2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:43:35 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2016-12-23 12:18:14 -07:00
|
|
|
#include "DolphinWX/Debugger/BreakpointView.h"
|
|
|
|
|
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/listctrl.h>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
2014-08-04 00:13:59 -06:00
|
|
|
#include "Common/StringUtil.h"
|
2016-12-23 12:18:14 -07:00
|
|
|
#include "Core/PowerPC/BreakPoints.h"
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
2016-06-24 02:43:46 -06:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
2016-06-24 02:43:46 -06:00
|
|
|
#include "DolphinWX/WxUtils.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2011-02-27 16:03:08 -07:00
|
|
|
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id)
|
2016-06-24 02:43:46 -06:00
|
|
|
: 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
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
SetFont(DebuggerFont);
|
|
|
|
Refresh();
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2016-10-03 01:29:50 -06:00
|
|
|
void CBreakPointView::Repopulate()
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06: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 06:27:45 -07:00
|
|
|
if (!rBP.is_temporary)
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
2017-01-11 06:27:45 -07:00
|
|
|
wxString breakpoint_enabled_str = StrToWxStr(rBP.is_enabled ? "on" : " ");
|
2016-06-24 02:43:46 -06:00
|
|
|
int item = InsertItem(0, breakpoint_enabled_str);
|
|
|
|
SetItem(item, 1, StrToWxStr("BP"));
|
|
|
|
|
2017-01-11 06:27:45 -07:00
|
|
|
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rBP.address);
|
2016-06-24 02:43:46 -06:00
|
|
|
if (symbol)
|
|
|
|
{
|
2017-01-11 06:27:45 -07:00
|
|
|
wxString symbol_description = StrToWxStr(g_symbolDB.GetDescription(rBP.address));
|
2016-06-24 02:43:46 -06:00
|
|
|
SetItem(item, 2, symbol_description);
|
|
|
|
}
|
|
|
|
|
2017-01-11 06:27:45 -07:00
|
|
|
std::string address = StringFromFormat("%08x", rBP.address);
|
2016-06-24 02:43:46 -06:00
|
|
|
SetItem(item, 3, StrToWxStr(address));
|
|
|
|
|
2017-01-11 06:27:45 -07:00
|
|
|
SetItemData(item, rBP.address);
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
|
|
|
for (const auto& rMemCheck : rMemChecks)
|
|
|
|
{
|
2017-01-11 06:27:45 -07:00
|
|
|
const wxString memcheck_on_str =
|
|
|
|
StrToWxStr((rMemCheck.break_on_hit || rMemCheck.log_on_hit) ? "on" : " ");
|
2016-06-24 02:43:46 -06:00
|
|
|
int item = InsertItem(0, memcheck_on_str);
|
2016-10-06 08:46:09 -06:00
|
|
|
SetItem(item, 1, StrToWxStr("MBP"));
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2017-01-11 06:27:45 -07:00
|
|
|
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.start_address);
|
2016-06-24 02:43:46 -06:00
|
|
|
if (symbol)
|
|
|
|
{
|
2017-01-11 06:27:45 -07:00
|
|
|
wxString memcheck_start_addr = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.start_address));
|
2016-06-24 02:43:46 -06:00
|
|
|
SetItem(item, 2, memcheck_start_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string address_range_str =
|
2017-01-11 06:27:45 -07:00
|
|
|
StringFromFormat("%08x to %08x", rMemCheck.start_address, rMemCheck.end_address);
|
2016-06-24 02:43:46 -06:00
|
|
|
SetItem(item, 3, StrToWxStr(address_range_str));
|
|
|
|
|
|
|
|
std::string mode;
|
2017-01-11 06:27:45 -07:00
|
|
|
if (rMemCheck.is_break_on_read)
|
2016-06-24 02:43:46 -06:00
|
|
|
mode += 'r';
|
2017-01-11 06:27:45 -07:00
|
|
|
if (rMemCheck.is_break_on_write)
|
2016-06-24 02:43:46 -06:00
|
|
|
mode += 'w';
|
|
|
|
|
|
|
|
SetItem(item, 4, StrToWxStr(mode));
|
|
|
|
|
2017-01-11 06:27:45 -07:00
|
|
|
SetItemData(item, rMemCheck.start_address);
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
Refresh();
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::DeleteCurrentSelection()
|
|
|
|
{
|
2016-06-24 02:43:46 -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);
|
2016-10-03 01:29:50 -06:00
|
|
|
Repopulate();
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|