IDA C++ SDK 9.2
Loading...
Searching...
No Matches
lvar_t Class Reference

Definition of a local variable (register or stack) #var #lvar. More...

#include <hexrays.hpp>

Inheritance diagram for lvar_t:
lvar_locator_t

Public Member Functions

 lvar_t ()
 lvar_t (const qstring &n, const vdloc_t &l, ea_t e, const tinfo_t &t, int w, int db)
const char *hexapi dstr () const
bool used () const
 Is the variable used in the code?
bool typed () const
 Has the variable a type?
bool mreg_done () const
 Have corresponding microregs been replaced by references to this variable?
bool has_nice_name () const
 Does the variable have a nice name?
bool is_unknown_width () const
 Do we know the width of the variable?
bool has_user_info () const
 Has any user-defined information?
bool has_user_name () const
 Has user-defined name?
bool has_user_type () const
 Has user-defined type?
bool is_result_var () const
 Is the function result?
bool is_arg_var () const
 Is the function argument?
bool hexapi is_promoted_arg () const
 Is the promoted function argument?
bool is_fake_var () const
 Is fake return variable?
bool is_overlapped_var () const
 Is overlapped variable?
bool is_floating_var () const
 Used by a fpu insn?
bool is_spoiled_var () const
 Is spoiled var? (meaningful only during lvar allocation)
bool is_partialy_typed () const
 Variable type should be handled as a partial one.
bool is_noptr_var () const
 Variable type should not be a pointer.
bool is_mapdst_var () const
 Other variable(s) map to this var?
bool is_thisarg () const
 Is 'this' argument of a C++ member function?
bool is_split_var () const
 Is a split variable?
bool has_regname () const
 Has a register name? (like _RAX)
bool in_asm () const
 Is variable used in an instruction translated into __asm?
bool is_dummy_arg () const
 Is a dummy argument (added to fill a hole in the argument list)
bool is_notarg () const
 Is a local variable? (local variable cannot be an input argument)
bool is_automapped () const
 Was the variable automatically mapped to another variable?
bool is_used_byref () const
 Was the address of the variable taken?
bool is_decl_unused () const
 Was declared as __unused by the user? See CVAR_UNUSED.
bool is_shared () const
 Is lvar mapped to several chains.
bool was_scattered_arg () const
 Was lvar transformed from a scattered argument?
void set_used ()
void clear_used ()
void set_typed ()
void set_non_typed ()
void clr_user_info ()
void set_user_name ()
void set_user_type ()
void clr_user_type ()
void clr_user_name ()
void set_mreg_done ()
void clr_mreg_done ()
void set_unknown_width ()
void clr_unknown_width ()
void set_arg_var ()
void clr_arg_var ()
void set_fake_var ()
void clr_fake_var ()
void set_overlapped_var ()
void clr_overlapped_var ()
void set_floating_var ()
void clr_floating_var ()
void set_spoiled_var ()
void clr_spoiled_var ()
void set_mapdst_var ()
void clr_mapdst_var ()
void set_partialy_typed ()
void clr_partialy_typed ()
void set_noptr_var ()
void clr_noptr_var ()
void set_thisarg ()
void clr_thisarg ()
void set_split_var ()
void clr_split_var ()
void set_dummy_arg ()
void clr_dummy_arg ()
void set_notarg ()
void clr_notarg ()
void set_automapped ()
void clr_automapped ()
void set_used_byref ()
void clr_used_byref ()
void set_decl_unused ()
void clr_decl_unused ()
void set_shared ()
void clr_shared ()
void set_scattered_arg ()
void clr_scattered_arg ()
bool has_common (const lvar_t &v) const
 Do variables overlap?
bool has_common_bit (const vdloc_t &loc, asize_t width2) const
 Does the variable overlap with the specified location?
const tinfo_ttype () const
 Get variable type.
tinfo_ttype ()
bool hexapi accepts_type (const tinfo_t &t, bool may_change_thisarg=false)
 Check if the variable accept the specified type.
bool hexapi set_lvar_type (const tinfo_t &t, bool may_fail=false)
 Set variable type Note: this function does not modify the idb, only the lvar instance in the memory.
void set_final_lvar_type (const tinfo_t &t)
 Set final variable type.
bool hexapi set_width (int w, int svw_flags=0)
 Change the variable width.
void hexapi append_list (const mba_t *mba, mlist_t *lst, bool pad_if_scattered=false) const
 Append local variable to mlist.
bool is_aliasable (const mba_t *mba) const
 Is the variable aliasable?
Public Member Functions inherited from lvar_locator_t
 lvar_locator_t ()
 lvar_locator_t (const vdloc_t &loc, ea_t ea)
sval_t get_stkoff () const
 Get offset of the varialbe in the stack frame.
bool is_reg1 () const
 Is variable located on one register?
bool is_reg2 () const
 Is variable located on two registers?
bool is_reg_var () const
 Is variable located on register(s)?
bool is_stk_var () const
 Is variable located on the stack?
bool is_scattered () const
 Is variable scattered?
mreg_t get_reg1 () const
 Get the register number of the variable.
mreg_t get_reg2 () const
 Get the number of the second register (works only for ALOC_REG2 lvars)
const scattered_aloc_tget_scattered () const
 Get information about scattered variable.
scattered_aloc_tget_scattered ()
 DECLARE_COMPARISONS (lvar_locator_t)
 HEXRAYS_MEMORY_ALLOCATION_FUNCS () const char *hexapi dstr() const

Public Attributes

qstring name
 variable name.
qstring cmt
 variable comment string
tinfo_t tif
 variable type
int width = 0
 variable size in bytes
int defblk = -1
 first block defining the variable.
uint64 divisor = 0
 max known divisor of the variable
Public Attributes inherited from lvar_locator_t
vdloc_t location
 Variable location.
ea_t defea = BADADDR
 Definition address.

Friends

class mba_t

Detailed Description

Definition of a local variable (register or stack) #var #lvar.

Constructor & Destructor Documentation

◆ lvar_t() [1/2]

lvar_t::lvar_t ( )
inline

◆ lvar_t() [2/2]

lvar_t::lvar_t ( const qstring & n,
const vdloc_t & l,
ea_t e,
const tinfo_t & t,
int w,
int db )
inline

Member Function Documentation

◆ dstr()

const char * lvar_t::dstr ( ) const
inline

◆ used()

bool lvar_t::used ( ) const
inline

Is the variable used in the code?

◆ typed()

bool lvar_t::typed ( ) const
inline

Has the variable a type?

◆ mreg_done()

bool lvar_t::mreg_done ( ) const
inline

Have corresponding microregs been replaced by references to this variable?

◆ has_nice_name()

bool lvar_t::has_nice_name ( ) const
inline

Does the variable have a nice name?

◆ is_unknown_width()

bool lvar_t::is_unknown_width ( ) const
inline

Do we know the width of the variable?

◆ has_user_info()

bool lvar_t::has_user_info ( ) const
inline

Has any user-defined information?

◆ has_user_name()

bool lvar_t::has_user_name ( ) const
inline

Has user-defined name?

◆ has_user_type()

bool lvar_t::has_user_type ( ) const
inline

Has user-defined type?

◆ is_result_var()

bool lvar_t::is_result_var ( ) const
inline

Is the function result?

◆ is_arg_var()

bool lvar_t::is_arg_var ( ) const
inline

Is the function argument?

◆ is_promoted_arg()

bool lvar_t::is_promoted_arg ( ) const
inline

Is the promoted function argument?

◆ is_fake_var()

bool lvar_t::is_fake_var ( ) const
inline

Is fake return variable?

◆ is_overlapped_var()

bool lvar_t::is_overlapped_var ( ) const
inline

Is overlapped variable?

◆ is_floating_var()

bool lvar_t::is_floating_var ( ) const
inline

Used by a fpu insn?

◆ is_spoiled_var()

bool lvar_t::is_spoiled_var ( ) const
inline

Is spoiled var? (meaningful only during lvar allocation)

◆ is_partialy_typed()

bool lvar_t::is_partialy_typed ( ) const
inline

Variable type should be handled as a partial one.

◆ is_noptr_var()

bool lvar_t::is_noptr_var ( ) const
inline

Variable type should not be a pointer.

◆ is_mapdst_var()

bool lvar_t::is_mapdst_var ( ) const
inline

Other variable(s) map to this var?

◆ is_thisarg()

bool lvar_t::is_thisarg ( ) const
inline

Is 'this' argument of a C++ member function?

◆ is_split_var()

bool lvar_t::is_split_var ( ) const
inline

Is a split variable?

◆ has_regname()

bool lvar_t::has_regname ( ) const
inline

Has a register name? (like _RAX)

◆ in_asm()

bool lvar_t::in_asm ( ) const
inline

Is variable used in an instruction translated into __asm?

◆ is_dummy_arg()

bool lvar_t::is_dummy_arg ( ) const
inline

Is a dummy argument (added to fill a hole in the argument list)

◆ is_notarg()

bool lvar_t::is_notarg ( ) const
inline

Is a local variable? (local variable cannot be an input argument)

◆ is_automapped()

bool lvar_t::is_automapped ( ) const
inline

Was the variable automatically mapped to another variable?

◆ is_used_byref()

bool lvar_t::is_used_byref ( ) const
inline

Was the address of the variable taken?

◆ is_decl_unused()

bool lvar_t::is_decl_unused ( ) const
inline

Was declared as __unused by the user? See CVAR_UNUSED.

◆ is_shared()

bool lvar_t::is_shared ( ) const
inline

Is lvar mapped to several chains.

◆ was_scattered_arg()

bool lvar_t::was_scattered_arg ( ) const
inline

Was lvar transformed from a scattered argument?

◆ set_used()

void lvar_t::set_used ( )
inline

◆ clear_used()

void lvar_t::clear_used ( )
inline

◆ set_typed()

void lvar_t::set_typed ( )
inline

◆ set_non_typed()

void lvar_t::set_non_typed ( )
inline

◆ clr_user_info()

void lvar_t::clr_user_info ( )
inline

◆ set_user_name()

void lvar_t::set_user_name ( )
inline

◆ set_user_type()

void lvar_t::set_user_type ( )
inline

◆ clr_user_type()

void lvar_t::clr_user_type ( )
inline

◆ clr_user_name()

void lvar_t::clr_user_name ( )
inline

◆ set_mreg_done()

void lvar_t::set_mreg_done ( )
inline

◆ clr_mreg_done()

void lvar_t::clr_mreg_done ( )
inline

◆ set_unknown_width()

void lvar_t::set_unknown_width ( )
inline

◆ clr_unknown_width()

void lvar_t::clr_unknown_width ( )
inline

◆ set_arg_var()

void lvar_t::set_arg_var ( )
inline

◆ clr_arg_var()

void lvar_t::clr_arg_var ( )
inline

◆ set_fake_var()

void lvar_t::set_fake_var ( )
inline

◆ clr_fake_var()

void lvar_t::clr_fake_var ( )
inline

◆ set_overlapped_var()

void lvar_t::set_overlapped_var ( )
inline

◆ clr_overlapped_var()

void lvar_t::clr_overlapped_var ( )
inline

◆ set_floating_var()

void lvar_t::set_floating_var ( )
inline

◆ clr_floating_var()

void lvar_t::clr_floating_var ( )
inline

◆ set_spoiled_var()

void lvar_t::set_spoiled_var ( )
inline

◆ clr_spoiled_var()

void lvar_t::clr_spoiled_var ( )
inline

◆ set_mapdst_var()

void lvar_t::set_mapdst_var ( )
inline

◆ clr_mapdst_var()

void lvar_t::clr_mapdst_var ( )
inline

◆ set_partialy_typed()

void lvar_t::set_partialy_typed ( )
inline

◆ clr_partialy_typed()

void lvar_t::clr_partialy_typed ( )
inline

◆ set_noptr_var()

void lvar_t::set_noptr_var ( )
inline

◆ clr_noptr_var()

void lvar_t::clr_noptr_var ( )
inline

◆ set_thisarg()

void lvar_t::set_thisarg ( )
inline

◆ clr_thisarg()

void lvar_t::clr_thisarg ( )
inline

◆ set_split_var()

void lvar_t::set_split_var ( )
inline

◆ clr_split_var()

void lvar_t::clr_split_var ( )
inline

◆ set_dummy_arg()

void lvar_t::set_dummy_arg ( )
inline

◆ clr_dummy_arg()

void lvar_t::clr_dummy_arg ( )
inline

◆ set_notarg()

void lvar_t::set_notarg ( )
inline

◆ clr_notarg()

void lvar_t::clr_notarg ( )
inline

◆ set_automapped()

void lvar_t::set_automapped ( )
inline

◆ clr_automapped()

void lvar_t::clr_automapped ( )
inline

◆ set_used_byref()

void lvar_t::set_used_byref ( )
inline

◆ clr_used_byref()

void lvar_t::clr_used_byref ( )
inline

◆ set_decl_unused()

void lvar_t::set_decl_unused ( )
inline

◆ clr_decl_unused()

void lvar_t::clr_decl_unused ( )
inline

◆ set_shared()

void lvar_t::set_shared ( )
inline

◆ clr_shared()

void lvar_t::clr_shared ( )
inline

◆ set_scattered_arg()

void lvar_t::set_scattered_arg ( )
inline

◆ clr_scattered_arg()

void lvar_t::clr_scattered_arg ( )
inline

◆ has_common()

bool lvar_t::has_common ( const lvar_t & v) const
inline

Do variables overlap?

◆ has_common_bit()

bool lvar_t::has_common_bit ( const vdloc_t & loc,
asize_t width2 ) const
inline

Does the variable overlap with the specified location?

◆ type() [1/2]

const tinfo_t & lvar_t::type ( ) const
inline

Get variable type.

◆ type() [2/2]

tinfo_t & lvar_t::type ( )
inline

◆ accepts_type()

bool lvar_t::accepts_type ( const tinfo_t & t,
bool may_change_thisarg = false )
inline

Check if the variable accept the specified type.

Some types are forbidden (void, function types, wrong arrays, etc)

◆ set_lvar_type()

bool lvar_t::set_lvar_type ( const tinfo_t & t,
bool may_fail = false )
inline

Set variable type Note: this function does not modify the idb, only the lvar instance in the memory.

For permanent changes see modify_user_lvars() Also, the variable type is not considered as final by the decompiler and may be modified later by the type derivation. In some cases set_final_var_type() may work better, but it does not do persistent changes to the database neither.

Parameters
tnew type
may_failif false and type is bad, interr
Returns
success

◆ set_final_lvar_type()

void lvar_t::set_final_lvar_type ( const tinfo_t & t)
inline

Set final variable type.

◆ set_width()

bool lvar_t::set_width ( int w,
int svw_flags = 0 )
inline

Change the variable width.

We call the variable size 'width', it is represents the number of bytes. This function may change the variable type using set_lvar_type().

Parameters
wnew width
svw_flagscombination of SVW_... bits
Returns
success

◆ append_list()

void lvar_t::append_list ( const mba_t * mba,
mlist_t * lst,
bool pad_if_scattered = false ) const
inline

Append local variable to mlist.

Parameters
mbaptr to the current mba_t
lstlist to append to
pad_if_scatteredif true, append padding bytes in case of scattered lvar

◆ is_aliasable()

bool lvar_t::is_aliasable ( const mba_t * mba) const
inline

Is the variable aliasable?

Parameters
mbaptr to the current mba_t Aliasable variables may be modified indirectly (through a pointer)

◆ mba_t

friend class mba_t
friend

Member Data Documentation

◆ name

qstring lvar_t::name

variable name.

use mba_t::set_nice_lvar_name() and mba_t::set_user_lvar_name() to modify it

◆ cmt

qstring lvar_t::cmt

variable comment string

◆ tif

tinfo_t lvar_t::tif

variable type

◆ width

int lvar_t::width = 0

variable size in bytes

◆ defblk

int lvar_t::defblk = -1

first block defining the variable.

0 for args, -1 if unknown

◆ divisor

uint64 lvar_t::divisor = 0

max known divisor of the variable


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