From 1e5bcfc1dd83e4f8a15a0af57ec1d3982821445c Mon Sep 17 00:00:00 2001 From: Xusheng Date: Mon, 8 Jan 2024 12:11:43 +0800 Subject: [PATCH] Revert LLDB changes and change back to use absolute address in "b -s -a" command. Fix https://github.com/Vector35/debugger/issues/499 --- core/adapters/lldbadapter.cpp | 3 ++- core/debugadapter.cpp | 1 + core/debugadapter.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/adapters/lldbadapter.cpp b/core/adapters/lldbadapter.cpp index 7346578a..5f3931c7 100644 --- a/core/adapters/lldbadapter.cpp +++ b/core/adapters/lldbadapter.cpp @@ -600,7 +600,8 @@ DebugBreakpoint LldbAdapter::AddBreakpoint(const ModuleNameAndOffset& address, u } else { - std::string entryBreakpointCommand = fmt::format("b -s \"{}\" -a 0x{:x}", address.module, address.offset); + uint64_t addr = address.offset + m_originalBase; + std::string entryBreakpointCommand = fmt::format("b -s \"{}\" -a 0x{:x}", address.module, addr); auto ret = InvokeBackendCommand(entryBreakpointCommand); DebuggerEvent evt; evt.type = BackendMessageEventType; diff --git a/core/debugadapter.cpp b/core/debugadapter.cpp index c0ea2803..fe85fcce 100644 --- a/core/debugadapter.cpp +++ b/core/debugadapter.cpp @@ -44,6 +44,7 @@ DebugAdapter::DebugAdapter(BinaryView* data) // Here we check if there is actually a function at the entry point, to determine if the entry point is real. m_hasEntryFunction = (data->GetAnalysisEntryPoint() != nullptr); m_start = data->GetStart(); + m_originalBase = data->GetOriginalBase(); if (data->GetDefaultArchitecture()) m_defaultArchitecture = data->GetDefaultArchitecture()->GetName(); diff --git a/core/debugadapter.h b/core/debugadapter.h index a47e5100..f1a2a013 100644 --- a/core/debugadapter.h +++ b/core/debugadapter.h @@ -198,6 +198,7 @@ namespace BinaryNinjaDebugger { uint64_t m_entryPoint; bool m_hasEntryFunction; uint64_t m_start; + uint64_t m_originalBase; std::string m_defaultArchitecture; std::string m_originalFileName;