// Process incomming net messages public void Update(DebuggerRecInterface a_iRec) { int msgLimit = 100; // NOTE: This can improve UI responsiveness, but can cause the queue buffer to grow! for (;;) // While messages are queued { m_inStreamCur = m_network.GetFirstInQueue(); // Limit messages in case we cause app to freeze if (--msgLimit <= 0) { break; } if (m_inStreamCur == null) { break; } int msgId = 0; Unpack(out msgId); if (FOURCC.ID_dbrk == msgId) { int threadId, sourceId, lineNum; Unpack(out threadId).Unpack(out sourceId).Unpack(out lineNum); a_iRec.gmDebuggerBreak(threadId, sourceId, lineNum); } else if (FOURCC.ID_drun == msgId) { int threadId; Unpack(out threadId); a_iRec.gmDebuggerRun(threadId); } else if (FOURCC.ID_dstp == msgId) { int threadId; Unpack(out threadId); a_iRec.gmDebuggerStop(threadId); } else if (FOURCC.ID_dsrc == msgId) { int sourceId; String sourceName, source; Unpack(out sourceId).Unpack(out sourceName).Unpack(out source); a_iRec.gmDebuggerSource(sourceId, sourceName, source); } else if (FOURCC.ID_dexc == msgId) { int threadId; Unpack(out threadId); a_iRec.gmDebuggerException(threadId); } else if (FOURCC.ID_dctx == msgId) { int threadId, callFrame; Unpack(out threadId).Unpack(out callFrame); // thread id, callframe a_iRec.gmDebuggerBeginContext(threadId, callFrame); for (;;) { int id; Unpack(out id); if (id == FOURCC.ID_call) { String functionName, thisSymbol, thisValue; int sourceId, lineNum, thisId; Unpack(out callFrame).Unpack(out functionName).Unpack(out sourceId).Unpack(out lineNum).Unpack(out thisSymbol).Unpack(out thisValue).Unpack(out thisId); a_iRec.gmDebuggerContextCallFrame(callFrame, functionName, sourceId, lineNum, thisSymbol, thisValue, thisId); } else if (id == FOURCC.ID_vari) { int varId; String varSymbol, varValue; Unpack(out varSymbol).Unpack(out varValue).Unpack(out varId); a_iRec.gmDebuggerContextVariable(varSymbol, varValue, varId); } else if (id == FOURCC.ID_done) { break; } else { break; } } a_iRec.gmDebuggerEndContext(); } else if (FOURCC.ID_dsri == msgId) { // todo break; } else if (FOURCC.ID_dthi == msgId) { a_iRec.gmDebuggerBeginThreadInfo(); for (;;) { int id, threadId, threadState; Unpack(out id); if (id == FOURCC.ID_thri) { Unpack(out threadId).Unpack(out threadState); a_iRec.gmDebuggerThreadInfo(threadId, threadState); } else if (id == FOURCC.ID_done) { break; } else { break; } } a_iRec.gmDebuggerEndThreadInfo(); } else if (FOURCC.ID_derr == msgId) { String errorMessage; Unpack(out errorMessage); a_iRec.gmDebuggerError(errorMessage); } else if (FOURCC.ID_dmsg == msgId) { String message; Unpack(out message); a_iRec.gmDebuggerMessage(message); } else if (FOURCC.ID_dack == msgId) { int response, posNeg; Unpack(out response).Unpack(out posNeg); a_iRec.gmDebuggerAck(response, posNeg); } else if (FOURCC.ID_dend == msgId) { a_iRec.gmDebuggerQuit(); } else { // unknown Id } } }
// Process incomming net messages public void Update(DebuggerRecInterface a_iRec) { int msgLimit = 100; // NOTE: This can improve UI responsiveness, but can cause the queue buffer to grow! for(;;) // While messages are queued { m_inStreamCur = m_network.GetFirstInQueue(); // Limit messages in case we cause app to freeze if( --msgLimit <= 0 ) { break; } if (m_inStreamCur == null) { break; } int msgId = 0; Unpack(out msgId); if( FOURCC.ID_dbrk == msgId ) { int threadId, sourceId, lineNum; Unpack(out threadId).Unpack(out sourceId).Unpack(out lineNum); a_iRec.gmDebuggerBreak(threadId, sourceId, lineNum); } else if( FOURCC.ID_drun == msgId ) { int threadId; Unpack(out threadId); a_iRec.gmDebuggerRun(threadId); } else if( FOURCC.ID_dstp == msgId ) { int threadId; Unpack(out threadId); a_iRec.gmDebuggerStop(threadId); } else if( FOURCC.ID_dsrc == msgId ) { int sourceId; String sourceName, source; Unpack(out sourceId).Unpack(out sourceName).Unpack(out source); a_iRec.gmDebuggerSource(sourceId, sourceName, source); } else if( FOURCC.ID_dexc == msgId ) { int threadId; Unpack(out threadId); a_iRec.gmDebuggerException(threadId); } else if( FOURCC.ID_dctx == msgId ) { int threadId, callFrame; Unpack(out threadId).Unpack(out callFrame); // thread id, callframe a_iRec.gmDebuggerBeginContext(threadId, callFrame); for(;;) { int id; Unpack(out id); if(id == FOURCC.ID_call) { String functionName, thisSymbol, thisValue; int sourceId, lineNum, thisId; Unpack(out callFrame).Unpack(out functionName).Unpack(out sourceId).Unpack(out lineNum).Unpack(out thisSymbol).Unpack(out thisValue).Unpack(out thisId); a_iRec.gmDebuggerContextCallFrame(callFrame, functionName, sourceId, lineNum, thisSymbol, thisValue, thisId); } else if (id == FOURCC.ID_vari) { int varId; String varSymbol, varValue; Unpack(out varSymbol).Unpack(out varValue).Unpack(out varId); a_iRec.gmDebuggerContextVariable(varSymbol, varValue, varId); } else if (id == FOURCC.ID_done) { break; } else { break; } } a_iRec.gmDebuggerEndContext(); } else if( FOURCC.ID_dsri == msgId ) { // todo break; } else if( FOURCC.ID_dthi == msgId ) { a_iRec.gmDebuggerBeginThreadInfo(); for(;;) { int id, threadId, threadState; Unpack(out id); if(id == FOURCC.ID_thri) { Unpack(out threadId).Unpack(out threadState); a_iRec.gmDebuggerThreadInfo(threadId, threadState); } else if (id == FOURCC.ID_done) { break; } else { break; } } a_iRec.gmDebuggerEndThreadInfo(); } else if( FOURCC.ID_derr == msgId ) { String errorMessage; Unpack(out errorMessage); a_iRec.gmDebuggerError(errorMessage); } else if( FOURCC.ID_dmsg == msgId ) { String message; Unpack(out message); a_iRec.gmDebuggerMessage(message); } else if( FOURCC.ID_dack == msgId ) { int response, posNeg; Unpack(out response).Unpack(out posNeg); a_iRec.gmDebuggerAck(response, posNeg); } else if( FOURCC.ID_dend == msgId ) { a_iRec.gmDebuggerQuit(); } else { // unknown Id } } }