public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn, params LiteralToken[] types) { var cpu = (Arm)monitor.ConvertValueOrThrowRecoverable(cpuToken.Value, typeof(Arm)); var cpuTracer = EnsureTracer(cpu); var handler = new DefaultFunctionHandler(cpu); var paramList = new List<FunctionCallParameter>(); foreach(var parameter in types) { FunctionCallParameterType paramType; if(!Enum.TryParse(parameter.Value, out paramType)) { throw new RecoverableException("{0} is not a proper parameter type.".FormatWith(parameter.Value)); } paramList.Add(new FunctionCallParameter{ Type = paramType }); } handler.CallParameters = paramList.Take(paramList.Count - (traceReturn.Value ? 1 : 0)); handler.ReturnParameter = traceReturn.Value ? paramList.Last() : (FunctionCallParameter?)null; if(traceReturn.Value) { cpuTracer.TraceFunction(functionName.Value, handler.CallParameters, handler.CallHandler, handler.ReturnParameter, handler.ReturnHandler); } else { cpuTracer.TraceFunction(functionName.Value, handler.CallParameters, handler.CallHandler); } }
public void Run(ICommandInteraction writer, [Values("set", "add", "rem")] LiteralToken action, StringToken name) { switch(action.Value) { case "add": var machine = new Machine(); EmulationManager.Instance.CurrentEmulation.AddMachine(machine, name.Value); if(GetCurrentMachine() == null) { SetCurrentMachine(machine); } break; case "set": try { SetCurrentMachine(EmulationManager.Instance.CurrentEmulation[name.Value]); } catch(KeyNotFoundException) { writer.WriteError(string.Format("Machine {0} not found.", name.Value)); } break; case "rem": var machineToRemove = EmulationManager.Instance.CurrentEmulation[name.Value]; EmulationManager.Instance.CurrentEmulation.RemoveMachine(name.Value); if(GetCurrentMachine() == machineToRemove) { SetCurrentMachine(null); } break; } }
public void Run(ICommandInteraction writer, [Values(TraceEnableCommand, TraceDisableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName) { if(enable.Value == TraceEnableCommand) { Execute(writer, cpuToken, functionName.Value, false, null); } else { var cpu = (Arm)monitor.ConvertValueOrThrowRecoverable(cpuToken.Value, typeof(Arm)); var cpuTracer = EnsureTracer(cpu); cpuTracer.RemoveTracing(functionName.Value); } }
public void Run(ICommandInteraction writer, StringToken analyzerName, LiteralToken peripheral, LiteralToken analyzerTypeName) { try { var analyzer = GetAnalyzer(peripheral.Value, analyzerTypeName == null ? null : analyzerTypeName.Value); if (analyzerName != null) { EmulationManager.Instance.CurrentEmulation.ExternalsManager.AddExternal((IExternal)analyzer, analyzerName.Value); } analyzer.Show(); } catch (Exception e) { throw new RecoverableException(string.Format("Received '{0}' error while initializng analyzer for: {1}. Are you missing a required plugin?", e.Message, peripheral.Value)); } }
public void Run(ICommandInteraction writer, StringToken analyzerName, LiteralToken peripheral) { Run(writer, analyzerName, peripheral, null); }
public void Run(ICommandInteraction writer, StringToken command) { Execute(command.Value, writer); }
public void Run(ICommandInteraction writer, LiteralToken peripheral, StringToken viewId) { Run(writer, null, peripheral, viewId); }
public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn, NumericToken numberOfParameters) { Execute(writer, cpuToken, functionName.Value, traceReturn.Value, (int)numberOfParameters.Value); }
public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn) { Execute(writer, cpuToken, functionName.Value, traceReturn.Value, null); }
public void Run(ICommandInteraction writer, StringToken message, [Values( "Noisy", "Debug", "Info", "Warning", "Error")] StringToken level) { InnerLog(LogLevel.Parse(level.Value), message.Value); }
public void Run(ICommandInteraction writer, StringToken message, [Values( -1L, 0L, 1L, 2L, 3L)] NumericToken level) { InnerLog((LogLevel)(int)level.Value, message.Value); }
public void Run(ICommandInteraction writer, StringToken message) { InnerLog(LogLevel.Debug, message.Value); }
public void Run(ICommandInteraction writer, StringToken name) { console.SetActiveTerminal(name.Value); }
public void Run(ICommandInteraction writer, StringToken name) { writer.WriteLine(String.Format("Hello, {0}!", name.Value)); }
public void Run(ICommandInteraction writer, LiteralToken type, StringToken name) { Execute(writer, type.Value, name.Value); }