Printing Source Lines
list command
- list linenum
Print lines centered around line number linenum in the current source file. - list function
Print lines centered around the beginning of function function. - list
Print more lines. If the last lines printed were printed with a list command, this prints lines following the last lines printed; however, if the last line printed was a solitary line printed as part of displaying a stack frame (see Examining the Stack), this prints lines centered around that line. If no list command has been used and no solitary line was printed, it prints the lines around the function main. - list +
Same as using with no arguments. - list -
Print lines just before the lines last printed. - list .
Print the lines surrounding the point of execution within the currently selected frame. If the inferior is not running, print lines around the start of the main function instead.
Mix Source Code with Assembly
Tui
Enable tui
- Step0
gdb -q binary_program
-
Step1
Once the program has started, to enable TUI mode you can either use Ctrl+X+A or enter in tui enable into GDB to enter TUI mode.
TUI-specific Commands
https://sourceware.org/gdb/current/onlinedocs/gdb.html/TUI-Commands.html