public EmonicInterpreter(DebuggerConfiguration config, DebuggerOptions options) : base(true,config,options) { DebuggerEngine = new EmonicDebuggerEngine(this); thisReference = this; }
static bool ParseDebugFlags(DebuggerOptions options, string value) { if (value == null) { return(false); } int pos = value.IndexOf(':'); if (pos > 0) { string filename = value.Substring(0, pos); value = value.Substring(pos + 1); options.DebugOutput = filename; } DebugFlags flags; if (!Report.ParseDebugFlags(value, out flags)) { return(false); } options.DebugFlags = flags; return(true); }
public static DebuggerOptions ParseCommandLine(string[] args) { DebuggerOptions options = new DebuggerOptions(); int i; bool parsing_options = true; for (i = 0; i < args.Length; i++) { string arg = args[i]; if (arg == "") { continue; } if (!parsing_options) { i--; break; } if (arg.StartsWith("-")) { if (ParseOption(options, arg, ref args, ref i, ref parsing_options)) { continue; } Usage(); Console.WriteLine("Unknown argument: {0}", arg); Environment.Exit(1); } else if (arg.StartsWith("/")) { string unix_opt = "-" + arg.Substring(1); if (ParseOption(options, unix_opt, ref args, ref i, ref parsing_options)) { continue; } } options.File = arg; break; } if (args.Length > i) { string[] argv = new string [args.Length - i - 1]; Array.Copy(args, i + 1, argv, 0, args.Length - i - 1); options.InferiorArgs = argv; } else { options.InferiorArgs = new string [0]; } return(options); }
public static DebuggerOptions CreateXSP(string root) { DebuggerOptions options = new DebuggerOptions(); options.InferiorArgs = new string [0]; options.StartXSP = true; options.XSP_Root = root; options.SetupXSP(); return(options); }
public DebuggerSession(DebuggerConfiguration config, DebuggerOptions options, string name, IExpressionParser parser) : this(config, name) { this.Options = options; this.parser = parser; if (config.IsCLI) AddEvent (new MainMethodBreakpoint (this)); }
public DebuggerSession(DebuggerConfiguration config, DebuggerOptions options, string name, IExpressionParser parser) : this(config, name) { this.Options = options; this.parser = parser; if (config.IsCLI) { AddEvent(new MainMethodBreakpoint(this)); } }
internal DebuggerSession Clone(Process new_process, DebuggerOptions new_options, string new_name) { XmlDocument document = SaveSession(); XPathNavigator nav = document.CreateNavigator(); XPathNodeIterator session_iter = nav.Select( "/DebuggerConfiguration/DebuggerSession[@name='" + Name + "']"); if (!session_iter.MoveNext()) { throw new InternalError(); } return(new DebuggerSession(Config, new_process, new_options, new_name, parser, session_iter.Current)); }
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; }
protected DebuggerSession(DebuggerConfiguration config, Process process, DebuggerOptions options, string name, IExpressionParser parser, XPathNavigator nav) : this(config, name) { this.main_process = process; this.Options = options; this.parser = parser.Clone(this); XPathNodeIterator event_iter = nav.Select("Events/*"); LoadEvents(event_iter); XPathNodeIterator display_iter = nav.Select("Displays/*"); LoadDisplays(display_iter); }
public DebuggerOptions Clone() { DebuggerOptions options = new DebuggerOptions(); options.file = file; options.inferior_args = clone(inferior_args); options.JitOptimizations = JitOptimizations; options.jit_arguments = clone(jit_arguments); options.WorkingDirectory = WorkingDirectory; options.IsScript = IsScript; options.start_target = start_target; options.debug_flags = debug_flags; options.DebugOutput = DebugOutput; options.MonoPrefix = MonoPrefix; options.MonoPath = MonoPath; options.user_environment = clone(user_environment); return(options); }
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; }
public DebuggerSession(DebuggerConfiguration config, Stream stream, IExpressionParser parser) : this(config, "main") { this.parser = parser; XmlReaderSettings settings = new XmlReaderSettings(); Assembly ass = Assembly.GetExecutingAssembly(); using (Stream schema = ass.GetManifestResourceStream("DebuggerConfiguration")) settings.Schemas.Add(null, new XmlTextReader(schema)); XmlReader reader = XmlReader.Create(stream, settings); saved_session = new XmlDocument(); saved_session.Load(reader); reader.Close(); XPathNavigator nav = saved_session.CreateNavigator(); XPathNodeIterator session_iter = nav.Select( "/DebuggerConfiguration/DebuggerSession[@name='" + Name + "']"); if (!session_iter.MoveNext()) { throw new InternalError(); } XPathNodeIterator options_iter = session_iter.Current.Select("Options/*"); Options = new DebuggerOptions(options_iter); XPathNodeIterator dir_map_iter = session_iter.Current.Select("DirectoryMap/Map"); while (dir_map_iter.MoveNext()) { string from = dir_map_iter.Current.GetAttribute("from", ""); string to = dir_map_iter.Current.GetAttribute("to", ""); directory_maps.Add(from, to); } LoadSession(nav); }
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"]; }
protected DebuggerSession(DebuggerConfiguration config, Process process, DebuggerOptions options, string name, IExpressionParser parser, XPathNavigator nav) : this(config, name) { this.main_process = process; this.Options = options; this.parser = parser.Clone (this); XPathNodeIterator event_iter = nav.Select ("Events/*"); LoadEvents (event_iter); XPathNodeIterator display_iter = nav.Select ("Displays/*"); LoadDisplays (display_iter); }
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; }
public DebuggerSession(DebuggerConfiguration config, Stream stream, IExpressionParser parser) : this(config, "main") { this.parser = parser; XmlReaderSettings settings = new XmlReaderSettings (); Assembly ass = Assembly.GetExecutingAssembly (); using (Stream schema = ass.GetManifestResourceStream ("DebuggerConfiguration")) settings.Schemas.Add (null, new XmlTextReader (schema)); XmlReader reader = XmlReader.Create (stream, settings); saved_session = new XmlDocument (); saved_session.Load (reader); reader.Close (); XPathNavigator nav = saved_session.CreateNavigator (); XPathNodeIterator session_iter = nav.Select ( "/DebuggerConfiguration/DebuggerSession[@name='" + Name + "']"); if (!session_iter.MoveNext ()) throw new InternalError (); XPathNodeIterator options_iter = session_iter.Current.Select ("Options/*"); Options = new DebuggerOptions (options_iter); XPathNodeIterator dir_map_iter = session_iter.Current.Select ("DirectoryMap/Map"); while (dir_map_iter.MoveNext ()) { string from = dir_map_iter.Current.GetAttribute ("from", ""); string to = dir_map_iter.Current.GetAttribute ("to", ""); directory_maps.Add (from, to); } LoadSession (nav); }
internal DebuggerSession Clone(Process new_process, DebuggerOptions new_options, string new_name) { XmlDocument document = SaveSession (); XPathNavigator nav = document.CreateNavigator (); XPathNodeIterator session_iter = nav.Select ( "/DebuggerConfiguration/DebuggerSession[@name='" + Name + "']"); if (!session_iter.MoveNext ()) throw new InternalError (); return new DebuggerSession (Config, new_process, new_options, new_name, parser, session_iter.Current); }
static bool ParseOption(DebuggerOptions debug_options, string option, ref string [] args, ref int i, ref bool parsing_options) { int idx = option.IndexOf(':'); string arg, value, ms_value = null; if (idx == -1) { arg = option; } else { arg = option.Substring(0, idx); ms_value = option.Substring(idx + 1); } switch (arg) { case "-working-directory": case "-cd": value = GetValue(ref args, ref i, ms_value); if (value == null) { Usage(); Environment.Exit(1); } debug_options.WorkingDirectory = value; return(true); case "-debug-flags": value = GetValue(ref args, ref i, ms_value); if (!ParseDebugFlags(debug_options, value)) { Console.WriteLine("Unknown -debug-flags argument: {0}", ms_value); Environment.Exit(1); } return(true); case "-jit-optimizations": value = GetValue(ref args, ref i, ms_value); if (value == null) { Usage(); Environment.Exit(1); } debug_options.JitOptimizations = value; return(true); case "-jit-arg": value = GetValue(ref args, ref i, ms_value); if (ms_value == null) { Usage(); Environment.Exit(1); } if (debug_options.JitArguments != null) { string[] old = debug_options.JitArguments; string[] new_args = new string [old.Length + 1]; old.CopyTo(new_args, 0); new_args [old.Length] = value; debug_options.JitArguments = new_args; } else { debug_options.JitArguments = new string[] { value }; } return(true); case "-mono-prefix": value = GetValue(ref args, ref i, ms_value); if (value == null) { Usage(); Environment.Exit(1); } debug_options.MonoPrefix = value; return(true); case "-mono": value = GetValue(ref args, ref i, ms_value); if (value == null) { Usage(); Environment.Exit(1); } debug_options.MonoPath = value; return(true); case "-script": if (ms_value != null) { Usage(); Environment.Exit(1); } debug_options.IsScript = true; return(true); case "-version": case "-V": if (ms_value != null) { Usage(); Environment.Exit(1); } About(); Environment.Exit(1); return(true); case "-help": case "--help": case "-h": case "-usage": if (ms_value != null) { Usage(); Environment.Exit(1); } Usage(); Environment.Exit(1); return(true); case "-start": if (ms_value != null) { Usage(); Environment.Exit(1); } debug_options.StartTarget = true; debug_options.StopInMain = false; return(true); case "-run": if (ms_value != null) { Usage(); Environment.Exit(1); } debug_options.StartTarget = true; debug_options.StopInMain = true; return(true); #if HAVE_XSP case "-xsp": value = GetValue(ref args, ref i, ms_value); if (value == null) { Usage(); Environment.Exit(1); } debug_options.StartXSP = true; debug_options.XSP_Root = value; debug_options.SetupXSP(); parsing_options = false; return(true); #endif } return(false); }
public static DebuggerOptions ParseCommandLine(string[] args) { DebuggerOptions options = new DebuggerOptions (); int i; bool parsing_options = true; for (i = 0; i < args.Length; i++) { string arg = args[i]; if (arg == "") continue; if (!parsing_options) { i--; break; } if (arg.StartsWith ("-")) { if (ParseOption (options, arg, ref args, ref i, ref parsing_options)) continue; Usage (); Console.WriteLine ("Unknown argument: {0}", arg); Environment.Exit (1); } else if (arg.StartsWith ("/")) { string unix_opt = "-" + arg.Substring (1); if (ParseOption (options, unix_opt, ref args, ref i, ref parsing_options)) continue; } options.File = arg; break; } if (args.Length > i) { string[] argv = new string [args.Length - i - 1]; Array.Copy (args, i + 1, argv, 0, args.Length - i - 1); options.InferiorArgs = argv; } else { options.InferiorArgs = new string [0]; } return options; }
public DebuggerOptions Clone() { DebuggerOptions options = new DebuggerOptions (); options.file = file; options.inferior_args = clone (inferior_args); options.JitOptimizations = JitOptimizations; options.jit_arguments = clone (jit_arguments); options.WorkingDirectory = WorkingDirectory; options.IsScript = IsScript; options.start_target = start_target; options.debug_flags = debug_flags; options.DebugOutput = DebugOutput; options.MonoPrefix = MonoPrefix; options.MonoPath = MonoPath; options.user_environment = clone (user_environment); return options; }
static bool ParseDebugFlags(DebuggerOptions options, string value) { if (value == null) return false; int pos = value.IndexOf (':'); if (pos > 0) { string filename = value.Substring (0, pos); value = value.Substring (pos + 1); options.DebugOutput = filename; } DebugFlags flags; if (!Report.ParseDebugFlags (value, out flags)) return false; options.DebugFlags = flags; return true; }
static bool ParseOption(DebuggerOptions debug_options, string option, ref string [] args, ref int i, ref bool parsing_options) { int idx = option.IndexOf (':'); string arg, value, ms_value = null; if (idx == -1){ arg = option; } else { arg = option.Substring (0, idx); ms_value = option.Substring (idx + 1); } switch (arg) { case "-working-directory": case "-cd": value = GetValue (ref args, ref i, ms_value); if (value == null) { Usage (); Environment.Exit (1); } debug_options.WorkingDirectory = value; return true; case "-debug-flags": value = GetValue (ref args, ref i, ms_value); if (!ParseDebugFlags (debug_options, value)) { Console.WriteLine ("Unknown -debug-flags argument: {0}", ms_value); Environment.Exit (1); } return true; case "-jit-optimizations": value = GetValue (ref args, ref i, ms_value); if (value == null) { Usage (); Environment.Exit (1); } debug_options.JitOptimizations = value; return true; case "-jit-arg": value = GetValue (ref args, ref i, ms_value); if (ms_value == null) { Usage (); Environment.Exit (1); } if (debug_options.JitArguments != null) { string[] old = debug_options.JitArguments; string[] new_args = new string [old.Length + 1]; old.CopyTo (new_args, 0); new_args [old.Length] = value; debug_options.JitArguments = new_args; } else { debug_options.JitArguments = new string[] { value }; } return true; case "-mono-prefix": value = GetValue (ref args, ref i, ms_value); if (value == null) { Usage (); Environment.Exit (1); } debug_options.MonoPrefix = value; return true; case "-mono": value = GetValue (ref args, ref i, ms_value); if (value == null) { Usage (); Environment.Exit (1); } debug_options.MonoPath = value; return true; case "-script": if (ms_value != null) { Usage (); Environment.Exit (1); } debug_options.IsScript = true; return true; case "-version": case "-V": if (ms_value != null) { Usage (); Environment.Exit (1); } About(); Environment.Exit (1); return true; case "-help": case "--help": case "-h": case "-usage": if (ms_value != null) { Usage (); Environment.Exit (1); } Usage(); Environment.Exit (1); return true; case "-start": if (ms_value != null) { Usage (); Environment.Exit (1); } debug_options.StartTarget = true; debug_options.StopInMain = false; return true; case "-run": if (ms_value != null) { Usage (); Environment.Exit (1); } debug_options.StartTarget = true; debug_options.StopInMain = true; return true; #if HAVE_XSP case "-xsp": value = GetValue (ref args, ref i, ms_value); if (value == null) { Usage (); Environment.Exit (1); } debug_options.StartXSP = true; debug_options.XSP_Root = value; debug_options.SetupXSP (); parsing_options = false; return true; #endif } return false; }
public static DebuggerOptions CreateXSP(string root) { DebuggerOptions options = new DebuggerOptions (); options.InferiorArgs = new string [0]; options.StartXSP = true; options.XSP_Root = root; options.SetupXSP (); return options; }
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 (); }