Skip to content

Commit 76e6309

Browse files
authored
Fix mcs -dumpMap (#79571)
This needs to be in sync with how printing in the JIT works to ensure that we don't ask for data that the JIT did not make available. Fix #79568
1 parent fb10175 commit 76e6309

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/coreclr/tools/superpmi/mcs/verbildump.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,32 @@ void DumpPrimToConsoleBare(MethodContext* mc, CorInfoType prim, DWORDLONG classH
6767
case CORINFO_TYPE_VALUECLASS:
6868
case CORINFO_TYPE_CLASS:
6969
{
70-
char className[256];
71-
mc->repPrintClassName((CORINFO_CLASS_HANDLE)classHandle, className, sizeof(className));
70+
CORINFO_CLASS_HANDLE cls = (CORINFO_CLASS_HANDLE)classHandle;
71+
unsigned arrayRank = mc->repGetArrayRank(cls);
72+
if (arrayRank > 0)
73+
{
74+
CORINFO_CLASS_HANDLE childCls;
75+
CorInfoType childType = mc->repGetChildType(cls, &childCls);
76+
DumpPrimToConsoleBare(mc, childType, (DWORDLONG)childCls);
77+
78+
printf("[");
79+
for (unsigned i = 1; i < arrayRank; i++)
80+
{
81+
printf(",");
82+
}
83+
printf("]");
84+
}
85+
else
86+
{
87+
char className[256];
88+
mc->repPrintClassName((CORINFO_CLASS_HANDLE)classHandle, className, sizeof(className));
89+
90+
printf(
91+
"%s %s",
92+
prim == CORINFO_TYPE_VALUECLASS ? "valueclass" : "class",
93+
className);
94+
}
7295

73-
printf(
74-
"%s %s",
75-
prim == CORINFO_TYPE_VALUECLASS ? "valueclass" : "class",
76-
className);
7796
return;
7897
}
7998
case CORINFO_TYPE_REFANY:

0 commit comments

Comments
 (0)