Debugger: Prevent blinking animation when stepping

This commit is contained in:
chaoticgd 2025-03-28 21:19:37 +00:00 committed by lightningterror
parent fcde7fdb80
commit ee8335e5f1
3 changed files with 28 additions and 26 deletions

View File

@ -307,12 +307,18 @@ void DebuggerWindow::onVMPaused()
m_ui.actionStepOver->setEnabled(true);
m_ui.actionStepOut->setEnabled(true);
// Switch to the CPU tab that triggered the breakpoint.
// Also blink the tab text to indicate that a breakpoint was triggered.
if (CBreakPoints::GetBreakpointTriggered())
{
const BreakPointCpu triggeredCpu = CBreakPoints::GetBreakpointTriggeredCpu();
m_dock_manager->switchToLayoutWithCPU(triggeredCpu, true);
// Select a layout tab corresponding to the CPU that triggered the
// breakpoint and make it start blinking unless said breakpoint was
// generated as a result of stepping.
const BreakPointCpu cpu_type = CBreakPoints::GetBreakpointTriggeredCpu();
if (cpu_type == BREAKPOINT_EE || cpu_type == BREAKPOINT_IOP)
{
DebugInterface& cpu = DebugInterface::get(cpu_type);
bool blink_tab = !CBreakPoints::IsSteppingBreakPoint(cpu_type, cpu.getPC());
m_dock_manager->switchToLayoutWithCPU(cpu_type, blink_tab);
}
Host::RunOnCPUThread([] {
CBreakPoints::ClearTemporaryBreakPoints();
@ -418,7 +424,7 @@ void DebuggerWindow::onStepInto()
bpAddr = info.branchTarget; // Syscalls are always taken
Host::RunOnCPUThread([cpu, bpAddr] {
CBreakPoints::AddBreakPoint(cpu->getCpuType(), bpAddr, true);
CBreakPoints::AddBreakPoint(cpu->getCpuType(), bpAddr, true, true, true);
cpu->resumeCpu();
});
@ -468,7 +474,7 @@ void DebuggerWindow::onStepOver()
}
Host::RunOnCPUThread([cpu, bpAddr] {
CBreakPoints::AddBreakPoint(cpu->getCpuType(), bpAddr, true);
CBreakPoints::AddBreakPoint(cpu->getCpuType(), bpAddr, true, true, true);
cpu->resumeCpu();
});
@ -509,7 +515,7 @@ void DebuggerWindow::onStepOut()
u32 breakpoint_pc = stack_frames.at(1).pc;
Host::RunOnCPUThread([cpu, breakpoint_pc] {
CBreakPoints::AddBreakPoint(cpu->getCpuType(), breakpoint_pc, true);
CBreakPoints::AddBreakPoint(cpu->getCpuType(), breakpoint_pc, true, true, true);
cpu->resumeCpu();
});

View File

@ -172,7 +172,13 @@ bool CBreakPoints::IsTempBreakPoint(BreakPointCpu cpu, u32 addr)
return bp != INVALID_BREAKPOINT;
}
void CBreakPoints::AddBreakPoint(BreakPointCpu cpu, u32 addr, bool temp, bool enabled)
bool CBreakPoints::IsSteppingBreakPoint(BreakPointCpu cpu, u32 addr)
{
const size_t bp = FindBreakpoint(cpu, addr, true, true);
return bp != INVALID_BREAKPOINT && breakPoints_[bp].stepping;
}
void CBreakPoints::AddBreakPoint(BreakPointCpu cpu, u32 addr, bool temp, bool enabled, bool stepping)
{
const size_t bp = FindBreakpoint(cpu, addr, true, temp);
if (bp == INVALID_BREAKPOINT)
@ -180,6 +186,7 @@ void CBreakPoints::AddBreakPoint(BreakPointCpu cpu, u32 addr, bool temp, bool en
BreakPoint pt;
pt.enabled = enabled;
pt.temporary = temp;
pt.stepping = stepping;
pt.addr = addr;
pt.cpu = cpu;

View File

@ -12,15 +12,10 @@
struct BreakPointCond
{
DebugInterface* debug;
DebugInterface* debug = nullptr;
PostfixExpression expression;
std::string expressionString;
BreakPointCond()
: debug(NULL)
{
}
u32 Evaluate()
{
u64 result;
@ -33,17 +28,10 @@ struct BreakPointCond
struct BreakPoint
{
BreakPoint()
: addr(0)
, enabled(false)
, temporary(false)
, hasCond(false)
{
}
u32 addr;
bool enabled;
bool temporary;
u32 addr = 0;
bool enabled = false;
bool temporary = false;
bool stepping = false;
bool hasCond;
BreakPointCond cond;
@ -120,7 +108,8 @@ public:
static bool IsAddressBreakPoint(BreakPointCpu cpu, u32 addr);
static bool IsAddressBreakPoint(BreakPointCpu cpu, u32 addr, bool* enabled);
static bool IsTempBreakPoint(BreakPointCpu cpu, u32 addr);
static void AddBreakPoint(BreakPointCpu cpu, u32 addr, bool temp = false, bool enabled = true);
static bool IsSteppingBreakPoint(BreakPointCpu cpu, u32 addr);
static void AddBreakPoint(BreakPointCpu cpu, u32 addr, bool temp = false, bool enabled = true, bool stepping = false);
static void RemoveBreakPoint(BreakPointCpu cpu, u32 addr);
static void ChangeBreakPoint(BreakPointCpu cpu, u32 addr, bool enable);
static void ClearAllBreakPoints();