Skip to content

Commit 537502c

Browse files
committed
Add a new line disassembly text token
1 parent 187c880 commit 537502c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

binaryninjacore.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ extern "C"
416416
StackVariableToken = 71,
417417
AddressSeparatorToken = 72,
418418
CollapsedInformationToken = 73,
419-
CollapseStateIndicatorToken = 74
419+
CollapseStateIndicatorToken = 74,
420+
NewLineToken = 75
420421
} BNInstructionTextTokenType;
421422

422423
typedef enum BNInstructionTextTokenContext
@@ -7586,8 +7587,10 @@ extern "C"
75867587

75877588
// LLVM Services APIs
75887589
BINARYNINJACOREAPI void BNLlvmServicesInit(void);
7590+
75897591
BINARYNINJACOREAPI int BNLlvmServicesAssemble(const char* src, int dialect, const char* triplet, int codeModel,
75907592
int relocMode, char** outBytes, int* outBytesLen, char** err, int* errLen);
7593+
75917594
BINARYNINJACOREAPI void BNLlvmServicesAssembleFree(char* outBytes, char* err);
75927595
BINARYNINJACOREAPI int BNLlvmServicesDisasmInstruction(const char *triplet, uint8_t *src, int srcLen,
75937596
uint64_t addr, char *result, size_t resultMaxSize);

python/architecture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,6 +3196,7 @@ class InstructionTextToken:
31963196
CommentToken Comments
31973197
TypeNameToken **Not emitted by architectures**
31983198
AddressSeparatorToken **Not emitted by architectures**
3199+
NewLineToken New lines
31993200
========================== ============================================
32003201
32013202
"""

rust/src/disassembly.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ pub enum InstructionTextTokenKind {
545545
// TODO: Explain what this is
546546
hash: Option<u64>,
547547
},
548+
NewLine {
549+
// Offset into instruction that this new line is associated with
550+
value: u64,
551+
},
548552
}
549553

550554
impl InstructionTextTokenKind {
@@ -721,6 +725,7 @@ impl InstructionTextTokenKind {
721725
},
722726
}
723727
}
728+
BNInstructionTextTokenType::NewLineToken => Self::NewLine { value: value.value },
724729
}
725730
}
726731

@@ -756,6 +761,7 @@ impl InstructionTextTokenKind {
756761
InstructionTextTokenKind::ExternalSymbol { value, .. } => Some(*value),
757762
InstructionTextTokenKind::StackVariable { variable_id, .. } => Some(*variable_id),
758763
InstructionTextTokenKind::CollapseStateIndicator { hash, .. } => *hash,
764+
InstructionTextTokenKind::NewLine { value, .. } => Some(*value),
759765
_ => None,
760766
}
761767
}
@@ -925,6 +931,7 @@ impl From<InstructionTextTokenKind> for BNInstructionTextTokenType {
925931
InstructionTextTokenKind::CollapseStateIndicator { .. } => {
926932
BNInstructionTextTokenType::CollapseStateIndicatorToken
927933
}
934+
InstructionTextTokenKind::NewLine { .. } => BNInstructionTextTokenType::NewLineToken,
928935
}
929936
}
930937
}

0 commit comments

Comments
 (0)