Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Applied Thays's fix so that step into would work as step over in a hi…
…dden method.
  • Loading branch information
ilonatommy committed Nov 22, 2021
commit faf1e3c1a0a1af84ed2822f9e5fccf787bd14886
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public ExecutionContext(MonoSDBHelper sdbAgent, int id, object auxData)

public TaskCompletionSource<DebugStore> ready;
public bool IsRuntimeReady => ready != null && ready.Task.IsCompleted;

public bool IsSkippingHiddenMethod { get; set; }
public int ThreadId { get; set; }
public int Id { get; set; }
public object AuxData { get; set; }
Expand Down
33 changes: 32 additions & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,21 @@ private async Task<bool> SendCallStack(SessionId sessionId, ExecutionContext con
DebugStore store = await LoadStore(sessionId, token);
var method = await context.SdbAgent.GetMethodInfo(methodId, token);

if (context.IsSkippingHiddenMethod == true)
{
context.IsSkippingHiddenMethod = false;
await context.SdbAgent.Step(context.ThreadId, StepKind.Over, token);
await SendCommand(sessionId, "Debugger.resume", new JObject(), token);
return true;
}
if (j == 0 && method?.Info.IsHiddenFromDebugger == true)
{
context.IsSkippingHiddenMethod = true;
await context.SdbAgent.Step(context.ThreadId, StepKind.Out, token);
await SendCommand(sessionId, "Debugger.resume", new JObject(), token);
return true;
}

SourceLocation location = method?.Info.GetLocationByIl(il_pos);

// When hitting a breakpoint on the "IncrementCount" method in the standard
Expand Down Expand Up @@ -979,19 +994,35 @@ private async Task OnResume(MessageId msg_id, CancellationToken token)

private async Task<bool> Step(MessageId msgId, StepKind kind, CancellationToken token)
{
var stepKind = kind;
ExecutionContext context = GetContext(msgId);
if (context.CallStack == null)
return false;

if (context.CallStack.Count <= 1 && kind == StepKind.Out)
return false;

var step = await context.SdbAgent.Step(context.ThreadId, kind, token);
var a = context.store;
var b = context.CallStack.FirstOrDefault();
var loc = b.Location;
var sId = loc.IlLocation.Method.SourceId;
var c = loc.IlLocation.Method; //RUN, how to get location of HiddenMethod?
if (c.IsHiddenFromDebugger)
stepKind = StepKind.Over;

var step = await context.SdbAgent.Step(context.ThreadId, stepKind, token);
if (step == false) {
context.ClearState();
await SendCommand(msgId, "Debugger.stepOut", new JObject(), token);
return false;
}
var frameTop = context.CallStack.FirstOrDefault();
var loc2 = frameTop.Location;
if (loc.Equals(loc2))
{
var sthWrong = true;
step = sthWrong;
}

SendResponse(msgId, Result.Ok(new JObject()), token);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ public async Task<bool> Step(int thread_id, StepKind kind, CancellationToken tok
commandParamsWriter.Write(thread_id);
commandParamsWriter.Write((int)StepSize.Line);
commandParamsWriter.Write((int)kind);
commandParamsWriter.Write((int)(StepFilter.StaticCtor | StepFilter.DebuggerHidden)); //filter
commandParamsWriter.Write((int)(StepFilter.StaticCtor)); //filter
using var retDebuggerCmdReader = await SendDebuggerAgentCommand(CmdEventRequest.Set, commandParamsWriter, token);
if (retDebuggerCmdReader.HasError)
return false;
Expand Down