iOS Debug lldb Command Common PO

Source: Internet
Author: User
Tags print object gdb debugger

LLDB Command Common (Memo)

If you are going to run this in the simulator, you can enter the following in the "(LLDB)" Prompt:

(LLDB) PO $eax

LLDB is the default debugger in xcode4.3 or later versions. If you are using an older version of Xcode, you are also GDB debugger. They have some basic same commands, so if your xcode uses a "(GDB)" hint instead of a "(LLDB)" Hint, you can do it more, without problems.

The "po" command is shorthand for "print object". "$eax" is a register of Cups. In the case of an exception, this register will contain a pointer to an exception object. Note: $eax will only work in the emulator, if you debug on the device, you will need to use the "$r 0″ register.

For example, if you enter:

(LLDB) PO [$eax class]

You will see something like this:

(ID) $ = 0x01446e84 NSException

These numbers are not important, but it is clear that the NSException object you are dealing with is here.

You can call any method on this object. For example:

(LLDB) PO [$eax name]

This will output the name of the exception, here is the nsinvalidargumentexception, and:

(LLDB) PO [$eax reason]

This will output an error message:

(unsigned int) $4 = 114784400 Receiver () have no segue with identifier ' Modalsegue '

Note: When you use only the "Po $eax", this command will call the "description" method and print out the object, in which case you will get the wrong message.

Utility LLDB Command

Command name Usage description

Expr Expr expression A useful command that can dynamically execute a specified expression and print the result at debug time.
Po PO Expression Similar to expr, the object description method is called when the object is printed. It's a shorthand for print-object .
Print Print (type) expression is also a print command, you need to specify a type.
Bt BT [ALL] The print call stack is a shorthand for the thread BackTrace , plus all to print the stack of all the thread.
BR L BR L It's a shorthand for the breakpoint list .
Process Continue L Process continue Shorthand:C
Thread step-in L Thread step-in L Abbreviation:s
Thread Step-inst L Thread Step-inst L Abbreviation:si
Thread Step-over L Thread Step-over L Shorthand:n
Thread Step-over-inst L Thread Step-over-inst L Abbreviation:ni
Thread Step-out L Thread Step-out L Abbreviation:f
Thread List Thread List Abbreviation:th l

Hidden memory leaks Hint:
Potential Leak of an object allocated in line ...
Data assignment hidden hint:
The left operand of ... is a garbage value;
Object reference hidden Hint:
Reference-counted object is used after it is released;

Retain, copy, Init, release, autorelease, etc. in the count of the use of the situation of the detailed explanation, recommend:

Http://www.cnblogs.com/andyque/archive/2011/08/08/2131236.html

Call Autorelease This means that you can use Vari in this function, but once the next run
When loop is called, it is sent to the release object. Then the reference count is changed to 0, then the memory is freed. (As for how autorelease works, my understanding is that each thread has a autoreleasepool stack, which puts a lot of Autoreleasepool objects in it.) When you send a autorelease message to an object, the object is added to the Autoreleasepool at the top of the current stack. When the current Runloop is finished, the pool is destroyed and the release message is sent to all the Autorelease objects inside it. The Autoreleasepool is created at the beginning of the current runloop and pressed into the top of the stack. So what is a runloop? A UI event, Timer
Call, the delegate call, will be a new runloop. )

WhenWhat to do when the program crashes, as in the next two parts (English version):

Http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1

(Part-1 in Chinese) http://article.ityran.com/archives/1006

Http://www.raywenderlich.com/10505/my-app-crashed-now-what-part-2

(Part-2 in Chinese) http://article.ityran.com/archives/1143

Memory Usage Detailed Description:

Http://www.cocoachina.com/bbs/simple/?t94017.html

Apple's official Mac OS X debugging Magic, detailing the debugging skills the most advanced Apple programmer should have

http://developer.apple.com/library/mac/#technotes/tn2004/tn2124.html

iOS Debug lldb Command Common PO

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.