[pspplayer commit] r600 - in trunk: Noxa.Emulation.Psp.Cpu.R4000Ultra Noxa.Emulation.Psp.Player/Debugger/Tools

1 view
Skip to first unread message

codesite...@google.com

unread,
Mar 29, 2008, 9:18:59 PM3/29/08
to psppla...@googlegroups.com
Author: ben.vanik
Date: Sat Mar 29 18:18:18 2008
New Revision: 600

Modified:
trunk/Noxa.Emulation.Psp.Cpu.R4000Ultra/R4000Controller.cpp
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/CodeViewControl.cs

Log:
implemented 'run until' and 'set next statement' commands - very useful

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 18:18:18 2008
@@ -31,6 +31,7 @@
#define DEBUG_RESUME_CONTINUE 0 // resume normal
#define DEBUG_RESUME_STEP 1 // param = see below
#define DEBUG_RESUME_SET_NEXT 2 // param = new address
+#define DEBUG_RESUME_RUN_UNTIL 3 // param = new address

#define DEBUG_STEP_INTO 0
#define DEBUG_STEP_OVER 1
@@ -97,6 +98,9 @@

void R4000Controller::RunUntil( uint address )
{
+ _debugResumeMode = DEBUG_RESUME_RUN_UNTIL;
+ _debugResumeParam = address;
+ PulseEvent( _debugHandle );
}

void R4000Controller::Break()
@@ -177,6 +181,7 @@
int __debugHandlerM( int breakpointId )
{
R4000Cpu^ cpu = R4000Cpu::GlobalCpu;
+ int result = DEBUG_HANDLE_CONTINUE;

Breakpoint^ breakpoint;
for each( Breakpoint^ bp in cpu->_hook->SteppingBreakpoints )
@@ -304,6 +309,24 @@
}
break;
case DEBUG_RESUME_SET_NEXT:
+ // _debugResumeParam is address to jump to
+ {
+ Breakpoint^ newBreakpoint = gcnew Breakpoint(
Diag::Instance->Client->AllocateID(), BreakpointType::Stepping,
_debugResumeParam );
+ cpu->_hook->SteppingBreakpoints->Add( newBreakpoint );
+ SetBreakpoint( newBreakpoint );
+
+ // TODO: somehow change the cpu to execute from there, and break
out of the current block
+ _cpuCtx->PC = _debugResumeParam;
+ result = DEBUG_HANDLE_BREAK;
+ }
+ break;
+ case DEBUG_RESUME_RUN_UNTIL:
+ // _debugResumeParam is the address to break on
+ {
+ Breakpoint^ newBreakpoint = gcnew Breakpoint(
Diag::Instance->Client->AllocateID(), BreakpointType::Stepping,
_debugResumeParam );
+ cpu->_hook->SteppingBreakpoints->Add( newBreakpoint );
+ SetBreakpoint( newBreakpoint );
+ }
break;
}
}
@@ -317,7 +340,7 @@
Debugger::Break();
}

- return DEBUG_HANDLE_CONTINUE;
+ return result;
}

void BreakHandler( uint pc )
@@ -328,7 +351,8 @@
int handleResult = __debugHandlerM( bp->ID );
Diag::Instance->CpuHook->RemoveBreakpoint( bp->ID );
// handleResult should be 0 for continue, non-zero for death?
- assert( handleResult == 0 );
+ //assert( handleResult == 0 );
+ // Since we are called from the main handler, we can survive breaking out
}

int ErrorDebugBreak( uint pc )

Modified: trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/CodeViewControl.cs
==============================================================================
--- trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/CodeViewControl.cs (original)
+++ trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/CodeViewControl.cs
Sat Mar 29 18:18:18 2008
@@ -1081,10 +1081,6 @@

private void showNextToolStripMenuItem_Click( object sender,
EventArgs e )
{
- Instruction instr = this.GetContextInstruction();
- if( instr == null )
- return;
-
this.NavigateToAddress( _debugger.PC );
this.Focus();

@@ -1097,6 +1093,8 @@
if( instr == null )
return;

+ _debugger.DebugHost.Controller.RunUntil( instr.Address );
+
this.ContextReturn();
}

@@ -1105,6 +1103,8 @@
Instruction instr = this.GetContextInstruction();
if( instr == null )
return;
+
+ _debugger.DebugHost.Controller.SetNext( instr.Address );

this.ContextReturn();
}

Reply all
Reply to author
Forward
0 new messages