Maxim
Maxim

Reputation: 355

How to debug when gdb itself crashes?

I have a crash (segmentation fault) but I'm having trouble finding where it occurs, because the gdb crashes as soon as try to bt or frame #. This happens on different systems (tried CentOS 7 and Ubuntu 17.04) so it doesn't seem like a specific version.

Are there any other debuggers I could use, or is there a way to make gdb more stable?

Upvotes: 0

Views: 2504

Answers (1)

Employed Russian
Employed Russian

Reputation: 213576

Are there any other debuggers I could use

There is LLDB you could try.

is there a way to make gdb more stable?

The magic "--run-without-bugs" flag ;-)

Seriously, any crash in GDB is a bug, and you should report it in the GDB bugzilla.

If you can't supply a reproducible test case, you can at least run GDB under itself, and figure out where it is crashing:

gdb -ex 'set prompt (top) ' -ex run --args gdb -ex run /path/to/your/a.out
... your program will crash, you will get (gdb) prompt
(gdb) where
... now GDB will crash, and you will get "outer" GDB (top) prompt
(top) where
... you should get a stack trace for the "inner" GDB crash.

Upvotes: 4

Related Questions