mirror of https://github.com/PCSX2/pcsx2.git
A hackish attempt at step into
This commit is contained in:
parent
d8abd04a8e
commit
e55229db40
|
@ -356,6 +356,10 @@ namespace MIPSAnalyst
|
||||||
switch (MIPS_GET_OP(op)) {
|
switch (MIPS_GET_OP(op)) {
|
||||||
case 0: // special
|
case 0: // special
|
||||||
switch (MIPS_GET_FUNC(op)) {
|
switch (MIPS_GET_FUNC(op)) {
|
||||||
|
case 0x0C: // syscall
|
||||||
|
info.isSyscall = true;
|
||||||
|
info.branchTarget = 0x80000000+0x180;
|
||||||
|
break;
|
||||||
case 0x20: // add
|
case 0x20: // add
|
||||||
case 0x21: // addu
|
case 0x21: // addu
|
||||||
info.hasRelevantAddress = true;
|
info.hasRelevantAddress = true;
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace MIPSAnalyst
|
||||||
|
|
||||||
// branches
|
// branches
|
||||||
u32 branchTarget;
|
u32 branchTarget;
|
||||||
|
bool isSyscall;
|
||||||
bool isBranch;
|
bool isBranch;
|
||||||
bool isLinkedBranch;
|
bool isLinkedBranch;
|
||||||
bool isLikelyBranch;
|
bool isLikelyBranch;
|
||||||
|
|
|
@ -689,7 +689,10 @@ void CtrlDisassemblyView::keydownEvent(wxKeyEvent& evt)
|
||||||
break;
|
break;
|
||||||
case WXK_F10:
|
case WXK_F10:
|
||||||
postEvent(debEVT_STEPOVER,0);
|
postEvent(debEVT_STEPOVER,0);
|
||||||
break;
|
return;
|
||||||
|
case WXK_F11:
|
||||||
|
postEvent(debEVT_STEPINTO,0);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,6 +8,7 @@ DEFINE_LOCAL_EVENT_TYPE( debEVT_GOTOINDISASM )
|
||||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_RUNTOPOS )
|
DEFINE_LOCAL_EVENT_TYPE( debEVT_RUNTOPOS )
|
||||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED )
|
DEFINE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED )
|
||||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPOVER )
|
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPOVER )
|
||||||
|
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPINTO )
|
||||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_UPDATE )
|
DEFINE_LOCAL_EVENT_TYPE( debEVT_UPDATE )
|
||||||
|
|
||||||
bool parseExpression(const char* exp, DebugInterface* cpu, u64& dest)
|
bool parseExpression(const char* exp, DebugInterface* cpu, u64& dest)
|
||||||
|
|
|
@ -9,6 +9,7 @@ DECLARE_LOCAL_EVENT_TYPE( debEVT_GOTOINDISASM, wxNewEventType() )
|
||||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_RUNTOPOS, wxNewEventType() )
|
DECLARE_LOCAL_EVENT_TYPE( debEVT_RUNTOPOS, wxNewEventType() )
|
||||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED, wxNewEventType() )
|
DECLARE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED, wxNewEventType() )
|
||||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPOVER, wxNewEventType() )
|
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPOVER, wxNewEventType() )
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPINTO, wxNewEventType() )
|
||||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_UPDATE, wxNewEventType() )
|
DECLARE_LOCAL_EVENT_TYPE( debEVT_UPDATE, wxNewEventType() )
|
||||||
|
|
||||||
bool executeExpressionWindow(wxWindow* parent, DebugInterface* cpu, u64& dest);
|
bool executeExpressionWindow(wxWindow* parent, DebugInterface* cpu, u64& dest);
|
||||||
|
|
|
@ -18,6 +18,7 @@ BEGIN_EVENT_TABLE(DisassemblyDialog, wxFrame)
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_RUNTOPOS, DisassemblyDialog::onDebuggerEvent )
|
EVT_COMMAND( wxID_ANY, debEVT_RUNTOPOS, DisassemblyDialog::onDebuggerEvent )
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_GOTOINDISASM, DisassemblyDialog::onDebuggerEvent )
|
EVT_COMMAND( wxID_ANY, debEVT_GOTOINDISASM, DisassemblyDialog::onDebuggerEvent )
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_STEPOVER, DisassemblyDialog::onDebuggerEvent )
|
EVT_COMMAND( wxID_ANY, debEVT_STEPOVER, DisassemblyDialog::onDebuggerEvent )
|
||||||
|
EVT_COMMAND( wxID_ANY, debEVT_STEPINTO, DisassemblyDialog::onDebuggerEvent )
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_UPDATE, DisassemblyDialog::onDebuggerEvent )
|
EVT_COMMAND( wxID_ANY, debEVT_UPDATE, DisassemblyDialog::onDebuggerEvent )
|
||||||
EVT_CLOSE( DisassemblyDialog::onClose )
|
EVT_CLOSE( DisassemblyDialog::onClose )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
@ -97,6 +98,7 @@ DisassemblyDialog::DisassemblyDialog(wxWindow* parent):
|
||||||
|
|
||||||
stepIntoButton = new wxButton( panel, wxID_ANY, L"Step Into" );
|
stepIntoButton = new wxButton( panel, wxID_ANY, L"Step Into" );
|
||||||
stepIntoButton->Enable(false);
|
stepIntoButton->Enable(false);
|
||||||
|
Connect( stepIntoButton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DisassemblyDialog::onStepIntoClicked ) );
|
||||||
topRowSizer->Add(stepIntoButton,0,wxBOTTOM,2);
|
topRowSizer->Add(stepIntoButton,0,wxBOTTOM,2);
|
||||||
|
|
||||||
stepOverButton = new wxButton( panel, wxID_ANY, L"Step Over" );
|
stepOverButton = new wxButton( panel, wxID_ANY, L"Step Over" );
|
||||||
|
@ -181,6 +183,11 @@ void DisassemblyDialog::onStepOverClicked(wxCommandEvent& evt)
|
||||||
stepOver();
|
stepOver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisassemblyDialog::onStepIntoClicked(wxCommandEvent& evt)
|
||||||
|
{
|
||||||
|
stepInto();
|
||||||
|
}
|
||||||
|
|
||||||
void DisassemblyDialog::onPageChanging(wxCommandEvent& evt)
|
void DisassemblyDialog::onPageChanging(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
wxNotebook* notebook = (wxNotebook*)wxWindow::FindWindowById(evt.GetId());
|
wxNotebook* notebook = (wxNotebook*)wxWindow::FindWindowById(evt.GetId());
|
||||||
|
@ -247,6 +254,48 @@ void DisassemblyDialog::stepOver()
|
||||||
r5900Debug.resumeCpu();
|
r5900Debug.resumeCpu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DisassemblyDialog::stepInto()
|
||||||
|
{
|
||||||
|
if (!r5900Debug.isAlive() || !r5900Debug.isCpuPaused() || currentCpu == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// todo: breakpoints for iop
|
||||||
|
if (currentCpu != eeTab)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CtrlDisassemblyView* disassembly = currentCpu->getDisassembly();
|
||||||
|
|
||||||
|
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
||||||
|
CBreakPoints::SetSkipFirst(r5900Debug.getPC());
|
||||||
|
u32 currentPc = r5900Debug.getPC();
|
||||||
|
|
||||||
|
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(&r5900Debug,r5900Debug.getPC());
|
||||||
|
u32 breakpointAddress = currentPc+disassembly->getInstructionSizeAt(currentPc);
|
||||||
|
if (info.isBranch)
|
||||||
|
{
|
||||||
|
if (info.isConditional == false)
|
||||||
|
{
|
||||||
|
breakpointAddress = info.branchTarget;
|
||||||
|
} else {
|
||||||
|
if (info.conditionMet)
|
||||||
|
{
|
||||||
|
breakpointAddress = info.branchTarget;
|
||||||
|
} else {
|
||||||
|
breakpointAddress = currentPc+2*4;
|
||||||
|
disassembly->scrollStepping(breakpointAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.isSyscall)
|
||||||
|
breakpointAddress = info.branchTarget;
|
||||||
|
|
||||||
|
CBreakPoints::AddBreakPoint(breakpointAddress,true);
|
||||||
|
r5900Debug.resumeCpu();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DisassemblyDialog::onBreakpointClick(wxCommandEvent& evt)
|
void DisassemblyDialog::onBreakpointClick(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
if (currentCpu == NULL)
|
if (currentCpu == NULL)
|
||||||
|
@ -295,6 +344,10 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
if (currentCpu != NULL)
|
if (currentCpu != NULL)
|
||||||
stepOver();
|
stepOver();
|
||||||
|
} else if (type == debEVT_STEPINTO)
|
||||||
|
{
|
||||||
|
if (currentCpu != NULL)
|
||||||
|
stepInto();
|
||||||
} else if (type == debEVT_UPDATE)
|
} else if (type == debEVT_UPDATE)
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
|
@ -340,6 +393,7 @@ void DisassemblyDialog::setDebugMode(bool debugMode)
|
||||||
breakRunButton->SetLabel(L"Run");
|
breakRunButton->SetLabel(L"Run");
|
||||||
|
|
||||||
stepOverButton->Enable(true);
|
stepOverButton->Enable(true);
|
||||||
|
stepIntoButton->Enable(true);
|
||||||
|
|
||||||
eeTab->getDisassembly()->gotoPc();
|
eeTab->getDisassembly()->gotoPc();
|
||||||
iopTab->getDisassembly()->gotoPc();
|
iopTab->getDisassembly()->gotoPc();
|
||||||
|
|
|
@ -52,11 +52,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void onBreakRunClicked(wxCommandEvent& evt);
|
void onBreakRunClicked(wxCommandEvent& evt);
|
||||||
void onStepOverClicked(wxCommandEvent& evt);
|
void onStepOverClicked(wxCommandEvent& evt);
|
||||||
|
void onStepIntoClicked(wxCommandEvent& evt);
|
||||||
void onDebuggerEvent(wxCommandEvent& evt);
|
void onDebuggerEvent(wxCommandEvent& evt);
|
||||||
void onPageChanging(wxCommandEvent& evt);
|
void onPageChanging(wxCommandEvent& evt);
|
||||||
void onBreakpointClick(wxCommandEvent& evt);
|
void onBreakpointClick(wxCommandEvent& evt);
|
||||||
void onClose(wxCloseEvent& evt);
|
void onClose(wxCloseEvent& evt);
|
||||||
void stepOver();
|
void stepOver();
|
||||||
|
void stepInto();
|
||||||
private:
|
private:
|
||||||
CpuTabPage* eeTab;
|
CpuTabPage* eeTab;
|
||||||
CpuTabPage* iopTab;
|
CpuTabPage* iopTab;
|
||||||
|
|
Loading…
Reference in New Issue