Open aytey opened 3 years ago
Okay, so changing:
#define BACKWARD_HAS_LIBUNWIND 0
#define BACKWARD_HAS_UNWIND 1
to
#define BACKWARD_HAS_LIBUNWIND 1
#define BACKWARD_HAS_UNWIND 0
gives me better traces:
Stack trace (most recent call last):
#3 Source "../sysdeps/x86_64/start.S", line 120, in _start
#2 Object "/lib64/libc-2.33.so", at 0x7fea802d8b24, in __libc_start_main
#1 Source "./main.cpp", line 44, in main
41: #ifdef USE_HANDLERS
42: setup_handlers();
43: #endif
> 44: do_it();
45: return 0;
46: }
#0 Source "./unit.cpp", line 13, in mthd
10: int cls::mthd() {
11: b g;
12: f = (d *)&g;
> 13: f->e(1, 1);
14: return 1;
15: }
16: void do_it() {
Interestingly, I took the defines from CMakeFiles/test_stacktrace.dir/flags.make
, which uses BACKWARD_HAS_UNWIND
over BACKWARD_HAS_LIBUNWIND
.
gdb might be looking for the debug symbols in the various .debug
directories.
https://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html
tl;dr:
backward-cpp
gives incomplete stack-traces (whilegdb
gives complete ones); I'm trying to understand if this is solvable.Problem
I'm experiencing an issue where
backward-cpp
gives me a stack-trace like this:while
gdb
gives me a stack-trace like this:Notice:
gdb
hasdo_it
andcls::mthd
, whilebackward-cpp
does not.This is an example I have found "in the wild", but some of my stack-traces are correct (I'm saying this because I believe I am using
backward-cpp
correctly; e.g., using the correct defines/link flags).Question
Is it possible to get
backwards-cpp
to give better (/"more correct") stack-traces here?Example code
When I found this issue, I used https://github.com/marxin/cvise to automatically construct my "failing test-case" (if the code looks weird, maybe it is, but it is derived from valid code that displays the same behaviour; I'm actually surprised that this code links, given there's no definition of
d::e
).unit.cpp
main.cpp
Compilation
Output
When using "manual" signal handlers (i.e.,
p.print(st);
)stderr
viabackward-cpp
gdb
When using "automatic" signal handlers (i.e.,
backward::SignalHandling sh
)stderr
viabackward-cpp
gdb
System specifics
Library versions
backward-cpp
@ 9f4b0ddlibelf-devel
@ 0.183-2.1libdw-devel
@ 0.183-2.1libunwind-devel
@ 1.5.0-1.3