Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to understand crash log on XCode 4

I am trying to debug the cause of my app to crash. From my trial I realized that somewhere, there were leaks and I am in the middle of figuring out. I knew it because when I tried debugging using this method here, it will crash eventually as it seems the memory leaks bulking up after some time.

To find out the caused, I have now open the NSZombieEnabled to YES on XCode 4. But I didn't see anything. So now I turn to crash log. And here it is :

Thread 7 Crashed:
0   libsystem_kernel.dylib          0x31b71a1c __pthread_kill + 8
1   libsystem_c.dylib               0x35ceb3b4 pthread_kill + 52
2   libsystem_c.dylib               0x35ce3bf8 abort + 72
3   libsystem_c.dylib               0x35d1f024 free + 104
4   ImageIO                         0x32ca35f0 ImageProviderReleaseInfoCallback + 56
5   CoreGraphics                    0x31a05284 image_provider_finalize + 8
6   CoreFoundation                  0x35aad288 _CFRelease + 160
7   CoreFoundation                  0x35aad1ae CFRelease + 82
8   CoreGraphics                    0x319fe150 CGImageProviderRelease + 4
9   CoreGraphics                    0x31a00bac CGImageBlockSetRelease + 44
10  CoreGraphics                    0x31a00b70 img_blocks_destroy + 8
11  CoreGraphics                    0x319fdaae CGSImageDataUnlock + 26
12  libRIP.A.dylib                  0x309eebae ripc_ReleaseImage + 374
13  libRIP.A.dylib                  0x309ecc9c ripc_DrawImage + 536
14  CoreGraphics                    0x319f9284 CGContextDelegateDrawImage + 44
15  CoreGraphics                    0x319f9142 CGContextDrawImage + 250
16  myapp                           0x000c6a28 0x45000 + 530984
17  myapp                           0x000c6d6a 0x45000 + 531818
18  myapp                           0x000c681c 0x45000 + 530460
19  myapp                           0x000c3526 0x45000 + 517414
20  myapp                           0x000c3796 0x45000 + 518038
21  Foundation                      0x33486382 -[NSThread main] + 38
22  Foundation                      0x334f85c6 __NSThread__main__ + 966
23  libsystem_c.dylib               0x35ceb30a _pthread_start + 242
24  libsystem_c.dylib               0x35cecbb4 thread_start + 0

My question : is there any tips on how to read and understand this debug log? Maybe a link or book that cover how to debug all together. Thanks.

like image 211
Willy Avatar asked Dec 21 '22 10:12

Willy


2 Answers

In this case,

2   libsystem_c.dylib               0x35ce3bf8 abort + 72
3   libsystem_c.dylib               0x35d1f024 free + 104

free function detected the freeing address is not in the range of heap or invalid, and then called abort function.

"Technical Note TN2239 - iOS Debugging Magic" is quite helpful document. Please take a look at "Memory Allocator" and use Malloc* environments like NSZombieEnabled. Setting breakpoint to abort function is also useful for getting the parameter for free and tracking stack.

like image 108
Kazuki Sakamoto Avatar answered Jan 08 '23 14:01

Kazuki Sakamoto


That crash log is not symbolised, hence it not giving you line numbers and object names in your app. There is a process for adding this information to the crash log to give you a lot more information to help debug the crash.

See http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html In particular the section on symbolising crash dumps.

like image 40
railwayparade Avatar answered Jan 08 '23 14:01

railwayparade