Don't print internal errors when image base resolution fails, this can happen on mac since platform dylibs don't actually exist on disk. Closes #217.

This commit is contained in:
Jeremy Rifkin 2025-02-22 13:20:03 -06:00
parent 6cec10601e
commit a32e22aa44
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
2 changed files with 11 additions and 3 deletions

View File

@ -78,9 +78,11 @@ namespace detail {
- reinterpret_cast<std::uintptr_t>(info.dli_fbase)
+ base.unwrap_value();
} else {
if(!should_absorb_trace_exceptions()) {
base.drop_error();
}
}
}
return frame;
}
#else
@ -101,9 +103,11 @@ namespace detail {
- reinterpret_cast<std::uintptr_t>(info.dli_fbase)
+ base.unwrap_value();
} else {
if(!should_absorb_trace_exceptions()) {
base.drop_error();
}
}
}
return frame;
}
#endif
@ -146,8 +150,10 @@ namespace detail {
- reinterpret_cast<std::uintptr_t>(handle)
+ base.unwrap_value();
} else {
if(!should_absorb_trace_exceptions()) {
base.drop_error();
}
}
} else {
std::fprintf(stderr, "%s\n", std::system_error(GetLastError(), std::system_category()).what());
}

View File

@ -83,6 +83,8 @@ namespace detail {
}
}
// TODO: Symbol resolution code should probably handle when object addresses are 0
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames) {
#if defined(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF) && defined(CPPTRACE_GET_SYMBOLS_WITH_DBGHELP)
std::vector<stacktrace_frame> trace = libdwarf::resolve_frames(frames);