1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 02:08:11 +00:00

LibELF: Remove ELF::Loader and move everyone to ELF::Image

This commit gets rid of ELF::Loader entirely since its very ambiguous
purpose was actually to load executables for the kernel, and that is
now handled by the kernel itself.

This patch includes some drive-by cleanup in LibDebug and CrashDaemon
enabled by the fact that we no longer need to keep the ref-counted
ELF::Loader around.
This commit is contained in:
Andreas Kling 2020-12-25 02:14:56 +01:00
parent 7551a66f73
commit 1e4c010643
24 changed files with 178 additions and 318 deletions

View file

@ -309,14 +309,13 @@ String Emulator::create_backtrace_line(FlatPtr address)
if (!mapped_file.is_valid())
return minimal;
auto loader = ELF::Loader::create((const u8*)mapped_file.data(), mapped_file.size());
auto debug_info = make<Debug::DebugInfo>(loader);
m_dynamic_library_cache.set(lib_path, CachedELF { move(mapped_file), move(loader), move(debug_info) });
auto debug_info = make<Debug::DebugInfo>(make<ELF::Image>((const u8*)mapped_file.data(), mapped_file.size()));
m_dynamic_library_cache.set(lib_path, CachedELF { move(mapped_file), move(debug_info) });
}
auto it = m_dynamic_library_cache.find(lib_path);
auto& loader = *it->value.elf_loader;
String symbol = loader.symbolicate(address - region->base());
auto& elf = it->value.debug_info->elf();
String symbol = elf.symbolicate(address - region->base());
auto line_without_source_info = String::format("=={%d}== %p [%s]: %s", getpid(), address, lib_name.characters(), symbol.characters());