Move MemCheck functionality into the virtual DebugInterface class from the more general MemView class.

Give DSP LLE Debugger a wxAUI facelift and add memory view to dsp debugger.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5080 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-02-18 12:06:13 +00:00
parent d5c094df75
commit 63827c71c6
10 changed files with 253 additions and 315 deletions

View File

@ -19,6 +19,8 @@ public:
virtual void clearBreakpoint(unsigned int /*address*/){}
virtual void clearAllBreakpoints() {}
virtual void toggleBreakpoint(unsigned int /*address*/){}
virtual bool isMemCheck(unsigned int /*address*/) {return false;}
virtual void toggleMemCheck(unsigned int /*address*/){}
virtual unsigned int readMemory(unsigned int /*address*/){return 0;}
virtual void writeExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {}
virtual unsigned int readExtraMemory(int /*memory*/, unsigned int /*address*/){return 0;}

View File

@ -133,6 +133,34 @@ void PPCDebugInterface::toggleBreakpoint(unsigned int address)
PowerPC::breakpoints.Add(address);
}
bool PPCDebugInterface::isMemCheck(unsigned int address)
{
return (Memory::AreMemoryBreakpointsActivated()
&& PowerPC::memchecks.GetMemCheck(address));
}
void PPCDebugInterface::toggleMemCheck(unsigned int address)
{
if (Memory::AreMemoryBreakpointsActivated()
&& !PowerPC::memchecks.GetMemCheck(address))
{
// Add Memory Check
TMemCheck MemCheck;
MemCheck.StartAddress = address;
MemCheck.EndAddress = address;
MemCheck.OnRead = true;
MemCheck.OnWrite = true;
MemCheck.Log = true;
MemCheck.Break = true;
PowerPC::memchecks.Add(MemCheck);
}
else
PowerPC::memchecks.DeleteByAddress(address);
}
void PPCDebugInterface::insertBLR(unsigned int address, unsigned int value)
{
Memory::Write_U32(value, address);

View File

@ -20,6 +20,8 @@ public:
virtual void clearBreakpoint(unsigned int address);
virtual void clearAllBreakpoints();
virtual void toggleBreakpoint(unsigned int address);
virtual bool isMemCheck(unsigned int address);
virtual void toggleMemCheck(unsigned int address);
virtual unsigned int readMemory(unsigned int address);
enum {

View File

@ -108,24 +108,7 @@ void CMemoryView::OnMouseDownL(wxMouseEvent& event)
}
else
{
int address = YToAddress(y);
if (Memory::AreMemoryBreakpointsActivated() && !PowerPC::memchecks.GetMemCheck(address))
{
// Add Memory Check
TMemCheck MemCheck;
MemCheck.StartAddress = address;
MemCheck.EndAddress = address;
MemCheck.OnRead = true;
MemCheck.OnWrite = true;
MemCheck.Log = true;
MemCheck.Break = true;
PowerPC::memchecks.Add(MemCheck);
}
else
PowerPC::memchecks.DeleteByAddress(address);
debugger->toggleMemCheck(YToAddress(y));
redraw();
Host_UpdateBreakPointView();
@ -238,7 +221,7 @@ void CMemoryView::OnMouseDownR(wxMouseEvent& event)
menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
#endif
menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory (RAM/ARAM)"));
menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory"));
@ -265,16 +248,18 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
wxRect rc = GetClientRect();
wxFont hFont(_T("Courier"));
if(viewAsType==VIEWAS_HEX){
if (viewAsType==VIEWAS_HEX)
{
hFont.SetFamily(wxFONTFAMILY_TELETYPE);
dc.SetFont(hFont);
}else{
dc.SetFont(DebuggerFont);
}
else
{
dc.SetFont(DebuggerFont);
}
//wxFont tempFont(Lucida Console);
int fontSize =(viewAsType==VIEWAS_HEX?hFont.GetPointSize() : DebuggerFont.GetPointSize());
int textPlacement=77;
int fontSize = viewAsType == VIEWAS_HEX ? hFont.GetPointSize() : DebuggerFont.GetPointSize();
int textPlacement = 77;
struct branch
{
int src, dst, srcAddr;
@ -302,10 +287,9 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetBrush(bgBrush);
dc.DrawRectangle(0, 0, 16, rc.height);
dc.DrawRectangle(0, 0, rc.width, 5+8);
// TODO - clean up this freaking mess!!!!!
int i;
for (i = -numRows; i <= numRows; i++)
// TODO - clean up this freaking mess!!!!!
for (int i = -numRows; i <= numRows; i++)
{
unsigned int address = curAddress + i * align;
@ -341,13 +325,16 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetBrush(currentBrush);
dc.SetTextForeground(_T("#600000"));
dc.DrawText(temp, 17, rowY1);
if(viewAsType!=VIEWAS_HEX){
char mem[256];
debugger->getRawMemoryString(memory, address, mem, 256);
dc.SetTextForeground(_T("#000080"));
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1);
dc.SetTextForeground(_T("#000000"));
if (viewAsType != VIEWAS_HEX)
{
char mem[256];
debugger->getRawMemoryString(memory, address, mem, 256);
dc.SetTextForeground(_T("#000080"));
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1);
dc.SetTextForeground(_T("#000000"));
}
if (debugger->isAlive())
{
char dis[256] = {0};
@ -360,60 +347,73 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
}
else if (viewAsType == VIEWAS_ASCII)
{
char a[4] = {(mem_data&0xff000000)>>24, (mem_data&0xff0000)>>16, (mem_data&0xff00)>>8, mem_data&0xff};
char a[4] = {(mem_data&0xff000000)>>24,
(mem_data&0xff0000)>>16,
(mem_data&0xff00)>>8,
mem_data&0xff};
for (size_t i = 0; i < 4; i++)
if (a[i] == '\0')
a[i] = ' ';
sprintf(dis, "%c%c%c%c", a[0], a[1], a[2], a[3]);
}
else if(viewAsType==VIEWAS_HEX){
dis[0]=0;dis[1]=0;
u32 mema[8]={
debugger->readExtraMemory(memory, address),
debugger->readExtraMemory(memory, address+4),
debugger->readExtraMemory(memory, address+8),
debugger->readExtraMemory(memory, address+12),
debugger->readExtraMemory(memory, address+16),
debugger->readExtraMemory(memory, address+20),
debugger->readExtraMemory(memory, address+24),
debugger->readExtraMemory(memory, address+28)
};
// for(size_t i=0;i<2;i++){
//sprintf(dis,"%s %x %x %x %x",((mems&0xff000000)>>24)&0xFF, ((mems&0xff0000)>>16)&0xFF, ((mems&0xff00)>>8)&0xFF, mems&0xff);
int i=0;
for(i=0;i<8;i++){
switch(dataType){
case 0:
sprintf(dis,"%s %02X %02X %02X %02X",dis,((mema[i]&0xff000000)>>24)&0xFF, ((mema[i]&0xff0000)>>16)&0xFF, ((mema[i]&0xff00)>>8)&0xFF, mema[i]&0xff);
break;
case 1:
sprintf(dis,"%s %02X%02X %02X%02X",dis,((mema[i]&0xff000000)>>24)&0xFF, ((mema[i]&0xff0000)>>16)&0xFF, ((mema[i]&0xff00)>>8)&0xFF, mema[i]&0xff);
break;
case 2:
sprintf(dis,"%s %02X%02X%02X%02X",dis,((mema[i]&0xff000000)>>24)&0xFF, ((mema[i]&0xff0000)>>16)&0xFF, ((mema[i]&0xff00)>>8)&0xFF, mema[i]&0xff);
break;
}
// sprintf(dis,"%s %08X",dis,mema[i]);
// while((strlen(dis))%9)strcat(dis," ");
}
size_t len=strlen(dis);
//if(strlen(dis)%2)strcat(dis," ");
strcat(dis,"\0");
curAddress+=32;
//textPlacement-=32;
else if (viewAsType == VIEWAS_HEX)
{
dis[0] = 0;
dis[1] = 0;
u32 mema[8] = {
debugger->readExtraMemory(memory, address),
debugger->readExtraMemory(memory, address+4),
debugger->readExtraMemory(memory, address+8),
debugger->readExtraMemory(memory, address+12),
debugger->readExtraMemory(memory, address+16),
debugger->readExtraMemory(memory, address+20),
debugger->readExtraMemory(memory, address+24),
debugger->readExtraMemory(memory, address+28)
};
for (int i = 0; i < 8; i++)
{
switch (dataType)
{
case 0:
sprintf(dis, "%s %02X %02X %02X %02X", dis,
((mema[i]&0xff000000)>>24)&0xFF,
((mema[i]&0xff0000)>>16)&0xFF,
((mema[i]&0xff00)>>8)&0xFF,
mema[i]&0xff);
break;
case 1:
sprintf(dis, "%s %02X%02X %02X%02X", dis,
((mema[i]&0xff000000)>>24)&0xFF,
((mema[i]&0xff0000)>>16)&0xFF,
((mema[i]&0xff00)>>8)&0xFF,
mema[i]&0xff);
break;
case 2:
sprintf(dis, "%s %02X%02X%02X%02X", dis,
((mema[i]&0xff000000)>>24)&0xFF,
((mema[i]&0xff0000)>>16)&0xFF,
((mema[i]&0xff00)>>8)&0xFF,
mema[i]&0xff);
break;
}
}
size_t len = strlen(dis);
strcat(dis, "\0");
curAddress += 32;
}
else
{
sprintf(dis, "INVALID VIEWAS TYPE");
}
char desc[256] = "";
if(viewAsType!=VIEWAS_HEX){
dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1);
}else{
dc.DrawText(wxString::FromAscii(dis), textPlacement + 8+16, rowY1);
}
if (viewAsType != VIEWAS_HEX)
{
dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1);
} else {
dc.DrawText(wxString::FromAscii(dis), textPlacement + 8+16, rowY1);
}
if (desc[0] == 0)
{
strcpy(desc, debugger->getDescription(address).c_str());
@ -427,7 +427,7 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
}
// Show blue memory check dot
if (Memory::AreMemoryBreakpointsActivated() && PowerPC::memchecks.GetMemCheck(address))
if (debugger->isMemCheck(address))
{
dc.SetBrush(mcBrush);
dc.DrawRectangle(8, rowY1 + 1, 11, 11);
@ -437,132 +437,3 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetPen(currentPen);
}
/*
void OnPaint2(wxPaintEvent& event)
{
wxPaintDC dc(this);
wxRect rc = GetClientRect();
dc.SetFont(DebuggerFont);
int fontSize = DebuggerFont.GetPointSize();
struct branch
{
int src, dst, srcAddr;
};
// TODO: Add any drawing code here...
int width = rc.width;
int numRows = (rc.height / rowHeight) / 2 + 2;
//numRows=(numRows&(~1)) + 1;
dc.SetBackgroundMode(wxTRANSPARENT);
const wxChar* bgColor = _T("#ffffff");
wxPen nullPen(bgColor);
wxPen currentPen(_T("#000000"));
wxPen selPen(_T("#808080")); // gray
nullPen.SetStyle(wxTRANSPARENT);
wxBrush currentBrush(_T("#FFEfE8")); // light gray
wxBrush pcBrush(_T("#70FF70")); // green
wxBrush mcBrush(_T("#1133FF")); // blue
wxBrush bgBrush(bgColor);
wxBrush nullBrush(bgColor);
nullBrush.SetStyle(wxTRANSPARENT);
dc.SetPen(nullPen);
dc.SetBrush(bgBrush);
dc.DrawRectangle(0, 0, 16, rc.height);
dc.DrawRectangle(0, 0, rc.width, 5+8);
// TODO - clean up this freaking mess!!!!!
int i;
for (i = -numRows; i <= numRows; i++)
{
unsigned int address = curAddress + i * align;
int rowY1 = rc.height / 2 + rowHeight * i - rowHeight / 2;
int rowY2 = rc.height / 2 + rowHeight * i + rowHeight / 2;
wxString temp = wxString::Format(_T("%08x"), address);
u32 col = debugger->getColor(address);
wxBrush rowBrush(wxColor(col >> 16, col >> 8, col));
dc.SetBrush(nullBrush);
dc.SetPen(nullPen);
dc.DrawRectangle(0, rowY1, 16, rowY2);
if (selecting && (address == selection))
{
dc.SetPen(selPen);
}
else
{
dc.SetPen(i == 0 ? currentPen : nullPen);
}
if (address == debugger->getPC())
{
dc.SetBrush(pcBrush);
}
else
{
dc.SetBrush(rowBrush);
}
dc.DrawRectangle(16, rowY1, width, rowY2 - 1);
dc.SetBrush(currentBrush);
dc.SetTextForeground(_T("#600000"));
dc.DrawText(temp, 17, rowY1);
char mem[256];
debugger->getRawMemoryString(memory, address, mem, 256);
dc.SetTextForeground(_T("#000080"));
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1);
dc.SetTextForeground(_T("#000000"));
if (debugger->isAlive())
{
char dis[256] = {0};
u32 mem_data = debugger->readExtraMemory(memory, address);
if (viewAsType == VIEWAS_FP)
{
float flt = *(float *)(&mem_data);
sprintf(dis, "f: %f", flt);
}
else if (viewAsType == VIEWAS_ASCII)
{
char a[4] = {(mem_data&0xff000000)>>24, (mem_data&0xff0000)>>16, (mem_data&0xff00)>>8, mem_data&0xff};
for (size_t i = 0; i < 4; i++)
if (a[i] == '\0')
a[i] = ' ';
sprintf(dis, "%c%c%c%c", a[0], a[1], a[2], a[3]);
}
else
sprintf(dis, "INVALID VIEWAS TYPE");
char desc[256] = "";
dc.DrawText(wxString::FromAscii(dis), 77 + fontSize*(8 + 8), rowY1);
if (desc[0] == 0)
{
strcpy(desc, debugger->getDescription(address).c_str());
}
dc.SetTextForeground(_T("#0000FF"));
if (strlen(desc))
{
dc.DrawText(wxString::FromAscii(desc), 17+fontSize*(8+8+8+30), rowY1);
}
// Show blue memory check dot
if (Memory::AreMemoryBreakpointsActivated() && PowerPC::memchecks.GetMemCheck(address))
{
dc.SetBrush(mcBrush);
dc.DrawRectangle(2, rowY1 + 1, 11, 11);
}
}
}
dc.SetPen(currentPen);
}
*/

View File

@ -43,8 +43,9 @@ public:
curAddress = addr;
redraw();
}
int dataType;//u8,u16,u32
int curAddress;//Will be accessed by parent
int dataType; // u8,u16,u32
int curAddress; // Will be accessed by parent
private:
int YToAddress(int y);
void redraw() {Refresh();}

View File

@ -40,7 +40,7 @@ void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, cha
sprintf(dest, "%04x", dsp_imem_read(address));
break;
default:
sprintf(dest, "----");
sprintf(dest, "--IMEM--");
break;
}
break;
@ -48,10 +48,13 @@ void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, cha
switch (address >> 12) {
case 0:
case 1:
sprintf(dest, "%04x", dsp_dmem_read(address));
sprintf(dest, "%04x (DMEM)", dsp_dmem_read(address));
break;
case 0xf:
sprintf(dest, "%04x (MMIO)", g_dsp.ifx_regs[address & 0xFF]);
break;
default:
sprintf(dest, "----");
sprintf(dest, "--DMEM--");
break;
}
break;
@ -115,6 +118,16 @@ void DSPDebugInterface::toggleBreakpoint(unsigned int address)
}
}
bool DSPDebugInterface::isMemCheck(unsigned int address)
{
return false;
}
void DSPDebugInterface::toggleMemCheck(unsigned int address)
{
PanicAlert("MemCheck functionality not supported in DSP module.");
}
void DSPDebugInterface::insertBLR(unsigned int address)
{
PanicAlert("insertBLR functionality not supported in DSP module.");

View File

@ -19,6 +19,8 @@ public:
virtual void clearBreakpoint(unsigned int address);
virtual void clearAllBreakpoints();
virtual void toggleBreakpoint(unsigned int address);
virtual bool isMemCheck(unsigned int address);
virtual void toggleMemCheck(unsigned int address);
virtual unsigned int readMemory(unsigned int address);
virtual unsigned int readInstruction(unsigned int address);
virtual unsigned int getPC();

View File

@ -15,82 +15,108 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h" // Common
#include <iostream> // System
#include "Common.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <wx/artprov.h>
#include "DSPDebugWindow.h"
#include "DSPRegisterView.h"
#include "CodeView.h"
#include "MemoryView.h"
#include "../DSPSymbols.h"
// Define these here to avoid undefined symbols while still saving functionality
void Host_NotifyMapLoaded() {}
void Host_UpdateBreakPointView() {}
// Event table and class
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxFrame)
EVT_CLOSE(DSPDebuggerLLE::OnClose)
EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState)
EVT_MENU(ID_SHOWPCTOOL, DSPDebuggerLLE::OnShowPC)
EVT_TEXT(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
EVT_TEXT_ENTER(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
END_EVENT_TABLE()
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
: wxFrame(parent, id, title, position, size, style)
, m_CachedStepCounter(-1)
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent)
: wxFrame(parent, wxID_ANY, _("DSP LLE Debugger"),
wxDefaultPosition, wxSize(700, 800),
wxDEFAULT_FRAME_STYLE)
, m_CachedStepCounter(-1)
{
CreateGUIControls();
// notify wxAUI which frame to use
m_mgr.SetManagedWindow(this);
m_Toolbar = new wxAuiToolBar(this, ID_TOOLBAR,
wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_TEXT);
m_Toolbar->AddTool(ID_RUNTOOL, wxT("Pause"),
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"),
wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_OTHER, wxSize(10,10)));
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show PC"),
wxArtProvider::GetBitmap(wxART_GO_TO_PARENT, wxART_OTHER, wxSize(10,10)));
m_Toolbar->AddSeparator();
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER));
m_Toolbar->Realize();
m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition,
wxSize(140, 100), 0, NULL, wxLB_SORT);
m_MainNotebook = new wxAuiNotebook(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE);
wxPanel *code_panel = new wxPanel(m_MainNotebook, wxID_ANY);
wxBoxSizer *code_sizer = new wxBoxSizer(wxVERTICAL);
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, code_panel);
m_CodeView->SetPlain();
code_sizer->Add(m_CodeView, 1, wxALL | wxEXPAND);
code_panel->SetSizer(code_sizer);
code_sizer->SetSizeHints(code_panel);
m_MainNotebook->AddPage(code_panel, wxT("Disasm"), true);
wxPanel *mem_panel = new wxPanel(m_MainNotebook, wxID_ANY);
wxBoxSizer *mem_sizer = new wxBoxSizer(wxVERTICAL);
// TODO insert memViewer class
m_MemView = new CMemoryView(&debug_interface, mem_panel);
mem_sizer->Add(m_MemView, 1, wxALL | wxEXPAND);
mem_panel->SetSizer(mem_sizer);
mem_sizer->SetSizeHints(mem_panel);
m_MainNotebook->AddPage(mem_panel, wxT("Mem"));
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
// add the panes to the manager
m_mgr.AddPane(m_Toolbar, wxAuiPaneInfo().
ToolbarPane().Top().
LeftDockable(false).RightDockable(false));
m_mgr.AddPane(m_SymbolList, wxAuiPaneInfo().
Left().CloseButton(false).
Caption(wxT("Symbols")).Dockable(true));
m_mgr.AddPane(m_MainNotebook, wxAuiPaneInfo().
Name(wxT("m_MainNotebook")).Center().
CloseButton(false).MaximizeButton(true));
m_mgr.AddPane(m_Regs, wxAuiPaneInfo().Right().
CloseButton(false).Caption(wxT("Registers")).
Dockable(true));
UpdateState();
m_mgr.Update();
Show();
}
DSPDebuggerLLE::~DSPDebuggerLLE()
{
}
void DSPDebuggerLLE::CreateGUIControls()
{
// Basic settings
SetSize(700, 800);
this->SetSizeHints(700, 800);
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
m_Toolbar = CreateToolBar(wxTB_NODIVIDER|wxTB_NOICONS|wxTB_HORZ_TEXT|wxTB_DOCKABLE, ID_TOOLBAR);
m_Toolbar->AddTool(ID_RUNTOOL, wxT("Run"), wxNullBitmap, wxEmptyString, wxITEM_NORMAL);
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"), wxNullBitmap, wxT("Step Code "), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Show where PC is"), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
m_Toolbar->AddSeparator();
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, _T("")));
m_Toolbar->Realize();
wxBoxSizer* sMain = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(140, 100), 0, NULL, wxLB_SORT),
1, wxEXPAND);
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, this, ID_CODEVIEW);
m_CodeView->SetPlain();
sMain->Add(sizerLeft, 0, wxEXPAND, 0);
sMain->Add(m_CodeView, 4, wxEXPAND, 0);
wxStaticLine* m_staticline = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 0);
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
sMain->Add(m_Regs, 0, wxEXPAND|wxALL, 5);
this->SetSizer(sMain);
this->Layout();
UpdateState();
m_mgr.UnInit();
}
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
@ -123,6 +149,7 @@ void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
}
UpdateState();
m_mgr.Update();
}
void DSPDebuggerLLE::OnShowPC(wxCommandEvent& event)
@ -137,6 +164,7 @@ void DSPDebuggerLLE::Refresh()
UpdateDisAsmListView();
UpdateRegisterFlags();
UpdateState();
m_mgr.Update();
}
void DSPDebuggerLLE::FocusOnPC()
@ -147,12 +175,15 @@ void DSPDebuggerLLE::FocusOnPC()
void DSPDebuggerLLE::UpdateState()
{
if (DSPCore_GetState() == DSPCORE_RUNNING) {
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
m_Toolbar->FindById(ID_STEPTOOL)->Enable(false);
}
else {
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Run"));
m_Toolbar->FindById(ID_STEPTOOL)->Enable(true);
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Pause"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
m_Toolbar->EnableTool(ID_STEPTOOL, false);
} else {
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Run"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_OTHER, wxSize(10,10)));
m_Toolbar->EnableTool(ID_STEPTOOL, true);
}
m_Toolbar->Realize();
}
@ -201,12 +232,11 @@ void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
void DSPDebuggerLLE::UpdateRegisterFlags()
{
}
void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event)
{
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(ID_ADDRBOX);
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_Toolbar->FindControl(ID_ADDRBOX);
wxString txt = pAddrCtrl->GetValue();
std::string text(txt.mb_str());
@ -220,16 +250,32 @@ void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event)
else
pAddrCtrl->SetBackgroundColour(*wxRED);
}
event.Skip(1);
event.Skip();
}
bool DSPDebuggerLLE::JumpToAddress(u16 addr)
{
int new_line = DSPSymbols::Addr2Line(addr);
if (new_line >= 0) {
m_CodeView->Center(new_line);
return true;
} else {
return false;
int page = m_MainNotebook->GetSelection();
if (page == 0)
{
// Center on valid instruction in IRAM/IROM
int new_line = DSPSymbols::Addr2Line(addr);
if (new_line >= 0) {
m_CodeView->Center(new_line);
return true;
}
}
else if (page == 1)
{
// Center on any location in any valid ROM/RAM
int seg = addr >> 12;
if (seg == 0 || seg == 1 ||
seg == 8 || seg == 0xf)
{
m_MemView->Center(addr);
return true;
}
}
return false;
}

View File

@ -33,6 +33,7 @@
#include <wx/sizer.h>
#include <wx/listctrl.h>
#include <wx/statline.h>
#include <wx/aui/aui.h>
#include "disassemble.h"
#include "DSPInterpreter.h"
@ -41,17 +42,12 @@
class DSPRegisterView;
class CCodeView;
class CMemoryView;
class DSPDebuggerLLE : public wxFrame
{
public:
DSPDebuggerLLE(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("DSP LLE Debugger"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE);
DSPDebuggerLLE(wxWindow *parent);
virtual ~DSPDebuggerLLE();
void Refresh();
@ -61,36 +57,13 @@ private:
enum
{
// Toolbar
ID_TOOLBAR = 1000,
ID_RUNTOOL,
ID_STEPTOOL,
ID_SHOWPCTOOL,
ID_ADDRBOX,
ID_JUMPTOTOOL,
ID_DISASMDUMPTOOL,
ID_CHECK_ASSERTINT,
ID_CHECK_HALT,
ID_CHECK_INIT,
ID_SYMBOLLIST,
// Code view
ID_CODEVIEW,
// Register View
ID_DSP_REGS,
};
// Disasm listctrl columns
enum
{
COLUMN_BP,
COLUMN_FUNCTION,
COLUMN_ADDRESS,
COLUMN_MNEMONIC,
COLUMN_OPCODE,
COLUMN_EXT,
COLUMN_PARAM,
ID_DSP_REGS
};
DSPDebugInterface debug_interface;
@ -103,10 +76,13 @@ private:
void UpdateState();
// GUI items
wxToolBar* m_Toolbar;
wxAuiManager m_mgr;
wxAuiToolBar* m_Toolbar;
CCodeView* m_CodeView;
CMemoryView* m_MemView;
DSPRegisterView* m_Regs;
wxListBox* m_SymbolList;
wxAuiNotebook* m_MainNotebook;
void OnClose(wxCloseEvent& event);
void OnChangeState(wxCommandEvent& event);
@ -118,7 +94,6 @@ private:
bool JumpToAddress(u16 addr);
void CreateGUIControls();
void FocusOnPC();
void UnselectAll();
};

View File

@ -78,8 +78,6 @@ from huge functions in ROM - some kind of obfuscation?
0030 8e00 set16
0031 02bf 8078 call 0x8078
0030 8e00 set16
0031 02bf 8078 call 0x8078 // wait for cpu mail
0033 20ff lrs $AX0.L, @CMBL
0034 0240 0fff andi $AC0.M, #0x0fff
0036 1f5e mrr $AX0.H, $AC0.M