public IEnumerable<InterruptibleRange> InterruptibleRanges { get; }
public GcSlotTable SlotTable { get; }
public int Size { get; }
+ public int Offset { get; }
public GcInfo(byte[] image, int offset, Machine machine, ushort majorVersion)
{
+ Offset = offset;
GcInfoTypes gcInfoTypes = new GcInfoTypes(machine);
SecurityObjectStackSlot = -1;
{
WriteSubDivider();
_writer.WriteLine(method.ToString());
+ if (_gc)
+ {
+ _writer.WriteLine("GcInfo:");
+ _writer.Write(method.GcInfo);
+ if (_raw)
+ {
+ DumpBytes(r2r, method.GcInfo.Offset, (uint)method.GcInfo.Size);
+ }
+ }
+ _writer.WriteLine();
foreach (RuntimeFunction runtimeFunction in method.RuntimeFunctions)
{
DumpBytes(r2r, rtf.UnwindRVA, (uint)rtf.UnwindInfo.Size);
}
}
- if (_gc)
- {
- _writer.WriteLine("GcInfo:");
- _writer.Write(rtf.GcInfo);
- if (_raw)
- {
- DumpBytes(r2r, rtf.UnwindRVA + rtf.UnwindInfo.Size, (uint)rtf.GcInfo.Size);
- }
- }
_writer.WriteLine();
}
public R2RMethod Method { get; }
public UnwindInfo UnwindInfo { get; }
- public GcInfo GcInfo { get; }
public RuntimeFunction(int id, int startRva, int endRva, int unwindRva, R2RMethod method, UnwindInfo unwindInfo, GcInfo gcInfo)
{
UnwindRVA = unwindRva;
Method = method;
UnwindInfo = unwindInfo;
- GcInfo = gcInfo;
- Size = gcInfo.CodeLength;
+ if (endRva != -1)
+ {
+ Size = endRva - startRva;
+ }
+ else if (gcInfo != null)
+ {
+ Size = gcInfo.CodeLength;
+ }
+ method.GcInfo = gcInfo;
}
public override string ToString()
{
sb.AppendLine($"Size: {Size} bytes");
}
+ sb.AppendLine($"UnwindRVA: 0x{UnwindRVA:X8}");
return sb.ToString();
}
public bool IsGeneric { get; }
- /*/// <summary>
- /// The return type of the method
- /// </summary>
- public string ReturnType { get; }
-
- /// <summary>
- /// The argument types of the method
- /// </summary>
- public string[] ArgTypes { get; }*/
-
public MethodSignature<string> Signature { get; }
/// <summary>
/// </summary>
public int EntryPointRuntimeFunctionId { get; }
+ public GcInfo GcInfo { get; set; }
+
/// <summary>
/// Maps all the generic parameters to the type in the instance
/// </summary>
if (runtimeFunctionId == -1)
continue;
curOffset = runtimeFunctionOffset + runtimeFunctionId * runtimeFunctionSize;
+ GcInfo gcInfo = null;
do
{
int startRva = NativeReader.ReadInt32(Image, ref curOffset);
int unwindOffset = GetOffset(unwindRva);
UnwindInfo unwindInfo = new UnwindInfo(Image, unwindOffset);
- GcInfo gcInfo = new GcInfo(Image, unwindOffset + unwindInfo.Size, Machine, R2RHeader.MajorVersion);
+ if (isEntryPoint[runtimeFunctionId])
+ {
+ gcInfo = new GcInfo(Image, unwindOffset + unwindInfo.Size, Machine, R2RHeader.MajorVersion);
+ }
method.RuntimeFunctions.Add(new RuntimeFunction(runtimeFunctionId, startRva, endRva, unwindRva, method, unwindInfo, gcInfo));
runtimeFunctionId++;