diff options
author | Thays Grazia <thaystg@gmail.com> | 2019-07-09 22:07:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 22:07:46 +0300 |
commit | d33747a6e3bdb13803ae2dcd7077edd7df094b5b (patch) | |
tree | 6d6cb380b12a4df6304bf1dfa3b29970d4af702c /mcs/class/Mono.Debugger.Soft | |
parent | a6983e4a37d22ecb8adeb5982d1288f7554453e6 (diff) |
[debugger] Update client thread frames after SetIP. (#15449)
* Fixes #13408
PR of draft https://github.com/mono/mono/pull/14667
* Disabling test on Interpreter.
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
3 files changed, 39 insertions, 1 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index 75e647374c9..f07725ddcf9 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -427,7 +427,7 @@ namespace Mono.Debugger.Soft * with newer runtimes, and vice versa. */ internal const int MAJOR_VERSION = 2; - internal const int MINOR_VERSION = 51; + internal const int MINOR_VERSION = 52; enum WPSuspendPolicy { NONE = 0, diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs index a3a4dcfc7a7..4ee43c9fb53 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs @@ -168,6 +168,10 @@ namespace Mono.Debugger.Soft throw new ArgumentNullException ("loc"); try { vm.conn.Thread_SetIP (id, loc.Method.Id, loc.ILOffset); + if (vm.conn.Version.AtLeast(2, 52)) { + InvalidateFrames(); + FetchFrames(true); + } } catch (CommandException ex) { if (ex.ErrorCode == ErrorCode.INVALID_ARGUMENT) throw new ArgumentException ("loc doesn't refer to a location in the current method of this thread.", "loc"); diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 1f394d53c53..cef1452f26e 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -4436,6 +4436,40 @@ public class DebuggerTests } [Test] + [Category ("NotWorkingRuntimeInterpreter")] + public void SetIP2 () { + var bevent = run_until ("set_ip_1"); + + var invalid_loc = bevent.Thread.GetFrames ()[0].Location; + + var req = create_step (bevent); + var e = step_out (); + req.Disable (); + var frames = e.Thread.GetFrames (); + var locs = frames [0].Method.Locations; + + var next_loc = locs.First (l => (l.LineNumber == frames [0].Location.LineNumber + 3)); + + e.Thread.SetIP (next_loc); + + Assert.AreEqual(next_loc.ILOffset, e.Thread.GetFrames ()[0].Location.ILOffset); + /* Check that i ++; j = 5; was skipped */ + bevent = run_until ("set_ip_2"); + var f = bevent.Thread.GetFrames ()[1]; + AssertValue (2, f.GetValue (f.Method.GetLocal ("i"))); + AssertValue (0, f.GetValue (f.Method.GetLocal ("j"))); + + // Error handling + AssertThrows<ArgumentNullException> (delegate { + e.Thread.SetIP (null); + }); + + AssertThrows<ArgumentException> (delegate { + e.Thread.SetIP (invalid_loc); + }); + } + + [Test] public void SetIPSingleStep () { // Check that single stepping after set-ip steps from the new ip var bevent = run_until ("set_ip_1"); |