Debugger: GB - Fixed some issues with breaking not working properly in some scenarios
This commit is contained in:
parent
e47f0b8feb
commit
89199f298a
3 changed files with 23 additions and 18 deletions
|
@ -566,7 +566,7 @@ void Console::PauseOnNextFrame()
|
|||
shared_ptr<Debugger> debugger = _debugger;
|
||||
if(debugger) {
|
||||
if(_settings->CheckFlag(EmulationFlags::GameboyMode)) {
|
||||
debugger->Step(CpuType::Cpu, 144, StepType::SpecificScanline);
|
||||
debugger->Step(CpuType::Gameboy, 144, StepType::SpecificScanline);
|
||||
} else {
|
||||
debugger->Step(CpuType::Cpu, 240, StepType::SpecificScanline);
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ void CpuDebugger::Step(int32_t stepCount, StepType type)
|
|||
StepRequest step;
|
||||
if((type == StepType::StepOver || type == StepType::StepOut || type == StepType::Step) && GetState().StopState == CpuStopState::Stopped) {
|
||||
//If STP was called, the CPU isn't running anymore - use the PPU to break execution instead (useful for test roms that end with STP)
|
||||
_debugger->Step(_cpuType, 1, StepType::PpuStep);
|
||||
step.PpuStepCount = 1;
|
||||
} else {
|
||||
switch(type) {
|
||||
case StepType::Step: step.StepCount = stepCount; break;
|
||||
|
@ -203,8 +203,8 @@ void CpuDebugger::Step(int32_t stepCount, StepType type)
|
|||
}
|
||||
break;
|
||||
|
||||
case StepType::PpuStep: step.PpuStepCount = stepCount; _step.reset(new StepRequest(step)); break;
|
||||
case StepType::SpecificScanline: step.BreakScanline = stepCount; _step.reset(new StepRequest(step)); break;
|
||||
case StepType::PpuStep: step.PpuStepCount = stepCount; break;
|
||||
case StepType::SpecificScanline: step.BreakScanline = stepCount; break;
|
||||
}
|
||||
}
|
||||
_step.reset(new StepRequest(step));
|
||||
|
|
|
@ -183,22 +183,27 @@ void GbDebugger::Step(int32_t stepCount, StepType type)
|
|||
{
|
||||
StepRequest step;
|
||||
|
||||
switch(type) {
|
||||
case StepType::Step: step.StepCount = stepCount; break;
|
||||
case StepType::StepOut: step.BreakAddress = _callstackManager->GetReturnAddress(); break;
|
||||
case StepType::StepOver:
|
||||
if(GameboyDisUtils::IsJumpToSub(_prevOpCode)) {
|
||||
step.BreakAddress = _prevProgramCounter + DisassemblyInfo::GetOpSize(_prevOpCode, 0, CpuType::Gameboy);
|
||||
} else {
|
||||
//For any other instruction, step over is the same as step into
|
||||
step.StepCount = 1;
|
||||
}
|
||||
break;
|
||||
GbCpuState gbState = _gameboy->GetState().Cpu;
|
||||
if((type == StepType::StepOver || type == StepType::StepOut || type == StepType::Step) && gbState.Halted) {
|
||||
//CPU isn't running - use the PPU to break execution instead
|
||||
step.PpuStepCount = 1;
|
||||
} else {
|
||||
switch(type) {
|
||||
case StepType::Step: step.StepCount = stepCount; break;
|
||||
case StepType::StepOut: step.BreakAddress = _callstackManager->GetReturnAddress(); break;
|
||||
case StepType::StepOver:
|
||||
if(GameboyDisUtils::IsJumpToSub(_prevOpCode)) {
|
||||
step.BreakAddress = _prevProgramCounter + DisassemblyInfo::GetOpSize(_prevOpCode, 0, CpuType::Gameboy);
|
||||
} else {
|
||||
//For any other instruction, step over is the same as step into
|
||||
step.StepCount = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case StepType::PpuStep: step.PpuStepCount = stepCount; _step.reset(new StepRequest(step)); break;
|
||||
case StepType::SpecificScanline: step.BreakScanline = stepCount; _step.reset(new StepRequest(step)); break;
|
||||
case StepType::PpuStep: step.PpuStepCount = stepCount; break;
|
||||
case StepType::SpecificScanline: step.BreakScanline = stepCount; break;
|
||||
}
|
||||
}
|
||||
|
||||
_step.reset(new StepRequest(step));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue