Allow setting a breakpoint on automatically implemented properties
authorMarek Safar <marek.safar@gmail.com>
Tue, 7 Feb 2012 16:51:30 +0000 (16:51 +0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 7 Feb 2012 17:40:59 +0000 (17:40 +0000)
mcs/mcs/property.cs
mcs/tests/test-debug-10-ref.xml [new file with mode: 0644]
mcs/tests/test-debug-10.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_5.xml

index 7e7d55de216c12e34f4f52e57c9ae468e1f1d538..0d417fde73fa9557f8206efbc478ab2decd2322a 100644 (file)
@@ -749,14 +749,22 @@ namespace Mono.CSharp
                        if ((field.ModFlags & Modifiers.STATIC) == 0)
                                fe.InstanceExpression = new CompilerGeneratedThis (Parent.CurrentType, Location);
 
-                       // Create get block
-                       Get.Block = new ToplevelBlock (Compiler, ParametersCompiled.EmptyReadOnlyParameters, Location);
-                       Return r = new Return (fe, Location);
+                       //
+                       // Create get block but we careful with location to
+                       // emit only single sequence point per accessor. This allow
+                       // to set a breakpoint on it even with no user code
+                       //
+                       Get.Block = new ToplevelBlock (Compiler, ParametersCompiled.EmptyReadOnlyParameters, Get.Location) {
+                               EndLocation = Location.Null
+                       };
+                       Return r = new Return (fe, Location.Null);
                        Get.Block.AddStatement (r);
 
                        // Create set block
-                       Set.Block = new ToplevelBlock (Compiler, Set.ParameterInfo, Location);
-                       Assign a = new SimpleAssign (fe, new SimpleName ("value", Location));
+                       Set.Block = new ToplevelBlock (Compiler, Set.ParameterInfo, Set.Location) {
+                               EndLocation = Location.Null
+                       };
+                       Assign a = new SimpleAssign (fe, new SimpleName ("value", Location.Null), Location.Null);
                        Set.Block.AddStatement (new StatementExpression (a));
                }
 
diff --git a/mcs/tests/test-debug-10-ref.xml b/mcs/tests/test-debug-10-ref.xml
new file mode 100644 (file)
index 0000000..0bed00a
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<symbols>
+  <files>
+    <file id="1" name="test-debug-10.cs" checksum="c1382ff87ceabeec202eed6c58e40747" />
+  </files>
+  <methods>
+    <method token="0x6000001">
+      <sequencepoints>
+        <entry il="0x0" row="4" file_ref="1" hidden="false" />
+        <entry il="0x1" row="5" file_ref="1" hidden="false" />
+        <entry il="0x7" row="6" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000002">
+      <sequencepoints>
+        <entry il="0x0" row="10" file_ref="1" hidden="false" />
+        <entry il="0x1" row="11" file_ref="1" hidden="false" />
+        <entry il="0x9" row="12" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000003">
+      <sequencepoints>
+        <entry il="0x0" row="14" file_ref="1" hidden="false" />
+        <entry il="0x1" row="15" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000004">
+      <sequencepoints>
+        <entry il="0x0" row="20" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000005">
+      <sequencepoints>
+        <entry il="0x0" row="21" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000006">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+  </methods>
+</symbols>
\ No newline at end of file
diff --git a/mcs/tests/test-debug-10.cs b/mcs/tests/test-debug-10.cs
new file mode 100644 (file)
index 0000000..babec3a
--- /dev/null
@@ -0,0 +1,23 @@
+class C
+{
+       public static void Main ()
+       {
+               Prop = 3;
+       }
+       
+       static int Prop
+       {
+               get {
+                       return 4;
+               }
+               
+               set {
+               }
+       }
+       
+       static int PropAuto
+       {
+               get;
+               set;
+       }
+}
index dae29b4b61ebca175175648ae9a343eeda9ffcff..1644aa610da64f7c80a97a8864629cd09788e96b 100644 (file)
       </method>
     </type>
   </test>
+  <test name="dtest-anontype-01.cs">
+    <type name="C">
+      <method name="Void Main()" attrs="150">
+        <size>101</size>
+      </method>
+      <method name="Void Test()" attrs="129">
+        <size>2</size>
+      </method>
+      <method name="System.Object Factory()" attrs="145">
+        <size>14</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="&lt;&gt;__AnonType0`1[&lt;Field&gt;__T]">
+      <method name="&lt;Field&gt;__T get_Field()" attrs="2182">
+        <size>15</size>
+      </method>
+      <method name="Boolean Equals(System.Object)" attrs="198">
+        <size>47</size>
+      </method>
+      <method name="Int32 GetHashCode()" attrs="198">
+        <size>71</size>
+      </method>
+      <method name="System.String ToString()" attrs="198">
+        <size>75</size>
+      </method>
+      <method name="Void .ctor(&lt;Field&gt;__T)" attrs="6278">
+        <size>15</size>
+      </method>
+    </type>
+  </test>
   <test name="dtest-cls-01.cs">
     <type name="A">
       <method name="Void Main()" attrs="150">
       </method>
     </type>
   </test>
+  <test name="test-debug-10.cs">
+    <type name="C">
+      <method name="Void Main()" attrs="150">
+        <size>8</size>
+      </method>
+      <method name="Int32 get_Prop()" attrs="2193">
+        <size>10</size>
+      </method>
+      <method name="Void set_Prop(Int32)" attrs="2193">
+        <size>2</size>
+      </method>
+      <method name="Int32 get_PropAuto()" attrs="2193">
+        <size>14</size>
+      </method>
+      <method name="Void set_PropAuto(Int32)" attrs="2193">
+        <size>8</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-externalias-01.cs">
     <type name="Test">
       <method name="Int32 Main()" attrs="145">