1use crate::prelude::v1::*;
4
5#[repr(C)]
7#[derive(Clone, Debug)]
8#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
9#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
10pub struct ModuleInfo {
11 pub address: Address,
17 pub parent_process: Address,
23 pub base: Address,
30 pub size: umem,
32 pub name: ReprCString,
34 pub path: ReprCString,
36 pub arch: ArchitectureIdent,
45}
46
47pub type ModuleInfoCallback<'a> = OpaqueCallback<'a, ModuleInfo>;
48
49#[repr(C)]
51#[derive(Clone, Debug)]
52#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
53#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
54pub struct ModuleAddressInfo {
55 pub address: Address,
56 pub arch: ArchitectureIdent,
57}
58
59pub type ModuleAddressCallback<'a> = OpaqueCallback<'a, ModuleAddressInfo>;
60
61#[repr(C)]
63#[derive(Clone, Debug)]
64#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
65#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
66pub struct ImportInfo {
67 pub name: ReprCString,
69 pub offset: umem,
71}
72
73pub type ImportCallback<'a> = OpaqueCallback<'a, ImportInfo>;
74
75#[repr(C)]
77#[derive(Clone, Debug)]
78#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
79#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
80pub struct ExportInfo {
81 pub name: ReprCString,
83 pub offset: umem,
85}
86
87pub type ExportCallback<'a> = OpaqueCallback<'a, ExportInfo>;
88
89#[repr(C)]
91#[derive(Clone, Debug)]
92#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
93#[cfg_attr(feature = "abi_stable", derive(::abi_stable::StableAbi))]
94pub struct SectionInfo {
95 pub name: ReprCString,
97 pub base: Address,
99 pub size: umem,
101}
102
103impl SectionInfo {
104 pub fn is_section(&self, name: &str) -> bool {
106 let mut n = self.name.as_ref();
107 if let Some(stripped) = n.strip_prefix('.') {
108 n = stripped;
109 } else if let Some(stripped) = n.strip_prefix("__") {
110 n = stripped;
111 } else {
112 return false;
113 }
114 n == name
115 }
116
117 pub fn is_text(&self) -> bool {
119 self.is_section("text")
120 }
121}
122
123pub type SectionCallback<'a> = OpaqueCallback<'a, SectionInfo>;