gdb常用的几个命令

官网:

http://www.gnu.org/software/gdb/documentation/


gdb

help x

x &var_name:输出变量

Examine memory: x/FMT ADDRESS.
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
  t(binary), f(float), a(address), i(instruction), c(char) and s(string).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.
Defaults for format and size letters are those previously used.
Default count is 1.  Default address is following last thing printed
with this command or "print".
e.g.: x/24w &a 输出变量a地址后的24个字. 4*24个字节的内容。


c: continue 继续执行
s: step into
n: next, step over

b: breakpoint,usage (b main,add a breakpoint as main func) 增加断点
l: list the source,列出源代码
bt: backtrace 显示栈中的内容,相当 于 CallStack

p: 输入变量名(p var_name)

info registers:输出寄存器内容

你可能感兴趣的:(gdb)