diff --git a/Cargo.lock b/Cargo.lock index 808136c6..2b302269 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,23 +51,24 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bindgen" -version = "0.62.0" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6720a8b7b2d39dd533285ed438d458f65b31b5c257e6ac7bb3d7e82844dd722" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "cexpr", "clang-sys", + "itertools", "lazy_static", "lazycell", "log", - "peeking_take_while", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 1.0.109", + "syn", "which", ] @@ -505,12 +506,6 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "plotters" version = "0.3.5" @@ -539,6 +534,16 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "prettyplease" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.80" @@ -667,7 +672,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn", ] [[package]] @@ -700,17 +705,6 @@ dependencies = [ "thread_local", ] -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.58" @@ -809,7 +803,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn", "wasm-bindgen-shared", ] @@ -831,7 +825,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/capstone-sys/Cargo.toml b/capstone-sys/Cargo.toml index e0a76cf4..e31c03d8 100644 --- a/capstone-sys/Cargo.toml +++ b/capstone-sys/Cargo.toml @@ -27,8 +27,8 @@ travis-ci = { repository = "capstone-rust/capstone-sys" } libc = { version = "0.2.59", default-features = false } [build-dependencies] -bindgen = { optional = true, version = "0.62.0" } -regex = { optional = true, version = "1.3.1" } +bindgen = { optional = true, version = "0.69.0" } +regex = { optional = true, version = "1.10.4" } cc = "1.0" [features] diff --git a/capstone-sys/pre_generated/capstone.rs b/capstone-sys/pre_generated/capstone.rs index 4350768b..ca3ca442 100644 --- a/capstone-sys/pre_generated/capstone.rs +++ b/capstone-sys/pre_generated/capstone.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.62.0 */ +/* automatically generated by rust-bindgen 0.69.4 */ pub type va_list = __builtin_va_list; pub type csh = usize; @@ -107,8 +107,7 @@ pub const CS_MODE_M680X_6808: cs_mode = cs_mode(64); pub const CS_MODE_M680X_6809: cs_mode = cs_mode(128); #[doc = "< M680X Motorola/Freescale/NXP 68HC11 mode"] pub const CS_MODE_M680X_6811: cs_mode = cs_mode(256); -#[doc = "< M680X Motorola/Freescale/NXP CPU12"] -#[doc = "< used on M68HC12/HCS12"] +#[doc = "< M680X Motorola/Freescale/NXP CPU12\n< used on M68HC12/HCS12"] pub const CS_MODE_M680X_CPU12: cs_mode = cs_mode(512); #[doc = "< M680X Freescale/NXP HCS08 mode"] pub const CS_MODE_M680X_HCS08: cs_mode = cs_mode(1024); @@ -181,8 +180,7 @@ pub type cs_vsnprintf_t = ::core::option::Option< ap: *mut __va_list_tag, ) -> libc::c_int, >; -#[doc = " User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf()"] -#[doc = " By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf()."] +#[doc = " User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf()\n By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf()."] #[repr(C)] #[derive(Debug, Copy)] pub struct cs_opt_mem { @@ -197,10 +195,7 @@ impl Clone for cs_opt_mem { *self } } -#[doc = " Customize mnemonic for instructions with alternative name."] -#[doc = " To reset existing customized instruction to its default mnemonic,"] -#[doc = " call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value"] -#[doc = " for @mnemonic."] +#[doc = " Customize mnemonic for instructions with alternative name.\n To reset existing customized instruction to its default mnemonic,\n call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value\n for @mnemonic."] #[repr(C)] #[derive(Debug, Copy)] pub struct cs_opt_mnem { @@ -305,8 +300,7 @@ impl ::core::ops::BitAndAssign for cs_ac_type { } } #[repr(C)] -#[doc = " Common instruction operand access types - to be consistent across all architectures."] -#[doc = " It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE"] +#[doc = " Common instruction operand access types - to be consistent across all architectures.\n It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE"] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct cs_ac_type(pub libc::c_uint); pub mod cs_group_type { @@ -329,18 +323,7 @@ pub mod cs_group_type { #[doc = "< all relative branching instructions"] pub const CS_GRP_BRANCH_RELATIVE: Type = 7; } -#[doc = "User-defined callback function for SKIPDATA option."] -#[doc = "See tests/test_skipdata.c for sample code demonstrating this API."] -#[doc = ""] -#[doc = "@code: the input buffer containing code to be disassembled."] -#[doc = "This is the same buffer passed to cs_disasm()."] -#[doc = "@code_size: size (in bytes) of the above @code buffer."] -#[doc = "@offset: the position of the currently-examining byte in the input"] -#[doc = "buffer @code mentioned above."] -#[doc = "@user_data: user-data passed to cs_option() via @user_data field in"] -#[doc = "cs_opt_skipdata struct below."] -#[doc = ""] -#[doc = "@return: return number of bytes to skip, or 0 to immediately stop disassembling."] +#[doc = "User-defined callback function for SKIPDATA option.\nSee tests/test_skipdata.c for sample code demonstrating this API.\n\n@code: the input buffer containing code to be disassembled.\nThis is the same buffer passed to cs_disasm().\n@code_size: size (in bytes) of the above @code buffer.\n@offset: the position of the currently-examining byte in the input\nbuffer @code mentioned above.\n@user_data: user-data passed to cs_option() via @user_data field in\ncs_opt_skipdata struct below.\n\n@return: return number of bytes to skip, or 0 to immediately stop disassembling."] pub type cs_skipdata_cb_t = ::core::option::Option< unsafe extern "C" fn( code: *const u8, @@ -353,31 +336,9 @@ pub type cs_skipdata_cb_t = ::core::option::Option< #[repr(C)] #[derive(Debug, Copy)] pub struct cs_opt_skipdata { - #[doc = " Capstone considers data to skip as special \"instructions\"."] - #[doc = " User can specify the string for this instruction's \"mnemonic\" here."] - #[doc = " By default (if @mnemonic is NULL), Capstone use \".byte\"."] + #[doc = " Capstone considers data to skip as special \"instructions\".\n User can specify the string for this instruction's \"mnemonic\" here.\n By default (if @mnemonic is NULL), Capstone use \".byte\"."] pub mnemonic: *const libc::c_char, - #[doc = " User-defined callback function to be called when Capstone hits data."] - #[doc = " If the returned value from this callback is positive (>0), Capstone"] - #[doc = " will skip exactly that number of bytes & continue. Otherwise, if"] - #[doc = " the callback returns 0, Capstone stops disassembling and returns"] - #[doc = " immediately from cs_disasm()"] - #[doc = " NOTE: if this callback pointer is NULL, Capstone would skip a number"] - #[doc = " of bytes depending on architectures, as following:"] - #[doc = " Arm: 2 bytes (Thumb mode) or 4 bytes."] - #[doc = " Arm64: 4 bytes."] - #[doc = " Mips: 4 bytes."] - #[doc = " M680x: 1 byte."] - #[doc = " PowerPC: 4 bytes."] - #[doc = " Sparc: 4 bytes."] - #[doc = " SystemZ: 2 bytes."] - #[doc = " X86: 1 bytes."] - #[doc = " XCore: 2 bytes."] - #[doc = " EVM: 1 bytes."] - #[doc = " RISCV: 4 bytes."] - #[doc = " WASM: 1 bytes."] - #[doc = " MOS65XX: 1 bytes."] - #[doc = " BPF: 8 bytes."] + #[doc = " User-defined callback function to be called when Capstone hits data.\n If the returned value from this callback is positive (>0), Capstone\n will skip exactly that number of bytes & continue. Otherwise, if\n the callback returns 0, Capstone stops disassembling and returns\n immediately from cs_disasm()\n NOTE: if this callback pointer is NULL, Capstone would skip a number\n of bytes depending on architectures, as following:\n Arm: 2 bytes (Thumb mode) or 4 bytes.\n Arm64: 4 bytes.\n Mips: 4 bytes.\n M680x: 1 byte.\n PowerPC: 4 bytes.\n Sparc: 4 bytes.\n SystemZ: 2 bytes.\n X86: 1 bytes.\n XCore: 2 bytes.\n EVM: 1 bytes.\n RISCV: 4 bytes.\n WASM: 1 bytes.\n MOS65XX: 1 bytes.\n BPF: 8 bytes."] pub callback: cs_skipdata_cb_t, #[doc = " User-defined data to be passed to @callback function pointer."] pub user_data: *mut libc::c_void, @@ -612,8 +573,7 @@ pub enum arm_sysreg { ARM_SYSREG_SPSR_HYP = 325, } #[repr(u32)] -#[doc = " The memory barrier constants map directly to the 4-bit encoding of"] -#[doc = " the option field for Memory Barrier operations."] +#[doc = " The memory barrier constants map directly to the 4-bit encoding of\n the option field for Memory Barrier operations."] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum arm_mem_barrier { ARM_MB_INVALID = 0, @@ -857,8 +817,7 @@ pub mod arm_reg { pub const ARM_REG_FP: Type = 77; pub const ARM_REG_IP: Type = 78; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with ARM_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with ARM_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct arm_op_mem { @@ -870,8 +829,7 @@ pub struct arm_op_mem { pub scale: libc::c_int, #[doc = "< displacement/offset value"] pub disp: libc::c_int, - #[doc = " left-shift on index register, or 0 if irrelevant"] - #[doc = " NOTE: this value can also be fetched via operand.shift.value"] + #[doc = " left-shift on index register, or 0 if irrelevant\n NOTE: this value can also be fetched via operand.shift.value"] pub lshift: libc::c_int, } impl Clone for arm_op_mem { @@ -889,13 +847,9 @@ pub struct cs_arm_op { #[doc = "< operand type"] pub type_: arm_op_type, pub __bindgen_anon_1: cs_arm_op__bindgen_ty_2, - #[doc = " in some instructions, an operand can be subtracted or added to"] - #[doc = " the base register,"] - #[doc = " if TRUE, this operand is subtracted. otherwise, it is added."] + #[doc = " in some instructions, an operand can be subtracted or added to\n the base register,\n if TRUE, this operand is subtracted. otherwise, it is added."] pub subtracted: bool, - #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)"] - #[doc = " This field is combined of cs_ac_type."] - #[doc = " NOTE: this field is irrelevant if engine is compiled in DIET mode."] + #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)\n This field is combined of cs_ac_type.\n NOTE: this field is irrelevant if engine is compiled in DIET mode."] pub access: u8, #[doc = " Neon lane index for NEON instructions (or -1 if irrelevant)"] pub neon_lane: i8, @@ -967,8 +921,7 @@ pub struct cs_arm { pub writeback: bool, #[doc = "< Option for some memory barrier instructions"] pub mem_barrier: arm_mem_barrier, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_arm_op; 36usize], @@ -2951,8 +2904,7 @@ pub mod arm64_reg { pub const ARM64_REG_X29: Type = 2; pub const ARM64_REG_X30: Type = 3; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with ARM64_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with ARM64_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct arm64_op_mem { @@ -2982,9 +2934,7 @@ pub struct cs_arm64_op { #[doc = "< operand type"] pub type_: arm64_op_type, pub __bindgen_anon_1: cs_arm64_op__bindgen_ty_2, - #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)"] - #[doc = " This field is combined of cs_ac_type."] - #[doc = " NOTE: this field is irrelevant if engine is compiled in DIET mode."] + #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)\n This field is combined of cs_ac_type.\n NOTE: this field is irrelevant if engine is compiled in DIET mode."] pub access: u8, } #[repr(C)] @@ -3050,8 +3000,7 @@ pub struct cs_arm64 { pub update_flags: bool, #[doc = "< does this insn request writeback? 'True' means 'yes'"] pub writeback: bool, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_arm64_op; 8usize], @@ -4180,8 +4129,7 @@ pub enum m68k_op_type { #[doc = "< Branch displacement"] M68K_OP_BR_DISP = 8, } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with M68K_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with M68K_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct m68k_op_mem { @@ -4989,8 +4937,7 @@ pub mod mips_reg { pub const MIPS_REG_LO2: Type = 47; pub const MIPS_REG_LO3: Type = 48; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with MIPS_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with MIPS_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct mips_op_mem { @@ -5050,8 +4997,7 @@ impl ::core::fmt::Debug for cs_mips_op { #[repr(C)] #[derive(Copy)] pub struct cs_mips { - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_mips_op; 10usize], @@ -6043,8 +5989,7 @@ pub mod ppc_reg { pub const PPC_REG_CR7UN: Type = 343; pub const PPC_REG_ENDING: Type = 344; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with PPC_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with PPC_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct ppc_op_mem { @@ -6124,8 +6069,7 @@ pub struct cs_ppc { pub bh: ppc_bh, #[doc = " if update_cr0 = True, then this 'dot' insn updates CR0"] pub update_cr0: bool, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_ppc_op; 8usize], @@ -8054,14 +7998,11 @@ pub mod sparc_reg { pub const SPARC_REG_O6: Type = 85; pub const SPARC_REG_I6: Type = 53; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with SPARC_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with SPARC_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct sparc_op_mem { - #[doc = "< base register, can be safely interpreted as"] - #[doc = "< a value of type `sparc_reg`, but it is only"] - #[doc = "< one byte wide"] + #[doc = "< base register, can be safely interpreted as\n< a value of type `sparc_reg`, but it is only\n< one byte wide"] pub base: u8, #[doc = "< index register, same conditions apply here"] pub index: u8, @@ -8123,8 +8064,7 @@ pub struct cs_sparc { pub cc: sparc_cc, #[doc = "< branch hint: encoding as bitwise OR of sparc_hint."] pub hint: sparc_hint, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_sparc_op; 4usize], @@ -8602,14 +8542,11 @@ pub mod sysz_reg { pub const SYSZ_REG_F4Q: Type = 116; pub const SYSZ_REG_ENDING: Type = 117; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with SYSZ_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with SYSZ_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct sysz_op_mem { - #[doc = "< base register, can be safely interpreted as"] - #[doc = "< a value of type `sysz_reg`, but it is only"] - #[doc = "< one byte wide"] + #[doc = "< base register, can be safely interpreted as\n< a value of type `sysz_reg`, but it is only\n< one byte wide"] pub base: u8, #[doc = "< index register, same conditions apply here"] pub index: u8, @@ -8670,8 +8607,7 @@ impl ::core::fmt::Debug for cs_sysz_op { pub struct cs_sysz { #[doc = "< Code condition"] pub cc: sysz_cc, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_sysz_op; 6usize], @@ -11471,8 +11407,7 @@ pub enum x86_prefix { #[doc = "< address-size override (cs_x86.prefix[3]"] X86_PREFIX_ADDRSIZE = 103, } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with X86_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with X86_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct x86_op_mem { @@ -11501,9 +11436,7 @@ pub struct cs_x86_op { pub __bindgen_anon_1: cs_x86_op__bindgen_ty_1, #[doc = " size of this operand (in bytes)."] pub size: u8, - #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)"] - #[doc = " This field is combined of cs_ac_type."] - #[doc = " NOTE: this field is irrelevant if engine is compiled in DIET mode."] + #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)\n This field is combined of cs_ac_type.\n NOTE: this field is irrelevant if engine is compiled in DIET mode."] pub access: u8, #[doc = " AVX broadcast type, or 0 if irrelevant"] pub avx_bcast: x86_avx_bcast, @@ -11561,17 +11494,9 @@ impl Clone for cs_x86_encoding { #[repr(C)] #[derive(Copy)] pub struct cs_x86 { - #[doc = " Instruction prefix, which can be up to 4 bytes."] - #[doc = " A prefix byte gets value 0 when irrelevant."] - #[doc = " prefix[0] indicates REP/REPNE/LOCK prefix (See X86_PREFIX_REP/REPNE/LOCK above)"] - #[doc = " prefix[1] indicates segment override (irrelevant for x86_64):"] - #[doc = " See X86_PREFIX_CS/SS/DS/ES/FS/GS above."] - #[doc = " prefix[2] indicates operand-size override (X86_PREFIX_OPSIZE)"] - #[doc = " prefix[3] indicates address-size override (X86_PREFIX_ADDRSIZE)"] + #[doc = " Instruction prefix, which can be up to 4 bytes.\n A prefix byte gets value 0 when irrelevant.\n prefix[0] indicates REP/REPNE/LOCK prefix (See X86_PREFIX_REP/REPNE/LOCK above)\n prefix[1] indicates segment override (irrelevant for x86_64):\n See X86_PREFIX_CS/SS/DS/ES/FS/GS above.\n prefix[2] indicates operand-size override (X86_PREFIX_OPSIZE)\n prefix[3] indicates address-size override (X86_PREFIX_ADDRSIZE)"] pub prefix: [u8; 4usize], - #[doc = " Instruction opcode, which can be from 1 to 4 bytes in size."] - #[doc = " This contains VEX opcode as well."] - #[doc = " An trailing opcode byte gets value 0 when irrelevant."] + #[doc = " Instruction opcode, which can be from 1 to 4 bytes in size.\n This contains VEX opcode as well.\n An trailing opcode byte gets value 0 when irrelevant."] pub opcode: [u8; 4usize], #[doc = " REX prefix: only a non-zero value is relevant for x86_64"] pub rex: u8, @@ -11600,8 +11525,7 @@ pub struct cs_x86 { #[doc = " AVX static rounding mode"] pub avx_rm: x86_avx_rm, pub __bindgen_anon_1: cs_x86__bindgen_ty_1, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_x86_op; 8usize], @@ -11611,11 +11535,9 @@ pub struct cs_x86 { #[repr(C)] #[derive(Copy)] pub union cs_x86__bindgen_ty_1 { - #[doc = " EFLAGS updated by this instruction."] - #[doc = " This can be formed from OR combination of X86_EFLAGS_* symbols in x86.h"] + #[doc = " EFLAGS updated by this instruction.\n This can be formed from OR combination of X86_EFLAGS_* symbols in x86.h"] pub eflags: u64, - #[doc = " FPU_FLAGS updated by this instruction."] - #[doc = " This can be formed from OR combination of X86_FPU_FLAGS_* symbols in x86.h"] + #[doc = " FPU_FLAGS updated by this instruction.\n This can be formed from OR combination of X86_FPU_FLAGS_* symbols in x86.h"] pub fpu_flags: u64, } impl Clone for cs_x86__bindgen_ty_1 { @@ -13278,14 +13200,11 @@ pub mod xcore_reg { pub const XCORE_REG_ID: Type = 25; pub const XCORE_REG_ENDING: Type = 26; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with XCORE_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with XCORE_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct xcore_op_mem { - #[doc = "< base register, can be safely interpreted as"] - #[doc = "< a value of type `xcore_reg`, but it is only"] - #[doc = "< one byte wide"] + #[doc = "< base register, can be safely interpreted as\n< a value of type `xcore_reg`, but it is only\n< one byte wide"] pub base: u8, #[doc = "< index register, same conditions apply here"] pub index: u8, @@ -13345,8 +13264,7 @@ impl ::core::fmt::Debug for cs_xcore_op { #[repr(C)] #[derive(Copy)] pub struct cs_xcore { - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_xcore_op; 8usize], @@ -13980,33 +13898,24 @@ pub enum m680x_op_type { M680X_OP_DIRECT = 5, #[doc = "< = Relative addressing operand."] M680X_OP_RELATIVE = 6, - #[doc = "< = constant operand (Displayed as number only)."] - #[doc = "< Used e.g. for a bit index or page number."] + #[doc = "< = constant operand (Displayed as number only).\n< Used e.g. for a bit index or page number."] M680X_OP_CONSTANT = 7, } #[doc = " Instruction's operand referring to indexed addressing"] #[repr(C)] #[derive(Debug, Copy)] pub struct m680x_op_idx { - #[doc = "< base register (or M680X_REG_INVALID if"] - #[doc = "< irrelevant)"] + #[doc = "< base register (or M680X_REG_INVALID if\n< irrelevant)"] pub base_reg: m680x_reg::Type, - #[doc = "< offset register (or M680X_REG_INVALID if"] - #[doc = "< irrelevant)"] + #[doc = "< offset register (or M680X_REG_INVALID if\n< irrelevant)"] pub offset_reg: m680x_reg::Type, #[doc = "< 5-,8- or 16-bit offset. See also offset_bits."] pub offset: i16, - #[doc = "< = offset addr. if base_reg == M680X_REG_PC."] - #[doc = "< calculated as offset + PC"] + #[doc = "< = offset addr. if base_reg == M680X_REG_PC.\n< calculated as offset + PC"] pub offset_addr: u16, #[doc = "< offset width in bits for indexed addressing"] pub offset_bits: u8, - #[doc = "< inc. or dec. value:"] - #[doc = "< 0: no inc-/decrement"] - #[doc = "< 1 .. 8: increment by 1 .. 8"] - #[doc = "< -1 .. -8: decrement by 1 .. 8"] - #[doc = "< if flag M680X_IDX_POST_INC_DEC set it is post"] - #[doc = "< inc-/decrement otherwise pre inc-/decrement"] + #[doc = "< inc. or dec. value:\n< 0: no inc-/decrement\n< 1 .. 8: increment by 1 .. 8\n< -1 .. -8: decrement by 1 .. 8\n< if flag M680X_IDX_POST_INC_DEC set it is post\n< inc-/decrement otherwise pre inc-/decrement"] pub inc_dec: i8, #[doc = "< 8-bit flags (see above)"] pub flags: u8, @@ -14020,9 +13929,7 @@ impl Clone for m680x_op_idx { #[repr(C)] #[derive(Debug, Copy)] pub struct m680x_op_rel { - #[doc = "< The absolute address."] - #[doc = "< calculated as PC + offset. PC is the first"] - #[doc = "< address after the instruction."] + #[doc = "< The absolute address.\n< calculated as PC + offset. PC is the first\n< address after the instruction."] pub address: u16, #[doc = "< the offset/displacement value"] pub offset: i16, @@ -14054,9 +13961,7 @@ pub struct cs_m680x_op { pub __bindgen_anon_1: cs_m680x_op__bindgen_ty_1, #[doc = "< size of this operand (in bytes)"] pub size: u8, - #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)"] - #[doc = " This field is combined of cs_ac_type."] - #[doc = " NOTE: this field is irrelevant if engine is compiled in DIET"] + #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)\n This field is combined of cs_ac_type.\n NOTE: this field is irrelevant if engine is compiled in DIET"] pub access: u8, } #[repr(C)] @@ -15454,8 +15359,7 @@ impl ::core::fmt::Debug for cs_mos65xx_op { pub struct cs_mos65xx { pub am: mos65xx_address_mode, pub modifies_flags: bool, - #[doc = " Number of operands of this instruction,"] - #[doc = " or 0 when instruction has no operand."] + #[doc = " Number of operands of this instruction,\n or 0 when instruction has no operand."] pub op_count: u8, #[doc = "< operands for this instruction."] pub operands: [cs_mos65xx_op; 3usize], @@ -15509,8 +15413,7 @@ pub mod bpf_reg { pub const BPF_REG_R10: Type = 13; pub const BPF_REG_ENDING: Type = 14; } -#[doc = " Instruction's operand referring to memory"] -#[doc = " This is associated with BPF_OP_MEM operand type above"] +#[doc = " Instruction's operand referring to memory\n This is associated with BPF_OP_MEM operand type above"] #[repr(C)] #[derive(Debug, Copy)] pub struct bpf_op_mem { @@ -15536,9 +15439,7 @@ pub enum bpf_ext_type { pub struct cs_bpf_op { pub type_: bpf_op_type, pub __bindgen_anon_1: cs_bpf_op__bindgen_ty_1, - #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)"] - #[doc = " This field is combined of cs_ac_type."] - #[doc = " NOTE: this field is irrelevant if engine is compiled in DIET mode."] + #[doc = " How is this operand accessed? (READ, WRITE or READ|WRITE)\n This field is combined of cs_ac_type.\n NOTE: this field is irrelevant if engine is compiled in DIET mode."] pub access: u8, } #[repr(C)] @@ -15721,11 +15622,7 @@ pub mod bpf_insn_group { pub const BPF_GRP_MISC: Type = 7; pub const BPF_GRP_ENDING: Type = 8; } -#[doc = " NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON"] -#[doc = " Initialized as memset(., 0, offsetof(cs_detail, ARCH)+sizeof(cs_ARCH))"] -#[doc = " by ARCH_getInstruction in arch/ARCH/ARCHDisassembler.c"] -#[doc = " if cs_detail changes, in particular if a field is added after the union,"] -#[doc = " then update arch/ARCH/ARCHDisassembler.c accordingly"] +#[doc = " NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON\n Initialized as memset(., 0, offsetof(cs_detail, ARCH)+sizeof(cs_ARCH))\n by ARCH_getInstruction in arch/ARCH/ARCHDisassembler.c\n if cs_detail changes, in particular if a field is added after the union,\n then update arch/ARCH/ARCHDisassembler.c accordingly"] #[repr(C)] #[derive(Copy)] pub struct cs_detail { @@ -15803,35 +15700,19 @@ impl ::core::fmt::Debug for cs_detail { #[doc = " Detail information of disassembled instruction"] #[repr(C)] pub struct cs_insn { - #[doc = " Instruction ID (basically a numeric ID for the instruction mnemonic)"] - #[doc = " Find the instruction id in the '[ARCH]_insn' enum in the header file"] - #[doc = " of corresponding architecture, such as 'arm_insn' in arm.h for ARM,"] - #[doc = " 'x86_insn' in x86.h for X86, etc..."] - #[doc = " This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] - #[doc = " NOTE: in Skipdata mode, \"data\" instruction has 0 for this id field."] + #[doc = " Instruction ID (basically a numeric ID for the instruction mnemonic)\n Find the instruction id in the '[ARCH]_insn' enum in the header file\n of corresponding architecture, such as 'arm_insn' in arm.h for ARM,\n 'x86_insn' in x86.h for X86, etc...\n This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n NOTE: in Skipdata mode, \"data\" instruction has 0 for this id field."] pub id: libc::c_uint, - #[doc = " Address (EIP) of this instruction"] - #[doc = " This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] + #[doc = " Address (EIP) of this instruction\n This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] pub address: u64, - #[doc = " Size of this instruction"] - #[doc = " This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] + #[doc = " Size of this instruction\n This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] pub size: u16, - #[doc = " Machine bytes of this instruction, with number of bytes indicated by @size above"] - #[doc = " This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] + #[doc = " Machine bytes of this instruction, with number of bytes indicated by @size above\n This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] pub bytes: [u8; 24usize], - #[doc = " Ascii text of instruction mnemonic"] - #[doc = " This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] + #[doc = " Ascii text of instruction mnemonic\n This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] pub mnemonic: [libc::c_char; 32usize], - #[doc = " Ascii text of instruction operands"] - #[doc = " This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] + #[doc = " Ascii text of instruction operands\n This information is available even when CS_OPT_DETAIL = CS_OPT_OFF"] pub op_str: [libc::c_char; 160usize], - #[doc = " Pointer to cs_detail."] - #[doc = " NOTE: detail pointer is only valid when both requirements below are met:"] - #[doc = " (1) CS_OP_DETAIL = CS_OPT_ON"] - #[doc = " (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON)"] - #[doc = ""] - #[doc = " NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer"] - #[doc = " is not NULL, its content is still irrelevant."] + #[doc = " Pointer to cs_detail.\n NOTE: detail pointer is only valid when both requirements below are met:\n (1) CS_OP_DETAIL = CS_OPT_ON\n (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON)\n\n NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer\n is not NULL, its content is still irrelevant."] pub detail: *mut cs_detail, } impl ::core::fmt::Debug for cs_insn { @@ -15844,8 +15725,7 @@ impl ::core::fmt::Debug for cs_insn { } } pub mod cs_err { - #[doc = " All type of errors encountered by Capstone API."] - #[doc = " These are values returned by cs_errno()"] + #[doc = " All type of errors encountered by Capstone API.\n These are values returned by cs_errno()"] pub type Type = libc::c_uint; #[doc = "< No error: everything was fine"] pub const CS_ERR_OK: Type = 0; @@ -15879,128 +15759,35 @@ pub mod cs_err { pub const CS_ERR_X86_MASM: Type = 14; } extern "C" { - #[doc = "Return combined API version & major and minor version numbers."] - #[doc = ""] - #[doc = "@major: major number of API version"] - #[doc = "@minor: minor number of API version"] - #[doc = ""] - #[doc = "@return hexical number as (major << 8 | minor), which encodes both"] - #[doc = "major & minor versions."] - #[doc = "NOTE: This returned value can be compared with version number made"] - #[doc = "with macro CS_MAKE_VERSION"] - #[doc = ""] - #[doc = "For example, second API version would return 1 in @major, and 1 in @minor"] - #[doc = "The return value would be 0x0101"] - #[doc = ""] - #[doc = "NOTE: if you only care about returned value, but not major and minor values,"] - #[doc = "set both @major & @minor arguments to NULL."] + #[doc = "Return combined API version & major and minor version numbers.\n\n@major: major number of API version\n@minor: minor number of API version\n\n@return hexical number as (major << 8 | minor), which encodes both\nmajor & minor versions.\nNOTE: This returned value can be compared with version number made\nwith macro CS_MAKE_VERSION\n\nFor example, second API version would return 1 in @major, and 1 in @minor\nThe return value would be 0x0101\n\nNOTE: if you only care about returned value, but not major and minor values,\nset both @major & @minor arguments to NULL."] pub fn cs_version(major: *mut libc::c_int, minor: *mut libc::c_int) -> libc::c_uint; } extern "C" { - #[doc = "This API can be used to either ask for archs supported by this library,"] - #[doc = "or check to see if the library was compile with 'diet' option (or called"] - #[doc = "in 'diet' mode)."] - #[doc = ""] - #[doc = "To check if a particular arch is supported by this library, set @query to"] - #[doc = "arch mode (CS_ARCH_* value)."] - #[doc = "To verify if this library supports all the archs, use CS_ARCH_ALL."] - #[doc = ""] - #[doc = "To check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET."] - #[doc = ""] - #[doc = "@return True if this library supports the given arch, or in 'diet' mode."] + #[doc = "This API can be used to either ask for archs supported by this library,\nor check to see if the library was compile with 'diet' option (or called\nin 'diet' mode).\n\nTo check if a particular arch is supported by this library, set @query to\narch mode (CS_ARCH_* value).\nTo verify if this library supports all the archs, use CS_ARCH_ALL.\n\nTo check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET.\n\n@return True if this library supports the given arch, or in 'diet' mode."] pub fn cs_support(query: libc::c_int) -> bool; } extern "C" { - #[doc = "Initialize CS handle: this must be done before any usage of CS."] - #[doc = ""] - #[doc = "@arch: architecture type (CS_ARCH_*)"] - #[doc = "@mode: hardware mode. This is combined of CS_MODE_*"] - #[doc = "@handle: pointer to handle, which will be updated at return time"] - #[doc = ""] - #[doc = "@return CS_ERR_OK on success, or other value on failure (refer to cs_err enum"] - #[doc = "for detailed error)."] + #[doc = "Initialize CS handle: this must be done before any usage of CS.\n\n@arch: architecture type (CS_ARCH_*)\n@mode: hardware mode. This is combined of CS_MODE_*\n@handle: pointer to handle, which will be updated at return time\n\n@return CS_ERR_OK on success, or other value on failure (refer to cs_err enum\nfor detailed error)."] pub fn cs_open(arch: cs_arch, mode: cs_mode, handle: *mut csh) -> cs_err::Type; } extern "C" { - #[doc = "Close CS handle: MUST do to release the handle when it is not used anymore."] - #[doc = "NOTE: this must be only called when there is no longer usage of Capstone,"] - #[doc = "not even access to cs_insn array. The reason is the this API releases some"] - #[doc = "cached memory, thus access to any Capstone API after cs_close() might crash"] - #[doc = "your application."] - #[doc = ""] - #[doc = "In fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0)."] - #[doc = ""] - #[doc = "@handle: pointer to a handle returned by cs_open()"] - #[doc = ""] - #[doc = "@return CS_ERR_OK on success, or other value on failure (refer to cs_err enum"] - #[doc = "for detailed error)."] + #[doc = "Close CS handle: MUST do to release the handle when it is not used anymore.\nNOTE: this must be only called when there is no longer usage of Capstone,\nnot even access to cs_insn array. The reason is the this API releases some\ncached memory, thus access to any Capstone API after cs_close() might crash\nyour application.\n\nIn fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0).\n\n@handle: pointer to a handle returned by cs_open()\n\n@return CS_ERR_OK on success, or other value on failure (refer to cs_err enum\nfor detailed error)."] pub fn cs_close(handle: *mut csh) -> cs_err::Type; } extern "C" { - #[doc = "Set option for disassembling engine at runtime"] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@type: type of option to be set"] - #[doc = "@value: option value corresponding with @type"] - #[doc = ""] - #[doc = "@return: CS_ERR_OK on success, or other value on failure."] - #[doc = "Refer to cs_err enum for detailed error."] - #[doc = ""] - #[doc = "NOTE: in the case of CS_OPT_MEM, handle's value can be anything,"] - #[doc = "so that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called"] - #[doc = "even before cs_open()"] + #[doc = "Set option for disassembling engine at runtime\n\n@handle: handle returned by cs_open()\n@type: type of option to be set\n@value: option value corresponding with @type\n\n@return: CS_ERR_OK on success, or other value on failure.\nRefer to cs_err enum for detailed error.\n\nNOTE: in the case of CS_OPT_MEM, handle's value can be anything,\nso that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called\neven before cs_open()"] pub fn cs_option(handle: csh, type_: cs_opt_type, value: usize) -> cs_err::Type; } extern "C" { - #[doc = "Report the last error number when some API function fail."] - #[doc = "Like glibc's errno, cs_errno might not retain its old value once accessed."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = ""] - #[doc = "@return: error code of cs_err enum type (CS_ERR_*, see above)"] + #[doc = "Report the last error number when some API function fail.\nLike glibc's errno, cs_errno might not retain its old value once accessed.\n\n@handle: handle returned by cs_open()\n\n@return: error code of cs_err enum type (CS_ERR_*, see above)"] pub fn cs_errno(handle: csh) -> cs_err::Type; } extern "C" { - #[doc = "Return a string describing given error code."] - #[doc = ""] - #[doc = "@code: error code (see CS_ERR_* above)"] - #[doc = ""] - #[doc = "@return: returns a pointer to a string that describes the error code"] - #[doc = "passed in the argument @code"] + #[doc = "Return a string describing given error code.\n\n@code: error code (see CS_ERR_* above)\n\n@return: returns a pointer to a string that describes the error code\npassed in the argument @code"] pub fn cs_strerror(code: cs_err::Type) -> *const libc::c_char; } extern "C" { - #[doc = "Disassemble binary code, given the code buffer, size, address and number"] - #[doc = "of instructions to be decoded."] - #[doc = "This API dynamically allocate memory to contain disassembled instruction."] - #[doc = "Resulting instructions will be put into @*insn"] - #[doc = ""] - #[doc = "NOTE 1: this API will automatically determine memory needed to contain"] - #[doc = "output disassembled instructions in @insn."] - #[doc = ""] - #[doc = "NOTE 2: caller must free the allocated memory itself to avoid memory leaking."] - #[doc = ""] - #[doc = "NOTE 3: for system with scarce memory to be dynamically allocated such as"] - #[doc = "OS kernel or firmware, the API cs_disasm_iter() might be a better choice than"] - #[doc = "cs_disasm(). The reason is that with cs_disasm(), based on limited available"] - #[doc = "memory, we have to calculate in advance how many instructions to be disassembled,"] - #[doc = "which complicates things. This is especially troublesome for the case @count=0,"] - #[doc = "when cs_disasm() runs uncontrollably (until either end of input buffer, or"] - #[doc = "when it encounters an invalid instruction)."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@code: buffer containing raw binary code to be disassembled."] - #[doc = "@code_size: size of the above code buffer."] - #[doc = "@address: address of the first instruction in given raw code buffer."] - #[doc = "@insn: array of instructions filled in by this API."] - #[doc = "NOTE: @insn will be allocated by this function, and should be freed"] - #[doc = "with cs_free() API."] - #[doc = "@count: number of instructions to be disassembled, or 0 to get all of them"] - #[doc = ""] - #[doc = "@return: the number of successfully disassembled instructions,"] - #[doc = "or 0 if this function failed to disassemble the given code"] - #[doc = ""] - #[doc = "On failure, call cs_errno() for error code."] + #[doc = "Disassemble binary code, given the code buffer, size, address and number\nof instructions to be decoded.\nThis API dynamically allocate memory to contain disassembled instruction.\nResulting instructions will be put into @*insn\n\nNOTE 1: this API will automatically determine memory needed to contain\noutput disassembled instructions in @insn.\n\nNOTE 2: caller must free the allocated memory itself to avoid memory leaking.\n\nNOTE 3: for system with scarce memory to be dynamically allocated such as\nOS kernel or firmware, the API cs_disasm_iter() might be a better choice than\ncs_disasm(). The reason is that with cs_disasm(), based on limited available\nmemory, we have to calculate in advance how many instructions to be disassembled,\nwhich complicates things. This is especially troublesome for the case @count=0,\nwhen cs_disasm() runs uncontrollably (until either end of input buffer, or\nwhen it encounters an invalid instruction).\n\n@handle: handle returned by cs_open()\n@code: buffer containing raw binary code to be disassembled.\n@code_size: size of the above code buffer.\n@address: address of the first instruction in given raw code buffer.\n@insn: array of instructions filled in by this API.\nNOTE: @insn will be allocated by this function, and should be freed\nwith cs_free() API.\n@count: number of instructions to be disassembled, or 0 to get all of them\n\n@return: the number of successfully disassembled instructions,\nor 0 if this function failed to disassemble the given code\n\nOn failure, call cs_errno() for error code."] pub fn cs_disasm( handle: csh, code: *const u8, @@ -16011,56 +15798,15 @@ extern "C" { ) -> usize; } extern "C" { - #[doc = "Free memory allocated by cs_malloc() or cs_disasm() (argument @insn)"] - #[doc = ""] - #[doc = "@insn: pointer returned by @insn argument in cs_disasm() or cs_malloc()"] - #[doc = "@count: number of cs_insn structures returned by cs_disasm(), or 1"] - #[doc = "to free memory allocated by cs_malloc()."] + #[doc = "Free memory allocated by cs_malloc() or cs_disasm() (argument @insn)\n\n@insn: pointer returned by @insn argument in cs_disasm() or cs_malloc()\n@count: number of cs_insn structures returned by cs_disasm(), or 1\nto free memory allocated by cs_malloc()."] pub fn cs_free(insn: *mut cs_insn, count: usize); } extern "C" { - #[doc = "Allocate memory for 1 instruction to be used by cs_disasm_iter()."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = ""] - #[doc = "NOTE: when no longer in use, you can reclaim the memory allocated for"] - #[doc = "this instruction with cs_free(insn, 1)"] + #[doc = "Allocate memory for 1 instruction to be used by cs_disasm_iter().\n\n@handle: handle returned by cs_open()\n\nNOTE: when no longer in use, you can reclaim the memory allocated for\nthis instruction with cs_free(insn, 1)"] pub fn cs_malloc(handle: csh) -> *mut cs_insn; } extern "C" { - #[doc = "Fast API to disassemble binary code, given the code buffer, size, address"] - #[doc = "and number of instructions to be decoded."] - #[doc = "This API puts the resulting instruction into a given cache in @insn."] - #[doc = "See tests/test_iter.c for sample code demonstrating this API."] - #[doc = ""] - #[doc = "NOTE 1: this API will update @code, @size & @address to point to the next"] - #[doc = "instruction in the input buffer. Therefore, it is convenient to use"] - #[doc = "cs_disasm_iter() inside a loop to quickly iterate all the instructions."] - #[doc = "While decoding one instruction at a time can also be achieved with"] - #[doc = "cs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30%"] - #[doc = "faster on random input."] - #[doc = ""] - #[doc = "NOTE 2: the cache in @insn can be created with cs_malloc() API."] - #[doc = ""] - #[doc = "NOTE 3: for system with scarce memory to be dynamically allocated such as"] - #[doc = "OS kernel or firmware, this API is recommended over cs_disasm(), which"] - #[doc = "allocates memory based on the number of instructions to be disassembled."] - #[doc = "The reason is that with cs_disasm(), based on limited available memory,"] - #[doc = "we have to calculate in advance how many instructions to be disassembled,"] - #[doc = "which complicates things. This is especially troublesome for the case"] - #[doc = "@count=0, when cs_disasm() runs uncontrollably (until either end of input"] - #[doc = "buffer, or when it encounters an invalid instruction)."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@code: buffer containing raw binary code to be disassembled"] - #[doc = "@size: size of above code"] - #[doc = "@address: address of the first insn in given raw code buffer"] - #[doc = "@insn: pointer to instruction to be filled in by this API."] - #[doc = ""] - #[doc = "@return: true if this API successfully decode 1 instruction,"] - #[doc = "or false otherwise."] - #[doc = ""] - #[doc = "On failure, call cs_errno() for error code."] + #[doc = "Fast API to disassemble binary code, given the code buffer, size, address\nand number of instructions to be decoded.\nThis API puts the resulting instruction into a given cache in @insn.\nSee tests/test_iter.c for sample code demonstrating this API.\n\nNOTE 1: this API will update @code, @size & @address to point to the next\ninstruction in the input buffer. Therefore, it is convenient to use\ncs_disasm_iter() inside a loop to quickly iterate all the instructions.\nWhile decoding one instruction at a time can also be achieved with\ncs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30%\nfaster on random input.\n\nNOTE 2: the cache in @insn can be created with cs_malloc() API.\n\nNOTE 3: for system with scarce memory to be dynamically allocated such as\nOS kernel or firmware, this API is recommended over cs_disasm(), which\nallocates memory based on the number of instructions to be disassembled.\nThe reason is that with cs_disasm(), based on limited available memory,\nwe have to calculate in advance how many instructions to be disassembled,\nwhich complicates things. This is especially troublesome for the case\n@count=0, when cs_disasm() runs uncontrollably (until either end of input\nbuffer, or when it encounters an invalid instruction).\n\n@handle: handle returned by cs_open()\n@code: buffer containing raw binary code to be disassembled\n@size: size of above code\n@address: address of the first insn in given raw code buffer\n@insn: pointer to instruction to be filled in by this API.\n\n@return: true if this API successfully decode 1 instruction,\nor false otherwise.\n\nOn failure, call cs_errno() for error code."] pub fn cs_disasm_iter( handle: csh, code: *mut *const u8, @@ -16070,123 +15816,35 @@ extern "C" { ) -> bool; } extern "C" { - #[doc = "Return friendly name of register in a string."] - #[doc = "Find the instruction id from header file of corresponding architecture (arm.h for ARM,"] - #[doc = "x86.h for X86, ...)"] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because engine does not"] - #[doc = "store register name."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@reg_id: register id"] - #[doc = ""] - #[doc = "@return: string name of the register, or NULL if @reg_id is invalid."] + #[doc = "Return friendly name of register in a string.\nFind the instruction id from header file of corresponding architecture (arm.h for ARM,\nx86.h for X86, ...)\n\nWARN: when in 'diet' mode, this API is irrelevant because engine does not\nstore register name.\n\n@handle: handle returned by cs_open()\n@reg_id: register id\n\n@return: string name of the register, or NULL if @reg_id is invalid."] pub fn cs_reg_name(handle: csh, reg_id: libc::c_uint) -> *const libc::c_char; } extern "C" { - #[doc = "Return friendly name of an instruction in a string."] - #[doc = "Find the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because the engine does not"] - #[doc = "store instruction name."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@insn_id: instruction id"] - #[doc = ""] - #[doc = "@return: string name of the instruction, or NULL if @insn_id is invalid."] + #[doc = "Return friendly name of an instruction in a string.\nFind the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\nWARN: when in 'diet' mode, this API is irrelevant because the engine does not\nstore instruction name.\n\n@handle: handle returned by cs_open()\n@insn_id: instruction id\n\n@return: string name of the instruction, or NULL if @insn_id is invalid."] pub fn cs_insn_name(handle: csh, insn_id: libc::c_uint) -> *const libc::c_char; } extern "C" { - #[doc = "Return friendly name of a group id (that an instruction can belong to)"] - #[doc = "Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because the engine does not"] - #[doc = "store group name."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@group_id: group id"] - #[doc = ""] - #[doc = "@return: string name of the group, or NULL if @group_id is invalid."] + #[doc = "Return friendly name of a group id (that an instruction can belong to)\nFind the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\nWARN: when in 'diet' mode, this API is irrelevant because the engine does not\nstore group name.\n\n@handle: handle returned by cs_open()\n@group_id: group id\n\n@return: string name of the group, or NULL if @group_id is invalid."] pub fn cs_group_name(handle: csh, group_id: libc::c_uint) -> *const libc::c_char; } extern "C" { - #[doc = "Check if a disassembled instruction belong to a particular group."] - #[doc = "Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = "Internally, this simply verifies if @group_id matches any member of insn->groups array."] - #[doc = ""] - #[doc = "NOTE: this API is only valid when detail option is ON (which is OFF by default)."] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because the engine does not"] - #[doc = "update @groups array."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()"] - #[doc = "@group_id: group that you want to check if this instruction belong to."] - #[doc = ""] - #[doc = "@return: true if this instruction indeed belongs to the given group, or false otherwise."] + #[doc = "Check if a disassembled instruction belong to a particular group.\nFind the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\nInternally, this simply verifies if @group_id matches any member of insn->groups array.\n\nNOTE: this API is only valid when detail option is ON (which is OFF by default).\n\nWARN: when in 'diet' mode, this API is irrelevant because the engine does not\nupdate @groups array.\n\n@handle: handle returned by cs_open()\n@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n@group_id: group that you want to check if this instruction belong to.\n\n@return: true if this instruction indeed belongs to the given group, or false otherwise."] pub fn cs_insn_group(handle: csh, insn: *const cs_insn, group_id: libc::c_uint) -> bool; } extern "C" { - #[doc = "Check if a disassembled instruction IMPLICITLY used a particular register."] - #[doc = "Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = "Internally, this simply verifies if @reg_id matches any member of insn->regs_read array."] - #[doc = ""] - #[doc = "NOTE: this API is only valid when detail option is ON (which is OFF by default)"] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because the engine does not"] - #[doc = "update @regs_read array."] - #[doc = ""] - #[doc = "@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()"] - #[doc = "@reg_id: register that you want to check if this instruction used it."] - #[doc = ""] - #[doc = "@return: true if this instruction indeed implicitly used the given register, or false otherwise."] + #[doc = "Check if a disassembled instruction IMPLICITLY used a particular register.\nFind the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\nInternally, this simply verifies if @reg_id matches any member of insn->regs_read array.\n\nNOTE: this API is only valid when detail option is ON (which is OFF by default)\n\nWARN: when in 'diet' mode, this API is irrelevant because the engine does not\nupdate @regs_read array.\n\n@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n@reg_id: register that you want to check if this instruction used it.\n\n@return: true if this instruction indeed implicitly used the given register, or false otherwise."] pub fn cs_reg_read(handle: csh, insn: *const cs_insn, reg_id: libc::c_uint) -> bool; } extern "C" { - #[doc = "Check if a disassembled instruction IMPLICITLY modified a particular register."] - #[doc = "Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = "Internally, this simply verifies if @reg_id matches any member of insn->regs_write array."] - #[doc = ""] - #[doc = "NOTE: this API is only valid when detail option is ON (which is OFF by default)"] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because the engine does not"] - #[doc = "update @regs_write array."] - #[doc = ""] - #[doc = "@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()"] - #[doc = "@reg_id: register that you want to check if this instruction modified it."] - #[doc = ""] - #[doc = "@return: true if this instruction indeed implicitly modified the given register, or false otherwise."] + #[doc = "Check if a disassembled instruction IMPLICITLY modified a particular register.\nFind the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\nInternally, this simply verifies if @reg_id matches any member of insn->regs_write array.\n\nNOTE: this API is only valid when detail option is ON (which is OFF by default)\n\nWARN: when in 'diet' mode, this API is irrelevant because the engine does not\nupdate @regs_write array.\n\n@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n@reg_id: register that you want to check if this instruction modified it.\n\n@return: true if this instruction indeed implicitly modified the given register, or false otherwise."] pub fn cs_reg_write(handle: csh, insn: *const cs_insn, reg_id: libc::c_uint) -> bool; } extern "C" { - #[doc = "Count the number of operands of a given type."] - #[doc = "Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = ""] - #[doc = "NOTE: this API is only valid when detail option is ON (which is OFF by default)"] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()"] - #[doc = "@op_type: Operand type to be found."] - #[doc = ""] - #[doc = "@return: number of operands of given type @op_type in instruction @insn,"] - #[doc = "or -1 on failure."] + #[doc = "Count the number of operands of a given type.\nFind the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\nNOTE: this API is only valid when detail option is ON (which is OFF by default)\n\n@handle: handle returned by cs_open()\n@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n@op_type: Operand type to be found.\n\n@return: number of operands of given type @op_type in instruction @insn,\nor -1 on failure."] pub fn cs_op_count(handle: csh, insn: *const cs_insn, op_type: libc::c_uint) -> libc::c_int; } extern "C" { - #[doc = "Retrieve the position of operand of given type in .operands[] array."] - #[doc = "Later, the operand can be accessed using the returned position."] - #[doc = "Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)"] - #[doc = ""] - #[doc = "NOTE: this API is only valid when detail option is ON (which is OFF by default)"] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()"] - #[doc = "@op_type: Operand type to be found."] - #[doc = "@position: position of the operand to be found. This must be in the range"] - #[doc = "[1, cs_op_count(handle, insn, op_type)]"] - #[doc = ""] - #[doc = "@return: index of operand of given type @op_type in .operands[] array"] - #[doc = "in instruction @insn, or -1 on failure."] + #[doc = "Retrieve the position of operand of given type in .operands[] array.\nLater, the operand can be accessed using the returned position.\nFind the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\nNOTE: this API is only valid when detail option is ON (which is OFF by default)\n\n@handle: handle returned by cs_open()\n@insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n@op_type: Operand type to be found.\n@position: position of the operand to be found. This must be in the range\n[1, cs_op_count(handle, insn, op_type)]\n\n@return: index of operand of given type @op_type in .operands[] array\nin instruction @insn, or -1 on failure."] pub fn cs_op_index( handle: csh, insn: *const cs_insn, @@ -16197,21 +15855,7 @@ extern "C" { #[doc = " Type of array to keep the list of registers"] pub type cs_regs = [u16; 64usize]; extern "C" { - #[doc = "Retrieve all the registers accessed by an instruction, either explicitly or"] - #[doc = "implicitly."] - #[doc = ""] - #[doc = "WARN: when in 'diet' mode, this API is irrelevant because engine does not"] - #[doc = "store registers."] - #[doc = ""] - #[doc = "@handle: handle returned by cs_open()"] - #[doc = "@insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter()"] - #[doc = "@regs_read: on return, this array contains all registers read by instruction."] - #[doc = "@regs_read_count: number of registers kept inside @regs_read array."] - #[doc = "@regs_write: on return, this array contains all registers written by instruction."] - #[doc = "@regs_write_count: number of registers kept inside @regs_write array."] - #[doc = ""] - #[doc = "@return CS_ERR_OK on success, or other value on failure (refer to cs_err enum"] - #[doc = "for detailed error)."] + #[doc = "Retrieve all the registers accessed by an instruction, either explicitly or\nimplicitly.\n\nWARN: when in 'diet' mode, this API is irrelevant because engine does not\nstore registers.\n\n@handle: handle returned by cs_open()\n@insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter()\n@regs_read: on return, this array contains all registers read by instruction.\n@regs_read_count: number of registers kept inside @regs_read array.\n@regs_write: on return, this array contains all registers written by instruction.\n@regs_write_count: number of registers kept inside @regs_write array.\n\n@return CS_ERR_OK on success, or other value on failure (refer to cs_err enum\nfor detailed error)."] pub fn cs_regs_access( handle: csh, insn: *const cs_insn,