From 4b339f1b9cadcb1a9028b2194fecf1f0e23a5f7a Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 5 Mar 2021 04:57:10 -0500 Subject: [PATCH 1/3] [wasm][debugger] Correctly skip static properties when iterating type .. members. --- src/mono/mono/mini/mini-wasm-debugger.c | 3 +++ src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs | 2 +- .../wasm/debugger/tests/debugger-test/debugger-cfo-test.cs | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/mini-wasm-debugger.c b/src/mono/mono/mini/mini-wasm-debugger.c index 8795abc655dfa3..e93320adebb4a7 100644 --- a/src/mono/mono/mini/mini-wasm-debugger.c +++ b/src/mono/mono/mini/mini-wasm-debugger.c @@ -1272,6 +1272,9 @@ describe_object_properties_for_klass (void *obj, MonoClass *klass, gboolean isAs continue; } + if (p->get->flags & METHOD_ATTRIBUTE_STATIC) + continue; + EM_ASM ({ MONO.mono_wasm_add_properties_var ($0, { field_offset: $1, is_own: $2, attr: $3, owner_class: $4 }); }, p->name, pnum, is_own, p->attrs, klass_name); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs index 9e964558b52449..d16844783c9489 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs @@ -718,7 +718,7 @@ await CompareObjectPropertiesFor(frame_locals, "dto", Day = TNumber(2), Year = TNumber(2020), DayOfWeek = TEnum("System.DayOfWeek", "Thursday") - }, "dto_props", num_fields: 22); + }, "dto_props", num_fields: 20); var DT = new DateTime(2004, 10, 15, 1, 2, 3); var DTO = new DateTimeOffset(dt0, new TimeSpan(2, 14, 0)); diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs index 66a964a2808178..31dfe11d1e6033 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs @@ -58,6 +58,9 @@ class ClassWithProperties public DateTime[] DTArray { get { return new DateTime[] { new DateTime(6, 7, 8, 9, 10, 11), new DateTime(1, 2, 3, 4, 5, 6) }; } } public DateTime DTAutoProperty { get; set; } public string StringField; + + private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1); + public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4); } struct StructWithProperties @@ -71,5 +74,8 @@ struct StructWithProperties public DateTime[] DTArray { get { return new DateTime[] { new DateTime(6, 7, 8, 9, 10, 11), new DateTime(1, 2, 3, 4, 5, 6) }; } } public DateTime DTAutoProperty { get; set; } public string StringField; + + private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1); + public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4); } } From 24b575e17b553d4b359c774a78fc2bfe0bfa94ef Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 5 Mar 2021 05:24:40 -0500 Subject: [PATCH 2/3] [wasm][debugger][tests] cleanup --- src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs b/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs index 1e9f155b19f16b..fdd23b0f58f818 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs @@ -5,13 +5,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Net.WebSockets; using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Logging; using Microsoft.WebAssembly.Diagnostics; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -430,7 +426,6 @@ internal async Task SendCommandAndCheck(JObject args, string method, st AssertEqual(function_name, wait_res["callFrames"]?[0]?["functionName"]?.Value(), top_frame?.ToString()); } - Console.WriteLine(top_frame); if (script_loc != null && line >= 0) CheckLocation(script_loc, line, column, scripts, top_frame["location"]); From 7c6ea540444c9415e3e90614c470b883ed8b2d80 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 5 Mar 2021 06:20:04 -0500 Subject: [PATCH 3/3] [wasm][debugger][tests] Use SingleLine for the logger --- src/mono/wasm/debugger/BrowserDebugHost/Startup.cs | 6 ++++-- src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs | 5 +++-- .../wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs index 0a28e88096272d..c4de27f4ee9f6f 100644 --- a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs +++ b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs @@ -153,8 +153,10 @@ async Task ConnectProxy(HttpContext context) var endpoint = new Uri($"ws://{devToolsHost.Authority}{context.Request.Path}"); try { - using ILoggerFactory loggerFactory = LoggerFactory.Create( - builder => builder.AddConsole().AddFilter(null, LogLevel.Information)); + using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => + builder.AddSimpleConsole(options => options.SingleLine = true) + .AddFilter(null, LogLevel.Information) + ); context.Request.Query.TryGetValue("urlSymbolServer", out StringValues urlSymbolServerList); var proxy = new DebuggerProxy(loggerFactory, urlSymbolServerList.ToList()); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs b/src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs index 8c9edc677cc457..c555cd0439767c 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs @@ -41,8 +41,9 @@ public Inspector() _cancellationTokenSource = new CancellationTokenSource(); Token = _cancellationTokenSource.Token; - _loggerFactory = LoggerFactory.Create( - builder => builder.AddConsole().AddFilter(null, LogLevel.Trace)); + _loggerFactory = LoggerFactory.Create(builder => + builder.AddSimpleConsole(options => options.SingleLine = true) + .AddFilter(null, LogLevel.Trace)); Client = new InspectorClient(_loggerFactory.CreateLogger()); _logger = _loggerFactory.CreateLogger(); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs b/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs index d50a8454949311..7a5c30d9cc9e82 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs @@ -38,7 +38,8 @@ public static Task Start(string chromePath, string appPath, string pagePath) }) .ConfigureLogging(logging => { - logging.AddConsole(); + logging.AddSimpleConsole(options => options.SingleLine = true) + .AddFilter(null, LogLevel.Information); }) .ConfigureServices((ctx, services) => {