1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +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

@ -30,7 +30,7 @@
namespace Debug::Dwarf {
DwarfInfo::DwarfInfo(NonnullRefPtr<const ELF::Loader> elf)
DwarfInfo::DwarfInfo(const ELF::Image& elf)
: m_elf(elf)
{
m_debug_info_data = section_data(".debug_info");
@ -42,7 +42,7 @@ DwarfInfo::DwarfInfo(NonnullRefPtr<const ELF::Loader> elf)
ReadonlyBytes DwarfInfo::section_data(const String& section_name) const
{
auto section = m_elf->image().lookup_section(section_name);
auto section = m_elf.lookup_section(section_name);
if (section.is_undefined())
return {};
return section.bytes();

View file

@ -32,13 +32,13 @@
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <LibELF/Loader.h>
#include <LibELF/Image.h>
namespace Debug::Dwarf {
class DwarfInfo : public RefCounted<DwarfInfo> {
class DwarfInfo {
public:
static NonnullRefPtr<DwarfInfo> create(NonnullRefPtr<const ELF::Loader> elf) { return adopt(*new DwarfInfo(move(elf))); }
explicit DwarfInfo(const ELF::Image&);
ReadonlyBytes debug_info_data() const { return m_debug_info_data; }
ReadonlyBytes abbreviation_data() const { return m_abbreviation_data; }
@ -48,12 +48,11 @@ public:
void for_each_compilation_unit(Callback) const;
private:
explicit DwarfInfo(NonnullRefPtr<const ELF::Loader> elf);
void populate_compilation_units();
ReadonlyBytes section_data(const String& section_name) const;
NonnullRefPtr<const ELF::Loader> m_elf;
const ELF::Image& m_elf;
ReadonlyBytes m_debug_info_data;
ReadonlyBytes m_abbreviation_data;
ReadonlyBytes m_debug_strings_data;