diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-12 21:59:47 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-12 21:59:47 +0100 |
commit | 0f393148da8c462a142b60b68fd7fd1f024a1787 (patch) | |
tree | 067978f322339e3b102aaeb443a9568780fd1e86 /Libraries | |
parent | 078ee798f790fd62fa6a9b03c07576af44afc4ca (diff) | |
download | serenity-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.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibELF/ELFLoader.h | 2 |
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(); |