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
Adding wasm debugger test.
Fixing using protocol version.
  • Loading branch information
thaystg committed Aug 19, 2021
commit ebc6bf4242066496bfa0f32d7c918b65db2188db
4 changes: 2 additions & 2 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -9286,7 +9286,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)

locals = mono_debug_lookup_locals (frame->de.method);
if (locals) {
if (CHECK_ICORDBG (FALSE)) //on icordbg the index value is correct, we don't need to fix it.
if (!CHECK_PROTOCOL_VERSION (2, 59)) //from newer protocol versions it's sent the pdb index
{
g_assert (pos < locals->num_locals);
pos = locals->locals [pos].index;
Expand Down Expand Up @@ -9343,7 +9343,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)

locals = mono_debug_lookup_locals (frame->de.method);
if (locals) {
if (CHECK_ICORDBG (FALSE))
if (!CHECK_PROTOCOL_VERSION (2, 59)) //from newer protocol versions it's sent the pdb index
{
g_assert (pos < locals->num_locals);
pos = locals->locals [pos].index;
Expand Down
15 changes: 15 additions & 0 deletions src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,21 @@ public async Task InspectTaskAtLocals() => await CheckInspectLocalsAtBreakpointS
}, "t_props", num_fields: 53);
});


[Fact]
public async Task InspectLocalsWithIndexAndPositionWithDifferentValues() //https://github.com/xamarin/xamarin-android/issues/6161
{
await EvaluateAndCheck(
"window.setTimeout(function() { invoke_static_method('[debugger-test] MainPage:CallSetValue'); }, 1);",
"dotnet://debugger-test.dll/debugger-test.cs", 758, 16,
"set_SomeValue",
locals_fn: (locals) =>
{
CheckNumber(locals, "view", 150);
}
);
}

//TODO add tests covering basic stepping behavior as step in/out/over
}
}
43 changes: 43 additions & 0 deletions src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,5 +725,48 @@ public async System.Threading.Tasks.Task<bool> AsyncMethod()
Console.WriteLine($"time for await");
return true;
}

}

public class MainPage
{
public MainPage()
{
}

int count = 0;
private int someValue;

public int SomeValue
{
get
{
return someValue;
}
set
{
someValue = value;
count++;

if (count == 10)
{
var view = 150;

if (view != 50)
{

}
System.Diagnostics.Debugger.Break();
}

SomeValue = count;
}
}

public static void CallSetValue()
{
var mainPage = new MainPage();
mainPage.SomeValue = 10;
}
}