diff options
| author | Mason Reed <mason@vector35.com> | 2026-04-21 18:10:51 -0700 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-05-10 17:13:08 -0700 |
| commit | c4ba6d79ae3b96d56cc6b3744e7c64e004ecd161 (patch) | |
| tree | 5762fc3ff58b57caec5f42176faf6635c464b4f3 /arch | |
| parent | 8269a8ac29e59c7949af753dac5c1f36bb700903 (diff) | |
[Rust] Refactor `binary_view` module
- Remove the "viral" `BinaryViewExt` trait and its blanket impl
- Split up the binary view type from the custom trait impl
- Simplify and fix bugs regarding custom binary view initialization
- Rewrite Minidump binary view example, parses the PE headers to create proper sections now
- Add some extra documentation
- Add unit test for custom binary view
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/msp430/src/lib.rs | 9 | ||||
| -rw-r--r-- | arch/riscv/src/lib.rs | 5 |
2 files changed, 5 insertions, 9 deletions
diff --git a/arch/msp430/src/lib.rs b/arch/msp430/src/lib.rs index 892e617d..0655cc85 100644 --- a/arch/msp430/src/lib.rs +++ b/arch/msp430/src/lib.rs @@ -1,9 +1,6 @@ use binaryninja::{ - add_optional_plugin_dependency, - architecture::ArchitectureExt, - calling_convention, - custom_binary_view::{BinaryViewType, BinaryViewTypeExt}, - Endianness, + add_optional_plugin_dependency, architecture::ArchitectureExt, binary_view::BinaryViewType, + calling_convention, Endianness, }; mod architecture; @@ -45,7 +42,7 @@ pub extern "C" fn CorePluginInit() -> bool { arch.set_default_calling_convention(&default); - if let Ok(bvt) = BinaryViewType::by_name("ELF") { + if let Some(bvt) = BinaryViewType::by_name("ELF") { bvt.register_arch(105, Endianness::LittleEndian, arch); } diff --git a/arch/riscv/src/lib.rs b/arch/riscv/src/lib.rs index 2bc0427c..3537a082 100644 --- a/arch/riscv/src/lib.rs +++ b/arch/riscv/src/lib.rs @@ -13,9 +13,8 @@ use binaryninja::{ ImplicitRegisterExtend, InstructionInfo, Register as Reg, RegisterInfo, UnusedFlag, UnusedRegisterStack, }, - binary_view::{BinaryView, BinaryViewExt}, + binary_view::{BinaryView, BinaryViewType}, calling_convention::{register_calling_convention, CallingConvention, ConventionBuilder}, - custom_binary_view::{BinaryViewType, BinaryViewTypeExt}, disassembly::{InstructionTextToken, InstructionTextTokenKind}, function::Function, function_recognizer::FunctionRecognizer, @@ -3101,7 +3100,7 @@ pub extern "C" fn CorePluginInit() -> bool { ); arch64.set_default_calling_convention(&cc64); - if let Ok(bvt) = BinaryViewType::by_name("ELF") { + if let Some(bvt) = BinaryViewType::by_name("ELF") { bvt.register_arch( (1 << 16) | 243, binaryninja::Endianness::LittleEndian, |
