mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +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
|
@ -52,6 +52,15 @@ public:
|
|||
void set_malloc_metadata(Badge<MallocTracer>, NonnullOwnPtr<MallocRegionMetadata> metadata) { m_malloc_metadata = move(metadata); }
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
String lib_name() const
|
||||
{
|
||||
if (m_name.contains("Loader.so"sv))
|
||||
return "Loader.so";
|
||||
auto const maybe_separator = m_name.find(':');
|
||||
if (!maybe_separator.has_value())
|
||||
return {};
|
||||
return m_name.substring(0, *maybe_separator);
|
||||
}
|
||||
void set_name(String name) { m_name = move(name); }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue