Class
Instruction
public class Instruction: CustomStringConvertible
Base class for all disassembled instructions.
Provides access to basic information about an instruction, shared by all architectures. Disassembled instructions will always be of a platform-specific instruction class.
Relationships
Subclasses
PlatformInstructionBase
Base class for platform-specific instructions without registers.
Conforms To
CustomStringConvertible
Properties
registerType
var registerType: Any.Type?
The type for registers used in this architecture (if any).
This is an enumeration with values corresponding to the registers.
instructionType
var instructionType: InstructionType.Type
The type for instructions used in this architecture.
This is an enumeration with values corresponding to instruction mnemonics.
address
var address: UInt64
Address (EIP) of this instruction.
This information is available even when detail option is disabled.
size
var size: UInt16
Size of this instruction in bytes.
This information is available even when detail option is disabled.
bytes
var bytes: Data
Machine bytes of this instruction.
This information is available even when detail option is disabled.
mnemonic
var mnemonic: String
Textual representation of the instruction's mnemonic.
This information is available even when detail option is disabled.
operandsString
var operandsString: String
Textual representation of the instruction's operands.
This information is available even when detail option is disabled.
description
var description: String
Textual representation of the instruction, including its mnemonic and operands.
This information is available even when detail option is disabled.
hasDetail
var hasDetail: Bool
True if details are available for this instruction.
Details are available on instructions (not on skipped data) when disassembling in detail mode, by setting the appropriate option:
capstone.set(option: .detail(value: true))
baseGroups
var baseGroups: [InstructionGroup]
List of architecture-agnostic groups this instruction belongs to.
The list will be empty in any of these cases:
-
detail mode is off
-
capstone is built in diet mode
-
instruction groups are not implemented for this architecture See
groups
for architecture-specific groups.
groupNames
var groupNames: [String]
List of group names this instruction belongs to.
This API is only valid when detail mode is on (it's off by default). When in 'diet' mode, this API is irrelevant because engine does not store groups.
registerNamesAccessed
var registerNamesAccessed: (read: [String], written: [String])
Register names implicitly and explicitly accessed by this instruction.
This API is only valid when detail mode is on (it's off by default). When in 'diet' mode, this API is irrelevant because engine does not store registers.
registerNamesAccessedImplicitly
var registerNamesAccessedImplicitly: (read: [String], written: [String])
Register names implicitly accessed by this instruction.
This API is only valid when detail mode is on (it's off by default). When in 'diet' mode, this API is irrelevant because engine does not store registers.
Methods
isIn(group:)
public func isIn(group: InstructionGroup) -> Bool
Check if an instruction belong to a particular group.
This API is only valid when detail mode is on (it's off by default). When in 'diet' mode, this API is irrelevant because engine does not store groups.
Parameters
Name | Type | Description |
---|---|---|
group | InstructionGroup |
group to check. |
Returns
true
if the instruction belongs to this group, false
otherwise.