常用LLDB指令

  • print , p
    打印内存地址
(lldb) p a
(int) $0 = 10
(lldb) p obj
(NSObject *) $1 = 0x0000000100573f70
(lldb) print obj
(NSObject *) $2 = 0x0000000100573f70
  • po
    打印对象
(lldb) po a
10
(lldb) po obj

  • memory read 或者 x
    读取内存

(lldb) memory read 0x100573f70
0x100573f70: 41 d1 a9 8d ff ff 1d 00 00 00 00 00 00 00 00 00  A...............
0x100573f80: 50 40 57 00 01 00 00 00 90 42 57 00 01 00 00 00  [email protected].....

(lldb) x 0x100573f70

memory read后边可以增加数量、格式、字节数三个参数,
格式:x是16进制,f是浮点,d是10进制
字节大小:b:byte 1字节,h:half word 2字节,w:word 4字节,g:giant word 8字节

(lldb) memory read/4xg 0x100573f70
0x100573f70: 0x001dffff8da9d141 0x0000000000000000
0x100573f80: 0x0000000100574050 0x0000000100574290

(lldb) x/4xg 0x100573f70
  • memory write
    修改内存中的值
(lldb) memory write 0x100573f79 9
(lldb) x 0x100573f70
0x100573f70: 41 d1 a9 8d ff ff 1d 00 00 09 00 00 00 00 00 00  A...............
0x100573f80: 50 40 57 00 01 00 00 00 90 42 57 00 01 00 00 00  [email protected].....
  • register read
    读取寄存器
register read x0     //读取x0寄存器的值,这里不再需要附加$符号了
register read     //读取所有寄存器的值  
register write x10 100    //将寄存器的x10的值设置为100 
  • bt
    打印堆栈

你可能感兴趣的:(常用LLDB指令)