| IDA SDK

Public Attributes | Public Member Functions | List of all members
insn_t Class Reference

## Public Attributes
ea_t | cs = BADADDR
| Current segment base paragraph. Initialized by the kernel.
ea_t | ip = BADADDR
| Virtual address of the instruction (address within the segment). More...
ea_t | ea = BADADDR
| Linear address of the instruction. More...
uint16 | itype = 0
| Internal code of instruction (only for canonical insns - not user defined!). More...
uint16 | size = 0
| Size of instruction in bytes. More...
union {
uint32 auxpref
| processor dependent field
uint16 auxpref_u16 [2]
uint8 auxpref_u8 [4]
}; |
char | segpref = 0
| processor dependent field
char | insnpref = 0
| processor dependent field
int16 | flags = 0
| Instruction flags
op_t | ops [UA_MAXOP]
| array of operands

## Public Member Functions
bool | is_canon_insn (const processor_t &ph) const
| see processor_t::is_canon_insn()
uint32 | get_canon_feature (const processor_t &ph) const
| see instruc_t::feature
const char * | get_canon_mnem (const processor_t &ph) const
| see instruc_t::name
bool | is_macro (void) const
| Is a macro instruction?
bool | is_64bit (void) const
| Belongs to a 64bit segment?
void | add_cref (ea_t to, int opoff, cref_t type) const
| Add a code cross-reference from the instruction. More...
void | add_dref (ea_t to, int opoff, dref_t type) const
| Add a data cross-reference from the instruction. More...
ea_t | add_off_drefs (const op_t &x, dref_t type, int outf) const
| Add xrefs for an operand of the instruction. More...
Analysis helpers
The following functions return the next byte, 2 bytes, 4 bytes, and 8 bytes of insn. They use and modify the size field (\insn_t{size}). Normally they are used in the analyzer to get bytes of the instruction. Warning These methods work only for normal (8bit) byte processors!
uint8 | get_next_byte ()
uint16 | get_next_word ()
uint32 | get_next_dword ()
uint64 | get_next_qword ()
Emulator helpers
bool | create_op_data (ea_t ea_, int opoff, op_dtype_t dtype) const
| Convert to data using information about operand value type (op_t::dtype). More...
bool | create_op_data (ea_t ea_, const op_t &op) const
| Convenient alias.
bool | create_stkvar (const op_t &x, adiff_t v, int flags_) const
| Create or modify a stack variable in the function frame. More...

## Member Function Documentation

## ◆ create_op_data()

bool insn_t::create_op_data | ( | ea_t | ea_,
|  | int | opoff,
|  | op_dtype_t | dtype
| ) |  | const
| inline

Convert to data using information about operand value type (op_t::dtype).

Emulator could use this function to convert unexplored bytes to data when an instruction references them. This function creates data only if the address was unexplored.

Parameters

  ea_ | linear address to be converted to data
  opoff | offset of the operand from the start of instruction if the offset is unknown, then 0
  dtype | operand value type (from op_t::dtype)

Return values

  true | ok
  false | failed to create data item

## ◆ create_stkvar()

bool insn_t::create_stkvar | ( | const op_t & | x,
|  | adiff_t | v,
|  | int | flags_
| ) |  | const
| inline

Create or modify a stack variable in the function frame.

The emulator could use this function to create stack variables in the function frame before converting the operand to a stack variable. Please check with may_create_stkvars() before calling this function.

Parameters

  x | operand (used to determine the addressing type)
  v | a displacement in the operand
  flags_ | Stack variable flags

Return values

  1 | ok, a stack variable exists now
  0 | no, couldn't create stack variable

## Member Data Documentation

## ◆ ip

ea_t insn_t::ip = BADADDR

Virtual address of the instruction (address within the segment).

Initialized by the kernel.

## ◆ ea

ea_t insn_t::ea = BADADDR

Linear address of the instruction.

Initialized by the kernel.

## ◆ itype

uint16 insn_t::itype = 0

Internal code of instruction (only for canonical insns - not user defined!).

IDP should define its own instruction codes. These codes are usually defined in ins.hpp. The array of instruction names and features (ins.cpp) is accessed using this code.

## ◆ size

uint16 insn_t::size = 0

Size of instruction in bytes.

The analyzer should put here the actual size of the instruction.

The documentation for this class was generated from the following files:

- ua.hpp
- idp.hpp