0

我遇到了崩溃(分段错误),但我无法找到它发生的位置,因为 gdb 在尝试bt或时立即崩溃frame #。这发生在不同的系统上(尝试过 CentOS 7 和 Ubuntu 17.04),所以它看起来不像一个特定的版本。

有没有我可以使用的其他调试器,或者有没有办法让 gdb 更稳定?

4

1 回答 1

2

还有其他我可以使用的调试器吗

你可以试试LLDB 。

有没有办法让 gdb 更稳定?

神奇的“--run-without-bugs”标志;-)

严重的是,GDB 中的任何崩溃都是一个错误,您应该在 GDB buganizer 中报告它。

如果您不能提供可重现的测试用例,您至少可以在 GDB 下运行 GDB,并找出崩溃的位置:

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.
于 2019-04-11T02:49:18.400 回答