Hello,
Iâd like to dynamically
modify a binary and change branches to NOPs and back. I
wondered whether DynInst (in particular PatchAPI) would be a
suitable tool for this. What do you think?
Hereâs what Iâd like to
do in more detail: I have a program that contains branches
like the one below.
... some code ...
21d0: cmpb $0x0, branch_flag
â jne 2221
... some more code ...
These branches are
usually not taken because the branch_flag is set to zero.
Nevertheless, there is some cost for loading the flag and
the non-taken branch. I would like to get rid of this cost
as much as possible, by replacing that sequence of
instructions with NOPs.
In a later stage, Iâd
also like to undo some of these replacements, or even change
the conditional branch into an unconditional branch.