Search code examples
debugginggdb

How to see which line of code "next" would execute in gdb?


While debugging some code in gdb, I want to see which line will be executed if I say next or step.

  • Of course I can say 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 can also scroll back to the last time gdb stopped and see which line it was at, but that sometimes involve digging through a bunch of output.

I am wondering if I am missing a simple command in gdb which shows me the current line the debugger is stopped at?


Solution

  • 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.