lldb: Breakpoint on exceptions (equivalent of gdb's catch throw)

前端 未结 3 1428
别那么骄傲
别那么骄傲 2021-01-31 14:04

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 documen

相关标签:
3条回答
  • 2021-01-31 14:53

    I think breakpoint set -w <boolean> is the correct answer, you can use help breakpoint set to see the document.

    0 讨论(0)
  • 2021-01-31 14:58

    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++.

    0 讨论(0)
  • 2021-01-31 15:05

    Use break set -E c++ to break on all exceptions and break set -F std::range_error to break on a specific exception.

    0 讨论(0)
提交回复
热议问题