1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 10:07:35 +00:00

Kernel+LibELF: Don't demangle symbols in the kernel

Instead we should just generate kernel.map in such a way that it already
contains demangled symbols.
This commit is contained in:
Gunnar Beutner 2021-07-06 12:35:26 +02:00 committed by Gunnar Beutner
parent 8e8a5680d5
commit 67f0c0d5f0
7 changed files with 12 additions and 10 deletions

View file

@ -289,6 +289,7 @@ StringView Image::Symbol::raw_data() const
return { section.raw_data() + (value() - section.address()), size() };
}
#ifndef KERNEL
Optional<Image::Symbol> Image::find_demangled_function(const StringView& name) const
{
Optional<Image::Symbol> found;
@ -309,6 +310,7 @@ Optional<Image::Symbol> Image::find_demangled_function(const StringView& name) c
});
return found;
}
#endif
Image::SortedSymbol* Image::find_sorted_symbol(FlatPtr address) const
{
@ -355,6 +357,7 @@ NEVER_INLINE void Image::sort_symbols() const
});
}
#ifndef KERNEL
String Image::symbolicate(u32 address, u32* out_offset) const
{
auto symbol_count = this->symbol_count();
@ -381,5 +384,6 @@ String Image::symbolicate(u32 address, u32* out_offset) const
}
return String::formatted("{} +{:#x}", demangled_name, address - symbol->address);
}
#endif
} // end namespace ELF

View file

@ -227,10 +227,11 @@ public:
FlatPtr base_address() const { return (FlatPtr)m_buffer; }
size_t size() const { return m_size; }
Optional<Symbol> find_demangled_function(const StringView& name) const;
bool has_symbols() const { return symbol_count(); }
#ifndef KERNEL
Optional<Symbol> find_demangled_function(const StringView& name) const;
String symbolicate(u32 address, u32* offset = nullptr) const;
#endif
Optional<Image::Symbol> find_symbol(u32 address, u32* offset = nullptr) const;
private: