Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e24179e
[release/8.0-staging] [browser] Use whole assembly name when looking …
maraf Jan 19, 2024
5e9e29f
[release/8.0][browser] BrowserWebSocket.ReceiveAsync after server ini…
pavelsavara Jan 23, 2024
fe443a9
[release/8.0][mono][debugger] Debugger improvements on .net8 (#97160)
thaystg Jan 24, 2024
d7a4118
[release/8.0-staging] Add additionalSize for the DisableOptData (#97479)
github-actions[bot] Jan 26, 2024
1901707
[release/8.0-staging] Bump to new Ubuntu 22.04 queue for PPC64 (#97555)
github-actions[bot] Jan 26, 2024
b54886b
[release/8.0-staging] Fix compilation error with generic type attribu…
github-actions[bot] Jan 31, 2024
e6d8079
Remove use of NewHolder as field. (#97843)
github-actions[bot] Feb 6, 2024
b0025c7
[release/8.0-staging] Update dependencies from dotnet/runtime-assets …
dotnet-maestro[bot] Feb 7, 2024
d8042d4
Update dependencies from https://github.com/dotnet/hotreload-utils bu…
dotnet-maestro[bot] Feb 7, 2024
c2415d7
[release/8.0] Fix STJ SG regression in handling of property names tha…
eiriktsarpalis Feb 8, 2024
2663ba6
Update SystemDataSqlClientVersion from 4.8.5 -> 4.8.6 for component g…
github-actions[bot] Feb 8, 2024
d62ff0b
Disable jiterpreter_do_jit_call to address issues with disabling Wasm…
kg Feb 8, 2024
53c1d13
Fixes exception while debugging on Chrome as IDE (#97871)
github-actions[bot] Feb 9, 2024
ea2b2e8
Backport #97418 (#97568)
thaystg Feb 9, 2024
279fe23
Update dependencies from https://github.com/dotnet/runtime-assets bui…
dotnet-maestro[bot] Feb 9, 2024
eded9a5
[release/8.0-staging] Ensure that the Create(Dot(...)) optimization d…
github-actions[bot] Feb 9, 2024
a143568
Don't clean up thread list on shutdown (#97188)
github-actions[bot] Feb 9, 2024
2767a15
[mono][interp] Fix inlining of ldarga (#97650)
BrzVlad Feb 9, 2024
ef1b0d6
[release/8.0-staging] [mono][jit] Fix passing of byref arguments in m…
vargaz Feb 9, 2024
4b040aa
Stop trying to format HOST_RUNTIME_CONTRACT property with locale sett…
elinor-fung Feb 9, 2024
6cd0edd
Backport of Handle open types to appear in interface maps (#97733) to…
davidwrighton Feb 9, 2024
c804f58
[release/8.0-staging] Move a lock to protect m_pDynamicStaticsInfo (#…
github-actions[bot] Feb 9, 2024
f4075f3
Ensure that constant folding for SIMD shifts on xarch follow the corr…
tannergooding Feb 10, 2024
d45a576
[release/8.0-staging] Ensure that the various `Max*Number` and `Min*N…
github-actions[bot] Feb 10, 2024
ff4e048
Define installer-owned directories (#98241)
github-actions[bot] Feb 11, 2024
2190e9b
Fix Windows implementation of NegotiateAuthenticationPal.GetMIC (#98031)
filipnavara Feb 12, 2024
dedae5e
[release/8.0-staging] Fix constant folding for arm64 MultiplyByScalar…
jakobbotsch Feb 12, 2024
bb540a8
[NativeAOT][8.0] Use ld_classic in ILC build and in build integration…
VSadov Feb 12, 2024
ba68cf1
Fix side effect of only not sending assembly_load while invoking meth…
github-actions[bot] Feb 12, 2024
6dec8dd
Fix polluted CompareState when comparing element types in a signature…
elinor-fung Feb 12, 2024
9598872
[release/8.0-staging] Update dependencies from dotnet/emsdk (#97405)
dotnet-maestro[bot] Feb 12, 2024
11ae42b
[release/8.0-staging] Fix regex lazy loop handling of backtracking st…
github-actions[bot] Feb 12, 2024
b7fda9f
Add ca-certificates to Mariner 2.0 deps (#98267)
github-actions[bot] Feb 12, 2024
00c95a6
[release/8.0-staging] Ensure that Vector512 uses the same patterns as…
github-actions[bot] Feb 12, 2024
c192fba
[release/8.0-staging] Implement faster RSA key check
github-actions[bot] Feb 12, 2024
11a4ff1
[release/8.0-staging] ServiceKey comparisons use Equals for matching …
github-actions[bot] Feb 12, 2024
ec1636f
Merge branch 'release/8.0' into release/8.0-staging
carlossanlop Feb 12, 2024
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
Backport #97418 (#97568)
  • Loading branch information
thaystg authored Feb 9, 2024
commit ea2b2e86419f2879c38f80a940b7d9f81209e7b5
59 changes: 49 additions & 10 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -5477,6 +5477,52 @@ decode_fixed_size_array_internal (MonoType *t, int type, MonoDomain *domain, gui
return err;
}

static int
decode_fixed_size_array_compute_size_internal (MonoType *t, int type, MonoDomain *domain, guint8 *buf, guint8 **endbuf, guint8 *limit)
{
int ret = 0;
int fixedSizeLen = 1;
int newType = MONO_TYPE_END;
if (CHECK_PROTOCOL_VERSION (2, 53)) {
newType = decode_byte (buf, &buf, limit);
fixedSizeLen = decode_int (buf, &buf, limit);
//t->type = newType;
}
for (int i = 0 ; i < fixedSizeLen; i++) {
switch (newType) {
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
decode_int (buf, &buf, limit);
ret += sizeof(guint8);
break;
case MONO_TYPE_CHAR:
decode_int (buf, &buf, limit);
ret += sizeof(gunichar2);
break;
case MONO_TYPE_I2:
case MONO_TYPE_U2:
decode_int (buf, &buf, limit);
ret += sizeof(guint16);
break;
case MONO_TYPE_I4:
case MONO_TYPE_U4:
case MONO_TYPE_R4:
decode_int (buf, &buf, limit);
ret += sizeof(guint32);
break;
case MONO_TYPE_I8:
case MONO_TYPE_U8:
case MONO_TYPE_R8:
decode_long (buf, &buf, limit);
ret += sizeof(guint64);
break;
}
}
*endbuf = buf;
return ret;
}

static int
decode_vtype_compute_size (MonoType *t, MonoDomain *domain, gpointer void_buf, guint8 **endbuf, guint8 *limit, gboolean from_by_ref_value_type)
{
Expand Down Expand Up @@ -5540,7 +5586,6 @@ decode_value_compute_size (MonoType *t, int type, MonoDomain *domain, guint8 *bu
if (type == 0)
type = decode_byte (buf, &buf, limit);
int ret = 0;
ErrorCode err;
if (type != t->type && !MONO_TYPE_IS_REFERENCE (t) &&
!(t->type == MONO_TYPE_I && type == MONO_TYPE_VALUETYPE) &&
!(type == VALUE_TYPE_ID_FIXED_ARRAY) &&
Expand All @@ -5555,7 +5600,7 @@ decode_value_compute_size (MonoType *t, int type, MonoDomain *domain, guint8 *bu
goto end;
}
if (type == VALUE_TYPE_ID_FIXED_ARRAY && t->type != MONO_TYPE_VALUETYPE) {
//decode_fixed_size_array_internal (t, type, domain, addr, buf, endbuf, limit, check_field_datatype);
ret += decode_fixed_size_array_compute_size_internal (t, type, domain, buf, &buf, limit);
goto end;
}
switch (t->type) {
Expand Down Expand Up @@ -5626,13 +5671,6 @@ decode_value_compute_size (MonoType *t, int type, MonoDomain *domain, guint8 *bu
decode_int (buf, &buf, limit); //not used
}
} else if (type == MONO_TYPE_VALUETYPE) {
MonoDomain *d;
decode_byte (buf, &buf, limit);
if (CHECK_PROTOCOL_VERSION(2, 61))
decode_byte (buf, &buf, limit); //ignore is boxed
if (CHECK_PROTOCOL_VERSION(2, 65))
decode_int (buf, &buf, limit); //ignore inline array
decode_typeid (buf, &buf, limit, &d, &err);
ret += decode_vtype_compute_size (NULL, domain, buf, &buf, limit, from_by_ref_value_type);
} else {
goto end;
Expand Down Expand Up @@ -5678,7 +5716,8 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr,
return ERR_INVALID_ARGUMENT;
}
if (type == VALUE_TYPE_ID_FIXED_ARRAY && t->type != MONO_TYPE_VALUETYPE) {
decode_fixed_size_array_internal (t, type, domain, addr, buf, endbuf, limit, check_field_datatype);
decode_fixed_size_array_internal (t, type, domain, addr, buf, &buf, limit, check_field_datatype);
*endbuf = buf;
return ERR_NONE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public async Task<JObject> ReadAsVariableValue(
case ElementType.U:
case ElementType.Void:
case (ElementType)ValueTypeId.VType:
case (ElementType)ValueTypeId.FixedArray:
ret = Create(value: "void", type: "void", description: "void");
break;
case ElementType.Boolean:
Expand Down Expand Up @@ -419,4 +418,98 @@ private async Task<JObject> ReadAsArray(MonoBinaryReader retDebuggerCmdReader, C
objectId: "dotnet:array:" + objectId,
subtype: length.Rank == 1 ? "array" : null);
}

public async Task<JObject> CreateFixedArrayElement(MonoBinaryReader retDebuggerCmdReader, ElementType etype, string name, CancellationToken token)
{
JObject ret = null;
switch (etype)
{
case ElementType.I:
case ElementType.U:
case ElementType.Void:
case (ElementType)ValueTypeId.VType:
ret = Create(value: "void", type: "void", description: "void");
break;
case ElementType.Boolean:
{
var value = retDebuggerCmdReader.ReadInt32();
ret = CreateFromPrimitiveType(value == 1);
break;
}
case ElementType.I1:
{
var value = retDebuggerCmdReader.ReadSByte();
ret = CreateJObjectForNumber<int>(value);
break;
}
case ElementType.I2:
case ElementType.I4:
{
var value = retDebuggerCmdReader.ReadInt32();
ret = CreateJObjectForNumber<int>(value);
break;
}
case ElementType.U1:
{
var value = retDebuggerCmdReader.ReadUByte();
ret = CreateJObjectForNumber<int>(value);
break;
}
case ElementType.U2:
{
var value = retDebuggerCmdReader.ReadUShort();
ret = CreateJObjectForNumber<int>(value);
break;
}
case ElementType.U4:
{
var value = retDebuggerCmdReader.ReadUInt32();
ret = CreateJObjectForNumber<uint>(value);
break;
}
case ElementType.R4:
{
float value = retDebuggerCmdReader.ReadSingle();
ret = CreateJObjectForNumber<float>(value);
break;
}
case ElementType.Char:
{
var value = retDebuggerCmdReader.ReadInt32();
ret = CreateJObjectForChar(value);
break;
}
case ElementType.I8:
{
long value = retDebuggerCmdReader.ReadInt64();
ret = CreateJObjectForNumber<long>(value);
break;
}
case ElementType.U8:
{
ulong value = retDebuggerCmdReader.ReadUInt64();
ret = CreateJObjectForNumber<ulong>(value);
break;
}
case ElementType.R8:
{
double value = retDebuggerCmdReader.ReadDouble();
ret = CreateJObjectForNumber<double>(value);
break;
}
case ElementType.FnPtr:
case ElementType.Ptr:
{
ret = await ReadAsPtrValue(etype, retDebuggerCmdReader, name, token);
break;
}
default:
{
_logger.LogDebug($"Could not evaluate CreateFixedArrayElement invalid type {etype}");
break;
}
}
ret["name"] = name;
return ret;
}
}
20 changes: 18 additions & 2 deletions src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,24 @@ public static async Task<ValueTypeClass> CreateFromReader(
&& !f.Attributes.HasFlag(FieldAttributes.Static));
foreach (var field in writableFields)
{
lastWritableFieldValue = await sdbAgent.ValueCreator.ReadAsVariableValue(cmdReader, field.Name, token, isOwn: true, field.TypeId, forDebuggerDisplayAttribute: false);
fields.Add(GetFieldWithMetadata(field, lastWritableFieldValue, isStatic: false));
//check if it's fixed size array and behave as a inline array
ElementType etype = (ElementType)cmdReader.ReadByte();
if (etype == (ElementType)ValueTypeId.FixedArray && writableFields.Count() == 1)
{
ElementType elementType = (ElementType)cmdReader.ReadByte();
var arraySize = cmdReader.ReadInt32();
inlineArray = new(arraySize + 1);
for (int i = 0; i < arraySize; i++)
{
inlineArray.Add(await sdbAgent.ValueCreator.CreateFixedArrayElement(cmdReader, elementType, $"{i}", token));
}
}
else
{
cmdReader.BaseStream.Position-=sizeof(byte);
lastWritableFieldValue = await sdbAgent.ValueCreator.ReadAsVariableValue(cmdReader, field.Name, token, isOwn: true, field.TypeId, forDebuggerDisplayAttribute: false);
fields.Add(GetFieldWithMetadata(field, lastWritableFieldValue, isStatic: false));
}
}
if (inlineArraySize > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,5 +749,28 @@ await EvaluateOnCallFrameAndCheck(id,
("f[f.numArray[f.numList[0]], f.numArray[f.numArray[i]]]", TNumber("4"))
);
});

[Fact]
public async Task EvaluateValueTypeWithFixedArrayAndMoreFields() => await CheckInspectLocalsAtBreakpointSite(
"DebuggerTests.EvaluateValueTypeWithFixedArray", "run", 3, "DebuggerTests.EvaluateValueTypeWithFixedArray.run",
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateValueTypeWithFixedArray:run'); })",
wait_for_event_fn: async (pause_location) =>
{
await RuntimeEvaluateAndCheck(
("myVar.MyMethod()", TNumber(13)),
("myVar.myIntArray[0]", TNumber(1)),
("myVar.myIntArray[1]", TNumber(2)),
("myVar.myCharArray[2]", TChar('a')));
});

[Fact]
public async Task EvaluateValueTypeWithObjectValueType() => await CheckInspectLocalsAtBreakpointSite(
"DebuggerTests.EvaluateValueTypeWithObjectValueType", "run", 3, "DebuggerTests.EvaluateValueTypeWithObjectValueType.run",
"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateValueTypeWithObjectValueType:run'); })",
wait_for_event_fn: async (pause_location) =>
{
await RuntimeEvaluateAndCheck(
("myVar.MyMethod()", TNumber(10)));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2182,4 +2182,50 @@ public static void run()
Console.WriteLine(dt);
}
}
public unsafe struct EvaluateValueTypeWithFixedArray
{
private fixed int myIntArray[4];
private fixed char myCharArray[3];
double myDouble;
public EvaluateValueTypeWithFixedArray()
{
myDouble = 10;
myIntArray[0] = 1;
myIntArray[1] = 2;
myCharArray[2] = 'a';
}
public int MyMethod()
{
Console.WriteLine(myDouble);
return myIntArray[0] + myIntArray[1] + (int)myDouble;
}
public static void run()
{
var myVar = new EvaluateValueTypeWithFixedArray();
Console.WriteLine("pause here");
myVar.MyMethod();
}
}

public struct EvaluateValueTypeWithObjectValueType
{
private object myObject;
double myDouble;
public EvaluateValueTypeWithObjectValueType()
{
myObject = new int();
myDouble = 10;
}
public int MyMethod()
{
Console.WriteLine(myDouble);
return (int)myObject + (int)myDouble;
}
public static void run()
{
var myVar = new EvaluateValueTypeWithObjectValueType();
Console.WriteLine("pause here");
myVar.MyMethod();
}
}
}