Skip to content

Commit 6294a11

Browse files
committed
Add elf pointer_size
1 parent 3a770a4 commit 6294a11

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/file_format/elf.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,13 @@ pub fn is_64_bit(process: &Process, module_address: Address) -> Option<bool> {
10051005
}
10061006
}
10071007

1008+
/// Checks if a given ELF module is 64-bit or 32-bit
1009+
pub fn pointer_size(process: &Process, module_address: Address) -> Option<PointerSize> {
1010+
let header = process.read::<Header>(module_address).ok()?;
1011+
let info = Info::parse(bytemuck::bytes_of(&header))?;
1012+
info.bitness.pointer_size()
1013+
}
1014+
10081015
#[derive(Debug, Copy, Clone, Pod, Zeroable)]
10091016
#[repr(C)]
10101017
struct ProgramHeader32 {

0 commit comments

Comments
 (0)