Inheritance: DebuggerMarshalByRefObject
コード例 #1
0
        internal ExpressionBreakpoint(DebuggerSession session, ThreadGroup group,
					       LocationType type, string expression)
            : base(EventType.Breakpoint, expression, group)
        {
            this.Session = session;
            this.LocationType = type;
        }
コード例 #2
0
ファイル: SourceBreakpoint.cs プロジェクト: baulig/debugger
        internal SourceBreakpoint(DebuggerSession session, int index, ThreadGroup group,
					   SourceLocation location)
            : base(EventType.Breakpoint, index, location.Name, group)
        {
            this.session = session;
            this.location = location;
        }
コード例 #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();
            });
        }
コード例 #4
0
ファイル: Display.cs プロジェクト: baulig/debugger
 internal Display(DebuggerSession session, int index, bool enabled, string text)
 {
     this.session = session;
     this.index = index;
     this.enabled = enabled;
     this.text = text;
 }
コード例 #5
0
ファイル: Interpreter.cs プロジェクト: baulig/debugger
        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"];
        }
コード例 #6
0
ファイル: SourceInfo.cs プロジェクト: baulig/debugger
        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);
                }
            }
        }
コード例 #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;
            }
        }
コード例 #8
0
 internal MainMethodBreakpoint(DebuggerSession session)
     : base(EventType.Breakpoint, "<main>", ThreadGroup.Global)
 {
     this.Session = session;
 }
コード例 #9
0
        public Process Attach(DebuggerSession session, int pid)
        {
            CommandResult dummy;

            return(Attach(session, pid, out dummy));
        }
コード例 #10
0
        public Process Run(DebuggerSession session)
        {
            CommandResult dummy;

            return(Run(session, out dummy));
        }
コード例 #11
0
 internal Display(DebuggerSession session, string text)
     : this(session, ++next_index, true, text)
 {
 }
コード例 #12
0
ファイル: SourceLocation.cs プロジェクト: baulig/debugger
        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 ();
            }
        }
コード例 #13
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;
			}
		}
コード例 #14
0
ファイル: Interpreter.cs プロジェクト: baulig/debugger
        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;
            }
        }
コード例 #15
0
ファイル: Display.cs プロジェクト: baulig/debugger
 internal Display(DebuggerSession session, string text)
     : this(session, ++next_index, true, text)
 {
 }
コード例 #16
0
ファイル: Debugger.cs プロジェクト: baulig/debugger
        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;
        }
コード例 #17
0
 internal MainMethodBreakpoint(DebuggerSession session)
     : base(EventType.Breakpoint, "<main>", ThreadGroup.Global)
 {
     this.Session = session;
 }
コード例 #18
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 ();
			});
		}
コード例 #19
0
ファイル: Debugger.cs プロジェクト: baulig/debugger
        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;
        }
コード例 #20
0
ファイル: Debugger.cs プロジェクト: baulig/debugger
 public Process Run(DebuggerSession session)
 {
     CommandResult dummy;
     return Run (session, out dummy);
 }
コード例 #21
0
            public MonoSourceFile(DebuggerSession session, Module module,
					       C.SourceFileEntry file, string path)
                : base(session, module, path)
            {
                this.file = file;
            }
コード例 #22
0
ファイル: ExpressionParser.cs プロジェクト: baulig/debugger
 public IExpressionParser Clone(DebuggerSession session)
 {
     ExpressionParser parser = new ExpressionParser (Interpreter);
     parser.Session = session;
     return parser;
 }
コード例 #23
0
ファイル: Process.cs プロジェクト: baulig/debugger
        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);
        }
コード例 #24
0
ファイル: SourceLocation.cs プロジェクト: baulig/debugger
        internal BreakpointHandle ResolveBreakpoint(DebuggerSession session,
							     Breakpoint breakpoint)
        {
            if (!Resolve (session))
                throw new TargetException (TargetError.LocationInvalid);

            return dynamic.ResolveBreakpoint (breakpoint);
        }
コード例 #25
0
ファイル: SourceLocation.cs プロジェクト: baulig/debugger
        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;
        }
コード例 #26
0
ファイル: Debugger.cs プロジェクト: baulig/debugger
 public Process Attach(DebuggerSession session, int pid)
 {
     CommandResult dummy;
     return Attach (session, pid, out dummy);
 }