DynamoRIO API
average_bb_size.p2

Now we register for events we'll need. For our first pass we only need to register for the bb event (to add our instrumentation) and the exit event (to display the results). We don't need to register for trace events (as we will add our instrumentation to the constituent bbs) and we can ignore the for_trace and translating arguments to the basic block callback as our changes are deterministic and idempotent so DynamoRIO default translation will work fine.

#include "dr_api.h"
+ static void
+ event_exit(void);
+ event_basic_block(void *drcontext, void *tag, instrlist_t *bb,
+ bool for_trace, bool translating);
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
+ /* register events */
+ dr_register_exit_event(event_exit);
+ dr_register_bb_event(event_basic_block);
}
+ static void
+ event_exit(void)
+ {
+ /* empty */
+ }
+
+ event_basic_block(void *drcontext, void *tag, instrlist_t *bb,
+ bool for_trace, bool translating)
+ {
+ /* empty */
+ return DR_EMIT_DEFAULT;
+ }

[ prev | next ]