Fix computation of object address for safe object frames. I forgot to do this as part of a528aa8e0b, also related to #104

This commit is contained in:
Jeremy Rifkin 2024-09-07 12:02:52 -05:00
parent 499bea182c
commit 4f94f20d41
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
2 changed files with 4 additions and 6 deletions

View File

@ -235,7 +235,9 @@ namespace cpptrace {
);
struct CPPTRACE_EXPORT safe_object_frame {
frame_ptr raw_address;
frame_ptr address_relative_to_object_start; // base must still be added
// This ends up being the real object address. It was named at a time when I thought the object base address
// still needed to be added in
frame_ptr address_relative_to_object_start;
char object_path[CPPTRACE_PATH_MAX + 1];
// To be called outside a signal handler. Not signal safe.
object_frame resolve() const;

View File

@ -169,13 +169,9 @@ namespace detail {
""
};
}
auto base = get_module_image_base(frame.object_path);
if(base.is_error()) {
throw base.unwrap_error(); // This throw is intentional
}
return {
frame.raw_address,
frame.address_relative_to_object_start + base.unwrap_value(),
frame.address_relative_to_object_start,
std::move(object_path)
};
}