internal ExpressionBreakpoint(DebuggerSession session, ThreadGroup group, LocationType type, string expression) : base(EventType.Breakpoint, expression, group) { this.Session = session; this.LocationType = type; }
internal SourceBreakpoint(DebuggerSession session, int index, ThreadGroup group, SourceLocation location) : base(EventType.Breakpoint, index, location.Name, group) { this.session = session; this.location = location; }
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 Display(DebuggerSession session, int index, bool enabled, string text) { this.session = session; this.index = index; this.enabled = enabled; this.text = text; }
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 SourceFile(DebuggerSession session, Module module, string name) { this.id = ++next_id; this.module = module; if ((name == "") || (name == null)) { this.path = this.filename = ""; } else if (session.Config.OpaqueFileNames) { this.path = this.filename = name; } else { if ((name.Length > 1) && (name [1] == ':')) name = session.MapFileName (name); if ((name.Length > 1) && (name [1] == ':')) this.path = this.filename = name; else { name = session.MapFileName (name); this.path = Path.GetFullPath (name); this.filename = Path.GetFileName (name); } } }
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; } }
internal MainMethodBreakpoint(DebuggerSession session) : base(EventType.Breakpoint, "<main>", ThreadGroup.Global) { this.Session = session; }
public Process Attach(DebuggerSession session, int pid) { CommandResult dummy; return(Attach(session, pid, out dummy)); }
public Process Run(DebuggerSession session) { CommandResult dummy; return(Run(session, out dummy)); }
internal Display(DebuggerSession session, string text) : this(session, ++next_index, true, text) { }
internal SourceLocation(DebuggerSession session, XPathNavigator navigator) { this.Line = -1; this.Column = -1; XPathNodeIterator children = navigator.SelectChildren (XPathNodeType.Element); while (children.MoveNext ()) { if (children.Current.Name == "Module") Module = children.Current.Value; else if (children.Current.Name == "Method") Method = children.Current.Value; else if (children.Current.Name == "File") FileName = children.Current.Value; else if (children.Current.Name == "Name") Name = children.Current.Value; else if (children.Current.Name == "Line") Line = Int32.Parse (children.Current.Value); else if (children.Current.Name == "Column") Column = Int32.Parse (children.Current.Value); else throw new InvalidOperationException (); } }
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 Process LoadSession(Stream stream) { if ((debugger != null) || (main_process != null)) throw new TargetException (TargetError.AlreadyHaveTarget); try { debugger = new Debugger (config); parser = new ExpressionParser (this); session = new DebuggerSession (config, stream, parser); parser.Session = session; new InterpreterEventSink (this, debugger); CommandResult result; current_process = main_process = debugger.Run (session, out result); current_thread = current_process.MainThread; Wait (result); return current_process; } catch (TargetException ex) { Console.WriteLine ("Got a TargetException during LoadSession: {0}", ex); debugger.Dispose (); debugger = null; throw; } catch (Exception ex) { Console.WriteLine ("Got an Exception during LoadSession: {0}", ex); debugger.Dispose (); debugger = null; throw; } }
public Process OpenCoreFile(DebuggerSession session, string core_file, out Thread[] threads) { check_alive (); if (main_process != null) throw new TargetException (TargetError.AlreadyHaveTarget); ProcessStart start = new ProcessStart (session, core_file); main_process = thread_manager.OpenCoreFile (start, out threads); process_hash.Add (main_process, main_process); return main_process; }
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 Process Run(DebuggerSession session, out CommandResult result) { check_alive (); if (main_process != null) throw new TargetException (TargetError.AlreadyHaveTarget); ProcessStart start = new ProcessStart (session); main_process = thread_manager.StartApplication (start, out result); return main_process; }
public Process Run(DebuggerSession session) { CommandResult dummy; return Run (session, out dummy); }
public MonoSourceFile(DebuggerSession session, Module module, C.SourceFileEntry file, string path) : base(session, module, path) { this.file = file; }
public IExpressionParser Clone(DebuggerSession session) { ExpressionParser parser = new ExpressionParser (Interpreter); parser.Session = session; return parser; }
private Process(ThreadManager manager, DebuggerSession session) { this.manager = manager; this.session = session; operation_host = new MyOperationHost (this); thread_lock_mutex = new DebuggerMutex ("thread_lock_mutex"); stopped_event = new ST.ManualResetEvent (false); thread_hash = Hashtable.Synchronized (new Hashtable ()); target_info = Inferior.GetTargetInfo (); if (target_info.TargetAddressSize == 8) architecture = new Architecture_X86_64 (this, target_info); else architecture = new Architecture_I386 (this, target_info); }
internal BreakpointHandle ResolveBreakpoint(DebuggerSession session, Breakpoint breakpoint) { if (!Resolve (session)) throw new TargetException (TargetError.LocationInvalid); return dynamic.ResolveBreakpoint (breakpoint); }
protected bool Resolve(DebuggerSession session) { if (dynamic != null) return true; if (Method != null) { Module module = session.GetModule (Module); MethodSource source = module.FindMethod (Method); if (source == null) return false; dynamic = new DynamicSourceLocation (source, source.SourceFile, Line, Column); return true; } if (FileName != null) { SourceFile file = session.FindFile (FileName); if (file == null) return false; dynamic = new DynamicSourceLocation (file, Line, Column); return true; } return false; }
public Process Attach(DebuggerSession session, int pid) { CommandResult dummy; return Attach (session, pid, out dummy); }