关于:asm(.desc xxx 0x10)

时间:2014-04-29 01:22:50

标签: ios debugging assembly

写入此神奇全局变量(“ 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)

0 个答案:

没有答案