diff options
author | Zoltan Varga <vargaz@gmail.com> | 2016-11-09 22:42:21 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2016-11-09 22:53:12 +0300 |
commit | f42685a7efdf14aeb61c73cb15801d706c93b189 (patch) | |
tree | cea5379a64495cf04f20a5e85a3c8cf6d96ca4dd | |
parent | def42333a42b28dbff5106d045e528fe46b69a67 (diff) |
[sdb] Avoid asserting when trying to single step on a thread with no managed frames. Fixes #34802.
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 20 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 22 |
2 files changed, 42 insertions, 0 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index cc2ab66960f..e4817ee4be5 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -430,6 +430,7 @@ public class Tests : TestsBase, ITest2 ss_recursive2 (1); ss_recursive_chaotic (); ss_fp_clobber (); + ss_no_frames (); } [MethodImplAttribute (MethodImplOptions.NoInlining)] @@ -680,6 +681,25 @@ public class Tests : TestsBase, ITest2 } [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void ss_no_frames () { + Action a = ss_no_frames_2; + var ar = a.BeginInvoke (null, null); + ar.AsyncWaitHandle.WaitOne (); + // Avoid waiting every time this runs + if (static_i == 56) + Thread.Sleep (200); + ss_no_frames_3 (); + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void ss_no_frames_2 () { + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void ss_no_frames_3 () { + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] public static bool is_even (int i) { return i % 2 == 0; } diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 1933fc5e827..8f929048d1b 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -891,6 +891,28 @@ public class DebuggerTests } [Test] + public void SingleSteppingNoFrames () { + // + // Test what happens when starting a single step operation on a thread + // with no managed frames + // + // Run a delegate on a tp thread + var e = run_until ("ss_no_frames_2"); + + var this_type = e.Thread.GetFrames ()[0].Method.DeclaringType; + this_type.SetValue (this_type.GetField ("static_i"), vm.CreateValue (56)); + + var thread = e.Thread; + var e2 = run_until ("ss_no_frames_3"); + // The tp thread should be idle now + step_req = vm.CreateStepRequest (thread); + step_req.Depth = StepDepth.Over; + AssertThrows<Exception> (delegate { + step_req.Enable (); + }); + } + + [Test] public void MethodEntryExit () { run_until ("single_stepping"); |