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] Support indexing by array schema #92337

Merged
merged 7 commits into from
Sep 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ private void Write<T1, T2>(T1 type, T2 value) where T1 : struct where T2 : struc

public void WriteObj(DotnetObjectId objectId, MonoSDBHelper SdbHelper)
{
if (objectId.Scheme == "object")
if (objectId.Scheme == "object" || objectId.Scheme == "array")
{
Write(ElementType.Class, objectId.Value);
ilonatommy marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public async Task EvaluateIndexingNegative() => await CheckInspectLocalsAtBreakp
Assert.Equal("Unable to evaluate element access 'f.idx0[2]': Cannot apply indexing with [] to a primitive object of type 'number'", res.Error["result"]?["description"]?.Value<string>());
var exceptionDetailsStack = res.Error["exceptionDetails"]?["stackTrace"]?["callFrames"]?[0];
Assert.Equal("DebuggerTests.EvaluateLocalsWithIndexingTests.EvaluateLocals", exceptionDetailsStack?["functionName"]?.Value<string>());
Assert.Equal(556, exceptionDetailsStack?["lineNumber"]?.Value<int>());
Assert.Equal(559, exceptionDetailsStack?["lineNumber"]?.Value<int>());
Assert.Equal(12, exceptionDetailsStack?["columnNumber"]?.Value<int>());
(_, res) = await EvaluateOnCallFrame(id, "f[1]", expect_ok: false );
Assert.Equal( "Unable to evaluate element access 'f[1]': Cannot apply indexing with [] to an object of type 'DebuggerTests.EvaluateLocalsWithIndexingTests.TestEvaluate'", res.Error["result"]?["description"]?.Value<string>());
Expand Down Expand Up @@ -650,7 +650,7 @@ await EvaluateOnCallFrameAndCheck(id,

[Fact]
public async Task EvaluateObjectByNonIntLocals() => await CheckInspectLocalsAtBreakpointSite(
"DebuggerTests.EvaluateLocalsWithIndexingTests", "EvaluateLocals", 12, "DebuggerTests.EvaluateLocalsWithIndexingTests.EvaluateLocals",
"DebuggerTests.EvaluateLocalsWithIndexingTests", "EvaluateLocals", 13, "DebuggerTests.EvaluateLocalsWithIndexingTests.EvaluateLocals",
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateLocalsWithIndexingTests:EvaluateLocals'); })",
wait_for_event_fn: async (pause_location) =>
{
Expand All @@ -662,7 +662,8 @@ await EvaluateOnCallFrameAndCheck(id,
("f[shortString]", TBool(false)),
("f[aFloat]", TNumber(1)),
("f[aDouble]", TNumber(2)),
("f[aDecimal]", TNumber(3)) // object
("f[aDecimal]", TNumber(3)),
("f[arr]", TChar('t'))
);
});

Expand Down Expand Up @@ -722,7 +723,7 @@ public async Task EvaluateIndexingByExpressionNegative() => await CheckInspectLo
Assert.Equal("Unable to evaluate element access 'f.numList[\"a\" + 1]': Cannot index with an object of type 'string'", res.Error["result"]?["description"]?.Value<string>());
var exceptionDetailsStack = res.Error["exceptionDetails"]?["stackTrace"]?["callFrames"]?[0];
Assert.Equal("DebuggerTests.EvaluateLocalsWithIndexingTests.EvaluateLocals", exceptionDetailsStack?["functionName"]?.Value<string>());
Assert.Equal(556, exceptionDetailsStack?["lineNumber"]?.Value<int>());
Assert.Equal(559, exceptionDetailsStack?["lineNumber"]?.Value<int>());
Assert.Equal(12, exceptionDetailsStack?["columnNumber"]?.Value<int>());
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ public class TestEvaluate
public int this[double key] => (int)key;
public int this[float key] => (int)key;
public int this[decimal key] => (int)key;
public char this[char[] arr] => arr.Length == 0 ? '0' : arr[0];

public void run()
{
Expand Down Expand Up @@ -561,6 +562,7 @@ public static void EvaluateLocals()
float aFloat = 1.23f;
double aDouble = 2.34;
decimal aDecimal = 3.34m;
char[] arr = new char[] { 't', 'e', 's', 't' };
}
}

Expand Down
Loading