diff options
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 11 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.h | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index 87c1c52044..cf705a0ad9 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -153,11 +153,17 @@ bool Emulator::load_elf() auto malloc_symbol = m_elf->find_demangled_function("malloc"); auto free_symbol = m_elf->find_demangled_function("free"); + auto realloc_symbol = m_elf->find_demangled_function("realloc"); + auto malloc_size_symbol = m_elf->find_demangled_function("malloc_size"); m_malloc_symbol_start = malloc_symbol.value().value(); 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_realloc_symbol_start = realloc_symbol.value().value(); + m_realloc_symbol_end = m_realloc_symbol_start + realloc_symbol.value().size(); + m_malloc_size_symbol_start = malloc_size_symbol.value().value(); + m_malloc_size_symbol_end = m_malloc_size_symbol_start + malloc_size_symbol.value().size(); m_debug_info = make<Debug::DebugInfo>(m_elf); return true; @@ -194,7 +200,10 @@ int Emulator::exec() bool Emulator::is_in_malloc_or_free() const { - return (m_cpu.base_eip() >= m_malloc_symbol_start && m_cpu.base_eip() < m_malloc_symbol_end) || (m_cpu.base_eip() >= m_free_symbol_start && m_cpu.base_eip() < m_free_symbol_end); + return (m_cpu.base_eip() >= m_malloc_symbol_start && m_cpu.base_eip() < m_malloc_symbol_end) + || (m_cpu.base_eip() >= m_free_symbol_start && m_cpu.base_eip() < m_free_symbol_end) + || (m_cpu.base_eip() >= m_realloc_symbol_start && m_cpu.base_eip() < m_realloc_symbol_end) + || (m_cpu.base_eip() >= m_malloc_size_symbol_start && m_cpu.base_eip() < m_malloc_size_symbol_end); } Vector<FlatPtr> Emulator::raw_backtrace() diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h index baaf4edeea..30142edf02 100644 --- a/DevTools/UserspaceEmulator/Emulator.h +++ b/DevTools/UserspaceEmulator/Emulator.h @@ -164,8 +164,12 @@ private: FlatPtr m_malloc_symbol_start { 0 }; FlatPtr m_malloc_symbol_end { 0 }; + FlatPtr m_realloc_symbol_start { 0 }; + FlatPtr m_realloc_symbol_end { 0 }; FlatPtr m_free_symbol_start { 0 }; FlatPtr m_free_symbol_end { 0 }; + FlatPtr m_malloc_size_symbol_start { 0 }; + FlatPtr m_malloc_size_symbol_end { 0 }; sigset_t m_pending_signals { 0 }; sigset_t m_signal_mask { 0 }; |