X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9dbeb2372ad9a123d0558132ebb6e003e10aa641..4b6ea22affbf2fb45a2e80779c789047121ceff6:/src/mc/mc_object_info.cpp diff --git a/src/mc/mc_object_info.cpp b/src/mc/mc_object_info.cpp index 2b00607c68..5222260291 100644 --- a/src/mc/mc_object_info.cpp +++ b/src/mc/mc_object_info.cpp @@ -11,9 +11,74 @@ #include "mc_object_info.h" #include "mc_private.h" -dw_frame_t MC_file_object_info_find_function(mc_object_info_t info, const void *ip) +namespace simgrid { +namespace mc { + +// Free functions + +static void mc_variable_free_voidp(void *t) +{ + delete *(simgrid::mc::Variable**)t; +} + +static void mc_frame_free_voipd(void** p) +{ + delete *(mc_frame_t**)p; + *p = nullptr; +} + +// Type + +Type::Type() +{ + this->type = 0; + this->id = 0; + this->byte_size = 0; + this->element_count = 0; + this->is_pointer_type = 0; + this->subtype = nullptr; + this->full_type = nullptr; +} + +// Type + +Variable::Variable() { - xbt_dynar_t dynar = info->functions_index; + this->dwarf_offset = 0; + this->global = 0; + this->type = nullptr; + this->address = nullptr; + this->start_scope = 0; + this->object_info = nullptr; +} + +// Frame + +Frame::Frame() +{ + this->tag = 0; + this->low_pc = nullptr; + this->high_pc = nullptr; + this->variables = xbt_dynar_new( + sizeof(mc_variable_t), mc_variable_free_voidp); + this->id = 0; + this->scopes = xbt_dynar_new( + sizeof(mc_frame_t), (void_f_pvoid_t) mc_frame_free_voipd); + this->abstract_origin_id = 0; + this->object_info = nullptr; +} + +Frame::~Frame() +{ + xbt_dynar_free(&(this->variables)); + xbt_dynar_free(&(this->scopes)); +} + +// ObjectInformations + +mc_frame_t ObjectInformation::find_function(const void *ip) const +{ + xbt_dynar_t dynar = this->functions_index; mc_function_index_item_t base = (mc_function_index_item_t) xbt_dynar_get_ptr(dynar, 0); int i = 0; @@ -28,17 +93,18 @@ dw_frame_t MC_file_object_info_find_function(mc_object_info_t info, const void * return base[k].function; } } - return NULL; + return nullptr; } -dw_variable_t MC_file_object_info_find_variable_by_name(mc_object_info_t info, const char* name) +mc_variable_t ObjectInformation::find_variable(const char* name) const { unsigned int cursor = 0; - dw_variable_t variable; - xbt_dynar_foreach(info->global_variables, cursor, variable){ - if(!strcmp(name, variable->name)) + mc_variable_t variable; + xbt_dynar_foreach(this->global_variables, cursor, variable) + if(variable->name == name) return variable; - } + return nullptr; +} - return NULL; } +} \ No newline at end of file