//----------------------------------------------------------------------------- // Handle delayed VXConsole transactions // //----------------------------------------------------------------------------- static unsigned _DebugThreadFunc( void *pParam ) { while ( 1 ) { Sleep( 10 ); if ( !g_xbx_DebugStringQueue.Count() && !g_xbx_numProfileCounters && !g_xbx_freeMemory ) { continue; } if ( g_xbx_numProfileCounters ) { // build and send asynchronously char dbgCommand[XBX_MAX_RCMDLENGTH]; _snprintf( dbgCommand, sizeof( dbgCommand ), "SetProfileData() %s 0x%8.8x", g_xbx_profileName, g_xbx_profileCounters ); XBX_SendRemoteCommand( dbgCommand, true ); // mark as sent g_xbx_numProfileCounters = 0; } if ( g_xbx_freeMemory ) { // build and send asynchronously char dbgCommand[XBX_MAX_RCMDLENGTH]; _snprintf( dbgCommand, sizeof( dbgCommand ), "FreeMemory() 0x%8.8x", g_xbx_freeMemory ); XBX_SendRemoteCommand( dbgCommand, true ); // mark as sent g_xbx_freeMemory = 0; } bool bRemoteValid = g_xbx_bUseVXConsoleOutput && XBX_IsConsoleConnected(); while ( 1 ) { DebugString_t debugString; if ( !g_xbx_DebugStringQueue.PopItem( &debugString ) ) { break; } OutputStringToDevice( debugString.color, debugString.pString, bRemoteValid ); free( debugString.pString ); } } return 0; }
//----------------------------------------------------------------------------- // Sends a disconnect signal to possibly attached VXConsole. //----------------------------------------------------------------------------- void CXboxConsole::DisconnectConsoleMonitor() { if ( XBX_NoXBDM() ) return; // caller is trying to safely stop vxconsole traffic, disconnect must be synchronous XBX_SendRemoteCommand( "Disconnect()", false ); }
DBG_INTERFACE bool DoNewAssertDialog( const tchar *pFilename, int line, const tchar *pExpression ) { LOCAL_THREAD_LOCK(); if ( AreAssertsDisabled() ) return false; // If they have the old mode enabled (always break immediately), then just break right into // the debugger like we used to do. if ( IsDebugBreakEnabled() ) return true; // Have ALL Asserts been disabled? if ( !g_bAssertsEnabled ) return false; // Has this specific Assert been disabled? if ( !AreAssertsEnabledInFileLine( pFilename, line ) ) return false; // Now create the dialog. g_Info.m_pFilename = pFilename; g_Info.m_iLine = line; g_Info.m_pExpression = pExpression; g_bBreak = false; #if defined( _X360 ) char cmdString[XBX_MAX_RCMDLENGTH]; // Before calling VXConsole, init the global variable that receives the result g_VXConsoleAssertReturnValue = -1; // Message VXConsole to pop up a PC-side Assert dialog _snprintf( cmdString, sizeof(cmdString), "Assert() 0x%.8x File: %s\tLine: %d\t%s", &g_VXConsoleAssertReturnValue, pFilename, line, pExpression ); XBX_SendRemoteCommand( cmdString, false ); // We sent a synchronous message, so g_xbx_dbgVXConsoleAssertReturnValue should have been overwritten by now if ( g_VXConsoleAssertReturnValue == -1 ) { // VXConsole isn't connected/running - default to the old behaviour (break) g_bBreak = true; } else { // Respond to what the user selected switch( g_VXConsoleAssertReturnValue ) { case ASSERT_ACTION_IGNORE_FILE: IgnoreAssertsInCurrentFile(); break; case ASSERT_ACTION_IGNORE_THIS: // Ignore this Assert once break; case ASSERT_ACTION_BREAK: // Break on this Assert g_bBreak = true; break; case ASSERT_ACTION_IGNORE_ALL: // Ignore all Asserts from now on g_bAssertsEnabled = false; break; case ASSERT_ACTION_IGNORE_ALWAYS: // Ignore this Assert from now on IgnoreAssertsNearby( 0 ); break; case ASSERT_ACTION_OTHER: default: // Error... just break XBX_Error( "DoNewAssertDialog: invalid Assert response returned from VXConsole - breaking to debugger" ); g_bBreak = true; break; } } #elif defined( _WIN32 ) if ( !ThreadInMainThread() ) { int result = MessageBox( NULL, pExpression, "Assertion Failed", MB_SYSTEMMODAL | MB_CANCELTRYCONTINUE ); if ( result == IDCANCEL ) { IgnoreAssertsNearby( 0 ); } else if ( result == IDCONTINUE ) { g_bBreak = true; } } else { HWND hParentWindow = FindLikelyParentWindow(); DialogBox( g_hTier0Instance, MAKEINTRESOURCE( IDD_ASSERT_DIALOG ), hParentWindow, AssertDialogProc ); } #elif _LINUX fprintf(stderr, "%s %i %s", pFilename, line, pExpression); #endif return g_bBreak; }