In Xcode, is there a way to bypass the "All Exceptions" breakpoints for just one or a few lines?

This line of code is slowly confusing me:

NSDictionary* rectangle3FontAttributes = @{NSFontAttributeName: [UIFont fontWithName: @"TrajanPro3-Regular" size: 18], NSForegroundColorAttributeName: theCoverLogoColor, NSParagraphStyleAttributeName: rectangle3Style};

      

... which for some reason raises an inner exception. The program continues without issue, but my exception checkpoint catches it every time the viewport changes the file I was looking at, and requires me to click continue for each ... one ... run.

Is there a pragma or something to bypass the exception breakpoints for multiple lines?

FYI, it's not even NSException

. It is listed on the call stack as __cxa_throw

callableTFFileDescriptorContext(char const *)

+3


source to share


2 answers


If you are not debugging C ++ code, or are simply not interested in C ++ exceptions, include only ObjC exceptions, then you won't hit it.

If this is not the case, you can write breakpoint-based Python commands in lldb (although you cannot yet save them in the breakpoint editor). It is very easy to make a Python command that restarts the debugger based on the callers of the current stop. Here's an example of a simple Python based breakpoint command in the docs:

http://lldb.llvm.org/python-reference.html

You need to do something like:

def AvoidTTFileDescriptorContext(frame, bp_loc, dict):
    parent = frame.thread.frames[1]
    if parent.name == "TFFileDescriptorContext":
        return False
    else:
        return True

      

Place this function in, say, ~ / lldb_bkpt_cmds.py.



The exception breakpoint is a normal breakpoint, so if you do:

(lldb) break list

      

in the Xcode console you can find it. Let's say it's breakpoint 1, then do:

(lldb) command script import ~/lldb_bkpt_cmds.py
(lldb) break command add -F lldb_bkpt_cmds.AvoidTTFileDescriptorContext 1

      

Then Xcode will automatically continue when it hits that breakpoint and the caller name is TFFileDescriptorContext.

+2


source


I'm not 100% sure you are looking at this, but there is a control named Ignore in Edit.



enter image description here

+1


source







All Articles