写入此神奇全局变量(“ crashreporter_info ”)的任何字符串都将显示在崩溃日志的该部分中。为什么呢?
const char *__crashreporter_info__ = NULL;
asm(".desc _crashreporter_info, 0x10");
#define MAAssert(expression, ...) \
do { \
if(!(expression)) { \
NSString *__MAAssert_temp_string = [NSString stringWithFormat: @"Assertion failure: %s in %s on line %s:%d. %@", #expression, __func__, __FILE__, __LINE__, [NSString stringWithFormat: @"" __VA_ARGS__]]; \
NSLog(@"%@", __MAAssert_temp_string); \
__crashreporter_info__ = [__MAAssert_temp_string UTF8String]; \
abort(); \
} \
} while(0)