BlockEncoder option to return all offsets, including for rewritten instructions #643
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new
BlockEncoderOption
,ReturnAllNewInstructionOffsets
, which enablesReturnNewInstructionOffsets
and also changes its behavior regarding instructions that were rewritten (e.g. by branch fixups) to output the offset of the rewritten block of instructions, as opposed tou32::MAX
withReturnNewInstructionOffsets
.I am not really happy about the name, but can't think of anything better at the moment so please let me know if you have other suggestions.
The particular use-case I need this for is for live instrumentation where I will be hooking thousands of individual instructions, some of which may be in the middle of functions. In such cases it becomes necessary to maintain a CFG to fixup branch targets as code is relocated. To do so, I need to know where control flow instructions were moved, regardless of whether they had to be rewritten as multiple instructions. Without this feature, I would have to perform the
BlockEncoder
's branch fixups myself, which seems counterproductive.