pub struct Region {
pub base: Address,
pub size: usize,
pub protection: Protection,
pub kind: RegionKind,
pub path: Option<PathBuf>,
}Expand description
A contiguous range of committed memory with uniform protection.
Reflected as an opaque type because its path field is Option<PathBuf>, which
does not implement Facet. Access base, size, protection and kind directly.
Fields§
§base: Address§size: usize§protection: Protection§kind: RegionKind§path: Option<PathBuf>The backing file, when known.
Implementations§
Source§impl Region
impl Region
Sourcepub fn end(&self) -> Address
pub fn end(&self) -> Address
Examples found in repository?
examples/regions.rs (line 19)
7fn main() -> procodile::Result<()> {
8 let handle = match std::env::args().nth(1) {
9 Some(pid) => ProcessHandle::open(pid.parse().expect("pid"), Access::Read)?,
10 None => ProcessHandle::open_current()?,
11 };
12
13 let regions = handle.regions()?;
14 for r in ®ions {
15 let path = r.path.as_deref().map(|p| p.display().to_string());
16 println!(
17 "[{:?}-{:?}) {:<5} {:<8?} {}",
18 r.base,
19 r.end(),
20 r.protection,
21 r.kind,
22 path.unwrap_or_default()
23 );
24 }
25 let total: usize = regions.iter().map(|r| r.size).sum();
26 println!("{} regions, {total:#x} bytes\n", regions.len());
27
28 for m in handle.modules()? {
29 println!("{:?} {:>#10x} {}", m.base, m.size, m.path.display());
30 }
31 Ok(())
32}pub fn range(&self) -> Range<Address> ⓘ
pub fn contains(&self, address: Address) -> bool
Trait Implementations§
impl Eq for Region
impl StructuralPartialEq for Region
Auto Trait Implementations§
impl Forget for Region
impl Freeze for Region
impl Move for Region
impl RefUnwindSafe for Region
impl Send for Regionwhere
RawVecInner: Send,
impl Sync for Regionwhere
RawVecInner: Sync,
impl Unpin for Region
impl UnsafeUnpin for Region
impl UnwindSafe for Regionwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more