Skip to content

Commit

Permalink
PageProtection - Added Display implementation (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xoffio authored Nov 6, 2024
1 parent 42d7f87 commit 9153a2b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frida-gum/src/range_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use {
crate::MemoryRange,
core::{
ffi::{c_void, CStr},
fmt,
marker::PhantomData,
},
frida_gum_sys as gum_sys,
Expand All @@ -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> {
Expand Down

0 comments on commit 9153a2b

Please sign in to comment.