Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Small changes to Variable
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 10 Mar 2016 13:30:06 +0000 (14:30 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 11 Mar 2016 12:49:33 +0000 (13:49 +0100)
src/mc/Variable.hpp
src/mc/mc_dwarf.cpp

index 7e04621..a4f048a 100644 (file)
@@ -21,15 +21,24 @@ namespace mc {
 class Variable {
 public:
   Variable() {}
-  unsigned dwarf_offset = 0; /* Global offset of the field. */
-  int global = 0;
+  std::uint32_t id = 0;
+  bool global = false;
   std::string name;
   unsigned type_id = 0;
   simgrid::mc::Type* type = nullptr;
-  // Use either of:
-  simgrid::dwarf::LocationList location_list;
+
+  /** Address of the variable -if it is fixed) */
   void* address = nullptr;
+
+  /** Description of the location of the variable if it's not fixed */
+  simgrid::dwarf::LocationList location_list;
+
+  /** Offset of validity of the variable (DW_AT_start_scope)
+   *
+   *  This variable is not valid since the beginning of its scope.
+   */
   std::size_t start_scope = 0;
+
   simgrid::mc::ObjectInformation* object_info = nullptr;
 };
 
index 7942ae2..247d3fe 100644 (file)
@@ -714,7 +714,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
 
   std::unique_ptr<simgrid::mc::Variable> variable =
     std::unique_ptr<simgrid::mc::Variable>(new simgrid::mc::Variable());
-  variable->dwarf_offset = dwarf_dieoffset(die);
+  variable->id = dwarf_dieoffset(die);
   variable->global = frame == nullptr;     // Can be override base on DW_AT_location
   variable->object_info = info;
 
@@ -740,12 +740,12 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
         xbt_die(
           "Could not read location expression in DW_AT_location "
           "of variable <%" PRIx64 ">%s",
-          (uint64_t) variable->dwarf_offset,
+          (uint64_t) variable->id,
           variable->name.c_str());
       }
 
       if (len == 1 && expr[0].atom == DW_OP_addr) {
-        variable->global = 1;
+        variable->global = true;
         uintptr_t offset = (uintptr_t) expr[0].number;
         uintptr_t base = (uintptr_t) info->base_address();
         variable->address = (void *) (base + offset);
@@ -767,7 +767,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
     xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location "
             "in <%" PRIx64 ">%s",
             form, form, (int) form_class, (int) form_class,
-            (uint64_t) variable->dwarf_offset,
+            (uint64_t) variable->id,
             variable->name.c_str());
   }