Hi,
I am trying to insert an add instruction to increment a global counter by the following code. I use Linux system with Aarch64 architecture.
/* save arithmetic flags */
dr_save_reg(drcontext, bb, first_inst, DR_REG_X0, SPILL_SLOT_1); dr_save_arith_flags_to_reg(drcontext, bb, first_inst, DR_REG_X0);
/* inser inst to increment the counter */
uint64_t tmp = 0; int one = 1;
instrlist_meta_preinsert(bb,
first_inst,
XINST_CREATE_add(drcontext, OPND_CREATE_ABSMEM((void*)&global_counter, OPSZ_8), OPND_CREATE_INT(1))
);
/* restore arithmetic flags */
dr_restore_arith_flags_from_reg(drcontext, bb, first_inst, DR_REG_X0);
dr_restore_reg(drcontext, bb, first_inst, DR_REG_X0, SPILL_SLOT_1);
But the client crashes with the following information:
Tool internal crash at PC 0x000000007109cd7c. Please report this at your tool's issue tracker. Program aborted.
Received SIGSEGV at pc 0x000000007109cd7c in thread 2920934
Base: 0x0000000071000000
Registers: eflags=0x0000000080001000
version 9.0.1, custom build
Do you have any ideas about how to solve this issue?
Thanks a lot for your help.
Sincerely,
Ray