BB requirements for Code Cache flushing

39 views
Skip to first unread message

Mohammad Ewais

unread,
Jan 8, 2022, 4:01:04 PM1/8/22
to DynamoRIO Users
Hello,

I understand that if I want to change my BB instrumentation, I would have to flush the code cache so the new instrumentation would apply on previously seen BBs.

Does the same requirement hold if I just start my BB instrumentation late? In other words, does DR also run uninstrumented code from the code cache?

My second question, how can I flush the code cache for EVERYTHING in my program at once? Looking at the exmaple uses of dr_Region_flush(_ex) my understanding (which of course may be wrong) is that it can applied to a specific BB, but what if I wanted to do it for everything? The traget app, all modules called from it, etc?


John Galea

unread,
Jan 9, 2022, 4:19:09 PM1/9/22
to DynamoRIO Users
Hi,

One option is to apply DR_EMIT_GO_NATIVE to make a thread run natively and then take over using dr_retakeover_suspended_native_thread().

You can also try out drrun's -attach option. It is still considered experimental but it might be useful in your case.  

WRT your 2nd question: To flush `everything` in the code cache, you could use  dr_flush_region(), with maximum size, but flushing is expensive in general. Drbbdup might be an alternative method to handle different instrumentation versions of the same basic blocks without the need for flushing.

John
Reply all
Reply to author
Forward
0 new messages