DSPLLE: sort of semi-working breakpoints and stepping, if you flip an #ifdef. more work to do, for some reason it gets very slow when you enable it atm

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3573 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-06-28 16:23:40 +00:00
parent b406203794
commit 04105baf4e
19 changed files with 841 additions and 774 deletions

View File

@ -69,7 +69,7 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
// this crc is comparable with the HLE plugin
u32 ector_crc = 0;
for (u32 i = 0; i < size; i++)
for (int i = 0; i < size; i++)
{
ector_crc ^= ptr[i];
//let's rol
@ -85,7 +85,8 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
DSPSymbols::Clear();
bool success = false;
switch (ector_crc) {
switch (ector_crc)
{
case 0x86840740: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Zelda.txt"); break;
case 0x42f64ac4: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_Luigi.txt"); break;
case 0x4e8a8b21: success = DSPSymbols::ReadAnnotatedAssembly("../../Docs/DSP/DSP_UC_AX1.txt"); break;
@ -101,4 +102,9 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
m_DebuggerFrame->Refresh();
return crc;
}
}
void DSPHost_UpdateDebugger()
{
m_DebuggerFrame->Refresh();
}

View File

@ -39,8 +39,6 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &
const wxPoint &position, const wxSize& size, long style)
: wxFrame(parent, id, title, position, size, style)
, m_CachedStepCounter(-1)
, m_CachedCR(-1)
, m_State(RUN)
{
CreateGUIControls();
}
@ -87,6 +85,8 @@ void DSPDebuggerLLE::CreateGUIControls()
this->SetSizer(sMain);
this->Layout();
UpdateState();
}
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
@ -99,15 +99,17 @@ void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
switch (event.GetId())
{
case ID_RUNTOOL:
if ((m_State == RUN) || (m_State == RUN_START))
m_State = PAUSE;
if (DSPCore_GetState() == DSPCORE_RUNNING)
DSPCore_SetState(DSPCORE_STEPPING);
else
m_State = RUN_START;
DSPCore_SetState(DSPCORE_RUNNING);
break;
case ID_STEPTOOL:
m_State = STEP;
if (DSPCore_GetState() == DSPCORE_STEPPING)
DSPCore_Step();
break;
case ID_SHOWPCTOOL:
FocusOnPC();
break;
@ -137,10 +139,14 @@ void DSPDebuggerLLE::FocusOnPC()
void DSPDebuggerLLE::UpdateState()
{
if ((m_State == RUN) || (m_State == RUN_START))
if (DSPCore_GetState() == DSPCORE_RUNNING) {
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
else
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->Realize();
}
@ -188,54 +194,7 @@ void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
void DSPDebuggerLLE::UpdateRegisterFlags()
{
if (m_CachedCR == g_dsp.cr)
return;
// m_Toolbar->ToggleTool(ID_CHECK_ASSERTINT, g_dsp.cr & 0x02 ? true : false);
// m_Toolbar->ToggleTool(ID_CHECK_HALT, g_dsp.cr & 0x04 ? true : false);
// m_Toolbar->ToggleTool(ID_CHECK_INIT, g_dsp.cr & 0x800 ? true : false);
m_CachedCR = g_dsp.cr;
}
bool DSPDebuggerLLE::CanDoStep()
{
// update the symbols all the time because they're script cmds like bps
UpdateSymbolMap();
switch (m_State)
{
case RUN_START:
m_State = RUN;
return true;
case RUN:
/*
if (IsBreakPoint(g_dsp.pc))
{
Refresh();
m_State = PAUSE;
return false;
}*/
return true;
case PAUSE:
Refresh();
return false;
case STEP:
Refresh();
m_State = PAUSE;
return true;
}
return false;
}
void DSPDebuggerLLE::DebugBreak()
{
m_State = PAUSE;
}
void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event)

View File

@ -54,8 +54,6 @@ public:
virtual ~DSPDebuggerLLE();
bool CanDoStep();
void DebugBreak();
void Refresh();
private:
@ -95,18 +93,8 @@ private:
COLUMN_PARAM,
};
enum EState
{
PAUSE,
STEP,
RUN,
RUN_START // ignores breakpoints and switches after one step to RUN
};
EState m_State;
DSPDebugInterface debug_interface;
u64 m_CachedStepCounter;
u16 m_CachedCR;
// GUI updaters
void UpdateDisAsmListView();

View File

@ -45,17 +45,12 @@ DSPDebuggerLLE* m_DebuggerFrame = NULL;
PLUGIN_GLOBALS* globals = NULL;
DSPInitialize g_dspInitialize;
Common::Thread *g_hDSPThread = NULL;
SoundStream *soundStream = NULL;
#define GDSP_MBOX_CPU 0
#define GDSP_MBOX_DSP 1
bool bCanWork = false;
bool bIsRunning = false;
//////////////////////////////////////////////////////////////////////////
// UGLY wxw stuff, TODO fix up
// UGLY WxW stuff, TODO fix up
// wxWidgets: Create the wxApp
#if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp
@ -188,14 +183,14 @@ THREAD_RETURN dsp_thread(void* lpParameter)
void DSP_DebugBreak()
{
#if defined(HAVE_WX) && HAVE_WX
if(m_DebuggerFrame)
m_DebuggerFrame->DebugBreak();
// if (m_DebuggerFrame)
// m_DebuggerFrame->DebugBreak();
#endif
}
void Initialize(void *init)
{
bCanWork = true;
bool bCanWork = true;
g_dspInitialize = *(DSPInitialize*)init;
g_Config.Load();
@ -324,7 +319,7 @@ void DSP_Update(int cycles)
// If we're not on a thread, run cycles here.
if (!g_dspInitialize.bOnThread)
{
DSPInterpreter::RunCycles(cycles);
DSPCore_RunCycles(cycles);
}
}
@ -347,8 +342,8 @@ void DSP_SendAIBuffer(unsigned int address, int sample_rate)
// so each sample now triggers the sound stream)
// TODO: think about this.
//static int counter = 0;
//counter++;
// static int counter = 0;
// counter++;
if (/*(counter & 31) == 0 &&*/ soundStream)
soundStream->Update();
}