Fixing the epilog size decoding
authorAndrew Au <andrewau@microsoft.com>
Sun, 26 May 2019 23:30:39 +0000 (16:30 -0700)
committerAndrew Au <cshung@gmail.com>
Tue, 28 May 2019 20:50:30 +0000 (13:50 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/c690daea096f44d6563de58cd4b5d50cce83d9bf

src/coreclr/src/tools/r2rdump/Amd64/GcInfo.cs
src/coreclr/src/tools/r2rdump/GCInfoTypes.cs
src/coreclr/src/tools/r2rdump/R2RReader.cs

index 7ab9394..0727c98 100644 (file)
@@ -119,7 +119,7 @@ namespace R2RDump.Amd64
             if (_hasGSCookie)
             {
                 uint normPrologSize = NativeReader.DecodeVarLengthUnsigned(image, _gcInfoTypes.NORM_PROLOG_SIZE_ENCBASE, ref bitOffset) + 1;
-                uint normEpilogSize = NativeReader.DecodeVarLengthUnsigned(image, _gcInfoTypes.NORM_PROLOG_SIZE_ENCBASE, ref bitOffset);
+                uint normEpilogSize = NativeReader.DecodeVarLengthUnsigned(image, _gcInfoTypes.NORM_EPILOG_SIZE_ENCBASE, ref bitOffset);
 
                 ValidRangeStart = normPrologSize;
                 ValidRangeEnd = (uint)CodeLength - normEpilogSize;
index 10bad28..f3bf54f 100644 (file)
@@ -79,6 +79,7 @@ namespace R2RDump
         internal int SIZE_OF_RETURN_KIND_FAT { get; } = 2;
         internal int CODE_LENGTH_ENCBASE { get; } = 8;
         internal int NORM_PROLOG_SIZE_ENCBASE { get; } = 5;
+        internal int NORM_EPILOG_SIZE_ENCBASE { get; } = 3;
         internal int SECURITY_OBJECT_STACK_SLOT_ENCBASE { get; } = 6;
         internal int GS_COOKIE_STACK_SLOT_ENCBASE { get; } = 6;
         internal int PSP_SYM_STACK_SLOT_ENCBASE { get; } = 6;
index edfbec0..6f61241 100644 (file)
@@ -553,19 +553,7 @@ namespace R2RDump
                         unwindInfo = new Amd64.UnwindInfo(Image, unwindOffset);
                         if (isEntryPoint[runtimeFunctionId])
                         {
-                            try
-                            {
-                                gcInfo = new Amd64.GcInfo(Image, unwindOffset + unwindInfo.Size, Machine, R2RHeader.MajorVersion);
-                            }
-                            catch (OverflowException)
-                            {
-                                Console.WriteLine($"Warning: Could not parse GC Info for method: {method.SignatureString}");
-                            }
-                            catch (IndexOutOfRangeException)
-                            {
-                                Console.WriteLine($"Warning: Could not parse GC Info for method: {method.SignatureString}");
-                            }
-                             
+                            gcInfo = new Amd64.GcInfo(Image, unwindOffset + unwindInfo.Size, Machine, R2RHeader.MajorVersion);
                         }
                     }
                     else if (Machine == Machine.I386)