OC底层原理00:LLDB常用命令

张建 lol

x 对象:以 16 进制,打印对象的内存分布,位数为 16

1
2
3
(lldb) x p
0x100792110: 75 32 00 00 01 80 1d 00 00 00 00 00 00 00 00 00 u2..............
0x100792120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

memory read 对象:以 16 进制,打印对象的内存分布,和1一样,位数为 16

1
2
3
(lldb) memory read p
0x100792110: 75 32 00 00 01 80 1d 00 00 00 00 00 00 00 00 00 u2..............
0x100792120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

x/4gx 对象:以 16 进制,打印 4段 对象的内存分布情况,位数为 16

1
2
3
(lldb) x/4gx p
0x100792110: 0x001d800100003275 0x0000000000000000
0x100792120: 0x0000000000000000 0x0000000000000000

x/4gw 对象:以 16 进制,打印 4段 对象的内存分布情况,位数为 16

1
2
(lldb) x/4gw p
0x100792110: 0x00003275 0x001d8001 0x00000000 0x00000000

po 对象:输出对应的值

1
2
(lldb) po p
<LGPerson: 0x100792110>

p 对象:返回值的类型以及命令结果的引用名,将地址 0x0000000100792110 放到 寄存器$5

1
2
(lldb) p p
(LGPerson *) $5 = 0x0000000100792110

p/x:以16进制的形式,打印类信息

1
2
(lldb) p/x p
(LGPerson *) $6 = 0x0000000100792110
  • Post title:OC底层原理00:LLDB常用命令
  • Post author:张建
  • Create time:2020-09-01 23:31:27
  • Post link:https://redefine.ohevan.com/2020/09/01/OC底层原理/OC底层原理00:LLDB常用命令/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.