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
35 changes: 35 additions & 0 deletions src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,41 @@ await CheckInspectLocalsAtBreakpointSite(
}
);

[Fact]
public async Task InspectSimpleStringLocals() =>
await CheckInspectLocalsAtBreakpointSite(
"Math", "TestSimpleStrings", 13, "TestSimpleStrings",
"window.setTimeout(function() { invoke_static_method ('[debugger-test] Math:TestSimpleStrings')(); }, 1);",
wait_for_event_fn: async (pause_location) =>
{
var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value<string>());

var str_null = TString(null);
var str_empty = TString(String.Empty);
var str_spaces = TString(" ");
var str_esc = TString("\\");

await CheckProps(locals, new
{
str_null,
str_empty,
str_spaces,
str_esc,

strings = TArray("string[]", 4)
}, "locals");

var strings_arr = await GetObjectOnLocals(locals, "strings");
await CheckProps(strings_arr, new[]
{
str_null,
str_empty,
str_spaces,
str_esc
}, "locals#strings");
}
);

[Theory]
[InlineData(false)]
[InlineData(true)]
Expand Down
17 changes: 17 additions & 0 deletions src/mono/wasm/debugger/tests/debugger-test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,23 @@ public struct GenericStruct<T>
public static GenericStruct<bool[]> DelegateTargetForSignatureTest(Math m, GenericStruct<GenericStruct<T[]>> gs) => new GenericStruct<bool[]>();
}

public static void TestSimpleStrings()
{
string str_null = null;
string str_empty = String.Empty;
string str_spaces = " ";
string str_esc = "\\";

var strings = new[]
{
str_null,
str_empty,
str_spaces,
str_esc
};
Console.WriteLine ($"break here");
}

}

public class DebuggerTest
Expand Down
10 changes: 6 additions & 4 deletions src/mono/wasm/runtime/library_mono.js
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ var MonoSupportLib = {
},

_mono_wasm_add_string_var: function(var_value) {
if (var_value == 0) {
if (var_value === 0) {
MONO.mono_wasm_add_null_var ("string");
return;
}
Expand Down Expand Up @@ -1692,7 +1692,7 @@ var MonoSupportLib = {
value: {
type : "object",
className : fixed_class_name,
description : (toString == 0 ? fixed_class_name: Module.UTF8ToString (toString)),
description : (toString === 0 ? fixed_class_name: Module.UTF8ToString (toString)),
expanded : true,
isValueType : true,
__extra_vt_props: { klass: args.klass, value64: base64String },
Expand Down Expand Up @@ -1734,7 +1734,7 @@ var MonoSupportLib = {
value: {
type: "object",
className: fixed_class_name,
description: (toString == 0 ? fixed_class_name : Module.UTF8ToString (toString)),
description: (toString === 0 ? fixed_class_name : Module.UTF8ToString (toString)),
isValueType: true
}
});
Expand All @@ -1745,6 +1745,8 @@ var MonoSupportLib = {
let type_str = type;
if (typeof type != 'string')
type_str = Module.UTF8ToString (type);

if (str_value !== 0)
str_value = Module.UTF8ToString (str_value);

switch (type_str) {
Expand Down Expand Up @@ -1962,7 +1964,7 @@ var MonoSupportLib = {
value: {
type: "object",
className: fixed_class_name,
description: (toString == 0 ? fixed_class_name : Module.UTF8ToString (toString)),
description: (toString === 0 ? fixed_class_name : Module.UTF8ToString (toString)),
objectId: "dotnet:object:"+ objectId,
}
});
Expand Down