summaryrefslogtreecommitdiff
path: root/rust/src/disassembly.rs
diff options
context:
space:
mode:
authorLukBukkit <luk.bukkit@gmail.com>2025-04-24 16:20:32 +0000
committerMason Reed <mason@vector35.com>2025-10-07 16:47:33 -0400
commit64633f61f7b9e03be9437b5f4896bbe122f7a7a2 (patch)
tree8fafed1395a8d2e29e5a6b8b7f7d7b8a2af2731a /rust/src/disassembly.rs
parente6e4ebea5d0ea7842766c7e686e0dfd45cb54bb8 (diff)
[Rust] Implement custom data renderer API
Also adds an example plugin and misc rust fixes / documentation. This is a continuation of https://github.com/Vector35/binaryninja-api/pull/6721 Co-authored-by: rbran <lgit@rubens.io>
Diffstat (limited to 'rust/src/disassembly.rs')
-rw-r--r--rust/src/disassembly.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/rust/src/disassembly.rs b/rust/src/disassembly.rs
index ed9b0854..cd5a860d 100644
--- a/rust/src/disassembly.rs
+++ b/rust/src/disassembly.rs
@@ -142,6 +142,14 @@ impl DisassemblyTextLine {
..Default::default()
}
}
+
+ pub fn new_with_addr(tokens: Vec<InstructionTextToken>, addr: u64) -> Self {
+ Self {
+ address: addr,
+ tokens,
+ ..Default::default()
+ }
+ }
}
impl From<&str> for DisassemblyTextLine {
@@ -308,6 +316,10 @@ impl InstructionTextToken {
}
}
+ /// Construct a new token **without** an associated address.
+ ///
+ /// You most likely want to call [`InstructionTextToken::new_with_address`], while also adjusting
+ /// the [`InstructionTextToken::expr_index`] field where applicable.
pub fn new(text: impl Into<String>, kind: InstructionTextTokenKind) -> Self {
Self {
address: 0,
@@ -493,13 +505,13 @@ pub enum InstructionTextTokenKind {
hash: Option<u64>,
},
CodeSymbol {
- // TODO: Value of what?
+ // Target address of the symbol
value: u64,
// TODO: Size of what?
size: usize, // TODO: Operand?
},
DataSymbol {
- // TODO: Value of what?
+ // Target address of the symbol
value: u64,
// TODO: Size of what?
size: usize, // TODO: Operand?