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

Public Attributes

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

Public Member Functions

bool is_canon_insn (void) const
 see processor_t::is_canon_insn()
 
uint32 get_canon_feature (void) const
 see instruc_t::feature
 
const char * get_canon_mnem (void) const
 see instruc_t::name
 
bool is_macro (void) const
 Is a macro instruction?
 
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 ({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

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
ealinear address to be converted to data
opoffoffset of the operand from the start of instruction if the offset is unknown, then 0
dtypeoperand value type (from op_t::dtype)
Return values
trueok
falsefailed to create data item
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
xoperand (used to determine the addressing type)
va displacement in the operand
flags_Stack variable flags
Return values
1ok, a stack variable exists now
0no, couldn't create stack variable

Member Data Documentation

ea_t insn_t::ip

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

Initialized by the kernel.

ea_t insn_t::ea

Linear address of the instruction.

Initialized by the kernel.

uint16 insn_t::itype

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.

uint16 insn_t::size

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: