I'm trying to set a breakpoint that triggers anywhere within the scope of a viewController when a global variable takes certain value. So far I haven't found a way to do it because line breakpoints break at specific lines, symbolic breakpoints break at specific methods, and exception breakpoints break at, well, exceptions. But I just want the execution to stop at any point in the code without having to set a breakpoint at every line where I think it could happen. Any ideas?
我正在尝试设置一个断点,当全局变量获取特定值时,该断点会触发viewController范围内的任何位置。到目前为止,我还没有找到一种方法,因为行断点在特定行中断,符号断点在特定方法中断,异常断点断开,异常。但我只是希望执行在代码中的任何一点停止,而不必在我认为可能发生的每一行设置断点。有任何想法吗?
2 个解决方案
#1
3
You are describing a watchpoint, not a breakpoint. There is no user interface for setting a watchpoint on a global; you'll have to pause your running app and set it at the LLDB command-line:
您正在描述观察点,而不是断点。没有用于在全局设置观察点的用户界面;您必须暂停正在运行的应用程序并将其设置为LLDB命令行:
(lldb) watch set variable myGlobalVariable
#2
2
Could you add a didSet
observer to your variable and add a break-point inside that?
你可以在你的变量中添加一个didSet观察者并在其中添加一个断点吗?
Simon
西蒙
#1
3
You are describing a watchpoint, not a breakpoint. There is no user interface for setting a watchpoint on a global; you'll have to pause your running app and set it at the LLDB command-line:
您正在描述观察点,而不是断点。没有用于在全局设置观察点的用户界面;您必须暂停正在运行的应用程序并将其设置为LLDB命令行:
(lldb) watch set variable myGlobalVariable
#2
2
Could you add a didSet
observer to your variable and add a break-point inside that?
你可以在你的变量中添加一个didSet观察者并在其中添加一个断点吗?
Simon
西蒙