diff --git a/frida-gum/src/range_details.rs b/frida-gum/src/range_details.rs index d8a3277..6b19bc8 100644 --- a/frida-gum/src/range_details.rs +++ b/frida-gum/src/range_details.rs @@ -15,6 +15,7 @@ use { crate::MemoryRange, core::{ ffi::{c_void, CStr}, + fmt, marker::PhantomData, }, frida_gum_sys as gum_sys, @@ -40,6 +41,20 @@ pub enum PageProtection { | gum_sys::_GumPageProtection_GUM_PAGE_EXECUTE as u32, } +impl fmt::Display for PageProtection { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + PageProtection::NoAccess => write!(fmt, "---"), + PageProtection::Read => write!(fmt, "r--"), + PageProtection::Write => write!(fmt, "-w-"), + PageProtection::Execute => write!(fmt, "--e"), + PageProtection::ReadWrite => write!(fmt, "rw-"), + PageProtection::ReadExecute => write!(fmt, "r-e"), + PageProtection::ReadWriteExecute => write!(fmt, "rwe"), + } + } +} + /// The file association to a page. #[derive(Clone)] pub struct FileMapping<'a> {