Exemple #1
0
        /// <summary>
        /// Looks up string command and if it is a debugger command returns the
        /// corresponding DebuggerCommand object.
        /// </summary>
        /// <param name="command">String command</param>
        /// <returns>DebuggerCommand or null.</returns>
        public DebuggerCommand ProcessBasicCommand(string command)
        {
            if (command.Length == 0 && _lastCommand != null && _lastCommand.RepeatOnEnter)
            {
                return _lastCommand;
            }

            DebuggerCommand debuggerCommand;
            if (_commandTable.TryGetValue(command, out debuggerCommand))
            {
                if (debuggerCommand.ExecutedByDebugger || (debuggerCommand.ResumeAction != null)) { _lastCommand = debuggerCommand; }
                return debuggerCommand;
            }

            return null;
        }
Exemple #2
0
 /// <summary>
 /// Process the command read by the host and returns the DebuggerResumeAction or the command
 /// that the host should execute (see comments in the DebuggerCommand class above).
 /// </summary>
 public DebuggerCommand ProcessCommand(PSHost host, string command, InvocationInfo invocationInfo)
 {
     return _lastCommand = DoProcessCommand(host, command, invocationInfo, null);
 }
Exemple #3
0
 /// <summary>
 /// ProcessCommand
 /// </summary>
 /// <param name="host"></param>
 /// <param name="command"></param>
 /// <param name="invocationInfo"></param>
 /// <param name="output"></param>
 /// <returns></returns>
 public DebuggerCommand ProcessCommand(PSHost host, string command, InvocationInfo invocationInfo, IList<PSObject> output)
 {
     DebuggerCommand dbgCommand = DoProcessCommand(host, command, invocationInfo, output);
     if (dbgCommand.ExecutedByDebugger || (dbgCommand.ResumeAction != null)) { _lastCommand = dbgCommand; }
     return dbgCommand;
 }
Exemple #4
0
 /// <summary>
 /// Creates the table of debugger commands
 /// </summary>
 public DebuggerCommandProcessor()
 {
     _commandTable = new Dictionary<string, DebuggerCommand>(StringComparer.OrdinalIgnoreCase);
     _commandTable[StepCommand] = _commandTable[StepShortcut] = new DebuggerCommand(StepCommand, DebuggerResumeAction.StepInto, true, false);
     _commandTable[StepOutCommand] = _commandTable[StepOutShortcut] = new DebuggerCommand(StepOutCommand, DebuggerResumeAction.StepOut, false, false);
     _commandTable[StepOverCommand] = _commandTable[StepOverShortcut] = new DebuggerCommand(StepOverCommand, DebuggerResumeAction.StepOver, true, false);
     _commandTable[ContinueCommand] = _commandTable[ContinueShortcut] = new DebuggerCommand(ContinueCommand, DebuggerResumeAction.Continue, false, false);
     _commandTable[StopCommand] = _commandTable[StopShortcut] = new DebuggerCommand(StopCommand, DebuggerResumeAction.Stop, false, false);
     _commandTable[GetStackTraceShortcut] = new DebuggerCommand("get-pscallstack", null, false, false);
     _commandTable[HelpCommand] = _commandTable[HelpShortcut] = _helpCommand = new DebuggerCommand(HelpCommand, null, false, true);
     _commandTable[ListCommand] = _commandTable[ListShortcut] = _listCommand = new DebuggerCommand(ListCommand, null, true, true);
     _commandTable[string.Empty] = new DebuggerCommand(string.Empty, null, false, true);
 }