Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm][debugger]Trying to improve CI performance for debugger-tests #89525

Merged
merged 5 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public MonoProxy(ILogger logger, int runtimeId = 0, string loggerId = "", ProxyO
RuntimeId = runtimeId;
_options = options;
_defaultPauseOnExceptions = PauseOnExceptionsKind.Unset;
JustMyCode = options?.JustMyCode ?? false;
}

internal virtual Task<Result> SendMonoCommand(SessionId id, MonoCommands cmd, CancellationToken token) => SendCommand(id, "Runtime.evaluate", JObject.FromObject(cmd), token);
Expand Down Expand Up @@ -1277,7 +1278,11 @@ protected async Task<bool> Step(MessageId msgId, StepKind kind, CancellationToke
return false;

if (context.CallStack.Count <= 1 && kind == StepKind.Out)
return false;
{
Frame scope = context.CallStack.FirstOrDefault<Frame>();
if (scope is null || !(await context.SdbAgent.IsAsyncMethod(scope.Method.DebugId, token)))
return false;
}
var ret = await TryStepOnManagedCodeAndStepOutIfNotPossible(msgId, context, kind, token);
if (ret)
SendResponse(msgId, Result.Ok(new JObject()), token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ public async Task<AssemblyInfo> GetAssemblyInfo(int assemblyId, CancellationToke
}
else
{
if (asm.asmMetadataReader is null && proxy.JustMyCode) //load on demand
if (asm.asmMetadataReader is null) //load on demand
{
var assemblyAndPdbData = await GetDataFromAssemblyAndPdbAsync(asm.Name, true, token);
if (assemblyAndPdbData is not null)
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/debugger/BrowserDebugProxy/ProxyOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ public int DevToolsDebugPort
public string? LogPath { get; set; }
public bool RunningForBlazor { get; set; }
public bool IsFirefoxDebugging { get; set; }
public bool JustMyCode { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public async Task StartBrowserAndProxyAsync(HttpContext context,

_logger.LogInformation($"{messagePrefix} launching proxy for {con_str}");

_debuggerProxy = new DebuggerProxy(loggerFactory, loggerId: Id);
var options = new ProxyOptions();
options.JustMyCode = true;
_debuggerProxy = new DebuggerProxy(loggerFactory, loggerId: Id, options: options);
TestHarnessProxy.RegisterNewProxy(Id, _debuggerProxy);
var browserUri = new Uri(con_str);
WebSocket? ideSocket = await context.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false);
Expand Down
10 changes: 9 additions & 1 deletion src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ public async Task InspectTaskAtLocals() => await CheckInspectLocalsAtBreakpointS
await CheckProps(t_props, new
{
Status = TGetter("Status")
}, "t_props", num_fields: 58);
}, "t_props", num_fields: 33);
});


Expand Down Expand Up @@ -938,6 +938,12 @@ await EvaluateAndCheck(
[Fact]
public async Task InspectLocalsUsingClassFromLibraryUsingDebugTypeFull()
{
/*DebugType.Full generates symbols in a format that we don't understand (vs portable). If JMC=true (default for tests) then we will not load the assemblies
that don't have debug symbols. With JMC=false, the assembly will be loaded, even with unusable symbols, and the proxy will use the assembly metadata
instead.

This test specifically tries to inspect an object defined in the external library, so we need JMC=false here.*/
await SetJustMyCode(false);
thaystg marked this conversation as resolved.
Show resolved Hide resolved
var expression = $"{{ invoke_static_method('[debugger-test] DebugTypeFull:CallToEvaluateLocal'); }}";

await EvaluateAndCheck(
Expand Down Expand Up @@ -1002,6 +1008,8 @@ public async Task SetBreakpointInProjectWithColonInSourceName()
1160)]
public async Task InspectPropertiesOfObjectFromExternalLibrary(string className, int line)
{
//Setting JustMyCode = false because we are trying to inspect an object from an external library, and this is only allowed when JMC is disabled
await SetJustMyCode(false);
var expression = $"{{ invoke_static_method('[debugger-test] {className}:Run'); }}";

await EvaluateAndCheck(
Expand Down
2 changes: 2 additions & 0 deletions src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,8 @@ await EvaluateAndCheck(
[InlineData(false)]
public async Task SteppingIntoLibrarySymbolsLoadedFromSymbolServer(bool justMyCode)
{
//The test behavior is expecting to start with JustMyCode disabled
await SetJustMyCode(false);
string cachePath = _env.CreateTempDirectory("symbols-cache");
_testOutput.WriteLine($"** Using cache path: {cachePath}");
var searchPaths = new JArray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@
<Target Name="PrepareForWasmBuildApp" DependsOnTargets="Build">
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)native')"
Text="Cannot find %24(MicrosoftNetCoreAppRuntimePackRidDir)=$(MicrosoftNetCoreAppRuntimePackRidDir)native. Make sure to set the runtime configuration with %24(RuntimeConfiguration). Current value: $(RuntimeConfiguration)" />
<!-- Remove pdb from System.Private.CoreLib to have the same scenario that we have in a Blazor/Wasm user app -->
<Delete Files="$(MicrosoftNetCoreAppRuntimePackRidDir)native/System.Private.CoreLib.pdb" />
<ItemGroup>
<!-- Remove pdb from System.Private.CoreLib to have the same scenario that we have in a Blazor/Wasm user app -->
<FilesToDelete Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native/System.Private.CoreLib.pdb"/>
<!-- Remove pdb from all libraries in CI to improve CI performance and have the same scenario that we have in a Blazor/Wasm user app -->
<FilesToDelete Condition="'$(ContinuousIntegrationBuild)' == 'true'" Include="$(MicrosoftNetCoreAppRuntimePackRidDir)lib/$(AspNetCoreAppCurrent)/*.pdb" Exclude="$(MicrosoftNetCoreAppRuntimePackRidDir)lib/$(AspNetCoreAppCurrent)/System.Console.pdb"/>
</ItemGroup>
<Delete Files="@(FilesToDelete)"/>
<PropertyGroup>
<EnableDefaultWasmAssembliesToBundle>false</EnableDefaultWasmAssembliesToBundle>
<WasmAppDir>$(AppDir)</WasmAppDir>
Expand Down