Skip to content

Commit cb81564

Browse files
committed
2 parents cd28c25 + 331d226 commit cb81564

File tree

15 files changed

+3287
-43
lines changed

15 files changed

+3287
-43
lines changed

basicblock.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ void DisassemblySettings::SetAddressBaseOffset(uint64_t addressBaseOffset)
113113
BNSetDisassemblyAddressBaseOffset(m_object, addressBaseOffset);
114114
}
115115

116+
BNDisassemblyCallParameterHints DisassemblySettings::GetCallParameterHints() const
117+
{
118+
return BNGetDisassemblyCallParameterHints(m_object);
119+
}
120+
121+
122+
void DisassemblySettings::SetCallParameterHints(BNDisassemblyCallParameterHints hints)
123+
{
124+
BNSetDisassemblyCallParameterHints(m_object, hints);
125+
}
126+
116127

117128
DisassemblyTextLine::DisassemblyTextLine()
118129
{

binaryninjaapi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9824,6 +9824,8 @@ namespace BinaryNinja {
98249824
void SetAddressMode(BNDisassemblyAddressMode mode);
98259825
uint64_t GetAddressBaseOffset() const;
98269826
void SetAddressBaseOffset(uint64_t addressBaseOffset);
9827+
BNDisassemblyCallParameterHints GetCallParameterHints() const;
9828+
void SetCallParameterHints(BNDisassemblyCallParameterHints hints);
98279829
};
98289830

98299831
/*!

binaryninjacore.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ extern "C"
697697
ExpandLongOpcode = 2,
698698
ShowVariablesAtTopOfGraph = 3,
699699
ShowVariableTypesWhenAssigned = 4,
700-
ShowCallParameterNames = 6,
701700
ShowRegisterHighlight = 7,
702701
ShowFunctionAddress = 8,
703702
ShowFunctionHeader = 9,
@@ -731,6 +730,13 @@ extern "C"
731730
DisassemblyAddressModeFlagsMask = 0xFFFF0000,
732731
} BNDisassemblyAddressMode;
733732

733+
typedef enum BNDisassemblyCallParameterHints
734+
{
735+
NeverShowMatchingParameterHints,
736+
AlwaysShowParameterHints,
737+
NeverShowParameterHints,
738+
} BNDisassemblyCallParameterHints;
739+
734740
typedef enum BNTypeClass
735741
{
736742
VoidTypeClass = 0,
@@ -5134,6 +5140,8 @@ extern "C"
51345140
BINARYNINJACOREAPI void BNSetDisassemblyAddressMode(BNDisassemblySettings* settings, BNDisassemblyAddressMode mode);
51355141
BINARYNINJACOREAPI uint64_t BNGetDisassemblyAddressBaseOffset(BNDisassemblySettings* settings);
51365142
BINARYNINJACOREAPI void BNSetDisassemblyAddressBaseOffset(BNDisassemblySettings* settings, uint64_t addressBaseOffset);
5143+
BINARYNINJACOREAPI BNDisassemblyCallParameterHints BNGetDisassemblyCallParameterHints(BNDisassemblySettings* settings);
5144+
BINARYNINJACOREAPI void BNSetDisassemblyCallParameterHints(BNDisassemblySettings* settings, BNDisassemblyCallParameterHints hints);
51375145

51385146
// Flow graphs
51395147
BINARYNINJACOREAPI BNFlowGraph* BNCreateFlowGraph(void);

python/binaryview.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8780,7 +8780,6 @@ def find_all_text(
87808780
settings.set_option(DisassemblyOption.ShowAddress, False)
87818781
settings.set_option(DisassemblyOption.ShowOpcode, False)
87828782
settings.set_option(DisassemblyOption.ShowVariableTypesWhenAssigned, True)
8783-
settings.set_option(DisassemblyOption.ShowCallParameterNames, True)
87848783
settings.set_option(DisassemblyOption.WaitForIL, True)
87858784
if not isinstance(settings, _function.DisassemblySettings):
87868785
raise TypeError("settings parameter is not DisassemblySettings type")
@@ -8870,7 +8869,6 @@ def find_all_constant(
88708869
settings.set_option(DisassemblyOption.ShowAddress, False)
88718870
settings.set_option(DisassemblyOption.ShowOpcode, False)
88728871
settings.set_option(DisassemblyOption.ShowVariableTypesWhenAssigned, True)
8873-
settings.set_option(DisassemblyOption.ShowCallParameterNames, True)
88748872
settings.set_option(DisassemblyOption.WaitForIL, True)
88758873
if not isinstance(settings, _function.DisassemblySettings):
88768874
raise TypeError("settings parameter is not DisassemblySettings type")

rust/src/architecture.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,21 @@ impl Register for CoreRegister {
715715
}
716716
}
717717

718+
impl CoreArrayProvider for CoreRegister {
719+
type Raw = u32;
720+
type Context = CoreArchitecture;
721+
type Wrapped<'a> = Self;
722+
}
723+
724+
unsafe impl CoreArrayProviderInner for CoreRegister {
725+
unsafe fn free(raw: *mut Self::Raw, _count: usize, _context: &Self::Context) {
726+
BNFreeRegisterList(raw)
727+
}
728+
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, context: &'a Self::Context) -> Self::Wrapped<'a> {
729+
Self(context.0, *raw)
730+
}
731+
}
732+
718733
pub struct CoreRegisterStackInfo(*mut BNArchitecture, BNRegisterStackInfo);
719734

720735
impl RegisterStackInfo for CoreRegisterStackInfo {
@@ -2419,7 +2434,10 @@ where
24192434
};
24202435

24212436
let inputs = intrinsic.inputs();
2422-
let mut res: Box<[_]> = inputs.into_iter().map(|input| unsafe { Ref::into_raw(input) }.0).collect();
2437+
let mut res: Box<[_]> = inputs
2438+
.into_iter()
2439+
.map(|input| unsafe { Ref::into_raw(input) }.0)
2440+
.collect();
24232441

24242442
unsafe {
24252443
*count = res.len();

rust/src/disassembly.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,35 @@ impl Drop for InstructionTextToken {
265265
}
266266
}
267267

268+
impl CoreArrayProvider for InstructionTextToken {
269+
type Raw = BNInstructionTextToken;
270+
type Context = ();
271+
type Wrapped<'a> = Self;
272+
}
273+
unsafe impl CoreArrayProviderInner for InstructionTextToken {
274+
unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
275+
BNFreeInstructionText(raw, count)
276+
}
277+
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
278+
Self(*raw)
279+
}
280+
}
281+
282+
impl CoreArrayProvider for Array<InstructionTextToken> {
283+
type Raw = BNInstructionTextLine;
284+
type Context = ();
285+
type Wrapped<'a> = Self;
286+
}
287+
unsafe impl CoreArrayProviderInner for Array<InstructionTextToken> {
288+
unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
289+
BNFreeInstructionTextLines(raw, count)
290+
}
291+
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
292+
Self::new(raw.tokens, raw.count, ())
293+
}
294+
}
295+
296+
#[repr(transparent)]
268297
pub struct DisassemblyTextLine(pub(crate) BNDisassemblyTextLine);
269298

270299
impl DisassemblyTextLine {
@@ -422,6 +451,21 @@ impl Drop for DisassemblyTextLine {
422451
}
423452
}
424453

454+
impl CoreArrayProvider for DisassemblyTextLine {
455+
type Raw = BNDisassemblyTextLine;
456+
type Context = ();
457+
type Wrapped<'a> = &'a Self;
458+
}
459+
460+
unsafe impl CoreArrayProviderInner for DisassemblyTextLine {
461+
unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) {
462+
BNFreeDisassemblyTextLines(raw, count)
463+
}
464+
unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
465+
core::mem::transmute(raw)
466+
}
467+
}
468+
425469
pub type DisassemblyOption = BNDisassemblyOption;
426470

427471
#[derive(PartialEq, Eq, Hash)]

0 commit comments

Comments
 (0)