From 147ce06ed85fa4ff696ac94eefba3b802ac0d2dc Mon Sep 17 00:00:00 2001 From: Simon Nattress Date: Thu, 21 Feb 2019 13:37:50 -0800 Subject: [PATCH] R2RDump - Gracefully handle inability to parse GC Info The Amd64 GC Info parser is not complete in its implementation and sometimes will index to a location beyond the size of the image. If we fail to parse the GC info for a method, continue dumping the rest of the image. Emit a warning when this happens so we don't forget about this. Commit migrated from https://github.com/dotnet/coreclr/commit/b43650c6b60b47c5823c9bf1806fab0a5ca3f7c1 --- src/coreclr/src/tools/r2rdump/R2RReader.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/tools/r2rdump/R2RReader.cs b/src/coreclr/src/tools/r2rdump/R2RReader.cs index b74e9b2f369..3e38adc7991 100644 --- a/src/coreclr/src/tools/r2rdump/R2RReader.cs +++ b/src/coreclr/src/tools/r2rdump/R2RReader.cs @@ -456,7 +456,15 @@ namespace R2RDump unwindInfo = new Amd64.UnwindInfo(Image, unwindOffset); if (isEntryPoint[runtimeFunctionId]) { - gcInfo = new Amd64.GcInfo(Image, unwindOffset + unwindInfo.Size, Machine, R2RHeader.MajorVersion); + try + { + gcInfo = new Amd64.GcInfo(Image, unwindOffset + unwindInfo.Size, Machine, R2RHeader.MajorVersion); + } + catch (IndexOutOfRangeException) + { + Console.WriteLine($"Warning: Could not parse GC Info for method: {method.SignatureString}"); + } + } } else if (Machine == Machine.I386)