diff options
Diffstat (limited to 'DevTools/UserspaceEmulator')
-rw-r--r-- | DevTools/UserspaceEmulator/CMakeLists.txt | 2 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 8 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.h | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/DevTools/UserspaceEmulator/CMakeLists.txt b/DevTools/UserspaceEmulator/CMakeLists.txt index 87fca0f34a..cd41cd6181 100644 --- a/DevTools/UserspaceEmulator/CMakeLists.txt +++ b/DevTools/UserspaceEmulator/CMakeLists.txt @@ -10,4 +10,4 @@ set(SOURCES ) serenity_bin(UserspaceEmulator) -target_link_libraries(UserspaceEmulator LibX86 LibCore) +target_link_libraries(UserspaceEmulator LibX86 LibDebug LibCore) diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index 15f80f6d52..b07aa15e1a 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -139,6 +139,8 @@ bool Emulator::load_elf() m_malloc_symbol_end = m_malloc_symbol_start + malloc_symbol.value().size(); m_free_symbol_start = free_symbol.value().value(); m_free_symbol_end = m_free_symbol_start + free_symbol.value().size(); + + m_debug_info = make<DebugInfo>(m_elf); return true; } @@ -214,7 +216,11 @@ void Emulator::dump_backtrace(const Vector<FlatPtr>& backtrace) for (auto& address : backtrace) { u32 offset = 0; String symbol = m_elf->symbolicate(address, &offset); - dbgprintf("==%d== %#08x %s +%#x\n", s_pid, address, symbol.characters(), offset); + auto source_position = m_debug_info->get_source_position(address); + dbgprintf("==%d== %#08x %s +%#x", getpid(), address, symbol.characters(), offset); + if (source_position.has_value()) + dbgprintf(" (%s:%zu)", LexicalPath(source_position.value().file_path).basename().characters(), source_position.value().line_number); + dbgprintf("\n"); } } diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h index a52f9f7ced..ae0e2c5e4b 100644 --- a/DevTools/UserspaceEmulator/Emulator.h +++ b/DevTools/UserspaceEmulator/Emulator.h @@ -30,6 +30,7 @@ #include "SoftCPU.h" #include "SoftMMU.h" #include <AK/Types.h> +#include <LibDebug/DebugInfo.h> #include <LibELF/Loader.h> #include <LibX86/Instruction.h> #include <sys/types.h> @@ -60,6 +61,7 @@ public: private: NonnullRefPtr<ELF::Loader> m_elf; + OwnPtr<DebugInfo> m_debug_info; SoftMMU m_mmu; SoftCPU m_cpu; |