Added option to load breakpoints and memory checks from a file.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@905 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d75bf5ab97
commit
7804c2c026
|
@ -25,10 +25,8 @@
|
|||
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include "../HW/CPU.h"
|
||||
#include "../Host.h"
|
||||
|
||||
#include "../PowerPC/SymbolDB.h"
|
||||
#include "Debugger_BreakPoints.h"
|
||||
|
||||
|
@ -48,8 +46,10 @@ void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc)
|
|||
if (Log)
|
||||
{
|
||||
LOG(MEMMAP,"CHK %08x %s%i at %08x (%s)",
|
||||
iValue, write ? "Write" : "Read", size*8, addr,
|
||||
g_symbolDB.GetDescription(addr));
|
||||
iValue, write ? "Write" : "Read", // read or write
|
||||
size*8, addr, // address
|
||||
g_symbolDB.GetDescription(addr) // symbol map description
|
||||
);
|
||||
}
|
||||
if (Break)
|
||||
CCPU::Break();
|
||||
|
@ -101,16 +101,14 @@ TMemCheck *CBreakPoints::GetMemCheck(u32 address)
|
|||
|
||||
void CBreakPoints::AddBreakPoint(u32 _iAddress, bool temp)
|
||||
{
|
||||
if (!IsAddressBreakPoint(_iAddress))
|
||||
if (!IsAddressBreakPoint(_iAddress)) // only add new addresses
|
||||
{
|
||||
TBreakPoint pt;
|
||||
TBreakPoint pt; // breakpoint settings
|
||||
pt.bOn = true;
|
||||
pt.bTemporary = temp;
|
||||
pt.iAddress = _iAddress;
|
||||
|
||||
m_BreakPoints.push_back(pt);
|
||||
|
||||
Host_UpdateBreakPointView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,13 +131,19 @@ void CBreakPoints::RemoveBreakPoint(u32 _iAddress)
|
|||
void CBreakPoints::ClearAllBreakPoints()
|
||||
{
|
||||
m_BreakPoints.clear();
|
||||
m_MemChecks.clear();
|
||||
Host_UpdateBreakPointView();
|
||||
}
|
||||
|
||||
// update breakpoint window
|
||||
void CBreakPoints::UpdateBreakPointView()
|
||||
{
|
||||
Host_UpdateBreakPointView();
|
||||
}
|
||||
|
||||
void CBreakPoints::AddMemoryCheck(const TMemCheck& _rMemoryCheck)
|
||||
{
|
||||
m_MemChecks.push_back(_rMemoryCheck);
|
||||
Host_UpdateBreakPointView();
|
||||
}
|
||||
|
||||
void CBreakPoints::AddAutoBreakpoints()
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
static void AddMemoryCheck(const TMemCheck& _rMemoryCheck);
|
||||
|
||||
static void ClearAllBreakPoints();
|
||||
static void UpdateBreakPointView();
|
||||
|
||||
static void AddAutoBreakpoints();
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
|
|||
if (AsciiToHex(AddressString.mb_str(), Address))
|
||||
{
|
||||
CBreakPoints::AddBreakPoint(Address);
|
||||
Close();
|
||||
CBreakPoints::UpdateBreakPointView();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "BreakPointDlg.h"
|
||||
#include "MemoryCheckDlg.h"
|
||||
#include "IniFile.h"
|
||||
#include "Debugger/Debugger_BreakPoints.h" // for TMemCheck
|
||||
|
||||
#include <wx/mstream.h>
|
||||
|
||||
|
@ -37,8 +38,11 @@ static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
|
|||
BEGIN_EVENT_TABLE(CBreakPointWindow, wxFrame)
|
||||
EVT_CLOSE(CBreakPointWindow::OnClose)
|
||||
EVT_MENU(IDM_DELETE, CBreakPointWindow::OnDelete)
|
||||
EVT_MENU(IDM_CLEAR, CBreakPointWindow::OnClear)
|
||||
EVT_MENU(IDM_ADD_BREAKPOINT, CBreakPointWindow::OnAddBreakPoint)
|
||||
EVT_MENU(IDM_ADD_BREAKPOINTMANY, CBreakPointWindow::OnAddBreakPointMany)
|
||||
EVT_MENU(IDM_ADD_MEMORYCHECK, CBreakPointWindow::OnAddMemoryCheck)
|
||||
EVT_MENU(IDM_ADD_MEMORYCHECKMANY, CBreakPointWindow::OnAddMemoryCheckMany)
|
||||
EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -115,13 +119,18 @@ CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
|
|||
|
||||
toolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
toolBar->AddTool(IDM_DELETE, _T("Delete"), m_Bitmaps[Toolbar_Delete], _T("Delete the selected BreakPoint or MemoryCheck"));
|
||||
toolBar->AddTool(IDM_CLEAR, _T("Clear all"), m_Bitmaps[Toolbar_Delete], _T("Clear all BreakPoints and MemoryChecks"));
|
||||
|
||||
toolBar->AddSeparator();
|
||||
|
||||
toolBar->AddTool(IDM_ADD_BREAKPOINT, _T("BP"), m_Bitmaps[Toolbar_Add_BreakPoint], _T("Add BreakPoint..."));
|
||||
toolBar->AddTool(IDM_ADD_BREAKPOINTMANY, _T("BPs"), m_Bitmaps[Toolbar_Add_BreakPoint], _T("Add BreakPoints..."));
|
||||
|
||||
// just add memory breakpoints if you can use them
|
||||
if (Memory::AreMemoryBreakpointsActivated())
|
||||
{
|
||||
toolBar->AddTool(IDM_ADD_MEMORYCHECK, _T("MC"), m_Bitmaps[Toolbar_Add_Memcheck], _T("Add MemoryCheck..."));
|
||||
toolBar->AddTool(IDM_ADD_MEMORYCHECKMANY, _T("MCs"), m_Bitmaps[Toolbar_Add_Memcheck], _T("Add MemoryChecks..."));
|
||||
}
|
||||
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect
|
||||
|
@ -190,6 +199,17 @@ CBreakPointWindow::OnDelete(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
|
||||
// ==========================================================================================
|
||||
// Clear all breakpoints
|
||||
// ------------
|
||||
void
|
||||
CBreakPointWindow::OnClear(wxCommandEvent& event)
|
||||
{
|
||||
CBreakPoints::ClearAllBreakPoints();
|
||||
}
|
||||
// ============
|
||||
|
||||
|
||||
void
|
||||
CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
|
||||
{
|
||||
|
@ -198,6 +218,47 @@ CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
|
||||
// ==========================================================================================
|
||||
// Load breakpoints from file
|
||||
// --------------
|
||||
void
|
||||
CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
|
||||
{
|
||||
// load ini
|
||||
IniFile ini;
|
||||
std::string filename = std::string("GameIni/BreakPoints.ini");
|
||||
|
||||
if (ini.Load(filename.c_str())) // check if there is any file there
|
||||
{
|
||||
// get lines from a certain section
|
||||
std::vector<std::string> lines;
|
||||
if (!ini.GetLines("BreakPoints", lines))
|
||||
{
|
||||
wxMessageBox(_T("You have no [BreakPoints] line in your file"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
{
|
||||
std::string line = StripSpaces(*iter);
|
||||
u32 Address = 0;
|
||||
if (AsciiToHex(line.c_str(), Address))
|
||||
{
|
||||
CBreakPoints::AddBreakPoint(Address);
|
||||
}
|
||||
}
|
||||
// only update after we are done with the loop
|
||||
CBreakPoints::UpdateBreakPointView();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("You have no GameIni/BreakPoints.ini file"));
|
||||
}
|
||||
|
||||
}
|
||||
// =================
|
||||
|
||||
|
||||
void
|
||||
CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
|
||||
{
|
||||
|
@ -206,6 +267,55 @@ CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
|
|||
}
|
||||
|
||||
|
||||
// ==========================================================================================
|
||||
// Load memory checks from file
|
||||
// --------------
|
||||
void
|
||||
CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
|
||||
{
|
||||
// load ini
|
||||
IniFile ini;
|
||||
std::string filename = std::string("GameIni/MemoryChecks.ini");
|
||||
|
||||
if (ini.Load(filename.c_str()))
|
||||
{
|
||||
// get lines from a certain section
|
||||
std::vector<std::string> lines;
|
||||
if (!ini.GetLines("MemoryChecks", lines))
|
||||
{
|
||||
wxMessageBox(_T("You have no [MemoryChecks] line in your file"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
{
|
||||
std::string line = StripSpaces(*iter);
|
||||
u32 Address = 0;
|
||||
if (AsciiToHex(line.c_str(), Address))
|
||||
{
|
||||
// settting for the memory check
|
||||
TMemCheck MemCheck;
|
||||
MemCheck.StartAddress = Address;
|
||||
MemCheck.EndAddress = Address;
|
||||
MemCheck.OnRead = true;
|
||||
MemCheck.OnWrite = true;
|
||||
MemCheck.Log = true;
|
||||
MemCheck.Break = false; // this is also what sets Active "on" in the breakpoint window
|
||||
// so don't think it's off because we are only writing this to the log
|
||||
CBreakPoints::AddMemoryCheck(MemCheck);
|
||||
}
|
||||
}
|
||||
// update after we are done with the loop
|
||||
CBreakPoints::UpdateBreakPointView();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("You have no GameIni/MemoryChecks.ini file"));
|
||||
}
|
||||
}
|
||||
// =================
|
||||
|
||||
|
||||
void
|
||||
CBreakPointWindow::OnActivated(wxListEvent& event)
|
||||
{
|
||||
|
|
|
@ -54,8 +54,11 @@ class CBreakPointWindow
|
|||
ID_TOOLBAR = 500,
|
||||
ID_BPS = 1002,
|
||||
IDM_DELETE,
|
||||
IDM_CLEAR,
|
||||
IDM_ADD_BREAKPOINT,
|
||||
IDM_ADD_MEMORYCHECK
|
||||
IDM_ADD_BREAKPOINTMANY,
|
||||
IDM_ADD_MEMORYCHECK,
|
||||
IDM_ADD_MEMORYCHECKMANY
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -79,8 +82,11 @@ class CBreakPointWindow
|
|||
void InitBitmaps();
|
||||
|
||||
void OnDelete(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void OnAddBreakPoint(wxCommandEvent& event);
|
||||
void OnAddBreakPointMany(wxCommandEvent& event);
|
||||
void OnAddMemoryCheck(wxCommandEvent& event);
|
||||
void OnAddMemoryCheckMany(wxCommandEvent& event);
|
||||
void OnActivated(wxListEvent& event);
|
||||
};
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/)
|
|||
MemCheck.Break = true;
|
||||
|
||||
CBreakPoints::AddMemoryCheck(MemCheck);
|
||||
CBreakPoints::UpdateBreakPointView();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue