From d0b233b4f4b60b826dc851c9f0bea9d9743c129a Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Thu, 3 Sep 2026 17:31:06 +0200 Subject: [PATCH 1/3] debugging-via-dotnet-dump: update for name2ee C# rewrite too. Also adds back test for 'dumpclass' to the debugging-sos-lldb-via-core test. --- debugging-sos-lldb-via-core/test.sh | 7 ++++++- debugging-via-dotnet-dump/test.sh | 11 +++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/debugging-sos-lldb-via-core/test.sh b/debugging-sos-lldb-via-core/test.sh index 814a0ee..aec4662 100755 --- a/debugging-sos-lldb-via-core/test.sh +++ b/debugging-sos-lldb-via-core/test.sh @@ -200,7 +200,7 @@ cat lldb.out grep 'MethodTable: ' lldb.out grep 'Name: ' lldb.out string_module=$(grep 'Module: ' lldb.out | head -1 | awk '{print $2}') -string_method_table=$(grep 'MethodTable:' lldb.out | awk '{print $2}') +string_method_table=$(grep 'MethodTable:' lldb.out | head -1 | awk '{print $2}') lldb-core 'name2ee *!System.String.ToString' > lldb.out cat lldb.out @@ -213,6 +213,11 @@ to_string_method_descriptor=$(grep 'MethodDesc:' lldb.out | head -1 | awk '{prin # grep 'Name: System.String' lldb.out # grep -F "File: ${framework_dir}" lldb.out +echo "[dumpclass]" +lldb-core "dumpclass ${string_method_table}" > lldb.out +cat lldb.out +grep 'Class Name: System.String' lldb.out + echo "[dumpmd]" lldb-core "dumpmd ${to_string_method_descriptor}" > lldb.out cat lldb.out diff --git a/debugging-via-dotnet-dump/test.sh b/debugging-via-dotnet-dump/test.sh index d3aeff4..0b6545e 100755 --- a/debugging-via-dotnet-dump/test.sh +++ b/debugging-via-dotnet-dump/test.sh @@ -227,9 +227,8 @@ fi heading "dumpclass" dump-analyze 'name2ee *!System.String' > dump.out cat dump.out -grep 'EEClass: ' dump.out -string_eeclass=$(grep 'EEClass:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') -dump-analyze "dumpclass ${string_eeclass}" > dump.out +string_method_table=$(grep 'MethodTable:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +dump-analyze "dumpclass ${string_method_table}" > dump.out cat dump.out grep 'Class Name: System.String' dump.out @@ -297,9 +296,6 @@ if grep 'Unmanaged code' dump.out; then fi dump-analyze 'name2ee *!System.String.ToString' > dump.out cat dump.out -grep 'TestDir.dll' dump.out -grep 'System.Runtime.dll' dump.out -grep 'Microsoft.AspNetCore.dll' dump.out to_string_method_descriptor=$(grep 'MethodDesc:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') dump-analyze "dumpmd ${to_string_method_descriptor}" > dump.out cat dump.out @@ -323,7 +319,7 @@ heading "dumpmt" dump-analyze 'name2ee *!System.String' > dump.out cat dump.out grep 'MethodTable:' dump.out | awk '{print $2}' -string_method_table=$(grep 'MethodTable:' dump.out | awk '{print $2}') +string_method_table=$(grep 'MethodTable:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') dump-analyze "dumpmt ${string_method_table}" > dump.out cat dump.out grep -E '^Name:[ \n\t]+System.String' dump.out @@ -550,7 +546,6 @@ heading "name2ee" dump-analyze 'name2ee *!System.String' > dump.out cat dump.out grep 'MethodTable: ' dump.out -grep 'EEClass: ' dump.out grep 'Name: ' dump.out dump-analyze 'name2ee *!System.String.ToString' > dump.out From bb38cdf303fd0ab2a6c4348c1abbc170f3e08981 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Thu, 3 Sep 2026 18:12:58 +0200 Subject: [PATCH 2/3] Use EEClass on .NET 8 where MethodTable isn't accepted. --- debugging-sos-lldb-via-core/test.sh | 9 ++++++++- debugging-via-dotnet-dump/test.sh | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/debugging-sos-lldb-via-core/test.sh b/debugging-sos-lldb-via-core/test.sh index aec4662..de880da 100755 --- a/debugging-sos-lldb-via-core/test.sh +++ b/debugging-sos-lldb-via-core/test.sh @@ -201,6 +201,13 @@ grep 'MethodTable: ' lldb.out grep 'Name: ' lldb.out string_module=$(grep 'Module: ' lldb.out | head -1 | awk '{print $2}') string_method_table=$(grep 'MethodTable:' lldb.out | head -1 | awk '{print $2}') +# For .NET 8, dumpclass needs EEClass. For later versions we pass the +# MethodTable address since EEClass is no longer in the output. +if grep -q 'EEClass:' lldb.out; then + dumpclass_arg=$(grep 'EEClass:' lldb.out | head -1 | awk '{print $2}') +else + dumpclass_arg=${string_method_table} +fi lldb-core 'name2ee *!System.String.ToString' > lldb.out cat lldb.out @@ -214,7 +221,7 @@ to_string_method_descriptor=$(grep 'MethodDesc:' lldb.out | head -1 | awk '{prin # grep -F "File: ${framework_dir}" lldb.out echo "[dumpclass]" -lldb-core "dumpclass ${string_method_table}" > lldb.out +lldb-core "dumpclass ${dumpclass_arg}" > lldb.out cat lldb.out grep 'Class Name: System.String' lldb.out diff --git a/debugging-via-dotnet-dump/test.sh b/debugging-via-dotnet-dump/test.sh index 0b6545e..0e6921b 100755 --- a/debugging-via-dotnet-dump/test.sh +++ b/debugging-via-dotnet-dump/test.sh @@ -227,8 +227,14 @@ fi heading "dumpclass" dump-analyze 'name2ee *!System.String' > dump.out cat dump.out -string_method_table=$(grep 'MethodTable:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') -dump-analyze "dumpclass ${string_method_table}" > dump.out +# For .NET 8, dumpclass needs EEClass. For later versions we pass the +# MethodTable address since EEClass is no longer in the output. +if grep -q 'EEClass:' dump.out; then + dumpclass_arg=$(grep 'EEClass:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +else + dumpclass_arg=$(grep 'MethodTable:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +fi +dump-analyze "dumpclass ${dumpclass_arg}" > dump.out cat dump.out grep 'Class Name: System.String' dump.out From c08ca3b6f58f728042a4144798c5a99e5352ad2c Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Thu, 3 Sep 2026 19:28:21 +0200 Subject: [PATCH 3/3] Address differences between .NET versions. --- debugging-sos-lldb-via-core/test.sh | 13 ++++++------- debugging-via-dotnet-dump/test.sh | 14 +++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/debugging-sos-lldb-via-core/test.sh b/debugging-sos-lldb-via-core/test.sh index de880da..409939b 100755 --- a/debugging-sos-lldb-via-core/test.sh +++ b/debugging-sos-lldb-via-core/test.sh @@ -201,13 +201,12 @@ grep 'MethodTable: ' lldb.out grep 'Name: ' lldb.out string_module=$(grep 'Module: ' lldb.out | head -1 | awk '{print $2}') string_method_table=$(grep 'MethodTable:' lldb.out | head -1 | awk '{print $2}') -# For .NET 8, dumpclass needs EEClass. For later versions we pass the -# MethodTable address since EEClass is no longer in the output. -if grep -q 'EEClass:' lldb.out; then - dumpclass_arg=$(grep 'EEClass:' lldb.out | head -1 | awk '{print $2}') -else - dumpclass_arg=${string_method_table} -fi +lldb-core "dumpmt ${string_method_table}" > lldb.out +cat lldb.out +# On .NET 8, dumpclass needs the EEClass address (from dumpmt output). +# On .NET 9+, EEClass is gone and dumpclass accepts the MethodTable directly. +dumpclass_arg=$(grep 'EEClass:' lldb.out | head -1 | awk '{print $2}' || true) +dumpclass_arg=${dumpclass_arg:-${string_method_table}} lldb-core 'name2ee *!System.String.ToString' > lldb.out cat lldb.out diff --git a/debugging-via-dotnet-dump/test.sh b/debugging-via-dotnet-dump/test.sh index 0e6921b..c3b2fa5 100755 --- a/debugging-via-dotnet-dump/test.sh +++ b/debugging-via-dotnet-dump/test.sh @@ -227,13 +227,13 @@ fi heading "dumpclass" dump-analyze 'name2ee *!System.String' > dump.out cat dump.out -# For .NET 8, dumpclass needs EEClass. For later versions we pass the -# MethodTable address since EEClass is no longer in the output. -if grep -q 'EEClass:' dump.out; then - dumpclass_arg=$(grep 'EEClass:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') -else - dumpclass_arg=$(grep 'MethodTable:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') -fi +string_method_table=$(grep 'MethodTable:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +dump-analyze "dumpmt ${string_method_table}" > dump.out +cat dump.out +# On .NET 8, dumpclass needs the EEClass address (from dumpmt output). +# On .NET 9+, EEClass is gone and dumpclass accepts the MethodTable directly. +dumpclass_arg=$(grep 'EEClass:' dump.out | awk '{print $2}' || true) +dumpclass_arg=${dumpclass_arg:-${string_method_table}} dump-analyze "dumpclass ${dumpclass_arg}" > dump.out cat dump.out grep 'Class Name: System.String' dump.out