2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2010-12-05 15:36:08 +00:00
|
|
|
#include <wx/wx.h>
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
#include "BreakpointView.h"
|
2010-12-05 15:28:31 +00:00
|
|
|
#include "DebuggerUIUtil.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
#include "Debugger/Debugger_SymbolMap.h"
|
2009-06-21 08:39:21 +00:00
|
|
|
#include "PowerPC/PPCSymbolDB.h"
|
2009-06-28 11:47:39 +00:00
|
|
|
#include "PowerPC/PowerPC.h"
|
2009-09-27 21:28:09 +00:00
|
|
|
#include "HW/Memmap.h"
|
2013-02-28 04:37:38 +00:00
|
|
|
#include "../WxUtils.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2011-02-27 23:03:08 +00:00
|
|
|
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id)
|
|
|
|
: wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-02-06 18:18:20 +00:00
|
|
|
SetFont(DebuggerFont);
|
2008-12-08 05:30:24 +00:00
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::Update()
|
|
|
|
{
|
|
|
|
ClearAll();
|
|
|
|
|
2011-02-27 23:03:08 +00:00
|
|
|
InsertColumn(0, wxT("Active"));
|
|
|
|
InsertColumn(1, wxT("Type"));
|
|
|
|
InsertColumn(2, wxT("Function"));
|
2013-04-08 05:16:50 +00:00
|
|
|
InsertColumn(3, wxT("Address"));
|
|
|
|
InsertColumn(4, wxT("Flags"));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
char szBuffer[64];
|
2009-06-28 11:47:39 +00:00
|
|
|
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
|
2008-12-08 05:30:24 +00:00
|
|
|
for (size_t i = 0; i < rBreakPoints.size(); i++)
|
|
|
|
{
|
|
|
|
const TBreakPoint& rBP = rBreakPoints[i];
|
|
|
|
if (!rBP.bTemporary)
|
|
|
|
{
|
|
|
|
wxString temp;
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr(rBP.bOn ? "on" : " ");
|
2008-12-08 05:30:24 +00:00
|
|
|
int Item = InsertItem(0, temp);
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr("BP");
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 1, temp);
|
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress));
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 2, temp);
|
|
|
|
}
|
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
sprintf(szBuffer, "%08x", rBP.iAddress);
|
|
|
|
temp = StrToWxStr(szBuffer);
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 3, temp);
|
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
SetItemData(Item, rBP.iAddress);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-28 11:47:39 +00:00
|
|
|
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
2008-12-08 05:30:24 +00:00
|
|
|
for (size_t i = 0; i < rMemChecks.size(); i++)
|
|
|
|
{
|
|
|
|
const TMemCheck& rMemCheck = rMemChecks[i];
|
|
|
|
|
|
|
|
wxString temp;
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " ");
|
2008-12-08 05:30:24 +00:00
|
|
|
int Item = InsertItem(0, temp);
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr("MC");
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 1, temp);
|
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress));
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 2, temp);
|
|
|
|
}
|
|
|
|
|
2011-02-25 11:03:49 +00:00
|
|
|
sprintf(szBuffer, "%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr(szBuffer);
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 3, temp);
|
|
|
|
|
|
|
|
size_t c = 0;
|
|
|
|
if (rMemCheck.OnRead) szBuffer[c++] = 'r';
|
|
|
|
if (rMemCheck.OnWrite) szBuffer[c++] = 'w';
|
|
|
|
szBuffer[c] = 0x00;
|
2013-02-28 04:37:38 +00:00
|
|
|
temp = StrToWxStr(szBuffer);
|
2008-12-08 05:30:24 +00:00
|
|
|
SetItem(Item, 4, temp);
|
|
|
|
|
|
|
|
SetItemData(Item, rMemCheck.StartAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::DeleteCurrentSelection()
|
|
|
|
{
|
2013-04-08 05:16:50 +00:00
|
|
|
int Item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (Item >= 0)
|
|
|
|
{
|
|
|
|
u32 Address = (u32)GetItemData(Item);
|
|
|
|
PowerPC::breakpoints.Remove(Address);
|
|
|
|
PowerPC::memchecks.Remove(Address);
|
2008-12-20 14:00:33 +00:00
|
|
|
Update();
|
2013-04-08 05:16:50 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|