Hi, @derekbruening and @AssadHashmi.
When I use DynamoRIO in debug mode to detach an instrumented process externally, I met the error like following:
Client bbcount is running
<received nudge mask=0x4 id=0x00000000 arg=0x0000000000000000>
<Detaching from application /home/wlmu/cpu2017/benchspec/CPU/602.gcc_s/run/run_base_refspeed_aarch64-perf-79749-64.0000/sgcc_base.aarch64-perf-79749-64 (513978)>
<Application /home/wlmu/cpu2017/benchspec/CPU/602.gcc_s/run/run_base_refspeed_aarch64-perf-79749-64.0000/sgcc_base.aarch64-perf-79749-64 (513978) DynamoRIO usage error : meta-instr faulted? must set translation field and handle fault!>
<Usage error: meta-instr faulted? must set translation field and handle fault! (/home/wlmu/dynamorio-master/dynamorio/core/translate.c, line 1060)
version 10.92.19885, custom build
This DOCHECK can be located in the following code snippet:
if (instr_get_translation(inst) == NULL) {
/* Clients are supposed to leave their meta instrs with
* NULL translations. (DR may hit this assert for
* -optimize but we need to fix that by setting translation
* for all our optimizations.) We assume we will never
* get an app fault here, so we fail if asked for full state
* since although we can get full app state we can't relocate
* in the middle of client meta code.
*/
ASSERT(instr_is_meta(inst));
/* PR 302951: our clean calls do show up here and have full state.
* FIXME i#4219: This is not safe: see comment above.
*/
if (walk.in_clean_call)
translate_restore_clean_call(tdcontext, &walk);
else
res = RECREATE_SUCCESS_PC; /* failed on full state, but pc good */
/* should only happen for thread synch, not a fault */
DOCHECK(1, {
if (!(instr_is_our_mangling(inst) ||
tdcontext != get_thread_private_dcontext() ||
INTERNAL_OPTION(stress_recreate_pc) ||
tdcontext->client_data->is_translating)) {
CLIENT_ASSERT(false,
"meta-instr faulted? must set translation "
"field and handle fault!");
}
});
I think this error is caused by receiving the detachment signal in the middle of client's code. In this case, the instructions being translated is the meta instruction, which isn't a safe spot for the nudged thread.
Would you like to give me some advice for this problem?If possible, I hope to contribute some code to solve this problem.
Best regards,
Wenlong.