mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
finished dialogs for memory checks and breakpoints
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@76 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -16,10 +16,16 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "BreakPointDlg.h"
|
||||
#include "Common.h"
|
||||
#include "Debugger.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Debugger/Debugger_BreakPoints.h"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog)
|
||||
EVT_CLOSE(BreakPointDlg::OnClose)
|
||||
EVT_BUTTON(ID_OK, BreakPointDlg::OnOK)
|
||||
EVT_BUTTON(ID_CANCEL, BreakPointDlg::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
@ -51,7 +57,7 @@ void BreakPointDlg::CreateGUIControls()
|
||||
m_pButtonCancel = new wxButton(this, ID_CANCEL, wxT("Cancel"), wxPoint(112,64), wxSize(73,25), 0, wxDefaultValidator, wxT("Cancel"));
|
||||
m_pButtonCancel->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
m_pEditAddress = new wxTextCtrl(this, ID_ADDRESS, wxT("WxEdit1"), wxPoint(56,24), wxSize(197,20), 0, wxDefaultValidator, wxT("WxEdit1"));
|
||||
m_pEditAddress = new wxTextCtrl(this, ID_ADDRESS, wxT("80000000"), wxPoint(56,24), wxSize(197,20), 0, wxDefaultValidator, wxT("WxEdit1"));
|
||||
m_pEditAddress->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
wxStaticBox* WxStaticBox1 = new wxStaticBox(this, ID_WXSTATICBOX1, wxT("Address"), wxPoint(0,0), wxSize(265,57));
|
||||
@ -63,3 +69,19 @@ void BreakPointDlg::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
|
||||
{
|
||||
wxString AddressString = m_pEditAddress->GetLineText(0);
|
||||
u32 Address = 0;
|
||||
if (AsciiToHex(AddressString.GetData(), Address))
|
||||
{
|
||||
CBreakPoints::AddBreakPoint(Address);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
void BreakPointDlg::OnCancel(wxCommandEvent& /*event*/)
|
||||
{
|
||||
Close();
|
||||
}
|
@ -27,7 +27,7 @@
|
||||
#include <wx/statbox.h>
|
||||
|
||||
#undef BreakPointDlg_STYLE
|
||||
#define BreakPointDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxSTAY_ON_TOP | wxDIALOG_NO_PARENT | wxCLOSE_BOX
|
||||
#define BreakPointDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
|
||||
|
||||
|
||||
class BreakPointDlg : public wxDialog
|
||||
@ -57,8 +57,11 @@ class BreakPointDlg : public wxDialog
|
||||
};
|
||||
|
||||
private:
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
void CreateGUIControls();
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -44,10 +44,10 @@ CBreakPointView::Update()
|
||||
InsertColumn(0, wxT("Active"), wxLIST_FORMAT_LEFT, 50);
|
||||
InsertColumn(1, wxT("Type"), wxLIST_FORMAT_LEFT, 50);
|
||||
InsertColumn(2, wxT("Function"), wxLIST_FORMAT_CENTER, 200);
|
||||
InsertColumn(3, wxT("Address"), wxLIST_FORMAT_CENTER, 100);
|
||||
InsertColumn(3, wxT("Address"), wxLIST_FORMAT_LEFT, 100);
|
||||
InsertColumn(4, wxT("Flags"), wxLIST_FORMAT_CENTER, 100);
|
||||
|
||||
char szBuffer[32];
|
||||
char szBuffer[64];
|
||||
const CBreakPoints::TBreakPoints& rBreakPoints = CBreakPoints::GetBreakPoints();
|
||||
for (size_t i=0; i<rBreakPoints.size(); i++)
|
||||
{
|
||||
@ -75,6 +75,38 @@ CBreakPointView::Update()
|
||||
}
|
||||
}
|
||||
|
||||
const CBreakPoints::TMemChecks& rMemChecks = CBreakPoints::GetMemChecks();
|
||||
for (size_t i=0; i<rMemChecks.size(); i++)
|
||||
{
|
||||
const TMemCheck& rMemCheck = rMemChecks[i];
|
||||
|
||||
wxString temp;
|
||||
temp = wxString::FromAscii(rMemCheck.Break ? "on" : " ");
|
||||
int Item = InsertItem(0, temp);
|
||||
temp = wxString::FromAscii("MC");
|
||||
SetItem(Item, 1, temp);
|
||||
|
||||
Debugger::XSymbolIndex index = Debugger::FindSymbol(rMemCheck.StartAddress);
|
||||
if (index > 0)
|
||||
{
|
||||
temp = wxString::FromAscii(Debugger::GetDescription(rMemCheck.StartAddress));
|
||||
SetItem(Item, 2, temp);
|
||||
}
|
||||
|
||||
sprintf(szBuffer, "0x%08x to 0%08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
|
||||
temp = wxString::FromAscii(szBuffer);
|
||||
SetItem(Item, 3, temp);
|
||||
|
||||
size_t c = 0;
|
||||
if (rMemCheck.OnRead) szBuffer[c++] = 'r';
|
||||
if (rMemCheck.OnWrite) szBuffer[c++] = 'w';
|
||||
szBuffer[c] = 0x00;
|
||||
temp = wxString::FromAscii(szBuffer);
|
||||
SetItem(Item, 4, temp);
|
||||
|
||||
SetItemData(Item, rMemCheck.StartAddress);
|
||||
}
|
||||
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
@ -16,10 +16,15 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "MemoryCheckDlg.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "Debugger.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Debugger/Debugger_BreakPoints.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(MemoryCheckDlg,wxDialog)
|
||||
EVT_CLOSE(MemoryCheckDlg::OnClose)
|
||||
EVT_BUTTON(ID_OK, MemoryCheckDlg::OnOK)
|
||||
EVT_BUTTON(ID_CANCEL, MemoryCheckDlg::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
@ -54,18 +59,18 @@ void MemoryCheckDlg::CreateGUIControls()
|
||||
wxStaticBox* WxStaticBox2 = new wxStaticBox(this, ID_WXSTATICBOX2, wxT("Break On"), wxPoint(328,0), wxSize(73,57));
|
||||
WxStaticBox2->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
m_pEditEndAddress = new wxTextCtrl(this, ID_EDIT_END_ADDRESS, wxT("EndAddr"), wxPoint(200,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit2"));
|
||||
m_pEditEndAddress->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
wxStaticText* WxStaticText2 = new wxStaticText(this, ID_WXSTATICTEXT2, wxT("End"), wxPoint(168,24), wxDefaultSize, 0, wxT("WxStaticText2"));
|
||||
WxStaticText2->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
wxStaticText* WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, wxT("Start"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1"));
|
||||
WxStaticText1->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
m_pEditStartAddress = new wxTextCtrl(this, ID_EDIT_START_ADDR, wxT("StartAddr"), wxPoint(40,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit1"));
|
||||
m_pEditStartAddress = new wxTextCtrl(this, ID_EDIT_START_ADDR, wxT("80000000"), wxPoint(40,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit1"));
|
||||
m_pEditStartAddress->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
m_pEditEndAddress = new wxTextCtrl(this, ID_EDIT_END_ADDRESS, wxT("80000000"), wxPoint(200,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit2"));
|
||||
m_pEditEndAddress->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
|
||||
wxStaticBox* WxStaticBox1 = new wxStaticBox(this, ID_WXSTATICBOX1, wxT("Address Range"), wxPoint(0,0), wxSize(321,57));
|
||||
WxStaticBox1->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
|
||||
}
|
||||
@ -74,3 +79,33 @@ void MemoryCheckDlg::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/)
|
||||
{
|
||||
wxString StartAddressString = m_pEditStartAddress->GetLineText(0);
|
||||
wxString EndAddressString = m_pEditEndAddress->GetLineText(0);
|
||||
bool OnRead = m_pReadFlag->GetValue();
|
||||
bool OnWrite = m_pWriteFlag->GetValue();
|
||||
|
||||
u32 StartAddress, EndAddress;
|
||||
if (AsciiToHex(StartAddressString.GetData(), StartAddress) &&
|
||||
AsciiToHex(EndAddressString.GetData(), EndAddress))
|
||||
{
|
||||
TMemCheck MemCheck;
|
||||
MemCheck.StartAddress = StartAddress;
|
||||
MemCheck.EndAddress = EndAddress;
|
||||
MemCheck.OnRead = OnRead;
|
||||
MemCheck.OnWrite = OnWrite;
|
||||
|
||||
MemCheck.Log = true;
|
||||
MemCheck.Break = true;
|
||||
|
||||
CBreakPoints::AddMemoryCheck(MemCheck);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCheckDlg::OnCancel(wxCommandEvent& /*event*/)
|
||||
{
|
||||
Close();
|
||||
}
|
@ -65,6 +65,8 @@ class MemoryCheckDlg : public wxDialog
|
||||
|
||||
private:
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void CreateGUIControls();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user