Adds a new global flag to drwrap which inverts control such that the client must explicitly invoke drwrap's app2app and instrumentation handlers. This lets a client use drbbdup with drwrap only applying to a subset of the cases.
Given missing pieces in drbbdup, only drwrap wrapping is supported this way: not drwrap replacing. (For full support, we would need to add app2app event support inside drbbdup, as well as support for returning other than DR_EMIT_DEFAULT for the various instrumentation handlers.)
Adds a new test drbbdup-drwrap-test which wraps a function in only one of its drbbdup cases.
The new test includes a check for drwrap_set_global_flags() being called after drwrap_init() by having a drwrap_init;drwrap_exit;drwrap_init sequence. This revealed several missing unregister calls in drwrap_exit, which we fix here. These are not assumed to affect full re-attach since drmgr resets its state completely; they cause a use-after-free here because drwrap but not drmgr was reset and we had two thread exit handlers.
Issue: #3995, #5356 (closed) Fixes #5356 (closed)