美文网首页iOS逆向开发
<安全攻防之LLDB调试>

<安全攻防之LLDB调试>

作者: 高阿呆 | 来源:发表于2019-11-25 11:18 被阅读0次

    断点

    • 设置断点
    $breakpoint set -n xxx 
    set 是子命令
    -n 是选项 是--name的缩写
    或者
    $b xxx
    
    * 查看断点列表
    $breakpoint list 
    
    * 删除
    $breakpoint delete 组号
    
    * 禁用/启用
    $breakpoint disable 禁用
    $breakpoint enable  启用
    
    * 遍历整个项目中满足Hello:这个字符的所有方法
    $breakpoint set --selector Hello:
    $breakpoint set -r Hello:
    $breakpoint set --file xxx文件xxx --selector xxx方法名xxx
    
    E:在某一个文件(ViewController.m)中满足Hello:的所有方法
    $breakpoint set --file ViewController.m --selector Hello:
    
    $breakpoint  
    // 查看断点命令下所有的命令
         Commands for operating on breakpoints (see 'help b' for shorthand.)
    
    Syntax: breakpoint <subcommand> [<command-options>]
    
    The following subcommands are supported:
          // 清除或者废除匹配的特定的资源文件和哪一行的断点
          clear   -- Delete or disable breakpoints matching the specified source
                     file and line. 
          // 当断点触发时,添加.移除或者监听LLDB控制执行 
          command -- Commands for adding, removing and listing LLDB commands
                     executed when a breakpoint is hit. 
          //  删除特定的断点,如果没匹配到,删除所有断点
          delete  -- Delete the specified breakpoint(s).  If no breakpoints are
                     specified, delete them all. 
          // 使断点失效
          disable -- Disable the specified breakpoint(s) without deleting them.  If
                     none are specified, disable all breakpoints. 
          // 使断点有效
          enable  -- Enable the specified disabled breakpoint(s). If no breakpoints
                     are specified, enable all of them. 
          // 查看所有的断点
          list    -- List some or all breakpoints at configurable levels of detail. 
          // 修改
          modify  -- Modify the options on a breakpoint or set of breakpoints in
                     the executable.  If no breakpoint is specified, acts on the
                     last created breakpoint.  With the exception of -e, -d and -i,
                     passing an empty argument clears the modification. 
          name    -- Commands to manage name tags for breakpoints 
          read    -- Read and set the breakpoints previously saved to a file with
                     "breakpoint write".  
          // 设置
          set     -- Sets a breakpoint or set of breakpoints in the executable. 
          write   -- Write the breakpoints listed to a file that can be read in
                     with "breakpoint read".  If given no arguments, writes all
                     breakpoints.
    

    流程控制

    * 继续执行
    $continue c 
    * 单步运行,将子函数当做整体一步执行
    $n next
    * 单步运行,遇到子函数会进去
    $s 
    

    执行代码

    • help xxx 查看帮助文档 (E: help p)
    // 这三个命令是相同的
    (lldb) expression self.view.subviews
    (__NSArray0 *) $6 = 0x00000001cde73400 @"0 elements"
    (lldb) p self.view.subviews
    (__NSArray0 *) $7 = 0x00000001cde73400 @"0 elements"
    (lldb) e self.view.subviews
    (__NSArray0 *) $8 = 0x00000001cde73400 @"0 elements"
    (lldb) 
    
    p 插入自己写的代码
    p self.view.backgroundColor = [UIColor yellowColor]
    

    查看堆栈信息

    $bt
    $frame select xx 查看某个Frame的信息
    $frame variable 查看某个frame的参数信息
    

    内存断点

    // 对某个对象的某个属性设置内存断点(E:对p的name属性设置内存断点)
    $watchpoint set variable p->_name
    // 通过内存地址设置断点
    $watchpoint set expression xxx地址
    

    其他指令

    // 崩溃信息中通过地址信息查找崩溃原因
    $image lookup -a xxx
    $image lookup -t xxx对象 查看对象的成员变量
    $image list 查看所有的库列表
    

    常用指令

    $x (memory read xxx地址) 查看内存
    $register read xxx (寄存器查看)
    

    相关文章

      网友评论

        本文标题:<安全攻防之LLDB调试>

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