From c3f344a38ca4b027b4e69b0f82d3184622d6da79 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 29 Apr 2025 16:05:54 -0400 Subject: [Rust] Pretty print LLIL sub expressions --- rust/src/low_level_il/expression.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rust/src/low_level_il/expression.rs') 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) } } -- cgit v1.3.1