summaryrefslogtreecommitdiff
path: root/src/tools/r2rdump/R2RReader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/r2rdump/R2RReader.cs')
-rw-r--r--src/tools/r2rdump/R2RReader.cs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/tools/r2rdump/R2RReader.cs b/src/tools/r2rdump/R2RReader.cs
index 0da6e98f8d..c7da57857a 100644
--- a/src/tools/r2rdump/R2RReader.cs
+++ b/src/tools/r2rdump/R2RReader.cs
@@ -118,6 +118,11 @@ namespace R2RDump
public string CompilerIdentifier { get; }
/// <summary>
+ /// Exception lookup table is used to map runtime function addresses to EH clauses.
+ /// </summary>
+ public EHLookupTable EHLookupTable { get; }
+
+ /// <summary>
/// List of import sections present in the R2R executable.
/// </summary>
public IList<R2RImportSection> ImportSections { get; }
@@ -184,6 +189,9 @@ namespace R2RDump
ParseDebugInfo();
+ 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))
{
@@ -380,7 +388,26 @@ namespace R2RDump
}
}
- RuntimeFunction rtf = new RuntimeFunction(runtimeFunctionId, startRva, endRva, unwindRva, codeOffset, method, unwindInfo, gcInfo, _runtimeFunctionToDebugInfo.GetValueOrDefault(runtimeFunctionId));
+ EHInfo ehInfo = null;
+
+ EHInfoLocation ehInfoLocation;
+ if (EHLookupTable.RuntimeFunctionToEHInfoMap.TryGetValue(startRva, out ehInfoLocation))
+ {
+ ehInfo = new EHInfo(this, ehInfoLocation.EHInfoRVA, startRva, GetOffset(ehInfoLocation.EHInfoRVA), ehInfoLocation.ClauseCount);
+ }
+
+ RuntimeFunction rtf = new RuntimeFunction(
+ runtimeFunctionId,
+ startRva,
+ endRva,
+ unwindRva,
+ codeOffset,
+ method,
+ unwindInfo,
+ gcInfo,
+ ehInfo,
+ _runtimeFunctionToDebugInfo.GetValueOrDefault(runtimeFunctionId));
+
method.RuntimeFunctions.Add(rtf);
runtimeFunctionId++;
codeOffset += rtf.Size;