Re: [DynInst_API:] BPatch_object


Date: Mon, 30 Apr 2012 17:27:51 -0500
From: Andrew Bernat <bernat@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] BPatch_object
On Apr 30, 2012, at 4:43 PM, Josh Stone wrote:

There's .text, .init, .fini, etc, but usually these are bottled up in a
single segment, as shown in program headers (readelf -l).  But there
could be many segments, as I guess your rewriting shows.

The reason I bring it up is because it has bitten us in the posterior many times. Once we build a "return one" interface, it's _really_ hard to generalize it. 

Because in general, I have basically a file+offset pair, and I need to
turn that into an address in order to do any sort of instrumentation
point lookup.  Even a function lookup seems not directly interesting, as
I'm not trying to specify things at the function level.

I see functions in SymtabAPI to map offsets to the functions, variables,
modules, etc., but I don't see one to compute the plain address.

Perhaps that can be a BPatch_object method, like ->offsetToAddr() ?
Then I can feed that to createPointsAtAddr().

Ah, okay, you need the opposite. 

We can turn a file, offset pair into an address with complete accuracy; this is making some assumptions about how static libraries work, but I think they can be worked out. For non-static-libraries, the offset has to tell us where in the file we are (text, some other code, data, etc.) and we can use that to distinguish which load address we want. 

BTW, SymtabAPI is working on disk, and so has no concept of a "loaded at" address. There is a wrapper provided for that, but that is a logical thing to expose through BPatch. 

Drew




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