From 856220a486ce61eda51b8dfb7ff71f53af25b020 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Thu, 10 Mar 2016 14:30:06 +0100 Subject: [PATCH] [mc] Small changes to Variable --- src/mc/Variable.hpp | 17 +++++++++++++---- src/mc/mc_dwarf.cpp | 8 ++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/mc/Variable.hpp b/src/mc/Variable.hpp index 7e04621a49..a4f048a4d1 100644 --- a/src/mc/Variable.hpp +++ b/src/mc/Variable.hpp @@ -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; }; diff --git a/src/mc/mc_dwarf.cpp b/src/mc/mc_dwarf.cpp index 7942ae22b3..247d3fe9d9 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/mc_dwarf.cpp @@ -714,7 +714,7 @@ static std::unique_ptr MC_die_to_variable( std::unique_ptr variable = std::unique_ptr(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 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 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()); } -- 2.20.1