美文网首页
常用LLDB指令

常用LLDB指令

作者: MrDemon_ | 来源:发表于2021-01-28 23:47 被阅读0次
    • 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
    <NSObject: 0x100573f70>
    
    • memory read 或者 x
      读取内存
    <NSObject: 0x100573f70>
    (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  P@W......BW.....
    
    (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  P@W......BW.....
    
    • register read
      读取寄存器
    register read x0     //读取x0寄存器的值,这里不再需要附加$符号了
    register read     //读取所有寄存器的值  
    register write x10 100    //将寄存器的x10的值设置为100 
    
    • bt
      打印堆栈

    相关文章

      网友评论

          本文标题:常用LLDB指令

          本文链接:https://www.haomeiwen.com/subject/ptsftltx.html