gdb cheat sheet

0x00 misc


gdb --args executablename arg1 arg2 arg3


0x01 控制流

r        run,运行程序。

r < a.txt      run,重定向输入

si         step instruction 进入函数

ni           next instruction 下一条指令

finish       执行到函数结束


0x02 断点

b        block,下断点

b *0x0000xx     在指定位置下断点

b main         在函数入口下断点

watch *0x00xx    当修改指定内存时中断

rwatch *0x00xx     当读取指定内存时中断

info b           查看当前断点

en 1 2 3       允许中断

dis 1 2 3         不允许中断


0x03 内存


x [Address expression]
x /[Format] [Address expression]
x /[Length][Format] [Address expression]

Address expression
Specifies the memory address which contents will be displayed. This can be the address itself or any C/C++ expression evaluating to address. The expression can include registers (e.g. $eip) and pseudoregisters (e.g. $pc). If the address expression is not specified, the command will continue displaying memory contents from the address where the previous instance of this command has finished.
If specified, allows overriding the output format used by the command. Valid format specifiers are:
  • o - octal
  • x - hexadecimal
  • d - decimal
  • u - unsigned decimal
  • t - binary
  • f - floating point
  • a - address
  • c - char
  • s - string
  • i - instruction

The following size modifiers are supported:

  • b - byte
  • h - halfword (16-bit value)
  • w - word (32-bit value)
  • g - giant word (64-bit value)

x /16xb 0x123123

x /s  0x123123123


0x04 LOAD信息


info files


posted @ 2019-04-29 17:26  Helica  阅读(216)  评论(0编辑  收藏