Exception in Xcode debugging

Source: Internet
Author: User

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.

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.