Skip to content
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
3 changes: 3 additions & 0 deletions src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ public ExecutionContext(MonoSDBHelper sdbAgent, int id, object auxData, PauseOnE
SdbAgent = sdbAgent;
PauseOnExceptions = pauseOnExceptions;
Destroyed = false;
FrameworkScriptList = new();
}
public ExecutionContext CreateChildAsyncExecutionContext(SessionId sessionId)
=> new ExecutionContext(null, Id, AuxData, PauseOnExceptions)
Expand Down Expand Up @@ -434,6 +435,8 @@ public bool CopyDataFromParentContext()
public int ThreadId { get; set; }
public int Id { get; set; }
public ExecutionContext ParentContext { get; private set; }

public List<int> FrameworkScriptList { get; init; }
public SessionId SessionId { get; private set; }

public bool PausedOnWasm { get; set; }
Expand Down
30 changes: 25 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,15 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, JObject par
Contexts.ClearContexts(sessionId);
return false;
}

case "Debugger.scriptParsed":
{
if (args["url"]?.ToString()?.Contains("/_framework/") == true) //is from dotnet runtime framework
{
if (Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context))
context.FrameworkScriptList.Add(args["scriptId"].Value<int>());
}
return false;
}
case "Debugger.paused":
{
return await OnDebuggerPaused(sessionId, args, token);
Expand Down Expand Up @@ -237,11 +245,23 @@ protected async Task<bool> OnDebuggerPaused(SessionId sessionId, JObject args, C
}
default:
{
//avoid pausing when justMyCode is enabled and it's a wasm function
if (JustMyCode && args?["callFrames"]?[0]?["scopeChain"]?[0]?["type"]?.Value<string>()?.Equals("wasm-expression-stack") == true)
if (JustMyCode)
{
await SendCommand(sessionId, "Debugger.stepOut", new JObject(), token);
return true;
if (!Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context))
return false;
//avoid pausing when justMyCode is enabled and it's a wasm function
if (args?["callFrames"]?[0]?["scopeChain"]?[0]?["type"]?.Value<string>()?.Equals("wasm-expression-stack") == true)
{
await SendCommand(sessionId, "Debugger.stepOut", new JObject(), token);
return true;
}
//avoid pausing when justMyCode is enabled and it's a framework function
var scriptId = args?["callFrames"]?[0]?["location"]?["scriptId"]?.Value<int>();
if (!context.IsSkippingHiddenMethod && !context.IsSteppingThroughMethod && scriptId is not null && context.FrameworkScriptList.Contains(scriptId.Value))
{
await SendCommand(sessionId, "Debugger.stepOut", new JObject(), token);
return true;
}
}
break;
}
Expand Down