diff options
author | David Karlaš <david.karlas@xamarin.com> | 2016-12-28 22:57:28 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2016-12-28 23:03:53 +0300 |
commit | 9a231cd18e80e46d3ad9981692015256ea816581 (patch) | |
tree | 22b54223cc5af70d8d35ac34544dfc9dcaa0a8ef /mcs/class/Mono.Debugger.Soft | |
parent | 7308137e43d976c50d7a211a1b4be4f5745d39c7 (diff) |
[Debugger] Fixed step-in and step-out in case of exception + unit tests
Before this change step-in and step-out didn’t place breakpoints on catch handlers which caused code to continue execution instead of stopping since it missed all breakpoints…
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 52 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 56 |
2 files changed, 82 insertions, 26 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index 61ed822f2e1..1687bcbc72d 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -485,23 +485,49 @@ public class Tests : TestsBase, ITest2 public static void ss6_2 () { } - [MethodImplAttribute (MethodImplOptions.NoInlining)] - public static void ss7 () { - try { - ss7_2 (); - ss7_3 (); - } catch { - } - ss7_2 (); + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static void ss7 () + { + ss7_2();//Used to test stepout inside ss7_2, which may not go to catch + ss7_2();//Used to test stepout inside ss7_2_1, which must go to catch + ss7_2();//Used to test stepover inside ss7_2, which must go to catch + ss7_2();//Used to test stepover inside ss7_2_1, which must go to catch + ss7_3();//Used to test stepin inside ss7_3, which must go to catch + ss7_2();//Used to test stepin inside ss7_2_1, which must go to catch } - [MethodImplAttribute (MethodImplOptions.NoInlining)] - public static void ss7_2 () { + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static void ss7_2_1 () + { + throw new Exception (); } - [MethodImplAttribute (MethodImplOptions.NoInlining)] - public static void ss7_3 () { - throw new Exception (); + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static void ss7_2_2 () + { + ss7_2_1(); + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static void ss7_2 () + { + try { + ss7_2_2(); + } + catch + { + } + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static void ss7_3 () + { + try { + throw new Exception (); + } + catch + { + } } [MethodImplAttribute (MethodImplOptions.NoInlining)] diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 05896473e39..17fa74bd75d 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -724,23 +724,53 @@ public class DebuggerTests assert_location (e, "ss6"); req.Disable (); - // Check that a step over stops at an EH clause + // Testing stepping in, over and out with exception handlers in same or caller method + + //stepout in ss7_2, which may not go to catch(instead out to ss7) e = run_until ("ss7_2"); - req = create_step (e); - req.Depth = StepDepth.Out; - req.Enable (); - e = step_once (); - assert_location (e, "ss7"); - req.Disable (); - req = create_step (e); - req.Depth = StepDepth.Over; - req.Enable (); - e = step_once (); - assert_location (e, "ss7"); - req.Disable (); + create_step (e); + assert_location (step_out(), "ss7"); + + //stepout in ss7_2_1, which must go to catch + run_until ("ss7_2_1"); + assert_location (step_out (), "ss7_2"); + + //stepover over ss7_2, which must go to catch + run_until ("ss7_2"); + assert_location (step_over (), "ss7_2");//move to "try {" line + assert_location (step_over (), "ss7_2");//move to "ss7_2_2();" line + assert_location (step_over (), "ss7_2");//step over ss7_2_2();, assume we are at "catch" now + assert_location (step_over (), "ss7_2");//move to { of catch + assert_location (step_over (), "ss7_2");//move to } of catch + assert_location (step_over (), "ss7_2");//move to } of method + assert_location (step_over (), "ss7");//finish method + + //stepover over ss7_2_1, which must go to catch + run_until ("ss7_2_1"); + assert_location (step_over (), "ss7_2_1");//move from { of method to "throw new Exception ();" + assert_location (step_over (), "ss7_2");//step over exception, being in ss7_2 means we are at catch + + //stepin in ss7_3, which must go to catch + run_until ("ss7_3"); + assert_location (step_into (), "ss7_3");//move to "try {" + assert_location (step_into (), "ss7_3");//move to "throw new Exception ();" + step_req.Disable (); + step_req.AssemblyFilter = new AssemblyMirror [] { (e as BreakpointEvent).Method.DeclaringType.Assembly }; + assert_location (step_into (), "ss7_3");//call "throw new Exception ();", we assume we end up at "catch" + assert_location (step_into (), "ss7_3");//move to { of catch + assert_location (step_into (), "ss7_3");//move to } of catch + assert_location (step_into (), "ss7_3");//move to } of method + assert_location (step_into (), "ss7");//move out to ss7 + + //stepover in ss7_2_1, which must go to catch + run_until ("ss7_2_1"); + assert_location (step_into (), "ss7_2_1");//move from { of method to "throw new Exception ();" + assert_location (step_into (), "ss7_2");//step in exception, being in ss7_2 means we are at catch + step_req.Disable (); // Check that stepping stops between nested calls e = run_until ("ss_nested_2"); + req = create_step (e); e = step_out (); assert_location (e, "ss_nested"); e = step_into (); |