diff options
| author | hrydgard <hrydgard@gmail.com> | 2009-06-07 11:06:40 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2009-06-07 11:06:40 +0000 |
| commit | bb06a53e28ee3403e92e42aeba303ac69aecf3d6 (patch) | |
| tree | 2621a68067ad0a6b29653c2b6f62c339ab579442 /Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp | |
| parent | 89cd1a4a76b02f24a9477c4c5b5db84d6565b9b2 (diff) | |
DSP LLE: Just some renaming and cleanup. Prepared for proper base address support in disassembly. Added a "DebugInterface" for the DSP which would allow us to hook up a CodeView .. although CoreView currently doesn't have any support for variable-length instructions.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3351 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp')
| -rw-r--r-- | Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp new file mode 100644 index 0000000000..540add418d --- /dev/null +++ b/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp @@ -0,0 +1,183 @@ +// Copyright (C) 2003-2009 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 "DSPDebugInterface.h"
+
+#include "DSPCore.h"
+#include "disassemble.h"
+
+void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
+{
+ AssemblerSettings settings;
+ settings.print_tabs = true;
+
+ u16 pc = address;
+ DSPDisassembler dis(settings);
+
+ u16 base = 0;
+ const u16 *binbuf = g_dsp.iram;
+ if (pc & 0x8000)
+ {
+ binbuf = g_dsp.irom;
+ base = 0x8000;
+ }
+
+ std::string text;
+ dis.DisOpcode(binbuf, base, 2, &pc, text);
+ strncpy(dest, text.c_str(), max_size);
+ dest[max_size - 1] = '\0';
+
+ /*
+ if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ {
+ if (Memory::IsRAMAddress(address, true))
+ {
+ u32 op = Memory::Read_Instruction(address);
+ DisassembleGekko(op, address, dest, max_size);
+ UGeckoInstruction inst;
+ inst.hex = Memory::ReadUnchecked_U32(address);
+ if (inst.OPCD == 1) {
+ strcat(dest, " (hle)");
+ }
+ }
+ else
+ {
+ strcpy(dest, "(No RAM here)");
+ }
+ }
+ else
+ {
+ strcpy(dest, "<unknown>");
+ }*/
+}
+
+void DSPDebugInterface::getRawMemoryString(unsigned int address, char *dest, int max_size)
+{
+ /*
+ if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ {
+ if (Memory::IsRAMAddress(address, true))
+ {
+ snprintf(dest, max_size, "%08X", readMemory(address));
+ }
+ else
+ {
+ strcpy(dest, "--------");
+ }
+ }
+ else
+ {
+ strcpy(dest, "<unknwn>"); // bad spelling - 8 chars
+ }*/
+}
+
+unsigned int DSPDebugInterface::readMemory(unsigned int address)
+{
+ return 0; //Memory::ReadUnchecked_U32(address);
+}
+
+unsigned int DSPDebugInterface::readInstruction(unsigned int address)
+{
+ return 0; //Memory::Read_Instruction(address);
+}
+
+bool DSPDebugInterface::isAlive()
+{
+ return true; //Core::GetState() != Core::CORE_UNINITIALIZED;
+}
+
+bool DSPDebugInterface::isBreakpoint(unsigned int address)
+{
+ return false; //BreakPoints::IsAddressBreakPoint(address);
+}
+
+void DSPDebugInterface::setBreakpoint(unsigned int address)
+{
+ //if (BreakPoints::Add(address))
+ // jit.NotifyBreakpoint(address, true);
+}
+
+void DSPDebugInterface::clearBreakpoint(unsigned int address)
+{
+ //if (BreakPoints::Remove(address))
+ // jit.NotifyBreakpoint(address, false);
+}
+
+void DSPDebugInterface::clearAllBreakpoints() {}
+
+void DSPDebugInterface::toggleBreakpoint(unsigned int address)
+{
+ //if (BreakPoints::IsAddressBreakPoint(address))
+ // BreakPoints::Remove(address);
+ //else
+ // BreakPoints::Add(address);
+}
+
+void DSPDebugInterface::insertBLR(unsigned int address)
+{
+ // Memory::Write_U32(0x4e800020, address);
+}
+
+
+// =======================================================
+// Separate the blocks with colors.
+// -------------
+int DSPDebugInterface::getColor(unsigned int address)
+{
+ return 0xEEEEEE;
+ /*
+ if (!Memory::IsRAMAddress(address, true))
+ return 0xeeeeee;
+ static const int colors[6] =
+ {
+ 0xd0FFFF, // light cyan
+ 0xFFd0d0, // light red
+ 0xd8d8FF, // light blue
+ 0xFFd0FF, // light purple
+ 0xd0FFd0, // light green
+ 0xFFFFd0, // light yellow
+ };
+
+ Symbol *symbol = g_symbolDB.GetSymbolFromAddr(address);
+ if (!symbol)
+ return 0xFFFFFF;
+ if (symbol->type != Symbol::SYMBOL_FUNCTION)
+ return 0xEEEEFF;
+ return colors[symbol->index % 6];*/
+}
+// =============
+
+
+std::string DSPDebugInterface::getDescription(unsigned int address)
+{
+ return "asdf"; // g_symbolDB.GetDescription(address);
+}
+
+unsigned int DSPDebugInterface::getPC()
+{
+ return 0;
+}
+
+void DSPDebugInterface::setPC(unsigned int address)
+{
+ //PowerPC::ppcState.pc = address;
+}
+
+void DSPDebugInterface::runToBreakpoint()
+{
+
+}
|
