X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe304706848f0a64477d4687b3ea97d5b9a0c35c..6d822b05d062d8be5858745ee8bdba4208f42d00:/src/mc/inspect/LocationList.cpp diff --git a/src/mc/inspect/LocationList.cpp b/src/mc/inspect/LocationList.cpp index cc701965ee..426b97b99a 100644 --- a/src/mc/inspect/LocationList.cpp +++ b/src/mc/inspect/LocationList.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2021. 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. */ @@ -20,7 +20,7 @@ namespace dwarf { /** Resolve a location expression */ Location resolve(simgrid::dwarf::DwarfExpression const& expression, simgrid::mc::ObjectInformation* object_info, - unw_cursor_t* c, void* frame_pointer_address, simgrid::mc::AddressSpace* address_space) + unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space) { simgrid::dwarf::ExpressionContext context; context.frame_base = frame_pointer_address; @@ -50,7 +50,7 @@ static simgrid::dwarf::DwarfExpression const* find_expression(simgrid::dwarf::Lo } Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::ObjectInformation* object_info, - unw_cursor_t* c, void* frame_pointer_address, simgrid::mc::AddressSpace* address_space) + unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space) { unw_word_t ip = 0; if (c && unw_get_reg(c, UNW_REG_IP, &ip)) @@ -61,11 +61,11 @@ Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::Obj return simgrid::dwarf::resolve(*expression, object_info, c, frame_pointer_address, address_space); } -LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr) +LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr) { LocationList locations; std::ptrdiff_t offset = 0; - while (1) { + while (true) { Dwarf_Addr base; Dwarf_Addr start; Dwarf_Addr end; @@ -79,7 +79,7 @@ LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute else if (offset == -1) xbt_die("Error while loading location list"); - std::uint64_t base_address = (std::uint64_t)info.base_address(); + auto base_address = reinterpret_cast(info.base_address()); LocationListEntry::range_type range; if (start == 0) @@ -88,7 +88,7 @@ LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute else range = {base_address + start, base_address + end}; - locations.push_back({DwarfExpression(ops, ops + len), range}); + locations.emplace_back(DwarfExpression(ops, ops + len), range); } return locations;