Esempio n. 1
0
static void test_local_variable(simgrid::mc::ObjectInformation* info, const char* function, const char* variable, void* address, unw_cursor_t* cursor) {
  simgrid::mc::Frame* subprogram = find_function_by_name(info, function);
  assert(subprogram);
  // TODO, Lookup frame by IP and test against name instead

  simgrid::mc::Variable* var = find_local_variable(subprogram, variable);
  assert(var);

  void* frame_base = subprogram->frame_base(*cursor);
  simgrid::dwarf::Location location = simgrid::dwarf::resolve(
    var->location_list, info, cursor, frame_base, nullptr, -1);

  xbt_assert(location.in_memory(), "Expected the variable %s of function %s to be in memory", variable, function);
  xbt_assert(location.address() == address, "Bad resolution of local variable %s of %s", variable, function);
}
Esempio n. 2
0
static void get_master_applies(object_t *  ob) {
    int i;
    /* master_applies will be allocated if we're recompiling master_ob */
	/* 如果我们重新编译master_ob,那么新master_applies将会申请新内存 */
    if (master_applies)		/* 如果已经存在apply,那么释放掉,换新的 */
        FREE(master_applies);
    master_applies = CALLOCATE(NUM_MASTER_APPLIES, function_lookup_info_t,
                               TAG_SIMULS, "get_master_applies");

    for (i = 0; i < NUM_MASTER_APPLIES; i++) {
        char *name = applies_table[i];
        int ind, ri;

        if (find_function_by_name(ob, name, &ind, &ri)) {
            master_applies[i].func = find_func_entry(ob->prog, ri);
            master_applies[i].index = ri;
        } else {
            master_applies[i].func = 0;
        }
    }
}