[Debugger] Make skip a setting

This commit is contained in:
zilmar 2018-01-17 22:36:28 +11:00
parent 8a85f1e6a4
commit 3d7e9b40b0
11 changed files with 31 additions and 32 deletions

View File

@ -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;
};

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -230,6 +230,7 @@ enum SettingID
Debugger_DebugLanguage,
Debugger_RecordExecutionTimes,
Debugger_SteppingOps,
Debugger_SkipOp,
Debugger_HaveExecutionBP,
Debugger_WaitingForStep,

View File

@ -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));

View File

@ -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)

View File

@ -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;
};

View File

@ -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()

View File

@ -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()

View File

@ -56,7 +56,7 @@ private:
protected:
void TLBChanged(void);
bool CPUStepStarted(void);
void CPUStepStarted(void);
void CPUStep(void);
void FrameDrawn(void);