2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:43:35 +00:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdio>
|
2010-12-05 15:36:08 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/listctrl.h>
|
|
|
|
|
|
|
|
#include "Common/BreakPoints.h"
|
|
|
|
#include "Common/CommonTypes.h"
|
2014-08-04 06:13:59 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Debugger/BreakpointView.h"
|
|
|
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "DolphinWX/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)
|
2016-06-24 08:43:46 +00:00
|
|
|
: 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
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
SetFont(DebuggerFont);
|
|
|
|
Refresh();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 07:29:50 +00:00
|
|
|
void CBreakPointView::Repopulate()
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
ClearAll();
|
|
|
|
|
|
|
|
InsertColumn(0, _("Active"));
|
|
|
|
InsertColumn(1, _("Type"));
|
|
|
|
InsertColumn(2, _("Function"));
|
|
|
|
InsertColumn(3, _("Address"));
|
|
|
|
InsertColumn(4, _("Flags"));
|
|
|
|
|
|
|
|
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
|
|
|
|
for (const auto& rBP : rBreakPoints)
|
|
|
|
{
|
|
|
|
if (!rBP.bTemporary)
|
|
|
|
{
|
|
|
|
wxString breakpoint_enabled_str = StrToWxStr(rBP.bOn ? "on" : " ");
|
|
|
|
int item = InsertItem(0, breakpoint_enabled_str);
|
|
|
|
SetItem(item, 1, StrToWxStr("BP"));
|
|
|
|
|
|
|
|
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
|
|
|
wxString symbol_description = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress));
|
|
|
|
SetItem(item, 2, symbol_description);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string address = StringFromFormat("%08x", rBP.iAddress);
|
|
|
|
SetItem(item, 3, StrToWxStr(address));
|
|
|
|
|
|
|
|
SetItemData(item, rBP.iAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
|
|
|
for (const auto& rMemCheck : rMemChecks)
|
|
|
|
{
|
|
|
|
wxString memcheck_on_str = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " ");
|
|
|
|
int item = InsertItem(0, memcheck_on_str);
|
|
|
|
SetItem(item, 1, StrToWxStr("MC"));
|
|
|
|
|
|
|
|
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
|
|
|
wxString memcheck_start_addr = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress));
|
|
|
|
SetItem(item, 2, memcheck_start_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string address_range_str =
|
|
|
|
StringFromFormat("%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
|
|
|
|
SetItem(item, 3, StrToWxStr(address_range_str));
|
|
|
|
|
|
|
|
std::string mode;
|
|
|
|
if (rMemCheck.OnRead)
|
|
|
|
mode += 'r';
|
|
|
|
if (rMemCheck.OnWrite)
|
|
|
|
mode += 'w';
|
|
|
|
|
|
|
|
SetItem(item, 4, StrToWxStr(mode));
|
|
|
|
|
|
|
|
SetItemData(item, rMemCheck.StartAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
Refresh();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::DeleteCurrentSelection()
|
|
|
|
{
|
2016-06-24 08:43:46 +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);
|
2016-10-03 07:29:50 +00:00
|
|
|
Repopulate();
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|