summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2025-08-06 16:10:02 -0400
committerBrandon Miller <brandon@vector35.com>2025-09-29 07:07:41 -0400
commit0bc967cf0f873a27dca1e7f3a723a0c53db9a68f (patch)
treed12314f5959e205d605fb6751ef49a79b8db0696
parent604a22a0050c000ed4d142589c9ce0e34ee7b570 (diff)
Add a new line disassembly text token
-rw-r--r--binaryninjacore.h5
-rw-r--r--python/architecture.py1
-rw-r--r--rust/src/disassembly.rs7
3 files changed, 12 insertions, 1 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 66c1e15b..3c2386cd 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -416,7 +416,8 @@ extern "C"
StackVariableToken = 71,
AddressSeparatorToken = 72,
CollapsedInformationToken = 73,
- CollapseStateIndicatorToken = 74
+ CollapseStateIndicatorToken = 74,
+ NewLineToken = 75
} BNInstructionTextTokenType;
typedef enum BNInstructionTextTokenContext
@@ -7607,8 +7608,10 @@ extern "C"
// LLVM Services APIs
BINARYNINJACOREAPI void BNLlvmServicesInit(void);
+
BINARYNINJACOREAPI int BNLlvmServicesAssemble(const char* src, int dialect, const char* triplet, int codeModel,
int relocMode, char** outBytes, int* outBytesLen, char** err, int* errLen);
+
BINARYNINJACOREAPI void BNLlvmServicesAssembleFree(char* outBytes, char* err);
BINARYNINJACOREAPI int BNLlvmServicesDisasmInstruction(const char *triplet, uint8_t *src, int srcLen,
uint64_t addr, char *result, size_t resultMaxSize);
diff --git a/python/architecture.py b/python/architecture.py
index 0a2890d3..95af9ddd 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -3196,6 +3196,7 @@ class InstructionTextToken:
CommentToken Comments
TypeNameToken **Not emitted by architectures**
AddressSeparatorToken **Not emitted by architectures**
+ NewLineToken New lines
========================== ============================================
"""
diff --git a/rust/src/disassembly.rs b/rust/src/disassembly.rs
index c1021197..ed9b0854 100644
--- a/rust/src/disassembly.rs
+++ b/rust/src/disassembly.rs
@@ -545,6 +545,10 @@ pub enum InstructionTextTokenKind {
// TODO: Explain what this is
hash: Option<u64>,
},
+ NewLine {
+ // Offset into instruction that this new line is associated with
+ value: u64,
+ },
}
impl InstructionTextTokenKind {
@@ -721,6 +725,7 @@ impl InstructionTextTokenKind {
},
}
}
+ BNInstructionTextTokenType::NewLineToken => Self::NewLine { value: value.value },
}
}
@@ -756,6 +761,7 @@ impl InstructionTextTokenKind {
InstructionTextTokenKind::ExternalSymbol { value, .. } => Some(*value),
InstructionTextTokenKind::StackVariable { variable_id, .. } => Some(*variable_id),
InstructionTextTokenKind::CollapseStateIndicator { hash, .. } => *hash,
+ InstructionTextTokenKind::NewLine { value, .. } => Some(*value),
_ => None,
}
}
@@ -925,6 +931,7 @@ impl From<InstructionTextTokenKind> for BNInstructionTextTokenType {
InstructionTextTokenKind::CollapseStateIndicator { .. } => {
BNInstructionTextTokenType::CollapseStateIndicatorToken
}
+ InstructionTextTokenKind::NewLine { .. } => BNInstructionTextTokenType::NewLineToken,
}
}
}