Definition of a local variable (register or stack) #var #lvar. More...
#include <hexrays.hpp>

Public Member Functions | |
lvar_t (const qstring &n, const vdloc_t &l, ea_t e, const tinfo_t &t, int w, int db) | |
const char * | dstr () const |
bool | used (void) const |
Is the variable used in the code? More... | |
bool | typed (void) const |
Has the variable a type? More... | |
bool | mreg_done (void) const |
Have corresponding microregs been replaced by references to this variable? More... | |
bool | has_nice_name (void) const |
Does the variable have a nice name? More... | |
bool | is_unknown_width (void) const |
Do we know the width of the variable? More... | |
bool | has_user_info (void) const |
Has any user-defined information? More... | |
bool | has_user_name (void) const |
Has user-defined name? More... | |
bool | has_user_type (void) const |
Has user-defined type? More... | |
bool | is_result_var (void) const |
Is the function result? More... | |
bool | is_arg_var (void) const |
Is the function argument? More... | |
bool | is_promoted_arg (void) const |
Is the promoted function argument? More... | |
bool | is_fake_var (void) const |
Is fake return variable? More... | |
bool | is_overlapped_var (void) const |
Is overlapped variable? More... | |
bool | is_floating_var (void) const |
Used by a fpu insn? More... | |
bool | is_spoiled_var (void) const |
Is spoiled var? (meaningful only during lvar allocation) More... | |
bool | is_partialy_typed (void) const |
Variable type should be handled as a partial one. More... | |
bool | is_noptr_var (void) const |
Variable type should not be a pointer. More... | |
bool | is_mapdst_var (void) const |
Other variable(s) map to this var? More... | |
bool | is_thisarg (void) const |
Is 'this' argument of a C++ member function? More... | |
bool | is_forced_var (void) const |
Is a forced variable? More... | |
bool | has_regname (void) const |
Has a register name? (like _RAX) More... | |
bool | in_asm (void) const |
Is variable used in an instruction translated into __asm? More... | |
bool | is_dummy_arg (void) const |
Is a dummy argument (added to fill a hole in the argument list) More... | |
bool | is_notarg (void) const |
Is a local variable? (local variable cannot be an input argument) More... | |
bool | is_automapped (void) const |
Was the variable automatically mapped to another variable? More... | |
bool | is_used_byref (void) const |
Was the address of the variable taken? More... | |
bool | is_decl_unused (void) const |
Was declared as __unused by the user? See CVAR_UNUSED. More... | |
bool | is_shared (void) const |
Is lvar mapped to several chains. More... | |
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_noptr_var (void) |
void | clr_noptr_var (void) |
void | set_thisarg (void) |
void | clr_thisarg (void) |
void | set_forced_var (void) |
void | clr_forced_var (void) |
void | set_dummy_arg (void) |
void | clr_dummy_arg (void) |
void | set_notarg (void) |
void | clr_notarg (void) |
void | set_automapped (void) |
void | clr_automapped (void) |
void | set_used_byref (void) |
void | clr_used_byref (void) |
void | set_decl_unused (void) |
void | clr_decl_unused (void) |
void | set_shared (void) |
void | clr_shared (void) |
bool | has_common (const lvar_t &v) const |
Do variables overlap? More... | |
bool | has_common_bit (const vdloc_t &loc, asize_t width2) const |
Does the variable overlap with the specified location? More... | |
const tinfo_t & | type (void) const |
Get variable type. More... | |
tinfo_t & | type (void) |
bool | accepts_type (const tinfo_t &t, bool may_change_thisarg=false) |
Check if the variable accept the specified type. More... | |
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. More... | |
bool | set_width (int w, int svw_flags=0) |
Change the variable width. More... | |
void | append_list (const mba_t *mba, mlist_t *lst, bool pad_if_scattered=false) const |
Append local variable to mlist. More... | |
bool | is_aliasable (const mba_t *mba) const |
Is the variable aliasable? More... | |
![]() | |
lvar_locator_t (const vdloc_t &loc, ea_t ea) | |
sval_t | get_stkoff (void) const |
Get offset of the varialbe in the stack frame. More... | |
bool | is_reg1 (void) const |
Is variable located on one register? More... | |
bool | is_reg2 (void) const |
Is variable located on two registers? More... | |
bool | is_reg_var (void) const |
Is variable located on register(s)? More... | |
bool | is_stk_var (void) const |
Is variable located on the stack? More... | |
bool | is_scattered (void) const |
Is variable scattered? More... | |
mreg_t | get_reg1 (void) const |
Get the register number of the variable. More... | |
mreg_t | get_reg2 (void) const |
Get the number of the second register (works only for ALOC_REG2 lvars) More... | |
const scattered_aloc_t & | get_scattered (void) const |
Get information about scattered variable. More... | |
scattered_aloc_t & | get_scattered (void) |
DECLARE_COMPARISONS (lvar_locator_t) | |
const char * | dstr () const |
Public Attributes | |
qstring | name |
variable name. More... | |
qstring | cmt |
variable comment string More... | |
tinfo_t | tif |
variable type More... | |
int | width = 0 |
variable size in bytes More... | |
int | defblk = -1 |
first block defining the variable. More... | |
uint64 | divisor = 0 |
max known divisor of the variable More... | |
![]() | |
vdloc_t | location |
Variable location. More... | |
ea_t | defea |
Definition address. More... | |
Friends | |
class | mba_t |
Detailed Description
Definition of a local variable (register or stack) #var #lvar.
- Examples
- hexrays_sample18.cpp.
Definition at line 1171 of file hexrays.hpp.
Constructor & Destructor Documentation
◆ lvar_t() [1/2]
lvar_t::lvar_t | ( | void | ) |
Definition at line 1222 of file hexrays.hpp.
◆ 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 | ||
) |
Definition at line 1223 of file hexrays.hpp.
Member Function Documentation
◆ accepts_type()
bool lvar_t::accepts_type | ( | const tinfo_t & | t, |
bool | may_change_thisarg = false |
||
) |
Check if the variable accept the specified type.
Some types are forbidden (void, function types, wrong arrays, etc)
Definition at line 9989 of file hexrays.hpp.
◆ append_list()
Append local variable to mlist.
- Parameters
-
mba ptr to the current mba_t lst list to append to pad_if_scattered if true, append padding bytes in case of scattered lvar
Definition at line 10007 of file hexrays.hpp.
◆ clear_used()
void lvar_t::clear_used | ( | void | ) |
Definition at line 1291 of file hexrays.hpp.
◆ clr_arg_var()
void lvar_t::clr_arg_var | ( | void | ) |
Definition at line 1304 of file hexrays.hpp.
◆ clr_automapped()
void lvar_t::clr_automapped | ( | void | ) |
Definition at line 1328 of file hexrays.hpp.
◆ clr_decl_unused()
void lvar_t::clr_decl_unused | ( | void | ) |
Definition at line 1332 of file hexrays.hpp.
◆ clr_dummy_arg()
void lvar_t::clr_dummy_arg | ( | void | ) |
Definition at line 1324 of file hexrays.hpp.
◆ clr_fake_var()
void lvar_t::clr_fake_var | ( | void | ) |
Definition at line 1306 of file hexrays.hpp.
◆ clr_floating_var()
void lvar_t::clr_floating_var | ( | void | ) |
Definition at line 1310 of file hexrays.hpp.
◆ clr_forced_var()
void lvar_t::clr_forced_var | ( | void | ) |
Definition at line 1322 of file hexrays.hpp.
◆ clr_mapdst_var()
void lvar_t::clr_mapdst_var | ( | void | ) |
Definition at line 1314 of file hexrays.hpp.
◆ clr_mreg_done()
void lvar_t::clr_mreg_done | ( | void | ) |
Definition at line 1300 of file hexrays.hpp.
◆ clr_noptr_var()
void lvar_t::clr_noptr_var | ( | void | ) |
Definition at line 1318 of file hexrays.hpp.
◆ clr_notarg()
void lvar_t::clr_notarg | ( | void | ) |
Definition at line 1326 of file hexrays.hpp.
◆ clr_overlapped_var()
void lvar_t::clr_overlapped_var | ( | void | ) |
Definition at line 1308 of file hexrays.hpp.
◆ clr_partialy_typed()
void lvar_t::clr_partialy_typed | ( | void | ) |
Definition at line 1316 of file hexrays.hpp.
◆ clr_shared()
void lvar_t::clr_shared | ( | void | ) |
Definition at line 1334 of file hexrays.hpp.
◆ clr_spoiled_var()
void lvar_t::clr_spoiled_var | ( | void | ) |
Definition at line 1312 of file hexrays.hpp.
◆ clr_thisarg()
void lvar_t::clr_thisarg | ( | void | ) |
Definition at line 1320 of file hexrays.hpp.
◆ clr_unknown_width()
void lvar_t::clr_unknown_width | ( | void | ) |
Definition at line 1302 of file hexrays.hpp.
◆ clr_used_byref()
void lvar_t::clr_used_byref | ( | void | ) |
Definition at line 1330 of file hexrays.hpp.
◆ clr_user_info()
void lvar_t::clr_user_info | ( | void | ) |
Definition at line 1294 of file hexrays.hpp.
◆ clr_user_name()
void lvar_t::clr_user_name | ( | void | ) |
Definition at line 1298 of file hexrays.hpp.
◆ clr_user_type()
void lvar_t::clr_user_type | ( | void | ) |
Definition at line 1297 of file hexrays.hpp.
◆ dstr()
const char * lvar_t::dstr | ( | void | ) | const |
Definition at line 9977 of file hexrays.hpp.
◆ has_common()
bool lvar_t::has_common | ( | const lvar_t & | v | ) | const |
Do variables overlap?
Definition at line 1337 of file hexrays.hpp.
References arglocs_overlap(), lvar_locator_t::location, and width.
◆ has_common_bit()
bool lvar_t::has_common_bit | ( | const vdloc_t & | loc, |
asize_t | width2 | ||
) | const |
Does the variable overlap with the specified location?
Definition at line 1342 of file hexrays.hpp.
References arglocs_overlap().
◆ has_nice_name()
bool lvar_t::has_nice_name | ( | void | ) | const |
Does the variable have a nice name?
Definition at line 1237 of file hexrays.hpp.
References CVAR_NAME.
◆ has_regname()
bool lvar_t::has_regname | ( | void | ) | const |
Has a register name? (like _RAX)
Definition at line 1275 of file hexrays.hpp.
References CVAR_REGNAME.
◆ has_user_info()
bool lvar_t::has_user_info | ( | void | ) | const |
Has any user-defined information?
Definition at line 1241 of file hexrays.hpp.
References CVAR_NOPTR, CVAR_UNAME, CVAR_UNUSED, and CVAR_UTYPE.
◆ has_user_name()
bool lvar_t::has_user_name | ( | void | ) | const |
◆ has_user_type()
bool lvar_t::has_user_type | ( | void | ) | const |
◆ in_asm()
bool lvar_t::in_asm | ( | void | ) | const |
Is variable used in an instruction translated into __asm?
Definition at line 1277 of file hexrays.hpp.
References CVAR_INASM.
◆ is_aliasable()
bool lvar_t::is_aliasable | ( | const mba_t * | mba | ) | const |
Is the variable aliasable?
- Parameters
-
mba ptr to the current mba_t Aliasable variables may be modified indirectly (through a pointer)
Definition at line 1393 of file hexrays.hpp.
◆ is_arg_var()
bool lvar_t::is_arg_var | ( | void | ) | const |
◆ is_automapped()
bool lvar_t::is_automapped | ( | void | ) | const |
Was the variable automatically mapped to another variable?
Definition at line 1283 of file hexrays.hpp.
References CVAR_AUTOMAP.
◆ is_decl_unused()
bool lvar_t::is_decl_unused | ( | void | ) | const |
Was declared as __unused by the user? See CVAR_UNUSED.
Definition at line 1287 of file hexrays.hpp.
References CVAR_UNUSED.
◆ is_dummy_arg()
bool lvar_t::is_dummy_arg | ( | void | ) | const |
Is a dummy argument (added to fill a hole in the argument list)
Definition at line 1279 of file hexrays.hpp.
References CVAR_DUMMY.
◆ is_fake_var()
bool lvar_t::is_fake_var | ( | void | ) | const |
◆ is_floating_var()
bool lvar_t::is_floating_var | ( | void | ) | const |
◆ is_forced_var()
bool lvar_t::is_forced_var | ( | void | ) | const |
◆ is_mapdst_var()
bool lvar_t::is_mapdst_var | ( | void | ) | const |
Other variable(s) map to this var?
Definition at line 1269 of file hexrays.hpp.
References CVAR_MAPDST.
◆ is_noptr_var()
bool lvar_t::is_noptr_var | ( | void | ) | const |
Variable type should not be a pointer.
Definition at line 1267 of file hexrays.hpp.
References CVAR_NOPTR.
◆ is_notarg()
bool lvar_t::is_notarg | ( | void | ) | const |
Is a local variable? (local variable cannot be an input argument)
Definition at line 1281 of file hexrays.hpp.
References CVAR_NOTARG.
◆ is_overlapped_var()
bool lvar_t::is_overlapped_var | ( | void | ) | const |
◆ is_partialy_typed()
bool lvar_t::is_partialy_typed | ( | void | ) | const |
Variable type should be handled as a partial one.
Definition at line 1265 of file hexrays.hpp.
References CVAR_PARTIAL.
◆ is_promoted_arg()
bool lvar_t::is_promoted_arg | ( | void | ) | const |
Is the promoted function argument?
Definition at line 9983 of file hexrays.hpp.
◆ is_result_var()
bool lvar_t::is_result_var | ( | void | ) | const |
◆ is_shared()
bool lvar_t::is_shared | ( | void | ) | const |
Is lvar mapped to several chains.
Definition at line 1289 of file hexrays.hpp.
References CVAR_SHARED.
◆ is_spoiled_var()
bool lvar_t::is_spoiled_var | ( | void | ) | const |
Is spoiled var? (meaningful only during lvar allocation)
Definition at line 1263 of file hexrays.hpp.
References CVAR_SPOILED.
◆ is_thisarg()
bool lvar_t::is_thisarg | ( | void | ) | const |
Is 'this' argument of a C++ member function?
Definition at line 1271 of file hexrays.hpp.
References CVAR_THISARG.
◆ is_unknown_width()
bool lvar_t::is_unknown_width | ( | void | ) | const |
Do we know the width of the variable?
Definition at line 1239 of file hexrays.hpp.
References CVAR_NOWD.
◆ is_used_byref()
bool lvar_t::is_used_byref | ( | void | ) | const |
Was the address of the variable taken?
Definition at line 1285 of file hexrays.hpp.
References CVAR_BYREF.
◆ mreg_done()
bool lvar_t::mreg_done | ( | void | ) | const |
Have corresponding microregs been replaced by references to this variable?
Definition at line 1235 of file hexrays.hpp.
References CVAR_MREG.
◆ set_arg_var()
void lvar_t::set_arg_var | ( | void | ) |
Definition at line 1303 of file hexrays.hpp.
◆ set_automapped()
void lvar_t::set_automapped | ( | void | ) |
Definition at line 1327 of file hexrays.hpp.
◆ set_decl_unused()
void lvar_t::set_decl_unused | ( | void | ) |
Definition at line 1331 of file hexrays.hpp.
◆ set_dummy_arg()
void lvar_t::set_dummy_arg | ( | void | ) |
Definition at line 1323 of file hexrays.hpp.
◆ set_fake_var()
void lvar_t::set_fake_var | ( | void | ) |
Definition at line 1305 of file hexrays.hpp.
◆ set_final_lvar_type()
void lvar_t::set_final_lvar_type | ( | const tinfo_t & | t | ) |
Set final variable type.
Definition at line 1366 of file hexrays.hpp.
◆ set_floating_var()
void lvar_t::set_floating_var | ( | void | ) |
Definition at line 1309 of file hexrays.hpp.
◆ set_forced_var()
void lvar_t::set_forced_var | ( | void | ) |
Definition at line 1321 of file hexrays.hpp.
◆ 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() 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
-
t new type may_fail if false and type is bad, interr
- Returns
- success
Definition at line 9995 of file hexrays.hpp.
◆ set_mapdst_var()
void lvar_t::set_mapdst_var | ( | void | ) |
Definition at line 1313 of file hexrays.hpp.
◆ set_mreg_done()
void lvar_t::set_mreg_done | ( | void | ) |
Definition at line 1299 of file hexrays.hpp.
◆ set_non_typed()
void lvar_t::set_non_typed | ( | void | ) |
Definition at line 1293 of file hexrays.hpp.
◆ set_noptr_var()
void lvar_t::set_noptr_var | ( | void | ) |
Definition at line 1317 of file hexrays.hpp.
◆ set_notarg()
void lvar_t::set_notarg | ( | void | ) |
Definition at line 1325 of file hexrays.hpp.
◆ set_overlapped_var()
void lvar_t::set_overlapped_var | ( | void | ) |
Definition at line 1307 of file hexrays.hpp.
◆ set_partialy_typed()
void lvar_t::set_partialy_typed | ( | void | ) |
Definition at line 1315 of file hexrays.hpp.
◆ set_shared()
void lvar_t::set_shared | ( | void | ) |
Definition at line 1333 of file hexrays.hpp.
◆ set_spoiled_var()
void lvar_t::set_spoiled_var | ( | void | ) |
Definition at line 1311 of file hexrays.hpp.
◆ set_thisarg()
void lvar_t::set_thisarg | ( | void | ) |
Definition at line 1319 of file hexrays.hpp.
◆ set_typed()
void lvar_t::set_typed | ( | void | ) |
Definition at line 1292 of file hexrays.hpp.
◆ set_unknown_width()
void lvar_t::set_unknown_width | ( | void | ) |
Definition at line 1301 of file hexrays.hpp.
◆ set_used()
void lvar_t::set_used | ( | void | ) |
Definition at line 1290 of file hexrays.hpp.
◆ set_used_byref()
void lvar_t::set_used_byref | ( | void | ) |
Definition at line 1329 of file hexrays.hpp.
◆ set_user_name()
void lvar_t::set_user_name | ( | void | ) |
Definition at line 1295 of file hexrays.hpp.
◆ set_user_type()
void lvar_t::set_user_type | ( | void | ) |
Definition at line 1296 of file hexrays.hpp.
◆ set_width()
bool lvar_t::set_width | ( | int | w, |
int | svw_flags = 0 |
||
) |
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
-
w new width svw_flags combination of SVW_... bits
- Returns
- success
Definition at line 10001 of file hexrays.hpp.
◆ type() [1/2]
tinfo_t & lvar_t::type | ( | void | ) |
Definition at line 1348 of file hexrays.hpp.
◆ type() [2/2]
const tinfo_t & lvar_t::type | ( | void | ) | const |
Get variable type.
Definition at line 1347 of file hexrays.hpp.
◆ typed()
bool lvar_t::typed | ( | void | ) | const |
◆ used()
bool lvar_t::used | ( | void | ) | const |
Is the variable used in the code?
Definition at line 1231 of file hexrays.hpp.
References CVAR_USED.
Friends And Related Function Documentation
◆ mba_t
|
friend |
Definition at line 1173 of file hexrays.hpp.
Member Data Documentation
◆ cmt
qstring lvar_t::cmt |
variable comment string
Definition at line 1215 of file hexrays.hpp.
◆ defblk
int lvar_t::defblk = -1 |
first block defining the variable.
0 for args, -1 if unknown
Definition at line 1218 of file hexrays.hpp.
◆ divisor
uint64 lvar_t::divisor = 0 |
max known divisor of the variable
Definition at line 1220 of file hexrays.hpp.
◆ name
qstring lvar_t::name |
variable name.
use mba_t::set_nice_lvar_name() and mba_t::set_user_lvar_name() to modify it
Definition at line 1212 of file hexrays.hpp.
◆ tif
tinfo_t lvar_t::tif |
variable type
Definition at line 1216 of file hexrays.hpp.
◆ width
int lvar_t::width = 0 |