简体   繁体   English

Emacs / gud-gdb:显示失败时的断言位置

[英]Emacs/gud-gdb: show assert location on failure

When an assertion in my code fails, I get a backtrace like this from 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>
    ...

So in order to get to the actual point of failure I have to go ' up <RET> <RET> <RET> ', which seems a bit inefficient. 因此,为了到达实际的故障点,我必须up <RET> <RET> <RET> ,这似乎效率很低。 Is there a way to configure gdb to automatically go to #3 in the stack? 有没有一种方法可以配置gdb自动进入堆栈中的#3? 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. 我对在emacs中运行gdb特别感兴趣,因此,如果有一种配置gud的方法,那也可以。

I have to go 'up <RET> <RET> <RET>' 我必须'up <RET> <RET> <RET>'

You could do fr 3 instead. 您可以改为fr 3

Is there a way to configure gdb to automatically go to #3 in the stack? 有没有一种方法可以配置gdb自动进入堆栈中的#3?

I don't believe so. 我不相信

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM