LLDB for iOS debugging

Source: Internet
Author: User

LLDB for iOS debugging
Brief Introduction

LLDB is an open-source debugging tool built into XCode. It can install C ++ or Python plug-ins. Corresponding to LLDB is gdb, which mainly exists in program debugging tools based on UNIX platforms.

Usage

During development, we often need to debug code. print and NSLog output are the most used. This method is not very efficient to some extent. The introduction of LLDB replaces the printing function in some cases, improve test efficiency.

Usage 1. help

The role of the help command is self-evident. When we encounter a command that does not know how to use it, we can use the help command to call the system command introduction document to learn more details.

For example:

                    help print

Print out the specific help parameter usage in detail

2. print

The usage of the print command is self-evident and can be used to print a value.

Or p (variable name)

3. expression

When we want to change the value of a variable, the expression command is used to simplify it to expr, e

You can also use the print command to print

We can clearly compare the difference between print and expression: print does not change the actual parameter value, and the simulated variable is called the value you want, while expression is different, it actually changes the value of the variable.

4. process continue command

For short, continue or c.
In the same way as the first button above, cancel the program pause and allow the program to continue running.

5. thread step-over command

Next for short, or n

The role is to execute a line of code in the black box mode. If a function is encountered, the function will be executed, instead of just jumping into a line of code in the function.

6. thread step in command

Step or s

This command can be used when we want to jump into a function and debug the program step by step. If the current row is not a function, this command is consistent with the 5. thread step-over command.

7. step out command

When we want to jump out of a function, we can use this command.

8. frame info command

Running this command will tell you the current number of lines, the source code file, and other information.

9. Thread Return command

Sometimes we do not want to execute the code of a function for debugging. We can use this command to directly return the value of this function at the beginning of the function, so that the Code after the function will not have a chance, the execution directly gives the personal return value. This command is too powerful. You must be careful when using it. It is a pseudo-loader and an absolute pseudo-loader.

10. breakpoint list

Br li for short

Obtain and print the specific position and information of the breakpoint in the project.

11. breakpoint enable and breakpoint disable

Enable or disable a specific breakpoint

12 breakpoint set

Manual breakpoint Creation

The above is the most common LLDB command. Is it so powerful that LLDB can replace the inefficient NSLog Function Method in many cases? Of course, LLDB has many other commands, the LLDB command Table query manual is attached. Let's cheer for iOS and apple for this convenient development!

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.