From: Marek Safar Date: Tue, 7 Feb 2012 16:51:30 +0000 (+0000) Subject: Allow setting a breakpoint on automatically implemented properties X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=f174510809a27bd1ac76c4f4f7344110a8898fd6;p=mono.git Allow setting a breakpoint on automatically implemented properties --- diff --git a/mcs/mcs/property.cs b/mcs/mcs/property.cs index 7e7d55de216..0d417fde73f 100644 --- a/mcs/mcs/property.cs +++ b/mcs/mcs/property.cs @@ -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 index 00000000000..0bed00aa683 --- /dev/null +++ b/mcs/tests/test-debug-10-ref.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 index 00000000000..babec3ab4b0 --- /dev/null +++ b/mcs/tests/test-debug-10.cs @@ -0,0 +1,23 @@ +class C +{ + public static void Main () + { + Prop = 3; + } + + static int Prop + { + get { + return 4; + } + + set { + } + } + + static int PropAuto + { + get; + set; + } +} diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml index dae29b4b61e..1644aa610da 100644 --- a/mcs/tests/ver-il-net_4_5.xml +++ b/mcs/tests/ver-il-net_4_5.xml @@ -2866,6 +2866,39 @@ + + + + 101 + + + 2 + + + 14 + + + 7 + + + + + 15 + + + 47 + + + 71 + + + 75 + + + 15 + + + @@ -55739,6 +55772,28 @@ + + + + 8 + + + 10 + + + 2 + + + 14 + + + 8 + + + 7 + + +