コード例 #1
0
ファイル: Extensions.cs プロジェクト: zcf7822/monodevelop
        public static AsyncOperation AttachToProcess(this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
        {
            var oper = DebuggingService.AttachToProcess(debugger, proc);

            opers.AddRunOperation(oper);
            return(opers.CurrentRunOperation);
        }
コード例 #2
0
        private void ChangeEngine(DebuggerEngine newEngine)
        {
            if (selectedEngine == newEngine)
            {
                return;
            }
            selectedEngine = newEngine;

            refreshLoopTokenSource.Cancel();
            refreshLoopTokenSource = new CancellationTokenSource();

            if (processAttacher != null)
            {
                processAttacher.AttachableProcessesChanged -= ProcessAttacher_AttachableProcessesChanged;
                processAttacher.Dispose();
            }

            processAttacher = selectedEngine.GetProcessAttacher();
            if (processAttacher != null)
            {
                processAttacher.AttachableProcessesChanged += ProcessAttacher_AttachableProcessesChanged;
                this.procs = processAttacher.GetAttachableProcesses();
                Runtime.RunInMainThread(new Action(FillList)).Ignore();
            }
            else
            {
                var refreshThread = new Thread(new ParameterizedThreadStart(Refresh));
                refreshThread.IsBackground = true;
                refreshThread.Start(refreshLoopTokenSource.Token);
            }
        }
コード例 #3
0
        internal static void InternalRun(ExecutionCommand cmd, DebuggerEngine factory, IConsole c)
        {
            if (factory == null)
            {
                factory = GetFactoryForCommand(cmd);
                if (factory == null)
                {
                    throw new InvalidOperationException("Unsupported command: " + cmd);
                }
            }

            DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo(cmd);

            startInfo.UseExternalConsole         = c is ExternalConsole;
            startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose;
            currentEngine = factory;
            session       = factory.CreateSession();
            session.Initialize();
            console = c;

            SetupSession();

            try {
                session.Run(startInfo, GetUserOptions());
            } catch {
                Cleanup();
                throw;
            }
        }
コード例 #4
0
		public static IAsyncOperation AttachToProcess (this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
		{
			if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
				return opers.CurrentRunOperation;
			
			opers.CurrentRunOperation = DebuggingService.AttachToProcess (debugger, proc);
			
			return opers.CurrentRunOperation;
		}
コード例 #5
0
ファイル: Extensions.cs プロジェクト: nerzhulart/monodevelop
		public static IAsyncOperation AttachToProcess (this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
		{
			if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
				return opers.CurrentRunOperation;

			var oper = DebuggingService.AttachToProcess (debugger, proc);

			opers.CurrentRunOperation = oper;
			return opers.CurrentRunOperation;
		}
コード例 #6
0
        internal static void InternalRun(ExecutionCommand cmd, DebuggerEngine factory, IConsole c)
        {
            if (factory == null)
            {
                factory = GetFactoryForCommand(cmd);
                if (factory == null)
                {
                    throw new InvalidOperationException("Unsupported command: " + cmd);
                }
            }

            if (session != null)
            {
                throw new InvalidOperationException("A debugger session is already started");
            }

            DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo(cmd);

            startInfo.UseExternalConsole         = c is ExternalConsole;
            startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose;
            currentEngine            = factory;
            session                  = factory.CreateSession();
            session.ExceptionHandler = ExceptionHandler;

            // When using an external console, create a new internal console which will be used
            // to show the debugger log
            if (startInfo.UseExternalConsole)
            {
                console = (IConsole)IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor();
            }
            else
            {
                console = c;
            }

            SetupSession();

            // Dispatch synchronously to avoid start/stop races
            DispatchService.GuiSyncDispatch(delegate
            {
                oldLayout = IdeApp.Workbench.CurrentLayout;
                IdeApp.Workbench.CurrentLayout = "Debug";
            });

            try
            {
                session.Run(startInfo, GetUserOptions());
            }
            catch
            {
                Cleanup();
                throw;
            }
        }
コード例 #7
0
        public static DebuggerFeatures GetSupportedFeaturesForCommand(ExecutionCommand command)
        {
            DebuggerEngine engine = GetFactoryForCommand(command);

            if (engine != null)
            {
                return(engine.SupportedFeatures);
            }

            return(DebuggerFeatures.None);
        }
コード例 #8
0
ファイル: Extensions.cs プロジェクト: dgjbss/MonoDevelopWin
        public static AsyncOperation AttachToProcess(this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
        {
            if (!IdeApp.Workbench.Visible)
            {
                IdeApp.Workbench.Present();
            }

            var oper = DebuggingService.AttachToProcess(debugger, proc);

            opers.AddRunOperation(oper);
            return(opers.CurrentRunOperation);
        }
コード例 #9
0
        public static IAsyncOperation AttachToProcess(this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
        {
            if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
            {
                return(opers.CurrentRunOperation);
            }

            var oper = DebuggingService.AttachToProcess(debugger, proc);

            SwitchToDebugLayout(oper);

            opers.CurrentRunOperation = oper;
            return(opers.CurrentRunOperation);
        }
コード例 #10
0
        public static IAsyncOperation AttachToProcess(DebuggerEngine debugger, ProcessInfo proc)
        {
            currentEngine = debugger;
            session       = debugger.CreateSession();
            IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor();

            console = monitor as IConsole;
            SetupSession();
            session.TargetExited += delegate {
                monitor.Dispose();
            };
            session.AttachToProcess(proc, GetUserOptions());
            return(monitor.AsyncOperation);
        }
コード例 #11
0
        internal static void InternalRun(ExecutionCommand cmd, DebuggerEngine factory, OperationConsole c)
        {
            if (factory == null)
            {
                factory = GetFactoryForCommand(cmd);
                if (factory == null)
                {
                    throw new InvalidOperationException("Unsupported command: " + cmd);
                }
            }

            if (session != null)
            {
                throw new InvalidOperationException("A debugger session is already started");
            }

            DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo(cmd);

            startInfo.UseExternalConsole = c is ExternalConsole;
            if (startInfo.UseExternalConsole)
            {
                startInfo.CloseExternalConsoleOnExit = ((ExternalConsole)c).CloseOnDispose;
            }
            currentEngine            = factory;
            session                  = factory.CreateSession();
            session.ExceptionHandler = ExceptionHandler;

            // When using an external console, create a new internal console which will be used
            // to show the debugger log
            if (startInfo.UseExternalConsole)
            {
                console = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor().Console;
            }
            else
            {
                console = c;
            }

            SetupSession();

            SetDebugLayout();

            try {
                session.Run(startInfo, GetUserOptions());
            } catch {
                Cleanup();
                throw;
            }
        }
コード例 #12
0
        static DebuggerEngine GetFactoryForCommand(ExecutionCommand cmd)
        {
            DebuggerEngine supportedEngine = null;

            // Get the default engine for the command if available,
            // or the first engine that supports the command otherwise

            foreach (DebuggerEngine factory in GetDebuggerEngines())
            {
                if (factory.CanDebugCommand(cmd))
                {
                    if (factory.IsDefaultDebugger(cmd))
                    {
                        return(factory);
                    }
                    if (supportedEngine == null)
                    {
                        supportedEngine = factory;
                    }
                }
            }
            return(supportedEngine);
        }
コード例 #13
0
		public static IAsyncOperation AttachToProcess (DebuggerEngine debugger, ProcessInfo proc)
		{
			currentEngine = debugger;
			session = debugger.CreateSession ();
			session.ExceptionHandler = ExceptionHandler;
			IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ();
			console = monitor as IConsole;
			SetupSession ();
			session.TargetExited += delegate {
				monitor.Dispose ();
			};
			session.AttachToProcess (proc, GetUserOptions ());
			return monitor.AsyncOperation;
		}
コード例 #14
0
ファイル: DebuggingService.cs プロジェクト: thild/monodevelop
 public InternalDebugExecutionHandler(DebuggerEngine engine)
 {
     this.engine = engine;
 }
コード例 #15
0
 public DebugExecutionHandler(DebuggerEngine factory)
 {
     this.factory = factory;
     DebuggingService.StoppedEvent += new EventHandler(OnStopDebug);
 }
コード例 #16
0
		internal static void InternalRun (ExecutionCommand cmd, DebuggerEngine factory, IConsole c)
		{
			if (factory == null) {
				factory = GetFactoryForCommand (cmd);
				if (factory == null)
					throw new InvalidOperationException ("Unsupported command: " + cmd);
			}
			
			DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo (cmd);
			startInfo.UseExternalConsole = c is ExternalConsole;
			startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose;
			currentEngine = factory;
			session = factory.CreateSession ();
			session.Initialize ();
			console = c;
			
			SetupSession ();

			try {
				session.Run (startInfo, GetUserOptions ());
			} catch {
				Cleanup ();
				throw;
			}
		}
コード例 #17
0
		internal static void InternalRun (ExecutionCommand cmd, DebuggerEngine factory, IConsole c)
		{
			if (factory == null) {
				factory = GetFactoryForCommand (cmd);
				if (factory == null)
					throw new InvalidOperationException ("Unsupported command: " + cmd);
			}
			
			DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo (cmd);
			startInfo.UseExternalConsole = c is ExternalConsole;
			startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose;
			currentEngine = factory;
			session = factory.CreateSession ();
			session.ExceptionHandler = ExceptionHandler;
			session.Initialize ();
			
			// When using an external console, create a new internal console which will be used
			// to show the debugger log
			if (startInfo.UseExternalConsole)
				console = (IConsole) IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (GettextCatalog.GetString ("Application Output"), Stock.RunProgramIcon, true, true);
			else
				console = c;
			
			SetupSession ();

			try {
				session.Run (startInfo, GetUserOptions ());
			} catch {
				Cleanup ();
				throw;
			}
		}
コード例 #18
0
 public static ProcessAsyncOperation Run(ExecutionCommand cmd, OperationConsole console, DebuggerEngine engine = null)
 {
     InternalRun(cmd, engine, console);
     return(currentDebugOperation);
 }
コード例 #19
0
		public DebugExecutionHandler (DebuggerEngine factory)
		{
			this.factory = factory;
			DebuggingService.StoppedEvent += new EventHandler (OnStopDebug);
		}
コード例 #20
0
		internal static void InternalRun (ExecutionCommand cmd, DebuggerEngine factory, IConsole c)
		{
			if (factory == null) {
				factory = GetFactoryForCommand (cmd);
				if (factory == null)
					throw new InvalidOperationException ("Unsupported command: " + cmd);
			}
			
			if (session != null)
				throw new InvalidOperationException ("A debugger session is already started");

			DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo (cmd);
			startInfo.UseExternalConsole = c is ExternalConsole;
			startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose;
			currentEngine = factory;
			session = factory.CreateSession ();
			session.ExceptionHandler = ExceptionHandler;
			
			// When using an external console, create a new internal console which will be used
			// to show the debugger log
			if (startInfo.UseExternalConsole)
				console = (IConsole) IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ();
			else
				console = c;
			
			SetupSession ();
			
			// Dispatch synchronously to avoid start/stop races
			DispatchService.GuiSyncDispatch (delegate {
				oldLayout = IdeApp.Workbench.CurrentLayout;
				IdeApp.Workbench.CurrentLayout = "Debug";
			});
			
			try {
				session.Run (startInfo, GetUserOptions ());
			} catch {
				Cleanup ();
				throw;
			}
		}
コード例 #21
0
		public InternalDebugExecutionHandler (DebuggerEngine engine)
		{
			this.engine = engine;
		}
コード例 #22
0
        public AttachToProcessDialog()
        {
            this.Build();

            store      = new Gtk.ListStore(typeof(ProcessInfo), typeof(string), typeof(string), typeof(string));
            tree.Model = store;
            tree.AppendColumn("PID", new Gtk.CellRendererText(), "text", 1);
            tree.AppendColumn(GettextCatalog.GetString("Name"), new Gtk.CellRendererText(), "text", 2);
            tree.AppendColumn(GettextCatalog.GetString("Description"), new Gtk.CellRendererText(), "text", 3);
            tree.RowActivated += OnRowActivated;

            state = new TreeViewState(tree, 1);

            buttonOk.Sensitive = false;
            tree.Selection.UnselectAll();
            tree.Selection.Changed += OnSelectionChanged;

            Gtk.TreeIter it;
            if (store.GetIterFirst(out it))
            {
                tree.Selection.SelectIter(it);
            }

            //Logic below tries to CreateExecutionCommand which is used to determine default debug engine
            var startupConfig = IdeApp.ProjectOperations.CurrentSelectedSolution?.StartupConfiguration as SingleItemSolutionRunConfiguration;
            ExecutionCommand executionCommand = null;

            if (startupConfig?.Item is DotNetProject dnp)
            {
                var config = dnp.GetConfiguration(IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration;
                var runProjectConfiguration = startupConfig.RunConfiguration as ProjectRunConfiguration ?? dnp.GetDefaultRunConfiguration() as ProjectRunConfiguration;
                if (config != null)
                {
                    executionCommand = dnp.CreateExecutionCommand(IdeApp.Workspace.ActiveConfiguration, config, runProjectConfiguration);
                }
            }
            DebuggerEngine defaultEngine = null;

            foreach (DebuggerEngine de in DebuggingService.GetDebuggerEngines())
            {
                if ((de.SupportedFeatures & DebuggerFeatures.Attaching) == 0)
                {
                    continue;
                }
                if (executionCommand != null && de.CanDebugCommand(executionCommand))
                {
                    defaultEngine = de;
                }
                debugEngines.Add(de);
                comboDebs.AppendText(de.Name);
            }
            if (!debugEngines.Any())
            {
                return;
            }
            if (defaultEngine == null)
            {
                defaultEngine = debugEngines.First();
            }
            comboDebs.Active = debugEngines.IndexOf(defaultEngine);
            ChangeEngine(defaultEngine);
            comboDebs.Changed += delegate {
                ChangeEngine(debugEngines [comboDebs.Active]);
            };
        }