Hex-Rays logo State-of-the-art binary code analysis tools
email icon

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?
 
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...
 
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...
 

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
 

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
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

◆ 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
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

◆ add_cref()

void insn_t::add_cref ( ea_t  to,
int  opoff,
cref_t  type 
) const
inline

Add a code cross-reference from the instruction.

Parameters
opoffoffset of the operand from the start of instruction. if the offset is unknown, then 0.
totarget linear address
typetype of xref

◆ add_dref()

void insn_t::add_dref ( ea_t  to,
int  opoff,
dref_t  type 
) const
inline

Add a data cross-reference from the instruction.

See add_off_drefs() - usually it can be used in most cases.

Parameters
opoffoffset of the operand from the start of instruction if the offset is unknown, then 0
totarget linear address
typetype of xref

◆ add_off_drefs()

ea_t insn_t::add_off_drefs ( const op_t x,
dref_t  type,
int  outf 
) const
inline

Add xrefs for an operand of the instruction.

This function creates all cross references for 'enum', 'offset' and 'structure offset' operands. Use add_off_drefs() in the presence of negative offsets.

Parameters
xreference to operand
typetype of xref
outfout_value() flags. These flags should match the flags used to output the operand
Returns
if is_off(): the reference target address (the same as calc_reference_data). if is_stroff(): BADADDR because for stroffs the target address is unknown else: BADADDR because enums do not represent addresses

Member Data Documentation

◆ ip

ea_t insn_t::ip

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

Initialized by the kernel.

◆ ea

ea_t insn_t::ea

Linear address of the instruction.

Initialized by the kernel.

◆ itype

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.

◆ size

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: