Skip to main content

Module symbol_table

Module symbol_table 

Source
Expand description

ELF / Mach-O symbol-table parser.

The single piece of logic parse_symbol_table hides: open a binary file, hand it to the object crate, and project the rich object::SymbolTable API down to the small SymbolTable view Whisker’s hot-reload pipeline actually needs (name → address + kind/size/visibility flags).

Why a projection rather than re-using object::Symbol directly: the object types are bound by lifetimes to the file they came out of. Storing them across an async boundary would force the file bytes to live for the whole dev-loop run. Copying the small pieces we need (name + 4 numbers per symbol) into owned data is cheaper than that lifetime gymnastics.

Structs§

SymbolInfo
What we keep about each symbol — enough to drive subsecond’s JumpTable construction (I4g-2) and no more.
SymbolTable
Owned name → info map. BTreeMap would give deterministic iteration order but we want O(1) lookup by symbol name in the JumpTable construction step, so HashMap it is.

Functions§

parse_symbol_table
Open path and project its symbol table.
parse_symbol_table_from_bytes
Same as parse_symbol_table but takes the bytes directly. Used by tests so we don’t need a fixture file on disk.