How do I automatically set breakpoints on all methods in Xcode? I want to know how my program works, and which methods invoke when I interact with the user interface.
You can set a conditional break point in Xcode by setting the breakpoint normally, then control-click on it and select Edit Breakpoint (choose Run -> Show -> Breakpoints). In the breakpoint entry, there is a Condition column. Now, there are several issues to keep in mind for the condition.
Press F3 and then press F9 to add a breakpoint. This adds a breakpoint to the first method found using the trick.
To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint.
breakpoint set -r . -s <PRODUCT_NAME>
(insert your app's name).lldb will answer with something like...
Breakpoint 1: 4345 locations
Now just press the Continue button.
breakpoint set
is lldb's command to create breakpoints. The location is specified using a regular expression (-r
) on function/method names, in this case .
which matches any method. The -s
option is used to limit the scope to your executable (needed to exclude frameworks).
When you run your app lldb will now break whenever the app hits a function from your main executable.
To disable the breakpoints type breakpoint delete 1
(insert proper breakpoint number).
In some cases, it is more convenient to set breakpoints only on some of the methods.
Using LLDB we can put breakpoint on all ViewDidLoad methods by name, for example.
(lldb) breakpoint set -n ViewDidLoad
Here "-n" means by name.
Also, we can put breakpoints by selector name:
(lldb) breakpoint set -S alignLeftEdges:
Here "-S" means by selector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With