pub struct Metadata {
pub soname: String,
pub symbols: Vec<Symbol>,
}Expand description
The defined, versioned dynamic symbols of one shared object.
Fields§
§soname: StringThe object’s DT_SONAME, such as libc.so.6.
symbols: Vec<Symbol>Its defined dynamic symbols, one entry per name and version.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn load(path: &Path) -> Result<Self, String>
pub fn load(path: &Path) -> Result<Self, String>
Reads and parses the ELF shared object at path.
§Errors
Fails if the file cannot be read, is larger than MAX_FILE_BYTES, or
Metadata::parse rejects it; the message names the path.
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, String>
pub fn parse(bytes: &[u8]) -> Result<Self, String>
Parses an x86_64 ELF64 shared object held in memory. Every offset and size is bounds-checked, so malformed input fails instead of panicking.
§Errors
Fails if the input is larger than MAX_FILE_BYTES, is not a
little-endian x86_64 ELF64 shared object with a DT_SONAME, or has
malformed dynamic-symbol, string or version tables.
Sourcepub fn from_tsv(text: &str) -> Result<Vec<Self>, String>
pub fn from_tsv(text: &str) -> Result<Vec<Self>, String>
Reads Metadata::to_tsv output back, one entry per SONAME in the order
first seen. Several libraries’ rows may share one table under one header.
Sourcepub fn to_tsv(&self) -> String
pub fn to_tsv(&self) -> String
Stable tab-separated table of the symbols, one row per symbol under a
header, which Metadata::from_tsv reads back.