SBAddress

Struct SBAddress 

Source
pub struct SBAddress {
    pub raw: SBAddressRef,
}
Expand description

A section + offset based address class.

The SBAddress class allows addresses to be relative to a section that can move during runtime due to images (executables, shared libraries, bundles, frameworks) being loaded at different addresses than the addresses found in the object file that represents them on disk. There are currently two types of addresses for a section:

  • file addresses
  • load addresses

File addresses represents the virtual addresses that are in the ‘on disk’ object files. These virtual addresses are converted to be relative to unique sections scoped to the object file so that when/if the addresses slide when the images are loaded/unloaded in memory, we can easily track these changes without having to update every object (compile unit ranges, line tables, function address ranges, lexical block and inlined subroutine address ranges, global and static variables) each time an image is loaded or unloaded.

Load addresses represents the virtual addresses where each section ends up getting loaded at runtime. Before executing a program, it is common for all of the load addresses to be unresolved. When a DynamicLoader plug-in receives notification that shared libraries have been loaded/unloaded, the load addresses of the main executable and any images (shared libraries) will be resolved/unresolved. When this happens, breakpoints that are in one of these sections can be set/cleared.

Fields§

§raw: SBAddressRef

The underlying raw SBAddressRef.

Implementations§

Source§

impl SBAddress

Source

pub fn is_valid(&self) -> bool

Check whether or not this is a valid SBAddress value.

Source

pub fn from_section_offset( section: &SBSection, offset: lldb_addr_t, ) -> SBAddress

Construct a new SBAddress from the given section and offset.

Source

pub fn from_load_address(load_addr: lldb_addr_t, target: &SBTarget) -> SBAddress

Create a new SBAddress from the given load address within the target.

Source

pub fn file_address(&self) -> u64

The address that represents the address as it is found in the object file that defines it.

Source

pub fn load_address(&self, target: &SBTarget) -> u64

The address as it has been loaded into memory by a target.

Source

pub fn symbol_context(&self, resolve_scope: u32) -> SBSymbolContext

Get the SBSymbolContext for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

  • resolve_scope: Flags that specify what type of symbol context is needed by the caller. These flags have constants starting with SYMBOL_CONTEXT_ITEM_.
Source

pub fn module(&self) -> Option<SBModule>

Get the SBModule for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

This grabs an individual object for a given address and is less efficient if you want more than one symbol related objects. Use one of the following when you want multiple debug symbol related objects for an address:

One or more bits from the SymbolContextItem enumerations can be logically OR’ed together to more efficiently retrieve multiple symbol objects.

Source

pub fn compile_unit(&self) -> Option<SBCompileUnit>

Get the SBCompileUnit for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

This grabs an individual object for a given address and is less efficient if you want more than one symbol related objects. Use one of the following when you want multiple debug symbol related objects for an address:

One or more bits from the SymbolContextItem enumerations can be logically OR’ed together to more efficiently retrieve multiple symbol objects.

Source

pub fn function(&self) -> Option<SBFunction>

Get the SBFunction for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

This grabs an individual object for a given address and is less efficient if you want more than one symbol related objects. Use one of the following when you want multiple debug symbol related objects for an address:

One or more bits from the SymbolContextItem enumerations can be logically OR’ed together to more efficiently retrieve multiple symbol objects.

Source

pub fn block(&self) -> Option<SBBlock>

Get the SBBlock for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

This grabs an individual object for a given address and is less efficient if you want more than one symbol related objects. Use one of the following when you want multiple debug symbol related objects for an address:

One or more bits from the SymbolContextItem enumerations can be logically OR’ed together to more efficiently retrieve multiple symbol objects.

Source

pub fn symbol(&self) -> Option<SBSymbol>

Get the SBSymbol for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

This grabs an individual object for a given address and is less efficient if you want more than one symbol related objects. Use one of the following when you want multiple debug symbol related objects for an address:

One or more bits from the SymbolContextItem enumerations can be logically OR’ed together to more efficiently retrieve multiple symbol objects.

Source

pub fn line_entry(&self) -> Option<SBLineEntry>

Get the SBLineEntry for a given address.

An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. This will only return valid values if the address has been resolved to a code or data address using SBAddress::from_load_address or SBTarget::resolve_load_address.

This grabs an individual object for a given address and is less efficient if you want more than one symbol related objects. Use one of the following when you want multiple debug symbol related objects for an address:

One or more bits from the SymbolContextItem enumerations can be logically OR’ed together to more efficiently retrieve multiple symbol objects.

Source

pub fn get_offset(&self) -> lldb_addr_t

Returns offset of the address in the section

See also:

  • get_section for getting the section corresponding to this address
Source

pub fn get_section(&self) -> Option<SBSection>

Returns the corresponding section of this address.

Trait Implementations§

Source§

impl Clone for SBAddress

Source§

fn clone(&self) -> SBAddress

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SBAddress

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SBAddress

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for SBAddress

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SBAddress

Source§

impl Send for SBAddress

Source§

impl Sync for SBAddress

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.