[Monodevelop-patches-list] r1083 - in trunk/MonoDevelop: . src/Main/Base src/Main/Base/Services

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Mar 2 19:43:33 EST 2004


Author: mkestner
Date: 2004-03-02 19:43:33 -0500 (Tue, 02 Mar 2004)
New Revision: 1083

Added:
   trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs
Modified:
   trunk/MonoDevelop/ChangeLog
   trunk/MonoDevelop/configure.in
   trunk/MonoDevelop/src/Main/Base/Makefile.am
Log:
2004-03-02  Mike Kestner  <mkestner at ximian.com>

	* configure.in : check for mono debugger
	* Main/Base/Makefile.am : reference Mono.Debugger
	* Main/Base/Services/DebuggingService.cs : new minimal debugging
	service implementation.



Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog	2004-03-02 21:37:13 UTC (rev 1082)
+++ trunk/MonoDevelop/ChangeLog	2004-03-03 00:43:33 UTC (rev 1083)
@@ -1 +1,7 @@
-==== 0.1 Released ====
+2004-03-02  Mike Kestner  <mkestner at ximian.com>
+
+	* configure.in : check for mono debugger
+	* Main/Base/Makefile.am : reference Mono.Debugger
+	* Main/Base/Services/DebuggingService.cs : new minimal debugging
+	service implementation.
+

Modified: trunk/MonoDevelop/configure.in
===================================================================
--- trunk/MonoDevelop/configure.in	2004-03-02 21:37:13 UTC (rev 1082)
+++ trunk/MonoDevelop/configure.in	2004-03-03 00:43:33 UTC (rev 1083)
@@ -29,7 +29,7 @@
 dnl Find gtk-sharp
 GTKSHARP_REQUIRED_VERSION=0.17
 
-PKG_CHECK_MODULES(BASE_DEPENDENCIES, gtk-sharp >= $GTKSHARP_REQUIRED_VERSION, enable_gtksharp=yes, enable_gtksharp=no) 
+PKG_CHECK_MODULES(BASE_DEPENDENCIES, gtk-sharp >= $GTKSHARP_REQUIRED_VERSION) 
 gtksharp_prefix=`pkg-config --variable=prefix gtk-sharp`
 AC_SUBST(gtksharp_prefix)
 
@@ -56,6 +56,10 @@
 MOZGTK_REQUIRED_VERSION=1.2
 PKG_CHECK_MODULES(BASE_DEPENDENCIES, mozilla-gtkmozembed >= $MOZGTK_REQUIRED_VERSION, enable_gtkmoz=yes, enable_gtkmoz=no)
 
+dnl find mono debugger
+MONO_DEBUGGER_REQUIRED_VERSION=0.6
+PKG_CHECK_MODULES(MONO_DEBUGGER, mono-debugger >= $MONO_DEBUGGER_REQUIRED_VERSION)
+
 MOZILLA_HOME="`$PKG_CONFIG --variable=libdir mozilla-gtkmozembed`"
 AC_SUBST(MOZILLA_HOME)
 
@@ -123,7 +127,6 @@
 echo "   * GNOME prefix = $gnome_prefix"
 echo ""
 echo "   * gnomevfs $GNOMEVFS_REQUIRED_VERSION: $enable_gnomevfs"
-echo "   * gtk-sharp $GTKSHARP_REQUIRED_VERSION: $enable_gtksharp"
 echo "   * gtkmozembed $MOZGTK_REQUIRED_VERSION: $enable_gtkmoz"
 echo "   * gtksourceview $GTKSOURCEVIEW_REQUIRED_VERSION: $enable_gtksourceview"
 echo "   * gtksourceview-sharp $GTKSOURCEVIEWSHARP_REQUIRED_VERSION: $enable_gtksourceviewsharp"

Modified: trunk/MonoDevelop/src/Main/Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Makefile.am	2004-03-02 21:37:13 UTC (rev 1082)
+++ trunk/MonoDevelop/src/Main/Base/Makefile.am	2004-03-03 00:43:33 UTC (rev 1083)
@@ -179,6 +179,7 @@
 ./Services/AmbienceService/CodeDOMGeneratorUtility.cs \
 ./Services/AmbienceService/NetAmbience.cs \
 ./Services/AmbienceService/IAmbience.cs \
+./Services/DebuggingService.cs \
 ./Services/Project/ProjectEventArgs.cs \
 ./Services/Project/IProjectService.cs \
 ./Services/Project/ProjectRenameEventArgs.cs \
@@ -371,6 +372,7 @@
 		/r:../../../build/bin/gtkmozembed-sharp.dll \
 		/r:glade-sharp \
 		/r:gnome-sharp \
+		/r:Mono.Debugger \
 		$(FILES) \
 	&& cp $(DLL) ../../../build/bin/.
 

Added: trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs	2004-03-02 21:37:13 UTC (rev 1082)
+++ trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs	2004-03-03 00:43:33 UTC (rev 1083)
@@ -0,0 +1,150 @@
+// DebuggingService.cs - Debugging service frontend for MonoDebugger
+//
+//  Author: Mike Kestner <mkesner at ximian.com>
+//
+// Copyright (c) 2004 Novell, Inc.
+
+using System;
+using System.Collections;
+
+using ICSharpCode.Core.Services;
+using ICSharpCode.Core.AddIns;
+
+using Mono.Debugger;
+
+namespace MonoDevelop.Services
+{
+
+	public class DebuggingService : AbstractService
+	{
+		Process proc;
+		Hashtable breakpoints = new Hashtable ();
+		DebuggerBackend backend;
+
+		public DebuggingService()
+		{
+		}
+		
+		private bool Debugging {
+			get {
+				return backend != null && proc != null && proc.HasTarget;
+			}
+		}
+
+		private bool IsRunning {
+			get {
+				return Debugging && !proc.IsStopped;
+			}
+		}
+
+		private Breakpoint CreateBreakpoint (string name)
+		{
+			SimpleBreakpoint point = new SimpleBreakpoint (name, null);
+			point.BreakpointHitEvent += new BreakpointEventHandler (OnBreakpointHit);
+			return point;
+		}
+
+		public bool AddBreakpoint (string filename, int linenum)
+		{
+			string key = filename + ":" + linenum;
+			BreakpointHandle brkptnum = null;
+			if (Debugging) {
+				Breakpoint point = CreateBreakpoint (key);
+				SourceLocation loc = backend.FindLocation(filename, linenum);
+				if (loc == null)
+					return false;
+				brkptnum = loc.InsertBreakpoint (proc, point);
+			}
+
+			breakpoints.Add (key, brkptnum);
+			return true;
+		}
+
+		public void RemoveBreakpoint (string filename, int linenum)
+		{
+			string key = filename + ":" + linenum;
+			if (Debugging)
+				((BreakpointHandle)breakpoints [key]).RemoveBreakpoint (proc);
+
+			breakpoints.Remove (key);
+		}
+
+		public void ToggleRunning ()
+		{
+			if (!Debugging)
+				return;
+
+			if (proc.IsStopped)
+				proc.Continue (false);
+			else
+				proc.Stop ();
+		}
+
+		public void Run (string[] argv)
+		{
+			backend = new DebuggerBackend ();
+			foreach (string key in breakpoints.Keys) {
+				Breakpoint point = CreateBreakpoint (key);
+				string[] toks = point.Name.Split (':');
+				string filename = toks [0];
+				int linenumber = Int32.Parse (toks [1]);
+				SourceLocation loc = backend.FindLocation(filename, linenumber);
+				if (loc == null)
+					return;
+				breakpoints [key] = loc.InsertBreakpoint (proc, point);
+			}
+			proc = backend.Run (ProcessStart.Create (null, argv));
+		}
+
+		public void Stop ()
+		{
+			if (!Debugging)
+				return;
+
+			proc.Kill ();
+			proc = null;
+			backend = null;
+		}
+
+		private void OnBreakpointHit (Breakpoint point)
+		{
+			if (this.BreakpointHit == null) 
+				return;
+
+			string[] toks = point.Name.Split (':');
+			string filename = toks [0];
+			int linenumber = Int32.Parse (toks [1]);
+
+			BreakpointHitArgs args = new BreakpointHitArgs (filename, linenumber);
+			this.BreakpointHit (this, args);
+		}
+
+		public event DebuggingService.BreakpointHitHandler BreakpointHit;
+
+		public delegate void BreakpointHitHandler (object o, BreakpointHitArgs args);
+
+		public class BreakpointHitArgs : EventArgs {
+
+			string filename;
+			int linenumber;
+
+			public BreakpointHitArgs (string filename, int linenumber)
+			{
+				this.filename = filename;
+				this.linenumber = linenumber;
+			}
+
+			public string Filename {
+				get {
+					return filename;
+				}
+			}
+
+			public int LineNumber {
+				get {
+					return linenumber;
+				}
+			}
+		}
+	}
+}




More information about the Monodevelop-patches-list mailing list