mirror of https://github.com/PCSX2/pcsx2.git
x86/microVU: Add tracing similar to EE
Can dump per-block or per-instruction, useful for debugging regressions.
This commit is contained in:
parent
c1e92b594e
commit
08faba5455
|
@ -474,3 +474,67 @@ void SaveStateBase::vuJITFreeze()
|
|||
Freeze(microVU0.prog.lpState);
|
||||
Freeze(microVU1.prog.lpState);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
void DumpVUState(u32 n, u32 pc)
|
||||
{
|
||||
const VURegs& r = vuRegs[n];
|
||||
static FILE* fp = nullptr;
|
||||
static bool fp_opened = false;
|
||||
static u32 counter = 0;
|
||||
|
||||
u32 first = pc >> 31;
|
||||
pc &= 0x7FFFFFFFu;
|
||||
if (first)
|
||||
counter++;
|
||||
|
||||
#if 0
|
||||
if (counter == 184639 && pc == 0x0D70)
|
||||
__debugbreak();
|
||||
#endif
|
||||
|
||||
if (counter < 0)
|
||||
return;
|
||||
|
||||
if (!fp_opened)
|
||||
{
|
||||
fp = std::fopen("C:\\Dumps\\comp\\vulog.txt", "wb");
|
||||
fp_opened = true;
|
||||
}
|
||||
if (fp)
|
||||
{
|
||||
const microVU& m = (n == 0) ? microVU0 : microVU1;
|
||||
fprintf(fp, "%08d VU%u SPC:%04X xPC:%04X", counter, n, r.start_pc, pc);
|
||||
#if 1
|
||||
//fprintf(fp, " MEM:%08X", crc32(0, (Bytef*)r.Mem, (n == 0) ? VU0_MEMSIZE : VU1_MEMSIZE));
|
||||
fprintf(fp, " MAC %08X %08X %08X %08X [%08X %08X %08X %08X]", r.micro_macflags[3], r.micro_macflags[2], r.micro_macflags[1], r.micro_macflags[0], m.macFlag[3], m.macFlag[2], m.macFlag[1], m.macFlag[0]);
|
||||
fprintf(fp, " CLIP %08X %08X %08X %08X [%08X %08X %08X %08X]", r.micro_clipflags[3], r.micro_clipflags[2], r.micro_clipflags[1], r.micro_clipflags[0], m.clipFlag[3], m.clipFlag[2], m.clipFlag[1], m.clipFlag[0]);
|
||||
fprintf(fp, " STATUS %08X %08X %08X %08X [%08X %08X %08X %08X]", r.micro_statusflags[3], r.micro_statusflags[2], r.micro_statusflags[1], r.micro_statusflags[0], m.statFlag[3], m.statFlag[2], m.statFlag[1], m.statFlag[0]);
|
||||
|
||||
for (u32 i = 0; i < 32; i++)
|
||||
{
|
||||
const VECTOR& v = r.VF[i];
|
||||
fprintf(fp, " VF%u: %08X%08X%08X%08X (%f,%f,%f,%f)", i, v.UL[3], v.UL[2], v.UL[1], v.UL[0], v.F[3], v.F[2], v.F[1], v.F[0]);
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 32; i++)
|
||||
{
|
||||
const REG_VI& v = r.VI[i];
|
||||
fprintf(fp, " VI%u: %08X", i, v.UL);
|
||||
}
|
||||
|
||||
fprintf(fp, " ACC: %08X%08X%08X%08X (%f,%f,%f,%f)", r.ACC.UL[3], r.ACC.UL[2], r.ACC.UL[1], r.ACC.UL[0],
|
||||
r.ACC.F[3], r.ACC.F[2], r.ACC.F[1], r.ACC.F[0]);
|
||||
fprintf(fp, " Q: %08X (%f)", r.q.UL, r.q.F);
|
||||
fprintf(fp, " P: %08X (%f)\n", r.p.UL, r.p.F);
|
||||
#else
|
||||
fprintf(fp, " REG:%08X\n", crc32(0, (Bytef*)&r, offsetof(VURegs, idx)));
|
||||
#endif
|
||||
//fflush(fp);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -281,6 +281,7 @@ alignas(16) microVU microVU1;
|
|||
|
||||
// Debug Helper
|
||||
int mVUdebugNow = 0;
|
||||
extern void DumpVUState(u32 n, u32 pc);
|
||||
|
||||
// Main Functions
|
||||
extern void mVUclear(mV, u32, u32);
|
||||
|
|
|
@ -764,6 +764,17 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState)
|
|||
|
||||
for (; x < endCount; x++)
|
||||
{
|
||||
#if 0
|
||||
if (mVU.index == 1 && (x == 0 || true))
|
||||
{
|
||||
mVU.regAlloc->flushAll(false);
|
||||
mVUbackupRegs(mVU, true);
|
||||
xFastCall(DumpVUState, mVU.index, (xPC) | ((x == 0) ? 0x80000000 : 0));
|
||||
mVUrestoreRegs(mVU, true);
|
||||
//if (xPC == 0x1358) __debugbreak();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mVUinfo.isEOB)
|
||||
{
|
||||
handleBadOp(mVU, x);
|
||||
|
|
Loading…
Reference in New Issue