Hi,

I'm currently playing around with DyninstAPI and found in the documentation that
using a PatchModifier one can remove functions from a binary image (for example,
an ELF executable). But somehow I have trouble of connecting all the dots here,
so I'd like to know if the following schematic workflow is correct:

- Do BPatch_binaryEdit *app = BPatch::openBinary() for the file in question
- Call app->getImage()->findFunction() for the function name in question
- In the resulting BPatch_Vector<BPatch_function *>, use the first element and
call Dyninst::PatchAPI::convert to get a Dyninst::PatchAPI::PatchFunction *.
- Hand that Pointer to PatchModifier::remove()
- Call app->writeFile() to write the modified file to disk.

Is there any synchronisation needed before writing the file out? In other parts
of the documentation for PatchAPI the finalizeInsertionSet call comes up often,
but I don't see how that fits into the picture here.

In principle, this method should delete the function in question from the ELF
and leave it otherwise intact (assuming there are no internal callers for that
function, of course), right?

Best regards and thanks already!

Andreas


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

Reply via email to