Ejemplo n.º 1
0
        } // end _WaitIfNeededAsync()

        private async Task _CallExtensionAsync(ulong hExt, string extCommand, string extArgs)
        {
            LogManager.Trace("_CallExtensionAsync: {0} {1}", extCommand, extArgs);

            try
            {
                // N.B. We need to be sure that we have unregistered for DbgEngOutput etc.
                // /BEFORE/ SignalDone is called. If not, there could be some DbgEng
                // output that comes after SignalDone has been called, but before we get
                // back from MsgLoop.Run() and dispose of the registrations, and that
                // would blow chunks. (because things like SafeWriteVerbose would not
                // work, because the q was completed when SignalDone was called)
                using (Debugger.HandleDbgEngOutput(_ConsumeLine))
                {
                    await Debugger.CallExtensionAsync(hExt, extCommand, extArgs);
                    await _WaitIfNeededAsync();
                }
            }
            finally
            {
                MsgLoop.SignalDone();
            }
        } // end _CallExtensionAsync()
Ejemplo n.º 2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            DEBUG_OUTCTL ctl;

            if (ThisClientOnly)
            {
                ctl = DEBUG_OUTCTL.THIS_CLIENT;
            }
            else if (OtherClientsOnly)
            {
                ctl = DEBUG_OUTCTL.ALL_OTHER_CLIENTS;
            }
            // else if( Ignore )
            //     ctl = DEBUG_OUTCTL.IGNORE;
            else if (LogOnly)
            {
                ctl = DEBUG_OUTCTL.LOG_ONLY;
            }
            else
            {
                ctl = DEBUG_OUTCTL.ALL_CLIENTS;
            }

            if (NotLogged)
            {
                ctl |= DEBUG_OUTCTL.NOT_LOGGED;
            }

            if (Override)
            {
                ctl |= DEBUG_OUTCTL.OVERRIDE_MASK;
            }

            if (Dml)
            {
                ctl |= DEBUG_OUTCTL.DML;
            }

            foreach (var io in InputObject)
            {
                string s = io.ToString();
                if (!s.EndsWith("\n") && !NoNewLine)
                {
                    s += Environment.NewLine;
                }


                Task[] tasks = new Task[3];
                try
                {
                    // These tasks need to happen strictly in sequence, of course. We are
                    // relying on the fact that they all get queued to the DbgEngThread,
                    // which will execute them in the order received.
                    tasks[0] = Debugger.CallExtensionAsync(0, "internal_SwapMask", null);
                    tasks[1] = Debugger.ControlledOutputAsync(ctl, OutputType, s);
                }
                finally
                {
                    tasks[2] = Debugger.CallExtensionAsync(0, "internal_SwapMask", null);
                }
                Util.Await(Task.WhenAll(tasks));
            }
        } // end ProcessRecord()