summaryrefslogtreecommitdiff
path: root/Userland/DevTools/UserspaceEmulator/MmapRegion.h
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-07-28 17:18:43 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-08 10:55:36 +0200
commitc1d6637dc786be76721c31fb7712efb4735b8fce (patch)
tree9f358c20ab0ad176dd78f3457d35ed4e2c0fa9ba /Userland/DevTools/UserspaceEmulator/MmapRegion.h
parent980f314a0303e0ecbf911d8daf666bb463012524 (diff)
downloadserenity-c1d6637dc786be76721c31fb7712efb4735b8fce.zip
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.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator/MmapRegion.h')
-rw-r--r--Userland/DevTools/UserspaceEmulator/MmapRegion.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/MmapRegion.h b/Userland/DevTools/UserspaceEmulator/MmapRegion.h
index c535c80aea..b39eaeee1b 100644
--- a/Userland/DevTools/UserspaceEmulator/MmapRegion.h
+++ b/Userland/DevTools/UserspaceEmulator/MmapRegion.h
@@ -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: