Why a breakpoint is not set
A breakpoint is set, but it does not fall because ...
and why didn’t I get the stack?
... you are apparently debugging the wrong process.
With set follow-fork-mode child
GDB will follow the first child you created. Did you create more than one?
One way to debug is to install the SIGSEGV
handler using signal
or sigaction
.
In the handler, do the following:
void handler(int signo) { int i = 1; fprintf(stderr, "pid=%d, got signal=%d\n", getpid(), signo); while (i) { } }
As soon as you see the message printed in another window:
gdb /proc/<pid>/exe <pid> (gdb) where
source share