Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] C++ify Variable
[simgrid.git] / src / mc / mc_object_info.cpp
index e040769..b05c69e 100644 (file)
 namespace simgrid {
 namespace mc {
 
+// 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()
+{
+  this->dwarf_offset = 0;
+  this->global = 0;
+  this->type = nullptr;
+  this->location_list = {0, nullptr};
+  this->address = nullptr;
+  this->start_scope = 0;
+  this->object_info = nullptr;
+}
+
+Variable::~Variable()
+{
+  if (this->location_list.locations)
+    mc_dwarf_location_list_clear(&this->location_list);
+}
+
+// ObjectInformations
+
 dw_frame_t ObjectInformation::find_function(const void *ip) const
 {
   xbt_dynar_t dynar = this->functions_index;
@@ -34,15 +68,13 @@ dw_frame_t ObjectInformation::find_function(const void *ip) const
   return nullptr;
 }
 
-dw_variable_t ObjectInformation::find_variable(const char* name) const
+mc_variable_t ObjectInformation::find_variable(const char* name) const
 {
   unsigned int cursor = 0;
-  dw_variable_t variable;
-  xbt_dynar_foreach(this->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;
 }