2016-01-27 09:11:59 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "DebugSettings.h"
|
|
|
|
|
|
|
|
int CDebugSettings::m_RefCount = 0;
|
|
|
|
|
2018-01-15 21:14:15 +00:00
|
|
|
bool CDebugSettings::m_Registered = false;
|
|
|
|
|
2018-01-17 11:36:28 +00:00
|
|
|
bool CDebugSettings::m_HaveDebugger = false;
|
|
|
|
bool CDebugSettings::m_Debugging = false;
|
|
|
|
bool CDebugSettings::m_Stepping = false;
|
|
|
|
bool CDebugSettings::m_SkipOp = false;
|
2018-01-16 21:26:54 +00:00
|
|
|
bool CDebugSettings::m_WaitingForStep = false;
|
2016-12-12 19:11:47 +00:00
|
|
|
bool CDebugSettings::m_bRecordRecompilerAsm = false;
|
2016-01-27 09:11:59 +00:00
|
|
|
bool CDebugSettings::m_bShowTLBMisses = false;
|
|
|
|
bool CDebugSettings::m_bShowDivByZero = false;
|
2016-10-02 21:46:05 +00:00
|
|
|
bool CDebugSettings::m_RecordExecutionTimes = false;
|
2017-12-12 10:15:34 +00:00
|
|
|
bool CDebugSettings::m_HaveExecutionBP = false;
|
2018-02-01 17:28:08 +00:00
|
|
|
bool CDebugSettings::m_HaveWriteBP = false;
|
2018-02-05 06:43:46 +00:00
|
|
|
bool CDebugSettings::m_HaveReadBP = false;
|
2018-02-16 05:38:00 +00:00
|
|
|
bool CDebugSettings::m_bShowPifRamErrors = false;
|
2019-01-14 09:18:43 +00:00
|
|
|
bool CDebugSettings::m_bCPULoggingEnabled = false;
|
2019-01-17 09:34:24 +00:00
|
|
|
uint32_t CDebugSettings::m_ExceptionBreakpoints = 0;
|
2019-08-20 22:20:49 +00:00
|
|
|
uint32_t CDebugSettings::m_FpExceptionBreakpoints = 0;
|
|
|
|
uint32_t CDebugSettings::m_IntrBreakpoints = 0;
|
|
|
|
uint32_t CDebugSettings::m_RcpIntrBreakpoints = 0;
|
2022-08-01 01:29:16 +00:00
|
|
|
bool CDebugSettings::m_EndOnPermLoop = false;
|
2022-08-01 00:30:07 +00:00
|
|
|
bool CDebugSettings::m_BreakOnUnhandledMemory = false;
|
2022-08-01 01:08:12 +00:00
|
|
|
bool CDebugSettings::m_BreakOnAddressError = false;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
CDebugSettings::CDebugSettings()
|
|
|
|
{
|
|
|
|
m_RefCount += 1;
|
|
|
|
if (!m_Registered && g_Settings)
|
|
|
|
{
|
|
|
|
m_Registered = true;
|
|
|
|
g_Settings->RegisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-12-12 19:11:47 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_RecordRecompilerAsm, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-01-27 09:11:59 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-10-02 21:46:05 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-01-15 21:14:15 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-01-17 11:36:28 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_SkipOp, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2017-12-12 10:15:34 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-02-01 17:28:08 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_WriteBPExists, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-02-05 06:43:46 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_ReadBPExists, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-01-16 21:26:54 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-02-16 05:38:00 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_ShowPifErrors, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2019-01-14 09:18:43 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_CPULoggingEnabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2019-01-17 09:34:24 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_ExceptionBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2019-08-20 22:20:49 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_FpExceptionBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Debugger_IntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->RegisterChangeCB(Debugger_RcpIntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2022-08-01 01:29:16 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_EndOnPermLoop, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2022-08-01 00:30:07 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_BreakOnUnhandledMemory, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2022-08-01 01:08:12 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_BreakOnAddressError, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
RefreshSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CDebugSettings::~CDebugSettings()
|
|
|
|
{
|
|
|
|
m_RefCount -= 1;
|
|
|
|
if (m_RefCount == 0 && g_Settings)
|
|
|
|
{
|
|
|
|
g_Settings->UnregisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-12-12 19:11:47 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_RecordRecompilerAsm, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-01-27 09:11:59 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-10-02 21:46:05 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-01-15 21:14:15 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-01-17 11:36:28 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_SkipOp, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2017-12-12 10:15:34 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_HaveExecutionBP, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-02-01 17:28:08 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_WriteBPExists, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-01-16 21:26:54 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2018-02-16 05:38:00 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_ShowPifErrors, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2019-01-14 09:18:43 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_CPULoggingEnabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2019-01-17 09:34:24 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_ExceptionBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2019-08-20 22:20:49 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_FpExceptionBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Debugger_IntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
|
|
|
g_Settings->UnregisterChangeCB(Debugger_RcpIntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2022-08-01 01:29:16 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_EndOnPermLoop, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2022-08-01 00:30:07 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_BreakOnUnhandledMemory, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2022-08-01 01:08:12 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_BreakOnAddressError, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugSettings::RefreshSettings()
|
|
|
|
{
|
2018-01-15 21:23:21 +00:00
|
|
|
m_HaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
|
|
|
|
m_bRecordRecompilerAsm = m_HaveDebugger && g_Settings->LoadBool(Debugger_RecordRecompilerAsm);
|
|
|
|
m_bShowDivByZero = m_HaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
|
2018-02-01 17:28:08 +00:00
|
|
|
m_RecordExecutionTimes = m_HaveDebugger && g_Settings->LoadBool(Debugger_RecordExecutionTimes);
|
|
|
|
m_Stepping = m_HaveDebugger && g_Settings->LoadBool(Debugger_SteppingOps);
|
|
|
|
m_SkipOp = m_HaveDebugger && g_Settings->LoadBool(Debugger_SkipOp);
|
2018-01-16 21:26:54 +00:00
|
|
|
m_WaitingForStep = g_Settings->LoadBool(Debugger_WaitingForStep);
|
2018-02-01 17:28:08 +00:00
|
|
|
m_HaveExecutionBP = m_HaveDebugger && g_Settings->LoadBool(Debugger_HaveExecutionBP);
|
|
|
|
m_HaveWriteBP = m_HaveDebugger && g_Settings->LoadBool(Debugger_WriteBPExists);
|
2018-02-05 06:43:46 +00:00
|
|
|
m_HaveReadBP = m_HaveDebugger && g_Settings->LoadBool(Debugger_ReadBPExists);
|
2018-02-16 05:38:00 +00:00
|
|
|
m_bShowPifRamErrors = m_HaveDebugger && g_Settings->LoadBool(Debugger_ShowPifErrors);
|
2019-01-14 09:18:43 +00:00
|
|
|
m_bCPULoggingEnabled = m_HaveDebugger && g_Settings->LoadBool(Debugger_CPULoggingEnabled);
|
2019-01-17 09:34:24 +00:00
|
|
|
m_ExceptionBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_ExceptionBreakpoints) : 0;
|
2019-08-20 22:20:49 +00:00
|
|
|
m_FpExceptionBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_FpExceptionBreakpoints) : 0;
|
|
|
|
m_IntrBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_IntrBreakpoints) : 0;
|
|
|
|
m_RcpIntrBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_RcpIntrBreakpoints) : 0;
|
2022-08-01 01:29:16 +00:00
|
|
|
m_EndOnPermLoop = m_HaveDebugger && g_Settings->LoadBool(Debugger_EndOnPermLoop);
|
2022-08-01 00:30:07 +00:00
|
|
|
m_BreakOnUnhandledMemory = m_HaveDebugger && g_Settings->LoadBool(Debugger_BreakOnUnhandledMemory);
|
2022-08-01 01:08:12 +00:00
|
|
|
m_BreakOnAddressError = m_HaveDebugger && g_Settings->LoadBool(Debugger_BreakOnAddressError);
|
|
|
|
|
2018-02-05 06:43:46 +00:00
|
|
|
m_Debugging = m_HaveDebugger && (m_HaveExecutionBP || m_WaitingForStep || m_HaveWriteBP || m_HaveReadBP);
|
2015-11-14 21:32:57 +00:00
|
|
|
}
|