diff options
author | Zoltan Varga <vargaz@gmail.com> | 2013-02-19 17:56:36 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2013-02-19 17:56:36 +0400 |
commit | b4fd5d27555bba2d0f0031c033d99e51686381e6 (patch) | |
tree | d38a35927ac7cb32746b036eeaf3f8a590cdd63f | |
parent | 0d8e4fd1c28b5460805ebd6da53368713cb684a4 (diff) |
Fix sdb tests.
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 149 |
1 files changed, 75 insertions, 74 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index f68778983a4..a0be9f83203 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -348,6 +348,11 @@ public class DebuggerTests Assert.AreEqual (m2.Name, (e as BreakpointEvent).Method.Name); } + void assert_location (Event e, string method) { + Assert.IsTrue (e is StepEvent); + Assert.AreEqual (method, (e as StepEvent).Method.Name); + } + [Test] public void SingleStepping () { Event e = run_until ("single_stepping"); @@ -358,22 +363,22 @@ public class DebuggerTests step_req = req; // Step over 'bool b = true' - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "single_stepping"); + + // Skip nop + step_once (); // Step into ss1 - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss1", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss1"); + + // Skip } + e = step_once (); // Step out of ss1 - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "single_stepping"); // Change to step over req.Disable (); @@ -381,10 +386,8 @@ public class DebuggerTests req.Enable (); // Step over ss2 - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "single_stepping"); // Change to step into req.Disable (); @@ -392,10 +395,8 @@ public class DebuggerTests req.Enable (); // Step into ss3 - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss3", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss3"); // Change to step out req.Disable (); @@ -403,10 +404,8 @@ public class DebuggerTests req.Enable (); // Step back into single_stepping - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "single_stepping"); // Change to step into req.Disable (); @@ -414,10 +413,8 @@ public class DebuggerTests req.Enable (); // Step into ss3_2 () - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss3_2", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss3_2"); // Change to step over req.Disable (); @@ -425,20 +422,19 @@ public class DebuggerTests req.Enable (); // Step over ss3_2_2 () - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss3_2", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss3_2"); // Recreate the request req.Disable (); req.Enable (); + // Skip } + e = step_once (); + // Step back into single_stepping () with the new request - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "single_stepping"); // Change to step into req.Disable (); @@ -446,10 +442,11 @@ public class DebuggerTests req.Enable (); // Step into ss4 () - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss4", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss4"); + + // Skip nop + e = step_once (); // Change to StepSize.Line req.Disable (); @@ -458,19 +455,15 @@ public class DebuggerTests req.Enable (); // Step over ss1 (); ss1 (); - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); + e = step_once (); // Step into ss2 () req.Disable (); req.Depth = StepDepth.Into; req.Enable (); - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss2", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss2"); req.Disable (); @@ -481,11 +474,12 @@ public class DebuggerTests req.AssemblyFilter = new AssemblyMirror [] { (e as BreakpointEvent).Method.DeclaringType.Assembly }; req.Enable (); + // Skip nop + e = step_once (); + // Step into is_even, skipping the linq stuff - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("is_even", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "is_even"); // FIXME: Check that single stepping works with lock (obj) @@ -499,13 +493,9 @@ public class DebuggerTests req.Enable (); // Check that single stepping works in out-of-line bblocks - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss6", (e as StepEvent).Method.Name); + e = step_once (); + e = step_once (); + assert_location (e, "ss6"); req.Disable (); // Check that a step over stops at an EH clause @@ -513,18 +503,14 @@ public class DebuggerTests req = vm.CreateStepRequest (e.Thread); req.Depth = StepDepth.Out; req.Enable (); - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss7", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss7"); req.Disable (); req = vm.CreateStepRequest (e.Thread); req.Depth = StepDepth.Over; req.Enable (); - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); - Assert.AreEqual ("ss7", (e as StepEvent).Method.Name); + e = step_once (); + assert_location (e, "ss7"); req.Disable (); } @@ -1354,6 +1340,9 @@ public class DebuggerTests // this on vtype methods e = run_until ("vtypes2"); + // Skip nop + e = single_step (e.Thread); + e = single_step (e.Thread); frame = e.Thread.GetFrames () [0]; @@ -1370,6 +1359,9 @@ public class DebuggerTests // this on static vtype methods e = run_until ("vtypes3"); + // Skip nop + e = single_step (e.Thread); + e = single_step (e.Thread); frame = e.Thread.GetFrames () [0]; @@ -1441,6 +1433,13 @@ public class DebuggerTests } } + Event step_once () { + vm.Resume (); + var e = GetNextEvent (); + Assert.IsTrue (e is StepEvent); + return e; + } + [Test] public void Locals () { var be = run_until ("locals1"); @@ -1456,20 +1455,19 @@ public class DebuggerTests object val = frame.GetValue (frame.Method.GetLocal ("i")); AssertValue (0, val); - // Execute i = 42 var req = vm.CreateStepRequest (be.Thread); req.Enable (); step_req = req; - vm.Resume (); - var e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); + // Skip nop + step_once (); + + // Execute i = 42 + var e = step_once (); Assert.AreEqual ("locals2", (e as StepEvent).Method.Name); // Execute s = "AB"; - vm.Resume (); - e = GetNextEvent (); - Assert.IsTrue (e is StepEvent); + e = step_once (); Assert.AreEqual ("locals2", (e as StepEvent).Method.Name); frame = e.Thread.GetFrames () [0]; @@ -2345,6 +2343,9 @@ public class DebuggerTests step_req = req; + // Skip nop + step_once (); + // Step into invoke2 vm.Resume (); e = GetNextEvent (); @@ -2463,7 +2464,7 @@ public class DebuggerTests Assert.AreEqual (0x0f, frames [1].Location.ILOffset); Assert.AreEqual ("exception_filter_method", frames [2].Location.Method.Name); - Assert.AreEqual (0x05, frames [2].Location.ILOffset); + Assert.AreEqual (0x06, frames [2].Location.ILOffset); Assert.AreEqual (0, frames [3].Location.Method.MetadataToken, 0); Assert.AreEqual (0, frames [3].Location.ILOffset); |