summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-12 21:59:47 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-12 21:59:47 +0100
commit0f393148da8c462a142b60b68fd7fd1f024a1787 (patch)
tree067978f322339e3b102aaeb443a9568780fd1e86 /Libraries
parent078ee798f790fd62fa6a9b03c07576af44afc4ca (diff)
downloadserenity-0f393148da8c462a142b60b68fd7fd1f024a1787.zip
Kernel: Separate out the symbol offsets in profile output
Instead of saying "main +39" and "main +57" etc, we now have a separate field in /proc/profile for the offset-into-the-symbol.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibELF/ELFLoader.cpp6
-rw-r--r--Libraries/LibELF/ELFLoader.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/Libraries/LibELF/ELFLoader.cpp b/Libraries/LibELF/ELFLoader.cpp
index 8f50d08ff5..363590a377 100644
--- a/Libraries/LibELF/ELFLoader.cpp
+++ b/Libraries/LibELF/ELFLoader.cpp
@@ -102,7 +102,7 @@ char* ELFLoader::symbol_ptr(const char* name)
return found_ptr;
}
-String ELFLoader::symbolicate(u32 address) const
+String ELFLoader::symbolicate(u32 address, u32* out_offset) const
{
SortedSymbol* sorted_symbols = nullptr;
#ifdef KERNEL
@@ -139,6 +139,10 @@ String ELFLoader::symbolicate(u32 address) const
if (i == 0)
return "!!";
auto& symbol = sorted_symbols[i - 1];
+ if (out_offset) {
+ *out_offset = address - symbol.address;
+ return demangle(symbol.name);
+ }
return String::format("%s +%u", demangle(symbol.name).characters(), address - symbol.address);
}
}
diff --git a/Libraries/LibELF/ELFLoader.h b/Libraries/LibELF/ELFLoader.h
index ab607c10ad..6d80fd31b1 100644
--- a/Libraries/LibELF/ELFLoader.h
+++ b/Libraries/LibELF/ELFLoader.h
@@ -27,7 +27,7 @@ public:
bool has_symbols() const { return m_image.symbol_count(); }
- String symbolicate(u32 address) const;
+ String symbolicate(u32 address, u32* offset = nullptr) const;
private:
bool layout();