Jim, one orthogonal follow-up question:
Is there a reason you're going image->module and then iterating over all
modules, rather than asking all of these questions at the image level?
And if you do that, does that fix the line information problem?
Rough pseudocode, omitting a ton of variable declarations and error
checking:
getLoopInfo(Address a, BPatch_image* i)
{
i->findFunction(a, funcs);
foreach(f in funcs)
{
CFG = f->getCFG();
CFG->getLoops(loops);
foreach(L in loops)
{
if(a is in L)
{
L->getLoopEntries(entries);
if(entries.size > 1)
{
foreach(e in entries)
{
i->getSourceLines(e.startAddr, lineInfo);
}
}
}
}
}
}
That will be no less efficient (probably moreso) and will ensure that
any glitches between symtab module and BPatch module scopes don't
interfere with the retrieval of line info.
--bw
|