Author: martin
Date: 2007-02-28 10:19:15 -0500 (Wed, 28 Feb 2007)
New Revision: 73558

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/classes/DebuggerSession.cs
   trunk/debugger/classes/SourceLocation.cs
   trunk/debugger/frontend/Command.cs
   trunk/debugger/frontend/Interpreter.cs
Log:
2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>

        * classes/DebuggerSession.cs
        (DebuggerSession.InsertBreakpoint): Don't take a `Thread' argument
        when inserting a breakpoint on a `SourceLocation' and don't
        activate it.  This allows us to insert such breakpoints before the
        target is started.

        * frontend/Interpreter.cs
        (Interpreter.InsertBreakpoint): Removed; call
        DebuggerSession.InsertBreakpoint() directly.

        * frontend/Command.cs
        (TestCommand): Temporary hack.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-02-28 15:06:20 UTC (rev 73557)
+++ trunk/debugger/ChangeLog    2007-02-28 15:19:15 UTC (rev 73558)
@@ -1,5 +1,20 @@
 2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * classes/DebuggerSession.cs
+       (DebuggerSession.InsertBreakpoint): Don't take a `Thread' argument
+       when inserting a breakpoint on a `SourceLocation' and don't
+       activate it.  This allows us to insert such breakpoints before the
+       target is started.
+
+       * frontend/Interpreter.cs
+       (Interpreter.InsertBreakpoint): Removed; call
+       DebuggerSession.InsertBreakpoint() directly.
+
+       * frontend/Command.cs
+       (TestCommand): Temporary hack.
+
+2007-02-28  Martin Baulig  <[EMAIL PROTECTED]>
+
        * backend/ProcessStart.cs
        (ProcessStart..ctor): Set `options.WorkingDirectory' if null.
 

Modified: trunk/debugger/classes/DebuggerSession.cs
===================================================================
--- trunk/debugger/classes/DebuggerSession.cs   2007-02-28 15:06:20 UTC (rev 
73557)
+++ trunk/debugger/classes/DebuggerSession.cs   2007-02-28 15:19:15 UTC (rev 
73558)
@@ -131,11 +131,9 @@
                        root.AppendChild (element);
                }
 
-               public Event InsertBreakpoint (Thread target, ThreadGroup group,
-                                              SourceLocation location)
+               public Event InsertBreakpoint (ThreadGroup group, 
SourceLocation location)
                {
                        Event handle = new SourceBreakpoint (this, group, 
location);
-                       handle.Activate (target);
                        AddEvent (handle);
                        return handle;
                }

Modified: trunk/debugger/classes/SourceLocation.cs
===================================================================
--- trunk/debugger/classes/SourceLocation.cs    2007-02-28 15:06:20 UTC (rev 
73557)
+++ trunk/debugger/classes/SourceLocation.cs    2007-02-28 15:19:15 UTC (rev 
73558)
@@ -131,7 +131,7 @@
                                                            int domain)
                {
                        if (!Resolve (session, target))
-                                       throw new TargetException 
(TargetError.LocationInvalid);
+                               throw new TargetException 
(TargetError.LocationInvalid);
 
                        return dynamic.InsertBreakpoint (target, breakpoint, 
domain);
                }

Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs  2007-02-28 15:06:20 UTC (rev 73557)
+++ trunk/debugger/frontend/Command.cs  2007-02-28 15:19:15 UTC (rev 73558)
@@ -82,6 +82,7 @@
                        RegisterCommand ("save", typeof (SaveCommand));
                        RegisterCommand ("load", typeof (LoadCommand));
                        RegisterCommand ("module", typeof (ModuleCommand));
+                       RegisterCommand ("test", typeof (TestCommand));
                }
        }
 
@@ -2368,6 +2369,43 @@
                }
        }
 
+       public class TestCommand : DebuggerCommand
+       {
+               SourceLocation location;
+
+               protected override bool DoResolve (ScriptingContext context)
+               {
+                       int line;
+                       int pos = Argument.IndexOf (':');
+                       if (pos >= 0) {
+                               string filename = Argument.Substring (0, pos);
+                               try {
+                                       line = (int) UInt32.Parse 
(Argument.Substring (pos+1));
+                               } catch {
+                                       throw new ScriptingException ("Expected 
filename:line");
+                               }
+
+                               location = new SourceLocation (filename, line);
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               protected override object DoExecute (ScriptingContext context)
+               {
+                       if (location == null)
+                               throw new TargetException 
(TargetError.LocationInvalid);
+
+                       Event handle = 
context.Interpreter.Session.InsertBreakpoint (
+                               ThreadGroup.Global, location);
+                       if (context.Interpreter.HasTarget)
+                               handle.Activate 
(context.Interpreter.CurrentThread);
+
+                       return handle.Index;
+               }
+       }
+
        public class BreakCommand : SourceCommand, IDocumentableCommand
        {
                string group;
@@ -2444,20 +2482,21 @@
                                                "Can't specifcy an appdomain 
when inserting a " +
                                                "breakpoint on an address");
 
-                               int index = 
context.Interpreter.InsertBreakpoint (
+                               Event handle = 
context.Interpreter.Session.InsertBreakpoint (
                                        context.CurrentThread, tgroup, address);
-                               context.Print ("Breakpoint {0} at {1}", index, 
address);
-                               return index;
+                               context.Print ("Breakpoint {0} at {1}", 
handle.Index, address);
+                               return handle.Index;
                        } else {
                                if (domain != 0)
                                        throw new ScriptingException (
                                                "Can't insert breakpoints in " +
                                                "other application domains.");
 
-                               int index = 
context.Interpreter.InsertBreakpoint (
-                                       context.CurrentThread, tgroup, 
Location);
-                               context.Print ("Breakpoint {0} at {1}", index, 
Location.Name);
-                               return index;
+                               Event handle = 
context.Interpreter.Session.InsertBreakpoint (
+                                       tgroup, Location);
+                               handle.Activate (context.CurrentThread);
+                               context.Print ("Breakpoint {0} at {1}", 
handle.Index, Location.Name);
+                               return handle.Index;
                        }
                }
 

Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs      2007-02-28 15:06:20 UTC (rev 
73557)
+++ trunk/debugger/frontend/Interpreter.cs      2007-02-28 15:19:15 UTC (rev 
73558)
@@ -821,21 +821,6 @@
                                group.RemoveThread (thread.ID);
                }
 
-               public int InsertBreakpoint (Thread target, ThreadGroup group,
-                                            SourceLocation location)
-               {
-                       Event handle = target.Process.Session.InsertBreakpoint 
(target, group, location);
-                       return handle.Index;
-               }
-
-               public int InsertBreakpoint (Thread target, ThreadGroup group,
-                                            TargetAddress address)
-               {
-                       Event handle = target.Process.Session.InsertBreakpoint (
-                               target, group, address);
-                       return handle.Index;
-               }
-
                public int InsertExceptionCatchPoint (Thread target, 
ThreadGroup group,
                                                      TargetType exception)
                {

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

Reply via email to