dhewm3/neo/tools/debugger/DebuggerServer.cpp

708 lines
17 KiB
C++
Raw Normal View History

2011-11-22 21:28:15 +00:00
/*
===========================================================================
Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
2011-11-22 21:28:15 +00:00
2011-12-06 16:14:59 +00:00
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
2011-11-22 21:28:15 +00:00
Doom 3 Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "tools/edit_gui_common.h"
2011-11-22 21:28:15 +00:00
#include "DebuggerApp.h"
#include "DebuggerServer.h"
/*
================
rvDebuggerServer::rvDebuggerServer
================
*/
rvDebuggerServer::rvDebuggerServer ( )
{
mConnected = false;
mBreakNext = false;
mBreak = false;
mBreakStepOver = false;
mBreakStepInto = false;
mGameThread = NULL;
mLastStatementLine = -1;
mBreakStepOverFunc1 = NULL;
mBreakStepOverFunc2 = NULL;
}
/*
================
rvDebuggerServer::~rvDebuggerServer
================
*/
rvDebuggerServer::~rvDebuggerServer ( )
{
}
/*
================
rvDebuggerServer::Initialize
Initialize the debugger server. This function should be called before the
debugger server is used.
================
*/
bool rvDebuggerServer::Initialize ( void )
{
// Initialize the network connection
if ( !mPort.InitForPort ( 27980 ) )
{
return false;
}
// Get a copy of the game thread handle so we can suspend the thread on a break
DuplicateHandle ( GetCurrentProcess(), GetCurrentThread ( ), GetCurrentProcess(), &mGameThread, 0, FALSE, DUPLICATE_SAME_ACCESS );
// Create a critical section to ensure that the shared thread
// variables are protected
InitializeCriticalSection ( &mCriticalSection );
// Server must be running on the local host on port 28980
Sys_StringToNetAdr ( "localhost", &mClientAdr, true );
mClientAdr.port = 27981;
2011-11-22 21:28:15 +00:00
// Attempt to let the server know we are here. The server may not be running so this
// message will just get ignored.
SendMessage ( DBMSG_CONNECT );
2011-11-22 21:28:15 +00:00
return true;
}
2011-11-22 21:28:15 +00:00
void rvDebuggerServer::OSPathToRelativePath( const char *osPath, idStr &qpath )
{
if ( strchr( osPath, ':' ) )
2011-11-22 21:28:15 +00:00
{
qpath = fileSystem->OSPathToRelativePath( osPath );
}
else
{
qpath = osPath;
}
}
/*
================
rvDebuggerServer::Shutdown
Shutdown the debugger server.
================
*/
void rvDebuggerServer::Shutdown ( void )
{
// Let the debugger client know we are shutting down
if ( mConnected )
{
SendMessage ( DBMSG_DISCONNECT );
mConnected = false;
}
mPort.Close();
// dont need the crit section anymore
DeleteCriticalSection ( &mCriticalSection );
}
/*
================
rvDebuggerServer::ProcessMessages
Process all incoming network messages from the debugger client
================
*/
bool rvDebuggerServer::ProcessMessages ( void )
{
netadr_t adrFrom;
2021-05-11 20:45:24 +00:00
idBitMsg msg;
2011-11-22 21:28:15 +00:00
byte buffer[MAX_MSGLEN];
// Check for pending udp packets on the debugger port
2021-05-11 20:45:24 +00:00
int msgSize;
while ( mPort.GetPacket ( adrFrom, buffer, msgSize, MAX_MSGLEN) )
2011-11-22 21:28:15 +00:00
{
2021-05-11 20:45:24 +00:00
short command;
msg.Init(buffer, sizeof(buffer));
msg.SetSize(msgSize);
msg.BeginReading();
2011-11-22 21:28:15 +00:00
// Only accept packets from the debugger server for security reasons
if ( !Sys_CompareNetAdrBase ( adrFrom, mClientAdr ) )
{
continue;
}
2021-05-11 20:45:24 +00:00
command = msg.ReadShort( );
2011-11-22 21:28:15 +00:00
switch ( command )
{
case DBMSG_CONNECT:
mConnected = true;
SendMessage ( DBMSG_CONNECTED );
2021-05-11 20:45:24 +00:00
2011-11-22 21:28:15 +00:00
break;
2011-11-22 21:28:15 +00:00
case DBMSG_CONNECTED:
mConnected = true;
2021-05-11 20:45:24 +00:00
com_editors |= EDITOR_DEBUGGER;
2011-11-22 21:28:15 +00:00
break;
2011-11-22 21:28:15 +00:00
case DBMSG_DISCONNECT:
ClearBreakpoints ( );
Resume ( );
2011-11-22 21:28:15 +00:00
mConnected = false;
2021-05-11 20:45:24 +00:00
com_editors &= ~EDITOR_DEBUGGER;
2011-11-22 21:28:15 +00:00
break;
2011-11-22 21:28:15 +00:00
case DBMSG_ADDBREAKPOINT:
HandleAddBreakpoint ( &msg );
break;
2011-11-22 21:28:15 +00:00
case DBMSG_REMOVEBREAKPOINT:
HandleRemoveBreakpoint ( &msg );
break;
2011-11-22 21:28:15 +00:00
case DBMSG_RESUME:
2021-05-11 20:45:24 +00:00
HandleResume ( &msg );
2011-11-22 21:28:15 +00:00
break;
2011-11-22 21:28:15 +00:00
case DBMSG_BREAK:
mBreakNext = true;
break;
2011-11-22 21:28:15 +00:00
case DBMSG_STEPOVER:
mBreakStepOver = true;
2021-05-11 20:45:24 +00:00
mBreakStepOverDepth = gameEdit->GetInterpreterCallStackDepth(mBreakInterpreter);
mBreakStepOverFunc1 = gameEdit->GetInterpreterCallStackFunction(mBreakInterpreter);
if (mBreakStepOverDepth)
2011-11-22 21:28:15 +00:00
{
2021-05-11 20:45:24 +00:00
mBreakStepOverFunc2 = gameEdit->GetInterpreterCallStackFunction(mBreakInterpreter,mBreakStepOverDepth - 1);
2011-11-22 21:28:15 +00:00
}
else
{
mBreakStepOverFunc2 = NULL;
}
Resume ( );
break;
case DBMSG_STEPINTO:
mBreakStepInto = true;
Resume ( );
break;
2011-11-22 21:28:15 +00:00
case DBMSG_INSPECTVARIABLE:
HandleInspectVariable ( &msg );
break;
2011-11-22 21:28:15 +00:00
case DBMSG_INSPECTCALLSTACK:
HandleInspectCallstack ( &msg );
break;
2011-11-22 21:28:15 +00:00
case DBMSG_INSPECTTHREADS:
HandleInspectThreads ( &msg );
break;
2021-05-11 20:45:24 +00:00
case DBMSG_INSPECTSCRIPTS:
HandleInspectScripts( &msg );
break;
}
2011-11-22 21:28:15 +00:00
}
return true;
}
/*
================
rvDebuggerServer::SendMessage
Send a message with no data to the debugger server.
================
*/
void rvDebuggerServer::SendMessage ( EDebuggerMessage dbmsg )
{
2021-05-11 20:45:24 +00:00
idBitMsg msg;
2011-11-22 21:28:15 +00:00
byte buffer[MAX_MSGLEN];
2021-05-11 20:45:24 +00:00
msg.Init( buffer, sizeof( buffer ) );
msg.BeginWriting();
msg.WriteShort ( (short)dbmsg );
2021-05-11 20:45:24 +00:00
SendPacket ( msg.GetData(), msg.GetSize() );
2011-11-22 21:28:15 +00:00
}
/*
================
rvDebuggerServer::HandleAddBreakpoint
Handle the DBMSG_ADDBREAKPOINT message being sent by the debugger client. This
2021-05-11 20:45:24 +00:00
message is handled by first checking if it is valid
and is added as a new breakpoint to the breakpoint list with the
2011-11-22 21:28:15 +00:00
data supplied in the message.
================
*/
2021-05-11 20:45:24 +00:00
void rvDebuggerServer::HandleAddBreakpoint ( idBitMsg* msg )
2011-11-22 21:28:15 +00:00
{
bool onceOnly = false;
long lineNumber;
long id;
char filename[MAX_PATH];
2011-11-22 21:28:15 +00:00
// Read the breakpoint info
2021-05-11 20:45:24 +00:00
onceOnly = msg->ReadBits ( 1 ) ? true : false;
lineNumber = msg->ReadInt ( );
id = msg->ReadInt ( );
msg->ReadString ( filename, MAX_PATH );
//check for statement on requested breakpoint location
if (!gameEdit->IsLineCode(filename, lineNumber))
{
idBitMsg msgOut;
byte buffer[MAX_MSGLEN];
msgOut.Init(buffer, sizeof(buffer));
msgOut.BeginWriting();
msgOut.WriteShort((short)DBMSG_REMOVEBREAKPOINT);
msgOut.WriteInt(lineNumber);
msgOut.WriteString(filename);
SendPacket(msgOut.GetData(), msgOut.GetSize());
return;
}
2011-11-22 21:28:15 +00:00
EnterCriticalSection ( &mCriticalSection );
mBreakpoints.Append ( new rvDebuggerBreakpoint ( filename, lineNumber, id ) );
LeaveCriticalSection ( &mCriticalSection );
}
/*
================
rvDebuggerServer::HandleRemoveBreakpoint
Handle the DBMSG_REMOVEBREAKPOINT message being sent by the debugger client. This
message is handled by removing the breakpoint that matches the given id from the
2011-11-22 21:28:15 +00:00
list.
================
*/
2021-05-11 20:45:24 +00:00
void rvDebuggerServer::HandleRemoveBreakpoint ( idBitMsg* msg )
2011-11-22 21:28:15 +00:00
{
int i;
int id;
2011-11-22 21:28:15 +00:00
// ID that we are to remove
2021-05-11 20:45:24 +00:00
id = msg->ReadInt ( );
2011-11-22 21:28:15 +00:00
// Since breakpoints are used by both threads we need to
// protect them with a crit section
2011-11-22 21:28:15 +00:00
EnterCriticalSection ( &mCriticalSection );
2011-11-22 21:28:15 +00:00
// Find the breakpoint that matches the given id and remove it from the list
for ( i = 0; i < mBreakpoints.Num(); i ++ )
{
if ( mBreakpoints[i]->GetID ( ) == id )
{
delete mBreakpoints[i];
mBreakpoints.RemoveIndex ( i );
break;
}
}
LeaveCriticalSection ( &mCriticalSection );
}
/*
================
2021-05-11 20:45:24 +00:00
rvDebuggerServer::HandleResume
2011-11-22 21:28:15 +00:00
2021-05-11 20:45:24 +00:00
Resume the game thread.
2011-11-22 21:28:15 +00:00
================
2021-05-11 20:45:24 +00:00
2011-11-22 21:28:15 +00:00
*/
2021-05-11 20:45:24 +00:00
void rvDebuggerServer::HandleResume(idBitMsg* msg)
2011-11-22 21:28:15 +00:00
{
2021-05-11 20:45:24 +00:00
//Empty msg
Resume();
2011-11-22 21:28:15 +00:00
}
/*
================
rvDebuggerServer::HandleInspectCallstack
Handle an incoming inspect callstack message by sending a message
back to the client with the callstack data.
================
*/
2021-05-11 20:45:24 +00:00
void rvDebuggerServer::HandleInspectCallstack ( idBitMsg* msg )
2011-11-22 21:28:15 +00:00
{
2021-05-11 20:45:24 +00:00
idBitMsg msgOut;
2011-11-22 21:28:15 +00:00
byte buffer[MAX_MSGLEN];
2021-05-11 20:45:24 +00:00
msgOut.Init(buffer, sizeof( buffer ) );
msgOut.BeginWriting();
msgOut.WriteShort ( (short)DBMSG_INSPECTCALLSTACK );
2011-11-22 21:28:15 +00:00
2021-05-11 20:45:24 +00:00
gameEdit->MSG_WriteInterpreterInfo(&msgOut, mBreakInterpreter, mBreakProgram, mBreakInstructionPointer);
2011-11-22 21:28:15 +00:00
2021-05-11 20:45:24 +00:00
SendPacket (msgOut.GetData(), msgOut.GetSize() );
2011-11-22 21:28:15 +00:00
}
/*
================
rvDebuggerServer::HandleInspectThreads
Send the list of the current threads in the interpreter back to the debugger client
================
*/
2021-05-11 20:45:24 +00:00
void rvDebuggerServer::HandleInspectThreads ( idBitMsg* msg )
2011-11-22 21:28:15 +00:00
{
2021-05-11 20:45:24 +00:00
idBitMsg msgOut;
byte buffer[MAX_MSGLEN];
int i;
2011-11-22 21:28:15 +00:00
// Initialize the message
2021-05-11 20:45:24 +00:00
msgOut.Init( buffer, sizeof( buffer ) );
msgOut.SetAllowOverflow(true);
msgOut.BeginWriting();
msgOut.WriteShort ( (short)DBMSG_INSPECTTHREADS );
2011-11-22 21:28:15 +00:00
// Write the number of threads to the message
2021-05-11 20:45:24 +00:00
msgOut.WriteShort ((short)gameEdit->GetTotalScriptThreads() );
2011-11-22 21:28:15 +00:00
// Loop through all of the threads and write their name and number to the message
2021-05-11 20:45:24 +00:00
for ( i = 0; i < gameEdit->GetTotalScriptThreads(); i ++ )
2011-11-22 21:28:15 +00:00
{
2021-05-11 20:45:24 +00:00
gameEdit->MSG_WriteThreadInfo(&msgOut,gameEdit->GetThreadByIndex(i), mBreakInterpreter);
2011-11-22 21:28:15 +00:00
}
// Send off the inspect threads packet to the debugger client
2021-05-11 20:45:24 +00:00
SendPacket (msgOut.GetData(), msgOut.GetSize() );
}
/*
================
rvDebuggerServer::HandleInspectScripts
Send the list of the current loaded scripts in the interpreter back to the debugger client
================
*/
void rvDebuggerServer::HandleInspectScripts( idBitMsg* msg )
{
idBitMsg msgOut;
byte buffer[MAX_MSGLEN];
// Initialize the message
msgOut.Init(buffer, sizeof(buffer));
msgOut.BeginWriting();
msgOut.WriteShort((short)DBMSG_INSPECTSCRIPTS);
gameEdit->MSG_WriteScriptList( &msgOut );
SendPacket(msgOut.GetData(), msgOut.GetSize());
2011-11-22 21:28:15 +00:00
}
/*
================
rvDebuggerServer::HandleInspectVariable
Respondes to a request from the debugger client to inspect the value of a given variable
================
*/
2021-05-11 20:45:24 +00:00
void rvDebuggerServer::HandleInspectVariable ( idBitMsg* msg )
2011-11-22 21:28:15 +00:00
{
char varname[256];
int scopeDepth;
2011-11-22 21:28:15 +00:00
if ( !mBreak )
{
return;
}
2021-05-11 20:45:24 +00:00
scopeDepth = (short)msg->ReadShort ( );
msg->ReadString ( varname, 256 );
2011-11-22 21:28:15 +00:00
idStr varvalue;
2021-05-11 20:45:24 +00:00
idBitMsg msgOut;
2011-11-22 21:28:15 +00:00
byte buffer[MAX_MSGLEN];
// Initialize the message
2021-05-11 20:45:24 +00:00
msgOut.Init( buffer, sizeof( buffer ) );
msgOut.BeginWriting();
msgOut.WriteShort ( (short)DBMSG_INSPECTVARIABLE );
2021-05-11 20:45:24 +00:00
if (!gameEdit->GetRegisterValue(mBreakInterpreter, varname, varvalue, scopeDepth ) )
2011-11-22 21:28:15 +00:00
{
varvalue = "???";
}
2021-05-11 20:45:24 +00:00
msgOut.WriteShort ( (short)scopeDepth );
msgOut.WriteString ( varname );
msgOut.WriteString ( varvalue );
2021-05-11 20:45:24 +00:00
SendPacket (msgOut.GetData(), msgOut.GetSize() );
2011-11-22 21:28:15 +00:00
}
/*
================
rvDebuggerServer::CheckBreakpoints
Check to see if any breakpoints have been hit. This includes "break next",
2011-11-22 21:28:15 +00:00
"step into", and "step over" break points
================
*/
void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* program, int instructionPointer )
{
const char* filename;
int i;
if ( !mConnected ) {
return;
}
2021-05-11 20:45:24 +00:00
2011-11-22 21:28:15 +00:00
// Grab the current statement and the filename that it came from
2021-05-11 20:45:24 +00:00
filename = gameEdit->GetFilenameForStatement(program, instructionPointer);
int linenumber = gameEdit->GetLineNumberForStatement(program, instructionPointer);
2011-11-22 21:28:15 +00:00
// Operate on lines, not statements
2021-05-11 20:45:24 +00:00
if ( mLastStatementLine == linenumber && mLastStatementFile == filename)
2011-11-22 21:28:15 +00:00
{
return;
}
2021-05-11 20:45:24 +00:00
2011-11-22 21:28:15 +00:00
// Save the last visited line and file so we can prevent
// double breaks on lines with more than one statement
2021-05-11 20:45:24 +00:00
mLastStatementFile = idStr(filename);
mLastStatementLine = linenumber;
2011-11-22 21:28:15 +00:00
// Reset stepping when the last function on the callstack is returned from
2021-05-11 20:45:24 +00:00
if (gameEdit->ReturnedFromFunction(program, interpreter,instructionPointer))
2011-11-22 21:28:15 +00:00
{
mBreakStepOver = false;
mBreakStepInto = false;
2011-11-22 21:28:15 +00:00
}
// See if we are supposed to break on the next script line
if ( mBreakNext )
{
2021-05-11 20:45:24 +00:00
HandleInspectScripts(nullptr);
2011-11-22 21:28:15 +00:00
Break ( interpreter, program, instructionPointer );
return;
}
// Only break on the same callstack depth and thread as the break over
2011-11-22 21:28:15 +00:00
if ( mBreakStepOver )
{
2021-05-11 20:45:24 +00:00
//virtual bool CheckForBreakpointHit(interpreter,function1,function2,depth)
if (gameEdit->CheckForBreakPointHit(interpreter, mBreakStepOverFunc1, mBreakStepOverFunc2, mBreakStepOverDepth))
2011-11-22 21:28:15 +00:00
{
Break ( interpreter, program, instructionPointer );
return;
}
2011-11-22 21:28:15 +00:00
}
2011-11-22 21:28:15 +00:00
// See if we are supposed to break on the next line
if ( mBreakStepInto )
{
2021-05-11 20:45:24 +00:00
HandleInspectScripts(nullptr);
2011-11-22 21:28:15 +00:00
// Break
Break ( interpreter, program, instructionPointer );
return;
}
idStr qpath;
OSPathToRelativePath(filename,qpath);
2011-11-22 21:28:15 +00:00
qpath.BackSlashesToSlashes ( );
EnterCriticalSection ( &mCriticalSection );
// Check all the breakpoints
for ( i = 0; i < mBreakpoints.Num ( ); i ++ )
{
rvDebuggerBreakpoint* bp = mBreakpoints[i];
2011-11-22 21:28:15 +00:00
// Skip if not match of the line number
2021-05-11 20:45:24 +00:00
if ( linenumber != bp->GetLineNumber ( ) )
2011-11-22 21:28:15 +00:00
{
continue;
}
// Skip if no match of the filename
2021-05-11 20:45:24 +00:00
if ( idStr::Icmp ( bp->GetFilename(), qpath.c_str() ) )
2011-11-22 21:28:15 +00:00
{
continue;
2011-11-22 21:28:15 +00:00
}
// Pop out of the critical section so we dont get stuck
2011-11-22 21:28:15 +00:00
LeaveCriticalSection ( &mCriticalSection );
2021-05-11 20:45:24 +00:00
HandleInspectScripts(nullptr);
2011-11-22 21:28:15 +00:00
// We hit a breakpoint, so break
Break ( interpreter, program, instructionPointer );
// Back into the critical section since we are going to have to leave it
2011-11-22 21:28:15 +00:00
EnterCriticalSection ( &mCriticalSection );
2011-11-22 21:28:15 +00:00
break;
}
LeaveCriticalSection ( &mCriticalSection );
2011-11-22 21:28:15 +00:00
}
/*
================
rvDebuggerServer::Break
Halt execution of the game threads and inform the debugger client that
the game has been halted
================
*/
void rvDebuggerServer::Break ( idInterpreter* interpreter, idProgram* program, int instructionPointer )
{
2021-05-11 20:45:24 +00:00
idBitMsg msg;
2011-11-22 21:28:15 +00:00
byte buffer[MAX_MSGLEN];
const char* filename;
// Clear all the break types
mBreakStepOver = false;
mBreakStepInto = false;
mBreakNext = false;
2011-11-22 21:28:15 +00:00
// Grab the current statement and the filename that it came from
2021-05-11 20:45:24 +00:00
filename = gameEdit->GetFilenameForStatement(program,instructionPointer);
int linenumber = gameEdit->GetLineNumberForStatement(program, instructionPointer);
idStr fileStr = filename;
fileStr.BackSlashesToSlashes();
2011-11-22 21:28:15 +00:00
// Give the mouse cursor back to the world
Sys_GrabMouseCursor( false );
2011-11-22 21:28:15 +00:00
// Set the break variable so we know the main thread is stopped
mBreak = true;
mBreakProgram = program;
mBreakInterpreter = interpreter;
mBreakInstructionPointer = instructionPointer;
2011-11-22 21:28:15 +00:00
// Inform the debugger of the breakpoint hit
2021-05-11 20:45:24 +00:00
msg.Init( buffer, sizeof( buffer ) );
msg.BeginWriting();
msg.WriteShort ( (short)DBMSG_BREAK );
msg.WriteInt ( linenumber );
msg.WriteString ( fileStr.c_str() );
msg.WriteInt( (int)mBreakProgram );
SendPacket ( msg.GetData(), msg.GetSize() );
2011-11-22 21:28:15 +00:00
// Suspend the game thread. Since this will be called from within the main game thread
// execution wont return until after the thread is resumed
SuspendThread ( mGameThread );
2011-11-22 21:28:15 +00:00
// Let the debugger client know that we have started back up again
SendMessage ( DBMSG_RESUMED );
// This is to give some time between the keypress that
2011-11-22 21:28:15 +00:00
// told us to resume and the setforeground window. Otherwise the quake window
// would just flash
Sleep ( 150 );
// Bring the window back to the foreground
2011-11-22 21:28:15 +00:00
SetForegroundWindow ( win32.hWnd );
SetActiveWindow ( win32.hWnd );
UpdateWindow ( win32.hWnd );
SetFocus ( win32.hWnd );
2011-11-22 21:28:15 +00:00
// Give the mouse cursor back to the game
2021-05-11 20:45:24 +00:00
// HVG_Note : there be dragons here. somewhere.
Sys_GrabMouseCursor( true );
2011-11-22 21:28:15 +00:00
// Clear all commands that were generated before we went into suspended mode. This is
// to ensure we dont have mouse downs with no ups because the context was changed.
idKeyInput::ClearStates();
}
/*
================
rvDebuggerServer::Resume
Resume execution of the game.
================
*/
void rvDebuggerServer::Resume ( void )
{
// Cant resume if not paused
if ( !mBreak )
{
return;
}
2011-11-22 21:28:15 +00:00
mBreak = false;
// Start the game thread back up
2011-11-22 21:28:15 +00:00
ResumeThread ( mGameThread );
}
/*
================
rvDebuggerServer::ClearBreakpoints
Remove all known breakpoints
================
*/
void rvDebuggerServer::ClearBreakpoints ( void )
{
int i;
2011-11-22 21:28:15 +00:00
for ( i = 0; i < mBreakpoints.Num(); i ++ )
{
delete mBreakpoints[i];
}
2011-11-22 21:28:15 +00:00
mBreakpoints.Clear ( );
}
/*
================
rvDebuggerServer::Print
Sends a console print message over to the debugger client
================
*/
void rvDebuggerServer::Print ( const char* text )
{
if ( !mConnected )
{
return;
}
2021-05-11 20:45:24 +00:00
idBitMsg msg;
2011-11-22 21:28:15 +00:00
byte buffer[MAX_MSGLEN];
2021-05-11 20:45:24 +00:00
msg.Init( buffer, sizeof( buffer ) );
msg.BeginWriting();
msg.WriteShort ( (short)DBMSG_PRINT );
msg.WriteString ( text );
2021-05-11 20:45:24 +00:00
SendPacket ( msg.GetData(), msg.GetSize() );
}