コード例 #1
0
        } // end InterceptCtrlC()

        protected override void ProcessRecord()
        {
            if (!DbgProvider.IsInGuestMode)
            {
                throw new InvalidOperationException("This command is only intended to be used by the !dbgshell implementation.");
            }

            LogManager.Trace("WaitForBangDbgShellCommandCommand.ProcessRecord: DbgShell is going dormant.");

            using (var disposer = new ExceptionGuard())
            {
                disposer.Protect(SetDebuggerAndContextAndUpdateCallbacks());
                disposer.Protect(InterceptCtrlC());
                disposer.Protect(Debugger.SuspendEventOutput());   // don't want our "modload" output etc. spewing while we are dormant

                base.ProcessRecord();
                // 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.
                _RegisterWaitForGuestModeEvent(disposer);

                // Give the user a hint about what's going on.
                var s = new ColorString(ConsoleColor.DarkGray,
                                        "(DbgShell will remain running in the background until you run !dbgshell again)").ToString(true);
                Host.UI.WriteLine(s);

                MsgLoop.Prepare();

                // This will allow the extension command to return (it tells the dbgeng
                // thread that it can return).
                DbgProvider.GuestModePassivate();

                MsgLoop.Run(); // This will complete when the guest mode event gets signaled.
            } // end using( disposer )
        } // end ProcessRecord()