GDB高阶使用方法

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


    image.png

TUI-specific Commands

https://sourceware.org/gdb/current/onlinedocs/gdb.html/TUI-Commands.html

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容