From: Martin Quinson Date: Sun, 19 May 2019 23:05:29 +0000 (+0200) Subject: mc: move some files related to ELF, DWARF or unwind reading into their own directory X-Git-Tag: v3.22.4~87 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4bcfd40036f842e976d329cd0cee7349b8e0f4d6 mc: move some files related to ELF, DWARF or unwind reading into their own directory --- diff --git a/src/mc/DwarfExpression.cpp b/src/mc/DwarfExpression.cpp deleted file mode 100644 index 31852a6719..0000000000 --- a/src/mc/DwarfExpression.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* Copyright (c) 2014-2019. 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. */ - -#include -#include - -#include "src/mc/AddressSpace.hpp" -#include "src/mc/DwarfExpression.hpp" -#include "src/mc/Frame.hpp" -#include "src/mc/LocationList.hpp" -#include "src/mc/ObjectInformation.hpp" -#include "src/mc/mc_dwarf.hpp" -#include "src/mc/mc_private.hpp" - -using simgrid::mc::remote; - -namespace simgrid { -namespace dwarf { - -void execute( - const Dwarf_Op* ops, std::size_t n, - const ExpressionContext& context, ExpressionStack& stack) -{ - for (size_t i = 0; i != n; ++i) { - const Dwarf_Op *op = ops + i; - std::uint8_t atom = op->atom; - intptr_t first; - intptr_t second; - - switch (atom) { - - // Registers: - - case DW_OP_breg0: - case DW_OP_breg1: - case DW_OP_breg2: - case DW_OP_breg3: - case DW_OP_breg4: - case DW_OP_breg5: - case DW_OP_breg6: - case DW_OP_breg7: - case DW_OP_breg8: - case DW_OP_breg9: - case DW_OP_breg10: - case DW_OP_breg11: - case DW_OP_breg12: - case DW_OP_breg13: - case DW_OP_breg14: - case DW_OP_breg15: - case DW_OP_breg16: - case DW_OP_breg17: - case DW_OP_breg18: - case DW_OP_breg19: - case DW_OP_breg20: - case DW_OP_breg21: - case DW_OP_breg22: - case DW_OP_breg23: - case DW_OP_breg24: - case DW_OP_breg25: - case DW_OP_breg26: - case DW_OP_breg27: - case DW_OP_breg28: - case DW_OP_breg29: - case DW_OP_breg30: - case DW_OP_breg31:{ - // Push register + constant: - int register_id = simgrid::dwarf::dwarf_register_to_libunwind( - op->atom - DW_OP_breg0); - unw_word_t res; - if (not context.cursor) - throw evaluation_error("Missing stack context"); - unw_get_reg(context.cursor, register_id, &res); - stack.push(res + op->number); - break; - } - - // Push the CFA (Canonical Frame Address): - case DW_OP_call_frame_cfa: - { - /* See 6.4 of DWARF4 (http://dwarfstd.org/doc/DWARF4.pdf#page=140): - * - * > Typically, the CFA is defined to be the value of the stack - * > pointer at the call site in the previous frame (which may be - * > different from its value on entry to the current frame). - * - * We need to unwind the frame in order to get the SP of the parent - * frame. - * - * Warning: the CFA returned by libunwind (UNW_X86_64_RSP, etc.) - * is the SP of the *current* frame. */ - - if (not context.cursor) - throw evaluation_error("Missint cursor"); - - // Get frame: - unw_cursor_t cursor = *(context.cursor); - unw_step(&cursor); - - unw_word_t res; - unw_get_reg(&cursor, UNW_REG_SP, &res); - stack.push(res); - break; - } - - // Frame base: - - case DW_OP_fbreg: - stack.push((std::uintptr_t) context.frame_base + op->number); - break; - - // ***** Constants: - - // Short constant literals: - case DW_OP_lit0: - case DW_OP_lit1: - case DW_OP_lit2: - case DW_OP_lit3: - case DW_OP_lit4: - case DW_OP_lit5: - case DW_OP_lit6: - case DW_OP_lit7: - case DW_OP_lit8: - case DW_OP_lit9: - case DW_OP_lit10: - case DW_OP_lit11: - case DW_OP_lit12: - case DW_OP_lit13: - case DW_OP_lit14: - case DW_OP_lit15: - case DW_OP_lit16: - case DW_OP_lit17: - case DW_OP_lit18: - case DW_OP_lit19: - case DW_OP_lit20: - case DW_OP_lit21: - case DW_OP_lit22: - case DW_OP_lit23: - case DW_OP_lit24: - case DW_OP_lit25: - case DW_OP_lit26: - case DW_OP_lit27: - case DW_OP_lit28: - case DW_OP_lit29: - case DW_OP_lit30: - case DW_OP_lit31: - // Push a literal/constant on the stack: - stack.push(atom - DW_OP_lit0); - break; - - // Address from the base address of this ELF object. - // Push the address on the stack (base_address + argument). - case DW_OP_addr: { - if (not context.object_info) - throw evaluation_error("No base address"); - Dwarf_Off addr = (Dwarf_Off) (std::uintptr_t) - context.object_info->base_address() + op->number; - stack.push(addr); - break; - } - - // General constants: - // Push the constant argument on the stack. - case DW_OP_const1u: - case DW_OP_const2u: - case DW_OP_const4u: - case DW_OP_const8u: - case DW_OP_const1s: - case DW_OP_const2s: - case DW_OP_const4s: - case DW_OP_const8s: - case DW_OP_constu: - case DW_OP_consts: - stack.push(op->number); - break; - - // ***** Stack manipulation: - - // Push another copy/duplicate the value at the top of the stack: - case DW_OP_dup: - stack.dup(); - break; - - // Pop/drop the top of the stack: - case DW_OP_drop: - stack.pop(); - break; - - case DW_OP_swap: - stack.swap(); - break; - - // Duplicate the value under the top of the stack: - case DW_OP_over: - stack.push(stack.top(1)); - break; - - // ***** Operations: - // Those usually take the top of the stack and the next value as argument - // and replace the top of the stack with the computed value - // (stack.top() += stack.before_top()). - - case DW_OP_plus: - first = stack.pop(); - second = stack.pop(); - stack.push(first + second); - break; - - case DW_OP_mul: - first = stack.pop(); - second = stack.pop(); - stack.push(first * second); - break; - - case DW_OP_plus_uconst: - stack.top() += op->number; - break; - - case DW_OP_not: - stack.top() = ~stack.top(); - break; - - case DW_OP_neg: - stack.top() = - (intptr_t) stack.top(); - break; - - case DW_OP_minus: - first = stack.pop(); - second = stack.pop(); - stack.push(second - first); - break; - - case DW_OP_and: - first = stack.pop(); - second = stack.pop(); - stack.push(first & second); - break; - - case DW_OP_or: - first = stack.pop(); - second = stack.pop(); - stack.push(first | second); - break; - - case DW_OP_xor: - first = stack.pop(); - second = stack.pop(); - stack.push(first ^ second); - break; - - case DW_OP_nop: - break; - - // ***** Deference (memory fetch) - - case DW_OP_deref_size: - throw evaluation_error("Unsupported operation"); - - case DW_OP_deref: - // 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.process_index); - break; - - // Not handled: - default: - throw evaluation_error("Unsupported operation"); - } - - } -} - -} -} diff --git a/src/mc/inspect/DwarfExpression.cpp b/src/mc/inspect/DwarfExpression.cpp new file mode 100644 index 0000000000..42f590ebfb --- /dev/null +++ b/src/mc/inspect/DwarfExpression.cpp @@ -0,0 +1,270 @@ +/* Copyright (c) 2014-2019. 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. */ + +#include +#include + +#include "src/mc/AddressSpace.hpp" +#include "src/mc/DwarfExpression.hpp" +#include "src/mc/Frame.hpp" +#include "src/mc/LocationList.hpp" +#include "src/mc/ObjectInformation.hpp" +#include "src/mc/mc_dwarf.hpp" +#include "src/mc/mc_private.hpp" + +using simgrid::mc::remote; + +namespace simgrid { +namespace dwarf { + +void execute(const Dwarf_Op* ops, std::size_t n, const ExpressionContext& context, ExpressionStack& stack) +{ + for (size_t i = 0; i != n; ++i) { + const Dwarf_Op* op = ops + i; + std::uint8_t atom = op->atom; + intptr_t first; + intptr_t second; + + switch (atom) { + + // Registers: + + case DW_OP_breg0: + case DW_OP_breg1: + case DW_OP_breg2: + case DW_OP_breg3: + case DW_OP_breg4: + case DW_OP_breg5: + case DW_OP_breg6: + case DW_OP_breg7: + case DW_OP_breg8: + case DW_OP_breg9: + case DW_OP_breg10: + case DW_OP_breg11: + case DW_OP_breg12: + case DW_OP_breg13: + case DW_OP_breg14: + case DW_OP_breg15: + case DW_OP_breg16: + case DW_OP_breg17: + case DW_OP_breg18: + case DW_OP_breg19: + case DW_OP_breg20: + case DW_OP_breg21: + case DW_OP_breg22: + case DW_OP_breg23: + case DW_OP_breg24: + case DW_OP_breg25: + case DW_OP_breg26: + case DW_OP_breg27: + case DW_OP_breg28: + case DW_OP_breg29: + case DW_OP_breg30: + case DW_OP_breg31: { + // Push register + constant: + int register_id = simgrid::dwarf::dwarf_register_to_libunwind(op->atom - DW_OP_breg0); + unw_word_t res; + if (not context.cursor) + throw evaluation_error("Missing stack context"); + unw_get_reg(context.cursor, register_id, &res); + stack.push(res + op->number); + break; + } + + // Push the CFA (Canonical Frame Address): + case DW_OP_call_frame_cfa: { + /* See 6.4 of DWARF4 (http://dwarfstd.org/doc/DWARF4.pdf#page=140): + * + * > Typically, the CFA is defined to be the value of the stack + * > pointer at the call site in the previous frame (which may be + * > different from its value on entry to the current frame). + * + * We need to unwind the frame in order to get the SP of the parent + * frame. + * + * Warning: the CFA returned by libunwind (UNW_X86_64_RSP, etc.) + * is the SP of the *current* frame. */ + + if (not context.cursor) + throw evaluation_error("Missint cursor"); + + // Get frame: + unw_cursor_t cursor = *(context.cursor); + unw_step(&cursor); + + unw_word_t res; + unw_get_reg(&cursor, UNW_REG_SP, &res); + stack.push(res); + break; + } + + // Frame base: + + case DW_OP_fbreg: + stack.push((std::uintptr_t)context.frame_base + op->number); + break; + + // ***** Constants: + + // Short constant literals: + case DW_OP_lit0: + case DW_OP_lit1: + case DW_OP_lit2: + case DW_OP_lit3: + case DW_OP_lit4: + case DW_OP_lit5: + case DW_OP_lit6: + case DW_OP_lit7: + case DW_OP_lit8: + case DW_OP_lit9: + case DW_OP_lit10: + case DW_OP_lit11: + case DW_OP_lit12: + case DW_OP_lit13: + case DW_OP_lit14: + case DW_OP_lit15: + case DW_OP_lit16: + case DW_OP_lit17: + case DW_OP_lit18: + case DW_OP_lit19: + case DW_OP_lit20: + case DW_OP_lit21: + case DW_OP_lit22: + case DW_OP_lit23: + case DW_OP_lit24: + case DW_OP_lit25: + case DW_OP_lit26: + case DW_OP_lit27: + case DW_OP_lit28: + case DW_OP_lit29: + case DW_OP_lit30: + case DW_OP_lit31: + // Push a literal/constant on the stack: + stack.push(atom - DW_OP_lit0); + break; + + // Address from the base address of this ELF object. + // Push the address on the stack (base_address + argument). + case DW_OP_addr: { + if (not context.object_info) + throw evaluation_error("No base address"); + Dwarf_Off addr = (Dwarf_Off)(std::uintptr_t)context.object_info->base_address() + op->number; + stack.push(addr); + break; + } + + // General constants: + // Push the constant argument on the stack. + case DW_OP_const1u: + case DW_OP_const2u: + case DW_OP_const4u: + case DW_OP_const8u: + case DW_OP_const1s: + case DW_OP_const2s: + case DW_OP_const4s: + case DW_OP_const8s: + case DW_OP_constu: + case DW_OP_consts: + stack.push(op->number); + break; + + // ***** Stack manipulation: + + // Push another copy/duplicate the value at the top of the stack: + case DW_OP_dup: + stack.dup(); + break; + + // Pop/drop the top of the stack: + case DW_OP_drop: + stack.pop(); + break; + + case DW_OP_swap: + stack.swap(); + break; + + // Duplicate the value under the top of the stack: + case DW_OP_over: + stack.push(stack.top(1)); + break; + + // ***** Operations: + // Those usually take the top of the stack and the next value as argument + // and replace the top of the stack with the computed value + // (stack.top() += stack.before_top()). + + case DW_OP_plus: + first = stack.pop(); + second = stack.pop(); + stack.push(first + second); + break; + + case DW_OP_mul: + first = stack.pop(); + second = stack.pop(); + stack.push(first * second); + break; + + case DW_OP_plus_uconst: + stack.top() += op->number; + break; + + case DW_OP_not: + stack.top() = ~stack.top(); + break; + + case DW_OP_neg: + stack.top() = -(intptr_t)stack.top(); + break; + + case DW_OP_minus: + first = stack.pop(); + second = stack.pop(); + stack.push(second - first); + break; + + case DW_OP_and: + first = stack.pop(); + second = stack.pop(); + stack.push(first & second); + break; + + case DW_OP_or: + first = stack.pop(); + second = stack.pop(); + stack.push(first | second); + break; + + case DW_OP_xor: + first = stack.pop(); + second = stack.pop(); + stack.push(first ^ second); + break; + + case DW_OP_nop: + break; + + // ***** Deference (memory fetch) + + case DW_OP_deref_size: + throw evaluation_error("Unsupported operation"); + + case DW_OP_deref: + // 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.process_index); + break; + + // Not handled: + default: + throw evaluation_error("Unsupported operation"); + } + } +} + +} // namespace dwarf +} // namespace simgrid diff --git a/src/mc/DwarfExpression.hpp b/src/mc/inspect/DwarfExpression.hpp similarity index 84% rename from src/mc/DwarfExpression.hpp rename to src/mc/inspect/DwarfExpression.hpp index b6713b22af..5891042244 100644 --- a/src/mc/DwarfExpression.hpp +++ b/src/mc/inspect/DwarfExpression.hpp @@ -17,7 +17,7 @@ #include #include "src/mc/AddressSpace.hpp" -#include "src/mc/mc_dwarf.hpp" +#include "src/mc/inspect/mc_dwarf.hpp" #include "src/mc/mc_forward.hpp" /** @file DwarfExpression.hpp @@ -45,9 +45,14 @@ typedef std::vector DwarfExpression; */ class ExpressionContext { public: - ExpressionContext() : - cursor(nullptr), frame_base(nullptr), address_space(nullptr), - object_info(nullptr), process_index(simgrid::mc::ProcessIndexMissing) {} + ExpressionContext() + : cursor(nullptr) + , frame_base(nullptr) + , address_space(nullptr) + , object_info(nullptr) + , process_index(simgrid::mc::ProcessIndexMissing) + { + } /** CPU state (registers) */ unw_cursor_t* cursor; void* frame_base; @@ -71,18 +76,20 @@ class ExpressionStack { public: typedef std::uintptr_t value_type; static const std::size_t max_size = 64; + private: // Values of the stack (the top is stack_[size_ - 1]): - uintptr_t stack_[max_size] {0}; + uintptr_t stack_[max_size]{0}; size_t size_; + public: ExpressionStack() : size_(0) {} // Access: std::size_t size() const { return size_; } - bool empty() const { return size_ == 0; } - void clear() { size_ = 0; } - uintptr_t& operator[](int i) { return stack_[i]; } + bool empty() const { return size_ == 0; } + void clear() { size_ = 0; } + uintptr_t& operator[](int i) { return stack_[i]; } uintptr_t const& operator[](int i) const { return stack_[i]; } /** Top of the stack */ @@ -133,8 +140,7 @@ public: * @param context evaluation context (registers, memory, etc.) * @param stack DWARf stack where the operations are executed */ -void execute(const Dwarf_Op* ops, std::size_t n, - ExpressionContext const& context, ExpressionStack& stack); +void execute(const Dwarf_Op* ops, std::size_t n, ExpressionContext const& context, ExpressionStack& stack); /** Executes/evaluates a DWARF expression * @@ -142,14 +148,13 @@ void execute(const Dwarf_Op* ops, std::size_t n, * @param context evaluation context (registers, memory, etc.) * @param stack DWARf stack where the operations are executed */ -inline -void execute(simgrid::dwarf::DwarfExpression const& expression, - ExpressionContext const& context, ExpressionStack& stack) +inline void execute(simgrid::dwarf::DwarfExpression const& expression, ExpressionContext const& context, + ExpressionStack& stack) { execute(expression.data(), expression.size(), context, stack); } -} -} +} // namespace dwarf +} // namespace simgrid #endif diff --git a/src/mc/Frame.cpp b/src/mc/inspect/Frame.cpp similarity index 76% rename from src/mc/Frame.cpp rename to src/mc/inspect/Frame.cpp index 7a2f5ba5bd..2d8620fc45 100644 --- a/src/mc/Frame.cpp +++ b/src/mc/inspect/Frame.cpp @@ -15,9 +15,8 @@ namespace mc { void* Frame::frame_base(unw_cursor_t& unw_cursor) const { - simgrid::dwarf::Location location = simgrid::dwarf::resolve( - frame_base_location, object_info, - &unw_cursor, nullptr, nullptr, -1); + simgrid::dwarf::Location location = + simgrid::dwarf::resolve(frame_base_location, object_info, &unw_cursor, nullptr, nullptr, -1); if (location.in_memory()) return location.address(); else if (location.in_register()) { @@ -28,10 +27,10 @@ void* Frame::frame_base(unw_cursor_t& unw_cursor) const // contains the address of the frame base. unw_word_t word; unw_get_reg(&unw_cursor, location.register_id(), &word); - return (void*) word; - } - else xbt_die("Unexpected location type"); + return (void*)word; + } else + xbt_die("Unexpected location type"); } -} -} +} // namespace mc +} // namespace simgrid diff --git a/src/mc/Frame.hpp b/src/mc/inspect/Frame.hpp similarity index 84% rename from src/mc/Frame.hpp rename to src/mc/inspect/Frame.hpp index e6d9e0d4d6..0d653ed26e 100644 --- a/src/mc/Frame.hpp +++ b/src/mc/inspect/Frame.hpp @@ -7,15 +7,15 @@ #ifndef SIMGRID_MC_FRAME_HPP #define SIMGRID_MC_FRAME_HPP -#include #include +#include #include "xbt/base.h" #include "xbt/range.hpp" +#include "src/mc/inspect/LocationList.hpp" +#include "src/mc/inspect/Variable.hpp" #include "src/mc/mc_forward.hpp" -#include "src/mc/LocationList.hpp" -#include "src/mc/Variable.hpp" namespace simgrid { namespace mc { @@ -59,17 +59,16 @@ public: void remove_variable(char* name); }; -inline -Frame::Frame() +inline Frame::Frame() { - this->tag = 0; - this->range = {0, 0}; - this->id = 0; + this->tag = 0; + this->range = {0, 0}; + this->id = 0; this->abstract_origin_id = 0; - this->object_info = nullptr; + this->object_info = nullptr; } -} -} +} // namespace mc +} // namespace simgrid #endif diff --git a/src/mc/LocationList.cpp b/src/mc/inspect/LocationList.cpp similarity index 58% rename from src/mc/LocationList.cpp rename to src/mc/inspect/LocationList.cpp index ef1e2a903b..500b851f9b 100644 --- a/src/mc/LocationList.cpp +++ b/src/mc/inspect/LocationList.cpp @@ -12,26 +12,23 @@ #include -#include "src/mc/mc_dwarf.hpp" -#include "src/mc/ObjectInformation.hpp" #include "src/mc/LocationList.hpp" +#include "src/mc/ObjectInformation.hpp" +#include "src/mc/mc_dwarf.hpp" namespace simgrid { 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, int process_index) +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, + int process_index) { simgrid::dwarf::ExpressionContext context; - context.frame_base = frame_pointer_address; - context.cursor = c; + context.frame_base = frame_pointer_address; + context.cursor = c; context.address_space = address_space; - context.object_info = object_info; + context.object_info = object_info; context.process_index = process_index; if (not expression.empty() && expression[0].atom >= DW_OP_reg0 && expression[0].atom <= DW_OP_reg31) { @@ -42,12 +39,12 @@ Location resolve( simgrid::dwarf::ExpressionStack stack; simgrid::dwarf::execute(expression, context, stack); - return Location((void*) stack.top()); + return Location((void*)stack.top()); } // TODO, move this in a method of LocationList -static simgrid::dwarf::DwarfExpression const* find_expression( - simgrid::dwarf::LocationList const& locations, unw_word_t ip) +static simgrid::dwarf::DwarfExpression const* find_expression(simgrid::dwarf::LocationList const& locations, + unw_word_t ip) { for (simgrid::dwarf::LocationListEntry const& entry : locations) if (entry.valid_for_ip(ip)) @@ -55,29 +52,20 @@ static simgrid::dwarf::DwarfExpression const* find_expression( return nullptr; } -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, - int process_index) +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, + int process_index) { unw_word_t ip = 0; if (c && unw_get_reg(c, UNW_REG_IP, &ip)) xbt_die("Could not resolve IP"); - simgrid::dwarf::DwarfExpression const* expression = - find_expression(locations, ip); + simgrid::dwarf::DwarfExpression const* expression = find_expression(locations, ip); if (not expression) xbt_die("Could not resolve location"); - return simgrid::dwarf::resolve( - *expression, object_info, c, - frame_pointer_address, address_space, process_index); + return simgrid::dwarf::resolve(*expression, object_info, c, frame_pointer_address, address_space, process_index); } -LocationList location_list( - simgrid::mc::ObjectInformation& info, - Dwarf_Attribute& attr) +LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr) { LocationList locations; std::ptrdiff_t offset = 0; @@ -85,7 +73,7 @@ LocationList location_list( Dwarf_Addr base; Dwarf_Addr start; Dwarf_Addr end; - Dwarf_Op *ops; + Dwarf_Op* ops; std::size_t len; offset = dwarf_getlocations(&attr, offset, &base, &start, &end, &ops, &len); @@ -95,19 +83,19 @@ LocationList location_list( else if (offset == -1) xbt_die("Error while loading location list"); - std::uint64_t base_address = (std::uint64_t) info.base_address(); + std::uint64_t base_address = (std::uint64_t)info.base_address(); LocationListEntry::range_type range; if (start == 0) // If start == 0, this is not a location list: - range = { 0, UINT64_MAX }; + range = {0, UINT64_MAX}; else - range = { base_address + start, base_address + end }; + range = {base_address + start, base_address + end}; - locations.push_back({ DwarfExpression(ops, ops+len), range }); + locations.push_back({DwarfExpression(ops, ops + len), range}); } return locations; } -} -} +} // namespace dwarf +} // namespace simgrid diff --git a/src/mc/LocationList.hpp b/src/mc/inspect/LocationList.hpp similarity index 57% rename from src/mc/LocationList.hpp rename to src/mc/inspect/LocationList.hpp index 3427060139..b937ef45cb 100644 --- a/src/mc/LocationList.hpp +++ b/src/mc/inspect/LocationList.hpp @@ -9,9 +9,9 @@ #include "xbt/base.h" #include "xbt/range.hpp" +#include "src/mc/inspect/DwarfExpression.hpp" #include "src/mc/mc_base.h" #include "src/mc/mc_forward.hpp" -#include "src/mc/DwarfExpression.hpp" #include #include @@ -23,31 +23,22 @@ namespace dwarf { class LocationListEntry { public: typedef simgrid::xbt::Range range_type; + private: DwarfExpression expression_; // By default, the expression is always valid: range_type range_ = {0, UINT64_MAX}; + public: LocationListEntry() = default; - LocationListEntry(DwarfExpression expression, range_type range) - : expression_(std::move(expression)), range_(range) - {} + LocationListEntry(DwarfExpression expression, range_type range) : expression_(std::move(expression)), range_(range) {} explicit LocationListEntry(DwarfExpression expression) : expression_(std::move(expression)), range_({0, UINT64_MAX}) { } - DwarfExpression& expression() - { - return expression_; - } - DwarfExpression const& expression() const - { - return expression_; - } - bool valid_for_ip(unw_word_t ip) const - { - return range_.contain(ip); - } + DwarfExpression& expression() { return expression_; } + DwarfExpression const& expression() const { return expression_; } + bool valid_for_ip(unw_word_t ip) const { return range_.contain(ip); } }; typedef std::vector LocationList; @@ -66,34 +57,26 @@ public: explicit Location(int register_id) : memory_(nullptr), register_id_(register_id) {} // Type of location: bool in_register() const { return memory_ == nullptr; } - bool in_memory() const { return memory_ != nullptr; } + bool in_memory() const { return memory_ != nullptr; } // Get the location: - void* address() const { return memory_; } - int register_id() const { return register_id_; } + void* address() const { return memory_; } + int register_id() const { return register_id_; } }; XBT_PRIVATE -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, - int process_index); - -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, - int process_index); +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, + int process_index); + +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, + int process_index); XBT_PRIVATE -simgrid::dwarf::LocationList location_list( - simgrid::mc::ObjectInformation& info, - Dwarf_Attribute& attr); +simgrid::dwarf::LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr); -} -} +} // namespace dwarf +} // namespace simgrid #endif diff --git a/src/mc/ObjectInformation.cpp b/src/mc/inspect/ObjectInformation.cpp similarity index 75% rename from src/mc/ObjectInformation.cpp rename to src/mc/inspect/ObjectInformation.cpp index 18c2da3f0d..e0f96bfcef 100644 --- a/src/mc/ObjectInformation.cpp +++ b/src/mc/inspect/ObjectInformation.cpp @@ -25,7 +25,7 @@ namespace mc { * i.e. \f$\text{virtual address} = \text{shared object base address} * + \text{dwarf address}\f$. */ -void *ObjectInformation::base_address() const +void* ObjectInformation::base_address() const { // For an executable (more precisely for a ET_EXEC) the base it 0: if (this->executable()) @@ -33,15 +33,15 @@ void *ObjectInformation::base_address() const // For an a shared-object (ET_DYN, including position-independant executables) // the base address is its lowest address: - void *result = this->start_exec; - if (this->start_rw != nullptr && result > (void *) this->start_rw) + void* result = this->start_exec; + if (this->start_rw != nullptr && result > (void*)this->start_rw) result = this->start_rw; - if (this->start_ro != nullptr && result > (void *) this->start_ro) + if (this->start_ro != nullptr && result > (void*)this->start_ro) result = this->start_ro; return result; } -simgrid::mc::Frame* ObjectInformation::find_function(const void *ip) const +simgrid::mc::Frame* ObjectInformation::find_function(const void* ip) const { /* This is implemented by binary search on a sorted array. * @@ -55,10 +55,9 @@ simgrid::mc::Frame* ObjectInformation::find_function(const void *ip) const * We could use std::binary_search by including the high_pc inside * the FunctionIndexEntry. */ - const simgrid::mc::FunctionIndexEntry* base = - this->functions_index.data(); - int i = 0; - int j = this->functions_index.size() - 1; + const simgrid::mc::FunctionIndexEntry* base = this->functions_index.data(); + int i = 0; + int j = this->functions_index.size() - 1; while (j >= i) { int k = i + ((j - i) / 2); @@ -73,7 +72,7 @@ simgrid::mc::Frame* ObjectInformation::find_function(const void *ip) const * Either we have found the correct function or we do not know * any function corresponding to this instruction address. * Only at the point do we dereference the function pointer. */ - else if ((std::uint64_t) ip < base[k].function->range.end()) + else if ((std::uint64_t)ip < base[k].function->range.end()) return base[k].function; else return nullptr; @@ -84,7 +83,7 @@ simgrid::mc::Frame* ObjectInformation::find_function(const void *ip) const const simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const { for (simgrid::mc::Variable const& variable : this->global_variables) - if(variable.name == name) + if (variable.name == name) return &variable; return nullptr; } @@ -98,12 +97,12 @@ void ObjectInformation::remove_global_variable(const char* name) // Binary search: size_type first = 0; - size_type last = this->global_variables.size() - 1; + size_type last = this->global_variables.size() - 1; while (first <= last) { - size_type cursor = first + (last - first) / 2; + size_type cursor = first + (last - first) / 2; simgrid::mc::Variable& current_var = this->global_variables[cursor]; - int cmp = current_var.name.compare(name); + int cmp = current_var.name.compare(name); if (cmp == 0) { @@ -117,9 +116,7 @@ void ObjectInformation::remove_global_variable(const char* name) last++; // Remove the whole range: - this->global_variables.erase( - this->global_variables.begin() + first, - this->global_variables.begin() + last + 1); + this->global_variables.erase(this->global_variables.begin() + first, this->global_variables.begin() + last + 1); return; } else if (cmp < 0) @@ -142,10 +139,8 @@ void ObjectInformation::remove_global_variable(const char* name) * @param subprogram (possibly inlined) Subprogram of the scope current scope * @param scope Current scope */ -static void remove_local_variable(simgrid::mc::Frame& scope, - const char *var_name, - const char *subprogram_name, - simgrid::mc::Frame const& subprogram) +static void remove_local_variable(simgrid::mc::Frame& scope, const char* var_name, const char* subprogram_name, + simgrid::mc::Frame const& subprogram) { typedef std::vector::size_type size_type; @@ -155,13 +150,13 @@ static void remove_local_variable(simgrid::mc::Frame& scope, // Try to find the variable and remove it: size_type start = 0; - size_type end = scope.variables.size() - 1; + size_type end = scope.variables.size() - 1; // Binary search: while (start <= end) { - size_type cursor = start + (end - start) / 2; + size_type cursor = start + (end - start) / 2; simgrid::mc::Variable& current_var = scope.variables[cursor]; - int compare = current_var.name.compare(var_name); + int compare = current_var.name.compare(var_name); if (compare == 0) { // Variable found, remove it: scope.variables.erase(scope.variables.begin() + cursor); @@ -180,20 +175,16 @@ static void remove_local_variable(simgrid::mc::Frame& scope, // The new scope may be an inlined subroutine, in this case we want to use its // namespaced name in recursive calls: simgrid::mc::Frame const& nested_subprogram = - nested_scope.tag == - DW_TAG_inlined_subroutine ? nested_scope : subprogram; - remove_local_variable(nested_scope, var_name, subprogram_name, - nested_subprogram); + nested_scope.tag == DW_TAG_inlined_subroutine ? nested_scope : subprogram; + remove_local_variable(nested_scope, var_name, subprogram_name, nested_subprogram); } } -void ObjectInformation::remove_local_variable( - const char* var_name, const char* subprogram_name) +void ObjectInformation::remove_local_variable(const char* var_name, const char* subprogram_name) { for (auto& entry : this->subprograms) - simgrid::mc::remove_local_variable(entry.second, - var_name, subprogram_name, entry.second); + simgrid::mc::remove_local_variable(entry.second, var_name, subprogram_name, entry.second); } -} -} +} // namespace mc +} // namespace simgrid diff --git a/src/mc/ObjectInformation.hpp b/src/mc/inspect/ObjectInformation.hpp similarity index 87% rename from src/mc/ObjectInformation.hpp rename to src/mc/inspect/ObjectInformation.hpp index e813af7333..6bf27ff791 100644 --- a/src/mc/ObjectInformation.hpp +++ b/src/mc/inspect/ObjectInformation.hpp @@ -7,13 +7,13 @@ #ifndef SIMGRID_MC_OBJECT_INFORMATION_HPP #define SIMGRID_MC_OBJECT_INFORMATION_HPP +#include #include #include -#include #include -#include "src/mc/Frame.hpp" -#include "src/mc/Type.hpp" +#include "src/mc/inspect/Frame.hpp" +#include "src/mc/inspect/Type.hpp" #include "src/mc/mc_forward.hpp" #include "src/xbt/memory_map.hpp" @@ -63,16 +63,16 @@ public: int flags = 0; std::string file_name; const void* start = nullptr; - const void *end = nullptr; + const void* end = nullptr; // Location of its text segment: - char *start_exec = nullptr; - char *end_exec = nullptr; + char* start_exec = nullptr; + char* end_exec = nullptr; // Location of the read-only part of its data segment: - char *start_rw = nullptr; - char *end_rw = nullptr; + char* start_rw = nullptr; + char* end_rw = nullptr; // Location of the read/write part of its data segment: - char *start_ro = nullptr; - char *end_ro = nullptr; + char* start_ro = nullptr; + char* end_ro = nullptr; /** All of its subprograms indexed by their address */ std::unordered_map subprograms; @@ -110,10 +110,7 @@ public: * use fixed addresses instead of base-addres relative addresses. * Position independant executables are in fact ET_DYN. */ - bool executable() const - { - return this->flags & simgrid::mc::ObjectInformation::Executable; - } + bool executable() const { return this->flags & simgrid::mc::ObjectInformation::Executable; } /** Base address of the module * @@ -131,7 +128,7 @@ public: * @param ip instruction address * @return corresponding function (if any) or nullptr */ - simgrid::mc::Frame* find_function(const void *ip) const; + simgrid::mc::Frame* find_function(const void* ip) const; /** Find a global variable by name * @@ -154,16 +151,15 @@ public: * @param name Name of the globale variable * @param scope Namespaceed name of the function (or null for all functions) */ - void remove_local_variable( - const char* name, const char* scope); + void remove_local_variable(const char* name, const char* scope); }; -XBT_PRIVATE std::shared_ptr createObjectInformation( - std::vector const& maps, const char* name); +XBT_PRIVATE std::shared_ptr createObjectInformation(std::vector const& maps, + const char* name); /** Augment the current module with informations about the other ones */ XBT_PRIVATE void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info); -} -} +} // namespace mc +} // namespace simgrid #endif diff --git a/src/mc/Type.hpp b/src/mc/inspect/Type.hpp similarity index 60% rename from src/mc/Type.hpp rename to src/mc/inspect/Type.hpp index 7bc14644c1..4ae29aad1c 100644 --- a/src/mc/Type.hpp +++ b/src/mc/inspect/Type.hpp @@ -8,14 +8,14 @@ #include -#include #include +#include #include "xbt/asserts.h" #include "xbt/base.h" +#include "src/mc/inspect/LocationList.hpp" #include "src/mc/mc_forward.hpp" -#include "src/mc/LocationList.hpp" namespace simgrid { namespace mc { @@ -27,7 +27,7 @@ namespace mc { class Member { public: typedef int flags_type; - static constexpr flags_type INHERITANCE_FLAG = 1; + static constexpr flags_type INHERITANCE_FLAG = 1; static constexpr flags_type VIRTUAL_POINTER_FLAG = 2; Member() = default; @@ -43,35 +43,28 @@ public: std::size_t byte_size = 0; // Do we really need this? - unsigned type_id = 0; + unsigned type_id = 0; simgrid::mc::Type* type = nullptr; - bool isInheritance() const - { - return this->flags & INHERITANCE_FLAG; - } - bool isVirtualPointer() const - { - return this->flags & VIRTUAL_POINTER_FLAG; - } + bool isInheritance() const { return this->flags & INHERITANCE_FLAG; } + bool isVirtualPointer() const { return this->flags & VIRTUAL_POINTER_FLAG; } /** Whether the member is at a fixed offset from the base address */ bool has_offset_location() const { // Recognize the expression `DW_OP_plus_uconst(offset)`: - return location_expression.size() == 1 && - location_expression[0].atom == DW_OP_plus_uconst; + return location_expression.size() == 1 && location_expression[0].atom == DW_OP_plus_uconst; } /** Get the offset of the member - * - * This is only valid is the member is at a fixed offset from the base. - * This is often the case (for C types, C++ type without virtual - * inheritance). - * - * If the location is more complex, the location expression has - * to be evaluated (which might need accessing the memory). - */ + * + * This is only valid is the member is at a fixed offset from the base. + * This is often the case (for C types, C++ type without virtual + * inheritance). + * + * If the location is more complex, the location expression has + * to be evaluated (which might need accessing the memory). + */ int offset() const { xbt_assert(this->has_offset_location()); @@ -83,11 +76,10 @@ public: { // Set the expression to be `DW_OP_plus_uconst(offset)`: Dwarf_Op op; - op.atom = DW_OP_plus_uconst; - op.number = new_offset; - this->location_expression = { op }; + op.atom = DW_OP_plus_uconst; + op.number = new_offset; + this->location_expression = {op}; } - }; /** A type in the model-checked program */ @@ -96,19 +88,19 @@ public: Type() = default; /** The DWARF TAG of the type (e.g. DW_TAG_array_type) */ - int type = 0; - unsigned id = 0; /* Offset in the section (in hexadecimal form) */ - std::string name; /* Name of the type */ - int byte_size = 0; /* Size in bytes */ - int element_count = 0; /* Number of elements for array type */ - unsigned type_id = 0; /* DW_AT_type id */ + int type = 0; + unsigned id = 0; /* Offset in the section (in hexadecimal form) */ + std::string name; /* Name of the type */ + int byte_size = 0; /* Size in bytes */ + int element_count = 0; /* Number of elements for array type */ + unsigned type_id = 0; /* DW_AT_type id */ std::vector members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/ - simgrid::mc::Type* subtype = nullptr; // DW_AT_type + simgrid::mc::Type* subtype = nullptr; // DW_AT_type simgrid::mc::Type* full_type = nullptr; // The same (but more complete) type }; -} -} +} // namespace mc +} // namespace simgrid #endif diff --git a/src/mc/Variable.hpp b/src/mc/inspect/Variable.hpp similarity index 86% rename from src/mc/Variable.hpp rename to src/mc/inspect/Variable.hpp index b3a0817e64..8c4f6c2145 100644 --- a/src/mc/Variable.hpp +++ b/src/mc/inspect/Variable.hpp @@ -11,8 +11,8 @@ #include +#include "src/mc/inspect/LocationList.hpp" #include "src/mc/mc_forward.hpp" -#include "src/mc/LocationList.hpp" namespace simgrid { namespace mc { @@ -20,11 +20,11 @@ namespace mc { /** A variable (global or local) in the model-checked program */ class Variable { public: - Variable() = default; + Variable() = default; std::uint32_t id = 0; - bool global = false; + bool global = false; std::string name; - unsigned type_id = 0; + unsigned type_id = 0; simgrid::mc::Type* type = nullptr; /** Address of the variable (if it is fixed) */ @@ -43,7 +43,7 @@ public: simgrid::mc::ObjectInformation* object_info = nullptr; }; -} -} +} // namespace mc +} // namespace simgrid #endif diff --git a/src/mc/mc_dwarf.cpp b/src/mc/inspect/mc_dwarf.cpp similarity index 60% rename from src/mc/mc_dwarf.cpp rename to src/mc/inspect/mc_dwarf.cpp index ec22c9a71e..81f61f1c42 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/inspect/mc_dwarf.cpp @@ -11,9 +11,9 @@ #include -#include #include #include +#include #include @@ -57,7 +57,7 @@ static uint64_t MC_dwarf_subrange_element_count(Dwarf_Die* die, Dwarf_Die* unit) * * @param die DIE for the DW_TAG_array_type */ -static uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit); +static uint64_t MC_dwarf_array_element_count(Dwarf_Die* die, Dwarf_Die* unit); /** @brief Process a DIE * @@ -66,15 +66,13 @@ static uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit); * @param unit the DIE of the compile unit of the current DIE * @param frame containing frame if any */ -static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns); +static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns); /** @brief Process a type DIE */ -static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns); +static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns); /** @brief Calls MC_dwarf_handle_die on all children of the given die * @@ -83,9 +81,8 @@ static void MC_dwarf_handle_type_die(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_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns); +static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns); /** @brief Handle a variable (DW_TAG_variable or other) * @@ -94,34 +91,26 @@ 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, simgrid::mc::Frame* frame, - const char *ns); +static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns); /** @brief Get the DW_TAG_type of the DIE * * @param die DIE * @return DW_TAG_type attribute as a new string (nullptr if none) */ -static std::uint64_t MC_dwarf_at_type(Dwarf_Die * die); +static std::uint64_t MC_dwarf_at_type(Dwarf_Die* die); namespace simgrid { namespace dwarf { -enum class TagClass { - Unknown, - Type, - Subprogram, - Variable, - Scope, - Namespace -}; +enum class TagClass { Unknown, Type, Subprogram, Variable, Scope, Namespace }; /*** Class of forms defined in the DWARF standard */ enum class FormClass { Unknown, - Address, // Location in the program's address space - Block, // Arbitrary block of bytes + Address, // Location in the program's address space + Block, // Arbitrary block of bytes Constant, String, Flag, // Boolean value @@ -133,55 +122,54 @@ enum class FormClass { RangeListPtr }; -static -TagClass classify_tag(int tag) +static TagClass classify_tag(int tag) { switch (tag) { - case DW_TAG_array_type: - case DW_TAG_class_type: - case DW_TAG_enumeration_type: - case DW_TAG_typedef: - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_rvalue_reference_type: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subroutine_type: - case DW_TAG_union_type: - case DW_TAG_ptr_to_member_type: - case DW_TAG_set_type: - case DW_TAG_subrange_type: - case DW_TAG_base_type: - case DW_TAG_const_type: - case DW_TAG_file_type: - case DW_TAG_packed_type: - case DW_TAG_volatile_type: - case DW_TAG_restrict_type: - case DW_TAG_interface_type: - case DW_TAG_unspecified_type: - case DW_TAG_shared_type: - return TagClass::Type; - - case DW_TAG_subprogram: - return TagClass::Subprogram; - - case DW_TAG_variable: - case DW_TAG_formal_parameter: - return TagClass::Variable; - - case DW_TAG_lexical_block: - case DW_TAG_try_block: - case DW_TAG_catch_block: - case DW_TAG_inlined_subroutine: - case DW_TAG_with_stmt: - return TagClass::Scope; - - case DW_TAG_namespace: - return TagClass::Namespace; - - default: - return TagClass::Unknown; + case DW_TAG_array_type: + case DW_TAG_class_type: + case DW_TAG_enumeration_type: + case DW_TAG_typedef: + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_rvalue_reference_type: + case DW_TAG_string_type: + case DW_TAG_structure_type: + case DW_TAG_subroutine_type: + case DW_TAG_union_type: + case DW_TAG_ptr_to_member_type: + case DW_TAG_set_type: + case DW_TAG_subrange_type: + case DW_TAG_base_type: + case DW_TAG_const_type: + case DW_TAG_file_type: + case DW_TAG_packed_type: + case DW_TAG_volatile_type: + case DW_TAG_restrict_type: + case DW_TAG_interface_type: + case DW_TAG_unspecified_type: + case DW_TAG_shared_type: + return TagClass::Type; + + case DW_TAG_subprogram: + return TagClass::Subprogram; + + case DW_TAG_variable: + case DW_TAG_formal_parameter: + return TagClass::Variable; + + case DW_TAG_lexical_block: + case DW_TAG_try_block: + case DW_TAG_catch_block: + case DW_TAG_inlined_subroutine: + case DW_TAG_with_stmt: + return TagClass::Scope; + + case DW_TAG_namespace: + return TagClass::Namespace; + + default: + return TagClass::Unknown; } } @@ -192,43 +180,42 @@ TagClass classify_tag(int tag) * @param form The form (values taken from the DWARF spec) * @return An internal representation for the corresponding class * */ -static -FormClass classify_form(int form) +static FormClass classify_form(int form) { switch (form) { - case DW_FORM_addr: - return FormClass::Address; - case DW_FORM_block2: - case DW_FORM_block4: - case DW_FORM_block: - case DW_FORM_block1: - return FormClass::Block; - case DW_FORM_data1: - case DW_FORM_data2: - case DW_FORM_data4: - case DW_FORM_data8: - case DW_FORM_udata: - case DW_FORM_sdata: - return FormClass::Constant; - case DW_FORM_string: - case DW_FORM_strp: - return FormClass::String; - case DW_FORM_ref_addr: - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: - return FormClass::Reference; - case DW_FORM_flag: - case DW_FORM_flag_present: - return FormClass::Flag; - case DW_FORM_exprloc: - return FormClass::ExprLoc; - // TODO sec offset - // TODO indirect - default: - return FormClass::Unknown; + case DW_FORM_addr: + return FormClass::Address; + case DW_FORM_block2: + case DW_FORM_block4: + case DW_FORM_block: + case DW_FORM_block1: + return FormClass::Block; + case DW_FORM_data1: + case DW_FORM_data2: + case DW_FORM_data4: + case DW_FORM_data8: + case DW_FORM_udata: + case DW_FORM_sdata: + return FormClass::Constant; + case DW_FORM_string: + case DW_FORM_strp: + return FormClass::String; + case DW_FORM_ref_addr: + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: + case DW_FORM_ref8: + case DW_FORM_ref_udata: + return FormClass::Reference; + case DW_FORM_flag: + case DW_FORM_flag_present: + return FormClass::Flag; + case DW_FORM_exprloc: + return FormClass::ExprLoc; + // TODO sec offset + // TODO indirect + default: + return FormClass::Unknown; } } @@ -237,14 +224,13 @@ FormClass classify_form(int form) * @param die DIE * @return name of the tag of this DIE */ -inline XBT_PRIVATE -const char *tagname(Dwarf_Die * die) +inline XBT_PRIVATE const char* tagname(Dwarf_Die* die) { return simgrid::dwarf::tagname(dwarf_tag(die)); } -} -} +} // namespace dwarf +} // namespace simgrid // ***** Attributes @@ -254,8 +240,7 @@ const char *tagname(Dwarf_Die * die) * @param attribute attribute * @return value of the given attribute of the given DIE */ -static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die, - int attribute) +static const char* MC_dwarf_attr_integrate_string(Dwarf_Die* die, int attribute) { Dwarf_Attribute attr; if (not dwarf_attr_integrate(die, attribute, &attr)) @@ -264,7 +249,7 @@ static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die, return dwarf_formstring(&attr); } -static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die * die, int attribute) +static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die* die, int attribute) { Dwarf_Attribute attr; if (dwarf_hasattr_integrate(die, attribute) == 0) @@ -276,8 +261,7 @@ static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die * die, int attribute) return dwarf_dieoffset(&subtype_die); } -static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die * die, - int attribute) +static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die* die, int attribute) { Dwarf_Attribute attr; if (dwarf_hasattr_integrate(die, attribute) == 0) @@ -294,46 +278,41 @@ static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die * die, * @param die the DIE * @return DW_AT_type reference as a global offset in hexadecimal (or nullptr) */ -static -std::uint64_t MC_dwarf_at_type(Dwarf_Die * die) +static std::uint64_t MC_dwarf_at_type(Dwarf_Die* die) { return MC_dwarf_attr_integrate_dieoffset(die, DW_AT_type); } -static uint64_t MC_dwarf_attr_integrate_addr(Dwarf_Die * die, int attribute) +static uint64_t MC_dwarf_attr_integrate_addr(Dwarf_Die* die, int attribute) { Dwarf_Attribute attr; if (dwarf_attr_integrate(die, attribute, &attr) == nullptr) return 0; Dwarf_Addr value; if (dwarf_formaddr(&attr, &value) == 0) - return (uint64_t) value; + return (uint64_t)value; else return 0; } -static uint64_t MC_dwarf_attr_integrate_uint(Dwarf_Die * die, int attribute, - uint64_t default_value) +static uint64_t MC_dwarf_attr_integrate_uint(Dwarf_Die* die, int attribute, uint64_t default_value) { Dwarf_Attribute attr; if (dwarf_attr_integrate(die, attribute, &attr) == nullptr) return default_value; Dwarf_Word value; - return dwarf_formudata(dwarf_attr_integrate(die, attribute, &attr), - &value) == 0 ? (uint64_t) value : default_value; + return dwarf_formudata(dwarf_attr_integrate(die, attribute, &attr), &value) == 0 ? (uint64_t)value : default_value; } -static bool MC_dwarf_attr_flag(Dwarf_Die * die, int attribute, bool integrate) +static bool MC_dwarf_attr_flag(Dwarf_Die* die, int attribute, bool integrate) { Dwarf_Attribute attr; - if ((integrate ? dwarf_attr_integrate(die, attribute, &attr) - : dwarf_attr(die, attribute, &attr)) == 0) + if ((integrate ? dwarf_attr_integrate(die, attribute, &attr) : dwarf_attr(die, attribute, &attr)) == 0) return false; bool result; if (dwarf_formflag(&attr, &result)) - xbt_die("Unexpected form for attribute %s", - simgrid::dwarf::attrname(attribute)); + xbt_die("Unexpected form for attribute %s", simgrid::dwarf::attrname(attribute)); return result; } @@ -348,32 +327,31 @@ static bool MC_dwarf_attr_flag(Dwarf_Die * die, int attribute, bool integrate) static uint64_t MC_dwarf_default_lower_bound(int lang) { switch (lang) { - case DW_LANG_C: - case DW_LANG_C89: - case DW_LANG_C99: - case DW_LANG_C_plus_plus: - case DW_LANG_D: - case DW_LANG_Java: - case DW_LANG_ObjC: - case DW_LANG_ObjC_plus_plus: - case DW_LANG_Python: - case DW_LANG_UPC: - return 0; - case DW_LANG_Ada83: - case DW_LANG_Ada95: - case DW_LANG_Fortran77: - case DW_LANG_Fortran90: - case DW_LANG_Fortran95: - case DW_LANG_Modula2: - case DW_LANG_Pascal83: - case DW_LANG_PL1: - case DW_LANG_Cobol74: - case DW_LANG_Cobol85: - return 1; - default: - xbt_die("No default DW_TAG_lower_bound for language %i and none given", - lang); - return 0; + case DW_LANG_C: + case DW_LANG_C89: + case DW_LANG_C99: + case DW_LANG_C_plus_plus: + case DW_LANG_D: + case DW_LANG_Java: + case DW_LANG_ObjC: + case DW_LANG_ObjC_plus_plus: + case DW_LANG_Python: + case DW_LANG_UPC: + return 0; + case DW_LANG_Ada83: + case DW_LANG_Ada95: + case DW_LANG_Fortran77: + case DW_LANG_Fortran90: + case DW_LANG_Fortran95: + case DW_LANG_Modula2: + case DW_LANG_Pascal83: + case DW_LANG_PL1: + case DW_LANG_Cobol74: + case DW_LANG_Cobol85: + return 1; + default: + xbt_die("No default DW_TAG_lower_bound for language %i and none given", lang); + return 0; } } @@ -383,13 +361,10 @@ static uint64_t MC_dwarf_default_lower_bound(int lang) * @param unit DIE of the compilation unit * @return number of elements in the range * */ -static uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die, - Dwarf_Die * unit) +static uint64_t MC_dwarf_subrange_element_count(Dwarf_Die* die, Dwarf_Die* unit) { - xbt_assert(dwarf_tag(die) == DW_TAG_enumeration_type - || dwarf_tag(die) == DW_TAG_subrange_type, - "MC_dwarf_subrange_element_count called with DIE of type %s", - simgrid::dwarf::tagname(die)); + xbt_assert(dwarf_tag(die) == DW_TAG_enumeration_type || dwarf_tag(die) == DW_TAG_subrange_type, + "MC_dwarf_subrange_element_count called with DIE of type %s", simgrid::dwarf::tagname(die)); // Use DW_TAG_count if present: if (dwarf_hasattr_integrate(die, DW_AT_count)) @@ -419,20 +394,17 @@ static uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die, * @param unit the DIE of the compilation unit * @return number of elements in this array type * */ -static uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit) +static uint64_t MC_dwarf_array_element_count(Dwarf_Die* die, Dwarf_Die* unit) { - xbt_assert(dwarf_tag(die) == DW_TAG_array_type, - "MC_dwarf_array_element_count called with DIE of type %s", + xbt_assert(dwarf_tag(die) == DW_TAG_array_type, "MC_dwarf_array_element_count called with DIE of type %s", simgrid::dwarf::tagname(die)); int result = 1; Dwarf_Die child; int res; - for (res = dwarf_child(die, &child); res == 0; - res = dwarf_siblingof(&child, &child)) { + for (res = dwarf_child(die, &child); res == 0; res = dwarf_siblingof(&child, &child)) { int child_tag = dwarf_tag(&child); - if (child_tag == DW_TAG_subrange_type - || child_tag == DW_TAG_enumeration_type) + if (child_tag == DW_TAG_subrange_type || child_tag == DW_TAG_enumeration_type) result *= MC_dwarf_subrange_element_count(&child, unit); } return result; @@ -444,8 +416,7 @@ static uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit) * * We could use boost::container::flat_set instead. */ -static bool MC_compare_variable( - simgrid::mc::Variable const& a, simgrid::mc::Variable const& b) +static bool MC_compare_variable(simgrid::mc::Variable const& a, simgrid::mc::Variable const& b) { int cmp = a.name.compare(b.name); if (cmp < 0) @@ -465,8 +436,7 @@ static bool MC_compare_variable( * @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(simgrid::mc::Type* type, simgrid::mc::Member* member, Dwarf_Die* child) { if (dwarf_hasattr(child, DW_AT_data_bit_offset)) xbt_die("Can't groke DW_AT_data_bit_offset."); @@ -474,50 +444,45 @@ static void MC_dwarf_fill_member_location( if (not dwarf_hasattr_integrate(child, DW_AT_data_member_location)) { if (type->type == DW_TAG_union_type) return; - xbt_die - ("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%" - PRIx64 ">%s", member->name.c_str(), - (uint64_t) type->id, type->name.c_str()); + xbt_die("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%" PRIx64 ">%s", + member->name.c_str(), (uint64_t)type->id, type->name.c_str()); } Dwarf_Attribute attr; dwarf_attr_integrate(child, DW_AT_data_member_location, &attr); - int form = dwarf_whatform(&attr); + int form = dwarf_whatform(&attr); simgrid::dwarf::FormClass form_class = simgrid::dwarf::classify_form(form); switch (form_class) { - case simgrid::dwarf::FormClass::ExprLoc: - case simgrid::dwarf::FormClass::Block: - // Location expression: - { - Dwarf_Op *expr; - size_t len; - if (dwarf_getlocation(&attr, &expr, &len)) - xbt_die - ("Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%" - PRIx64 ">%s", MC_dwarf_attr_integrate_string(child, DW_AT_name), - (uint64_t) type->id, type->name.c_str()); - member->location_expression = simgrid::dwarf::DwarfExpression(expr, expr+len); - break; - } - case simgrid::dwarf::FormClass::Constant: - // Offset from the base address of the object: - { - Dwarf_Word offset; - if (not dwarf_formudata(&attr, &offset)) - member->offset(offset); - else - xbt_die("Cannot get %s location <%" PRIx64 ">%s", - MC_dwarf_attr_integrate_string(child, DW_AT_name), - (uint64_t) type->id, type->name.c_str()); - break; - } + case simgrid::dwarf::FormClass::ExprLoc: + case simgrid::dwarf::FormClass::Block: + // Location expression: + { + Dwarf_Op* expr; + size_t len; + if (dwarf_getlocation(&attr, &expr, &len)) + xbt_die("Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%" PRIx64 + ">%s", + MC_dwarf_attr_integrate_string(child, DW_AT_name), (uint64_t)type->id, type->name.c_str()); + member->location_expression = simgrid::dwarf::DwarfExpression(expr, expr + len); + break; + } + case simgrid::dwarf::FormClass::Constant: + // Offset from the base address of the object: + { + Dwarf_Word offset; + if (not dwarf_formudata(&attr, &offset)) + member->offset(offset); + else + xbt_die("Cannot get %s location <%" PRIx64 ">%s", MC_dwarf_attr_integrate_string(child, DW_AT_name), + (uint64_t)type->id, type->name.c_str()); + break; + } - default: - // includes FormClass::LocListPtr (reference to a location list: TODO) and FormClass::Reference (it's supposed to be - // possible in DWARF2 but I couldn't find its semantic in the spec) - xbt_die("Can't handle form class (%d) / form 0x%x as DW_AT_member_location", (int)form_class, (unsigned)form); + default: + // includes FormClass::LocListPtr (reference to a location list: TODO) and FormClass::Reference (it's supposed to + // be possible in DWARF2 but I couldn't find its semantic in the spec) + xbt_die("Can't handle form class (%d) / form 0x%x as DW_AT_member_location", (int)form_class, (unsigned)form); } - } /** @brief Populate the list of members of a type @@ -533,8 +498,7 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf int res; Dwarf_Die child; xbt_assert(type->members.empty()); - for (res = dwarf_child(die, &child); res == 0; - res = dwarf_siblingof(&child, &child)) { + for (res = dwarf_child(die, &child); res == 0; res = dwarf_siblingof(&child, &child)) { int tag = dwarf_tag(&child); if (tag == DW_TAG_member || tag == DW_TAG_inheritance) { @@ -551,13 +515,13 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf if (tag == DW_TAG_inheritance) member.flags |= simgrid::mc::Member::INHERITANCE_FLAG; - const char *name = MC_dwarf_attr_integrate_string(&child, DW_AT_name); + const char* name = MC_dwarf_attr_integrate_string(&child, DW_AT_name); if (name) member.name = name; // Those base names are used by GCC and clang for virtual table pointers // respectively ("__vptr$ClassName", "__vptr.ClassName"): if (boost::algorithm::starts_with(member.name, "__vptr$") || - boost::algorithm::starts_with(member.name, "__vptr.")) + boost::algorithm::starts_with(member.name, "__vptr.")) member.flags |= simgrid::mc::Member::VIRTUAL_POINTER_FLAG; // A cleaner solution would be to check against the type: // --- @@ -577,9 +541,8 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf // name: "int" // --- - member.byte_size = - MC_dwarf_attr_integrate_uint(&child, DW_AT_byte_size, 0); - member.type_id = MC_dwarf_at_type(&child); + member.byte_size = MC_dwarf_attr_integrate_uint(&child, DW_AT_byte_size, 0); + member.type_id = MC_dwarf_at_type(&child); if (dwarf_hasattr(&child, DW_AT_data_bit_offset)) xbt_die("Can't groke DW_AT_data_bit_offset."); @@ -587,9 +550,8 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf MC_dwarf_fill_member_location(type, &member, &child); if (not member.type_id) - xbt_die("Missing type for member %s of <%" PRIx64 ">%s", - member.name.c_str(), - (uint64_t) type->id, type->name.c_str()); + xbt_die("Missing type for member %s of <%" PRIx64 ">%s", member.name.c_str(), (uint64_t)type->id, + type->name.c_str()); type->members.push_back(std::move(member)); } @@ -603,35 +565,33 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf * @param unit compilation unit of the current DIE * @return MC representation of the type */ -static simgrid::mc::Type MC_dwarf_die_to_type( - simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns) +static simgrid::mc::Type MC_dwarf_die_to_type(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns) { simgrid::mc::Type type; - type.type = dwarf_tag(die); - type.name = std::string(); + type.type = dwarf_tag(die); + type.name = std::string(); 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 "; - break; - case DW_TAG_union_type: - prefix = "union "; - break; - case DW_TAG_class_type: - prefix = "class "; - break; - default: - prefix = ""; + case DW_TAG_structure_type: + prefix = "struct "; + break; + case DW_TAG_union_type: + prefix = "union "; + break; + case DW_TAG_class_type: + prefix = "class "; + break; + default: + prefix = ""; } - const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name); + const char* name = MC_dwarf_attr_integrate_string(die, DW_AT_name); if (name != nullptr) { if (ns) type.name = simgrid::xbt::string_printf("%s%s::%s", prefix, ns, name); @@ -650,47 +610,44 @@ static simgrid::mc::Type MC_dwarf_die_to_type( // Computation of the byte_size if (dwarf_hasattr_integrate(die, DW_AT_byte_size)) type.byte_size = MC_dwarf_attr_integrate_uint(die, DW_AT_byte_size, 0); - else if (type.type == DW_TAG_array_type - || type.type == DW_TAG_structure_type - || type.type == DW_TAG_class_type) { + else if (type.type == DW_TAG_array_type || type.type == DW_TAG_structure_type || type.type == DW_TAG_class_type) { Dwarf_Word size; if (dwarf_aggregate_size(die, &size) == 0) type.byte_size = size; } switch (type.type) { - case DW_TAG_array_type: - type.element_count = MC_dwarf_array_element_count(die, unit); - // TODO, handle DW_byte_stride and (not) DW_bit_stride - break; - - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_rvalue_reference_type: - break; - - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_class_type: - MC_dwarf_add_members(info, die, unit, &type); - MC_dwarf_handle_children(info, die, unit, frame, - ns ? simgrid::xbt::string_printf("%s::%s", ns, name).c_str() : type.name.c_str()); - break; - - default: - XBT_DEBUG("Unhandled type: %d (%s)", type.type, simgrid::dwarf::tagname(type.type)); - break; + case DW_TAG_array_type: + type.element_count = MC_dwarf_array_element_count(die, unit); + // TODO, handle DW_byte_stride and (not) DW_bit_stride + break; + + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_rvalue_reference_type: + break; + + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_class_type: + MC_dwarf_add_members(info, die, unit, &type); + MC_dwarf_handle_children(info, die, unit, frame, + ns ? simgrid::xbt::string_printf("%s::%s", ns, name).c_str() : type.name.c_str()); + break; + + default: + XBT_DEBUG("Unhandled type: %d (%s)", type.type, simgrid::dwarf::tagname(type.type)); + break; } return type; } -static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns) +static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns) { simgrid::mc::Type type = MC_dwarf_die_to_type(info, die, unit, frame, ns); - auto& t = (info->types[type.id] = std::move(type)); + auto& t = (info->types[type.id] = std::move(type)); if (not t.name.empty() && type.byte_size != 0) info->full_types_by_name[t.name] = &t; } @@ -714,13 +671,12 @@ static std::unique_ptr MC_die_to_variable(simgrid::mc::Ob // No location: do not add it ? return nullptr; - std::unique_ptr variable = - std::unique_ptr(new simgrid::mc::Variable()); - variable->id = dwarf_dieoffset(die); - variable->global = frame == nullptr; // Can be override base on DW_AT_location - variable->object_info = info; + std::unique_ptr variable = std::unique_ptr(new simgrid::mc::Variable()); + variable->id = dwarf_dieoffset(die); + variable->global = frame == nullptr; // Can be override base on DW_AT_location + variable->object_info = info; - const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name); + const char* name = MC_dwarf_attr_integrate_string(die, DW_AT_name); if (name) variable->name = name; variable->type_id = MC_dwarf_at_type(die); @@ -732,42 +688,39 @@ static std::unique_ptr MC_die_to_variable(simgrid::mc::Ob else form_class = simgrid::dwarf::classify_form(form); switch (form_class) { - case simgrid::dwarf::FormClass::ExprLoc: - case simgrid::dwarf::FormClass::Block: - // Location expression: - { - Dwarf_Op *expr; - size_t len; - if (dwarf_getlocation(&attr_location, &expr, &len)) { - xbt_die( - "Could not read location expression in DW_AT_location " - "of variable <%" PRIx64 ">%s", - (uint64_t) variable->id, - variable->name.c_str()); - } + case simgrid::dwarf::FormClass::ExprLoc: + case simgrid::dwarf::FormClass::Block: + // Location expression: + { + Dwarf_Op* expr; + size_t len; + if (dwarf_getlocation(&attr_location, &expr, &len)) { + xbt_die("Could not read location expression in DW_AT_location " + "of variable <%" PRIx64 ">%s", + (uint64_t)variable->id, variable->name.c_str()); + } - if (len == 1 && expr[0].atom == DW_OP_addr) { - variable->global = true; - uintptr_t offset = (uintptr_t) expr[0].number; - uintptr_t base = (uintptr_t) info->base_address(); - variable->address = (void *) (base + offset); - } else - variable->location_list = { - simgrid::dwarf::LocationListEntry(simgrid::dwarf::DwarfExpression(expr, expr + len))}; + if (len == 1 && expr[0].atom == DW_OP_addr) { + variable->global = true; + uintptr_t offset = (uintptr_t)expr[0].number; + uintptr_t base = (uintptr_t)info->base_address(); + variable->address = (void*)(base + offset); + } else + variable->location_list = { + simgrid::dwarf::LocationListEntry(simgrid::dwarf::DwarfExpression(expr, expr + len))}; - break; - } + break; + } - case simgrid::dwarf::FormClass::LocListPtr: - case simgrid::dwarf::FormClass::Constant: - // Reference to location list: - variable->location_list = simgrid::dwarf::location_list( - *info, attr_location); - break; + case simgrid::dwarf::FormClass::LocListPtr: + case simgrid::dwarf::FormClass::Constant: + // Reference to location list: + variable->location_list = simgrid::dwarf::location_list(*info, attr_location); + break; - default: - xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location in <%" PRIx64 ">%s", (unsigned)form, form, - (unsigned)form_class, (int)form_class, (uint64_t)variable->id, variable->name.c_str()); + default: + xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location in <%" PRIx64 ">%s", (unsigned)form, form, + (unsigned)form_class, (int)form_class, (uint64_t)variable->id, variable->name.c_str()); } // Handle start_scope: @@ -787,8 +740,7 @@ static std::unique_ptr MC_die_to_variable(simgrid::mc::Ob } if (ns && variable->global) - variable->name = - std::string(ns) + "::" + variable->name; + variable->name = std::string(ns) + "::" + variable->name; // The current code needs a variable name, // generate a fake one: @@ -799,12 +751,10 @@ 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, simgrid::mc::Frame* frame, - const char *ns) +static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns) { - std::unique_ptr variable = - MC_die_to_variable(info, die, unit, frame, ns); + std::unique_ptr variable = MC_die_to_variable(info, die, unit, frame, ns); if (not variable) return; // Those arrays are sorted later: @@ -816,46 +766,43 @@ static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, D xbt_die("No frame for this local variable"); } -static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* parent_frame, - const char *ns) +static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* parent_frame, const char* ns) { // TODO, handle DW_TAG_type/DW_TAG_location for DW_TAG_with_stmt - int tag = dwarf_tag(die); + int tag = dwarf_tag(die); simgrid::dwarf::TagClass klass = simgrid::dwarf::classify_tag(tag); // (Template) Subprogram declaration: - if (klass == simgrid::dwarf::TagClass::Subprogram - && MC_dwarf_attr_flag(die, DW_AT_declaration, false)) + if (klass == simgrid::dwarf::TagClass::Subprogram && MC_dwarf_attr_flag(die, DW_AT_declaration, false)) return; if (klass == simgrid::dwarf::TagClass::Scope) xbt_assert(parent_frame, "No parent scope for this scope"); simgrid::mc::Frame frame; - frame.tag = tag; - frame.id = dwarf_dieoffset(die); + frame.tag = tag; + frame.id = dwarf_dieoffset(die); frame.object_info = info; if (klass == simgrid::dwarf::TagClass::Subprogram) { - const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name); + const char* name = MC_dwarf_attr_integrate_string(die, DW_AT_name); if (name && ns) - frame.name = std::string(ns) + "::" + name; + frame.name = std::string(ns) + "::" + name; else if (name) frame.name = name; } - frame.abstract_origin_id = - MC_dwarf_attr_dieoffset(die, DW_AT_abstract_origin); + frame.abstract_origin_id = MC_dwarf_attr_dieoffset(die, DW_AT_abstract_origin); // This is the base address for DWARF addresses. // Relocated addresses are offset from this base address. // See DWARF4 spec 7.5 - std::uint64_t base = (std::uint64_t) info->base_address(); + std::uint64_t base = (std::uint64_t)info->base_address(); // TODO, support DW_AT_ranges - uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc); - frame.range.begin() = low_pc ? (std::uint64_t) base + low_pc : 0; + uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc); + frame.range.begin() = low_pc ? (std::uint64_t)base + low_pc : 0; if (low_pc) { // DW_AT_high_pc: Dwarf_Attribute attr; @@ -867,32 +814,30 @@ static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwar switch (simgrid::dwarf::classify_form(dwarf_whatform(&attr))) { - // DW_AT_high_pc if an offset from the low_pc: - case simgrid::dwarf::FormClass::Constant: - - if (dwarf_formsdata(&attr, &offset) != 0) - xbt_die("Could not read constant"); - frame.range.end() = frame.range.begin() + offset; - break; + // DW_AT_high_pc if an offset from the low_pc: + case simgrid::dwarf::FormClass::Constant: - // DW_AT_high_pc is a relocatable address: - case simgrid::dwarf::FormClass::Address: - if (dwarf_formaddr(&attr, &high_pc) != 0) - xbt_die("Could not read address"); - frame.range.end() = base + high_pc; - break; + if (dwarf_formsdata(&attr, &offset) != 0) + xbt_die("Could not read constant"); + frame.range.end() = frame.range.begin() + offset; + break; - default: - xbt_die("Unexpected class for DW_AT_high_pc"); + // DW_AT_high_pc is a relocatable address: + case simgrid::dwarf::FormClass::Address: + if (dwarf_formaddr(&attr, &high_pc) != 0) + xbt_die("Could not read address"); + frame.range.end() = base + high_pc; + break; + default: + xbt_die("Unexpected class for DW_AT_high_pc"); } } if (klass == simgrid::dwarf::TagClass::Subprogram) { Dwarf_Attribute attr_frame_base; if (dwarf_attr_integrate(die, DW_AT_frame_base, &attr_frame_base)) - frame.frame_base_location = simgrid::dwarf::location_list(*info, - attr_frame_base); + frame.frame_base_location = simgrid::dwarf::location_list(*info, attr_frame_base); } // Handle children: @@ -909,68 +854,60 @@ static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwar parent_frame->scopes.push_back(std::move(frame)); } -static void mc_dwarf_handle_namespace_die(simgrid::mc::ObjectInformation* info, - Dwarf_Die * die, Dwarf_Die * unit, - simgrid::mc::Frame* frame, - const char *ns) +static void mc_dwarf_handle_namespace_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns) { - const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name); + const char* name = MC_dwarf_attr_integrate_string(die, DW_AT_name); if (frame) xbt_die("Unexpected namespace in a subprogram"); - char *new_ns = ns == nullptr ? xbt_strdup(name) - : bprintf("%s::%s", ns, name); + char* new_ns = ns == nullptr ? xbt_strdup(name) : bprintf("%s::%s", ns, name); MC_dwarf_handle_children(info, die, unit, frame, new_ns); xbt_free(new_ns); } -static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns) +static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns) { // For each child DIE: Dwarf_Die child; int res; - for (res = dwarf_child(die, &child); res == 0; - res = dwarf_siblingof(&child, &child)) + for (res = dwarf_child(die, &child); res == 0; res = dwarf_siblingof(&child, &child)) MC_dwarf_handle_die(info, &child, unit, frame, ns); } -static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die, - Dwarf_Die * unit, simgrid::mc::Frame* frame, - const char *ns) +static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit, + simgrid::mc::Frame* frame, const char* ns) { - int tag = dwarf_tag(die); + int tag = dwarf_tag(die); simgrid::dwarf::TagClass klass = simgrid::dwarf::classify_tag(tag); switch (klass) { - // Type: - case simgrid::dwarf::TagClass::Type: - MC_dwarf_handle_type_die(info, die, unit, frame, ns); - break; - - // Subprogram or scope: - case simgrid::dwarf::TagClass::Subprogram: - case simgrid::dwarf::TagClass::Scope: - MC_dwarf_handle_scope_die(info, die, unit, frame, ns); - return; + // Type: + case simgrid::dwarf::TagClass::Type: + MC_dwarf_handle_type_die(info, die, unit, frame, ns); + break; - // Variable: - case simgrid::dwarf::TagClass::Variable: - MC_dwarf_handle_variable_die(info, die, unit, frame, ns); - break; + // Subprogram or scope: + case simgrid::dwarf::TagClass::Subprogram: + case simgrid::dwarf::TagClass::Scope: + MC_dwarf_handle_scope_die(info, die, unit, frame, ns); + return; - case simgrid::dwarf::TagClass::Namespace: - mc_dwarf_handle_namespace_die(info, die, unit, frame, ns); - break; + // Variable: + case simgrid::dwarf::TagClass::Variable: + MC_dwarf_handle_variable_die(info, die, unit, frame, ns); + break; - default: - break; + case simgrid::dwarf::TagClass::Namespace: + mc_dwarf_handle_namespace_die(info, die, unit, frame, ns); + break; + default: + break; } } -static -Elf64_Half get_type(Elf* elf) +static Elf64_Half get_type(Elf* elf) { Elf64_Ehdr* ehdr64 = elf64_getehdr(elf); if (ehdr64) @@ -981,16 +918,14 @@ Elf64_Half get_type(Elf* elf) xbt_die("Could not get ELF heeader"); } -static -void read_dwarf_info(simgrid::mc::ObjectInformation* info, Dwarf* dwarf) +static void read_dwarf_info(simgrid::mc::ObjectInformation* info, Dwarf* dwarf) { // For each compilation unit: - Dwarf_Off offset = 0; + Dwarf_Off offset = 0; Dwarf_Off next_offset = 0; size_t length; - while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, nullptr, nullptr) == - 0) { + 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) MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, nullptr); @@ -1006,21 +941,20 @@ void read_dwarf_info(simgrid::mc::ObjectInformation* info, Dwarf* dwarf) * @param elf libelf handle for an ELF file * @return build-id for this ELF file (or an empty vector if none is found) */ -static -std::vector get_build_id(Elf* elf) +static std::vector get_build_id(Elf* elf) { #ifdef __linux // Summary: the GNU build ID is stored in a ("GNU, NT_GNU_BUILD_ID) note // found in a PT_NOTE entry in the program header table. size_t phnum; - if (elf_getphdrnum (elf, &phnum) != 0) + if (elf_getphdrnum(elf, &phnum) != 0) xbt_die("Could not read program headers"); // 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); + GElf_Phdr* phdr = gelf_getphdr(elf, i, &phdr_temp); if (phdr->p_type != PT_NOTE) continue; @@ -1036,41 +970,34 @@ std::vector get_build_id(Elf* elf) pos = gelf_getnote(data, pos, &nhdr, &name_pos, &desc_pos); // A build ID note is identified by the pair ("GNU", NT_GNU_BUILD_ID) // (a namespace and a type within this namespace): - if (nhdr.n_type == NT_GNU_BUILD_ID - && nhdr.n_namesz == sizeof("GNU") - && memcmp((char*) data->d_buf + name_pos, "GNU", sizeof("GNU")) == 0) { + if (nhdr.n_type == NT_GNU_BUILD_ID && nhdr.n_namesz == sizeof("GNU") && + memcmp((char*)data->d_buf + name_pos, "GNU", sizeof("GNU")) == 0) { XBT_DEBUG("Found GNU/NT_GNU_BUILD_ID note"); - char* start = (char*) data->d_buf + desc_pos; - char* end = (char*) start + nhdr.n_descsz; + char* start = (char*)data->d_buf + desc_pos; + char* end = (char*)start + nhdr.n_descsz; return std::vector(start, end); } } - } #endif return std::vector(); } -static char hexdigits[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f' -}; +static char hexdigits[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** Binary data to hexadecimal */ -static inline -std::array to_hex(std::uint8_t byte) +static inline std::array to_hex(std::uint8_t byte) { // Horrid double braces! // Apparently, this is needed in C++11 (not in C++14). - return { { hexdigits[byte >> 4], hexdigits[byte & 0xF] } }; + return {{hexdigits[byte >> 4], hexdigits[byte & 0xF]}}; } /** Binary data to hexadecimal */ -static -std::string to_hex(const char* data, std::size_t count) +static std::string to_hex(const char* data, std::size_t count) { std::string res; - res.resize(2*count); + res.resize(2 * count); for (std::size_t i = 0; i < count; i++) { std::array hex_byte = to_hex(data[i]); for (int j = 0; j < 2; ++j) @@ -1080,17 +1007,15 @@ std::string to_hex(const char* data, std::size_t count) } /** Binary data to hexadecimal */ -static -std::string to_hex(std::vector const& data) +static std::string to_hex(std::vector const& data) { return to_hex(data.data(), data.size()); } /** Base directories for external debug files */ -static -const char* debug_paths[] = { - "/usr/lib/debug/", - "/usr/local/lib/debug/", +static const char* debug_paths[] = { + "/usr/lib/debug/", + "/usr/local/lib/debug/", }; /** Locate an external debug file from the NT_GNU_BUILD_ID @@ -1100,16 +1025,14 @@ const char* debug_paths[] = { */ // Example: // /usr/lib/debug/.build-id/0b/dc77f1c29aea2b14ff5acd9a19ab3175ffdeae.debug -static -std::string find_by_build_id(std::vector id) +static std::string find_by_build_id(std::vector id) { std::string filename; std::string hex = to_hex(id); for (const char* const& debug_path : debug_paths) { // Example: - filename = std::string(debug_path) + ".build-id/" - + to_hex(id.data(), 1) + '/' - + to_hex(id.data() + 1, id.size() - 1) + ".debug"; + 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()); if (access(filename.c_str(), F_OK) == 0) { XBT_DEBUG("Found debug file: %s\n", hex.c_str()); @@ -1125,8 +1048,7 @@ std::string find_by_build_id(std::vector id) * Read the DWARf information of the EFFL object and populate the * lists of types, variables, functions. */ -static -void MC_load_dwarf(simgrid::mc::ObjectInformation* info) +static void MC_load_dwarf(simgrid::mc::ObjectInformation* info) { if (elf_version(EV_CURRENT) == EV_NONE) xbt_die("libelf initialization error"); @@ -1148,7 +1070,7 @@ void MC_load_dwarf(simgrid::mc::ObjectInformation* info) info->flags |= simgrid::mc::ObjectInformation::Executable; // Read DWARF debug information in the file: - Dwarf* dwarf = dwarf_begin_elf (elf, DWARF_C_READ, nullptr); + Dwarf* dwarf = dwarf_begin_elf(elf, DWARF_C_READ, nullptr); if (dwarf != nullptr) { read_dwarf_info(info, dwarf); dwarf_end(dwarf); @@ -1177,20 +1099,18 @@ void MC_load_dwarf(simgrid::mc::ObjectInformation* info) if (debug_file.empty()) { std::string hex = to_hex(build_id); xbt_die("Missing debug info for %s with build-id %s\n" - "You might want to install the suitable debugging package.\n", - info->file_name.c_str(), hex.c_str()); + "You might want to install the suitable debugging package.\n", + info->file_name.c_str(), hex.c_str()); } // Load the DWARF info from this file: - XBT_DEBUG("Load DWARF for %s from %s", - info->file_name.c_str(), debug_file.c_str()); + XBT_DEBUG("Load DWARF for %s from %s", info->file_name.c_str(), debug_file.c_str()); fd = open(debug_file.c_str(), O_RDONLY); if (fd < 0) xbt_die("Could not open file %s", debug_file.c_str()); dwarf = dwarf_begin(fd, DWARF_C_READ); if (dwarf == nullptr) - xbt_die("No DWARF info in %s for %s", - debug_file.c_str(), info->file_name.c_str()); + xbt_die("No DWARF info in %s for %s", debug_file.c_str(), info->file_name.c_str()); read_dwarf_info(info, dwarf); dwarf_end(dwarf); close(fd); @@ -1216,7 +1136,7 @@ static void MC_make_functions_index(simgrid::mc::ObjectInformation* info) if (e.second.range.begin() == 0) continue; simgrid::mc::FunctionIndexEntry entry; - entry.low_pc = (void*) e.second.range.begin(); + entry.low_pc = (void*)e.second.range.begin(); entry.function = &e.second; info->functions_index.push_back(entry); } @@ -1225,11 +1145,9 @@ static void MC_make_functions_index(simgrid::mc::ObjectInformation* info) // Sort the array by low_pc: boost::range::sort(info->functions_index, - [](simgrid::mc::FunctionIndexEntry const& a, - simgrid::mc::FunctionIndexEntry const& b) - { - return a.low_pc < b.low_pc; - }); + [](simgrid::mc::FunctionIndexEntry const& a, simgrid::mc::FunctionIndexEntry const& b) { + return a.low_pc < b.low_pc; + }); } static void MC_post_process_variables(simgrid::mc::ObjectInformation* info) @@ -1239,8 +1157,7 @@ static void MC_post_process_variables(simgrid::mc::ObjectInformation* info) for (simgrid::mc::Variable& variable : info->global_variables) if (variable.type_id) - variable.type = simgrid::util::find_map_ptr( - info->types, variable.type_id); + variable.type = simgrid::util::find_map_ptr(info->types, variable.type_id); } static void mc_post_process_scope(simgrid::mc::ObjectInformation* info, simgrid::mc::Frame* scope) @@ -1249,26 +1166,22 @@ static void mc_post_process_scope(simgrid::mc::ObjectInformation* info, simgrid: if (scope->tag == DW_TAG_inlined_subroutine) { // Attach correct namespaced name in inlined subroutine: auto i = info->subprograms.find(scope->abstract_origin_id); - xbt_assert(i != info->subprograms.end(), - "Could not lookup abstract origin %" PRIx64, - (std::uint64_t) scope->abstract_origin_id); + xbt_assert(i != info->subprograms.end(), "Could not lookup abstract origin %" PRIx64, + (std::uint64_t)scope->abstract_origin_id); scope->name = i->second.name; } // Direct: for (simgrid::mc::Variable& variable : scope->variables) if (variable.type_id) - variable.type = simgrid::util::find_map_ptr( - info->types, variable.type_id); + variable.type = simgrid::util::find_map_ptr(info->types, variable.type_id); // Recursive post-processing of nested-scopes: for (simgrid::mc::Frame& nested_scope : scope->scopes) mc_post_process_scope(info, &nested_scope); } -static -simgrid::mc::Type* MC_resolve_type( - simgrid::mc::ObjectInformation* info, unsigned type_id) +static simgrid::mc::Type* MC_resolve_type(simgrid::mc::ObjectInformation* info, unsigned type_id) { if (not type_id) return nullptr; @@ -1286,8 +1199,7 @@ simgrid::mc::Type* MC_resolve_type( // Try to find a more complete description of the type: // We need to fix in order to support C++. - simgrid::mc::Type** subtype = simgrid::util::find_map_ptr( - info->full_types_by_name, type->name); + simgrid::mc::Type** subtype = simgrid::util::find_map_ptr(info->full_types_by_name, type->name); if (subtype) type = *subtype; return type; @@ -1307,12 +1219,11 @@ 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()); @@ -1331,9 +1242,8 @@ void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::m simgrid::mc::Type* type = &(t.second); simgrid::mc::Type* subtype = type; - while (subtype->type == DW_TAG_typedef - || subtype->type == DW_TAG_volatile_type - || subtype->type == DW_TAG_const_type) + while (subtype->type == DW_TAG_typedef || subtype->type == DW_TAG_volatile_type || + subtype->type == DW_TAG_const_type) if (subtype->subtype) subtype = subtype->subtype; else @@ -1348,13 +1258,13 @@ void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::m break; } } - else type->full_type = subtype; - + else + type->full_type = subtype; } } -} -} +} // namespace mc +} // namespace simgrid namespace simgrid { namespace dwarf { @@ -1374,61 +1284,61 @@ int dwarf_register_to_libunwind(int dwarf_register) // Couldn't find the authoritative source of information for this. // This is inspired from http://source.winehq.org/source/dlls/dbghelp/cpu_i386.c#L517. switch (dwarf_register) { - case 0: - return UNW_X86_EAX; - case 1: - return UNW_X86_ECX; - case 2: - return UNW_X86_EDX; - case 3: - return UNW_X86_EBX; - case 4: - return UNW_X86_ESP; - case 5: - return UNW_X86_EBP; - case 6: - return UNW_X86_ESI; - case 7: - return UNW_X86_EDI; - case 8: - return UNW_X86_EIP; - case 9: - return UNW_X86_EFLAGS; - case 10: - return UNW_X86_CS; - case 11: - return UNW_X86_SS; - case 12: - return UNW_X86_DS; - case 13: - return UNW_X86_ES; - case 14: - return UNW_X86_FS; - case 15: - return UNW_X86_GS; - case 16: - return UNW_X86_ST0; - case 17: - return UNW_X86_ST1; - case 18: - return UNW_X86_ST2; - case 19: - return UNW_X86_ST3; - case 20: - return UNW_X86_ST4; - case 21: - return UNW_X86_ST5; - case 22: - return UNW_X86_ST6; - case 23: - return UNW_X86_ST7; - default: - xbt_die("Bad/unknown register number."); + case 0: + return UNW_X86_EAX; + case 1: + return UNW_X86_ECX; + case 2: + return UNW_X86_EDX; + case 3: + return UNW_X86_EBX; + case 4: + return UNW_X86_ESP; + case 5: + return UNW_X86_EBP; + case 6: + return UNW_X86_ESI; + case 7: + return UNW_X86_EDI; + case 8: + return UNW_X86_EIP; + case 9: + return UNW_X86_EFLAGS; + case 10: + return UNW_X86_CS; + case 11: + return UNW_X86_SS; + case 12: + return UNW_X86_DS; + case 13: + return UNW_X86_ES; + case 14: + return UNW_X86_FS; + case 15: + return UNW_X86_GS; + case 16: + return UNW_X86_ST0; + case 17: + return UNW_X86_ST1; + case 18: + return UNW_X86_ST2; + case 19: + return UNW_X86_ST3; + case 20: + return UNW_X86_ST4; + case 21: + return UNW_X86_ST5; + case 22: + return UNW_X86_ST6; + case 23: + return UNW_X86_ST7; + default: + xbt_die("Bad/unknown register number."); } #else #error This architecture is not supported yet for DWARF expression evaluation. #endif } -} -} +} // namespace dwarf +} // namespace simgrid diff --git a/src/mc/mc_dwarf.hpp b/src/mc/inspect/mc_dwarf.hpp similarity index 64% rename from src/mc/mc_dwarf.hpp rename to src/mc/inspect/mc_dwarf.hpp index aef260c704..a533f00c0a 100644 --- a/src/mc/mc_dwarf.hpp +++ b/src/mc/inspect/mc_dwarf.hpp @@ -8,7 +8,7 @@ #include "xbt/base.h" -#define DW_LANG_Objc DW_LANG_ObjC /* fix spelling error in older dwarf.h */ +#define DW_LANG_Objc DW_LANG_ObjC /* fix spelling error in older dwarf.h */ #include #include "src/mc/mc_forward.hpp" @@ -19,14 +19,13 @@ namespace dwarf { XBT_PRIVATE const char* attrname(int attr); XBT_PRIVATE const char* tagname(int tag); -XBT_PRIVATE void* resolve_member( - const void* base, simgrid::mc::Type* type, simgrid::mc::Member* member, - simgrid::mc::AddressSpace* snapshot, int process_index); +XBT_PRIVATE void* resolve_member(const void* base, simgrid::mc::Type* type, simgrid::mc::Member* member, + simgrid::mc::AddressSpace* snapshot, int process_index); XBT_PRIVATE int dwarf_register_to_libunwind(int dwarf_register); -} -} +} // namespace dwarf +} // namespace simgrid #endif diff --git a/src/mc/mc_dwarf_attrnames.cpp b/src/mc/inspect/mc_dwarf_attrnames.cpp similarity index 98% rename from src/mc/mc_dwarf_attrnames.cpp rename to src/mc/inspect/mc_dwarf_attrnames.cpp index 248a127d73..018d9c27fa 100644 --- a/src/mc/mc_dwarf_attrnames.cpp +++ b/src/mc/inspect/mc_dwarf_attrnames.cpp @@ -158,7 +158,7 @@ const std::unordered_map attrname_map = { } namespace simgrid { -namespace dwarf { +namespace dwarf { /** @brief Get the name of an attribute (DW_AT_*) from its code * @@ -166,11 +166,11 @@ namespace dwarf { * @return name of the attribute */ XBT_PRIVATE -const char *attrname(int attr) +const char* attrname(int attr) { auto name = attrname_map.find(attr); return name == attrname_map.end() ? "DW_AT_unknown" : name->second; } -} -} +} // namespace dwarf +} // namespace simgrid diff --git a/src/mc/mc_dwarf_tagnames.cpp b/src/mc/inspect/mc_dwarf_tagnames.cpp similarity index 97% rename from src/mc/mc_dwarf_tagnames.cpp rename to src/mc/inspect/mc_dwarf_tagnames.cpp index f94c2c6dde..4db55c3389 100644 --- a/src/mc/mc_dwarf_tagnames.cpp +++ b/src/mc/inspect/mc_dwarf_tagnames.cpp @@ -100,11 +100,11 @@ namespace dwarf { * @return name of the tag */ XBT_PRIVATE -const char *tagname(int tag) +const char* tagname(int tag) { auto name = tagname_map.find(tag); return name == tagname_map.end() ? "DW_TAG_unknown" : name->second; } -} -} +} // namespace dwarf +} // namespace simgrid diff --git a/src/mc/mc_member.cpp b/src/mc/inspect/mc_member.cpp similarity index 85% rename from src/mc/mc_member.cpp rename to src/mc/inspect/mc_member.cpp index c92ab41a9b..63493620a1 100644 --- a/src/mc/mc_member.cpp +++ b/src/mc/inspect/mc_member.cpp @@ -23,16 +23,16 @@ void* resolve_member(const void* base, simgrid::mc::Type* /*type*/, simgrid::mc: simgrid::mc::AddressSpace* address_space, int process_index) { ExpressionContext state; - state.frame_base = nullptr; - state.cursor = nullptr; + state.frame_base = nullptr; + state.cursor = nullptr; state.address_space = address_space; state.process_index = process_index; ExpressionStack stack; - stack.push((ExpressionStack::value_type) base); + stack.push((ExpressionStack::value_type)base); simgrid::dwarf::execute(member->location_expression, state, stack); - return (void*) stack.top(); + return (void*)stack.top(); } -} -} +} // namespace dwarf +} // namespace simgrid diff --git a/src/mc/mc_unw.cpp b/src/mc/inspect/mc_unw.cpp similarity index 59% rename from src/mc/mc_unw.cpp rename to src/mc/inspect/mc_unw.cpp index b9a4ceab64..da7553997d 100644 --- a/src/mc/mc_unw.cpp +++ b/src/mc/inspect/mc_unw.cpp @@ -40,11 +40,10 @@ namespace mc { int UnwindContext::find_proc_info(unw_addr_space_t /*as*/, unw_word_t ip, unw_proc_info_t* pip, int need_unwind_info, void* arg) noexcept { - simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*) arg; - return unw_get_accessors(context->process_->unw_underlying_addr_space)->find_proc_info( - context->process_->unw_underlying_addr_space, ip, pip, - need_unwind_info, context->process_->unw_underlying_context - ); + simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg; + return unw_get_accessors(context->process_->unw_underlying_addr_space) + ->find_proc_info(context->process_->unw_underlying_addr_space, ip, pip, need_unwind_info, + context->process_->unw_underlying_context); } /** Release frame unwind information (libunwind method) @@ -53,11 +52,9 @@ int UnwindContext::find_proc_info(unw_addr_space_t /*as*/, unw_word_t ip, unw_pr */ void UnwindContext::put_unwind_info(unw_addr_space_t /*as*/, unw_proc_info_t* pip, void* arg) noexcept { - simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*) arg; - return unw_get_accessors(context->process_->unw_underlying_addr_space)->put_unwind_info( - context->process_->unw_underlying_addr_space, pip, - context->process_->unw_underlying_context - ); + simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg; + return unw_get_accessors(context->process_->unw_underlying_addr_space) + ->put_unwind_info(context->process_->unw_underlying_addr_space, pip, context->process_->unw_underlying_context); } /** (libunwind method) @@ -66,12 +63,10 @@ void UnwindContext::put_unwind_info(unw_addr_space_t /*as*/, unw_proc_info_t* pi */ int UnwindContext::get_dyn_info_list_addr(unw_addr_space_t /*as*/, unw_word_t* dilap, void* arg) noexcept { - simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*) arg; - return unw_get_accessors(context->process_->unw_underlying_addr_space)->get_dyn_info_list_addr( - context->process_->unw_underlying_addr_space, - dilap, - context->process_->unw_underlying_context - ); + simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg; + return unw_get_accessors(context->process_->unw_underlying_addr_space) + ->get_dyn_info_list_addr(context->process_->unw_underlying_addr_space, dilap, + context->process_->unw_underlying_context); } /** Read from the target address space memory (libunwind method) @@ -80,9 +75,9 @@ int UnwindContext::get_dyn_info_list_addr(unw_addr_space_t /*as*/, unw_word_t* d */ int UnwindContext::access_mem(unw_addr_space_t /*as*/, unw_word_t addr, unw_word_t* valp, int write, void* arg) noexcept { - simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*) arg; + simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg; if (write) - return - UNW_EREADONLYREG; + return -UNW_EREADONLYREG; context->addressSpace_->read_bytes(valp, sizeof(unw_word_t), remote(addr)); return 0; } @@ -92,46 +87,81 @@ void* UnwindContext::get_reg(unw_context_t* context, unw_regnum_t regnum) noexce #ifdef __x86_64 mcontext_t* mcontext = &context->uc_mcontext; switch (regnum) { -# ifdef __linux__ - case UNW_X86_64_RAX: return &mcontext->gregs[REG_RAX]; - case UNW_X86_64_RDX: return &mcontext->gregs[REG_RDX]; - case UNW_X86_64_RCX: return &mcontext->gregs[REG_RCX]; - case UNW_X86_64_RBX: return &mcontext->gregs[REG_RBX]; - case UNW_X86_64_RSI: return &mcontext->gregs[REG_RSI]; - case UNW_X86_64_RDI: return &mcontext->gregs[REG_RDI]; - case UNW_X86_64_RBP: return &mcontext->gregs[REG_RBP]; - case UNW_X86_64_RSP: return &mcontext->gregs[REG_RSP]; - case UNW_X86_64_R8: return &mcontext->gregs[REG_R8]; - case UNW_X86_64_R9: return &mcontext->gregs[REG_R9]; - case UNW_X86_64_R10: return &mcontext->gregs[REG_R10]; - case UNW_X86_64_R11: return &mcontext->gregs[REG_R11]; - case UNW_X86_64_R12: return &mcontext->gregs[REG_R12]; - case UNW_X86_64_R13: return &mcontext->gregs[REG_R13]; - case UNW_X86_64_R14: return &mcontext->gregs[REG_R14]; - case UNW_X86_64_R15: return &mcontext->gregs[REG_R15]; - case UNW_X86_64_RIP: return &mcontext->gregs[REG_RIP]; -# elif defined __FreeBSD__ - case UNW_X86_64_RAX: return &mcontext->mc_rax; - case UNW_X86_64_RDX: return &mcontext->mc_rdx; - case UNW_X86_64_RCX: return &mcontext->mc_rcx; - case UNW_X86_64_RBX: return &mcontext->mc_rbx; - case UNW_X86_64_RSI: return &mcontext->mc_rsi; - case UNW_X86_64_RDI: return &mcontext->mc_rdi; - case UNW_X86_64_RBP: return &mcontext->mc_rbp; - case UNW_X86_64_RSP: return &mcontext->mc_rsp; - case UNW_X86_64_R8: return &mcontext->mc_r8; - case UNW_X86_64_R9: return &mcontext->mc_r9; - case UNW_X86_64_R10: return &mcontext->mc_r10; - case UNW_X86_64_R11: return &mcontext->mc_r11; - case UNW_X86_64_R12: return &mcontext->mc_r12; - case UNW_X86_64_R13: return &mcontext->mc_r13; - case UNW_X86_64_R14: return &mcontext->mc_r14; - case UNW_X86_64_R15: return &mcontext->mc_r15; - case UNW_X86_64_RIP: return &mcontext->mc_rip; -# else -# error "Unable to get register from ucontext, please add your case" -# endif - default: return nullptr; +#ifdef __linux__ + case UNW_X86_64_RAX: + return &mcontext->gregs[REG_RAX]; + case UNW_X86_64_RDX: + return &mcontext->gregs[REG_RDX]; + case UNW_X86_64_RCX: + return &mcontext->gregs[REG_RCX]; + case UNW_X86_64_RBX: + return &mcontext->gregs[REG_RBX]; + case UNW_X86_64_RSI: + return &mcontext->gregs[REG_RSI]; + case UNW_X86_64_RDI: + return &mcontext->gregs[REG_RDI]; + case UNW_X86_64_RBP: + return &mcontext->gregs[REG_RBP]; + case UNW_X86_64_RSP: + return &mcontext->gregs[REG_RSP]; + case UNW_X86_64_R8: + return &mcontext->gregs[REG_R8]; + case UNW_X86_64_R9: + return &mcontext->gregs[REG_R9]; + case UNW_X86_64_R10: + return &mcontext->gregs[REG_R10]; + case UNW_X86_64_R11: + return &mcontext->gregs[REG_R11]; + case UNW_X86_64_R12: + return &mcontext->gregs[REG_R12]; + case UNW_X86_64_R13: + return &mcontext->gregs[REG_R13]; + case UNW_X86_64_R14: + return &mcontext->gregs[REG_R14]; + case UNW_X86_64_R15: + return &mcontext->gregs[REG_R15]; + case UNW_X86_64_RIP: + return &mcontext->gregs[REG_RIP]; +#elif defined __FreeBSD__ + case UNW_X86_64_RAX: + return &mcontext->mc_rax; + case UNW_X86_64_RDX: + return &mcontext->mc_rdx; + case UNW_X86_64_RCX: + return &mcontext->mc_rcx; + case UNW_X86_64_RBX: + return &mcontext->mc_rbx; + case UNW_X86_64_RSI: + return &mcontext->mc_rsi; + case UNW_X86_64_RDI: + return &mcontext->mc_rdi; + case UNW_X86_64_RBP: + return &mcontext->mc_rbp; + case UNW_X86_64_RSP: + return &mcontext->mc_rsp; + case UNW_X86_64_R8: + return &mcontext->mc_r8; + case UNW_X86_64_R9: + return &mcontext->mc_r9; + case UNW_X86_64_R10: + return &mcontext->mc_r10; + case UNW_X86_64_R11: + return &mcontext->mc_r11; + case UNW_X86_64_R12: + return &mcontext->mc_r12; + case UNW_X86_64_R13: + return &mcontext->mc_r13; + case UNW_X86_64_R14: + return &mcontext->mc_r14; + case UNW_X86_64_R15: + return &mcontext->mc_r15; + case UNW_X86_64_RIP: + return &mcontext->mc_rip; +#else +#error "Unable to get register from ucontext, please add your case" +#endif + default: + return nullptr; } #else return nullptr; @@ -143,11 +173,11 @@ void* UnwindContext::get_reg(unw_context_t* context, unw_regnum_t regnum) noexce int UnwindContext::access_reg(unw_addr_space_t /*as*/, unw_regnum_t regnum, unw_word_t* valp, int write, void* arg) noexcept { - simgrid::mc::UnwindContext* as_context = (simgrid::mc::UnwindContext*) arg; - unw_context_t* context = &as_context->unwindContext_; + simgrid::mc::UnwindContext* as_context = (simgrid::mc::UnwindContext*)arg; + unw_context_t* context = &as_context->unwindContext_; if (write) return -UNW_EREADONLYREG; - greg_t* preg = (greg_t*) get_reg(context, regnum); + greg_t* preg = (greg_t*)get_reg(context, regnum); if (not preg) return -UNW_EBADREG; *valp = *preg; @@ -180,11 +210,11 @@ int UnwindContext::resume(unw_addr_space_t /*as*/, unw_cursor_t* /*cp*/, void* / int UnwindContext::get_proc_name(unw_addr_space_t /*as*/, unw_word_t addr, char* bufp, size_t buf_len, unw_word_t* offp, void* arg) noexcept { - simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*) arg; - simgrid::mc::Frame* frame = context->process_->find_function(remote(addr)); + simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg; + simgrid::mc::Frame* frame = context->process_->find_function(remote(addr)); if (not frame) - return - UNW_ENOINFO; - *offp = (unw_word_t) frame->range.begin() - addr; + return -UNW_ENOINFO; + *offp = (unw_word_t)frame->range.begin() - addr; strncpy(bufp, frame->name.c_str(), buf_len); if (bufp[buf_len - 1]) { @@ -204,16 +234,9 @@ int UnwindContext::get_proc_name(unw_addr_space_t /*as*/, unw_word_t addr, char* * * It works with the `simgrid::mc::UnwindContext` context. */ -unw_accessors_t UnwindContext::accessors = { - &find_proc_info, - &put_unwind_info, - &get_dyn_info_list_addr, - &access_mem, - &access_reg, - &access_fpreg, - &resume, - &get_proc_name -}; +unw_accessors_t UnwindContext::accessors = {&find_proc_info, &put_unwind_info, &get_dyn_info_list_addr, + &access_mem, &access_reg, &access_fpreg, + &resume, &get_proc_name}; unw_addr_space_t UnwindContext::createUnwindAddressSpace() { @@ -223,34 +246,32 @@ unw_addr_space_t UnwindContext::createUnwindAddressSpace() void UnwindContext::initialize(simgrid::mc::RemoteClient* process, unw_context_t* c) { this->addressSpace_ = process; - this->process_ = process; + this->process_ = process; // Take a copy of the context for our own purpose: this->unwindContext_ = *c; #if SIMGRID_PROCESSOR_x86_64 || SIMGRID_PROCESSOR_i686 -# ifdef __linux__ +#ifdef __linux__ // On x86_64, ucontext_t contains a pointer to itself for FP registers. // We don't really need support for FR registers as they are caller saved // and probably never use those fields as libunwind-x86_64 does not read // FP registers from the unw_context_t // Let's ignore this and see what happens: this->unwindContext_.uc_mcontext.fpregs = nullptr; -# endif +#endif #else // Do we need to do any fixup like this? -# error Target CPU type is not handled. +#error Target CPU type is not handled. #endif } unw_cursor_t UnwindContext::cursor() { unw_cursor_t cursor; - if (process_ == nullptr - || addressSpace_ == nullptr - || unw_init_remote(&cursor, process_->unw_addr_space, this) != 0) + if (process_ == nullptr || addressSpace_ == nullptr || unw_init_remote(&cursor, process_->unw_addr_space, this) != 0) xbt_die("UnwindContext not initialized"); return cursor; } -} -} +} // namespace mc +} // namespace simgrid diff --git a/src/mc/mc_unw.hpp b/src/mc/inspect/mc_unw.hpp similarity index 97% rename from src/mc/mc_unw.hpp rename to src/mc/inspect/mc_unw.hpp index f629b8cf02..f3bd0a6502 100644 --- a/src/mc/mc_unw.hpp +++ b/src/mc/inspect/mc_unw.hpp @@ -36,8 +36,8 @@ namespace unw { XBT_PRIVATE unw_addr_space_t create_addr_space(); XBT_PRIVATE void* create_context(unw_addr_space_t as, pid_t pid); -} -} +} // namespace unw +} // namespace simgrid namespace simgrid { namespace mc { @@ -72,7 +72,7 @@ public: void dumpStack(FILE* file, unw_cursor_t&& cursor); void dumpStack(FILE* file, pid_t pid); -} -} +} // namespace mc +} // namespace simgrid #endif diff --git a/src/mc/mc_unw_vmread.cpp b/src/mc/inspect/mc_unw_vmread.cpp similarity index 73% rename from src/mc/mc_unw_vmread.cpp rename to src/mc/inspect/mc_unw_vmread.cpp index 1e7674cc86..9075f7b3aa 100644 --- a/src/mc/mc_unw_vmread.cpp +++ b/src/mc/inspect/mc_unw_vmread.cpp @@ -8,8 +8,8 @@ #include #include -#include #include +#include #include "src/mc/mc_unw.hpp" #include "src/mc/remote/RemoteClient.hpp" @@ -33,8 +33,7 @@ struct _UPT_info { /** Get the PID of a `libunwind-ptrace` context */ -static inline -pid_t _UPT_getpid(void* arg) +static inline pid_t _UPT_getpid(void* arg) { _UPT_info* info = static_cast<_UPT_info*>(arg); return info->pid; @@ -42,46 +41,45 @@ pid_t _UPT_getpid(void* arg) /** Read from the memory, avoid using `ptrace` (libunwind method) */ -static int access_mem(const unw_addr_space_t as, - const unw_word_t addr, unw_word_t* const valp, - const int write, void* const arg) +static int access_mem(const unw_addr_space_t as, const unw_word_t addr, unw_word_t* const valp, const int write, + void* const arg) { if (write) - return - UNW_EINVAL; - pid_t pid = _UPT_getpid(arg); + return -UNW_EINVAL; + pid_t pid = _UPT_getpid(arg); size_t size = sizeof(unw_word_t); #if HAVE_PROCESS_VM_READV // process_vm_read implementation. // This is only available since Linux 3.2. - struct iovec local = { valp, size }; - struct iovec remote = { (void*) addr, size }; - ssize_t s = process_vm_readv(pid, &local, 1, &remote, 1, 0); + struct iovec local = {valp, size}; + struct iovec remote = {(void*)addr, size}; + ssize_t s = process_vm_readv(pid, &local, 1, &remote, 1, 0); if (s >= 0) { - if ((size_t) s != size) - return - UNW_EINVAL; + if ((size_t)s != size) + return -UNW_EINVAL; else return 0; } if (s < 0 && errno != ENOSYS) - return - UNW_EINVAL; + return -UNW_EINVAL; #endif // /proc/${pid}/mem implementation. // On recent kernels, we do not need to ptrace the target process. // On older kernels, it is necessary to ptrace the target process. size_t count = size; - off_t off = (off_t) addr; - char* buf = (char*) valp; - int fd = simgrid::mc::open_vm(pid, O_RDONLY); + off_t off = (off_t)addr; + char* buf = (char*)valp; + int fd = simgrid::mc::open_vm(pid, O_RDONLY); if (fd < 0) - return - UNW_EINVAL; + return -UNW_EINVAL; while (1) { ssize_t nread = pread(fd, buf, count, off); if (nread == 0) { close(fd); - return - UNW_EINVAL; + return -UNW_EINVAL; } if (nread == -1) break; @@ -116,16 +114,9 @@ namespace unw { */ // TODO, we could get rid of this if we properly stop the model-checked // process before reading the memory. -static unw_accessors_t accessors = { - &_UPT_find_proc_info, - &_UPT_put_unwind_info, - &_UPT_get_dyn_info_list_addr, - &access_mem, - &_UPT_access_reg, - &_UPT_access_fpreg, - &_UPT_resume, - &_UPT_get_proc_name -}; +static unw_accessors_t accessors = {&_UPT_find_proc_info, &_UPT_put_unwind_info, &_UPT_get_dyn_info_list_addr, + &access_mem, &_UPT_access_reg, &_UPT_access_fpreg, + &_UPT_resume, &_UPT_get_proc_name}; unw_addr_space_t create_addr_space() { @@ -137,5 +128,5 @@ void* create_context(unw_addr_space_t /*as*/, pid_t pid) return _UPT_create(pid); } -} -} +} // namespace unw +} // namespace simgrid diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index b2cc82d9cd..96a70120f3 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -30,12 +30,12 @@ #if SIMGRID_HAVE_MC #include "src/mc/checker/Checker.hpp" +#include "src/mc/inspect/mc_unw.hpp" #include "src/mc/mc_comm_pattern.hpp" #include "src/mc/mc_private.hpp" #include "src/mc/mc_request.hpp" #include "src/mc/mc_safety.hpp" #include "src/mc/mc_smx.hpp" -#include "src/mc/mc_unw.hpp" #include "src/mc/sosp/mc_snapshot.hpp" #include #endif diff --git a/src/mc/remote/RemoteClient.hpp b/src/mc/remote/RemoteClient.hpp index f61d4819be..994b88b7c6 100644 --- a/src/mc/remote/RemoteClient.hpp +++ b/src/mc/remote/RemoteClient.hpp @@ -6,9 +6,9 @@ #ifndef SIMGRID_MC_PROCESS_H #define SIMGRID_MC_PROCESS_H -#include "src/xbt/mmalloc/mmprivate.h" +#include "src/mc/inspect/ObjectInformation.hpp" #include "src/mc/remote/Channel.hpp" -#include "src/mc/ObjectInformation.hpp" +#include "src/xbt/mmalloc/mmprivate.h" #include diff --git a/src/mc/sosp/mc_snapshot.hpp b/src/mc/sosp/mc_snapshot.hpp index 71962a13c6..35d07cbb36 100644 --- a/src/mc/sosp/mc_snapshot.hpp +++ b/src/mc/sosp/mc_snapshot.hpp @@ -7,7 +7,7 @@ #define SIMGRID_MC_SNAPSHOT_HPP #include "src/mc/ModelChecker.hpp" -#include "src/mc/mc_unw.hpp" +#include "src/mc/inspect/mc_unw.hpp" #include "src/mc/remote/RemoteClient.hpp" #include "src/mc/sosp/RegionSnapshot.hpp" diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 8f61acb2be..7e12ac3f03 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -593,6 +593,26 @@ set(MC_SRC src/mc/checker/SafetyChecker.hpp src/mc/checker/LivenessChecker.cpp src/mc/checker/LivenessChecker.hpp + + src/mc/inspect/DwarfExpression.hpp + src/mc/inspect/DwarfExpression.cpp + src/mc/inspect/Frame.hpp + src/mc/inspect/Frame.cpp + src/mc/inspect/LocationList.hpp + src/mc/inspect/LocationList.cpp + src/mc/inspect/ObjectInformation.hpp + src/mc/inspect/ObjectInformation.cpp + src/mc/inspect/Type.hpp + src/mc/inspect/Variable.hpp + src/mc/inspect/mc_dwarf.hpp + src/mc/inspect/mc_dwarf.cpp + src/mc/inspect/mc_dwarf_attrnames.cpp + src/mc/inspect/mc_dwarf_tagnames.cpp + src/mc/inspect/mc_member.cpp + src/mc/inspect/mc_unw.hpp + src/mc/inspect/mc_unw.cpp + src/mc/inspect/mc_unw_vmread.cpp + src/mc/remote/Channel.cpp src/mc/remote/Channel.hpp src/mc/remote/Client.cpp @@ -614,36 +634,18 @@ set(MC_SRC src/mc/sosp/mc_snapshot.cpp src/mc/AddressSpace.hpp - src/mc/Frame.hpp - src/mc/Frame.cpp src/mc/ModelChecker.hpp src/mc/ModelChecker.cpp - src/mc/ObjectInformation.hpp - src/mc/ObjectInformation.cpp - src/mc/Type.hpp - src/mc/Variable.hpp src/mc/mc_forward.hpp src/mc/Session.cpp src/mc/Session.hpp - src/mc/mc_unw.hpp - src/mc/mc_unw.cpp - src/mc/mc_unw_vmread.cpp src/mc/mc_comm_pattern.cpp src/mc/mc_comm_pattern.hpp src/mc/compare.cpp - src/mc/mc_dwarf.hpp - src/mc/mc_dwarf.cpp - src/mc/mc_dwarf_attrnames.cpp - src/mc/DwarfExpression.hpp - src/mc/DwarfExpression.cpp - src/mc/mc_dwarf_tagnames.cpp src/mc/mc_hash.hpp src/mc/mc_hash.cpp src/mc/mc_ignore.hpp - src/mc/LocationList.hpp - src/mc/LocationList.cpp src/mc/mc_record.cpp - src/mc/mc_member.cpp src/mc/mc_memory.cpp src/mc/mc_private.hpp src/mc/mc_request.hpp