Prevent VARARG and GENERIC methods parse in WalkMethods.
authorMikhail Kurinnoi <m.kurinnoi@samsung.com>
Fri, 2 Sep 2022 12:07:33 +0000 (15:07 +0300)
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Fri, 2 Sep 2022 15:26:56 +0000 (18:26 +0300)
Related to https://github.com/Samsung/netcoredbg/issues/101

src/debugger/evaluator.cpp

index 178f1d6aad6c3b0415f04bdf3505dc44b6b8eafd..ca73874a1b90420c90ea76a9b5a58a0ab7535980 100644 (file)
@@ -409,6 +409,10 @@ static HRESULT InternalWalkMethods(ICorDebugType *pInputType, Evaluator::WalkMet
         }
     }
 
+    // https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/docs/design/coreclr/profiling/davbr-blog-archive/samples/sigparse.cpp
+    static const ULONG SIG_METHOD_VARARG = 0x5; // vararg calling convention
+    static const ULONG SIG_METHOD_GENERIC = 0x10; // used to indicate that the method has one or more generic parameters.
+
     ULONG numMethods = 0;
     HCORENUM fEnum = NULL;
     mdMethodDef methodDef;
@@ -434,6 +438,11 @@ static HRESULT InternalWalkMethods(ICorDebugType *pInputType, Evaluator::WalkMet
         elementSize = CorSigUncompressData(pSig, &convFlags);
         pSig += elementSize;
 
+        // TODO add VARARG and GENERIC methods support.
+        if ((convFlags & SIG_METHOD_VARARG) ||
+            (convFlags & SIG_METHOD_GENERIC))
+            continue;
+
         // 2. count of params
         elementSize = CorSigUncompressData(pSig, &cParams);
         pSig += elementSize;