Add support for combining emulation sequences with original-instruction-stream clients
Filing an issue as this is becoming a larger feature topic now.
Xref original discussions at https://groups.google.com/forum/#!topic/dynamorio-devs/BxXN9JcaUDc (Add INSTR_EMULATE flag to _instr_t).
Xref https://github.com/DynamoRIO/dynamorio/pull/3104#issuecomment-404805574
Summarizing some of the key points:
- We want one client to be able to replace an app instr with an emulated sequence of app instrs, while having observational clients operating in the same run see the original instruction stream.
- We decided not to add some kind of new, second app2app phase as that becomes an even larger and more complex change.
- We decided not to have emulation sequences added in the instru2instru phase: that violates the original phase division and gets complex and messy even when emulation sequences are "drop-in" replacements. The instru2instru phase is the "wild west" and there's not much help there from drreg or other tools.
- We decided to mark the emulation sequence and provide a pointer to the original instruction, using labels with notes and label data. This avoids breaking any existing clients.
- We'll change existing observational clients that want to see the original instrs (rather than what's actually executed) to be "emulation-aware" by having them use an emulation iterator.
We should also change drutil_expand_rep_string_ex() to use the new labels.