[sysprof] callgraph: fix loading of stacks coming from backtrace()



commit 14973bc2b915aad65608b50921e17ae9f8014baf
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 26 09:31:31 2020 -0800

    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 3b2c832..1e146d9 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]