예제 #1
0
/* Parse CL options and register DR event handlers and annotation handlers */
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    context_lock = dr_mutex_create();
    write_lock = dr_mutex_create();

# ifdef WINDOWS
    dr_enable_console_printing();
# endif

    client_id = id;

    /* XXX: should use droption */
    if (argc > 1 && strcmp(argv[1], "full-decode") == 0) {
        PRINTF("Init annotation test client with full decoding");
        dr_register_bb_event(empty_bb_event);
    } else if (argc > 1 && strlen(argv[1]) >= 8 && strncmp(argv[1], "truncate", 8) == 0) {
        bb_truncation_length = (argv[1][9] - '0'); /* format is "truncate@n" (0<n<10) */
        ASSERT(bb_truncation_length < 10 && bb_truncation_length > 0);
        PRINTF("Init annotation test client with bb truncation");
        dr_register_bb_event(bb_event_truncate);
    } else {
        PRINTF("Init annotation test client with fast decoding");
    }

    context_list = dr_global_alloc(sizeof(context_list_t));
    memset(context_list, 0, sizeof(context_list_t));

#if !(defined (WINDOWS) && defined (X64))
    mem_defines = dr_global_alloc(sizeof(mem_defines_t));
    memset(mem_defines, 0, sizeof(mem_defines_t));
#endif

    dr_register_exit_event(event_exit);

    register_call("test_annotation_init_mode", (void *) init_mode, 1);
    register_call("test_annotation_init_context", (void *) init_context, 3);
    register_call("test_annotation_get_mode", (void *) get_mode, 1);
    register_call("test_annotation_set_mode", (void *) set_mode, 2);
#if !(defined (WINDOWS) && defined (X64))
    register_call("test_annotation_rotate_valgrind_handler",
                  (void *) rotate_valgrind_handler, 1);
#endif

    register_call("test_annotation_eight_args", (void *) test_eight_args_v1, 8);
    register_call("test_annotation_eight_args", (void *) test_eight_args_v2, 8);
    /* Test removing the last handler */
    dr_annotation_unregister_call("test_annotation_eight_args", test_eight_args_v1);

    register_call("test_annotation_nine_args", (void *) test_nine_args_v1, 9);
    register_call("test_annotation_nine_args", (void *) test_nine_args_v2, 9);
    /* Test removing the first handler */
    dr_annotation_unregister_call("test_annotation_nine_args", test_nine_args_v2);

    /* Test multiple handlers */
    register_call("test_annotation_ten_args", (void *) test_ten_args_v1, 10);
    register_call("test_annotation_ten_args", (void *) test_ten_args_v2, 10);

    dr_annotation_register_return("test_annotation_get_client_version", (void *) "2.2.8");
}
예제 #2
0
DR_EXPORT void
dr_init(client_id_t id)
{
    module_data_t *appmod  = dr_get_main_module();

    DR_ASSERT(appmod != NULL);
    app_base = appmod->start;
    app_end  = appmod->end;
    dr_free_module_data(appmod);

    /* register events */
    dr_register_exit_event(event_exit);
    dr_register_bb_event(event_basic_block);

    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'modxfer_app2lib' 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 in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client modxfer_app2lib is running\n");
    }
#endif
}
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
# ifdef WINDOWS
    dr_enable_console_printing();
# endif

    client_id = id;

    /* XXX: should use droption */
    if (argc > 1 && strcmp(argv[1], "full-decode") == 0) {
        PRINT("Init annotation test client with full decoding");
        dr_register_bb_event(empty_bb_event);
    } else if (argc > 1 && strlen(argv[1]) >= 8 && strncmp(argv[1], "truncate", 8) == 0) {
        bb_truncation_length = (argv[1][9] - '0'); /* format is "truncate@n" (0<n<10) */
        ASSERT(bb_truncation_length < 10 && bb_truncation_length > 0);
        PRINT("Init annotation test client with bb truncation");
        dr_register_bb_event(bb_event_truncate);
    } else {
        PRINT("Init annotation test client with fast decoding");
    }

    register_call("test_annotation_two_args", (void *) test_two_args, 2);
    register_call("test_annotation_three_args", (void *) test_three_args, 3);
    register_call("test_annotation_eight_args", (void *) test_eight_args, 8);
    register_call("test_annotation_nine_args", (void *) test_nine_args, 9);
    register_call("test_annotation_ten_args", (void *) test_ten_args, 10);
}
예제 #4
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    module_data_t *appmod;
    dr_set_client_name("DynamoRIO Sample Client 'modxfer_app2lib'",
                       "http://dynamorio.org/issues");
    appmod = dr_get_main_module();
    DR_ASSERT(appmod != NULL);
    app_base = appmod->start;
    app_end = appmod->end;
    dr_free_module_data(appmod);

    if (!drmgr_init())
        DR_ASSERT(false);

    /* register events */
    dr_register_exit_event(event_exit);
    if (!drmgr_register_bb_instrumentation_event(event_analyze_bb,
                                                 event_insert_instrumentation, NULL))
        DR_ASSERT(false);

    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, DR_LOG_ALL, 1, "Client 'modxfer_app2lib' 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 modxfer_app2lib is running\n");
    }
#endif
}
예제 #5
0
파일: bbcount.c 프로젝트: AVGirl/dynamorio
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    drreg_options_t ops = {sizeof(ops), 1 /*max slots needed: aflags*/, false};
    dr_set_client_name("DynamoRIO Sample Client 'bbcount'",
                       "http://dynamorio.org/issues");
    if (!drmgr_init() || drreg_init(&ops) != DRREG_SUCCESS)
        DR_ASSERT(false);

    /* register events */
    dr_register_exit_event(event_exit);
    if (!drmgr_register_bb_instrumentation_event(NULL, event_app_instruction, NULL))
        DR_ASSERT(false);

    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'bbcount' 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 bbcount is running\n");
    }
#endif
}
예제 #6
0
파일: inline.c 프로젝트: stoyannk/dynamorio
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
}
예제 #7
0
DR_EXPORT void 
dr_init(client_id_t id)
{
    dr_register_exit_event(event_exit);
    dr_register_trace_event(event_trace);
    /* this optimization is only worthwhile on the Pentium 4, where
     * an add of 1 is faster than an inc
     */
    enable = (proc_get_family() == FAMILY_PENTIUM_4);
    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'inc2add' 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 in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client inc2add is running\n");
    }
#endif
    /* initialize our global variables */
    num_examined = 0;
    num_converted = 0;
}
예제 #8
0
DR_EXPORT void
dr_init(client_id_t id)
{
    dr_set_client_name("DynamoRIO Sample Client 'instrcalls'",
                       "http://dynamorio.org/issues");
    my_id = id;
    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'instrcalls' initializing\n");
    /* also give notification to stderr */
#ifdef SHOW_RESULTS
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        /* ask for best-effort printing to cmd window.  must be called in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client instrcalls is running\n");
    }
#endif
    dr_register_exit_event(event_exit);
    dr_register_bb_event(event_basic_block);
    dr_register_thread_init_event(event_thread_init);
    dr_register_thread_exit_event(event_thread_exit);
#ifdef SHOW_SYMBOLS
    if (drsym_init(0) != DRSYM_SUCCESS) {
        dr_log(NULL, LOG_ALL, 1, "WARNING: unable to initialize symbol translation\n");
    }
#endif
}
예제 #9
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    /* We need 2 reg slots beyond drreg's eflags slots => 3 slots */
    drreg_options_t ops = {sizeof(ops), 3, false};
    /* Specify priority relative to other instrumentation operations: */
    drmgr_priority_t priority = {
        sizeof(priority), /* size of struct */
        "memtrace",       /* name of our operation */
        NULL,             /* optional name of operation we should precede */
        NULL,             /* optional name of operation we should follow */
        0};               /* numeric priority */
    dr_set_client_name("DynamoRIO Sample Client 'memtrace'",
                       "http://dynamorio.org/issues");
    page_size = dr_page_size();
    drmgr_init();
    drutil_init();
    client_id = id;
    mutex = dr_mutex_create();
    dr_register_exit_event(event_exit);
    if (!drmgr_register_thread_init_event(event_thread_init) ||
        !drmgr_register_thread_exit_event(event_thread_exit) ||
        !drmgr_register_bb_app2app_event(event_bb_app2app, &priority) ||
        !drmgr_register_bb_instrumentation_event(NULL, event_bb_insert, &priority) ||
        drreg_init(&ops) != DRREG_SUCCESS) {
        /* something is wrong: can't continue */
        DR_ASSERT(false);
        return;
    }
    tls_index = drmgr_register_tls_field();
    DR_ASSERT(tls_index != -1);

    code_cache_init();
    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, DR_LOG_ALL, 1, "Client 'memtrace' initializing\n");
#ifdef SHOW_RESULTS
    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 memtrace is running\n");
    }
#endif
}
예제 #10
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    /* We need no drreg slots ourselves, but we initialize drreg as we call
     * drreg_restore_app_values(), required since drx_insert_counter_update()
     * uses drreg when drmgr is used.
     */
    drreg_options_t ops = {sizeof(ops)};
    dr_set_client_name("DynamoRIO Sample Client 'modxfer'",
                       "http://dynamorio.org/issues");
    if (!drmgr_init() || drreg_init(&ops) != DRREG_SUCCESS)
        DR_ASSERT(false);
    drx_init();
    /* register events */
    dr_register_exit_event(event_exit);
    if (!drmgr_register_bb_instrumentation_event(event_analyze_bb,
                                                 event_insert_instrumentation, NULL))
        DR_ASSERT(false);
    drmgr_register_module_load_event(event_module_load);
    drmgr_register_module_unload_event(event_module_unload);

    mod_lock = dr_mutex_create();

    logfile = log_file_open(id, NULL /* drcontext */,
                            NULL/* path */, "modxfer",
#ifndef WINDOWS
                            DR_FILE_CLOSE_ON_FORK |
#endif
                            DR_FILE_ALLOW_LARGE);

    DR_ASSERT(logfile != INVALID_FILE);
    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'modxfer' 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 modxfer is running\n");
    }
#endif
}
예제 #11
0
파일: signal.c 프로젝트: aiaxun/patharmor
DR_EXPORT void
dr_init(client_id_t id)
{
    dr_set_client_name("DynamoRIO Sample Client 'signal'",
                       "http://dynamorio.org/issues");
#ifdef UNIX
    dr_register_signal_event(event_signal);
#endif
    dr_register_exit_event(event_exit);
#ifdef SHOW_RESULTS
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        /* ask for best-effort printing to cmd window.  must be called in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client signal is running\n");
    }
#endif
}
예제 #12
0
DR_EXPORT void 
dr_init(client_id_t id)
{
    num_bb = 0;
    ave_size = 0.;
    max_size = 0;
    stats_mutex = dr_mutex_create();
    dr_register_bb_event(event_basic_block);
    dr_register_exit_event(event_exit);
#ifdef SHOW_RESULTS
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        /* ask for best-effort printing to cmd window.  must be called in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client bbsize is running\n");
    }
#endif
}
예제 #13
0
DR_EXPORT void 
dr_init(client_id_t id)
{
    dr_printf("dr_init()\n");
    my_bbcount = 0;
    stats_mutex = dr_mutex_create();
    dr_register_exit_event(event_exit);
    dr_register_bb_event(event_basic_block);

#ifdef SHOW_RESULTS
    dr_log(NULL, LOG_ALL, 1, "Client 'inspar' initializing\n");
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client inspar is running\n");
    }
#endif
}
예제 #14
0
DR_EXPORT
void dr_init(client_id_t id)
{
    uint i = 0;
    uint const_arrays_num;
    drsys_options_t ops = { sizeof(ops), 0, };

    dr_set_client_name("Dr. STrace", "http://drmemory.org/issues");

#ifdef WINDOWS
    dr_enable_console_printing();
#endif

    options_init(id);
    drsym_init(0);
    drmgr_init();
    drx_init();

    if (drsys_init(id, &ops) != DRMF_SUCCESS)
        ASSERT(false, "drsys failed to init");
    dr_register_exit_event(exit_event);

    dr_register_filter_syscall_event(event_filter_syscall);
    drmgr_register_pre_syscall_event(event_pre_syscall);
    drmgr_register_post_syscall_event(event_post_syscall);
    if (drsys_filter_all_syscalls() != DRMF_SUCCESS)
        ASSERT(false, "drsys_filter_all_syscalls should never fail");
    open_log_file();

    const_arrays_num = get_const_arrays_num();
    hashtable_init(&nconsts_table, HASHTABLE_BITSIZE, HASH_STRING, false);
    while (i < const_arrays_num) {
        const_values_t *named_consts = const_struct_array[i];
        bool res = hashtable_add(&nconsts_table,
                                 (void *) named_consts[0].const_name,
                                 (void *) named_consts);
        if (!res)
            ASSERT(false, "drstrace failed to add to hashtable");
        i++;
    }

}
예제 #15
0
파일: inscount.c 프로젝트: cherry-wb/dr-vis
DR_EXPORT void 
dr_init(client_id_t id)
{
    /* register events */
    dr_register_exit_event(event_exit);
    dr_register_bb_event(event_basic_block);

    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'inscount' 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 in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client inscount is running\n");
    }
#endif
}
예제 #16
0
DR_EXPORT void 
dr_init(client_id_t id)
{
    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'wrap' initializing\n");
    /* also give notification to stderr */
#ifdef SHOW_RESULTS
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        /* ask for best-effort printing to cmd window.  must be called in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client wrap is running\n");
    }
#endif
    drwrap_init();
    dr_register_exit_event(event_exit);
    dr_register_module_load_event(module_load_event);
    max_lock = dr_mutex_create();
}
예제 #17
0
파일: strace.c 프로젝트: mephi42/dynamorio
DR_EXPORT void 
dr_init(client_id_t id)
{
    drmgr_init();
    write_sysnum = get_write_sysnum();
    dr_register_filter_syscall_event(event_filter_syscall);
    drmgr_register_pre_syscall_event(event_pre_syscall);
    drmgr_register_post_syscall_event(event_post_syscall);
    dr_register_exit_event(event_exit);
    tcls_idx = drmgr_register_cls_field(event_thread_context_init,
                                        event_thread_context_exit);
    DR_ASSERT(tcls_idx != -1);
#ifdef SHOW_RESULTS
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        /* ask for best-effort printing to cmd window.  must be called in dr_init(). */
        dr_enable_console_printing();
# endif
        dr_fprintf(STDERR, "Client strace is running\n");
    }
#endif
}
예제 #18
0
파일: cbrtrace.c 프로젝트: AVGirl/dynamorio
DR_EXPORT
void dr_client_main(client_id_t id, int argc, const char *argv[])
{
    dr_set_client_name("DynamoRIO Sample Client 'cbrtrace'",
                       "http://dynamorio.org/issues");
    dr_log(NULL, LOG_ALL, 1, "Client 'cbrtrace' initializing");

    client_id = id;
    dr_register_thread_init_event(event_thread_init);
    dr_register_thread_exit_event(event_thread_exit);
    dr_register_bb_event(event_basic_block);
    dr_register_exit_event(event_exit);

#ifdef SHOW_RESULTS
    if (dr_is_notify_on()) {
# ifdef WINDOWS
        dr_enable_console_printing();
# endif /* WINDOWS */
        dr_fprintf(STDERR, "Client 'cbrtrace' is running\n");
    }
#endif /* SHOW_RESULTS */
}
예제 #19
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    dr_set_client_name("DynamoRIO Sample Client 'inscount'",
                       "http://dynamorio.org/issues");

    /* Options */
    if (!droption_parser_t::parse_argv(DROPTION_SCOPE_CLIENT, argc, argv, NULL, NULL))
        DR_ASSERT(false);
    drmgr_init();

    /* Get main module address */
    if (only_from_app.get_value()) {
        module_data_t *exe = dr_get_main_module();
        if (exe != NULL)
            exe_start = exe->start;
        dr_free_module_data(exe);
    }

    /* register events */
    dr_register_exit_event(event_exit);
    drmgr_register_bb_instrumentation_event(event_bb_analysis, event_app_instruction,
                                            NULL);

    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, DR_LOG_ALL, 1, "Client 'inscount' 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 inscount is running\n");
    }
#endif
}
예제 #20
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    dr_set_client_name("DynamoRIO Sample Client 'countcalls'",
                       "http://dynamorio.org/issues");
    /* register events */
    dr_register_exit_event(event_exit);
    dr_register_thread_init_event(event_thread_init);
    dr_register_thread_exit_event(event_thread_exit);
    dr_register_bb_event(event_basic_block);

    /* make it easy to tell, by looking at log file, which client executed */
    dr_log(NULL, LOG_ALL, 1, "Client 'countcalls' 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 countcalls is running\n");
    }
#endif
}
예제 #21
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    dr_set_client_name("DynamoRIO Sample Client 'syscall'",
                       "http://dynamorio.org/issues");
    drmgr_init();
    write_sysnum = get_write_sysnum();
    dr_register_filter_syscall_event(event_filter_syscall);
    drmgr_register_pre_syscall_event(event_pre_syscall);
    drmgr_register_post_syscall_event(event_post_syscall);
    dr_register_exit_event(event_exit);
    tcls_idx = drmgr_register_cls_field(event_thread_context_init,
                                        event_thread_context_exit);
    DR_ASSERT(tcls_idx != -1);
#ifdef SHOW_RESULTS
    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 syscall is running\n");
    }
#endif
}
예제 #22
0
DR_EXPORT void
dr_init(client_id_t id)
{

	int i = 0;
	int j = 0;

	drmgr_init();
	dr_enable_console_printing();

	setupInsPasses();
	doCommandLineArgProcessing(id);


	DEBUG_PRINT("argument length - %d\n", argument_length);
	for (i = 0; i < argument_length; i++){
		DEBUG_PRINT("\"%s - %s\"\n", arguments[i].name, arguments[i].arguments);
	}

	dr_register_nudge_event(nudge_event, id);

	/*if (log_mode){
		populate_conv_filename(global_logfilename, logdir, "global", NULL);
		global_logfile = dr_open_file(global_logfilename, DR_FILE_WRITE_OVERWRITE);
		DR_ASSERT(global_logfile != INVALID_FILE);
	}*/

	//dr_messagebox("client id - %d\n", id);
	DEBUG_PRINT("%s is starting\n", dr_get_application_name());
	/* if you are using it only for photoshop do no instrument other exes */
	if (strcmp(exec, "photoshop") == 0){
		DEBUG_PRINT("photoshop detected only instrumenting Photoshop.exe\n");
		if(strcmp(dr_get_application_name(), "Photoshop.exe") != 0){
			return;
		}
		DEBUG_PRINT("starting to instrument Photoshop.exe\n");
	}

	

	for( i=0 ; i<argument_length; i++){
		for( j=0; j<pass_length; j++){
			if(strcmp(arguments[i].name,ins_pass[j].name) == 0){
				//we can now register the call backs
				DEBUG_PRINT("%s - registered\n", arguments[i].name);

				DEBUG_PRINT("%s - initializing...\n", arguments[i].name);
				ins_pass[j].init_func(id,arguments[i].name, arguments[i].arguments);
				DEBUG_PRINT("%s - initialized\n", arguments[i].name);

				//register thread events
				if(ins_pass[j].thread_init != NULL)
					drmgr_register_thread_init_event(ins_pass[j].thread_init);
				if(ins_pass[j].thread_exit != NULL)
					drmgr_register_thread_exit_event(ins_pass[j].thread_exit);
				
				//register bb events
				if(ins_pass[j].app2app_bb != NULL)
					drmgr_register_bb_app2app_event(ins_pass[j].app2app_bb,
									&ins_pass[j].priority);
				if(ins_pass[j].instrumentation_bb != NULL || ins_pass[j].analysis_bb != NULL)
					drmgr_register_bb_instrumentation_event(ins_pass[j].analysis_bb,
										ins_pass[j].instrumentation_bb,
										&ins_pass[j].priority);
				if (ins_pass[j].module_load != NULL)
					drmgr_register_module_load_event_ex(ins_pass[j].module_load, &ins_pass[j].priority);
				if (ins_pass[j].module_unload != NULL)
					drmgr_register_module_unload_event_ex(ins_pass[j].module_unload, &ins_pass[j].priority);
			}
		}
	}

	

	dr_register_exit_event(process_exit_routine_call);
		
}