Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_il/rz_il_vm.h>
Go to the source code of this file.
Macros | |
#define | il_op_unimplemented(name) |
#define | il_op_param_0(name) |
#define | il_op_param_1(name, opx, v0) |
#define | il_op_param_2(name, opx, sort0, v0, sort1, v1) |
#define | il_op_param_3(name, opx, sort0, v0, sort1, v1, sort2, v2) |
Outputs the IL statements & events in JSON or string format. The string format of a statement is composed simply of s-expressions and looks like below: (store 0 (var ptr) (+ (load 0 (var ptr)) (bv 8 0x1))) which can be deconstructed like below (store 0 (var ptr) (+ (load 0 (var ptr) ) (bv 8 0x1) ) )
The json format of a statement looks like below: [ { "opcode": "store", "key": { "opcode": "var", "value": "ptr" }, "value": { "opcode": "add", "x": { "opcode": "load", "key": { "opcode": "var", "value": "ptr" }, "mem": 0 }, "y": { "opcode": "int", "length": 8, "value": 1 } }, "mem": 0 } ] The string format of an event looks like below: mem_write(addr: 0x0000000000000000, old: 0x00, new: 0x01)
The json format of an event looks like below: { "event": "mem_write", "old": "0x00", "new": "0x01" }
Definition in file il_export.c.
#define il_op_param_0 | ( | name | ) |
Definition at line 77 of file il_export.c.
Definition at line 103 of file il_export.c.
Definition at line 122 of file il_export.c.
#define il_op_unimplemented | ( | name | ) |
|
static |
Definition at line 637 of file il_export.c.
References op::code, il_opdmp_blk(), il_opdmp_branch(), il_opdmp_empty(), il_opdmp_goto(), il_opdmp_jmp(), il_opdmp_nop(), il_opdmp_repeat(), il_opdmp_seq(), il_opdmp_set(), il_opdmp_store(), il_opdmp_storew(), pj_end(), pj_ks(), pj_o(), RZ_IL_OP_BLK, RZ_IL_OP_BRANCH, RZ_IL_OP_EMPTY, RZ_IL_OP_GOTO, RZ_IL_OP_JMP, RZ_IL_OP_NOP, RZ_IL_OP_REPEAT, RZ_IL_OP_SEQ, RZ_IL_OP_SET, RZ_IL_OP_STORE, RZ_IL_OP_STOREW, rz_strbuf_append(), rz_strbuf_appendf(), rz_strf, rz_warn_if_reached, sb, and autogen_x86imm::tmp.
Referenced by il_opdmp_blk(), il_opdmp_seq_inner(), rz_il_op_effect_json(), and rz_il_op_effect_stringify().
|
static |
Definition at line 509 of file il_export.c.
References op::code, il_opdmp_add(), il_opdmp_append(), il_opdmp_bitv(), il_opdmp_bool_and(), il_opdmp_bool_false(), il_opdmp_bool_inv(), il_opdmp_bool_or(), il_opdmp_bool_true(), il_opdmp_bool_xor(), il_opdmp_cast(), il_opdmp_div(), il_opdmp_eq(), il_opdmp_is_zero(), il_opdmp_ite(), il_opdmp_let(), il_opdmp_load(), il_opdmp_loadw(), il_opdmp_logand(), il_opdmp_lognot(), il_opdmp_logor(), il_opdmp_logxor(), il_opdmp_lsb(), il_opdmp_mod(), il_opdmp_msb(), il_opdmp_mul(), il_opdmp_neg(), il_opdmp_sdiv(), il_opdmp_shiftl(), il_opdmp_shiftr(), il_opdmp_sle(), il_opdmp_smod(), il_opdmp_sub(), il_opdmp_ule(), il_opdmp_var(), pj_end(), pj_knull(), pj_ks(), pj_o(), RZ_IL_OP_ADD, RZ_IL_OP_AND, RZ_IL_OP_APPEND, RZ_IL_OP_B0, RZ_IL_OP_B1, RZ_IL_OP_BITV, RZ_IL_OP_CAST, RZ_IL_OP_DIV, RZ_IL_OP_EQ, RZ_IL_OP_INV, RZ_IL_OP_IS_ZERO, RZ_IL_OP_ITE, RZ_IL_OP_LET, RZ_IL_OP_LOAD, RZ_IL_OP_LOADW, RZ_IL_OP_LOGAND, RZ_IL_OP_LOGNOT, RZ_IL_OP_LOGOR, RZ_IL_OP_LOGXOR, RZ_IL_OP_LSB, RZ_IL_OP_MOD, RZ_IL_OP_MSB, RZ_IL_OP_MUL, RZ_IL_OP_NEG, RZ_IL_OP_OR, RZ_IL_OP_SDIV, RZ_IL_OP_SHIFTL, RZ_IL_OP_SHIFTR, RZ_IL_OP_SLE, RZ_IL_OP_SMOD, RZ_IL_OP_SUB, RZ_IL_OP_ULE, RZ_IL_OP_VAR, RZ_IL_OP_XOR, rz_strbuf_append(), rz_strbuf_appendf(), rz_strf, rz_warn_if_reached, sb, and autogen_x86imm::tmp.
Referenced by il_opdmp_cast(), il_opdmp_let(), il_opdmp_load(), il_opdmp_loadw(), il_opdmp_set(), il_opdmp_store(), il_opdmp_storew(), rz_il_op_pure_json(), and rz_il_op_pure_stringify().
|
static |
Definition at line 254 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 334 of file il_export.c.
References il_op_param_2.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 219 of file il_export.c.
References free(), bitvector_t::len, num, pj_end(), pj_kn(), pj_ks(), pj_o(), rz_bv_as_hex_string(), rz_strbuf_appendf(), sb, and rz_il_op_args_bv_t::value.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 482 of file il_export.c.
References rzil_op_blk_t::ctrl_eff, rzil_op_blk_t::data_eff, il_op_effect_resolve(), rzil_op_blk_t::label, pj_end(), pj_k(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), and sb.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 207 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 181 of file il_export.c.
References pj_end(), pj_kb(), pj_ks(), pj_o(), rz_strbuf_append(), and sb.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 203 of file il_export.c.
References il_op_param_1, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 211 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 192 of file il_export.c.
References pj_end(), pj_kb(), pj_ks(), pj_o(), rz_strbuf_append(), and sb.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 215 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 505 of file il_export.c.
References il_op_param_3.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 314 of file il_export.c.
References rz_il_op_args_cast_t::fill, il_op_pure_resolve(), rz_il_op_args_cast_t::length, pj_end(), pj_k(), pj_kn(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), sb, and rz_il_op_args_cast_t::val.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 266 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 417 of file il_export.c.
References il_op_param_0.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 302 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 441 of file il_export.c.
References rz_il_op_args_goto_t::lbl, pj_end(), pj_ks(), pj_o(), rz_strbuf_appendf(), and sb.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 242 of file il_export.c.
References il_op_param_1.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 157 of file il_export.c.
References il_op_param_3, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 437 of file il_export.c.
References dst, and il_op_param_1.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 161 of file il_export.c.
References rz_il_op_args_let_t::body, rz_il_op_args_let_t::exp, il_op_pure_resolve(), rz_il_op_args_let_t::name, pj_end(), pj_k(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), and sb.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 338 of file il_export.c.
References il_op_pure_resolve(), rz_il_op_args_load_t::key, rz_il_op_args_load_t::mem, pj_end(), pj_k(), pj_kn(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), and sb.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 354 of file il_export.c.
References il_op_pure_resolve(), rz_il_op_args_loadw_t::key, rz_il_op_args_loadw_t::mem, rz_il_op_args_loadw_t::n_bits, pj_end(), pj_k(), pj_kn(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), and sb.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 282 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 250 of file il_export.c.
References il_op_param_1.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 286 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 290 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 238 of file il_export.c.
References il_op_param_1.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 274 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 234 of file il_export.c.
References il_op_param_1.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 262 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 246 of file il_export.c.
References il_op_param_1.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 413 of file il_export.c.
References il_op_param_0.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 501 of file il_export.c.
References il_op_param_2.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 270 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 468 of file il_export.c.
References il_op_param_2, il_opdmp_seq_inner(), rz_strbuf_append(), sb, and x.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 453 of file il_export.c.
References rz_il_op_effect_t::code, il_op_effect_resolve(), NULL, RZ_IL_OP_SEQ, rz_strbuf_append(), sb, rz_il_op_args_seq_t::x, and rz_il_op_args_seq_t::y.
Referenced by il_opdmp_seq().
|
static |
Definition at line 421 of file il_export.c.
References il_op_pure_resolve(), pj_end(), pj_k(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), sb, rz_il_op_args_set_t::v, and rz_il_op_args_set_t::x.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 298 of file il_export.c.
References il_op_param_3, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 294 of file il_export.c.
References il_op_param_3, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 306 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 278 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 371 of file il_export.c.
References il_op_pure_resolve(), rz_il_op_args_store_t::key, rz_il_op_args_store_t::mem, pj_end(), pj_k(), pj_kn(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), sb, and rz_il_op_args_store_t::value.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 392 of file il_export.c.
References il_op_pure_resolve(), rz_il_op_args_store_t::key, rz_il_op_args_store_t::mem, pj_end(), pj_k(), pj_kn(), pj_ks(), pj_o(), rz_strbuf_append(), rz_strbuf_appendf(), sb, and rz_il_op_args_store_t::value.
Referenced by il_op_effect_resolve().
|
static |
Definition at line 258 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 310 of file il_export.c.
References il_op_param_2, and x.
Referenced by il_op_pure_resolve().
|
static |
Definition at line 145 of file il_export.c.
References pj_end(), pj_ks(), pj_o(), rz_strbuf_appendf(), sb, and rz_il_op_args_var_t::v.
Referenced by il_op_pure_resolve().
RZ_API void rz_il_event_json | ( | RZ_NONNULL RzILEvent * | evt, |
RZ_NONNULL PJ * | pj | ||
) |
Definition at line 797 of file il_export.c.
References free(), NULL, pj_end(), pj_ks(), pj_o(), rz_bv_as_hex_string(), RZ_IL_EVENT_EXCEPTION, RZ_IL_EVENT_MEM_READ, RZ_IL_EVENT_MEM_WRITE, RZ_IL_EVENT_PC_WRITE, RZ_IL_EVENT_VAR_READ, RZ_IL_EVENT_VAR_WRITE, rz_il_value_stringify(), rz_return_if_fail, and rz_warn_if_reached.
Referenced by rz_core_analysis_il_step_with_events().
RZ_API void rz_il_event_stringify | ( | RZ_NONNULL const RzILEvent * | evt, |
RZ_NONNULL RzStrBuf * | sb | ||
) |
Create a readable string representation of evt
Definition at line 753 of file il_export.c.
References free(), NULL, rz_bv_as_hex_string(), RZ_IL_EVENT_EXCEPTION, RZ_IL_EVENT_MEM_READ, RZ_IL_EVENT_MEM_WRITE, RZ_IL_EVENT_PC_WRITE, RZ_IL_EVENT_VAR_READ, RZ_IL_EVENT_VAR_WRITE, rz_il_value_stringify(), rz_return_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_warn_if_reached, and sb.
Referenced by rz_core_analysis_il_step_with_events().
RZ_API void rz_il_op_effect_json | ( | RZ_NONNULL RzILOpEffect * | op, |
RZ_NONNULL PJ * | pj | ||
) |
Generates the JSON representation of the IL statement
op | IL statement |
pj | PJ*, a pointer to the JSON buffer |
Definition at line 731 of file il_export.c.
References il_op_effect_resolve(), NULL, and rz_return_if_fail.
Referenced by core_analysis_bytes_json().
RZ_API void rz_il_op_effect_stringify | ( | RZ_NONNULL RzILOpEffect * | op, |
RZ_NONNULL RzStrBuf * | sb | ||
) |
Generates the string representation of the IL statement
op | IL statement |
sb | RzStrBuf*, a pointer to the string buffer |
Definition at line 711 of file il_export.c.
References il_op_effect_resolve(), NULL, rz_return_if_fail, and sb.
Referenced by core_analysis_bytes_standard(), ds_print_cmt_il(), and print_and_check_il().
RZ_API RZ_NONNULL const char* rz_il_op_pure_code_stringify | ( | RzILOpPureCode | code | ) |
Get a readable representation of code
Definition at line 872 of file il_export.c.
References RZ_IL_OP_ADD, RZ_IL_OP_AND, RZ_IL_OP_APPEND, RZ_IL_OP_B0, RZ_IL_OP_B1, RZ_IL_OP_BITV, RZ_IL_OP_CAST, RZ_IL_OP_DIV, RZ_IL_OP_EQ, RZ_IL_OP_INV, RZ_IL_OP_IS_ZERO, RZ_IL_OP_ITE, RZ_IL_OP_LET, RZ_IL_OP_LOAD, RZ_IL_OP_LOADW, RZ_IL_OP_LOGAND, RZ_IL_OP_LOGNOT, RZ_IL_OP_LOGOR, RZ_IL_OP_LOGXOR, RZ_IL_OP_LSB, RZ_IL_OP_MOD, RZ_IL_OP_MSB, RZ_IL_OP_MUL, RZ_IL_OP_NEG, RZ_IL_OP_OR, RZ_IL_OP_PURE_MAX, RZ_IL_OP_SDIV, RZ_IL_OP_SHIFTL, RZ_IL_OP_SHIFTR, RZ_IL_OP_SLE, RZ_IL_OP_SMOD, RZ_IL_OP_SUB, RZ_IL_OP_ULE, RZ_IL_OP_VAR, and RZ_IL_OP_XOR.
Referenced by VALIDATOR_PURE().
RZ_API void rz_il_op_pure_json | ( | RZ_NONNULL RzILOpPure * | op, |
RZ_NONNULL PJ * | pj | ||
) |
Generates the JSON representation of the IL statement
op | IL statement |
pj | PJ*, a pointer to the JSON buffer |
Definition at line 721 of file il_export.c.
References il_op_pure_resolve(), NULL, and rz_return_if_fail.
RZ_API void rz_il_op_pure_stringify | ( | RZ_NONNULL RzILOpPure * | op, |
RZ_NONNULL RzStrBuf * | sb | ||
) |
Generates the string representation of the IL statement
op | IL statement |
sb | RzStrBuf*, a pointer to the string buffer |
Definition at line 701 of file il_export.c.
References il_op_pure_resolve(), NULL, rz_return_if_fail, and sb.
RZ_API RZ_OWN char* rz_il_sort_pure_stringify | ( | RzILSortPure | sort | ) |
Get a readable representation of sort
Definition at line 952 of file il_export.c.
References rz_il_sort_pure_t::bv, rz_il_sort_pure_t::props, RZ_IL_TYPE_PURE_BITVECTOR, RZ_IL_TYPE_PURE_BOOL, rz_str_newf(), strdup(), and rz_il_sort_pure_t::type.
Referenced by local_var_meet_known_cb(), VALIDATOR_EFFECT(), and VALIDATOR_PURE().
RZ_API char* rz_il_value_stringify | ( | RZ_NONNULL const RzILVal * | val | ) |
Create a readable string representation of val
Definition at line 739 of file il_export.c.
References NULL, r, rz_bv_as_hex_string(), rz_bv_free(), rz_il_value_to_bv(), rz_return_val_if_fail, and val.
Referenced by rz_il_event_json(), and rz_il_event_stringify().