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
This commit is contained in:
hrydgard
2009-06-21 08:39:21 +00:00
parent 80217a6ed7
commit aecaf271f1
76 changed files with 1895 additions and 794 deletions

View File

@ -23,7 +23,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
@ -85,7 +85,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="0"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"

View File

@ -604,6 +604,10 @@
RelativePath=".\Src\CPUDetect.h"
>
</File>
<File
RelativePath=".\Src\DebugInterface.h"
>
</File>
<File
RelativePath=".\Src\DynamicLibrary.cpp"
>
@ -780,6 +784,14 @@
RelativePath=".\Src\StringUtil.h"
>
</File>
<File
RelativePath=".\Src\SymbolDB.cpp"
>
</File>
<File
RelativePath=".\Src\SymbolDB.h"
>
</File>
<File
RelativePath=".\Src\Thread.cpp"
>

View File

@ -20,6 +20,7 @@ public:
virtual void clearAllBreakpoints() {}
virtual void toggleBreakpoint(unsigned int /*address*/){}
virtual unsigned int readMemory(unsigned int /*address*/){return 0;}
virtual void writeExtraMemory(int memory, unsigned int value, unsigned int /*address*/) {}
virtual unsigned int readExtraMemory(int memory, unsigned int address){return 0;}
virtual unsigned int readInstruction(unsigned int /*address*/){return 0;}
virtual unsigned int getPC() {return 0;}

View File

@ -460,3 +460,32 @@ void NormalizeDirSep(std::string* str)
}
#endif
}
std::string TabsToSpaces(int tab_size, const std::string &in)
{
std::string out;
int len = 0;
// First, compute the size of the new string.
for (int i = 0; i < in.size(); i++)
{
if (in[i] == '\t')
len += tab_size;
else
len += 1;
}
out.resize(len);
int out_ctr = 0;
for (int i = 0; i < in.size(); i++)
{
if (in[i] == '\t')
{
for (int j = 0; j < tab_size; j++)
out[out_ctr++] = ' ';
}
else
{
out[out_ctr++] = in[i];
}
}
return out;
}

View File

@ -66,6 +66,8 @@ bool AsciiToHex(const char* _szValue, u32& result);
u32 Ascii2Hex(std::string _Text);
std::string Hex2Ascii(u32 _Text);
std::string TabsToSpaces(int tab_size, const std::string &in);
void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output);
int ChooseStringFrom(const char* str, const char* * items);

View File

@ -0,0 +1,59 @@
// 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 "SymbolDB.h"
void SymbolDB::List()
{
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
DEBUG_LOG(HLE,"%s @ %08x: %i bytes (hash %08x) : %i calls", iter->second.name.c_str(), iter->second.address, iter->second.size, iter->second.hash,iter->second.numCalls);
}
INFO_LOG(HLE,"%i functions known in this program above.", functions.size());
}
void SymbolDB::Clear(const char *prefix)
{
// TODO: honor prefix
functions.clear();
checksumToFunction.clear();
}
void SymbolDB::Index()
{
int i = 0;
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
iter->second.index = i++;
}
}
Symbol *SymbolDB::GetSymbolFromName(const char *name)
{
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
if (!strcmp(iter->second.name.c_str(), name))
return &iter->second;
}
return 0;
}
void SymbolDB::AddCompleteSymbol(const Symbol &symbol)
{
functions.insert(std::pair<u32, Symbol>(symbol.address, symbol));
}

View File

@ -1,131 +1,122 @@
// 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 <map>
#include <string>
#include <vector>
#include "../Debugger/PPCDebugInterface.h"
#include "../Debugger/DebugInterface.h"
struct SCall
{
SCall(u32 a, u32 b) :
function(a),
callAddress(b)
{}
u32 function;
u32 callAddress;
};
struct Symbol
{
enum {
SYMBOL_FUNCTION = 0,
SYMBOL_DATA = 1,
};
Symbol() :
hash(0),
address(0),
flags(0),
size(0),
numCalls(0),
type(SYMBOL_FUNCTION),
analyzed(0)
{}
std::string name;
std::vector<SCall> callers; //addresses of functions that call this function
std::vector<SCall> calls; //addresses of functions that are called by this function
u32 hash; //use for HLE function finding
u32 address;
u32 flags;
int size;
int numCalls;
int type;
int index; // only used for coloring the disasm view
int analyzed;
};
enum
{
FFLAG_TIMERINSTRUCTIONS=(1<<0),
FFLAG_LEAF=(1<<1),
FFLAG_ONLYCALLSNICELEAFS=(1<<2),
FFLAG_EVIL=(1<<3),
FFLAG_RFI=(1<<4),
FFLAG_STRAIGHT=(1<<5)
};
// This has functionality overlapping Debugger_Symbolmap. Should merge that stuff in here later.
class SymbolDB
{
public:
typedef std::map<u32, Symbol> XFuncMap;
typedef std::map<u32, Symbol*> XFuncPtrMap;
private:
XFuncMap functions;
XFuncPtrMap checksumToFunction;
DebugInterface* debugger;
public:
typedef void (*functionGetterCallback)(Symbol *f);
SymbolDB();
~SymbolDB();
Symbol *AddFunction(u32 startAddr);
void AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type = Symbol::SYMBOL_FUNCTION);
Symbol *GetSymbolFromAddr(u32 addr);
Symbol *GetSymbolFromName(const char *name);
Symbol *GetSymbolFromHash(u32 hash) {
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
if (iter != checksumToFunction.end())
return iter->second;
else
return 0;
}
const XFuncMap &Symbols() const {return functions;}
XFuncMap &AccessSymbols() {return functions;}
// deprecated
XFuncMap::iterator GetIterator() { return functions.begin(); }
XFuncMap::const_iterator GetConstIterator() { return functions.begin(); }
XFuncMap::iterator End() { return functions.end(); }
const char *GetDescription(u32 addr);
void Clear(const char *prefix = "");
void List();
void Index();
void FillInCallers();
bool LoadMap(const char *filename);
bool SaveMap(const char *filename, bool WithCodes = false) const;
void PrintCalls(u32 funcAddr) const;
void PrintCallers(u32 funcAddr) const;
void LogFunctionCall(u32 addr);
};
extern SymbolDB g_symbolDB;
// 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/
// This file contains a generic symbol map implementation. For CPU-specific
// magic, derive and extend.
#ifndef _SYMBOL_DB_H
#define _SYMBOL_DB_H
#include <string>
#include <map>
#include "Common.h"
struct SCall
{
SCall(u32 a, u32 b) :
function(a),
callAddress(b)
{}
u32 function;
u32 callAddress;
};
struct Symbol
{
enum {
SYMBOL_FUNCTION = 0,
SYMBOL_DATA = 1,
};
Symbol() :
hash(0),
address(0),
flags(0),
size(0),
numCalls(0),
type(SYMBOL_FUNCTION),
analyzed(0)
{}
std::string name;
std::vector<SCall> callers; //addresses of functions that call this function
std::vector<SCall> calls; //addresses of functions that are called by this function
u32 hash; //use for HLE function finding
u32 address;
u32 flags;
int size;
int numCalls;
int type;
int index; // only used for coloring the disasm view
int analyzed;
};
enum
{
FFLAG_TIMERINSTRUCTIONS=(1<<0),
FFLAG_LEAF=(1<<1),
FFLAG_ONLYCALLSNICELEAFS=(1<<2),
FFLAG_EVIL=(1<<3),
FFLAG_RFI=(1<<4),
FFLAG_STRAIGHT=(1<<5)
};
class SymbolDB
{
public:
typedef std::map<u32, Symbol> XFuncMap;
typedef std::map<u32, Symbol*> XFuncPtrMap;
protected:
XFuncMap functions;
XFuncPtrMap checksumToFunction;
public:
SymbolDB() {}
virtual ~SymbolDB() {}
virtual Symbol *GetSymbolFromAddr(u32 addr) { return 0; }
virtual Symbol *AddFunction(u32 startAddr) { return 0;}
void AddCompleteSymbol(const Symbol &symbol);
Symbol *GetSymbolFromName(const char *name);
Symbol *GetSymbolFromHash(u32 hash) {
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
if (iter != checksumToFunction.end())
return iter->second;
else
return 0;
}
const XFuncMap &Symbols() const {return functions;}
XFuncMap &AccessSymbols() {return functions;}
// deprecated
XFuncMap::iterator GetIterator() { return functions.begin(); }
XFuncMap::const_iterator GetConstIterator() { return functions.begin(); }
XFuncMap::iterator End() { return functions.end(); }
void Clear(const char *prefix = "");
void List();
void Index();
};
#endif

View File

@ -963,6 +963,14 @@
RelativePath=".\Src\PowerPC\PPCAnalyst.h"
>
</File>
<File
RelativePath=".\Src\PowerPC\PPCSymbolDB.cpp"
>
</File>
<File
RelativePath=".\Src\PowerPC\PPCSymbolDB.h"
>
</File>
<File
RelativePath=".\Src\PowerPC\PPCTables.cpp"
>
@ -987,14 +995,6 @@
RelativePath=".\Src\PowerPC\SignatureDB.h"
>
</File>
<File
RelativePath=".\Src\PowerPC\SymbolDB.cpp"
>
</File>
<File
RelativePath=".\Src\PowerPC\SymbolDB.h"
>
</File>
<Filter
Name="Interpreter"
>

View File

@ -41,7 +41,7 @@
#include "../VolumeHandler.h"
#include "../PatchEngine.h"
#include "../PowerPC/SignatureDB.h"
#include "../PowerPC/SymbolDB.h"
#include "../PowerPC/PPCSymbolDB.h"
#include "../MemTools.h"
#include "../ConfigManager.h"
@ -314,7 +314,7 @@ bool CBoot::BootUp()
Boot_ELF(_StartupPara.m_strFilename.c_str());
UpdateDebugger_MapLoaded();
BreakPoints::AddAutoBreakpoints();
Debugger::AddAutoBreakpoints();
}
break;

View File

@ -20,7 +20,7 @@
#include "Common.h"
#include "../Debugger/Debugger_SymbolMap.h"
#include "../HW/Memmap.h"
#include "../PowerPC/SymbolDB.h"
#include "../PowerPC/PPCSymbolDB.h"
#include "ElfReader.h"
void bswap(Elf32_Word &w) {w = Common::swap32(w);}

View File

@ -26,7 +26,7 @@
#include "CoreTiming.h"
#include "Core.h"
#include "PowerPC/Jit64/Jit.h"
#include "PowerPC/SymbolDB.h"
#include "PowerPC/PPCSymbolDB.h"
#include "PowerPCDisasm.h"
#include "Console.h"

View File

@ -399,6 +399,7 @@ THREAD_RETURN EmuThread(void *pArg)
DSPInitialize dspInit;
dspInit.hWnd = g_pWindowHandle;
dspInit.pARAM_Read_U8 = (u8 (__cdecl *)(const u32))DSP::ReadARAM;
dspInit.pARAM_Write_U8 = (void (__cdecl *)(const u8, const u32))DSP::WriteARAM;
dspInit.pGetARAMPointer = DSP::GetARAMPtr;
dspInit.pGetMemoryPointer = Memory::GetPointer;
dspInit.pLog = Callback_DSPLog;

View File

@ -19,12 +19,11 @@
#include "../HW/CPU.h"
#include "../Host.h"
#include "../PowerPC/SymbolDB.h"
#include "../PowerPC/PPCSymbolDB.h"
#include "Debugger_BreakPoints.h"
BreakPoints::TBreakPoints BreakPoints::m_BreakPoints;
MemChecks::TMemChecks MemChecks::m_MemChecks;
BreakPoints g_breakpoints;
MemChecks g_memchecks;
void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc)
{
@ -99,24 +98,6 @@ void BreakPoints::Clear()
Host_UpdateBreakPointView();
}
void BreakPoints::AddAutoBreakpoints()
{
#if defined(_DEBUG) || defined(DEBUGFAST)
#if 1
const char *bps[] = {
"PPCHalt",
};
for (u32 i = 0; i < sizeof(bps) / sizeof(const char *); i++)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(bps[i]);
if (symbol)
BreakPoints::Add(symbol->address, false);
}
#endif
#endif
}
void BreakPoints::DeleteByAddress(u32 _Address)
{
// first check breakpoints

View File

@ -51,52 +51,52 @@ struct TMemCheck
void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc);
};
// Code breakpoints.
class BreakPoints
{
public:
typedef std::vector<TBreakPoint> TBreakPoints;
static const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
// is address breakpoint
static bool IsAddressBreakPoint(u32 _iAddress);
static bool IsTempBreakPoint(u32 _iAddress);
bool IsAddressBreakPoint(u32 _iAddress);
bool IsTempBreakPoint(u32 _iAddress);
// AddBreakPoint
static bool Add(u32 em_address, bool temp=false);
bool Add(u32 em_address, bool temp=false);
// Remove Breakpoint
static bool Remove(u32 _iAddress);
static void Clear();
bool Remove(u32 _iAddress);
void Clear();
static void UpdateBreakPointView();
static void AddAutoBreakpoints();
static void DeleteByAddress(u32 _Address);
void DeleteByAddress(u32 _Address);
private:
static TBreakPoints m_BreakPoints;
static u32 m_iBreakOnCount;
TBreakPoints m_BreakPoints;
u32 m_iBreakOnCount;
};
extern BreakPoints g_breakpoints;
// Memory breakpoints
class MemChecks
{
public:
typedef std::vector<TMemCheck> TMemChecks;
static TMemChecks m_MemChecks;
static const TMemChecks& GetMemChecks() { return m_MemChecks; }
static void Add(const TMemCheck& _rMemoryCheck);
TMemChecks m_MemChecks;
const TMemChecks& GetMemChecks() { return m_MemChecks; }
void Add(const TMemCheck& _rMemoryCheck);
//memory breakpoint
static TMemCheck *GetMemCheck(u32 address);
static void DeleteByAddress(u32 _Address);
TMemCheck *GetMemCheck(u32 address);
void DeleteByAddress(u32 _Address);
void Clear();
};
extern MemChecks g_memchecks;
#endif

View File

@ -18,16 +18,35 @@
#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"
#include "../PowerPC/PPCAnalyst.h"
#include "../PowerPC/SymbolDB.h"
#include "../PowerPC/PPCSymbolDB.h"
#include "../../../../Externals/Bochs_disasm/PowerPCDisasm.h"
namespace Debugger
{
void AddAutoBreakpoints()
{
#if defined(_DEBUG) || defined(DEBUGFAST)
#if 1
const char *bps[] = {
"PPCHalt",
};
for (u32 i = 0; i < sizeof(bps) / sizeof(const char *); i++)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(bps[i]);
if (symbol)
g_breakpoints.Add(symbol->address, false);
}
#endif
#endif
}
bool GetCallstack(std::vector<CallstackEntry> &output)
{
if (Core::GetState() == Core::CORE_UNINITIALIZED)

View File

@ -36,6 +36,8 @@ bool GetCallstack(std::vector<CallstackEntry> &output);
void PrintCallstack();
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level);
void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title);
void AddAutoBreakpoints();
} // end of namespace Debugger

View File

@ -25,7 +25,7 @@
#include "../HW/Memmap.h"
#include "../PowerPC/PowerPC.h"
#include "../PowerPC/Jit64/Jit.h"
#include "../PowerPC/SymbolDB.h"
#include "../PowerPC/PPCSymbolDB.h"
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
@ -104,18 +104,18 @@ bool PPCDebugInterface::isAlive()
bool PPCDebugInterface::isBreakpoint(unsigned int address)
{
return BreakPoints::IsAddressBreakPoint(address);
return g_breakpoints.IsAddressBreakPoint(address);
}
void PPCDebugInterface::setBreakpoint(unsigned int address)
{
if (BreakPoints::Add(address))
if (g_breakpoints.Add(address))
jit.NotifyBreakpoint(address, true);
}
void PPCDebugInterface::clearBreakpoint(unsigned int address)
{
if (BreakPoints::Remove(address))
if (g_breakpoints.Remove(address))
jit.NotifyBreakpoint(address, false);
}
@ -123,10 +123,10 @@ void PPCDebugInterface::clearAllBreakpoints() {}
void PPCDebugInterface::toggleBreakpoint(unsigned int address)
{
if (BreakPoints::IsAddressBreakPoint(address))
BreakPoints::Remove(address);
if (g_breakpoints.IsAddressBreakPoint(address))
g_breakpoints.Remove(address);
else
BreakPoints::Add(address);
g_breakpoints.Add(address);
}
void PPCDebugInterface::insertBLR(unsigned int address, unsigned int value)

View File

@ -21,7 +21,7 @@
#include "HLE.h"
#include "../PowerPC/PowerPC.h"
#include "../PowerPC/SymbolDB.h"
#include "../PowerPC/PPCSymbolDB.h"
#include "../HW/Memmap.h"
#include "../Debugger/Debugger_SymbolMap.h"
#include "../Debugger/Debugger_BreakPoints.h"
@ -132,7 +132,7 @@ void PatchFunctions()
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
if (symbol > 0)
{
BreakPoints::Add(symbol->address, false);
g_breakpoints.Add(symbol->address, false);
INFO_LOG(HLE,"Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address);
}
}

View File

@ -474,7 +474,7 @@ void UpdateAudioDMA()
// Latch new parameters
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
// DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
GenerateDSPInterrupt(DSP::INT_AID);
}
} else {
@ -647,11 +647,35 @@ u8 ReadARAM(u32 _iAddress)
return g_ARAM[_iAddress & ARAM_MASK];
}
void WriteARAM(u8 value, u32 _uAddress)
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
//LOGV(DSPINTERFACE, 0, "ARAM (w) 0x%08x 0x%08x 0x%08x", WII_MASK, _iAddress, (_iAddress & WII_MASK));
// Does this make any sense?
if (_uAddress > WII_MASK)
{
if (_uAddress > WII_MEM2)
_uAddress = (_uAddress & WII_MEM2);
g_MEM2[_uAddress] = value;
}
else
{
g_ARAM[_uAddress] = value;
}
}
else
g_ARAM[_uAddress & ARAM_MASK] = value;
}
u8 *GetARAMPtr()
{
return g_ARAM;
}
/*
// Should this really be a function? The hardware only supports block DMA.
void WriteARAM(u8 _iValue, u32 _iAddress)
{
@ -661,7 +685,7 @@ void WriteARAM(u8 _iValue, u32 _iAddress)
// rouge leader writes WAY outside
// not really surprising since it uses a totally different memory model :P
g_ARAM[_iAddress & ARAM_MASK] = _iValue;
}
}*/
} // end of namespace DSP
// ===================

View File

@ -48,6 +48,7 @@ void Write32(const u32 _uValue, const u32 _uAddress);
// Audio/DSP Plugin Helper
u8 ReadARAM(const u32 _uAddress);
void WriteARAM(u8 value, u32 _uAddress);
// Debugger Helper
u8* GetARAMPtr();

View File

@ -254,7 +254,7 @@ u8 Read_U8(const u32 _Address)
u8 _var = 0;
ReadFromHardware<u8>(_var, _Address, _Address, FLAG_READ);
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -269,7 +269,7 @@ u16 Read_U16(const u32 _Address)
u16 _var = 0;
ReadFromHardware<u16>(_var, _Address, _Address, FLAG_READ);
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -291,7 +291,7 @@ u32 Read_U32(const u32 _Address)
u32 _var = 0;
ReadFromHardware<u32>(_var, _Address, _Address, FLAG_READ);
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -307,7 +307,7 @@ u64 Read_U64(const u32 _Address)
u64 _var = 0;
ReadFromHardware<u64>(_var, _Address, _Address, FLAG_READ);
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -321,7 +321,7 @@ u64 Read_U64(const u32 _Address)
void Write_U8(const u8 _Data, const u32 _Address)
{
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -335,7 +335,7 @@ void Write_U8(const u8 _Data, const u32 _Address)
void Write_U16(const u16 _Data, const u32 _Address)
{
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -350,7 +350,7 @@ void Write_U16(const u16 _Data, const u32 _Address)
void Write_U32(const u32 _Data, const u32 _Address)
{
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
@ -364,7 +364,7 @@ void Write_U32(const u32 _Data, const u32 _Address)
void Write_U64(const u64 _Data, const u32 _Address)
{
#ifndef NOCHECK
TMemCheck *mc = MemChecks::GetMemCheck(_Address);
TMemCheck *mc = g_memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;

View File

@ -166,7 +166,7 @@ void Run()
#endif
//2: check for breakpoint
if (BreakPoints::IsAddressBreakPoint(PC))
if (g_breakpoints.IsAddressBreakPoint(PC))
{
#ifdef SHOW_HISTORY
NOTICE_LOG(POWERPC, "----------------------------");
@ -187,8 +187,8 @@ void Run()
#endif
INFO_LOG(POWERPC, "Hit Breakpoint - %08x", PC);
CCPU::Break();
if (BreakPoints::IsTempBreakPoint(PC))
BreakPoints::Remove(PC);
if (g_breakpoints.IsTempBreakPoint(PC))
g_breakpoints.Remove(PC);
Host_UpdateDisasmDialog();
return;

View File

@ -550,7 +550,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitB
}
// If starting from the breakpointed instruction, we don't break.
if (em_address != ops[i].address && BreakPoints::IsAddressBreakPoint(ops[i].address))
if (em_address != ops[i].address && g_breakpoints.IsAddressBreakPoint(ops[i].address))
{
}

View File

@ -21,7 +21,7 @@
#include "Interpreter/Interpreter.h"
#include "../HW/Memmap.h"
#include "PPCTables.h"
#include "SymbolDB.h"
#include "PPCSymbolDB.h"
#include "SignatureDB.h"
#include "PPCAnalyst.h"
@ -582,11 +582,11 @@ void FindFunctionsFromBranches(u32 startAddr, u32 endAddr, SymbolDB *func_db)
}
}
void FindFunctionsAfterBLR(SymbolDB *func_db)
void FindFunctionsAfterBLR(PPCSymbolDB *func_db)
{
vector<u32> funcAddrs;
for (SymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); iter++)
for (PPCSymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); iter++)
funcAddrs.push_back(iter->second.address + iter->second.size);
for (vector<u32>::iterator iter = funcAddrs.begin(); iter != funcAddrs.end(); iter++)
@ -609,7 +609,7 @@ void FindFunctionsAfterBLR(SymbolDB *func_db)
}
}
void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db)
void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB *func_db)
{
//Step 1: Find all functions
FindFunctionsFromBranches(startAddr, endAddr, func_db);
@ -621,7 +621,7 @@ void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db)
int numLeafs = 0, numNice = 0, numUnNice = 0;
int numTimer = 0, numRFI = 0, numStraightLeaf = 0;
int leafSize = 0, niceSize = 0, unniceSize = 0;
for (SymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); iter++)
for (PPCSymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); iter++)
{
if (iter->second.address == 4)
{

View File

@ -26,7 +26,7 @@
#include "Common.h"
#include "Gekko.h"
class SymbolDB;
class PPCSymbolDB;
struct Symbol;
namespace PPCAnalyst
@ -94,7 +94,7 @@ public:
bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer);
void LogFunctionCall(u32 addr);
void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db);
void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB *func_db);
bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size = 0);
} // namespace

View File

@ -22,49 +22,24 @@
#include <vector>
#include "../HW/Memmap.h"
#include "SymbolDB.h"
#include "PPCSymbolDB.h"
#include "SignatureDB.h"
#include "PPCAnalyst.h"
SymbolDB g_symbolDB;
PPCSymbolDB g_symbolDB;
SymbolDB::SymbolDB()
PPCSymbolDB::PPCSymbolDB()
{
// Get access to the disasm() fgnction
debugger = new PPCDebugInterface();
}
SymbolDB::~SymbolDB()
PPCSymbolDB::~PPCSymbolDB()
{
}
void SymbolDB::List()
{
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
DEBUG_LOG(HLE,"%s @ %08x: %i bytes (hash %08x) : %i calls", iter->second.name.c_str(), iter->second.address, iter->second.size, iter->second.hash,iter->second.numCalls);
}
INFO_LOG(HLE,"%i functions known in this program above.", functions.size());
}
void SymbolDB::Clear(const char *prefix)
{
// TODO: honor prefix
functions.clear();
checksumToFunction.clear();
}
void SymbolDB::Index()
{
int i = 0;
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
iter->second.index = i++;
}
}
// Adds the function to the list, unless it's already there
Symbol *SymbolDB::AddFunction(u32 startAddr)
Symbol *PPCSymbolDB::AddFunction(u32 startAddr)
{
if (startAddr < 0x80000010)
return 0;
@ -88,7 +63,7 @@ Symbol *SymbolDB::AddFunction(u32 startAddr)
}
}
void SymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type)
void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type)
{
XFuncMap::iterator iter = functions.find(startAddr);
if (iter != functions.end())
@ -116,7 +91,7 @@ void SymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int typ
}
}
Symbol *SymbolDB::GetSymbolFromAddr(u32 addr)
Symbol *PPCSymbolDB::GetSymbolFromAddr(u32 addr)
{
if (!Memory::IsRAMAddress(addr))
return 0;
@ -134,17 +109,7 @@ Symbol *SymbolDB::GetSymbolFromAddr(u32 addr)
return 0;
}
Symbol *SymbolDB::GetSymbolFromName(const char *name)
{
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
if (!strcmp(iter->second.name.c_str(), name))
return &iter->second;
}
return 0;
}
const char *SymbolDB::GetDescription(u32 addr)
const char *PPCSymbolDB::GetDescription(u32 addr)
{
Symbol *symbol = GetSymbolFromAddr(addr);
if (symbol)
@ -153,7 +118,7 @@ const char *SymbolDB::GetDescription(u32 addr)
return " --- ";
}
void SymbolDB::FillInCallers()
void PPCSymbolDB::FillInCallers()
{
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); iter++)
{
@ -183,7 +148,7 @@ void SymbolDB::FillInCallers()
}
}
void SymbolDB::PrintCalls(u32 funcAddr) const
void PPCSymbolDB::PrintCalls(u32 funcAddr) const
{
XFuncMap::const_iterator iter = functions.find(funcAddr);
if (iter != functions.end())
@ -205,7 +170,7 @@ void SymbolDB::PrintCalls(u32 funcAddr) const
}
}
void SymbolDB::PrintCallers(u32 funcAddr) const
void PPCSymbolDB::PrintCallers(u32 funcAddr) const
{
XFuncMap::const_iterator iter = functions.find(funcAddr);
if (iter != functions.end())
@ -223,7 +188,7 @@ void SymbolDB::PrintCallers(u32 funcAddr) const
}
}
void SymbolDB::LogFunctionCall(u32 addr)
void PPCSymbolDB::LogFunctionCall(u32 addr)
{
//u32 from = PC;
XFuncMap::iterator iter = functions.find(addr);
@ -236,7 +201,7 @@ void SymbolDB::LogFunctionCall(u32 addr)
// This one can load both leftover map files on game discs (like Zelda), and mapfiles
// produced by SaveSymbolMap below.
bool SymbolDB::LoadMap(const char *filename)
bool PPCSymbolDB::LoadMap(const char *filename)
{
FILE *f = fopen(filename, "r");
if (!f)
@ -302,7 +267,7 @@ bool SymbolDB::LoadMap(const char *filename)
// ===================================================
/* Save the map file and save a code file */
// ----------------
bool SymbolDB::SaveMap(const char *filename, bool WithCodes) const
bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const
{
// Format the name for the codes version
std::string mapFile = filename;

View File

@ -0,0 +1,56 @@
// 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 <map>
#include <string>
#include <vector>
#include "../Debugger/PPCDebugInterface.h"
#include "SymbolDB.h"
// This has functionality overlapping Debugger_Symbolmap. Should merge that stuff in here later.
class PPCSymbolDB : public SymbolDB
{
private:
DebugInterface* debugger;
public:
typedef void (*functionGetterCallback)(Symbol *f);
PPCSymbolDB();
~PPCSymbolDB();
Symbol *AddFunction(u32 startAddr);
void AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type = Symbol::SYMBOL_FUNCTION);
Symbol *GetSymbolFromAddr(u32 addr);
const char *GetDescription(u32 addr);
void FillInCallers();
bool LoadMap(const char *filename);
bool SaveMap(const char *filename, bool WithCodes = false) const;
void PrintCalls(u32 funcAddr) const;
void PrintCallers(u32 funcAddr) const;
void LogFunctionCall(u32 addr);
};
extern PPCSymbolDB g_symbolDB;

View File

@ -20,7 +20,7 @@
#include <vector>
#include <algorithm>
#include "SymbolDB.h"
#include "PPCSymbolDB.h"
namespace Profiler
{

View File

@ -20,7 +20,7 @@
#include "../HW/Memmap.h"
#include "SignatureDB.h"
#include "SymbolDB.h"
#include "PPCSymbolDB.h"
namespace {
@ -111,7 +111,7 @@ void SignatureDB::Clear()
database.clear();
}
void SignatureDB::Apply(SymbolDB *symbol_db)
void SignatureDB::Apply(PPCSymbolDB *symbol_db)
{
for (FuncDB::const_iterator iter = database.begin(); iter != database.end(); iter++)
{
@ -135,10 +135,10 @@ void SignatureDB::Apply(SymbolDB *symbol_db)
symbol_db->Index();
}
void SignatureDB::Initialize(SymbolDB *symbol_db, const char *prefix)
void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const char *prefix)
{
std::string prefix_str(prefix);
for (SymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); iter++)
for (PPCSymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); iter++)
{
if (iter->second.name.substr(0, prefix_str.size()) == prefix_str)
{

View File

@ -22,7 +22,7 @@
// You're not meant to keep around SignatureDB objects persistently. Use 'em, throw them away.
class SymbolDB;
class PPCSymbolDB;
class SignatureDB
{
@ -50,8 +50,8 @@ public:
void Clear();
void List();
void Initialize(SymbolDB *func_db, const char *prefix = "");
void Apply(SymbolDB *func_db);
void Initialize(PPCSymbolDB *func_db, const char *prefix = "");
void Apply(PPCSymbolDB *func_db);
static u32 ComputeCodeChecksum(u32 offsetStart, u32 offsetEnd);
};

View File

@ -75,7 +75,7 @@ files = ["ActionReplay.cpp",
"PowerPC/PPCTables.cpp",
"PowerPC/Profiler.cpp",
"PowerPC/SignatureDB.cpp",
"PowerPC/SymbolDB.cpp",
"PowerPC/PPCSymbolDB.cpp",
"PowerPC/Interpreter/Interpreter.cpp",
"PowerPC/Interpreter/Interpreter_Branch.cpp",
"PowerPC/Interpreter/Interpreter_Integer.cpp",

View File

@ -299,7 +299,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
PreprocessorDefinitions="LOGGING;WIN32;NDEBUG;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@ -363,7 +363,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
PreprocessorDefinitions="LOGGING;WIN32;NDEBUG;_LIB;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@ -426,6 +426,10 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
</Filter>
<File
RelativePath=".\Src\assemble.cpp"
>

View File

@ -155,6 +155,8 @@ void DSPCore_CheckExternalInterrupt()
{
// level 7 is the interrupt exception
DSPCore_SetException(7);
// Uh, confusing. Can this really be right?
g_dsp.cr &= ~0x0002;
}
}

View File

@ -24,6 +24,7 @@
// can be stubbed out.
u8 DSPHost_ReadHostMemory(u32 addr);
void DSPHost_WriteHostMemory(u8 value, u32 addr);
bool DSPHost_OnThread();
bool DSPHost_Running();
u32 DSPHost_CodeLoaded(const u8 *ptr, int size);

View File

@ -364,15 +364,42 @@ const pdlabel_t pdlabels[] =
{0xffad, "COEF_A2_6", "COEF_A2_6",},
{0xffae, "COEF_A1_7", "COEF_A1_7",},
{0xffaf, "COEF_A2_7", "COEF_A2_7",},
{0xffb0, 0, 0,},
{0xffb1, 0, 0,},
{0xffb2, 0, 0,},
{0xffb3, 0, 0,},
{0xffb4, 0, 0,},
{0xffb5, 0, 0,},
{0xffb6, 0, 0,},
{0xffb7, 0, 0,},
{0xffb8, 0, 0,},
{0xffb9, 0, 0,},
{0xffba, 0, 0,},
{0xffbb, 0, 0,},
{0xffbc, 0, 0,},
{0xffbd, 0, 0,},
{0xffbe, 0, 0,},
{0xffbf, 0, 0,},
{0xffc0, 0, 0,},
{0xffc1, 0, 0,},
{0xffc2, 0, 0,},
{0xffc3, 0, 0,},
{0xffc4, 0, 0,},
{0xffc5, 0, 0,},
{0xffc6, 0, 0,},
{0xffc7, 0, 0,},
{0xffc8, 0, 0,},
{0xffc9, "DSCR", "DSP DMA Control Reg",},
{0xffca, 0, 0,},
{0xffcb, "DSBL", "DSP DMA Block Length",},
{0xffcc, 0, 0,},
{0xffcd, "DSPA", "DSP DMA DMEM Address",},
{0xffce, "DSMAH", "DSP DMA Mem Address H",},
{0xffcf, "DSMAL", "DSP DMA Mem Address L",},
{0xffd0, 0,0,},
{0xffd1, "SampleFormat", "SampleFormat",},
{0xffd3, "Unk Zelda", "Unk Zelda writes to it",},
{0xffd2, 0,0,},
{0xffd3, "UnkZelda", "Unk Zelda reads/writes from/to it",},
{0xffd4, "ACSAH", "Accelerator start address H",},
{0xffd5, "ACSAL", "Accelerator start address L",},
{0xffd6, "ACEAH", "Accelerator end address H",},
@ -384,7 +411,34 @@ const pdlabel_t pdlabels[] =
{0xffdc, "yn2", "yn2",},
{0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",},
{0xffde, "GAIN", "Gain",},
{0xffdf, 0,0,},
{0xffe0, 0,0,},
{0xffe1, 0,0,},
{0xffe2, 0,0,},
{0xffe3, 0,0,},
{0xffe4, 0,0,},
{0xffe5, 0,0,},
{0xffe6, 0,0,},
{0xffe7, 0,0,},
{0xffe8, 0,0,},
{0xffe9, 0,0,},
{0xffea, 0,0,},
{0xffeb, 0,0,},
{0xffec, 0,0,},
{0xffed, 0,0,},
{0xffee, 0,0,},
{0xffef, "AMDM", "ARAM DMA Request Mask",},
{0xfff0, 0,0,},
{0xfff1, 0,0,},
{0xfff2, 0,0,},
{0xfff3, 0,0,},
{0xfff4, 0,0,},
{0xfff5, 0,0,},
{0xfff6, 0,0,},
{0xfff7, 0,0,},
{0xfff8, 0,0,},
{0xfff9, 0,0,},
{0xfffa, 0,0,},
{0xfffb, "DIRQ", "DSP IRQ Request",},
{0xfffc, "DMBH", "DSP Mailbox H",},
{0xfffd, "DMBL", "DSP Mailbox L",},

View File

@ -82,7 +82,7 @@ bool DSPDisassembler::Disassemble(int start_pc, const std::vector<u16> &code, in
fclose(f);
// Run the two passes.
return DisFile(tmp1, 1, text) && DisFile(tmp1, 2, text);
return DisFile(tmp1, base_addr, 1, text) && DisFile(tmp1, base_addr, 2, text);
}
char *DSPDisassembler::DisParams(const DSPOPCTemplate& opc, u16 op1, u16 op2, char *strbuf)
@ -186,7 +186,7 @@ static void MakeLowerCase(char *ptr)
}
}
void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest)
bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest)
{
char buffer[256];
char *buf = buffer;
@ -200,11 +200,10 @@ void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
{
*pc++;
dest.append("; outside memory");
return;
return false;
}
*pc &= 0x0fff;
const u32 op1 = binbuf[*pc];
const u32 op1 = binbuf[*pc & 0x0fff];
const DSPOPCTemplate *opc = NULL;
const DSPOPCTemplate *opc_ext = NULL;
@ -259,7 +258,7 @@ void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
// Size 2 - the op has a large immediate.
if ((opc->size & ~P_EXT) == 2)
{
op2 = binbuf[*pc + 1];
op2 = binbuf[(*pc + 1) & 0x0fff];
if (settings_.show_hex)
buf += sprintf(buf, "%04x %04x ", op1, op2);
}
@ -318,9 +317,10 @@ void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
if (pass == 2)
dest.append(buffer);
return true;
}
bool DSPDisassembler::DisFile(const char* name, int pass, std::string &output)
bool DSPDisassembler::DisFile(const char* name, int base_addr, int pass, std::string &output)
{
FILE* in = fopen(name, "rb");
if (in == NULL)
@ -339,7 +339,7 @@ bool DSPDisassembler::DisFile(const char* name, int pass, std::string &output)
// Actually do the disassembly.
for (u16 pc = 0; pc < (size / 2);)
{
DisOpcode(binbuf, 0x0000, pass, &pc, output);
DisOpcode(binbuf, base_addr, pass, &pc, output);
if (pass == 2)
output.append("\n");
}

View File

@ -67,11 +67,11 @@ public:
// Warning - this one is trickier to use right.
// Use pass == 2 if you're just using it by itself.
void DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest);
bool DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest);
private:
// Moves PC forward and writes the result to dest.
bool DisFile(const char* name, int pass, std::string &output);
bool DisFile(const char* name, int base_addr, int pass, std::string &output);
char* DisParams(const DSPOPCTemplate& opc, u16 op1, u16 op2, char* strbuf);
std::map<u16, int> unk_opcodes;

View File

@ -64,6 +64,18 @@ s16 ADPCM_Step(u32& _rSamplePos)
return val;
}
void dsp_write_aram_d3(u16 value)
{
// Not sure about this one but it sure looks like Zelda is writing to ARAM
// through 0xFFd3...
const u32 EndAddress = (gdsp_ifx_regs[DSP_ACEAH] << 16) | gdsp_ifx_regs[DSP_ACEAL];
u32 Address = (gdsp_ifx_regs[DSP_ACCAH] << 16) | gdsp_ifx_regs[DSP_ACCAL];
DSPHost_WriteHostMemory(value >> 8, Address);
DSPHost_WriteHostMemory(value & 0xFF, Address + 1);
}
u16 dsp_read_aram()
{
const u32 EndAddress = (gdsp_ifx_regs[DSP_ACEAH] << 16) | gdsp_ifx_regs[DSP_ACEAL];

View File

@ -19,5 +19,6 @@
#define _GDSP_ARAM_H
u16 dsp_read_aram();
void dsp_write_aram_d3(u16 value);
#endif

View File

@ -30,6 +30,7 @@
#include "DSPCore.h"
#include "DSPHost.h"
#include "DSPTables.h"
#include "DSPAnalyzer.h"
#include "gdsp_aram.h"
#include "gdsp_interpreter.h"
@ -89,6 +90,8 @@ void gdsp_mbox_write_l(u8 mbx, u16 val)
if (mbx == GDSP_MBOX_DSP)
{
DEBUG_LOG(DSPLLE, " - DSP writes mail to mbx %i: 0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
} else {
// Trigger exception?
}
}
@ -138,6 +141,11 @@ void gdsp_ifx_write(u16 addr, u16 val)
gdsp_ifx_regs[DSP_DSCR] &= ~0x0004;
break;
case 0xd3: // ZeldaUnk (accelerator WRITE)
ERROR_LOG(DSPLLE, "Write To ZeldaUnk pc=%04x (%04x)\n", g_dsp.pc, val);
dsp_write_aram_d3(val);
break;
case 0xde:
//if (val)
// PanicAlert("Gain written: %04x", val); // BMX XXX does, and sounds HORRIBLE.
@ -149,10 +157,17 @@ void gdsp_ifx_write(u16 addr, u16 val)
break;
default:
/* if ((addr & 0xff) >= 0xa0 && reg_names[addr - 0xa0])
DEBUG_LOG(DSPLLE, "%04x MW %s (%04x)\n", g_dsp.pc, reg_names[addr - 0xa0], val);
else
DEBUG_LOG(DSPLLE, "%04x MW %04x (%04x)\n", g_dsp.pc, addr, val);*/
if ((addr & 0xff) >= 0xa0) {
if (pdlabels[(addr & 0xFF) - 0xa0].name) {
INFO_LOG(DSPLLE, "%04x MW %s (%04x)\n", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, val);
}
else {
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)\n", g_dsp.pc, addr, val);
}
}
else {
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)\n", g_dsp.pc, addr, val);
}
gdsp_ifx_regs[addr & 0xFF] = val;
break;
}
@ -176,14 +191,22 @@ u16 gdsp_ifx_read(u16 addr)
return gdsp_ifx_regs[addr & 0xFF];
case 0xdd:
// ERROR_LOG(DSPLLE, "Accelerator");
return dsp_read_aram();
default:
if ((addr & 0xff) >= 0xa0) {
if (pdlabels[(addr & 0xFF) - 0xa0].name) {
INFO_LOG(DSPLLE, "%04x MR %s (%04x)\n", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, gdsp_ifx_regs[addr & 0xFF]);
}
else {
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)\n", g_dsp.pc, addr, gdsp_ifx_regs[addr & 0xFF]);
}
}
else {
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)\n", g_dsp.pc, addr, gdsp_ifx_regs[addr & 0xFF]);
}
return gdsp_ifx_regs[addr & 0xFF];
/* if ((addr & 0xff) >= 0xc0 && reg_names[addr & 0x3f])
printf("%04x MR %s (%04x)\n", g_dsp.pc, reg_names[addr & 0x3f], val);
else
printf("%04x MR %04x (%04x)\n", g_dsp.pc, addr, val);*/
}
}

View File

@ -78,10 +78,12 @@ void HandleLoop()
const u16 rCallAddress = g_dsp.r[DSP_REG_ST0];
const u16 rLoopAddress = g_dsp.r[DSP_REG_ST2];
// This does not always work correctly!
// The loop end tends to point to the second part of
// two-byte instructions!
if (g_dsp.pc == (rLoopAddress + 1))
{
rLoopCounter--;
if (rLoopCounter > 0)
{
g_dsp.pc = rCallAddress;
@ -147,6 +149,21 @@ void Run()
// Used by non-thread mode.
void RunCycles(int cycles)
{
if (cycles < 18)
{
for (int i = 0; i < cycles; i++)
{
if (g_dsp.cr & CR_HALT)
return;
if (DSPAnalyzer::code_flags[g_dsp.pc] & DSPAnalyzer::CODE_IDLE_SKIP)
return;
Step();
cycles--;
}
return;
}
DSPCore_CheckExternalInterrupt();
// First, let's run a few cycles with no idle skipping so that things can progress a bit.
@ -158,7 +175,7 @@ void RunCycles(int cycles)
cycles--;
}
// Next, let's run a few cycles with idle skipping, so that we can skip loops.
// Next, let's run a few cycles with idle skipping, so that we can skip idle loops.
for (int i = 0; i < 8; i++)
{
if (g_dsp.cr & CR_HALT)

View File

@ -0,0 +1,429 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="DebuggerUICommon"
ProjectGUID="{F81AE75C-3D17-4D8C-A201-82FA5351C123}"
RootNamespace="DebuggerUICommon"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\Src\CodeView.cpp"
>
</File>
<File
RelativePath=".\Src\CodeView.h"
>
</File>
<File
RelativePath=".\Src\DebuggerUIUtil.cpp"
>
</File>
<File
RelativePath=".\Src\DebuggerUIUtil.h"
>
</File>
<File
RelativePath=".\Src\SConscript"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -15,17 +15,19 @@
// 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 "Debugger.h"
// #include "Debugger/PPCDebugInterface.h"
// #include "PowerPC/SymbolDB.h"
#include "Common.h"
#include "StringUtil.h"
#include "Debugger/DebugInterface.h"
#include "DebuggerUIUtil.h"
#include "DebugInterface.h"
#include "Host.h"
// #include "Host.h"
#include "CodeView.h"
#include "JitWindow.h"
#include "SymbolDB.h"
// #include "JitWindow.h"
#include <wx/event.h>
#include <wx/clipbrd.h>
@ -61,9 +63,11 @@ BEGIN_EVENT_TABLE(CCodeView, wxControl)
EVT_MENU(-1, CCodeView::OnPopupMenu)
END_EVENT_TABLE()
CCodeView::CCodeView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id, const wxSize& Size)
CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb, wxWindow* parent, wxWindowID Id, const wxSize& Size)
: wxControl(parent, Id, wxDefaultPosition, Size),
debugger(debuginterface),
symbol_db(symboldb),
plain(false),
rowHeight(13),
selection(0),
oldSelection(0),
@ -121,7 +125,7 @@ void CCodeView::OnMouseDown(wxMouseEvent& event)
{
debugger->toggleBreakpoint(YToAddress(y));
redraw();
Host_UpdateBreakPointView();
// Host_UpdateBreakPointView();
}
event.Skip(true);
@ -202,9 +206,9 @@ void CCodeView::InsertBlrNop(int Blr)
}
// Save the old value
if(find >= 0)
if (find >= 0)
{
Memory::Write_U32(BlrList.at(find).OldValue, selection);
debugger->writeExtraMemory(0, BlrList.at(find).OldValue, selection);
BlrList.erase(BlrList.begin() + find);
}
else
@ -257,7 +261,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_COPYFUNCTION:
{
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(selection);
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
if (symbol) {
std::string text;
text = text + symbol->name + "\r\n";
@ -292,7 +296,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
break;
case IDM_JITRESULTS:
CJitWindow::ViewAddr(selection);
// CJitWindow::ViewAddr(selection);
break;
case IDM_FOLLOWBRANCH:
@ -306,14 +310,14 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_ADDFUNCTION:
{
g_symbolDB.AddFunction(selection);
Host_NotifyMapLoaded();
symbol_db->AddFunction(selection);
// Host_NotifyMapLoaded();
}
break;
case IDM_RENAMESYMBOL:
{
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(selection);
Symbol *symbol = symbol_db->GetSymbolFromAddr(selection);
if (symbol) {
wxTextEntryDialog input_symbol(this, wxString::FromAscii("Rename symbol:"), wxGetTextFromUserPromptStr,
wxString::FromAscii(symbol->name.c_str()));
@ -321,7 +325,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
symbol->name = input_symbol.GetValue().mb_str();
}
// redraw();
Host_NotifyMapLoaded();
// Host_NotifyMapLoaded();
}
}
break;
@ -342,7 +346,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
void CCodeView::OnMouseUpR(wxMouseEvent& event)
{
bool isSymbol = g_symbolDB.GetSymbolFromAddr(selection) != 0;
bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0;
// popup menu
wxMenu menu;
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
@ -379,7 +383,9 @@ void CCodeView::OnPaint(wxPaintEvent& event)
// -------------------------
wxPaintDC dc(this);
wxRect rc = GetClientRect();
dc.SetFont(DebuggerFont);
struct branch
{
int src, dst, srcAddr;
@ -448,9 +454,11 @@ void CCodeView::OnPaint(wxPaintEvent& event)
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 (!plain) {
dc.SetTextForeground(_T("#600000")); // the address text is dark red
dc.DrawText(temp, 17, rowY1);
dc.SetTextForeground(_T("#000000"));
}
if (debugger->isAlive())
{
@ -464,23 +472,17 @@ void CCodeView::OnPaint(wxPaintEvent& event)
{
*dis2 = 0;
dis2++;
// look for hex strings to decode branches
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)
{
@ -489,12 +491,6 @@ void CCodeView::OnPaint(wxPaintEvent& event)
}
}
}
// ------------
// --------------------------------------------------------------------
// Colors and brushes
// -------------------------
if (mojs)
{
int offs;
@ -520,20 +516,22 @@ void CCodeView::OnPaint(wxPaintEvent& event)
else
dc.SetTextForeground(_T("#8000FF")); // purple
dc.DrawText(wxString::FromAscii(dis), 80, rowY1);
dc.DrawText(wxString::FromAscii(dis), plain ? 25 : 80, rowY1);
if (desc[0] == 0)
{
strcpy(desc, debugger->getDescription(address).c_str());
}
dc.SetTextForeground(_T("#0000FF")); // blue
if (!plain) {
dc.SetTextForeground(_T("#0000FF")); // blue
//char temp[256];
//UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE);
if (strlen(desc))
{
dc.DrawText(wxString::FromAscii(desc), 270, rowY1);
//char temp[256];
//UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE);
if (strlen(desc))
{
dc.DrawText(wxString::FromAscii(desc), 270, rowY1);
}
}
// Show red breakpoint dot
@ -541,7 +539,6 @@ void CCodeView::OnPaint(wxPaintEvent& event)
{
dc.SetBrush(bpBrush);
dc.DrawRectangle(2, rowY1 + 1, 11, 11);
//DrawIconEx(hdc, 2, rowY1, breakPoint, 32, 32, 0, 0, DI_NORMAL);
}
}
} // end of for

View File

@ -18,7 +18,12 @@
#ifndef CODEVIEW_H_
#define CODEVIEW_H_
#include "Debugger.h"
#define wxUSE_XPM_IN_MSW 1
#define USE_XPM_BITMAPS 1
#include <wx/wx.h>
// #include "Debugger.h"
#include "Common.h"
#include <vector>
@ -26,11 +31,12 @@
DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1);
class DebugInterface;
class SymbolDB;
class CCodeView : public wxControl
{
public:
CCodeView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize);
CCodeView(DebugInterface* debuginterface, SymbolDB *symbol_db, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize);
wxSize DoGetBestSize() const;
void OnPaint(wxPaintEvent& event);
void OnErase(wxEraseEvent& event);
@ -57,6 +63,10 @@ public:
redraw();
}
void SetPlain() {
plain = true;
}
private:
void RaiseEvent();
int YToAddress(int y);
@ -66,6 +76,9 @@ private:
void redraw() {Refresh();}
DebugInterface* debugger;
SymbolDB* symbol_db;
bool plain;
int curAddress;
int align;

View File

@ -0,0 +1,23 @@
// 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 "DebuggerUIUtil.h"
// The default font
wxFont DebuggerFont = wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false, wxT("monospace"));

View File

@ -0,0 +1,36 @@
// 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 _DEBUGGER_UI_UTIL_H
#define _DEBUGGER_UI_UTIL_H
#include <wx/wx.h>
#define wxUSE_XPM_IN_MSW 1
#define USE_XPM_BITMAPS 1
// Defined in CodeWindow.cpp
extern wxFont DebuggerFont;
// 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
#endif

View File

@ -0,0 +1,13 @@
# -*- python -*-
Import('env')
files = [
'CodeView.cpp',
'DebuggerUIUtil.cpp',
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'debugger_ui_util', files)

View File

@ -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"
@ -427,14 +426,6 @@
RelativePath=".\src\BreakpointView.h"
>
</File>
<File
RelativePath=".\src\CodeView.cpp"
>
</File>
<File
RelativePath=".\src\CodeView.h"
>
</File>
<File
RelativePath=".\src\MemoryView.cpp"
>

View File

@ -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();
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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)
{

View File

@ -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);

View File

@ -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 "DebuggerUIUtil.h"
#include "IniFile.h"
// Defined in CodeWindow.cpp
extern wxFont DebuggerFont;
// 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
#endif

View File

@ -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();
}

View File

@ -20,7 +20,7 @@
#include "Debugger.h"
#include "Common.h"
#include "Debugger/DebugInterface.h"
#include "DebugInterface.h"
class CMemoryView : public wxControl
{

View File

@ -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"

View File

@ -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",