Debugger: Add "Go to address" for both disasm and memory view

This commit is contained in:
ty 2021-02-24 17:59:40 -05:00 committed by refractionpcsx2
parent 1bb398c6c2
commit cb56b3f76b
5 changed files with 32 additions and 1 deletions

View File

@ -62,6 +62,7 @@ enum DisassemblyMenuIdentifiers
ID_DISASM_SETPCTOHERE,
ID_DISASM_TOGGLEBREAKPOINT,
ID_DISASM_FOLLOWBRANCH,
ID_DISASM_GOTOADDRESS,
ID_DISASM_GOTOINMEMORYVIEW,
ID_DISASM_KILLFUNCTION,
ID_DISASM_RENAMEFUNCTION,
@ -168,6 +169,7 @@ CtrlDisassemblyView::CtrlDisassemblyView(wxWindow* parent, DebugInterface* _cpu)
menu.Append(ID_DISASM_TOGGLEBREAKPOINT, L"Toggle Breakpoint");
menu.Append(ID_DISASM_FOLLOWBRANCH, L"Follow Branch");
menu.AppendSeparator();
menu.Append(ID_DISASM_GOTOADDRESS, L"Go to Address");
menu.Append(ID_DISASM_GOTOINMEMORYVIEW, L"Go to in Memory View");
menu.AppendSeparator();
menu.Append(ID_DISASM_ADDFUNCTION, L"Add Function Here");
@ -669,6 +671,9 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
wxTheClipboard->Close();
}
break;
case ID_DISASM_GOTOADDRESS:
postEvent(debEVT_GOTOADDRESS, 0);
break;
case ID_DISASM_GOTOINMEMORYVIEW:
postEvent(debEVT_GOTOINMEMORYVIEW,curAddress);
break;
@ -685,6 +690,9 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
case ID_DISASM_RUNTOHERE:
postEvent(debEVT_RUNTOPOS,curAddress);
break;
case ID_DISASM_TOGGLEBREAKPOINT:
toggleBreakpoint(false);
break;
case ID_DISASM_DISASSEMBLETOFILE:
disassembleToFile();
break;

View File

@ -45,6 +45,7 @@ wxEND_EVENT_TABLE()
enum MemoryViewMenuIdentifiers
{
ID_MEMVIEW_GOTOINDISASM = 1,
ID_MEMVIEW_GOTOADDRESS,
ID_MEMVIEW_COPYADDRESS,
ID_MEMVIEW_FOLLOWADDRESS,
ID_MEMVIEW_DISPLAYVALUE_8,
@ -82,6 +83,7 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
underlineFont.SetPixelSize(wxSize(charWidth,rowHeight));
menu.Append(ID_MEMVIEW_GOTOINDISASM, L"Go to in Disasm");
menu.Append(ID_MEMVIEW_GOTOADDRESS, L"Go to address");
menu.Append(ID_MEMVIEW_COPYADDRESS, L"Copy address");
menu.Append(ID_MEMVIEW_FOLLOWADDRESS, L"Follow address");
menu.AppendSeparator();
@ -326,7 +328,10 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
}
break;
case ID_MEMVIEW_GOTOINDISASM:
postEvent(debEVT_GOTOINDISASM,curAddress);
postEvent(debEVT_GOTOINDISASM,1);
break;
case ID_MEMVIEW_GOTOADDRESS:
postEvent(debEVT_GOTOADDRESS, curAddress);
break;
case ID_MEMVIEW_FOLLOWADDRESS:
gotoAddress(cpu->read32(curAddress), true);

View File

@ -18,6 +18,7 @@
wxDEFINE_EVENT(debEVT_SETSTATUSBARTEXT, wxCommandEvent);
wxDEFINE_EVENT(debEVT_UPDATELAYOUT, wxCommandEvent);
wxDEFINE_EVENT(debEVT_GOTOADDRESS, wxCommandEvent);
wxDEFINE_EVENT(debEVT_GOTOINMEMORYVIEW, wxCommandEvent);
wxDEFINE_EVENT(debEVT_REFERENCEMEMORYVIEW, wxCommandEvent);
wxDEFINE_EVENT(debEVT_GOTOINDISASM, wxCommandEvent);

View File

@ -19,6 +19,7 @@
wxDECLARE_EVENT(debEVT_SETSTATUSBARTEXT, wxCommandEvent);
wxDECLARE_EVENT(debEVT_UPDATELAYOUT, wxCommandEvent);
wxDECLARE_EVENT(debEVT_GOTOADDRESS, wxCommandEvent);
wxDECLARE_EVENT(debEVT_GOTOINMEMORYVIEW, wxCommandEvent);
wxDECLARE_EVENT(debEVT_REFERENCEMEMORYVIEW, wxCommandEvent);
wxDECLARE_EVENT(debEVT_GOTOINDISASM, wxCommandEvent);

View File

@ -33,6 +33,7 @@
wxBEGIN_EVENT_TABLE(DisassemblyDialog, wxFrame)
EVT_COMMAND( wxID_ANY, debEVT_SETSTATUSBARTEXT, DisassemblyDialog::onDebuggerEvent )
EVT_COMMAND( wxID_ANY, debEVT_UPDATELAYOUT, DisassemblyDialog::onDebuggerEvent )
EVT_COMMAND( wxID_ANY, debEVT_GOTOADDRESS, DisassemblyDialog::onDebuggerEvent )
EVT_COMMAND( wxID_ANY, debEVT_GOTOINMEMORYVIEW, DisassemblyDialog::onDebuggerEvent )
EVT_COMMAND( wxID_ANY, debEVT_REFERENCEMEMORYVIEW, DisassemblyDialog::onDebuggerEvent )
EVT_COMMAND( wxID_ANY, debEVT_RUNTOPOS, DisassemblyDialog::onDebuggerEvent )
@ -483,6 +484,21 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
currentCpu->GetSizer()->Layout();
topSizer->Layout();
update();
} else if (type == debEVT_GOTOADDRESS)
{
DebugInterface* cpu = reinterpret_cast<DebugInterface*>(evt.GetClientData());
u64 addr;
if (!executeExpressionWindow(this, cpu, addr))
return;
if (currentCpu != NULL) {
// GetInt() is 0 when called by the disassembly view, 1 when called by the memory view
if (!evt.GetInt())
currentCpu->getDisassembly()->gotoAddress(addr);
else
currentCpu->getMemoryView()->gotoAddress(addr);
}
update();
} else if (type == debEVT_GOTOINMEMORYVIEW)
{
if (currentCpu != NULL)