xbt_mheap_t mmalloc_set_current_heap(xbt_mheap_t new_heap);
xbt_mheap_t mmalloc_get_current_heap(void);
-struct s_dw_type;
-
int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2);
int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2);
int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t to_ignore1, xbt_dynar_t to_ignore2);
-int compare_heap_area(int process_index, const void *area1, const void* area2, mc_snapshot_t snapshot1, mc_snapshot_t snapshot2, xbt_dynar_t previous, struct s_dw_type *type, int pointer_level);
+int compare_heap_area(int process_index, const void *area1, const void* area2, mc_snapshot_t snapshot1, mc_snapshot_t snapshot2, xbt_dynar_t previous, mc_type_t type, int pointer_level);
void reset_heap_information(void);
size_t mmalloc_get_bytes_used(xbt_mheap_t);
int process_index,
void* real_area1, mc_snapshot_t snapshot1, mc_mem_region_t region1,
void* real_area2, mc_snapshot_t snapshot2, mc_mem_region_t region2,
- dw_type_t type, int pointer_level)
+ mc_type_t type, int pointer_level)
{
mc_process_t process = &mc_model_checker->process();
unsigned int cursor = 0;
- dw_type_t member, subtype, subsubtype;
+ mc_type_t member, subtype, subsubtype;
int elm_size, i, res;
top:
else if (region1->contain(simgrid::mc::remote(addr_pointed1))) {
if (!region2->contain(simgrid::mc::remote(addr_pointed2)))
return 1;
- if (type->dw_type_id == NULL)
+ if (type->dw_type_id.empty())
return (addr_pointed1 != addr_pointed2);
else {
return compare_areas_with_type(state, process_index,
|| (char *) current_var->address > (char *) object_info->end_rw)
continue;
- dw_type_t bvariable_type = current_var->type;
+ mc_type_t bvariable_type = current_var->type;
res =
compare_areas_with_type(state, process_index,
(char *) current_var->address, snapshot1, r1,
}
// TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
- dw_type_t subtype = current_var1->type;
+ mc_type_t subtype = current_var1->type;
res =
compare_areas_with_type(state, process_index,
current_var1->address, snapshot1, mc_get_snapshot_region(current_var1->address, snapshot1, process_index),
std::vector<s_mc_heap_ignore_region_t>* to_ignore1;
std::vector<s_mc_heap_ignore_region_t>* to_ignore2;
s_heap_area_t *equals_to1, *equals_to2;
- dw_type_t *types1, *types2;
+ mc_type_t *types1, *types2;
size_t available;
};
realloc(state->equals_to1,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
sizeof(s_heap_area_t));
- state->types1 = (s_dw_type**)
+ state->types1 = (simgrid::mc::Type**)
realloc(state->types1,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
sizeof(type_name *));
realloc(state->equals_to2,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
sizeof(s_heap_area_t));
- state->types2 = (s_dw_type**)
+ state->types2 = (simgrid::mc::Type**)
realloc(state->types2,
state->heaplimit * MAX_FRAGMENT_PER_BLOCK *
sizeof(type_name *));
const void *real_area1, const void *real_area2,
mc_snapshot_t snapshot1,
mc_snapshot_t snapshot2,
- xbt_dynar_t previous, dw_type_t type,
+ xbt_dynar_t previous, mc_type_t type,
int area_size, int check_ignore,
int pointer_level)
{
return 0;
}
- dw_type_t subtype, subsubtype;
+ mc_type_t subtype, subsubtype;
int res, elm_size;
unsigned int cursor = 0;
- dw_type_t member;
+ mc_type_t member;
const void *addr_pointed1, *addr_pointed2;;
mc_mem_region_t heap_region1 = MC_get_heap_region(snapshot1);
return 1;
case DW_TAG_base_type:
- if (type->name != NULL && strcmp(type->name, "char") == 0) { /* String, hence random (arbitrary ?) size */
+ if (!type->name.empty() && type->name == "char") { /* String, hence random (arbitrary ?) size */
if (real_area1 == real_area2)
return -1;
else
* @param area_size
* @return DWARF type ID for given offset
*/
-static dw_type_t get_offset_type(void *real_base_address, dw_type_t type,
+static mc_type_t get_offset_type(void *real_base_address, mc_type_t type,
int offset, int area_size,
mc_snapshot_t snapshot, int process_index)
{
return NULL;
} else {
unsigned int cursor = 0;
- dw_type_t member;
+ mc_type_t member;
xbt_dynar_foreach(type->members, cursor, member) {
if (!member->location.size) {
*/
int compare_heap_area(int process_index, const void *area1, const void *area2, mc_snapshot_t snapshot1,
mc_snapshot_t snapshot2, xbt_dynar_t previous,
- dw_type_t type, int pointer_level)
+ mc_type_t type, int pointer_level)
{
mc_process_t process = &mc_model_checker->process();
int type_size = -1;
int offset1 = 0, offset2 = 0;
int new_size1 = -1, new_size2 = -1;
- dw_type_t new_type1 = NULL, new_type2 = NULL;
+ mc_type_t new_type1 = NULL, new_type2 = NULL;
int match_pairs = 0;
// Find type_size:
if ((type->type == DW_TAG_pointer_type)
- || ((type->type == DW_TAG_base_type) && type->name != NULL
- && (!strcmp(type->name, "char"))))
+ || ((type->type == DW_TAG_base_type) && !type->name.empty()
+ && type->name == "char"))
type_size = -1;
else
type_size = type->byte_size;
if (type_size != -1) {
if (type_size != (ssize_t) heapinfo1->busy_block.busy_size
&& type_size != (ssize_t) heapinfo2->busy_block.busy_size
- && (type->name == NULL || !strcmp(type->name, "struct s_smx_context"))) {
+ && (type->name.empty() || type->name == "struct s_smx_context")) {
if (match_pairs) {
match_equals(state, previous);
xbt_dynar_free(&previous);
#include "mc_object_info.h"
#include "mc_private.h"
+static void dw_variable_free(dw_variable_t v);
+static void dw_variable_free_voidp(void *t);
+
static void MC_dwarf_register_global_variable(mc_object_info_t info, dw_variable_t variable);
static void MC_register_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable);
static void MC_dwarf_register_non_global_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable);
return result;
}
-// ***** dw_type_t
+// ***** mc_type_t
/** \brief Initialize the location of a member of a type
* (DW_AT_data_member_location of a DW_TAG_member).
* \param member the member of the type
* \param child DIE of the member (DW_TAG_member)
*/
-static void MC_dwarf_fill_member_location(dw_type_t type, dw_type_t member,
+static void MC_dwarf_fill_member_location(mc_type_t type, mc_type_t member,
Dwarf_Die * child)
{
if (dwarf_hasattr(child, DW_AT_data_bit_offset)) {
if (type->type != DW_TAG_union_type) {
xbt_die
("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%"
- PRIx64 ">%s", member->name, (uint64_t) type->id, type->name);
+ PRIx64 ">%s", member->name.c_str(),
+ (uint64_t) type->id, type->name.c_str());
} else {
return;
}
xbt_die
("Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%"
PRIx64 ">%s", MC_dwarf_attr_integrate_string(child, DW_AT_name),
- (uint64_t) type->id, type->name);
+ (uint64_t) type->id, type->name.c_str());
}
if (len == 1 && expr[0].atom == DW_OP_plus_uconst) {
member->offset = expr[0].number;
else
xbt_die("Cannot get %s location <%" PRIx64 ">%s",
MC_dwarf_attr_integrate_string(child, DW_AT_name),
- (uint64_t) type->id, type->name);
+ (uint64_t) type->id, type->name.c_str());
break;
}
case MC_DW_CLASS_LOCLISTPTR:
static void dw_type_free_voidp(void *t)
{
- delete *(dw_type_t*)t;
+ delete *(mc_type_t*)t;
}
/** \brief Populate the list of members of a type
* \param type the type
*/
static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die * die,
- Dwarf_Die * unit, dw_type_t type)
+ Dwarf_Die * unit, mc_type_t type)
{
int res;
Dwarf_Die child;
xbt_assert(!type->members);
type->members =
- xbt_dynar_new(sizeof(dw_type_t), (void (*)(void *)) dw_type_free_voidp);
+ xbt_dynar_new(sizeof(mc_type_t), (void (*)(void *)) dw_type_free_voidp);
for (res = dwarf_child(die, &child); res == 0;
res = dwarf_siblingof(&child, &child)) {
int tag = dwarf_tag(&child);
continue;
// TODO, we should use another type (because is is not a type but a member)
- dw_type_t member = xbt_new0(s_dw_type_t, 1);
+ mc_type_t member = new simgrid::mc::Type();
member->type = tag;
// Global Offset:
const char *name = MC_dwarf_attr_integrate_string(&child, DW_AT_name);
if (name)
- member->name = xbt_strdup(name);
- else
- member->name = NULL;
-
+ member->name = name;
member->byte_size =
MC_dwarf_attr_integrate_uint(&child, DW_AT_byte_size, 0);
member->element_count = -1;
- member->dw_type_id = MC_dwarf_at_type(&child);
- member->members = NULL;
- member->is_pointer_type = 0;
- member->offset = 0;
+
+ char* type_id = MC_dwarf_at_type(&child);
+ if (type_id) {
+ member->dw_type_id = type_id;
+ free(type_id);
+ }
if (dwarf_hasattr(&child, DW_AT_data_bit_offset)) {
xbt_die("Can't groke DW_AT_data_bit_offset.");
MC_dwarf_fill_member_location(type, member, &child);
- if (!member->dw_type_id) {
- xbt_die("Missing type for member %s of <%" PRIx64 ">%s", member->name,
- (uint64_t) type->id, type->name);
+ if (member->dw_type_id.empty()) {
+ xbt_die("Missing type for member %s of <%" PRIx64 ">%s",
+ member->name.c_str(),
+ (uint64_t) type->id, type->name.c_str());
}
xbt_dynar_push(type->members, &member);
* \param unit compilation unit of the current DIE
* \return MC representation of the type
*/
-static dw_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die * die,
+static mc_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die * die,
Dwarf_Die * unit, dw_frame_t frame,
const char *ns)
{
- dw_type_t type = new s_dw_type();
+ mc_type_t type = new simgrid::mc::Type();
type->type = -1;
- type->id = 0;
- type->name = NULL;
- type->byte_size = 0;
+ type->name = std::string();
type->element_count = -1;
- type->dw_type_id = NULL;
- type->members = NULL;
- type->is_pointer_type = 0;
- type->offset = 0;
type->type = dwarf_tag(die);
const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
if (name != NULL) {
- type->name =
- ns ? bprintf("%s%s::%s", prefix, ns,
- name) : bprintf("%s%s", prefix, name);
+ char* full_name = ns ? bprintf("%s%s::%s", prefix, ns, name) :
+ bprintf("%s%s", prefix, name);
+ type->name = std::string(full_name);
+ free(full_name);
}
- type->dw_type_id = MC_dwarf_at_type(die);
+ char* type_id = MC_dwarf_at_type(die);
+ if (type_id) {
+ type->dw_type_id = type_id;
+ free(type_id);
+ }
// Some compilers do not emit DW_AT_byte_size for pointer_type,
// so we fill this. We currently assume that the model-checked process is in
case DW_TAG_union_type:
case DW_TAG_class_type:
MC_dwarf_add_members(info, die, unit, type);
- char *new_ns = ns == NULL ? xbt_strdup(type->name)
+ char *new_ns = ns == NULL ? xbt_strdup(type->name.c_str())
: bprintf("%s::%s", ns, name);
MC_dwarf_handle_children(info, die, unit, frame, new_ns);
free(new_ns);
Dwarf_Die * unit, dw_frame_t frame,
const char *ns)
{
- dw_type_t type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
+ mc_type_t type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
char *key = bprintf("%" PRIx64, (uint64_t) type->id);
xbt_dict_set(info->types, key, type, NULL);
xbt_free(key);
- if (type->name && type->byte_size != 0) {
- xbt_dict_set(info->full_types_by_name, type->name, type, NULL);
+ if (!type->name.empty() && type->byte_size != 0) {
+ xbt_dict_set(info->full_types_by_name, type->name.c_str(), type, NULL);
}
}
xbt_free(frame);
}
-s_dw_type::s_dw_type()
-{
- this->type = 0;
- this->id = 0;
- this->name = nullptr;
- this->byte_size = 0;
- this->element_count = 0;
- this->dw_type_id = nullptr;
- this->members = nullptr;
- this->is_pointer_type = 0;
- this->location = { 0, 0, 0, 0};
- this->offset = 0;
- this->subtype = nullptr;
- this->full_type = nullptr;
-}
-
-s_dw_type::~s_dw_type()
-{
- xbt_free(this->name);
- xbt_free(this->dw_type_id);
- xbt_dynar_free(&this->members);
- mc_dwarf_expression_clear(&this->location);
-}
-
-static void dw_type_free(dw_type_t t)
+static void dw_type_free(mc_type_t t)
{
delete t;
}
dw_variable_t variable = NULL;
xbt_dynar_foreach(info->global_variables, cursor, variable) {
if (variable->type_origin) {
- variable->type = (dw_type_t) xbt_dict_get_or_null(info->types, variable->type_origin);
+ variable->type = (mc_type_t) xbt_dict_get_or_null(info->types, variable->type_origin);
}
}
}
dw_variable_t variable = NULL;
xbt_dynar_foreach(scope->variables, cursor, variable) {
if (variable->type_origin) {
- variable->type = (dw_type_t) xbt_dict_get_or_null(info->types, variable->type_origin);
+ variable->type = (mc_type_t) xbt_dict_get_or_null(info->types, variable->type_origin);
}
}
/** \brief Fill/lookup the "subtype" field.
*/
-static void MC_resolve_subtype(mc_object_info_t info, dw_type_t type)
+static void MC_resolve_subtype(mc_object_info_t info, mc_type_t type)
{
- if (type->dw_type_id == NULL)
+ if (type->dw_type_id.empty())
return;
- type->subtype = (dw_type_t) xbt_dict_get_or_null(info->types, type->dw_type_id);
+ type->subtype = (mc_type_t) xbt_dict_get_or_null(
+ info->types, type->dw_type_id.c_str());
if (type->subtype == NULL)
return;
if (type->subtype->byte_size != 0)
return;
- if (type->subtype->name == NULL)
+ if (type->subtype->name.empty())
return;
// Try to find a more complete description of the type:
// We need to fix in order to support C++.
- dw_type_t subtype =
- (dw_type_t) xbt_dict_get_or_null(info->full_types_by_name, type->subtype->name);
+ mc_type_t subtype =
+ (mc_type_t) xbt_dict_get_or_null(
+ info->full_types_by_name, type->subtype->name.c_str());
if (subtype != NULL) {
type->subtype = subtype;
}
{
xbt_dict_cursor_t cursor = NULL;
char *origin;
- dw_type_t type;
+ mc_type_t type;
// Lookup "subtype" field:
xbt_dict_foreach(info->types, cursor, origin, type) {
MC_resolve_subtype(info, type);
- dw_type_t member;
+ mc_type_t member;
unsigned int i = 0;
if (type->members != NULL)
xbt_dynar_foreach(type->members, i, member) {
{
xbt_dict_cursor_t cursor = NULL;
char *key = NULL;
- dw_type_t type = NULL;
+ mc_type_t type = NULL;
xbt_dict_foreach(info->types, cursor, key, type) {
- dw_type_t subtype = type;
+ mc_type_t subtype = type;
while (subtype->type == DW_TAG_typedef || subtype->type == DW_TAG_volatile_type
|| subtype->type == DW_TAG_const_type) {
if (subtype->subtype)
}
// Resolve full_type:
- if (subtype->name && subtype->byte_size == 0) {
+ if (!subtype->name.empty() && subtype->byte_size == 0) {
for (auto const& object_info : process->object_infos) {
- dw_type_t same_type = (dw_type_t)
+ mc_type_t same_type = (mc_type_t)
xbt_dict_get_or_null(object_info->full_types_by_name,
- subtype->name);
- if (same_type && same_type->name && same_type->byte_size) {
+ subtype->name.c_str());
+ if (same_type && !same_type->name.empty() && same_type->byte_size) {
type->full_type = same_type;
break;
}
class Process;
class Snapshot;
class ObjectInformation;
+class Type;
}
}
typedef ::simgrid::mc::Process s_mc_process_t;
typedef ::simgrid::mc::Snapshot s_mc_snapshot_t;
typedef ::simgrid::mc::ObjectInformation s_mc_object_info_t;
+typedef ::simgrid::mc::Type s_mc_type_t;
#else
typedef struct _s_mc_process_t s_mc_process_t;
typedef struct _s_mc_snapshot_t s_mc_snapshot_t;
typedef struct _s_mc_object_info_t s_mc_object_info_t;
+typedef struct _s_mc_type_t s_mc_type_t;
#endif
-
-typedef struct s_dw_type s_dw_type_t, *dw_type_t;
typedef struct s_memory_map s_memory_map_t, *memory_map_t;
typedef struct s_dw_variable s_dw_variable_t, *dw_variable_t;
typedef struct s_dw_frame s_dw_frame_t, *dw_frame_t;
-
typedef s_mc_pages_store_t *mc_pages_store_t;
typedef s_mc_model_checker_t *mc_model_checker_t;
typedef s_mc_address_space_t *mc_address_space_t;
typedef s_mc_process_t *mc_process_t;
typedef s_mc_snapshot_t *mc_snapshot_t;
typedef s_mc_object_info_t *mc_object_info_t;
+typedef s_mc_type_t *mc_type_t;
SG_BEGIN_DECL()
extern mc_model_checker_t mc_model_checker;
* */
static void mc_hash_value(hash_type * hash, mc_hashing_state * state,
mc_object_info_t info, const void *address,
- dw_type_t type)
+ mc_type_t type)
{
mc_process_t process = &mc_model_checker->process();
top:
return;
long element_count = type->element_count;
- dw_type_t subtype = type->subtype;
+ mc_type_t subtype = type->subtype;
if (subtype == NULL) {
XBT_DEBUG("Hash array without subtype");
return;
return;
unsigned int cursor = 0;
- dw_type_t member;
+ mc_type_t member;
xbt_dynar_foreach(type->members, cursor, member) {
XBT_DEBUG("Hash struct member %s", member->name);
if (type->subtype == NULL)
}
if (type->subtype == NULL) {
- XBT_DEBUG("Missing type for %p (type=%s)", pointed, type->dw_type_id);
+ XBT_DEBUG("Missing type for %p (type=%s)",
+ pointed, type->dw_type_id.c_str());
return;
}
continue;
}
- dw_type_t type = variable->type;
+ mc_type_t type = variable->type;
if (type == NULL) {
// Nothing
continue;
variable->object_info, unw_cursor,
frame_pointer, NULL);
- dw_type_t type = variable->type;
+ mc_type_t type = variable->type;
if (type == NULL) {
XBT_DEBUG("Hash local variable %s without loctypeation", variable->name);
continue;
* @param snapshot Snapshot (or NULL)
* @return Process address of the given member of the 'object' struct/class
*/
-void *mc_member_resolve(const void *base, dw_type_t type, dw_type_t member,
+void *mc_member_resolve(const void *base, mc_type_t type, mc_type_t member,
mc_address_space_t address_space, int process_index)
{
if (!member->location.size) {
namespace simgrid {
namespace mc {
+// Type
+
+Type::Type()
+{
+ this->type = 0;
+ this->id = 0;
+ this->name = std::string();
+ this->byte_size = 0;
+ this->element_count = 0;
+ this->members = nullptr;
+ this->is_pointer_type = 0;
+ this->location = {0, 0, 0, 0};
+ this->offset = 0;
+ this->subtype = nullptr;
+ this->full_type = nullptr;
+}
+
+Type::~Type()
+{
+ xbt_dynar_free(&this->members);
+ mc_dwarf_expression_clear(&this->location);
+}
+
+// ObjectInformations
+
dw_frame_t ObjectInformation::find_function(const void *ip) const
{
xbt_dynar_t dynar = this->functions_index;
#define SIMGRID_MC_OBJECT_INFO_H
#include <stdint.h>
-#include <stdbool.h>
+
+#include <string>
#include <simgrid_config.h>
#include <xbt/dict.h>
// ***** Type
-typedef int e_dw_type_type;
+typedef int e_mc_type_type;
-struct s_dw_type {
- s_dw_type();
- ~s_dw_type();
+namespace simgrid {
+namespace mc {
- e_dw_type_type type;
+class Type {
+public:
+ Type();
+ ~Type();
+ Type(Type const& type) = delete;
+ Type& operator=(Type const&) = delete;
+
+ e_mc_type_type type;
Dwarf_Off id; /* Offset in the section (in hexadecimal form) */
- char *name; /* Name of the type */
+ std::string name; /* Name of the type */
int byte_size; /* Size in bytes */
int element_count; /* Number of elements for array type */
- char *dw_type_id; /* DW_AT_type id */
+ std::string dw_type_id; /* DW_AT_type id */
xbt_dynar_t members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/
int is_pointer_type;
struct s_mc_expression location;
int offset;
- dw_type_t subtype; // DW_AT_type
- dw_type_t full_type; // The same (but more complete) type
+ mc_type_t subtype; // DW_AT_type
+ mc_type_t full_type; // The same (but more complete) type
};
-XBT_INTERNAL void dw_variable_free(dw_variable_t v);
-XBT_INTERNAL void dw_variable_free_voidp(void *t);
+}
+}
// ***** Object info
char *end_ro; // read-only segment
xbt_dict_t subprograms; // xbt_dict_t<origin as hexadecimal string, dw_frame_t>
xbt_dynar_t global_variables; // xbt_dynar_t<dw_variable_t>
- xbt_dict_t types; // xbt_dict_t<origin as hexadecimal string, dw_type_t>
- xbt_dict_t full_types_by_name; // xbt_dict_t<name, dw_type_t> (full defined type only)
+ xbt_dict_t types; // xbt_dict_t<origin as hexadecimal string, mc_type_t>
+ xbt_dict_t full_types_by_name; // xbt_dict_t<name, mc_type_t> (full defined type only)
// Here we sort the minimal information for an efficient (and cache-efficient)
// lookup of a function given an instruction pointer.
XBT_INTERNAL const char* MC_dwarf_attrname(int attr);
XBT_INTERNAL const char* MC_dwarf_tagname(int tag);
-XBT_INTERNAL void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_address_space_t snapshot, int process_index);
+XBT_INTERNAL void* mc_member_resolve(const void* base, mc_type_t type, mc_type_t member, mc_address_space_t snapshot, int process_index);
struct s_dw_variable{
Dwarf_Off dwarf_offset; /* Global offset of the field. */
int global;
char *name;
char *type_origin;
- dw_type_t type;
+ mc_type_t type;
// Use either of:
s_mc_location_list_t locations;
dw_frame_t subprogram;
unsigned long ip;
std::string name;
- dw_type_t type;
+ mc_type_t type;
void *address;
int region;
} s_local_variable_t, *local_variable_t;
int test_some_array[4][5][6];
struct some_struct { int first; int second[4][5]; } test_some_struct;
-static dw_type_t find_type_by_name(mc_object_info_t info, const char* name) {
+static mc_type_t find_type_by_name(mc_object_info_t info, const char* name) {
xbt_dict_cursor_t cursor = NULL;
char *key;
- dw_type_t type;
- xbt_dict_foreach(info->types, cursor, key, type) {
- if(!strcmp(name, type->name))
+ mc_type_t type;
+ xbt_dict_foreach(info->types, cursor, key, type)
+ if(type->name == name)
return type;
- }
-
return NULL;
}
xbt_assert(variable->address == address,
"Address mismatch for %s : %p expected but %p found", name, address, variable->address);
- dw_type_t type = (dw_type_t) xbt_dict_get_or_null(process->binary_info->types, variable->type_origin);
+ mc_type_t type = (mc_type_t) xbt_dict_get_or_null(process->binary_info->types, variable->type_origin);
xbt_assert(type!=NULL, "Missing type for %s", name);
xbt_assert(type->byte_size = byte_size, "Byte size mismatch for %s", name);
return variable;
}
-static dw_type_t find_member(mc_object_info_t info, const char* name, dw_type_t type) {
+static mc_type_t find_member(mc_object_info_t info, const char* name, mc_type_t type) {
unsigned int cursor = 0;
- dw_type_t member;
- xbt_dynar_foreach(type->members, cursor, member){
- if(!strcmp(name,member->name))
+ mc_type_t member;
+ xbt_dynar_foreach(type->members, cursor, member)
+ if(member->name == name)
return member;
- }
return NULL;
}
SIMIX_global_init(&argc, argv);
dw_variable_t var;
- dw_type_t type;
+ mc_type_t type;
s_mc_process_t p(getpid(), -1);
mc_process_t process = &p;
var = test_global_variable(process, process->binary_info.get(),
"test_some_array", &test_some_array, sizeof(test_some_array));
- type = (dw_type_t) xbt_dict_get_or_null(process->binary_info->types, var->type_origin);
+ type = (mc_type_t) xbt_dict_get_or_null(process->binary_info->types, var->type_origin);
xbt_assert(type->element_count == 6*5*4, "element_count mismatch in test_some_array : %i / %i", type->element_count, 6*5*4);
var = test_global_variable(process, process->binary_info.get(),
"test_some_struct", &test_some_struct, sizeof(test_some_struct));
- type = (dw_type_t) xbt_dict_get_or_null(process->binary_info->types, var->type_origin);
+ type = (mc_type_t) xbt_dict_get_or_null(process->binary_info->types, var->type_origin);
assert(find_member(process->binary_info.get(), "first", type)->offset == 0);
assert(find_member(process->binary_info.get(), "second", type)->offset
== ((const char*)&test_some_struct.second) - (const char*)&test_some_struct);