2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 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.
24 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.
26 ===========================================================================
28 #ifndef DEBUGGERCLIENT_H_
29 #define DEBUGGERCLIENT_H_
31 class rvDebuggerCallstack
40 class rvDebuggerThread
52 #ifndef DEBUGGERBREAKPOINT_H_
53 #include "DebuggerBreakpoint.h"
56 typedef idList<rvDebuggerCallstack*> rvDebuggerCallstackList;
57 typedef idList<rvDebuggerThread*> rvDebuggerThreadList;
58 typedef idList<rvDebuggerBreakpoint*> rvDebuggerBreakpointList;
60 class rvDebuggerClient
65 ~rvDebuggerClient ( );
67 bool Initialize ( void );
68 void Shutdown ( void );
69 bool ProcessMessages ( void );
70 bool WaitFor ( EDebuggerMessage msg, int time );
72 bool IsConnected ( void );
73 bool IsStopped ( void );
75 int GetActiveBreakpointID ( void );
76 const char* GetBreakFilename ( void );
77 int GetBreakLineNumber ( void );
78 rvDebuggerCallstackList& GetCallstack ( void );
79 rvDebuggerThreadList& GetThreads ( void );
80 const char* GetVariableValue ( const char* name, int stackDepth );
82 void InspectVariable ( const char* name, int callstackDepth );
86 void StepInto ( void );
87 void StepOver ( void );
90 int AddBreakpoint ( const char* filename, int lineNumber, bool onceOnly = false );
91 bool RemoveBreakpoint ( int bpID );
92 void ClearBreakpoints ( void );
93 int GetBreakpointCount ( void );
94 rvDebuggerBreakpoint* GetBreakpoint ( int index );
95 rvDebuggerBreakpoint* FindBreakpoint ( const char* filename, int linenumber );
99 void SendMessage ( EDebuggerMessage dbmsg );
100 void SendBreakpoints ( void );
101 void SendAddBreakpoint ( rvDebuggerBreakpoint& bp, bool onceOnly = false );
102 void SendRemoveBreakpoint ( rvDebuggerBreakpoint& bp );
103 void SendPacket ( void* data, int datasize );
111 int mBreakLineNumber;
112 idStr mBreakFilename;
116 rvDebuggerCallstackList mCallstack;
117 rvDebuggerThreadList mThreads;
118 rvDebuggerBreakpointList mBreakpoints;
120 EDebuggerMessage mWaitFor;
124 void ClearCallstack ( void );
125 void ClearThreads ( void );
127 void UpdateWatches ( void );
129 // Network message handlers
130 void HandleBreak ( msg_t* msg );
131 void HandleInspectCallstack ( msg_t* msg );
132 void HandleInspectThreads ( msg_t* msg );
133 void HandleInspectVariable ( msg_t* msg );
138 rvDebuggerClient::IsConnected
141 ID_INLINE bool rvDebuggerClient::IsConnected ( void )
148 rvDebuggerClient::IsStopped
151 ID_INLINE bool rvDebuggerClient::IsStopped ( void )
158 rvDebuggerClient::GetActiveBreakpointID
161 ID_INLINE int rvDebuggerClient::GetActiveBreakpointID ( void )
168 rvDebuggerClient::GetBreakFilename
171 ID_INLINE const char* rvDebuggerClient::GetBreakFilename ( void )
173 return mBreakFilename;
178 rvDebuggerClient::GetBreakLineNumber
181 ID_INLINE int rvDebuggerClient::GetBreakLineNumber ( void )
183 return mBreakLineNumber;
188 rvDebuggerClient::GetCallstack
191 ID_INLINE rvDebuggerCallstackList& rvDebuggerClient::GetCallstack ( void )
198 rvDebuggerClient::GetThreads
201 ID_INLINE rvDebuggerThreadList& rvDebuggerClient::GetThreads ( void )
208 rvDebuggerClient::GetVariableValue
211 ID_INLINE const char* rvDebuggerClient::GetVariableValue ( const char* var, int stackDepth )
213 return mVariables.GetString ( va("%d:%s",stackDepth,var), "" );
218 rvDebuggerClient::GetBreakpointCount
221 ID_INLINE int rvDebuggerClient::GetBreakpointCount ( void )
223 return mBreakpoints.Num ( );
228 rvDebuggerClient::GetBreakpoint
231 ID_INLINE rvDebuggerBreakpoint* rvDebuggerClient::GetBreakpoint ( int index )
233 return mBreakpoints[index];
238 rvDebuggerClient::Break
241 ID_INLINE void rvDebuggerClient::Break ( void )
243 SendMessage ( DBMSG_BREAK );
248 rvDebuggerClient::Resume
251 ID_INLINE void rvDebuggerClient::Resume ( void )
254 SendMessage ( DBMSG_RESUME );
259 rvDebuggerClient::StepOver
262 ID_INLINE void rvDebuggerClient::StepOver ( void )
265 SendMessage ( DBMSG_STEPOVER );
270 rvDebuggerClient::StepInto
273 ID_INLINE void rvDebuggerClient::StepInto ( void )
276 SendMessage ( DBMSG_STEPINTO );
281 rvDebuggerClient::SendPacket
284 ID_INLINE void rvDebuggerClient::SendPacket ( void* data, int size )
286 mPort.SendPacket ( mServerAdr, data, size );
289 #endif // DEBUGGERCLIENT_H_