From 721951d816d5f2f9e54a383c846a154362d8f763 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Thu, 11 Jan 2024 14:23:54 +0800 Subject: [PATCH] Expose the BinaryView::ForgetUndoActions API and use avoid undo actions warning in the debugger --- core/debuggercontroller.cpp | 3 +++ ui/ui.cpp | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/debuggercontroller.cpp b/core/debuggercontroller.cpp index 00e1054..c69509d 100644 --- a/core/debuggercontroller.cpp +++ b/core/debuggercontroller.cpp @@ -1547,6 +1547,8 @@ void DebuggerController::UpdateStackVariables() if (!m_liveView) return; + + auto id = m_liveView->BeginUndoActions(); std::vector threads = GetAllThreads(); uint64_t frameAdjustment = 0; if (!m_liveView->GetDefaultArchitecture()) @@ -1626,6 +1628,7 @@ void DebuggerController::UpdateStackVariables() { m_liveView->SetCommentForAddress(address, ""); } + m_liveView->ForgetUndoActions(id); } diff --git a/ui/ui.cpp b/ui/ui.cpp index 9167148..8954f45 100644 --- a/ui/ui.cpp +++ b/ui/ui.cpp @@ -1011,7 +1011,9 @@ void DebuggerUI::updateIPHighlight() if (tag->GetType() != getPCTagType(data)) continue; + auto id = data->BeginUndoActions(); func->RemoveUserAddressTag(data->GetDefaultArchitecture(), lastIP, tag); + data->ForgetUndoActions(id); } } @@ -1030,8 +1032,10 @@ void DebuggerUI::updateIPHighlight() if (!tagFound) { + auto id = data->BeginUndoActions(); func->SetAutoInstructionHighlight(data->GetDefaultArchitecture(), address, BlueHighlightColor); func->CreateUserAddressTag(data->GetDefaultArchitecture(), address, getPCTagType(data), "program counter"); + data->ForgetUndoActions(id); } } } @@ -1050,7 +1054,12 @@ void DebuggerUI::navigateToCurrentIP() auto functions = liveView->GetAnalysisFunctionsContainingAddress(address); if (functions.empty()) - liveView->CreateUserFunction(m_controller->GetLiveView()->GetDefaultPlatform(), address); + { + auto data = m_controller->GetLiveView(); + auto id = data->BeginUndoActions(); + liveView->CreateUserFunction(data->GetDefaultPlatform(), address); + data->ForgetUndoActions(id); + } navigateDebugger(address); } @@ -1233,8 +1242,10 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) if (!tagFound) { + auto id = data->BeginUndoActions(); func->SetAutoInstructionHighlight(data->GetDefaultArchitecture(), addr, RedHighlightColor); func->CreateUserAddressTag(data->GetDefaultArchitecture(), addr, getBreakpointTagType(data), "breakpoint"); + data->ForgetUndoActions(id); } } } @@ -1271,8 +1282,10 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) if (!tagFound) { + auto id = data->BeginUndoActions(); func->SetAutoInstructionHighlight(data->GetDefaultArchitecture(), address, RedHighlightColor); func->CreateUserAddressTag(data->GetDefaultArchitecture(), address, getBreakpointTagType(data), "breakpoint"); + data->ForgetUndoActions(id); } } } @@ -1301,7 +1314,9 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) if (tag->GetType() != getBreakpointTagType(data)) continue; + auto id = data->BeginUndoActions(); func->RemoveUserAddressTag(data->GetDefaultArchitecture(), address, tag); + data->ForgetUndoActions(id); } } } @@ -1332,7 +1347,9 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) if (tag->GetType() != getBreakpointTagType(data)) continue; + auto id = data->BeginUndoActions(); func->RemoveUserAddressTag(data->GetDefaultArchitecture(), address, tag); + data->ForgetUndoActions(id); } } }