[sysprof/wip/chergert/control-fd] capture: allow null backtrace func



commit d42c6b2e5d86b53766e0b52d9a08340b8dd2506a
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 11 17:00:57 2020 -0800

    capture: allow null backtrace func

 src/libsysprof-capture/sysprof-capture-writer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c
index 22f0bfb..e40174f 100644
--- a/src/libsysprof-capture/sysprof-capture-writer.c
+++ b/src/libsysprof-capture/sysprof-capture-writer.c
@@ -1307,7 +1307,10 @@ sysprof_capture_writer_add_allocation (SysprofCaptureWriter  *self,
   ev->tid = tid;
   ev->n_addrs = 0;
 
-  n_addrs = backtrace_func (ev->addrs, MAX_UNWIND_DEPTH, backtrace_data);
+  if (backtrace_func != NULL)
+    n_addrs = backtrace_func (ev->addrs, MAX_UNWIND_DEPTH, backtrace_data);
+  else
+    n_addrs = 0;
 
   if (n_addrs <= MAX_UNWIND_DEPTH)
     ev->n_addrs = n_addrs;


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