From c1e4fd72584b7f0a9c0872dd6d93185a996294ad Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 24 Jul 2015 13:35:26 +0200 Subject: [PATCH] [mc] Cleanup --- src/mc/mc_dwarf.cpp | 7 ++----- src/mc/mc_object_info.h | 19 ++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/mc/mc_dwarf.cpp b/src/mc/mc_dwarf.cpp index 0b0e2e4d0c..3ac63ab297 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/mc_dwarf.cpp @@ -610,14 +610,11 @@ static simgrid::mc::Type MC_dwarf_die_to_type( Dwarf_Die * unit, simgrid::mc::Frame* frame, const char *ns) { - simgrid::mc::Type type; - type.type = -1; + type.type = dwarf_tag(die); type.name = std::string(); type.element_count = -1; - type.type = dwarf_tag(die); - // Global Offset type.id = dwarf_dieoffset(die); @@ -1141,7 +1138,7 @@ std::shared_ptr MC_find_object_info( std::shared_ptr result = std::make_shared(); if (executable) - result->flags |= MC_OBJECT_INFO_EXECUTABLE; + result->flags |= simgrid::mc::ObjectInformation::Executable; result->file_name = name; MC_find_object_address(maps, result.get()); MC_dwarf_get_variables(result.get()); diff --git a/src/mc/mc_object_info.h b/src/mc/mc_object_info.h index c04b917c38..2ec4e56fef 100644 --- a/src/mc/mc_object_info.h +++ b/src/mc/mc_object_info.h @@ -30,8 +30,6 @@ // ***** Type -typedef int e_mc_type_type; - namespace simgrid { namespace mc { @@ -47,7 +45,8 @@ public: Type(Type&& type) = default; Type& operator=(Type&&) = default; - e_mc_type_type type; + /** The DWARF TAG of the type (e.g. DW_TAG_array_type) */ + int type; Dwarf_Off id; /* Offset in the section (in hexadecimal form) */ std::string name; /* Name of the type */ int byte_size; /* Size in bytes */ @@ -89,11 +88,6 @@ public: // ***** Object info -/** Bit field of options */ -typedef int mc_object_info_flags; -#define MC_OBJECT_INFO_NONE 0 -#define MC_OBJECT_INFO_EXECUTABLE 1 - namespace simgrid { namespace mc { @@ -165,7 +159,11 @@ public: ObjectInformation(ObjectInformation const&) = delete; ObjectInformation& operator=(ObjectInformation const&) = delete; - mc_object_info_flags flags; + // Flag: + static const int Executable = 1; + + /** Bitfield of flags */ + int flags; std::string file_name; const void* start; const void *end; @@ -190,7 +188,7 @@ public: bool executable() const { - return this->flags & MC_OBJECT_INFO_EXECUTABLE; + return this->flags & simgrid::mc::ObjectInformation::Executable; } bool privatized() const @@ -201,7 +199,6 @@ public: void* base_address() const; simgrid::mc::Frame* find_function(const void *ip) const; - // TODO, should be simgrid::mc::Variable* simgrid::mc::Variable* find_variable(const char* name) const; }; -- 2.20.1