Added some DebugBreak generation (INT3 / 0xcc) to the PsxRec, for catching null pxsRegs.pc assignments from the recompiler (enabled in DEBUG builds only). These are usually more context-useful breakpoints than the assert() check in psxRecompile.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1948 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-10-03 13:36:19 +00:00
parent 910669f937
commit 4efb1ed9ca
4 changed files with 33 additions and 8 deletions

View File

@ -681,7 +681,6 @@ static __forceinline s32 recExecuteBlock( s32 eeCycles )
// Returns the offset to the next instruction after any cleared memory // Returns the offset to the next instruction after any cleared memory
static __forceinline u32 psxRecClearMem(u32 pc) static __forceinline u32 psxRecClearMem(u32 pc)
{ {
BASEBLOCKEX* pexblock;
BASEBLOCK* pblock; BASEBLOCK* pblock;
pblock = PSX_GETBLOCK(pc); pblock = PSX_GETBLOCK(pc);
@ -696,8 +695,7 @@ static __forceinline u32 psxRecClearMem(u32 pc)
jASSUME(blockidx != -1); jASSUME(blockidx != -1);
// Variable assignment in the middle of the while statements condition? while (BASEBLOCKEX* pexblock = recBlocks[blockidx - 1]) {
while (pexblock = recBlocks[blockidx - 1]) {
if (pexblock->startpc + pexblock->size * 4 <= lowerextent) if (pexblock->startpc + pexblock->size * 4 <= lowerextent)
break; break;
@ -705,8 +703,7 @@ static __forceinline u32 psxRecClearMem(u32 pc)
blockidx--; blockidx--;
} }
// Same here. while (BASEBLOCKEX* pexblock = recBlocks[blockidx]) {
while (pexblock = recBlocks[blockidx]) {
if (pexblock->startpc >= upperextent) if (pexblock->startpc >= upperextent)
break; break;
@ -716,7 +713,8 @@ static __forceinline u32 psxRecClearMem(u32 pc)
} }
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
for (int i = 0; pexblock = recBlocks[i]; i++) blockidx=0;
while(BASEBLOCKEX* pexblock = recBlocks[blockidx++])
if (pc >= pexblock->startpc && pc < pexblock->startpc + pexblock->size * 4) { if (pc >= pexblock->startpc && pc < pexblock->startpc + pexblock->size * 4) {
Console::Error("Impossible block clearing failure"); Console::Error("Impossible block clearing failure");
jASSUME(0); jASSUME(0);
@ -749,11 +747,24 @@ void psxSetBranchReg(u32 reg)
assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK ); assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK );
MOV32RtoM((uptr)&psxRegs.pc, ESI); MOV32RtoM((uptr)&psxRegs.pc, ESI);
x86regs[ESI].inuse = 0; x86regs[ESI].inuse = 0;
#ifdef PCSX2_DEBUG
xOR( esi, esi );
#endif
} }
else { else {
MOV32MtoR(EAX, (uptr)&g_recWriteback); MOV32MtoR(EAX, (uptr)&g_recWriteback);
MOV32RtoM((uptr)&psxRegs.pc, EAX); MOV32RtoM((uptr)&psxRegs.pc, EAX);
#ifdef PCSX2_DEBUG
xOR( eax, eax );
#endif
} }
#ifdef PCSX2_DEBUG
xForwardJNZ8 skipAssert;
xWrite8( 0xcc );
skipAssert.SetTarget();
#endif
} }
_psxFlushCall(FLUSH_EVERYTHING); _psxFlushCall(FLUSH_EVERYTHING);

View File

@ -22,6 +22,8 @@
#include "IopMem.h" #include "IopMem.h"
#include "IopDma.h" #include "IopDma.h"
using namespace x86Emitter;
extern int g_psxWriteOk; extern int g_psxWriteOk;
extern u32 g_psxMaxRecMem; extern u32 g_psxMaxRecMem;
@ -1243,11 +1245,23 @@ void rpsxJALR()
assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK ); assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK );
MOV32RtoM((uptr)&psxRegs.pc, ESI); MOV32RtoM((uptr)&psxRegs.pc, ESI);
x86regs[ESI].inuse = 0; x86regs[ESI].inuse = 0;
#ifdef PCSX2_DEBUG
xOR( esi, esi );
#endif
} }
else { else {
MOV32MtoR(EAX, (uptr)&g_recWriteback); MOV32MtoR(EAX, (uptr)&g_recWriteback);
MOV32RtoM((uptr)&psxRegs.pc, EAX); MOV32RtoM((uptr)&psxRegs.pc, EAX);
#ifdef PCSX2_DEBUG
xOR( eax, eax );
#endif
} }
#ifdef PCSX2_DEBUG
xForwardJNZ8 skipAssert;
xWrite8( 0xcc );
skipAssert.SetTarget();
#endif
psxSetBranchReg(0xffffffff); psxSetBranchReg(0xffffffff);
} }

View File

@ -491,7 +491,7 @@ void recEventTest()
// dont' remove this check unless doing an official release // dont' remove this check unless doing an official release
if( g_globalXMMSaved || g_globalMMXSaved) if( g_globalXMMSaved || g_globalMMXSaved)
{ {
DevCon::Error("Pcsx2 Foopah! Frozen regs have not been restored!!!"); DevCon::Error("PCSX2 Foopah! Frozen regs have not been restored!!!");
DevCon::Error("g_globalXMMSaved = %d,g_globalMMXSaved = %d", g_globalXMMSaved, g_globalMMXSaved); DevCon::Error("g_globalXMMSaved = %d,g_globalMMXSaved = %d", g_globalXMMSaved, g_globalMMXSaved);
} }
assert( !g_globalXMMSaved && !g_globalMMXSaved); assert( !g_globalXMMSaved && !g_globalMMXSaved);

View File

@ -696,6 +696,6 @@ Global
{677B7D11-D5E1-40B3-88B1-9A4DF83D2213} = {2D6F0A62-A247-4CCF-947F-FCD54BE16103} {677B7D11-D5E1-40B3-88B1-9A4DF83D2213} = {2D6F0A62-A247-4CCF-947F-FCD54BE16103}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
AMDCaProjectFile = E:\devpcsx2\fail\wx\CodeAnalyst\pcsx2_suite_2008.caw AMDCaProjectFile = E:\devpcsx2\nommx\CodeAnalyst\pcsx2_suite_2008.caw
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal