module Crabstone
Library by Nguyen Anh Quynh Original binding by Nguyen Anh Quynh and Tan Sheng Di Additional binding work by Ben Nagy © 2013 COSEINC. All Rights Reserved.
XXX: Auto-gerneate this file? Error
classes might be added in a newer Capstone version, but this should not be frequent, currently this file is updated manually.
Constants
- AC_INVALID
Access types for instruction operands.
- AC_READ
- AC_WRITE
- ARCH_ALL
- ARCH_ARM
architectures
- ARCH_ARM64
- ARCH_EVM
- ARCH_M680X
- ARCH_M68K
- ARCH_MAX
- ARCH_MIPS
- ARCH_PPC
- ARCH_SPARC
- ARCH_SYSZ
- ARCH_TMS320C64X
- ARCH_X86
- ARCH_XCORE
- BINDING_MAJ
API version
- DIET_MODE
This is a C engine build option, so we can set it here, not when we instantiate a new
Disassembler
. Diet mode means:-
No op_str or mnemonic in
Instruction
-
No regs_read, regs_write or groups ( even with detail on )
-
No reg_name or insn_name id2str convenience functions
-
detail mode CAN still be on - so the arch insn operands MAY be available
-
- GRP_CALL
- GRP_INT
- GRP_INVALID
Common instruction groups - to be consistent across all architectures.
- GRP_IRET
- GRP_JUMP
- GRP_PRIVILEGE
- GRP_RET
- MODE_16
- MODE_32
- MODE_64
- MODE_ARM
- MODE_BIG_ENDIAN
- MODE_LITTLE_ENDIAN
disasm mode
- MODE_M680X_6301
- MODE_M680X_6309
- MODE_M680X_6800
- MODE_M680X_6801
- MODE_M680X_6805
- MODE_M680X_6808
- MODE_M680X_6809
- MODE_M680X_6811
- MODE_M680X_CPU12
- MODE_M680X_HCS08
- MODE_M68K_000
- MODE_M68K_010
- MODE_M68K_020
- MODE_M68K_030
- MODE_M68K_040
- MODE_M68K_060
- MODE_MCLASS
- MODE_MICRO
- MODE_MIPS3
- MODE_MIPS32
- MODE_MIPS32R6
- MODE_MIPS64
- MODE_MIPSGP64
- MODE_MODE_MIPS2
- MODE_QPX
- MODE_THUMB
- MODE_V8
- MODE_V9
- OPT_DETAIL
- OPT_MEM
- OPT_MNEMONIC
- OPT_MODE
- OPT_OFF
Capstone option value
- OPT_ON
- OPT_SKIPDATA
- OPT_SKIPDATA_SETUP
- OPT_SYNTAX
Capstone option type
- OPT_SYNTAX_ATT
- OPT_SYNTAX_DEFAULT
Capstone syntax value
- OPT_SYNTAX_INTEL
- OPT_SYNTAX_MASM
- OPT_SYNTAX_NOREGNAME
- OPT_UNSIGNED
- OP_FP
- OP_IMM
- OP_INVALID
Common instruction operand types - to be consistent across all architectures.
- OP_MEM
- OP_REG
- SUPPORT_DIET
query id for cs_support()
- SUPPORT_X86_REDUCE
- VERSION
Public Instance Methods
Get the major version of capstone library.
@return [Integer]
Returns the major version of Capstone.
# File lib/crabstone/cs_version.rb, line 28 def cs_major_version cs_version.first end
@return [(Integer, Integer)]
# File lib/crabstone/cs_version.rb, line 33 def cs_version return @cs_version if defined?(@cs_version) maj = FFI::MemoryPointer.new(:int) min = FFI::MemoryPointer.new(:int) Binding.cs_version(maj, min) @cs_version = [maj.read_int, min.read_int] end
Checks the cs_major is less or equal to Crabstone::VERSION
.
# File lib/crabstone/cs_version.rb, line 43 def version_compatitable! @version_compatitable ||= cs_major_version <= Crabstone::BINDING_MAJ && cs_major_version >= 3 maj, min = cs_version raise "FATAL: Crabstone v#{VERSION} doesn't support binding Capstone v#{maj}.#{min}" unless @version_compatitable end
Since some constants/structures are different in different Capstone versions, some scripts in Crabstone
use this method to require the version-sensitive Ruby scripts. @param [String] path_tpl @return [Boolean] @example
version_require 'crabstone/binding/%v/structs' # equivalent to "require 'crabstone/binding/4/structs'" if Capstone is version 4.
# File lib/crabstone/cs_version.rb, line 18 def version_require(path_tpl) version_compatitable! path = path_tpl.gsub('%v', cs_major_version.to_s) require path end