mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-26 19:28:52 +00:00
Move step into, step out and run to line into accelerators
This commit is contained in:
parent
3d3fa32bcd
commit
4e8bca7549
@ -109,6 +109,7 @@ LRESULT CALLBACK CtrlDisAsmView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
|
||||
ccp->redraw();
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
ccp->controlHeld = false;
|
||||
ccp->hasFocus=false;
|
||||
ccp->redraw();
|
||||
break;
|
||||
@ -117,9 +118,6 @@ LRESULT CALLBACK CtrlDisAsmView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_F9:
|
||||
case VK_F10:
|
||||
case VK_F11:
|
||||
case VK_TAB:
|
||||
return DLGC_WANTMESSAGE;
|
||||
default:
|
||||
@ -592,18 +590,6 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
|
||||
case VK_CONTROL:
|
||||
controlHeld = true;
|
||||
break;
|
||||
case VK_F9:
|
||||
if (debugger->GetPC() != curAddress)
|
||||
{
|
||||
SendMessage(GetParent(wnd),WM_DEB_RUNTOWPARAM,curAddress,0);
|
||||
}
|
||||
break;
|
||||
case VK_F10:
|
||||
SendMessage(GetParent(wnd),WM_COMMAND,IDC_STEPOVER,0);
|
||||
return;
|
||||
case VK_F11:
|
||||
SendMessage(GetParent(wnd),WM_COMMAND,IDC_STEP,0);
|
||||
return;
|
||||
case VK_SPACE:
|
||||
debugger->toggleBreakpoint(curAddress);
|
||||
break;
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
extern HMENU g_hPopupMenus;
|
||||
|
||||
enum { WM_DEB_RUNTOWPARAM = WM_USER+2,
|
||||
WM_DEB_GOTOWPARAM,
|
||||
enum { WM_DEB_GOTOWPARAM = WM_USER+2,
|
||||
WM_DEB_GOTOADDRESSEDIT,
|
||||
WM_DEB_MAPLOADED,
|
||||
WM_DEB_TABPRESSED,
|
||||
|
@ -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));
|
||||
|
@ -43,6 +43,9 @@ private:
|
||||
void SavePosition();
|
||||
void updateThreadLabel(bool clear);
|
||||
void changeSubWindow(SubWindowType type);
|
||||
void stepInto();
|
||||
void stepOver();
|
||||
void runToLine();
|
||||
public:
|
||||
int index; //helper
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user