[Monodevelop-patches-list] r1207 - in trunk/MonoDevelop: . build/AddIns src/AddIns src/AddIns/BackendBindings/CSharpBinding src/AddIns/DebuggerAddIn src/AddIns/DebuggerAddIn/Gui src/AddIns/DisplayBindings/SourceEditor src/AddIns/DisplayBindings/SourceEditor/Gui src/AddIns/DisplayBindings/SourceEditor/Gui/Pads src/Libraries/MonoDevelop.Core/AddIns src/Main/Base src/Main/Base/Commands src/Main/Base/Gui/CompletionDatabaseWizard src/Main/Base/Gui/Workbench src/Main/Base/Services
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sat Mar 20 19:57:47 EST 2004
Author: tberman
Date: 2004-03-20 19:57:47 -0500 (Sat, 20 Mar 2004)
New Revision: 1207
Added:
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/DebuggingService.cs
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Gui/
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Gui/DebuggerLocalsPad.cs
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Makefile.am
trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin
trunk/MonoDevelop/src/Main/Base/Services/IDebuggerService.cs
Removed:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs
trunk/MonoDevelop/src/Main/Base/Commands/DebuggerCommands.cs
trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs
Modified:
trunk/MonoDevelop/build/AddIns/
trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin
trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin
trunk/MonoDevelop/configure.in
trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
trunk/MonoDevelop/src/AddIns/Makefile.am
trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs
trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs
trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs
trunk/MonoDevelop/src/Main/Base/Makefile.am
Log:
move debugger to an optional depend.
build file needs some jluke style rough love.
Property changes on: trunk/MonoDevelop/build/AddIns
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
+ Makefile
Makefile.in
MonoDevelop.Debugger.dll
MonoDevelopDebugger.addin
Modified: trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin
===================================================================
--- trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin 2004-03-21 00:57:47 UTC (rev 1207)
@@ -52,8 +52,6 @@
<Extension path = "/SharpDevelop/Workbench/Views">
<Class id = "CompilerMessageView"
class = "MonoDevelop.EditorBindings.Gui.Pads.CompilerMessageView"/>
- <Class id = "DebuggerLocalsPad"
- class = "MonoDevelop.SourceEditor.Gui.DebuggerLocalsPad"/>
</Extension>
<Extension path = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu">
Modified: trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin
===================================================================
--- trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin 2004-03-21 00:57:47 UTC (rev 1207)
@@ -30,8 +30,6 @@
</Extension>
<Extension path = "/Workspace/Services">
- <Class id = "DebuggingService"
- class = "MonoDevelop.Services.DebuggingService"/>
<Class id = "MonodocService"
class = "MonoDevelop.Services.MonodocService"/>
<Class id = "ProjectService"
@@ -796,38 +794,8 @@
shortcut = "F5"
class = "MonoDevelop.Commands.RunCommand"/>
- <MenuItem id = "DebugProject"
- label = "Debug Project"
- shortcut = "Control|F5"
- class = "MonoDevelop.Commands.DebugProject"/>
</Conditional>
</MenuItem>
-
- <MenuItem id = "DebugMenu"
- label = "Debug">
-
- <MenuItem id = "ToggleRunning"
- label = "Pause/Resume"
- shortcut = "Control|F8"
- class = "MonoDevelop.Commands.ToggleRunning"/>
-
- <MenuItem id = "DebugKillApplication"
- label = "Kill Application"
- class = "MonoDevelop.Commands.KillApplication"/>
-
- <MenuItem id = "DebugSep1" label = "-" />
-
- <MenuItem id = "DebugStepOver"
- label = "Step Over"
- shortcut = "F11"
- class = "MonoDevelop.Commands.StepOver"/>
-
- <MenuItem id = "DebugStepInto"
- label = "Step Into"
- shortcut = "Control|F11"
- class = "MonoDevelop.Commands.StepInto"/>
-
- </MenuItem>
<MenuItem id = "Tools"
label = "${res:XML.MainMenu.ToolMenu}">
Modified: trunk/MonoDevelop/configure.in
===================================================================
--- trunk/MonoDevelop/configure.in 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/configure.in 2004-03-21 00:57:47 UTC (rev 1207)
@@ -93,6 +93,8 @@
gnome_prefix="`$PKG_CONFIG --variable=prefix libgnome-2.0`"
AC_SUBST(gnome_prefix)
+AM_CONDITIONAL(ENABLE_DEBUGGER, test "x$enable_debugger" = "xyes")
+
AC_OUTPUT([
Makefile
gdldock/Makefile
@@ -108,6 +110,7 @@
src/AddIns/DisplayBindings/SourceEditor/Makefile
src/AddIns/Misc/Makefile
src/AddIns/Misc/StartPage/Makefile
+src/AddIns/DebuggerAddIn/Makefile
src/Main/Makefile
src/Main/Base/Makefile
src/Main/StartUp/Makefile
Modified: trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -33,8 +33,9 @@
string directory = fileUtilityService.GetDirectoryNameWithSeparator(((CSharpCompilerParameters)project.ActiveConfiguration).OutputDirectory);
string exe = ((CSharpCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
- DebuggingService dbgr = (DebuggingService) ServiceManager.Services.GetService (typeof (DebuggingService));
- dbgr.Run (new string[] { Path.Combine (directory, exe) } );
+ IDebuggingService dbgr = (IDebuggingService) ServiceManager.Services.GetService (typeof (IDebuggingService));
+ if (dbgr != null)
+ dbgr.Run (new string[] { Path.Combine (directory, exe) } );
}
public void Execute(string filename)
Property changes on: trunk/MonoDevelop/src/AddIns/DebuggerAddIn
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
MonoDevelop.Debugger.dll
Copied: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/DebuggerCommands.cs (from rev 1202, trunk/MonoDevelop/src/Main/Base/Commands/DebuggerCommands.cs)
Copied: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/DebuggingService.cs (from rev 1202, trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs)
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs 2004-03-20 06:48:50 UTC (rev 1202)
+++ trunk/MonoDevelop/src/AddIns/DebuggerAddIn/DebuggingService.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -0,0 +1,350 @@
+// 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 MonoDevelop.Core.Services;
+using MonoDevelop.Core.AddIns;
+
+using MonoDevelop.Services;
+using MonoDevelop.Gui;
+
+using Mono.Debugger;
+
+/*
+ * Some places we should be doing some error handling we used to toss
+ * exceptions, now we error out silently, this needs a real solution.
+ */
+
+namespace MonoDevelop.Services
+{
+
+ public class DebuggingService : AbstractService, IDebuggingService
+ {
+ Process proc;
+ Hashtable breakpoints = new Hashtable ();
+ DebuggerBackend backend;
+ Breakpoint point;
+
+ public DebuggingService()
+ {
+ DebuggerBackend.Initialize ();
+ }
+
+ void Cleanup ()
+ {
+ if (!Debugging)
+ return;
+
+ if (StoppedEvent != null)
+ StoppedEvent (this, new EventArgs ());
+ backend.Dispose ();
+ backend = null;
+ proc = null;
+ }
+
+ public override void UnloadService ()
+ {
+ Cleanup ();
+ base.UnloadService ();
+ }
+
+ private bool Debugging {
+ get {
+ return backend != null && proc != null && proc.HasTarget;
+ }
+ }
+
+ public 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 bool ToggleBreakpoint (string filename, int linenum)
+ {
+ if (!breakpoints.ContainsKey (filename + ":" + linenum))
+ return AddBreakpoint (filename, linenum);
+ else
+ RemoveBreakpoint (filename, linenum);
+ return true;
+ }
+
+ private void initialized_event (ThreadManager manager, Process process)
+ {
+ this.proc = process;
+
+ proc.TargetEvent += new TargetEventHandler (target_event);
+
+ Gtk.Timeout.Add (1, new Gtk.Function (EmitStarted));
+ }
+
+ 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));
+ break;
+ case TargetEventType.TargetStopped:
+ case TargetEventType.TargetRunning:
+ Gtk.Timeout.Add (1, new Gtk.Function (ChangeState));
+ break;
+ case TargetEventType.TargetHitBreakpoint:
+ default:
+ break;
+ }
+ }
+
+ void insert_breakpoints ()
+ {
+ string[] keys = new string [breakpoints.Keys.Count];
+ breakpoints.Keys.CopyTo (keys, 0);
+ foreach (string key in 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) {
+ Console.WriteLine ("Couldn't find breakpoint location " + key + " " + backend.Modules.Length);
+ return;
+ }
+ breakpoints [key] = loc.InsertBreakpoint (proc, point);
+ if (breakpoints [key] == null)
+ //throw new Exception ("Couldn't insert breakpoint " + key);
+ return;
+ }
+ }
+
+ bool EmitStarted ()
+ {
+ insert_breakpoints ();
+
+ proc.Continue (false);
+
+ if (StartedEvent != null)
+ StartedEvent (this, new EventArgs ());
+
+ return false;
+ }
+
+ bool ChangeState ()
+ {
+ if (IsRunning) {
+ if (ResumedEvent != null) {
+ ResumedEvent (this, new EventArgs ());
+ }
+ } else if (PausedEvent != null) {
+ PausedEvent (this, new EventArgs ());
+ }
+ return false;
+ }
+
+ public event EventHandler PausedEvent;
+ public event EventHandler ResumedEvent;
+ public event EventHandler StartedEvent;
+ public event EventHandler StoppedEvent;
+
+ bool KillApplication ()
+ {
+ Cleanup ();
+ return false;
+ }
+
+ public void Pause ()
+ {
+ if (!Debugging)
+ //throw new Exception ("Debugger not running.");
+ return;
+
+ if (proc.IsStopped)
+ return;
+
+ proc.Stop ();
+ }
+
+ public void Resume ()
+ {
+ if (!Debugging)
+ //throw new Exception ("Debugger not running.");
+ return;
+
+ if (!proc.IsStopped)
+ return;
+
+ proc.Continue (false);
+ }
+
+ public void Run (string[] argv)
+ {
+ if (Debugging)
+ return;
+
+ backend = new DebuggerBackend ();
+ backend.ThreadManager.InitializedEvent += new ThreadEventHandler (initialized_event);
+ backend.Run (ProcessStart.Create (null, argv));
+ }
+
+ public void Stop ()
+ {
+ Cleanup ();
+ }
+
+ public void StepInto ()
+ {
+ if (!Debugging)
+ //throw new Exception ("Can't step without running debugger.");
+ return;
+
+ if (IsRunning)
+ //throw new Exception ("Can't step unless paused.");
+ return;
+
+ proc.StepLine (false);
+ }
+
+ public void StepOver ()
+ {
+ if (!Debugging)
+ //throw new Exception ("Can't step without running debugger.");
+ return;
+
+ if (IsRunning)
+ //throw new Exception ("Can't step unless paused.");
+ return;
+
+ proc.NextLine (false);
+ }
+
+ public string[] Backtrace {
+ get {
+ Backtrace trace = proc.GetBacktrace ();
+ string[] result = new string [trace.Length];
+ int i = 0;
+ foreach (StackFrame frame in trace.Frames)
+ result [i++] = frame.SourceAddress.Name;
+
+ return result;
+ }
+ }
+
+ public object CurrentFrame {
+ get {
+ if (IsRunning)
+ return null;
+ return proc.CurrentFrame;
+ }
+ }
+
+ public string CurrentFilename {
+ get {
+ if (IsRunning)
+ return String.Empty;
+
+ if (proc.CurrentFrame.SourceAddress.MethodSource.IsDynamic)
+ return String.Empty;
+
+ return proc.CurrentFrame.SourceAddress.MethodSource.SourceFile.FileName;
+ }
+ }
+
+ public int CurrentLineNumber {
+ get {
+ if (IsRunning)
+ return -1;
+
+ return proc.CurrentFrame.SourceAddress.Row;
+ }
+ }
+
+ public string LookupValue (string expr)
+ {
+ return "";
+ }
+
+ private void OnBreakpointHit (Breakpoint pointFromDbg, StackFrame frame)
+ {
+ point = pointFromDbg;
+ Gtk.Timeout.Add (1, new Gtk.Function (MainThreadNotify));
+ }
+
+ bool MainThreadNotify ()
+ {
+ string[] toks = point.Name.Split (':');
+ string filename = toks [0];
+ int linenumber = Int32.Parse (toks [1]);
+
+ if (this.BreakpointHit == null)
+ return false;
+
+ BreakpointHitArgs args = new BreakpointHitArgs (filename, linenumber);
+ BreakpointHit (this, args);
+ return false;
+ }
+
+ 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;
+ }
+ }
+ }
+ }
+}
Copied: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Gui/DebuggerLocalsPad.cs (from rev 1202, trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs)
Copied: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs (from rev 1202, trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs)
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs 2004-03-20 06:48:50 UTC (rev 1202)
+++ trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Gui/DebuggerVariablePad.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -0,0 +1,287 @@
+using GLib;
+using Gtk;
+using GtkSharp;
+using System;
+using System.IO;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using Mono.Debugger;
+using Mono.Debugger.Languages;
+
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public class DebuggerVariablePad : Gtk.ScrolledWindow
+ {
+ StackFrame current_frame;
+
+ Gtk.TreeView tree;
+ Gtk.TreeStore store;
+ bool is_locals_display;
+
+ public DebuggerVariablePad (bool is_locals_display)
+ {
+ this.ShadowType = ShadowType.In;
+
+ this.is_locals_display = is_locals_display;
+
+ store = new TreeStore (typeof (string),
+ typeof (string),
+ typeof (string));
+
+ tree = new TreeView (store);
+ tree.RulesHint = true;
+ tree.HeadersVisible = true;
+
+ TreeViewColumn NameCol = new TreeViewColumn ();
+ CellRenderer NameRenderer = new CellRendererText ();
+ NameCol.Title = "Name";
+ NameCol.PackStart (NameRenderer, true);
+ NameCol.AddAttribute (NameRenderer, "text", 0);
+ NameCol.Resizable = true;
+ NameCol.Alignment = 0.0f;
+ tree.AppendColumn (NameCol);
+
+ TreeViewColumn TypeCol = new TreeViewColumn ();
+ CellRenderer TypeRenderer = new CellRendererText ();
+ TypeCol.Title = "Type";
+ TypeCol.PackStart (TypeRenderer, true);
+ TypeCol.AddAttribute (TypeRenderer, "text", 1);
+ TypeCol.Resizable = true;
+ NameCol.Alignment = 0.0f;
+ tree.AppendColumn (TypeCol);
+
+ TreeViewColumn ValueCol = new TreeViewColumn ();
+ CellRenderer ValueRenderer = new CellRendererText ();
+ ValueCol.Title = "Value";
+ ValueCol.PackStart (ValueRenderer, true);
+ ValueCol.AddAttribute (ValueRenderer, "text", 2);
+ ValueCol.Resizable = true;
+ NameCol.Alignment = 0.0f;
+ tree.AppendColumn (ValueCol);
+
+ tree.TestExpandRow += new TestExpandRowHandler (test_expand_row);
+
+ Add (tree);
+ ShowAll ();
+
+ DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
+ dbgr.PausedEvent += new EventHandler (OnPausedEvent);
+ dbgr.ResumedEvent += new EventHandler (OnResumedEvent);
+ dbgr.StoppedEvent += new EventHandler (OnStoppedEvent);
+ }
+
+ bool add_array (TreeIter parent, ITargetArrayObject array)
+ {
+ bool inserted = false;
+
+ for (int i = array.LowerBound; i < array.UpperBound; i++) {
+ ITargetObject elt = array [i];
+ if (elt == null)
+ continue;
+
+ TreeIter iter = store.Append (parent);
+ add_object (elt, i.ToString (), iter);
+ inserted = true;
+ }
+
+ return inserted;
+ }
+
+ bool add_struct (TreeIter parent, ITargetStructObject sobj)
+ {
+ bool inserted = false;
+
+ foreach (ITargetFieldInfo field in sobj.Type.Fields) {
+ TreeIter iter = store.Append (parent);
+ add_object (sobj.GetField (field.Index), field.Name, iter);
+ inserted = true;
+ }
+
+ return inserted;
+ }
+
+ bool add_class (TreeIter parent, ITargetClassObject sobj)
+ {
+ bool inserted = false;
+
+ if (sobj.Type.HasParent) {
+ TreeIter iter = store.Append (parent);
+ add_object (sobj.Parent, "<parent>", iter);
+ inserted = true;
+ }
+
+ if (add_struct (parent, sobj))
+ inserted = true;
+
+ return inserted;
+ }
+
+ void add_message (TreeIter parent, string message)
+ {
+ TreeIter child;
+ if (store.IterChildren (out child, parent)) {
+ while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
+ store.Remove (ref child);
+ }
+
+ TreeIter iter = store.Append (parent);
+ store.SetValue (iter, 2, new GLib.Value (message));
+ }
+
+ void test_expand_row (object o, TestExpandRowArgs args)
+ {
+ bool inserted = false;
+
+ ITargetObject obj = (ITargetObject) iters [args.Iter];
+
+ TreeIter child;
+ if (store.IterChildren (out child, args.Iter)) {
+ while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
+ store.Remove (ref child);
+ }
+
+ if (obj == null) {
+ child = store.Append (args.Iter);
+ return;
+ }
+
+ switch (obj.Type.Kind) {
+ case TargetObjectKind.Array:
+ ITargetArrayObject array = (ITargetArrayObject) obj;
+ try {
+ inserted = add_array (args.Iter, array);
+ } catch {
+ add_message (args.Iter, "<can't display array>");
+ inserted = true;
+ }
+ if (!inserted)
+ add_message (args.Iter, "<empty array>");
+ break;
+
+ case TargetObjectKind.Class:
+ ITargetClassObject cobj = (ITargetClassObject) obj;
+ try {
+ inserted = add_class (args.Iter, cobj);
+ } catch {
+ add_message (args.Iter, "<can't display class>");
+ inserted = true;
+ }
+ if (!inserted)
+ add_message (args.Iter, "<empty class>");
+ break;
+
+ case TargetObjectKind.Struct:
+ ITargetStructObject sobj = (ITargetStructObject) obj;
+ try {
+ inserted = add_struct (args.Iter, sobj);
+ } catch {
+ add_message (args.Iter, "<can't display struct>");
+ inserted = true;
+ }
+ if (!inserted)
+ add_message (args.Iter, "<empty struct>");
+ break;
+
+ default:
+ add_message (args.Iter, "<unknown object>");
+ break;
+ }
+ }
+
+ void add_data (ITargetObject obj, TreeIter parent)
+ {
+ TreeIter iter = store.Append (parent);
+ iters.Add (parent, obj);
+ }
+
+ void add_object (ITargetObject obj, string name, TreeIter iter)
+ {
+ store.SetValue (iter, 0, new GLib.Value (name));
+ store.SetValue (iter, 1, new GLib.Value (obj.Type.Name));
+
+ switch (obj.Type.Kind) {
+ case TargetObjectKind.Fundamental:
+ object contents = ((ITargetFundamentalObject) obj).Object;
+ store.SetValue (iter, 2, new GLib.Value (contents.ToString ()));
+ break;
+
+ case TargetObjectKind.Array:
+ case TargetObjectKind.Struct:
+ case TargetObjectKind.Class:
+ add_data (obj, iter);
+ break;
+ }
+ }
+
+ void add_variable (IVariable variable)
+ {
+ if (!variable.IsAlive (current_frame.TargetAddress))
+ return;
+
+ TreeIter iter;
+ store.Append (out iter);
+
+ try {
+ ITargetObject obj = variable.GetObject (current_frame);
+ add_object (obj, variable.Name, iter);
+ } catch (LocationInvalidException) {
+ // Do nothing
+ } catch (Exception e) {
+ Console.WriteLine ("CAN'T ADD VARIABLE: {0} {1}", variable, e);
+ }
+ }
+
+ Hashtable iters = null;
+
+ public void CleanDisplay ()
+ {
+ store.Clear ();
+ iters = new Hashtable ();
+ }
+
+ public void UpdateDisplay ()
+ {
+ CleanDisplay ();
+
+ if ((current_frame == null) || (current_frame.Method == null))
+ return;
+
+ try {
+ if (is_locals_display) {
+ IVariable[] local_vars = current_frame.Method.Locals;
+ foreach (IVariable var in local_vars)
+ add_variable (var);
+ } else {
+ IVariable[] param_vars = current_frame.Method.Parameters;
+ foreach (IVariable var in param_vars)
+ add_variable (var);
+ }
+ } catch (Exception e) {
+ Console.WriteLine ("CAN'T GET VARIABLES: {0}", e);
+ store.Clear ();
+ iters = new Hashtable ();
+ }
+ }
+
+ protected void OnStoppedEvent (object o, EventArgs args)
+ {
+ CleanDisplay ();
+ }
+
+ protected void OnResumedEvent (object o, EventArgs args)
+ {
+ CleanDisplay ();
+ }
+
+ protected void OnPausedEvent (object o, EventArgs args)
+ {
+ DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
+ current_frame = (StackFrame)dbgr.CurrentFrame;
+ UpdateDisplay ();
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Makefile.am 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/DebuggerAddIn/Makefile.am 2004-03-21 00:57:47 UTC (rev 1207)
@@ -0,0 +1,28 @@
+if ENABLE_DEBUGGER
+
+all: $(DLL)
+
+DLL = MonoDevelop.Debugger.dll
+
+FILES = \
+DebuggerCommands.cs \
+DebuggingService.cs \
+Gui/DebuggerLocalsPad.cs \
+Gui/DebuggerVariablePad.cs
+
+build_sources = $(addprefix $(srcdir)/, $(FILES))
+
+../../../build/AddIns/MonoDevelopDebugger.addin:
+ cp MonoDevelopDebugger.addin ../../../build/AddIns/
+
+MonoDevelop.Debugger.dll: $(build_sources) ../../../build/AddIns/MonoDevelopDebugger.addin
+ mcs /out:$(DLL) /target:library \
+ /r:gtk-sharp \
+ /r:glib-sharp \
+ /r:$(debugger_prefix)/lib/Mono.Debugger.dll \
+ /r:../../../build/bin/MonoDevelop.Base.dll \
+ /r:../../../build/bin/MonoDevelop.Core.dll \
+ $(build_sources) \
+ && cp $(DLL) ../../../build/AddIns/
+else
+endif
Added: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin
===================================================================
--- trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin 2004-03-21 00:57:47 UTC (rev 1207)
@@ -0,0 +1,52 @@
+<AddIn name = "MonoDevelop Debugger"
+ author = "Todd Berman"
+ copyright = "GPL"
+ url = ""
+ description = ""
+ version = "0.2">
+
+ <Runtime>
+ <Import assembly="MonoDevelop.Debugger.dll"/>
+ </Runtime>
+
+ <Extension path="/Workspace/Services">
+ <Class id = "DebuggingService"
+ class = "MonoDevelop.Services.DebuggingService"/>
+ </Extension>
+
+ <Extension path="/SharpDevelop/Workbench/Views">
+ <Class id = "DebuggerLocalsPad"
+ class = "MonoDevelop.SourceEditor.Gui.DebuggerLocalsPad"/>
+ </Extension>
+
+ <Extension path="/SharpDevelop/Workbench/MainMenu">
+ <MenuItem id = "DebugMenuThing" label = "Debug" insertafter = "View" insertbefore = "Tools">
+ <MenuItem id = "DebugProject"
+ label = "Debug Project"
+ shortcut = "Control|F5"
+ class = "MonoDevelop.Commands.DebugProject"/>
+
+ <MenuItem id = "ToggleRunning"
+ label = "Pause/Resume"
+ shortcut = "Control|F8"
+ class = "MonoDevelop.Commands.ToggleRunning"/>
+
+ <MenuItem id = "DebugKillApplication"
+ label = "Kill Application"
+ class = "MonoDevelop.Commands.KillApplication"/>
+
+ <MenuItem id = "DebugSep1" label = "-" />
+
+ <MenuItem id = "DebugStepOver"
+ label = "Step Over"
+ shortcut = "F11"
+ class = "MonoDevelop.Commands.StepOver"/>
+
+ <MenuItem id = "DebugStepInto"
+ label = "Step Into"
+ shortcut = "Control|F11"
+ class = "MonoDevelop.Commands.StepInto"/>
+ </MenuItem>
+ </Extension>
+</AddIn>
+
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -1,57 +0,0 @@
-using System;
-using MonoDevelop.Gui;
-
-namespace MonoDevelop.SourceEditor.Gui
-{
- public class DebuggerLocalsPad : DebuggerVariablePad, IPadContent
- {
-
- public DebuggerLocalsPad () : base (true)
- {
- }
-
- public Gtk.Widget Control {
- get {
- return this;
- }
- }
-
- public string Title {
- get {
- return "Locals";
- }
- }
-
- public string Icon {
- get {
- return MonoDevelop.Gui.Stock.OutputIcon;
- }
- }
-
- public void RedrawContent ()
- {
- UpdateDisplay ();
- }
-
- public void BringToFront ()
- {
- }
-
- protected virtual void OnTitleChanged(EventArgs e)
- {
- if (TitleChanged != null) {
- TitleChanged(this, e);
- }
- }
- protected virtual void OnIconChanged(EventArgs e)
- {
- if (IconChanged != null) {
- IconChanged(this, e);
- }
- }
- public event EventHandler TitleChanged;
- public event EventHandler IconChanged;
-
-
- }
-}
Deleted: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -1,287 +0,0 @@
-using GLib;
-using Gtk;
-using GtkSharp;
-using System;
-using System.IO;
-using System.Collections;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using Mono.Debugger;
-using Mono.Debugger.Languages;
-
-using MonoDevelop.Core.Services;
-using MonoDevelop.Services;
-
-namespace MonoDevelop.SourceEditor.Gui
-{
- public class DebuggerVariablePad : Gtk.ScrolledWindow
- {
- StackFrame current_frame;
-
- Gtk.TreeView tree;
- Gtk.TreeStore store;
- bool is_locals_display;
-
- public DebuggerVariablePad (bool is_locals_display)
- {
- this.ShadowType = ShadowType.In;
-
- this.is_locals_display = is_locals_display;
-
- store = new TreeStore (typeof (string),
- typeof (string),
- typeof (string));
-
- tree = new TreeView (store);
- tree.RulesHint = true;
- tree.HeadersVisible = true;
-
- TreeViewColumn NameCol = new TreeViewColumn ();
- CellRenderer NameRenderer = new CellRendererText ();
- NameCol.Title = "Name";
- NameCol.PackStart (NameRenderer, true);
- NameCol.AddAttribute (NameRenderer, "text", 0);
- NameCol.Resizable = true;
- NameCol.Alignment = 0.0f;
- tree.AppendColumn (NameCol);
-
- TreeViewColumn TypeCol = new TreeViewColumn ();
- CellRenderer TypeRenderer = new CellRendererText ();
- TypeCol.Title = "Type";
- TypeCol.PackStart (TypeRenderer, true);
- TypeCol.AddAttribute (TypeRenderer, "text", 1);
- TypeCol.Resizable = true;
- NameCol.Alignment = 0.0f;
- tree.AppendColumn (TypeCol);
-
- TreeViewColumn ValueCol = new TreeViewColumn ();
- CellRenderer ValueRenderer = new CellRendererText ();
- ValueCol.Title = "Value";
- ValueCol.PackStart (ValueRenderer, true);
- ValueCol.AddAttribute (ValueRenderer, "text", 2);
- ValueCol.Resizable = true;
- NameCol.Alignment = 0.0f;
- tree.AppendColumn (ValueCol);
-
- tree.TestExpandRow += new TestExpandRowHandler (test_expand_row);
-
- Add (tree);
- ShowAll ();
-
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
- dbgr.PausedEvent += new EventHandler (OnPausedEvent);
- dbgr.ResumedEvent += new EventHandler (OnResumedEvent);
- dbgr.StoppedEvent += new EventHandler (OnStoppedEvent);
- }
-
- bool add_array (TreeIter parent, ITargetArrayObject array)
- {
- bool inserted = false;
-
- for (int i = array.LowerBound; i < array.UpperBound; i++) {
- ITargetObject elt = array [i];
- if (elt == null)
- continue;
-
- TreeIter iter = store.Append (parent);
- add_object (elt, i.ToString (), iter);
- inserted = true;
- }
-
- return inserted;
- }
-
- bool add_struct (TreeIter parent, ITargetStructObject sobj)
- {
- bool inserted = false;
-
- foreach (ITargetFieldInfo field in sobj.Type.Fields) {
- TreeIter iter = store.Append (parent);
- add_object (sobj.GetField (field.Index), field.Name, iter);
- inserted = true;
- }
-
- return inserted;
- }
-
- bool add_class (TreeIter parent, ITargetClassObject sobj)
- {
- bool inserted = false;
-
- if (sobj.Type.HasParent) {
- TreeIter iter = store.Append (parent);
- add_object (sobj.Parent, "<parent>", iter);
- inserted = true;
- }
-
- if (add_struct (parent, sobj))
- inserted = true;
-
- return inserted;
- }
-
- void add_message (TreeIter parent, string message)
- {
- TreeIter child;
- if (store.IterChildren (out child, parent)) {
- while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
- store.Remove (ref child);
- }
-
- TreeIter iter = store.Append (parent);
- store.SetValue (iter, 2, new GLib.Value (message));
- }
-
- void test_expand_row (object o, TestExpandRowArgs args)
- {
- bool inserted = false;
-
- ITargetObject obj = (ITargetObject) iters [args.Iter];
-
- TreeIter child;
- if (store.IterChildren (out child, args.Iter)) {
- while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
- store.Remove (ref child);
- }
-
- if (obj == null) {
- child = store.Append (args.Iter);
- return;
- }
-
- switch (obj.Type.Kind) {
- case TargetObjectKind.Array:
- ITargetArrayObject array = (ITargetArrayObject) obj;
- try {
- inserted = add_array (args.Iter, array);
- } catch {
- add_message (args.Iter, "<can't display array>");
- inserted = true;
- }
- if (!inserted)
- add_message (args.Iter, "<empty array>");
- break;
-
- case TargetObjectKind.Class:
- ITargetClassObject cobj = (ITargetClassObject) obj;
- try {
- inserted = add_class (args.Iter, cobj);
- } catch {
- add_message (args.Iter, "<can't display class>");
- inserted = true;
- }
- if (!inserted)
- add_message (args.Iter, "<empty class>");
- break;
-
- case TargetObjectKind.Struct:
- ITargetStructObject sobj = (ITargetStructObject) obj;
- try {
- inserted = add_struct (args.Iter, sobj);
- } catch {
- add_message (args.Iter, "<can't display struct>");
- inserted = true;
- }
- if (!inserted)
- add_message (args.Iter, "<empty struct>");
- break;
-
- default:
- add_message (args.Iter, "<unknown object>");
- break;
- }
- }
-
- void add_data (ITargetObject obj, TreeIter parent)
- {
- TreeIter iter = store.Append (parent);
- iters.Add (parent, obj);
- }
-
- void add_object (ITargetObject obj, string name, TreeIter iter)
- {
- store.SetValue (iter, 0, new GLib.Value (name));
- store.SetValue (iter, 1, new GLib.Value (obj.Type.Name));
-
- switch (obj.Type.Kind) {
- case TargetObjectKind.Fundamental:
- object contents = ((ITargetFundamentalObject) obj).Object;
- store.SetValue (iter, 2, new GLib.Value (contents.ToString ()));
- break;
-
- case TargetObjectKind.Array:
- case TargetObjectKind.Struct:
- case TargetObjectKind.Class:
- add_data (obj, iter);
- break;
- }
- }
-
- void add_variable (IVariable variable)
- {
- if (!variable.IsAlive (current_frame.TargetAddress))
- return;
-
- TreeIter iter;
- store.Append (out iter);
-
- try {
- ITargetObject obj = variable.GetObject (current_frame);
- add_object (obj, variable.Name, iter);
- } catch (LocationInvalidException) {
- // Do nothing
- } catch (Exception e) {
- Console.WriteLine ("CAN'T ADD VARIABLE: {0} {1}", variable, e);
- }
- }
-
- Hashtable iters = null;
-
- public void CleanDisplay ()
- {
- store.Clear ();
- iters = new Hashtable ();
- }
-
- public void UpdateDisplay ()
- {
- CleanDisplay ();
-
- if ((current_frame == null) || (current_frame.Method == null))
- return;
-
- try {
- if (is_locals_display) {
- IVariable[] local_vars = current_frame.Method.Locals;
- foreach (IVariable var in local_vars)
- add_variable (var);
- } else {
- IVariable[] param_vars = current_frame.Method.Parameters;
- foreach (IVariable var in param_vars)
- add_variable (var);
- }
- } catch (Exception e) {
- Console.WriteLine ("CAN'T GET VARIABLES: {0}", e);
- store.Clear ();
- iters = new Hashtable ();
- }
- }
-
- protected void OnStoppedEvent (object o, EventArgs args)
- {
- CleanDisplay ();
- }
-
- protected void OnResumedEvent (object o, EventArgs args)
- {
- CleanDisplay ();
- }
-
- protected void OnPausedEvent (object o, EventArgs args)
- {
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
- current_frame = dbgr.CurrentFrame;
- UpdateDisplay ();
- }
- }
-}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -94,11 +94,13 @@
public void breakpointToggled (object o, EventArgs e)
{
if (lineToMark == -1) return;
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
- bool canToggle = dbgr.ToggleBreakpoint (ParentEditor.DisplayBinding.ContentName, lineToMark + 1);
- if (canToggle)
- buf.ToggleMark (lineToMark, SourceMarkerType.BreakpointMark);
- lineToMark = -1;
+ IDebuggingService dbgr = (IDebuggingService)ServiceManager.Services.GetService (typeof (IDebuggingService));
+ if (dbgr != null) {
+ bool canToggle = dbgr.ToggleBreakpoint (ParentEditor.DisplayBinding.ContentName, lineToMark + 1);
+ if (canToggle)
+ buf.ToggleMark (lineToMark, SourceMarkerType.BreakpointMark);
+ lineToMark = -1;
+ }
}
public void ExecutingAt (int linenumber)
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2004-03-21 00:57:47 UTC (rev 1207)
@@ -15,8 +15,6 @@
./Gui/SourceEditorView.cs \
./Gui/SourceEditorDisplayBinding.cs \
./Gui/Pads/CompilerMessageView.cs \
-./Gui/Pads/DebuggerVariablePad.cs \
-./Gui/Pads/DebuggerLocalsPad.cs \
./Gui/OptionPanels/BehaviorTextEditorPanel.cs \
./Gui/OptionPanels/MarkersTextEditorPanel.cs \
./Gui/OptionPanels/CodeTemplatePanel.cs \
@@ -88,7 +86,6 @@
/r:pango-sharp /r:gnome-sharp /r:glade-sharp \
/r:gconf-sharp \
/r:System.Drawing \
- /r:Mono.Debugger \
&& cp $(DLL) ../../../../build/bin/.
assemblydir = $(libdir)/monodevelop/bin
Modified: trunk/MonoDevelop/src/AddIns/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/AddIns/Makefile.am 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/AddIns/Makefile.am 2004-03-21 00:57:47 UTC (rev 1207)
@@ -1 +1 @@
-SUBDIRS=DisplayBindings BackendBindings Misc
+SUBDIRS=DisplayBindings BackendBindings Misc DebuggerAddIn
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -86,6 +86,7 @@
if (ignoreDefaultCoreDirectory == false) {
addInFiles = fileUtilityService.SearchDirectory(defaultCoreDirectory, "*.addin");
+ foreach (string i in addInFiles) { Console.WriteLine (i); }
retryList = InsertAddIns(addInFiles);
}
else
Deleted: trunk/MonoDevelop/src/Main/Base/Commands/DebuggerCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/DebuggerCommands.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Main/Base/Commands/DebuggerCommands.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -1,77 +0,0 @@
-using System;
-
-using MonoDevelop.Core.AddIns.Codons;
-using MonoDevelop.Services;
-using MonoDevelop.Core.Services;
-
-namespace MonoDevelop.Commands
-{
-
- public class ToggleRunning : AbstractMenuCommand
- {
- public override void Run ()
- {
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
- if (dbgr.IsRunning)
- dbgr.Pause ();
- else
- dbgr.Resume ();
- }
- }
-
- public class KillApplication : AbstractMenuCommand
- {
- public override void Run ()
- {
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
-
- dbgr.Stop ();
- }
- }
-
- public class StepOver : AbstractMenuCommand
- {
- public override void Run ()
- {
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
-
- dbgr.StepOver ();
- }
- }
-
- public class StepInto : AbstractMenuCommand
- {
- public override void Run ()
- {
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
-
- dbgr.StepInto ();
- }
- }
-
- public class DebugProject : AbstractMenuCommand
- {
-
- public override void Run ()
- {
-
- IProjectService projServ = (IProjectService)ServiceManager.Services.GetService (typeof (IProjectService));
-
- if (projServ.CurrentOpenCombine != null) {
- //try {
- if (projServ.NeedsCompiling) {
- projServ.CompileCombine ();
- }
- projServ.OnBeforeStartProject ();
- projServ.CurrentOpenCombine.Debug ();
- //} catch {
- // IMessageService msgServ = (IMessageService)ServiceManager.Services.GetService (typeof (IMessageService));
- // msgServ.ShowError ("Can't execute the debugger");
- //}
- }
-
- }
-
- }
-
-}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -120,7 +120,7 @@
Console.WriteLine ("Attempting to restart MonoDevelop, if you get any exceptions, restart manually");
Console.WriteLine ("******************************************************************************");
// not everyone can run .exe's directly
- System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo ("mono", "./MonoDevelop.exe");
+ System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo ("mono", "MonoDevelop.exe");
System.Diagnostics.Process.Start (psi);
Gtk.Application.Quit ();
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -135,11 +135,13 @@
this.Icon = resourceService.GetBitmap ("Icons.SharpDevelopIcon");
this.WindowPosition = Gtk.WindowPosition.None;
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
- dbgr.StartedEvent += new EventHandler (onDebuggerStarted);
- dbgr.PausedEvent += new EventHandler (onDebuggerPaused);
- dbgr.ResumedEvent += new EventHandler (onDebuggerResumed);
- dbgr.StoppedEvent += new EventHandler (onDebuggerStopped);
+ IDebuggingService dbgr = (IDebuggingService)ServiceManager.Services.GetService (typeof (IDebuggingService));
+ if (dbgr != null) {
+ dbgr.StartedEvent += new EventHandler (onDebuggerStarted);
+ dbgr.PausedEvent += new EventHandler (onDebuggerPaused);
+ dbgr.ResumedEvent += new EventHandler (onDebuggerResumed);
+ dbgr.StoppedEvent += new EventHandler (onDebuggerStopped);
+ }
}
void onDebuggerStarted (object o, EventArgs e)
@@ -150,14 +152,16 @@
void onDebuggerPaused (object o, EventArgs e)
{
- DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
- cur_dbgFilename = dbgr.CurrentFilename;
- cur_dbgLineNumber = dbgr.CurrentLineNumber - 1;
+ IDebuggingService dbgr = (IDebuggingService)ServiceManager.Services.GetService (typeof (IDebuggingService));
+ if (dbgr != null) {
+ cur_dbgFilename = dbgr.CurrentFilename;
+ cur_dbgLineNumber = dbgr.CurrentLineNumber - 1;
- IFileService fs = (IFileService)ServiceManager.Services.GetService (typeof (IFileService));
- fs.OpenFile (cur_dbgFilename);
- if (ActiveWorkbenchWindow.ViewContent is IDebuggableEditor)
- ((IDebuggableEditor)ActiveWorkbenchWindow.ViewContent).ExecutingAt (cur_dbgLineNumber);
+ IFileService fs = (IFileService)ServiceManager.Services.GetService (typeof (IFileService));
+ fs.OpenFile (cur_dbgFilename);
+ if (ActiveWorkbenchWindow.ViewContent is IDebuggableEditor)
+ ((IDebuggableEditor)ActiveWorkbenchWindow.ViewContent).ExecutingAt (cur_dbgLineNumber);
+ }
}
void onDebuggerResumed (object o, EventArgs e)
Modified: trunk/MonoDevelop/src/Main/Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Makefile.am 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Main/Base/Makefile.am 2004-03-21 00:57:47 UTC (rev 1207)
@@ -11,8 +11,7 @@
/r:gtk-sharp /r:gdk-sharp /r:glib-sharp /r:pango-sharp \
/r:../../../build/bin/gtkmozembed-sharp.dll \
/r:../../../build/bin/gdl-sharp.dll \
- /r:glade-sharp /r:gnome-sharp /r:gtkhtml-sharp \
- /r:$(debugger_prefix)/lib/Mono.Debugger.dll
+ /r:glade-sharp /r:gnome-sharp /r:gtkhtml-sharp
FILES= \
./Gui/Pads/ProjectBrowser/ProjectBrowserView.cs \
@@ -175,7 +174,6 @@
./Commands/AutostartCommands.cs \
./Commands/ToolsCommands.cs \
./Commands/MenuItemBuilders.cs \
-./Commands/DebuggerCommands.cs \
./Services/File/IFileService.cs \
./Services/File/DefaultFileService.cs \
./Services/File/FileEventArgs.cs \
@@ -192,7 +190,6 @@
./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 \
@@ -217,6 +214,7 @@
./Services/MessageService.cs \
./Services/Toolbar/ToolbarService.cs \
./Services/MonodocService.cs \
+./Services/IDebuggerService.cs \
./Internal/Undo/IUndoableOperation.cs \
./Internal/Undo/UndoStack.cs \
./Internal/Undo/UndoQueue.cs \
Deleted: trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Main/Base/Services/DebuggingService.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -1,355 +0,0 @@
-// 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 MonoDevelop.Core.Services;
-using MonoDevelop.Core.AddIns;
-
-using MonoDevelop.Services;
-using MonoDevelop.Gui;
-
-using Mono.Debugger;
-
-/*
- * Some places we should be doing some error handling we used to toss
- * exceptions, now we error out silently, this needs a real solution.
- */
-
-namespace MonoDevelop.Services
-{
-
- public interface IDebuggableEditor {
- void ExecutingAt (int lineNumber);
- void ClearExecutingAt (int lineNumber);
- }
-
- public class DebuggingService : AbstractService
- {
- Process proc;
- Hashtable breakpoints = new Hashtable ();
- DebuggerBackend backend;
- Breakpoint point;
-
- public DebuggingService()
- {
- DebuggerBackend.Initialize ();
- }
-
- void Cleanup ()
- {
- if (!Debugging)
- return;
-
- if (StoppedEvent != null)
- StoppedEvent (this, new EventArgs ());
- backend.Dispose ();
- backend = null;
- proc = null;
- }
-
- public override void UnloadService ()
- {
- Cleanup ();
- base.UnloadService ();
- }
-
- private bool Debugging {
- get {
- return backend != null && proc != null && proc.HasTarget;
- }
- }
-
- public 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 bool ToggleBreakpoint (string filename, int linenum)
- {
- if (!breakpoints.ContainsKey (filename + ":" + linenum))
- return AddBreakpoint (filename, linenum);
- else
- RemoveBreakpoint (filename, linenum);
- return true;
- }
-
- private void initialized_event (ThreadManager manager, Process process)
- {
- this.proc = process;
-
- proc.TargetEvent += new TargetEventHandler (target_event);
-
- Gtk.Timeout.Add (1, new Gtk.Function (EmitStarted));
- }
-
- 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));
- break;
- case TargetEventType.TargetStopped:
- case TargetEventType.TargetRunning:
- Gtk.Timeout.Add (1, new Gtk.Function (ChangeState));
- break;
- case TargetEventType.TargetHitBreakpoint:
- default:
- break;
- }
- }
-
- void insert_breakpoints ()
- {
- string[] keys = new string [breakpoints.Keys.Count];
- breakpoints.Keys.CopyTo (keys, 0);
- foreach (string key in 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) {
- Console.WriteLine ("Couldn't find breakpoint location " + key + " " + backend.Modules.Length);
- return;
- }
- breakpoints [key] = loc.InsertBreakpoint (proc, point);
- if (breakpoints [key] == null)
- //throw new Exception ("Couldn't insert breakpoint " + key);
- return;
- }
- }
-
- bool EmitStarted ()
- {
- insert_breakpoints ();
-
- proc.Continue (false);
-
- if (StartedEvent != null)
- StartedEvent (this, new EventArgs ());
-
- return false;
- }
-
- bool ChangeState ()
- {
- if (IsRunning) {
- if (ResumedEvent != null) {
- ResumedEvent (this, new EventArgs ());
- }
- } else if (PausedEvent != null) {
- PausedEvent (this, new EventArgs ());
- }
- return false;
- }
-
- public event EventHandler PausedEvent;
- public event EventHandler ResumedEvent;
- public event EventHandler StartedEvent;
- public event EventHandler StoppedEvent;
-
- bool KillApplication ()
- {
- Cleanup ();
- return false;
- }
-
- public void Pause ()
- {
- if (!Debugging)
- //throw new Exception ("Debugger not running.");
- return;
-
- if (proc.IsStopped)
- return;
-
- proc.Stop ();
- }
-
- public void Resume ()
- {
- if (!Debugging)
- //throw new Exception ("Debugger not running.");
- return;
-
- if (!proc.IsStopped)
- return;
-
- proc.Continue (false);
- }
-
- public void Run (string[] argv)
- {
- if (Debugging)
- return;
-
- backend = new DebuggerBackend ();
- backend.ThreadManager.InitializedEvent += new ThreadEventHandler (initialized_event);
- backend.Run (ProcessStart.Create (null, argv));
- }
-
- public void Stop ()
- {
- Cleanup ();
- }
-
- public void StepInto ()
- {
- if (!Debugging)
- //throw new Exception ("Can't step without running debugger.");
- return;
-
- if (IsRunning)
- //throw new Exception ("Can't step unless paused.");
- return;
-
- proc.StepLine (false);
- }
-
- public void StepOver ()
- {
- if (!Debugging)
- //throw new Exception ("Can't step without running debugger.");
- return;
-
- if (IsRunning)
- //throw new Exception ("Can't step unless paused.");
- return;
-
- proc.NextLine (false);
- }
-
- public string[] Backtrace {
- get {
- Backtrace trace = proc.GetBacktrace ();
- string[] result = new string [trace.Length];
- int i = 0;
- foreach (StackFrame frame in trace.Frames)
- result [i++] = frame.SourceAddress.Name;
-
- return result;
- }
- }
-
- public StackFrame CurrentFrame {
- get {
- if (IsRunning)
- return null;
- return proc.CurrentFrame;
- }
- }
-
- public string CurrentFilename {
- get {
- if (IsRunning)
- return String.Empty;
-
- if (proc.CurrentFrame.SourceAddress.MethodSource.IsDynamic)
- return String.Empty;
-
- return proc.CurrentFrame.SourceAddress.MethodSource.SourceFile.FileName;
- }
- }
-
- public int CurrentLineNumber {
- get {
- if (IsRunning)
- return -1;
-
- return proc.CurrentFrame.SourceAddress.Row;
- }
- }
-
- public string LookupValue (string expr)
- {
- return "";
- }
-
- private void OnBreakpointHit (Breakpoint pointFromDbg, StackFrame frame)
- {
- point = pointFromDbg;
- Gtk.Timeout.Add (1, new Gtk.Function (MainThreadNotify));
- }
-
- bool MainThreadNotify ()
- {
- string[] toks = point.Name.Split (':');
- string filename = toks [0];
- int linenumber = Int32.Parse (toks [1]);
-
- if (this.BreakpointHit == null)
- return false;
-
- BreakpointHitArgs args = new BreakpointHitArgs (filename, linenumber);
- BreakpointHit (this, args);
- return false;
- }
-
- 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;
- }
- }
- }
- }
-}
Added: trunk/MonoDevelop/src/Main/Base/Services/IDebuggerService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/IDebuggerService.cs 2004-03-20 22:34:00 UTC (rev 1206)
+++ trunk/MonoDevelop/src/Main/Base/Services/IDebuggerService.cs 2004-03-21 00:57:47 UTC (rev 1207)
@@ -0,0 +1,48 @@
+// IDebuggingService - Interface for the debugger to remove the depend on the
+// debugger.
+//
+// Author: Todd Berman <tberman at sevenl.net>
+//
+// (C) 2004 Todd Berman
+
+using System;
+
+namespace MonoDevelop.Services
+{
+
+ public interface IDebuggableEditor {
+ void ExecutingAt (int lineNumber);
+ void ClearExecutingAt (int lineNumber);
+ }
+
+ public interface IDebuggingService {
+ bool IsRunning { get; }
+ bool AddBreakpoint (string filename, int linenum);
+ void RemoveBreakpoint (string filename, int linenum);
+ bool ToggleBreakpoint (string filename, int linenum);
+
+ event EventHandler PausedEvent;
+ event EventHandler ResumedEvent;
+ event EventHandler StartedEvent;
+ event EventHandler StoppedEvent;
+
+ void Pause ();
+ void Resume ();
+ void Run (string[] args);
+ void Stop ();
+
+ void StepInto ();
+ void StepOver ();
+
+ string[] Backtrace { get; }
+
+ //FIXME: This is such a hack to workaround the fact that we
+ //cant use any debugger types. This returns a StackFrame
+ object CurrentFrame { get; }
+
+ string CurrentFilename { get; }
+ int CurrentLineNumber { get; }
+
+ string LookupValue (string expr);
+ }
+}
More information about the Monodevelop-patches-list
mailing list