Skip to content

Commit 4c521d7

Browse files
committed
[Rust] Add misc documentation
1 parent cfad77a commit 4c521d7

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

rust/src/architecture.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,12 @@ impl Architecture for CoreArchitecture {
499499
}
500500
}
501501

502+
/// Performs basic block recovery and commits the results to the function analysis.
503+
///
504+
/// NOTE: Only implement this method if function-level analysis is required. Otherwise, do not
505+
/// implement to let default basic block analysis take place.
506+
///
507+
/// NOTE: The default implementation exists in C++ here: https://github.com/Vector35/binaryninja-api/blob/dev/defaultabb.cpp
502508
fn analyze_basic_blocks(
503509
&self,
504510
function: &mut Function,

rust/src/binary_view.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,11 @@ pub trait BinaryViewExt: BinaryViewBase {
13221322
}
13231323
}
13241324

1325+
/// This list contains the analysis entry function, and functions like init_array, fini_array,
1326+
/// and TLS callbacks etc.
1327+
///
1328+
/// We see `entry_functions` as good starting points for analysis, these functions normally don't
1329+
/// have internal references. Exported functions in a dll/so file are not included.
13251330
fn entry_point_functions(&self) -> Array<Function> {
13261331
unsafe {
13271332
let mut count = 0;
@@ -1706,6 +1711,9 @@ pub trait BinaryViewExt: BinaryViewBase {
17061711
}
17071712
}
17081713

1714+
/// Retrieve the metadata as the type `T`.
1715+
///
1716+
/// Fails if the metadata does not exist, or if the metadata failed to coerce to type `T`.
17091717
fn get_metadata<T>(&self, key: &str) -> Option<Result<T>>
17101718
where
17111719
T: for<'a> TryFrom<&'a Metadata>,
@@ -2235,6 +2243,9 @@ pub trait BinaryViewExt: BinaryViewBase {
22352243
}
22362244
}
22372245

2246+
/// Retrieve the string that falls on a given virtual address.
2247+
///
2248+
/// NOTE: This returns discovered strings and is therefore governed by `analysis.limits.minStringLength` and other settings.
22382249
fn string_at(&self, addr: u64) -> Option<BNStringReference> {
22392250
let mut str_ref = BNStringReference::default();
22402251
let success = unsafe { BNGetStringAtAddress(self.as_ref().handle, addr, &mut str_ref) };

rust/src/llvm.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! LLVM functionality exposed by the core.
2+
//!
3+
//! Also see [`crate::demangle::demangle_llvm`].
4+
15
use binaryninjacore_sys::{
26
BNLlvmServicesAssemble, BNLlvmServicesAssembleFree, BNLlvmServicesDisasmInstruction,
37
BNLlvmServicesInit,

0 commit comments

Comments
 (0)