Reputation: 20153
I want to be able to specify a subset of all C++ exceptions for Xcode (lldb) to break upon. It looks like this is supported in the UI:
But for the life of me, I can't make it work. If I leave it set to the default "All C++ Exceptions", it works and every exception thrown triggers the breakpoint. If I attempt to specify an exception by name, the breakpoint is never triggered.
Has anyone else had issues with this, or is this just my problem?
Upvotes: 5
Views: 1748
Reputation: 5476
Despite the UI, lldb is unable to set breakpoints on specific C++ exceptions or it does not resolve the name correctly.
I set a breakpoint for std::underflow_error
and then using the lldb breakpoint list
command, determined it only places a symbolic breakpoint on std::underflow_error
:
9: name = 'std::underflow_error', locations = 0 (pending)
I suspect that lldb never resolves std::underflow_error
to the constructor. C++ name mangling might have something to do with it too.
If you create a breakpoint for all C++ exception, you will see it creates a symbolic breakpoint on __cxa_throw
:
10: name = '__cxa_throw', locations = 1, resolved = 1
10.1: where = libc++abi.dylib`__cxa_throw, address = 0x01cefa44, resolved, hit count = 0
You might be able to put a breakpoint in the constructor of the exception you are interested in, assuming it is instantiated and thrown at the same point.
Upvotes: 3