================ rvDebuggerClient::ProcessMessages Process all incomding messages from the debugger server ================ */
| 108 | ================ |
| 109 | */ |
| 110 | bool rvDebuggerClient::ProcessMessages ( void ) |
| 111 | { |
| 112 | netadr_t adrFrom; |
| 113 | idBitMsg msg; |
| 114 | byte buffer[MAX_MSGLEN]; |
| 115 | |
| 116 | msg.SetSize(MAX_MSGLEN); |
| 117 | msg.BeginReading(); |
| 118 | |
| 119 | int msgSize; |
| 120 | // Check for pending udp packets on the debugger port |
| 121 | while ( mPort.GetPacket ( adrFrom, buffer,msgSize, MAX_MSGLEN) ) |
| 122 | { |
| 123 | short command; |
| 124 | msg.Init(buffer, sizeof(buffer)); |
| 125 | msg.SetSize(msgSize); |
| 126 | msg.BeginReading(); |
| 127 | |
| 128 | // Only accept packets from the debugger server for security reasons |
| 129 | if ( !Sys_CompareNetAdrBase ( adrFrom, mServerAdr ) ) |
| 130 | { |
| 131 | continue; |
| 132 | } |
| 133 | command = msg.ReadShort ( ); |
| 134 | |
| 135 | // Is this what we are waiting for? |
| 136 | if ( command == mWaitFor ) |
| 137 | { |
| 138 | mWaitFor = DBMSG_UNKNOWN; |
| 139 | } |
| 140 | |
| 141 | switch ( command ) |
| 142 | { |
| 143 | case DBMSG_CONNECT: |
| 144 | mConnected = true; |
| 145 | SendMessage ( DBMSG_CONNECTED ); |
| 146 | SendBreakpoints ( ); |
| 147 | break; |
| 148 | |
| 149 | case DBMSG_CONNECTED: |
| 150 | mConnected = true; |
| 151 | SendBreakpoints ( ); |
| 152 | break; |
| 153 | |
| 154 | case DBMSG_DISCONNECT: |
| 155 | mConnected = false; |
| 156 | break; |
| 157 | |
| 158 | case DBMSG_BREAK: |
| 159 | HandleBreak ( &msg ); |
| 160 | break; |
| 161 | |
| 162 | // Callstack being send to the client |
| 163 | case DBMSG_INSPECTCALLSTACK: |
| 164 | HandleInspectCallstack ( &msg ); |
| 165 | break; |
| 166 | |
| 167 | // Thread list is being sent to the client |
no test coverage detected