mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
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:
+7
-7
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Bochs_disasm"
|
||||
ProjectGUID="{29C2ABC1-ADA5-42CD-A5FC-96022D52A510}"
|
||||
RootNamespace="Bochs_disasm"
|
||||
@@ -24,7 +24,7 @@
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
@@ -87,7 +87,7 @@
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
@@ -151,7 +151,7 @@
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
@@ -213,7 +213,7 @@
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
@@ -278,7 +278,7 @@
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
@@ -340,7 +340,7 @@
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
+1
@@ -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;}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);}
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
// ===================
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user