use crate::prelude::v1::*;
#[repr(C)]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
pub struct ModuleInfo {
pub address: Address,
pub parent_process: Address,
pub base: Address,
pub size: umem,
pub name: ReprCString,
pub path: ReprCString,
pub arch: ArchitectureIdent,
}
pub type ModuleInfoCallback<'a> = OpaqueCallback<'a, ModuleInfo>;
#[repr(C)]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
pub struct ModuleAddressInfo {
pub address: Address,
pub arch: ArchitectureIdent,
}
pub type ModuleAddressCallback<'a> = OpaqueCallback<'a, ModuleAddressInfo>;
#[repr(C)]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
pub struct ImportInfo {
pub name: ReprCString,
pub offset: umem,
}
pub type ImportCallback<'a> = OpaqueCallback<'a, ImportInfo>;
#[repr(C)]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
pub struct ExportInfo {
pub name: ReprCString,
pub offset: umem,
}
pub type ExportCallback<'a> = OpaqueCallback<'a, ExportInfo>;
#[repr(C)]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
pub struct SectionInfo {
pub name: ReprCString,
pub base: Address,
pub size: umem,
}
impl SectionInfo {
pub fn is_section(&self, name: &str) -> bool {
let mut n = self.name.as_ref();
if let Some(stripped) = n.strip_prefix('.') {
n = stripped;
} else if let Some(stripped) = n.strip_prefix("__") {
n = stripped;
} else {
return false;
}
n == name
}
pub fn is_text(&self) -> bool {
self.is_section("text")
}
}
pub type SectionCallback<'a> = OpaqueCallback<'a, SectionInfo>;