From b801e16cd36fd73a46807f8a9c0573a1fb74d9c1 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 6 Apr 2009 20:32:37 +0000 Subject: [PATCH] minor dsp debugger improvements git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2907 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/Debugger/Debugger.cpp | 67 +++++++++++++------ .../Src/Debugger/Debugger.h | 5 +- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.cpp index 0d6d0eaead..865a787e83 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.cpp @@ -26,9 +26,9 @@ // Event table and class BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxFrame) EVT_CLOSE(DSPDebuggerLLE::OnClose) - EVT_SIZE(DSPDebuggerLLE::OnChangeSize) EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState) + EVT_MENU(ID_SHOWPCTOOL, DSPDebuggerLLE::OnShowPC) EVT_MENU(ID_DUMPCODETOOL, DSPDebuggerLLE::OnDumpCode) EVT_LIST_ITEM_RIGHT_CLICK(ID_DISASM, DSPDebuggerLLE::OnRightClick) @@ -100,12 +100,6 @@ void DSPDebuggerLLE::OnClose(wxCloseEvent& event) event.Skip(); } -void DSPDebuggerLLE::OnChangeSize(wxSizeEvent& event) -{ - Refresh(); - event.Skip(); -} - void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event) { switch (event.GetId()) @@ -122,11 +116,13 @@ void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event) 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(); + UpdateState(); +} + +void DSPDebuggerLLE::OnShowPC(wxCommandEvent& event) +{ + Refresh(); + FocusOnPC(); } void DSPDebuggerLLE::OnDumpCode(wxCommandEvent& event) @@ -160,6 +156,40 @@ void DSPDebuggerLLE::Refresh() UpdateSymbolMap(); UpdateDisAsmListView(); UpdateRegisterFlags(); + UpdateState(); +} + +void DSPDebuggerLLE::FocusOnPC() +{ + UnselectAll(); + + for (int i = 0; i < m_Disasm->GetItemCount(); i++) + { + if (m_Disasm->GetItemData(i) == g_dsp.pc) + { + m_Disasm->EnsureVisible(i - 5); + m_Disasm->EnsureVisible(i + 5); + m_Disasm->SetItemState(i, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED); + break; + } + } +} + +void DSPDebuggerLLE::UnselectAll() +{ + for (int i = 0; i < m_Disasm->GetItemCount(); i++) + { + m_Disasm->SetItemState(i, 0, wxLIST_STATE_SELECTED); + } +} + +void DSPDebuggerLLE::UpdateState() +{ + 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::RebuildDisAsmListView() @@ -280,16 +310,7 @@ void DSPDebuggerLLE::UpdateDisAsmListView() return; // show PC - for (int i = 0; i < m_Disasm->GetItemCount(); i++) - { - if (m_Disasm->GetItemData(i) == g_dsp.pc) - { - m_Disasm->EnsureVisible(i - 5); - m_Disasm->EnsureVisible(i + 14); - m_Disasm->SetItemState(i, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED); - break; - } - } + FocusOnPC(); m_CachedStepCounter = g_dsp.step_counter; @@ -319,6 +340,8 @@ void DSPDebuggerLLE::UpdateRegisterFlags() if (m_CachedCR == g_dsp.cr) return; + m_Toolbar->ToggleTool(ID_DUMPCODETOOL, g_dsp.dump_imem); + 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); diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.h index 940aaa33be..735438e782 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/Debugger/Debugger.h @@ -137,6 +137,7 @@ private: void UpdateDisAsmListView(); void UpdateRegisterFlags(); void UpdateSymbolMap(); + void UpdateState(); void RebuildDisAsmListView(); @@ -146,14 +147,16 @@ private: DSPRegisterView* m_Regs; void OnClose(wxCloseEvent& event); - void OnChangeSize(wxSizeEvent& event); void OnChangeState(wxCommandEvent& event); + void OnShowPC(wxCommandEvent& event); void OnDumpCode(wxCommandEvent& event); void OnRightClick(wxListEvent& event); void OnDoubleClick(wxListEvent& event); void CreateGUIControls(); void Refresh(); + void FocusOnPC(); + void UnselectAll(); }; #endif //_DSP_DEBUGGER_LLE_H