DetailsDebug XcodeThe program is the content to be introduced in this article. Let's talk about it. There are two ways to solve the problem of long-standing debugging: first, brute force.DebuggingThe second is to use the 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.
How to debug with a debugger?
1) the Debug configuration of the compiler must be used to compile the program. In this way, the compiled program contains the debugging information used by the debugger)
2) The program must be run in Debugger Mode during debugging.
There are two methods to Run the program in Xcode: run-> Run (shortcut: command + R), without the need to run the program using a debugger;
Run-> Go (Debug) or Run-> Debug (shortcut: command + Y), Run the program using the debugger.
3) breakpoint operations
How do I set breakpoints?
Click on the edge column gutter) to set a blue breakpoint. Click it to disable the breakpoint. If you want to delete the breakpoint, drag the breakpoint out of the edge column.
Debugging shortcut:
- continue : option + command + P
- step Into : shift + command + I
- step Over : shift + command + O
- step Out : shift + command + T
Summary: How to explainDebug XcodeThe content of the program has been introduced. I hope this article will help you!