Skip to content

Commit a32e22a

Browse files
committed
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.
1 parent 6cec106 commit a32e22a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/binary/object.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ namespace detail {
7878
- reinterpret_cast<std::uintptr_t>(info.dli_fbase)
7979
+ base.unwrap_value();
8080
} else {
81-
base.drop_error();
81+
if(!should_absorb_trace_exceptions()) {
82+
base.drop_error();
83+
}
8284
}
8385
}
8486
return frame;
@@ -101,7 +103,9 @@ namespace detail {
101103
- reinterpret_cast<std::uintptr_t>(info.dli_fbase)
102104
+ base.unwrap_value();
103105
} else {
104-
base.drop_error();
106+
if(!should_absorb_trace_exceptions()) {
107+
base.drop_error();
108+
}
105109
}
106110
}
107111
return frame;
@@ -146,7 +150,9 @@ namespace detail {
146150
- reinterpret_cast<std::uintptr_t>(handle)
147151
+ base.unwrap_value();
148152
} else {
149-
base.drop_error();
153+
if(!should_absorb_trace_exceptions()) {
154+
base.drop_error();
155+
}
150156
}
151157
} else {
152158
std::fprintf(stderr, "%s\n", std::system_error(GetLastError(), std::system_category()).what());

src/symbols/symbols_core.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ namespace detail {
8383
}
8484
}
8585

86+
// TODO: Symbol resolution code should probably handle when object addresses are 0
87+
8688
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames) {
8789
#if defined(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF) && defined(CPPTRACE_GET_SYMBOLS_WITH_DBGHELP)
8890
std::vector<stacktrace_frame> trace = libdwarf::resolve_frames(frames);

0 commit comments

Comments
 (0)