summaryrefslogtreecommitdiff
path: root/rust/src/function.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/function.rs')
-rw-r--r--rust/src/function.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs
index 29d4fc3c..06da39dc 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -368,6 +368,9 @@ impl Function {
}
}
+ /// Returns the symbol at the function start address or a default symbol.
+ ///
+ /// NOTE: If you want to only get the symbol if there is actually a symbol, use [`Function::defined_symbol`].
pub fn symbol(&self) -> Ref<Symbol> {
unsafe {
let sym = BNGetFunctionSymbol(self.handle);
@@ -375,6 +378,13 @@ impl Function {
}
}
+ /// Returns the symbol at the function start address or `None` if there is no symbol.
+ ///
+ /// NOTE: If you want to get a default "sub_X" symbol use [`Function::symbol`].
+ pub fn defined_symbol(&self) -> Option<Ref<Symbol>> {
+ self.view().symbol_by_address(self.start())
+ }
+
/// Returns true when the function's symbol binding marks it as exported.
pub fn is_exported(&self) -> bool {
let symbol = self.symbol();