summaryrefslogtreecommitdiff
path: root/Source/Core/DebuggerWX
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-06-21 08:39:21 +0000
committerhrydgard <hrydgard@gmail.com>2009-06-21 08:39:21 +0000
commitaecaf271f1fe98cba1ebc8228ff9eff3e39e72c5 (patch)
tree4c82001793b35149ae81fcb483f13b22d3b6fa11 /Source/Core/DebuggerWX
parent80217a6ed718d15c75784090340cd3ddd9432f96 (diff)
New DSP debugger: step one. (not ready yet, but try loading zelda WW and look at the dsp debugger..).
Had to shuffle around quite a lot of code to be able to extract the CodeView into a library nicely so it can be used from both the main dolphin and the LLE plugin... also extracted the symboldb code. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3517 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DebuggerWX')
-rw-r--r--Source/Core/DebuggerWX/DebuggerWX.vcproj23
-rw-r--r--Source/Core/DebuggerWX/Src/BreakPointDlg.cpp2
-rw-r--r--Source/Core/DebuggerWX/Src/BreakpointView.cpp10
-rw-r--r--Source/Core/DebuggerWX/Src/BreakpointWindow.cpp6
-rw-r--r--Source/Core/DebuggerWX/Src/CodeView.cpp595
-rw-r--r--Source/Core/DebuggerWX/Src/CodeView.h88
-rw-r--r--Source/Core/DebuggerWX/Src/CodeWindow.cpp9
-rw-r--r--Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp5
-rw-r--r--Source/Core/DebuggerWX/Src/Debugger.h17
-rw-r--r--Source/Core/DebuggerWX/Src/MemoryCheckDlg.cpp2
-rw-r--r--Source/Core/DebuggerWX/Src/MemoryView.h2
-rw-r--r--Source/Core/DebuggerWX/Src/MemoryWindow.cpp2
-rw-r--r--Source/Core/DebuggerWX/Src/SConscript2
13 files changed, 26 insertions, 737 deletions
diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj
index 9e479a75fd..3f84875fb0 100644
--- a/Source/Core/DebuggerWX/DebuggerWX.vcproj
+++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="Debugger"
ProjectGUID="{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}"
RootNamespace="DebuggerWX"
@@ -46,7 +46,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
+ AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -112,7 +112,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
+ AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
ExceptionHandling="2"
@@ -177,7 +177,7 @@
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
+ AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@@ -242,7 +242,7 @@
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
+ AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@@ -306,7 +306,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
+ AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST"
MinimalRebuild="true"
BasicRuntimeChecks="0"
@@ -372,9 +372,8 @@
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
WholeProgramOptimization="false"
- AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
+ AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerUICommon\Src"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -428,14 +427,6 @@
>
</File>
<File
- RelativePath=".\src\CodeView.cpp"
- >
- </File>
- <File
- RelativePath=".\src\CodeView.h"
- >
- </File>
- <File
RelativePath=".\src\MemoryView.cpp"
>
</File>
diff --git a/Source/Core/DebuggerWX/Src/BreakPointDlg.cpp b/Source/Core/DebuggerWX/Src/BreakPointDlg.cpp
index 86a597794e..85e8cf8b31 100644
--- a/Source/Core/DebuggerWX/Src/BreakPointDlg.cpp
+++ b/Source/Core/DebuggerWX/Src/BreakPointDlg.cpp
@@ -72,7 +72,7 @@ void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
u32 Address = 0;
if (AsciiToHex(AddressString.mb_str(), Address))
{
- BreakPoints::Add(Address);
+ g_breakpoints.Add(Address);
Host_UpdateBreakPointView();
Close();
}
diff --git a/Source/Core/DebuggerWX/Src/BreakpointView.cpp b/Source/Core/DebuggerWX/Src/BreakpointView.cpp
index b8257ae219..4c47987709 100644
--- a/Source/Core/DebuggerWX/Src/BreakpointView.cpp
+++ b/Source/Core/DebuggerWX/Src/BreakpointView.cpp
@@ -21,7 +21,7 @@
#include "BreakpointView.h"
#include "Debugger/Debugger_BreakPoints.h"
#include "Debugger/Debugger_SymbolMap.h"
-#include "PowerPC/SymbolDB.h"
+#include "PowerPC/PPCSymbolDB.h"
BEGIN_EVENT_TABLE(CBreakPointView, wxListCtrl)
@@ -47,7 +47,7 @@ void CBreakPointView::Update()
InsertColumn(4, wxT("Flags"), wxLIST_FORMAT_CENTER, 100);
char szBuffer[64];
- const BreakPoints::TBreakPoints& rBreakPoints = BreakPoints::GetBreakPoints();
+ const BreakPoints::TBreakPoints& rBreakPoints = g_breakpoints.GetBreakPoints();
for (size_t i = 0; i < rBreakPoints.size(); i++)
{
const TBreakPoint& rBP = rBreakPoints[i];
@@ -74,7 +74,7 @@ void CBreakPointView::Update()
}
}
- const MemChecks::TMemChecks& rMemChecks = MemChecks::GetMemChecks();
+ const MemChecks::TMemChecks& rMemChecks = g_memchecks.GetMemChecks();
for (size_t i = 0; i < rMemChecks.size(); i++)
{
const TMemCheck& rMemCheck = rMemChecks[i];
@@ -115,8 +115,8 @@ void CBreakPointView::DeleteCurrentSelection()
if (Item >= 0)
{
u32 Address = (u32)GetItemData(Item);
- BreakPoints::DeleteByAddress(Address);
- MemChecks::DeleteByAddress(Address);
+ g_breakpoints.DeleteByAddress(Address);
+ g_memchecks.DeleteByAddress(Address);
Update();
}
}
diff --git a/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp b/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp
index 0e009f7591..4277f6d341 100644
--- a/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp
@@ -205,7 +205,7 @@ CBreakPointWindow::OnDelete(wxCommandEvent& event)
void
CBreakPointWindow::OnClear(wxCommandEvent& event)
{
- BreakPoints::Clear();
+ g_breakpoints.Clear();
}
// ============
@@ -244,7 +244,7 @@ CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
u32 Address = 0;
if (AsciiToHex(line.c_str(), Address))
{
- BreakPoints::Add(Address);
+ g_breakpoints.Add(Address);
}
}
// only update after we are done with the loop
@@ -346,7 +346,7 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
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
- MemChecks::Add(MemCheck);
+ g_memchecks.Add(MemCheck);
}
}
// update after we are done with the loop
diff --git a/Source/Core/DebuggerWX/Src/CodeView.cpp b/Source/Core/DebuggerWX/Src/CodeView.cpp
deleted file mode 100644
index 07aee49901..0000000000
--- a/Source/Core/DebuggerWX/Src/CodeView.cpp
+++ /dev/null
@@ -1,595 +0,0 @@
-// Copyright (C) 2003-2008 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 "Debugger.h"
-#include "Debugger/PPCDebugInterface.h"
-#include "PowerPC/SymbolDB.h"
-#include "HW/Memmap.h" // for Write_U32
-#include "Common.h"
-#include "StringUtil.h"
-#include "Debugger/DebugInterface.h"
-
-#include "Host.h"
-#include "CodeView.h"
-#include "JitWindow.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, 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),
- 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
- {
- debugger->toggleBreakpoint(YToAddress(y));
- redraw();
- Host_UpdateBreakPointView();
- }
-
- event.Skip(true);
-}
-
-
-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)
- {
- Memory::Write_U32(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 = g_symbolDB.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:
- CJitWindow::ViewAddr(selection);
- break;
-
- case IDM_FOLLOWBRANCH:
- {
- u32 dest = AddrToBranch(selection);
- if (dest)
- Center(dest);
- RaiseEvent();
- }
- break;
-
- case IDM_ADDFUNCTION:
- {
- g_symbolDB.AddFunction(selection);
- Host_NotifyMapLoaded();
- }
- break;
-
- case IDM_RENAMESYMBOL:
- {
- Symbol *symbol = g_symbolDB.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();
- Host_NotifyMapLoaded();
- }
- }
- break;
-
- case IDM_PATCHALERT:
- {
-
- }
- break;
- }
-
-#if wxUSE_CLIPBOARD
- wxTheClipboard->Close();
-#endif
- event.Skip(true);
-}
-
-
-void CCodeView::OnMouseUpR(wxMouseEvent& event)
-{
- bool isSymbol = g_symbolDB.GetSymbolFromAddr(selection) != 0;
- // popup menu
- wxMenu menu;
- //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, _T("&Run To Here"));
- menu.Append(IDM_ADDFUNCTION, _T("&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")); // the ... ? ... is light gray
- wxBrush pcBrush(_T("#70FF70")); // the selected code line is 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);
- dc.SetTextForeground(_T("#600000")); // the address text is dark red
- dc.DrawText(temp, 17, rowY1);
- dc.SetTextForeground(_T("#000000"));
-
- 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++;
- const char* mojs = strstr(dis2, "0x8");
-
- // --------------------------------------------------------------------
- // Colors and brushes
- // -------------------------
- 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;
- }
- }
- }
- // ------------
-
-
- // --------------------------------------------------------------------
- // Colors and brushes
- // -------------------------
- 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), 80, rowY1);
-
- if (desc[0] == 0)
- {
- strcpy(desc, debugger->getDescription(address).c_str());
- }
-
- 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);
- //DrawIconEx(hdc, 2, rowY1, breakPoint, 32, 32, 0, 0, DI_NORMAL);
- }
- }
- } // 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;
-}
-
diff --git a/Source/Core/DebuggerWX/Src/CodeView.h b/Source/Core/DebuggerWX/Src/CodeView.h
deleted file mode 100644
index d6692431e7..0000000000
--- a/Source/Core/DebuggerWX/Src/CodeView.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (C) 2003-2008 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_
-
-#include "Debugger.h"
-#include "Common.h"
-
-#include <vector>
-
-DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1);
-
-class DebugInterface;
-
-class CCodeView : public wxControl
-{
-public:
- CCodeView(DebugInterface* debuginterface, 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);}
-
- struct BlrStruct // for IDM_INSERTBLR
- {
- u32 Address;
- u32 OldValue;
- };
- std::vector<BlrStruct> BlrList;
-
- void Center(u32 addr)
- {
- curAddress = addr;
- selection = addr;
- redraw();
- }
-
-private:
- void RaiseEvent();
- int YToAddress(int y);
-
- u32 AddrToBranch(u32 addr);
-
- void redraw() {Refresh();}
-
- DebugInterface* debugger;
-
- 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_*/
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index 145b1d0253..c202b970cb 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -54,7 +54,7 @@
#include "Debugger/Debugger_SymbolMap.h"
#include "PowerPC/PPCAnalyst.h"
#include "PowerPC/Profiler.h"
-#include "PowerPC/SymbolDB.h"
+#include "PowerPC/PPCSymbolDB.h"
#include "PowerPC/SignatureDB.h"
#include "PowerPC/PPCTables.h"
#include "PowerPC/Jit64/Jit.h"
@@ -79,9 +79,6 @@ class CPluginManager;
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
-// The default font
-wxFont DebuggerFont = wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false, wxT("monospace"));
-
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
@@ -358,7 +355,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
DebugInterface* di = new PPCDebugInterface();
- codeview = new CCodeView(di, this, ID_CODEVIEW);
+ codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW);
sizerBig->Add(sizerLeft, 2, wxEXPAND);
sizerBig->Add(codeview, 5, wxEXPAND);
@@ -375,8 +372,6 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
sizerBig->Fit(this);
sync_event.Init();
-
-
if (bRegisterWindow)
{
diff --git a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp
index f8bd2274a1..8eb31000be 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp
@@ -39,6 +39,7 @@
#include "Host.h"
#include "Debugger.h"
+#include "DebuggerUIUtil.h"
#include "RegisterWindow.h"
#include "BreakpointWindow.h"
@@ -59,7 +60,7 @@
#include "Debugger/Debugger_SymbolMap.h"
#include "PowerPC/PPCAnalyst.h"
#include "PowerPC/Profiler.h"
-#include "PowerPC/SymbolDB.h"
+#include "PowerPC/PPCSymbolDB.h"
#include "PowerPC/SignatureDB.h"
#include "PowerPC/PPCTables.h"
#include "PowerPC/Jit64/Jit.h"
@@ -273,7 +274,7 @@ void CCodeWindow::NotifyMapLoaded()
//symbols->Show(false); // hide it for faster filling
symbols->Freeze(); // HyperIris: wx style fast filling
symbols->Clear();
- for (SymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); iter++)
+ 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);
diff --git a/Source/Core/DebuggerWX/Src/Debugger.h b/Source/Core/DebuggerWX/Src/Debugger.h
index 7a32f67410..92ebe60a74 100644
--- a/Source/Core/DebuggerWX/Src/Debugger.h
+++ b/Source/Core/DebuggerWX/Src/Debugger.h
@@ -18,23 +18,10 @@
#ifndef _DEBUGGER_H
#define _DEBUGGER_H
-
-#define wxUSE_XPM_IN_MSW 1
-#define USE_XPM_BITMAPS 1
-
#include <wx/wx.h>
-#include "IniFile.h"
-
-// Defined in CodeWindow.cpp
-extern wxFont DebuggerFont;
+#include "DebuggerUIUtil.h"
-
-// define this to use XPMs everywhere (by default, BMPs are used under Win)
-// BMPs use less space, but aren't compiled into the executable on other platforms
-
-#if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW
-#error You need to enable XPM support to use XPM bitmaps with toolbar!
-#endif // USE_XPM_BITMAPS
+#include "IniFile.h"
#endif
diff --git a/Source/Core/DebuggerWX/Src/MemoryCheckDlg.cpp b/Source/Core/DebuggerWX/Src/MemoryCheckDlg.cpp
index 3008821a84..2fdf39fb4e 100644
--- a/Source/Core/DebuggerWX/Src/MemoryCheckDlg.cpp
+++ b/Source/Core/DebuggerWX/Src/MemoryCheckDlg.cpp
@@ -91,7 +91,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/)
MemCheck.Log = true;
MemCheck.Break = true;
- MemChecks::Add(MemCheck);
+ g_memchecks.Add(MemCheck);
Host_UpdateBreakPointView();
Close();
}
diff --git a/Source/Core/DebuggerWX/Src/MemoryView.h b/Source/Core/DebuggerWX/Src/MemoryView.h
index 1d42c821c9..70c1371f85 100644
--- a/Source/Core/DebuggerWX/Src/MemoryView.h
+++ b/Source/Core/DebuggerWX/Src/MemoryView.h
@@ -20,7 +20,7 @@
#include "Debugger.h"
#include "Common.h"
-#include "Debugger/DebugInterface.h"
+#include "DebugInterface.h"
class CMemoryView : public wxControl
{
diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp
index fd9711137d..a17ee545e8 100644
--- a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp
@@ -29,7 +29,7 @@
#include "Host.h"
#include "Debugger/PPCDebugInterface.h"
-#include "PowerPC/SymbolDB.h"
+#include "PowerPC/PPCSymbolDB.h"
#include "Core.h"
#include "LogManager.h"
diff --git a/Source/Core/DebuggerWX/Src/SConscript b/Source/Core/DebuggerWX/Src/SConscript
index 75b784cad7..9642d3e723 100644
--- a/Source/Core/DebuggerWX/Src/SConscript
+++ b/Source/Core/DebuggerWX/Src/SConscript
@@ -8,11 +8,9 @@ if not env['HAVE_WX']:
files = [
"BreakPointDlg.cpp",
"BreakpointView.cpp",
- "CodeView.cpp",
"BreakpointWindow.cpp",
"CodeWindow.cpp",
"CodeWindowSJP.cpp",
- "CodeView.cpp",
"MemoryCheckDlg.cpp",
"MemoryView.cpp",
"MemoryWindow.cpp",