Date: | Sat, 22 Aug 2015 22:06:47 -0400 |
---|---|
From: | Shuai Wang <wangshuai901@xxxxxxxxx> |
Subject: | [DynInst_API:] Patching every basic block of a given elf binary |
Dear list,
I am a newbie to DynInst, and I am trying to instrument every basic blocks of a given elf binary. For example, to insert a basic block counter at the beginning of each basic block. I installed DynInst 8.2.1, and modified the example in DynInstAPI's appendix A, some code snippet like this: Â..... BPatch_point *entryPointBB(BPatch_basicBlock *bb) { Â Â BPatch_point *points; Â Â points = bb->findPoint(BPatch_entry); Â Â return points; } void binaryAnalysis(BPatch_addressSpace *app) { Â Â BPatch_image *appImage = app->getImage(); Â Â int insns_access_memory = 0; Â Â std::vector<BPatch_function *> funcs; Â Â appImage->findFunction("main", funcs); Â Â BPatch_flowGraph *fg = funcs[0]->getCFG(); Â Â std::set<BPatch_basicBlock *> blocks; Â Â fg->getAllBasicBlocks(blocks); Â Â std::set<BPatch_basicBlock *>::iterator block_iter; Â Â for (block_iter = blocks.begin(); block_iter != blocks.end(); ++block_iter) Â Â { Â Â Â Â BPatch_basicBlock *block = *block_iter; Â Â Â Â BPatch_point * ps = ÂentryPointBB(block); Â Â Â Â //patchBB(app, ps); Â Â Â Â printf("%p\n", ps); Â Â<------------------- (nil) Â Â } } .... However, after the compilation, when I tried to execute the code, I find that BPatch_point ps does not get any value. As a result, the last printf statement print out a nil for this empty pointer.. Here is my question: Am I missed anything? What should I do if I want to instrument every basic block at its front? I really appreciate if anyone can give me some help. Thank you a lot! Sincerely, Shuai |
[← Prev in Thread] | Current Thread | [Next in Thread→] |
---|---|---|
|
Previous by Date: | Re: [DynInst_API:] commit: fix for version macros, Jim Galarowicz |
---|---|
Next by Date: | [DynInst_API:] A question about dynInst's static instrumentation ability, Shuai Wang |
Previous by Thread: | Re: [DynInst_API:] PATCH: have SymtabAPI properly use ELF contents to set architecture, Bill Williams |
Next by Thread: | Re: [DynInst_API:] Patching every basic block of a given elf binary, Xiaozhu Meng |
Indexes: | [Date] [Thread] |