mirror of https://github.com/PCSX2/pcsx2.git
debugger: memory view improvements
Highlight memory location referenced by current register Allow memory window not be aligned by row size Use radio and checks in menu
This commit is contained in:
parent
dc85989553
commit
268b4d9f9f
|
@ -58,6 +58,7 @@ enum MemoryViewMenuIdentifiers
|
||||||
ID_MEMVIEW_COPYVALUE_64,
|
ID_MEMVIEW_COPYVALUE_64,
|
||||||
ID_MEMVIEW_COPYVALUE_128,
|
ID_MEMVIEW_COPYVALUE_128,
|
||||||
ID_MEMVIEW_DUMP,
|
ID_MEMVIEW_DUMP,
|
||||||
|
ID_MEMVIEW_ALIGNWINDOW,
|
||||||
};
|
};
|
||||||
|
|
||||||
CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
||||||
|
@ -73,8 +74,9 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
||||||
selectedNibble = 0;
|
selectedNibble = 0;
|
||||||
addressStart = charWidth;
|
addressStart = charWidth;
|
||||||
hexStart = addressStart + 9*charWidth;
|
hexStart = addressStart + 9*charWidth;
|
||||||
|
alignWindowStart = true;
|
||||||
|
|
||||||
setRowSize(16);
|
setRowSize(32);
|
||||||
|
|
||||||
font = pxGetFixedFont(8);
|
font = pxGetFixedFont(8);
|
||||||
underlineFont = pxGetFixedFont(8, wxFONTWEIGHT_NORMAL, true);
|
underlineFont = pxGetFixedFont(8, wxFONTWEIGHT_NORMAL, true);
|
||||||
|
@ -85,11 +87,12 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
||||||
menu.Append(ID_MEMVIEW_COPYADDRESS, L"Copy address");
|
menu.Append(ID_MEMVIEW_COPYADDRESS, L"Copy address");
|
||||||
menu.Append(ID_MEMVIEW_FOLLOWADDRESS, L"Follow address");
|
menu.Append(ID_MEMVIEW_FOLLOWADDRESS, L"Follow address");
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
menu.Append(ID_MEMVIEW_DISPLAYVALUE_8, L"Display as 1 byte");
|
menu.AppendRadioItem(ID_MEMVIEW_DISPLAYVALUE_8, L"Display as 1 byte");
|
||||||
menu.Append(ID_MEMVIEW_DISPLAYVALUE_16, L"Display as 2 byte");
|
menu.AppendRadioItem(ID_MEMVIEW_DISPLAYVALUE_16, L"Display as 2 byte");
|
||||||
menu.Append(ID_MEMVIEW_DISPLAYVALUE_32, L"Display as 4 byte");
|
menu.AppendRadioItem(ID_MEMVIEW_DISPLAYVALUE_32, L"Display as 4 byte");
|
||||||
menu.Append(ID_MEMVIEW_DISPLAYVALUE_64, L"Display as 8 byte");
|
menu.AppendRadioItem(ID_MEMVIEW_DISPLAYVALUE_64, L"Display as 8 byte");
|
||||||
menu.Append(ID_MEMVIEW_DISPLAYVALUE_128, L"Display as 16 byte");
|
menu.AppendRadioItem(ID_MEMVIEW_DISPLAYVALUE_128, L"Display as 16 byte");
|
||||||
|
menu.Check(ID_MEMVIEW_DISPLAYVALUE_8, true);
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
menu.Append(ID_MEMVIEW_COPYVALUE_8, L"Copy Value (8 bit)");
|
menu.Append(ID_MEMVIEW_COPYVALUE_8, L"Copy Value (8 bit)");
|
||||||
menu.Append(ID_MEMVIEW_COPYVALUE_16, L"Copy Value (16 bit)");
|
menu.Append(ID_MEMVIEW_COPYVALUE_16, L"Copy Value (16 bit)");
|
||||||
|
@ -98,6 +101,9 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
||||||
menu.Append(ID_MEMVIEW_COPYVALUE_128, L"Copy Value (128 bit)");
|
menu.Append(ID_MEMVIEW_COPYVALUE_128, L"Copy Value (128 bit)");
|
||||||
menu.Append(ID_MEMVIEW_DUMP, L"Dump...");
|
menu.Append(ID_MEMVIEW_DUMP, L"Dump...");
|
||||||
menu.Enable(ID_MEMVIEW_DUMP,false);
|
menu.Enable(ID_MEMVIEW_DUMP,false);
|
||||||
|
menu.AppendSeparator();
|
||||||
|
menu.AppendCheckItem(ID_MEMVIEW_ALIGNWINDOW, L"Align window to row size");
|
||||||
|
menu.Check(ID_MEMVIEW_ALIGNWINDOW, alignWindowStart);
|
||||||
menu.Bind(wxEVT_MENU, &CtrlMemView::onPopupClick, this);
|
menu.Bind(wxEVT_MENU, &CtrlMemView::onPopupClick, this);
|
||||||
|
|
||||||
SetScrollbar(wxVERTICAL,100,1,201,true);
|
SetScrollbar(wxVERTICAL,100,1,201,true);
|
||||||
|
@ -164,6 +170,7 @@ void CtrlMemView::render(wxDC& dc)
|
||||||
const wxColor COLOR_BLACK = wxColor(0xFF000000);
|
const wxColor COLOR_BLACK = wxColor(0xFF000000);
|
||||||
const wxColor COLOR_SELECTED_BG = wxColor(0xFFFF9933);
|
const wxColor COLOR_SELECTED_BG = wxColor(0xFFFF9933);
|
||||||
const wxColor COLOR_SELECTED_INACTIVE_BG = wxColor(0xFFC0C0C0);
|
const wxColor COLOR_SELECTED_INACTIVE_BG = wxColor(0xFFC0C0C0);
|
||||||
|
const wxColor COLOR_REFRENCE_BG = wxColor(0xFFFFCFC8);
|
||||||
const wxColor COLOR_ADDRESS = wxColor(0xFF600000);
|
const wxColor COLOR_ADDRESS = wxColor(0xFF600000);
|
||||||
const wxColor COLOR_DELIMETER = wxColor(0xFFC0C0C0);
|
const wxColor COLOR_DELIMETER = wxColor(0xFFC0C0C0);
|
||||||
|
|
||||||
|
@ -221,6 +228,7 @@ void CtrlMemView::render(wxDC& dc)
|
||||||
|
|
||||||
u32 groupAddress = byteAddress - groupIndex;
|
u32 groupAddress = byteAddress - groupIndex;
|
||||||
|
|
||||||
|
bool backgroundIsDark = false;
|
||||||
if (curAddress >= groupAddress && curAddress < groupAddress + byteGroupSize)
|
if (curAddress >= groupAddress && curAddress < groupAddress + byteGroupSize)
|
||||||
{
|
{
|
||||||
// if group selected, draw rectangle behind
|
// if group selected, draw rectangle behind
|
||||||
|
@ -237,12 +245,17 @@ void CtrlMemView::render(wxDC& dc)
|
||||||
dc.DrawRectangle(groupPosX, rowY, groupWidth, rowHeight);
|
dc.DrawRectangle(groupPosX, rowY, groupWidth, rowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetTextForeground((hasFocus && !asciiSelected) ? COLOR_WHITE : COLOR_BLACK);
|
backgroundIsDark = hasFocus && !asciiSelected;
|
||||||
}
|
}
|
||||||
else {
|
if (groupAddress + groupIndex == referencedAddress) {
|
||||||
dc.SetTextForeground(COLOR_BLACK);
|
dc.SetPen(COLOR_REFRENCE_BG);
|
||||||
|
dc.SetBrush(COLOR_REFRENCE_BG);
|
||||||
|
dc.DrawRectangle(symbolPosX, rowY, charWidth*2, rowHeight);
|
||||||
|
backgroundIsDark = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dc.SetTextForeground(backgroundIsDark ? COLOR_WHITE : COLOR_BLACK);
|
||||||
|
|
||||||
swprintf(temp, TEMP_SIZE, byteValid ? L"%02X" : L"??", byteCurrent);
|
swprintf(temp, TEMP_SIZE, byteValid ? L"%02X" : L"??", byteCurrent);
|
||||||
// if selected byte, need hint current nibble
|
// if selected byte, need hint current nibble
|
||||||
if (byteAddress == curAddress) {
|
if (byteAddress == curAddress) {
|
||||||
|
@ -383,6 +396,12 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ID_MEMVIEW_ALIGNWINDOW:
|
||||||
|
if (alignWindowStart = evt.IsChecked()) {
|
||||||
|
windowStart -= windowStart % rowSize;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,17 +420,19 @@ void CtrlMemView::mouseEvent(wxMouseEvent& evt)
|
||||||
|
|
||||||
menu.Enable(ID_MEMVIEW_FOLLOWADDRESS, (curAddress & 3) == 0);
|
menu.Enable(ID_MEMVIEW_FOLLOWADDRESS, (curAddress & 3) == 0);
|
||||||
|
|
||||||
menu.Enable(ID_MEMVIEW_DISPLAYVALUE_8, byteGroupSize != 1);
|
menu.Check(ID_MEMVIEW_DISPLAYVALUE_8, byteGroupSize == 1);
|
||||||
menu.Enable(ID_MEMVIEW_DISPLAYVALUE_16, byteGroupSize != 2);
|
menu.Check(ID_MEMVIEW_DISPLAYVALUE_16, byteGroupSize == 2);
|
||||||
menu.Enable(ID_MEMVIEW_DISPLAYVALUE_32, byteGroupSize != 4);
|
menu.Check(ID_MEMVIEW_DISPLAYVALUE_32, byteGroupSize == 4);
|
||||||
menu.Enable(ID_MEMVIEW_DISPLAYVALUE_64, byteGroupSize != 8);
|
menu.Check(ID_MEMVIEW_DISPLAYVALUE_64, byteGroupSize == 8);
|
||||||
menu.Enable(ID_MEMVIEW_DISPLAYVALUE_128, byteGroupSize != 16);
|
menu.Check(ID_MEMVIEW_DISPLAYVALUE_128, byteGroupSize == 16);
|
||||||
|
|
||||||
menu.Enable(ID_MEMVIEW_COPYVALUE_128,(curAddress & 15) == 0);
|
menu.Enable(ID_MEMVIEW_COPYVALUE_128,(curAddress & 15) == 0);
|
||||||
menu.Enable(ID_MEMVIEW_COPYVALUE_64,(curAddress & 7) == 0);
|
menu.Enable(ID_MEMVIEW_COPYVALUE_64,(curAddress & 7) == 0);
|
||||||
menu.Enable(ID_MEMVIEW_COPYVALUE_32,(curAddress & 3) == 0);
|
menu.Enable(ID_MEMVIEW_COPYVALUE_32,(curAddress & 3) == 0);
|
||||||
menu.Enable(ID_MEMVIEW_COPYVALUE_16,(curAddress & 1) == 0);
|
menu.Enable(ID_MEMVIEW_COPYVALUE_16,(curAddress & 1) == 0);
|
||||||
|
|
||||||
|
menu.Check(ID_MEMVIEW_ALIGNWINDOW, alignWindowStart);
|
||||||
|
|
||||||
PopupMenu(&menu);
|
PopupMenu(&menu);
|
||||||
return;
|
return;
|
||||||
} else if (evt.GetEventType() == wxEVT_MOUSEWHEEL)
|
} else if (evt.GetEventType() == wxEVT_MOUSEWHEEL)
|
||||||
|
@ -638,11 +659,15 @@ void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory)
|
||||||
curAddress = addr;
|
curAddress = addr;
|
||||||
selectedNibble = 0;
|
selectedNibble = 0;
|
||||||
|
|
||||||
int visibleRows = GetClientSize().y/rowHeight;
|
if (alignWindowStart) {
|
||||||
u32 windowEnd = windowStart+visibleRows*rowSize;
|
int visibleRows = GetClientSize().y / rowHeight;
|
||||||
|
u32 windowEnd = windowStart + visibleRows*rowSize;
|
||||||
|
|
||||||
if (curAddress < windowStart || curAddress >= windowEnd)
|
if (curAddress < windowStart || curAddress >= windowEnd)
|
||||||
windowStart = (curAddress / rowSize) * rowSize;
|
windowStart = (curAddress / rowSize) * rowSize;
|
||||||
|
} else {
|
||||||
|
windowStart = curAddress;
|
||||||
|
}
|
||||||
|
|
||||||
updateStatusBarText();
|
updateStatusBarText();
|
||||||
redraw();
|
redraw();
|
||||||
|
@ -699,3 +724,8 @@ void CtrlMemView::gotoPoint(int x, int y)
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CtrlMemView::updateReference(u32 address) {
|
||||||
|
referencedAddress = address;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
void charEvent(wxKeyEvent& evt);
|
void charEvent(wxKeyEvent& evt);
|
||||||
void redraw();
|
void redraw();
|
||||||
void gotoAddress(u32 address, bool pushInHistory = false);
|
void gotoAddress(u32 address, bool pushInHistory = false);
|
||||||
|
void updateReference(u32 address);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
private:
|
private:
|
||||||
|
@ -50,7 +51,9 @@ private:
|
||||||
int rowHeight;
|
int rowHeight;
|
||||||
int charWidth;
|
int charWidth;
|
||||||
u32 windowStart;
|
u32 windowStart;
|
||||||
u32 curAddress;
|
bool alignWindowStart;
|
||||||
|
u32 curAddress; // current selected address
|
||||||
|
u32 referencedAddress; // refrenced by register
|
||||||
u32 byteGroupSize;
|
u32 byteGroupSize;
|
||||||
int rowSize;
|
int rowSize;
|
||||||
wxFont font,underlineFont;
|
wxFont font,underlineFont;
|
||||||
|
|
|
@ -480,6 +480,8 @@ void CtrlRegisterList::setCurrentRow(int row)
|
||||||
{
|
{
|
||||||
case DebugInterface::NORMAL:
|
case DebugInterface::NORMAL:
|
||||||
value = cpu->getRegister(category,row);
|
value = cpu->getRegister(category,row);
|
||||||
|
postEvent(debEVT_REFERENCEMEMORYVIEW, value._u32[0]);
|
||||||
|
|
||||||
switch (cpu->getRegisterSize(category))
|
switch (cpu->getRegisterSize(category))
|
||||||
{
|
{
|
||||||
case 128:
|
case 128:
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
wxDEFINE_EVENT(debEVT_SETSTATUSBARTEXT, wxCommandEvent);
|
wxDEFINE_EVENT(debEVT_SETSTATUSBARTEXT, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(debEVT_UPDATELAYOUT, wxCommandEvent);
|
wxDEFINE_EVENT(debEVT_UPDATELAYOUT, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(debEVT_GOTOINMEMORYVIEW, wxCommandEvent);
|
wxDEFINE_EVENT(debEVT_GOTOINMEMORYVIEW, wxCommandEvent);
|
||||||
|
wxDEFINE_EVENT(debEVT_REFERENCEMEMORYVIEW, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(debEVT_GOTOINDISASM, wxCommandEvent);
|
wxDEFINE_EVENT(debEVT_GOTOINDISASM, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(debEVT_RUNTOPOS, wxCommandEvent);
|
wxDEFINE_EVENT(debEVT_RUNTOPOS, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(debEVT_MAPLOADED, wxCommandEvent);
|
wxDEFINE_EVENT(debEVT_MAPLOADED, wxCommandEvent);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
wxDECLARE_EVENT(debEVT_SETSTATUSBARTEXT, wxCommandEvent);
|
wxDECLARE_EVENT(debEVT_SETSTATUSBARTEXT, wxCommandEvent);
|
||||||
wxDECLARE_EVENT(debEVT_UPDATELAYOUT, wxCommandEvent);
|
wxDECLARE_EVENT(debEVT_UPDATELAYOUT, wxCommandEvent);
|
||||||
wxDECLARE_EVENT(debEVT_GOTOINMEMORYVIEW, wxCommandEvent);
|
wxDECLARE_EVENT(debEVT_GOTOINMEMORYVIEW, wxCommandEvent);
|
||||||
|
wxDECLARE_EVENT(debEVT_REFERENCEMEMORYVIEW, wxCommandEvent);
|
||||||
wxDECLARE_EVENT(debEVT_GOTOINDISASM, wxCommandEvent);
|
wxDECLARE_EVENT(debEVT_GOTOINDISASM, wxCommandEvent);
|
||||||
wxDECLARE_EVENT(debEVT_RUNTOPOS, wxCommandEvent);
|
wxDECLARE_EVENT(debEVT_RUNTOPOS, wxCommandEvent);
|
||||||
wxDECLARE_EVENT(debEVT_MAPLOADED, wxCommandEvent);
|
wxDECLARE_EVENT(debEVT_MAPLOADED, wxCommandEvent);
|
||||||
|
|
|
@ -31,6 +31,7 @@ BEGIN_EVENT_TABLE(DisassemblyDialog, wxFrame)
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_SETSTATUSBARTEXT, DisassemblyDialog::onDebuggerEvent )
|
EVT_COMMAND( wxID_ANY, debEVT_SETSTATUSBARTEXT, DisassemblyDialog::onDebuggerEvent )
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_UPDATELAYOUT, DisassemblyDialog::onDebuggerEvent )
|
EVT_COMMAND( wxID_ANY, debEVT_UPDATELAYOUT, DisassemblyDialog::onDebuggerEvent )
|
||||||
EVT_COMMAND( wxID_ANY, debEVT_GOTOINMEMORYVIEW, 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 )
|
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 )
|
||||||
|
@ -505,6 +506,12 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
||||||
currentCpu->getMemoryView()->gotoAddress(evt.GetInt(), true);
|
currentCpu->getMemoryView()->gotoAddress(evt.GetInt(), true);
|
||||||
currentCpu->getDisassembly()->SetFocus();
|
currentCpu->getDisassembly()->SetFocus();
|
||||||
}
|
}
|
||||||
|
} else if (type == debEVT_REFERENCEMEMORYVIEW)
|
||||||
|
{
|
||||||
|
if (currentCpu != NULL)
|
||||||
|
{
|
||||||
|
currentCpu->getMemoryView()->updateReference(evt.GetInt());
|
||||||
|
}
|
||||||
} else if (type == debEVT_RUNTOPOS)
|
} else if (type == debEVT_RUNTOPOS)
|
||||||
{
|
{
|
||||||
// todo: breakpoints for iop
|
// todo: breakpoints for iop
|
||||||
|
|
Loading…
Reference in New Issue