MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / new_expr

Method new_expr

rust/src/medium_level_il/instruction.rs:65–624  ·  view source on GitHub ↗

TODO: I need MediumLevelILExpression YESTERDAY!!!!

(
        function: Ref<MediumLevelILFunction>,
        expr_index: MediumLevelInstructionIndex,
    )

Source from the content-addressed store, hash-verified

63
64 // TODO: I need MediumLevelILExpression YESTERDAY!!!!
65 pub(crate) fn new_expr(
66 function: Ref<MediumLevelILFunction>,
67 expr_index: MediumLevelInstructionIndex,
68 ) -> Self {
69 // TODO: If op.sourceOperation == BN_INVALID_OPERAND && op.operation == MLIL_NOP return None
70 let op = unsafe { BNGetMediumLevelILByIndex(function.handle, expr_index.0) };
71 use BNMediumLevelILOperation::*;
72 use MediumLevelILInstructionKind as Op;
73 let kind = match op.operation {
74 MLIL_NOP => Op::Nop,
75 MLIL_NORET => Op::Noret,
76 MLIL_BP => Op::Bp,
77 MLIL_UNDEF => Op::Undef,
78 MLIL_ASSERT | MLIL_ASSERT_SSA | MLIL_FORCE_VER | MLIL_FORCE_VER_SSA => Op::Undef,
79 MLIL_UNIMPL => Op::Unimpl,
80 MLIL_IF => Op::If(MediumLevelILOperationIf {
81 condition: op.operands[0] as usize,
82 dest_true: MediumLevelInstructionIndex(op.operands[1] as usize),
83 dest_false: MediumLevelInstructionIndex(op.operands[2] as usize),
84 }),
85 MLIL_FLOAT_CONST => Op::FloatConst(FloatConst {
86 constant: get_float(op.operands[0], op.size),
87 }),
88 MLIL_CONST => Op::Const(Constant {
89 constant: op.operands[0],
90 }),
91 MLIL_CONST_PTR => Op::ConstPtr(Constant {
92 constant: op.operands[0],
93 }),
94 MLIL_IMPORT => Op::Import(Constant {
95 constant: op.operands[0],
96 }),
97 MLIL_EXTERN_PTR => Op::ExternPtr(ExternPtr {
98 constant: op.operands[0],
99 offset: op.operands[1],
100 }),
101 MLIL_CONST_DATA => Op::ConstData(ConstData {
102 constant_data_kind: op.operands[0] as u32,
103 constant_data_value: op.operands[1] as i64,
104 size: op.size,
105 }),
106 MLIL_JUMP => Op::Jump(Jump {
107 dest: op.operands[0] as usize,
108 }),
109 MLIL_RET_HINT => Op::RetHint(Jump {
110 dest: op.operands[0] as usize,
111 }),
112 MLIL_STORE_SSA => Op::StoreSsa(StoreSsa {
113 dest: op.operands[0] as usize,
114 dest_memory: op.operands[1],
115 src_memory: op.operands[2],
116 src: op.operands[3] as usize,
117 }),
118 MLIL_STORE_STRUCT_SSA => Op::StoreStructSsa(StoreStructSsa {
119 dest: op.operands[0] as usize,
120 offset: op.operands[1],
121 dest_memory: op.operands[2],
122 src_memory: op.operands[3],

Callers

nothing calls this directly

Calls 15

StoreSsaClass · 0.85
StoreStructSsaClass · 0.85
StoreStructClass · 0.85
FreeVarSlotClass · 0.85
SetVarFieldClass · 0.85
FreeVarSlotSsaClass · 0.85
SetVarSsaFieldClass · 0.85
SetVarAliasedClass · 0.85
SetVarSsaClass · 0.85
VarSplitClass · 0.85
SetVarSplitClass · 0.85

Tested by

no test coverage detected