Add drwrap mode that inverts control for use inside a drbbdup case
Split from #3995
Pasting from there:
I guess this raises a larger issue: we want the drwrap clean call to only be inserted for one of our drbbdup cases. But with no control over drwrap, we can't arrange that, and drwrap is going to go insert its clean call at the start before the drbbdup case dispatch I would guess.
How to solve?
If drbbdup were integrated inside drmgr: would non-bbdup-aware users of drmgr like drwrap be invoked for the default case insertion and not the other cases? So the user can either have wrapping for just one case (has to be default)? Provide an option where user can pick one case, or all cases?
Or, drwrap has to turn its control model around and have the user call "do_drwrap_instru" from its insertion event, with drwrap not registering instru events (but still registering modload, etc.)?
Leaning toward the latter: add a drwrap global flag.
However, we have several issues implementing this:
- There is no app2app event inside drbbdup! => For now, don't support drwrap_replace.
- The "for_trace" and "translating" params are not passed => For now, document that drwrap doesn't need them
- The dr_emit_flags_t return value is not propagated => For now, document that when wrapping and not replacing it always returns DR_EMIT_DEFAULT
We would have to augment drbbdup to support drwrap_replace which needs app2app and under some options needs to return something other than DR_EMIT_DEFAULT.