mirror of
https://github.com/libretro/pcsx2.git
synced 2025-02-09 03:09:30 +00:00
Add step out feature
This commit is contained in:
parent
d3ffd13c25
commit
8dba78abce
@ -889,11 +889,17 @@ void CtrlDisassemblyView::keydownEvent(wxKeyEvent& evt)
|
||||
}
|
||||
scanFunctions();
|
||||
break;
|
||||
case WXK_F8:
|
||||
postEvent(debEVT_STEPOUT,0);
|
||||
break;
|
||||
case WXK_F10:
|
||||
postEvent(debEVT_STEPOVER,0);
|
||||
return;
|
||||
case WXK_F11:
|
||||
postEvent(debEVT_STEPINTO,0);
|
||||
if (evt.ShiftDown())
|
||||
postEvent(debEVT_STEPOUT,0);
|
||||
else
|
||||
postEvent(debEVT_STEPINTO,0);
|
||||
return;
|
||||
default:
|
||||
evt.Skip();
|
||||
|
@ -24,6 +24,7 @@ DEFINE_LOCAL_EVENT_TYPE( debEVT_RUNTOPOS )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPOVER )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPINTO )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPOUT )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_UPDATE )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_BREAKPOINTWINDOW )
|
||||
|
||||
|
@ -25,6 +25,7 @@ DECLARE_LOCAL_EVENT_TYPE( debEVT_RUNTOPOS, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPOVER, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPINTO, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPOUT, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_UPDATE, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_BREAKPOINTWINDOW, wxNewEventType() )
|
||||
|
||||
|
@ -35,6 +35,7 @@ BEGIN_EVENT_TABLE(DisassemblyDialog, wxFrame)
|
||||
EVT_COMMAND( wxID_ANY, debEVT_GOTOINDISASM, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_STEPOVER, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_STEPINTO, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_STEPOUT, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_UPDATE, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_BREAKPOINTWINDOW, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_MAPLOADED, DisassemblyDialog::onDebuggerEvent )
|
||||
@ -196,6 +197,22 @@ void CpuTabPage::loadCycles()
|
||||
lastCycles = cycles;
|
||||
}
|
||||
|
||||
u32 CpuTabPage::getStepOutAddress()
|
||||
{
|
||||
if (threadList == NULL)
|
||||
return (u32)-1;
|
||||
|
||||
EEThread currentThread = threadList->getRunningThread();
|
||||
std::vector<MipsStackWalk::StackFrame> frames =
|
||||
MipsStackWalk::Walk(cpu,cpu->getPC(),cpu->getRegister(0,31),cpu->getRegister(0,29),
|
||||
currentThread.data.entry_init,currentThread.data.stack);
|
||||
|
||||
if (frames.size() < 2)
|
||||
return (u32)-1;
|
||||
|
||||
return frames[1].pc;
|
||||
}
|
||||
|
||||
DisassemblyDialog::DisassemblyDialog(wxWindow* parent):
|
||||
wxFrame( parent, wxID_ANY, L"Debugger", wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxCLOSE_BOX|wxCAPTION|wxSYSTEM_MENU ),
|
||||
currentCpu(NULL)
|
||||
@ -225,6 +242,7 @@ DisassemblyDialog::DisassemblyDialog(wxWindow* parent):
|
||||
|
||||
stepOutButton = new wxButton( panel, wxID_ANY, L"Step Out" );
|
||||
stepOutButton->Enable(false);
|
||||
Connect( stepOutButton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DisassemblyDialog::onStepOutClicked ) );
|
||||
topRowSizer->Add(stepOutButton,0,wxRIGHT,8);
|
||||
|
||||
breakpointButton = new wxButton( panel, wxID_ANY, L"Breakpoint" );
|
||||
@ -307,6 +325,11 @@ void DisassemblyDialog::onStepIntoClicked(wxCommandEvent& evt)
|
||||
stepInto();
|
||||
}
|
||||
|
||||
void DisassemblyDialog::onStepOutClicked(wxCommandEvent& evt)
|
||||
{
|
||||
stepOut();
|
||||
}
|
||||
|
||||
void DisassemblyDialog::onPageChanging(wxCommandEvent& evt)
|
||||
{
|
||||
wxNotebook* notebook = (wxNotebook*)wxWindow::FindWindowById(evt.GetId());
|
||||
@ -414,6 +437,18 @@ void DisassemblyDialog::stepInto()
|
||||
r5900Debug.resumeCpu();
|
||||
}
|
||||
|
||||
void DisassemblyDialog::stepOut()
|
||||
{
|
||||
if (!r5900Debug.isAlive() || !r5900Debug.isCpuPaused() || currentCpu == NULL)
|
||||
return;
|
||||
|
||||
u32 addr = currentCpu->getStepOutAddress();
|
||||
if (addr == (u32)-1)
|
||||
return;
|
||||
|
||||
CBreakPoints::AddBreakPoint(addr,true);
|
||||
r5900Debug.resumeCpu();
|
||||
}
|
||||
|
||||
void DisassemblyDialog::onBreakpointClick(wxCommandEvent& evt)
|
||||
{
|
||||
@ -485,6 +520,10 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
||||
{
|
||||
eeTab->reloadSymbolMap();
|
||||
iopTab->reloadSymbolMap();
|
||||
} else if (type == debEVT_STEPOUT)
|
||||
{
|
||||
if (currentCpu != NULL)
|
||||
stepOut();
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,6 +575,7 @@ void DisassemblyDialog::setDebugMode(bool debugMode, bool switchPC)
|
||||
|
||||
stepOverButton->Enable(true);
|
||||
stepIntoButton->Enable(true);
|
||||
stepOutButton->Enable(currentCpu == eeTab);
|
||||
|
||||
if (switchPC || CBreakPoints::GetBreakpointTriggered())
|
||||
gotoPc();
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
void showMemoryView() { setBottomTabPage(memory); };
|
||||
void loadCycles();
|
||||
void reloadSymbolMap();
|
||||
u32 getStepOutAddress();
|
||||
|
||||
void listBoxHandler(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
@ -86,12 +87,14 @@ protected:
|
||||
void onBreakRunClicked(wxCommandEvent& evt);
|
||||
void onStepOverClicked(wxCommandEvent& evt);
|
||||
void onStepIntoClicked(wxCommandEvent& evt);
|
||||
void onStepOutClicked(wxCommandEvent& evt);
|
||||
void onDebuggerEvent(wxCommandEvent& evt);
|
||||
void onPageChanging(wxCommandEvent& evt);
|
||||
void onBreakpointClick(wxCommandEvent& evt);
|
||||
void onClose(wxCloseEvent& evt);
|
||||
void stepOver();
|
||||
void stepInto();
|
||||
void stepOut();
|
||||
void gotoPc();
|
||||
private:
|
||||
CpuTabPage* eeTab;
|
||||
|
Loading…
x
Reference in New Issue
Block a user