Inheritance: DebuggerMarshalByRefObject
Esempio n. 1
0
        internal ExpressionBreakpoint(DebuggerSession session, ThreadGroup group,
					       LocationType type, string expression)
            : base(EventType.Breakpoint, expression, group)
        {
            this.Session = session;
            this.LocationType = type;
        }
Esempio n. 2
0
        internal SourceBreakpoint(DebuggerSession session, int index, ThreadGroup group,
					   SourceLocation location)
            : base(EventType.Breakpoint, index, location.Name, group)
        {
            this.session = session;
            this.location = location;
        }
Esempio n. 3
0
        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();
            });
        }
Esempio n. 4
0
 internal Display(DebuggerSession session, int index, bool enabled, string text)
 {
     this.session = session;
     this.index = index;
     this.enabled = enabled;
     this.text = text;
 }
Esempio n. 5
0
        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"];
        }
Esempio n. 6
0
        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);
                }
            }
        }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
 internal MainMethodBreakpoint(DebuggerSession session)
     : base(EventType.Breakpoint, "<main>", ThreadGroup.Global)
 {
     this.Session = session;
 }
Esempio n. 9
0
        public Process Attach(DebuggerSession session, int pid)
        {
            CommandResult dummy;

            return(Attach(session, pid, out dummy));
        }
Esempio n. 10
0
        public Process Run(DebuggerSession session)
        {
            CommandResult dummy;

            return(Run(session, out dummy));
        }
Esempio n. 11
0
 internal Display(DebuggerSession session, string text)
     : this(session, ++next_index, true, text)
 {
 }
Esempio n. 12
0
        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;
			}
		}
Esempio n. 14
0
        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;
            }
        }
Esempio n. 15
0
 internal Display(DebuggerSession session, string text)
     : this(session, ++next_index, true, text)
 {
 }
Esempio n. 16
0
        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;
        }
 internal MainMethodBreakpoint(DebuggerSession session)
     : base(EventType.Breakpoint, "<main>", ThreadGroup.Global)
 {
     this.Session = session;
 }
		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 ();
			});
		}
Esempio n. 19
0
        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;
        }
Esempio n. 20
0
 public Process Run(DebuggerSession session)
 {
     CommandResult dummy;
     return Run (session, out dummy);
 }
Esempio n. 21
0
            public MonoSourceFile(DebuggerSession session, Module module,
					       C.SourceFileEntry file, string path)
                : base(session, module, path)
            {
                this.file = file;
            }
Esempio n. 22
0
 public IExpressionParser Clone(DebuggerSession session)
 {
     ExpressionParser parser = new ExpressionParser (Interpreter);
     parser.Session = session;
     return parser;
 }
Esempio n. 23
0
        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);
        }
Esempio n. 24
0
        internal BreakpointHandle ResolveBreakpoint(DebuggerSession session,
							     Breakpoint breakpoint)
        {
            if (!Resolve (session))
                throw new TargetException (TargetError.LocationInvalid);

            return dynamic.ResolveBreakpoint (breakpoint);
        }
Esempio n. 25
0
        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;
        }
Esempio n. 26
0
 public Process Attach(DebuggerSession session, int pid)
 {
     CommandResult dummy;
     return Attach (session, pid, out dummy);
 }