mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:17:34 +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:
parent
980f314a03
commit
c1d6637dc7
4 changed files with 77 additions and 55 deletions
|
@ -71,6 +71,16 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<typename Type, typename Callback>
|
||||
void for_each_region_of_type(Callback callback)
|
||||
{
|
||||
return for_each_region([callback](auto& region) {
|
||||
if (!is<Type>(region))
|
||||
return IterationDecision::Continue;
|
||||
return callback(static_cast<Type&>(region));
|
||||
});
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
void for_regions_in(X86::LogicalAddress address, size_t size, Callback callback)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue