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
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
-- Andrew Bernat Paradyn Project
|