// <auto-generated/>
#nullable enable
using Microsoft.Diagnostics.DataContractReader;
using Microsoft.Diagnostics.DataContractReader.Contracts;
using Microsoft.Diagnostics.DataContractReader.Generated;
namespace Microsoft.Diagnostics.DataContractReader.Data;
/// <summary>Wraps the <c>StubDispatchFrame</c> type.</summary>
partial class StubDispatchFrame
{
private static readonly string[] _typeNames = new[] { "StubDispatchFrame" };
[UsesDataDescriptorTypeSize]
public static uint GetSize(Target target)
=> checked((uint)TypeLayout.Resolve(target, _typeNames).InstanceSize);
[DataDescriptorDependency("MethodDescPtr", "pointer")]
public static int GetMethodDescPtrOffset(Target target)
{
TypeLayout layout = TypeLayout.Resolve(target, _typeNames);
layout.Select(default, out var type, out _, out var name, "MethodDescPtr");
return type.Fields[name].Offset;
}
[DataDescriptorDependency("RepresentativeMTPtr", "pointer")]
public static int GetRepresentativeMTPtrOffset(Target target)
{
TypeLayout layout = TypeLayout.Resolve(target, _typeNames);
layout.Select(default, out var type, out _, out var name, "RepresentativeMTPtr");
return type.Fields[name].Offset;
}
[DataDescriptorDependency("RepresentativeSlot", "uint32")]
public static int GetRepresentativeSlotOffset(Target target)
{
TypeLayout layout = TypeLayout.Resolve(target, _typeNames);
layout.Select(default, out var type, out _, out var name, "RepresentativeSlot");
return type.Fields[name].Offset;
}
[DataDescriptorDependency("Indirection", "pointer")]
public static int GetIndirectionOffset(Target target)
{
TypeLayout layout = TypeLayout.Resolve(target, _typeNames);
layout.Select(default, out var type, out _, out var name, "Indirection");
return type.Fields[name].Offset;
}
public TargetPointer Address { get; }
private readonly Target _target;
private readonly TypeLayout _layout;
public StubDispatchFrame(Target target, TargetPointer address)
{
Address = address;
_target = target;
_layout = TypeLayout.Resolve(target, _typeNames);
}
static StubDispatchFrame IData<StubDispatchFrame>.Create(Target target, TargetPointer address)
=> new StubDispatchFrame(target, address);
private TargetPointer _MethodDescPtr__value = default!;
private bool _MethodDescPtr__read;
[DataDescriptorDependency("MethodDescPtr", "pointer")]
public partial TargetPointer MethodDescPtr
{
get
{
if (!_MethodDescPtr__read)
{
_layout.Select(Address, out var t, out var b, out var n, "MethodDescPtr");
_MethodDescPtr__value = _target.ReadPointerField(b, t, n);
_MethodDescPtr__read = true;
}
return _MethodDescPtr__value;
}
}
private TargetPointer _RepresentativeMTPtr__value = default!;
private bool _RepresentativeMTPtr__read;
[DataDescriptorDependency("RepresentativeMTPtr", "pointer")]
public partial TargetPointer RepresentativeMTPtr
{
get
{
if (!_RepresentativeMTPtr__read)
{
_layout.Select(Address, out var t, out var b, out var n, "RepresentativeMTPtr");
_RepresentativeMTPtr__value = _target.ReadPointerField(b, t, n);
_RepresentativeMTPtr__read = true;
}
return _RepresentativeMTPtr__value;
}
}
private uint _RepresentativeSlot__value = default!;
private bool _RepresentativeSlot__read;
[DataDescriptorDependency("RepresentativeSlot", "uint32")]
public partial uint RepresentativeSlot
{
get
{
if (!_RepresentativeSlot__read)
{
_layout.Select(Address, out var t, out var b, out var n, "RepresentativeSlot");
_RepresentativeSlot__value = _target.ReadField<uint>(b, t, n);
_RepresentativeSlot__read = true;
}
return _RepresentativeSlot__value;
}
}
private TargetPointer _Indirection__value = default!;
private bool _Indirection__read;
[DataDescriptorDependency("Indirection", "pointer")]
public partial TargetPointer Indirection
{
get
{
if (!_Indirection__read)
{
_layout.Select(Address, out var t, out var b, out var n, "Indirection");
_Indirection__value = _target.ReadPointerField(b, t, n);
_Indirection__read = true;
}
return _Indirection__value;
}
}
[DataDescriptorDependency("MethodDescPtr", "pointer")]
[DataDescriptorDependency("RepresentativeMTPtr", "pointer")]
[DataDescriptorDependency("RepresentativeSlot", "uint32")]
[DataDescriptorDependency("Indirection", "pointer")]
internal bool TryReadAllFields()
{
try
{
_ = MethodDescPtr;
_ = RepresentativeMTPtr;
_ = RepresentativeSlot;
_ = Indirection;
return true;
}
catch (VirtualReadException)
{
return false;
}
}
}