some progress on dsp llet debugger. go dump some ucodes ;)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2854 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-03 18:04:08 +00:00
parent 9356a920e2
commit 2a5b8f4366
8 changed files with 74 additions and 26 deletions

View File

@ -510,8 +510,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
wxMenuItem* pJit = pDebugDialogs->Append(IDM_JITWINDOW, _T("&Jit"), wxEmptyString, wxITEM_CHECK);
pJit->Check(bJitWindow);
wxMenuItem* pSound = pDebugDialogs->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString, wxITEM_CHECK);
pSound->Check(bSoundWindow);
wxMenuItem* pSound = pDebugDialogs->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString);
wxMenuItem* pVideo = pDebugDialogs->Append(IDM_VIDEOWINDOW, _T("&Video"), wxEmptyString, wxITEM_CHECK);
pVideo->Check(bVideoWindow);

View File

@ -28,12 +28,11 @@ BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxFrame)
EVT_CLOSE(DSPDebuggerLLE::OnClose)
EVT_SIZE(DSPDebuggerLLE::OnChangeSize)
//EVT_RIGHT_DOWN(DSPDebuggerLLE::ScrollBlocks)
//EVT_LEFT_DOWN(DSPDebuggerLLE::ScrollBlocks)
//EVT_MOUSE_EVENTS(DSPDebuggerLLE::ScrollBlocks)
//EVT_MOTION(DSPDebuggerLLE::ScrollBlocks)
//EVT_SCROLL(DSPDebuggerLLE::ScrollBlocks)
//EVT_SCROLLWIN(DSPDebuggerLLE::ScrollBlocks)
EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState)
EVT_MENU(ID_DUMPCODETOOL, DSPDebuggerLLE::OnDumpCode)
EVT_LIST_ITEM_RIGHT_CLICK(ID_DISASM, DSPDebuggerLLE::OnRightClick)
EVT_LIST_ITEM_ACTIVATED(ID_DISASM, DSPDebuggerLLE::OnDoubleClick)
END_EVENT_TABLE()
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &title,
@ -60,11 +59,10 @@ void DSPDebuggerLLE::CreateGUIControls()
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_PAUSETOOL, wxT("Pause"), wxNullBitmap, wxEmptyString, wxITEM_NORMAL);
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"), wxNullBitmap, wxT("Step Code "), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_RESETTOPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Reset To PC counter"), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Reset To PC counter"), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_DUMPCODETOOL, wxT("Dump"), wxNullBitmap, wxT("Dump Code to File"), wxITEM_NORMAL);
m_Toolbar->AddCheckTool(ID_DUMPCODETOOL, wxT("Dump"), wxNullBitmap, wxNullBitmap, wxT("Dump UCode to File"));
m_Toolbar->AddSeparator();
m_Toolbar->AddCheckTool(ID_CHECK_ASSERTINT, wxT("AssertInt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
m_Toolbar->AddCheckTool(ID_CHECK_HALT, wxT("Halt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
@ -97,6 +95,7 @@ void DSPDebuggerLLE::CreateGUIControls()
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
{
wxWindow::Destroy();
event.Skip();
}
@ -106,6 +105,55 @@ void DSPDebuggerLLE::OnChangeSize(wxSizeEvent& event)
event.Skip();
}
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_RUNTOOL:
if ((m_State == RUN) || (m_State == RUN_START))
m_State = PAUSE;
else
m_State = RUN_START;
break;
case ID_STEPTOOL:
m_State = STEP;
break;
}
if ((m_State == RUN) || (m_State == RUN_START))
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
else
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Run"));
m_Toolbar->Realize();
}
void DSPDebuggerLLE::OnDumpCode(wxCommandEvent& event)
{
g_dsp.dump_imem = event.IsChecked();
}
void DSPDebuggerLLE::OnRightClick(wxListEvent& event)
{
long item = m_Disasm->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
u16 SelectedPC = static_cast<u16>(m_Disasm->GetItemData(item));
g_dsp.pc = SelectedPC;
Refresh();
}
void DSPDebuggerLLE::OnDoubleClick(wxListEvent& event)
{
long item = m_Disasm->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
u16 SelectedPC = static_cast<u16>(m_Disasm->GetItemData(item));
ToggleBreakPoint(SelectedPC);
if (IsBreakPoint(SelectedPC))
m_Disasm->SetItem(item, COLUMN_BP, wxT("*"));
else
m_Disasm->SetItem(item, COLUMN_BP, wxT(""));
}
void DSPDebuggerLLE::Refresh()
{
UpdateSymbolMap();
@ -244,17 +292,13 @@ void DSPDebuggerLLE::UpdateDisAsmListView()
m_CachedStepCounter = g_dsp.step_counter;
// RebuildDisAsmListView(); // TODO do we need this?
m_Regs->Update();
}
void DSPDebuggerLLE::UpdateSymbolMap()
{
if (g_dsp.dram == NULL)
{
return;
}
if (m_CachedUCodeCRC != g_dsp.iram_crc)
{
@ -265,7 +309,7 @@ void DSPDebuggerLLE::UpdateSymbolMap()
LoadSymbolMap(FileName);
// rebuild the disasm
// RebuildDisAsmListView(); // TODO do we need this?
RebuildDisAsmListView();
}
}

View File

@ -63,14 +63,13 @@ private:
// Toolbar
ID_TOOLBAR = 1000,
ID_RUNTOOL,
ID_PAUSETOOL,
ID_STEPTOOL,
ID_RESETTOPCTOOL,
ID_SHOWPCTOOL,
ID_JUMPTOTOOL,
ID_DUMPCODETOOL,
ID_CHECK_ASSERTINT,
ID_CHECK_HALT,
ID_CHECK_INIT,
ID_DUMPCODETOOL,
// Disasm view
ID_DISASM,
@ -147,6 +146,10 @@ private:
void OnClose(wxCloseEvent& event);
void OnChangeSize(wxSizeEvent& event);
void OnChangeState(wxCommandEvent& event);
void OnDumpCode(wxCommandEvent& event);
void OnRightClick(wxListEvent& event);
void OnDoubleClick(wxListEvent& event);
void CreateGUIControls();
void Refresh();

View File

@ -22,7 +22,6 @@
#include <stdio.h>
#define WITH_DSP_ON_THREAD 1
#define DUMP_DSP_IMEM 0
#define PROFILE 0

View File

@ -26,7 +26,7 @@
bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc)
{
char szFilename[MAX_PATH];
sprintf(szFilename, "c:\\_\\DSP_UC_%08X.bin", crc);
sprintf(szFilename, "%sDSP_UC_%08X.bin", FULL_DUMP_DIR, crc);
FILE* pFile = fopen(szFilename, "wb");
if (pFile != NULL)
@ -73,7 +73,9 @@ u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
bool DumpCWCode(u32 _Address, u32 _Length)
{
FILE* pFile = fopen("d:\\DSP_UCode.bin", "wb");
char filename[256];
sprintf(filename, "%sDSP_UCode.bin", FULL_DUMP_DIR);
FILE* pFile = fopen(filename, "wb");
if (pFile != NULL)
{

View File

@ -256,9 +256,8 @@ void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
g_dsp.iram_crc = GenerateCRC(g_dsp.cpu_ram + (addr & 0x0fffffff), size);
DEBUG_LOG(DSPHLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)\n", addr, dsp_addr, g_dsp.iram_crc);
#if DUMP_DSP_IMEM
if (g_dsp.dump_imem)
DumpDSPCode(addr, size, g_dsp.iram_crc );
#endif
}

View File

@ -53,6 +53,7 @@ void (*SDSP::irq_request)() = NULL;
bool SDSP::exception_in_progress_hack = false;
// for debugger only
bool SDSP::dump_imem = false;
u32 SDSP::iram_crc = 0;
u64 SDSP::step_counter = 0;

View File

@ -79,6 +79,7 @@ struct SDSP
static void (* irq_request)(void);
// for debugger only
static bool dump_imem;
static u32 iram_crc;
static u64 step_counter;
static bool exception_in_progress_hack;