Author: martin
Date: 2007-02-20 12:05:29 -0500 (Tue, 20 Feb 2007)
New Revision: 73195

Modified:
   trunk/debugger/frontend/Command.cs
   trunk/debugger/frontend/Interpreter.cs
Log:
2007-02-20  Martin Baulig  <[EMAIL PROTECTED]>

        * classes/Event.cs
        (Event.Breaks): Check `IsEnabled' as well.
        (Event.Enable, Event.Disable): Make these methods internal; modify
        the `IsEnabled' property instead.

        * classes/DebuggerSession.cs
        (DebuggerSession.InsertBreakpoint): Also enable the breakpoint by
        calling the now internal `Event.Enable ()'.
        (DebuggerSession.InsertHardwareWatchPoint): Likewise.
        (DebuggerSession.InsertExceptionCatchPoint): Likewise.

        * backend/SingleSteppingEngine.cs
        (SingleSteppingEngine): Check whether a breakpoint is actually enabled.



Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs  2007-02-20 17:00:44 UTC (rev 73194)
+++ trunk/debugger/frontend/Command.cs  2007-02-20 17:05:29 UTC (rev 73195)
@@ -1522,11 +1522,7 @@
                {
                        protected override object DoExecute (ScriptingContext 
context)
                        {
-                               DebuggerOptions options;
-                               if (context.Interpreter.HasCurrentProcess)
-                                       options = 
context.Interpreter.CurrentProcess.Session.Options;
-                               else
-                                       options = context.Interpreter.Options;
+                               DebuggerOptions options = 
context.Interpreter.Session.Options;
 
                                string[] args = options.InferiorArgs;
                                if (args == null)
@@ -1985,7 +1981,7 @@
                        ModuleBase module = null;
                        if (name.StartsWith ("@")) {
                                name = name.Substring (1);
-                               module = 
CurrentProcess.Session.Config.GetModuleGroup (name);
+                               module = 
context.Interpreter.Session.Config.GetModuleGroup (name);
                                if (module == null)
                                        throw new ScriptingException ("No such 
module group `{0}'", name);
                        } else {
@@ -2078,11 +2074,14 @@
                protected override object DoExecute (ScriptingContext context)
                {
                        if (handle != null) {
-                               handle.Enable (CurrentThread);
+                               handle.IsEnabled = true;
                        } else {
+                               if (!context.Interpreter.Query ("Enable all 
breakpoints?"))
+                                       return null;
+
                                // enable all breakpoints
-                               foreach (Event h in 
CurrentThread.Process.Session.Events)
-                                       h.Enable (CurrentThread);
+                               foreach (Event h in 
context.Interpreter.Session.Events)
+                                       h.IsEnabled = true;
                        }
 
                        return null;
@@ -2099,11 +2098,14 @@
                protected override object DoExecute (ScriptingContext context)
                {
                        if (handle != null) {
-                               handle.Disable (CurrentThread);
+                               handle.IsEnabled = false;
                        } else {
+                               if (!context.Interpreter.Query ("Disable all 
breakpoints?"))
+                                       return null;
+
                                // enable all breakpoints
-                               foreach (Event h in 
CurrentThread.Process.Session.Events)
-                                       h.Disable (CurrentThread);
+                               foreach (Event h in 
context.Interpreter.Session.Events)
+                                       h.IsEnabled = false;
                        }
 
                        return null;
@@ -2120,9 +2122,9 @@
                protected override object DoExecute (ScriptingContext context)
                {
                        if (handle != null) {
-                               CurrentThread.Process.Session.DeleteEvent 
(CurrentThread, handle);
+                               context.Interpreter.Session.DeleteEvent 
(CurrentThread, handle);
                        } else {
-                               Event[] hs = 
CurrentThread.Process.Session.Events;
+                               Event[] hs = context.Interpreter.Session.Events;
 
                                if (hs.Length == 0)
                                        return null;
@@ -2131,8 +2133,8 @@
                                        return null;
 
                                // delete all breakpoints
-                               foreach (Event h in 
CurrentThread.Process.Session.Events)
-                                       
CurrentThread.Process.Session.DeleteEvent (CurrentThread, h);
+                               foreach (Event h in 
context.Interpreter.Session.Events)
+                                       context.Interpreter.Session.DeleteEvent 
(CurrentThread, h);
                        }
 
                        return null;

Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs      2007-02-20 17:00:44 UTC (rev 
73194)
+++ trunk/debugger/frontend/Interpreter.cs      2007-02-20 17:05:29 UTC (rev 
73195)
@@ -122,6 +122,15 @@
                        get { return current_process != null; }
                }
 
+               public DebuggerSession Session {
+                       get {
+                               if (session == null)
+                                       throw new TargetException 
(TargetError.NoTarget);
+
+                               return session;
+                       }
+               }
+
                public StyleBase GetStyle (string name)
                {
                        StyleBase style = (StyleBase) styles [name];
@@ -591,7 +600,7 @@
 
                public void ShowBreakpoints ()
                {
-                       Event[] events = CurrentProcess.Session.Events;
+                       Event[] events = Session.Events;
                        if (events.Length == 0) {
                                Print ("No breakpoints or catchpoints.");
                                return;
@@ -617,7 +626,7 @@
 
                public Event GetEvent (int index)
                {
-                       Event handle = CurrentProcess.Session.GetEvent (index);
+                       Event handle = Session.GetEvent (index);
                        if (handle == null)
                                throw new ScriptingException ("No such 
breakpoint/catchpoint.");
 
@@ -751,7 +760,7 @@
 
                public void ShowThreadGroups ()
                {
-                       foreach (ThreadGroup group in 
CurrentProcess.Session.ThreadGroups) {
+                       foreach (ThreadGroup group in Session.ThreadGroups) {
                                if (group.Name.StartsWith ("@"))
                                        continue;
                                StringBuilder ids = new StringBuilder ();
@@ -765,18 +774,18 @@
 
                public void CreateThreadGroup (string name)
                {
-                       if (CurrentProcess.Session.ThreadGroupExists (name))
+                       if (Session.ThreadGroupExists (name))
                                throw new ScriptingException ("A thread group 
with that name already exists.");
 
-                       CurrentProcess.Session.CreateThreadGroup (name);
+                       Session.CreateThreadGroup (name);
                }
 
                public void DeleteThreadGroup (string name)
                {
-                       if (!CurrentProcess.Session.ThreadGroupExists (name))
+                       if (!Session.ThreadGroupExists (name))
                                throw new ScriptingException ("No such thread 
group.");
 
-                       CurrentProcess.Session.DeleteThreadGroup (name);
+                       Session.DeleteThreadGroup (name);
                }
 
                public ThreadGroup GetThreadGroup (string name, bool writable)
@@ -787,10 +796,10 @@
                                return ThreadGroup.Global;
                        if (name.StartsWith ("@"))
                                throw new ScriptingException ("No such thread 
group.");
-                       if (!CurrentProcess.Session.ThreadGroupExists (name))
+                       if (!Session.ThreadGroupExists (name))
                                throw new ScriptingException ("No such thread 
group.");
 
-                       ThreadGroup group = 
CurrentProcess.Session.CreateThreadGroup (name);
+                       ThreadGroup group = Session.CreateThreadGroup (name);
 
                        if (writable && group.IsSystem)
                                throw new ScriptingException ("Cannot modify 
system-created thread group.");
@@ -818,7 +827,6 @@
                                             SourceLocation location)
                {
                        Event handle = target.Process.Session.InsertBreakpoint 
(target, group, location);
-                       handle.Enable (target);
                        return handle.Index;
                }
 
@@ -827,7 +835,6 @@
                {
                        Event handle = target.Process.Session.InsertBreakpoint (
                                target, group, address);
-                       handle.Enable (target);
                        return handle.Index;
                }
 
@@ -836,7 +843,6 @@
                {
                        Event handle = 
target.Process.Session.InsertExceptionCatchPoint (
                                target, group, exception);
-                       handle.Enable (target);
                        return handle.Index;
                }
 
@@ -844,7 +850,6 @@
                {
                        Event handle = 
target.Process.Session.InsertHardwareWatchPoint (
                                target, address, BreakpointType.WatchWrite);
-                       handle.Enable (target);
                        return handle.Index;
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to