1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

UserspaceEmulator: Make symbolication work when .text isn't the first

... segment

This happens with binaries build with Clang or with a custom linker
script. If this is the case, offsets should be calculated not from the
base address of `.text`, but from the first section loaded for the
library.

This commit moves all UserspaceEmulator symbolication into a common
helper function and fixes a FIXME.
This commit is contained in:
Daniel Bertalan 2021-07-28 17:18:43 +02:00 committed by Andreas Kling
parent 980f314a03
commit c1d6637dc7
4 changed files with 77 additions and 55 deletions

View file

@ -79,6 +79,14 @@ public:
pause();
}
struct SymbolInfo {
String lib_name;
String symbol;
Optional<Debug::DebugInfo::SourcePosition> source_position;
};
Optional<SymbolInfo> symbol_at(FlatPtr address);
void dump_regions() const;
private:
@ -211,7 +219,7 @@ private:
void dispatch_one_pending_signal();
MmapRegion const* find_text_region(FlatPtr address);
MmapRegion const* load_library_from_address(FlatPtr address);
String symbol_at(FlatPtr address);
MmapRegion const* first_region_for_object(StringView name);
String create_backtrace_line(FlatPtr address);
String create_instruction_line(FlatPtr address, X86::Instruction insn);