minor improvements (mostly debugger)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@82 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fires.gc
2008-07-24 13:40:07 +00:00
parent 9e285ca377
commit 2f308cf77a
19 changed files with 808 additions and 134 deletions

View File

@ -22,6 +22,7 @@
#include "HW/Memmap.h"
#include "BreakPointDlg.h"
#include "MemoryCheckDlg.h"
#include "IniFile.h"
#include "wx/mstream.h"
@ -69,6 +70,28 @@ CBreakPointWindow::~CBreakPointWindow()
{}
void
CBreakPointWindow::Save(IniFile& _IniFile) const
{
_IniFile.Set("BreakPoint", "x", GetPosition().x);
_IniFile.Set("BreakPoint", "y", GetPosition().y);
_IniFile.Set("BreakPoint", "w", GetSize().GetWidth());
_IniFile.Set("BreakPoint", "h", GetSize().GetHeight());
}
void
CBreakPointWindow::Load(IniFile& _IniFile)
{
int x,y,w,h;
_IniFile.Get("BreakPoint", "x", &x, GetPosition().x);
_IniFile.Get("BreakPoint", "y", &y, GetPosition().y);
_IniFile.Get("BreakPoint", "w", &w, GetSize().GetWidth());
_IniFile.Get("BreakPoint", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
}
void
CBreakPointWindow::CreateGUIControls()
{

View File

@ -21,6 +21,7 @@
class CBreakPointView;
class CCodeWindow;
class wxListEvent;
class IniFile;
#undef BREAKPOINT_WINDOW_STYLE
#define BREAKPOINT_WINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxRESIZE_BORDER
@ -41,6 +42,9 @@ class CBreakPointWindow
virtual ~CBreakPointWindow();
void NotifyUpdate();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
private:

View File

@ -47,9 +47,11 @@
#include "../../DolphinWX/src/Globals.h"
extern "C" {
#include "../resources/toolbar_add_breakpoint.c"
#include "../resources/toolbar_add_memorycheck.c"
#include "../resources/toolbar_delete.c"
#include "../resources/toolbar_play.c"
#include "../resources/toolbar_pause.c"
#include "../resources/toolbar_add_memorycheck.c"
#include "../resources/toolbar_delete.c"
#include "../resources/toolbar_add_breakpoint.c"
}
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
@ -84,7 +86,7 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
const wxString& title, const wxPoint& pos, const wxSize& size, long style)
: wxFrame(parent, id, title, pos, size, style)
, m_RegisterWindow(NULL)
, m_logwindow(NULL)
, m_LogWindow(NULL)
{
InitBitmaps();
@ -95,50 +97,54 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
UpdateButtonStates();
// load ini...
int x,y,w,h;
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
wxKeyEventHandler(CCodeWindow::OnKeyDown),
(wxObject*)0, this);
// load ini...
IniFile file;
file.Load("Debugger.ini");
this->Load(file);
m_BreakpointWindow->Load(file);
m_LogWindow->Load(file);
m_RegisterWindow->Load(file);
m_MemoryWindow->Load(file);
}
CCodeWindow::~CCodeWindow()
{
IniFile file;
file.Load("Debugger.ini");
this->Save(file);
m_BreakpointWindow->Save(file);
m_LogWindow->Save(file);
m_RegisterWindow->Save(file);
m_MemoryWindow->Save(file);
file.Save("Debugger.ini");
}
void CCodeWindow::Load( IniFile &file )
{
int x,y,w,h;
file.Get("Code", "x", &x, GetPosition().x);
file.Get("Code", "y", &y, GetPosition().y);
file.Get("Code", "w", &w, GetSize().GetWidth());
file.Get("Code", "h", &h, GetSize().GetHeight());
this->SetSize(x, y, w, h);
}
// These really should be in the respective constructors.
if (m_BreakpointWindow) {
file.Get("BreakPoint", "x", &x, m_BreakpointWindow->GetPosition().x);
file.Get("BreakPoint", "y", &y, m_BreakpointWindow->GetPosition().y);
file.Get("BreakPoint", "w", &w, m_BreakpointWindow->GetSize().GetWidth());
file.Get("BreakPoint", "h", &h, m_BreakpointWindow->GetSize().GetHeight());
m_BreakpointWindow->SetSize(x, y, w, h);
}
if (m_logwindow) {
file.Get("LogWindow", "x", &x, m_logwindow->GetPosition().x);
file.Get("LogWindow", "y", &y, m_logwindow->GetPosition().y);
file.Get("LogWindow", "w", &w, m_logwindow->GetSize().GetWidth());
file.Get("LogWindow", "h", &h, m_logwindow->GetSize().GetHeight());
m_logwindow->SetSize(x, y, w, h);
}
if (m_RegisterWindow) {
file.Get("RegisterWindow", "x", &x, m_RegisterWindow->GetPosition().x);
file.Get("RegisterWindow", "y", &y, m_RegisterWindow->GetPosition().y);
//file.Get("RegisterWindow", "w", &w, m_RegisterWindow->GetSize().GetWidth());
//file.Get("RegisterWindow", "h", &h, m_RegisterWindow->GetSize().GetHeight());
m_RegisterWindow->SetSize(x, y, w, h);
}
if (m_MemoryWindow) {
file.Get("MemoryWindow", "x", &x, m_MemoryWindow->GetPosition().x);
file.Get("MemoryWindow", "y", &y, m_MemoryWindow->GetPosition().y);
file.Get("MemoryWindow", "w", &w, m_MemoryWindow->GetSize().GetWidth());
file.Get("MemoryWindow", "h", &h, m_MemoryWindow->GetSize().GetHeight());
m_RegisterWindow->SetSize(x, y, w, h);
}
void CCodeWindow::Save(IniFile &file) const
{
file.Set("Code", "x", GetPosition().x);
file.Set("Code", "y", GetPosition().y);
file.Set("Code", "w", GetSize().GetWidth());
file.Set("Code", "h", GetSize().GetHeight());
}
@ -169,8 +175,8 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
// additional dialogs
if (IsLoggingActivated())
{
m_logwindow = new CLogWindow(this);
m_logwindow->Show(true);
m_LogWindow = new CLogWindow(this);
m_LogWindow->Show(true);
}
m_RegisterWindow = new CRegisterWindow(this);
@ -184,48 +190,6 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
}
CCodeWindow::~CCodeWindow()
{
IniFile file;
file.Load("Debugger.ini");
file.Set("Code", "x", GetPosition().x);
file.Set("Code", "y", GetPosition().y);
file.Set("Code", "w", GetSize().GetWidth());
file.Set("Code", "h", GetSize().GetHeight());
// These really should be in the respective destructors.
if (m_BreakpointWindow) {
file.Set("BreakPoint", "x", m_BreakpointWindow->GetPosition().x);
file.Set("BreakPoint", "y", m_BreakpointWindow->GetPosition().y);
file.Set("BreakPoint", "w", m_BreakpointWindow->GetSize().GetWidth());
file.Set("BreakPoint", "h", m_BreakpointWindow->GetSize().GetHeight());
}
if (m_logwindow) {
file.Set("LogWindow", "x", m_logwindow->GetPosition().x);
file.Set("LogWindow", "y", m_logwindow->GetPosition().y);
file.Set("LogWindow", "w", m_logwindow->GetSize().GetWidth());
file.Set("LogWindow", "h", m_logwindow->GetSize().GetHeight());
}
if (m_RegisterWindow) {
file.Set("RegisterWindow", "x", m_RegisterWindow->GetPosition().x);
file.Set("RegisterWindow", "y", m_RegisterWindow->GetPosition().y);
file.Set("RegisterWindow", "w", m_RegisterWindow->GetSize().GetWidth());
file.Set("RegisterWindow", "h", m_RegisterWindow->GetSize().GetHeight());
}
if (m_MemoryWindow) {
file.Set("MemoryWindow", "x", m_MemoryWindow->GetPosition().x);
file.Set("MemoryWindow", "y", m_MemoryWindow->GetPosition().y);
file.Set("MemoryWindow", "w", m_MemoryWindow->GetSize().GetWidth());
file.Set("MemoryWindow", "h", m_MemoryWindow->GetSize().GetHeight());
}
file.Save("Debugger.ini");
}
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
wxMenuBar* pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
@ -307,16 +271,8 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
break;
case IDM_STEP:
{
CCPU::StepOpcode(&sync_event);
// if (CCPU::IsStepping())
// sync_event.Wait();
wxThread::Sleep(20);
// need a short wait here
codeview->Center(PC);
Update();
Host_UpdateLogDisplay();
}
SingleCPUStep();
break;
case IDM_STEPOVER:
@ -410,7 +366,7 @@ void CCodeWindow::NotifyMapLoaded()
void CCodeWindow::UpdateButtonStates()
{
wxToolBarBase* toolBar = GetToolBar();
wxToolBar* toolBar = GetToolBar();
if (Core::GetState() == Core::CORE_UNINITIALIZED)
{
toolBar->EnableTool(IDM_DEBUG_GO, false);
@ -423,6 +379,7 @@ void CCodeWindow::UpdateButtonStates()
if (!CCPU::IsStepping())
{
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause"));
toolBar->SetToolNormalBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]);
toolBar->EnableTool(IDM_DEBUG_GO, true);
toolBar->EnableTool(IDM_STEP, false);
toolBar->EnableTool(IDM_STEPOVER, false);
@ -430,7 +387,8 @@ void CCodeWindow::UpdateButtonStates()
}
else
{
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Go"));
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play"));
toolBar->SetToolNormalBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]);
toolBar->EnableTool(IDM_DEBUG_GO, true);
toolBar->EnableTool(IDM_STEP, true);
toolBar->EnableTool(IDM_STEPOVER, true);
@ -472,12 +430,12 @@ void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
if (show)
{
if (!m_logwindow)
if (!m_LogWindow)
{
m_logwindow = new CLogWindow(this);
m_LogWindow = new CLogWindow(this);
}
m_logwindow->Show(true);
m_LogWindow->Show(true);
}
else // hide
{
@ -485,11 +443,11 @@ void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
// didn't report the checked menu item status correctly.
// It should be true just after the menu item was selected,
// if there was no modeless dialog yet.
wxASSERT(m_logwindow != NULL);
wxASSERT(m_LogWindow != NULL);
if (m_logwindow)
if (m_LogWindow)
{
m_logwindow->Hide();
m_LogWindow->Hide();
}
}
}
@ -589,9 +547,9 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
case IDM_UPDATELOGDISPLAY:
if (m_logwindow)
if (m_LogWindow)
{
m_logwindow->NotifyUpdate();
m_LogWindow->NotifyUpdate();
}
break;
@ -624,7 +582,7 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
h = m_Bitmaps[Toolbar_DebugGo].GetHeight();
toolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->AddTool(IDM_DEBUG_GO, _T("Go"), m_Bitmaps[Toolbar_DebugGo], _T("Delete the selected BreakPoint or MemoryCheck"));
toolBar->AddTool(IDM_DEBUG_GO, _T("Play"), m_Bitmaps[Toolbar_DebugGo], _T("Delete the selected BreakPoint or MemoryCheck"));
toolBar->AddTool(IDM_STEP, _T("Step"), m_Bitmaps[Toolbar_Step], _T("Add BreakPoint..."));
toolBar->AddTool(IDM_STEPOVER, _T("Step Over"), m_Bitmaps[Toolbar_StepOver], _T("Add BreakPoint..."));
toolBar->AddTool(IDM_SKIP, _T("Skip"), m_Bitmaps[Toolbar_Skip], _T("Add BreakPoint..."));
@ -659,12 +617,13 @@ void CCodeWindow::RecreateToolbar()
void CCodeWindow::InitBitmaps()
{
// load original size 48x48
m_Bitmaps[Toolbar_DebugGo] = wxGetBitmapFromMemory(toolbar_delete_png);
m_Bitmaps[Toolbar_DebugGo] = wxGetBitmapFromMemory(toolbar_play_png);
m_Bitmaps[Toolbar_Step] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png);
m_Bitmaps[Toolbar_StepOver] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(toolbar_pause_png);
// scale to 16x16 for toolbar
@ -673,3 +632,29 @@ void CCodeWindow::InitBitmaps()
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(16, 16));
}
}
void CCodeWindow::OnKeyDown(wxKeyEvent& event)
{
if (event.GetKeyCode() == WXK_SPACE)
{
SingleCPUStep();
}
else
{
event.Skip();
}
}
void CCodeWindow::SingleCPUStep()
{
CCPU::StepOpcode(&sync_event);
// if (CCPU::IsStepping())
// sync_event.Wait();
wxThread::Sleep(20);
// need a short wait here
codeview->Center(PC);
Update();
Host_UpdateLogDisplay();
}

View File

@ -32,6 +32,7 @@ class CLogWindow;
class CBreakPointWindow;
class CMemoryWindow;
class CCodeView;
class IniFile;
class CCodeWindow
: public wxFrame
@ -45,7 +46,10 @@ class CCodeWindow
const wxSize& size = wxSize(400, 500),
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
~CCodeWindow();
~CCodeWindow();
void Load(IniFile &file);
void Save(IniFile &file) const;
void Update();
void NotifyMapLoaded();
@ -79,6 +83,7 @@ class CCodeWindow
enum
{
Toolbar_DebugGo,
Toolbar_Pause,
Toolbar_Step,
Toolbar_StepOver,
Toolbar_Skip,
@ -88,7 +93,7 @@ class CCodeWindow
};
// sub dialogs
CLogWindow* m_logwindow;
CLogWindow* m_LogWindow;
CRegisterWindow* m_RegisterWindow;
CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow;
@ -105,6 +110,9 @@ class CCodeWindow
void OnSymbolListChange(wxCommandEvent& event);
void OnCallstackListChange(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);
void SingleCPUStep();
void OnAddrBoxChange(wxCommandEvent& event);
void OnToggleRegisterWindow(wxCommandEvent& event);
@ -121,6 +129,7 @@ class CCodeWindow
void PopulateToolbar(wxToolBar* toolBar);
void InitBitmaps();
void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
void OnKeyDown(wxKeyEvent& event);
};
#endif /*CODEWINDOW_*/

View File

@ -28,10 +28,10 @@
#include "IniFile.h"
BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit)
EVT_BUTTON(IDM_UPDATELOG, CLogWindow::OnUpdateLog)
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck)
EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit)
EVT_BUTTON(IDM_UPDATELOG, CLogWindow::OnUpdateLog)
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck)
END_EVENT_TABLE()
@ -72,6 +72,25 @@ CLogWindow::CLogWindow(wxWindow* parent)
}
void CLogWindow::Save(IniFile& _IniFile) const
{
_IniFile.Set("LogWindow", "x", GetPosition().x);
_IniFile.Set("LogWindow", "y", GetPosition().y);
_IniFile.Set("LogWindow", "w", GetSize().GetWidth());
_IniFile.Set("LogWindow", "h", GetSize().GetHeight());
}
void CLogWindow::Load(IniFile& _IniFile)
{
int x,y,w,h;
_IniFile.Get("LogWindow", "x", &x, GetPosition().x);
_IniFile.Get("LogWindow", "y", &y, GetPosition().y);
_IniFile.Get("LogWindow", "w", &w, GetSize().GetWidth());
_IniFile.Get("LogWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
}
void CLogWindow::OnSubmit(wxCommandEvent& event)
{
Console_Submit(m_cmdline->GetValue().To8BitData());

View File

@ -18,10 +18,9 @@
#ifndef LOGWINDOW_H_
#define LOGWINDOW_H_
#include "wx/dialog.h"
#include "wx/textctrl.h"
#include "wx/checklst.h"
#include "Debugger.h"
class wxTextCtrl;
class wxCheckListBox;
class IniFile;
class CLogWindow
: public wxDialog
@ -31,6 +30,8 @@ class CLogWindow
CLogWindow(wxWindow* parent);
void NotifyUpdate();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
private:

View File

@ -108,4 +108,4 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/)
void MemoryCheckDlg::OnCancel(wxCommandEvent& /*event*/)
{
Close();
}
}

View File

@ -38,14 +38,6 @@
// ugly that this lib included code from the main
#include "../../DolphinWX/src/Globals.h"
class SymbolList
: public wxListCtrl
{
wxString OnGetItemText(long item, long column)
{
return(_T("hello"));
}
};
enum
{
@ -107,6 +99,25 @@ CMemoryWindow::~CMemoryWindow()
}
void CMemoryWindow::Save(IniFile& _IniFile) const
{
_IniFile.Set("MemoryWindow", "x", GetPosition().x);
_IniFile.Set("MemoryWindow", "y", GetPosition().y);
_IniFile.Set("MemoryWindow", "w", GetSize().GetWidth());
_IniFile.Set("MemoryWindow", "h", GetSize().GetHeight());
}
void CMemoryWindow::Load(IniFile& _IniFile)
{
int x,y,w,h;
_IniFile.Get("MemoryWindow", "x", &x, GetPosition().x);
_IniFile.Get("MemoryWindow", "y", &y, GetPosition().y);
_IniFile.Get("MemoryWindow", "w", &w, GetSize().GetWidth());
_IniFile.Get("MemoryWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
}
void CMemoryWindow::JumpToAddress(u32 _Address)
{

View File

@ -45,6 +45,9 @@ class CMemoryWindow
~CMemoryWindow();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
void Update();
void NotifyMapLoaded();

View File

@ -19,12 +19,12 @@
#include "RegisterWindow.h"
#include "PowerPC/PowerPC.h"
#include "RegisterView.h"
#include "IniFile.h"
extern const char* GetGRPName(unsigned int index);
BEGIN_EVENT_TABLE(CRegisterWindow, wxDialog)
EVT_CLOSE(CRegisterWindow::OnClose)
EVT_CLOSE(CRegisterWindow::OnClose)
END_EVENT_TABLE()
CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
@ -39,6 +39,26 @@ CRegisterWindow::~CRegisterWindow()
{}
void CRegisterWindow::Save(IniFile& _IniFile) const
{
_IniFile.Set("RegisterWindow", "x", GetPosition().x);
_IniFile.Set("RegisterWindow", "y", GetPosition().y);
_IniFile.Set("RegisterWindow", "w", GetSize().GetWidth());
_IniFile.Set("RegisterWindow", "h", GetSize().GetHeight());
}
void CRegisterWindow::Load(IniFile& _IniFile)
{
int x,y,w,h;
_IniFile.Get("RegisterWindow", "x", &x, GetPosition().x);
_IniFile.Get("RegisterWindow", "y", &y, GetPosition().y);
_IniFile.Get("RegisterWindow", "w", &w, GetSize().GetWidth());
_IniFile.Get("RegisterWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
}
void CRegisterWindow::CreateGUIControls()
{
SetTitle(wxT("Registers"));

View File

@ -19,6 +19,7 @@
#define __REGISTERWINDOW_h__
class CRegisterView;
class IniFile;
#undef RegisterWindow_STYLE
#define RegisterWindow_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX
@ -35,6 +36,9 @@ class CRegisterWindow
CRegisterWindow(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Registers"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = RegisterWindow_STYLE);
virtual ~CRegisterWindow();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
void NotifyUpdate();