Thanks to visit codestin.com
Credit goes to github.com

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
fix behavior of JMC
  • Loading branch information
thaystg authored and github-actions committed Sep 19, 2022
commit 0db2b7bf46173bca8b115495210db61940067f2d
17 changes: 10 additions & 7 deletions src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ public static async Task<JArray> ExpandFieldValues(
JObject fieldValue = await ReadFieldValue(sdbHelper, retDebuggerCmdReader, field, id.Value, typeInfo, valtype, isOwn, parentTypeId, getCommandOptions, token);
numFieldsRead++;

if (typeInfo.Info.IsNonUserCode && getCommandOptions.HasFlag(GetObjectCommandOptions.JustMyCode) && field.Attributes.HasFlag(FieldAttributes.Private))
continue;

if (!Enum.TryParse(fieldValue["__state"].Value<string>(), out DebuggerBrowsableState fieldState)
|| fieldState == DebuggerBrowsableState.Collapsed)
{
Expand Down Expand Up @@ -311,7 +314,7 @@ public static async Task<Dictionary<string, JObject>> ExpandPropertyValues(
int typeId,
string typeName,
ArraySegment<byte> getterParamsBuffer,
bool isAutoExpandable,
GetObjectCommandOptions getCommandOptions,
DotnetObjectId objectId,
bool isValueType,
bool isOwn,
Expand Down Expand Up @@ -347,6 +350,10 @@ public static async Task<Dictionary<string, JObject>> ExpandPropertyValues(
MethodAttributes getterAttrs = getterInfo.Info.Attributes;
MethodAttributes getterMemberAccessAttrs = getterAttrs & MethodAttributes.MemberAccessMask;
MethodAttributes vtableLayout = getterAttrs & MethodAttributes.VtableLayoutMask;

if (typeInfo.Info.IsNonUserCode && getCommandOptions.HasFlag(GetObjectCommandOptions.JustMyCode) && getterMemberAccessAttrs == MethodAttributes.Private)
continue;

bool isNewSlot = (vtableLayout & MethodAttributes.NewSlot) == MethodAttributes.NewSlot;

typePropertiesBrowsableInfo.TryGetValue(propName, out DebuggerBrowsableState? state);
Expand Down Expand Up @@ -454,7 +461,7 @@ async Task AddProperty(
{
string returnTypeName = await sdbHelper.GetReturnType(getMethodId, token);
JObject propRet = null;
if (isAutoExpandable || (state is DebuggerBrowsableState.RootHidden && IsACollectionType(returnTypeName)))
if (getCommandOptions.HasFlag(GetObjectCommandOptions.AutoExpandable) || getCommandOptions.HasFlag(GetObjectCommandOptions.ForDebuggerProxyAttribute) || (state is DebuggerBrowsableState.RootHidden && IsACollectionType(returnTypeName)))
{
try
{
Expand Down Expand Up @@ -568,10 +575,6 @@ public static async Task<GetMembersResult> GetObjectMemberValues(
for (int i = 0; i < typeIdsCnt; i++)
{
int typeId = typeIdsIncludingParents[i];
var typeInfo = await sdbHelper.GetTypeInfo(typeId, token);

if (typeInfo.Info.IsNonUserCode && getCommandType.HasFlag(GetObjectCommandOptions.JustMyCode))
continue;

int parentTypeId = i + 1 < typeIdsCnt ? typeIdsIncludingParents[i + 1] : -1;
string typeName = await sdbHelper.GetTypeName(typeId, token);
Expand Down Expand Up @@ -604,7 +607,7 @@ public static async Task<GetMembersResult> GetObjectMemberValues(
typeId,
typeName,
getPropertiesParamBuffer,
getCommandType.HasFlag(GetObjectCommandOptions.ForDebuggerProxyAttribute),
getCommandType,
id,
isValueType: false,
isOwn,
Expand Down
3 changes: 2 additions & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ internal enum GetObjectCommandOptions
ForDebuggerProxyAttribute = 8,
ForDebuggerDisplayAttribute = 16,
WithProperties = 32,
JustMyCode = 64
JustMyCode = 64,
AutoExpandable = 128
}

internal enum CommandSet {
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public async Task ExpandPropertyValues(MonoSDBHelper sdbHelper, bool splitMember
typeId,
className,
Buffer,
autoExpand,
autoExpand ? GetObjectCommandOptions.AutoExpandable : GetObjectCommandOptions.None,
Id,
isValueType: true,
isOwn: i == 0,
Expand Down
6 changes: 5 additions & 1 deletion src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,11 @@ await EvaluateAndCheck(
{
myField = TNumber(0),
myField2 = TNumber(0),
}, "this_props", num_fields: 2);
propB = TGetter("propB"),
propC = TGetter("propC"),
e = TNumber(50),
f = TNumber(60),
}, "this_props", num_fields: 6);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public class ClassNonUserCodeToInheritThatInheritsFromNormalClass : NormalClass
private int d;
public int e;
protected int f;
public int G
private int G
{
get {return f + 1;}
}
public int H => f;
private int H => f;

public ClassNonUserCodeToInheritThatInheritsFromNormalClass()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public class ClassWithoutDebugSymbolsToInherit
private int d;
public int e;
protected int f;
public int G
private int G
{
get {return f + 1;}
}
public int H => f;
private int H => f;

public ClassWithoutDebugSymbolsToInherit()
{
Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,11 +1300,11 @@ public class ClassNonUserCodeToInherit
private int d;
public int e;
protected int f;
public int G
private int G
{
get {return f + 1;}
}
public int H => f;
private int H => f;

public ClassNonUserCodeToInherit()
{
Expand Down