Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

debugging

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?

like image 719
Yogeshwer Sharma Avatar asked Oct 25 '25 05:10

Yogeshwer Sharma


1 Answers

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.

like image 74
ks1322 Avatar answered Oct 26 '25 22:10

ks1322