pub enum Object<'data> {
Breakpad(BreakpadObject<'data>),
Elf(ElfObject<'data>),
MachO(MachObject<'data>),
Pdb(PdbObject<'data>),
Pe(PeObject<'data>),
SourceBundle(SourceBundle<'data>),
Wasm(WasmObject<'data>),
PortablePdb(PortablePdbObject<'data>),
}
Expand description
A generic object file providing uniform access to various file formats.
Variants§
Breakpad(BreakpadObject<'data>)
Breakpad ASCII symbol.
Elf(ElfObject<'data>)
Executable and Linkable Format, used on Linux.
MachO(MachObject<'data>)
Mach Objects, used on macOS and iOS derivatives.
Pdb(PdbObject<'data>)
Program Database, the debug companion format on Windows.
Pe(PeObject<'data>)
Portable Executable, an extension of COFF used on Windows.
SourceBundle(SourceBundle<'data>)
A source bundle.
Wasm(WasmObject<'data>)
A WASM file.
PortablePdb(PortablePdbObject<'data>)
A Portable PDB, a debug companion format for CLR languages.
Implementations§
Source§impl<'data> Object<'data>
impl<'data> Object<'data>
Sourcepub fn peek(data: &[u8]) -> FileFormat
pub fn peek(data: &[u8]) -> FileFormat
Tries to infer the object type from the start of the given buffer.
Sourcepub fn parse(data: &'data [u8]) -> Result<Self, ObjectError>
pub fn parse(data: &'data [u8]) -> Result<Self, ObjectError>
Tries to parse a supported object from the given slice.
Sourcepub fn file_format(&self) -> FileFormat
pub fn file_format(&self) -> FileFormat
The container format of this file, corresponding to the variant of this instance.
Sourcepub fn code_id(&self) -> Option<CodeId>
pub fn code_id(&self) -> Option<CodeId>
The code identifier of this object.
This is a platform-dependent string of variable length that always refers to the code file (e.g. executable or library), even if this object is a debug file. See the variants for the semantics of this code identifier.
Sourcepub fn debug_id(&self) -> DebugId
pub fn debug_id(&self) -> DebugId
The debug information identifier of this object.
For platforms that use different identifiers for their code and debug files, this always refers to the debug file, regardless whether this object is a debug file or not.
Sourcepub fn kind(&self) -> ObjectKind
pub fn kind(&self) -> ObjectKind
The kind of this object.
Sourcepub fn load_address(&self) -> u64
pub fn load_address(&self) -> u64
The address at which the image prefers to be loaded into memory.
Sourcepub fn has_symbols(&self) -> bool
pub fn has_symbols(&self) -> bool
Determines whether this object exposes a public symbol table.
Sourcepub fn symbols(&self) -> SymbolIterator<'data, '_> ⓘ
pub fn symbols(&self) -> SymbolIterator<'data, '_> ⓘ
Returns an iterator over symbols in the public symbol table.
Sourcepub fn symbol_map(&self) -> SymbolMap<'data>
pub fn symbol_map(&self) -> SymbolMap<'data>
Returns an ordered map of symbols in the symbol table.
Sourcepub fn has_debug_info(&self) -> bool
pub fn has_debug_info(&self) -> bool
Determines whether this object contains debug information.
Sourcepub fn debug_session(&self) -> Result<ObjectDebugSession<'data>, ObjectError>
pub fn debug_session(&self) -> Result<ObjectDebugSession<'data>, ObjectError>
Constructs a debugging session.
A debugging session loads certain information from the object file and creates caches for efficient access to various records in the debug information. Since this can be quite a costly process, try to reuse the debugging session as long as possible.
Objects that do not support debugging or do not contain debugging information return an empty debug session. This only returns an error if constructing the debug session fails due to invalid debug data in the object.
Constructing this session will also work if the object does not contain debugging
information, in which case the session will be a no-op. This can be checked via
has_debug_info
.
Sourcepub fn has_unwind_info(&self) -> bool
pub fn has_unwind_info(&self) -> bool
Determines whether this object contains stack unwinding information.
Sourcepub fn has_sources(&self) -> bool
pub fn has_sources(&self) -> bool
Determines whether this object contains embedded source
Sourcepub fn is_malformed(&self) -> bool
pub fn is_malformed(&self) -> bool
Determines whether this object is malformed and was only partially parsed