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);
+ 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 ]

Top-level include file for DynamoRIO API.
DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[])
dr_emit_flags_t
Definition: dr_events.h:138
struct _instrlist_t instrlist_t
Definition: dr_defines.h:902
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))
@ DR_EMIT_DEFAULT
Definition: dr_events.h:140
uint client_id_t
Definition: dr_defines.h:357