Пример #1
0
        protected void ProcessRecord(bool callWaitForEventDespiteCurrentStatus)
        {
            base.ProcessRecord();

            DEBUG_STATUS currentStatus = Debugger.GetExecutionStatus();

            LogManager.Trace("ExecutionBaseCommand.ProcessRecord: Current status is {0}.", currentStatus);
            if (!callWaitForEventDespiteCurrentStatus && (DEBUG_STATUS.BREAK == currentStatus))
            {
                // TODO: This is for attaching to a debugging server. Need to test it. Other cases?
                // Perhaps this logic should be changed to be more clear?
                LogManager.Trace("ExecutionBaseCommand: current status is already BREAK; will not call WaitForEvent.");
                return; // Don't need to call WaitForEvent.
            }

            using (InterceptCtrlC())
            {
                // We need to perform the wait on another thread, because we need to "pump"
                // on this thread, so that debug event callbacks can queue WriteObject calls
                // to this thread.
                LogManager.Trace("ExecutionBaseCommand: calling WaitForEvent (on dbgeng thread).");

                MsgLoop.Prepare();

                Task waitTask = Debugger.WaitForEventAsync();
                waitTask.ContinueWith((x) => { MsgLoop.SignalDone(); });

                MsgLoop.Run();

                Util.Await(waitTask);   // in case it threw
            } // end using( InterceptCtrlC )
        } // end ProcessRecord()
Пример #2
0
        } // end _FixPsPathsInSymbolPath()

        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (null == Path)
            {
                Path = String.Empty;
            }

            //
            // Fix PS-specific paths.
            //
            var fixedPath = _FixPsPathsInSymbolPath(Path, GetUnresolvedProviderPathFromPSPath);

            if (0 == fixedPath.Length)
            {
                WriteWarning("The symbol path is empty.");
            }

            Debugger.SymbolPath = fixedPath;
            if (PassThru)
            {
                WriteObject(Debugger.SymbolPath);
            }

            MsgLoop.Prepare();

            // If the specified symbol path is inaccessible, the SetSymbolPathWide call
            // will generate some warning dbgeng output. But we'd also like to be able to
            // get output about the "expanded" symbol path. Unfortunately, there is no way
            // to get that, except to parse ".sympath" output. Since executing ".sympath"
            // will also repeat the warning about the inaccessible symbol path, we won't
            // start displaying dbgeng output until now.
            using (Debugger.HandleDbgEngOutput(_HandleDbgEngOutput))
            {
                // TODO: Feature request: no way to get expanded symbol path except to parse ".sympath" output.
                var t = Debugger.InvokeDbgEngCommandAsync(".sympath", false);

                t.ContinueWith((x) => MsgLoop.SignalDone());

                MsgLoop.Run();

                Util.Await(t);   // in case it threw
            }
        } // end ProcessRecord()
Пример #3
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()