From: Thays Grazia Date: Tue, 3 Aug 2021 21:00:24 +0000 (-0300) Subject: [wasm] [debugger] Skip thread static field (#56749) X-Git-Tag: accepted/tizen/unified/20220110.054933~679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52d216eceb67d7cfcba875af53b0301478647f0c;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [wasm] [debugger] Skip thread static field (#56749) * Fix #56249 * Fix line test. * Fix indentation. * Addressing PR comments. * Fix line number changed --- diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index d5c8a34..2b6842c 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -8025,6 +8025,8 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint buffer_add_string (buf, f->name); buffer_add_typeid (buf, domain, mono_class_from_mono_type_internal (f->type)); buffer_add_int (buf, f->type->attrs); + if (CHECK_PROTOCOL_VERSION(2, 61)) + buffer_add_int(buf, mono_class_field_is_special_static(f)); i ++; } g_assert (i == nfields); diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs index 2cb7841..9b4b51c 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs @@ -981,6 +981,9 @@ namespace Microsoft.WebAssembly.Diagnostics string fieldNameStr = retDebuggerCmdReader.ReadString(); int typeId = retDebuggerCmdReader.ReadInt32(); //typeId retDebuggerCmdReader.ReadInt32(); //attrs + int isSpecialStatic = retDebuggerCmdReader.ReadInt32(); //is_special_static + if (isSpecialStatic == 1) + continue; if (fieldNameStr.Contains("k__BackingField")) { fieldNameStr = fieldNameStr.Replace("k__BackingField", ""); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs index 7bfc088..ed5d59e 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs @@ -259,7 +259,7 @@ namespace DebuggerTests { await EvaluateAndCheck( "window.setTimeout(function() { invoke_static_method_async('[debugger-test] UserBreak:BreakOnDebuggerBreakCommand'); }, 1);", - "dotnet://debugger-test.dll/debugger-test2.cs", 56, 4, + "dotnet://debugger-test.dll/debugger-test2.cs", 58, 4, "BreakOnDebuggerBreakCommand"); } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs index 6b4dcd6..51064a7 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs @@ -340,7 +340,7 @@ namespace DebuggerTests { var pause_location = await EvaluateAndCheck( "window.setTimeout(function() { invoke_static_method('[debugger-test] TestChild:TestWatchWithInheritance'); }, 1);", - "dotnet://debugger-test.dll/debugger-test2.cs", 83, 4, + "dotnet://debugger-test.dll/debugger-test2.cs", 122, 4, "TestWatchWithInheritance"); var frame_id = pause_location["callFrames"][0]["callFrameId"].Value(); var frame_locals = await GetProperties(frame_id); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs index 35bc79f..b09e32a 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs @@ -91,7 +91,7 @@ namespace DebuggerTests [Fact] public async Task InspectLocalsTypesAtBreakpointSite() => await CheckInspectLocalsAtBreakpointSite( - "dotnet://debugger-test.dll/debugger-test2.cs", 48, 8, "Types", + "dotnet://debugger-test.dll/debugger-test2.cs", 50, 8, "Types", "window.setTimeout(function() { invoke_static_method (\"[debugger-test] Fancy:Types\")(); }, 1);", use_cfo: false, test_fn: (locals) => @@ -826,6 +826,25 @@ namespace DebuggerTests Assert.True(source.IsOk); } + [Fact] + public async Task InspectTaskAtLocals() => await CheckInspectLocalsAtBreakpointSite( + "InspectTask", + "RunInspectTask", + 7, + "b__0" , + $"window.setTimeout(function() {{ invoke_static_method_async('[debugger-test] InspectTask:RunInspectTask'); }}, 1);", + wait_for_event_fn: async (pause_location) => + { + var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); + + var t_props = await GetObjectOnLocals(locals, "t"); + await CheckProps(t_props, new + { + s_taskIdCounter = TNumber(0), + Status = TGetter("Status") + }, "t_props", num_fields: 53); + }); + //TODO add tests covering basic stepping behavior as step in/out/over } } diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj index 797fa16..0503fea 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj @@ -11,6 +11,7 @@ + diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test2.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-test2.cs index d360819..2a5d525 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test2.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test2.cs @@ -3,6 +3,8 @@ using System; using System.Diagnostics; +using System.Net.Http.Json; + public class Misc { //Only append content to this class as the test suite depends on line info public static int CreateObject(int foo, int bar) @@ -57,6 +59,43 @@ public class UserBreak { } } +public class WeatherForecast +{ + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } +} + +public class InspectTask +{ + public static async System.Threading.Tasks.Task RunInspectTask() + { + WeatherForecast[] forecasts = null; + var httpClient = new System.Net.Http.HttpClient(); + var getJsonTask = httpClient.GetFromJsonAsync("http://localhost:9400/weather.json"); + try + { + await getJsonTask.ContinueWith(t => + { + if (t.IsCompletedSuccessfully) + forecasts = t.Result; + + if (t.IsFaulted) + throw t.Exception!; + }); + } + catch (Exception ex) + { + Console.WriteLine($"error {ex}"); + return; + } + } +} + public class TestParent2 { public int k = 30; diff --git a/src/mono/wasm/debugger/tests/debugger-test/weather.json b/src/mono/wasm/debugger/tests/debugger-test/weather.json new file mode 100644 index 0000000..e1ca33d --- /dev/null +++ b/src/mono/wasm/debugger/tests/debugger-test/weather.json @@ -0,0 +1,32 @@ +[ + { + "dateFormatted": "06/05/2018", + "temperatureC": 1, + "summary": "Freezing", + "temperatureF": 33 + }, + { + "dateFormatted": "07/05/2018", + "temperatureC": 14, + "summary": "Bracing", + "temperatureF": 57 + }, + { + "dateFormatted": "08/05/2018", + "temperatureC": -13, + "summary": "Freezing", + "temperatureF": 9 + }, + { + "dateFormatted": "09/05/2018", + "temperatureC": -16, + "summary": "Balmy", + "temperatureF": 4 + }, + { + "dateFormatted": "10/05/2018", + "temperatureC": -2, + "summary": "Chilly", + "temperatureF": 29 + } +]