1

I am trying to add basic-block counting to a static analyzer. This analyzer itself uses PIN as default tool for this kind of works.

So, I wrote a pintool for counting basic-blocks. But, when I try to open a complex PDF (eg. with 3D) or Excel, it takes about 5 minutes to proceed.

I am also working on DynamoRIO, but still no luck!

Any solution to count basic-blocks faster?

3
  • @yaspr, you're mistaken. He's talking about the number of basic blocks being executed when his/her target opens a PDF or Excel file. Jul 28, 2014 at 16:23
  • Posting the source of the PIN/DynamoRIO tool would help. Without the source code, we cannot determine what are you doing that causes it to take that long. In any case, binary instrumentation is always slower than normal, non instrumented, execution. Jul 28, 2014 at 16:24
  • You MUST definitely tell more about the method you are using to count basic blocks. The problem may lie in your algorithm... But, it might also be that this overhead is strongly connected with the problem (yet, I don't think that you can count basic blocks at all... just the number of intervals between two conditional jumps in an execution trace... which is something totally different).
    – perror
    Jul 28, 2014 at 17:52

2 Answers 2

2

Does your pintool remove the calls to the instrumentation function from a block after it's called once? This could help with performance for blocks that are called very often if you are only interested in knowing which blocks are reached and not how many times they are.

2

The bbcount example in DynamoRIO should give you a very good starting point, assuming that you really want to count the number of times a basic block is executed at runtime. The instrumentation inserted by this example is very close to the bare minimum you can achieve (it directly inserts an increment instruction pointing to a global buffer and tries to do so at a location where flags are dead, so it can overwrite them safely without restoring them).

1
  • 1
    The bbcount example should run at near native speeds. I don't have benchmarks for the raw bbcount example, but my own project built upon that code (with some additional computation) runs at around 66%-85% of the native speed. So just counting basic blocks should never be slower than that! I've tried Excel, Word, etc. as well and they all run smoothly.
    – jmiserez
    Aug 2, 2014 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.