Modified:
trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Controller.cpp
trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Cpu_Threading.cpp
Log:
Implemented proper breaking
Last thing to fix before I can actually start working on games again is
the debug through branch stuff that seems a bit broken
Modified: trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Controller.cpp
==============================================================================
--- trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Controller.cpp (original)
+++ trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Controller.cpp Sat Mar
29 15:21:22 2008
@@ -101,6 +101,7 @@
void R4000Controller::Break()
{
+ _cpuCtx->StopFlag = CtxBreakAndWait;
}
void R4000Controller::SetNext( uint address )
@@ -317,6 +318,17 @@
}
return DEBUG_HANDLE_CONTINUE;
+}
+
+void BreakHandler( uint pc )
+{
+ Breakpoint^ bp = gcnew Breakpoint(
Diag::Instance->Client->AllocateID(), BreakpointType::Stepping, pc );
+ bp->Enabled = true;
+ Diag::Instance->CpuHook->AddBreakpoint( bp );
+ int handleResult = __debugHandlerM( bp->ID );
+ Diag::Instance->CpuHook->RemoveBreakpoint( bp->ID );
+ // handleResult should be 0 for continue, non-zero for death?
+ assert( handleResult == 0 );
}
int ErrorDebugBreak( uint pc )
Modified: trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Cpu_Threading.cpp
==============================================================================
--- trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Cpu_Threading.cpp (original)
+++ trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Cpu_Threading.cpp Sat
Mar 29 15:21:22 2008
@@ -37,6 +37,8 @@
extern uint _codeCacheMisses;
#endif
+extern void BreakHandler( uint pc );
+
typedef struct ThreadContext_t
{
R4000Ctx Ctx;
@@ -544,7 +546,7 @@
{
_cpuCtx->StopFlag &= ~CtxBreakAndWait;
// BreakAndWait request
- WaitForSingleObject( _waitHandle, INFINITE );
+ BreakHandler( _cpuCtx->PC );
}
}