示例#1
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
}
示例#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
}
示例#3
0
DR_EXPORT void
dr_client_main(client_id_t id, int argc, const char *argv[])
{
    module_data_t *app;
    generic_func_t repeatme_addr;
    drmgr_init();
    if (drfuzz_init(id) != DRMF_SUCCESS)
        EXPECT(false, "drfuzz failed to init");
    dr_register_exit_event(exit_event);

    /* fuzz repeatme */
    app = dr_get_main_module();
    if (app == NULL)
        EXPECT(false, "failed to get application module");
    repeatme_addr = dr_get_proc_address(app->handle, "repeatme");
    if (repeatme_addr == NULL)
        EXPECT(false, "failed to find function repeatme");
    if (drfuzz_fuzz_target(repeatme_addr, 1, 0, DRWRAP_CALLCONV_DEFAULT,
                           pre_fuzz_cb, post_fuzz_cb) != DRMF_SUCCESS)
        EXPECT(false, "drfuzz failed to fuzz function repeatme");
    dr_free_module_data(app);
}
示例#4
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
}