mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Move debugger ui files into a subdirectory. Primarily to make it easy to keep debugger strings out of translations, but also because it is more organized.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7163 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
84
Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.cpp
Normal file
84
Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Host.h"
|
||||
#include "StringUtil.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "BreakpointWindow.h"
|
||||
#include "BreakpointDlg.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(BreakPointDlg,wxDialog)
|
||||
EVT_CLOSE(BreakPointDlg::OnClose)
|
||||
EVT_BUTTON(ID_OK, BreakPointDlg::OnOK)
|
||||
EVT_BUTTON(ID_CANCEL, BreakPointDlg::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
class CBreakPointWindow;
|
||||
|
||||
BreakPointDlg::BreakPointDlg(CBreakPointWindow *_Parent, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
, Parent(_Parent)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
|
||||
BreakPointDlg::~BreakPointDlg()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void BreakPointDlg::CreateGUIControls()
|
||||
{
|
||||
SetIcon(wxNullIcon);
|
||||
SetSize(8,8,279,121);
|
||||
Center();
|
||||
|
||||
|
||||
m_pButtonOK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(192,64), wxSize(73,25), 0, wxDefaultValidator, wxT("OK"));
|
||||
|
||||
m_pButtonCancel = new wxButton(this, ID_CANCEL, _("Cancel"), wxPoint(112,64), wxSize(73,25), 0, wxDefaultValidator, _("Cancel"));
|
||||
|
||||
m_pEditAddress = new wxTextCtrl(this, ID_ADDRESS, wxT("80000000"), wxPoint(56,24), wxSize(197,20), 0, wxDefaultValidator, wxT("WxEdit1"));
|
||||
}
|
||||
|
||||
|
||||
void BreakPointDlg::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
|
||||
{
|
||||
wxString AddressString = m_pEditAddress->GetLineText(0);
|
||||
u32 Address = 0;
|
||||
if (AsciiToHex(AddressString.mb_str(), Address))
|
||||
{
|
||||
PowerPC::breakpoints.Add(Address);
|
||||
Parent->NotifyUpdate();
|
||||
//Host_UpdateBreakPointView();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
void BreakPointDlg::OnCancel(wxCommandEvent& /*event*/)
|
||||
{
|
||||
Close();
|
||||
}
|
66
Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.h
Normal file
66
Source/Core/DolphinWX/Src/Debugger/BreakpointDlg.h
Normal file
@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __BREAKPOINTDLG_h__
|
||||
#define __BREAKPOINTDLG_h__
|
||||
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
|
||||
class BreakPointDlg : public wxDialog
|
||||
{
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
BreakPointDlg(CBreakPointWindow *, wxWindow *parent, wxWindowID id = 1, const wxString &title = _("BreakPoint"),
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX);
|
||||
virtual ~BreakPointDlg();
|
||||
|
||||
private:
|
||||
|
||||
CBreakPointWindow *Parent;
|
||||
wxButton *m_pButtonOK;
|
||||
wxButton *m_pButtonCancel;
|
||||
wxTextCtrl *m_pEditAddress;
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
ID_WXSTATICTEXT1 = 1006,
|
||||
ID_OK = 1005,
|
||||
ID_CANCEL = 1004,
|
||||
ID_ADDRESS = 1003,
|
||||
ID_WXSTATICBOX1 = 1001,
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
void CreateGUIControls();
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif
|
171
Source/Core/DolphinWX/Src/Debugger/BreakpointView.cpp
Normal file
171
Source/Core/DolphinWX/Src/Debugger/BreakpointView.cpp
Normal file
@ -0,0 +1,171 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/imaglist.h>
|
||||
|
||||
#include "BreakpointView.h"
|
||||
#include "DebuggerUIUtil.h"
|
||||
#include "Debugger/Debugger_SymbolMap.h"
|
||||
#include "PowerPC/PPCSymbolDB.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "HW/Memmap.h"
|
||||
|
||||
extern "C" {
|
||||
#include "../../resources/toolbar_add_breakpoint.c"
|
||||
#include "../../resources/toolbar_add_memorycheck.c"
|
||||
#include "../../resources/toolbar_debugger_delete.c"
|
||||
}
|
||||
|
||||
|
||||
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxListCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
SetFont(DebuggerFont);
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void CBreakPointView::Update()
|
||||
{
|
||||
ClearAll();
|
||||
|
||||
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);
|
||||
|
||||
char szBuffer[64];
|
||||
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
|
||||
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);
|
||||
PowerPC::breakpoints.DeleteByAddress(Address);
|
||||
PowerPC::memchecks.DeleteByAddress(Address);
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
InsertItem(IDM_DELETE, _("Delete"), 0);
|
||||
InsertItem(IDM_CLEAR, _("Clear all"), 0);
|
||||
|
||||
InsertItem(IDM_ADD_BREAKPOINT, _("Add BP..."), 1);
|
||||
InsertItem(IDM_ADD_BREAKPOINTMANY, _("Add BPs..."), 1);
|
||||
|
||||
// just add memory breakpoints if you can use them
|
||||
if (Memory::AreMemoryBreakpointsActivated())
|
||||
{
|
||||
InsertItem(IDM_ADD_MEMORYCHECK, _("Add MC..."), 2);
|
||||
InsertItem(IDM_ADD_MEMORYCHECKMANY, _("Add MCs..."), 2);
|
||||
}
|
||||
}
|
61
Source/Core/DolphinWX/Src/Debugger/BreakpointView.h
Normal file
61
Source/Core/DolphinWX/Src/Debugger/BreakpointView.h
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __BREAKPOINTVIEW_h__
|
||||
#define __BREAKPOINTVIEW_h__
|
||||
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "BreakpointWindow.h"
|
||||
|
||||
class CBreakPointView
|
||||
: public wxListCtrl
|
||||
{
|
||||
public:
|
||||
|
||||
CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
|
||||
void Update();
|
||||
void DeleteCurrentSelection();
|
||||
};
|
||||
|
||||
class CBreakPointBar
|
||||
: public wxListCtrl
|
||||
{
|
||||
public:
|
||||
|
||||
CBreakPointBar(CBreakPointWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
|
||||
void PopulateBar();
|
||||
|
||||
private:
|
||||
void OnSelectItem(wxListEvent& event);
|
||||
|
||||
enum
|
||||
{
|
||||
Toolbar_Delete,
|
||||
Toolbar_Add_BP,
|
||||
Toolbar_Add_MC,
|
||||
Bitmaps_max
|
||||
};
|
||||
|
||||
CBreakPointWindow* BPWindow;
|
||||
wxBitmap m_Bitmaps[Bitmaps_max];
|
||||
};
|
||||
|
||||
#endif
|
265
Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.cpp
Normal file
265
Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.cpp
Normal file
@ -0,0 +1,265 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "BreakpointView.h"
|
||||
#include "CodeWindow.h"
|
||||
#include "HW/Memmap.h"
|
||||
#include "BreakpointDlg.h"
|
||||
#include "MemoryCheckDlg.h"
|
||||
#include "Host.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
|
||||
EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated)
|
||||
EVT_LIST_ITEM_SELECTED(ID_TOOLBAR, CBreakPointWindow::OnSelectItem)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent,
|
||||
wxWindowID id, const wxString& title, const wxPoint& position,
|
||||
const wxSize& size, long style)
|
||||
: wxPanel(parent, id, position, size, style, title)
|
||||
, m_BreakPointListView(NULL)
|
||||
, m_pCodeWindow(_pCodeWindow)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::CreateGUIControls()
|
||||
{
|
||||
SetSize(8, 8, 400, 370);
|
||||
Center();
|
||||
|
||||
m_BreakPointBar = new CBreakPointBar(this, ID_TOOLBAR, wxDefaultPosition, wxSize(0, 55),
|
||||
wxLC_ICON | wxSUNKEN_BORDER | wxLC_SINGLE_SEL);
|
||||
m_BreakPointListView = new CBreakPointView(this, ID_BPS, wxDefaultPosition, wxDefaultSize,
|
||||
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
|
||||
|
||||
wxBoxSizer* sizerH = new wxBoxSizer(wxVERTICAL);
|
||||
sizerH->Add(m_BreakPointBar, 0, wxALL | wxEXPAND);
|
||||
sizerH->Add((wxListCtrl*)m_BreakPointListView, 1, wxEXPAND);
|
||||
|
||||
NotifyUpdate();
|
||||
SetSizer(sizerH);
|
||||
}
|
||||
|
||||
void CBreakPointWindow::OnSelectItem(wxListEvent& event)
|
||||
{
|
||||
switch(event.GetItem().GetId())
|
||||
{
|
||||
case IDM_DELETE:
|
||||
OnDelete();
|
||||
m_BreakPointBar->SetItemState(event.GetItem().GetId(), 0, wxLIST_STATE_FOCUSED);
|
||||
break;
|
||||
case IDM_CLEAR:
|
||||
OnClear();
|
||||
m_BreakPointBar->SetItemState(event.GetItem().GetId(), 0, wxLIST_STATE_FOCUSED);
|
||||
break;
|
||||
case IDM_ADD_BREAKPOINT:
|
||||
OnAddBreakPoint();
|
||||
break;
|
||||
case IDM_ADD_BREAKPOINTMANY:
|
||||
OnAddBreakPointMany();
|
||||
break;
|
||||
case IDM_ADD_MEMORYCHECK:
|
||||
OnAddMemoryCheck();
|
||||
break;
|
||||
case IDM_ADD_MEMORYCHECKMANY:
|
||||
OnAddMemoryCheckMany();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CBreakPointWindow::NotifyUpdate()
|
||||
{
|
||||
if (m_BreakPointListView != NULL) m_BreakPointListView->Update();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::OnDelete()
|
||||
{
|
||||
if (m_BreakPointListView)
|
||||
{
|
||||
m_BreakPointListView->DeleteCurrentSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void CBreakPointWindow::OnActivated(wxListEvent& event)
|
||||
{
|
||||
long Index = event.GetIndex();
|
||||
if (Index >= 0)
|
||||
{
|
||||
u32 Address = (u32)m_BreakPointListView->GetItemData(Index);
|
||||
if (m_pCodeWindow != NULL)
|
||||
{
|
||||
m_pCodeWindow->JumpToAddress(Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Breakpoint actions
|
||||
// ---------------------
|
||||
|
||||
// Clear all breakpoints
|
||||
void CBreakPointWindow::OnClear()
|
||||
{
|
||||
PowerPC::breakpoints.Clear();
|
||||
PowerPC::memchecks.Clear();
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
// Add one breakpoint
|
||||
void CBreakPointWindow::OnAddBreakPoint()
|
||||
{
|
||||
BreakPointDlg bpDlg(this, this);
|
||||
bpDlg.ShowModal();
|
||||
}
|
||||
|
||||
// Load breakpoints from file
|
||||
void CBreakPointWindow::OnAddBreakPointMany()
|
||||
{
|
||||
// load ini
|
||||
IniFile ini;
|
||||
std::string filename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "BreakPoints.ini";
|
||||
|
||||
if (ini.Load(filename.c_str())) // check if there is any file there
|
||||
{
|
||||
// get lines from a certain section
|
||||
std::vector<std::string> lines;
|
||||
if (!ini.GetLines("BreakPoints", lines))
|
||||
{
|
||||
wxMessageBox(_("You have no [BreakPoints] line in your file"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
{
|
||||
std::string line = StripSpaces(*iter);
|
||||
u32 Address = 0;
|
||||
if (AsciiToHex(line.c_str(), Address))
|
||||
{
|
||||
PowerPC::breakpoints.Add(Address);
|
||||
}
|
||||
}
|
||||
// Only update after we are done with the loop
|
||||
NotifyUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_("Couldn't find GameConfig/BreakPoints.ini file"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Memory check actions
|
||||
// ---------------------
|
||||
void
|
||||
CBreakPointWindow::OnAddMemoryCheck()
|
||||
{
|
||||
MemoryCheckDlg memDlg(this);
|
||||
memDlg.ShowModal();
|
||||
}
|
||||
|
||||
// Load memory checks from file
|
||||
void CBreakPointWindow::OnAddMemoryCheckMany()
|
||||
{
|
||||
// load ini
|
||||
IniFile ini;
|
||||
std::string filename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "MemoryChecks.ini";
|
||||
|
||||
if (ini.Load(filename.c_str()))
|
||||
{
|
||||
// get lines from a certain section
|
||||
std::vector<std::string> lines;
|
||||
if (!ini.GetLines("MemoryChecks", lines))
|
||||
{
|
||||
wxMessageBox(_("You have no [MemoryChecks] line in your file"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
|
||||
{
|
||||
std::string line = StripSpaces(*iter);
|
||||
std::vector<std::string> pieces;
|
||||
SplitString(line, ' ', pieces); // split string
|
||||
|
||||
TMemCheck MemCheck;
|
||||
u32 sAddress = 0;
|
||||
u32 eAddress = 0;
|
||||
bool doCommon = false;
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Decide if we have a range or just one address, and if we should break or not
|
||||
// --------------
|
||||
if (
|
||||
pieces.size() == 1
|
||||
&& AsciiToHex(pieces[0].c_str(), sAddress)
|
||||
&& pieces[0].size() == 8
|
||||
)
|
||||
{
|
||||
// address range
|
||||
MemCheck.StartAddress = sAddress;
|
||||
MemCheck.EndAddress = sAddress;
|
||||
doCommon = true;
|
||||
MemCheck.Break = false;
|
||||
}
|
||||
else if(
|
||||
pieces.size() == 2
|
||||
&& AsciiToHex(pieces[0].c_str(), sAddress) && AsciiToHex(pieces[1].c_str(), eAddress)
|
||||
&& pieces[0].size() == 8 && pieces[1].size() == 8
|
||||
)
|
||||
{
|
||||
// address range
|
||||
MemCheck.StartAddress = sAddress;
|
||||
MemCheck.EndAddress = eAddress;
|
||||
doCommon = true;
|
||||
MemCheck.Break = false;
|
||||
}
|
||||
else if(
|
||||
pieces.size() == 3
|
||||
&& AsciiToHex(pieces[0].c_str(), sAddress) && AsciiToHex(pieces[1].c_str(), eAddress)
|
||||
&& pieces[0].size() == 8 && pieces[1].size() == 8 && pieces[2].size() == 1
|
||||
)
|
||||
{
|
||||
// address range
|
||||
MemCheck.StartAddress = sAddress;
|
||||
MemCheck.EndAddress = eAddress;
|
||||
doCommon = true;
|
||||
MemCheck.Break = true;
|
||||
}
|
||||
|
||||
if (doCommon)
|
||||
{
|
||||
// settings for the memory check
|
||||
MemCheck.OnRead = true;
|
||||
MemCheck.OnWrite = true;
|
||||
MemCheck.Log = true;
|
||||
//MemCheck.Break = false; // this is also what sets Active "on" in the breakpoint window
|
||||
// so don't think it's off because we are only writing this to the log
|
||||
PowerPC::memchecks.Add(MemCheck);
|
||||
}
|
||||
}
|
||||
// Update after we are done with the loop
|
||||
NotifyUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_("You have no ") + wxString::FromAscii(File::GetUserPath(D_GAMECONFIG_IDX)) + _("MemoryChecks.ini file"));
|
||||
}
|
||||
}
|
||||
|
83
Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.h
Normal file
83
Source/Core/DolphinWX/Src/Debugger/BreakpointWindow.h
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __BREAKPOINTWINDOW_h__
|
||||
#define __BREAKPOINTWINDOW_h__
|
||||
|
||||
class CBreakPointView;
|
||||
class CBreakPointBar;
|
||||
class CCodeWindow;
|
||||
class wxListEvent;
|
||||
class IniFile;
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_DELETE = 0,
|
||||
IDM_CLEAR,
|
||||
IDM_ADD_BREAKPOINT,
|
||||
IDM_ADD_BREAKPOINTMANY,
|
||||
IDM_ADD_MEMORYCHECK,
|
||||
IDM_ADD_MEMORYCHECKMANY
|
||||
};
|
||||
|
||||
class CBreakPointWindow
|
||||
: public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
|
||||
CBreakPointWindow(CCodeWindow* _pCodeWindow,
|
||||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = _("Breakpoints"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxBORDER_NONE);
|
||||
|
||||
void NotifyUpdate();
|
||||
void OnDelete();
|
||||
void OnClear();
|
||||
void OnAddBreakPoint();
|
||||
void OnAddBreakPointMany();
|
||||
void OnAddMemoryCheck();
|
||||
void OnAddMemoryCheckMany();
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
ID_TOOLBAR = 501,
|
||||
ID_BPS = 1002,
|
||||
};
|
||||
|
||||
CBreakPointBar* m_BreakPointBar;
|
||||
CBreakPointView* m_BreakPointListView;
|
||||
CCodeWindow* m_pCodeWindow;
|
||||
|
||||
// void RecreateToolbar();
|
||||
// void PopulateToolbar(wxToolBar* toolBar);
|
||||
// void InitBitmaps();
|
||||
void CreateGUIControls();
|
||||
|
||||
void OnSelectItem(wxListEvent& event);
|
||||
void OnActivated(wxListEvent& event);
|
||||
};
|
||||
|
||||
#endif
|
594
Source/Core/DolphinWX/Src/Debugger/CodeView.cpp
Normal file
594
Source/Core/DolphinWX/Src/Debugger/CodeView.cpp
Normal file
@ -0,0 +1,594 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "Common.h"
|
||||
#include "StringUtil.h"
|
||||
#include "DebuggerUIUtil.h"
|
||||
#include "DebugInterface.h"
|
||||
|
||||
#include "Host.h"
|
||||
#include "CodeView.h"
|
||||
#include "SymbolDB.h"
|
||||
|
||||
#include <wx/event.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/textdlg.h>
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE);
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_GOTOINMEMVIEW = 12000,
|
||||
IDM_COPYADDRESS,
|
||||
IDM_COPYHEX,
|
||||
IDM_COPYCODE,
|
||||
IDM_INSERTBLR, IDM_INSERTNOP,
|
||||
IDM_RUNTOHERE,
|
||||
IDM_JITRESULTS,
|
||||
IDM_FOLLOWBRANCH,
|
||||
IDM_RENAMESYMBOL,
|
||||
IDM_PATCHALERT,
|
||||
IDM_COPYFUNCTION,
|
||||
IDM_ADDFUNCTION,
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(CCodeView, wxControl)
|
||||
EVT_ERASE_BACKGROUND(CCodeView::OnErase)
|
||||
EVT_PAINT(CCodeView::OnPaint)
|
||||
EVT_LEFT_DOWN(CCodeView::OnMouseDown)
|
||||
EVT_LEFT_UP(CCodeView::OnMouseUpL)
|
||||
EVT_MOTION(CCodeView::OnMouseMove)
|
||||
EVT_RIGHT_DOWN(CCodeView::OnMouseDown)
|
||||
EVT_RIGHT_UP(CCodeView::OnMouseUpR)
|
||||
EVT_MENU(-1, CCodeView::OnPopupMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, wxWindow* parent, wxWindowID Id, const wxSize& Size)
|
||||
: wxControl(parent, Id, wxDefaultPosition, Size),
|
||||
debugger(debuginterface),
|
||||
symbol_db(symboldb),
|
||||
plain(false),
|
||||
rowHeight(13),
|
||||
selection(0),
|
||||
oldSelection(0),
|
||||
selectionChanged(false),
|
||||
selecting(false),
|
||||
hasFocus(false),
|
||||
showHex(false),
|
||||
lx(-1),
|
||||
ly(-1)
|
||||
{
|
||||
rowHeight = 13;
|
||||
align = debuginterface->getInstructionSize(0);
|
||||
curAddress = debuginterface->getPC();
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
|
||||
wxSize CCodeView::DoGetBestSize() const
|
||||
{
|
||||
wxSize bestSize;
|
||||
bestSize.x = 400;
|
||||
bestSize.y = 800;
|
||||
return(bestSize);
|
||||
}
|
||||
|
||||
|
||||
int CCodeView::YToAddress(int y)
|
||||
{
|
||||
wxRect rc = GetClientRect();
|
||||
int ydiff = y - rc.height / 2 - rowHeight / 2;
|
||||
ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1;
|
||||
return(curAddress + ydiff * align);
|
||||
}
|
||||
|
||||
|
||||
void CCodeView::OnMouseDown(wxMouseEvent& event)
|
||||
{
|
||||
int x = event.m_x;
|
||||
int y = event.m_y;
|
||||
|
||||
if (x > 16)
|
||||
{
|
||||
oldSelection = selection;
|
||||
selection = YToAddress(y);
|
||||
// SetCapture(wnd);
|
||||
bool oldselecting = selecting;
|
||||
selecting = true;
|
||||
|
||||
if (!oldselecting || (selection != oldSelection))
|
||||
{
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleBreakpoint(YToAddress(y));
|
||||
}
|
||||
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CCodeView::ToggleBreakpoint(u32 address)
|
||||
{
|
||||
debugger->toggleBreakpoint(address);
|
||||
redraw();
|
||||
Host_UpdateBreakPointView();
|
||||
}
|
||||
|
||||
|
||||
void CCodeView::OnMouseMove(wxMouseEvent& event)
|
||||
{
|
||||
wxRect rc = GetClientRect();
|
||||
|
||||
if (event.m_leftDown)
|
||||
{
|
||||
if (event.m_x > 16)
|
||||
{
|
||||
if (event.m_y < 0)
|
||||
{
|
||||
curAddress -= align;
|
||||
redraw();
|
||||
}
|
||||
else if (event.m_y > rc.height)
|
||||
{
|
||||
curAddress += align;
|
||||
redraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnMouseDown(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
void CCodeView::RaiseEvent()
|
||||
{
|
||||
wxCommandEvent ev(wxEVT_CODEVIEW_CHANGE, GetId());
|
||||
ev.SetEventObject(this);
|
||||
ev.SetInt(selection);
|
||||
GetEventHandler()->ProcessEvent(ev);
|
||||
}
|
||||
|
||||
void CCodeView::OnMouseUpL(wxMouseEvent& event)
|
||||
{
|
||||
if (event.m_x > 16)
|
||||
{
|
||||
curAddress = YToAddress(event.m_y);
|
||||
selecting = false;
|
||||
//ReleaseCapture();
|
||||
redraw();
|
||||
}
|
||||
RaiseEvent();
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
u32 CCodeView::AddrToBranch(u32 addr)
|
||||
{
|
||||
char disasm[256];
|
||||
debugger->disasm(addr, disasm, 256);
|
||||
const char *mojs = strstr(disasm, "->0x");
|
||||
if (mojs)
|
||||
{
|
||||
u32 dest;
|
||||
sscanf(mojs+4,"%08x", &dest);
|
||||
return dest;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCodeView::InsertBlrNop(int Blr)
|
||||
{
|
||||
// Check if this address has been modified
|
||||
int find = -1;
|
||||
for(u32 i = 0; i < BlrList.size(); i++)
|
||||
{
|
||||
if(BlrList.at(i).Address == selection)
|
||||
{ find = i; break; }
|
||||
}
|
||||
|
||||
// Save the old value
|
||||
if (find >= 0)
|
||||
{
|
||||
debugger->writeExtraMemory(0, BlrList.at(find).OldValue, selection);
|
||||
BlrList.erase(BlrList.begin() + find);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlrStruct Temp;
|
||||
Temp.Address = selection;
|
||||
Temp.OldValue = debugger->readMemory(selection);
|
||||
BlrList.push_back(Temp);
|
||||
if (Blr == 0)
|
||||
debugger->insertBLR(selection, 0x4e800020);
|
||||
else
|
||||
debugger->insertBLR(selection, 0x60000000);
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CCodeView::OnPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
#if wxUSE_CLIPBOARD
|
||||
wxTheClipboard->Open();
|
||||
#endif
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_GOTOINMEMVIEW:
|
||||
// CMemoryDlg::Goto(selection);
|
||||
break;
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
case IDM_COPYADDRESS:
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
|
||||
break;
|
||||
|
||||
case IDM_COPYCODE:
|
||||
{
|
||||
char disasm[256];
|
||||
debugger->disasm(selection, disasm, 256);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); //Have to manually convert from char* to wxString, don't have to in Windows?
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_COPYHEX:
|
||||
{
|
||||
char temp[24];
|
||||
sprintf(temp, "%08x", debugger->readInstruction(selection));
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IDM_COPYFUNCTION:
|
||||
{
|
||||
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
|
||||
if (symbol) {
|
||||
std::string text;
|
||||
text = text + symbol->name + "\r\n";
|
||||
// we got a function
|
||||
u32 start = symbol->address;
|
||||
u32 end = start + symbol->size;
|
||||
for (u32 addr = start; addr != end; addr += 4) {
|
||||
char disasm[256];
|
||||
debugger->disasm(addr, disasm, 256);
|
||||
text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n";
|
||||
}
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(text.c_str())));
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IDM_RUNTOHERE:
|
||||
debugger->setBreakpoint(selection);
|
||||
debugger->runToBreakpoint();
|
||||
redraw();
|
||||
break;
|
||||
|
||||
// Insert blr or restore old value
|
||||
case IDM_INSERTBLR:
|
||||
InsertBlrNop(0);
|
||||
redraw();
|
||||
break;
|
||||
case IDM_INSERTNOP:
|
||||
InsertBlrNop(1);
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case IDM_JITRESULTS:
|
||||
debugger->showJitResults(selection);
|
||||
break;
|
||||
|
||||
case IDM_FOLLOWBRANCH:
|
||||
{
|
||||
u32 dest = AddrToBranch(selection);
|
||||
if (dest)
|
||||
Center(dest);
|
||||
RaiseEvent();
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_ADDFUNCTION:
|
||||
{
|
||||
symbol_db->AddFunction(selection);
|
||||
Host_NotifyMapLoaded();
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_RENAMESYMBOL:
|
||||
{
|
||||
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
|
||||
if (symbol) {
|
||||
wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"), wxGetTextFromUserPromptStr,
|
||||
wxString::FromAscii(symbol->name.c_str()));
|
||||
if (input_symbol.ShowModal() == wxID_OK) {
|
||||
symbol->name = input_symbol.GetValue().mb_str();
|
||||
redraw(); // Redraw to show the renamed symbol
|
||||
}
|
||||
Host_NotifyMapLoaded();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_PATCHALERT:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
wxTheClipboard->Close();
|
||||
#endif
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CCodeView::OnMouseUpR(wxMouseEvent& event)
|
||||
{
|
||||
bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0;
|
||||
// popup menu
|
||||
wxMenu* menu = new wxMenu;
|
||||
//menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
|
||||
menu->Append(IDM_FOLLOWBRANCH, wxString::FromAscii("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false);
|
||||
menu->AppendSeparator();
|
||||
#if wxUSE_CLIPBOARD
|
||||
menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
|
||||
menu->Append(IDM_COPYFUNCTION, wxString::FromAscii("Copy &function"))->Enable(isSymbol);
|
||||
menu->Append(IDM_COPYCODE, wxString::FromAscii("Copy &code line"));
|
||||
menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
|
||||
menu->AppendSeparator();
|
||||
#endif
|
||||
menu->Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"))->Enable(isSymbol);
|
||||
menu->AppendSeparator();
|
||||
menu->Append(IDM_RUNTOHERE, _("&Run To Here"));
|
||||
menu->Append(IDM_ADDFUNCTION, _("&Add function"));
|
||||
menu->Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86"));
|
||||
menu->Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr"));
|
||||
menu->Append(IDM_INSERTNOP, wxString::FromAscii("Insert &nop"));
|
||||
menu->Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert"));
|
||||
PopupMenu(menu);
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CCodeView::OnErase(wxEraseEvent& event)
|
||||
{}
|
||||
|
||||
|
||||
void CCodeView::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
// --------------------------------------------------------------------
|
||||
// General settings
|
||||
// -------------------------
|
||||
wxPaintDC dc(this);
|
||||
wxRect rc = GetClientRect();
|
||||
|
||||
dc.SetFont(DebuggerFont);
|
||||
|
||||
struct branch
|
||||
{
|
||||
int src, dst, srcAddr;
|
||||
};
|
||||
|
||||
branch branches[256];
|
||||
int numBranches = 0;
|
||||
// TODO: Add any drawing code here...
|
||||
int width = rc.width;
|
||||
int numRows = (rc.height / rowHeight) / 2 + 2;
|
||||
//numRows=(numRows&(~1)) + 1;
|
||||
// ------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Colors and brushes
|
||||
// -------------------------
|
||||
dc.SetBackgroundMode(wxTRANSPARENT); // the text background
|
||||
const wxChar* bgColor = _T("#ffffff");
|
||||
wxPen nullPen(bgColor);
|
||||
wxPen currentPen(_T("#000000"));
|
||||
wxPen selPen(_T("#808080")); // gray
|
||||
nullPen.SetStyle(wxTRANSPARENT);
|
||||
currentPen.SetStyle(wxSOLID);
|
||||
wxBrush currentBrush(_T("#FFEfE8")); // light gray
|
||||
wxBrush pcBrush(_T("#70FF70")); // green
|
||||
wxBrush bpBrush(_T("#FF3311")); // red
|
||||
|
||||
wxBrush bgBrush(bgColor);
|
||||
wxBrush nullBrush(bgColor);
|
||||
nullBrush.SetStyle(wxTRANSPARENT);
|
||||
|
||||
dc.SetPen(nullPen);
|
||||
dc.SetBrush(bgBrush);
|
||||
dc.DrawRectangle(0, 0, 16, rc.height);
|
||||
dc.DrawRectangle(0, 0, rc.width, 5);
|
||||
// ------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Walk through all visible rows
|
||||
// -------------------------
|
||||
for (int i = -numRows; i <= numRows; i++)
|
||||
{
|
||||
unsigned int address = curAddress + i * align;
|
||||
|
||||
int rowY1 = rc.height / 2 + rowHeight * i - rowHeight / 2;
|
||||
int rowY2 = rc.height / 2 + rowHeight * i + rowHeight / 2;
|
||||
|
||||
wxString temp = wxString::Format(_T("%08x"), address);
|
||||
u32 col = debugger->getColor(address);
|
||||
wxBrush rowBrush(wxColor(col >> 16, col >> 8, col));
|
||||
dc.SetBrush(nullBrush);
|
||||
dc.SetPen(nullPen);
|
||||
dc.DrawRectangle(0, rowY1, 16, rowY2 - rowY1 + 2);
|
||||
|
||||
if (selecting && (address == selection))
|
||||
dc.SetPen(selPen);
|
||||
else
|
||||
dc.SetPen(i == 0 ? currentPen : nullPen);
|
||||
|
||||
if (address == debugger->getPC())
|
||||
dc.SetBrush(pcBrush);
|
||||
else
|
||||
dc.SetBrush(rowBrush);
|
||||
|
||||
dc.DrawRectangle(16, rowY1, width, rowY2 - rowY1 + 1);
|
||||
dc.SetBrush(currentBrush);
|
||||
if (!plain) {
|
||||
dc.SetTextForeground(_T("#600000")); // the address text is dark red
|
||||
dc.DrawText(temp, 17, rowY1);
|
||||
dc.SetTextForeground(_T("#000000"));
|
||||
}
|
||||
|
||||
// If running
|
||||
if (debugger->isAlive())
|
||||
{
|
||||
char dis[256];
|
||||
debugger->disasm(address, dis, 256);
|
||||
char* dis2 = strchr(dis, '\t');
|
||||
char desc[256] = "";
|
||||
|
||||
// If we have a code
|
||||
if (dis2)
|
||||
{
|
||||
*dis2 = 0;
|
||||
dis2++;
|
||||
// look for hex strings to decode branches
|
||||
const char* mojs = strstr(dis2, "0x8");
|
||||
if (mojs)
|
||||
{
|
||||
for (int k = 0; k < 8; k++)
|
||||
{
|
||||
bool found = false;
|
||||
for (int j = 0; j < 22; j++)
|
||||
{
|
||||
if (mojs[k + 2] == "0123456789ABCDEFabcdef"[j])
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
mojs = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mojs)
|
||||
{
|
||||
int offs;
|
||||
sscanf(mojs + 2, "%08x", &offs);
|
||||
branches[numBranches].src = rowY1 + rowHeight / 2;
|
||||
branches[numBranches].srcAddr = address / align;
|
||||
branches[numBranches++].dst = (int)(rowY1 + ((s64)(u32)offs - (s64)(u32)address) * rowHeight / align + rowHeight / 2);
|
||||
sprintf(desc, "-->%s", debugger->getDescription(offs).c_str());
|
||||
dc.SetTextForeground(_T("#600060")); // the -> arrow illustrations are purple
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetTextForeground(_T("#000000"));
|
||||
}
|
||||
|
||||
dc.DrawText(wxString::FromAscii(dis2), 140, rowY1);
|
||||
// ------------
|
||||
}
|
||||
|
||||
// Show blr as its' own color
|
||||
if (strcmp(dis, "blr"))
|
||||
dc.SetTextForeground(_T("#007000")); // dark green
|
||||
else
|
||||
dc.SetTextForeground(_T("#8000FF")); // purple
|
||||
|
||||
dc.DrawText(wxString::FromAscii(dis), plain ? 25 : 80, rowY1);
|
||||
|
||||
if (desc[0] == 0)
|
||||
{
|
||||
strcpy(desc, debugger->getDescription(address).c_str());
|
||||
}
|
||||
|
||||
if (!plain) {
|
||||
dc.SetTextForeground(_T("#0000FF")); // blue
|
||||
|
||||
//char temp[256];
|
||||
//UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE);
|
||||
if (strlen(desc))
|
||||
{
|
||||
dc.DrawText(wxString::FromAscii(desc), 270, rowY1);
|
||||
}
|
||||
}
|
||||
|
||||
// Show red breakpoint dot
|
||||
if (debugger->isBreakpoint(address))
|
||||
{
|
||||
dc.SetBrush(bpBrush);
|
||||
dc.DrawRectangle(2, rowY1 + 1, 11, 11);
|
||||
}
|
||||
}
|
||||
} // end of for
|
||||
// ------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Colors and brushes
|
||||
// -------------------------
|
||||
dc.SetPen(currentPen);
|
||||
|
||||
for (int i = 0; i < numBranches; i++)
|
||||
{
|
||||
int x = 370 + (branches[i].srcAddr % 9) * 8;
|
||||
_MoveTo(x-2, branches[i].src);
|
||||
|
||||
if (branches[i].dst < rc.height + 400 && branches[i].dst > -400)
|
||||
{
|
||||
_LineTo(dc, x+2, branches[i].src);
|
||||
_LineTo(dc, x+2, branches[i].dst);
|
||||
_LineTo(dc, x-4, branches[i].dst);
|
||||
|
||||
_MoveTo(x, branches[i].dst - 4);
|
||||
_LineTo(dc, x-4, branches[i].dst);
|
||||
_LineTo(dc, x+1, branches[i].dst+5);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// This can be re-enabled when there is a scrollbar or
|
||||
// something on the codeview (the lines are too long)
|
||||
|
||||
//_LineTo(dc, x+4, branches[i].src);
|
||||
//_MoveTo(x+2, branches[i].dst-4);
|
||||
//_LineTo(dc, x+6, branches[i].dst);
|
||||
//_LineTo(dc, x+1, branches[i].dst+5);
|
||||
//}
|
||||
|
||||
//_LineTo(dc, x, branches[i].dst+4);
|
||||
//_LineTo(dc, x-2, branches[i].dst);
|
||||
}
|
||||
// ------------
|
||||
}
|
||||
|
||||
|
||||
void CCodeView::_LineTo(wxPaintDC &dc, int x, int y)
|
||||
{
|
||||
dc.DrawLine(lx, ly, x, y);
|
||||
lx = x;
|
||||
ly = y;
|
||||
}
|
||||
|
101
Source/Core/DolphinWX/Src/Debugger/CodeView.h
Normal file
101
Source/Core/DolphinWX/Src/Debugger/CodeView.h
Normal file
@ -0,0 +1,101 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef CODEVIEW_H_
|
||||
#define CODEVIEW_H_
|
||||
|
||||
#define wxUSE_XPM_IN_MSW 1
|
||||
#define USE_XPM_BITMAPS 1
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1);
|
||||
|
||||
class DebugInterface;
|
||||
class SymbolDB;
|
||||
|
||||
class CCodeView : public wxControl
|
||||
{
|
||||
public:
|
||||
CCodeView(DebugInterface* debuginterface, SymbolDB *symbol_db, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize);
|
||||
wxSize DoGetBestSize() const;
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnErase(wxEraseEvent& event);
|
||||
void OnMouseDown(wxMouseEvent& event);
|
||||
void OnMouseMove(wxMouseEvent& event);
|
||||
void OnMouseUpL(wxMouseEvent& event);
|
||||
void OnMouseUpR(wxMouseEvent& event);
|
||||
void OnPopupMenu(wxCommandEvent& event);
|
||||
void InsertBlrNop(int);
|
||||
|
||||
u32 GetSelection() {return(selection);}
|
||||
void ToggleBreakpoint(u32 address);
|
||||
|
||||
struct BlrStruct // for IDM_INSERTBLR
|
||||
{
|
||||
u32 Address;
|
||||
u32 OldValue;
|
||||
};
|
||||
std::vector<BlrStruct> BlrList;
|
||||
|
||||
void Center(u32 addr)
|
||||
{
|
||||
curAddress = addr;
|
||||
selection = addr;
|
||||
redraw();
|
||||
}
|
||||
|
||||
void SetPlain() {
|
||||
plain = true;
|
||||
}
|
||||
|
||||
private:
|
||||
void RaiseEvent();
|
||||
int YToAddress(int y);
|
||||
|
||||
u32 AddrToBranch(u32 addr);
|
||||
|
||||
void redraw() {Refresh();}
|
||||
|
||||
DebugInterface* debugger;
|
||||
SymbolDB* symbol_db;
|
||||
|
||||
bool plain;
|
||||
|
||||
int curAddress;
|
||||
int align;
|
||||
int rowHeight;
|
||||
|
||||
u32 selection;
|
||||
u32 oldSelection;
|
||||
bool selectionChanged;
|
||||
bool selecting;
|
||||
bool hasFocus;
|
||||
bool showHex;
|
||||
|
||||
int lx, ly;
|
||||
void _MoveTo(int x, int y) {lx = x; ly = y;}
|
||||
void _LineTo(wxPaintDC &dc, int x, int y);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /*CODEVIEW_H_*/
|
745
Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp
Normal file
745
Source/Core/DolphinWX/Src/Debugger/CodeWindow.cpp
Normal file
@ -0,0 +1,745 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
// Include
|
||||
#include "Common.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/textdlg.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/tipwin.h>
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
#include "RegisterWindow.h"
|
||||
#include "BreakpointWindow.h"
|
||||
#include "MemoryWindow.h"
|
||||
#include "JitWindow.h"
|
||||
|
||||
#include "CodeWindow.h"
|
||||
#include "CodeView.h"
|
||||
|
||||
#include "FileUtil.h"
|
||||
#include "Core.h"
|
||||
#include "HW/Memmap.h"
|
||||
#include "HLE/HLE.h"
|
||||
#include "Boot/Boot.h"
|
||||
#include "LogManager.h"
|
||||
#include "HW/CPU.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "Debugger/PPCDebugInterface.h"
|
||||
#include "Debugger/Debugger_SymbolMap.h"
|
||||
#include "PowerPC/PPCAnalyst.h"
|
||||
#include "PowerPC/Profiler.h"
|
||||
#include "PowerPC/PPCSymbolDB.h"
|
||||
#include "PowerPC/SignatureDB.h"
|
||||
#include "PowerPC/PPCTables.h"
|
||||
#include "PowerPC/JitCommon/JitBase.h"
|
||||
#include "PowerPC/JitCommon/JitCache.h" // for ClearCache()
|
||||
|
||||
#include "ConfigManager.h"
|
||||
|
||||
extern "C" // Bitmaps
|
||||
{
|
||||
#include "../../resources/toolbar_play.c"
|
||||
#include "../../resources/toolbar_pause.c"
|
||||
#include "../../resources/toolbar_add_memorycheck.c"
|
||||
#include "../../resources/toolbar_debugger_delete.c"
|
||||
#include "../../resources/toolbar_add_breakpoint.c"
|
||||
}
|
||||
|
||||
class CPluginInfo;
|
||||
class CPluginManager;
|
||||
|
||||
// -------
|
||||
// Main
|
||||
|
||||
BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
|
||||
|
||||
// Menu bar
|
||||
EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnCPUMode) // Options
|
||||
EVT_MENU(IDM_BOOTTOPAUSE, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont)
|
||||
|
||||
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // Jit
|
||||
EVT_MENU(IDM_JITNOBLOCKCACHE, CCodeWindow::OnCPUMode)
|
||||
|
||||
EVT_MENU(IDM_JITOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITIOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
|
||||
|
||||
EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu)
|
||||
EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu)
|
||||
EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
|
||||
|
||||
EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
|
||||
EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu)
|
||||
|
||||
EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu)
|
||||
EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
|
||||
|
||||
// Toolbar
|
||||
EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep)
|
||||
EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep)
|
||||
EVT_MENU(IDM_TOGGLE_BREAKPOINT, CCodeWindow::OnCodeStep)
|
||||
EVT_MENU(IDM_SKIP, CCodeWindow::OnCodeStep)
|
||||
EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
|
||||
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
|
||||
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
|
||||
|
||||
// Other
|
||||
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
|
||||
EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
|
||||
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
|
||||
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
|
||||
|
||||
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Class
|
||||
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *parent,
|
||||
wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name)
|
||||
: wxPanel((wxWindow*)parent, id, position, size, style, name)
|
||||
, Parent(parent)
|
||||
, m_RegisterWindow(NULL)
|
||||
, m_BreakpointWindow(NULL)
|
||||
, m_MemoryWindow(NULL)
|
||||
, m_JitWindow(NULL)
|
||||
, m_SoundWindow(NULL)
|
||||
, m_VideoWindow(NULL)
|
||||
, codeview(NULL)
|
||||
{
|
||||
InitBitmaps();
|
||||
|
||||
CreateGUIControls(_LocalCoreStartupParameter);
|
||||
|
||||
// Connect keyboard
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
|
||||
wxKeyEventHandler(CCodeWindow::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
}
|
||||
|
||||
wxMenuBar *CCodeWindow::GetMenuBar()
|
||||
{
|
||||
return Parent->GetMenuBar();
|
||||
}
|
||||
|
||||
wxAuiToolBar *CCodeWindow::GetToolBar()
|
||||
{
|
||||
return Parent->m_ToolBarDebug;
|
||||
}
|
||||
|
||||
// ----------
|
||||
// Events
|
||||
|
||||
void CCodeWindow::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if (event.GetKeyCode() == WXK_SPACE && event.GetModifiers() == wxMOD_NONE)
|
||||
SingleStep();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_NOTIFYMAPLOADED:
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
|
||||
case IDM_UPDATEDISASMDIALOG:
|
||||
Update();
|
||||
if (codeview) codeview->Center(PC);
|
||||
if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate();
|
||||
break;
|
||||
|
||||
case IDM_UPDATEBREAKPOINTS:
|
||||
Update();
|
||||
if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// The Play, Stop, Step, Skip, Go to PC and Show PC buttons go here
|
||||
void CCodeWindow::OnCodeStep(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_STEP:
|
||||
SingleStep();
|
||||
break;
|
||||
|
||||
case IDM_STEPOVER:
|
||||
StepOver();
|
||||
break;
|
||||
|
||||
case IDM_TOGGLE_BREAKPOINT:
|
||||
ToggleBreakpoint();
|
||||
break;
|
||||
|
||||
case IDM_SKIP:
|
||||
PC += 4;
|
||||
Update();
|
||||
break;
|
||||
|
||||
case IDM_SETPC:
|
||||
PC = codeview->GetSelection();
|
||||
Update();
|
||||
break;
|
||||
|
||||
case IDM_GOTOPC:
|
||||
JumpToAddress(PC);
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateButtonStates();
|
||||
// Update all toolbars in the aui manager
|
||||
Parent->UpdateGUI();
|
||||
}
|
||||
|
||||
void CCodeWindow::JumpToAddress(u32 _Address)
|
||||
{
|
||||
codeview->Center(_Address);
|
||||
UpdateLists();
|
||||
}
|
||||
|
||||
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
|
||||
{
|
||||
UpdateLists();
|
||||
}
|
||||
|
||||
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
|
||||
{
|
||||
if (!GetToolBar()) return;
|
||||
|
||||
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX);
|
||||
wxString txt = pAddrCtrl->GetValue();
|
||||
|
||||
std::string text(txt.mb_str());
|
||||
text = StripSpaces(text);
|
||||
if (text.size() == 8)
|
||||
{
|
||||
u32 addr;
|
||||
sscanf(text.c_str(), "%08x", &addr);
|
||||
JumpToAddress(addr);
|
||||
}
|
||||
|
||||
event.Skip(1);
|
||||
}
|
||||
|
||||
void CCodeWindow::OnCallstackListChange(wxCommandEvent& event)
|
||||
{
|
||||
int index = callstack->GetSelection();
|
||||
if (index >= 0)
|
||||
{
|
||||
u32 address = (u32)(u64)(callstack->GetClientData(index));
|
||||
if (address)
|
||||
JumpToAddress(address);
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::OnCallersListChange(wxCommandEvent& event)
|
||||
{
|
||||
int index = callers->GetSelection();
|
||||
if (index >= 0)
|
||||
{
|
||||
u32 address = (u32)(u64)(callers->GetClientData(index));
|
||||
if (address)
|
||||
JumpToAddress(address);
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::OnCallsListChange(wxCommandEvent& event)
|
||||
{
|
||||
int index = calls->GetSelection();
|
||||
if (index >= 0)
|
||||
{
|
||||
u32 address = (u32)(u64)(calls->GetClientData(index));
|
||||
if (address)
|
||||
JumpToAddress(address);
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::SingleStep()
|
||||
{
|
||||
if (CCPU::IsStepping())
|
||||
{
|
||||
CCPU::StepOpcode(&sync_event);
|
||||
wxThread::Sleep(20);
|
||||
// need a short wait here
|
||||
JumpToAddress(PC);
|
||||
Update();
|
||||
Host_UpdateLogDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::StepOver()
|
||||
{
|
||||
if (CCPU::IsStepping())
|
||||
{
|
||||
UGeckoInstruction inst = Memory::Read_Instruction(PC);
|
||||
if (inst.LK)
|
||||
{
|
||||
PowerPC::breakpoints.Add(PC + 4, true);
|
||||
CCPU::EnableStepping(false);
|
||||
JumpToAddress(PC);
|
||||
Update();
|
||||
}
|
||||
else
|
||||
SingleStep();
|
||||
|
||||
UpdateButtonStates();
|
||||
// Update all toolbars in the aui manager
|
||||
Parent->UpdateGUI();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleBreakpoint()
|
||||
{
|
||||
if (CCPU::IsStepping())
|
||||
{
|
||||
if (codeview) codeview->ToggleBreakpoint(codeview->GetSelection());
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::UpdateLists()
|
||||
{
|
||||
callers->Clear();
|
||||
u32 addr = codeview->GetSelection();
|
||||
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(addr);
|
||||
if (!symbol)
|
||||
return;
|
||||
for (int i = 0; i < (int)symbol->callers.size(); i++)
|
||||
{
|
||||
u32 caller_addr = symbol->callers[i].callAddress;
|
||||
Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
|
||||
if (caller_symbol)
|
||||
{
|
||||
int idx = callers->Append(wxString::FromAscii(StringFromFormat
|
||||
("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str()));
|
||||
callers->SetClientData(idx, (void*)caller_addr);
|
||||
}
|
||||
}
|
||||
|
||||
calls->Clear();
|
||||
for (int i = 0; i < (int)symbol->calls.size(); i++)
|
||||
{
|
||||
u32 call_addr = symbol->calls[i].function;
|
||||
Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
|
||||
if (call_symbol)
|
||||
{
|
||||
int idx = calls->Append(wxString::FromAscii(StringFromFormat
|
||||
("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str()));
|
||||
calls->SetClientData(idx, (void*)call_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::UpdateCallstack()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_STOPPING) return;
|
||||
|
||||
callstack->Clear();
|
||||
|
||||
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
||||
|
||||
bool ret = Dolphin_Debugger::GetCallstack(stack);
|
||||
|
||||
for (size_t i = 0; i < stack.size(); i++)
|
||||
{
|
||||
int idx = callstack->Append(wxString::FromAscii(stack[i].Name.c_str()));
|
||||
callstack->SetClientData(idx, (void*)(u64)stack[i].vAddress);
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
callstack->Append(wxString::FromAscii("invalid callstack"));
|
||||
}
|
||||
|
||||
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
|
||||
{
|
||||
// Configure the code window
|
||||
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
DebugInterface* di = &PowerPC::debug_interface;
|
||||
|
||||
codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW);
|
||||
sizerBig->Add(sizerLeft, 2, wxEXPAND);
|
||||
sizerBig->Add(codeview, 5, wxEXPAND);
|
||||
|
||||
sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST,
|
||||
wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND);
|
||||
sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST,
|
||||
wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
|
||||
sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition,
|
||||
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
|
||||
sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition,
|
||||
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
|
||||
|
||||
SetSizer(sizerBig);
|
||||
|
||||
sizerLeft->SetSizeHints(this);
|
||||
sizerLeft->Fit(this);
|
||||
sizerBig->SetSizeHints(this);
|
||||
sizerBig->Fit(this);
|
||||
|
||||
sync_event.Init();
|
||||
}
|
||||
|
||||
// Create CPU Mode menus
|
||||
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
|
||||
wxMenuBar *pMenuBar)
|
||||
{
|
||||
// CPU Mode
|
||||
wxMenu* pCoreMenu = new wxMenu;
|
||||
|
||||
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _("&Interpreter core"),
|
||||
wxString::FromAscii("This is necessary to get break points"
|
||||
" and stepping to work as explained in the Developer Documentation. But it can be very"
|
||||
" slow, perhaps slower than 1 fps."),
|
||||
wxITEM_CHECK);
|
||||
interpreter->Check(_LocalCoreStartupParameter.iCPUCore == 0);
|
||||
pCoreMenu->AppendSeparator();
|
||||
|
||||
pCoreMenu->Append(IDM_JITBLOCKLINKING, _("&JIT Block Linking off"),
|
||||
_("Provide safer execution by not linking the JIT blocks."),
|
||||
wxITEM_CHECK);
|
||||
|
||||
pCoreMenu->Append(IDM_JITNOBLOCKCACHE, _("&Disable JIT Cache"),
|
||||
_("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing.\n[This option must be selected before a game is started.]"),
|
||||
wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_CLEARCODECACHE, _("&Clear JIT cache"));
|
||||
|
||||
pCoreMenu->AppendSeparator();
|
||||
pCoreMenu->Append(IDM_LOGINSTRUCTIONS, _("&Log JIT instruction coverage"));
|
||||
pCoreMenu->Append(IDM_SEARCHINSTRUCTION, _("&Search for an op"));
|
||||
|
||||
pCoreMenu->AppendSeparator();
|
||||
pCoreMenu->Append(IDM_JITOFF, _("&JIT off (JIT core)"),
|
||||
_("Turn off all JIT functions, but still use the JIT core from Jit.cpp"),
|
||||
wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITLSOFF, _("&JIT LoadStore off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITLSLBZXOFF, _(" &JIT LoadStore lbzx off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITLSLXZOFF, _(" &JIT LoadStore lXz off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITLSLWZOFF, _("&JIT LoadStore lwz off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITLSFOFF, _("&JIT LoadStore Floating off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITLSPOFF, _("&JIT LoadStore Paired off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITFPOFF, _("&JIT FloatingPoint off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITIOFF, _("&JIT Integer off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITPOFF, _("&JIT Paired off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
pCoreMenu->Append(IDM_JITSROFF, _("&JIT SystemRegisters off"),
|
||||
wxEmptyString, wxITEM_CHECK);
|
||||
|
||||
pMenuBar->Append(pCoreMenu, _("&JIT"));
|
||||
|
||||
|
||||
// Debug Menu
|
||||
wxMenu* pDebugMenu = new wxMenu;
|
||||
|
||||
pDebugMenu->Append(IDM_STEP, _("Step &Into\tF11"));
|
||||
pDebugMenu->Append(IDM_STEPOVER, _("Step &Over\tF10"));
|
||||
pDebugMenu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint\tF9"));
|
||||
|
||||
pMenuBar->Append(pDebugMenu, _("&Debug"));
|
||||
|
||||
CreateMenuSymbols(pMenuBar);
|
||||
}
|
||||
|
||||
void CCodeWindow::CreateMenuOptions(wxMenu* pMenu)
|
||||
{
|
||||
wxMenuItem* boottopause = pMenu->Append(IDM_BOOTTOPAUSE, _("Boot to pause"),
|
||||
_("Start the game directly instead of booting to pause"),
|
||||
wxITEM_CHECK);
|
||||
boottopause->Check(bBootToPause);
|
||||
|
||||
wxMenuItem* automaticstart = pMenu->Append(IDM_AUTOMATICSTART, _("&Automatic start"),
|
||||
wxString::FromAscii(
|
||||
"Automatically load the Default ISO when Dolphin starts, or the last game you loaded,"
|
||||
" if you have not given it an elf file with the --elf command line. [This can be"
|
||||
" convenient if you are bug-testing with a certain game and want to rebuild"
|
||||
" and retry it several times, either with changes to Dolphin or if you are"
|
||||
" developing a homebrew game.]"),
|
||||
wxITEM_CHECK);
|
||||
automaticstart->Check(bAutomaticStart);
|
||||
|
||||
pMenu->Append(IDM_FONTPICKER, _("&Font..."), wxEmptyString, wxITEM_NORMAL);
|
||||
}
|
||||
|
||||
// CPU Mode and JIT Menu
|
||||
void CCodeWindow::OnCPUMode(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_INTERPRETER:
|
||||
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT);
|
||||
break;
|
||||
case IDM_BOOTTOPAUSE:
|
||||
bBootToPause = !bBootToPause;
|
||||
return;
|
||||
case IDM_AUTOMATICSTART:
|
||||
bAutomaticStart = !bAutomaticStart;
|
||||
return;
|
||||
case IDM_JITOFF:
|
||||
Core::g_CoreStartupParameter.bJITOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITLSOFF:
|
||||
Core::g_CoreStartupParameter.bJITLoadStoreOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITLSLXZOFF:
|
||||
Core::g_CoreStartupParameter.bJITLoadStorelXzOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITLSLWZOFF:
|
||||
Core::g_CoreStartupParameter.bJITLoadStorelwzOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITLSLBZXOFF:
|
||||
Core::g_CoreStartupParameter.bJITLoadStorelbzxOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITLSFOFF:
|
||||
Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITLSPOFF:
|
||||
Core::g_CoreStartupParameter.bJITLoadStorePairedOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITFPOFF:
|
||||
Core::g_CoreStartupParameter.bJITFloatingPointOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITIOFF:
|
||||
Core::g_CoreStartupParameter.bJITIntegerOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITPOFF:
|
||||
Core::g_CoreStartupParameter.bJITPairedOff = event.IsChecked();
|
||||
break;
|
||||
case IDM_JITSROFF:
|
||||
Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked();
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear the JIT cache to enable these changes
|
||||
if (jit)
|
||||
{
|
||||
jit->ClearCache();
|
||||
}
|
||||
// Update
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
void CCodeWindow::OnJitMenu(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_LOGINSTRUCTIONS:
|
||||
PPCTables::LogCompiledInstructions();
|
||||
break;
|
||||
|
||||
case IDM_CLEARCODECACHE:
|
||||
jit->ClearCache();
|
||||
break;
|
||||
|
||||
case IDM_SEARCHINSTRUCTION:
|
||||
{
|
||||
wxString str;
|
||||
str = wxGetTextFromUser(_T(""), wxT("Op?"), wxEmptyString, this);
|
||||
for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4)
|
||||
{
|
||||
const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr));
|
||||
if (name && !strcmp((const char *)str.mb_str(), name))
|
||||
{
|
||||
std::string mb_str(str.mb_str());
|
||||
NOTICE_LOG(POWERPC, "Found %s at %08x", mb_str.c_str(), addr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shortcuts
|
||||
bool CCodeWindow::UseInterpreter()
|
||||
{
|
||||
return GetMenuBar()->IsChecked(IDM_INTERPRETER);
|
||||
}
|
||||
|
||||
bool CCodeWindow::BootToPause()
|
||||
{
|
||||
return GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE);
|
||||
}
|
||||
|
||||
bool CCodeWindow::AutomaticStart()
|
||||
{
|
||||
return GetMenuBar()->IsChecked(IDM_AUTOMATICSTART);
|
||||
}
|
||||
|
||||
bool CCodeWindow::JITNoBlockCache()
|
||||
{
|
||||
return GetMenuBar()->IsChecked(IDM_JITNOBLOCKCACHE);
|
||||
}
|
||||
|
||||
bool CCodeWindow::JITBlockLinking()
|
||||
{
|
||||
return GetMenuBar()->IsChecked(IDM_JITBLOCKLINKING);
|
||||
}
|
||||
|
||||
// Toolbar
|
||||
void CCodeWindow::InitBitmaps()
|
||||
{
|
||||
// load original size 48x48
|
||||
m_Bitmaps[Toolbar_DebugGo] = wxGetBitmapFromMemory(toolbar_play_png);
|
||||
m_Bitmaps[Toolbar_Step] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png);
|
||||
m_Bitmaps[Toolbar_StepOver] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_DebugPause] = wxGetBitmapFromMemory(toolbar_pause_png);
|
||||
|
||||
// scale to 24x24 for toolbar
|
||||
for (size_t n = Toolbar_DebugGo; n < ToolbarDebugBitmapMax; n++)
|
||||
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24));
|
||||
}
|
||||
|
||||
void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
|
||||
{
|
||||
int w = m_Bitmaps[Toolbar_DebugGo].GetWidth(),
|
||||
h = m_Bitmaps[Toolbar_DebugGo].GetHeight();
|
||||
|
||||
toolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
|
||||
toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
|
||||
toolBar->AddTool(IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip]);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
|
||||
toolBar->AddTool(IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC]);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, _T("")));
|
||||
|
||||
toolBar->Realize();
|
||||
}
|
||||
|
||||
// Update GUI
|
||||
void CCodeWindow::Update()
|
||||
{
|
||||
if (!codeview) return;
|
||||
|
||||
codeview->Refresh();
|
||||
UpdateCallstack();
|
||||
UpdateButtonStates();
|
||||
|
||||
// Do not automatically show the current PC position when a breakpoint is hit or
|
||||
// when we pause since this can be called at other times too.
|
||||
//codeview->Center(PC);
|
||||
}
|
||||
|
||||
void CCodeWindow::UpdateButtonStates()
|
||||
{
|
||||
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
|
||||
bool Pause = (Core::GetState() == Core::CORE_PAUSE);
|
||||
bool Stepping = CCPU::IsStepping();
|
||||
wxAuiToolBar* ToolBar = GetToolBar();
|
||||
|
||||
// Toolbar
|
||||
if (!ToolBar) return;
|
||||
|
||||
if (!Initialized)
|
||||
{
|
||||
ToolBar->EnableTool(IDM_STEPOVER, false);
|
||||
ToolBar->EnableTool(IDM_SKIP, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Stepping)
|
||||
{
|
||||
ToolBar->EnableTool(IDM_STEPOVER, false);
|
||||
ToolBar->EnableTool(IDM_SKIP, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolBar->EnableTool(IDM_STEPOVER, true);
|
||||
ToolBar->EnableTool(IDM_SKIP, true);
|
||||
}
|
||||
}
|
||||
|
||||
ToolBar->EnableTool(IDM_STEP, Initialized && Stepping);
|
||||
|
||||
if (ToolBar) ToolBar->Realize();
|
||||
|
||||
// Menu bar
|
||||
// ------------------
|
||||
GetMenuBar()->Enable(IDM_INTERPRETER, Pause); // CPU Mode
|
||||
|
||||
GetMenuBar()->Enable(IDM_JITNOBLOCKCACHE, !Initialized);
|
||||
|
||||
GetMenuBar()->Enable(IDM_JITOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITLSOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITLSLXZOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITLSLWZOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITLSLBZXOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITLSFOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITLSPOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITFPOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITIOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITPOFF, Pause);
|
||||
GetMenuBar()->Enable(IDM_JITSROFF, Pause);
|
||||
|
||||
GetMenuBar()->Enable(IDM_CLEARCODECACHE, Pause); // JIT Menu
|
||||
GetMenuBar()->Enable(IDM_SEARCHINSTRUCTION, Initialized);
|
||||
|
||||
GetMenuBar()->Enable(IDM_CLEARSYMBOLS, Initialized); // Symbols menu
|
||||
GetMenuBar()->Enable(IDM_SCANFUNCTIONS, Initialized);
|
||||
GetMenuBar()->Enable(IDM_LOADMAPFILE, Initialized);
|
||||
GetMenuBar()->Enable(IDM_SAVEMAPFILE, Initialized);
|
||||
GetMenuBar()->Enable(IDM_SAVEMAPFILEWITHCODES, Initialized);
|
||||
GetMenuBar()->Enable(IDM_CREATESIGNATUREFILE, Initialized);
|
||||
GetMenuBar()->Enable(IDM_RENAME_SYMBOLS, Initialized);
|
||||
GetMenuBar()->Enable(IDM_USESIGNATUREFILE, Initialized);
|
||||
GetMenuBar()->Enable(IDM_PATCHHLEFUNCTIONS, Initialized);
|
||||
|
||||
// Update Fonts
|
||||
callstack->SetFont(DebuggerFont);
|
||||
symbols->SetFont(DebuggerFont);
|
||||
callers->SetFont(DebuggerFont);
|
||||
calls->SetFont(DebuggerFont);
|
||||
}
|
161
Source/Core/DolphinWX/Src/Debugger/CodeWindow.h
Normal file
161
Source/Core/DolphinWX/Src/Debugger/CodeWindow.h
Normal file
@ -0,0 +1,161 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
|
||||
#ifndef CODEWINDOW_H_
|
||||
#define CODEWINDOW_H_
|
||||
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/artprov.h>
|
||||
|
||||
#include "Thread.h"
|
||||
#include "CoreParameter.h"
|
||||
|
||||
// GUI global
|
||||
#include "../../DolphinWX/Src/Globals.h"
|
||||
#include "../../DolphinWX/Src/Frame.h"
|
||||
|
||||
class CFrame;
|
||||
class CRegisterWindow;
|
||||
class CBreakPointWindow;
|
||||
class CMemoryWindow;
|
||||
class CJitWindow;
|
||||
class CCodeView;
|
||||
class DSPDebuggerLLE;
|
||||
class GFXDebuggerPanel;
|
||||
|
||||
class CCodeWindow
|
||||
: public wxPanel
|
||||
{
|
||||
public:
|
||||
|
||||
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
|
||||
CFrame * parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
|
||||
const wxString& name = _("Code")
|
||||
);
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
// Parent interaction
|
||||
CFrame *Parent;
|
||||
wxMenuBar * GetMenuBar();
|
||||
wxAuiToolBar * GetToolBar();
|
||||
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
|
||||
|
||||
bool UseInterpreter();
|
||||
bool BootToPause();
|
||||
bool AutomaticStart();
|
||||
bool JITNoBlockCache();
|
||||
bool JITBlockLinking();
|
||||
void JumpToAddress(u32 _Address);
|
||||
|
||||
void Update();
|
||||
void NotifyMapLoaded();
|
||||
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
|
||||
wxMenuBar *pMenuBar);
|
||||
void CreateMenuOptions(wxMenu *pMenu);
|
||||
void CreateMenuSymbols(wxMenuBar *pMenuBar);
|
||||
void RecreateToolbar(wxAuiToolBar*);
|
||||
void PopulateToolbar(wxAuiToolBar* toolBar);
|
||||
void UpdateButtonStates();
|
||||
void OpenPages();
|
||||
void UpdateManager();
|
||||
|
||||
// Menu bar
|
||||
// -------------------
|
||||
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
|
||||
void OnJITOff(wxCommandEvent& event);
|
||||
|
||||
void ToggleCodeWindow(bool bShow);
|
||||
void ToggleRegisterWindow(bool bShow);
|
||||
void ToggleBreakPointWindow(bool bShow);
|
||||
void ToggleMemoryWindow(bool bShow);
|
||||
void ToggleJitWindow(bool bShow);
|
||||
void ToggleSoundWindow(bool bShow);
|
||||
void ToggleVideoWindow(bool bShow);
|
||||
|
||||
void OnChangeFont(wxCommandEvent& event);
|
||||
|
||||
void OnCodeStep(wxCommandEvent& event);
|
||||
void OnAddrBoxChange(wxCommandEvent& event);
|
||||
void OnSymbolsMenu(wxCommandEvent& event);
|
||||
void OnJitMenu(wxCommandEvent& event);
|
||||
void OnProfilerMenu(wxCommandEvent& event);
|
||||
|
||||
// Sub dialogs
|
||||
CRegisterWindow* m_RegisterWindow;
|
||||
CBreakPointWindow* m_BreakpointWindow;
|
||||
CMemoryWindow* m_MemoryWindow;
|
||||
CJitWindow* m_JitWindow;
|
||||
DSPDebuggerLLE* m_SoundWindow;
|
||||
GFXDebuggerPanel* m_VideoWindow;
|
||||
|
||||
// Settings
|
||||
bool bAutomaticStart; bool bBootToPause;
|
||||
bool bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
|
||||
int iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
// Debugger GUI Objects
|
||||
ID_CODEVIEW,
|
||||
ID_CALLSTACKLIST,
|
||||
ID_CALLERSLIST,
|
||||
ID_CALLSLIST,
|
||||
ID_SYMBOLLIST
|
||||
};
|
||||
|
||||
void OnSymbolListChange(wxCommandEvent& event);
|
||||
void OnSymbolListContextMenu(wxContextMenuEvent& event);
|
||||
void OnCallstackListChange(wxCommandEvent& event);
|
||||
void OnCallersListChange(wxCommandEvent& event);
|
||||
void OnCallsListChange(wxCommandEvent& event);
|
||||
void OnCodeViewChange(wxCommandEvent &event);
|
||||
void OnHostMessage(wxCommandEvent& event);
|
||||
|
||||
// Debugger functions
|
||||
void SingleStep();
|
||||
void StepOver();
|
||||
void ToggleBreakpoint();
|
||||
|
||||
void UpdateLists();
|
||||
void UpdateCallstack();
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
|
||||
void InitBitmaps();
|
||||
void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
|
||||
|
||||
CCodeView* codeview;
|
||||
wxListBox* callstack;
|
||||
wxListBox* symbols;
|
||||
wxListBox* callers;
|
||||
wxListBox* calls;
|
||||
Common::Event sync_event;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // CODEWINDOW_H_
|
551
Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp
Normal file
551
Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp
Normal file
@ -0,0 +1,551 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "Common.h"
|
||||
#include "CommonPaths.h"
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/textdlg.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/tipwin.h>
|
||||
#include <wx/fontdlg.h>
|
||||
|
||||
#include "../../DolphinWX/Src/WxUtils.h"
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
#include "DebuggerUIUtil.h"
|
||||
|
||||
#include "RegisterWindow.h"
|
||||
#include "BreakpointWindow.h"
|
||||
#include "MemoryWindow.h"
|
||||
#include "JitWindow.h"
|
||||
#include "DebuggerPanel.h"
|
||||
#include "DSPDebugWindow.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include "CodeWindow.h"
|
||||
#include "CodeView.h"
|
||||
|
||||
#include "Core.h"
|
||||
#include "HLE/HLE.h"
|
||||
#include "Boot/Boot.h"
|
||||
#include "LogManager.h"
|
||||
#include "HW/CPU.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "Debugger/PPCDebugInterface.h"
|
||||
#include "Debugger/Debugger_SymbolMap.h"
|
||||
#include "PowerPC/PPCAnalyst.h"
|
||||
#include "PowerPC/Profiler.h"
|
||||
#include "PowerPC/PPCSymbolDB.h"
|
||||
#include "PowerPC/SignatureDB.h"
|
||||
#include "PowerPC/PPCTables.h"
|
||||
#include "PowerPC/JitCommon/JitBase.h"
|
||||
#include "PowerPC/JitCommon/JitCache.h" // for ClearCache()
|
||||
|
||||
#include "ConfigManager.h"
|
||||
|
||||
extern "C" // Bitmaps
|
||||
{
|
||||
#include "../../resources/toolbar_play.c"
|
||||
#include "../../resources/toolbar_pause.c"
|
||||
#include "../../resources/toolbar_add_memorycheck.c"
|
||||
#include "../../resources/toolbar_debugger_delete.c"
|
||||
#include "../../resources/toolbar_add_breakpoint.c"
|
||||
}
|
||||
|
||||
// Save and load settings
|
||||
// -----------------------------
|
||||
void CCodeWindow::Load()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
|
||||
// The font to override DebuggerFont with
|
||||
std::string fontDesc;
|
||||
ini.Get("General", "DebuggerFont", &fontDesc);
|
||||
if (!fontDesc.empty())
|
||||
DebuggerFont.SetNativeFontInfoUserDesc(wxString::FromAscii(fontDesc.c_str()));
|
||||
|
||||
// Boot to pause or not
|
||||
ini.Get("General", "AutomaticStart", &bAutomaticStart, false);
|
||||
ini.Get("General", "BootToPause", &bBootToPause, true);
|
||||
|
||||
const char* SettingName[] = {
|
||||
"Log",
|
||||
"Console",
|
||||
"Registers",
|
||||
"Breakpoints",
|
||||
"Memory",
|
||||
"JIT",
|
||||
"Sound",
|
||||
"Video",
|
||||
"Code"
|
||||
};
|
||||
|
||||
// Decide what windows to show
|
||||
for (int i = 0; i <= IDM_VIDEOWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Get("ShowOnStart", SettingName[i], &bShowOnStart[i], false);
|
||||
|
||||
// Get notebook affiliation
|
||||
std::string _Section = "P - " +
|
||||
((Parent->ActivePerspective < Parent->Perspectives.size())
|
||||
? Parent->Perspectives[Parent->ActivePerspective].Name : "Perspective 1");
|
||||
|
||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Get(_Section.c_str(), SettingName[i], &iNbAffiliation[i], 0);
|
||||
|
||||
// Get floating setting
|
||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Get("Float", SettingName[i], &Parent->bFloatWindow[i], false);
|
||||
}
|
||||
|
||||
void CCodeWindow::Save()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
|
||||
ini.Set("General", "DebuggerFont",
|
||||
std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()));
|
||||
|
||||
// Boot to pause or not
|
||||
ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
|
||||
ini.Set("General", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
|
||||
|
||||
const char* SettingName[] = {
|
||||
"Log",
|
||||
"Console",
|
||||
"Registers",
|
||||
"Breakpoints",
|
||||
"Memory",
|
||||
"JIT",
|
||||
"Sound",
|
||||
"Video",
|
||||
"Code"
|
||||
};
|
||||
|
||||
// Save windows settings
|
||||
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
|
||||
ini.Set("ShowOnStart", SettingName[i - IDM_LOGWINDOW], GetMenuBar()->IsChecked(i));
|
||||
|
||||
// Save notebook affiliations
|
||||
std::string _Section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name;
|
||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Set(_Section.c_str(), SettingName[i], iNbAffiliation[i]);
|
||||
|
||||
// Save floating setting
|
||||
for (int i = IDM_LOGWINDOW_PARENT; i <= IDM_CODEWINDOW_PARENT; i++)
|
||||
ini.Set("Float", SettingName[i - IDM_LOGWINDOW_PARENT], !!FindWindowById(i));
|
||||
|
||||
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
}
|
||||
|
||||
// Symbols, JIT, Profiler
|
||||
// ----------------
|
||||
void CCodeWindow::CreateMenuSymbols(wxMenuBar *pMenuBar)
|
||||
{
|
||||
wxMenu *pSymbolsMenu = new wxMenu;
|
||||
pSymbolsMenu->Append(IDM_CLEARSYMBOLS, _("&Clear symbols"));
|
||||
// pSymbolsMenu->Append(IDM_CLEANSYMBOLS, _("&Clean symbols (zz)"));
|
||||
pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _("&Generate symbol map"));
|
||||
pSymbolsMenu->AppendSeparator();
|
||||
pSymbolsMenu->Append(IDM_LOADMAPFILE, _("&Load symbol map"));
|
||||
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _("&Save symbol map"));
|
||||
pSymbolsMenu->AppendSeparator();
|
||||
pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _("Save code"),
|
||||
wxString::FromAscii("Save the entire disassembled code. This may take a several seconds"
|
||||
" and may require between 50 and 100 MB of hard drive space. It will only save code"
|
||||
" that are in the first 4 MB of memory, if you are debugging a game that load .rel"
|
||||
" files with code to memory you may want to increase that to perhaps 8 MB, you can do"
|
||||
" that from SymbolDB::SaveMap().")
|
||||
);
|
||||
|
||||
pSymbolsMenu->AppendSeparator();
|
||||
pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _("&Create signature file..."));
|
||||
pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _("&Use signature file..."));
|
||||
pSymbolsMenu->AppendSeparator();
|
||||
pSymbolsMenu->Append(IDM_PATCHHLEFUNCTIONS, _("&Patch HLE functions"));
|
||||
pSymbolsMenu->Append(IDM_RENAME_SYMBOLS, _("&Rename symbols from file..."));
|
||||
pMenuBar->Append(pSymbolsMenu, _("&Symbols"));
|
||||
|
||||
wxMenu *pProfilerMenu = new wxMenu;
|
||||
pProfilerMenu->Append(IDM_PROFILEBLOCKS, _("&Profile blocks"), wxEmptyString, wxITEM_CHECK);
|
||||
pProfilerMenu->AppendSeparator();
|
||||
pProfilerMenu->Append(IDM_WRITEPROFILE, _("&Write to profile.txt, show"));
|
||||
pMenuBar->Append(pProfilerMenu, _("&Profiler"));
|
||||
}
|
||||
|
||||
void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_PROFILEBLOCKS:
|
||||
if (jit != NULL) jit->ClearCache();
|
||||
Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS);
|
||||
break;
|
||||
case IDM_WRITEPROFILE:
|
||||
Profiler::WriteProfileResults("profiler.txt");
|
||||
WxUtils::Launch("profiler.txt");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
||||
{
|
||||
Parent->ClearStatusBar();
|
||||
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
||||
|
||||
std::string mapfile = CBoot::GenerateMapFilename();
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_CLEARSYMBOLS:
|
||||
if(!AskYesNo("Do you want to clear the list of symbol names?")) return;
|
||||
g_symbolDB.Clear();
|
||||
Host_NotifyMapLoaded();
|
||||
break;
|
||||
case IDM_CLEANSYMBOLS:
|
||||
g_symbolDB.Clear("zz");
|
||||
Host_NotifyMapLoaded();
|
||||
break;
|
||||
case IDM_SCANFUNCTIONS:
|
||||
{
|
||||
PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB);
|
||||
SignatureDB db;
|
||||
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
||||
{
|
||||
db.Apply(&g_symbolDB);
|
||||
Parent->StatusBarMessage("Generated symbol names from '%s'", TOTALDB);
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent->StatusBarMessage("'%s' not found, no symbol names generated", TOTALDB);
|
||||
}
|
||||
// HLE::PatchFunctions();
|
||||
// Update GUI
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
}
|
||||
case IDM_LOADMAPFILE:
|
||||
if (!File::Exists(mapfile.c_str()))
|
||||
{
|
||||
g_symbolDB.Clear();
|
||||
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
|
||||
SignatureDB db;
|
||||
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
||||
db.Apply(&g_symbolDB);
|
||||
Parent->StatusBarMessage("'%s' not found, scanning for common functions instead", mapfile.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
g_symbolDB.LoadMap(mapfile.c_str());
|
||||
Parent->StatusBarMessage("Loaded symbols from '%s'", mapfile.c_str());
|
||||
}
|
||||
HLE::PatchFunctions();
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
case IDM_SAVEMAPFILE:
|
||||
g_symbolDB.SaveMap(mapfile.c_str());
|
||||
break;
|
||||
case IDM_SAVEMAPFILEWITHCODES:
|
||||
g_symbolDB.SaveMap(mapfile.c_str(), true);
|
||||
break;
|
||||
|
||||
case IDM_RENAME_SYMBOLS:
|
||||
{
|
||||
wxString path = wxFileSelector(
|
||||
_("Apply signature file"), wxEmptyString,
|
||||
wxEmptyString, wxEmptyString,
|
||||
_T("Dolphin Symbol Rename File (*.sym)|*.sym"),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
|
||||
if (! path.IsEmpty())
|
||||
{
|
||||
FILE *f = fopen(path.mb_str(), "r");
|
||||
if (!f)
|
||||
return;
|
||||
|
||||
while (!feof(f))
|
||||
{
|
||||
char line[512];
|
||||
fgets(line, 511, f);
|
||||
if (strlen(line) < 4)
|
||||
continue;
|
||||
|
||||
u32 address, type;
|
||||
char name[512];
|
||||
sscanf(line, "%08x %02i %s", &address, &type, name);
|
||||
|
||||
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(address);
|
||||
if (symbol) {
|
||||
symbol->name = line+12;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
Host_NotifyMapLoaded();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_CREATESIGNATUREFILE:
|
||||
{
|
||||
wxTextEntryDialog input_prefix(
|
||||
this,
|
||||
wxString::FromAscii("Only export symbols with prefix:\n(Blank for all symbols)"),
|
||||
wxGetTextFromUserPromptStr,
|
||||
wxEmptyString);
|
||||
|
||||
if (input_prefix.ShowModal() == wxID_OK)
|
||||
{
|
||||
std::string prefix(input_prefix.GetValue().mb_str());
|
||||
|
||||
wxString path = wxFileSelector(
|
||||
_T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString,
|
||||
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_SAVE,
|
||||
this);
|
||||
if (!path.IsEmpty())
|
||||
{
|
||||
SignatureDB db;
|
||||
db.Initialize(&g_symbolDB, prefix.c_str());
|
||||
std::string filename(path.mb_str());
|
||||
db.Save(path.mb_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDM_USESIGNATUREFILE:
|
||||
{
|
||||
wxString path = wxFileSelector(
|
||||
_T("Apply signature file"), wxEmptyString, wxEmptyString, wxEmptyString,
|
||||
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_OPEN | wxFD_FILE_MUST_EXIST,
|
||||
this);
|
||||
if (!path.IsEmpty())
|
||||
{
|
||||
SignatureDB db;
|
||||
db.Load(path.mb_str());
|
||||
db.Apply(&g_symbolDB);
|
||||
}
|
||||
}
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
case IDM_PATCHHLEFUNCTIONS:
|
||||
HLE::PatchFunctions();
|
||||
Update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::NotifyMapLoaded()
|
||||
{
|
||||
if (!codeview) return;
|
||||
|
||||
g_symbolDB.FillInCallers();
|
||||
//symbols->Show(false); // hide it for faster filling
|
||||
symbols->Freeze(); // HyperIris: wx style fast filling
|
||||
symbols->Clear();
|
||||
for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter)
|
||||
{
|
||||
int idx = symbols->Append(wxString::FromAscii(iter->second.name.c_str()));
|
||||
symbols->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
symbols->Thaw();
|
||||
//symbols->Show(true);
|
||||
Update();
|
||||
}
|
||||
|
||||
void CCodeWindow::OnSymbolListChange(wxCommandEvent& event)
|
||||
{
|
||||
int index = symbols->GetSelection();
|
||||
if (index >= 0) {
|
||||
Symbol* pSymbol = static_cast<Symbol *>(symbols->GetClientData(index));
|
||||
if (pSymbol != NULL)
|
||||
{
|
||||
if(pSymbol->type == Symbol::SYMBOL_DATA)
|
||||
{
|
||||
if(m_MemoryWindow)// && m_MemoryWindow->IsVisible())
|
||||
m_MemoryWindow->JumpToAddress(pSymbol->address);
|
||||
}
|
||||
else
|
||||
{
|
||||
JumpToAddress(pSymbol->address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
// Change the global DebuggerFont
|
||||
void CCodeWindow::OnChangeFont(wxCommandEvent& event)
|
||||
{
|
||||
wxFontData data;
|
||||
data.SetInitialFont(DebuggerFont);
|
||||
|
||||
wxFontDialog dialog(this, data);
|
||||
if ( dialog.ShowModal() == wxID_OK )
|
||||
DebuggerFont = dialog.GetFontData().GetChosenFont();
|
||||
}
|
||||
|
||||
// Toogle windows
|
||||
|
||||
void CCodeWindow::OpenPages()
|
||||
{
|
||||
ToggleCodeWindow(true);
|
||||
if (bShowOnStart[0])
|
||||
Parent->ToggleLogWindow(true);
|
||||
if (bShowOnStart[IDM_CONSOLEWINDOW - IDM_LOGWINDOW])
|
||||
Parent->ToggleConsole(true);
|
||||
if (bShowOnStart[IDM_REGISTERWINDOW - IDM_LOGWINDOW])
|
||||
ToggleRegisterWindow(true);
|
||||
if (bShowOnStart[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW])
|
||||
ToggleBreakPointWindow(true);
|
||||
if (bShowOnStart[IDM_MEMORYWINDOW - IDM_LOGWINDOW])
|
||||
ToggleMemoryWindow(true);
|
||||
if (bShowOnStart[IDM_JITWINDOW - IDM_LOGWINDOW])
|
||||
ToggleJitWindow(true);
|
||||
if (bShowOnStart[IDM_SOUNDWINDOW - IDM_LOGWINDOW])
|
||||
ToggleSoundWindow(true);
|
||||
if (bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW])
|
||||
ToggleVideoWindow(true);
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleCodeWindow(bool bShow)
|
||||
{
|
||||
if (bShow)
|
||||
Parent->DoAddPage(this,
|
||||
iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]);
|
||||
else // Hide
|
||||
Parent->DoRemovePage(this);
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleRegisterWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_RegisterWindow)
|
||||
m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW);
|
||||
Parent->DoAddPage(m_RegisterWindow,
|
||||
iNbAffiliation[IDM_REGISTERWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_RegisterWindow, false);
|
||||
m_RegisterWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleBreakPointWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_BreakpointWindow)
|
||||
m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW);
|
||||
Parent->DoAddPage(m_BreakpointWindow,
|
||||
iNbAffiliation[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_BreakpointWindow, false);
|
||||
m_BreakpointWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleMemoryWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_MemoryWindow)
|
||||
m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW);
|
||||
Parent->DoAddPage(m_MemoryWindow,
|
||||
iNbAffiliation[IDM_MEMORYWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_MemoryWindow, false);
|
||||
m_MemoryWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleJitWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_JitWindow)
|
||||
m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW);
|
||||
Parent->DoAddPage(m_JitWindow,
|
||||
iNbAffiliation[IDM_JITWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_JitWindow, false);
|
||||
m_JitWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCodeWindow::ToggleSoundWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_SoundWindow)
|
||||
m_SoundWindow = new DSPDebuggerLLE(Parent, IDM_SOUNDWINDOW);
|
||||
Parent->DoAddPage(m_SoundWindow,
|
||||
iNbAffiliation[IDM_SOUNDWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_SoundWindow, false);
|
||||
m_SoundWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleVideoWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_VideoWindow)
|
||||
m_VideoWindow = new GFXDebuggerPanel(Parent, IDM_VIDEOWINDOW);
|
||||
Parent->DoAddPage(m_VideoWindow,
|
||||
iNbAffiliation[IDM_VIDEOWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_VideoWindow, false);
|
||||
m_VideoWindow = NULL;
|
||||
}
|
||||
}
|
294
Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.cpp
Normal file
294
Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.cpp
Normal file
@ -0,0 +1,294 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "Common.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <wx/artprov.h>
|
||||
|
||||
#include "StringUtil.h"
|
||||
#include "DSPDebugWindow.h"
|
||||
#include "DSPRegisterView.h"
|
||||
#include "CodeView.h"
|
||||
#include "MemoryView.h"
|
||||
#include "HW/DSPLLE/DSPSymbols.h"
|
||||
|
||||
DSPDebuggerLLE* m_DebuggerFrame = NULL;
|
||||
|
||||
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxPanel)
|
||||
EVT_CLOSE(DSPDebuggerLLE::OnClose)
|
||||
EVT_MENU_RANGE(ID_RUNTOOL, ID_SHOWPCTOOL, DSPDebuggerLLE::OnChangeState)
|
||||
EVT_TEXT_ENTER(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
|
||||
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id)
|
||||
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
wxTAB_TRAVERSAL, _("DSP LLE Debugger"))
|
||||
, m_CachedStepCounter(-1)
|
||||
{
|
||||
m_DebuggerFrame = this;
|
||||
|
||||
// notify wxAUI which frame to use
|
||||
m_mgr.SetManagedWindow(this);
|
||||
m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
|
||||
|
||||
m_Toolbar = new wxAuiToolBar(this, ID_TOOLBAR,
|
||||
wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_TEXT);
|
||||
m_Toolbar->AddTool(ID_RUNTOOL, wxT("Pause"),
|
||||
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
|
||||
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"),
|
||||
wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_OTHER, wxSize(10,10)));
|
||||
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show PC"),
|
||||
wxArtProvider::GetBitmap(wxART_GO_TO_PARENT, wxART_OTHER, wxSize(10,10)));
|
||||
m_Toolbar->AddSeparator();
|
||||
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER));
|
||||
m_Toolbar->Realize();
|
||||
|
||||
m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition,
|
||||
wxSize(140, 100), 0, NULL, wxLB_SORT);
|
||||
|
||||
m_MainNotebook = new wxAuiNotebook(this, wxID_ANY,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE);
|
||||
|
||||
wxPanel *code_panel = new wxPanel(m_MainNotebook, wxID_ANY);
|
||||
wxBoxSizer *code_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, code_panel);
|
||||
m_CodeView->SetPlain();
|
||||
code_sizer->Add(m_CodeView, 1, wxALL | wxEXPAND);
|
||||
code_panel->SetSizer(code_sizer);
|
||||
code_sizer->SetSizeHints(code_panel);
|
||||
m_MainNotebook->AddPage(code_panel, wxT("Disasm"), true);
|
||||
|
||||
wxPanel *mem_panel = new wxPanel(m_MainNotebook, wxID_ANY);
|
||||
wxBoxSizer *mem_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
// TODO insert memViewer class
|
||||
m_MemView = new CMemoryView(&debug_interface, mem_panel);
|
||||
mem_sizer->Add(m_MemView, 1, wxALL | wxEXPAND);
|
||||
mem_panel->SetSizer(mem_sizer);
|
||||
mem_sizer->SetSizeHints(mem_panel);
|
||||
m_MainNotebook->AddPage(mem_panel, wxT("Mem"));
|
||||
|
||||
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
|
||||
|
||||
// add the panes to the manager
|
||||
m_mgr.AddPane(m_Toolbar, wxAuiPaneInfo().
|
||||
ToolbarPane().Top().
|
||||
LeftDockable(false).RightDockable(false));
|
||||
|
||||
m_mgr.AddPane(m_SymbolList, wxAuiPaneInfo().
|
||||
Left().CloseButton(false).
|
||||
Caption(wxT("Symbols")).Dockable(true));
|
||||
|
||||
m_mgr.AddPane(m_MainNotebook, wxAuiPaneInfo().
|
||||
Name(wxT("m_MainNotebook")).Center().
|
||||
CloseButton(false).MaximizeButton(true));
|
||||
|
||||
m_mgr.AddPane(m_Regs, wxAuiPaneInfo().Right().
|
||||
CloseButton(false).Caption(wxT("Registers")).
|
||||
Dockable(true));
|
||||
|
||||
UpdateState();
|
||||
|
||||
m_mgr.Update();
|
||||
}
|
||||
|
||||
DSPDebuggerLLE::~DSPDebuggerLLE()
|
||||
{
|
||||
m_mgr.UnInit();
|
||||
m_DebuggerFrame = NULL;
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
|
||||
{
|
||||
if (DSPCore_GetState() == DSPCORE_STOP)
|
||||
return;
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_RUNTOOL:
|
||||
if (DSPCore_GetState() == DSPCORE_RUNNING)
|
||||
DSPCore_SetState(DSPCORE_STEPPING);
|
||||
else
|
||||
DSPCore_SetState(DSPCORE_RUNNING);
|
||||
break;
|
||||
|
||||
case ID_STEPTOOL:
|
||||
if (DSPCore_GetState() == DSPCORE_STEPPING)
|
||||
{
|
||||
DSPCore_Step();
|
||||
Refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_SHOWPCTOOL:
|
||||
FocusOnPC();
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
m_mgr.Update();
|
||||
}
|
||||
|
||||
void Host_RefreshDSPDebuggerWindow()
|
||||
{
|
||||
if (m_DebuggerFrame)
|
||||
m_DebuggerFrame->Refresh();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::Refresh()
|
||||
{
|
||||
#if defined __WXGTK__
|
||||
if (!wxIsMainThread())
|
||||
wxMutexGuiEnter();
|
||||
#endif
|
||||
UpdateSymbolMap();
|
||||
UpdateDisAsmListView();
|
||||
UpdateRegisterFlags();
|
||||
UpdateState();
|
||||
m_mgr.Update();
|
||||
#if defined __WXGTK__
|
||||
if (!wxIsMainThread())
|
||||
wxMutexGuiLeave();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::FocusOnPC()
|
||||
{
|
||||
JumpToAddress(g_dsp.pc);
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::UpdateState()
|
||||
{
|
||||
if (DSPCore_GetState() == DSPCORE_RUNNING)
|
||||
{
|
||||
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Pause"));
|
||||
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
|
||||
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
|
||||
m_Toolbar->EnableTool(ID_STEPTOOL, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Run"));
|
||||
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
|
||||
wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_OTHER, wxSize(10,10)));
|
||||
m_Toolbar->EnableTool(ID_STEPTOOL, true);
|
||||
}
|
||||
m_Toolbar->Realize();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::UpdateDisAsmListView()
|
||||
{
|
||||
if (m_CachedStepCounter == g_dsp.step_counter)
|
||||
return;
|
||||
|
||||
// show PC
|
||||
FocusOnPC();
|
||||
m_CachedStepCounter = g_dsp.step_counter;
|
||||
m_Regs->Update();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::UpdateSymbolMap()
|
||||
{
|
||||
if (g_dsp.dram == NULL)
|
||||
return;
|
||||
|
||||
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
|
||||
m_SymbolList->Clear();
|
||||
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
|
||||
iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter)
|
||||
{
|
||||
int idx = m_SymbolList->Append(wxString::FromAscii(iter->second.name.c_str()));
|
||||
m_SymbolList->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
m_SymbolList->Thaw();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
|
||||
{
|
||||
int index = m_SymbolList->GetSelection();
|
||||
if (index >= 0) {
|
||||
Symbol* pSymbol = static_cast<Symbol *>(m_SymbolList->GetClientData(index));
|
||||
if (pSymbol != NULL)
|
||||
{
|
||||
if (pSymbol->type == Symbol::SYMBOL_FUNCTION)
|
||||
{
|
||||
JumpToAddress(pSymbol->address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::UpdateRegisterFlags()
|
||||
{
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnAddrBoxChange(wxCommandEvent& event)
|
||||
{
|
||||
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_Toolbar->FindControl(ID_ADDRBOX);
|
||||
wxString txt = pAddrCtrl->GetValue();
|
||||
|
||||
std::string text(txt.mb_str());
|
||||
text = StripSpaces(text);
|
||||
if (text.size())
|
||||
{
|
||||
u32 addr;
|
||||
sscanf(text.c_str(), "%04x", &addr);
|
||||
if (JumpToAddress(addr))
|
||||
pAddrCtrl->SetBackgroundColour(*wxWHITE);
|
||||
else
|
||||
pAddrCtrl->SetBackgroundColour(*wxRED);
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
bool DSPDebuggerLLE::JumpToAddress(u16 addr)
|
||||
{
|
||||
int page = m_MainNotebook->GetSelection();
|
||||
if (page == 0)
|
||||
{
|
||||
// Center on valid instruction in IRAM/IROM
|
||||
int new_line = DSPSymbols::Addr2Line(addr);
|
||||
if (new_line >= 0) {
|
||||
m_CodeView->Center(new_line);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (page == 1)
|
||||
{
|
||||
// Center on any location in any valid ROM/RAM
|
||||
int seg = addr >> 12;
|
||||
if (seg == 0 || seg == 1 ||
|
||||
seg == 8 || seg == 0xf)
|
||||
{
|
||||
m_MemView->Center(addr);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
102
Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.h
Normal file
102
Source/Core/DolphinWX/Src/Debugger/DSPDebugWindow.h
Normal file
@ -0,0 +1,102 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef _DSP_DEBUGGER_LLE_H
|
||||
#define _DSP_DEBUGGER_LLE_H
|
||||
|
||||
// general things
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/aui/aui.h>
|
||||
|
||||
#include "DSP/disassemble.h"
|
||||
#include "DSP/DSPInterpreter.h"
|
||||
#include "DSP/DSPMemoryMap.h"
|
||||
#include "HW/DSPLLE/DSPDebugInterface.h"
|
||||
|
||||
class DSPRegisterView;
|
||||
class CCodeView;
|
||||
class CMemoryView;
|
||||
|
||||
class DSPDebuggerLLE : public wxPanel
|
||||
{
|
||||
public:
|
||||
DSPDebuggerLLE(wxWindow *parent, wxWindowID id = wxID_ANY);
|
||||
virtual ~DSPDebuggerLLE();
|
||||
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
enum
|
||||
{
|
||||
ID_TOOLBAR = 1000,
|
||||
ID_RUNTOOL,
|
||||
ID_STEPTOOL,
|
||||
ID_SHOWPCTOOL,
|
||||
ID_ADDRBOX,
|
||||
ID_SYMBOLLIST,
|
||||
ID_DSP_REGS
|
||||
};
|
||||
|
||||
DSPDebugInterface debug_interface;
|
||||
u64 m_CachedStepCounter;
|
||||
|
||||
// GUI updaters
|
||||
void UpdateDisAsmListView();
|
||||
void UpdateRegisterFlags();
|
||||
void UpdateSymbolMap();
|
||||
void UpdateState();
|
||||
|
||||
// GUI items
|
||||
wxAuiManager m_mgr;
|
||||
wxAuiToolBar* m_Toolbar;
|
||||
CCodeView* m_CodeView;
|
||||
CMemoryView* m_MemView;
|
||||
DSPRegisterView* m_Regs;
|
||||
wxListBox* m_SymbolList;
|
||||
wxAuiNotebook* m_MainNotebook;
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnChangeState(wxCommandEvent& event);
|
||||
//void OnRightClick(wxListEvent& event);
|
||||
//void OnDoubleClick(wxListEvent& event);
|
||||
void OnAddrBoxChange(wxCommandEvent& event);
|
||||
void OnSymbolListChange(wxCommandEvent& event);
|
||||
|
||||
bool JumpToAddress(u16 addr);
|
||||
|
||||
void FocusOnPC();
|
||||
//void UnselectAll();
|
||||
};
|
||||
|
||||
extern DSPDebuggerLLE* m_DebuggerFrame;
|
||||
|
||||
#endif //_DSP_DEBUGGER_LLE_H
|
94
Source/Core/DolphinWX/Src/Debugger/DSPRegisterView.cpp
Normal file
94
Source/Core/DolphinWX/Src/Debugger/DSPRegisterView.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "DSPDebugWindow.h"
|
||||
#include "DSPRegisterView.h"
|
||||
|
||||
|
||||
wxString CDSPRegTable::GetValue(int row, int col)
|
||||
{
|
||||
if (row < 32) // 32 "normal" regs
|
||||
{
|
||||
switch (col)
|
||||
{
|
||||
case 0: return wxString::FromAscii(pdregname(row));
|
||||
case 1: return wxString::Format(wxT("0x%04x"), DSPCore_ReadRegister(row));
|
||||
default: return wxString::FromAscii("");
|
||||
}
|
||||
}
|
||||
return wxString::FromAscii("");
|
||||
}
|
||||
|
||||
void CDSPRegTable::SetValue(int, int, const wxString &)
|
||||
{
|
||||
}
|
||||
|
||||
void CDSPRegTable::UpdateCachedRegs()
|
||||
{
|
||||
if (m_CachedCounter == g_dsp.step_counter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_CachedCounter = g_dsp.step_counter;
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
m_CachedRegHasChanged[i] = (m_CachedRegs[i] != DSPCore_ReadRegister(i));
|
||||
m_CachedRegs[i] = DSPCore_ReadRegister(i);
|
||||
}
|
||||
}
|
||||
|
||||
wxGridCellAttr *CDSPRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
{
|
||||
wxGridCellAttr *attr = new wxGridCellAttr();
|
||||
|
||||
attr->SetBackgroundColour(wxColour(wxT("#FFFFFF")));
|
||||
|
||||
switch (col)
|
||||
{
|
||||
case 1:
|
||||
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
||||
break;
|
||||
default:
|
||||
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
break;
|
||||
}
|
||||
|
||||
if (col == 1)
|
||||
attr->SetTextColour(m_CachedRegHasChanged[row] ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
|
||||
|
||||
attr->IncRef();
|
||||
return attr;
|
||||
}
|
||||
|
||||
DSPRegisterView::DSPRegisterView(wxWindow *parent, wxWindowID id)
|
||||
: wxGrid(parent, id, wxDefaultPosition, wxSize(130, 120))
|
||||
{
|
||||
SetTable(new CDSPRegTable(), true);
|
||||
SetRowLabelSize(0);
|
||||
SetColLabelSize(0);
|
||||
DisableDragRowSize();
|
||||
|
||||
AutoSizeColumns();
|
||||
}
|
||||
|
||||
void DSPRegisterView::Update()
|
||||
{
|
||||
((CDSPRegTable *)GetTable())->UpdateCachedRegs();
|
||||
ForceRefresh();
|
||||
}
|
56
Source/Core/DolphinWX/Src/Debugger/DSPRegisterView.h
Normal file
56
Source/Core/DolphinWX/Src/Debugger/DSPRegisterView.h
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __DSPREGISTERVIEW_h__
|
||||
#define __DSPREGISTERVIEW_h__
|
||||
|
||||
#include <wx/grid.h>
|
||||
|
||||
|
||||
class CDSPRegTable : public wxGridTableBase
|
||||
{
|
||||
private:
|
||||
u64 m_CachedCounter;
|
||||
u16 m_CachedRegs[32];
|
||||
bool m_CachedRegHasChanged[32];
|
||||
|
||||
DECLARE_NO_COPY_CLASS(CDSPRegTable);
|
||||
|
||||
public:
|
||||
CDSPRegTable()
|
||||
{
|
||||
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
|
||||
memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged));
|
||||
}
|
||||
|
||||
int GetNumberCols(void) {return 2;}
|
||||
int GetNumberRows(void) {return 32;}
|
||||
bool IsEmptyCell(int row, int col) {return false;}
|
||||
wxString GetValue(int row, int col);
|
||||
void SetValue(int row, int col, const wxString &);
|
||||
wxGridCellAttr *GetAttr(int, int, wxGridCellAttr::wxAttrKind);
|
||||
void UpdateCachedRegs();
|
||||
};
|
||||
|
||||
class DSPRegisterView : public wxGrid
|
||||
{
|
||||
public:
|
||||
DSPRegisterView(wxWindow* parent, wxWindowID id);
|
||||
void Update();
|
||||
};
|
||||
|
||||
#endif //__DSPREGISTERVIEW_h__
|
344
Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.cpp
Normal file
344
Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.cpp
Normal file
@ -0,0 +1,344 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
|
||||
#include "IniFile.h"
|
||||
#include "DebuggerPanel.h"
|
||||
#include "FileUtil.h"
|
||||
#include "../../Core/Src/ConfigManager.h"
|
||||
|
||||
#include "VideoConfig.h"
|
||||
#include "TextureCacheBase.h"
|
||||
#include "PixelShaderGen.h"
|
||||
#include "VertexShaderGen.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(GFXDebuggerPanel, wxPanel)
|
||||
EVT_CLOSE(GFXDebuggerPanel::OnClose)
|
||||
EVT_BUTTON(ID_PAUSE,GFXDebuggerPanel::OnPauseButton)
|
||||
EVT_BUTTON(ID_PAUSE_AT_NEXT,GFXDebuggerPanel::OnPauseAtNextButton)
|
||||
EVT_BUTTON(ID_PAUSE_AT_NEXT_FRAME,GFXDebuggerPanel::OnPauseAtNextFrameButton)
|
||||
EVT_BUTTON(ID_CONT,GFXDebuggerPanel::OnContButton)
|
||||
EVT_BUTTON(ID_DUMP,GFXDebuggerPanel::OnDumpButton)
|
||||
EVT_BUTTON(ID_UPDATE_SCREEN,GFXDebuggerPanel::OnUpdateScreenButton)
|
||||
EVT_BUTTON(ID_CLEAR_SCREEN,GFXDebuggerPanel::OnClearScreenButton)
|
||||
EVT_BUTTON(ID_CLEAR_TEXTURE_CACHE,GFXDebuggerPanel::OnClearTextureCacheButton)
|
||||
EVT_BUTTON(ID_CLEAR_VERTEX_SHADER_CACHE,GFXDebuggerPanel::OnClearVertexShaderCacheButton)
|
||||
EVT_BUTTON(ID_CLEAR_PIXEL_SHADER_CACHE,GFXDebuggerPanel::OnClearPixelShaderCacheButton)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
GFXDebuggerBase *g_pdebugger = NULL;
|
||||
volatile bool GFXDebuggerPauseFlag = false;
|
||||
volatile PauseEvent GFXDebuggerToPauseAtNext = NOT_PAUSE;
|
||||
volatile int GFXDebuggerEventToPauseCount = 0;
|
||||
|
||||
GFXDebuggerPanel::GFXDebuggerPanel(wxWindow *parent, wxWindowID id, const wxPoint &position,
|
||||
const wxSize& size, long style, const wxString &title)
|
||||
: wxPanel(parent, id, position, size, style, title)
|
||||
{
|
||||
g_pdebugger = this;
|
||||
|
||||
CreateGUIControls();
|
||||
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
GFXDebuggerPanel::~GFXDebuggerPanel()
|
||||
{
|
||||
g_pdebugger = NULL;
|
||||
GFXDebuggerPauseFlag = false;
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
// save the window position when we hide the window
|
||||
SaveSettings();
|
||||
|
||||
event.Skip(); // This means wxDialog's Destroy is used
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::SaveSettings() const
|
||||
{
|
||||
IniFile file;
|
||||
file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
|
||||
// TODO: make this work when we close the entire program too, currently on total close we get
|
||||
// weird values, perhaps because of some conflict with the rendering window
|
||||
// TODO: get the screen resolution and make limits from that
|
||||
if (GetPosition().x < 1000 && GetPosition().y < 1000
|
||||
&& GetSize().GetWidth() < 1000
|
||||
&& GetSize().GetHeight() < 1000)
|
||||
{
|
||||
file.Set("VideoWindow", "x", GetPosition().x);
|
||||
file.Set("VideoWindow", "y", GetPosition().y);
|
||||
file.Set("VideoWindow", "w", GetSize().GetWidth());
|
||||
file.Set("VideoWindow", "h", GetSize().GetHeight());
|
||||
}
|
||||
|
||||
file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::LoadSettings()
|
||||
{
|
||||
IniFile file;
|
||||
file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
|
||||
int x = 100, y = 100, w = 100, h = 100;
|
||||
file.Get("VideoWindow", "x", &x, GetPosition().x);
|
||||
file.Get("VideoWindow", "y", &y, GetPosition().y);
|
||||
file.Get("VideoWindow", "w", &w, GetSize().GetWidth());
|
||||
file.Get("VideoWindow", "h", &h, GetSize().GetHeight());
|
||||
SetSize(x, y, w, h);
|
||||
}
|
||||
|
||||
struct PauseEventMap
|
||||
{
|
||||
PauseEvent event;
|
||||
const wxString ListStr;
|
||||
};
|
||||
|
||||
static PauseEventMap pauseEventMap[] = {
|
||||
{NEXT_FRAME, _("Frame")},
|
||||
{NEXT_FLUSH, _("Flush")},
|
||||
|
||||
{NEXT_PIXEL_SHADER_CHANGE, _("Pixel Shader")},
|
||||
{NEXT_VERTEX_SHADER_CHANGE, _("Vertex Shader")},
|
||||
{NEXT_TEXTURE_CHANGE, _("Texture")},
|
||||
{NEXT_NEW_TEXTURE, _("New Texture")},
|
||||
|
||||
{NEXT_XFB_CMD, _("XFB Cmd")},
|
||||
{NEXT_EFB_CMD, _("EFB Cmd")},
|
||||
|
||||
{NEXT_MATRIX_CMD, _("Matrix Cmd")},
|
||||
{NEXT_VERTEX_CMD, _("Vertex Cmd")},
|
||||
{NEXT_TEXTURE_CMD, _("Texture Cmd")},
|
||||
{NEXT_LIGHT_CMD, _("Light Cmd")},
|
||||
{NEXT_FOG_CMD, _("Fog Cmd")},
|
||||
|
||||
{NEXT_SET_TLUT, _("TLUT Cmd")},
|
||||
|
||||
{NEXT_ERROR, _("Error")}
|
||||
};
|
||||
static const int numPauseEventMap = sizeof(pauseEventMap)/sizeof(PauseEventMap);
|
||||
|
||||
void GFXDebuggerPanel::CreateGUIControls()
|
||||
{
|
||||
// Basic settings
|
||||
CenterOnParent();
|
||||
|
||||
// MainPanel
|
||||
m_MainPanel = new wxPanel(this, ID_MAINPANEL, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
m_pButtonPause = new wxButton(m_MainPanel, ID_PAUSE, _("Pause"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Pause"));
|
||||
m_pButtonPauseAtNext = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT, _("Pause At Next"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Pause At Next"));
|
||||
m_pButtonPauseAtNextFrame = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT_FRAME, _("Next Frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Next Frame"));
|
||||
m_pButtonCont = new wxButton(m_MainPanel, ID_CONT, _("Continue"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Continue"));
|
||||
|
||||
m_pPauseAtList = new wxChoice(m_MainPanel, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, NULL,0,wxDefaultValidator, _("PauseAtList"));
|
||||
for (int i=0; i<numPauseEventMap; i++)
|
||||
{
|
||||
m_pPauseAtList->Append(pauseEventMap[i].ListStr);
|
||||
}
|
||||
|
||||
m_pPauseAtList->SetSelection(0);
|
||||
|
||||
m_pButtonDump = new wxButton(m_MainPanel, ID_DUMP, _("Dump"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Dump"));
|
||||
m_pButtonUpdateScreen = new wxButton(m_MainPanel, ID_UPDATE_SCREEN, _("Update Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Update Screen"));
|
||||
m_pButtonClearScreen = new wxButton(m_MainPanel, ID_CLEAR_SCREEN, _("Clear Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear Screen"));
|
||||
m_pButtonClearTextureCache = new wxButton(m_MainPanel, ID_CLEAR_TEXTURE_CACHE, _("Clear Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear Textures"));
|
||||
m_pButtonClearVertexShaderCache = new wxButton(m_MainPanel, ID_CLEAR_VERTEX_SHADER_CACHE, _("Clear V Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear V Shaders"));
|
||||
m_pButtonClearPixelShaderCache = new wxButton(m_MainPanel, ID_CLEAR_PIXEL_SHADER_CACHE, _("Clear P Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear P Shaders"));
|
||||
m_pCount = new wxTextCtrl(m_MainPanel, ID_COUNT, wxT("1"), wxDefaultPosition, wxSize(50,25), 0, wxDefaultValidator, _("Count"));
|
||||
|
||||
m_pDumpList = new wxChoice(m_MainPanel, ID_DUMP_LIST, wxDefaultPosition, wxSize(120,25), 0, NULL,0,wxDefaultValidator, _("DumpList"));
|
||||
m_pDumpList->Insert(_("Pixel Shader"),0);
|
||||
m_pDumpList->Append(_("Vertex Shader"));
|
||||
m_pDumpList->Append(_("Pixel Shader Constants"));
|
||||
m_pDumpList->Append(_("Vertex Shader Constants"));
|
||||
m_pDumpList->Append(_("Textures"));
|
||||
m_pDumpList->Append(_("Frame Buffer"));
|
||||
m_pDumpList->Append(_("Geometry data"));
|
||||
m_pDumpList->Append(_("Vertex Description"));
|
||||
m_pDumpList->Append(_("Vertex Matrices"));
|
||||
m_pDumpList->Append(_("Statistics"));
|
||||
m_pDumpList->SetSelection(0);
|
||||
|
||||
// Layout everything on m_MainPanel
|
||||
wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
sMain->Add(m_pButtonPause, 0, 0, 5);
|
||||
sMain->Add(m_pButtonPauseAtNext, 0, 0, 5);
|
||||
sMain->Add(m_pCount,0,0,5);
|
||||
sMain->Add(m_pPauseAtList, 0, 0, 5);
|
||||
sMain->Add(m_pButtonDump, 0, 0, 5);
|
||||
sMain->Add(m_pDumpList, 0, 0, 5);
|
||||
sMain->Add(m_pButtonUpdateScreen, 0, 0, 5);
|
||||
sMain->Add(m_pButtonClearScreen, 0, 0, 5);
|
||||
sMain->Add(m_pButtonClearTextureCache, 0, 0, 5);
|
||||
sMain->Add(m_pButtonClearVertexShaderCache, 0, 0, 5);
|
||||
sMain->Add(m_pButtonClearPixelShaderCache, 0, 0, 5);
|
||||
sMain->Add(m_pButtonPauseAtNextFrame, 0, 0, 5);
|
||||
sMain->Add(m_pButtonCont, 0, 0, 5);
|
||||
m_MainPanel->SetSizerAndFit(sMain);
|
||||
Fit();
|
||||
|
||||
OnContinue();
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnPause()
|
||||
{
|
||||
m_pButtonDump->Enable(true);
|
||||
m_pButtonUpdateScreen->Enable(true);
|
||||
m_pButtonClearScreen->Enable(true);
|
||||
m_pButtonClearTextureCache->Enable(true);
|
||||
m_pButtonClearVertexShaderCache->Enable(true);
|
||||
m_pButtonClearPixelShaderCache->Enable(true);
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnContinue()
|
||||
{
|
||||
m_pButtonDump->Enable(false);
|
||||
m_pButtonUpdateScreen->Enable(false);
|
||||
m_pButtonClearScreen->Enable(false);
|
||||
m_pButtonClearTextureCache->Enable(false);
|
||||
m_pButtonClearVertexShaderCache->Enable(false);
|
||||
m_pButtonClearPixelShaderCache->Enable(false);
|
||||
}
|
||||
|
||||
|
||||
// General settings
|
||||
void GFXDebuggerPanel::GeneralSettings(wxCommandEvent& event)
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnPauseButton(wxCommandEvent& event)
|
||||
{
|
||||
GFXDebuggerPauseFlag = true;
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnPauseAtNextButton(wxCommandEvent& event)
|
||||
{
|
||||
GFXDebuggerPauseFlag = false;
|
||||
GFXDebuggerToPauseAtNext = pauseEventMap[m_pPauseAtList->GetSelection()].event;
|
||||
wxString val = m_pCount->GetValue();
|
||||
long value;
|
||||
if (val.ToLong(&value))
|
||||
GFXDebuggerEventToPauseCount = value;
|
||||
else
|
||||
GFXDebuggerEventToPauseCount = 1;
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnPauseAtNextFrameButton(wxCommandEvent& event)
|
||||
{
|
||||
GFXDebuggerPauseFlag = false;
|
||||
GFXDebuggerToPauseAtNext = NEXT_FRAME;
|
||||
GFXDebuggerEventToPauseCount = 1;
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event)
|
||||
{
|
||||
char dump_path[MAX_PATH];
|
||||
sprintf(dump_path, "%sDebug/%s/", File::GetUserPath(D_DUMP_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
|
||||
if (!File::CreateFullPath(dump_path))
|
||||
return;
|
||||
|
||||
switch (m_pDumpList->GetSelection())
|
||||
{
|
||||
case 0: // Pixel Shader
|
||||
DumpPixelShader(dump_path);
|
||||
break;
|
||||
|
||||
case 1: // Vertex Shader
|
||||
DumpVertexShader(dump_path);
|
||||
break;
|
||||
|
||||
case 2: // Pixel Shader Constants
|
||||
DumpPixelShaderConstants(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 3: // Vertex Shader Constants
|
||||
DumpVertexShaderConstants(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 4: // Textures
|
||||
DumpTextures(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 5: // Frame Buffer
|
||||
DumpFrameBuffer(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 6: // Geometry
|
||||
DumpGeometry(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 7: // Vertex Description
|
||||
DumpVertexDecl(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 8: // Vertex Matrices
|
||||
DumpMatrices(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
|
||||
case 9: // Statistics
|
||||
DumpStats(dump_path);
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnContButton(wxCommandEvent& event)
|
||||
{
|
||||
GFXDebuggerToPauseAtNext = NOT_PAUSE;
|
||||
GFXDebuggerPauseFlag = false;
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnClearScreenButton(wxCommandEvent& event)
|
||||
{
|
||||
// TODO
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event)
|
||||
{
|
||||
TextureCache::Invalidate(false);
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnClearVertexShaderCacheButton(wxCommandEvent& event)
|
||||
{
|
||||
// TODO
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnClearPixelShaderCacheButton(wxCommandEvent& event)
|
||||
{
|
||||
// TODO
|
||||
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
|
||||
}
|
||||
|
||||
void GFXDebuggerPanel::OnUpdateScreenButton(wxCommandEvent& event)
|
||||
{
|
||||
GFXDebuggerUpdateScreen();
|
||||
}
|
105
Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.h
Normal file
105
Source/Core/DolphinWX/Src/Debugger/DebuggerPanel.h
Normal file
@ -0,0 +1,105 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef _GFX_DEBUGGER_PANEL_H_
|
||||
#define _GFX_DEBUGGER_PANEL_H_
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/notebook.h>
|
||||
#include "Debugger.h"
|
||||
|
||||
class GFXDebuggerPanel : public wxPanel, public GFXDebuggerBase
|
||||
{
|
||||
public:
|
||||
GFXDebuggerPanel(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL,
|
||||
const wxString &title = _("GFX Debugger"));
|
||||
|
||||
virtual ~GFXDebuggerPanel();
|
||||
|
||||
void SaveSettings() const;
|
||||
void LoadSettings();
|
||||
|
||||
bool bInfoLog;
|
||||
bool bPrimLog;
|
||||
bool bSaveTextures;
|
||||
bool bSaveTargets;
|
||||
bool bSaveShaders;
|
||||
|
||||
void OnPause();
|
||||
void OnContinue();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxPanel *m_MainPanel;
|
||||
|
||||
wxButton *m_pButtonPause;
|
||||
wxButton *m_pButtonPauseAtNext;
|
||||
wxButton *m_pButtonPauseAtNextFrame;
|
||||
wxButton *m_pButtonCont;
|
||||
wxChoice *m_pPauseAtList;
|
||||
wxButton *m_pButtonDump;
|
||||
wxChoice *m_pDumpList;
|
||||
wxButton *m_pButtonUpdateScreen;
|
||||
wxButton *m_pButtonClearScreen;
|
||||
wxButton *m_pButtonClearTextureCache;
|
||||
wxButton *m_pButtonClearVertexShaderCache;
|
||||
wxButton *m_pButtonClearPixelShaderCache;
|
||||
wxTextCtrl *m_pCount;
|
||||
|
||||
|
||||
// TODO: Prefix with GFX_
|
||||
enum
|
||||
{
|
||||
ID_MAINPANEL = 3900,
|
||||
ID_CONT,
|
||||
ID_PAUSE,
|
||||
ID_PAUSE_AT_NEXT,
|
||||
ID_PAUSE_AT_NEXT_FRAME,
|
||||
ID_PAUSE_AT_LIST,
|
||||
ID_DUMP,
|
||||
ID_DUMP_LIST,
|
||||
ID_UPDATE_SCREEN,
|
||||
ID_CLEAR_SCREEN,
|
||||
ID_CLEAR_TEXTURE_CACHE,
|
||||
ID_CLEAR_VERTEX_SHADER_CACHE,
|
||||
ID_CLEAR_PIXEL_SHADER_CACHE,
|
||||
ID_COUNT
|
||||
};
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
|
||||
void GeneralSettings(wxCommandEvent& event);
|
||||
void OnPauseButton(wxCommandEvent& event);
|
||||
void OnPauseAtNextButton(wxCommandEvent& event);
|
||||
void OnPauseAtNextFrameButton(wxCommandEvent& event);
|
||||
void OnDumpButton(wxCommandEvent& event);
|
||||
void OnContButton(wxCommandEvent& event);
|
||||
void OnUpdateScreenButton(wxCommandEvent& event);
|
||||
void OnClearScreenButton(wxCommandEvent& event);
|
||||
void OnClearTextureCacheButton(wxCommandEvent& event);
|
||||
void OnClearVertexShaderCacheButton(wxCommandEvent& event);
|
||||
void OnClearPixelShaderCacheButton(wxCommandEvent& event);
|
||||
void OnCountEnter(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif // _GFX_DEBUGGER_PANEL_H_
|
23
Source/Core/DolphinWX/Src/Debugger/DebuggerUIUtil.cpp
Normal file
23
Source/Core/DolphinWX/Src/Debugger/DebuggerUIUtil.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
|
||||
#include "DebuggerUIUtil.h"
|
||||
|
||||
// The default font
|
||||
wxFont DebuggerFont = wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false, wxT("monospace"));
|
||||
|
25
Source/Core/DolphinWX/Src/Debugger/DebuggerUIUtil.h
Normal file
25
Source/Core/DolphinWX/Src/Debugger/DebuggerUIUtil.h
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef _DEBUGGER_UI_UTIL_H
|
||||
#define _DEBUGGER_UI_UTIL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
extern wxFont DebuggerFont;
|
||||
|
||||
#endif
|
266
Source/Core/DolphinWX/Src/Debugger/JitWindow.cpp
Normal file
266
Source/Core/DolphinWX/Src/Debugger/JitWindow.cpp
Normal file
@ -0,0 +1,266 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
#include "JitWindow.h"
|
||||
#include "HW/CPU.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "PowerPC/JitCommon/JitBase.h"
|
||||
#include "PowerPC/JitCommon/JitCache.h"
|
||||
#include "PowerPC/PPCAnalyst.h"
|
||||
#include "PowerPCDisasm.h"
|
||||
#include "Host.h"
|
||||
#include "disasm.h"
|
||||
|
||||
#include "Debugger/PPCDebugInterface.h"
|
||||
#include "Debugger/Debugger_SymbolMap.h"
|
||||
|
||||
#include "Core.h"
|
||||
#include "StringUtil.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
// ugly that this lib included code from the main
|
||||
#include "../../DolphinWX/Src/Globals.h"
|
||||
|
||||
// TODO: Fix this ugly hack
|
||||
namespace {
|
||||
CJitWindow *the_jit_window;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_REFRESH_LIST = 23350,
|
||||
IDM_PPC_BOX,
|
||||
IDM_X86_BOX,
|
||||
IDM_NEXT,
|
||||
IDM_PREV,
|
||||
IDM_BLOCKLIST,
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(CJitWindow, wxPanel)
|
||||
//EVT_TEXT(IDM_ADDRBOX, CJitWindow::OnAddrBoxChange)
|
||||
//EVT_LISTBOX(IDM_SYMBOLLIST, CJitWindow::OnSymbolListChange)
|
||||
//EVT_HOST_COMMAND(wxID_ANY, CJitWindow::OnHostMessage)
|
||||
EVT_BUTTON(IDM_REFRESH_LIST, CJitWindow::OnRefresh)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name)
|
||||
: wxPanel(parent, id, pos, size, style, name)
|
||||
{
|
||||
the_jit_window = this;
|
||||
wxBoxSizer* sizerBig = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* sizerSplit = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerSplit->Add(ppc_box = new wxTextCtrl(this, IDM_PPC_BOX, _T("(ppc)"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
|
||||
sizerSplit->Add(x86_box = new wxTextCtrl(this, IDM_X86_BOX, _T("(x86)"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
|
||||
sizerBig->Add(block_list = new JitBlockList(this, IDM_BLOCKLIST,
|
||||
wxDefaultPosition, wxSize(100, 140),
|
||||
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING),
|
||||
0, wxEXPAND);
|
||||
sizerBig->Add(sizerSplit, 2, wxEXPAND);
|
||||
// sizerBig->Add(memview, 5, wxEXPAND);
|
||||
// sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
|
||||
sizerBig->Add(button_refresh = new wxButton(this, IDM_REFRESH_LIST, _("&Refresh")));
|
||||
// sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T("")));
|
||||
// sizerRight->Add(new wxButton(this, IDM_SETPC, _("S&et PC")));
|
||||
|
||||
SetSizer(sizerBig);
|
||||
|
||||
sizerSplit->SetSizeHints(this);
|
||||
sizerSplit->Fit(this);
|
||||
sizerBig->SetSizeHints(this);
|
||||
sizerBig->Fit(this);
|
||||
}
|
||||
|
||||
void CJitWindow::OnRefresh(wxCommandEvent& /*event*/) {
|
||||
block_list->Update();
|
||||
}
|
||||
|
||||
void CJitWindow::ViewAddr(u32 em_address)
|
||||
{
|
||||
if (the_jit_window)
|
||||
{
|
||||
the_jit_window->Show(true);
|
||||
the_jit_window->Compare(em_address);
|
||||
the_jit_window->SetFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Jit window not available");
|
||||
}
|
||||
}
|
||||
|
||||
void CJitWindow::Compare(u32 em_address)
|
||||
{
|
||||
u8 *xDis = new u8[1<<18];
|
||||
memset(xDis, 0, 1<<18);
|
||||
|
||||
disassembler x64disasm;
|
||||
x64disasm.set_syntax_intel();
|
||||
|
||||
int block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address);
|
||||
if (block_num < 0)
|
||||
{
|
||||
for (int i = 0; i < 500; i++) {
|
||||
block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address - 4 * i);
|
||||
if (block_num >= 0)
|
||||
break;
|
||||
}
|
||||
if (block_num >= 0) {
|
||||
JitBlock *block = jit->GetBlockCache()->GetBlock(block_num);
|
||||
if (!(block->originalAddress <= em_address &&
|
||||
block->originalSize + block->originalAddress >= em_address))
|
||||
block_num = -1;
|
||||
}
|
||||
// Do not merge this "if" with the above - block_num changes inside it.
|
||||
if (block_num < 0) {
|
||||
ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)",
|
||||
em_address).c_str()));
|
||||
x86_box->SetValue(wxString::FromAscii(StringFromFormat("(no translation)").c_str()));
|
||||
delete[] xDis;
|
||||
return;
|
||||
}
|
||||
}
|
||||
JitBlock *block = jit->GetBlockCache()->GetBlock(block_num);
|
||||
|
||||
// 800031f0
|
||||
// == Fill in x86 box
|
||||
|
||||
const u8 *code = (const u8 *)jit->GetBlockCache()->GetCompiledCodeFromBlock(block_num);
|
||||
u64 disasmPtr = (u64)code;
|
||||
int size = block->codeSize;
|
||||
const u8 *end = code + size;
|
||||
char *sptr = (char*)xDis;
|
||||
|
||||
int num_x86_instructions = 0;
|
||||
while ((u8*)disasmPtr < end)
|
||||
{
|
||||
#ifdef _M_X64
|
||||
disasmPtr += x64disasm.disasm64(disasmPtr, disasmPtr, (u8*)disasmPtr, sptr);
|
||||
#else
|
||||
disasmPtr += x64disasm.disasm32(disasmPtr, disasmPtr, (u8*)disasmPtr, sptr);
|
||||
#endif
|
||||
sptr += strlen(sptr);
|
||||
*sptr++ = 13;
|
||||
*sptr++ = 10;
|
||||
num_x86_instructions++;
|
||||
}
|
||||
x86_box->SetValue(wxString::FromAscii((char*)xDis));
|
||||
|
||||
// == Fill in ppc box
|
||||
u32 ppc_addr = block->originalAddress;
|
||||
PPCAnalyst::CodeBuffer code_buffer(32000);
|
||||
PPCAnalyst::BlockStats st;
|
||||
PPCAnalyst::BlockRegStats gpa;
|
||||
PPCAnalyst::BlockRegStats fpa;
|
||||
bool broken_block = false;
|
||||
u32 merged_addresses[32];
|
||||
const int capacity_of_merged_addresses = sizeof(merged_addresses) / sizeof(merged_addresses[0]);
|
||||
int size_of_merged_addresses;
|
||||
if (PPCAnalyst::Flatten(ppc_addr, &size, &st, &gpa, &fpa, broken_block, &code_buffer, size, merged_addresses, capacity_of_merged_addresses, size_of_merged_addresses) != 0xffffffff)
|
||||
{
|
||||
sptr = (char*)xDis;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
const PPCAnalyst::CodeOp &op = code_buffer.codebuffer[i];
|
||||
char temp[256];
|
||||
DisassembleGekko(op.inst.hex, op.address, temp, 256);
|
||||
sptr += sprintf(sptr, "%08x %s\n", op.address, temp);
|
||||
}
|
||||
|
||||
// Add stats to the end of the ppc box since it's generally the shortest.
|
||||
sptr += sprintf(sptr, "\n");
|
||||
|
||||
// Add some generic analysis
|
||||
if (st.isFirstBlockOfFunction)
|
||||
sptr += sprintf(sptr, "(first block of function)\n");
|
||||
if (st.isLastBlockOfFunction)
|
||||
sptr += sprintf(sptr, "(first block of function)\n");
|
||||
|
||||
sptr += sprintf(sptr, "%i estimated cycles\n", st.numCycles);
|
||||
|
||||
sptr += sprintf(sptr, "Num instr: PPC: %i x86: %i (blowup: %i%%)\n",
|
||||
size, num_x86_instructions, 100 * (num_x86_instructions / size - 1));
|
||||
sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n",
|
||||
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
|
||||
|
||||
ppc_box->SetValue(wxString::FromAscii((char*)xDis));
|
||||
} else {
|
||||
ppc_box->SetValue(wxString::FromAscii(StringFromFormat(
|
||||
"(non-code address: %08x)", em_address).c_str()));
|
||||
x86_box->SetValue(wxString::FromAscii("---"));
|
||||
}
|
||||
|
||||
delete[] xDis;
|
||||
}
|
||||
|
||||
void CJitWindow::Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CJitWindow::OnHostMessage(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_NOTIFYMAPLOADED:
|
||||
//NotifyMapLoaded();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// JitBlockList
|
||||
//================
|
||||
|
||||
enum {
|
||||
COLUMN_ADDRESS,
|
||||
COLUMN_PPCSIZE,
|
||||
COLUMN_X86SIZE,
|
||||
COLUMN_NAME,
|
||||
COLUMN_FLAGS,
|
||||
COLUMN_NUMEXEC,
|
||||
COLUMN_COST, // (estimated as x86size * numexec)
|
||||
};
|
||||
|
||||
JitBlockList::JitBlockList(wxWindow* parent, const wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxListCtrl(parent, id, pos, size, style) // | wxLC_VIRTUAL)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
void JitBlockList::Init()
|
||||
{
|
||||
InsertColumn(COLUMN_ADDRESS, _("Address"));
|
||||
InsertColumn(COLUMN_PPCSIZE, _("PPC Size"));
|
||||
InsertColumn(COLUMN_X86SIZE, _("x86 Size"));
|
||||
InsertColumn(COLUMN_NAME, _("Symbol"));
|
||||
InsertColumn(COLUMN_FLAGS, _("Flags"));
|
||||
InsertColumn(COLUMN_NUMEXEC, _("NumExec"));
|
||||
InsertColumn(COLUMN_COST, _("Cost"));
|
||||
}
|
||||
|
||||
void JitBlockList::Update()
|
||||
{
|
||||
}
|
72
Source/Core/DolphinWX/Src/Debugger/JitWindow.h
Normal file
72
Source/Core/DolphinWX/Src/Debugger/JitWindow.h
Normal file
@ -0,0 +1,72 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef JITWINDOW_H_
|
||||
#define JITWINDOW_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/listbox.h>
|
||||
|
||||
#include "MemoryView.h"
|
||||
#include "Thread.h"
|
||||
#include "CoreParameter.h"
|
||||
|
||||
class JitBlockList : public wxListCtrl
|
||||
{
|
||||
std::vector<int> block_ranking;
|
||||
public:
|
||||
JitBlockList(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
void Init();
|
||||
void Update();
|
||||
};
|
||||
|
||||
class CJitWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
CJitWindow(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
|
||||
const wxString& name = _("JIT block viewer"));
|
||||
|
||||
static void ViewAddr(u32 em_address);
|
||||
void Update();
|
||||
|
||||
private:
|
||||
void OnRefresh(wxCommandEvent& /*event*/);
|
||||
void Compare(u32 em_address);
|
||||
|
||||
JitBlockList* block_list;
|
||||
wxButton* button_refresh;
|
||||
wxTextCtrl* ppc_box;
|
||||
wxTextCtrl* x86_box;
|
||||
wxListBox* top_instructions;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnSymbolListChange(wxCommandEvent& event);
|
||||
void OnCallstackListChange(wxCommandEvent& event);
|
||||
void OnAddrBoxChange(wxCommandEvent& event);
|
||||
void OnHostMessage(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif /*MEMORYWINDOW_*/
|
102
Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.cpp
Normal file
102
Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "MemoryCheckDlg.h"
|
||||
#include "Common.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Host.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(MemoryCheckDlg,wxDialog)
|
||||
EVT_CLOSE(MemoryCheckDlg::OnClose)
|
||||
EVT_BUTTON(ID_OK, MemoryCheckDlg::OnOK)
|
||||
EVT_BUTTON(ID_CANCEL, MemoryCheckDlg::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
MemoryCheckDlg::MemoryCheckDlg(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
MemoryCheckDlg::~MemoryCheckDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void MemoryCheckDlg::CreateGUIControls()
|
||||
{
|
||||
SetIcon(wxNullIcon);
|
||||
SetSize(8,8,415,122);
|
||||
Center();
|
||||
|
||||
m_pButtonCancel = new wxButton(this, ID_CANCEL, _("Cancel"), wxPoint(248,64), wxSize(73,25), 0, wxDefaultValidator, _("Cancel"));
|
||||
|
||||
m_pButtonOK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(328,64), wxSize(73,25), 0, wxDefaultValidator, wxT("OK"));
|
||||
|
||||
m_pReadFlag = new wxCheckBox(this, ID_READ_FLAG, _("Read"), wxPoint(336,33), wxSize(57,15), 0, wxDefaultValidator, _("Read"));
|
||||
|
||||
m_pWriteFlag = new wxCheckBox(this, ID_WRITE_FLAG, _("Write"), wxPoint(336,16), wxSize(57,17), 0, wxDefaultValidator, wxT("WxCheckBox1"));
|
||||
|
||||
new wxStaticBox(this, ID_WXSTATICBOX2, _("Break On"), wxPoint(328,0), wxSize(73,57));
|
||||
|
||||
new wxStaticText(this, ID_WXSTATICTEXT2, _("End"), wxPoint(168,24), wxDefaultSize, 0, wxT("WxStaticText2"));
|
||||
|
||||
new wxStaticText(this, ID_WXSTATICTEXT1, _("Start"), wxPoint(8,24), wxDefaultSize, 0, wxT("WxStaticText1"));
|
||||
|
||||
m_pEditStartAddress = new wxTextCtrl(this, ID_EDIT_START_ADDR, wxT("80000000"), wxPoint(40,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit1"));
|
||||
|
||||
m_pEditEndAddress = new wxTextCtrl(this, ID_EDIT_END_ADDRESS, wxT("80000000"), wxPoint(200,24), wxSize(109,20), 0, wxDefaultValidator, wxT("WxEdit2"));
|
||||
|
||||
new wxStaticBox(this, ID_WXSTATICBOX1, _("Address Range"), wxPoint(0,0), wxSize(321,57));
|
||||
}
|
||||
|
||||
void MemoryCheckDlg::OnClose(wxCloseEvent& /*event*/)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/)
|
||||
{
|
||||
wxString StartAddressString = m_pEditStartAddress->GetLineText(0);
|
||||
wxString EndAddressString = m_pEditEndAddress->GetLineText(0);
|
||||
bool OnRead = m_pReadFlag->GetValue();
|
||||
bool OnWrite = m_pWriteFlag->GetValue();
|
||||
|
||||
u32 StartAddress, EndAddress;
|
||||
if (AsciiToHex(StartAddressString.mb_str(), StartAddress) &&
|
||||
AsciiToHex(EndAddressString.mb_str(), EndAddress))
|
||||
{
|
||||
TMemCheck MemCheck;
|
||||
MemCheck.StartAddress = StartAddress;
|
||||
MemCheck.EndAddress = EndAddress;
|
||||
MemCheck.OnRead = OnRead;
|
||||
MemCheck.OnWrite = OnWrite;
|
||||
|
||||
MemCheck.Log = true;
|
||||
MemCheck.Break = true;
|
||||
|
||||
PowerPC::memchecks.Add(MemCheck);
|
||||
Host_UpdateBreakPointView();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryCheckDlg::OnCancel(wxCommandEvent& /*event*/)
|
||||
{
|
||||
Close();
|
||||
}
|
73
Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.h
Normal file
73
Source/Core/DolphinWX/Src/Debugger/MemoryCheckDlg.h
Normal file
@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __MEMORYCHECKDLG_h__
|
||||
#define __MEMORYCHECKDLG_h__
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
|
||||
#undef MemoryCheckDlg_STYLE
|
||||
#define MemoryCheckDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxSTAY_ON_TOP | wxDIALOG_NO_PARENT | wxCLOSE_BOX
|
||||
|
||||
class MemoryCheckDlg : public wxDialog
|
||||
{
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
MemoryCheckDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Memory Check"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MemoryCheckDlg_STYLE);
|
||||
virtual ~MemoryCheckDlg();
|
||||
|
||||
private:
|
||||
|
||||
wxButton* m_pButtonCancel;
|
||||
wxButton* m_pButtonOK;
|
||||
wxCheckBox* m_pReadFlag;
|
||||
wxCheckBox* m_pWriteFlag;
|
||||
wxTextCtrl* m_pEditEndAddress;
|
||||
wxTextCtrl* m_pEditStartAddress;
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
ID_CANCEL = 1016,
|
||||
ID_OK = 1015,
|
||||
ID_READ_FLAG = 1014,
|
||||
ID_WRITE_FLAG = 1013,
|
||||
ID_WXSTATICBOX2 = 1012,
|
||||
ID_EDIT_END_ADDRESS = 1011,
|
||||
ID_WXSTATICTEXT2 = 1010,
|
||||
ID_WXSTATICTEXT1 = 1009,
|
||||
ID_EDIT_START_ADDR = 1008,
|
||||
ID_WXSTATICBOX1 = 1007,
|
||||
};
|
||||
|
||||
private:
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void CreateGUIControls();
|
||||
};
|
||||
|
||||
#endif
|
439
Source/Core/DolphinWX/Src/Debugger/MemoryView.cpp
Normal file
439
Source/Core/DolphinWX/Src/Debugger/MemoryView.cpp
Normal file
@ -0,0 +1,439 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "DebuggerUIUtil.h"
|
||||
#include "Common.h"
|
||||
#include "Host.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "HW/Memmap.h"
|
||||
|
||||
#include "MemoryView.h"
|
||||
#include <wx/event.h>
|
||||
#include <wx/clipbrd.h>
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_GOTOINMEMVIEW = 12000,
|
||||
IDM_COPYADDRESS,
|
||||
IDM_COPYHEX,
|
||||
IDM_COPYCODE,
|
||||
IDM_RUNTOHERE,
|
||||
IDM_DYNARECRESULTS,
|
||||
IDM_TOGGLEMEMORY,
|
||||
IDM_VIEWASFP,
|
||||
IDM_VIEWASASCII,
|
||||
IDM_VIEWASHEX,
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(CMemoryView, wxControl)
|
||||
EVT_ERASE_BACKGROUND(CMemoryView::OnErase)
|
||||
EVT_PAINT(CMemoryView::OnPaint)
|
||||
EVT_LEFT_DOWN(CMemoryView::OnMouseDownL)
|
||||
EVT_LEFT_UP(CMemoryView::OnMouseUpL)
|
||||
EVT_MOTION(CMemoryView::OnMouseMove)
|
||||
EVT_RIGHT_DOWN(CMemoryView::OnMouseDownR)
|
||||
EVT_MENU(-1, CMemoryView::OnPopupMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id, const wxSize& Size)
|
||||
: wxControl(parent, Id, wxDefaultPosition, Size),
|
||||
debugger(debuginterface),
|
||||
rowHeight(13),
|
||||
selection(0),
|
||||
oldSelection(0),
|
||||
selectionChanged(false),
|
||||
selecting(false),
|
||||
hasFocus(false),
|
||||
showHex(false),
|
||||
memory(0),
|
||||
viewAsType(VIEWAS_FP)
|
||||
{
|
||||
rowHeight = 13;
|
||||
align = debuginterface->getInstructionSize(0);
|
||||
curAddress = debuginterface->getPC();
|
||||
}
|
||||
|
||||
|
||||
wxSize CMemoryView::DoGetBestSize() const
|
||||
{
|
||||
wxSize bestSize;
|
||||
bestSize.x = 300;
|
||||
bestSize.y = 300;
|
||||
return(bestSize);
|
||||
}
|
||||
|
||||
|
||||
int CMemoryView::YToAddress(int y)
|
||||
{
|
||||
wxRect rc = GetClientRect();
|
||||
int ydiff = y - rc.height / 2 - rowHeight / 2;
|
||||
ydiff = (int)(floorf((float)ydiff / (float)rowHeight)) + 1;
|
||||
return(curAddress + ydiff * align);
|
||||
}
|
||||
|
||||
|
||||
void CMemoryView::OnMouseDownL(wxMouseEvent& event)
|
||||
{
|
||||
int x = event.m_x;
|
||||
int y = event.m_y;
|
||||
|
||||
if (x > 16)
|
||||
{
|
||||
oldSelection = selection;
|
||||
selection = YToAddress(y);
|
||||
// SetCapture(wnd);
|
||||
bool oldselecting = selecting;
|
||||
selecting = true;
|
||||
|
||||
if (!oldselecting || (selection != oldSelection))
|
||||
{
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugger->toggleMemCheck(YToAddress(y));
|
||||
|
||||
redraw();
|
||||
Host_UpdateBreakPointView();
|
||||
}
|
||||
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CMemoryView::OnMouseMove(wxMouseEvent& event)
|
||||
{
|
||||
wxRect rc = GetClientRect();
|
||||
|
||||
if (event.m_leftDown)
|
||||
{
|
||||
if (event.m_x > 16)
|
||||
{
|
||||
if (event.m_y < 0)
|
||||
{
|
||||
curAddress -= align;
|
||||
redraw();
|
||||
}
|
||||
else if (event.m_y > rc.height)
|
||||
{
|
||||
curAddress += align;
|
||||
redraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnMouseDownL(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CMemoryView::OnMouseUpL(wxMouseEvent& event)
|
||||
{
|
||||
if (event.m_x > 16)
|
||||
{
|
||||
curAddress = YToAddress(event.m_y);
|
||||
selecting = false;
|
||||
//ReleaseCapture();
|
||||
redraw();
|
||||
}
|
||||
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
#if wxUSE_CLIPBOARD
|
||||
wxTheClipboard->Open();
|
||||
#endif
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
#if wxUSE_CLIPBOARD
|
||||
case IDM_COPYADDRESS:
|
||||
{
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_COPYHEX:
|
||||
{
|
||||
char temp[24];
|
||||
sprintf(temp, "%08x", debugger->readExtraMemory(memory, selection));
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IDM_TOGGLEMEMORY:
|
||||
memory ^= 1;
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case IDM_VIEWASFP:
|
||||
viewAsType = VIEWAS_FP;
|
||||
redraw();
|
||||
break;
|
||||
|
||||
case IDM_VIEWASASCII:
|
||||
viewAsType = VIEWAS_ASCII;
|
||||
redraw();
|
||||
break;
|
||||
case IDM_VIEWASHEX:
|
||||
viewAsType = VIEWAS_HEX;
|
||||
redraw();
|
||||
break;
|
||||
}
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
wxTheClipboard->Close();
|
||||
#endif
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CMemoryView::OnMouseDownR(wxMouseEvent& event)
|
||||
{
|
||||
// popup menu
|
||||
wxMenu* menu = new wxMenu;
|
||||
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
|
||||
#if wxUSE_CLIPBOARD
|
||||
menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
|
||||
menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
|
||||
#endif
|
||||
menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory"));
|
||||
|
||||
|
||||
|
||||
wxMenu* viewAsSubMenu = new wxMenu;
|
||||
viewAsSubMenu->Append(IDM_VIEWASFP, wxString::FromAscii("FP value"));
|
||||
viewAsSubMenu->Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII"));
|
||||
viewAsSubMenu->Append(IDM_VIEWASHEX, wxString::FromAscii("Hex"));
|
||||
menu->AppendSubMenu(viewAsSubMenu, wxString::FromAscii("View As:"));
|
||||
|
||||
|
||||
PopupMenu(menu);
|
||||
|
||||
//event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
void CMemoryView::OnErase(wxEraseEvent& event)
|
||||
{}
|
||||
|
||||
|
||||
void CMemoryView::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
wxRect rc = GetClientRect();
|
||||
wxFont hFont(_T("Courier"));
|
||||
|
||||
if (viewAsType==VIEWAS_HEX)
|
||||
{
|
||||
hFont.SetFamily(wxFONTFAMILY_TELETYPE);
|
||||
dc.SetFont(hFont);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetFont(DebuggerFont);
|
||||
}
|
||||
//wxFont tempFont(Lucida Console);
|
||||
int fontSize = viewAsType == VIEWAS_HEX ? hFont.GetPointSize() : DebuggerFont.GetPointSize();
|
||||
int textPlacement = 77;
|
||||
struct branch
|
||||
{
|
||||
int src, dst, srcAddr;
|
||||
};
|
||||
|
||||
// TODO: Add any drawing code here...
|
||||
int width = rc.width;
|
||||
int numRows = (rc.height / rowHeight) / 2 + 2;
|
||||
//numRows=(numRows&(~1)) + 1;
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
const wxChar* bgColor = _T("#ffffff");
|
||||
wxPen nullPen(bgColor);
|
||||
wxPen currentPen(_T("#000000"));
|
||||
wxPen selPen(_T("#808080")); // gray
|
||||
nullPen.SetStyle(wxTRANSPARENT);
|
||||
|
||||
wxBrush currentBrush(_T("#FFEfE8")); // light gray
|
||||
wxBrush pcBrush(_T("#70FF70")); // green
|
||||
wxBrush mcBrush(_T("#1133FF")); // blue
|
||||
wxBrush bgBrush(bgColor);
|
||||
wxBrush nullBrush(bgColor);
|
||||
nullBrush.SetStyle(wxTRANSPARENT);
|
||||
|
||||
dc.SetPen(nullPen);
|
||||
dc.SetBrush(bgBrush);
|
||||
dc.DrawRectangle(0, 0, 16, rc.height);
|
||||
dc.DrawRectangle(0, 0, rc.width, 5+8);
|
||||
|
||||
// TODO - clean up this freaking mess!!!!!
|
||||
for (int row = -numRows; row <= numRows; row++)
|
||||
{
|
||||
unsigned int address = curAddress + row * align;
|
||||
|
||||
int rowY1 = rc.height / 2 + rowHeight * row - rowHeight / 2;
|
||||
int rowY2 = rc.height / 2 + rowHeight * row + rowHeight / 2;
|
||||
|
||||
wxString temp = wxString::Format(_T("%08x"), address);
|
||||
u32 col = debugger->getColor(address);
|
||||
wxBrush rowBrush(wxColor(col >> 16, col >> 8, col));
|
||||
dc.SetBrush(nullBrush);
|
||||
dc.SetPen(nullPen);
|
||||
dc.DrawRectangle(0, rowY1, 16, rowY2);
|
||||
|
||||
if (selecting && (address == selection))
|
||||
{
|
||||
dc.SetPen(selPen);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetPen(row == 0 ? currentPen : nullPen);
|
||||
}
|
||||
|
||||
if (address == debugger->getPC())
|
||||
{
|
||||
dc.SetBrush(pcBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetBrush(rowBrush);
|
||||
}
|
||||
|
||||
dc.DrawRectangle(16, rowY1, width, rowY2 - 1);
|
||||
dc.SetBrush(currentBrush);
|
||||
dc.SetTextForeground(_T("#600000"));
|
||||
dc.DrawText(temp, 17, rowY1);
|
||||
|
||||
if (viewAsType != VIEWAS_HEX)
|
||||
{
|
||||
char mem[256];
|
||||
debugger->getRawMemoryString(memory, address, mem, 256);
|
||||
dc.SetTextForeground(_T("#000080"));
|
||||
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1);
|
||||
dc.SetTextForeground(_T("#000000"));
|
||||
}
|
||||
|
||||
if (debugger->isAlive())
|
||||
{
|
||||
char dis[256] = {0};
|
||||
u32 mem_data = debugger->readExtraMemory(memory, address);
|
||||
|
||||
if (viewAsType == VIEWAS_FP)
|
||||
{
|
||||
float flt = *(float *)(&mem_data);
|
||||
sprintf(dis, "f: %f", flt);
|
||||
}
|
||||
else if (viewAsType == VIEWAS_ASCII)
|
||||
{
|
||||
char a[4] = {(mem_data&0xff000000)>>24,
|
||||
(mem_data&0xff0000)>>16,
|
||||
(mem_data&0xff00)>>8,
|
||||
mem_data&0xff};
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
if (a[i] == '\0')
|
||||
a[i] = ' ';
|
||||
sprintf(dis, "%c%c%c%c", a[0], a[1], a[2], a[3]);
|
||||
}
|
||||
else if (viewAsType == VIEWAS_HEX)
|
||||
{
|
||||
dis[0] = 0;
|
||||
dis[1] = 0;
|
||||
u32 mema[8] = {
|
||||
debugger->readExtraMemory(memory, address),
|
||||
debugger->readExtraMemory(memory, address+4),
|
||||
debugger->readExtraMemory(memory, address+8),
|
||||
debugger->readExtraMemory(memory, address+12),
|
||||
debugger->readExtraMemory(memory, address+16),
|
||||
debugger->readExtraMemory(memory, address+20),
|
||||
debugger->readExtraMemory(memory, address+24),
|
||||
debugger->readExtraMemory(memory, address+28)
|
||||
};
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
char buf[32] = "";
|
||||
switch (dataType)
|
||||
{
|
||||
case 0:
|
||||
sprintf(buf, " %02X %02X %02X %02X",
|
||||
((mema[i]&0xff000000)>>24)&0xFF,
|
||||
((mema[i]&0xff0000)>>16)&0xFF,
|
||||
((mema[i]&0xff00)>>8)&0xFF,
|
||||
mema[i]&0xff);
|
||||
break;
|
||||
case 1:
|
||||
sprintf(buf, " %02X%02X %02X%02X",
|
||||
((mema[i]&0xff000000)>>24)&0xFF,
|
||||
((mema[i]&0xff0000)>>16)&0xFF,
|
||||
((mema[i]&0xff00)>>8)&0xFF,
|
||||
mema[i]&0xff);
|
||||
break;
|
||||
case 2:
|
||||
sprintf(buf, " %02X%02X%02X%02X",
|
||||
((mema[i]&0xff000000)>>24)&0xFF,
|
||||
((mema[i]&0xff0000)>>16)&0xFF,
|
||||
((mema[i]&0xff00)>>8)&0xFF,
|
||||
mema[i]&0xff);
|
||||
break;
|
||||
}
|
||||
strcat(dis, buf);
|
||||
}
|
||||
curAddress += 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(dis, "INVALID VIEWAS TYPE");
|
||||
}
|
||||
|
||||
char desc[256] = "";
|
||||
if (viewAsType != VIEWAS_HEX)
|
||||
{
|
||||
dc.DrawText(wxString::FromAscii(dis), textPlacement + fontSize*(8 + 8), rowY1);
|
||||
} else {
|
||||
dc.DrawText(wxString::FromAscii(dis), textPlacement + 8+16, rowY1);
|
||||
}
|
||||
if (desc[0] == 0)
|
||||
{
|
||||
strcpy(desc, debugger->getDescription(address).c_str());
|
||||
}
|
||||
|
||||
dc.SetTextForeground(_T("#0000FF"));
|
||||
|
||||
if (strlen(desc))
|
||||
{
|
||||
dc.DrawText(wxString::FromAscii(desc), 17+fontSize*((8+8+8+30)*2), rowY1);
|
||||
}
|
||||
|
||||
// Show blue memory check dot
|
||||
if (debugger->isMemCheck(address))
|
||||
{
|
||||
dc.SetBrush(mcBrush);
|
||||
dc.DrawRectangle(8, rowY1 + 1, 11, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dc.SetPen(currentPen);
|
||||
}
|
80
Source/Core/DolphinWX/Src/Debugger/MemoryView.h
Normal file
80
Source/Core/DolphinWX/Src/Debugger/MemoryView.h
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef MEMORYVIEW_H_
|
||||
#define MEMORYVIEW_H_
|
||||
|
||||
#include "DebuggerUIUtil.h"
|
||||
#include "Common.h"
|
||||
#include "DebugInterface.h"
|
||||
|
||||
class CMemoryView : public wxControl
|
||||
{
|
||||
public:
|
||||
CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize);
|
||||
wxSize DoGetBestSize() const;
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnErase(wxEraseEvent& event);
|
||||
void OnMouseDownL(wxMouseEvent& event);
|
||||
void OnMouseMove(wxMouseEvent& event);
|
||||
void OnMouseUpL(wxMouseEvent& event);
|
||||
void OnMouseDownR(wxMouseEvent& event);
|
||||
void OnPopupMenu(wxCommandEvent& event);
|
||||
|
||||
u32 GetSelection() { return selection ; }
|
||||
int GetMemoryType() { return memory; }
|
||||
|
||||
void Center(u32 addr)
|
||||
{
|
||||
curAddress = addr;
|
||||
redraw();
|
||||
}
|
||||
int dataType; // u8,u16,u32
|
||||
int curAddress; // Will be accessed by parent
|
||||
|
||||
private:
|
||||
int YToAddress(int y);
|
||||
void redraw() {Refresh();}
|
||||
|
||||
DebugInterface* debugger;
|
||||
|
||||
|
||||
int align;
|
||||
int rowHeight;
|
||||
|
||||
u32 selection;
|
||||
u32 oldSelection;
|
||||
bool selectionChanged;
|
||||
bool selecting;
|
||||
bool hasFocus;
|
||||
bool showHex;
|
||||
|
||||
int memory;
|
||||
|
||||
enum EViewAsType
|
||||
{
|
||||
VIEWAS_ASCII = 0,
|
||||
VIEWAS_FP,
|
||||
VIEWAS_HEX,
|
||||
};
|
||||
|
||||
EViewAsType viewAsType;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /*MEMORYVIEW_H_*/
|
438
Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp
Normal file
438
Source/Core/DolphinWX/Src/Debugger/MemoryWindow.cpp
Normal file
@ -0,0 +1,438 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include "MemoryWindow.h"
|
||||
#include "HW/CPU.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "Host.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include "Debugger/PPCDebugInterface.h"
|
||||
#include "PowerPC/PPCSymbolDB.h"
|
||||
|
||||
#include "Core.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#include "HW/Memmap.h"
|
||||
#include "HW/DSP.h"
|
||||
|
||||
#include "../../DolphinWX/Src/Globals.h"
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_MEM_ADDRBOX = 350,
|
||||
IDM_SYMBOLLIST,
|
||||
IDM_SETVALBUTTON,
|
||||
IDM_DUMP_MEMORY,
|
||||
IDM_DUMP_MEM2,
|
||||
IDM_VALBOX,
|
||||
IDM_U8,
|
||||
IDM_U16,
|
||||
IDM_U32,
|
||||
IDM_SEARCH,
|
||||
IDM_ASCII,
|
||||
IDM_HEX
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(CMemoryWindow, wxPanel)
|
||||
EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange)
|
||||
EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange)
|
||||
EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage)
|
||||
EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue)
|
||||
EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory)
|
||||
EVT_BUTTON(IDM_DUMP_MEM2, CMemoryWindow::OnDumpMem2)
|
||||
EVT_CHECKBOX(IDM_U8, CMemoryWindow::U8)
|
||||
EVT_CHECKBOX(IDM_U16, CMemoryWindow::U16)
|
||||
EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32)
|
||||
EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch)
|
||||
EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii)
|
||||
EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
||||
: wxPanel(parent, id, pos, size, style, name)
|
||||
{
|
||||
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||
// Didn't see anything usefull in the left part
|
||||
//wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
DebugInterface* di = &PowerPC::debug_interface;
|
||||
|
||||
//symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition,
|
||||
// wxSize(20, 100), 0, NULL, wxLB_SORT);
|
||||
//sizerLeft->Add(symbols, 1, wxEXPAND);
|
||||
memview = new CMemoryView(di, this, wxID_ANY);
|
||||
memview->dataType = 0;
|
||||
//sizerBig->Add(sizerLeft, 1, wxEXPAND);
|
||||
sizerBig->Add(memview, 20, wxEXPAND);
|
||||
sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
|
||||
sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, _T("")));
|
||||
sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, _T("")));
|
||||
sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _("Set &Value")));
|
||||
|
||||
sizerRight->AddSpacer(5);
|
||||
sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _("&Dump MRAM")));
|
||||
sizerRight->Add(new wxButton(this, IDM_DUMP_MEM2, _("&Dump EXRAM")));
|
||||
|
||||
wxStaticBoxSizer* sizerSearchType = new wxStaticBoxSizer(wxVERTICAL, this, _("Search"));
|
||||
|
||||
sizerSearchType->Add(btnSearch = new wxButton(this, IDM_SEARCH, _("Search")));
|
||||
sizerSearchType->Add(chkAscii = new wxCheckBox(this, IDM_ASCII, _T("&Ascii ")));
|
||||
sizerSearchType->Add(chkHex = new wxCheckBox(this, IDM_HEX, _("&Hex")));
|
||||
sizerRight->Add(sizerSearchType);
|
||||
wxStaticBoxSizer* sizerDataTypes = new wxStaticBoxSizer(wxVERTICAL, this, _("Data Type"));
|
||||
|
||||
sizerDataTypes->SetMinSize(74, 40);
|
||||
sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, _T("&U8")));
|
||||
sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, _T("&U16")));
|
||||
sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, _T("&U32")));
|
||||
sizerRight->Add(sizerDataTypes);
|
||||
SetSizer(sizerBig);
|
||||
chkHex->SetValue(1); //Set defaults
|
||||
chk8->SetValue(1);
|
||||
|
||||
//sizerLeft->SetSizeHints(this);
|
||||
//sizerLeft->Fit(this);
|
||||
sizerRight->SetSizeHints(this);
|
||||
sizerRight->Fit(this);
|
||||
sizerBig->SetSizeHints(this);
|
||||
sizerBig->Fit(this);
|
||||
}
|
||||
|
||||
void CMemoryWindow::Save(IniFile& _IniFile) const
|
||||
{
|
||||
// Prevent these bad values that can happen after a crash or hanging
|
||||
if(GetPosition().x != -32000 && GetPosition().y != -32000)
|
||||
{
|
||||
_IniFile.Set("MemoryWindow", "x", GetPosition().x);
|
||||
_IniFile.Set("MemoryWindow", "y", GetPosition().y);
|
||||
_IniFile.Set("MemoryWindow", "w", GetSize().GetWidth());
|
||||
_IniFile.Set("MemoryWindow", "h", GetSize().GetHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void CMemoryWindow::Load(IniFile& _IniFile)
|
||||
{
|
||||
int x, y, w, h;
|
||||
_IniFile.Get("MemoryWindow", "x", &x, GetPosition().x);
|
||||
_IniFile.Get("MemoryWindow", "y", &y, GetPosition().y);
|
||||
_IniFile.Get("MemoryWindow", "w", &w, GetSize().GetWidth());
|
||||
_IniFile.Get("MemoryWindow", "h", &h, GetSize().GetHeight());
|
||||
SetSize(x, y, w, h);
|
||||
}
|
||||
|
||||
void CMemoryWindow::JumpToAddress(u32 _Address)
|
||||
{
|
||||
memview->Center(_Address);
|
||||
}
|
||||
|
||||
void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
|
||||
{
|
||||
std::string str_addr = std::string(addrbox->GetValue().mb_str());
|
||||
std::string str_val = std::string(valbox->GetValue().mb_str());
|
||||
u32 addr;
|
||||
u32 val;
|
||||
|
||||
if (!TryParse(std::string("0x") + str_addr, &addr))
|
||||
{
|
||||
PanicAlert("Invalid Address: %s", str_addr.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryParse(std::string("0x") + str_val, &val))
|
||||
{
|
||||
PanicAlert("Invalid Value: %s", str_val.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Memory::Write_U32(val, addr);
|
||||
memview->Refresh();
|
||||
}
|
||||
|
||||
void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event)
|
||||
{
|
||||
wxString txt = addrbox->GetValue();
|
||||
if (txt.size())
|
||||
{
|
||||
u32 addr;
|
||||
sscanf(txt.mb_str(), "%08x", &addr);
|
||||
memview->Center(addr & ~3);
|
||||
}
|
||||
|
||||
event.Skip(1);
|
||||
}
|
||||
|
||||
void CMemoryWindow::Update()
|
||||
{
|
||||
memview->Refresh();
|
||||
memview->Center(PC);
|
||||
}
|
||||
|
||||
void CMemoryWindow::NotifyMapLoaded()
|
||||
{
|
||||
symbols->Show(false); // hide it for faster filling
|
||||
symbols->Clear();
|
||||
#if 0
|
||||
#ifdef _WIN32
|
||||
const FunctionDB::XFuncMap &syms = g_symbolDB.Symbols();
|
||||
for (FuntionDB::XFuncMap::iterator iter = syms.begin(); iter != syms.end(); ++iter)
|
||||
{
|
||||
int idx = symbols->Append(iter->second.name.c_str());
|
||||
symbols->SetClientData(idx, (void*)&iter->second);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
symbols->Show(true);
|
||||
Update();
|
||||
}
|
||||
|
||||
void CMemoryWindow::OnSymbolListChange(wxCommandEvent& event)
|
||||
{
|
||||
int index = symbols->GetSelection();
|
||||
if (index >= 0)
|
||||
{
|
||||
Symbol* pSymbol = static_cast<Symbol *>(symbols->GetClientData(index));
|
||||
if (pSymbol != NULL)
|
||||
{
|
||||
memview->Center(pSymbol->address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMemoryWindow::OnHostMessage(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_NOTIFYMAPLOADED:
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Write mram to file
|
||||
void CMemoryWindow::OnDumpMemory( wxCommandEvent& event )
|
||||
{
|
||||
FILE* f = fopen(File::GetUserPath(F_RAMDUMP_IDX), "wb");
|
||||
if (f && Memory::m_pRAM)
|
||||
{
|
||||
fwrite(Memory::m_pRAM, Memory::REALRAM_SIZE, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
// Write exram (aram or mem2) to file
|
||||
void CMemoryWindow::OnDumpMem2( wxCommandEvent& event )
|
||||
{
|
||||
FILE* f = NULL;
|
||||
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||
{
|
||||
f = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb");
|
||||
if (f && Memory::m_pEXRAM)
|
||||
{
|
||||
fwrite(Memory::m_pEXRAM, Memory::EXRAM_SIZE, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
u8* aram = DSP::GetARAMPtr();
|
||||
f = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb");
|
||||
if (f && aram)
|
||||
{
|
||||
fwrite(aram, DSP::ARAM_SIZE, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMemoryWindow::U8(wxCommandEvent& event)
|
||||
{
|
||||
chk16->SetValue(0);
|
||||
chk32->SetValue(0);
|
||||
memview->dataType = 0;
|
||||
memview->Refresh();
|
||||
}
|
||||
|
||||
void CMemoryWindow::U16(wxCommandEvent& event)
|
||||
{
|
||||
chk8->SetValue(0);
|
||||
chk32->SetValue(0);
|
||||
memview->dataType = 1;
|
||||
memview->Refresh();
|
||||
}
|
||||
|
||||
void CMemoryWindow::U32(wxCommandEvent& event)
|
||||
{
|
||||
chk16->SetValue(0);
|
||||
chk8->SetValue(0);
|
||||
memview->dataType = 2;
|
||||
memview->Refresh();
|
||||
}
|
||||
|
||||
void CMemoryWindow::onSearch(wxCommandEvent& event)
|
||||
{
|
||||
u8* TheRAM = 0;
|
||||
u32 szRAM = 0;
|
||||
switch (memview->GetMemoryType())
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
if (Memory::m_pRAM)
|
||||
{
|
||||
TheRAM = Memory::m_pRAM;
|
||||
szRAM = Memory::REALRAM_SIZE;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
u8* aram = DSP::GetARAMPtr();
|
||||
if (aram)
|
||||
{
|
||||
TheRAM = aram;
|
||||
szRAM = DSP::ARAM_SIZE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//Now we have memory to look in
|
||||
//Are we looking for ASCII string, or hex?
|
||||
//memview->cu
|
||||
wxString rawData = valbox->GetValue();
|
||||
std::vector<u8> Dest; //May need a better name
|
||||
u32 size = 0;
|
||||
int pad = rawData.size()%2; //If it's uneven
|
||||
unsigned int i = 0;
|
||||
long count = 0;
|
||||
char copy[3] = {0};
|
||||
long newsize = 0;
|
||||
unsigned char *tmp2 = 0;
|
||||
char* tmpstr = 0;
|
||||
|
||||
if (chkHex->GetValue())
|
||||
{
|
||||
//We are looking for hex
|
||||
//If it's uneven
|
||||
size = (rawData.size()/2) + pad;
|
||||
Dest.resize(size+32);
|
||||
newsize = rawData.size();
|
||||
|
||||
if (pad)
|
||||
{
|
||||
tmpstr = new char[newsize + 2];
|
||||
memset(tmpstr, 0, newsize + 2);
|
||||
tmpstr[0] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpstr = new char[newsize + 1];
|
||||
memset(tmpstr, 0, newsize + 1);
|
||||
}
|
||||
//sprintf(tmpstr, "%s%s", tmpstr, rawData.c_str());
|
||||
//strcpy(&tmpstr[1], rawData.ToAscii());
|
||||
//memcpy(&tmpstr[1], &rawData.c_str()[0], rawData.size());
|
||||
sprintf(tmpstr, "%s%s", tmpstr, (const char *)rawData.mb_str());
|
||||
tmp2 = &Dest.front();
|
||||
count = 0;
|
||||
for(i = 0; i < strlen(tmpstr); i++)
|
||||
{
|
||||
copy[0] = tmpstr[i];
|
||||
copy[1] = tmpstr[i+1];
|
||||
copy[2] = 0;
|
||||
int tmpint;
|
||||
sscanf(copy, "%02x", &tmpint);
|
||||
tmp2[count++] = tmpint;
|
||||
// Dest[count] should now be the hex of what the two chars were!
|
||||
// Also should add a check to make sure it's A-F only
|
||||
//sscanf(copy, "%02x", &tmp2[count++]);
|
||||
i += 1;
|
||||
}
|
||||
delete[] tmpstr;
|
||||
} else {
|
||||
//Looking for an ascii string
|
||||
size = rawData.size();
|
||||
Dest.resize(size+1);
|
||||
tmpstr = new char[size+1];
|
||||
|
||||
tmp2 = &Dest.front();
|
||||
sprintf(tmpstr, "%s", (const char *)rawData.mb_str());
|
||||
|
||||
for(i = 0; i < size; i++)
|
||||
tmp2[i] = tmpstr[i];
|
||||
|
||||
delete[] tmpstr;
|
||||
}
|
||||
|
||||
if(size)
|
||||
{
|
||||
unsigned char* pnt = &Dest.front();
|
||||
unsigned int k = 0;
|
||||
//grab
|
||||
wxString txt = addrbox->GetValue();
|
||||
u32 addr = 0;
|
||||
if (txt.size())
|
||||
{
|
||||
sscanf(txt.mb_str(), "%08x", &addr);
|
||||
}
|
||||
i = addr+4;
|
||||
for( ; i < szRAM; i++)
|
||||
{
|
||||
for(k = 0; k < size; k++)
|
||||
{
|
||||
if(i + k > szRAM) break;
|
||||
if(k > size) break;
|
||||
if(pnt[k] != TheRAM[i+k])
|
||||
{
|
||||
k = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(k == size)
|
||||
{
|
||||
//Match was found
|
||||
wxMessageBox(_("A match was found. Placing viewer at the offset."));
|
||||
wxChar tmpwxstr[128] = {0};
|
||||
wxSprintf(tmpwxstr, _T("%08x"), i);
|
||||
wxString tmpwx(tmpwxstr);
|
||||
addrbox->SetValue(tmpwx);
|
||||
//memview->curAddress = i;
|
||||
//memview->Refresh();
|
||||
OnAddrBoxChange(event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
wxMessageBox(_("No match was found."));
|
||||
}
|
||||
}
|
||||
|
||||
void CMemoryWindow::onAscii(wxCommandEvent& event)
|
||||
{
|
||||
chkHex->SetValue(0);
|
||||
}
|
||||
|
||||
void CMemoryWindow::onHex(wxCommandEvent& event)
|
||||
{
|
||||
chkAscii->SetValue(0);
|
||||
}
|
84
Source/Core/DolphinWX/Src/Debugger/MemoryWindow.h
Normal file
84
Source/Core/DolphinWX/Src/Debugger/MemoryWindow.h
Normal file
@ -0,0 +1,84 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef MEMORYWINDOW_H_
|
||||
#define MEMORYWINDOW_H_
|
||||
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listbox.h>
|
||||
#include "MemoryView.h"
|
||||
#include "Thread.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "CoreParameter.h"
|
||||
|
||||
class CRegisterWindow;
|
||||
class CBreakPointWindow;
|
||||
|
||||
class CMemoryWindow
|
||||
: public wxPanel
|
||||
{
|
||||
public:
|
||||
|
||||
CMemoryWindow(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
|
||||
const wxString& name = _("Memory"));
|
||||
|
||||
wxCheckBox* chk8;
|
||||
wxCheckBox* chk16;
|
||||
wxCheckBox* chk32;
|
||||
wxButton* btnSearch;
|
||||
wxCheckBox* chkAscii;
|
||||
wxCheckBox* chkHex;
|
||||
void Save(IniFile& _IniFile) const;
|
||||
void Load(IniFile& _IniFile);
|
||||
|
||||
void Update();
|
||||
void NotifyMapLoaded();
|
||||
|
||||
void JumpToAddress(u32 _Address);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
CMemoryView* memview;
|
||||
wxListBox* symbols;
|
||||
|
||||
wxButton* buttonGo;
|
||||
wxTextCtrl* addrbox;
|
||||
wxTextCtrl* valbox;
|
||||
|
||||
void U8(wxCommandEvent& event);
|
||||
void U16(wxCommandEvent& event);
|
||||
void U32(wxCommandEvent& event);
|
||||
void onSearch(wxCommandEvent& event);
|
||||
void onAscii(wxCommandEvent& event);
|
||||
void onHex(wxCommandEvent& event);
|
||||
void OnSymbolListChange(wxCommandEvent& event);
|
||||
void OnCallstackListChange(wxCommandEvent& event);
|
||||
void OnAddrBoxChange(wxCommandEvent& event);
|
||||
void OnHostMessage(wxCommandEvent& event);
|
||||
void SetMemoryValue(wxCommandEvent& event);
|
||||
void OnDumpMemory(wxCommandEvent& event);
|
||||
void OnDumpMem2(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif /*MEMORYWINDOW_*/
|
176
Source/Core/DolphinWX/Src/Debugger/RegisterView.cpp
Normal file
176
Source/Core/DolphinWX/Src/Debugger/RegisterView.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include "DebuggerUIUtil.h"
|
||||
#include "RegisterView.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "HW/ProcessorInterface.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
// F-zero 80005e60 wtf??
|
||||
|
||||
extern const char* GetGPRName(unsigned int index);
|
||||
extern const char* GetFPRName(unsigned int index);
|
||||
|
||||
static const char *special_reg_names[] = {
|
||||
"PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause",
|
||||
};
|
||||
|
||||
static u32 GetSpecialRegValue(int reg) {
|
||||
switch (reg) {
|
||||
case 0: return PowerPC::ppcState.pc;
|
||||
case 1: return PowerPC::ppcState.spr[SPR_LR];
|
||||
case 2: return PowerPC::ppcState.spr[SPR_CTR];
|
||||
case 3: return GetCR();
|
||||
case 4: return PowerPC::ppcState.fpscr;
|
||||
case 5: return PowerPC::ppcState.msr;
|
||||
case 6: return PowerPC::ppcState.spr[SPR_SRR0];
|
||||
case 7: return PowerPC::ppcState.spr[SPR_SRR1];
|
||||
case 8: return PowerPC::ppcState.Exceptions;
|
||||
case 9: return ProcessorInterface::GetMask();
|
||||
case 10: return ProcessorInterface::GetCause();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
wxString CRegTable::GetValue(int row, int col)
|
||||
{
|
||||
if (row < 32) {
|
||||
switch (col) {
|
||||
case 0: return wxString::FromAscii(GetGPRName(row));
|
||||
case 1: return wxString::Format(wxT("%08x"), GPR(row));
|
||||
case 2: return wxString::FromAscii(GetFPRName(row));
|
||||
case 3: return wxString::Format(wxT("%016llx"), riPS0(row));
|
||||
case 4: return wxString::Format(wxT("%016llx"), riPS1(row));
|
||||
default: return wxString::FromAscii("");
|
||||
}
|
||||
} else {
|
||||
if (row - 32 < NUM_SPECIALS) {
|
||||
switch (col) {
|
||||
case 0: return wxString::FromAscii(special_reg_names[row - 32]);
|
||||
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
|
||||
default: return wxString::FromAscii("");
|
||||
}
|
||||
}
|
||||
}
|
||||
return wxString::FromAscii("");
|
||||
}
|
||||
|
||||
static void SetSpecialRegValue(int reg, u32 value) {
|
||||
switch (reg) {
|
||||
case 0: PowerPC::ppcState.pc = value; break;
|
||||
case 1: PowerPC::ppcState.spr[SPR_LR] = value; break;
|
||||
case 2: PowerPC::ppcState.spr[SPR_CTR] = value; break;
|
||||
case 3: SetCR(value); break;
|
||||
case 4: PowerPC::ppcState.fpscr = value; break;
|
||||
case 5: PowerPC::ppcState.msr = value; break;
|
||||
case 6: PowerPC::ppcState.spr[SPR_SRR0] = value; break;
|
||||
case 7: PowerPC::ppcState.spr[SPR_SRR1] = value; break;
|
||||
case 8: PowerPC::ppcState.Exceptions = value; break;
|
||||
// Should we just change the value, or use ProcessorInterface::SetInterrupt() to make the system aware?
|
||||
// case 9: return ProcessorInterface::GetMask();
|
||||
// case 10: return ProcessorInterface::GetCause();
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
void CRegTable::SetValue(int row, int col, const wxString& strNewVal)
|
||||
{
|
||||
u32 newVal = 0;
|
||||
if (TryParse(std::string(strNewVal.mb_str()), &newVal))
|
||||
{
|
||||
if (row < 32) {
|
||||
if (col == 1)
|
||||
GPR(row) = newVal;
|
||||
else if (col == 3)
|
||||
riPS0(row) = newVal;
|
||||
else if (col == 4)
|
||||
riPS1(row) = newVal;
|
||||
} else {
|
||||
if ((row - 32 < NUM_SPECIALS) && (col == 1)) {
|
||||
SetSpecialRegValue(row - 32, newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRegTable::UpdateCachedRegs()
|
||||
{
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
m_CachedRegHasChanged[i] = (m_CachedRegs[i] != GPR(i));
|
||||
m_CachedRegs[i] = GPR(i);
|
||||
|
||||
m_CachedFRegHasChanged[i][0] = (m_CachedFRegs[i][0] != riPS0(i));
|
||||
m_CachedFRegs[i][0] = riPS0(i);
|
||||
m_CachedFRegHasChanged[i][1] = (m_CachedFRegs[i][1] != riPS1(i));
|
||||
m_CachedFRegs[i][1] = riPS1(i);
|
||||
}
|
||||
for (int i = 0; i < NUM_SPECIALS; ++i)
|
||||
{
|
||||
m_CachedSpecialRegHasChanged[i] = (m_CachedSpecialRegs[i] != GetSpecialRegValue(i));
|
||||
m_CachedSpecialRegs[i] = GetSpecialRegValue(i);
|
||||
}
|
||||
}
|
||||
|
||||
wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
{
|
||||
wxGridCellAttr *attr = new wxGridCellAttr();
|
||||
|
||||
attr->SetBackgroundColour(wxColour(wxT("#FFFFFF"))); //wxWHITE
|
||||
attr->SetFont(DebuggerFont);
|
||||
|
||||
switch (col) {
|
||||
case 1:
|
||||
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
attr->SetAlignment(wxALIGN_RIGHT, wxALIGN_CENTER);
|
||||
break;
|
||||
default:
|
||||
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
break;
|
||||
}
|
||||
|
||||
bool red = false;
|
||||
switch (col) {
|
||||
case 1: red = row < 32 ? m_CachedRegHasChanged[row] : m_CachedSpecialRegHasChanged[row-32]; break;
|
||||
case 3:
|
||||
case 4: red = row < 32 ? m_CachedFRegHasChanged[row][col-3] : false; break;
|
||||
}
|
||||
attr->SetTextColour(red ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
|
||||
attr->IncRef();
|
||||
return attr;
|
||||
}
|
||||
|
||||
CRegisterView::CRegisterView(wxWindow *parent, wxWindowID id)
|
||||
: wxGrid(parent, id)
|
||||
{
|
||||
SetTable(new CRegTable(), true);
|
||||
SetRowLabelSize(0);
|
||||
SetColLabelSize(0);
|
||||
DisableDragRowSize();
|
||||
|
||||
AutoSizeColumns();
|
||||
}
|
||||
|
||||
void CRegisterView::Update()
|
||||
{
|
||||
ForceRefresh();
|
||||
((CRegTable *)GetTable())->UpdateCachedRegs();
|
||||
}
|
82
Source/Core/DolphinWX/Src/Debugger/RegisterView.h
Normal file
82
Source/Core/DolphinWX/Src/Debugger/RegisterView.h
Normal file
@ -0,0 +1,82 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __REGISTERVIEW_h__
|
||||
#define __REGISTERVIEW_h__
|
||||
|
||||
#include <wx/grid.h>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// New register view:
|
||||
// R0 0x8000000 F0 0.0000 F0_PS1 0.0000
|
||||
// R1 0x8000000 F1 0.0000 F1_PS1 0.0000
|
||||
// R31 0x8000000 F31 0.0000 F31_PS1 0.0000
|
||||
// PC (specials)
|
||||
// LR
|
||||
// CTR
|
||||
// CR0-7
|
||||
// FPSCR
|
||||
// MSR
|
||||
// SRR0
|
||||
// SRR1
|
||||
// Exceptions
|
||||
// Interrupt Mask (PI)
|
||||
// Interrupt Cause(PI)
|
||||
|
||||
class CRegTable : public wxGridTableBase
|
||||
{
|
||||
enum {
|
||||
NUM_SPECIALS = 11,
|
||||
};
|
||||
|
||||
public:
|
||||
CRegTable() {
|
||||
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
|
||||
memset(m_CachedSpecialRegs, 0, sizeof(m_CachedSpecialRegs));
|
||||
memset(m_CachedFRegs, 0, sizeof(m_CachedFRegs));
|
||||
memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged));
|
||||
memset(m_CachedSpecialRegHasChanged, 0, sizeof(m_CachedSpecialRegHasChanged));
|
||||
memset(m_CachedFRegHasChanged, 0, sizeof(m_CachedFRegHasChanged));
|
||||
}
|
||||
int GetNumberCols(void) {return 5;}
|
||||
int GetNumberRows(void) {return 32 + NUM_SPECIALS;}
|
||||
bool IsEmptyCell(int row, int col) {return row > 31 && col > 2;}
|
||||
wxString GetValue(int row, int col);
|
||||
void SetValue(int row, int col, const wxString &);
|
||||
wxGridCellAttr *GetAttr(int, int, wxGridCellAttr::wxAttrKind);
|
||||
void UpdateCachedRegs();
|
||||
|
||||
private:
|
||||
u32 m_CachedRegs[32];
|
||||
u32 m_CachedSpecialRegs[NUM_SPECIALS];
|
||||
u64 m_CachedFRegs[32][2];
|
||||
bool m_CachedRegHasChanged[32];
|
||||
bool m_CachedSpecialRegHasChanged[NUM_SPECIALS];
|
||||
bool m_CachedFRegHasChanged[32][2];
|
||||
|
||||
DECLARE_NO_COPY_CLASS(CRegTable);
|
||||
};
|
||||
|
||||
class CRegisterView : public wxGrid
|
||||
{
|
||||
public:
|
||||
CRegisterView(wxWindow* parent, wxWindowID id);
|
||||
void Update();
|
||||
};
|
||||
|
||||
#endif
|
56
Source/Core/DolphinWX/Src/Debugger/RegisterWindow.cpp
Normal file
56
Source/Core/DolphinWX/Src/Debugger/RegisterWindow.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "RegisterWindow.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "RegisterView.h"
|
||||
|
||||
extern const char* GetGRPName(unsigned int index);
|
||||
|
||||
BEGIN_EVENT_TABLE(CRegisterWindow, wxPanel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& position, const wxSize& size,
|
||||
long style, const wxString& name)
|
||||
: wxPanel(parent, id, position, size, style, name)
|
||||
, m_GPRGridView(NULL)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
void CRegisterWindow::CreateGUIControls()
|
||||
{
|
||||
wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL);
|
||||
m_GPRGridView = new CRegisterView(this, ID_GPR);
|
||||
sGrid->Add(m_GPRGridView, 1, wxGROW);
|
||||
SetSizer(sGrid);
|
||||
sGrid->SetSizeHints(this);
|
||||
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
void CRegisterWindow::NotifyUpdate()
|
||||
{
|
||||
if (m_GPRGridView != NULL)
|
||||
{
|
||||
m_GPRGridView->Update();
|
||||
}
|
||||
}
|
50
Source/Core/DolphinWX/Src/Debugger/RegisterWindow.h
Normal file
50
Source/Core/DolphinWX/Src/Debugger/RegisterWindow.h
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef __REGISTERWINDOW_h__
|
||||
#define __REGISTERWINDOW_h__
|
||||
|
||||
class CRegisterView;
|
||||
class IniFile;
|
||||
|
||||
class CRegisterWindow
|
||||
: public wxPanel
|
||||
{
|
||||
public:
|
||||
CRegisterWindow(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = _("Registers"));
|
||||
|
||||
void NotifyUpdate();
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
enum
|
||||
{
|
||||
ID_GPR = 1002
|
||||
};
|
||||
|
||||
CRegisterView* m_GPRGridView;
|
||||
void CreateGUIControls();
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user