2013-04-17 21:43:35 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdio>
|
2010-12-05 08:36:08 -07:00
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <wx/chartype.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/listbase.h>
|
|
|
|
#include <wx/listctrl.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/windowid.h>
|
|
|
|
|
|
|
|
#include "Common/BreakPoints.h"
|
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/Debugger/BreakpointView.h"
|
|
|
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
class wxWindow;
|
|
|
|
struct Symbol;
|
|
|
|
|
2011-02-27 16:03:08 -07: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-07 22:30:24 -07:00
|
|
|
{
|
2009-02-06 11:18:20 -07:00
|
|
|
SetFont(DebuggerFont);
|
2008-12-07 22:30:24 -07:00
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::Update()
|
|
|
|
{
|
|
|
|
ClearAll();
|
|
|
|
|
2014-05-17 11:17:28 -06:00
|
|
|
InsertColumn(0, _("Active"));
|
|
|
|
InsertColumn(1, _("Type"));
|
|
|
|
InsertColumn(2, _("Function"));
|
|
|
|
InsertColumn(3, _("Address"));
|
|
|
|
InsertColumn(4, _("Flags"));
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2013-04-07 23:16:50 -06:00
|
|
|
char szBuffer[64];
|
2009-06-28 05:47:39 -06:00
|
|
|
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
|
2013-10-28 23:09:01 -06:00
|
|
|
for (const auto& rBP : rBreakPoints)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
if (!rBP.bTemporary)
|
|
|
|
{
|
|
|
|
wxString temp;
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr(rBP.bOn ? "on" : " ");
|
2008-12-07 22:30:24 -07:00
|
|
|
int Item = InsertItem(0, temp);
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr("BP");
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItem(Item, 1, temp);
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress));
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItem(Item, 2, temp);
|
|
|
|
}
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2013-04-07 23:16:50 -06:00
|
|
|
sprintf(szBuffer, "%08x", rBP.iAddress);
|
|
|
|
temp = StrToWxStr(szBuffer);
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItem(Item, 3, temp);
|
|
|
|
|
2013-04-07 23:16:50 -06:00
|
|
|
SetItemData(Item, rBP.iAddress);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-28 05:47:39 -06:00
|
|
|
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
2013-10-28 23:09:01 -06:00
|
|
|
for (const auto& rMemCheck : rMemChecks)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
|
|
|
wxString temp;
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " ");
|
2008-12-07 22:30:24 -07:00
|
|
|
int Item = InsertItem(0, temp);
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr("MC");
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItem(Item, 1, temp);
|
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress));
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItem(Item, 2, temp);
|
|
|
|
}
|
|
|
|
|
2011-02-25 04:03:49 -07:00
|
|
|
sprintf(szBuffer, "%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
|
2013-02-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr(szBuffer);
|
2008-12-07 22:30:24 -07: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-27 21:37:38 -07:00
|
|
|
temp = StrToWxStr(szBuffer);
|
2008-12-07 22:30:24 -07:00
|
|
|
SetItem(Item, 4, temp);
|
|
|
|
|
|
|
|
SetItemData(Item, rMemCheck.StartAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::DeleteCurrentSelection()
|
|
|
|
{
|
2013-04-07 23:16:50 -06: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 07:00:33 -07:00
|
|
|
Update();
|
2013-04-07 23:16:50 -06:00
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|