ssett / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Stack trace capturing method should be runtime-selectable #604

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Due to various issues it might be useful to be able to select stacktrace 
capturing method at runtime.

I.e. libunwind might deadlock, but stacktrace_x86-inl.h requires 
-fframe-pointers, etc.

Original issue reported on code.google.com by alkondratenko on 9 Feb 2014 at 1:56

GoogleCodeExporter commented 9 years ago
Code is here: https://github.com/alk/gperftools/tree/wip-selectable-backtracing

Original comment by alkondratenko on 9 Feb 2014 at 2:43

GoogleCodeExporter commented 9 years ago
Hi, thanks for the path. It does look good, you just forgot the adds guards for 
the case systme does not have libunwind-dev installed. With this following 
patch, it builds in the aforementioned case:

diff --git a/src/stacktrace.cc b/src/stacktrace.cc
index 327711e..98da963 100644
--- a/src/stacktrace.cc
+++ b/src/stacktrace.cc
@@ -90,12 +90,14 @@ struct GetStackImplementation {
 #define HAVE_GST_generic
 #endif

+#ifdef HAVE_LIBUNWIND_H
 #define STACKTRACE_INL_HEADER "stacktrace_libunwind-inl.h"
 #define GST_SUFFIX libunwind
 #include "stacktrace_impl_setup-inl.h"
 #undef GST_SUFFIX
 #undef STACKTRACE_INL_HEADER
 #define HAVE_GST_libunwind
+#endif

 #if defined(__i386__) || defined(__x86_64__)
 #define STACKTRACE_INL_HEADER "stacktrace_x86-inl.h"

Original comment by zatr...@gmail.com on 10 Feb 2014 at 4:33

GoogleCodeExporter commented 9 years ago
merged updated patch. Thanks for feedback.

Original comment by alkondratenko on 17 Feb 2014 at 4:02