Re: [DynInst_API:] Binary extension with raw bytes using PatchAPI


Date: Thu, 10 Apr 2014 15:59:13 -0700
From: Jiten Pathy <jpathy@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: [DynInst_API:] Binary extension with raw bytes using PatchAPI
Bill suggested this project to me.
http://sourceforge.net/p/crafthpc/code/

On Thu, Apr 10, 2014 at 2:09 AM, Sergej Proskurin <prosig@xxxxxxx> wrote:
> Hello,
>
> After first experimentations with the DynsinstAPI, I would like to use
> PatchAPI in order to develop a fine-grained binary editing solution.
> Unfortunately, at the moment, I have troubles with the extension of the
> Snippet class:
>
> For the beginning, I would like to simply include some raw bytes into an
> existing binary to be edited. I have followed the recently posted issue
> concerning the same topic
> (https://www-auth.cs.wisc.edu/lists/dyninst-api/2014/msg00061.shtml) and
> wondered whether you could provide me with some existing binary modification
> examples, as well. As can be seen in the code below, my current
> test-implementation is based on the above mentioned issue, which is as well
> provided by the PatchAPI documentation - in more or less same detail.
>
> The following code produces errors during compilation at the point when the
> snippet-pointer is created.
> Error message: "static Dyninst::PatchAPI::Snippet::Ptr
> Dyninst::PatchAPI::Snippet::create(Dyninst::PatchAPI::Snippet*)â is
> inaccessible within this context"
>
> ---
>
> class MySnippet : Snippet {
> public:
>     virtual bool generate(Point *point, Buffer &buf) {
>         buf.copy((void*)"BBBBBBBBBBBBBBBBBBBB", 20);
>
>         return true;
>     }
> };
>
> ...
>
> /* The folowing line leads to errors during compilation */
> MySnippet::Ptr snippet = MySnippet::create(new MySnippet());
>
> Point *point = mgr->findPoint(Location::Instruction(b, b->last()),
> Point::BlockExit);
>
> Patcher patcher(mgr);
> patcher.add(PushBackCommand::create(point, snippet));
> patcher.commit();
>
> ---
>
> I would really appreciate it if you could help me with my concern.
> Thank you very much in advance.
>
> Best regards,
> Sergej
>
> PS: I am using the DynsinstAPI bundle version 8.1.2 (including ParseAPI,
> PatchAPI, ...).
>
>
>
>
> _______________________________________________
> Dyninst-api mailing list
> Dyninst-api@xxxxxxxxxxx
> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

[← Prev in Thread] Current Thread [Next in Thread→]