I am trying to use lldb for c++ debugging and I want to halt if an exception is thrown, like gdb's catch throw
, and I cannot find an equivalent in the lldb documentation.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
In Xcode, you can set an Exception breakpoint (View > Navigators > Show Breakpoint Navigator, hit the + button in the bottom of the breakpoint list window to add a new breakpoint).
If you're using command line lldb, put a breakpoint on __cxa_throw
for C++ exception throws, objc_exception_throw
for Objective-C exception throws.
For all c++ exceptions: break set -E C++
.
回答2:
Use break set -E c++
to break on all exceptions and break set -F std::range_error
to break on a specific exception.
回答3:
I think breakpoint set -w <boolean>
is the correct answer, you can use help breakpoint set
to see the document.
And I fall into another question:how to set boolean value in lldb command line?
hoping any one can help me. the question was asked at here.