File: Data\RuntimeFunction.cs
Web Access
Project: src\src\runtime\src\native\managed\cdac\Microsoft.Diagnostics.DataContractReader.Contracts\Microsoft.Diagnostics.DataContractReader.Contracts.csproj (Microsoft.Diagnostics.DataContractReader.Contracts)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.Diagnostics.DataContractReader.Data;

internal sealed class RuntimeFunction : IData<RuntimeFunction>
{
    static RuntimeFunction IData<RuntimeFunction>.Create(Target target, TargetPointer address)
        => new RuntimeFunction(target, address);

    public RuntimeFunction(Target target, TargetPointer address)
    {
        Target.TypeInfo type = target.GetTypeInfo(DataType.RuntimeFunction);

        BeginAddress = target.ReadField<uint>(address, type, nameof(BeginAddress));

        // Not all platforms define EndAddress
        if (type.Fields.ContainsKey(nameof(EndAddress)))
            EndAddress = target.ReadField<uint>(address, type, nameof(EndAddress));

        UnwindData = target.ReadField<uint>(address, type, nameof(UnwindData));
    }

    public uint BeginAddress { get; }
    public uint? EndAddress { get; }
    public uint UnwindData { get; }
}