From db347bfcdb71d5e408edb784dec1d3914908942c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksey=20Kliger=20=28=CE=BBgeek=29?= Date: Fri, 2 Aug 2024 13:49:38 -0400 Subject: [PATCH] Don't print wNumVirtuals wNumVtableSlots if they're 0 (#4760) Since .NET 9 the runtime will always set these MethodTableData fields to 0 --- src/SOS/Strike/strike.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index 282182b23..70e2a1dbd 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -1096,8 +1096,14 @@ DECLARE_API(DumpClass) { DMLOut("Canonical MethodTable: %s\n", DMLClass(mtdata.Class)); } - ExtOut("Vtable Slots: %x\n", mtdata.wNumVirtuals); - ExtOut("Total Method Slots: %x\n", mtdata.wNumVtableSlots); + if (mtdata.wNumVirtuals != 0) + { + ExtOut("Vtable Slots: %x\n", mtdata.wNumVirtuals); + } + if (mtdata.wNumVtableSlots != 0) + { + ExtOut("Total Method Slots: %x\n", mtdata.wNumVtableSlots); + } ExtOut("Class Attributes: %x ", mtdata.dwAttrClass); if (IsTdInterface(mtdata.dwAttrClass)) @@ -1252,7 +1258,7 @@ DECLARE_API(DumpMT) table.WriteRow("ComponentSize:", PrefixHex(vMethTable.ComponentSize)); table.WriteRow("DynamicStatics:", vMethTable.bIsDynamic ? "true" : "false"); table.WriteRow("ContainsPointers:", vMethTable.bContainsPointers ? "true" : "false"); - table.WriteRow("Slots in VTable:", Decimal(vMethTable.wNumMethods)); + table.WriteRow("Number of Methods:", Decimal(vMethTable.wNumMethods)); table.SetColWidth(0, 29); table.WriteRow("Number of IFaces in IFaceMap:", Decimal(vMethTable.wNumInterfaces)); -- 2.34.1