diff --git a/kotlin-native/runtime/src/libbacktrace/c/macho.c b/kotlin-native/runtime/src/libbacktrace/c/macho.c index 43af78c079a..10d99e42c05 100644 --- a/kotlin-native/runtime/src/libbacktrace/c/macho.c +++ b/kotlin-native/runtime/src/libbacktrace/c/macho.c @@ -940,10 +940,24 @@ macho_add_dsym (struct backtrace_state *state, const char *filename, d = backtrace_open (dsym, error_callback, data, &does_not_exist); if (d < 0) { + p = strstr(dsym, ".framework/"); + if (p != NULL) + { + ps = dsym + (p - dsym + strlen(".framework")); + memcpy (ps, dsymsuffixdir, dsymsuffixdirlen); + ps += dsymsuffixdirlen; + memcpy (ps, basename, basenamelen); + ps += basenamelen; + *ps = '\0'; + d = backtrace_open (dsym, error_callback, data, &does_not_exist); + } /* The file does not exist, so we can't read the debug info. Just return success. */ - backtrace_free (state, dsym, dsymlen, error_callback, data); - return 1; + if (d < 0) + { + backtrace_free (state, dsym, dsymlen, error_callback, data); + return 1; + } } if (!macho_add (state, dsym, d, 0, uuid, base_address, 1,