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:
authorAnkit Jain <radical@gmail.com>2020-05-14 18:48:51 +0300
committerGitHub <noreply@github.com>2020-05-14 18:48:51 +0300
commit1a022edfcb95b0e23bde81d887e23ade18ffde57 (patch)
tree97061ac614d1fa89ad5059ba8a5657df417a3237 /sdks/wasm/DebuggerTestSuite
parent13c5c4129e231324451e7253f5326eddce83500e (diff)
[wasm][debugger] Clear valuetypes cache on Debugger.resume (#19778)
* [wasm][debugger] Clear valuetypes cache on Debugger.resume - This fixes: 1. Check valuetype properties 2. Debugger.resume, over some code that updates that valuetype 3. That valuetype's properties show older values * [wasm][debugger] Send mono_wasm_debugger_resume only if stopped on .. a managed frame.
Diffstat (limited to 'sdks/wasm/DebuggerTestSuite')
-rw-r--r--sdks/wasm/DebuggerTestSuite/Tests.cs133
1 files changed, 133 insertions, 0 deletions
diff --git a/sdks/wasm/DebuggerTestSuite/Tests.cs b/sdks/wasm/DebuggerTestSuite/Tests.cs
index 74c874566f4..fdd97c017db 100644
--- a/sdks/wasm/DebuggerTestSuite/Tests.cs
+++ b/sdks/wasm/DebuggerTestSuite/Tests.cs
@@ -1001,6 +1001,139 @@ namespace DebuggerTests
});
}
+ [Fact]
+ public async Task CheckUpdatedValueTypeFieldsOnResume ()
+ {
+ var insp = new Inspector ();
+ //Collect events
+ var scripts = SubscribeToScripts(insp);
+
+ await Ready();
+ await insp.Ready (async (cli, token) => {
+ ctx = new DebugTestContext (cli, insp, token, scripts);
+ var debugger_test_loc = "dotnet://debugger-test.dll/debugger-valuetypes-test.cs";
+
+ var lines = new [] {186, 189};
+ await SetBreakpoint (debugger_test_loc, lines [0], 3);
+ await SetBreakpoint (debugger_test_loc, lines [1], 3);
+
+ var pause_location = await EvaluateAndCheck (
+ "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.ValueTypesTest:MethodUpdatingValueTypeMembers'); }, 1);",
+ debugger_test_loc, lines [0], 3, "MethodUpdatingValueTypeMembers");
+
+ var dt = new DateTime (1, 2, 3, 4, 5, 6);
+ await CheckLocals (pause_location, dt);
+
+ // Resume
+ dt = new DateTime (9, 8, 7, 6, 5, 4);
+ pause_location = await SendCommandAndCheck (JObject.FromObject (new{}), "Debugger.resume", debugger_test_loc, lines[1], 3, "MethodUpdatingValueTypeMembers");
+ await CheckLocals (pause_location, dt);
+ });
+
+ async Task CheckLocals (JToken pause_location, DateTime dt)
+ {
+ var locals = await GetProperties (pause_location ["callFrames"][0]["callFrameId"].Value<string> ());
+ await CheckProps (locals, new {
+ obj = TObject ("DebuggerTests.ClassForToStringTests"),
+ vt = TObject ("DebuggerTests.StructForToStringTests")
+ }, "locals");
+
+ var obj_props = await GetObjectOnLocals (locals, "obj");
+ {
+ await CheckProps (obj_props, new {
+ DT = TValueType ("System.DateTime", dt.ToString ())
+ }, "locals#obj.DT", num_fields: 5);
+
+ await CheckDateTime (obj_props, "DT", dt);
+ }
+
+ var vt_props = await GetObjectOnLocals (locals, "obj");
+ {
+ await CheckProps (vt_props, new {
+ DT = TValueType ("System.DateTime", dt.ToString ())
+ }, "locals#obj.DT", num_fields: 5);
+
+ await CheckDateTime (vt_props, "DT", dt);
+ }
+ }
+ }
+
+ [Fact]
+ public async Task CheckUpdatedValueTypeLocalsOnResumeAsync ()
+ {
+ var insp = new Inspector ();
+ //Collect events
+ var scripts = SubscribeToScripts(insp);
+
+ await Ready();
+ await insp.Ready (async (cli, token) => {
+ ctx = new DebugTestContext (cli, insp, token, scripts);
+ var debugger_test_loc = "dotnet://debugger-test.dll/debugger-valuetypes-test.cs";
+
+ var lines = new [] { 195, 197 };
+ await SetBreakpoint (debugger_test_loc, lines [0], 3);
+ await SetBreakpoint (debugger_test_loc, lines [1], 3);
+
+ var pause_location = await EvaluateAndCheck (
+ "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.ValueTypesTest:MethodUpdatingValueTypeLocalsAsync'); }, 1);",
+ debugger_test_loc, lines [0], 3, "MoveNext");
+
+ var dt = new DateTime (1, 2, 3, 4, 5, 6);
+ var locals = await GetProperties (pause_location ["callFrames"][0]["callFrameId"].Value<string> ());
+ await CheckDateTime (locals, "dt", dt);
+
+ // Resume
+ dt = new DateTime (9, 8, 7, 6, 5, 4);
+ pause_location = await SendCommandAndCheck (JObject.FromObject (new{}), "Debugger.resume", debugger_test_loc, lines[1], 3, "MoveNext");
+ locals = await GetProperties (pause_location ["callFrames"][0]["callFrameId"].Value<string> ());
+ await CheckDateTime (locals, "dt", dt);
+ });
+ }
+
+ [Fact]
+ public async Task CheckUpdatedVTArrayMembersOnResume ()
+ {
+ var insp = new Inspector ();
+ //Collect events
+ var scripts = SubscribeToScripts(insp);
+
+ await Ready();
+ await insp.Ready (async (cli, token) => {
+ ctx = new DebugTestContext (cli, insp, token, scripts);
+ var debugger_test_loc = "dotnet://debugger-test.dll/debugger-valuetypes-test.cs";
+
+ var lines = new [] { 205, 207 };
+ await SetBreakpoint (debugger_test_loc, lines [0], 3);
+ await SetBreakpoint (debugger_test_loc, lines [1], 3);
+
+ var dt = new DateTime (1, 2, 3, 4, 5, 6);
+ var pause_location = await EvaluateAndCheck (
+ "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.ValueTypesTest:MethodUpdatingVTArrayMembers'); }, 1);",
+ debugger_test_loc, lines [0], 3, "MethodUpdatingVTArrayMembers");
+ await CheckArrayElements (pause_location, dt);
+
+ // Resume
+ dt = new DateTime (9, 8, 7, 6, 5, 4);
+ pause_location = await SendCommandAndCheck (JObject.FromObject (new{}), "Debugger.resume", debugger_test_loc, lines[1], 3, "MethodUpdatingVTArrayMembers");
+ await CheckArrayElements (pause_location, dt);
+ });
+
+ async Task CheckArrayElements (JToken pause_location, DateTime dt)
+ {
+ var locals = await GetProperties (pause_location ["callFrames"][0]["callFrameId"].Value<string> ());
+ await CheckProps (locals, new {
+ ssta = TArray ("DebuggerTests.StructForToStringTests[]", 1)
+ }, "locals");
+
+ var ssta = await GetObjectOnLocals (locals, "ssta");
+ var sst0 = await GetObjectOnLocals (ssta, "0");
+ await CheckProps (sst0, new {
+ DT = TValueType ("System.DateTime", dt.ToString ())
+ }, "dta [0]", num_fields: 5);
+
+ await CheckDateTime (sst0, "DT", dt);
+ }
+ }
[Theory]
[InlineData (false)]
[InlineData (true)]