From f5118a76604b9cc79d249b03c058925fe5b6d58f Mon Sep 17 00:00:00 2001 From: Xusheng Date: Thu, 11 Jan 2024 17:24:09 +0800 Subject: [PATCH] Fail the debugger view creation if the input view does not have an architecture and platform --- core/debuggercontroller.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/debuggercontroller.cpp b/core/debuggercontroller.cpp index c69509d..07d1491 100644 --- a/core/debuggercontroller.cpp +++ b/core/debuggercontroller.cpp @@ -712,10 +712,11 @@ bool DebuggerController::CreateDebuggerBinaryView() if (!liveView) return false; - // 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. + if (!m_data->GetDefaultArchitecture() || !m_data->GetDefaultPlatform()) + { + LogWarn("Fail to create debugger view. The input view must have an architecture and platform"); + return false; + } liveView->SetDefaultArchitecture(m_data->GetDefaultArchitecture()); liveView->SetDefaultPlatform(m_data->GetDefaultPlatform()); SetLiveView(liveView);