diff options
author | Simon Nattress <nattress@gmail.com> | 2018-09-19 10:24:02 -0700 |
---|---|---|
committer | Simon Nattress <nattress@gmail.com> | 2018-09-20 21:14:11 -0700 |
commit | 10e34eb55c3bb0a16969b45c97e12b275549ec20 (patch) | |
tree | f43bf548b331465696e0a704bdb2ce563c4a9cf3 /src/tools | |
parent | 4180182cae098b55cb6e2711cb2c2c43decaac0a (diff) | |
download | coreclr-10e34eb55c3bb0a16969b45c97e12b275549ec20.tar.gz coreclr-10e34eb55c3bb0a16969b45c97e12b275549ec20.tar.bz2 coreclr-10e34eb55c3bb0a16969b45c97e12b275549ec20.zip |
Make EH table optional in R2RDump
Ready-to-run binaries don't always have an EH table. Fix r2rdump so it doesn't crash if the table isn't present.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/r2rdump/R2RReader.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/r2rdump/R2RReader.cs b/src/tools/r2rdump/R2RReader.cs index c7da57857a..fb5d30b230 100644 --- a/src/tools/r2rdump/R2RReader.cs +++ b/src/tools/r2rdump/R2RReader.cs @@ -189,8 +189,11 @@ namespace R2RDump ParseDebugInfo(); - R2RSection exceptionInfoSection = R2RHeader.Sections[R2RSection.SectionType.READYTORUN_SECTION_EXCEPTION_INFO]; - EHLookupTable = new EHLookupTable(Image, GetOffset(exceptionInfoSection.RelativeVirtualAddress), exceptionInfoSection.Size); + if (R2RHeader.Sections.ContainsKey(R2RSection.SectionType.READYTORUN_SECTION_EXCEPTION_INFO)) + { + R2RSection exceptionInfoSection = R2RHeader.Sections[R2RSection.SectionType.READYTORUN_SECTION_EXCEPTION_INFO]; + EHLookupTable = new EHLookupTable(Image, GetOffset(exceptionInfoSection.RelativeVirtualAddress), exceptionInfoSection.Size); + } R2RMethods = new List<R2RMethod>(); if (R2RHeader.Sections.ContainsKey(R2RSection.SectionType.READYTORUN_SECTION_RUNTIME_FUNCTIONS)) @@ -391,7 +394,7 @@ namespace R2RDump EHInfo ehInfo = null; EHInfoLocation ehInfoLocation; - if (EHLookupTable.RuntimeFunctionToEHInfoMap.TryGetValue(startRva, out ehInfoLocation)) + if (EHLookupTable != null && EHLookupTable.RuntimeFunctionToEHInfoMap.TryGetValue(startRva, out ehInfoLocation)) { ehInfo = new EHInfo(this, ehInfoLocation.EHInfoRVA, startRva, GetOffset(ehInfoLocation.EHInfoRVA), ehInfoLocation.ClauseCount); } |