*/
static std::uint64_t MC_dwarf_at_type(Dwarf_Die* die);
-namespace simgrid {
-namespace dwarf {
+namespace simgrid::dwarf {
enum class TagClass { Unknown, Type, Subprogram, Variable, Scope, Namespace };
return tagname(dwarf_tag(die));
}
-} // namespace dwarf
-} // namespace simgrid
+} // namespace simgrid::dwarf
// ***** Attributes
{
simgrid::mc::Type type;
type.type = dwarf_tag(die);
- type.name = std::string();
+ type.name = "";
type.element_count = -1;
// Global Offset
type.id = dwarf_dieoffset(die);
- const char* prefix = "";
+ const char* prefix;
switch (type.type) {
case DW_TAG_structure_type:
prefix = "struct ";
}
if (ns && variable->global)
- variable->name = std::string(ns) + "::" + variable->name;
+ variable->name.insert(0, std::string(ns) + "::");
// The current code needs a variable name,
// generate a fake one:
size_t length;
while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, nullptr, nullptr) == 0) {
- Dwarf_Die unit_die;
- if (dwarf_offdie(dwarf, offset + length, &unit_die) != nullptr)
+ if (Dwarf_Die unit_die; dwarf_offdie(dwarf, offset + length, &unit_die) != nullptr)
MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, nullptr);
offset = next_offset;
}
filename = std::string(debug_path) + ".build-id/" + to_hex(id.data(), 1) + '/' +
to_hex(id.data() + 1, id.size() - 1) + ".debug";
XBT_DEBUG("Checking debug file: %s", filename.c_str());
- int fd = open(filename.c_str(), O_RDONLY);
- if (fd != -1) {
+ if (int fd = open(filename.c_str(), O_RDONLY); fd != -1) {
XBT_DEBUG("Found debug file: %s\n", hex.c_str());
return fd;
}
// Try with NT_GNU_BUILD_ID: we find the build ID in the ELF file and then
// use this ID to find the file in some known locations in the filesystem.
- std::vector<char> build_id = get_build_id(elf);
- if (not build_id.empty()) {
+ if (std::vector<char> build_id = get_build_id(elf); not build_id.empty()) {
elf_end(elf);
close(fd);
}
}
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
void ObjectInformation::ensure_dwarf_loaded()
{
}
}
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc
-namespace simgrid {
-namespace dwarf {
+namespace simgrid::dwarf {
/** Convert a DWARF register into a libunwind register
*
#endif
}
-} // namespace dwarf
-} // namespace simgrid
+} // namespace simgrid::dwarf