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
|
|
|
|
2016-12-23 19:18:14 +00:00
|
|
|
#include "DolphinWX/Debugger/BreakpointView.h"
|
|
|
|
|
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/CommonTypes.h"
|
2014-08-04 06:13:59 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2016-12-23 19:18:14 +00:00
|
|
|
#include "Core/PowerPC/BreakPoints.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/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)
|
|
|
|
{
|
2017-01-11 13:27:45 +00:00
|
|
|
if (!rBP.is_temporary)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-01-11 13:27:45 +00:00
|
|
|
wxString breakpoint_enabled_str = StrToWxStr(rBP.is_enabled ? "on" : " ");
|
2016-06-24 08:43:46 +00:00
|
|
|
int item = InsertItem(0, breakpoint_enabled_str);
|
|
|
|
SetItem(item, 1, StrToWxStr("BP"));
|
|
|
|
|
2018-05-27 21:37:52 +00:00
|
|
|
Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rBP.address);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (symbol)
|
|
|
|
{
|
2017-01-11 13:27:45 +00:00
|
|
|
wxString symbol_description = StrToWxStr(g_symbolDB.GetDescription(rBP.address));
|
2016-06-24 08:43:46 +00:00
|
|
|
SetItem(item, 2, symbol_description);
|
|
|
|
}
|
|
|
|
|
2017-01-11 13:27:45 +00:00
|
|
|
std::string address = StringFromFormat("%08x", rBP.address);
|
2016-06-24 08:43:46 +00:00
|
|
|
SetItem(item, 3, StrToWxStr(address));
|
|
|
|
|
2017-01-11 13:27:45 +00:00
|
|
|
SetItemData(item, rBP.address);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
|
|
|
for (const auto& rMemCheck : rMemChecks)
|
|
|
|
{
|
2017-01-11 13:27:45 +00:00
|
|
|
const wxString memcheck_on_str =
|
|
|
|
StrToWxStr((rMemCheck.break_on_hit || rMemCheck.log_on_hit) ? "on" : " ");
|
2016-06-24 08:43:46 +00:00
|
|
|
int item = InsertItem(0, memcheck_on_str);
|
2016-10-06 14:46:09 +00:00
|
|
|
SetItem(item, 1, StrToWxStr("MBP"));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2018-05-27 21:37:52 +00:00
|
|
|
Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.start_address);
|
2016-06-24 08:43:46 +00:00
|
|
|
if (symbol)
|
|
|
|
{
|
2017-01-11 13:27:45 +00:00
|
|
|
wxString memcheck_start_addr = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.start_address));
|
2016-06-24 08:43:46 +00:00
|
|
|
SetItem(item, 2, memcheck_start_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string address_range_str =
|
2017-01-11 13:27:45 +00:00
|
|
|
StringFromFormat("%08x to %08x", rMemCheck.start_address, rMemCheck.end_address);
|
2016-06-24 08:43:46 +00:00
|
|
|
SetItem(item, 3, StrToWxStr(address_range_str));
|
|
|
|
|
|
|
|
std::string mode;
|
2017-01-11 13:27:45 +00:00
|
|
|
if (rMemCheck.is_break_on_read)
|
2016-06-24 08:43:46 +00:00
|
|
|
mode += 'r';
|
2017-01-11 13:27:45 +00:00
|
|
|
if (rMemCheck.is_break_on_write)
|
2016-06-24 08:43:46 +00:00
|
|
|
mode += 'w';
|
|
|
|
|
|
|
|
SetItem(item, 4, StrToWxStr(mode));
|
|
|
|
|
2017-01-11 13:27:45 +00:00
|
|
|
SetItemData(item, rMemCheck.start_address);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|