ddn.elf.test_parsers
Output parser utilities for external ELF tools.
This module provides parsers for output from GNU binutils tools like readelf, nm, and objdump. These parsers enable automated comparison of library-generated ELF files against verified tool output.
Types 5
structReadelfHeader
Parsed ELF header from readelf -h output.
Fields
string elfClassELF class (32-bit or 64-bit)string dataEncodingData encoding (little endian or big endian)string elfVersionVersionstring osAbiOS/ABIstring abiVersionABI versionstring typeELF type (REL, EXEC, DYN, etc.)string machineMachine architectureulong entryPointEntry point addressulong phOffsetStart of program headers (bytes into file)ulong shOffsetStart of section headers (bytes into file)ulong flagsFlagsuint ehSizeSize of this header (bytes)uint phEntSizeSize of program headers (bytes)uint phNumNumber of program headersuint shEntSizeSize of section headers (bytes)uint shNumNumber of section headersuint shStrNdxSection header string table indexstructReadelfSection
Parsed section header from readelf -S output.
Fields
uint numberSection numberstring nameSection namestring typeSection typeulong addressAddressulong offsetOffsetulong sizeSizeulong entSizeEntry sizestring flagsFlags (as string, e.g., "WA", "AX", etc.)uint linkLink section indexuint infoInfoulong alignmentAlignmentstructReadelfSymbol
Parsed symbol from readelf -s output.
Fields
uint numberSymbol numberulong valueSymbol value (address)ulong sizeSymbol sizestring typeSymbol type (FUNC, OBJECT, NOTYPE, etc.)string bindSymbol binding (LOCAL, GLOBAL, WEAK, etc.)string visibilitySymbol visibility (DEFAULT, HIDDEN, INTERNAL, etc.)string ndxSection index (number or "UND", "ABS", "COM")string nameSymbol namestructReadelfSegment
Parsed segment/program header from readelf -l output.
Fields
string typeSegment type (LOAD, DYNAMIC, INTERP, etc.)ulong offsetSegment offsetulong vaddrVirtual addressulong paddrPhysical addressulong fileSizeFile sizeulong memSizeMemory sizestring flagsFlags (R, W, X, or combinations)ulong alignmentAlignmentstring[] sectionsSections in this segment (from section mapping)structNmSymbol
Parsed symbol from nm output.
Fields
ulong valueSymbol value (address)string typeSymbol type (T, U, D, B, W, etc.)string nameSymbol nameFunctions 12
fn
bool compareHeaders(const ref ReadelfHeader expected, const ref ReadelfHeader actual)Compare two ReadelfHeader structs.fn
bool compareSections(const ref ReadelfSection[] expected, const ref ReadelfSection[] actual)Compare two ReadelfSection arrays.fn
bool compareSymbols(const ref ReadelfSymbol[] expected, const ref ReadelfSymbol[] actual)Compare two ReadelfSymbol arrays.