1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

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.
This commit is contained in:
Andreas Kling 2019-12-12 21:59:47 +01:00
parent 078ee798f7
commit 0f393148da
5 changed files with 19 additions and 8 deletions

View file

@ -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);
}
}