7 #define CMP_REG_CHANGE(x, y) ((x) - ((RzAnalysisEsilRegChange *)(y))->idx)
8 #define CMP_MEM_CHANGE(x, y) ((x) - ((RzAnalysisEsilMemChange *)(y))->idx)
37 RZ_LOG_ERROR(
"esil: Cannot allocate hashmap for trace registers\n");
42 RZ_LOG_ERROR(
"esil: Cannot allocate hashmap for trace memory\n");
47 RZ_LOG_ERROR(
"esil: Cannot allocate vector for trace instructions\n");
65 RZ_LOG_ERROR(
"esil: Cannot allocate register arena for trace\n");
68 if (
b->bytes &&
a->bytes &&
b->size > 0) {
141 RzILTraceRegOp *reg_read =
RZ_NEW0(RzILTraceRegOp);
147 reg_read->behavior = RZ_IL_TRACE_OP_READ;
148 reg_read->value = *res;
160 RzILTraceRegOp *reg_write =
RZ_NEW0(RzILTraceRegOp);
166 reg_write->behavior = RZ_IL_TRACE_OP_WRITE;
167 reg_write->value = *
val;
197 RZ_LOG_ERROR(
"read memory more than 32 bytes, cannot trace\n");
204 mem_read->behavior = RZ_IL_TRACE_OP_READ;
231 RZ_LOG_ERROR(
"write memory more than 32 bytes, cannot trace\n");
238 mem_write->behavior = RZ_IL_TRACE_OP_WRITE;
244 for (
i = 0;
i <
len;
i++) {
290 int esil_verbose = esil->
verbose;
327 if (index > 0 && index <= vmem->
len) {
339 if (index > 0 && index <= vreg->
len) {
352 if (idx < esil->trace->
idx) {
376 bool reg = focus == RZ_IL_TRACE_INS_HAS_REG_R || focus == RZ_IL_TRACE_INS_HAS_REG_W;
377 bool read = focus == RZ_IL_TRACE_INS_HAS_REG_R || focus == RZ_IL_TRACE_INS_HAS_MEM_R;
378 const char *direction =
read ?
"read" :
"write";
387 RzILTraceRegOp *
op = (RzILTraceRegOp *)*it;
388 first ? (first =
false) : rz_cons_print(
",");
394 RzILTraceRegOp *
op = (RzILTraceRegOp *)*it;
396 op->reg_name,
op->value < 10 ?
"" :
"0x",
op->value);
403 RzILTraceMemOp *
op = (RzILTraceMemOp *)*it;
404 first ? (first =
false) : rz_cons_print(
",");
410 RzILTraceMemOp *
op = (RzILTraceMemOp *)*it;
411 char hexstr[
sizeof(
op->data_buf) * 2 + 1];
440 RzILTraceInstruction *instruction_trace;
444 instruction_trace = *
iter;
RZ_API RzRegArena * rz_reg_arena_new(size_t size)
RZ_API void rz_reg_arena_free(RzRegArena *ra)
static int mem_read(struct mem_file *fh, void *buffer, int bytes)
static int mem_write(struct mem_file *fh, void *buffer, int bytes)
static RzNumCalcValue expr(RzNum *, RzNumCalc *, int)
RZ_API void rz_cons_newline(void)
RZ_API int rz_cons_printf(const char *format,...)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API void rz_analysis_esil_stack_free(RzAnalysisEsil *esil)
RZ_API bool rz_analysis_esil_parse(RzAnalysisEsil *esil, const char *str)
static void print_instruction_trace(RzILTraceInstruction *instruction, int idx)
RZ_API RzAnalysisEsilTrace * rz_analysis_esil_trace_new(RzAnalysisEsil *esil)
static void add_reg_change(RzAnalysisEsilTrace *trace, int idx, RzRegItem *ri, ut64 data)
static bool restore_register(RzAnalysisEsil *esil, RzRegItem *ri, int idx)
static void print_instruction_ops(RzILTraceInstruction *instruction, int idx, RzILTraceInsOp focus)
static void htup_vector_free(HtUPKv *kv)
static bool esil_add_reg_trace(RzAnalysisEsilTrace *etrace, RzILTraceRegOp *reg)
RZ_API void rz_analysis_esil_trace_restore(RzAnalysisEsil *esil, int idx)
static RzAnalysisEsilCallbacks ocbs
RZ_API void rz_analysis_esil_trace_list(RzAnalysisEsil *esil)
#define CMP_MEM_CHANGE(x, y)
RZ_API void rz_analysis_esil_trace_free(RzAnalysisEsilTrace *trace)
static int trace_hook_reg_read(RzAnalysisEsil *esil, const char *name, ut64 *res, int *size)
static bool esil_add_mem_trace(RzAnalysisEsilTrace *etrace, RzILTraceMemOp *mem)
static bool restore_memory_cb(void *user, const ut64 key, const void *value)
RZ_API void rz_analysis_esil_trace_op(RzAnalysisEsil *esil, RZ_NONNULL RzAnalysisOp *op)
static int trace_hook_reg_write(RzAnalysisEsil *esil, const char *name, ut64 *val)
#define CMP_REG_CHANGE(x, y)
RZ_API void rz_analysis_esil_trace_show(RzAnalysisEsil *esil, int idx)
static void add_mem_change(RzAnalysisEsilTrace *trace, int idx, ut64 addr, ut8 data)
RZ_API RZ_BORROW RzILTraceInstruction * rz_analysis_esil_get_instruction_trace(RZ_NONNULL RzAnalysisEsilTrace *etrace, int idx)
static int trace_hook_mem_read(RzAnalysisEsil *esil, ut64 addr, ut8 *buf, int len)
static int trace_hook_mem_write(RzAnalysisEsil *esil, ut64 addr, const ut8 *buf, int len)
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RzILTraceInstruction * rz_analysis_il_trace_instruction_new(ut64 addr)
RZ_API bool rz_analysis_il_trace_add_mem(RzILTraceInstruction *trace, RzILTraceMemOp *mem)
RZ_API void rz_analysis_il_trace_instruction_free(RzILTraceInstruction *instruction)
RZ_API bool rz_analysis_il_trace_add_reg(RzILTraceInstruction *trace, RzILTraceRegOp *reg)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * malloc(size_t size)
RZ_API RzRegItem * rz_reg_get(RzReg *reg, const char *name, int type)
RZ_API bool rz_reg_set_value(RzReg *reg, RzRegItem *item, ut64 value)
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API void * rz_mem_copy(void *dest, size_t dmax, const void *src, size_t smax)
#define RZ_STR_ISEMPTY(x)
RZ_API const char * rz_str_constpool_get(RzStrConstPool *pool, const char *str)
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
static void * rz_vector_index_ptr(RzVector *vec, size_t index)
#define rz_vector_upper_bound(vec, x, i, cmp)
static size_t rz_pvector_len(const RzPVector *vec)
RZ_API void * rz_vector_push(RzVector *vec, void *x)
RZ_API RzPVector * rz_pvector_new(RzPVectorFree free)
void(* RzPVectorFree)(void *e)
static bool rz_pvector_empty(RzPVector *vec)
static void ** rz_pvector_push(RzPVector *vec, void *x)
RZ_API void rz_vector_free(RzVector *vec)
RZ_API void rz_pvector_free(RzPVector *vec)
RZ_API RzVector * rz_vector_new(size_t elem_size, RzVectorFree free, void *free_user)
static void * rz_pvector_at(const RzPVector *vec, size_t index)
#define rz_pvector_foreach(vec, it)
int(* hook_mem_read)(ANALYSIS_ESIL *esil, ut64 addr, ut8 *buf, int len)
int(* mem_read)(ANALYSIS_ESIL *esil, ut64 addr, ut8 *buf, int len)
int(* reg_read)(ANALYSIS_ESIL *esil, const char *name, ut64 *res, int *size)
int(* hook_reg_read)(ANALYSIS_ESIL *esil, const char *name, ut64 *res, int *size)
int(* hook_mem_write)(ANALYSIS_ESIL *esil, ut64 addr, const ut8 *buf, int len)
RzAnalysisEsilHookRegWriteCB hook_reg_write
RzAnalysisEsilCallbacks cb
RzAnalysisEsilTrace * trace
RzRegArena * arena[RZ_REG_TYPE_LAST]
int arena
In which arena is this reg living. Usually equals type.
int offset
Offset into register profile in bits.
RzRegSet regset[RZ_REG_TYPE_LAST]
void error(const char *msg)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
int read(izstream &zs, T *x, Items items)