mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-31 10:01:26 +02: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:
parent
185a214329
commit
dc717f7283
@ -22,7 +22,7 @@
|
||||
#include "TestFramework.h"
|
||||
|
||||
// faster than sscanf
|
||||
u32 AsciiToHex(const char* _szValue)
|
||||
bool AsciiToHex(const char* _szValue, u32& result)
|
||||
{
|
||||
u32 value = 0;
|
||||
size_t finish = strlen(_szValue);
|
||||
@ -126,12 +126,13 @@ u32 AsciiToHex(const char* _szValue)
|
||||
break;
|
||||
|
||||
default:
|
||||
value >>= 4;
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(value);
|
||||
result = value;
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ bool TryParseUInt(const std::string& str, u32* output);
|
||||
|
||||
|
||||
// TODO: kill this
|
||||
u32 AsciiToHex(const char* ascii);
|
||||
bool AsciiToHex(const char* _szValue, u32& result);
|
||||
|
||||
void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output);
|
||||
int ChooseStringFrom(const char* str, const char* * items);
|
||||
|
@ -45,14 +45,14 @@ TMemCheck::TMemCheck()
|
||||
|
||||
void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc)
|
||||
{
|
||||
if ((write && bOnWrite) || (!write && bOnRead))
|
||||
if ((write && OnWrite) || (!write && OnRead))
|
||||
{
|
||||
if (bLog)
|
||||
if (Log)
|
||||
{
|
||||
const char *copy = Debugger::GetDescription(addr);
|
||||
LOG(MEMMAP,"CHK %08x %s%i at %08x (%s)", iValue, write ? "Write" : "Read", size*8, addr, copy);
|
||||
}
|
||||
if (bBreak)
|
||||
if (Break)
|
||||
CCPU::Break();
|
||||
}
|
||||
}
|
||||
@ -86,12 +86,12 @@ TMemCheck *CBreakPoints::GetMemCheck(u32 address)
|
||||
{
|
||||
if ((*iter).bRange)
|
||||
{
|
||||
if (address >= (*iter).iStartAddress && address <= (*iter).iEndAddress)
|
||||
if (address >= (*iter).StartAddress && address <= (*iter).EndAddress)
|
||||
return &(*iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*iter).iStartAddress==address)
|
||||
if ((*iter).StartAddress==address)
|
||||
return &(*iter);
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ void CBreakPoints::DeleteElementByAddress(u32 _Address)
|
||||
std::vector<TMemCheck>::iterator iter;
|
||||
for (iter = m_MemChecks.begin(); iter != m_MemChecks.end(); ++iter)
|
||||
{
|
||||
if ((*iter).iStartAddress == _Address)
|
||||
if ((*iter).StartAddress == _Address)
|
||||
{
|
||||
m_MemChecks.erase(iter);
|
||||
Host_UpdateBreakPointView();
|
||||
|
@ -33,18 +33,18 @@ struct TBreakPoint
|
||||
struct TMemCheck
|
||||
{
|
||||
TMemCheck();
|
||||
u32 iStartAddress;
|
||||
u32 iEndAddress;
|
||||
u32 StartAddress;
|
||||
u32 EndAddress;
|
||||
|
||||
bool bRange;
|
||||
|
||||
bool bOnRead;
|
||||
bool bOnWrite;
|
||||
bool OnRead;
|
||||
bool OnWrite;
|
||||
|
||||
bool bLog;
|
||||
bool bBreak;
|
||||
bool Log;
|
||||
bool Break;
|
||||
|
||||
u32 numHits;
|
||||
u32 numHits;
|
||||
|
||||
void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc);
|
||||
};
|
||||
|
@ -357,6 +357,9 @@ void AnalyzeBackwards()
|
||||
|
||||
bool GetCallstack(std::vector<SCallstackEntry> &output)
|
||||
{
|
||||
if (!Memory::IsInitialized())
|
||||
return false;
|
||||
|
||||
if (!Memory::IsRAMAddress(PowerPC::ppcState.gpr[1]))
|
||||
return false;
|
||||
|
||||
|
@ -65,6 +65,7 @@ u8* m_pFakeVMEM = NULL;
|
||||
u8* m_pEXRAM = NULL; //wii
|
||||
u8* m_pEFB = NULL;
|
||||
u8* m_pL1Cache = NULL;
|
||||
bool m_IsInitialized = false;
|
||||
|
||||
MemArena g_arena;
|
||||
|
||||
@ -407,6 +408,12 @@ writeFn32 GetHWWriteFun32(const u32 _Address)
|
||||
}
|
||||
|
||||
|
||||
bool IsInitialized()
|
||||
{
|
||||
return m_IsInitialized;
|
||||
}
|
||||
|
||||
|
||||
bool Init()
|
||||
{
|
||||
bool wii = Core::GetStartupParameter().bWii;
|
||||
@ -509,12 +516,16 @@ bool Init()
|
||||
InitHWMemFuncsWii();
|
||||
else
|
||||
InitHWMemFuncs();
|
||||
|
||||
m_IsInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Shutdown()
|
||||
{
|
||||
m_IsInitialized = false;
|
||||
|
||||
bool wii = Core::GetStartupParameter().bWii;
|
||||
|
||||
g_arena.ReleaseView(m_pRAM, RAM_SIZE);
|
||||
|
@ -60,6 +60,7 @@ namespace Memory
|
||||
#endif
|
||||
};
|
||||
|
||||
bool IsInitialized();
|
||||
bool Init();
|
||||
bool Shutdown();
|
||||
void Clear();
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user