public EmonicInterpreter(DebuggerConfiguration config, DebuggerOptions options) : base(true,config,options) { DebuggerEngine = new EmonicDebuggerEngine(this); thisReference = 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)); }
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 Debugger(DebuggerConfiguration config) { this.config = config; this.alive = true; ObjectCache.Initialize(); kill_event = new ManualResetEvent(false); thread_manager = new ThreadManager(this); process_hash = Hashtable.Synchronized(new Hashtable()); stopped_event = new ManualResetEvent(false); operation_host = new MyOperationHost(this); }
public Debugger(DebuggerConfiguration config) { this.config = config; this.alive = true; ObjectCache.Initialize (); kill_event = new ManualResetEvent (false); thread_manager = new ThreadManager (this); process_hash = Hashtable.Synchronized (new Hashtable ()); stopped_event = new ManualResetEvent (false); operation_host = new MyOperationHost (this); }
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; }
private DebuggerSession(DebuggerConfiguration config, string name) { this.Config = config; this.Name = name; modules = Hashtable.Synchronized(new Hashtable()); displays = Hashtable.Synchronized(new Hashtable()); thread_groups = Hashtable.Synchronized(new Hashtable()); main_thread_group = CreateThreadGroup("main"); directory_maps = new Dictionary <string, string> (); user_module_paths = new List <string> (); user_modules = new List <string> (); exception_catchpoints = new Dictionary <int, ExceptionCatchPoint> (); events = new Dictionary <int, Event> (); pending_bpts = new Dictionary <Breakpoint, BreakpointHandle.Action> (); }
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 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 string MapFileName(string path) { path = DebuggerConfiguration.WindowsToUnix(path); foreach (KeyValuePair <string, string> map in directory_maps) { if (map_file_name(ref path, map.Key, map.Value)) { return(path); } } foreach (KeyValuePair <string, string> map in Config.DirectoryMaps) { if (map_file_name(ref path, map.Key, map.Value)) { return(path); } } return(path); }
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"]; }
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; } }
protected XmlDocument SaveSession() { XmlDocument doc = DebuggerConfiguration.CreateXmlDocument(); XmlElement module_groups = doc.CreateElement("ModuleGroups"); doc.DocumentElement.AppendChild(module_groups); foreach (ModuleGroup group in Config.ModuleGroups) { group.GetSessionData(module_groups); } XmlElement root = doc.CreateElement("DebuggerSession"); root.SetAttribute("name", Name); doc.DocumentElement.AppendChild(root); XmlElement options = doc.CreateElement("Options"); Options.GetSessionData(options); root.AppendChild(options); XmlElement modules = root.OwnerDocument.CreateElement("Modules"); root.AppendChild(modules); foreach (Module module in Modules) { module.GetSessionData(modules); } XmlElement thread_groups = root.OwnerDocument.CreateElement("ThreadGroups"); root.AppendChild(thread_groups); foreach (ThreadGroup group in ThreadGroups) { AddThreadGroup(thread_groups, group); } XmlElement event_list = root.OwnerDocument.CreateElement("Events"); root.AppendChild(event_list); foreach (Event e in Events) { e.GetSessionData(event_list); } XmlElement display_list = root.OwnerDocument.CreateElement("Displays"); root.AppendChild(display_list); foreach (Display d in Displays) { d.GetSessionData(display_list); } return(doc); }
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 (); }
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 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 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 (); }); }
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); }
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); }
private DebuggerSession(DebuggerConfiguration config, string name) { this.Config = config; this.Name = name; modules = Hashtable.Synchronized (new Hashtable ()); displays = Hashtable.Synchronized (new Hashtable ()); thread_groups = Hashtable.Synchronized (new Hashtable ()); main_thread_group = CreateThreadGroup ("main"); directory_maps = new Dictionary<string,string> (); user_module_paths = new List<string> (); user_modules = new List<string> (); exception_catchpoints = new Dictionary<int,ExceptionCatchPoint> (); events = new Dictionary<int,Event> (); pending_bpts = new Dictionary<Breakpoint,BreakpointHandle.Action> (); }