/* Truncates every basic block to the length specified in the CL option (see dr_init) */ dr_emit_flags_t bb_event_truncate(void *drcontext, void *, instrlist_t *bb, bool, bool) { uint app_instruction_count = 0; instr_t *next, *instr = instrlist_first(bb); while (instr != NULL) { next = instr_get_next(instr); if (!instr_is_meta(instr)) { if (app_instruction_count == bb_truncation_length) { instrlist_remove(bb, instr); instr_destroy(drcontext, instr); } else { app_instruction_count++; } } instr = next; } return DR_EMIT_DEFAULT; }
static inline void check_translation(instrlist_t *ilist, instr_t *inst) { if (ilist->translation_target != NULL && instr_get_translation(inst) == NULL) { instr_set_translation(inst, ilist->translation_target); } if (instrlist_get_our_mangling(ilist)) instr_set_our_mangling(inst, true); #if defined(CLIENT_INTERFACE) && defined(ARM) if (instr_is_meta(inst)) { dr_pred_type_t auto_pred = ilist->auto_pred; if (instr_predicate_is_cond(auto_pred)) { CLIENT_ASSERT(!instr_is_cti(inst), "auto-predication does not support cti's"); CLIENT_ASSERT( !TESTANY(EFLAGS_WRITE_NZCV, instr_get_arith_flags(inst, DR_QUERY_INCLUDE_COND_SRCS)), "cannot auto predicate a meta-inst that writes to NZCV"); if (!instr_is_predicated(inst)) instr_set_predicate(inst, auto_pred); } } #endif }