Example #1
0
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, ulong Arg, string Text)
        {
            _buffer.Append(Text);
            DoOutput(Text);

            return(HResult.Ok);
        }
Example #2
0
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, ulong Arg, string Text)
        {
            if (Which != DEBUG_OUTCB.DML)
            {
                return(Output(DEBUG_OUTPUT.NORMAL, Text));
            }

            Console.Write("DML: {0}", Text);
            return(0);
        }
Example #3
0
        /// <summary>
        /// Implements IDebugOutputCallbacks2::Output2
        /// </summary>
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, UInt64 Arg, string Text)
        {
            DEBUG_OUTPUT Mask = (DEBUG_OUTPUT)Arg;

            if (Which == DEBUG_OUTCB.EXPLICIT_FLUSH)
            {
                //Flush();
                return(S_OK);
            }
            else if ((Text == null) || (Text.Length == 0))
            {
                return(S_OK);
            }
            bool textIsDml = (Which == DEBUG_OUTCB.DML);

            stbOutPut.Append(Text);

            return(S_OK);
        }
Example #4
0
        /// <summary>
        /// Implements IDebugOutputCallbacks2::Output2
        /// </summary>
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, UInt64 Arg, string Text)
        {
            DEBUG_OUTPUT Mask = (DEBUG_OUTPUT)Arg;

            if (Which == DEBUG_OUTCB.EXPLICIT_FLUSH)
            {
                //Flush();
                return S_OK;
            }
            else if ((Text == null) || (Text.Length == 0))
            {
                return S_OK;
            }
            bool textIsDml = (Which == DEBUG_OUTCB.DML);

            stbOutPut.Append(Text);

            return S_OK;
        }
Example #5
0
 int IDebugOutputCallbacks2.Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, ulong Arg, string Text)
 {
     return(Output2(Which, Flags, Arg, Text));
 }
        /// <summary>
        ///     Implements IDebugOutputCallbacks2::Output2
        /// </summary>
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, UInt64 Arg, string Text)
        {
            var mask = (DEBUG_OUTPUT)Arg;

            if (Which == DEBUG_OUTCB.EXPLICIT_FLUSH)
            {
                //Flush();
                return(S_OK);
            }
            if (string.IsNullOrEmpty(Text))
            {
                return(S_OK);
            }
            bool textIsDml = (Which == DEBUG_OUTCB.DML);

            if (OutputActive)
            {
                lock (this)
                {
                    OutputActive       = false;
                    PreviousTextWasDml = textIsDml;
                    PreviousDmlFlags   = Flags;
                    DbgStringBuilder LineBuffer;
                    LineBuffers.TryGetValue(mask, out LineBuffer);
                    int LineInputPos = 0;
                    LineInputPositions.TryGetValue(mask, out LineInputPos);
                    bool waitForClosingDML = false;

                    if (LineBuffer == null)
                    {
                        LineBuffer        = new DbgStringBuilder(ExecutionUtilities, 1024);
                        LineBuffers[mask] = LineBuffer;
                    }
                    for (int i = 0; i < Text.Length; ++i)
                    {
                        char c = Text[i];
                        if (c == '<')
                        {
                            waitForClosingDML = true;
                        }
                        if (waitForClosingDML)
                        {
                            if (c == '>')
                            {
                                waitForClosingDML = false;
                            }
                        }
                        if (c == '\n' && waitForClosingDML == false)
                        {
                            LineBuffer.AppendLine();
                            ProcessLine(mask, LineBuffer.ToString(), textIsDml, Flags);
                            LineBuffer.Clear();
                            LineInputPos = 0;
                        }
                        else if (c == '\r')
                        {
                            LineInputPos = 0;
                        }
                        else
                        {
                            if (LineInputPos >= LineBuffer.Length)
                            {
                                LineBuffer.Append(c);
                            }
                            else
                            {
                                LineBuffer[LineInputPos] = c;
                            }
                            ++LineInputPos;
                        }
                    }

                    LineInputPositions[mask] = LineInputPos;

                    OutputActive = true;
                }
            }

            return(S_OK);
        }
Example #7
0
 public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, ulong Arg, string Text)
 {
     Console.ForegroundColor = ConsoleColor.White;
     Console.Write(Text);
     return(0);
 }
Example #8
0
 int IDebugOutputCallbacks2.Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, ulong Arg, string Text)
 {
     return Output2(Which, Flags, Arg,Text);
 }
        /// <summary>
        ///     Implements IDebugOutputCallbacks2::Output2
        /// </summary>
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, ulong Arg, string Text)
        {
            var mask = (DEBUG_OUTPUT)Arg;

            if (string.IsNullOrEmpty(Text))
            {
                return(S_OK);
            }

            _executionUtilities.OutputMaskRestore();
            var textIsDml = Which == DEBUG_OUTCB.DML;

            if (_outputActive)
            {
                lock (this)
                {
                    _outputActive = false;

                    var sb = new DbgStringBuilder(_passthroughUtilities, Text.Length);
                    sb.Append(Text);
                    var callbackData = new CallbackData(mask, sb, textIsDml, Flags);

                    // The advanced filter gets 1st crack at the data before it goes to the line by line filter.
                    callbackData = _outputFilter.AdvancedFilterText(callbackData);
                    if (callbackData == null)
                    {
                        _outputActive = true;
                        return(S_OK);
                    }
                    // It can force data to be output now, skipping the line-by-line filtering.
                    if (callbackData.ForceOutputNow)
                    {
                        PassThroughLine(callbackData);
                        _outputActive = true;
                        return(S_OK);
                    }

                    Text = callbackData.Data.ToString();
                    // Was there a partial line for this mask? if so, lets finish it and send it to the filter!
                    CallbackData lineBuffer;
                    _lineBuffers.TryGetValue(callbackData.Mask, out lineBuffer);

                    if (lineBuffer == null)
                    {
                        lineBuffer         = new CallbackData(callbackData.Mask, new DbgStringBuilder(_passthroughUtilities, Text.Length), callbackData.IsDML, callbackData.DMLFlags);
                        _lineBuffers[mask] = lineBuffer;
                    }

                    for (var i = 0; i < Text.Length; ++i)
                    {
                        var c = Text[i];
                        if (c == '\n')
                        {
                            lineBuffer.Data.Append(c);
                            ProcessLine(lineBuffer.Copy(_passthroughUtilities));
                            lineBuffer.Clear();
                        }
                        else if (c == '\r')
                        {
                            if ((i + 1) < Text.Length && Text[i + 1] != '\n')
                            {
                                lineBuffer.Clear();
                            }
                        }
                        else
                        {
                            lineBuffer.Data.Append(c);
                        }
                    }

                    //if (Which == DEBUG_OUTCB.EXPLICIT_FLUSH)
                    //{
                    //    _passthroughUtilities.DebugClient.FlushCallbacks();
                    //}
                    _outputActive = true;
                }
            }

            return(S_OK);
        }