public EmonicInterpreter(DebuggerConfiguration config, DebuggerOptions options) : base(true, config, options) { DebuggerEngine = new EmonicDebuggerEngine(this); thisReference = this; }
public void AttachToProcess(long pid, DebuggerSessionOptions sessionOptions) { Report.Initialize(); this.SessionOptions = sessionOptions; DebuggerConfiguration config = new DebuggerConfiguration(); mdbAdaptor.Configuration = config; mdbAdaptor.InitializeConfiguration(); config.LoadConfiguration(); debugger = new MD.Debugger(config); DebuggerOptions options = DebuggerOptions.ParseCommandLine(new string[0]); options.StopInMain = false; session = new MD.DebuggerSession(config, options, "main", (IExpressionParser)null); mdbAdaptor.Session = session; Process proc = debugger.Attach(session, (int)pid); OnInitialized(debugger, proc); ST.ThreadPool.QueueUserWorkItem(delegate { NotifyStarted(); }); }
internal CommandLineInterpreter(DebuggerOptions options, bool is_interactive) { if (options.HasDebugFlags) { Report.Initialize(options.DebugOutput, options.DebugFlags); } else { Report.Initialize(); } Configuration = new DebuggerConfiguration(); #if HAVE_XSP if (options.StartXSP) { Configuration.SetupXSP(); } else { Configuration.LoadConfiguration(); } #else Configuration.LoadConfiguration(); #endif Configuration.SetupCLI(); interpreter = new Interpreter(is_interactive, Configuration, options); interpreter.CLI = this; engine = interpreter.DebuggerEngine; parser = new LineParser(engine); if (!interpreter.IsScript) { line_editor = new LineEditor("mdb"); line_editor.AutoCompleteEvent += delegate(string text, int pos) { return(engine.Completer.Complete(text, pos)); }; Console.CancelKeyPress += control_c_event; } interrupt_event = new ST.AutoResetEvent(false); nested_break_state_event = new ST.AutoResetEvent(false); main_loop_stack = new Stack <MainLoop> (); main_loop_stack.Push(new MainLoop(interpreter)); main_thread = new ST.Thread(new ST.ThreadStart(main_thread_main)); main_thread.IsBackground = true; }
protected DebuggerTestFixture(string exe_file, string src_file, params string[] args) { ExeFileName = Path.GetFullPath(Path.Combine(BuildDirectory, exe_file)); FileName = Path.GetFullPath(Path.Combine(SourceDirectory, src_file)); config = new DebuggerConfiguration(); config.RedirectOutput = true; config.SetupCLI(); options = CreateOptions(ExeFileName, args); inferior_stdout = new LineReader(); inferior_stderr = new LineReader(); }
private DebuggerService(string[] args) { mono_debugger_server_static_init(); bool is_interactive = true; DebuggerConfiguration config = new DebuggerConfiguration(); config.LoadConfiguration(); DebuggerOptions options = DebuggerOptions.ParseCommandLine(args); if (options.HasDebugFlags) { Report.Initialize(options.DebugOutput, options.DebugFlags); } else { Report.Initialize(); } // Redirect the Reporter output stream HACK: Using reflection reporterOutput = new MemoryStream(); FieldInfo writerField = typeof(ReportWriter).GetField("writer", BindingFlags.NonPublic | BindingFlags.Instance); StreamWriter writer = new StreamWriter(reporterOutput); writer.AutoFlush = true; writerField.SetValue(Report.ReportWriter, writer); // Redirect the console //Console.SetOut(writer); //Console.SetError(writer); interpreter = new GuiInterpreter(this, is_interactive, config, options); engine = interpreter.DebuggerEngine; parser = new LineParser(engine); this.breakpointsStore = new BreakpointsStore(this, interpreter); this.callstackStore = new CallstackStore(this, interpreter); this.localsStore = new LocalsStore(this, interpreter); this.threadsStore = new ThreadsStore(this, interpreter); if (interpreter.Options.StartTarget) { interpreter.Start(); } NotifyStateChange(); }
public void StartMdb(string cmdLine) { string[] args = cmdLine.Split(' '); DebuggerConfiguration config = new DebuggerConfiguration(); config.LoadConfiguration(); DebuggerOptions options = DebuggerOptions.ParseCommandLine(args); System.Console.WriteLine("Mono Debugger"); EmonicLineInterpreter interpreter = new EmonicLineInterpreter(config, options); interpreter.RunMainLoop(); // we don't want an automatic breakpoint in Main(), and we want to be able // to set a breakpoint there, so we delete the automatic one EmonicLineInterpreter.AddCmd("delete 1"); }
public EmonicLineInterpreter(DebuggerConfiguration config, DebuggerOptions options) { if (options.HasDebugFlags) { Report.Initialize(options.DebugOutput, options.DebugFlags); } else { Report.Initialize(); } interpreter = new EmonicInterpreter(config, options); engine = interpreter.DebuggerEngine; parser = new LineParser(engine); main_thread = new ST.Thread(new System.Threading.ThreadStart(main_thread_main)); main_thread.IsBackground = true; command_thread = new ST.Thread(new ST.ThreadStart(command_thread_main)); command_thread.IsBackground = true; }
public Interpreter(bool is_interactive, DebuggerConfiguration config, DebuggerOptions options) { this.config = config; this.is_interactive = is_interactive; this.is_script = options.IsScript; this.parser = new ExpressionParser(this); this.session = new DebuggerSession(config, options, "main", parser); this.engine = new DebuggerEngine(this); parser.Session = session; source_factory = new SourceFileFactory(); interrupt_event = new ManualResetEvent(false); process_event = new ManualResetEvent(false); styles = new Hashtable(); styles.Add("cli", new StyleCLI(this)); styles.Add("emacs", new StyleEmacs(this)); current_style = (StyleBase)styles ["cli"]; }
internal NUnitInterpreter(DebuggerConfiguration config, DebuggerOptions options, LineReader inferior_stdout, LineReader inferior_stderr) : base(false, config, options) { this.inferior_stdout = inferior_stdout; this.inferior_stderr = inferior_stderr; config.FollowFork = true; queue = Queue.Synchronized(new Queue()); wait_event = new ST.ManualResetEvent(false); Style = style_nunit = new StyleNUnit(this); style_nunit.TargetEventEvent += delegate(Thread thread, TargetEventArgs args) { if (IgnoreThreadCreation && (args.Type == TargetEventType.TargetExited)) { return; } AddEvent(new DebuggerEvent(DebuggerEventType.TargetEvent, thread, args)); }; ST.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; ObjectFormatter.WrapLines = false; }
private DebuggerService(string[] args) { mono_debugger_server_static_init (); bool is_interactive = true; DebuggerConfiguration config = new DebuggerConfiguration (); config.LoadConfiguration (); DebuggerOptions options = DebuggerOptions.ParseCommandLine (args); if (options.HasDebugFlags) Report.Initialize (options.DebugOutput, options.DebugFlags); else Report.Initialize (); // Redirect the Reporter output stream HACK: Using reflection reporterOutput = new MemoryStream(); FieldInfo writerField = typeof(ReportWriter).GetField("writer", BindingFlags.NonPublic | BindingFlags.Instance); StreamWriter writer = new StreamWriter(reporterOutput); writer.AutoFlush = true; writerField.SetValue(Report.ReportWriter, writer); // Redirect the console //Console.SetOut(writer); //Console.SetError(writer); interpreter = new GuiInterpreter(this, is_interactive, config, options); engine = interpreter.DebuggerEngine; parser = new LineParser (engine); this.breakpointsStore = new BreakpointsStore(this, interpreter); this.callstackStore = new CallstackStore(this, interpreter); this.localsStore = new LocalsStore(this, interpreter); this.threadsStore = new ThreadsStore(this, interpreter); if (interpreter.Options.StartTarget) { interpreter.Start (); } NotifyStateChange(); }
public void Run(MonoDebuggerStartInfo startInfo, DebuggerSessionOptions sessionOptions) { try { if (startInfo == null) { throw new ArgumentNullException("startInfo"); } Console.WriteLine("MDB version: " + mdbAdaptor.MdbVersion); this.SessionOptions = sessionOptions; mdbAdaptor.StartInfo = startInfo; Report.Initialize(); DebuggerConfiguration config = new DebuggerConfiguration(); config.LoadConfiguration(); mdbAdaptor.Configuration = config; mdbAdaptor.InitializeConfiguration(); debugger = new MD.Debugger(config); debugger.ModuleLoadedEvent += OnModuleLoadedEvent; debugger.ModuleUnLoadedEvent += OnModuleUnLoadedEvent; debugger.ProcessReachedMainEvent += delegate(MD.Debugger deb, MD.Process proc) { OnInitialized(deb, proc); }; if (startInfo.IsXsp) { mdbAdaptor.SetupXsp(); config.FollowFork = false; } config.OpaqueFileNames = false; DebuggerOptions options = DebuggerOptions.ParseCommandLine(new string[] { startInfo.Command }); options.WorkingDirectory = startInfo.WorkingDirectory; Environment.CurrentDirectory = startInfo.WorkingDirectory; options.StopInMain = false; if (!string.IsNullOrEmpty(startInfo.Arguments)) { options.InferiorArgs = ToArgsArray(startInfo.Arguments); } if (startInfo.EnvironmentVariables != null) { foreach (KeyValuePair <string, string> env in startInfo.EnvironmentVariables) { options.SetEnvironment(env.Key, env.Value); } } session = new MD.DebuggerSession(config, options, "main", null); mdbAdaptor.Session = session; mdbAdaptor.InitializeSession(); ST.ThreadPool.QueueUserWorkItem(delegate { // Run in a thread to avoid a deadlock, since NotifyStarted calls back to the client. NotifyStarted(); debugger.Run(session); }); } catch (Exception e) { Console.WriteLine("error: " + e.ToString()); throw; } }
public GuiInterpreter(DebuggerService debuggerService, bool is_interactive, DebuggerConfiguration config, DebuggerOptions options) :base(is_interactive, config, options) { this.debuggerService = debuggerService; }
public GuiInterpreter(DebuggerService debuggerService, bool is_interactive, DebuggerConfiguration config, DebuggerOptions options) : base(is_interactive, config, options) { this.debuggerService = debuggerService; }