- Debugger server can be toggled with : com_enableDebuggerServer [1 / 0]

- Added com_dbgClientAdr for debugger server to connect to
- Added com_dbgServerAdr for the debugger client to connect to
This commit is contained in:
HarrievG 2021-06-13 02:35:00 +02:00 committed by Daniel Gibson
parent c2b34e6fe8
commit 8a455c3c7a
6 changed files with 28 additions and 14 deletions

View file

@ -98,7 +98,9 @@ idCVar com_timescale( "timescale", "1", CVAR_SYSTEM | CVAR_FLOAT, "scales the ti
idCVar com_makingBuild( "com_makingBuild", "0", CVAR_BOOL | CVAR_SYSTEM, "1 when making a build" );
idCVar com_updateLoadSize( "com_updateLoadSize", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "update the load size after loading a map" );
idCVar com_enableDebuggerServer( "com_enableDebuggerServer", "0", CVAR_BOOL | CVAR_SYSTEM, "set to 1 on startup to enable debugging with the DHEWM3 debugger" );
idCVar com_enableDebuggerServer( "com_enableDebuggerServer", "0", CVAR_BOOL | CVAR_SYSTEM, "toggle debugger server and try to connect to com_dbgClientAdr" );
idCVar com_dbgClientAdr( "com_dbgClientAdr", "localhost", CVAR_SYSTEM | CVAR_ARCHIVE, "debuggerApp client address" );
idCVar com_dbgServerAdr( "com_dbgServerAdr", "localhost", CVAR_SYSTEM | CVAR_ARCHIVE, "debugger server address" );
idCVar com_product_lang_ext( "com_product_lang_ext", "1", CVAR_INTEGER | CVAR_SYSTEM | CVAR_ARCHIVE, "Extension to use when creating language files." );
@ -2406,6 +2408,10 @@ void idCommonLocal::Frame( void ) {
InitSIMD();
}
if ( com_enableDebuggerServer.IsModified( ) ) {
com_enableDebuggerServer.GetBool( ) ? DebuggerServerInit( ) : DebuggerServerShutdown( );
}
eventLoop->RunEventLoop();
com_frameTime = com_ticNumber * USERCMD_MSEC;

View file

@ -74,6 +74,8 @@ extern idCVar com_showSoundDecoders;
extern idCVar com_makingBuild;
extern idCVar com_updateLoadSize;
extern idCVar com_enableDebuggerServer;
extern idCVar com_dbgClientAdr;
extern idCVar com_dbgServerAdr;
extern int time_gameFrame; // game logic time
extern int time_gameDraw; // game present time

View file

@ -73,7 +73,7 @@ bool rvDebuggerClient::Initialize ( void )
}
// Server must be running on the local host on port 28980
Sys_StringToNetAdr ( "localhost", &mServerAdr, true );
Sys_StringToNetAdr ( com_dbgServerAdr.GetString( ), &mServerAdr, true );
mServerAdr.port = 27980;
// Attempt to let the server know we are here. The server may not be running so this

View file

@ -98,7 +98,7 @@ bool rvDebuggerServer::Initialize ( void )
mCriticalSection = SDL_CreateMutex();
// Server must be running on the local host on port 28980
Sys_StringToNetAdr ( "localhost", &mClientAdr, true );
Sys_StringToNetAdr ( com_dbgClientAdr.GetString( ), &mClientAdr, true );
mClientAdr.port = 27981;
// Attempt to let the server know we are here. The server may not be running so this

View file

@ -53,9 +53,9 @@ public:
bool IsConnected ( void );
void CheckBreakpoints ( idInterpreter* interpreter, idProgram* program, int instructionPointer );
void CheckBreakpoints ( idInterpreter *interpreter, idProgram *program, int instructionPointer );
void Print ( const char* text );
void Print ( const char *text );
void OSPathToRelativePath ( const char *osPath, idStr &qpath );
@ -64,20 +64,20 @@ private:
void ClearBreakpoints ( void );
void Break ( idInterpreter* interpreter, idProgram* program, int instructionPointer );
void Break ( idInterpreter *interpreter, idProgram *program, int instructionPointer );
void Resume ( void );
void SendMessage ( EDebuggerMessage dbmsg );
void SendPacket ( void* data, int datasize );
// Message handlers
void HandleAddBreakpoint ( idBitMsg * msg );
void HandleRemoveBreakpoint ( idBitMsg * msg );
void HandleResume ( idBitMsg * msg );
void HandleInspectVariable ( idBitMsg * msg );
void HandleInspectCallstack ( idBitMsg * msg );
void HandleInspectThreads ( idBitMsg * msg );
void HandleInspectScripts ( idBitMsg * msg );
void HandleAddBreakpoint ( idBitMsg *msg );
void HandleRemoveBreakpoint ( idBitMsg *msg );
void HandleResume ( idBitMsg *msg );
void HandleInspectVariable ( idBitMsg *msg );
void HandleInspectCallstack ( idBitMsg *msg );
void HandleInspectThreads ( idBitMsg *msg );
void HandleInspectScripts ( idBitMsg *msg );
////
bool mConnected;
@ -123,7 +123,7 @@ ID_INLINE bool rvDebuggerServer::IsConnected ( void )
rvDebuggerServer::SendPacket
================
*/
ID_INLINE void rvDebuggerServer::SendPacket ( void* data, int size )
ID_INLINE void rvDebuggerServer::SendPacket ( void *data, int size )
{
mPort.SendPacket ( mClientAdr, data, size );
}

View file

@ -164,6 +164,8 @@ bool DebuggerServerInit ( void )
gDebuggerServer = NULL;
return false;
}
com_enableDebuggerServer.ClearModified( );
// Start the debugger server thread
#if SDL_VERSION_ATLEAST(2, 0, 0)
@ -199,7 +201,11 @@ void DebuggerServerShutdown ( void )
delete gDebuggerServer;
gDebuggerServer = NULL;
com_editors &= ~EDITOR_DEBUGGER;
}
com_enableDebuggerServer.ClearModified( );
}
/*