Emacs/gud-gdb: show assert location on failure

258 views Asked by At

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.

1

There are 1 answers

0
Employed Russian On

I have to go 'up <RET> <RET> <RET>'

You could do fr 3 instead.

Is there a way to configure gdb to automatically go to #3 in the stack?

I don't believe so.