How to debug a program on iPhone IOS xcode4 suddenly crashes and no code can be found

Source: Internet
Author: User

Xcode4 settings are not the same: find arguments in edit-> Scheme (in xcode 4.2, choose product-> edit Scheme)

Set the following three values to yes.

NtutoreleasefreedobjectCheckenabled

Nszombieenabled

Nsdebugenabled

Also reprinted 2 debugging exc_bad_access good article http://blog.zol.com.cn/2387/article_2386505.html
Http://www.cnblogs.com/likwo/archive/2011/02/28/1967066.html

This is also true for foreigners: I had similar issue; turns out I was
Not retaining a uibutton properly. how I found the cause: -Enable zombies-run the project with 'location' instruments-use the app to trigger the bug-check that instruments show message 'zombie messaged' on the timeline-There shocould be a link that
Opens calayer details: when it was allocated and deallocated-you are interested in the place where is was allocated, shocould be that aha !!! Place in your code


I use zombies on the simulator, and then run the program. When the program crashes, there will be a crash point and code.
To another article:

Method 1:

Paeholdtranmaincontrol * control = [[paeholdtranmaincontrol alloc] init];

[Self. navigationcontroller pushviewcontroller: Control animated: Yes];

[Control release];

Alloc has a control and release, and the running will crash. No prompt is displayed. Only exc_bad_access is displayed on the console.

Use the nszombieenabled parameter and the mallocstacklogging parameter to display-[calayer release]: Message sent to deallocated instance 0x13570810

After a long time, I used the following methods to locate the problem:

Open Instrument --> IOS simulator:

Select All -- "zombies to run. When disconnected, view the stack trace to track

 

Method 2: for example, the output in the console is as follows:

Testapp [1472: 207] ***-[nsobject release]: Message sent to deallocated instance 0x6019170

In the GDB Console, run shell malloc_history <pid> <mem_address>

PID = process ID (e.g. 1472)

Mem_address = memory address of instance (e.g. 0x6019170)

The call stack is displayed.



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.