X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/101c8b10d9965e115c9ff5c28954750a065cf155..9a35e3d4e5aed80e7b3fab624547ab045dc00f8a:/src/mc/inspect/mc_dwarf.cpp diff --git a/src/mc/inspect/mc_dwarf.cpp b/src/mc/inspect/mc_dwarf.cpp index e3a6d25e48..eb5f346718 100644 --- a/src/mc/inspect/mc_dwarf.cpp +++ b/src/mc/inspect/mc_dwarf.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2008-2020. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -89,7 +89,7 @@ static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf * @param unit the DIE of the compile unit of the current DIE * @param frame containing frame if any */ -static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, +static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, const Dwarf_Die* unit, simgrid::mc::Frame* frame, const char* ns); /** @brief Get the DW_TAG_type of the DIE @@ -123,7 +123,6 @@ enum class FormClass { static TagClass classify_tag(int tag) { switch (tag) { - case DW_TAG_array_type: case DW_TAG_class_type: case DW_TAG_enumeration_type: @@ -224,7 +223,7 @@ static FormClass classify_form(int form) */ inline XBT_PRIVATE const char* tagname(Dwarf_Die* die) { - return simgrid::dwarf::tagname(dwarf_tag(die)); + return tagname(dwarf_tag(die)); } } // namespace dwarf @@ -432,7 +431,7 @@ static bool MC_compare_variable(simgrid::mc::Variable const& a, simgrid::mc::Var * @param member the member of the type * @param child DIE of the member (DW_TAG_member) */ -static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc::Member* member, Dwarf_Die* child) +static void MC_dwarf_fill_member_location(const simgrid::mc::Type* type, simgrid::mc::Member* member, Dwarf_Die* child) { xbt_assert(not dwarf_hasattr(child, DW_AT_data_bit_offset), "Can't groke DW_AT_data_bit_offset."); @@ -485,8 +484,8 @@ static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc:: * @param unit DIE of the compilation unit containing the type DIE * @param type the type */ -static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf_Die* die, Dwarf_Die* /*unit*/, - simgrid::mc::Type* type) +static void MC_dwarf_add_members(const simgrid::mc::ObjectInformation* /*info*/, Dwarf_Die* die, + const Dwarf_Die* /*unit*/, simgrid::mc::Type* type) { int res; Dwarf_Die child; @@ -645,8 +644,8 @@ static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf static int mc_anonymous_variable_index = 0; static std::unique_ptr MC_die_to_variable(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, - Dwarf_Die* /*unit*/, simgrid::mc::Frame* frame, - const char* ns) + const Dwarf_Die* /*unit*/, + const simgrid::mc::Frame* frame, const char* ns) { // Skip declarations: if (MC_dwarf_attr_flag(die, DW_AT_declaration, false)) @@ -740,7 +739,7 @@ static std::unique_ptr MC_die_to_variable(simgrid::mc::Ob return variable; } -static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, +static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, const Dwarf_Die* unit, simgrid::mc::Frame* frame, const char* ns) { std::unique_ptr variable = MC_die_to_variable(info, die, unit, frame, ns); @@ -892,10 +891,10 @@ static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* static Elf64_Half get_type(Elf* elf) { - Elf64_Ehdr* ehdr64 = elf64_getehdr(elf); + const Elf64_Ehdr* ehdr64 = elf64_getehdr(elf); if (ehdr64) return ehdr64->e_type; - Elf32_Ehdr* ehdr32 = elf32_getehdr(elf); + const Elf32_Ehdr* ehdr32 = elf32_getehdr(elf); if (ehdr32) return ehdr32->e_type; xbt_die("Could not get ELF heeader"); @@ -936,7 +935,7 @@ static std::vector get_build_id(Elf* elf) // Iterate over the program headers and find the PT_NOTE ones: for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_temp; - GElf_Phdr* phdr = gelf_getphdr(elf, i, &phdr_temp); + const GElf_Phdr* phdr = gelf_getphdr(elf, i, &phdr_temp); if (phdr->p_type != PT_NOTE) continue; @@ -1192,11 +1191,10 @@ namespace simgrid { namespace mc { /** @brief Finds informations about a given shared object/executable */ -std::shared_ptr createObjectInformation(std::vector const& maps, - const char* name) +std::shared_ptr createObjectInformation(std::vector const& maps, const char* name) { - std::shared_ptr result = std::make_shared(); - result->file_name = name; + std::shared_ptr result = std::make_shared(); + result->file_name = name; simgrid::mc::find_object_address(maps, result.get()); MC_load_dwarf(result.get()); MC_post_process_variables(result.get()); @@ -1209,11 +1207,11 @@ std::shared_ptr createObjectInformation(std::vec /*************************************************************************/ -void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info) +void postProcessObjectInformation(const RemoteClient* process, ObjectInformation* info) { for (auto& t : info->types) { - simgrid::mc::Type* type = &(t.second); - simgrid::mc::Type* subtype = type; + Type* type = &(t.second); + Type* subtype = type; while (subtype->type == DW_TAG_typedef || subtype->type == DW_TAG_volatile_type || subtype->type == DW_TAG_const_type) if (subtype->subtype)