misc debugger improvements - hle:d code can be read in disasm window, memview can show floating point values, a crash fix, the locked cache now shows up in memview, some disasm bugfixes (frsp)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1970 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-01-21 11:44:36 +00:00
parent 852c35f705
commit 620bf888e7
7 changed files with 55 additions and 119 deletions

View File

@ -29,10 +29,15 @@ void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
if (Memory::IsRAMAddress(address))
if (Memory::IsRAMAddress(address, true))
{
u32 op = Memory::Read_Instruction(address);
DisassembleGekko(op, address, dest, max_size);
UGeckoInstruction inst;
inst.hex = Memory::ReadUnchecked_U32(address);
if (inst.OPCD == 1) {
strcat(dest, " (hle)");
}
}
else
{
@ -49,7 +54,7 @@ void PPCDebugInterface::getRawMemoryString(unsigned int address, char *dest, int
{
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
if (address < 0xE0000000)
if (Memory::IsRAMAddress(address, true))
{
snprintf(dest, max_size, "%08X", readMemory(address));
}
@ -115,19 +120,20 @@ void PPCDebugInterface::insertBLR(unsigned int address)
// -------------
int PPCDebugInterface::getColor(unsigned int address)
{
if (!Memory::IsRAMAddress(address))
if (!Memory::IsRAMAddress(address, true))
return 0xeeeeee;
int colors[6] =
{
0xd0FFFF // light cyan
,0xFFd0d0 // light red
,0xd8d8FF // light blue
,0xFFd0FF // light purple
,0xd0FFd0 // light green
,0xFFFFd0 // light yellow
static const int colors[6] =
{
0xd0FFFF, // light cyan
0xFFd0d0, // light red
0xd8d8FF, // light blue
0xFFd0FF, // light purple
0xd0FFd0, // light green
0xFFFFd0, // light yellow
};
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(address);
if (!symbol) return 0xFFFFFF;
if (!symbol)
return 0xFFFFFF;
if (symbol->type != Symbol::SYMBOL_FUNCTION)
return 0xEEEEFF;
return colors[symbol->index % 6];

View File

@ -31,6 +31,7 @@ may be redirected here (for example to Read_U32()).
#include "../PowerPC/PowerPC.h"
#include "../PowerPC/Jit64/Jit.h"
#include "../PowerPC/Jit64/JitCache.h"
#include "../HLE/HLE.h"
#include "CPU.h"
#include "PeripheralInterface.h"
#include "DSP.h"
@ -525,8 +526,15 @@ bool AreMemoryBreakpointsActivated()
u32 Read_Instruction(const u32 em_address)
{
return jit.GetBlockCache()->GetOriginalCode(em_address);
UGeckoInstruction inst = ReadUnchecked_U32(em_address);
if (inst.OPCD == 0)
inst.hex = jit.GetBlockCache()->GetOriginalCode(em_address);
if (inst.OPCD == 1)
return HLE::GetOrigInstruction(em_address);
else
return inst.hex;
}
//////////////////////////////////////////////////////////

View File

@ -310,6 +310,9 @@ bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo
memset(&code[i], 0, sizeof(CodeOp));
code[i].address = address;
UGeckoInstruction inst = Memory::Read_Instruction(code[i].address);
UGeckoInstruction untouched_op = Memory::ReadUnchecked_U32(code[i].address);
if (untouched_op.OPCD == 1) // Do handle HLE instructions.
inst = untouched_op;
_assert_msg_(GEKKO, inst.hex != 0, "Zero Op - Error flattening %08x op %08x", address + i*4, inst);
code[i].inst = inst;
code[i].branchTo = -1;

View File

@ -40,11 +40,11 @@ struct GekkoOPTemplate
int runCount;
};
struct inf
struct op_inf
{
const char *name;
int count;
bool operator < (const inf &o) const
bool operator < (const op_inf &o) const
{
return count > o.count;
}
@ -686,7 +686,7 @@ void InitTables()
}
}
// #define OPLOG
#define OPLOG
#ifdef OPLOG
namespace {
@ -701,7 +701,7 @@ void CompileInstruction(UGeckoInstruction _inst)
if (info) {
#ifdef OPLOG
if (!strcmp(info->opname, "mcrfs")) {
rsplocations.push_back(Jit64::js.compilerPC);
rsplocations.push_back(jit.js.compilerPC);
}
#endif
info->compileCount++;
@ -726,11 +726,10 @@ void CountInstruction(UGeckoInstruction _inst)
void PrintInstructionRunCounts()
{
std::vector<inf> temp;
std::vector<op_inf> temp;
for (int i = 0; i < m_numInstructions; i++)
{
inf x;
op_inf x;
x.name = m_allInstructions[i]->opname;
x.count = m_allInstructions[i]->runCount;
temp.push_back(x);
@ -738,14 +737,13 @@ void PrintInstructionRunCounts()
std::sort(temp.begin(), temp.end());
for (int i = 0; i < m_numInstructions; i++)
{
if(temp[i].count == 0)
if (temp[i].count == 0)
break;
LOG(GEKKO, "%s : %i", temp[i].name,temp[i].count);
//PanicAlert("%s : %i", temp[i].name,temp[i].count);
}
}
//TODO move to LogManager
void LogCompiledInstructions()
{
static int time = 0;