From 64633f61f7b9e03be9437b5f4896bbe122f7a7a2 Mon Sep 17 00:00:00 2001 From: LukBukkit Date: Thu, 24 Apr 2025 16:20:32 +0000 Subject: [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 --- rust/src/disassembly.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'rust/src/disassembly.rs') 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, 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, kind: InstructionTextTokenKind) -> Self { Self { address: 0, @@ -493,13 +505,13 @@ pub enum InstructionTextTokenKind { hash: Option, }, 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? -- cgit v1.3.1