Struct lief::dwarf::editor::Function

pub struct Function { /* private fields */ }
Expand description

This structure represents an editable DWARF function (DW_TAG_subprogram)

Implementations§

§

impl Function

pub fn set_address(&mut self, addr: u64) -> &mut Self

Set the address of this function by defining DW_AT_entry_pc

pub fn set_low_high(&mut self, low: u64, high: u64) -> &mut Self

Set the upper and lower bound addresses for this function. This assumes that the function is contiguous between low and high.

Underneath, the function defines DW_AT_low_pc and DW_AT_high_pc

pub fn set_ranges(&mut self, ranges: &[Range]) -> &mut Self

Set the ranges of addresses owned by the implementation of this function by setting the DW_AT_ranges attribute.

This setter should be used for non-contiguous function.

pub fn set_external(&mut self) -> &mut Self

Set the function as external by defining DW_AT_external to true. This means that the function is imported by the current compilation unit.

pub fn set_return_type(&mut self, ty: &dyn EditorType) -> &mut Self

Set the return type of this function

pub fn add_parameter(&mut self, name: &str, ty: &dyn EditorType) -> Parameter

Add a parameter to the current function

pub fn create_stack_variable(&mut self, name: &str) -> Variable

Create a stack-based variable owned by the current function

pub fn add_lexical_block(&mut self, start: u64, end: u64) -> LexicalBlock

Add a lexical block with the given range

pub fn add_label(&mut self, addr: u64, name: &str) -> Label

Add a label at the given address

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.