Struct fxprof_processed_profile::LibMappings
source · pub struct LibMappings<T> { /* private fields */ }
Expand description
Keeps track of mapped libraries in an address space. Stores a value for each mapping, and allows efficient lookup of that value based on an address.
A “library” here is a loose term; it could be a normal shared library, or the main binary, but it could also be a synthetic library for JIT code. For normal libraries, there’s usually just one mapping per library. For JIT code, you could have many small mappings, one per JIT function, all pointing to the synthetic JIT “library”.
Implementations§
source§impl<T> LibMappings<T>
impl<T> LibMappings<T>
sourcepub fn add_mapping(
&mut self,
start_avma: u64,
end_avma: u64,
relative_address_at_start: u32,
value: T
)
pub fn add_mapping( &mut self, start_avma: u64, end_avma: u64, relative_address_at_start: u32, value: T )
Add a mapping to this address space. Any existing mappings which overlap with the new mapping are removed.
start_avma
and end_avma
describe the address range that this mapping
occupies.
AVMA = “actual virtual memory address”
relative_address_at_start
is the “relative address” which corresponds
to start_avma
, in the library that is mapped in this mapping. This is zero if
start_avm
is the base address of the library.
A relative address is a u32
value which is relative to the library base address.
So you will usually set relative_address_at_start
to start_avma - base_avma
.
For ELF binaries, the base address is the AVMA of the first segment, i.e. the
start_avma of the mapping created by the first ELF LOAD
command.
For mach-O binaries, the base address is the vmaddr of the __TEXT
segment.
For Windows binaries, the base address is the image load address.
sourcepub fn remove_mapping(&mut self, start_avma: u64) -> Option<(u32, T)>
pub fn remove_mapping(&mut self, start_avma: u64) -> Option<(u32, T)>
Remove a mapping which starts at the given address. If found, this returns
the relative_address_at_start
and the associated value of the mapping.
Trait Implementations§
source§impl<T: Clone> Clone for LibMappings<T>
impl<T: Clone> Clone for LibMappings<T>
source§fn clone(&self) -> LibMappings<T>
fn clone(&self) -> LibMappings<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more