diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj index bfd4fbfe2c..ccb0a04cd3 100644 --- a/Source/Core/Common/Common.vcproj +++ b/Source/Core/Common/Common.vcproj @@ -556,6 +556,14 @@ RelativePath=".\Src\ABI.h" > + + + + diff --git a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp b/Source/Core/Common/Src/BreakPoints.cpp similarity index 90% rename from Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp rename to Source/Core/Common/Src/BreakPoints.cpp index c62b62bac9..446852028c 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.cpp +++ b/Source/Core/Common/Src/BreakPoints.cpp @@ -17,12 +17,10 @@ #include "Common.h" -#include "../HW/CPU.h" -#include "../Host.h" -#include "../PowerPC/PPCSymbolDB.h" -#include "Debugger_BreakPoints.h" +#include "DebugInterface.h" +#include "BreakPoints.h" -void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc) +void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc) { if ((write && OnWrite) || (!write && OnRead)) { @@ -31,11 +29,11 @@ void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc) DEBUG_LOG(MEMMAP, "CHK %08x %s%i at %08x (%s)", iValue, write ? "Write" : "Read", // read or write size*8, addr, // address - g_symbolDB.GetDescription(addr) // symbol map description + debug_interface->GetDescription(addr).c_str() // symbol map description ); } if (Break) - CCPU::Break(); + debug_interface->breakNow(); } } @@ -92,7 +90,6 @@ bool BreakPoints::Remove(u32 _iAddress) void BreakPoints::Clear() { m_BreakPoints.clear(); - Host_UpdateBreakPointView(); } void BreakPoints::DeleteByAddress(u32 _Address) @@ -151,8 +148,7 @@ void MemChecks::DeleteByAddress(u32 _Address) if ((*iter).StartAddress == _Address) { m_MemChecks.erase(iter); - Host_UpdateBreakPointView(); - return; + return; } } } diff --git a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h b/Source/Core/Common/Src/BreakPoints.h similarity index 94% rename from Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h rename to Source/Core/Common/Src/BreakPoints.h index d9f1727187..ef40da7419 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h +++ b/Source/Core/Common/Src/BreakPoints.h @@ -23,6 +23,8 @@ #include "Common.h" +class DebugInterface; + struct TBreakPoint { u32 iAddress; @@ -48,7 +50,7 @@ struct TMemCheck u32 numHits; - void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc); + void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr, bool write, int size, u32 pc); }; // Code breakpoints. diff --git a/Source/Core/Common/Src/DebugInterface.h b/Source/Core/Common/Src/DebugInterface.h index 804125b8dd..3e8a93e8b9 100644 --- a/Source/Core/Common/Src/DebugInterface.h +++ b/Source/Core/Common/Src/DebugInterface.h @@ -27,6 +27,7 @@ public: virtual void setPC(unsigned int /*address*/) {} virtual void step() {} virtual void runToBreakpoint() {} + virtual void breakNow() {} virtual void insertBLR(unsigned int /*address*/, unsigned int) {} virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} virtual std::string getDescription(unsigned int /*address*/) = 0; diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index 6ceba317a2..07e6ff313f 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -5,6 +5,7 @@ import sys files = [ "ABI.cpp", + "BreakPoints.cpp", "CDUtils.cpp", "ChunkFile.cpp", "ColorUtil.cpp", diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index fcdc3f20f4..e40e00554e 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -1987,14 +1987,6 @@ - - - - diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index 63c26e0490..dc2f9759e7 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -33,7 +33,6 @@ #include "../HW/CPU.h" #include "../Debugger/Debugger_SymbolMap.h" // Debugger -#include "../Debugger/Debugger_BreakPoints.h" #include "Boot_DOL.h" #include "Boot.h" @@ -147,7 +146,7 @@ bool CBoot::Load_BIOS(const std::string& _rBiosFilename) if (!File::ReadFileToString(false, _rBiosFilename.c_str(), data)) return false; - Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, data.size() - 0x820); + Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, (int)data.size() - 0x820); PC = 0x81300000; return true; } diff --git a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp index d2a5473554..2acb4ffef2 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp +++ b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp @@ -18,7 +18,6 @@ #include "Common.h" #include "StringUtil.h" #include "Debugger_SymbolMap.h" -#include "Debugger_BreakPoints.h" #include "../Core.h" #include "../HW/Memmap.h" #include "../PowerPC/PowerPC.h" diff --git a/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp index 56eab23c6d..92d88665c6 100644 --- a/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp +++ b/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp @@ -15,12 +15,12 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "Debugger_BreakPoints.h" #include "Debugger_SymbolMap.h" #include "DebugInterface.h" #include "PPCDebugInterface.h" #include "PowerPCDisasm.h" #include "../Core.h" +#include "../HW/CPU.h" #include "../HW/DSP.h" #include "../HW/Memmap.h" #include "../PowerPC/PowerPC.h" @@ -134,6 +134,11 @@ void PPCDebugInterface::insertBLR(unsigned int address, unsigned int value) Memory::Write_U32(value, address); } +void PPCDebugInterface::breakNow() +{ + CCPU::Break(); +} + // ======================================================= // Separate the blocks with colors. diff --git a/Source/Core/Core/Src/Debugger/PPCDebugInterface.h b/Source/Core/Core/Src/Debugger/PPCDebugInterface.h index 3deb54c01b..f0886a3ce7 100644 --- a/Source/Core/Core/Src/Debugger/PPCDebugInterface.h +++ b/Source/Core/Core/Src/Debugger/PPCDebugInterface.h @@ -4,7 +4,7 @@ #include #include "DebugInterface.h" -#include "Debugger_Breakpoints.h" + //wrapper between disasm control and Dolphin debugger class PPCDebugInterface : public DebugInterface @@ -30,6 +30,7 @@ public: virtual unsigned int getPC(); virtual void setPC(unsigned int address); virtual void step() {} + virtual void breakNow(); virtual void runToBreakpoint(); virtual void insertBLR(unsigned int address, unsigned int); virtual int getColor(unsigned int address); diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp index 629906b51d..ac8e6a972a 100644 --- a/Source/Core/Core/Src/HLE/HLE.cpp +++ b/Source/Core/Core/Src/HLE/HLE.cpp @@ -24,7 +24,6 @@ #include "../PowerPC/PPCSymbolDB.h" #include "../HW/Memmap.h" #include "../Debugger/Debugger_SymbolMap.h" -#include "../Debugger/Debugger_BreakPoints.h" #include "HLE_OS.h" #include "HLE_Misc.h" diff --git a/Source/Core/Core/Src/HW/CPU.cpp b/Source/Core/Core/Src/HW/CPU.cpp index 7d9337d0b6..5b29231d3d 100644 --- a/Source/Core/Core/Src/HW/CPU.cpp +++ b/Source/Core/Core/Src/HW/CPU.cpp @@ -23,8 +23,6 @@ #include "../Core.h" #include "CPU.h" -#include "../Debugger/Debugger_BreakPoints.h" - namespace { static bool g_Branch; diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index e250c78dcf..a58d171dc9 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -46,7 +46,6 @@ may be redirected here (for example to Read_U32()). #include "WII_IOB.h" #include "WII_IPC.h" #include "../ConfigManager.h" -#include "../Debugger/Debugger_BreakPoints.h" #include "../Debugger/Debugger_SymbolMap.h" ///////////////////////////// diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index 27f0aaaf88..77f76ad332 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -257,7 +257,7 @@ u8 Read_U8(const u32 _Address) if (mc) { mc->numHits++; - mc->Action(_var, _Address,false, 1, PC); + mc->Action(&PowerPC::debug_interface, _var, _Address, false, 1, PC); } #endif return (u8)_var; @@ -272,7 +272,7 @@ u16 Read_U16(const u32 _Address) if (mc) { mc->numHits++; - mc->Action(_var, _Address,false, 2, PC); + mc->Action(&PowerPC::debug_interface, _var, _Address, false, 2, PC); } #endif return (u16)_var; @@ -294,7 +294,7 @@ u32 Read_U32(const u32 _Address) if (mc) { mc->numHits++; - mc->Action(_var, _Address, false, 4, PC); + mc->Action(&PowerPC::debug_interface, _var, _Address, false, 4, PC); } #endif return _var; @@ -310,7 +310,7 @@ u64 Read_U64(const u32 _Address) if (mc) { mc->numHits++; - mc->Action((u32)_var, _Address, false, 8, PC); + mc->Action(&PowerPC::debug_interface, (u32)_var, _Address, false, 8, PC); } #endif return _var; @@ -324,7 +324,7 @@ void Write_U8(const u8 _Data, const u32 _Address) if (mc) { mc->numHits++; - mc->Action(_Data,_Address,true,1,PC); + mc->Action(&PowerPC::debug_interface, _Data,_Address,true,1,PC); } #endif WriteToHardware(_Address, _Data, _Address, FLAG_WRITE); @@ -338,7 +338,7 @@ void Write_U16(const u16 _Data, const u32 _Address) if (mc) { mc->numHits++; - mc->Action(_Data,_Address,true,2,PC); + mc->Action(&PowerPC::debug_interface, _Data,_Address,true,2,PC); } #endif @@ -353,7 +353,7 @@ void Write_U32(const u32 _Data, const u32 _Address) if (mc) { mc->numHits++; - mc->Action(_Data,_Address,true,4,PC); + mc->Action(&PowerPC::debug_interface, _Data,_Address,true,4,PC); } #endif WriteToHardware(_Address, _Data, _Address, FLAG_WRITE); @@ -367,7 +367,7 @@ void Write_U64(const u64 _Data, const u32 _Address) if (mc) { mc->numHits++; - mc->Action((u32)_Data,_Address,true,8,PC); + mc->Action(&PowerPC::debug_interface, (u32)_Data,_Address,true,8,PC); } #endif diff --git a/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp index 26ea34cf96..67d4f48ac5 100644 --- a/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp @@ -22,6 +22,7 @@ #include #include "../HW/Memmap.h" +#include "../PowerPC/PowerPC.h" #include "PPCSymbolDB.h" #include "SignatureDB.h" #include "PPCAnalyst.h" @@ -31,7 +32,7 @@ PPCSymbolDB g_symbolDB; PPCSymbolDB::PPCSymbolDB() { // Get access to the disasm() fgnction - debugger = new PPCDebugInterface(); + debugger = &PowerPC::debug_interface; } PPCSymbolDB::~PPCSymbolDB() diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.cpp b/Source/Core/Core/Src/PowerPC/PowerPC.cpp index cf43e26116..d3ec9a9432 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/Src/PowerPC/PowerPC.cpp @@ -44,6 +44,7 @@ static CoreMode mode; BreakPoints breakpoints; MemChecks memchecks; +PPCDebugInterface debug_interface; void CompactCR() { diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.h b/Source/Core/Core/Src/PowerPC/PowerPC.h index 7b22f3067d..6697d5277d 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.h +++ b/Source/Core/Core/Src/PowerPC/PowerPC.h @@ -20,7 +20,8 @@ #include "Common.h" #include "Gekko.h" -#include "../Debugger/Debugger_BreakPoints.h" +#include "BreakPoints.h" +#include "../Debugger/PPCDebugInterface.h" class PointerWrap; @@ -76,6 +77,7 @@ extern PowerPCState ppcState; extern BreakPoints breakpoints; extern MemChecks memchecks; +extern PPCDebugInterface debug_interface; void Init(); void Shutdown(); diff --git a/Source/Core/Core/Src/SConscript b/Source/Core/Core/Src/SConscript index 0cba5ef7c0..f1d9b63d5f 100644 --- a/Source/Core/Core/Src/SConscript +++ b/Source/Core/Core/Src/SConscript @@ -24,11 +24,9 @@ files = ["ActionReplay.cpp", "Boot/Boot_ELF.cpp", "Boot/Boot_WiiWAD.cpp", "Boot/ElfReader.cpp", - "Debugger/Debugger_BreakPoints.cpp", "Debugger/Debugger_SymbolMap.cpp", "Debugger/Dump.cpp", "Debugger/PPCDebugInterface.cpp", -# "Debugger/GClibloc.cpp", #Outdated "HW/AudioInterface.cpp", "HW/CommandProcessor.cpp", "HW/CPU.cpp", diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index c202b970cb..3fc2794d4a 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -353,7 +353,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL); - DebugInterface* di = new PPCDebugInterface(); + DebugInterface* di = &PowerPC::debug_interface; codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW); sizerBig->Add(sizerLeft, 2, wxEXPAND); diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp index a17ee545e8..a93d095d14 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp @@ -66,7 +66,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, // didn't see anything usefull in the left part //wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL); - DebugInterface* di = new PPCDebugInterface(); + DebugInterface* di = &PowerPC::debug_interface; //sizerLeft->Add(symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, wxSize(20, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND); memview = new CMemoryView(di, this, wxID_ANY);