Yes, use symbolic breakpoints to break NSLog or std::cout . If you are dealing with C ++ or Swift code, you can even break certain errors or exceptions. To add symbolic breakpoints to your project, you must do the following:
- Go to the breakpoint navigator by clicking the icon that looks like a thick right arrow in the navigation area (in Xcode 8, counting the second icon to the right of the panel to the left of the editor)
- Click the + button in the lower left corner of the window
- Select Symbolic Breakpoint in the pop-up menu.
- Add the character you want to split (examples: in C ++,
std::cout ; in the C object: -[NSObject(NSObject) doesNotRecognizeSelector:] ; in C or Swift, CGErrorBreakpoint() - Important note - avoid pasting any free space unfortunately, the formatting here puts - [character] in different lines, but there should not be spaces between ObjC characters between - and [ - If you know what a library is that gives you sadness, fill out the module field
- Click the action button and select Debugger Command from the popup menu
- In the text box below, enter
bt to get a backtrace every time you click this character - If you do not want to stop execution after reaching the first breakpoint, select the Automatically continue after evaluating actions check box.
If your library throws a C ++ exception, you can do it. Just select this option when you press the + button. To learn more about how to set breakpoints in Xcode, follow these steps:
http://help.apple.com/xcode/
And go to: Start and debug > Set breakpoints > Pause execution when events occur
jvarela
source share