Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockEncoder option to return all offsets, including for rewritten instructions #643

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tremwil
Copy link

@tremwil tremwil commented Dec 12, 2024

Adds a new BlockEncoderOption, ReturnAllNewInstructionOffsets, which enables ReturnNewInstructionOffsets 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 to u32::MAX with ReturnNewInstructionOffsets.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant