mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
add *.user, Win32, and x64 build dir to ignore list for DebuggerUICommon and Unit Tests
add *.aps to ignore list for DolphinWX dir add eol-style native to 120 or so files git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3689 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,179 +1,179 @@
|
||||
// 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"
|
||||
|
||||
#include "DSPSymbols.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
// we'll treat addresses as line numbers.
|
||||
strncpy(dest, DSPSymbols::GetLineText(address), max_size);
|
||||
dest[max_size-1] = 0;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
switch (memory) {
|
||||
case 0: // IMEM
|
||||
switch (address >> 12) {
|
||||
case 0:
|
||||
case 0x8:
|
||||
sprintf(dest, "%04x", dsp_imem_read(address));
|
||||
break;
|
||||
default:
|
||||
sprintf(dest, "----");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // DMEM
|
||||
switch (address >> 12) {
|
||||
case 0:
|
||||
case 1:
|
||||
sprintf(dest, "%04x", dsp_dmem_read(address));
|
||||
break;
|
||||
default:
|
||||
sprintf(dest, "----");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0)
|
||||
return dsp_breakpoints.IsAddressBreakPoint(real_addr);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::setBreakpoint(unsigned int address)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0) {
|
||||
if (dsp_breakpoints.Add(real_addr))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::clearBreakpoint(unsigned int address)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0) {
|
||||
if (dsp_breakpoints.Remove(real_addr))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::clearAllBreakpoints() {
|
||||
dsp_breakpoints.Clear();
|
||||
}
|
||||
|
||||
void DSPDebugInterface::toggleBreakpoint(unsigned int address)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0) {
|
||||
if (dsp_breakpoints.IsAddressBreakPoint(real_addr))
|
||||
dsp_breakpoints.Remove(real_addr);
|
||||
else
|
||||
dsp_breakpoints.Add(real_addr);
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::insertBLR(unsigned int address)
|
||||
{
|
||||
PanicAlert("insertBLR functionality not supported in DSP module.");
|
||||
}
|
||||
|
||||
// =======================================================
|
||||
// Separate the blocks with colors.
|
||||
// -------------
|
||||
int DSPDebugInterface::getColor(unsigned int address)
|
||||
{
|
||||
static const int colors[6] =
|
||||
{
|
||||
0xd0FFFF, // light cyan
|
||||
0xFFd0d0, // light red
|
||||
0xd8d8FF, // light blue
|
||||
0xFFd0FF, // light purple
|
||||
0xd0FFd0, // light green
|
||||
0xFFFFd0, // light yellow
|
||||
};
|
||||
|
||||
// Scan backwards so we don't miss it. Hm, actually, let's not - it looks pretty good.
|
||||
int addr = -1;
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
addr = DSPSymbols::Line2Addr(address - i);
|
||||
if (addr >= 0)
|
||||
break;
|
||||
}
|
||||
if (addr == -1)
|
||||
return 0xFFFFFF;
|
||||
|
||||
Symbol *symbol = DSPSymbols::g_dsp_symbol_db.GetSymbolFromAddr(addr);
|
||||
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 ""; // g_symbolDB.GetDescription(address);
|
||||
}
|
||||
|
||||
unsigned int DSPDebugInterface::getPC()
|
||||
{
|
||||
return DSPSymbols::Addr2Line(g_dsp.pc);
|
||||
}
|
||||
|
||||
void DSPDebugInterface::setPC(unsigned int address)
|
||||
{
|
||||
int new_pc = DSPSymbols::Line2Addr(address);
|
||||
if (new_pc > 0)
|
||||
g_dsp.pc = new_pc;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::runToBreakpoint()
|
||||
{
|
||||
|
||||
}
|
||||
// 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"
|
||||
|
||||
#include "DSPSymbols.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
|
||||
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
// we'll treat addresses as line numbers.
|
||||
strncpy(dest, DSPSymbols::GetLineText(address), max_size);
|
||||
dest[max_size-1] = 0;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
switch (memory) {
|
||||
case 0: // IMEM
|
||||
switch (address >> 12) {
|
||||
case 0:
|
||||
case 0x8:
|
||||
sprintf(dest, "%04x", dsp_imem_read(address));
|
||||
break;
|
||||
default:
|
||||
sprintf(dest, "----");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // DMEM
|
||||
switch (address >> 12) {
|
||||
case 0:
|
||||
case 1:
|
||||
sprintf(dest, "%04x", dsp_dmem_read(address));
|
||||
break;
|
||||
default:
|
||||
sprintf(dest, "----");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0)
|
||||
return dsp_breakpoints.IsAddressBreakPoint(real_addr);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::setBreakpoint(unsigned int address)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0) {
|
||||
if (dsp_breakpoints.Add(real_addr))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::clearBreakpoint(unsigned int address)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0) {
|
||||
if (dsp_breakpoints.Remove(real_addr))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::clearAllBreakpoints() {
|
||||
dsp_breakpoints.Clear();
|
||||
}
|
||||
|
||||
void DSPDebugInterface::toggleBreakpoint(unsigned int address)
|
||||
{
|
||||
int real_addr = DSPSymbols::Line2Addr(address);
|
||||
if (real_addr >= 0) {
|
||||
if (dsp_breakpoints.IsAddressBreakPoint(real_addr))
|
||||
dsp_breakpoints.Remove(real_addr);
|
||||
else
|
||||
dsp_breakpoints.Add(real_addr);
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::insertBLR(unsigned int address)
|
||||
{
|
||||
PanicAlert("insertBLR functionality not supported in DSP module.");
|
||||
}
|
||||
|
||||
// =======================================================
|
||||
// Separate the blocks with colors.
|
||||
// -------------
|
||||
int DSPDebugInterface::getColor(unsigned int address)
|
||||
{
|
||||
static const int colors[6] =
|
||||
{
|
||||
0xd0FFFF, // light cyan
|
||||
0xFFd0d0, // light red
|
||||
0xd8d8FF, // light blue
|
||||
0xFFd0FF, // light purple
|
||||
0xd0FFd0, // light green
|
||||
0xFFFFd0, // light yellow
|
||||
};
|
||||
|
||||
// Scan backwards so we don't miss it. Hm, actually, let's not - it looks pretty good.
|
||||
int addr = -1;
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
addr = DSPSymbols::Line2Addr(address - i);
|
||||
if (addr >= 0)
|
||||
break;
|
||||
}
|
||||
if (addr == -1)
|
||||
return 0xFFFFFF;
|
||||
|
||||
Symbol *symbol = DSPSymbols::g_dsp_symbol_db.GetSymbolFromAddr(addr);
|
||||
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 ""; // g_symbolDB.GetDescription(address);
|
||||
}
|
||||
|
||||
unsigned int DSPDebugInterface::getPC()
|
||||
{
|
||||
return DSPSymbols::Addr2Line(g_dsp.pc);
|
||||
}
|
||||
|
||||
void DSPDebugInterface::setPC(unsigned int address)
|
||||
{
|
||||
int new_pc = DSPSymbols::Line2Addr(address);
|
||||
if (new_pc > 0)
|
||||
g_dsp.pc = new_pc;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::runToBreakpoint()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,33 +1,33 @@
|
||||
#ifndef _DSPDEBUGINTERFACE_H
|
||||
#define _DSPDEBUGINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "DebugInterface.h"
|
||||
#include "Common.h"
|
||||
|
||||
class DSPDebugInterface : public DebugInterface
|
||||
{
|
||||
public:
|
||||
DSPDebugInterface(){}
|
||||
virtual void disasm(unsigned int address, char *dest, int max_size);
|
||||
virtual void getRawMemoryString(int memory, unsigned int address, char *dest, int max_size);
|
||||
virtual int getInstructionSize(int instruction) {return 1;}
|
||||
virtual bool isAlive();
|
||||
virtual bool isBreakpoint(unsigned int address);
|
||||
virtual void setBreakpoint(unsigned int address);
|
||||
virtual void clearBreakpoint(unsigned int address);
|
||||
virtual void clearAllBreakpoints();
|
||||
virtual void toggleBreakpoint(unsigned int address);
|
||||
virtual unsigned int readMemory(unsigned int address);
|
||||
virtual unsigned int readInstruction(unsigned int address);
|
||||
virtual unsigned int getPC();
|
||||
virtual void setPC(unsigned int address);
|
||||
virtual void step() {}
|
||||
virtual void runToBreakpoint();
|
||||
virtual void insertBLR(unsigned int address);
|
||||
virtual int getColor(unsigned int address);
|
||||
virtual std::string getDescription(unsigned int address);
|
||||
};
|
||||
|
||||
#endif // _DSPDEBUGINTERFACE_H
|
||||
#ifndef _DSPDEBUGINTERFACE_H
|
||||
#define _DSPDEBUGINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "DebugInterface.h"
|
||||
#include "Common.h"
|
||||
|
||||
class DSPDebugInterface : public DebugInterface
|
||||
{
|
||||
public:
|
||||
DSPDebugInterface(){}
|
||||
virtual void disasm(unsigned int address, char *dest, int max_size);
|
||||
virtual void getRawMemoryString(int memory, unsigned int address, char *dest, int max_size);
|
||||
virtual int getInstructionSize(int instruction) {return 1;}
|
||||
virtual bool isAlive();
|
||||
virtual bool isBreakpoint(unsigned int address);
|
||||
virtual void setBreakpoint(unsigned int address);
|
||||
virtual void clearBreakpoint(unsigned int address);
|
||||
virtual void clearAllBreakpoints();
|
||||
virtual void toggleBreakpoint(unsigned int address);
|
||||
virtual unsigned int readMemory(unsigned int address);
|
||||
virtual unsigned int readInstruction(unsigned int address);
|
||||
virtual unsigned int getPC();
|
||||
virtual void setPC(unsigned int address);
|
||||
virtual void step() {}
|
||||
virtual void runToBreakpoint();
|
||||
virtual void insertBLR(unsigned int address);
|
||||
virtual int getColor(unsigned int address);
|
||||
virtual std::string getDescription(unsigned int address);
|
||||
};
|
||||
|
||||
#endif // _DSPDEBUGINTERFACE_H
|
||||
|
@ -1,115 +1,115 @@
|
||||
// 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 "Common.h"
|
||||
#include "DSPHost.h"
|
||||
#include "DSPSymbols.h"
|
||||
#include "Tools.h"
|
||||
#include "pluginspecs_dsp.h"
|
||||
|
||||
extern DSPInitialize g_dspInitialize;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
#include "DSPConfigDlgLLE.h"
|
||||
#include "Debugger/Debugger.h" // For the DSPDebuggerLLE class
|
||||
extern DSPDebuggerLLE* m_DebuggerFrame;
|
||||
|
||||
#endif
|
||||
|
||||
// The user of the DSPCore library must supply a few functions so that the
|
||||
// emulation core can access the environment it runs in. If the emulation
|
||||
// core isn't used, for example in an asm/disasm tool, then most of these
|
||||
// can be stubbed out.
|
||||
|
||||
u8 DSPHost_ReadHostMemory(u32 addr)
|
||||
{
|
||||
return g_dspInitialize.pARAM_Read_U8(addr);
|
||||
}
|
||||
|
||||
void DSPHost_WriteHostMemory(u8 value, u32 addr)
|
||||
{
|
||||
g_dspInitialize.pARAM_Write_U8(value, addr);
|
||||
}
|
||||
|
||||
bool DSPHost_OnThread()
|
||||
{
|
||||
return g_dspInitialize.bOnThread;
|
||||
}
|
||||
|
||||
bool DSPHost_Running()
|
||||
{
|
||||
return !(*g_dspInitialize.pEmulatorState);
|
||||
}
|
||||
|
||||
void DSPHost_InterruptRequest()
|
||||
{
|
||||
#ifdef DEBUG_EXP
|
||||
NOTICE_LOG(DSPLLE, "Firing an interrupt on the PPC ASAP");
|
||||
#endif
|
||||
// Fire an interrupt on the PPC ASAP.
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
||||
{
|
||||
u32 crc = GenerateCRC(ptr, size);
|
||||
DumpDSPCode(ptr, size, crc);
|
||||
|
||||
// this crc is comparable with the HLE plugin
|
||||
u32 ector_crc = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ector_crc ^= ptr[i];
|
||||
//let's rol
|
||||
ector_crc = (ector_crc << 3) | (ector_crc >> 29);
|
||||
}
|
||||
|
||||
DSPSymbols::Clear();
|
||||
|
||||
// Auto load text file - if none just disassemble.
|
||||
|
||||
// TODO: Don't hardcode for Zelda.
|
||||
NOTICE_LOG(DSPLLE, "CRC: %08x", ector_crc);
|
||||
|
||||
DSPSymbols::Clear();
|
||||
bool success = false;
|
||||
switch (ector_crc)
|
||||
{
|
||||
case 0x86840740: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_Zelda.txt"); break;
|
||||
case 0x42f64ac4: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_Luigi.txt"); break;
|
||||
case 0x4e8a8b21: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_AX1.txt"); break;
|
||||
default: success = false; break;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
DSPSymbols::AutoDisassembly(0x0, 0x1000);
|
||||
}
|
||||
|
||||
// Always add the ROM.
|
||||
DSPSymbols::AutoDisassembly(0x8000, 0x9000);
|
||||
|
||||
if (m_DebuggerFrame)
|
||||
m_DebuggerFrame->Refresh();
|
||||
return crc;
|
||||
}
|
||||
|
||||
void DSPHost_UpdateDebugger()
|
||||
{
|
||||
if (m_DebuggerFrame)
|
||||
m_DebuggerFrame->Refresh();
|
||||
}
|
||||
// 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 "Common.h"
|
||||
#include "DSPHost.h"
|
||||
#include "DSPSymbols.h"
|
||||
#include "Tools.h"
|
||||
#include "pluginspecs_dsp.h"
|
||||
|
||||
extern DSPInitialize g_dspInitialize;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
#include "DSPConfigDlgLLE.h"
|
||||
#include "Debugger/Debugger.h" // For the DSPDebuggerLLE class
|
||||
extern DSPDebuggerLLE* m_DebuggerFrame;
|
||||
|
||||
#endif
|
||||
|
||||
// The user of the DSPCore library must supply a few functions so that the
|
||||
// emulation core can access the environment it runs in. If the emulation
|
||||
// core isn't used, for example in an asm/disasm tool, then most of these
|
||||
// can be stubbed out.
|
||||
|
||||
u8 DSPHost_ReadHostMemory(u32 addr)
|
||||
{
|
||||
return g_dspInitialize.pARAM_Read_U8(addr);
|
||||
}
|
||||
|
||||
void DSPHost_WriteHostMemory(u8 value, u32 addr)
|
||||
{
|
||||
g_dspInitialize.pARAM_Write_U8(value, addr);
|
||||
}
|
||||
|
||||
bool DSPHost_OnThread()
|
||||
{
|
||||
return g_dspInitialize.bOnThread;
|
||||
}
|
||||
|
||||
bool DSPHost_Running()
|
||||
{
|
||||
return !(*g_dspInitialize.pEmulatorState);
|
||||
}
|
||||
|
||||
void DSPHost_InterruptRequest()
|
||||
{
|
||||
#ifdef DEBUG_EXP
|
||||
NOTICE_LOG(DSPLLE, "Firing an interrupt on the PPC ASAP");
|
||||
#endif
|
||||
// Fire an interrupt on the PPC ASAP.
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
||||
{
|
||||
u32 crc = GenerateCRC(ptr, size);
|
||||
DumpDSPCode(ptr, size, crc);
|
||||
|
||||
// this crc is comparable with the HLE plugin
|
||||
u32 ector_crc = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ector_crc ^= ptr[i];
|
||||
//let's rol
|
||||
ector_crc = (ector_crc << 3) | (ector_crc >> 29);
|
||||
}
|
||||
|
||||
DSPSymbols::Clear();
|
||||
|
||||
// Auto load text file - if none just disassemble.
|
||||
|
||||
// TODO: Don't hardcode for Zelda.
|
||||
NOTICE_LOG(DSPLLE, "CRC: %08x", ector_crc);
|
||||
|
||||
DSPSymbols::Clear();
|
||||
bool success = false;
|
||||
switch (ector_crc)
|
||||
{
|
||||
case 0x86840740: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_Zelda.txt"); break;
|
||||
case 0x42f64ac4: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_Luigi.txt"); break;
|
||||
case 0x4e8a8b21: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_AX1.txt"); break;
|
||||
default: success = false; break;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
DSPSymbols::AutoDisassembly(0x0, 0x1000);
|
||||
}
|
||||
|
||||
// Always add the ROM.
|
||||
DSPSymbols::AutoDisassembly(0x8000, 0x9000);
|
||||
|
||||
if (m_DebuggerFrame)
|
||||
m_DebuggerFrame->Refresh();
|
||||
return crc;
|
||||
}
|
||||
|
||||
void DSPHost_UpdateDebugger()
|
||||
{
|
||||
if (m_DebuggerFrame)
|
||||
m_DebuggerFrame->Refresh();
|
||||
}
|
||||
|
@ -1,287 +1,287 @@
|
||||
// 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 <iostream> // I hope this doesn't break anything
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "DSPCore.h"
|
||||
#include "DSPSymbols.h"
|
||||
#include "disassemble.h"
|
||||
|
||||
namespace DSPSymbols {
|
||||
|
||||
DSPSymbolDB g_dsp_symbol_db;
|
||||
|
||||
std::map<u16, int> addr_to_line;
|
||||
std::map<int, u16> line_to_addr;
|
||||
std::map<int, const char *> line_to_symbol;
|
||||
std::vector<std::string> lines;
|
||||
int line_counter = 0;
|
||||
|
||||
int Addr2Line(u16 address) // -1 for not found
|
||||
{
|
||||
std::map<u16, int>::iterator iter = addr_to_line.find(address);
|
||||
if (iter != addr_to_line.end())
|
||||
return iter->second;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Line2Addr(int line) // -1 for not found
|
||||
{
|
||||
std::map<int, u16>::iterator iter = line_to_addr.find(line);
|
||||
if (iter != line_to_addr.end())
|
||||
return iter->second;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *GetLineText(int line)
|
||||
{
|
||||
if (line > 0 && line < (int)lines.size())
|
||||
{
|
||||
return lines[line].c_str();
|
||||
}
|
||||
else
|
||||
return "----";
|
||||
}
|
||||
|
||||
Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr)
|
||||
{
|
||||
XFuncMap::iterator it = functions.find(addr);
|
||||
if (it != functions.end())
|
||||
return &it->second;
|
||||
else
|
||||
{
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
|
||||
{
|
||||
if (addr >= iter->second.address && addr < iter->second.address + iter->second.size)
|
||||
return &iter->second;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// lower case only
|
||||
bool IsHexDigit(char c) {
|
||||
switch (c) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsAlpha(char c) {
|
||||
return (c >= 'A' && c <= 'Z') ||
|
||||
(c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
void DisasssembleRange(u16 start, u16 end)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ReadAnnotatedAssembly(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
ERROR_LOG(DSPLLE, "Bah! ReadAnnotatedAssembly couldn't find the file %s", filename);
|
||||
return false;
|
||||
}
|
||||
char line[512];
|
||||
|
||||
int last_addr = 0;
|
||||
|
||||
lines.reserve(3000);
|
||||
|
||||
// Symbol generation
|
||||
int brace_count = 0;
|
||||
bool symbol_in_progress = false;
|
||||
|
||||
int symbol_count = 0;
|
||||
Symbol current_symbol;
|
||||
|
||||
while (fgets(line, 512, f))
|
||||
{
|
||||
// Scan string for the first 4-digit hex string.
|
||||
size_t len = strlen(line);
|
||||
int first_hex = -1;
|
||||
bool hex_found = false;
|
||||
for (unsigned int i = 0; i < strlen(line); i++)
|
||||
{
|
||||
const char c = line[i];
|
||||
if (IsHexDigit(c))
|
||||
{
|
||||
if (first_hex == -1)
|
||||
{
|
||||
first_hex = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove hex notation
|
||||
if (i == first_hex + 3 &&
|
||||
(first_hex == 0 || line[first_hex - 1] != 'x') &&
|
||||
(i >= len - 1 || line[i + 1] == ' '))
|
||||
{
|
||||
hex_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i - first_hex < 3)
|
||||
{
|
||||
first_hex = -1;
|
||||
}
|
||||
if (IsAlpha(c))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Scan for function starts
|
||||
if (!memcmp(line, "void", 4)) {
|
||||
char temp[256];
|
||||
for (int i = 6; i < len; i++) {
|
||||
if (line[i] == '(') {
|
||||
// Yep, got one.
|
||||
memcpy(temp, line + 5, i - 5);
|
||||
temp[i - 5] = 0;
|
||||
|
||||
// Mark symbol so the next hex sets the address
|
||||
current_symbol.name = temp;
|
||||
current_symbol.address = 0xFFFF;
|
||||
current_symbol.index = symbol_count++;
|
||||
symbol_in_progress = true;
|
||||
|
||||
// Reset brace count.
|
||||
brace_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scan for braces
|
||||
for (int i = 0; i < (int)len; i++) {
|
||||
if (line[i] == '{')
|
||||
brace_count++;
|
||||
if (line[i] == '}')
|
||||
{
|
||||
brace_count--;
|
||||
if (brace_count == 0 && symbol_in_progress) {
|
||||
// Commit this symbol.
|
||||
current_symbol.size = last_addr - current_symbol.address + 1;
|
||||
g_dsp_symbol_db.AddCompleteSymbol(current_symbol);
|
||||
current_symbol.address = 0xFFFF;
|
||||
symbol_in_progress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hex_found)
|
||||
{
|
||||
int hex = 0;
|
||||
sscanf(line + first_hex, "%04x", &hex);
|
||||
|
||||
// Sanity check
|
||||
if (hex > last_addr + 3 || hex < last_addr - 3) {
|
||||
static int errors = 0;
|
||||
ERROR_LOG(DSPLLE, "Got Insane Hex Digit %04x (%04x) from %s", hex, last_addr, line);
|
||||
errors++;
|
||||
if (errors > 10)
|
||||
{
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (line_counter >= 200 && line_counter <= 220)
|
||||
// NOTICE_LOG(DSPLLE, "Got Hex Digit %04x from %s, line %i", hex, line, line_counter);
|
||||
if (symbol_in_progress && current_symbol.address == 0xFFFF)
|
||||
current_symbol.address = hex;
|
||||
|
||||
line_to_addr[line_counter] = hex;
|
||||
addr_to_line[hex] = line_counter;
|
||||
last_addr = hex;
|
||||
}
|
||||
}
|
||||
|
||||
lines.push_back(TabsToSpaces(4, line));
|
||||
line_counter++;
|
||||
}
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoDisassembly(u16 start_addr, u16 end_addr)
|
||||
{
|
||||
AssemblerSettings settings;
|
||||
settings.show_pc = true;
|
||||
settings.show_hex = true;
|
||||
DSPDisassembler disasm(settings);
|
||||
|
||||
u16 addr = start_addr;
|
||||
const u16 *ptr = (start_addr >> 15) ? g_dsp.irom : g_dsp.iram;
|
||||
while (addr < end_addr)
|
||||
{
|
||||
line_to_addr[line_counter] = addr;
|
||||
addr_to_line[addr] = line_counter;
|
||||
|
||||
std::string buf;
|
||||
if (!disasm.DisOpcode(ptr, 0, 2, &addr, buf))
|
||||
{
|
||||
ERROR_LOG(DSPLLE, "disasm failed at %04x", addr);
|
||||
break;
|
||||
}
|
||||
|
||||
//NOTICE_LOG(DSPLLE, "added %04x %i %s", addr, line_counter, buf.c_str());
|
||||
lines.push_back(buf);
|
||||
line_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
addr_to_line.clear();
|
||||
line_to_addr.clear();
|
||||
lines.clear();
|
||||
line_counter = 0;
|
||||
}
|
||||
|
||||
} // namespace DSPSymbols
|
||||
// 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 <iostream> // I hope this doesn't break anything
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "DSPCore.h"
|
||||
#include "DSPSymbols.h"
|
||||
#include "disassemble.h"
|
||||
|
||||
namespace DSPSymbols {
|
||||
|
||||
DSPSymbolDB g_dsp_symbol_db;
|
||||
|
||||
std::map<u16, int> addr_to_line;
|
||||
std::map<int, u16> line_to_addr;
|
||||
std::map<int, const char *> line_to_symbol;
|
||||
std::vector<std::string> lines;
|
||||
int line_counter = 0;
|
||||
|
||||
int Addr2Line(u16 address) // -1 for not found
|
||||
{
|
||||
std::map<u16, int>::iterator iter = addr_to_line.find(address);
|
||||
if (iter != addr_to_line.end())
|
||||
return iter->second;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Line2Addr(int line) // -1 for not found
|
||||
{
|
||||
std::map<int, u16>::iterator iter = line_to_addr.find(line);
|
||||
if (iter != line_to_addr.end())
|
||||
return iter->second;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *GetLineText(int line)
|
||||
{
|
||||
if (line > 0 && line < (int)lines.size())
|
||||
{
|
||||
return lines[line].c_str();
|
||||
}
|
||||
else
|
||||
return "----";
|
||||
}
|
||||
|
||||
Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr)
|
||||
{
|
||||
XFuncMap::iterator it = functions.find(addr);
|
||||
if (it != functions.end())
|
||||
return &it->second;
|
||||
else
|
||||
{
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
|
||||
{
|
||||
if (addr >= iter->second.address && addr < iter->second.address + iter->second.size)
|
||||
return &iter->second;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// lower case only
|
||||
bool IsHexDigit(char c) {
|
||||
switch (c) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsAlpha(char c) {
|
||||
return (c >= 'A' && c <= 'Z') ||
|
||||
(c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
void DisasssembleRange(u16 start, u16 end)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ReadAnnotatedAssembly(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
ERROR_LOG(DSPLLE, "Bah! ReadAnnotatedAssembly couldn't find the file %s", filename);
|
||||
return false;
|
||||
}
|
||||
char line[512];
|
||||
|
||||
int last_addr = 0;
|
||||
|
||||
lines.reserve(3000);
|
||||
|
||||
// Symbol generation
|
||||
int brace_count = 0;
|
||||
bool symbol_in_progress = false;
|
||||
|
||||
int symbol_count = 0;
|
||||
Symbol current_symbol;
|
||||
|
||||
while (fgets(line, 512, f))
|
||||
{
|
||||
// Scan string for the first 4-digit hex string.
|
||||
size_t len = strlen(line);
|
||||
int first_hex = -1;
|
||||
bool hex_found = false;
|
||||
for (unsigned int i = 0; i < strlen(line); i++)
|
||||
{
|
||||
const char c = line[i];
|
||||
if (IsHexDigit(c))
|
||||
{
|
||||
if (first_hex == -1)
|
||||
{
|
||||
first_hex = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove hex notation
|
||||
if (i == first_hex + 3 &&
|
||||
(first_hex == 0 || line[first_hex - 1] != 'x') &&
|
||||
(i >= len - 1 || line[i + 1] == ' '))
|
||||
{
|
||||
hex_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i - first_hex < 3)
|
||||
{
|
||||
first_hex = -1;
|
||||
}
|
||||
if (IsAlpha(c))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Scan for function starts
|
||||
if (!memcmp(line, "void", 4)) {
|
||||
char temp[256];
|
||||
for (int i = 6; i < len; i++) {
|
||||
if (line[i] == '(') {
|
||||
// Yep, got one.
|
||||
memcpy(temp, line + 5, i - 5);
|
||||
temp[i - 5] = 0;
|
||||
|
||||
// Mark symbol so the next hex sets the address
|
||||
current_symbol.name = temp;
|
||||
current_symbol.address = 0xFFFF;
|
||||
current_symbol.index = symbol_count++;
|
||||
symbol_in_progress = true;
|
||||
|
||||
// Reset brace count.
|
||||
brace_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scan for braces
|
||||
for (int i = 0; i < (int)len; i++) {
|
||||
if (line[i] == '{')
|
||||
brace_count++;
|
||||
if (line[i] == '}')
|
||||
{
|
||||
brace_count--;
|
||||
if (brace_count == 0 && symbol_in_progress) {
|
||||
// Commit this symbol.
|
||||
current_symbol.size = last_addr - current_symbol.address + 1;
|
||||
g_dsp_symbol_db.AddCompleteSymbol(current_symbol);
|
||||
current_symbol.address = 0xFFFF;
|
||||
symbol_in_progress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hex_found)
|
||||
{
|
||||
int hex = 0;
|
||||
sscanf(line + first_hex, "%04x", &hex);
|
||||
|
||||
// Sanity check
|
||||
if (hex > last_addr + 3 || hex < last_addr - 3) {
|
||||
static int errors = 0;
|
||||
ERROR_LOG(DSPLLE, "Got Insane Hex Digit %04x (%04x) from %s", hex, last_addr, line);
|
||||
errors++;
|
||||
if (errors > 10)
|
||||
{
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (line_counter >= 200 && line_counter <= 220)
|
||||
// NOTICE_LOG(DSPLLE, "Got Hex Digit %04x from %s, line %i", hex, line, line_counter);
|
||||
if (symbol_in_progress && current_symbol.address == 0xFFFF)
|
||||
current_symbol.address = hex;
|
||||
|
||||
line_to_addr[line_counter] = hex;
|
||||
addr_to_line[hex] = line_counter;
|
||||
last_addr = hex;
|
||||
}
|
||||
}
|
||||
|
||||
lines.push_back(TabsToSpaces(4, line));
|
||||
line_counter++;
|
||||
}
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoDisassembly(u16 start_addr, u16 end_addr)
|
||||
{
|
||||
AssemblerSettings settings;
|
||||
settings.show_pc = true;
|
||||
settings.show_hex = true;
|
||||
DSPDisassembler disasm(settings);
|
||||
|
||||
u16 addr = start_addr;
|
||||
const u16 *ptr = (start_addr >> 15) ? g_dsp.irom : g_dsp.iram;
|
||||
while (addr < end_addr)
|
||||
{
|
||||
line_to_addr[line_counter] = addr;
|
||||
addr_to_line[addr] = line_counter;
|
||||
|
||||
std::string buf;
|
||||
if (!disasm.DisOpcode(ptr, 0, 2, &addr, buf))
|
||||
{
|
||||
ERROR_LOG(DSPLLE, "disasm failed at %04x", addr);
|
||||
break;
|
||||
}
|
||||
|
||||
//NOTICE_LOG(DSPLLE, "added %04x %i %s", addr, line_counter, buf.c_str());
|
||||
lines.push_back(buf);
|
||||
line_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
addr_to_line.clear();
|
||||
line_to_addr.clear();
|
||||
lines.clear();
|
||||
line_counter = 0;
|
||||
}
|
||||
|
||||
} // namespace DSPSymbols
|
||||
|
@ -1,54 +1,54 @@
|
||||
// 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/
|
||||
|
||||
#ifndef _DSPSYMBOLS_H
|
||||
#define _DSPSYMBOLS_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "SymbolDB.h"
|
||||
#include "AudioCommon.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace DSPSymbols {
|
||||
|
||||
class DSPSymbolDB : public SymbolDB
|
||||
{
|
||||
public:
|
||||
DSPSymbolDB() {}
|
||||
~DSPSymbolDB() {}
|
||||
|
||||
Symbol *GetSymbolFromAddr(u32 addr);
|
||||
|
||||
};
|
||||
|
||||
extern DSPSymbolDB g_dsp_symbol_db;
|
||||
|
||||
bool ReadAnnotatedAssembly(const char *filename);
|
||||
void AutoDisassembly(u16 start_addr, u16 end_addr);
|
||||
|
||||
void Clear();
|
||||
|
||||
int Addr2Line(u16 address);
|
||||
int Line2Addr(int line); // -1 for not found
|
||||
|
||||
const char *GetLineText(int line);
|
||||
|
||||
} // namespace DSPSymbols
|
||||
|
||||
#endif
|
||||
|
||||
// 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/
|
||||
|
||||
#ifndef _DSPSYMBOLS_H
|
||||
#define _DSPSYMBOLS_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "SymbolDB.h"
|
||||
#include "AudioCommon.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace DSPSymbols {
|
||||
|
||||
class DSPSymbolDB : public SymbolDB
|
||||
{
|
||||
public:
|
||||
DSPSymbolDB() {}
|
||||
~DSPSymbolDB() {}
|
||||
|
||||
Symbol *GetSymbolFromAddr(u32 addr);
|
||||
|
||||
};
|
||||
|
||||
extern DSPSymbolDB g_dsp_symbol_db;
|
||||
|
||||
bool ReadAnnotatedAssembly(const char *filename);
|
||||
void AutoDisassembly(u16 start_addr, u16 end_addr);
|
||||
|
||||
void Clear();
|
||||
|
||||
int Addr2Line(u16 address);
|
||||
int Line2Addr(int line); // -1 for not found
|
||||
|
||||
const char *GetLineText(int line);
|
||||
|
||||
} // namespace DSPSymbols
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,228 +1,228 @@
|
||||
// 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 "Common.h" // Common
|
||||
#include <iostream> // System
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "Debugger.h"
|
||||
#include "DSPRegisterView.h"
|
||||
#include "CodeView.h"
|
||||
#include "../DSPSymbols.h"
|
||||
|
||||
// Event table and class
|
||||
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxFrame)
|
||||
EVT_CLOSE(DSPDebuggerLLE::OnClose)
|
||||
|
||||
EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState)
|
||||
EVT_MENU(ID_SHOWPCTOOL, DSPDebuggerLLE::OnShowPC)
|
||||
EVT_TEXT(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
|
||||
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
const wxPoint &position, const wxSize& size, long style)
|
||||
: wxFrame(parent, id, title, position, size, style)
|
||||
, m_CachedStepCounter(-1)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
DSPDebuggerLLE::~DSPDebuggerLLE()
|
||||
{
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::CreateGUIControls()
|
||||
{
|
||||
// Basic settings
|
||||
SetSize(700, 800);
|
||||
this->SetSizeHints(700, 800);
|
||||
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
|
||||
m_Toolbar = CreateToolBar(wxTB_NODIVIDER|wxTB_NOICONS|wxTB_HORZ_TEXT|wxTB_DOCKABLE, ID_TOOLBAR);
|
||||
m_Toolbar->AddTool(ID_RUNTOOL, wxT("Run"), wxNullBitmap, wxEmptyString, wxITEM_NORMAL);
|
||||
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"), wxNullBitmap, wxT("Step Code "), wxITEM_NORMAL);
|
||||
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Show where PC is"), wxITEM_NORMAL);
|
||||
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
|
||||
m_Toolbar->AddSeparator();
|
||||
|
||||
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, _T("")));
|
||||
|
||||
m_Toolbar->Realize();
|
||||
|
||||
wxBoxSizer* sMain = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(140, 100), 0, NULL, wxLB_SORT),
|
||||
1, wxEXPAND);
|
||||
|
||||
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, this, ID_CODEVIEW);
|
||||
m_CodeView->SetPlain();
|
||||
|
||||
sMain->Add(sizerLeft, 0, wxEXPAND, 0);
|
||||
|
||||
sMain->Add(m_CodeView, 4, wxEXPAND, 0);
|
||||
|
||||
wxStaticLine* m_staticline = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
|
||||
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 0);
|
||||
|
||||
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
|
||||
sMain->Add(m_Regs, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
this->Layout();
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
|
||||
{
|
||||
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();
|
||||
break;
|
||||
|
||||
case ID_SHOWPCTOOL:
|
||||
FocusOnPC();
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnShowPC(wxCommandEvent& event)
|
||||
{
|
||||
Refresh();
|
||||
FocusOnPC();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::Refresh()
|
||||
{
|
||||
UpdateSymbolMap();
|
||||
UpdateDisAsmListView();
|
||||
UpdateRegisterFlags();
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::FocusOnPC()
|
||||
{
|
||||
JumpToAddress(g_dsp.pc);
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::UpdateState()
|
||||
{
|
||||
if (DSPCore_GetState() == DSPCORE_RUNNING) {
|
||||
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
|
||||
m_Toolbar->FindById(ID_STEPTOOL)->Enable(false);
|
||||
}
|
||||
else {
|
||||
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Run"));
|
||||
m_Toolbar->FindById(ID_STEPTOOL)->Enable(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*)GetToolBar()->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(1);
|
||||
}
|
||||
|
||||
bool DSPDebuggerLLE::JumpToAddress(u16 addr)
|
||||
{
|
||||
int new_line = DSPSymbols::Addr2Line(addr);
|
||||
if (new_line >= 0) {
|
||||
m_CodeView->Center(new_line);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 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 "Common.h" // Common
|
||||
#include <iostream> // System
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "Debugger.h"
|
||||
#include "DSPRegisterView.h"
|
||||
#include "CodeView.h"
|
||||
#include "../DSPSymbols.h"
|
||||
|
||||
// Event table and class
|
||||
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxFrame)
|
||||
EVT_CLOSE(DSPDebuggerLLE::OnClose)
|
||||
|
||||
EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState)
|
||||
EVT_MENU(ID_SHOWPCTOOL, DSPDebuggerLLE::OnShowPC)
|
||||
EVT_TEXT(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
|
||||
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
const wxPoint &position, const wxSize& size, long style)
|
||||
: wxFrame(parent, id, title, position, size, style)
|
||||
, m_CachedStepCounter(-1)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
DSPDebuggerLLE::~DSPDebuggerLLE()
|
||||
{
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::CreateGUIControls()
|
||||
{
|
||||
// Basic settings
|
||||
SetSize(700, 800);
|
||||
this->SetSizeHints(700, 800);
|
||||
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
|
||||
m_Toolbar = CreateToolBar(wxTB_NODIVIDER|wxTB_NOICONS|wxTB_HORZ_TEXT|wxTB_DOCKABLE, ID_TOOLBAR);
|
||||
m_Toolbar->AddTool(ID_RUNTOOL, wxT("Run"), wxNullBitmap, wxEmptyString, wxITEM_NORMAL);
|
||||
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"), wxNullBitmap, wxT("Step Code "), wxITEM_NORMAL);
|
||||
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Show where PC is"), wxITEM_NORMAL);
|
||||
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
|
||||
m_Toolbar->AddSeparator();
|
||||
|
||||
m_Toolbar->AddControl(new wxTextCtrl(m_Toolbar, ID_ADDRBOX, _T("")));
|
||||
|
||||
m_Toolbar->Realize();
|
||||
|
||||
wxBoxSizer* sMain = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
sizerLeft->Add(m_SymbolList = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(140, 100), 0, NULL, wxLB_SORT),
|
||||
1, wxEXPAND);
|
||||
|
||||
m_CodeView = new CCodeView(&debug_interface, &DSPSymbols::g_dsp_symbol_db, this, ID_CODEVIEW);
|
||||
m_CodeView->SetPlain();
|
||||
|
||||
sMain->Add(sizerLeft, 0, wxEXPAND, 0);
|
||||
|
||||
sMain->Add(m_CodeView, 4, wxEXPAND, 0);
|
||||
|
||||
wxStaticLine* m_staticline = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL);
|
||||
sMain->Add(m_staticline, 0, wxEXPAND|wxALL, 0);
|
||||
|
||||
m_Regs = new DSPRegisterView(this, ID_DSP_REGS);
|
||||
sMain->Add(m_Regs, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
this->Layout();
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
|
||||
{
|
||||
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();
|
||||
break;
|
||||
|
||||
case ID_SHOWPCTOOL:
|
||||
FocusOnPC();
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::OnShowPC(wxCommandEvent& event)
|
||||
{
|
||||
Refresh();
|
||||
FocusOnPC();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::Refresh()
|
||||
{
|
||||
UpdateSymbolMap();
|
||||
UpdateDisAsmListView();
|
||||
UpdateRegisterFlags();
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::FocusOnPC()
|
||||
{
|
||||
JumpToAddress(g_dsp.pc);
|
||||
}
|
||||
|
||||
void DSPDebuggerLLE::UpdateState()
|
||||
{
|
||||
if (DSPCore_GetState() == DSPCORE_RUNNING) {
|
||||
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
|
||||
m_Toolbar->FindById(ID_STEPTOOL)->Enable(false);
|
||||
}
|
||||
else {
|
||||
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Run"));
|
||||
m_Toolbar->FindById(ID_STEPTOOL)->Enable(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*)GetToolBar()->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(1);
|
||||
}
|
||||
|
||||
bool DSPDebuggerLLE::JumpToAddress(u16 addr)
|
||||
{
|
||||
int new_line = DSPSymbols::Addr2Line(addr);
|
||||
if (new_line >= 0) {
|
||||
m_CodeView->Center(new_line);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,126 +1,126 @@
|
||||
// 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/
|
||||
|
||||
#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 "disassemble.h"
|
||||
#include "DSPInterpreter.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
#include "../DSPDebugInterface.h"
|
||||
|
||||
class DSPRegisterView;
|
||||
class CCodeView;
|
||||
|
||||
class DSPDebuggerLLE : public wxFrame
|
||||
{
|
||||
public:
|
||||
DSPDebuggerLLE(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString &title = wxT("DSP LLE Debugger"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
virtual ~DSPDebuggerLLE();
|
||||
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
enum
|
||||
{
|
||||
// Toolbar
|
||||
ID_TOOLBAR = 1000,
|
||||
ID_RUNTOOL,
|
||||
ID_STEPTOOL,
|
||||
ID_SHOWPCTOOL,
|
||||
ID_ADDRBOX,
|
||||
ID_JUMPTOTOOL,
|
||||
ID_DISASMDUMPTOOL,
|
||||
ID_CHECK_ASSERTINT,
|
||||
ID_CHECK_HALT,
|
||||
ID_CHECK_INIT,
|
||||
ID_SYMBOLLIST,
|
||||
|
||||
// Code view
|
||||
ID_CODEVIEW,
|
||||
|
||||
// Register View
|
||||
ID_DSP_REGS,
|
||||
};
|
||||
|
||||
// Disasm listctrl columns
|
||||
enum
|
||||
{
|
||||
COLUMN_BP,
|
||||
COLUMN_FUNCTION,
|
||||
COLUMN_ADDRESS,
|
||||
COLUMN_MNEMONIC,
|
||||
COLUMN_OPCODE,
|
||||
COLUMN_EXT,
|
||||
COLUMN_PARAM,
|
||||
};
|
||||
|
||||
DSPDebugInterface debug_interface;
|
||||
u64 m_CachedStepCounter;
|
||||
|
||||
// GUI updaters
|
||||
void UpdateDisAsmListView();
|
||||
void UpdateRegisterFlags();
|
||||
void UpdateSymbolMap();
|
||||
void UpdateState();
|
||||
|
||||
// GUI items
|
||||
wxToolBar* m_Toolbar;
|
||||
CCodeView* m_CodeView;
|
||||
DSPRegisterView* m_Regs;
|
||||
wxListBox* m_SymbolList;
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnChangeState(wxCommandEvent& event);
|
||||
void OnShowPC(wxCommandEvent& event);
|
||||
void OnRightClick(wxListEvent& event);
|
||||
void OnDoubleClick(wxListEvent& event);
|
||||
void OnAddrBoxChange(wxCommandEvent& event);
|
||||
void OnSymbolListChange(wxCommandEvent& event);
|
||||
|
||||
bool JumpToAddress(u16 addr);
|
||||
|
||||
void CreateGUIControls();
|
||||
void FocusOnPC();
|
||||
void UnselectAll();
|
||||
};
|
||||
|
||||
#endif //_DSP_DEBUGGER_LLE_H
|
||||
// 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/
|
||||
|
||||
#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 "disassemble.h"
|
||||
#include "DSPInterpreter.h"
|
||||
#include "DSPMemoryMap.h"
|
||||
#include "../DSPDebugInterface.h"
|
||||
|
||||
class DSPRegisterView;
|
||||
class CCodeView;
|
||||
|
||||
class DSPDebuggerLLE : public wxFrame
|
||||
{
|
||||
public:
|
||||
DSPDebuggerLLE(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString &title = wxT("DSP LLE Debugger"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
virtual ~DSPDebuggerLLE();
|
||||
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
enum
|
||||
{
|
||||
// Toolbar
|
||||
ID_TOOLBAR = 1000,
|
||||
ID_RUNTOOL,
|
||||
ID_STEPTOOL,
|
||||
ID_SHOWPCTOOL,
|
||||
ID_ADDRBOX,
|
||||
ID_JUMPTOTOOL,
|
||||
ID_DISASMDUMPTOOL,
|
||||
ID_CHECK_ASSERTINT,
|
||||
ID_CHECK_HALT,
|
||||
ID_CHECK_INIT,
|
||||
ID_SYMBOLLIST,
|
||||
|
||||
// Code view
|
||||
ID_CODEVIEW,
|
||||
|
||||
// Register View
|
||||
ID_DSP_REGS,
|
||||
};
|
||||
|
||||
// Disasm listctrl columns
|
||||
enum
|
||||
{
|
||||
COLUMN_BP,
|
||||
COLUMN_FUNCTION,
|
||||
COLUMN_ADDRESS,
|
||||
COLUMN_MNEMONIC,
|
||||
COLUMN_OPCODE,
|
||||
COLUMN_EXT,
|
||||
COLUMN_PARAM,
|
||||
};
|
||||
|
||||
DSPDebugInterface debug_interface;
|
||||
u64 m_CachedStepCounter;
|
||||
|
||||
// GUI updaters
|
||||
void UpdateDisAsmListView();
|
||||
void UpdateRegisterFlags();
|
||||
void UpdateSymbolMap();
|
||||
void UpdateState();
|
||||
|
||||
// GUI items
|
||||
wxToolBar* m_Toolbar;
|
||||
CCodeView* m_CodeView;
|
||||
DSPRegisterView* m_Regs;
|
||||
wxListBox* m_SymbolList;
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnChangeState(wxCommandEvent& event);
|
||||
void OnShowPC(wxCommandEvent& event);
|
||||
void OnRightClick(wxListEvent& event);
|
||||
void OnDoubleClick(wxListEvent& event);
|
||||
void OnAddrBoxChange(wxCommandEvent& event);
|
||||
void OnSymbolListChange(wxCommandEvent& event);
|
||||
|
||||
bool JumpToAddress(u16 addr);
|
||||
|
||||
void CreateGUIControls();
|
||||
void FocusOnPC();
|
||||
void UnselectAll();
|
||||
};
|
||||
|
||||
#endif //_DSP_DEBUGGER_LLE_H
|
||||
|
Reference in New Issue
Block a user