diff options
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/architecture.rs | 3 | ||||
| -rw-r--r-- | rust/src/low_level_il/expression.rs | 10 | ||||
| -rw-r--r-- | rust/src/low_level_il/function.rs | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs index 3573f1fb..7ad10dfb 100644 --- a/rust/src/architecture.rs +++ b/rust/src/architecture.rs @@ -418,7 +418,7 @@ pub trait Intrinsic: Debug + Sized + Clone + Copy { fn outputs(&self) -> Vec<Conf<Ref<Type>>>; } -pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> { +pub trait Architecture: 'static + Sized + AsRef<CoreArchitecture> + Debug { type Handle: Borrow<Self> + Clone; type RegisterInfo: RegisterInfo<RegType = Self::Register>; @@ -3234,6 +3234,7 @@ where } } +#[derive(Debug)] pub struct CustomArchitectureHandle<A> where A: 'static + Architecture<Handle = CustomArchitectureHandle<A>> + Send + Sync, diff --git a/rust/src/low_level_il/expression.rs b/rust/src/low_level_il/expression.rs index fd403c76..f8fcf9f7 100644 --- a/rust/src/low_level_il/expression.rs +++ b/rust/src/low_level_il/expression.rs @@ -21,7 +21,7 @@ use super::VisitorAction; use super::*; use crate::architecture::Architecture; use std::fmt; -use std::fmt::{Display, Formatter}; +use std::fmt::{Debug, Display, Formatter}; use std::marker::PhantomData; /// Used as a marker for an [`LowLevelILExpression`] that **can** produce a value. @@ -32,7 +32,7 @@ pub struct ValueExpr; #[derive(Copy, Clone, Debug)] pub struct VoidExpr; -pub trait ExpressionResultType: 'static {} +pub trait ExpressionResultType: 'static + Debug {} impl ExpressionResultType for ValueExpr {} impl ExpressionResultType for VoidExpr {} @@ -102,9 +102,9 @@ where R: ExpressionResultType, { fn fmt(&self, f: &mut Formatter) -> fmt::Result { - f.debug_struct("Expression") - .field("index", &self.index) - .finish() + let op = unsafe { BNGetLowLevelILByIndex(self.function.handle, self.index.0) }; + let t = unsafe { LowLevelILExpressionKind::from_raw(self.function, op) }; + t.fmt(f) } } diff --git a/rust/src/low_level_il/function.rs b/rust/src/low_level_il/function.rs index 85037632..301c3f09 100644 --- a/rust/src/low_level_il/function.rs +++ b/rust/src/low_level_il/function.rs @@ -35,7 +35,7 @@ pub struct Mutable; #[derive(Copy, Clone, Debug)] pub struct Finalized; -pub trait FunctionMutability: 'static {} +pub trait FunctionMutability: 'static + Debug {} impl FunctionMutability for Mutable {} impl FunctionMutability for Finalized {} @@ -44,7 +44,7 @@ pub struct LiftedNonSSA; #[derive(Copy, Clone, Debug)] pub struct RegularNonSSA; -pub trait NonSSAVariant: 'static {} +pub trait NonSSAVariant: 'static + Debug {} impl NonSSAVariant for LiftedNonSSA {} impl NonSSAVariant for RegularNonSSA {} @@ -53,7 +53,7 @@ pub struct SSA; #[derive(Copy, Clone, Debug)] pub struct NonSSA<V: NonSSAVariant>(V); -pub trait FunctionForm: 'static {} +pub trait FunctionForm: 'static + Debug {} impl FunctionForm for SSA {} impl<V: NonSSAVariant> FunctionForm for NonSSA<V> {} |
