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:输出寄存器内容
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步