lvar_t Class Reference

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

Inheritance diagram for lvar_t:

Public Member Functions

 lvar_t (const qstring &n, const vdloc_t &l, ea_t e, const tinfo_t &t, int w, int db)
 lvar_t (mreg_t reg, int width, const tinfo_t &type, int nblock, ea_t defea)
const char * dstr (void) const
bool used (void) const
 Is the variable used in the code?
bool typed (void) const
 Has the variable a type?
bool mreg_done (void) const
 Have corresponding microregs been replaced by references to this variable?
bool has_nice_name (void) const
 Does the variable have a nice name?
bool is_unknown_width (void) const
 Do we know the width of the variable?
bool has_user_info (void) const
 Has any user-defined information?
bool has_user_name (void) const
 Has user-defined name?
bool has_user_type (void) const
 Has user-defined type?
bool is_result_var (void) const
 Is the function result?
bool is_arg_var (void) const
 Is the function argument?
bool is_promoted_arg (void) const
 Is the promoted function argument?
bool is_fake_var (void) const
 Is fake return variable?
bool is_overlapped_var (void) const
 Is overlapped variable?
bool is_floating_var (void) const
 Used by a fpu insn?
bool is_spoiled_var (void) const
 Is spoiled var? (meaningful only during lvar allocation)
bool is_partialy_typed (void) const
 Other variable(s) map to this var?
bool is_mapdst_var (void) const
 Other variable(s) map to this var?
void set_used (void)
void clear_used (void)
void set_typed (void)
void set_non_typed (void)
void clr_user_info (void)
void set_user_name (void)
void set_user_type (void)
void clr_user_type (void)
void clr_user_name (void)
void set_mreg_done (void)
void clr_mreg_done (void)
void set_unknown_width (void)
void clr_unknown_width (void)
void set_arg_var (void)
void clr_arg_var (void)
void set_fake_var (void)
void clr_fake_var (void)
void set_overlapped_var (void)
void clr_overlapped_var (void)
void set_floating_var (void)
void clr_floating_var (void)
void set_spoiled_var (void)
void clr_spoiled_var (void)
void set_mapdst_var (void)
void clr_mapdst_var (void)
void set_partialy_typed (void)
void clr_partialy_typed (void)
void set_reg_name (const char *n)
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_t & type (void) const
 Get variable type.
tinfo_t & type (void)
bool accepts_type (const tinfo_t &t)
 Check if the variable accept the specified type. More...
void force_lvar_type (const tinfo_t &t)
 Set variable type without any validation.
bool 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. More...
void set_final_lvar_type (const tinfo_t &t)
 Set final variable type.
bool set_width (int w, int svw_flags=0)
 Change the variable width. More...
- Public Member Functions inherited from lvar_locator_t
 lvar_locator_t (const vdloc_t &loc, ea_t ea)
sval_t get_regnum (void) const
 Calculate the variable location (only for continuous variables) More...
bool is_reg1 (void) const
 Is variable located on one register?
bool is_reg2 (void) const
 Is variable located on two registers?
bool is_reg_var (void) const
 Is variable located on register(s)?
bool is_stk_var (void) const
 Is variable located on the stack?
bool is_scattered (void) const
 Is variable scattered?
mreg_t get_reg1 (void) const
 Get number of the register for the variable.
mreg_t get_reg2 (void) const
 Get number of the second register (only for tworeg lvars)
const scattered_aloc_t & get_scattered (void) const
 Get information about scattered variable.
scattered_aloc_t & get_scattered (void)
 DECLARE_COMPARISONS (lvar_locator_t)
const char * dstr (void) const

Public Attributes

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


class mbl_array_t

Detailed Description

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

Definition at line 866 of file hexrays.hpp.

Member Function Documentation

◆ accepts_type()

bool lvar_t::accepts_type ( const tinfo_t &  t)

Check if the variable accept the specified type.

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

Definition at line 7223 of file hexrays.hpp.

References hexdsp.

◆ set_lvar_type()

bool lvar_t::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.

for permanent changes see modify_user_lvars()

tnew type
may_failif false and type is bad, interr

Definition at line 7229 of file hexrays.hpp.

References hexdsp.

◆ set_width()

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

Change the variable width.

This function also changes the variable type.

wnew width
svw_flagscombination of SVW_... bits

Definition at line 7235 of file hexrays.hpp.

References hexdsp.

Member Data Documentation

◆ defblk

int lvar_t::defblk

first block defining the variable.

0 for args, -1 if unknown

Definition at line 897 of file hexrays.hpp.

◆ name

qstring lvar_t::name

variable name.

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

Definition at line 891 of file hexrays.hpp.