Example #1
0
 void PipeReceiveEvent(object sender, PipeReceiveEventArgs args)
 {
     if (DebugRawTrafficEvent != null)
     {
         DebugRawTrafficEvent(this, new DebugRawTrafficEventArgs(args.Received));
     }
 }
Example #2
0
        void PipeReceiveEvent(object sender, PipeReceiveEventArgs args)
        {
            bool   tookText = false;
            string inbufStr;
            int    promptIdx;

            mInputBuffer.Append(args.Received);

            if (mInputBuffer.ToString().Substring(mUsedInput).Contains("key to continue"))
            {
                mConnection.Write("\r");
                mUsedInput = mInputBuffer.Length;
            }

            while ((promptIdx = (inbufStr = mInputBuffer.ToString()).IndexOf("kdb:> ")) != -1)
            {
                string   pretext  = inbufStr.Substring(0, promptIdx);
                string[] theInput = pretext.Split(new char[] { '\n' });
                int      remove   = pretext.Length + "kdb:> ".Length;

                mInputBuffer.Remove(0, remove);
                mUsedInput = Math.Max(0, mUsedInput - remove);

                if (!tookText)
                {
                    if (mRunning)
                    {
                        mRunning = false;
                    }
                    tookText = true;
                }

                foreach (string line in theInput)
                {
                    string cleanedLine = line.Trim();
                    try
                    {
                        if (cleanedLine.Contains("Entered debugger on "))
                        {
                            mReceivingProcs   = false;
                            mReceivingThreads = false;
                            GetRegisterUpdate();
                            GetProcesses();
                            continue;
                        }

                        if (!mFirstModuleUpdate)
                        {
                            GetModuleUpdate();
                            mFirstModuleUpdate = true;
                        }

                        if (TryParseMemory(cleanedLine))
                        {
                            continue;
                        }
                        if (TryParseModule(cleanedLine))
                        {
                            continue;
                        }
                        if (TryParseRegisters(cleanedLine))
                        {
                            continue;
                        }
                        if (TryParseSegmentRegisters(cleanedLine))
                        {
                            continue;
                        }
                        if (TryParsePID(cleanedLine))
                        {
                            continue;
                        }
                        if (TryParseTID(cleanedLine))
                        {
                            continue;
                        }
                        if (TryParseBreakpoint(cleanedLine))
                        {
                            continue;
                        }
                    }
                    catch (Exception) { /* Error line ... we'll ignore it for now */ }
                }
            }

            if (tookText)
            {
                lock (mCommandBuffer)
                {
                    if (mCommandBuffer.Count > 0)
                    {
                        string firstCommand = mCommandBuffer.Dequeue();
                        mConnection.Write(firstCommand + "\r");
                    }
                }
            }
        }