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:
parent
852c35f705
commit
620bf888e7
|
@ -2086,7 +2086,7 @@ typedef unsigned int ppc_word;
|
|||
break;
|
||||
|
||||
case 20:
|
||||
fdabc(dp,in,"rsqrte",3,0);
|
||||
fdabc(dp,in,"rsqrte",1,0);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
|
@ -2121,15 +2121,15 @@ typedef unsigned int ppc_word;
|
|||
break;
|
||||
|
||||
case 12:
|
||||
fdabc(dp,in,"rsp",10,0);
|
||||
fdabc(dp,in,"rsp",1,0); // 10
|
||||
break;
|
||||
|
||||
case 14:
|
||||
fdabc(dp,in,"ctiw",10,0);
|
||||
fdabc(dp,in,"ctiw",1,0); // 10
|
||||
break;
|
||||
|
||||
case 15:
|
||||
fdabc(dp,in,"ctiwz",10,0);
|
||||
fdabc(dp,in,"ctiwz",1,0); // 10
|
||||
break;
|
||||
|
||||
case 32:
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -125,9 +125,16 @@ void CJitWindow::OnRefresh(wxCommandEvent& /*event*/) {
|
|||
|
||||
void CJitWindow::ViewAddr(u32 em_address)
|
||||
{
|
||||
the_jit_window->Show(true);
|
||||
the_jit_window->Compare(em_address);
|
||||
the_jit_window->SetFocus();
|
||||
if (the_jit_window)
|
||||
{
|
||||
the_jit_window->Show(true);
|
||||
the_jit_window->Compare(em_address);
|
||||
the_jit_window->SetFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Jit window not available");
|
||||
}
|
||||
}
|
||||
|
||||
void CJitWindow::Compare(u32 em_address)
|
||||
|
|
|
@ -159,24 +159,12 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
|||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_GOTOINMEMVIEW:
|
||||
// CMemoryDlg::Goto(selection);
|
||||
break;
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
case IDM_COPYADDRESS:
|
||||
{
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_COPYCODE:
|
||||
{
|
||||
char disasm[256];
|
||||
debugger->disasm(selection, disasm, 256);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); //Have to manually convert from char* to wxString, don't have to in Windows?
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_COPYHEX:
|
||||
{
|
||||
|
@ -186,22 +174,6 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IDM_RUNTOHERE:
|
||||
{
|
||||
debugger->setBreakpoint(selection);
|
||||
debugger->runToBreakpoint();
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_DYNARECRESULTS:
|
||||
{
|
||||
// CDynaViewDlg::ViewAddr(selection);
|
||||
// CDynaViewDlg::Show(TRUE);
|
||||
// MessageBox(NULL, "not impl", "CtrlDisAsmView", MB_OK);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
|
@ -218,11 +190,8 @@ void CMemoryView::OnMouseUpR(wxMouseEvent& event)
|
|||
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
|
||||
#if wxUSE_CLIPBOARD
|
||||
menu.Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
|
||||
menu.Append(IDM_COPYCODE, wxString::FromAscii("Copy &code"));
|
||||
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
|
||||
#endif
|
||||
menu.Append(IDM_RUNTOHERE, _T("&Run To Here"));
|
||||
//menu.Append(IDM_DYNARECRESULTS, "Copy &address");
|
||||
PopupMenu(&menu);
|
||||
event.Skip(true);
|
||||
}
|
||||
|
@ -315,66 +284,11 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
|||
if (debugger->isAlive())
|
||||
{
|
||||
char dis[256] = {0};
|
||||
debugger->disasm(address, dis, 256);
|
||||
char* dis2 = strchr(dis, '\t');
|
||||
u32 mem = debugger->readMemory(address);
|
||||
float flt = *(float *)(&mem);
|
||||
sprintf(dis, "f: %f", flt);
|
||||
char desc[256] = "";
|
||||
|
||||
if (dis2)
|
||||
{
|
||||
*dis2 = 0;
|
||||
dis2++;
|
||||
const char* mojs = strstr(dis2, "0x8");
|
||||
|
||||
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)
|
||||
{
|
||||
mojs = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mojs)
|
||||
{
|
||||
int offs;
|
||||
sscanf(mojs + 2, "%08x", &offs);
|
||||
branches[numBranches].src = rowY1 + rowHeight / 2;
|
||||
branches[numBranches].srcAddr = address / align;
|
||||
branches[numBranches++].dst = (int)(rowY1 + ((s64)offs - (s64)address) * rowHeight / align + rowHeight / 2);
|
||||
sprintf(desc, "-->%s", debugger->getDescription(offs).c_str());
|
||||
dc.SetTextForeground(_T("#600060"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetTextForeground(_T("#000000"));
|
||||
}
|
||||
|
||||
dc.DrawText(wxString::FromAscii(dis2), 17+fontSize*(8+8+8), rowY1);
|
||||
}
|
||||
|
||||
if (strcmp(dis, "blr"))
|
||||
{
|
||||
dc.SetTextForeground(_T("#007000"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetTextForeground(_T("#8000FF"));
|
||||
}
|
||||
|
||||
dc.DrawText(wxString::FromAscii(dis), 17+fontSize*(8+8), rowY1);
|
||||
|
||||
if (desc[0] == 0)
|
||||
|
|
Loading…
Reference in New Issue