ddn.elf.strtab

ELF string table handling functionality.

This module provides utilities for reading, searching, and building ELF string tables. String tables are used extensively in ELF files to store section names, symbol names, and other string data.

Types 2

Represents an ELF string table.

This struct provides efficient access to strings stored in an ELF string table section, which consists of null-terminated strings concatenated together.

Fields
const(ubyte)[] _data
Methods
string getString(size_t offset)Get a string by its offset in the string table.
size_t findString(string str)Find the offset of a string in the string table.
bool hasString(string str)Check if a string exists in the string table.
const(ubyte)[] getRawData() pure nothrow @nogc @safe constGet the raw string table data.
Constructors
this(const(ubyte)[] data)Constructor from raw string table data.

Builder for creating ELF string tables.

This struct allows incremental construction of a string table with automatic deduplication of strings.

Fields
ubyte[] _buffer
size_t[string] _stringOffsets
Methods
size_t addString(string str)Add a string to the string table.
size_t getOffset(string str)Get the offset of a previously added string.
ubyte[] build()Build the final string table byte array.
size_t size() pure nothrow @nogc @safe constGet the current size of the string table in bytes.
size_t count() pure nothrow @nogc @safe constGet the number of unique strings in the table.
void clear()Clear all strings from the builder.
Constructors
this()Default constructor - creates an empty builder.
this(size_t capacity)Constructor with initial buffer capacity.

Functions 1

fnElfStringTable getSectionStringTable(ElfFile file)Get the section header string table from an ELF file.