using System.Runtime.InteropServices;
namespace BinaryObjectScanner.Models.PortableExecutable
{
///
/// COFF line numbers are no longer produced and, in the future, will
/// not be consumed.
///
/// 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.
///
/// 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.
///
///
[StructLayout(LayoutKind.Explicit)]
public sealed class COFFLineNumber
{
///
/// 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.
///
[FieldOffset(0)] public uint SymbolTableIndex;
///
/// 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.
///
[FieldOffset(0)] public uint VirtualAddress;
///
/// 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.
///
[FieldOffset(4)] public ushort Linenumber;
}
}