Skip to content

Commit

Permalink
fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed May 14, 2024
1 parent 479b585 commit 7b935df
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions rust/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,36 +517,27 @@ impl Function {
/// * `addr` - virtual address of the call instruction to adjust
/// * `adjust_type` - (optional) overridden call type, or `None` to remove an existing adjustment
/// * `arch` - (optional) Architecture of the instruction if different from self.arch
///
/// # Example
/// ```no_run
/// // Change the current call site to no-return
/// target = bv.get_function_at(list(filter(lambda ref: ref.address == here, current_function.call_sites))[0].mlil.dest.value.value)
/// ft = target.type.mutable_copy()
/// ft.can_return = False
/// current_function.set_user_call_type_adjustment(here, ft)
/// ```
pub fn set_user_call_type_adjustment<'a, I>(
&self,
addr: u64,
adjust_type: I,
adjust_type: Option<I>,
arch: Option<CoreArchitecture>,
) where
I: Into<Conf<&'a Type>>,
{
let arch = arch.unwrap_or_else(|| self.arch());
let adjust_type: Conf<&Type> = adjust_type.into();
unsafe {
BNSetUserCallTypeAdjustment(
self.handle,
arch.0,
addr,
&mut BNTypeWithConfidence {
type_: adjust_type.contents.handle,
confidence: adjust_type.confidence,
},
)
}
let mut adjust_type = adjust_type.map(|adjust_type| {
let adjust_type = adjust_type.into();
BNTypeWithConfidence {
type_: adjust_type.contents.handle,
confidence: adjust_type.confidence,
}
});
let adjust_ptr = adjust_type
.as_mut()
.map(|x| x as *mut _)
.unwrap_or(core::ptr::null_mut());
unsafe { BNSetUserCallTypeAdjustment(self.handle, arch.0, addr, adjust_ptr) }
}

pub fn set_auto_call_type_adjustment<'a, I>(
Expand Down Expand Up @@ -1485,7 +1476,7 @@ impl Function {
/// * `value` - Field of the InstructionTextToken object for the token, usually the constant displayed
/// * `operand` - Operand index of the token, defined as the number of OperandSeparatorTokens in the disassembly line before the token
/// * `display_type` - Desired display type
/// * `itecture arch` - (optional) Architecture of the instruction or IL line containing the token
/// * `arch` - (optional) Architecture of the instruction or IL line containing the token
/// * `enum_display_typeid` - (optional) Whenever passing EnumDisplayType to ``display_type``, passing a type ID here will specify the Enumeration display type. Must be a valid type ID and resolve to an enumeration type.
pub fn set_int_display_type(
&self,
Expand Down Expand Up @@ -1805,14 +1796,14 @@ impl Function {

/// Indicates that this function needs to be reanalyzed during the next update cycle
///
/// * `update_type` - (optional) Desired update type
/// * `update_type` - Desired update type
pub fn mark_updates_required(&self, update_type: FunctionUpdateType) {
unsafe { BNMarkUpdatesRequired(self.handle, update_type) }
}

/// Indicates that callers of this function need to be reanalyzed during the next update cycle
///
/// * `uppdate_type` - (optional) Desired update type
/// * `uppdate_type` - Desired update type
pub fn mark_caller_updates_required(&self, update_type: FunctionUpdateType) {
unsafe { BNMarkCallerUpdatesRequired(self.handle, update_type) }
}
Expand Down

0 comments on commit 7b935df

Please sign in to comment.