drbbdup fails to interoperate with drmgr emulation API
For #3995 I'm integrating drbbdup with drmemtrace, the tracer for drcachesim. But drmemtrace uses the drmgr emulation support:
instr_t *instr_fetch = drmgr_orig_app_instr_for_fetch(drcontext);
instr_t *instr_operands = drmgr_orig_app_instr_for_operands(drcontext);
Those routines are not supported by drbbdup, which splits the where
to insert from the app instr being instrumented, to handle the inability to clone a block-final branch or syscall.
This causes drmemtrace to instrument the wrong instruction.
Xref past discussions on possibly integrating drbbdup with drmgr.
A possible simpler solution is to add a drmgr API to set the current app instruction.
Or, could we re-implement the drbbdup where
vs instr
split to instead use the emulation API itself?
That is one of the intended uses of the emulation API, for app instr rewrites that ease instrumentation (such as rep string or scatter-gather expansion): it is not only for pure emulation.