Skip to content

Commit 6341003

Browse files
committed
More rust cleanup
- Normalized modules - Split some code out into own files - Fixed some UB in type archive and projects - Improved API around type archives and projects substantially - Added ProgressExecutor abstraction for functions which have a progress callback - Improved background task documentation and added unit tests - Added worker thread api and unit tests - Moved some owned types to ref types, this is still not complete, but this is the path forward. - Add external location/library accessors to the binary view - Added some misc documentation - Replaced mod.rs with the module name source file Still need to normalize some paths and also update some documentation surrounding that change.
1 parent 6405576 commit 6341003

File tree

130 files changed

+2653
-2182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+2653
-2182
lines changed

arch/msp430/src/architecture.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use msp430_asm::{
1919
use binaryninja::architecture::{
2020
BranchKind, FlagClassId, FlagGroupId, FlagId, FlagWriteId, RegisterId,
2121
};
22-
use binaryninja::lowlevelil::expression::ValueExpr;
23-
use binaryninja::lowlevelil::{MutableLiftedILExpr, MutableLiftedILFunction};
22+
use binaryninja::low_level_il::expression::ValueExpr;
23+
use binaryninja::low_level_il::{MutableLiftedILExpr, MutableLiftedILFunction};
2424
use log::error;
2525

2626
const MIN_MNEMONIC: usize = 9;

arch/msp430/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ extern crate msp430_asm;
55
use binaryninja::{
66
add_optional_plugin_dependency,
77
architecture::ArchitectureExt,
8-
callingconvention,
9-
custombinaryview::{BinaryViewType, BinaryViewTypeExt},
8+
calling_convention,
9+
custom_binary_view::{BinaryViewType, BinaryViewTypeExt},
1010
Endianness,
1111
};
1212
use log::LevelFilter;
@@ -36,13 +36,13 @@ pub extern "C" fn CorePluginInit() -> bool {
3636
// https://www.ti.com/lit/an/slaa664/slaa664.pdf?ts=1613210655081. MSPGCC
3737
// appears to be a legacy calling convention while EABI is the newer
3838
// standardized one that is compatible with TI's compiler
39-
let default = callingconvention::ConventionBuilder::new(arch)
39+
let default = calling_convention::ConventionBuilder::new(arch)
4040
.is_eligible_for_heuristics(true)
4141
.int_arg_registers(&["r15", "r14", "r13", "r12"])
4242
.return_int_reg("r15")
4343
.return_hi_int_reg("r14")
4444
.register("default");
45-
callingconvention::ConventionBuilder::new(arch)
45+
calling_convention::ConventionBuilder::new(arch)
4646
.is_eligible_for_heuristics(true)
4747
.return_int_reg("r15")
4848
.return_hi_int_reg("r14")

arch/msp430/src/lift.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::flag::{Flag, FlagWrite};
33
use crate::register::Register;
44
use crate::Msp430;
55

6-
use binaryninja::{architecture::FlagCondition, lowlevelil::lifting::Label};
6+
use binaryninja::{architecture::FlagCondition, low_level_il::lifting::Label};
77

88
use msp430_asm::emulate::Emulated;
99
use msp430_asm::instruction::Instruction;
@@ -12,8 +12,8 @@ use msp430_asm::operand::{Operand, OperandWidth};
1212
use msp430_asm::single_operand::SingleOperand;
1313
use msp430_asm::two_operand::TwoOperand;
1414

15-
use binaryninja::lowlevelil::expression::ValueExpr;
16-
use binaryninja::lowlevelil::{MutableLiftedILExpr, MutableLiftedILFunction};
15+
use binaryninja::low_level_il::expression::ValueExpr;
16+
use binaryninja::low_level_il::{MutableLiftedILExpr, MutableLiftedILFunction};
1717
use log::info;
1818

1919
macro_rules! auto_increment {

arch/msp430/src/register.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use binaryninja::architecture;
22
use binaryninja::architecture::{ImplicitRegisterExtend, RegisterId};
33

4-
use binaryninja::lowlevelil::LowLevelILRegister;
4+
use binaryninja::low_level_il::LowLevelILRegister;
55
use std::borrow::Cow;
66

77
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]

arch/riscv/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ use binaryninja::{
1414
LlvmServicesRelocMode, Register as Reg, RegisterInfo, UnusedFlag, UnusedRegisterStack,
1515
UnusedRegisterStackInfo,
1616
},
17-
binaryview::{BinaryView, BinaryViewExt},
18-
callingconvention::{register_calling_convention, CallingConventionBase, ConventionBuilder},
19-
custombinaryview::{BinaryViewType, BinaryViewTypeExt},
17+
binary_view::{BinaryView, BinaryViewExt},
18+
calling_convention::{register_calling_convention, CallingConventionBase, ConventionBuilder},
19+
custom_binary_view::{BinaryViewType, BinaryViewTypeExt},
2020
disassembly::{InstructionTextToken, InstructionTextTokenKind},
2121
function::Function,
22-
functionrecognizer::FunctionRecognizer,
22+
function_recognizer::FunctionRecognizer,
2323
rc::Ref,
2424
relocation::{
2525
CoreRelocationHandler, CustomRelocationHandlerHandle, RelocationHandler, RelocationInfo,
@@ -37,10 +37,10 @@ use std::marker::PhantomData;
3737
use binaryninja::architecture::{BranchKind, IntrinsicId, RegisterId};
3838
use binaryninja::confidence::{Conf, MAX_CONFIDENCE, MIN_CONFIDENCE};
3939
use binaryninja::logger::Logger;
40-
use binaryninja::lowlevelil::expression::{LowLevelILExpressionKind, ValueExpr};
41-
use binaryninja::lowlevelil::instruction::LowLevelILInstructionKind;
42-
use binaryninja::lowlevelil::lifting::{Label, LiftableLowLevelIL, LiftableLowLevelILWithSize};
43-
use binaryninja::lowlevelil::{
40+
use binaryninja::low_level_il::expression::{LowLevelILExpressionKind, ValueExpr};
41+
use binaryninja::low_level_il::instruction::LowLevelILInstructionKind;
42+
use binaryninja::low_level_il::lifting::{Label, LiftableLowLevelIL, LiftableLowLevelILWithSize};
43+
use binaryninja::low_level_il::{
4444
expression::ExpressionHandler, instruction::InstructionHandler, LowLevelILRegister,
4545
MutableLiftedILExpr, MutableLiftedILFunction, RegularLowLevelILFunction,
4646
};

plugins/dwarf/dwarf_export/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::fs;
1212

1313
use binaryninja::logger::Logger;
1414
use binaryninja::{
15-
binaryview::{BinaryView, BinaryViewBase, BinaryViewExt},
15+
binary_view::{BinaryView, BinaryViewBase, BinaryViewExt},
1616
command::{register, Command},
1717
confidence::Conf,
1818
interaction,

plugins/dwarf/dwarf_import/src/dwarfdebuginfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ use crate::{
1818
};
1919

2020
use binaryninja::{
21-
binaryview::{BinaryView, BinaryViewBase, BinaryViewExt},
21+
binary_view::{BinaryView, BinaryViewBase, BinaryViewExt},
2222
debuginfo::{DebugFunctionInfo, DebugInfo},
2323
platform::Platform,
2424
rc::*,
2525
symbol::SymbolType,
26-
templatesimplifier::simplify_str_to_fqn,
26+
template_simplifier::simplify_str_to_fqn,
2727
types::{FunctionParameter, Type},
2828
variable::NamedVariableWithType,
2929
};

plugins/dwarf/dwarf_import/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::dwarfdebuginfo::{DebugInfoBuilder, DebugInfoBuilderContext, TypeUID};
1818
use crate::types::get_type;
1919
use crate::{helpers::*, ReaderType};
2020

21-
use binaryninja::templatesimplifier::simplify_str_to_str;
21+
use binaryninja::template_simplifier::simplify_str_to_str;
2222
use cpp_demangle::DemangleOptions;
2323
use gimli::{constants, AttributeValue, DebuggingInformationEntry, Dwarf, Operation, Unit};
2424
use log::{debug, error};

plugins/dwarf/dwarf_import/src/helpers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use std::path::{Path, PathBuf};
1717
use std::{collections::HashMap, ops::Deref, str::FromStr, sync::mpsc};
1818

1919
use crate::{DebugInfoBuilderContext, ReaderType};
20-
use binaryninja::binaryview::BinaryViewBase;
21-
use binaryninja::filemetadata::FileMetadata;
20+
use binaryninja::binary_view::BinaryViewBase;
21+
use binaryninja::file_metadata::FileMetadata;
2222
use binaryninja::Endianness;
2323
use binaryninja::{
24-
binaryview::{BinaryView, BinaryViewExt},
25-
downloadprovider::{DownloadInstanceInputOutputCallbacks, DownloadProvider},
24+
binary_view::{BinaryView, BinaryViewExt},
25+
download_provider::{DownloadInstanceInputOutputCallbacks, DownloadProvider},
2626
rc::Ref,
2727
settings::Settings,
2828
};

plugins/dwarf/dwarf_import/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ use crate::functions::parse_function_entry;
2525
use crate::helpers::{get_attr_die, get_name, get_uid, DieReference};
2626
use crate::types::parse_variable;
2727

28-
use binaryninja::binaryview::BinaryViewBase;
28+
use binaryninja::binary_view::BinaryViewBase;
2929
use binaryninja::{
30-
binaryview::{BinaryView, BinaryViewExt},
30+
binary_view::{BinaryView, BinaryViewExt},
3131
debuginfo::{CustomDebugInfoParser, DebugInfo, DebugInfoParser},
3232
settings::Settings,
33-
templatesimplifier::simplify_str_to_str,
33+
template_simplifier::simplify_str_to_str,
3434
};
3535
use dwarfreader::{
3636
create_section_reader, get_endian, is_dwo_dwarf, is_non_dwo_dwarf, is_raw_dwo_dwarf,

0 commit comments

Comments
 (0)