public DebuggerBridge(CommandHandler commandHandler, DebuggerServer debugerServer, IConsole console, InjectionRuntime runtime) { this.commandHandler = commandHandler; this.debuggerServer = debugerServer; this.console = console; this.runtime = runtime; }
static void Main(string[] args) { System.Console.OutputEncoding = System.Text.Encoding.UTF8; System.Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { System.Console.WriteLine(); System.Console.WriteLine("Goodbye! ¡Adiós! Ciao! Adieu! Adeus! Tschüss! Пока! 再见 さようなら הֱיה שלום وداعا"); }; ClearLine(); // Subscribe to the printing events from the interpreter. // A printing event will be triggered after each successful statement // execution. On error an exception will be thrown. Interpreter.Instance.OnOutput += Print; string scriptFilename = "scripts/temp.cscs"; scriptFilename = ""; string script = Utils.GetFileContents(scriptFilename); Environment.SetEnvironmentVariable("MONO_REGISTRY_PATH", "/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry/"); DebuggerServer.BaseDirectory = ""; if (string.IsNullOrWhiteSpace(script) && (args.Length < 1 || args[1] == "debugger")) { DebuggerServer.StartServer(13337, true); } if (args.Length >= 3) { Translation.TranslateScript(args); return; } if (args.Length > 0) { if (args[0].EndsWith(EXT)) { scriptFilename = args[0]; System.Console.WriteLine("Reading script from " + scriptFilename); script = Utils.GetFileContents(scriptFilename); } else { script = args[0]; } } if (!string.IsNullOrWhiteSpace(script)) { ProcessScript(script, scriptFilename); return; } RunLoop(); }
public TestDebuggerFacade(ITimeSource timeSource) { ScriptCancellation = new CancellationTokenSource(); debuggerServer = new DebuggerServer(() => ScriptCancellation.Token); runtime = new InjectionRuntime(null, debuggerServer, timeSource, () => ScriptCancellation.Token); tracer = debuggerServer; debuggerServer.DebuggerBreakHit += HandleDebuggerBreakHit; }
static void Main(string[] args) { var parser = new Parser(settings => { settings.CaseSensitive = false; settings.HelpWriter = Console.Error; settings.IgnoreUnknownArguments = true; }); var result = parser.ParseArguments <CommandLineOptions>(args); result.WithParsed(options => { WriteDebugInfo(options.DebugInfo, "Starting 6502 emulator..."); _emulator = new M6502Emulator(options.Frequency); var devices = ParseDevices(string.Join(" ", args)); var loadedDevices = LoadDevices(_emulator.Core, devices); loadedDevices.ForEach(d => _emulator.Core.Bus.AttachDevice(d)); WriteDebugInfo(options.DebugInfo, $"Added {loadedDevices.Count} peripherals"); DebuggerServer debugger = null; if (options.DebuggerEnabled) { WriteDebugInfo(options.DebugInfo, $"Starting debugger at {options.DebuggerPort} port..."); debugger = new DebuggerServer(_emulator.Core, options.DebuggerPort); debugger.Start(); if (options.DebugInfo) { _debugTimer = new Timer(1000); _debugTimer.Elapsed += DebugTimer_Elapsed; _debugTimer.Start(); } } WriteDebugInfo(options.DebugInfo, "Starting 6502 core..."); _emulator.PowerUp(); _emulator.SetRdyState(!options.WaitForDebugger); _emulator.Reset(); _emulator.Run(); WriteDebugInfo(options.DebugInfo, "Closing 6502 emulator..."); debugger?.Dispose(); }); }