mirror of https://github.com/PCSX2/pcsx2.git
clang-format: Debugger files (check commit message)
gui/Debugger/CtrlDisassemblyView.cpp gui/Debugger/CtrlMemView.cpp gui/DebugerLists.cpp Had to manually format wx event tables
This commit is contained in:
parent
58a9460f7c
commit
efd2df8a33
File diff suppressed because it is too large
Load Diff
|
@ -62,7 +62,8 @@ enum MemoryViewMenuIdentifiers
|
|||
};
|
||||
|
||||
CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
||||
: wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxVSCROLL), cpu(_cpu)
|
||||
: wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxVSCROLL)
|
||||
, cpu(_cpu)
|
||||
{
|
||||
rowHeight = getDebugFontHeight();
|
||||
charWidth = getDebugFontWidth();
|
||||
|
@ -73,14 +74,14 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
|||
asciiSelected = false;
|
||||
selectedNibble = 0;
|
||||
addressStart = charWidth;
|
||||
hexStart = addressStart + 9*charWidth;
|
||||
hexStart = addressStart + 9 * charWidth;
|
||||
|
||||
setRowSize(g_Conf->EmuOptions.Debugger.MemoryViewBytesPerRow);
|
||||
|
||||
font = pxGetFixedFont(8);
|
||||
underlineFont = pxGetFixedFont(8, wxFONTWEIGHT_NORMAL, true);
|
||||
font.SetPixelSize(wxSize(charWidth,rowHeight));
|
||||
underlineFont.SetPixelSize(wxSize(charWidth,rowHeight));
|
||||
font.SetPixelSize(wxSize(charWidth, rowHeight));
|
||||
underlineFont.SetPixelSize(wxSize(charWidth, rowHeight));
|
||||
|
||||
menu.Append(ID_MEMVIEW_GOTOINDISASM, L"Go to in Disasm");
|
||||
menu.Append(ID_MEMVIEW_GOTOADDRESS, L"Go to address");
|
||||
|
@ -104,34 +105,35 @@ CtrlMemView::CtrlMemView(wxWindow* parent, DebugInterface* _cpu)
|
|||
menu.Check(ID_MEMVIEW_ALIGNWINDOW, g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart);
|
||||
menu.Bind(wxEVT_MENU, &CtrlMemView::onPopupClick, this);
|
||||
|
||||
SetScrollbar(wxVERTICAL,100,1,201,true);
|
||||
SetScrollbar(wxVERTICAL, 100, 1, 201, true);
|
||||
SetDoubleBuffered(true);
|
||||
}
|
||||
|
||||
void CtrlMemView::setRowSize(int bytesInRow) {
|
||||
void CtrlMemView::setRowSize(int bytesInRow)
|
||||
{
|
||||
rowSize = (std::max(16, std::min(256, bytesInRow)) / 16) * 16;
|
||||
asciiStart = hexStart + (rowSize * 3 + 1)*charWidth;
|
||||
asciiStart = hexStart + (rowSize * 3 + 1) * charWidth;
|
||||
}
|
||||
|
||||
void CtrlMemView::postEvent(wxEventType type, wxString text)
|
||||
{
|
||||
wxCommandEvent event( type, GetId() );
|
||||
wxCommandEvent event(type, GetId());
|
||||
event.SetEventObject(this);
|
||||
event.SetClientData(cpu);
|
||||
event.SetString(text);
|
||||
wxPostEvent(this,event);
|
||||
wxPostEvent(this, event);
|
||||
}
|
||||
|
||||
void CtrlMemView::postEvent(wxEventType type, int value)
|
||||
{
|
||||
wxCommandEvent event( type, GetId() );
|
||||
wxCommandEvent event(type, GetId());
|
||||
event.SetEventObject(this);
|
||||
event.SetClientData(cpu);
|
||||
event.SetInt(value);
|
||||
wxPostEvent(this,event);
|
||||
wxPostEvent(this, event);
|
||||
}
|
||||
|
||||
void CtrlMemView::paintEvent(wxPaintEvent & evt)
|
||||
void CtrlMemView::paintEvent(wxPaintEvent& evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
render(dc);
|
||||
|
@ -192,7 +194,7 @@ void CtrlMemView::render(wxDC& dc)
|
|||
u32 rowAddress = windowStart + i * rowSize;
|
||||
int rowY = rowHeight * i;
|
||||
|
||||
swprintf(temp, TEMP_SIZE, L"%08X" , rowAddress);
|
||||
swprintf(temp, TEMP_SIZE, L"%08X", rowAddress);
|
||||
dc.SetFont(font);
|
||||
dc.SetTextForeground(COLOR_ADDRESS);
|
||||
dc.DrawText(temp, addressStart, rowY);
|
||||
|
@ -203,13 +205,15 @@ void CtrlMemView::render(wxDC& dc)
|
|||
u8 byteCurrent = 0;
|
||||
bool byteValid = false;
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
byteValid = validCpu && cpu->isValidAddress(byteAddress);
|
||||
|
||||
if (byteValid)
|
||||
byteCurrent = cpu->read8(byteAddress);
|
||||
}
|
||||
catch (Exception::Ps2Generic &) {
|
||||
catch (Exception::Ps2Generic&)
|
||||
{
|
||||
byteValid = false;
|
||||
}
|
||||
|
||||
|
@ -230,12 +234,15 @@ void CtrlMemView::render(wxDC& dc)
|
|||
if (curAddress >= groupAddress && curAddress < groupAddress + byteGroupSize)
|
||||
{
|
||||
// if group selected, draw rectangle behind
|
||||
if (groupIndex == 0) {
|
||||
if (hasFocus && !asciiSelected) {
|
||||
if (groupIndex == 0)
|
||||
{
|
||||
if (hasFocus && !asciiSelected)
|
||||
{
|
||||
dc.SetPen(COLOR_SELECTED_BG);
|
||||
dc.SetBrush(COLOR_SELECTED_BG);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dc.SetPen(COLOR_SELECTED_INACTIVE_BG);
|
||||
dc.SetBrush(COLOR_SELECTED_INACTIVE_BG);
|
||||
}
|
||||
|
@ -245,10 +252,11 @@ void CtrlMemView::render(wxDC& dc)
|
|||
|
||||
backgroundIsDark = hasFocus && !asciiSelected;
|
||||
}
|
||||
if (groupAddress + groupIndex == referencedAddress) {
|
||||
if (groupAddress + groupIndex == referencedAddress)
|
||||
{
|
||||
dc.SetPen(COLOR_REFRENCE_BG);
|
||||
dc.SetBrush(COLOR_REFRENCE_BG);
|
||||
dc.DrawRectangle(symbolPosX, rowY, charWidth*2, rowHeight);
|
||||
dc.DrawRectangle(symbolPosX, rowY, charWidth * 2, rowHeight);
|
||||
backgroundIsDark = false;
|
||||
}
|
||||
|
||||
|
@ -256,7 +264,8 @@ void CtrlMemView::render(wxDC& dc)
|
|||
|
||||
swprintf(temp, TEMP_SIZE, byteValid ? L"%02X" : L"??", byteCurrent);
|
||||
// if selected byte, need hint current nibble
|
||||
if (byteAddress == curAddress) {
|
||||
if (byteAddress == curAddress)
|
||||
{
|
||||
if (selectedNibble == 1)
|
||||
dc.SetFont(underlineFont);
|
||||
|
||||
|
@ -273,7 +282,8 @@ void CtrlMemView::render(wxDC& dc)
|
|||
if (selectedNibble == 0)
|
||||
dc.SetFont(font);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dc.DrawText(temp, symbolPosX, rowY);
|
||||
}
|
||||
|
||||
|
@ -281,30 +291,34 @@ void CtrlMemView::render(wxDC& dc)
|
|||
temp[1] = 0;
|
||||
temp[0] = (!byteValid || byteCurrent < 32 || byteCurrent > 128) ? '.' : byteCurrent;
|
||||
|
||||
if (byteAddress == curAddress) {
|
||||
if (hasFocus && asciiSelected) {
|
||||
if (byteAddress == curAddress)
|
||||
{
|
||||
if (hasFocus && asciiSelected)
|
||||
{
|
||||
dc.SetPen(COLOR_SELECTED_BG);
|
||||
dc.SetBrush(COLOR_SELECTED_BG);
|
||||
dc.SetTextForeground(COLOR_WHITE);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dc.SetPen(COLOR_SELECTED_INACTIVE_BG);
|
||||
dc.SetBrush(COLOR_SELECTED_INACTIVE_BG);
|
||||
dc.SetTextForeground(COLOR_BLACK);
|
||||
}
|
||||
dc.DrawRectangle(asciiStart + j*(charWidth + 2), rowY, charWidth, rowHeight);
|
||||
dc.DrawRectangle(asciiStart + j * (charWidth + 2), rowY, charWidth, rowHeight);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dc.SetTextForeground(COLOR_BLACK);
|
||||
}
|
||||
|
||||
dc.DrawText(temp, asciiStart + j*(charWidth + 2), rowY);
|
||||
dc.DrawText(temp, asciiStart + j * (charWidth + 2), rowY);
|
||||
}
|
||||
}
|
||||
|
||||
dc.SetPen(COLOR_DELIMETER);
|
||||
dc.SetBrush(COLOR_DELIMETER);
|
||||
int linestep = std::max((u32) 4, byteGroupSize);
|
||||
int linestep = std::max((u32)4, byteGroupSize);
|
||||
for (int i = linestep; i < rowSize; i += linestep)
|
||||
{
|
||||
int x = hexStart + i * 3 * charWidth - charWidth / 2;
|
||||
|
@ -322,13 +336,13 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
case ID_MEMVIEW_COPYADDRESS:
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
swprintf(str,64,L"%08X",curAddress);
|
||||
swprintf(str, 64, L"%08X", curAddress);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
break;
|
||||
case ID_MEMVIEW_GOTOINDISASM:
|
||||
postEvent(debEVT_GOTOINDISASM,1);
|
||||
postEvent(debEVT_GOTOINDISASM, 1);
|
||||
break;
|
||||
case ID_MEMVIEW_GOTOADDRESS:
|
||||
postEvent(debEVT_GOTOADDRESS, curAddress);
|
||||
|
@ -359,7 +373,7 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
case ID_MEMVIEW_COPYVALUE_8:
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
swprintf(str,64,L"%02X",cpu->read8(curAddress));
|
||||
swprintf(str, 64, L"%02X", cpu->read8(curAddress));
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
@ -367,7 +381,7 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
case ID_MEMVIEW_COPYVALUE_16:
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
swprintf(str,64,L"%04X",cpu->read16(curAddress));
|
||||
swprintf(str, 64, L"%04X", cpu->read16(curAddress));
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
@ -375,7 +389,7 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
case ID_MEMVIEW_COPYVALUE_32:
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
swprintf(str,64,L"%08X",cpu->read32(curAddress));
|
||||
swprintf(str, 64, L"%08X", cpu->read32(curAddress));
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
@ -383,7 +397,7 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
case ID_MEMVIEW_COPYVALUE_64:
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
swprintf(str,64,L"%016llX",cpu->read64(curAddress));
|
||||
swprintf(str, 64, L"%016llX", cpu->read64(curAddress));
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
@ -392,14 +406,15 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
if (wxTheClipboard->Open())
|
||||
{
|
||||
u128 value = cpu->read128(curAddress);
|
||||
swprintf(str,64,L"%016llX%016llX",value._u64[1],value._u64[0]);
|
||||
swprintf(str, 64, L"%016llX%016llX", value._u64[1], value._u64[0]);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
break;
|
||||
case ID_MEMVIEW_ALIGNWINDOW:
|
||||
g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart = evt.IsChecked();
|
||||
if (g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart) {
|
||||
if (g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart)
|
||||
{
|
||||
windowStart -= windowStart % rowSize;
|
||||
redraw();
|
||||
}
|
||||
|
@ -410,13 +425,13 @@ void CtrlMemView::onPopupClick(wxCommandEvent& evt)
|
|||
void CtrlMemView::mouseEvent(wxMouseEvent& evt)
|
||||
{
|
||||
// left button
|
||||
if (evt.GetEventType() == wxEVT_LEFT_DOWN || evt.GetEventType() == wxEVT_LEFT_DCLICK
|
||||
|| evt.GetEventType() == wxEVT_RIGHT_DOWN || evt.GetEventType() == wxEVT_RIGHT_DCLICK)
|
||||
if (evt.GetEventType() == wxEVT_LEFT_DOWN || evt.GetEventType() == wxEVT_LEFT_DCLICK || evt.GetEventType() == wxEVT_RIGHT_DOWN || evt.GetEventType() == wxEVT_RIGHT_DCLICK)
|
||||
{
|
||||
gotoPoint(evt.GetPosition().x,evt.GetPosition().y);
|
||||
gotoPoint(evt.GetPosition().x, evt.GetPosition().y);
|
||||
SetFocus();
|
||||
SetFocusFromKbd();
|
||||
} else if (evt.GetEventType() == wxEVT_RIGHT_UP)
|
||||
}
|
||||
else if (evt.GetEventType() == wxEVT_RIGHT_UP)
|
||||
{
|
||||
curAddress -= (curAddress - windowStart) % byteGroupSize;
|
||||
|
||||
|
@ -428,35 +443,43 @@ void CtrlMemView::mouseEvent(wxMouseEvent& evt)
|
|||
menu.Check(ID_MEMVIEW_DISPLAYVALUE_64, byteGroupSize == 8);
|
||||
menu.Check(ID_MEMVIEW_DISPLAYVALUE_128, byteGroupSize == 16);
|
||||
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_128,(curAddress & 15) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_64,(curAddress & 7) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_32,(curAddress & 3) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_16,(curAddress & 1) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_128, (curAddress & 15) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_64, (curAddress & 7) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_32, (curAddress & 3) == 0);
|
||||
menu.Enable(ID_MEMVIEW_COPYVALUE_16, (curAddress & 1) == 0);
|
||||
|
||||
menu.Check(ID_MEMVIEW_ALIGNWINDOW, g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart);
|
||||
|
||||
PopupMenu(&menu);
|
||||
return;
|
||||
} else if (evt.GetEventType() == wxEVT_MOUSEWHEEL)
|
||||
}
|
||||
else if (evt.GetEventType() == wxEVT_MOUSEWHEEL)
|
||||
{
|
||||
if (evt.ControlDown())
|
||||
{
|
||||
if (evt.GetWheelRotation() > 0)
|
||||
{
|
||||
if (evt.ControlDown()) {
|
||||
if (evt.GetWheelRotation() > 0) {
|
||||
setRowSize(rowSize + 16);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
setRowSize(rowSize - 16);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (evt.GetWheelRotation() > 0)
|
||||
{
|
||||
scrollWindow(-3);
|
||||
}
|
||||
else if (evt.GetWheelRotation() < 0) {
|
||||
else if (evt.GetWheelRotation() < 0)
|
||||
{
|
||||
scrollWindow(3);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
evt.Skip();
|
||||
return;
|
||||
}
|
||||
|
@ -474,7 +497,7 @@ void CtrlMemView::keydownEvent(wxKeyEvent& evt)
|
|||
case 'G':
|
||||
{
|
||||
u64 addr;
|
||||
if (!executeExpressionWindow(this,cpu,addr))
|
||||
if (!executeExpressionWindow(this, cpu, addr))
|
||||
return;
|
||||
|
||||
gotoAddress(addr, true);
|
||||
|
@ -483,11 +506,11 @@ void CtrlMemView::keydownEvent(wxKeyEvent& evt)
|
|||
case 'b':
|
||||
case 'B':
|
||||
{
|
||||
BreakpointWindow bpw(this,cpu);
|
||||
BreakpointWindow bpw(this, cpu);
|
||||
if (bpw.ShowModal() == wxID_OK)
|
||||
{
|
||||
bpw.addBreakpoint();
|
||||
postEvent(debEVT_UPDATE,0);
|
||||
postEvent(debEVT_UPDATE, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -526,13 +549,14 @@ void CtrlMemView::keydownEvent(wxKeyEvent& evt)
|
|||
scrollCursor(rowSize);
|
||||
break;
|
||||
case WXK_PAGEUP:
|
||||
scrollWindow(-GetClientSize().y/rowHeight);
|
||||
scrollWindow(-GetClientSize().y / rowHeight);
|
||||
break;
|
||||
case WXK_PAGEDOWN:
|
||||
scrollWindow(GetClientSize().y/rowHeight);
|
||||
scrollWindow(GetClientSize().y / rowHeight);
|
||||
break;
|
||||
case WXK_ESCAPE:
|
||||
if (!history.empty()) {
|
||||
if (!history.empty())
|
||||
{
|
||||
gotoAddress(history.top());
|
||||
history.pop();
|
||||
}
|
||||
|
@ -561,23 +585,27 @@ void CtrlMemView::charEvent(wxKeyEvent& evt)
|
|||
if (asciiSelected)
|
||||
{
|
||||
u8 newValue = evt.GetKeyCode();
|
||||
cpu->write8(curAddress,newValue);
|
||||
cpu->write8(curAddress, newValue);
|
||||
scrollCursor(1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 key = tolower(evt.GetKeyCode());
|
||||
int inputValue = -1;
|
||||
|
||||
if (key >= '0' && key <= '9') inputValue = key - '0';
|
||||
if (key >= 'a' && key <= 'f') inputValue = key -'a' + 10;
|
||||
if (key >= '0' && key <= '9')
|
||||
inputValue = key - '0';
|
||||
if (key >= 'a' && key <= 'f')
|
||||
inputValue = key - 'a' + 10;
|
||||
|
||||
if (inputValue >= 0)
|
||||
{
|
||||
int shiftAmount = (1-selectedNibble)*4;
|
||||
int shiftAmount = (1 - selectedNibble) * 4;
|
||||
|
||||
u8 oldValue = cpu->read8(curAddress);
|
||||
oldValue &= ~(0xF << shiftAmount);
|
||||
u8 newValue = oldValue | (inputValue << shiftAmount);
|
||||
cpu->write8(curAddress,newValue);
|
||||
cpu->write8(curAddress, newValue);
|
||||
scrollCursor(1);
|
||||
}
|
||||
}
|
||||
|
@ -593,15 +621,18 @@ void CtrlMemView::scrollbarEvent(wxScrollWinEvent& evt)
|
|||
if (type == wxEVT_SCROLLWIN_LINEUP)
|
||||
{
|
||||
scrollCursor(-rowSize);
|
||||
} else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||
}
|
||||
else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||
{
|
||||
scrollCursor(rowSize);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||
}
|
||||
else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||
{
|
||||
scrollWindow(-GetClientSize().y/rowHeight);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||
scrollWindow(-GetClientSize().y / rowHeight);
|
||||
}
|
||||
else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||
{
|
||||
scrollWindow(GetClientSize().y/rowHeight);
|
||||
scrollWindow(GetClientSize().y / rowHeight);
|
||||
}
|
||||
|
||||
redraw();
|
||||
|
@ -609,8 +640,8 @@ void CtrlMemView::scrollbarEvent(wxScrollWinEvent& evt)
|
|||
|
||||
void CtrlMemView::scrollWindow(int lines)
|
||||
{
|
||||
windowStart += lines*rowSize;
|
||||
curAddress += lines*rowSize;
|
||||
windowStart += lines * rowSize;
|
||||
curAddress += lines * rowSize;
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
@ -622,15 +653,20 @@ void CtrlMemView::scrollCursor(int bytes)
|
|||
{
|
||||
selectedNibble = 1;
|
||||
bytes = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedNibble = 0;
|
||||
}
|
||||
} else if (!asciiSelected && bytes == -1)
|
||||
}
|
||||
else if (!asciiSelected && bytes == -1)
|
||||
{
|
||||
if (selectedNibble == 0)
|
||||
{
|
||||
selectedNibble = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedNibble = 0;
|
||||
bytes = 0;
|
||||
}
|
||||
|
@ -638,15 +674,16 @@ void CtrlMemView::scrollCursor(int bytes)
|
|||
|
||||
curAddress += bytes;
|
||||
|
||||
int visibleRows = GetClientSize().y/rowHeight;
|
||||
u32 windowEnd = windowStart+visibleRows*rowSize;
|
||||
int visibleRows = GetClientSize().y / rowHeight;
|
||||
u32 windowEnd = windowStart + visibleRows * rowSize;
|
||||
|
||||
if (curAddress < windowStart)
|
||||
{
|
||||
windowStart = (curAddress / rowSize) * rowSize;
|
||||
} else if (curAddress >= windowEnd)
|
||||
}
|
||||
else if (curAddress >= windowEnd)
|
||||
{
|
||||
windowStart = curAddress - (visibleRows - 1)*rowSize;
|
||||
windowStart = curAddress - (visibleRows - 1) * rowSize;
|
||||
windowStart = (windowStart / rowSize) * rowSize;
|
||||
}
|
||||
|
||||
|
@ -663,7 +700,7 @@ void CtrlMemView::updateStatusBarText()
|
|||
|
||||
swprintf(text, 64, L"%08X %08X", curAddress, addr);
|
||||
|
||||
postEvent(debEVT_SETSTATUSBARTEXT,text);
|
||||
postEvent(debEVT_SETSTATUSBARTEXT, text);
|
||||
}
|
||||
|
||||
void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory)
|
||||
|
@ -674,13 +711,16 @@ void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory)
|
|||
curAddress = addr;
|
||||
selectedNibble = 0;
|
||||
|
||||
if (g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart) {
|
||||
if (g_Conf->EmuOptions.Debugger.AlignMemoryWindowStart)
|
||||
{
|
||||
int visibleRows = GetClientSize().y / rowHeight;
|
||||
u32 windowEnd = windowStart + visibleRows*rowSize;
|
||||
u32 windowEnd = windowStart + visibleRows * rowSize;
|
||||
|
||||
if (curAddress < windowStart || curAddress >= windowEnd)
|
||||
windowStart = (curAddress / rowSize) * rowSize;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
windowStart = curAddress;
|
||||
}
|
||||
|
||||
|
@ -690,22 +730,24 @@ void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory)
|
|||
|
||||
void CtrlMemView::gotoPoint(int x, int y)
|
||||
{
|
||||
int line = y/rowHeight;
|
||||
int lineAddress = windowStart+line*rowSize;
|
||||
int line = y / rowHeight;
|
||||
int lineAddress = windowStart + line * rowSize;
|
||||
|
||||
if (x >= asciiStart)
|
||||
{
|
||||
int col = (x-asciiStart) / (charWidth+2);
|
||||
if (col >= rowSize) return;
|
||||
int col = (x - asciiStart) / (charWidth + 2);
|
||||
if (col >= rowSize)
|
||||
return;
|
||||
|
||||
asciiSelected = true;
|
||||
curAddress = lineAddress+col;
|
||||
curAddress = lineAddress + col;
|
||||
selectedNibble = 0;
|
||||
updateStatusBarText();
|
||||
redraw();
|
||||
} else if (x >= hexStart)
|
||||
}
|
||||
else if (x >= hexStart)
|
||||
{
|
||||
int col = (x-hexStart);
|
||||
int col = (x - hexStart);
|
||||
|
||||
int groupWidth = byteGroupSize * charWidth * 3;
|
||||
int group = col / groupWidth;
|
||||
|
@ -714,9 +756,10 @@ void CtrlMemView::gotoPoint(int x, int y)
|
|||
|
||||
int indexInGroup = -1;
|
||||
|
||||
for (int i = 0; i < int(byteGroupSize); i++) {
|
||||
for (int i = 0; i < int(byteGroupSize); i++)
|
||||
{
|
||||
int start = hexGroupPositionFromIndex(i);
|
||||
int end = start + 2 * charWidth -1;
|
||||
int end = start + 2 * charWidth - 1;
|
||||
if (posInGroup < start)
|
||||
{
|
||||
return;
|
||||
|
@ -740,7 +783,8 @@ void CtrlMemView::gotoPoint(int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
void CtrlMemView::updateReference(u32 address) {
|
||||
void CtrlMemView::updateReference(u32 address)
|
||||
{
|
||||
referencedAddress = address;
|
||||
redraw();
|
||||
}
|
||||
|
@ -771,13 +815,14 @@ void CtrlMemView::pasteHex()
|
|||
{
|
||||
cpu->write8(curAddress + i, static_cast<u8>(byte));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
scrollCursor(i);
|
||||
|
||||
if(active)
|
||||
if (active)
|
||||
cpu->resumeCpu();
|
||||
}
|
||||
wxTheClipboard->Close();
|
||||
|
|
|
@ -24,11 +24,11 @@ wxBEGIN_EVENT_TABLE(GenericListView, wxWindow)
|
|||
EVT_RIGHT_DOWN(GenericListView::mouseEvent)
|
||||
EVT_RIGHT_UP(GenericListView::mouseEvent)
|
||||
EVT_LEFT_DCLICK(GenericListView::mouseEvent)
|
||||
EVT_LIST_ITEM_RIGHT_CLICK(wxID_ANY,GenericListView::listEvent)
|
||||
EVT_LIST_ITEM_RIGHT_CLICK(wxID_ANY, GenericListView::listEvent)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
GenericListView::GenericListView(wxWindow* parent, GenericListViewColumn* columns, int columnCount)
|
||||
: wxListView(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_VIRTUAL|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER)
|
||||
: wxListView(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_VIRTUAL | wxLC_REPORT | wxLC_SINGLE_SEL | wxNO_BORDER)
|
||||
{
|
||||
m_isInResizeColumn = false;
|
||||
dontResizeColumnsInSizeEventHandler = false;
|
||||
|
@ -46,7 +46,7 @@ void GenericListView::insertColumns(GenericListViewColumn* columns, int count)
|
|||
column.SetText(columns[i].name);
|
||||
column.SetWidth(totalWidth * columns[i].size);
|
||||
|
||||
InsertColumn(i,column);
|
||||
InsertColumn(i, column);
|
||||
}
|
||||
|
||||
this->columns = columns;
|
||||
|
@ -54,7 +54,8 @@ void GenericListView::insertColumns(GenericListViewColumn* columns, int count)
|
|||
|
||||
void GenericListView::resizeColumn(int col, int width)
|
||||
{
|
||||
if (!m_isInResizeColumn) {
|
||||
if (!m_isInResizeColumn)
|
||||
{
|
||||
m_isInResizeColumn = true;
|
||||
|
||||
SetColumnWidth(col, width);
|
||||
|
@ -88,15 +89,17 @@ void GenericListView::keydownEvent(wxKeyEvent& evt)
|
|||
switch (evt.GetKeyCode())
|
||||
{
|
||||
case WXK_UP:
|
||||
if (sel > 0) {
|
||||
Select(sel-1);
|
||||
Focus(sel-1);
|
||||
if (sel > 0)
|
||||
{
|
||||
Select(sel - 1);
|
||||
Focus(sel - 1);
|
||||
}
|
||||
break;
|
||||
case WXK_DOWN:
|
||||
if (sel+1 < GetItemCount()) {
|
||||
Select(sel+1);
|
||||
Focus(sel+1);
|
||||
if (sel + 1 < GetItemCount())
|
||||
{
|
||||
Select(sel + 1);
|
||||
Focus(sel + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -126,15 +129,15 @@ void GenericListView::update()
|
|||
|
||||
wxString GenericListView::OnGetItemText(long item, long col) const
|
||||
{
|
||||
return getColumnText(item,col);
|
||||
return getColumnText(item, col);
|
||||
}
|
||||
|
||||
void GenericListView::postEvent(wxEventType type, int value)
|
||||
{
|
||||
wxCommandEvent event( type, GetId() );
|
||||
wxCommandEvent event(type, GetId());
|
||||
event.SetEventObject(this);
|
||||
event.SetInt(value);
|
||||
wxPostEvent(this,event);
|
||||
wxPostEvent(this, event);
|
||||
}
|
||||
|
||||
void GenericListView::mouseEvent(wxMouseEvent& evt)
|
||||
|
@ -145,25 +148,37 @@ void GenericListView::mouseEvent(wxMouseEvent& evt)
|
|||
{
|
||||
clickPos = evt.GetPosition();
|
||||
evt.Skip();
|
||||
} else if (type == wxEVT_RIGHT_UP)
|
||||
}
|
||||
else if (type == wxEVT_RIGHT_UP)
|
||||
{
|
||||
onRightClick(GetFirstSelected(),evt.GetPosition());
|
||||
} else if (type == wxEVT_LEFT_DCLICK)
|
||||
onRightClick(GetFirstSelected(), evt.GetPosition());
|
||||
}
|
||||
else if (type == wxEVT_LEFT_DCLICK)
|
||||
{
|
||||
onDoubleClick(GetFirstSelected(),evt.GetPosition());
|
||||
onDoubleClick(GetFirstSelected(), evt.GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
void GenericListView::listEvent(wxListEvent& evt)
|
||||
{
|
||||
onRightClick(GetFirstSelected(),clickPos);
|
||||
onRightClick(GetFirstSelected(), clickPos);
|
||||
}
|
||||
|
||||
//
|
||||
// BreakpointList
|
||||
//
|
||||
|
||||
enum { BPL_TYPE, BPL_OFFSET, BPL_SIZELABEL, BPL_OPCODE, BPL_CONDITION, BPL_HITS, BPL_ENABLED, BPL_COLUMNCOUNT };
|
||||
enum
|
||||
{
|
||||
BPL_TYPE,
|
||||
BPL_OFFSET,
|
||||
BPL_SIZELABEL,
|
||||
BPL_OPCODE,
|
||||
BPL_CONDITION,
|
||||
BPL_HITS,
|
||||
BPL_ENABLED,
|
||||
BPL_COLUMNCOUNT
|
||||
};
|
||||
|
||||
enum BreakpointListMenuIdentifiers
|
||||
{
|
||||
|
@ -174,17 +189,18 @@ enum BreakpointListMenuIdentifiers
|
|||
};
|
||||
|
||||
GenericListViewColumn breakpointColumns[BPL_COLUMNCOUNT] = {
|
||||
{ L"Type", 0.12f },
|
||||
{ L"Offset", 0.12f },
|
||||
{ L"Size/Label", 0.18f },
|
||||
{ L"Opcode", 0.28f },
|
||||
{ L"Condition", 0.17f },
|
||||
{ L"Hits", 0.05f },
|
||||
{ L"Enabled", 0.08f }
|
||||
};
|
||||
{L"Type", 0.12f},
|
||||
{L"Offset", 0.12f},
|
||||
{L"Size/Label", 0.18f},
|
||||
{L"Opcode", 0.28f},
|
||||
{L"Condition", 0.17f},
|
||||
{L"Hits", 0.05f},
|
||||
{L"Enabled", 0.08f}};
|
||||
|
||||
BreakpointList::BreakpointList(wxWindow* parent, DebugInterface* _cpu, CtrlDisassemblyView* _disassembly)
|
||||
: GenericListView(parent,breakpointColumns,BPL_COLUMNCOUNT), cpu(_cpu),disasm(_disassembly)
|
||||
: GenericListView(parent, breakpointColumns, BPL_COLUMNCOUNT)
|
||||
, cpu(_cpu)
|
||||
, disasm(_disassembly)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -193,11 +209,13 @@ int BreakpointList::getRowCount()
|
|||
int count = 0;
|
||||
for (size_t i = 0; i < CBreakPoints::GetMemChecks().size(); i++)
|
||||
{
|
||||
if (displayedMemChecks_[i].cpu == cpu->getCpuType()) count++;
|
||||
if (displayedMemChecks_[i].cpu == cpu->getCpuType())
|
||||
count++;
|
||||
}
|
||||
for (size_t i = 0; i < CBreakPoints::GetBreakpoints().size(); i++)
|
||||
{
|
||||
if (!displayedBreakPoints_[i].temporary && displayedBreakPoints_[i].cpu == cpu->getCpuType()) count++;
|
||||
if (!displayedBreakPoints_[i].temporary && displayedBreakPoints_[i].cpu == cpu->getCpuType())
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@ -207,15 +225,18 @@ wxString BreakpointList::getColumnText(int item, int col) const
|
|||
{
|
||||
FastFormatUnicode dest;
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(item,isMemory);
|
||||
if (index == -1) return L"Invalid";
|
||||
int index = getBreakpointIndex(item, isMemory);
|
||||
if (index == -1)
|
||||
return L"Invalid";
|
||||
|
||||
switch (col)
|
||||
{
|
||||
case BPL_TYPE:
|
||||
{
|
||||
if (isMemory) {
|
||||
switch ((int)displayedMemChecks_[index].cond) {
|
||||
if (isMemory)
|
||||
{
|
||||
switch ((int)displayedMemChecks_[index].cond)
|
||||
{
|
||||
case MEMCHECK_READ:
|
||||
dest.Write("Read");
|
||||
break;
|
||||
|
@ -232,34 +253,44 @@ wxString BreakpointList::getColumnText(int item, int col) const
|
|||
dest.Write("Read/Write Change");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write(L"Execute");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPL_OFFSET:
|
||||
{
|
||||
if (isMemory) {
|
||||
dest.Write("0x%08X",displayedMemChecks_[index].start);
|
||||
} else {
|
||||
dest.Write("0x%08X",displayedBreakPoints_[index].addr);
|
||||
if (isMemory)
|
||||
{
|
||||
dest.Write("0x%08X", displayedMemChecks_[index].start);
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write("0x%08X", displayedBreakPoints_[index].addr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPL_SIZELABEL:
|
||||
{
|
||||
if (isMemory) {
|
||||
if (isMemory)
|
||||
{
|
||||
auto mc = displayedMemChecks_[index];
|
||||
if (mc.end == 0)
|
||||
dest.Write("0x%08X",1);
|
||||
dest.Write("0x%08X", 1);
|
||||
else
|
||||
dest.Write("0x%08X",mc.end-mc.start);
|
||||
} else {
|
||||
dest.Write("0x%08X", mc.end - mc.start);
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string sym = symbolMap.GetLabelString(displayedBreakPoints_[index].addr);
|
||||
if (!sym.empty())
|
||||
{
|
||||
dest.Write("%s",sym.c_str());
|
||||
} else {
|
||||
dest.Write("%s", sym.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write("-");
|
||||
}
|
||||
}
|
||||
|
@ -267,41 +298,53 @@ wxString BreakpointList::getColumnText(int item, int col) const
|
|||
break;
|
||||
case BPL_OPCODE:
|
||||
{
|
||||
if (isMemory) {
|
||||
if (isMemory)
|
||||
{
|
||||
dest.Write(L"-");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cpu->isAlive())
|
||||
break;
|
||||
char temp[256];
|
||||
disasm->getOpcodeText(displayedBreakPoints_[index].addr, temp);
|
||||
dest.Write("%s",temp);
|
||||
dest.Write("%s", temp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPL_CONDITION:
|
||||
{
|
||||
if (isMemory || !displayedBreakPoints_[index].hasCond) {
|
||||
if (isMemory || !displayedBreakPoints_[index].hasCond)
|
||||
{
|
||||
dest.Write("-");
|
||||
} else {
|
||||
dest.Write("%s",displayedBreakPoints_[index].cond.expressionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write("%s", displayedBreakPoints_[index].cond.expressionString);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPL_HITS:
|
||||
{
|
||||
if (isMemory) {
|
||||
dest.Write("%d",displayedMemChecks_[index].numHits);
|
||||
} else {
|
||||
if (isMemory)
|
||||
{
|
||||
dest.Write("%d", displayedMemChecks_[index].numHits);
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write("-");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPL_ENABLED:
|
||||
{
|
||||
if (isMemory) {
|
||||
dest.Write("%s",displayedMemChecks_[index].result & MEMCHECK_BREAK ? "true" : "false");
|
||||
} else {
|
||||
dest.Write("%s",displayedBreakPoints_[index].enabled ? "true" : "false");
|
||||
if (isMemory)
|
||||
{
|
||||
dest.Write("%s", displayedMemChecks_[index].result & MEMCHECK_BREAK ? "true" : "false");
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write("%s", displayedBreakPoints_[index].enabled ? "true" : "false");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -334,7 +377,8 @@ int BreakpointList::getBreakpointIndex(int itemIndex, bool& isMemory) const
|
|||
// memory breakpoints first
|
||||
for (size_t i = 0; i < displayedMemChecks_.size(); i++)
|
||||
{
|
||||
if (displayedMemChecks_[i].cpu != cpu->getCpuType()) continue;
|
||||
if (displayedMemChecks_[i].cpu != cpu->getCpuType())
|
||||
continue;
|
||||
if (itemIndex == 0)
|
||||
{
|
||||
isMemory = true;
|
||||
|
@ -370,7 +414,7 @@ void BreakpointList::reloadBreakpoints()
|
|||
{
|
||||
// Update the items we're displaying from the debugger.
|
||||
displayedBreakPoints_ = CBreakPoints::GetBreakpoints();
|
||||
displayedMemChecks_= CBreakPoints::GetMemChecks();
|
||||
displayedMemChecks_ = CBreakPoints::GetMemChecks();
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -378,19 +422,22 @@ void BreakpointList::editBreakpoint(int itemIndex)
|
|||
{
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(itemIndex, isMemory);
|
||||
if (index == -1) return;
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
BreakpointWindow win(this,cpu);
|
||||
BreakpointWindow win(this, cpu);
|
||||
if (isMemory)
|
||||
{
|
||||
auto mem = displayedMemChecks_[index];
|
||||
win.loadFromMemcheck(mem);
|
||||
if (win.ShowModal() == wxID_OK)
|
||||
{
|
||||
CBreakPoints::RemoveMemCheck(cpu->getCpuType(), mem.start,mem.end);
|
||||
CBreakPoints::RemoveMemCheck(cpu->getCpuType(), mem.start, mem.end);
|
||||
win.addBreakpoint();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
auto bp = displayedBreakPoints_[index];
|
||||
win.loadFromBreakpoint(bp);
|
||||
if (win.ShowModal() == wxID_OK)
|
||||
|
@ -405,12 +452,16 @@ void BreakpointList::toggleEnabled(int itemIndex)
|
|||
{
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(itemIndex, isMemory);
|
||||
if (index == -1) return;
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
if (isMemory) {
|
||||
if (isMemory)
|
||||
{
|
||||
MemCheck mcPrev = displayedMemChecks_[index];
|
||||
CBreakPoints::ChangeMemCheck(cpu->getCpuType(), mcPrev.start, mcPrev.end, mcPrev.cond, MemCheckResult(mcPrev.result ^ MEMCHECK_BREAK));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
BreakPoint bpPrev = displayedBreakPoints_[index];
|
||||
CBreakPoints::ChangeBreakPoint(cpu->getCpuType(), bpPrev.addr, !bpPrev.enabled);
|
||||
}
|
||||
|
@ -419,30 +470,36 @@ void BreakpointList::toggleEnabled(int itemIndex)
|
|||
void BreakpointList::gotoBreakpointAddress(int itemIndex)
|
||||
{
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(itemIndex,isMemory);
|
||||
if (index == -1) return;
|
||||
int index = getBreakpointIndex(itemIndex, isMemory);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
if (isMemory)
|
||||
{
|
||||
u32 address = displayedMemChecks_[index].start;
|
||||
postEvent(debEVT_GOTOINMEMORYVIEW,address);
|
||||
} else {
|
||||
postEvent(debEVT_GOTOINMEMORYVIEW, address);
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 address = displayedBreakPoints_[index].addr;
|
||||
postEvent(debEVT_GOTOINDISASM,address);
|
||||
postEvent(debEVT_GOTOINDISASM, address);
|
||||
}
|
||||
}
|
||||
|
||||
void BreakpointList::removeBreakpoint(int itemIndex)
|
||||
{
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(itemIndex,isMemory);
|
||||
if (index == -1) return;
|
||||
int index = getBreakpointIndex(itemIndex, isMemory);
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
if (isMemory)
|
||||
{
|
||||
auto mc = displayedMemChecks_[index];
|
||||
CBreakPoints::RemoveMemCheck(cpu->getCpuType(), mc.start, mc.end);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 address = displayedBreakPoints_[index].addr;
|
||||
CBreakPoints::RemoveBreakPoint(displayedBreakPoints_[index].cpu, address);
|
||||
}
|
||||
|
@ -463,10 +520,10 @@ void BreakpointList::onPopupClick(wxCommandEvent& evt)
|
|||
removeBreakpoint(index);
|
||||
break;
|
||||
case ID_BREAKPOINTLIST_ADDNEW:
|
||||
postEvent(debEVT_BREAKPOINTWINDOW,0);
|
||||
postEvent(debEVT_BREAKPOINTWINDOW, 0);
|
||||
break;
|
||||
default:
|
||||
wxMessageBox( L"Unimplemented.", L"Unimplemented.", wxICON_INFORMATION);
|
||||
wxMessageBox(L"Unimplemented.", L"Unimplemented.", wxICON_INFORMATION);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -474,7 +531,7 @@ void BreakpointList::onPopupClick(wxCommandEvent& evt)
|
|||
void BreakpointList::showMenu(const wxPoint& pos)
|
||||
{
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(GetFirstSelected(),isMemory);
|
||||
int index = getBreakpointIndex(GetFirstSelected(), isMemory);
|
||||
|
||||
wxMenu menu;
|
||||
if (index != -1)
|
||||
|
@ -491,13 +548,13 @@ void BreakpointList::showMenu(const wxPoint& pos)
|
|||
else
|
||||
enabled = displayedBreakPoints_[index].enabled;
|
||||
|
||||
menu.Check(ID_BREAKPOINTLIST_ENABLE,enabled);
|
||||
menu.Check(ID_BREAKPOINTLIST_ENABLE, enabled);
|
||||
}
|
||||
|
||||
menu.Append(ID_BREAKPOINTLIST_ADDNEW, L"Add new");
|
||||
|
||||
menu.Bind(wxEVT_MENU, &BreakpointList::onPopupClick, this);
|
||||
PopupMenu(&menu,pos);
|
||||
PopupMenu(&menu, pos);
|
||||
}
|
||||
|
||||
void BreakpointList::onRightClick(int itemIndex, const wxPoint& point)
|
||||
|
@ -515,19 +572,29 @@ void BreakpointList::onDoubleClick(int itemIndex, const wxPoint& point)
|
|||
// ThreadList
|
||||
//
|
||||
|
||||
enum { TL_TID, TL_PROGRAMCOUNTER, TL_ENTRYPOINT, TL_PRIORITY, TL_STATE, TL_WAITTYPE, TL_COLUMNCOUNT };
|
||||
enum
|
||||
{
|
||||
TL_TID,
|
||||
TL_PROGRAMCOUNTER,
|
||||
TL_ENTRYPOINT,
|
||||
TL_PRIORITY,
|
||||
TL_STATE,
|
||||
TL_WAITTYPE,
|
||||
TL_COLUMNCOUNT
|
||||
};
|
||||
|
||||
GenericListViewColumn threadColumns[TL_COLUMNCOUNT] = {
|
||||
{ L"TID", 0.08f },
|
||||
{ L"PC", 0.21f },
|
||||
{ L"Entry Point", 0.21f },
|
||||
{ L"Priority", 0.08f },
|
||||
{ L"State", 0.21f },
|
||||
{ L"Wait type", 0.21f },
|
||||
{L"TID", 0.08f},
|
||||
{L"PC", 0.21f},
|
||||
{L"Entry Point", 0.21f},
|
||||
{L"Priority", 0.08f},
|
||||
{L"State", 0.21f},
|
||||
{L"Wait type", 0.21f},
|
||||
};
|
||||
|
||||
ThreadList::ThreadList(wxWindow* parent, DebugInterface* _cpu)
|
||||
: GenericListView(parent,threadColumns,TL_COLUMNCOUNT), cpu(_cpu)
|
||||
: GenericListView(parent, threadColumns, TL_COLUMNCOUNT)
|
||||
, cpu(_cpu)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -554,7 +621,7 @@ wxString ThreadList::getColumnText(int item, int col) const
|
|||
switch (col)
|
||||
{
|
||||
case TL_TID:
|
||||
dest.Write("%d",thread.tid);
|
||||
dest.Write("%d", thread.tid);
|
||||
break;
|
||||
case TL_PROGRAMCOUNTER:
|
||||
if (thread.data.status == THS_RUN)
|
||||
|
@ -626,13 +693,13 @@ void ThreadList::onDoubleClick(int itemIndex, const wxPoint& point)
|
|||
{
|
||||
case THS_DORMANT:
|
||||
case THS_BAD:
|
||||
postEvent(debEVT_GOTOINDISASM,thread.data.entry_init);
|
||||
postEvent(debEVT_GOTOINDISASM, thread.data.entry_init);
|
||||
break;
|
||||
case THS_RUN:
|
||||
postEvent(debEVT_GOTOINDISASM,cpu->getPC());
|
||||
postEvent(debEVT_GOTOINDISASM, cpu->getPC());
|
||||
break;
|
||||
default:
|
||||
postEvent(debEVT_GOTOINDISASM,thread.data.entry);
|
||||
postEvent(debEVT_GOTOINDISASM, thread.data.entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -646,7 +713,7 @@ EEThread ThreadList::getRunningThread()
|
|||
}
|
||||
|
||||
EEThread thread;
|
||||
memset(&thread,0,sizeof(thread));
|
||||
memset(&thread, 0, sizeof(thread));
|
||||
thread.tid = -1;
|
||||
return thread;
|
||||
}
|
||||
|
@ -655,26 +722,36 @@ EEThread ThreadList::getRunningThread()
|
|||
// StackFramesList
|
||||
//
|
||||
|
||||
enum { SF_ENTRY, SF_ENTRYNAME, SF_CURPC, SF_CUROPCODE, SF_CURSP, SF_FRAMESIZE, SF_COLUMNCOUNT };
|
||||
|
||||
GenericListViewColumn stackFrameolumns[SF_COLUMNCOUNT] = {
|
||||
{ L"Entry", 0.12f },
|
||||
{ L"Name", 0.24f },
|
||||
{ L"PC", 0.12f },
|
||||
{ L"Opcode", 0.28f },
|
||||
{ L"SP", 0.12f },
|
||||
{ L"Frame Size", 0.12f }
|
||||
enum
|
||||
{
|
||||
SF_ENTRY,
|
||||
SF_ENTRYNAME,
|
||||
SF_CURPC,
|
||||
SF_CUROPCODE,
|
||||
SF_CURSP,
|
||||
SF_FRAMESIZE,
|
||||
SF_COLUMNCOUNT
|
||||
};
|
||||
|
||||
GenericListViewColumn stackFrameolumns[SF_COLUMNCOUNT] = {
|
||||
{L"Entry", 0.12f},
|
||||
{L"Name", 0.24f},
|
||||
{L"PC", 0.12f},
|
||||
{L"Opcode", 0.28f},
|
||||
{L"SP", 0.12f},
|
||||
{L"Frame Size", 0.12f}};
|
||||
|
||||
StackFramesList::StackFramesList(wxWindow* parent, DebugInterface* _cpu, CtrlDisassemblyView* _disassembly)
|
||||
: GenericListView(parent,stackFrameolumns,SF_COLUMNCOUNT), cpu(_cpu), disassembly(_disassembly)
|
||||
: GenericListView(parent, stackFrameolumns, SF_COLUMNCOUNT)
|
||||
, cpu(_cpu)
|
||||
, disassembly(_disassembly)
|
||||
{
|
||||
}
|
||||
|
||||
void StackFramesList::loadStackFrames(EEThread& currentThread)
|
||||
{
|
||||
frames = MipsStackWalk::Walk(cpu,cpu->getPC(),cpu->getRegister(0,31),cpu->getRegister(0,29),
|
||||
currentThread.data.entry_init,currentThread.data.stack);
|
||||
frames = MipsStackWalk::Walk(cpu, cpu->getPC(), cpu->getRegister(0, 31), cpu->getRegister(0, 29),
|
||||
currentThread.data.entry_init, currentThread.data.stack);
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -694,35 +771,38 @@ wxString StackFramesList::getColumnText(int item, int col) const
|
|||
switch (col)
|
||||
{
|
||||
case SF_ENTRY:
|
||||
dest.Write("0x%08X",frame.entry);
|
||||
dest.Write("0x%08X", frame.entry);
|
||||
break;
|
||||
case SF_ENTRYNAME:
|
||||
{
|
||||
const std::string sym = symbolMap.GetLabelString(frame.entry);
|
||||
if (!sym.empty()) {
|
||||
dest.Write("%s",sym.c_str());
|
||||
} else {
|
||||
if (!sym.empty())
|
||||
{
|
||||
dest.Write("%s", sym.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.Write("-");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SF_CURPC:
|
||||
dest.Write("0x%08X",frame.pc);
|
||||
dest.Write("0x%08X", frame.pc);
|
||||
break;
|
||||
case SF_CUROPCODE:
|
||||
{
|
||||
if (!cpu->isAlive())
|
||||
break;
|
||||
char temp[512];
|
||||
disassembly->getOpcodeText(frame.pc,temp);
|
||||
dest.Write("%s",temp);
|
||||
disassembly->getOpcodeText(frame.pc, temp);
|
||||
dest.Write("%s", temp);
|
||||
}
|
||||
break;
|
||||
case SF_CURSP:
|
||||
dest.Write("0x%08X",frame.sp);
|
||||
dest.Write("0x%08X", frame.sp);
|
||||
break;
|
||||
case SF_FRAMESIZE:
|
||||
dest.Write("0x%08X",frame.stackSize);
|
||||
dest.Write("0x%08X", frame.stackSize);
|
||||
break;
|
||||
default:
|
||||
return L"Invalid";
|
||||
|
@ -736,5 +816,5 @@ void StackFramesList::onDoubleClick(int itemIndex, const wxPoint& point)
|
|||
if (itemIndex < 0 || itemIndex >= (int)frames.size())
|
||||
return;
|
||||
|
||||
postEvent(debEVT_GOTOINDISASM,frames[itemIndex].pc);
|
||||
postEvent(debEVT_GOTOINDISASM, frames[itemIndex].pc);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue