Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb what file am I debugging

Tags:

debugging

gdb

I'm using gdb's next n command, and when I stop, I usually write finish to know in which file I landed:

(gdb) finish
Run till exit from #0  klee::Executor::executeAlloc (this=0x5555577dfaf0, ...) at 
/home/oren/GIT/klee/str.klee/klee/lib/Core/Executor.cpp:3218

Is there a more elegant way to know which file am I debugging right now?

I mean something like:

(gdb) next 100
3
3194                   true);
(gdb) whereami
/home/oren/GIT/klee/str.klee/klee/lib/Core/Executor.cpp:3194

My current method makes me run everything twice ...

like image 504
OrenIshShalom Avatar asked Nov 30 '25 15:11

OrenIshShalom


1 Answers

I think the backtrace command does what you want:

(gdb) backtrace 1
#0  0x00007ffff76ed441 in __pselect (nfds=1, readfds=0x7fffffffcc00, 
    writefds=0x0, exceptfds=0x0, timeout=<optimized out>, 
    sigmask=0x7fffffffcb80) at ../sysdeps/unix/sysv/linux/pselect.c:69
like image 121
Florian Weimer Avatar answered Dec 02 '25 07:12

Florian Weimer