Skip to content

Commit

Permalink
Expose the BinaryView::ForgetUndoActions API and use avoid undo actio…
Browse files Browse the repository at this point in the history
…ns warning in the debugger
  • Loading branch information
xusheng6 committed Jan 11, 2024
1 parent 1bd4f92 commit 721951d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/debuggercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,8 @@ void DebuggerController::UpdateStackVariables()

if (!m_liveView)
return;

auto id = m_liveView->BeginUndoActions();
std::vector<DebugThread> threads = GetAllThreads();
uint64_t frameAdjustment = 0;
if (!m_liveView->GetDefaultArchitecture())
Expand Down Expand Up @@ -1626,6 +1628,7 @@ void DebuggerController::UpdateStackVariables()
{
m_liveView->SetCommentForAddress(address, "");
}
m_liveView->ForgetUndoActions(id);
}


Expand Down
19 changes: 18 additions & 1 deletion ui/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 721951d

Please sign in to comment.