GDB

gdblldb含义
p *data@10mem read -tdouble -c10 dataprint array content
info threadsthread listall threads
thread 2thread select 2jump to thread
info break
dis 1break dis 1disable breakpoints
del 1break del 1delete breakpoints
ccontinue
info localframe variableall local variables
info args
disp ${var}display var
undisp var

step

  • s, step one line 会进入子函数调用
  • n, next line 不会进入子函数调用
  • u, Until the next line forward from the current line (so let an already- visited loop run through until forward progress).
  • c, continue 到下一个断点
  • j 105, jump to 任意行
  • ret 3, 以指定值返回当前函数

查看指定内存地址的指令

MacOS 安装

1
2
3
4
5
6
7
brew install gdb

之后安装证书,然后

codesign --entitlements gdb-entitlement.xml -fs gdb-cert /usr/loacl/bin/gdb

echo "set startup-with-shell off" >> ~/.gdbinit