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
|
|
|
|
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/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-08-04 06:13:59 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Debugger/BreakpointView.h"
|
|
|
|
#include "DolphinWX/Debugger/DebuggerUIUtil.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();
|
|
|
|
|
2014-05-17 17:17:28 +00:00
|
|
|
InsertColumn(0, _("Active"));
|
|
|
|
InsertColumn(1, _("Type"));
|
|
|
|
InsertColumn(2, _("Function"));
|
|
|
|
InsertColumn(3, _("Address"));
|
|
|
|
InsertColumn(4, _("Flags"));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-06-28 11:47:39 +00:00
|
|
|
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
|
2013-10-29 05:09:01 +00:00
|
|
|
for (const auto& rBP : rBreakPoints)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
|
|
|
if (!rBP.bTemporary)
|
|
|
|
{
|
2014-08-04 06:13:59 +00:00
|
|
|
wxString breakpoint_enabled_str = StrToWxStr(rBP.bOn ? "on" : " ");
|
2014-08-15 13:51:29 +00:00
|
|
|
int item = InsertItem(0, breakpoint_enabled_str);
|
|
|
|
SetItem(item, 1, StrToWxStr("BP"));
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
2014-08-04 06:13:59 +00:00
|
|
|
wxString symbol_description = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress));
|
2014-08-15 13:51:29 +00:00
|
|
|
SetItem(item, 2, symbol_description);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2014-08-04 06:13:59 +00:00
|
|
|
std::string address = StringFromFormat("%08x", rBP.iAddress);
|
2014-08-15 13:51:29 +00:00
|
|
|
SetItem(item, 3, StrToWxStr(address));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-08-15 13:51:29 +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();
|
2013-10-29 05:09:01 +00:00
|
|
|
for (const auto& rMemCheck : rMemChecks)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2014-08-04 06:13:59 +00:00
|
|
|
wxString memcheck_on_str = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " ");
|
2014-08-15 13:51:29 +00:00
|
|
|
int item = InsertItem(0, memcheck_on_str);
|
|
|
|
SetItem(item, 1, StrToWxStr("MC"));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
2014-08-04 06:13:59 +00:00
|
|
|
wxString memcheck_start_addr = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress));
|
2014-08-15 13:51:29 +00:00
|
|
|
SetItem(item, 2, memcheck_start_addr);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2014-08-04 06:13:59 +00:00
|
|
|
std::string address_range_str = StringFromFormat("%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
|
2014-08-15 13:51:29 +00:00
|
|
|
SetItem(item, 3, StrToWxStr(address_range_str));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-08-04 06:13:59 +00:00
|
|
|
std::string mode;
|
|
|
|
if (rMemCheck.OnRead)
|
|
|
|
mode += 'r';
|
|
|
|
if (rMemCheck.OnWrite)
|
|
|
|
mode += 'w';
|
|
|
|
|
2014-08-15 13:51:29 +00:00
|
|
|
SetItem(item, 4, StrToWxStr(mode));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-08-15 13:51:29 +00:00
|
|
|
SetItemData(item, rMemCheck.StartAddress);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::DeleteCurrentSelection()
|
|
|
|
{
|
2014-08-15 13:51:29 +00:00
|
|
|
int item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (item >= 0)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2014-08-15 13:51:29 +00:00
|
|
|
u32 Address = (u32)GetItemData(item);
|
2013-04-08 05:16:50 +00:00
|
|
|
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
|
|
|
}
|