[Monodevelop-patches-list] r2231 - trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Feb 4 04:16:23 EST 2005


Author: toshok
Date: 2005-02-04 04:16:23 -0500 (Fri, 04 Feb 2005)
New Revision: 2231

Modified:
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
Log:
2005-02-04  Chris Toshok  <toshok at ximian.com>

        * DebuggerCommands.cs: Update so this compiles/works with new
        MD.

        * DebuggingService.cs
        (DebuggingService.GetDebugProgressMonitor):
        create a progress monitor in which to display output from the
        debugged program.  not sure what to do about input, though.
        (DebuggingService.Cleanup): null current_monitor.
        (DebuggingService.thread_created): add
        TargetOutput/DebuggerOutput/DebuggerError handlers for the new
        thread, and use Gtk.ThreadNotify.
        (DebuggingService.initialized_event): same.
        (DebuggingService.thread_exited): use Gtk.ThreadNotify
        (DebuggingService.target_output, DebuggingService.debugger_output,
        DebuggingService.debugger_error): delegates for inferior output -
        output to our current_monitor.
        (DebuggingService.target_event): use Gtk.ThreadNotify.
        (DebuggingService.OnBreakpointHit): same.



Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog	2005-02-03 20:05:44 UTC (rev 2230)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog	2005-02-04 09:16:23 UTC (rev 2231)
@@ -1,3 +1,22 @@
+2005-02-04  Chris Toshok  <toshok at ximian.com>
+
+	* DebuggerCommands.cs: Update so this compiles/works with new MD.
+
+	* DebuggingService.cs (DebuggingService.GetDebugProgressMonitor):
+	create a progress monitor in which to display output from the
+	debugged program.  not sure what to do about input, though.
+	(DebuggingService.Cleanup): null current_monitor.
+	(DebuggingService.thread_created): add
+	TargetOutput/DebuggerOutput/DebuggerError handlers for the new
+	thread, and use Gtk.ThreadNotify.
+	(DebuggingService.initialized_event): same.
+	(DebuggingService.thread_exited): use Gtk.ThreadNotify
+	(DebuggingService.target_output, DebuggingService.debugger_output,
+	DebuggingService.debugger_error): delegates for inferior output -
+	output to our current_monitor.
+	(DebuggingService.target_event): use Gtk.ThreadNotify.
+	(DebuggingService.OnBreakpointHit): same.
+
 2004-10-23  Chris Toshok  <toshok at ximian.com>
 
 	* Gui/DebuggerThreadPad.cs: add the current location to stopped

Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs	2005-02-03 20:05:44 UTC (rev 2230)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs	2005-02-04 09:16:23 UTC (rev 2231)
@@ -54,16 +54,17 @@
 
 		public override void Run ()
 		{
-
+			DebuggingService dbgr = (DebuggingService)ServiceManager.GetService (typeof (DebuggingService));
 			IProjectService projServ = (IProjectService)ServiceManager.GetService (typeof (IProjectService));
 			
 			if (projServ.CurrentOpenCombine != null) {
 				//try {
 					if (projServ.NeedsCompiling) {
-						projServ.CompileCombine ();
+						projServ.BuildActiveCombine ().WaitForCompleted ();
 					}
-					projServ.OnBeforeStartProject ();
-					projServ.CurrentOpenCombine.Debug ();
+					//					if (projServ.BeforeStartProject != null)
+					//						projServ.BeforeStartProject (projServ, null);
+					projServ.CurrentOpenCombine.Debug (dbgr.GetDebugProgressMonitor ());
 				//} catch {
 				//	IMessageService msgServ = (IMessageService)ServiceManager.Services.GetService (typeof (IMessageService));
 				//	msgServ.ShowError ("Can't execute the debugger");

Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs	2005-02-03 20:05:44 UTC (rev 2230)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs	2005-02-04 09:16:23 UTC (rev 2231)
@@ -32,10 +32,18 @@
 		DebuggerBackend backend;
 		Breakpoint point;
 
+		IProgressMonitor current_monitor;
+
 		public DebuggingService()
 		{
 			DebuggerBackend.Initialize ();
 		}
+
+                public IProgressMonitor GetDebugProgressMonitor ()
+                {
+                        current_monitor = Runtime.TaskService.GetOutputProgressMonitor ("Debug Output", MonoDevelop.Gui.Stock.OutputIcon, true, true);
+			return current_monitor;
+                }
 		
 		void Cleanup ()
 		{
@@ -46,6 +54,7 @@
 				StoppedEvent (this, new EventArgs ());
 			backend.Dispose ();
 			backend = null;
+			current_monitor = null;
 			proc = null;
 		}
 
@@ -111,11 +120,14 @@
 		private void thread_created (ThreadManager manager, Process process)
 		{
 			lock (procs) {
-			  //				process.ProcessExitedEvent += new ProcessExitedHandler (thread_exited);
 				procs.Add (process.ID, process);
+
+				process.TargetOutput += new TargetOutputHandler (target_output);
+				process.DebuggerOutput += new DebuggerOutputHandler (debugger_output);
+				process.DebuggerError += new DebuggerErrorHandler (debugger_error);
 			}
 
-			Gtk.Timeout.Add (1, new Gtk.Function (EmitThreadStateEvent));
+			new Gtk.ThreadNotify (new Gtk.ReadyEvent (EmitThreadStateEvent)).WakeupMain();
 		}
 
 		private void thread_exited (ThreadManager manager, Process process)
@@ -124,28 +136,46 @@
 				procs.Remove (process.ID);
 			}
 
-			Gtk.Timeout.Add (1, new Gtk.Function (EmitThreadStateEvent));
+			new Gtk.ThreadNotify (new Gtk.ReadyEvent (EmitThreadStateEvent)).WakeupMain();
 		}
 
 		private void initialized_event (ThreadManager manager, Process process)
 		{
 			this.proc = process;
 
+			proc.TargetOutput += new TargetOutputHandler (target_output);
+			proc.DebuggerOutput += new DebuggerOutputHandler (debugger_output);
+			proc.DebuggerError += new DebuggerErrorHandler (debugger_error);
 			proc.TargetEvent += new TargetEventHandler (target_event);
 
-			Gtk.Timeout.Add (1, new Gtk.Function (EmitStarted));
+			new Gtk.ThreadNotify (new Gtk.ReadyEvent (EmitStarted)).WakeupMain();
 		}
 
+		void target_output (bool is_stderr, string line)
+		{
+			current_monitor.Log.Write (line);
+		}
+
+		void debugger_output (string line)
+		{
+			current_monitor.ReportWarning (line);
+		}
+
+		void debugger_error (object sender, string message, Exception e)
+		{
+			current_monitor.ReportError (message, e);
+		}
+
 		private void target_event (object sender, TargetEventArgs args)
 		{
 			switch (args.Type) {
 			case TargetEventType.TargetExited:
 			case TargetEventType.TargetSignaled:
-				Gtk.Timeout.Add (1, new Gtk.Function (KillApplication));
+				new Gtk.ThreadNotify (new Gtk.ReadyEvent (KillApplication)).WakeupMain();
 				break;
 			case TargetEventType.TargetStopped:
 			case TargetEventType.TargetRunning:
-				Gtk.Timeout.Add (1, new Gtk.Function (ChangeState));
+				new Gtk.ThreadNotify (new Gtk.ReadyEvent (ChangeState)).WakeupMain();
 				break;
 			case TargetEventType.TargetHitBreakpoint:
 			default:
@@ -174,15 +204,13 @@
 			}
 		}
 
-		bool EmitThreadStateEvent ()
+		void EmitThreadStateEvent ()
 		{
 			if (ThreadStateEvent != null)
 				ThreadStateEvent (this, new EventArgs ());
-
-			return false;
 		}
 
-		bool EmitStarted ()
+		void EmitStarted ()
 		{
 			insert_breakpoints ();
 
@@ -190,11 +218,9 @@
 				StartedEvent (this, new EventArgs ());
 
 			ChangeState ();
-
-			return false;
 		}
 
-		bool ChangeState ()
+		void ChangeState ()
 		{
 			if (ThreadStateEvent != null)
 				ThreadStateEvent (this, new EventArgs ());
@@ -205,7 +231,6 @@
 			} else if (PausedEvent != null) {
 				PausedEvent (this, new EventArgs ());
 			}
-			return false;
 		}
 
 		public event EventHandler PausedEvent;
@@ -214,10 +239,9 @@
 		public event EventHandler StoppedEvent;
 		public event EventHandler ThreadStateEvent;
 
-		bool KillApplication ()
+		void KillApplication ()
 		{
 			Cleanup ();
-			return false;
 		}
 
 		public void Pause ()
@@ -348,21 +372,20 @@
 		private void OnBreakpointHit (Breakpoint pointFromDbg, StackFrame frame)
 		{
 			point = pointFromDbg;
-			Gtk.Timeout.Add (1, new Gtk.Function (MainThreadNotify));
+			new Gtk.ThreadNotify (new Gtk.ReadyEvent (MainThreadNotify)).WakeupMain();
 		}
 
-		bool MainThreadNotify ()
+		void MainThreadNotify ()
 		{
 			string[] toks = point.Name.Split (':');
 			string filename = toks [0];
 			int linenumber = Int32.Parse (toks [1]);
 
 			if (this.BreakpointHit == null)
-				return false;
+				return;
 			
 			BreakpointHitArgs args = new BreakpointHitArgs (filename, linenumber);
 			BreakpointHit (this, args);
-			return false;
 		}
 
 		public event DebuggingService.BreakpointHitHandler BreakpointHit;




More information about the Monodevelop-patches-list mailing list