How to debug Xcode

Source: Internet
Author: User
Tags gdb debugger

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:

 
 
  1. continue    :    option + command + P  
  2. step Into   :     shift + command + I  
  3. step Over :      shift + command + O  
  4. step Out   :      shift + command + T 

Summary: How to explainDebug XcodeThe content of the program has been introduced. I hope this article will help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.