当前位置: 首页>>代码示例>>C++>>正文


C++ DR_ASSERT函数代码示例

本文整理汇总了C++中DR_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ DR_ASSERT函数的具体用法?C++ DR_ASSERT怎么用?C++ DR_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DR_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: event_bb_app2app

/* We transform string loops into regular loops so we can more easily
 * monitor every memory reference they make.
 */
static dr_emit_flags_t
event_bb_app2app(void *drcontext, void *tag, instrlist_t *bb, bool for_trace,
                 bool translating)
{
    if (!drutil_expand_rep_string(drcontext, bb)) {
        DR_ASSERT(false);
        /* in release build, carry on: we'll just miss per-iter refs */
    }
    drx_tail_pad_block(drcontext, bb);
    return DR_EMIT_DEFAULT;
}
开发者ID:DynamoRIO,项目名称:dynamorio,代码行数:14,代码来源:memval_simple.c

示例2: event_exit

static void
event_exit(void)
{
#ifdef SHOW_RESULTS
    /* Display the results! */
    char msg[512];
    int len = dr_snprintf(msg, sizeof(msg)/sizeof(msg[0]),
                          "Inlining results:\n"
                          "  Number of traces: %d\n"
                          "  Number of complete inlines: %d\n",
                          num_traces, num_complete_inlines);
    DR_ASSERT(len > 0);
    msg[sizeof(msg)/sizeof(msg[0])-1] = '\0';
    DISPLAY_STRING(msg);
#endif
    hashtable_delete(&head_table);
    if (!drmgr_unregister_bb_instrumentation_event(event_analyze_bb))
        DR_ASSERT(false);
    drmgr_exit();
}
开发者ID:stoyannk,项目名称:dynamorio,代码行数:20,代码来源:inline.c

示例3: table_alloc_bytes

app_pc
table_alloc_bytes(umbra_info_t *info, int size)
{
    app_pc ptr;

    DR_ASSERT(size >= 0 && 
              (info->table.bytes_ptr + size) < 
              (info->table.bytes_table + MAX_BYTES_TABLE_SIZE));
    ptr = info->table.bytes_ptr;
    info->table.bytes_ptr += size;
    return ptr;
}
开发者ID:zhaoqin,项目名称:Umbra,代码行数:12,代码来源:table.c

示例4: event_exit

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();
}
开发者ID:derekbruening,项目名称:dynamorio,代码行数:12,代码来源:bbbuf.c

示例5: event_exit

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();
}
开发者ID:stoyannk,项目名称:dynamorio,代码行数:12,代码来源:syscall.c

示例6: event_exit

static void 
event_exit(void)
{
    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);
}
开发者ID:jikk,项目名称:dbi_study,代码行数:12,代码来源:inscount0.c

示例7: wrap_post

static void
wrap_post(void *wrapcxt, void *user_data)
{
    size_t sz = (size_t) user_data;
    /* test out-of-memory by having a random moderately-large alloc fail */
    if (sz > 1024 && dr_get_random_value(1000) < 10) {
        bool ok = drwrap_set_retval(wrapcxt, NULL);
        DR_ASSERT(ok);
        dr_mutex_lock(max_lock);
        malloc_oom++;
        dr_mutex_unlock(max_lock);
    }
}
开发者ID:FrancisRussell,项目名称:za1610-dynamorio,代码行数:13,代码来源:wrap.c

示例8: umbra_open_proc_log

file_t 
umbra_open_proc_log(process_id_t pid)
{
#ifdef LINUX_KERNEL
    return our_stdout;
#else
    char   name[128];
    int    len;
    file_t logfile;

    /* XXX: Windows need a absolute path */
    name[0] = '\0';
    len = dr_snprintf(name, sizeof(name)/sizeof(name[0]),
                      "umbra.%s.%d.proc.log", 
                      dr_get_application_name(), pid);
    DR_ASSERT(len > 0);
    name[sizeof(name)/sizeof(name[0])-1] = '\0';
    logfile = dr_open_file(name, DR_FILE_READ | DR_FILE_WRITE_APPEND);
    DR_ASSERT(logfile != INVALID_FILE);
    return logfile;
#endif
}
开发者ID:kumarak,项目名称:Granary-Drk,代码行数:22,代码来源:utils.c

示例9: post_func_cb

static void post_func_cb(void * wrapcxt, void ** user_data){
	DEBUG_PRINT("funcwrap - post_func_cb\n");
	per_thread_t * data = drmgr_get_tls_field(dr_get_current_drcontext(), tls_index);
	data->nesting--;
	//dr_unlink_flush_region(0, ~((ptr_uint_t)0));
	DR_ASSERT(data->nesting >= 0); 
	if (data->nesting == 0){
		data->filter_func = false;
	}
	DEBUG_PRINT("funcwrap - post_func_cb done \n");
	

}
开发者ID:CharithYMendis,项目名称:Helium,代码行数:13,代码来源:funcwrap.c

示例10: event_thread_init

static void
event_thread_init(void *drcontext)
{
    file_t log;
    log = log_file_open(client_id, drcontext, NULL /* using client lib path */,
                        "cbrtrace",
#ifndef WINDOWS
                        DR_FILE_CLOSE_ON_FORK |
#endif
                        DR_FILE_ALLOW_LARGE);
    DR_ASSERT(log != INVALID_FILE);
    dr_set_tls_field(drcontext, (void *)(ptr_uint_t)log);
}
开发者ID:AVGirl,项目名称:dynamorio,代码行数:13,代码来源:cbrtrace.c

示例11: module_load_event

static void
module_load_event(void *drcontext, const module_data_t *mod, bool loaded)
{
    app_pc towrap = (app_pc)dr_get_proc_address(mod->handle, "SSL_write");
    if (towrap != NULL) {
        bool ok = drwrap_wrap(towrap, wrap_pre_SSL_write, NULL);
        if (!ok) {
            dr_fprintf(STDERR, "Couldn’t wrap SSL_write\n");
            DR_ASSERT(ok);
        }
    }

    towrap = (app_pc)dr_get_proc_address(mod->handle, "SSL_read");
    if (towrap != NULL) {
        bool ok = drwrap_wrap(towrap, wrap_pre_SSL_read, wrap_post_SSL_read);
        if (!ok) {
            dr_fprintf(STDERR, "Couldn’t wrap SSL_read\n");
            DR_ASSERT(ok);
        }
    }

    towrap = (app_pc)dr_get_proc_address(mod->handle, "gnutls_record_send");
    if (towrap != NULL) {
        bool ok = drwrap_wrap(towrap, wrap_pre_SSL_write, NULL);
        if (!ok) {
            dr_fprintf(STDERR, "Couldn’t wrap gnutls_record_send\n");
            DR_ASSERT(ok);
        }
    }

    towrap = (app_pc)dr_get_proc_address(mod->handle, "gnutls_record_recv");
    if (towrap != NULL) {
        bool ok = drwrap_wrap(towrap, wrap_pre_SSL_read, wrap_post_SSL_read);
        if (!ok) {
            dr_fprintf(STDERR, "Couldn’t wrap gnutls_record_recv\n");
            DR_ASSERT(ok);
        }
    }
}
开发者ID:DynamoRIO,项目名称:dynamorio,代码行数:39,代码来源:ssljack.c

示例12: event_app_analysis

static dr_emit_flags_t
event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, bool for_trace,
                   bool translating, void **user_data)
{
    per_thread_t *data = drmgr_get_tls_field(drcontext, tls_idx);

    *user_data = (void *)&data->reg_addr;
    /* If we have an outstanding write, that means we did not correctly handle a case
     * where there was a write but no fall-through NOP or terminating instruction in
     * the previous basic block.
     */
    DR_ASSERT(data->reg_addr == DR_REG_NULL);
    return DR_EMIT_DEFAULT;
}
开发者ID:DynamoRIO,项目名称:dynamorio,代码行数:14,代码来源:memval_simple.c

示例13: insert_save_addr

static void
insert_save_addr(void *drcontext, instrlist_t *ilist, instr_t *where, opnd_t ref,
                 reg_id_t reg_ptr, reg_id_t reg_addr)
{
    bool ok;
    /* we use reg_ptr as scratch to get addr */
    ok = drutil_insert_get_mem_addr(drcontext, ilist, where, ref, reg_addr, reg_ptr);
    DR_ASSERT(ok);
    insert_load_buf_ptr(drcontext, ilist, where, reg_ptr);
    MINSERT(ilist, where,
            XINST_CREATE_store(drcontext,
                               OPND_CREATE_MEMPTR(reg_ptr, offsetof(mem_ref_t, addr)),
                               opnd_create_reg(reg_addr)));
}
开发者ID:DynamoRIO,项目名称:dynamorio,代码行数:14,代码来源:memtrace_simple.c

示例14: event_exit

static void event_exit()
{
  char msg[512];
  int len;
  len = snprintf(msg, sizeof(msg) / sizeof(msg[0]), "Number of basi blocks built : %"UINT64_FORMAT_CODE"\n"
  "    Average size        : %5.2lf instructions\n",
  counts_as_built.blocks, counts_as_built.total_size / (double)counts_as_built.blocks);
  DR_ASSERT(len > 0);
  msg[sizeof(msg)/sizeof(msg[0])-1] = '\0'; /*NULL Terminate */
  DISPLAY_STRING(msg);

  /* Free mutex */
  dr_mutex_destroy(as_built_lock);
}
开发者ID:screampro,项目名称:DynamoRio,代码行数:14,代码来源:example1.c

示例15: memtrace_init

void memtrace_init(client_id_t id,const char * name, const char * arguments)
{

	char logfilename[MAX_STRING_LENGTH];
	file_t in_file;


	drmgr_init();
    drutil_init();

    client_id = id;
    mutex = dr_mutex_create();

	DR_ASSERT(parse_commandline_args(arguments) == true);
	
	head = md_initialize();


	if(client_arg->filter_mode != FILTER_NONE){
		in_file = dr_open_file(client_arg->filter_filename,DR_FILE_READ);
		DR_ASSERT(in_file != INVALID_FILE);
		md_read_from_file(head,in_file,false);
		dr_close_file(in_file);
	}
    
    tls_index = drmgr_register_tls_field();
    DR_ASSERT(tls_index != -1);

    code_cache_init();

	if (log_mode){
		populate_conv_filename(logfilename, logdir, name, NULL);
		logfile = dr_open_file(logfilename, DR_FILE_WRITE_OVERWRITE);
	}
	strncpy(ins_pass_name, name, MAX_STRING_LENGTH);

}
开发者ID:CharithYMendis,项目名称:Helium,代码行数:37,代码来源:memtrace.c


注:本文中的DR_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。