Reading iPhone Crash Logs from iPhone real machine debugging Logs

Source: Internet
Author: User

1. After synchronizing the application, find the log file you want to view. The log file corresponds to the mac location and xp \ vista location.
2. I found that log files are not readable in hexadecimal notation. How can I convert them into what we can understand.
3. use the command line tool "symbolicatecrash" for conversion. You can copy the tool to the path that can be called anywhere: sudo cp/Developer/Platforms/iPhoneOS. platform/Developer/Library/PrivateFrameworks/DTDeviceKit. framework/Versions/A/Resources/symbolicatecrash/usr/local/bin/
4. Talked about how to use the "symbolicatecrash" tool. General as long as: symbolicatecrash report. crash?elines. app. dSYM> report-with-symbols.crash, you can
5. note that when you use Xcode debug to package, two items are generated: XXX. app. The other is XXX. app. dSYM, these two correspond to the MobileLines in the 4th point I wrote. app. dSYM corresponds. the log file here must be the version you packaged, or your log file will not be parsed. in other words, the app you installed on your mobile phone is paired with the dSYM. If you want to view the log files on the mobile phone, you must save the corresponding dSYM file to parse the log file. the dSYM file is regenerated every time you repackage it.
6. Okay. You can check out what went wrong with your program based on your report-with-symbols.crash and log files.
Sometimes programs crash. this annoys users and developers alike. users are frustrated because they cannot use crashing software, developers are frustrated because they have to hunt bugs instead of doing something creative and rewarding. how do we communicate if an iPhone application crashes?
I'll start with a disclaimer. i'm not sure whether the information provided in this post is covered by iPhone Developer Program NDA or not. if it is, the post will be removed. secondly, this post is a result of googling, so I haven't got Ted anything new here.
Working with crash logs typically involves certain interaction between developers and users, unless they are automagically sent to the developer. first of all, the user shocould get the crash log and send it to the developer, who shocould examine it, find the bug and fix it.
IPhone OS and Mac OS X are remarkably similar ubuntures. both store crash logs to help identify crashing bugs. the difference between the two is how users retrieve them. on Mac OS X every user has unrestricted access to crash logs related to the applications she runs. the iPhone does not even have a file browser. what to do? ITunes comes to the rescue.
Whenever you synchronize your iPhone or iPod Touch, all the crash logs are transferred to your computer. Here are their locations:
• Mac OS X :~ /Library/Logs/CrashReporter/MobileDevice/<DEVICE_NAME>
• Windows XP: C: \ Documents ents and Settings \ <USERNAME> \ Application Data \ Apple computer \ Logs \ CrashReporter/<DEVICE_NAME>
• Windows Vista: C: \ Users \ <USERNAME> \ AppData \ Roaming \ Apple computer \ Logs \ CrashReporter/MobileDevice/<DEVICE_NAME>
The log file names start with application name and have the extension "crash ". they are just plain text files and can be sent by e-mail in original or zipped form, or even copy-pasted into your e-mail program.
The second part is trickier. Both Apple and common sense suggest that all AppStore binaries are shipped with stripped symbols. If you ever saw a crash log like this, read on:
Thread 0 Crashed: 0 libobjc. a. dylib 00000x300bb000 + 552761 faster elines 0x00006434 0x1000 + 215562 faster elines 0x000064c2 0x1000 + 216983 UIKit 00000000+ 1312444 UIKit 0x30a66110 0x30a54000 + 740005 UIKit 00000x30a54000 + 712606 GraphicsServices limit 0x31696000 + 206607 GraphicsServices 0x00009d818 0x31696000 + 307448 IOMobileFramebuffer 0x31f3e8f8 0x31f3d000 + 63929 com. apple. framework. IOKit release 0x30f30000 + 1708010 CoreFoundation 0x3025ced4 0x30229000 + 21269211 CoreFoundation 0x3025bed6 0x30229000 + 20859812 CoreFoundation release 0x30229000 + 20621213 GraphicsServices 0x0000998e4 0x31696000 + 1456414 UIKit release 0x30a54000 + 4173615 UIKit 0x30a54000 + 7830016 faster elines 0x00002090 0x1000 + 424017 faster elines 0x0000202c 0x1000 + 4140
In a nutshell, it contains function addresses and offsets instead of function names and line numbers. the structure is obvious, but, to be honest, I don't know what "average elines 0 × 00006434 0 × 1000 + 21556" is, even though I have all the source code. thanks to Apple Developer Tools and to Craig Hockenberry whowrote about it, we have a perfect solution called symbolicatecrash.
I copied it to/usr/local/bin/so that I can run it whenever I want without trying to remember its original location (you may prefer a symbolic link ):
$ Sudo cp/Developer/Platforms/iPhone OS. platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice. xcodeplugin/Contents/Resources/symbolicatecrash/usr/local/bin/
Running this script with the-h option provides the minimal help:
$ Symbolicatecrash-h
Usage:
Symbolicatecrash [-Ah] LOGFILE [SYMBOL_PATH...]
Symbolicates a crashdump LOGFILE which may be "-" to refer
To stdin. By default, all heuristics will be employed
In an attempt to symbolicate all addresses. Additional
Symbol files can be found under specified directories.
Options:
-A Only symbolicate the application, not libraries
-H Display this message
-V Verbose
To add symbols to the crash log you need the dSYM file generated by the linker when you compiled your application for AppStore. in other words, when you build for AppStore you shoshould keep the dSYM package in a safe place backed up by Time Machine. this is very important. you shoshould keep a copy of the dSYM for each version of your application ever shipped. if you have the package, translating code offsets to function names with line numbers has never been easier:
$ Symbolicatecrash report. crash cancelines. app. dSYM> report-with-symbols.crash
Here is the result:
Thread 0 Crashed: 0 libobjc. a. dylib 0x300c87ec objc_msgSend + 201 export elines 0x00006434-[BoardView setSelectedPiece:] (BoardView. m: 321) 2 cancelines 0x000064c2-[BoardView touchesBegan: withEvent:] (BoardView. m: 349) 3 UIKit 0x30a740ac-[UIWindow sendEvent:] + 2644 UIKit 0x30a66110-[UIApplication sendEvent:] + 2485 UIKit 0x30a6565c _ UIApplicationHandleEvent + 40886 GraphicsServices 0x00009b0b4 PurpleEventCallback + 4287 GraphicsServices 0x00009d818 HeartbeatVBLCallback + 1528 IOMobileFramebuffer 0x31f3e8f8 success + 1249 com. apple. framework. IOKit PLATFORM + 30410 CoreFoundation 0x3025ced4 _ CFMachPortPerform + 7211 CoreFoundation 0x3025bed6 Platform + 236412 CoreFoundation PLATFORM + 4413 GraphicsServices 0x0000998e4 Platform + 26814 UIKit platform-[UIApplication _ run] + 40415 UIKit extends UIApplication + 106416 cancelines 0x00002090 main (main. m: 16) 17 cancelines 0x0000202c start + 44
Now, this ismuch better. Happy debugging!
Other useful references:
 
View gdb:
If the above method cannot be parsed, gdb can be used for parsing:
The method is as follows: In the. app and. dSYM directories,
Open the terminal and enter:
/Developer/Platforms/iPhoneOS. platform/Developer/usr/libexec/gdb-arm-apple-darwin package. app/MyApp
To display the class and line, use:
(Gdb) set print symbol-filename on
(Gdb) p/a 0x0002b0ee
 
Here 0x0002b0ee is your program error, for example:
Thread 0 name: Dispatch queue: com. apple. main-thread
Thread 0 Crashed:
0 libobjc. A. dylib 0x34bc8c9a objc_msgSend + 18
1 UIKit 0x34309146-[UIViewController didReceiveMemoryWarning] + 10
2 UIKit 0x3430915c-[UIViewController _ didReceiveMemoryWarning:] + 8
3 Foundation 0x36b7d17c _ nsnote_callback + 136
4 CoreFoundation 0x355bb208 _ CFXNotificationPost_old + 396
5 CoreFoundation 0x35555ee4 _ CFXNotificationPostNotification + 112
6 Foundation 0x36b7a5cc-[NSNotificationCenter postNotificationName: object: userInfo:] + 64
7 Foundation 0x36b7c1ba-[NSNotificationCenter postNotificationName: object:] + 18
8 UIKit 0x342df35a-[UIApplication _ export mmemorywarning] + 42
9 UIKit 0x342dfd7c-[UIApplication _ receivedMemoryNotification] + 120
10 UIKit 0x342dd500 _ memoryStatusChanged + 36
11 CoreFoundation 0x355bbd62 _ CFNotificationCenterDarwinCallBack + 18
12 CoreFoundation 0x355b8bd8 _ CFMachPortPerform + 204
13 CoreFoundation 0x355c3a90 _ cfrunloop_is_calling_out_to_a_source1_m_function _ + 20
14 CoreFoundation 0x355c5838 _ CFRunLoopDoSource1 + 160
15 CoreFoundation 0x355c6606 _ CFRunLoopRun + 514
16 CoreFoundation 0x35556ebc CFRunLoopRunSpecific + 224
17 CoreFoundation 0x35556dc4 CFRunLoopRunInMode + 52
18 GraphicsServices 0x3417d418 GSEventRunModal + 108
19 GraphicsServices 0x3417d4c4 GSEventRun + 56
20 UIKit 0x341b4d62-[UIApplication _ run] + 398
21 UIKit 0x341b2800 UIApplicationMain + 664
22 PABankiPad 0x00002618 0x1000 + 5656
23 PABankiPad 0x000025cc 0x1000 + 5580

Here, you can use: p/a 0x00002618
 
 
 
Check whether. app, and. dSYM are consistent with the crash log:
Enter the following command:
Dwarfdump--uuid MyApp. app/MyApp
Returned content:
UUID: E2D9D241-37D3-CE06-7272-653B813963E2 (armv6) MyApp. app/MyApp
 
Enter the following command:
Dwarfdump--uuid MyApp. app. dSYM
Returned content
UUID: E2D9D241 ‐37d3 ‐ce06 ‐7272 ‐653b813963e2 (armv6) MyApp. app. dSYM/Contents/Resources/DWARF/MyApp
 
The comparison result is consistent.
 
 
Link commands to all users
Sudo ln-s/Developer/Platforms/iPhoneOS. platform/Developer/Library/PrivateFrameworks/DTDeviceKit. framework/Versions/A/Resources/symbolicatecrash/usr/local/bin/
Sudo ln-s/Developer/Platforms/iPhoneOS. platform/Developer/usr/libexec/gdb-arm-apple-darwin/usr/local/bin/
Batch conversion logs: (the app package, dSYM, and carsh files are stored in the corresponding directory)
Cd ~ /Desktop/a1201s4z1.5c
Pwd
K = 1
For I in *. crash; do
Echo $ I
Symbolicatecrash $ I PABankiPad. app. dSYM> $ k. log
(K ++ ))
Done

 

From dread
 

 

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.