summaryrefslogtreecommitdiff
path: root/arch/msp430/src
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-12-17 21:23:46 -0500
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-01-11 10:36:01 -0800
commit168a3fd34824adc9c6a606cd144219701f15cccf (patch)
tree9bbac31ece5ea6ab6627998d995a77f7f7e2f8e6 /arch/msp430/src
parentca91bc1933976c62d24248f0f7c35af38451ff11 (diff)
[Rust] Replace `log` with `tracing`
- Added more documentation - Replaced global named logger for plugins, fixing the issue when the CU has multiple (e.g. statically linked demo) - Simplified some misc code This is a breaking change, but I believe there is no better time to make it, we cannot continue to use the `log` crate, it is too limited for our needs.
Diffstat (limited to 'arch/msp430/src')
-rw-r--r--arch/msp430/src/architecture.rs7
-rw-r--r--arch/msp430/src/lib.rs9
-rw-r--r--arch/msp430/src/lift.rs5
3 files changed, 7 insertions, 14 deletions
diff --git a/arch/msp430/src/architecture.rs b/arch/msp430/src/architecture.rs
index ef4c503a..996d3c4a 100644
--- a/arch/msp430/src/architecture.rs
+++ b/arch/msp430/src/architecture.rs
@@ -8,7 +8,7 @@ use binaryninja::{
UnusedIntrinsic, UnusedRegisterStack,
},
disassembly::{InstructionTextToken, InstructionTextTokenKind},
- Endianness,
+ tracing, Endianness,
};
use msp430_asm::{
@@ -21,7 +21,6 @@ use binaryninja::architecture::{
};
use binaryninja::low_level_il::expression::ValueExpr;
use binaryninja::low_level_il::{LowLevelILMutableExpression, LowLevelILMutableFunction};
-use log::error;
const MIN_MNEMONIC: usize = 9;
@@ -321,7 +320,7 @@ impl Architecture for Msp430 {
match id.try_into() {
Ok(flag) => Some(flag),
Err(_) => {
- error!("invalid flag id {}", id);
+ tracing::error!("invalid flag id {}", id);
None
}
}
@@ -331,7 +330,7 @@ impl Architecture for Msp430 {
match id.try_into() {
Ok(flag_write) => Some(flag_write),
Err(_) => {
- error!("invalid flag write id {}", id);
+ tracing::error!("invalid flag write id {}", id);
None
}
}
diff --git a/arch/msp430/src/lib.rs b/arch/msp430/src/lib.rs
index b5465554..892e617d 100644
--- a/arch/msp430/src/lib.rs
+++ b/arch/msp430/src/lib.rs
@@ -1,7 +1,3 @@
-extern crate binaryninja;
-extern crate log;
-extern crate msp430_asm;
-
use binaryninja::{
add_optional_plugin_dependency,
architecture::ArchitectureExt,
@@ -9,7 +5,6 @@ use binaryninja::{
custom_binary_view::{BinaryViewType, BinaryViewTypeExt},
Endianness,
};
-use log::LevelFilter;
mod architecture;
mod flag;
@@ -17,12 +12,12 @@ mod lift;
mod register;
use architecture::Msp430;
-use binaryninja::logger::Logger;
#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn CorePluginInit() -> bool {
- Logger::new("MSP430").with_level(LevelFilter::Info).init();
+ binaryninja::tracing_init!("MSP430");
+
let arch =
binaryninja::architecture::register_architecture("msp430", |custom_handle, handle| {
Msp430::new(handle, custom_handle)
diff --git a/arch/msp430/src/lift.rs b/arch/msp430/src/lift.rs
index 3e69b5a4..480b150b 100644
--- a/arch/msp430/src/lift.rs
+++ b/arch/msp430/src/lift.rs
@@ -2,7 +2,7 @@ use crate::architecture::offset_to_absolute;
use crate::flag::{Flag, FlagWrite};
use crate::register::Register;
-use binaryninja::{architecture::FlagCondition, low_level_il::lifting::LowLevelILLabel};
+use binaryninja::{architecture::FlagCondition, low_level_il::lifting::LowLevelILLabel, tracing};
use msp430_asm::emulate::Emulated;
use msp430_asm::instruction::Instruction;
@@ -13,7 +13,6 @@ use msp430_asm::two_operand::TwoOperand;
use binaryninja::low_level_il::expression::ValueExpr;
use binaryninja::low_level_il::{LowLevelILMutableExpression, LowLevelILMutableFunction};
-use log::info;
macro_rules! auto_increment {
($src:expr, $il:ident) => {
@@ -550,7 +549,7 @@ pub(crate) fn lift_instruction(inst: &Instruction, addr: u64, il: &LowLevelILMut
il.set_reg(size, Register::try_from(*r as u32).unwrap(), il.pop(2))
.append();
} else {
- info!("pop: invalid destination operand");
+ tracing::info!("pop: invalid destination operand");
}
}
Instruction::Ret(_) => {