Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make XCode break on any console output

I found this post which explains how to setup a conditional breakpoint in order to break on any printf function. What is the procedure to achieve something similar in XCode ? The purpose being obviously the debugger to stop when and where something tries to output anything in the console.

like image 506
Flavien Volken Avatar asked Jan 12 '13 14:01

Flavien Volken


People also ask

How do I create a breakpoint in Xcode?

Navigate to a line in your code where you want execution to pause, then click the gutter or line number in the source editor to set a breakpoint. Xcode displays a breakpoint icon to indicate the location. Drag a breakpoint up or down to move it to another location; drag it away from the gutter to remove it.

How do I enable breakpoints in Xcode?

Step 1 − To add an exception breakpoint, first move to breakpoint navigator in xcode. Step 2 − Click on the + option at the left bottom of the navigator and select Exception breakpoint. Once you select exception breakpoint, it will be added to our code.


1 Answers

You could add a breakpoint in NSLog using lldb console like this:

breakpoint set -n NSLog

You basically have to pause execution, write that command in the console and then resume the execution. For step-by-step instructions and a way to reuse the command have a look here.

like image 157
Rad'Val Avatar answered Nov 15 '22 08:11

Rad'Val