Author: martin
Date: 2008-02-18 10:31:37 -0500 (Mon, 18 Feb 2008)
New Revision: 96066

Modified:
   branches/martin/debugger-terrania/debugger/ChangeLog
   branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs
   branches/martin/debugger-terrania/debugger/test/R.cs
   branches/martin/debugger-terrania/debugger/test/src/TestIterator.cs
   branches/martin/debugger-terrania/debugger/test/testsuite/TestIterator.cs
Log:
2008-02-18  Martin Baulig  <[EMAIL PROTECTED]>

        * languages/mono/MonoSymbolFile.cs
        (MonoMethod.do_read_variables): Support a captured 'this'.



Modified: branches/martin/debugger-terrania/debugger/ChangeLog
===================================================================
--- branches/martin/debugger-terrania/debugger/ChangeLog        2008-02-18 
15:30:57 UTC (rev 96065)
+++ branches/martin/debugger-terrania/debugger/ChangeLog        2008-02-18 
15:31:37 UTC (rev 96066)
@@ -1,5 +1,10 @@
 2008-02-18  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * languages/mono/MonoSymbolFile.cs
+       (MonoMethod.do_read_variables): Support a captured 'this'.
+
+2008-02-18  Martin Baulig  <[EMAIL PROTECTED]>
+
        Improved iterator support and added some tests.
 
        * test/{src|testsuite}/TestIterator.cs: New tests.

Modified: 
branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs 
2008-02-18 15:30:57 UTC (rev 96065)
+++ branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs 
2008-02-18 15:31:37 UTC (rev 96066)
@@ -1004,7 +1004,7 @@
                        C.MethodEntry method;
                        Cecil.MethodDefinition mdef;
                        TargetStructType decl_type;
-                       MonoVariable this_var;
+                       TargetVariable this_var;
                        List<MonoCodeBlock> root_blocks;
                        List<TargetVariable> parameters;
                        List<TargetVariable> locals;
@@ -1127,10 +1127,20 @@
                                        foreach (C.CapturedVariable captured in 
entry.CapturedVariables) {
                                                CapturedVariable cv = new 
CapturedVariable (
                                                        scope, this, 
captured.Name, captured.CapturedName);
-                                               if (captured.IsLocal)
+
+                                               switch (captured.Kind) {
+                                               case 
C.CapturedVariable.CapturedKind.Local:
                                                        locals.Add (cv);
-                                               else
+                                                       break;
+                                               case 
C.CapturedVariable.CapturedKind.Parameter:
                                                        parameters.Add (cv);
+                                                       break;
+                                               case 
C.CapturedVariable.CapturedKind.This:
+                                                       this_var = cv;
+                                                       continue;
+                                               default:
+                                                       throw new InternalError 
();
+                                               }
 
                                                captured_vars.Add 
(captured.Name, cv);
                                        }

Modified: branches/martin/debugger-terrania/debugger/test/R.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/test/R.cs        2008-02-18 
15:30:57 UTC (rev 96065)
+++ branches/martin/debugger-terrania/debugger/test/R.cs        2008-02-18 
15:31:37 UTC (rev 96066)
@@ -3,31 +3,25 @@
 
 class X
 {
-       static int total;
+       int total;
 
-       static IEnumerator GetRange ()
+       IEnumerator GetRange (int a)
        {
-               yield return 1;
-
-               {
-                       int a = 3;
-                       yield return a;
-               }
-
-               for (;;) {
-                       if (total > 3)
-                               yield break;
-
-                       yield return 4;
-               }
+               yield return total * a;
        }
 
-       static void Main ()
+       void Test ()
        {
-               IEnumerator e = GetRange ();
+               IEnumerator e = GetRange (9);
                while (e.MoveNext ())
                        total += (int) e.Current;
 
                Console.WriteLine (total);
        }
+
+       static void Main ()
+       {
+               X x = new X ();
+               x.Test ();
+       }
 }

Modified: branches/martin/debugger-terrania/debugger/test/src/TestIterator.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/test/src/TestIterator.cs 
2008-02-18 15:30:57 UTC (rev 96065)
+++ branches/martin/debugger-terrania/debugger/test/src/TestIterator.cs 
2008-02-18 15:31:37 UTC (rev 96066)
@@ -46,7 +46,7 @@
 {
        public class X
        {
-               int total;
+               int total = 1;
                bool stop;
 
                IEnumerator<int> GetRange ()
@@ -62,8 +62,10 @@
                public int Run ()
                {
                        IEnumerator<int> e = GetRange ();               // @MDB 
BREAKPOINT: test2 run
-                       while (e.MoveNext ())                           // @MDB 
LINE: test2 loop
-                               stop = true;                            // @MDB 
LINE: test2 statement
+                       while (e.MoveNext ()) {                         // @MDB 
LINE: test2 loop
+                               total += e.Current;                     // @MDB 
LINE: test2 statement
+                               stop = true;                            // @MDB 
LINE: test2 stop
+                       }
 
                        return total;                                   // @MDB 
LINE: test2 return
                }

Modified: 
branches/martin/debugger-terrania/debugger/test/testsuite/TestIterator.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/test/testsuite/TestIterator.cs   
2008-02-18 15:30:57 UTC (rev 96065)
+++ branches/martin/debugger-terrania/debugger/test/testsuite/TestIterator.cs   
2008-02-18 15:31:37 UTC (rev 96066)
@@ -107,6 +107,9 @@
                        AssertStopped (thread, "test2 statement", 
"Test2.X.Run()");
 
                        AssertExecute ("step");
+                       AssertStopped (thread, "test2 stop", "Test2.X.Run()");
+
+                       AssertExecute ("step");
                        AssertStopped (thread, "test2 loop", "Test2.X.Run()");
 
                        AssertExecute ("step");
@@ -117,6 +120,8 @@
                        AssertStopped (thread, "test2 iterator if",
                                       
"Test2.X/<>c__CompilerGenerated1.MoveNext()");
 
+                       AssertPrint (thread, "this", "(Test2.X) { total = 2, 
stop = true }");
+
                        AssertExecute ("step");
                        AssertStopped (thread, "test2 iterator break",
                                       
"Test2.X/<>c__CompilerGenerated1.MoveNext()");

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

Reply via email to