Prevent VS catching exceptions when not debugging

This commit is contained in:
x1nixmzeng 2018-01-07 21:36:36 +00:00
parent ba74b162ad
commit 135699e45d
4 changed files with 18 additions and 4 deletions

View File

@ -55,9 +55,10 @@ namespace CxbxDebugger
bool IsAttached()
{
// TODO: Avoid clashing with VS when child process debugging is enabled for all processes
// TODO: Check the PID of the debugger? Ensure the PID is linked to CxbxDebugger.exe?
return IsDebuggerPresent() == TRUE;
bool IsDebugging;
g_EmuShared->GetDebuggingFlag(&IsDebugging);
return IsDebugging && IsDebuggerPresent() == TRUE;
}
class ReportHelper
@ -124,8 +125,11 @@ namespace CxbxDebugger
{
switch (ExceptionCode)
{
case Internal::FILE_OPENED:
case Internal::HLECACHE_FILE:
case Internal::KERNEL_PATCH:
case Internal::FILE_OPENED:
case Internal::FILE_READ:
case Internal::FILE_CLOSED:
return true;
}

View File

@ -138,6 +138,7 @@ EmuShared::EmuShared()
{
Load();
m_bMultiXbe = false;
m_bDebugging = false;
m_LaunchDataPAddress = NULL;
}

View File

@ -1933,6 +1933,8 @@ void WndMain::StartEmulation(HWND hwndParent, bool WithLocalDebugger /*= false*/
char szArgsBuffer[4096];
snprintf(szArgsBuffer, 4096, "/load \"%s\" %d %d \"%s\"", m_XbeFilename, (int)hwndParent, (int)m_KrnlDebug, m_KrnlDebugFilename);
g_EmuShared->SetDebuggingFlag(&WithLocalDebugger);
if (WithLocalDebugger)
{
// TODO: Set a configuration variable for this. For now it will be within the same folder as Cxbx.exe

View File

@ -124,6 +124,12 @@ class EmuShared : public Mutex
void GetMultiXbeFlag(bool *value) { Lock(); *value = m_bMultiXbe; Unlock(); }
void SetMultiXbeFlag(bool *value) { Lock(); m_bMultiXbe = *value; Unlock(); }
// ******************************************************************
// * Debugging flag Accessors
// ******************************************************************
void GetDebuggingFlag(bool *value) { Lock(); *value = m_bDebugging; Unlock(); }
void SetDebuggingFlag(bool *value) { Lock(); m_bDebugging = *value; Unlock(); }
// ******************************************************************
// * Launch data physical address Accessors
// ******************************************************************
@ -150,6 +156,7 @@ class EmuShared : public Mutex
float m_MSpF;
float m_FPS;
bool m_bMultiXbe;
bool m_bDebugging;
PAddr m_LaunchDataPAddress;
};