#[repr(C)]pub struct Symbol {
pub name: [u8; 8],
pub value: u32,
pub section_number: i16,
pub typ: u16,
pub storage_class: u8,
pub number_of_aux_symbols: u8,
}
Expand description
A COFF symbol.
Unwind information for this function can be loaded with ExceptionData::get_unwind_info
.
Fields§
§name: [u8; 8]
The name of the symbol.
An array of 8 bytes is used if the name is not more than 8 bytes long. This array is padded with nulls on the right if the name is less than 8 bytes long.
For longer names, the first 4 bytes are all zeros, and the second 4 bytes are an offset into the string table.
value: u32
The value that is associated with the symbol.
The interpretation of this field depends on section_number
and
storage_class
. A typical meaning is the relocatable address.
section_number: i16
A one-based index into the section table. Zero and negative values have special meanings.
typ: u16
A number that represents type.
Microsoft tools set this field to 0x20 (function) or 0x0 (not a function).
storage_class: u8
An enumerated value that represents storage class.
number_of_aux_symbols: u8
The number of auxiliary symbol table entries that follow this record.
Each auxiliary record is the same size as a standard symbol-table record (18 bytes), but rather than define a new symbol, the auxiliary record gives additional information on the last symbol defined.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn parse<'a>(
bytes: &'a [u8],
offset: usize,
) -> Result<(Option<&'a str>, Symbol)>
pub fn parse<'a>( bytes: &'a [u8], offset: usize, ) -> Result<(Option<&'a str>, Symbol)>
Parse the symbol at the given offset.
If the symbol has an inline name, then also returns a reference to the name’s
location in bytes
.
Sourcepub fn name<'a>(&'a self, strtab: &'a Strtab<'_>) -> Result<&'a str>
pub fn name<'a>(&'a self, strtab: &'a Strtab<'_>) -> Result<&'a str>
Returns the symbol name.
This may be a reference to an inline name in the symbol, or to a strtab entry.
Sourcepub fn name_offset(&self) -> Option<u32>
pub fn name_offset(&self) -> Option<u32>
Return the strtab offset of the symbol name.
Returns None
if the name is inline.
Sourcepub fn set_name_offset(&mut self, offset: u32)
pub fn set_name_offset(&mut self, offset: u32)
Set the strtab offset of the symbol name.
Sourcepub fn base_type(&self) -> u16
pub fn base_type(&self) -> u16
Return the base type of the symbol.
This type uses the IMAGE_SYM_TYPE_*
definitions.
Sourcepub fn derived_type(&self) -> u16
pub fn derived_type(&self) -> u16
Return the derived type of the symbol.
This type uses the IMAGE_SYM_DTYPE_*
definitions.
Sourcepub fn is_function_definition(&self) -> bool
pub fn is_function_definition(&self) -> bool
Return true for function definitions.
These symbols use AuxFunctionDefinition
for auxiliary symbol records.
Sourcepub fn is_weak_external(&self) -> bool
pub fn is_weak_external(&self) -> bool
Return true for weak external symbols.
These symbols use AuxWeakExternal
for auxiliary symbol records.
Sourcepub fn is_file(&self) -> bool
pub fn is_file(&self) -> bool
Return true for file symbol records.
The auxiliary records contain the name of the source code file.
Sourcepub fn is_section_definition(&self) -> bool
pub fn is_section_definition(&self) -> bool
Return true for section definitions.
These symbols use AuxSectionDefinition
for auxiliary symbol records.