Reputation: 3837
While debugging some code in gdb, I want to see which line will be executed if I say next
or step
.
l
, but if I say l
a couple times (and don't remember how many times), then l
does not print the line that will be executed. I am wondering if I am missing a simple command in gdb which shows me the current line the debugger is stopped at?
Upvotes: 4
Views: 6436
Reputation: 35708
To see the current line the debugger stopped at, you can use frame
command with no arguments. This achieves the same effect as update
command. It works both in tui
and command line mode.
Upvotes: 3
Reputation: 20838
You can use
list *$eip
or the shorter form
l *$eip
This will instruct gdb to print the source lines near the current program counter.
Upvotes: 2
Reputation: 83
You can say l +0
; the current line will be the first one listed.
The command l +offset
lists the code starting from offset
lines from the current line.
Note that, if you have already used the list
command, the current line will have changed, i.e., it will no longer be the next executing line. So this will only work on your first list
command.
Upvotes: 1
Reputation: 213406
It sounds like you want to run GDB
in Emacs
(which will show you current file and mark the current line), in DDD
, or in tui
mode.
Upvotes: 0