Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace ILCompiler.Reflection.ReadyToRun.Amd64
Expand Down Expand Up @@ -76,6 +77,19 @@ public UnwindCode(byte[] image, int index, ref int offset)
FrameOffset = NativeReader.ReadUInt16(image, ref offset);
NextFrameOffset = -1;

if (UnwindOp == UnwindOpCodes.UWOP_ALLOC_LARGE)
{
uint codedSize;
if (OpInfo == 0)
{
codedSize = NativeReader.ReadUInt16(image, ref offset);
}
else if (OpInfo == 1)
{
codedSize = NativeReader.ReadUInt32(image, ref offset);
}
}

IsOpInfo = false;
}
}
Expand All @@ -95,7 +109,7 @@ public class UnwindInfo : BaseUnwindInfo
public Registers FrameRegister { get; set; } //4 bits
public byte FrameOffset { get; set; } //4 bits
public UnwindCode[] UnwindCodeArray { get; set; }
public Dictionary<int, List<UnwindCode>> UnwindCodes { get; set; }
public Dictionary<int, UnwindCode> UnwindCodes { get; set; }
public uint PersonalityRoutineRVA { get; set; }

public UnwindInfo() { }
Expand All @@ -115,19 +129,16 @@ public UnwindInfo(byte[] image, int offset)
FrameOffset = (byte)(frameRegisterAndOffset >> 4);

UnwindCodeArray = new UnwindCode[CountOfUnwindCodes];
UnwindCodes = new Dictionary<int, List<UnwindCode>>();
UnwindCodes = new Dictionary<int, UnwindCode>();
for (int i = 0; i < CountOfUnwindCodes; i++)
{
UnwindCodeArray[i] = new UnwindCode(image, i, ref offset);
}
for (int i = 0; i < CountOfUnwindCodes; i++)
{
ParseUnwindCode(ref i);
if (!UnwindCodes.ContainsKey(UnwindCodeArray[i].CodeOffset))
{
UnwindCodes[UnwindCodeArray[i].CodeOffset] = new List<UnwindCode>();
}
UnwindCodes[UnwindCodeArray[i].CodeOffset].Add(UnwindCodeArray[i]);
Debug.Assert(!UnwindCodes.ContainsKey(UnwindCodeArray[i].CodeOffset));
UnwindCodes.Add(UnwindCodeArray[i].CodeOffset, UnwindCodeArray[i]);
}

Size = _offsetofUnwindCode + CountOfUnwindCodes * _sizeofUnwindCode;
Expand Down
13 changes: 5 additions & 8 deletions src/coreclr/src/tools/r2rdump/TextDumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,13 @@ internal override void DumpDisasm(RuntimeFunction rtf, int imageOffset)

if (_r2r.Machine == Machine.Amd64 && ((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).UnwindCodes.ContainsKey(codeOffset))
{
List<ILCompiler.Reflection.ReadyToRun.Amd64.UnwindCode> codes = ((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).UnwindCodes[codeOffset];
foreach (ILCompiler.Reflection.ReadyToRun.Amd64.UnwindCode code in codes)
ILCompiler.Reflection.ReadyToRun.Amd64.UnwindCode code = ((ILCompiler.Reflection.ReadyToRun.Amd64.UnwindInfo)rtf.UnwindInfo).UnwindCodes[codeOffset];
_writer.Write($"{indentString}{code.UnwindOp} {code.OpInfoStr}");
if (code.NextFrameOffset != -1)
{
_writer.Write($"{indentString}{code.UnwindOp} {code.OpInfoStr}");
if (code.NextFrameOffset != -1)
{
_writer.WriteLine($"{indentString}{code.NextFrameOffset}");
}
_writer.WriteLine();
_writer.WriteLine($"{indentString}{code.NextFrameOffset}");
}
_writer.WriteLine();
}

if (!_options.HideTransitions && rtf.Method.GcInfo?.Transitions != null && rtf.Method.GcInfo.Transitions.TryGetValue(codeOffset, out List<BaseGcTransition> transitionsForOffset))
Expand Down