X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f..9ee28948a83efbfd6b4d9d9e7b513932afa40c10:/src/mc/inspect/DwarfExpression.cpp diff --git a/src/mc/inspect/DwarfExpression.cpp b/src/mc/inspect/DwarfExpression.cpp index 20e776171b..2e74410e91 100644 --- a/src/mc/inspect/DwarfExpression.cpp +++ b/src/mc/inspect/DwarfExpression.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2014-2023. 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. */ @@ -15,10 +15,7 @@ #include "src/mc/inspect/mc_dwarf.hpp" #include "src/mc/mc_private.hpp" -using simgrid::mc::remote; - -namespace simgrid { -namespace dwarf { +namespace simgrid::dwarf { void execute(const Dwarf_Op* ops, std::size_t n, const ExpressionContext& context, ExpressionStack& stack) { @@ -78,7 +75,7 @@ void execute(const Dwarf_Op* ops, std::size_t n, const ExpressionContext& contex // Pop/drop the top of the stack: case DW_OP_drop: - stack.pop(); + (void)stack.pop(); break; case DW_OP_swap: @@ -155,21 +152,21 @@ void execute(const Dwarf_Op* ops, std::size_t n, const ExpressionContext& contex // Computed address: if (not context.address_space) throw evaluation_error("Missing address space"); - context.address_space->read_bytes(&stack.top(), sizeof(uintptr_t), remote(stack.top())); + context.address_space->read_bytes(&stack.top(), sizeof(uintptr_t), mc::remote(stack.top())); break; default: // Registers: - static const std::unordered_set registers = { - DW_OP_breg0, DW_OP_breg1, DW_OP_breg2, DW_OP_breg3, DW_OP_breg4, DW_OP_breg5, DW_OP_breg6, - DW_OP_breg7, DW_OP_breg8, DW_OP_breg9, DW_OP_breg10, DW_OP_breg11, DW_OP_breg12, DW_OP_breg13, - DW_OP_breg14, DW_OP_breg15, DW_OP_breg16, DW_OP_breg17, DW_OP_breg18, DW_OP_breg19, DW_OP_breg20, - DW_OP_breg21, DW_OP_breg22, DW_OP_breg23, DW_OP_breg24, DW_OP_breg25, DW_OP_breg26, DW_OP_breg27, - DW_OP_breg28, DW_OP_breg29, DW_OP_breg30, DW_OP_breg31}; - if (registers.count(atom) > 0) { + if (static const std::unordered_set registers = + {DW_OP_breg0, DW_OP_breg1, DW_OP_breg2, DW_OP_breg3, DW_OP_breg4, DW_OP_breg5, DW_OP_breg6, + DW_OP_breg7, DW_OP_breg8, DW_OP_breg9, DW_OP_breg10, DW_OP_breg11, DW_OP_breg12, DW_OP_breg13, + DW_OP_breg14, DW_OP_breg15, DW_OP_breg16, DW_OP_breg17, DW_OP_breg18, DW_OP_breg19, DW_OP_breg20, + DW_OP_breg21, DW_OP_breg22, DW_OP_breg23, DW_OP_breg24, DW_OP_breg25, DW_OP_breg26, DW_OP_breg27, + DW_OP_breg28, DW_OP_breg29, DW_OP_breg30, DW_OP_breg31}; + registers.count(atom) > 0) { // Push register + constant: - int register_id = simgrid::dwarf::dwarf_register_to_libunwind(op->atom - DW_OP_breg0); + int register_id = dwarf_register_to_libunwind(op->atom - DW_OP_breg0); unw_word_t res; if (not context.cursor) throw evaluation_error("Missing stack context"); @@ -181,22 +178,26 @@ void execute(const Dwarf_Op* ops, std::size_t n, const ExpressionContext& contex // ***** Constants: // Short constant literals: - static const std::unordered_set literals = { - DW_OP_lit0, DW_OP_lit1, DW_OP_lit2, DW_OP_lit3, DW_OP_lit4, DW_OP_lit5, DW_OP_lit6, DW_OP_lit7, - DW_OP_lit8, DW_OP_lit9, DW_OP_lit10, DW_OP_lit11, DW_OP_lit12, DW_OP_lit13, DW_OP_lit14, DW_OP_lit15, - DW_OP_lit16, DW_OP_lit17, DW_OP_lit18, DW_OP_lit19, DW_OP_lit20, DW_OP_lit21, DW_OP_lit22, DW_OP_lit23, - DW_OP_lit24, DW_OP_lit25, DW_OP_lit26, DW_OP_lit27, DW_OP_lit28, DW_OP_lit29, DW_OP_lit30, DW_OP_lit31}; - if (literals.count(atom) > 0) { + if (static const std::unordered_set literals = {DW_OP_lit0, DW_OP_lit1, DW_OP_lit2, DW_OP_lit3, + DW_OP_lit4, DW_OP_lit5, DW_OP_lit6, DW_OP_lit7, + DW_OP_lit8, DW_OP_lit9, DW_OP_lit10, DW_OP_lit11, + DW_OP_lit12, DW_OP_lit13, DW_OP_lit14, DW_OP_lit15, + DW_OP_lit16, DW_OP_lit17, DW_OP_lit18, DW_OP_lit19, + DW_OP_lit20, DW_OP_lit21, DW_OP_lit22, DW_OP_lit23, + DW_OP_lit24, DW_OP_lit25, DW_OP_lit26, DW_OP_lit27, + DW_OP_lit28, DW_OP_lit29, DW_OP_lit30, DW_OP_lit31}; + literals.count(atom) > 0) { // Push a literal/constant on the stack: stack.push(atom - DW_OP_lit0); break; } // General constants: - static const std::unordered_set constants = { - DW_OP_const1u, DW_OP_const2u, DW_OP_const4u, DW_OP_const8u, DW_OP_const1s, - DW_OP_const2s, DW_OP_const4s, DW_OP_const8s, DW_OP_constu, DW_OP_consts}; - if (constants.count(atom) > 0) { + if (static const std::unordered_set constants = {DW_OP_const1u, DW_OP_const2u, DW_OP_const4u, + DW_OP_const8u, DW_OP_const1s, DW_OP_const2s, + DW_OP_const4s, DW_OP_const8s, DW_OP_constu, + DW_OP_consts}; + constants.count(atom) > 0) { // Push the constant argument on the stack. stack.push(op->number); break; @@ -208,5 +209,4 @@ void execute(const Dwarf_Op* ops, std::size_t n, const ExpressionContext& contex } } -} // namespace dwarf -} // namespace simgrid +} // namespace simgrid::dwarf