From 14973bc2b915aad65608b50921e17ae9f8014baf Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 26 Feb 2020 09:31:31 -0800 Subject: [PATCH] callgraph: fix loading of stacks coming from backtrace() --- src/libsysprof/sysprof-callgraph-profile.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libsysprof/sysprof-callgraph-profile.c b/src/libsysprof/sysprof-callgraph-profile.c index 3b2c832c..1e146d99 100644 --- a/src/libsysprof/sysprof-callgraph-profile.c +++ b/src/libsysprof/sysprof-callgraph-profile.c @@ -382,6 +382,13 @@ sysprof_callgraph_profile_generate_worker (GTask *task, } else { + /* In case we get plain backtraces that aren't coming from perf, + * we might never get a context switch into user-space. This ensures + * that we still get traces for things from backtrace(). + */ + if (last_context == SYSPROF_ADDRESS_CONTEXT_NONE) + last_context = SYSPROF_ADDRESS_CONTEXT_USER; + for (guint j = 0; j < resolvers->len; j++) { SysprofSymbolResolver *resolver = g_ptr_array_index (resolvers, j);