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


Date: Fri, 18 Oct 2013 14:30:23 -0500
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Snippets that need libs that the mutatee does not reference
On 10/18/2013 01:30 PM, Wayne Motycka wrote:
The snippet examples seem to fixate on opening file handles destinations for
output, but given the high cost of doing disk I/O, I'd like to instead send
these messages down a TCP/IP socket.  From my limited view I believe that I'd
need to somehow attach the appropriate libraries to the binary and then perform
the findFunction() mechanism to locate the socket() and other functions
necessary to open/write/close the socket in the snippet.

The question is, am I correct in my expectations (needing to attach libs), and
more importantly, is there a better mechanism that would give me low performance
cost that would allow me to emit information from a snippet?

Your expectation is correct (assuming that the process does not already have socket I/O linked in, you'd need to add it). I would not (see below) use TCP/IP as my preferred mechanism for collecting instrumentation data, though.

FYI, I'm trying to implement a execution path tracing tool that will indicate
the edges/blocks traversed/visited in a way that identifies what
file:function:edge/block was executed and simple counters aren't really
enough to maintain order of edge traversal.

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.

-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→]