Re: [DynInst_API:] Snippets that need libs that the mutatee does not reference


Date: Fri, 18 Oct 2013 15:12:03 -0500
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Snippets that need libs that the mutatee does not reference
On 10/18/2013 02:59 PM, Wayne Motycka wrote:
Bill Williams <bill <at> cs.wisc.edu> writes:
...
There are a couple of ways you can go here, with varying levels of
programmer and execution overhead. You can use BPatch_malloc to create
instrumentation variables of complex data types and manipulate their
fields with snippets, or you can inject an instrumentation library. The
standard technique when using an instrumentation library would be to
insert a call to some function that updates your assorted in-memory data
structures. In either case, you'd then register an exit callback that
will serialize the results to disk. The instrumentation library tends to
be easier to implement, and as your data structures grow more complex,
it will tend to be more efficient as well.


Ah, instrumentation library sounds like the way to go then.  If I understand
this it means that I'd need to define the in-memory data structure that
the instrumentation library would manipulate/update and the exit callback
would access this data structure to write it to disk, right?

Yep. The data structure can be a static global (and initialized when the library is loaded), or you can initialize it with a OneTimeCode before you start the process back up.

Also, the library should be a shared lib (.so) and not an archive (.a), right?

Assuming you're working with a live process and not doing binary rewriting, a .so is the right tool. If you're doing binary rewriting, you can easily add either a shared lib or an archive, depending on how the original binary was linked.

-Wayne


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



--
--bw

Bill Williams
Paradyn Project
bill@xxxxxxxxxxx
[← Prev in Thread] Current Thread [Next in Thread→]