Hi,
I use a very simple program to test the first example of PatchAPI.
Unfortunately, the dyninst gets crash on this example. More
specifically, func->blocks() cause the system segment fault.
The code is pasted as follows, can someone give me some hint?
Thanks.
Best
Hai
ParseAPI::SymtabCodeSource *sts;
ParseAPI::CodeObject *co;
Address code_base = 0x8048000;
sts = new ParseAPI::SymtabCodeSource( argv[1] );
co = new ParseAPI::CodeObject( sts );
PatchObject *obj = PatchObject::create(co, code_base);
// Find all functions in the object
std::vector<PatchFunction*> all;
obj->funcs(back_inserter(all));
for (std::vector<PatchFunction*>::iterator fi = all.begin();
fi != all.end(); fi++) {
// Print out each function's name
PatchFunction* func = *fi;
std::cout << func->name() << std::endl;
const PatchFunction::Blockset& blks = func->blocks();
for (PatchFunction::BlockSet::iterator bi = blks.begin();
bi != blks.end(); bi++) {
// Print out each block's size
PatchBlock* blk = *bi;
std::cout << "\tBlock size:" << blk->size() << std::endl;
}
}
_______________________________________________
Dyninst-api mailing list
[email protected]
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api