DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[]) { dr_set_client_name("DynamoRIO Sample Client 'inline'", "http://dynamorio.org/issues"); if (!drmgr_init()) DR_ASSERT(false); hashtable_init_ex(&head_table, HASH_BITS, HASH_INTPTR, false/*!strdup*/, false/*synchronization is external*/, free_trace_head_entry, NULL, NULL); dr_register_exit_event(event_exit); if (!drmgr_register_bb_instrumentation_event(event_analyze_bb, NULL, NULL)) DR_ASSERT(false); dr_register_delete_event(event_fragment_deleted); dr_register_end_trace_event(query_end_trace); /* Make it easy to tell from the log file which client executed. */ dr_log(NULL, DR_LOG_ALL, 1, "Client 'inline' initializing\n"); #ifdef SHOW_RESULTS /* also give notification to stderr */ if (dr_is_notify_on()) { # ifdef WINDOWS /* Ask for best-effort printing to cmd window. Must be called at init. */ dr_enable_console_printing(); # endif dr_fprintf(STDERR, "Client inline is running\n"); } #endif }
DR_EXPORT void dr_init(client_id_t id) { htable_mutex = dr_mutex_create(); /* global HASH_BITS-bit addressed hash table */ htable = htable_create(NULL/*global*/); dr_register_exit_event(event_exit); dr_register_bb_event(event_basic_block); dr_register_delete_event(event_fragment_deleted); dr_register_end_trace_event(query_end_trace); /* make it easy to tell, by looking at log file, which client executed */ dr_log(NULL, LOG_ALL, 1, "Client 'inline' initializing\n"); num_complete_inlines = 0; }