From 20ead9fcc85df9822716ca3c879449a0a79ec83f Mon Sep 17 00:00:00 2001 From: Xusheng Date: Mon, 13 Mar 2023 11:59:23 +0800 Subject: [PATCH] Properly set default platform/arch for the debugger view --- core/debuggercontroller.cpp | 7 +++++++ core/debuggerstate.cpp | 2 +- ui/ui.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/debuggercontroller.cpp b/core/debuggercontroller.cpp index 67e40506..277e1328 100644 --- a/core/debuggercontroller.cpp +++ b/core/debuggercontroller.cpp @@ -624,6 +624,13 @@ void DebuggerController::HandleInitialBreakpoint() if (!liveView) return; + // The bvt does not set the arch and platform for the created binary view. We must set them explicitly. + // TODO: in the future, when we add support for using the debugger without a base binary view (i.e., the m_data in + // this code), we will need to either read these info from the adapter backends, or make a UI to allow the user to + // inform us the values. + liveView->SetDefaultArchitecture(m_data->GetDefaultArchitecture()); + liveView->SetDefaultPlatform(m_data->GetDefaultPlatform()); + SetLiveView(liveView); DetectLoadedModule(); NotifyStopped(DebugStopReason::InitialBreakpoint); diff --git a/core/debuggerstate.cpp b/core/debuggerstate.cpp index 86992966..3c65d36b 100644 --- a/core/debuggerstate.cpp +++ b/core/debuggerstate.cpp @@ -856,7 +856,7 @@ void DebuggerState::UpdateCaches() bool DebuggerState::GetRemoteBase(uint64_t& address) { - return m_modules->GetModuleBase(GetExecutablePath()); + return m_modules->GetModuleBase(GetExecutablePath(), address); } diff --git a/ui/ui.cpp b/ui/ui.cpp index 394fd308..78571484 100644 --- a/ui/ui.cpp +++ b/ui/ui.cpp @@ -1094,7 +1094,7 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) if (newFrame) { m_context->closeTab(m_context->getTabForFile(fileContext)); - navigateDebugger(address); + navigateToCurrentIP(); QCoreApplication::processEvents(); } }