Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Karlaš <david.karlas@gmail.com>2017-01-04 09:49:11 +0300
committerGitHub <noreply@github.com>2017-01-04 09:49:11 +0300
commit41bb2b531662364fbfd1a3d763d0bc99277d2f3f (patch)
treefdca33e392c6e4107a3f945464612df566ec0442 /mcs/class/Mono.Debugger.Soft
parentce68b90aa7bd6c88c88b63a520676e791b69eb25 (diff)
parent9a231cd18e80e46d3ad9981692015256ea816581 (diff)
Merge pull request #4196 from DavidKarlas/stepAndCatchException
[Debugger] Fixed step-in and step-out in case of exception + unit tests
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r--mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs52
-rw-r--r--mcs/class/Mono.Debugger.Soft/Test/dtest.cs56
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 dbc13f065e6..f6312cb1703 100644
--- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
+++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
@@ -723,23 +723,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 ();