Re: [DynInst_API:] File offsets


Date: Tue, 26 Mar 2013 11:02:26 -0500
From: Andrew Bernat <bernat@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] File offsets
This is going to be a little chained together, but should work:

using namespace Dyninst;
using namespace ParseAPI;
using namespace SymtabAPI;

Block *block;
SymtabCodeRegion *scr = dynamic_cast<SymtabCodeRegion *>(block->region());
// assuming scr, which will be valid unless you have a very odd compilation of Dyninst
Region *r = scr->symRegion();
Offset diskOffset = block->start() - r->getMemOffset() + r->getDiskOffset();

Drew


On Mar 26, 2013, at 7:49 AM, "E.Robbins" <er209@xxxxxxxxxx> wrote:

Hi again,
I asked about this before, but I could really do with a way to get the file offset of parseapi blocks.

Drew mentioned something in the symtabapi region object - here I see getFileOffset(), and I guess I could calculate the block file offset from that by adding the difference between the block address and the region address? But I can't find a way to get a region object from a block anyway, I can get a coderegion, which I was hoping inherited from region, but it doesn't.

Is there a way to do this, even if it's a nasty hack?

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




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