#[repr(C)]pub enum Error {
Show 22 variants
OK = 0,
NOMEM = 1,
ARCH = 2,
HANDLE = 3,
MODE = 4,
VERSION = 5,
READ_UNMAPPED = 6,
WRITE_UNMAPPED = 7,
ETCH_UNMAPPED = 8,
HOOK = 9,
INSN_INVALID = 10,
MAP = 11,
WRITE_PROT = 12,
READ_PROT = 13,
FETCH_PROT = 14,
ARG = 15,
READ_UNALIGNED = 16,
WRITE_UNALIGNED = 17,
FETCH_UNALIGNED = 18,
HOOK_EXIST = 19,
RESOURCE = 20,
EXCEPTION = 21,
}
Variants§
OK = 0
NOMEM = 1
ARCH = 2
HANDLE = 3
MODE = 4
VERSION = 5
READ_UNMAPPED = 6
WRITE_UNMAPPED = 7
ETCH_UNMAPPED = 8
HOOK = 9
INSN_INVALID = 10
MAP = 11
WRITE_PROT = 12
READ_PROT = 13
FETCH_PROT = 14
ARG = 15
READ_UNALIGNED = 16
WRITE_UNALIGNED = 17
FETCH_UNALIGNED = 18
HOOK_EXIST = 19
RESOURCE = 20
EXCEPTION = 21
Implementations§
Source§impl Error
impl Error
Sourcepub fn msg(self) -> &'static str
pub fn msg(self) -> &'static str
Examples found in repository?
examples/test.rs (line 26)
5fn main() {
6 let (major, minor) = unicorn::unicorn_version();
7 println!("version : {}.{}", major, minor);
8 println!(
9 "Support for:\n\t x86: {}\n\t arm: {}\n\t mips: {}",
10 unicorn::arch_supported(unicorn::Arch::X86),
11 unicorn::arch_supported(unicorn::Arch::ARM),
12 unicorn::arch_supported(unicorn::Arch::MIPS)
13 );
14
15 let emu = CpuARM::new(unicorn::Mode::THUMB).expect("failed to create emulator");
16
17 let page_size = emu
18 .query(unicorn::Query::PAGE_SIZE)
19 .expect("failed to query page size");
20 println!("page size : {}", page_size);
21 let hardware_mode = emu
22 .query(unicorn::Query::MODE)
23 .expect("failed to query hardware mode");
24 println!("hardware mode : {}", hardware_mode);
25
26 println!("Sample error message : {}", unicorn::Error::HOOK.msg());
27
28 emu.mem_map(0x10000, 0x4000, unicorn::Protection::ALL)
29 .expect("failed to map first memory region");
30 emu.mem_map(0x20000, 0x4000, unicorn::Protection::ALL)
31 .expect("failed to map second memory region");
32 let regions = emu
33 .mem_regions()
34 .expect("failed to retrieve memory mappings");
35 println!("Regions : {}", regions.len());
36
37 for region in ®ions {
38 println!("{:?}", region);
39 }
40}
Trait Implementations§
impl Copy for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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