diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index c135be9cd4..126aa77ffa 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -293,6 +293,40 @@ void CDisasm::stepOver() UpdateDialog(); } +void CDisasm::stepOut() +{ + auto threads = GetThreadsInfo(); + + u32 entry, stackTop; + for (size_t i = 0; i < threads.size(); i++) + { + if (threads[i].isCurrent) + { + entry = threads[i].entrypoint; + stackTop = threads[i].initialStack; + break; + } + } + + auto frames = MIPSStackWalk::Walk(cpu->GetPC(),cpu->GetRegValue(0,31),cpu->GetRegValue(0,29),entry,stackTop); + if (frames.size() < 2) return; + u32 breakpointAddress = frames[1].pc; + + // If the current PC is on a breakpoint, the user doesn't want to do nothing. + CBreakPoints::SetSkipFirst(currentMIPS->pc); + + CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); + ptr->setDontRedraw(true); + + 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)); @@ -411,6 +445,10 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine(); break; + case ID_DEBUG_STEPOUT: + if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut(); + break; + case IDC_SHOWVFPU: vfpudlg->Show(true); break; @@ -482,6 +520,10 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) case IDC_STEPOVER: stepOver(); break; + + case IDC_STEPOUT: + stepOut(); + break; case IDC_STEPHLE: { @@ -744,6 +786,7 @@ void CDisasm::SetDebugMode(bool _bDebug) EnableWindow( GetDlgItem(hDlg, IDC_STEP), TRUE); EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), TRUE); EnableWindow( GetDlgItem(hDlg, IDC_STEPHLE), TRUE); + EnableWindow( GetDlgItem(hDlg, IDC_STEPOUT), TRUE); CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->setDontRedraw(false); ptr->gotoPC(); @@ -763,6 +806,7 @@ void CDisasm::SetDebugMode(bool _bDebug) EnableWindow( GetDlgItem(hDlg, IDC_STEP), FALSE); EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), FALSE); EnableWindow( GetDlgItem(hDlg, IDC_STEPHLE), FALSE); + EnableWindow( GetDlgItem(hDlg, IDC_STEPOUT), FALSE); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); reglist->redraw(); } diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index 6626ef2776..d5425ca2ea 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -45,6 +45,7 @@ private: void changeSubWindow(SubWindowType type); void stepInto(); void stepOver(); + void stepOut(); void runToLine(); public: int index; //helper diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index f23f2a791d..d98d7d2ac8 100644 Binary files a/Windows/ppsspp.rc and b/Windows/ppsspp.rc differ diff --git a/Windows/resource.h b/Windows/resource.h index e991def27e..08b985bdf2 100644 Binary files a/Windows/resource.h and b/Windows/resource.h differ