假如程序员编译了inhouse给测试。
如果在测试过程中出现奔溃现象,我想程序员一般会来看Device Log 也就是 crash文件
如果crash文件遇到如下的情况,在重要的地方看不到函数名称。我想是一件很奔溃的事情。
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x37c0fe54 strlen + 12
1 libstdc++.6.dylib 0x38202410 std::string::operator=(char const*) + 8
2 FishingJoy 0x003423a0 0x1000 + 3412896
3 FishingJoy 0x00342b90 0x1000 + 3414928
4 FishingJoy 0x002fb3e0 0x1000 + 3122144
5 FishingJoy 0x002fae3c 0x1000 + 3120700
6 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36
7 FishingJoy 0x002d5614 0x1000 + 2967060
8 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36
9 Foundation 0x3548e750 __NSThreadPerformPerform + 344
10 CoreFoundation 0x38129afc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
11 CoreFoundation 0x3812935e __CFRunLoopDoSources0 + 358
12 CoreFoundation 0x3812806e __CFRunLoopRun + 646
13 CoreFoundation 0x380ab4d6 CFRunLoopRunSpecific + 294
14 CoreFoundation 0x380ab39e CFRunLoopRunInMode + 98
15 GraphicsServices 0x37e82fc6 GSEventRunModal + 150
16 UIKit 0x31c2b73c UIApplicationMain + 1084
17 FishingJoy 0x0000389c 0x1000 + 10396
18 FishingJoy 0x0000383c 0x1000 + 10300
其实我们可以还原出函数名称,现在需要软件“symbolicatecrash”(点击下载)和编译这台inhouse的电脑。
1、先下载symbolicatecrash,放入一个干净的目录下。顺便把crash文件也拖入此目录。
2、先把app文件给弄出来,步骤Xcode -> Window -> Organizer -> Archives -> 右击给测试的包->“Show in Finder”->“显示包内容”->复制目录“Products/Applications/”下面的.app到symbolicatecrash同级目录下。
3、打开终端(terminal)首先把symbolicatecrash拖入终端,现在终端会显示symbolicatecrash的地址并在末尾加入空格,不要回车然后依次把crash和app都拖入终端。
现在终端应该是(我在这里因为举例,先去掉绝对目录地址。大家看到的应该是一堆):
symbolicatecrash a.crash a.app
在末尾加入输出地址:
symbolicatecrash a.crash a.app > b.crash 回车。
现在去输出地址看 b.crash,应该已经成功显示函数名称了。呵呵~
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_c.dylib 0x37c0fe54 strlen + 12
1 libstdc++.6.dylib 0x38202410 std::string::operator=(char const*) + 8
2 FishingJoy 0x003423a0 FishNetCollideHandler::JSONLoaderDidLoad(char const*) + 1936
3 FishingJoy 0x00342b90 non-virtual thunk to FishNetCollideHandler::JSONLoaderDidLoad(char const*) + 32
4 FishingJoy 0x002fb3e0 -[JSONLoaderDelegateEx JSONLoaderDidLoad:withResult:] + 144
5 FishingJoy 0x002fae3c -[JSONLoader requestFinished:] + 352
6 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36
7 FishingJoy 0x002d5614 -[ASIHTTPRequest reportFinished] + 164
8 CoreFoundation 0x380b4224 -[NSObject performSelector:withObject:] + 36
9 Foundation 0x3548e750 __NSThreadPerformPerform + 344
10 CoreFoundation 0x38129afc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
11 CoreFoundation 0x3812935e __CFRunLoopDoSources0 + 358
12 CoreFoundation 0x3812806e __CFRunLoopRun + 646
13 CoreFoundation 0x380ab4d6 CFRunLoopRunSpecific + 294
14 CoreFoundation 0x380ab39e CFRunLoopRunInMode + 98
15 GraphicsServices 0x37e82fc6 GSEventRunModal + 150
16 UIKit 0x31c2b73c UIApplicationMain + 1084
17 FishingJoy 0x0000389c main + 84
18 FishingJoy 0x0000383c start + 32