2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2010-12-05 15:36:08 +00:00
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <wx/mstream.h>
|
|
|
|
#include <wx/imaglist.h>
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
#include "BreakpointView.h"
|
2010-12-05 15:28:31 +00:00
|
|
|
#include "DebuggerUIUtil.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
#include "Debugger/Debugger_SymbolMap.h"
|
2009-06-21 08:39:21 +00:00
|
|
|
#include "PowerPC/PPCSymbolDB.h"
|
2009-06-28 11:47:39 +00:00
|
|
|
#include "PowerPC/PowerPC.h"
|
2009-09-27 21:28:09 +00:00
|
|
|
#include "HW/Memmap.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-09-27 21:28:09 +00:00
|
|
|
extern "C" {
|
2011-02-13 06:06:32 +00:00
|
|
|
#include "../../resources/toolbar_add_breakpoint.c"
|
|
|
|
#include "../../resources/toolbar_add_memorycheck.c"
|
|
|
|
#include "../../resources/toolbar_debugger_delete.c"
|
2009-09-27 21:28:09 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
|
|
|
: wxListCtrl(parent, id, pos, size, style)
|
|
|
|
{
|
2009-02-06 18:18:20 +00:00
|
|
|
SetFont(DebuggerFont);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CBreakPointView::Update()
|
|
|
|
{
|
|
|
|
ClearAll();
|
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
InsertColumn(0, _("Active"), wxLIST_FORMAT_LEFT, 50);
|
|
|
|
InsertColumn(1, _("Type"), wxLIST_FORMAT_LEFT, 50);
|
|
|
|
InsertColumn(2, _("Function"), wxLIST_FORMAT_CENTER, 200);
|
|
|
|
InsertColumn(3, _("Address"), wxLIST_FORMAT_LEFT, 100);
|
|
|
|
InsertColumn(4, _("Flags"), wxLIST_FORMAT_CENTER, 100);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
char szBuffer[64];
|
2009-06-28 11:47:39 +00:00
|
|
|
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
|
2008-12-08 05:30:24 +00:00
|
|
|
for (size_t i = 0; i < rBreakPoints.size(); i++)
|
|
|
|
{
|
|
|
|
const TBreakPoint& rBP = rBreakPoints[i];
|
|
|
|
if (!rBP.bTemporary)
|
|
|
|
{
|
|
|
|
wxString temp;
|
|
|
|
temp = wxString::FromAscii(rBP.bOn ? "on" : " ");
|
|
|
|
int Item = InsertItem(0, temp);
|
|
|
|
temp = wxString::FromAscii("BP");
|
|
|
|
SetItem(Item, 1, temp);
|
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
|
|
|
temp = wxString::FromAscii(g_symbolDB.GetDescription(rBP.iAddress));
|
|
|
|
SetItem(Item, 2, temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(szBuffer, "0x%08x", rBP.iAddress);
|
|
|
|
temp = wxString::FromAscii(szBuffer);
|
|
|
|
SetItem(Item, 3, temp);
|
|
|
|
|
|
|
|
SetItemData(Item, rBP.iAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-28 11:47:39 +00:00
|
|
|
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
2008-12-08 05:30:24 +00:00
|
|
|
for (size_t i = 0; i < rMemChecks.size(); i++)
|
|
|
|
{
|
|
|
|
const TMemCheck& rMemCheck = rMemChecks[i];
|
|
|
|
|
|
|
|
wxString temp;
|
|
|
|
temp = wxString::FromAscii(rMemCheck.Break ? "on" : " ");
|
|
|
|
int Item = InsertItem(0, temp);
|
|
|
|
temp = wxString::FromAscii("MC");
|
|
|
|
SetItem(Item, 1, temp);
|
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
|
|
|
|
if (symbol)
|
|
|
|
{
|
|
|
|
temp = wxString::FromAscii(g_symbolDB.GetDescription(rMemCheck.StartAddress));
|
|
|
|
SetItem(Item, 2, temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(szBuffer, "0x%08x to 0%08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
|
|
|
|
temp = wxString::FromAscii(szBuffer);
|
|
|
|
SetItem(Item, 3, temp);
|
|
|
|
|
|
|
|
size_t c = 0;
|
|
|
|
if (rMemCheck.OnRead) szBuffer[c++] = 'r';
|
|
|
|
if (rMemCheck.OnWrite) szBuffer[c++] = 'w';
|
|
|
|
szBuffer[c] = 0x00;
|
|
|
|
temp = wxString::FromAscii(szBuffer);
|
|
|
|
SetItem(Item, 4, temp);
|
|
|
|
|
|
|
|
SetItemData(Item, rMemCheck.StartAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBreakPointView::DeleteCurrentSelection()
|
|
|
|
{
|
|
|
|
int Item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (Item >= 0)
|
|
|
|
{
|
|
|
|
u32 Address = (u32)GetItemData(Item);
|
2009-06-28 11:47:39 +00:00
|
|
|
PowerPC::breakpoints.DeleteByAddress(Address);
|
|
|
|
PowerPC::memchecks.DeleteByAddress(Address);
|
2008-12-20 14:00:33 +00:00
|
|
|
Update();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-27 21:28:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
CBreakPointBar::CBreakPointBar(CBreakPointWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
|
|
|
: wxListCtrl((wxWindow*)parent, id, pos, size, style)
|
|
|
|
{
|
|
|
|
BPWindow = parent;
|
|
|
|
|
|
|
|
SetBackgroundColour(wxColour(0x555555));
|
|
|
|
SetForegroundColour(wxColour(0xffffff));
|
|
|
|
|
|
|
|
// load orignal size 48x48
|
|
|
|
wxMemoryInputStream st1(toolbar_delete_png, sizeof(toolbar_delete_png));
|
|
|
|
wxMemoryInputStream st2(toolbar_add_breakpoint_png, sizeof(toolbar_add_breakpoint_png));
|
|
|
|
wxMemoryInputStream st3(toolbar_add_memcheck_png, sizeof(toolbar_add_memcheck_png));
|
|
|
|
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxImage(st1, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
|
|
|
|
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxImage(st2, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
|
|
|
|
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxImage(st3, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
|
|
|
|
|
|
|
|
m_imageListNormal = new wxImageList(24, 24);
|
|
|
|
m_imageListNormal->Add(m_Bitmaps[Toolbar_Delete]);
|
|
|
|
m_imageListNormal->Add(m_Bitmaps[Toolbar_Add_BP]);
|
|
|
|
m_imageListNormal->Add(m_Bitmaps[Toolbar_Add_MC]);
|
|
|
|
SetImageList(m_imageListNormal, wxIMAGE_LIST_NORMAL);
|
|
|
|
|
|
|
|
PopulateBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CBreakPointBar::PopulateBar()
|
|
|
|
{
|
2011-01-05 04:35:46 +00:00
|
|
|
InsertItem(IDM_DELETE, _("Delete"), 0);
|
|
|
|
InsertItem(IDM_CLEAR, _("Clear all"), 0);
|
2009-09-27 21:28:09 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
InsertItem(IDM_ADD_BREAKPOINT, _("Add BP..."), 1);
|
|
|
|
InsertItem(IDM_ADD_BREAKPOINTMANY, _("Add BPs..."), 1);
|
2009-09-27 21:28:09 +00:00
|
|
|
|
|
|
|
// just add memory breakpoints if you can use them
|
|
|
|
if (Memory::AreMemoryBreakpointsActivated())
|
|
|
|
{
|
2011-01-05 04:35:46 +00:00
|
|
|
InsertItem(IDM_ADD_MEMORYCHECK, _("Add MC..."), 2);
|
|
|
|
InsertItem(IDM_ADD_MEMORYCHECKMANY, _("Add MCs..."), 2);
|
2009-09-27 21:28:09 +00:00
|
|
|
}
|
|
|
|
}
|