steipete steipete - 3 months ago 56
Objective-C Question

Prevent "Execution was interrupted, reason: internal ObjC exception breakpoint(-3)" on lldb

I've written some code that dumps all ivars of a class into a dictionary (for ObjC). This uses

valueForKey:
to get the data from the class. Sometimes, KVC throws an internal exception that is also captured properly - but this disrupts lldb's feature and all I get is:


error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3)..
The process has been returned to the state before expression evaluation.


There are no breakpoints set. I even tried with
-itrue -ufalse
as expression options, but it doesn't make a difference. This totally defeats for what I want to use lldb for, and it seems like such a tiny issue. How can I bring clang to simply ignore if there are internal, captured ObjC exceptions while calling a method?

I tried this both from within Xcode, and directly via calling clang from the terminal and connecting to a remote debug server - no difference.

Answer

I ran into the same issue. My solution was to wrap a try/catch around it (I only use this code for debugging). See: DALIntrospection.m line #848

NSDictionary *DALPropertyNamesAndValuesMemoryAddressesForObject(NSObject *instance)

Or, if you're running on iOS 7, the private instance method _ivarDescription will print all the ivars for you (similar instance methods are _methodDescription and _shortMethodDescription).

Comments