Files

43 lines
1.7 KiB
C#
Raw Permalink Normal View History

2025-09-26 12:09:34 -04:00
using System.Runtime.InteropServices;
2025-09-26 13:06:18 -04:00
namespace SabreTools.Data.Models.COFF
2025-09-26 12:09:34 -04:00
{
/// <summary>
/// COFF line numbers are no longer produced and, in the future, will
/// not be consumed.
2025-10-30 21:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// COFF line numbers indicate the relationship between code and line
/// numbers in source files. The Microsoft format for COFF line numbers
/// is similar to standard COFF, but it has been extended to allow a
/// single section to relate to line numbers in multiple source files.
2025-10-30 21:29:24 -04:00
///
2025-09-26 12:09:34 -04:00
/// COFF line numbers consist of an array of fixed-length records.
/// The location (file offset) and size of the array are specified in
/// the section header.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Explicit)]
public sealed class LineNumber
{
/// <summary>
/// Used when Linenumber is zero: index to symbol table entry for a function.
/// This format is used to indicate the function to which a group of
/// line-number records refers.
/// </summary>
[FieldOffset(0)] public uint SymbolTableIndex;
/// <summary>
/// Used when Linenumber is non-zero: the RVA of the executable code that
/// corresponds to the source line indicated. In an object file, this
/// contains the VA within the section.
/// </summary>
[FieldOffset(0)] public uint VirtualAddress;
/// <summary>
/// When nonzero, this field specifies a one-based line number. When zero,
/// the Type field is interpreted as a symbol table index for a function.
/// </summary>
[FieldOffset(4)] public ushort Linenumber;
}
}