【问题标题】:Load LLDB commands into XCode将 LLDB 命令加载到 XCode
【发布时间】:2015-08-24 16:17:39
【问题描述】:

是否有人将命令加载到 LLDB 以用于 XCode 应用程序的调试会话。 我在 XCode 6.1.1 和 iOS 8.x 中

我不懂任何 Python,所以我非常希望避免涉及 Python。 我想从一个文件中加载我手动输入的这些内容,这样我就不必在每次重新运行调试会话时一遍又一遍地输入它...

(lldb) breakpoint set --func-regex "SomeClass"
Breakpoint 10: 48 locations.
(lldb) breakpoint set --func-regex "AnotherClass"
Breakpoint 11: 15 locations.
(lldb) breakpoint set --func-regex "ThisClass"
Breakpoint 12: 15 locations.
(lldb) breakpoint set --func-regex "ThatClass"
Breakpoint 13: 57 locations.
(lldb) breakpoint set --func-regex "OurClass"
Breakpoint 14: 98 locations.
(lldb) breakpoint set --func-regex "YourClass"
Breakpoint 15: 22 locations.
(lldb) breakpoint set --func-regex "HerClass"
Breakpoint 16: 17 locations.
(lldb) breakpoint set --func-regex "HisClass"
Breakpoint 17: 46 locations.
(lldb) breakpoint set --func-regex "TheyreClass"
Breakpoint 18: 63 locations.

(lldb) breakpoint command add 10
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 11
Enter your debugger command(s).  Type 'DONE' to end.
> frame info; continue; DONE
> DONE
(lldb) breakpoint command delete 11
(lldb) breakpoint command add 11
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 12
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 13
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 14
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 15
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 16
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 17
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE
(lldb) breakpoint command add 18
Enter your debugger command(s).  Type 'DONE' to end.
> frame info
> continue
> DONE

谢谢

【问题讨论】:

    标签: ios xcode lldb


    【解决方案1】:

    一种方法是在应用程序的 main() 函数上设置断点,并通过 Xcode UI 绑定它以执行表单的调试器命令

    command source <myMagicFile>
    

    然后自动继续

    然后该文件将包含您要执行的命令,并且由于断点位于 main() 上,因此每次开始调试应用程序时都会加载您的文件并执行命令

    作为提示,添加每个断点然后直接执行断点命令添加可能更安全。断点命令 add 将自动引用您创建的最后一个断点,因此您不必依赖断点 ID

    例如:

    breakpoint set --func-regex "SomeClass"
    breakpoint command add
    Enter your debugger command(s).  Type 'DONE' to end.
    > frame info
    > continue
    > DONE
    breakpoint set --func-regex "AnotherClass"
    

    [...]

    【讨论】:

      猜你喜欢
      • 2014-07-20
      • 2021-03-07
      • 2012-09-23
      • 2021-02-08
      • 2017-03-28
      • 2016-05-27
      • 1970-01-01
      • 2022-12-10
      • 2021-02-14
      相关资源
      最近更新 更多