[sysprof] preload: skip an additional stack frame



commit 87004f5d24d6120bcf0dce4826006d6f6836a72a
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 18 14:11:09 2020 -0800

    preload: skip an additional stack frame
    
    Now that we do some math here, we need to skip another frame to keep this
    more useful and not show everything inside of sysprof_collector_allocate().

 src/libsysprof/preload/sysprof-memory-collector.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/libsysprof/preload/sysprof-memory-collector.c 
b/src/libsysprof/preload/sysprof-memory-collector.c
index 557d5d3..6e1c632 100644
--- a/src/libsysprof/preload/sysprof-memory-collector.c
+++ b/src/libsysprof/preload/sysprof-memory-collector.c
@@ -82,9 +82,9 @@ backtrace_func (SysprofCaptureAddress *addrs,
    * and subtract an offset from addrs to avoid having to
    * copy frame pointers around.
    */
-  return unw_backtrace ((void **)addrs - 1, n_addrs) - 1;
+  return unw_backtrace ((void **)addrs - 2, n_addrs) - 2;
 # else
-  static const gint skip = 1;
+  static const gint skip = 2;
   void **stack = alloca (n_addrs * sizeof (gpointer));
   gint n = unw_backtrace (stack, n_addrs);
   for (guint i = skip; i < n; i++)
@@ -94,9 +94,9 @@ backtrace_func (SysprofCaptureAddress *addrs,
 #elif defined(HAVE_EXECINFO_H)
 # if GLIB_SIZEOF_VOID_P == 8
   /* See note on unw_backtrace() */
-  return backtrace ((void **)addrs - 1, n_addrs) - 1;
+  return backtrace ((void **)addrs - 2, n_addrs) - 2;
 # else /* GLIB_SIZEOF_VOID_P != 8 */
-  static const gint skip = 1;
+  static const gint skip = 2;
   void **stack = alloca (n_addrs * sizeof (gpointer));
   gint n = backtrace (stack, n_addrs);
   for (guint i = skip; i < n; i++)


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