diff options
author | Nico Weber <thakis@chromium.org> | 2020-08-15 20:01:35 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-16 19:37:58 +0200 |
commit | fd73de684efc17170fbaa3613f1e222c3c22e4f3 (patch) | |
tree | c2345cfd16640f1f94e856b40317418e5ab3ce3b /DevTools/UserspaceEmulator | |
parent | d3967660588a02dd7965dda40b27a11117f0d137 (diff) | |
download | serenity-fd73de684efc17170fbaa3613f1e222c3c22e4f3.zip |
X86+Profiler+UserspaceEmulator: Deduplicate ELFSymbolProvider to LibX86
From a layering perspective, it's maybe a bit surprising that the
X86::SymbolProvider implementation also lives in LibX86, but since
everything depends on LibELF via LibC, and since all current
LibX86-based disassemblers want to use ELFSymbolProvider, it makes
some amount of sense to put it there.
Diffstat (limited to 'DevTools/UserspaceEmulator')
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index ef31e2c262..5e5deb8411 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -32,6 +32,7 @@ #include <AK/LexicalPath.h> #include <AK/LogStream.h> #include <Kernel/API/Syscall.h> +#include <LibX86/ELFSymbolProvider.h> #include <fcntl.h> #include <serenity.h> #include <stdio.h> @@ -157,25 +158,9 @@ bool Emulator::load_elf() return true; } -class ELFSymbolProvider final : public X86::SymbolProvider { -public: - ELFSymbolProvider(ELF::Loader& loader) - : m_loader(loader) - { - } - - virtual String symbolicate(FlatPtr address, u32* offset = nullptr) const - { - return m_loader.symbolicate(address, offset); - } - -private: - ELF::Loader& m_loader; -}; - int Emulator::exec() { - ELFSymbolProvider symbol_provider(*m_elf); + X86::ELFSymbolProvider symbol_provider(*m_elf); bool trace = false; |