Add new instrumentation insertion event(s) for observing original instruction stream, hiding expansions and emulations
With expansions for rep strings and scatter gather, and with emulation of other instructions, we've added an emulation API for a tool to view the original instruction stream rather than the messy expanded to-be-executed instruction list passed to the drmgr insertion event. It would be cleaner to have an instrumentation insertion event that is passed just the original instruction stream, hiding the expansions directly, rather than a tool having to separately query for the original code. That was proposed in #4865 (closed) but we balked at implementing it at that time: see https://github.com/DynamoRIO/dynamorio/issues/4865#issuecomment-861030167 for a two-event proposal.
This issue covers revisiting that idea. There are several complexities:
- Would we try to replace the existing insertion event in all end tools? If not, would we then add new event support to wrappers such as drbbdup which call their own insertion events? If so, would we just have a big compatibility break? And we'd leave the to-be-executed instrlist event only for libraries like drreg?
- Would we have versions that do not support expanded operands, or would we go with the two-event scheme from https://github.com/DynamoRIO/dynamorio/issues/4865#issuecomment-861030167?