Example #1
0
static void
event_exit(void)
{
#ifdef SHOW_RESULTS
    char msg[512];
    int len;
    uint64 total_count = app_count + lib_count;
    /* We only instrument indirect calls/jmps, and assume that
     * there would be a return paired with indirect calls/jmps.
     */
    uint64 total_xfer = (app2lib + lib2app);
    len = dr_snprintf(msg, sizeof(msg) / sizeof(msg[0]),
                      "Instrumentation results:\n"
                      "\t%10llu instructions executed\n"
                      "\t%10llu (%2.3f%%) in app\n"
                      "\t%10llu (%2.3f%%) in lib,\n"
                      "\t%10llu (%2.3f%%) call/jmp between app and lib\n"
                      "\t%10u app call/jmp to lib\n"
                      "\t%10u lib call/jmp to app\n",
                      total_count, app_count, 100 * (float)app_count / total_count,
                      lib_count, 100 * (float)lib_count / total_count, total_xfer,
                      100 * (float)total_xfer / total_count, app2lib, lib2app);
    DR_ASSERT(len > 0);
    NULL_TERMINATE(msg);
    DISPLAY_STRING(msg);
#endif /* SHOW_RESULTS */
    if (!drmgr_unregister_bb_instrumentation_event(event_analyze_bb))
        DR_ASSERT(false);
    drmgr_exit();
}
Example #2
0
static void
event_exit(void)
{
    file_t f;
    /* Display the results! */
    char msg[512];
    int len;
    len = dr_snprintf(msg, sizeof(msg)/sizeof(msg[0]),
                      "Instrumentation results:\n"
                      "  saw %" STAT_FORMAT_CODE " flops\n", stats->num_flops);
    DR_ASSERT(len > 0);
    msg[sizeof(msg)/sizeof(msg[0])-1] = '\0';
#ifdef SHOW_RESULTS
    DISPLAY_STRING(msg);
#endif /* SHOW_RESULTS */

    /* On Windows we need an absolute path so we place it in
     * the same directory as our library.
     */
    f = log_file_open(my_id, NULL, NULL /* client lib path */, "stats", 0);
    DR_ASSERT(f != INVALID_FILE);
    dr_fprintf(f, "%s\n", msg);
    dr_close_file(f);

    shared_memory_exit();

    drx_exit();
    if (!drmgr_unregister_bb_instrumentation_event(event_analyze_bb))
        DR_ASSERT(false);
    drmgr_exit();
}
Example #3
0
drcovlib_status_t
drmodtrack_exit(void)
{
    drvector_delete(&module_table.vector);
    drmgr_exit();
    return DRCOVLIB_SUCCESS;
}
Example #4
0
static
void exit_event(void)
{
    if (drsys_exit() != DRMF_SUCCESS)
        ASSERT(false, "drsys failed to exit");
    drmgr_exit();
}
Example #5
0
static void
event_exit(void)
{
    dr_mutex_destroy(syslock);
    dr_mutex_destroy(threadlock);
    CHECK(checked_tls_from_cache, "failed to hit clean call");
    CHECK(checked_cls_from_cache, "failed to hit clean call");
    CHECK(checked_tls_write_from_cache, "failed to hit clean call");
    CHECK(checked_cls_write_from_cache, "failed to hit clean call");
    CHECK(one_time_exec == 1, "failed to execute one-time event");

    if (!drmgr_unregister_bb_instrumentation_event(event_bb_analysis))
        CHECK(false, "drmgr unregistration failed");

    if (!drmgr_unregister_bb_instrumentation_ex_event(event_bb4_app2app,
                                                      event_bb4_analysis,
                                                      event_bb4_insert,
                                                      event_bb4_instru2instru))
        CHECK(false, "drmgr unregistration failed");

    if (!drmgr_unregister_cls_field(event_thread_context_init,
                                    event_thread_context_exit, cls_idx))
        CHECK(false, "drmgr unregistration failed");

    drmgr_exit();
    dr_fprintf(STDERR, "all done\n");
}
Example #6
0
void instrace_exit_event()
{

	int i;

	DEBUG_PRINT("%s - total amount of instructions - %d\n",ins_pass_name, num_refs);

	if (client_arg->instrace_mode == OPCODE_TRACE){
		dr_printf("opcodes that were covered in this part of the code - \n");
		for (i = OP_FIRST; i <= OP_LAST; i++){
			if (opcodes_visited[i]){
				dr_printf(logfile,"%s - ", decode_opcode_name(i));
			}
		}
		dr_printf("\n");
	}

	md_delete_list(head, false);
	md_delete_list(instrace_head, false);
	dr_global_free(client_arg,sizeof(client_arg_t));
    code_cache_exit();
    drmgr_unregister_tls_field(tls_index);
    dr_mutex_destroy(mutex);
	if (log_mode){
		dr_close_file(logfile);
	}
    drutil_exit();
    drmgr_exit();
}
Example #7
0
static void
event_exit()
{
#ifdef SHOW_RESULTS
    char msg[512];
    int len;
    len = dr_snprintf(msg, sizeof(msg)/sizeof(msg[0]),
                      "Instrumentation results:\n"
                      "  saw %llu memory references\n",
                      num_refs);
    DR_ASSERT(len > 0);
    NULL_TERMINATE_BUFFER(msg);
    DISPLAY_STRING(msg);
#endif /* SHOW_RESULTS */
    code_cache_exit();

    if (!drmgr_unregister_tls_field(tls_index) ||
        !drmgr_unregister_thread_init_event(event_thread_init) ||
        !drmgr_unregister_thread_exit_event(event_thread_exit) ||
        !drmgr_unregister_bb_insertion_event(event_bb_insert) ||
        drreg_exit() != DRREG_SUCCESS)
        DR_ASSERT(false);

    dr_mutex_destroy(mutex);
    drmgr_exit();
}
Example #8
0
static void
exit_event(void)
{
    if (umbra_destroy_mapping(umbra_map) != DRMF_SUCCESS)
        DR_ASSERT(false);
    umbra_exit();
    drmgr_exit();
}
Example #9
0
static void
event_exit(void)
{
    if (!drmgr_unregister_bb_insertion_event(event_app_instruction) ||
        drreg_exit() != DRREG_SUCCESS)
        CHECK(false, "exit failed");
    drmgr_exit();
}
Example #10
0
static void
event_exit(void)
{
    drmgr_unregister_tls_field(tls_idx);
    drwrap_exit();
    drmgr_exit();
    dr_fprintf(STDERR, "all done\n");
}
Example #11
0
static void
exit_event(void)
{
    if (drfuzz_exit() != DRMF_SUCCESS)
        EXPECT(false, "drfuzz failed to exit");
    dr_fprintf(STDERR, "TEST PASSED\n");
    drmgr_exit();
}
Example #12
0
static void
event_exit(void)
{
    dr_fprintf(STDERR, "client exiting\n");
    drmgr_unregister_cls_field(event_thread_context_init,
                               event_thread_context_exit,
                               cls_idx);
    drmgr_exit();
}
Example #13
0
static void
event_exit(void)
{
    show_results();
    drmgr_unregister_cls_field(event_thread_context_init,
                               event_thread_context_exit,
                               tcls_idx);
    drmgr_exit();
}
Example #14
0
static void
event_exit(void)
{
    drx_exit();
    drreg_exit();
    drmgr_exit();
    CHECK(counterB == 3 * counterA, "counter inc messed up");
    dr_fprintf(STDERR, "event_exit\n");
}
Example #15
0
static void
event_exit(void)
{
    display_results(&global_count, "");
    if (!drmgr_unregister_bb_insertion_event(event_instruction) ||
        !drmgr_unregister_thread_init_event(event_thread_init) ||
        !drmgr_unregister_thread_exit_event(event_thread_exit) ||
        drreg_exit() != DRREG_SUCCESS)
        DR_ASSERT(false);
    drmgr_exit();
}
Example #16
0
static void
event_exit(void)
{
    show_results();
    if (!drmgr_unregister_cls_field(event_thread_context_init,
                                    event_thread_context_exit,
                                    tcls_idx) ||
        !drmgr_unregister_pre_syscall_event(event_pre_syscall) ||
        !drmgr_unregister_post_syscall_event(event_post_syscall))
        DR_ASSERT(false && "failed to unregister");
    drmgr_exit();
}
Example #17
0
static
void exit_event(void)
{
    drsys_gateway_t gateway;
    if (drsys_syscall_gateway(&gateway) != DRMF_SUCCESS ||
        gateway == DRSYS_GATEWAY_UNKNOWN)
        ASSERT(false, "drsys failed to determine syscall gateway");
    if (drsys_exit() != DRMF_SUCCESS)
        ASSERT(false, "drsys failed to exit");
    dr_fprintf(STDERR, "TEST PASSED\n");
    drmgr_exit();
}
Example #18
0
static void
event_exit(void)
{
    if (!drmgr_unregister_thread_init_event(event_thread_init) ||
        !drmgr_unregister_bb_insertion_event(event_app_instruction) ||
        drreg_exit() != DRREG_SUCCESS)
        DR_ASSERT(false);

    drx_buf_free(buf);
    drmgr_exit();
    drx_exit();
}
Example #19
0
static
void exit_event(void)
{
    if (outf != STDERR)
        dr_close_file(outf);
    if (drsys_exit() != DRMF_SUCCESS)
        ASSERT(false, "drsys failed to exit");
    drsym_exit();
    drx_exit();
    drmgr_exit();
    hashtable_delete(&nconsts_table);
}
Example #20
0
void <client_name>_exit_event(void)
{

	md_delete_list(head, false);
	dr_global_free(client_arg, sizeof(client_arg_t));
	drmgr_unregister_tls_field(tls_index);
	if (log_mode){
		dr_close_file(logfile);
	}
	drmgr_exit();

}
Example #21
0
static void 
event_exit(void)
{
    CHECK(checked_tls_from_cache, "failed to hit clean call");
    CHECK(checked_cls_from_cache, "failed to hit clean call");
    CHECK(checked_tls_write_from_cache, "failed to hit clean call");
    CHECK(checked_cls_write_from_cache, "failed to hit clean call");
    drmgr_unregister_cls_field(event_thread_context_init,
                               event_thread_context_exit,
                               cls_idx);
    drmgr_exit();
    dr_fprintf(STDERR, "all done\n");
}
Example #22
0
DR_EXPORT
void
drx_exit()
{
    int count = dr_atomic_add32_return_sum(&drx_init_count, -1);
    if (count != 0)
        return;

    if (soft_kills_enabled)
        soft_kills_exit();

    drmgr_exit();
}
Example #23
0
static void exit_event(void)
{
    if (outfile != INVALID_FILE) {
        dr_fprintf(outfile, "exit while recording enabled\n");
        dr_close_file(outfile);
        outfile = INVALID_FILE;
    }
    drsym_exit();
    drreg_exit();
    drwrap_exit();
    drutil_exit();
    drmgr_exit();
}
Example #24
0
void memtrace_exit_event()
{

	md_delete_list(head,false);
    code_cache_exit();
    drmgr_unregister_tls_field(tls_index);
	if (log_mode){
		dr_close_file(logfile);
	}
    dr_mutex_destroy(mutex);
	dr_global_free(client_arg, sizeof(client_arg_t));
    drutil_exit();
    drmgr_exit();
}
Example #25
0
static void
event_exit(void)
{
#ifdef SHOW_RESULTS
    char msg[512];
    int len;
    len = dr_snprintf(msg, sizeof(msg) / sizeof(msg[0]),
                      "Instrumentation results: %llu instructions executed\n",
                      global_count);
    DR_ASSERT(len > 0);
    NULL_TERMINATE(msg);
    DISPLAY_STRING(msg);
#endif /* SHOW_RESULTS */
    drmgr_exit();
}
Example #26
0
static void
event_exit(void)
{
    if (!drmgr_unregister_tls_field(tls_idx) ||
        !drmgr_unregister_thread_init_event(event_thread_init) ||
        !drmgr_unregister_thread_exit_event(event_thread_exit) ||
        !drmgr_unregister_bb_app2app_event(event_bb_app2app) ||
        !drmgr_unregister_bb_insertion_event(event_app_instruction))
        DR_ASSERT(false);

    drx_buf_free(write_buffer);
    drx_buf_free(trace_buffer);
    drutil_exit();
    drreg_exit();
    drmgr_exit();
    drx_exit();
}
Example #27
0
static void
event_exit(void)
{
    /* we are supposed to have faulted NUM_ITER times per thread, plus 2 more
     * because the callback is called on thread_exit(). Finally, two more for
     * drx_buf_insert_buf_memcpy().
     */
    CHECK(num_faults == NUM_ITER * 2 + 2 + 2,
            "the number of faults don't match up");
    if (!drmgr_unregister_bb_insertion_event(event_app_instruction))
        CHECK(false, "exit failed");
    drx_buf_free(circular_fast);
    drx_buf_free(circular_slow);
    drx_buf_free(trace);
    drmgr_unregister_thread_init_event(event_thread_init);
    drmgr_exit();
    drx_exit();
}
Example #28
0
DR_EXPORT drmf_status_t
drfuzz_exit(void)
{
    int count = dr_atomic_add32_return_sum(&drfuzz_init_count, -1);
    if (count > 0)
        return DRMF_SUCCESS;
    if (count < 0)
        return DRMF_ERROR;

    global_free(callbacks, sizeof(drfuzz_callbacks_t), HEAPSTAT_MISC);

    drmgr_exit();
    drwrap_exit();

    hashtable_delete(&fuzz_target_htable);

    return DRMF_SUCCESS;
}
Example #29
0
static void
exit_event(void)
{
#ifdef SHOW_RESULTS
    char msg[512];
    int len;
    len = dr_snprintf(msg, sizeof(msg)/sizeof(msg[0]),
                      "Instrumentation results:\n"
                      "  saw %d div instructions\n"
                      "  of which %d were powers of 2\n",
                      div_count, div_p2_count);
    DR_ASSERT(len > 0);
    NULL_TERMINATE(msg);
    DISPLAY_STRING(msg);
#endif /* SHOW_RESULTS */

    dr_mutex_destroy(count_mutex);
    drmgr_exit();
}
Example #30
0
static void
event_exit(void)
{
    dr_log(NULL, DR_LOG_ALL, 1, "Client 'memtrace' num refs seen: " SZFMT "\n", num_refs);
    if (!dr_raw_tls_cfree(tls_offs, MEMTRACE_TLS_COUNT))
        DR_ASSERT(false);

    if (!drmgr_unregister_tls_field(tls_idx) ||
        !drmgr_unregister_thread_init_event(event_thread_init) ||
        !drmgr_unregister_thread_exit_event(event_thread_exit) ||
        !drmgr_unregister_bb_app2app_event(event_bb_app2app) ||
        !drmgr_unregister_bb_insertion_event(event_app_instruction) ||
        drreg_exit() != DRREG_SUCCESS)
        DR_ASSERT(false);

    dr_mutex_destroy(mutex);
    drutil_exit();
    drmgr_exit();
}