diff --git a/BaseBin/launchdhook/src/crashreporter.m b/BaseBin/launchdhook/src/crashreporter.m index 356831011..4ee1742c8 100644 --- a/BaseBin/launchdhook/src/crashreporter.m +++ b/BaseBin/launchdhook/src/crashreporter.m @@ -128,15 +128,18 @@ static void pthread_backtrace(pthread_t pthread, vm_address_t *buffer, unsigned void crashreporter_dump_backtrace_line(FILE *f, vm_address_t addr) { Dl_info info; - dladdr((void *)addr, &info); + if (dladdr((void *)addr, &info) != 0) { + const char *sname = info.dli_sname; + const char *fname = info.dli_fname; + if (!sname) { + sname = ""; + } - const char *sname = info.dli_sname; - const char *fname = info.dli_fname; - if (!sname) { - sname = ""; + fprintf(f, "0x%lX: %s (0x%lX + 0x%lX) (%s(0x%lX) + 0x%lX)\n", addr, sname, (vm_address_t)info.dli_saddr, addr - (vm_address_t)info.dli_saddr, fname, (vm_address_t)info.dli_fbase, addr - (vm_address_t)info.dli_fbase); + } + else { + fprintf(f, "0x%lX (no association)\n", addr); } - - fprintf(f, "0x%lX: %s (0x%lX + 0x%lX) (%s(0x%lX) + 0x%lX)\n", addr, sname, (vm_address_t)info.dli_saddr, addr - (vm_address_t)info.dli_saddr, fname, (vm_address_t)info.dli_fbase, addr - (vm_address_t)info.dli_fbase); } FILE *crashreporter_open_outfile(const char *source, char **nameOut)