diff --git a/Source/Project64-core/Debugger.h b/Source/Project64-core/Debugger.h index 803be0c9f..bdf4b2e6d 100644 --- a/Source/Project64-core/Debugger.h +++ b/Source/Project64-core/Debugger.h @@ -27,6 +27,6 @@ __interface CDebugger virtual void WaitForStep(void) = 0; virtual bool ExecutionBP(uint32_t address) = 0; - virtual bool CPUStepStarted(void) = 0; + virtual void CPUStepStarted(void) = 0; virtual void CPUStep(void) = 0; }; diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp b/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp index 0e1604b07..5f84d6a81 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp +++ b/Source/Project64-core/N64System/Interpreter/InterpreterCPU.cpp @@ -307,14 +307,20 @@ void CInterpreterCPU::ExecuteCPU() if (isStepping()) { g_Debugger->WaitForStep(); + + if (SkipOp()) + { + // Skip command if instructed by the debugger + g_Settings->SaveBool(Debugger_SkipOp, false); + PROGRAM_COUNTER += 4; + continue; + } } } - if (CDebugSettings::HaveDebugger() && !g_Debugger->CPUStepStarted()) + if (CDebugSettings::HaveDebugger()) { - // Skip command if instructed by the debugger - PROGRAM_COUNTER += 4; - continue; + g_Debugger->CPUStepStarted(); } /* if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER < 0x80380000) diff --git a/Source/Project64-core/Settings/DebugSettings.cpp b/Source/Project64-core/Settings/DebugSettings.cpp index 0e8e46509..bc2ff84c9 100644 --- a/Source/Project64-core/Settings/DebugSettings.cpp +++ b/Source/Project64-core/Settings/DebugSettings.cpp @@ -15,9 +15,10 @@ int CDebugSettings::m_RefCount = 0; bool CDebugSettings::m_Registered = false; -bool CDebugSettings::m_HaveDebugger = true; -bool CDebugSettings::m_Debugging = true; -bool CDebugSettings::m_Stepping = true; +bool CDebugSettings::m_HaveDebugger = false; +bool CDebugSettings::m_Debugging = false; +bool CDebugSettings::m_Stepping = false; +bool CDebugSettings::m_SkipOp = false; bool CDebugSettings::m_WaitingForStep = false; bool CDebugSettings::m_bRecordRecompilerAsm = false; bool CDebugSettings::m_bShowTLBMisses = false; @@ -37,6 +38,7 @@ CDebugSettings::CDebugSettings() g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + g_Settings->RegisterChangeCB(Debugger_SkipOp, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -55,6 +57,7 @@ CDebugSettings::~CDebugSettings() g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + g_Settings->UnregisterChangeCB(Debugger_SkipOp, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); } @@ -68,6 +71,7 @@ void CDebugSettings::RefreshSettings() m_bShowDivByZero = m_HaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero); m_RecordExecutionTimes = g_Settings->LoadBool(Debugger_RecordExecutionTimes); m_Stepping = g_Settings->LoadBool(Debugger_SteppingOps); + m_SkipOp = g_Settings->LoadBool(Debugger_SkipOp); m_WaitingForStep = g_Settings->LoadBool(Debugger_WaitingForStep); m_HaveExecutionBP = g_Settings->LoadBool(Debugger_HaveExecutionBP); diff --git a/Source/Project64-core/Settings/DebugSettings.h b/Source/Project64-core/Settings/DebugSettings.h index 7c702b140..ee3299370 100644 --- a/Source/Project64-core/Settings/DebugSettings.h +++ b/Source/Project64-core/Settings/DebugSettings.h @@ -21,6 +21,7 @@ public: static inline bool HaveDebugger(void) { return m_HaveDebugger; } static inline bool isDebugging(void) { return m_Debugging; } static inline bool isStepping(void) { return m_Stepping; } + static inline bool SkipOp(void) { return m_SkipOp; } static inline bool WaitingForStep(void) { return m_WaitingForStep; } static inline bool bRecordRecompilerAsm(void) { return m_bRecordRecompilerAsm; } static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; } @@ -39,6 +40,7 @@ private: static bool m_HaveDebugger; static bool m_Debugging; static bool m_Stepping; + static bool m_SkipOp; static bool m_WaitingForStep; static bool m_bRecordRecompilerAsm; static bool m_bShowTLBMisses; diff --git a/Source/Project64-core/Settings/Settings.h b/Source/Project64-core/Settings/Settings.h index b6f3662c4..42e27d8ff 100644 --- a/Source/Project64-core/Settings/Settings.h +++ b/Source/Project64-core/Settings/Settings.h @@ -230,6 +230,7 @@ enum SettingID Debugger_DebugLanguage, Debugger_RecordExecutionTimes, Debugger_SteppingOps, + Debugger_SkipOp, Debugger_HaveExecutionBP, Debugger_WaitingForStep, diff --git a/Source/Project64-core/Settings/SettingsClass.cpp b/Source/Project64-core/Settings/SettingsClass.cpp index 3d5fcdb98..9dbb60ea9 100644 --- a/Source/Project64-core/Settings/SettingsClass.cpp +++ b/Source/Project64-core/Settings/SettingsClass.cpp @@ -315,6 +315,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Debugger_ShowRecompMemSize, new CSettingTypeApplication("Debugger", "Show Recompiler Memory size", false)); AddHandler(Debugger_RecordExecutionTimes, new CSettingTypeApplication("Debugger", "Record Execution Times", false)); AddHandler(Debugger_SteppingOps, new CSettingTypeTempBool(false)); + AddHandler(Debugger_SkipOp, new CSettingTypeTempBool(false)); AddHandler(Debugger_HaveExecutionBP, new CSettingTypeTempBool(false)); AddHandler(Debugger_WaitingForStep, new CSettingTypeTempBool(false)); AddHandler(Debugger_DebugLanguage, new CSettingTypeApplication("Debugger", "Debug Language", false)); diff --git a/Source/Project64/UserInterface/Debugger/Breakpoints.cpp b/Source/Project64/UserInterface/Debugger/Breakpoints.cpp index 325360f79..ec1173d7c 100644 --- a/Source/Project64/UserInterface/Debugger/Breakpoints.cpp +++ b/Source/Project64/UserInterface/Debugger/Breakpoints.cpp @@ -19,18 +19,6 @@ CBreakpoints::CBreakpoints() { - m_Skipping = FALSE; -} - -bool CBreakpoints::isSkipping() -{ - bool ret = m_Skipping; - m_Skipping = FALSE; - return ret; -} -void CBreakpoints::Skip() -{ - m_Skipping = true; } bool CBreakpoints::RBPAdd(uint32_t address, bool bTemporary) diff --git a/Source/Project64/UserInterface/Debugger/Breakpoints.h b/Source/Project64/UserInterface/Debugger/Breakpoints.h index 37739cb9b..22603fe97 100644 --- a/Source/Project64/UserInterface/Debugger/Breakpoints.h +++ b/Source/Project64/UserInterface/Debugger/Breakpoints.h @@ -36,10 +36,6 @@ public: BPSTATE WriteBPExists(uint32_t address, bool bRemoveTemp = false); BPSTATE ExecutionBPExists(uint32_t address, bool bRemoveTemp = false); - void Skip(); - - bool isSkipping(); - bool RBPAdd(uint32_t address, bool bTemporary = false); void RBPRemove(uint32_t address); void RBPToggle(uint32_t address, bool bTemporary = false); @@ -61,6 +57,4 @@ private: breakpoints_t m_ReadMem; breakpoints_t m_WriteMem; breakpoints_t m_Execution; - - bool m_Skipping; }; \ No newline at end of file diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index 630cf7748..fc48609f1 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -1096,7 +1096,11 @@ void CDebugCommandsView::RemoveSelectedBreakpoints() void CDebugCommandsView::CPUSkip() { - m_Breakpoints->Skip(); + g_Settings->SaveBool(Debugger_SkipOp, true); + if (WaitingForStep()) + { + m_StepEvent.Trigger(); + } } void CDebugCommandsView::CPUResume() diff --git a/Source/Project64/UserInterface/Debugger/Debugger.cpp b/Source/Project64/UserInterface/Debugger/Debugger.cpp index 94e8918e2..32d32b4e1 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger.cpp @@ -375,7 +375,7 @@ void CDebuggerUI::TLBChanged() // Called from the interpreter core at the beginning of every CPU step // Returns false when the instruction should be skipped -bool CDebuggerUI::CPUStepStarted() +void CDebuggerUI::CPUStepStarted() { uint32_t PROGRAM_COUNTER = g_Reg->m_PROGRAM_COUNTER; uint32_t JumpToLocation = R4300iOp::m_JumpToLocation; @@ -434,7 +434,7 @@ bool CDebuggerUI::CPUStepStarted() if (!isStepping()) { - return !m_Breakpoints->isSkipping(); + return; } if (R4300iOp::m_NextInstruction != JUMP) @@ -448,11 +448,10 @@ bool CDebuggerUI::CPUStepStarted() goto breakpoint_hit; } - return !m_Breakpoints->isSkipping(); + return; breakpoint_hit: g_Settings->SaveBool(Debugger_SteppingOps, true); - return !m_Breakpoints->isSkipping(); } void CDebuggerUI::CPUStep() diff --git a/Source/Project64/UserInterface/Debugger/debugger.h b/Source/Project64/UserInterface/Debugger/debugger.h index b8dfaf9ec..59438f8c5 100644 --- a/Source/Project64/UserInterface/Debugger/debugger.h +++ b/Source/Project64/UserInterface/Debugger/debugger.h @@ -56,7 +56,7 @@ private: protected: void TLBChanged(void); - bool CPUStepStarted(void); + void CPUStepStarted(void); void CPUStep(void); void FrameDrawn(void);