LLDB指令

作者: 风雨彩虹_123 | 来源:发表于2021-07-12 19:30 被阅读0次

    <command> [<subcommand> [<subcommand>...]] <action> [-options [option value]] [argument [argument...]]

    例如 : breakpoint set -n palyVideoMethod 给palyVideoMethod方法添加断点

    <command> :命令 breakpoint

    [<subcommand> [<subcommand>...]] : 子命令

    <action> : 命令操作 set

    [-options [option value]] : 命令选项 -n

    [argument [argument...]] : 命令参数 palyVideoMethod

    [] : 表示命令是可选的,可有可无。

    expression : 执行一个表达式,并将表达式返回的结果输出

    //在运行过程中,想把view的颜色改成红色看看效果
    expression self.view.layer.backgroundColor = UIColor.redColor.CGColor

    //打印对象地址
    expression self.view

    //打印对象
    expression -O -- self.view

    p & print & call 可以替换 expression ,使用的效果与用法是一样的

    po 可以替换 expression -O -- ,打印对象

    // 打印线程堆栈信息
    thread backtrace 可以简写为bt

    //让函数直接返回,不执行断点后面的代码
    thread return [表达式] 表达式可以省略

    //打印当前栈帧的变量
    frame variable [指定变量] 指定变量可以省略

    // 程序继续运行
    thread continue、continue、c

    //源码级别单步运行,把子函数当做整体一步执行
    thread step-over、next、n

    //源码级别单步运行,遇到子函数会进入子函数
    thread step-in、step、s

    //直接执行完当前函数的所有代码,返回到调用处
    thread step-out、finish

    //汇编指令级别单步运行,把子函数当做整体一步执行
    threadstep-inst-over、nexti、ni

    //添加断点
    breakpoint set -n 函数名
    breakpoint set -a 函数地址
    breakpointset-r 正则表达式

    //列出所有断点
    breakpoint list

    //查看某个断点设置的命令
    breakpoint command list 断点编号

    //删除某个断点设置的命令
    breakpoint command delete 断点编号

    //断点操作
    breakpoint disable 断点编号 : 禁用断点
    breakpoint enable 断点编号 : 启用断点
    breakpoint delete 断点编号 : 删除断点
    breakpoint command add 断点编号 : 给断点预先设置需要执行的命令,到触发断点时,就会按顺序执行

    //在内存数据发生改变的时候触发
    watchpoint set variable 变量
    watchpoint set expression 地址

    //列出内存断点
    watchpoint list

    //断点操作
    watchpoint disable 断点编号 : 禁用断点
    watchpoint enable 断点编号 : 启用断点
    watchpoint delete 断点编号 : 删除断点
    watchpoint command add 断点编号 : 给断点预先设置需要执行的命令,到触发断点时,就会按顺序执行

    //查看某个断点设置的命令
    watchpoint command list 断点编号

    //删除某个断点设置的命令
    watchpoint command delete 断点编号

    //打印加载的模块信息
    image list

    //根据内存地址查找在模块中的位置,在查找奔溃是使用
    image lookup -a 地址

    相关文章

      网友评论

        本文标题:LLDB指令

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