Emacs/gud-gdb:失败时显示断言位置
当代码中的断言失败时,我会从 gdb 得到如下回溯:
(gdb) bt
#0 0x00007ffff455b3a5 in __GI_raise (sig=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff455eb0b in __GI_abort () at abort.c:92
#2 0x00007ffff4553d4d in __GI___assert_fail (
assertion=0x123136d "<some failed test>", file=<optimized out>,
line=1573, function=<optimized out>) at assert.c:81
#3 <the actual place in my code where I called assert>
...
因此,为了到达实际的失败点,我必须“up
',这看起来效率有点低。有没有办法配置 gdb 自动转到堆栈中的#3?我对在 emacs 中运行 gdb 特别感兴趣,因此如果有一种方法可以配置 gud 来执行此操作,那也可以。
When an assertion in my code fails, I get a backtrace like this from gdb:
(gdb) bt
#0 0x00007ffff455b3a5 in __GI_raise (sig=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff455eb0b in __GI_abort () at abort.c:92
#2 0x00007ffff4553d4d in __GI___assert_fail (
assertion=0x123136d "<some failed test>", file=<optimized out>,
line=1573, function=<optimized out>) at assert.c:81
#3 <the actual place in my code where I called assert>
...
So in order to get to the actual point of failure I have to go 'up <RET> <RET> <RET>
', which seems a bit inefficient. Is there a way to configure gdb to automatically go to #3 in the stack? I'm specifically interested in running gdb in emacs, so if there's a way to configure gud to do it, that would work too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以执行
fr 3
。我不相信是这样。
You could do
fr 3
instead.I don't believe so.