2
我看到使用NSLog的段錯誤,具體來說,它在64位設備上,具有SEGV_ACCERR
。我是iOS新手,所以我有點困惑。Segfault from NSLog?
這裏的堆棧跟蹤:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x108074000
Crashed Thread: 0
Thread 0 Crashed:
0 libsystem_platform.dylib 0x00000001826ea31c _platform_memmove + 300
1 libsystem_asl.dylib 0x00000001825289a4 asl_string_append_no_encoding_len + 92
2 libsystem_asl.dylib 0x0000000182522fc8 asl_string_new + 108
3 libsystem_asl.dylib 0x0000000182522df4 asl_msg_to_string_raw + 68
4 libsystem_asl.dylib 0x00000001825228dc _asl_send_message + 828
5 libsystem_asl.dylib 0x00000001825224fc asl_send + 8
6 CoreFoundation 0x0000000182a6fa1c __CFLogCString + 568
7 CoreFoundation 0x0000000182a6f7ac _CFLogvEx2 + 300
8 CoreFoundation 0x0000000182a6fc14 _CFLogvEx3 + 152
9 Foundation 0x0000000183435dd8 _NSLogv + 128
10 Foundation 0x000000018336ae04 NSLog + 28
下面是調用此代碼:
NSString *truncated = [NSString stringWithUTF8String:buffer];
// Using original NSLog to print.
#undef NSLog
NSLog(@"%@", truncated);
,它從我的NSLog
通話崩潰。
其中buffer
只是一個字符緩衝區。
我的問題具體是:
- 它甚至有可能從使用蘋果提供的
NSLog
崩潰?或者我的堆棧跟蹤錯誤? SEG_ACCERR
在這種情況下意味着什麼?- 我怎麼能找到這是否是由不良內存問題引起的?
- 是什麼東西在多線程下的asl文件?
- 我應該如何調試這個?
任何幫助將不勝感激!謝謝!
也許緩衝區無效,例如,不是UTF8。 – Justlike