From c35ad6887ae4fe094ba95fd886b6e143c37d6625 Mon Sep 17 00:00:00 2001 From: Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> Date: Sat, 13 Jul 2024 12:57:49 -0500 Subject: [PATCH] Fix issue with incorrect reported object addresses on macos when using debug maps --- src/symbols/dwarf/debug_map_resolver.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/symbols/dwarf/debug_map_resolver.cpp b/src/symbols/dwarf/debug_map_resolver.cpp index bba8dd6..f56bf13 100644 --- a/src/symbols/dwarf/debug_map_resolver.cpp +++ b/src/symbols/dwarf/debug_map_resolver.cpp @@ -72,8 +72,12 @@ namespace libdwarf { auto it = symbol_table.find(symbol_name); if(it != symbol_table.end()) { auto frame = frame_info; + // substitute a translated address object for the target file in frame.object_address = it->second + offset; - return get_resolver()->resolve_frame(frame); + auto res = get_resolver()->resolve_frame(frame); + // replace the translated address with the object address in the binary + res.frame.object_address = frame_info.object_address; + return res; } else { return { { @@ -167,7 +171,7 @@ namespace libdwarf { frame_info.raw_address, // the resolver doesn't care about the object address here, only the offset from the start // of the symbol and it'll lookup the symbol's base-address - 0, + frame_info.object_address, frame_info.object_path }, closest_symbol_it->name,