コード例 #1
0
ファイル: nudge_ex.dll.c プロジェクト: Arunpreet/dynamorio
DR_EXPORT
void dr_init(client_id_t id)
{
    client_id = id;
    dr_fprintf(STDERR, "thank you for testing the client interface\n");
    drmgr_init();
    cls_idx = drmgr_register_cls_field(event_thread_context_init,
                                       event_thread_context_exit);
    ASSERT(cls_idx != -1);
    dr_register_nudge_event(event_nudge, id);
    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);

#ifdef WINDOWS
    sysnum_CreateProcess = get_sysnum("NtCreateProcess");
    ASSERT(sysnum_CreateProcess != -1);
    /* not asserting on these since added later */
    sysnum_CreateProcessEx = get_sysnum("NtCreateProcessEx");
    sysnum_CreateUserProcess = get_sysnum("NtCreateUserProcess");
    sysnum_ResumeThread = get_sysnum("NtResumeThread");
    ASSERT(sysnum_ResumeThread != -1);
#endif
}
コード例 #2
0
ファイル: drsyscall_client.c プロジェクト: amy103039/drmemory
DR_EXPORT
void dr_init(client_id_t id)
{
    drsys_options_t ops = { sizeof(ops), 0, };
    drmgr_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");

    test_static_queries();

    test_static_iterator();

    /* XXX: it would be nice to do deeper tests:
     * + drsys_filter_syscall() and have an app that makes both filtered
     *   and unfiltered syscalls
     * + have app make specific syscall w/ specific args and ensure
     *   they match up
     */
}
コード例 #3
0
ファイル: drstrace.c プロジェクト: rnk/drmemory
DR_EXPORT
void dr_init(client_id_t id)
{
    drsys_options_t ops = { sizeof(ops), 0, };
    drmgr_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");
}
コード例 #4
0
ファイル: drstrace.c プロジェクト: DynamoRIO/drmemory
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++;
    }

}
コード例 #5
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
}
コード例 #6
0
ファイル: syscall.c プロジェクト: modulexcite/dynamorio
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
}
コード例 #7
0
ファイル: journaling.c プロジェクト: Abioy/sheepdog
DR_EXPORT void dr_init(client_id_t id)
{
	const char *option;

	option = dr_get_options(id);
	fi_printf("the passed option to this client: %s\n", option);
	sid = atoi(option);
	fi_printf("sid: %d\n", sid);

	init_log_file();

	dr_register_filter_syscall_event(pre_syscall_filter);
	drmgr_init();

	tls_idx = drmgr_register_tls_field();
	drmgr_register_pre_syscall_event(pre_syscall);
	drmgr_register_post_syscall_event(post_syscall);

	drmgr_register_thread_init_event(thread_init_event);
	drmgr_register_thread_exit_event(thread_exit_event);

	jfile_fds[0] = -1;
	jfile_fds[1] = -1;
}