mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 23:40:29 +02:00
Move step into, step out and run to line into accelerators
This commit is contained in:
1 parent
3d3fa32bcd
commit
4e8bca7549
6 files changed
+122
-105
No files matched your search
@@ -226,6 +226,86 @@ void CDisasm::changeSubWindow(SubWindowType type)
|
||||
}
|
||||
}
|
||||
|
||||
void CDisasm::stepInto()
|
||||
{
|
||||
if (Core_IsActive()) return;
|
||||
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
|
||||
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
||||
CBreakPoints::SetSkipFirst(currentMIPS->pc);
|
||||
|
||||
Core_DoSingleStep();
|
||||
Sleep(1);
|
||||
_dbg_update_();
|
||||
ptr->gotoPC();
|
||||
UpdateDialog();
|
||||
vfpudlg->Update();
|
||||
|
||||
CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW))->redraw();
|
||||
threadList->reloadThreads();
|
||||
stackTraceView->loadStackTrace();
|
||||
updateThreadLabel(false);
|
||||
}
|
||||
|
||||
void CDisasm::stepOver()
|
||||
{
|
||||
if (Core_IsActive()) return;
|
||||
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
|
||||
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
||||
CBreakPoints::SetSkipFirst(currentMIPS->pc);
|
||||
|
||||
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(cpu,cpu->GetPC());
|
||||
ptr->setDontRedraw(true);
|
||||
u32 breakpointAddress = cpu->GetPC()+cpu->getInstructionSize(0);
|
||||
if (info.isBranch)
|
||||
{
|
||||
if (info.isConditional == false)
|
||||
{
|
||||
if (info.isLinkedBranch) // jal, jalr
|
||||
{
|
||||
// it's a function call with a delay slot - skip that too
|
||||
breakpointAddress += cpu->getInstructionSize(0);
|
||||
} else { // j, ...
|
||||
// in case of absolute branches, set the breakpoint at the branch target
|
||||
breakpointAddress = info.branchTarget;
|
||||
}
|
||||
} else { // beq, ...
|
||||
// set breakpoint at branch target
|
||||
breakpointAddress = info.branchTarget;
|
||||
CBreakPoints::AddBreakPoint(breakpointAddress,true);
|
||||
|
||||
// and after the delay slot
|
||||
breakpointAddress = cpu->GetPC()+2*cpu->getInstructionSize(0);
|
||||
}
|
||||
}
|
||||
|
||||
SetDebugMode(false);
|
||||
CBreakPoints::AddBreakPoint(breakpointAddress,true);
|
||||
_dbg_update_();
|
||||
Core_EnableStepping(false);
|
||||
Sleep(1);
|
||||
ptr->gotoAddr(breakpointAddress);
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
void CDisasm::runToLine()
|
||||
{
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
u32 pos = ptr->getSelection();
|
||||
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
ptr->setDontRedraw(true);
|
||||
SetDebugMode(false);
|
||||
CBreakPoints::AddBreakPoint(pos,true);
|
||||
_dbg_update_();
|
||||
Core_EnableStepping(false);
|
||||
}
|
||||
|
||||
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
//if (!m_hDlg) return FALSE;
|
||||
@@ -298,6 +378,39 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
changeSubWindow(SUBWIN_STACKFRAMES);
|
||||
break;
|
||||
|
||||
case ID_DEBUG_ADDBREAKPOINT:
|
||||
{
|
||||
bool isRunning = Core_IsActive();
|
||||
if (isRunning)
|
||||
{
|
||||
SetDebugMode(true);
|
||||
Core_EnableStepping(true);
|
||||
Core_WaitInactive(200);
|
||||
}
|
||||
|
||||
BreakpointWindow bpw(m_hDlg,cpu);
|
||||
if (bpw.exec()) bpw.addBreakpoint();
|
||||
|
||||
if (isRunning)
|
||||
{
|
||||
SetDebugMode(false);
|
||||
Core_EnableStepping(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_DEBUG_STEPOVER:
|
||||
if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver();
|
||||
break;
|
||||
|
||||
case ID_DEBUG_STEPINTO:
|
||||
if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto();
|
||||
break;
|
||||
|
||||
case ID_DEBUG_RUNTOLINE:
|
||||
if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine();
|
||||
break;
|
||||
|
||||
case IDC_SHOWVFPU:
|
||||
vfpudlg->Show(true);
|
||||
break;
|
||||
@@ -351,68 +464,11 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDC_STEP:
|
||||
{
|
||||
if (Core_IsActive()) break;
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
|
||||
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
||||
CBreakPoints::SetSkipFirst(currentMIPS->pc);
|
||||
|
||||
Core_DoSingleStep();
|
||||
Sleep(1);
|
||||
_dbg_update_();
|
||||
ptr->gotoPC();
|
||||
UpdateDialog();
|
||||
vfpudlg->Update();
|
||||
|
||||
CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW))->redraw();
|
||||
threadList->reloadThreads();
|
||||
stackTraceView->loadStackTrace();
|
||||
updateThreadLabel(false);
|
||||
}
|
||||
stepInto();
|
||||
break;
|
||||
|
||||
case IDC_STEPOVER:
|
||||
{
|
||||
if (Core_IsActive()) break;
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
|
||||
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
||||
CBreakPoints::SetSkipFirst(currentMIPS->pc);
|
||||
|
||||
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(cpu,cpu->GetPC());
|
||||
ptr->setDontRedraw(true);
|
||||
u32 breakpointAddress = cpu->GetPC()+cpu->getInstructionSize(0);
|
||||
if (info.isBranch)
|
||||
{
|
||||
if (info.isConditional == false)
|
||||
{
|
||||
if (info.isLinkedBranch) // jal, jalr
|
||||
{
|
||||
// it's a function call with a delay slot - skip that too
|
||||
breakpointAddress += cpu->getInstructionSize(0);
|
||||
} else { // j, ...
|
||||
// in case of absolute branches, set the breakpoint at the branch target
|
||||
breakpointAddress = info.branchTarget;
|
||||
}
|
||||
} else { // beq, ...
|
||||
// set breakpoint at branch target
|
||||
breakpointAddress = info.branchTarget;
|
||||
CBreakPoints::AddBreakPoint(breakpointAddress,true);
|
||||
|
||||
// and after the delay slot
|
||||
breakpointAddress = cpu->GetPC()+2*cpu->getInstructionSize(0);
|
||||
}
|
||||
}
|
||||
|
||||
SetDebugMode(false);
|
||||
CBreakPoints::AddBreakPoint(breakpointAddress,true);
|
||||
_dbg_update_();
|
||||
Core_EnableStepping(false);
|
||||
Sleep(1);
|
||||
ptr->gotoAddr(breakpointAddress);
|
||||
UpdateDialog();
|
||||
}
|
||||
stepOver();
|
||||
break;
|
||||
|
||||
case IDC_STEPHLE:
|
||||
@@ -454,24 +510,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDC_MEMCHECK:
|
||||
{
|
||||
bool isRunning = Core_IsActive();
|
||||
if (isRunning)
|
||||
{
|
||||
SetDebugMode(true);
|
||||
Core_EnableStepping(true);
|
||||
Core_WaitInactive(200);
|
||||
}
|
||||
|
||||
BreakpointWindow bpw(m_hDlg,cpu);
|
||||
if (bpw.exec()) bpw.addBreakpoint();
|
||||
|
||||
if (isRunning)
|
||||
{
|
||||
SetDebugMode(false);
|
||||
Core_EnableStepping(false);
|
||||
}
|
||||
}
|
||||
SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0);
|
||||
break;
|
||||
case IDC_UPDATECALLSTACK:
|
||||
{
|
||||
@@ -540,17 +579,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_DEB_MAPLOADED:
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
case WM_DEB_RUNTOWPARAM:
|
||||
{
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
ptr->setDontRedraw(true);
|
||||
SetDebugMode(false);
|
||||
CBreakPoints::AddBreakPoint(wParam,true);
|
||||
_dbg_update_();
|
||||
Core_EnableStepping(false);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DEB_GOTOWPARAM:
|
||||
{
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
|
||||
Reference in new issue
Block a user