Author: martin
Date: 2007-03-06 11:21:40 -0500 (Tue, 06 Mar 2007)
New Revision: 73819

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backend/DebuggerServant.cs
   trunk/debugger/backend/ProcessServant.cs
   trunk/debugger/classes/Debugger.cs
   trunk/debugger/frontend/Command.cs
   trunk/debugger/frontend/Interpreter.cs
   trunk/debugger/test/src/TestSession.cs
   trunk/debugger/test/testsuite/NUnit.cs
   trunk/debugger/test/testsuite/TestAbort.cs
   trunk/debugger/test/testsuite/TestAttach.cs
   trunk/debugger/test/testsuite/TestBreakpoint.cs
   trunk/debugger/test/testsuite/TestByRef.cs
   trunk/debugger/test/testsuite/TestDelegate.cs
   trunk/debugger/test/testsuite/TestEnum.cs
   trunk/debugger/test/testsuite/TestException.cs
   trunk/debugger/test/testsuite/TestExec.cs
   trunk/debugger/test/testsuite/TestIndexer.cs
   trunk/debugger/test/testsuite/TestInheritance.cs
   trunk/debugger/test/testsuite/TestInvocation.cs
   trunk/debugger/test/testsuite/TestManagedTypes.cs
   trunk/debugger/test/testsuite/TestMethodLookup.cs
   trunk/debugger/test/testsuite/TestMultiThread.cs
   trunk/debugger/test/testsuite/TestNamespace.cs
   trunk/debugger/test/testsuite/TestNull.cs
   trunk/debugger/test/testsuite/TestObject.cs
   trunk/debugger/test/testsuite/TestProperty.cs
   trunk/debugger/test/testsuite/TestRestart.cs
   trunk/debugger/test/testsuite/TestSession.cs
   trunk/debugger/test/testsuite/TestToString.cs
   trunk/debugger/test/testsuite/testnativeattach.cs
   trunk/debugger/test/testsuite/testnativeexec.cs
   trunk/debugger/test/testsuite/testnativefork.cs
Log:
2007-03-06  Martin Baulig  <[EMAIL PROTECTED]>

        * classes/Debugger.cs
        (Debugger.MainProcessCreatedEvent): New public event.

        * backend/ProcessServant.cs
        (ProcessServant.Initialize): Fire a `MainProcessCreatedEvent' when
        creating the main process.

        * test/testsuite/NUnit.cs
        (TestSuite.Start): New public method; use this instead of
        `Interpreter.Start()'.
        (TestSuite.LoadSession): Likewise.
        (TestSuite.Attach): Likewise.

        * test/testsuite/*.cs: Use our parent class'es Start(),
        LoadSession() and Attach() methods instead directly calling them
        on the `Interpreter'.

        * test/testsuite/TestSession.cs: Add a new testcase.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-03-06 16:07:19 UTC (rev 73818)
+++ trunk/debugger/ChangeLog    2007-03-06 16:21:40 UTC (rev 73819)
@@ -1,3 +1,24 @@
+2007-03-06  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * classes/Debugger.cs
+       (Debugger.MainProcessCreatedEvent): New public event.
+
+       * backend/ProcessServant.cs
+       (ProcessServant.Initialize): Fire a `MainProcessCreatedEvent' when
+       creating the main process.
+
+       * test/testsuite/NUnit.cs
+       (TestSuite.Start): New public method; use this instead of
+       `Interpreter.Start()'.
+       (TestSuite.LoadSession): Likewise.
+       (TestSuite.Attach): Likewise.
+
+       * test/testsuite/*.cs: Use our parent class'es Start(),
+       LoadSession() and Attach() methods instead directly calling them
+       on the `Interpreter'.
+
+       * test/testsuite/TestSession.cs: Add a new testcase.
+
 2007-03-05  Martin Baulig  <[EMAIL PROTECTED]>
 
        * classes/ExpressionBreakpoint.cs: New file.

Modified: trunk/debugger/backend/DebuggerServant.cs
===================================================================
--- trunk/debugger/backend/DebuggerServant.cs   2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/backend/DebuggerServant.cs   2007-03-06 16:21:40 UTC (rev 
73819)
@@ -47,6 +47,11 @@
                        get { return thread_manager; }
                }
 
+               internal void OnMainProcessCreatedEvent (ProcessServant process)
+               {
+                       client.OnMainProcessCreatedEvent (process.Client);
+               }
+
                internal void OnProcessCreatedEvent (ProcessServant process)
                {
                        process_hash.Add (process, process);

Modified: trunk/debugger/backend/ProcessServant.cs
===================================================================
--- trunk/debugger/backend/ProcessServant.cs    2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/backend/ProcessServant.cs    2007-03-06 16:21:40 UTC (rev 
73819)
@@ -332,6 +332,9 @@
                                thread_hash.Add (engine.PID, engine);
                        session.MainThreadGroup.AddThread (engine.Thread.ID);
 
+                       if (!is_forked && !is_exec)
+                               manager.Debugger.OnMainProcessCreatedEvent 
(this);
+
                        if ((start.PID != 0) && !is_exec) {
                                int[] threads = inferior.GetThreads ();
                                foreach (int thread in threads) {

Modified: trunk/debugger/classes/Debugger.cs
===================================================================
--- trunk/debugger/classes/Debugger.cs  2007-03-06 16:07:19 UTC (rev 73818)
+++ trunk/debugger/classes/Debugger.cs  2007-03-06 16:21:40 UTC (rev 73819)
@@ -51,6 +51,7 @@
                public event TargetOutputHandler TargetOutputEvent;
                public event ThreadEventHandler ThreadCreatedEvent;
                public event ThreadEventHandler ThreadExitedEvent;
+               public event ProcessEventHandler MainProcessCreatedEvent;
                public event ProcessEventHandler ProcessCreatedEvent;
                public event ProcessEventHandler ProcessExitedEvent;
                public event ProcessEventHandler ProcessExecdEvent;
@@ -68,6 +69,12 @@
                        return new Thread (servant, id);
                }
 
+               internal void OnMainProcessCreatedEvent (Process process)
+               {
+                       if (MainProcessCreatedEvent != null)
+                               MainProcessCreatedEvent (this, process);
+               }
+
                internal void OnProcessCreatedEvent (Process process)
                {
                        if (ProcessCreatedEvent != null)

Modified: trunk/debugger/frontend/Command.cs
===================================================================
--- trunk/debugger/frontend/Command.cs  2007-03-06 16:07:19 UTC (rev 73818)
+++ trunk/debugger/frontend/Command.cs  2007-03-06 16:21:40 UTC (rev 73819)
@@ -1080,6 +1080,13 @@
 
        public class RunCommand : DebuggerCommand, IDocumentableCommand
        {
+               bool yes;
+
+               public bool Yes {
+                       get { return yes; }
+                       set { yes = true; }
+               }
+
                protected override bool DoResolve (ScriptingContext context)
                {
                        if ((context.Interpreter.Options.File == null) ||
@@ -1088,18 +1095,22 @@
                                        "No executable file specified.\nUse the 
`file' command.");
                        }
 
-                       if (context.HasBackend && 
context.Interpreter.IsInteractive) {
-                               if (context.Interpreter.Query ("The program 
being debugged has been started already.\n" +
-                                                              "Start it from 
the beginning?")) {
-                                       context.Interpreter.Kill ();
-                                       return true;
-                               }
-                               else {
-                                       return false;
-                               }
+                       if (!context.HasBackend)
+                               return true;
+
+                       if (!context.Interpreter.IsInteractive || yes) {
+                               context.Interpreter.Kill ();
+                               return true;
                        }
 
-                       return true;
+                       if (context.Interpreter.Query (
+                                   "The program being debugged has been 
started already.\n" +
+                                   "Start it from the beginning?")) {
+                               context.Interpreter.Kill ();
+                               return true;
+                       } else {
+                               return false;
+                       }
                }
 
                protected override object DoExecute (ScriptingContext context)

Modified: trunk/debugger/frontend/Interpreter.cs
===================================================================
--- trunk/debugger/frontend/Interpreter.cs      2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/frontend/Interpreter.cs      2007-03-06 16:21:40 UTC (rev 
73819)
@@ -314,7 +314,7 @@
                                Style.TargetEvent (thread, args);
                }
 
-               public virtual Process Start ()
+               public Process Start ()
                {
                        if ((debugger != null) || (main_process != null))
                                throw new TargetException 
(TargetError.AlreadyHaveTarget);
@@ -645,6 +645,9 @@
                                current_thread = null;
                }
 
+               protected virtual void OnMainProcessCreated (Process process)
+               { }
+
                protected virtual void OnProcessCreated (Process process)
                {
                        Print ("Created new process #{0}.", process.ID);
@@ -1026,6 +1029,7 @@
                                debugger.TargetExitedEvent += target_exited;
                                debugger.ThreadCreatedEvent += thread_created;
                                debugger.ThreadExitedEvent += thread_exited;
+                               debugger.MainProcessCreatedEvent += 
main_process_created;
                                debugger.ProcessCreatedEvent += process_created;
                                debugger.ProcessExitedEvent += process_exited;
                                debugger.ProcessExecdEvent += process_execd;
@@ -1044,6 +1048,11 @@
                                        interpreter.OnThreadExited (thread);
                        }
 
+                       public void main_process_created (Debugger debugger, 
Process process)
+                       {
+                               interpreter.OnMainProcessCreated (process);
+                       }
+
                        public void process_created (Debugger debugger, Process 
process)
                        {
                                interpreter.OnProcessCreated (process);

Modified: trunk/debugger/test/src/TestSession.cs
===================================================================
--- trunk/debugger/test/src/TestSession.cs      2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/src/TestSession.cs      2007-03-06 16:21:40 UTC (rev 
73819)
@@ -20,6 +20,16 @@
 {
        public static void Bar ()
        {
+               Hello hello = new Hello ();
                Console.WriteLine ("Irish Pub");
+               hello.World ();
        }
 }
+
+public class Hello
+{
+       public void World ()
+       {
+               Console.WriteLine ("WORLD!");
+       }
+}

Modified: trunk/debugger/test/testsuite/NUnit.cs
===================================================================
--- trunk/debugger/test/testsuite/NUnit.cs      2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/NUnit.cs      2007-03-06 16:21:40 UTC (rev 
73819)
@@ -17,6 +17,7 @@
                TargetEvent,
                ThreadCreated,
                ThreadExited,
+               MainProcessCreated,
                ProcessCreated,
                ProcessExecd,
                ProcessExited,
@@ -74,7 +75,7 @@
        {
                internal NUnitInterpreter (DebuggerConfiguration config, 
DebuggerOptions options,
                                           LineReader inferior_stdout, 
LineReader inferior_stderr)
-                       : base (true, config, options)
+                       : base (false, config, options)
                {
                        this.inferior_stdout = inferior_stdout;
                        this.inferior_stderr = inferior_stderr;
@@ -135,6 +136,12 @@
                        AddEvent (new DebuggerEvent 
(DebuggerEventType.ThreadExited, thread));
                }
 
+               protected override void OnMainProcessCreated (Process process)
+               {
+                       base.OnMainProcessCreated (process);
+                       AddEvent (new DebuggerEvent 
(DebuggerEventType.MainProcessCreated, process));
+               }
+
                protected override void OnProcessCreated (Process process)
                {
                        base.OnProcessCreated (process);
@@ -357,7 +364,7 @@
 
                                Assert.AreEqual (function, name,
                                                 "Target stopped in method 
`{0}', but expected `{1}'.",
-                                                function, name);
+                                                name, function);
                                Assert.AreEqual (line, location.Line,
                                                 "Target stopped at line {0}, 
but expected {1}.",
                                                 location.Line, line);
@@ -455,6 +462,12 @@
                        return (int) result;
                }
 
+               public Process AssertMainProcessCreated ()
+               {
+                       DebuggerEvent e = AssertEvent 
(DebuggerEventType.MainProcessCreated);
+                       return (Process) e.Data;
+               }
+
                public Thread AssertProcessCreated ()
                {
                        AssertEvent (DebuggerEventType.ProcessCreated);
@@ -665,6 +678,36 @@
                        return e;
                }
 
+               private void AssertMainProcessCreated (Process process)
+               {
+                       DebuggerEvent e = AssertEvent 
(DebuggerEventType.MainProcessCreated);
+                       Process main = (Process) e.Data;
+                       Assert.AreEqual (process, main,
+                                        "Created main process `{0}', but 
expected `{1}'.",
+                                        main, process);
+               }
+
+               public Process Start ()
+               {
+                       Process process = Interpreter.Start ();
+                       AssertMainProcessCreated (process);
+                       return process;
+               }
+
+               public Process LoadSession (Stream stream)
+               {
+                       Process process = Interpreter.LoadSession (stream);
+                       AssertMainProcessCreated (process);
+                       return process;
+               }
+
+               public Process Attach (int pid)
+               {
+                       Process process = Interpreter.Attach (pid);
+                       AssertMainProcessCreated (process);
+                       return process;
+               }
+
                public TargetEventArgs AssertTargetEvent (Thread thread, 
TargetEventType type)
                {
                        DebuggerEvent e = AssertEvent ();

Modified: trunk/debugger/test/testsuite/TestAbort.cs
===================================================================
--- trunk/debugger/test/testsuite/TestAbort.cs  2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestAbort.cs  2007-03-06 16:21:40 UTC (rev 
73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestAttach.cs
===================================================================
--- trunk/debugger/test/testsuite/TestAttach.cs 2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestAttach.cs 2007-03-06 16:21:40 UTC (rev 
73819)
@@ -45,7 +45,7 @@
                [Category("Attach")]
                public void Main ()
                {
-                       Process process = Interpreter.Attach (child.Id);
+                       Process process = Attach (child.Id);
                        Assert.IsTrue (process.MainThread.IsStopped);
 
                        AssertThreadCreated ();
@@ -68,7 +68,7 @@
                [Category("Attach")]
                public void AttachAgain ()
                {
-                       Process process = Interpreter.Attach (child.Id);
+                       Process process = Attach (child.Id);
                        Assert.IsTrue (process.MainThread.IsStopped);
 
                        AssertThreadCreated ();
@@ -91,7 +91,7 @@
                [Category("Attach")]
                public void Kill ()
                {
-                       Process process = Interpreter.Attach (child.Id);
+                       Process process = Attach (child.Id);
                        Assert.IsTrue (process.MainThread.IsStopped);
 
                        AssertThreadCreated ();

Modified: trunk/debugger/test/testsuite/TestBreakpoint.cs
===================================================================
--- trunk/debugger/test/testsuite/TestBreakpoint.cs     2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestBreakpoint.cs     2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestByRef.cs
===================================================================
--- trunk/debugger/test/testsuite/TestByRef.cs  2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestByRef.cs  2007-03-06 16:21:40 UTC (rev 
73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestDelegate.cs
===================================================================
--- trunk/debugger/test/testsuite/TestDelegate.cs       2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestDelegate.cs       2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestEnum.cs
===================================================================
--- trunk/debugger/test/testsuite/TestEnum.cs   2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestEnum.cs   2007-03-06 16:21:40 UTC (rev 
73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestException.cs
===================================================================
--- trunk/debugger/test/testsuite/TestException.cs      2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestException.cs      2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -23,7 +23,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestExec.cs
===================================================================
--- trunk/debugger/test/testsuite/TestExec.cs   2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestExec.cs   2007-03-06 16:21:40 UTC (rev 
73819)
@@ -24,7 +24,7 @@
                [Category("Fork")]
                public void NativeChild ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -101,7 +101,7 @@
                                MonoExecutable, BuildDirectory + 
"/TestChild.exe"
                        };
 
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestIndexer.cs
===================================================================
--- trunk/debugger/test/testsuite/TestIndexer.cs        2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestIndexer.cs        2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestInheritance.cs
===================================================================
--- trunk/debugger/test/testsuite/TestInheritance.cs    2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestInheritance.cs    2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestInvocation.cs
===================================================================
--- trunk/debugger/test/testsuite/TestInvocation.cs     2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestInvocation.cs     2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -29,7 +29,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestManagedTypes.cs
===================================================================
--- trunk/debugger/test/testsuite/TestManagedTypes.cs   2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestManagedTypes.cs   2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -31,7 +31,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
 

Modified: trunk/debugger/test/testsuite/TestMethodLookup.cs
===================================================================
--- trunk/debugger/test/testsuite/TestMethodLookup.cs   2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestMethodLookup.cs   2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -52,7 +52,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestMultiThread.cs
===================================================================
--- trunk/debugger/test/testsuite/TestMultiThread.cs    2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestMultiThread.cs    2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -24,7 +24,7 @@
                [Category("Threads")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
 

Modified: trunk/debugger/test/testsuite/TestNamespace.cs
===================================================================
--- trunk/debugger/test/testsuite/TestNamespace.cs      2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestNamespace.cs      2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestNull.cs
===================================================================
--- trunk/debugger/test/testsuite/TestNull.cs   2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestNull.cs   2007-03-06 16:21:40 UTC (rev 
73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestObject.cs
===================================================================
--- trunk/debugger/test/testsuite/TestObject.cs 2007-03-06 16:07:19 UTC (rev 
73818)
+++ trunk/debugger/test/testsuite/TestObject.cs 2007-03-06 16:21:40 UTC (rev 
73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestProperty.cs
===================================================================
--- trunk/debugger/test/testsuite/TestProperty.cs       2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestProperty.cs       2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestRestart.cs
===================================================================
--- trunk/debugger/test/testsuite/TestRestart.cs        2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestRestart.cs        2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -25,7 +25,7 @@
                [Category("Session")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -50,7 +50,7 @@
                [Category("Session")]
                public void Restarted ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -72,7 +72,7 @@
                [Category("Session")]
                public void SecondRestart ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/TestSession.cs
===================================================================
--- trunk/debugger/test/testsuite/TestSession.cs        2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestSession.cs        2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,9 +18,11 @@
                const int line_main = 7;
                const int line_test = 15;
                const int line_bar = 23;
+               const int line_world = 33;
 
                int bpt_test;
                int bpt_bar;
+               int bpt_world;
 
                byte[] session;
 
@@ -30,7 +32,7 @@
                {
                        Compile (FileName);
 
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -56,7 +58,7 @@
 
                        Process process;
                        using (MemoryStream ms = new MemoryStream (session))
-                               process = Interpreter.LoadSession (ms);
+                               process = LoadSession (ms);
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -71,6 +73,7 @@
 
                        AssertExecute ("continue");
                        AssertTargetOutput ("Irish Pub");
+                       AssertTargetOutput ("WORLD!");
                        AssertTargetExited (thread.Process);
                }
 
@@ -82,7 +85,7 @@
 
                        Process process;
                        using (MemoryStream ms = new MemoryStream (session))
-                               process = Interpreter.LoadSession (ms);
+                               process = LoadSession (ms);
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -97,7 +100,64 @@
 
                        AssertExecute ("continue");
                        AssertTargetOutput ("Irish Pub");
+                       AssertTargetOutput ("WORLD!");
                        AssertTargetExited (thread.Process);
                }
+
+               [Test]
+               [Category("Session")]
+               public void TestBreakpoint ()
+               {
+                       Compile (FileName);
+
+                       Process process;
+                       using (MemoryStream ms = new MemoryStream (session))
+                               process = LoadSession (ms);
+                       Assert.IsTrue (process.IsManaged);
+                       Assert.IsTrue (process.MainThread.IsStopped);
+                       Thread thread = process.MainThread;
+
+                       AssertStopped (thread, "X.Main()", line_main);
+
+                       AssertExecute ("continue");
+                       AssertTargetOutput ("Hello World");
+                       AssertHitBreakpoint (thread, bpt_test, "X.Test()", 
line_test);
+                       AssertExecute ("continue");
+                       AssertHitBreakpoint (thread, bpt_bar, "Foo.Bar()", 
line_bar);
+
+                       AssertExecute ("next");
+                       AssertStopped (thread, "Foo.Bar()", line_bar+1);
+
+                       //
+                       // This breakpoint is contect-sensitive; ie. we can't 
use the
+                       // expression "hello.World ()" to insert it when we're 
at the
+                       // beginning of Main().
+                       //
+                       // We test here whether the session code correctly 
handles
+                       // this situation.
+                       //
+                       bpt_world = AssertBreakpoint ("hello.World ()");
+
+                       AssertExecute ("run -yes");
+                       AssertTargetExited (thread.Process);
+
+                       process = AssertMainProcessCreated ();
+                       thread = process.MainThread;
+
+                       AssertStopped (thread, "X.Main()", line_main);
+
+                       AssertExecute ("continue");
+                       AssertTargetOutput ("Hello World");
+                       AssertHitBreakpoint (thread, bpt_test, "X.Test()", 
line_test);
+                       AssertExecute ("continue");
+                       AssertHitBreakpoint (thread, bpt_bar, "Foo.Bar()", 
line_bar);
+                       AssertExecute ("continue");
+                       AssertTargetOutput ("Irish Pub");
+                       AssertHitBreakpoint (thread, bpt_world, 
"Hello.World()", line_world);
+                       AssertExecute ("continue");
+
+                       AssertTargetOutput ("WORLD!");
+                       AssertTargetExited (thread.Process);
+               }
        }
 }

Modified: trunk/debugger/test/testsuite/TestToString.cs
===================================================================
--- trunk/debugger/test/testsuite/TestToString.cs       2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/TestToString.cs       2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -18,7 +18,7 @@
                [Category("ManagedTypes")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsTrue (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/testnativeattach.cs
===================================================================
--- trunk/debugger/test/testsuite/testnativeattach.cs   2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/testnativeattach.cs   2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -44,7 +44,7 @@
                [Category("Attach")]
                public void Main ()
                {
-                       Process process = Interpreter.Attach (child.Id);
+                       Process process = Attach (child.Id);
                        Assert.IsTrue (process.MainThread.IsStopped);
 
                        AssertStopped (process.MainThread, null, -1);
@@ -63,7 +63,7 @@
                [Category("Attach")]
                public void AttachAgain ()
                {
-                       Process process = Interpreter.Attach (child.Id);
+                       Process process = Attach (child.Id);
                        Assert.IsTrue (process.MainThread.IsStopped);
 
                        AssertStopped (process.MainThread, null, -1);
@@ -82,7 +82,7 @@
                [Category("Attach")]
                public void Kill ()
                {
-                       Process process = Interpreter.Attach (child.Id);
+                       Process process = Attach (child.Id);
                        Assert.IsTrue (process.MainThread.IsStopped);
 
                        AssertStopped (process.MainThread, null, -1);

Modified: trunk/debugger/test/testsuite/testnativeexec.cs
===================================================================
--- trunk/debugger/test/testsuite/testnativeexec.cs     2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/testnativeexec.cs     2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -24,7 +24,7 @@
                [Category("Fork")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsFalse (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -99,7 +99,7 @@
                [Category("Fork")]
                public void Continue ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsFalse (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -172,7 +172,7 @@
                [Category("Fork")]
                public void Breakpoint ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsFalse (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

Modified: trunk/debugger/test/testsuite/testnativefork.cs
===================================================================
--- trunk/debugger/test/testsuite/testnativefork.cs     2007-03-06 16:07:19 UTC 
(rev 73818)
+++ trunk/debugger/test/testsuite/testnativefork.cs     2007-03-06 16:21:40 UTC 
(rev 73819)
@@ -22,7 +22,7 @@
                [Category("Fork")]
                public void Main ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsFalse (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -87,7 +87,7 @@
                [Category("Fork")]
                public void Continue ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsFalse (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;
@@ -144,7 +144,7 @@
                [Category("Fork")]
                public void Breakpoint ()
                {
-                       Process process = Interpreter.Start ();
+                       Process process = Start ();
                        Assert.IsFalse (process.IsManaged);
                        Assert.IsTrue (process.MainThread.IsStopped);
                        Thread thread = process.MainThread;

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

Reply via email to