DynamoRIO
|
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);
+ static dr_emit_flags_t
+ bool for_trace, bool translating);
DR_EXPORT void
{
+ /* register events */
+ dr_register_exit_event(event_exit);
+ dr_register_bb_event(event_basic_block);
}
+ static void
+ event_exit(void)
+ {
+ /* empty */
+ }
+
+ static dr_emit_flags_t
+ bool for_trace, bool translating)
+ {
+ /* empty */
+ return DR_EMIT_DEFAULT;
+ }
Top-level include file for DynamoRIO API.
DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[])
DR_API void dr_register_bb_event(dr_emit_flags_t(*func)(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, bool translating))
DR_API void dr_register_exit_event(void(*func)(void))