示例#1
0
        void ReceiveEvents(int timeout = -1)
        {
            string[] response = Debuggee.DebuggerClient.Receive(timeout);

            if (response == null)
            {
                throw new DebuggerNotResponsesException();
            }

            foreach (string line in response)
            {
                Logger.LogLine("< " + line);
            }

            MIOutput output = MIParser.ParseOutput(response);

            if (output.ResultRecord != null)
            {
                // this output must hasn't result record
                throw new MIParserException();
            }

            foreach (var record in output.OutOfBandRecords)
            {
                EventQueue.Enqueue(record);
            }
        }
示例#2
0
        public MIOutOfBandRecord[] Receive(int timeout = -1)
        {
            string[] response = Debuggee.DebuggerClient.Receive(timeout);

            if (response == null)
            {
                throw new DebuggerNotResponsesException();
            }

            foreach (string line in response)
            {
                Logger.LogLine("< " + line);
            }

            MIOutput output = MIParser.ParseOutput(response);

            if (output.ResultRecord != null)
            {
                // this output must hasn't result record
                throw new MIParserException();
            }

            OutOfBandRecords.AddRange(output.OutOfBandRecords);

            return(OutOfBandRecords.ToArray());
        }
示例#3
0
        public MIResultRecord Request(string command, int timeout = -1)
        {
            MIResultRecord resultRecord = null;

            Logger.LogLine("> " + command);

            if (!Debuggee.DebuggerClient.Send(command))
            {
                throw new DebuggerNotResponsesException();
            }

            while (true)
            {
                string[] response = Debuggee.DebuggerClient.Receive(timeout);

                if (response == null)
                {
                    throw new DebuggerNotResponsesException();
                }

                foreach (string line in response)
                {
                    Logger.LogLine("< " + line);
                }

                // we could get async record, in this case we could have two "(gdb)" prompts one by one
                // NOTE in this case we have only one line response, that contain prompt only
                if (MIParser.IsEnd(response[0]))
                {
                    continue;
                }

                MIOutput output = MIParser.ParseOutput(response);

                foreach (var record in output.OutOfBandRecords)
                {
                    EventQueue.Enqueue(record);
                }

                if (output.ResultRecord != null)
                {
                    resultRecord = output.ResultRecord;
                    break;
                }
            }

            return(resultRecord);
        }
示例#4
0
        public MIResultRecord Request(string command, int timeout = -1)
        {
            MIResultRecord resultRecord = null;

            Logger.LogLine("> " + command);

            if (!Debuggee.DebuggerClient.Send(command))
            {
                throw new DebuggerNotResponsesException();
            }

            while (true)
            {
                string[] response = Debuggee.DebuggerClient.Receive(timeout);

                if (response == null)
                {
                    throw new DebuggerNotResponsesException();
                }

                foreach (string line in response)
                {
                    Logger.LogLine("< " + line);
                }

                MIOutput output = MIParser.ParseOutput(response);

                if (output.ResultRecord != null)
                {
                    resultRecord = output.ResultRecord;
                    break;
                }
            }

            return(resultRecord);
        }