DetailsXcode debugging exceptionThis document describes how to quickly locate the row where code errors occur. There is not much content, but they are all on the page. Let's look at the content directly.
Many timesDebuggingWhen the program is running, we would like to immediately know which line of the error code is. Instead of setting a breakpoint, line-by-line debugging can find out which line of code is causing program crash. You can use the following method to quickly locate the problem code.
Select Run> Show> Breakpoints to go To the breakpoint window.
Xcode breakpoint window
First, you must create a breakpoint for-[NSException raise. Select Global Breakpoints, Double-click for Symbol, enter-[NSException raise], and press return.
After the breakpoint-NSException raise is added
Next, add another Global breakpoint objc_exception_throw according to the preceding steps.
When an exception occurs in a running program, the debugger stops running the program and points to the problematic code line.
Expanded content:
There are two methods: Brute Force debugging and debugger debugging.
What is brute force debugging?
Brute-force debugging adds NSLog to your program to output control processes and important data of the program to the terminal.
Debugger debugging:
The debugger is a program between the application you write and the operating system. It can control your program, such as stop, execute, and single-step tracking.
The debugger used by Xcode is GDB.
In addition to GDB, Xcode also has a micro-debugger, which is a floating window through which we can skip the GDB debugger for some simple debugging.
Xcode has a debugging window that provides a large amount of summary information.
Xcode provides a debugging console through which Debugging commands can be directly sent to the debugger.
Summary: DetailsXcode debugging exceptionI hope this article will help you! For more information, see edit recommendations.