Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | rz_il_var_t |
Definition of a variable inside the vm. More... | |
struct | rz_il_var_set_t |
Holds a set of variable definitions and their current contents This is meant only as a low-level container to be used in RzILVM. More... | |
Typedefs | |
typedef struct rz_il_var_t | RzILVar |
Definition of a variable inside the vm. More... | |
typedef struct rz_il_var_set_t | RzILVarSet |
Holds a set of variable definitions and their current contents This is meant only as a low-level container to be used in RzILVM. More... | |
Enumerations | |
enum | RzILVarKind { RZ_IL_VAR_KIND_GLOBAL , RZ_IL_VAR_KIND_LOCAL , RZ_IL_VAR_KIND_LOCAL_PURE } |
Functions | |
RZ_API RZ_OWN RzILVar * | rz_il_variable_new (RZ_NONNULL const char *name, RzILSortPure sort) |
RZ_API void | rz_il_variable_free (RZ_NULLABLE RzILVar *var) |
RZ_API bool | rz_il_var_set_init (RzILVarSet *vs) |
RZ_API void | rz_il_var_set_fini (RzILVarSet *vs) |
RZ_API void | rz_il_var_set_reset (RzILVarSet *vs) |
RZ_API RZ_BORROW RzILVar * | rz_il_var_set_create_var (RzILVarSet *vs, const char *name, RzILSortPure sort) |
RZ_API RZ_OWN RZ_NULLABLE RzILVal * | rz_il_var_set_remove_var (RzILVarSet *vs, const char *name) |
RZ_API bool | rz_il_var_set_bind (RzILVarSet *vs, const char *name, RZ_OWN RzILVal *val) |
RZ_API RZ_BORROW RzILVar * | rz_il_var_set_get (RzILVarSet *vs, const char *name) |
RZ_API RZ_OWN RzPVector * | rz_il_var_set_get_all (RzILVarSet *vs) |
RZ_API RZ_BORROW RzILVal * | rz_il_var_set_get_value (RzILVarSet *vs, const char *name) |
const char * | rz_il_var_kind_name (RzILVarKind kind) |
typedef struct rz_il_var_t RzILVar |
Definition of a variable inside the vm.
typedef struct rz_il_var_set_t RzILVarSet |
Holds a set of variable definitions and their current contents This is meant only as a low-level container to be used in RzILVM.
enum RzILVarKind |
Definition at line 46 of file variable.h.
const char* rz_il_var_kind_name | ( | RzILVarKind | kind | ) |
Get a readable string representation of kind
Definition at line 181 of file variable.c.
References RZ_IL_VAR_KIND_GLOBAL, RZ_IL_VAR_KIND_LOCAL, and RZ_IL_VAR_KIND_LOCAL_PURE.
Referenced by rz_il_handler_var().
Set the contents of the variable called name
to val
In order for this to succeed, a variable called name
must already exist and the sort of val
must match the variable's sort. Checking this is done inside this function, so calling it with invalid args in that sense is fine.
Definition at line 129 of file variable.c.
References rz_il_var_set_t::contents, NULL, rz_il_sort_pure_eq(), rz_il_value_free(), rz_il_value_get_sort(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_il_var_t::sort, val, and rz_il_var_set_t::vars.
Referenced by rz_il_vm_create_global_var(), rz_il_vm_pop_local_pure_var(), rz_il_vm_push_local_pure_var(), rz_il_vm_set_global_var(), and rz_il_vm_set_local_var().
RZ_API RZ_BORROW RzILVar* rz_il_var_set_create_var | ( | RzILVarSet * | vs, |
const char * | name, | ||
RzILSortPure | sort | ||
) |
Create a new variable of the given name and sort. If a variable of this name already exists, nothing happens.
Definition at line 90 of file variable.c.
References NULL, rz_il_variable_new(), rz_return_val_if_fail, and rz_il_var_set_t::vars.
Referenced by rz_il_vm_create_global_var(), rz_il_vm_pop_local_pure_var(), rz_il_vm_push_local_pure_var(), and rz_il_vm_set_local_var().
RZ_API void rz_il_var_set_fini | ( | RzILVarSet * | vs | ) |
Definition at line 76 of file variable.c.
References rz_il_var_set_t::contents, and rz_il_var_set_t::vars.
Referenced by rz_il_var_set_reset(), and rz_il_vm_fini().
RZ_API RZ_BORROW RzILVar* rz_il_var_set_get | ( | RzILVarSet * | vs, |
const char * | name | ||
) |
Get the definition of the variable called name
Definition at line 148 of file variable.c.
References NULL, and rz_il_var_set_t::vars.
Referenced by rz_il_vm_get_var().
RZ_API RZ_OWN RzPVector* rz_il_var_set_get_all | ( | RzILVarSet * | vs | ) |
Get a list of all variable definitions in the given set
Definition at line 160 of file variable.c.
References NULL, r, rz_pvector_new(), rz_return_val_if_fail, rz_il_var_set_t::vars, and vars_collect_cb().
Referenced by rz_il_vm_get_all_vars().
RZ_API RZ_BORROW RzILVal* rz_il_var_set_get_value | ( | RzILVarSet * | vs, |
const char * | name | ||
) |
Get the current value of the variable called name
Definition at line 173 of file variable.c.
References rz_il_var_set_t::contents, NULL, and rz_return_val_if_fail.
Referenced by rz_il_vm_get_var_value().
RZ_API bool rz_il_var_set_init | ( | RzILVarSet * | vs | ) |
Initialize vs
as an empty variable set
This makes sure that if a failure occurs, the contents are still zeroed out, so it is safe (but not required) to call rz_il_var_set_fini(), even if the init failed.
Definition at line 60 of file variable.c.
References rz_il_var_set_t::contents, memset(), NULL, rz_return_val_if_fail, val_ht_free(), var_ht_free(), and rz_il_var_set_t::vars.
Referenced by rz_il_var_set_reset(), and rz_il_vm_init().
RZ_API RZ_OWN RZ_NULLABLE RzILVal* rz_il_var_set_remove_var | ( | RzILVarSet * | vs, |
const char * | name | ||
) |
Remove a variable, if it exists
Definition at line 107 of file variable.c.
References rz_il_var_set_t::contents, NULL, r, rz_return_val_if_fail, and rz_il_var_set_t::vars.
Referenced by rz_il_vm_pop_local_pure_var(), and rz_il_vm_push_local_pure_var().
RZ_API void rz_il_var_set_reset | ( | RzILVarSet * | vs | ) |
Definition at line 81 of file variable.c.
References rz_il_var_set_fini(), and rz_il_var_set_init().
Referenced by rz_il_vm_step().
RZ_API void rz_il_variable_free | ( | RZ_NULLABLE RzILVar * | var | ) |
Free variable
var | RzILVar, pointer to RzILVar |
Definition at line 32 of file variable.c.
References free().
Referenced by var_ht_free().
RZ_API RZ_OWN RzILVar* rz_il_variable_new | ( | RZ_NONNULL const char * | name, |
RzILSortPure | sort | ||
) |
Create a new variable description
Definition at line 13 of file variable.c.
References free(), rz_il_var_t::name, NULL, RZ_NEW0, rz_return_val_if_fail, rz_il_var_t::sort, and strdup().
Referenced by rz_il_var_set_create_var().