Closed sigidagi closed 4 months ago
Thanks for opening this, sorry to see you’re running into issues. It’s probably some edge case I didn’t handle in the demo (unfortunately even for demo purposes this is super tricky). I’ll look into this this evening.
Hi Jeremy,
It seems that I needed pipe to signal_tracer
program (After investigating signal_demo source code).
sigis:app-debug$ ./signal_demo | ./signal_tracer
SIGSEGV occurred:
Stack trace (most recent call first):
#0 0x5647635202cd0000 in handler(int, siginfo_t*, void*) at /home/sigis/prg/cpp/cpptrace/test/signal_demo.cpp:42:25
#1 0x7f05c483c45f0000 at /lib/x86_64-linux-gnu/libc.so.6
#2 0x5647635202450000 in trace() at /home/sigis/prg/cpp/cpptrace/test/signal_demo.cpp:16:24
#3 0x5647635202580000 in bar() at /home/sigis/prg/cpp/cpptrace/test/signal_demo.cpp:20:5
#4 0x5647635202680000 in foo() at /home/sigis/prg/cpp/cpptrace/test/signal_demo.cpp:24:5
#5 0x5647635204ac0000 in main at /home/sigis/prg/cpp/cpptrace/test/signal_demo.cpp:98:5
#6 0x7f05c4823a8f0000 in __libc_start_call_main at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#7 0x7f05c4823b480000 in __libc_start_main_impl at ./csu/../csu/libc-start.c:360:3
#8 0x5647635201740000 at /home/sigis/prg/cpp/cpptrace/build/app-debug/signal_demo
Stack trace (most recent call first):
<empty trace>
Best regards.
Hi, sorry I didn’t look lat night. You shouldn’t have to pipe like that, one of the points of signal_demo is that it handles the forking and piping to the signal_tracer. I’ll look tonight. As a side note I have no idea how that snippet you sent worked since it should never write to stdout.
Ah, I see the problem. It needs to be ./signal_demo
not ./build/signal_demo
because the program forks + exec's signal_tracer expecting that program to be in the current working directory.
./signal_demo | ./signal_tracer
works because it's not ./build/
but also notice the double Stack trace (most recent call first):
: The first one, the populated trace, is from the process's own exec'd signal_tracer process while the empty trace is from the | ./signal_tracer
which gets no input from stdin because signal_demo
doesn't write to stdout.
Hi, I'm using Linux Ubuntu 22.04
Because signal-safe stack unwinding is only possible with
libunwind
, which must be manually enabled, I've applied such configuration:also checked that
libunwind-dev
is installed on my machine:I can build library and tests without any issues, but running demo, there is no debug output in the console.
What I am missing?