1 /* Copyright (c) 2008-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #if !defined(SIMGRID_MC_LIBDW_HPP)
8 #define SIMGRID_MC_LIBDW_HPP
13 #include <elfutils/libdw.h>
15 #include "mc/Frame.hpp"
16 #include "mc/ObjectInformation.hpp"
17 #include "mc/Variable.hpp"
19 /** \brief Computes the the element_count of a DW_TAG_enumeration_type DIE
21 * This is the number of elements in a given array dimension.
23 * A reference of the compilation unit (DW_TAG_compile_unit) is
24 * needed because the default lower bound (when there is no DW_AT_lower_bound)
25 * depends of the language of the compilation unit (DW_AT_language).
27 * \param die DIE for the DW_TAG_enumeration_type or DW_TAG_subrange_type
28 * \param unit DIE of the DW_TAG_compile_unit
30 static std::uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die,
33 /** \brief Computes the number of elements of a given DW_TAG_array_type.
35 * \param die DIE for the DW_TAG_array_type
37 static std::uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit);
39 /** \brief Process a DIE
41 * \param info the resulting object fot the library/binary file (output)
42 * \param die the current DIE
43 * \param unit the DIE of the compile unit of the current DIE
44 * \param frame containg frame if any
46 static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
47 Dwarf_Die * unit, simgrid::mc::Frame* frame,
50 /** \brief Process a type DIE
52 static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
53 Dwarf_Die * unit, simgrid::mc::Frame* frame,
56 /** \brief Calls MC_dwarf_handle_die on all childrend of the given die
58 * \param info the resulting object fot the library/binary file (output)
59 * \param die the current DIE
60 * \param unit the DIE of the compile unit of the current DIE
61 * \param frame containg frame if any
63 static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
64 Dwarf_Die * unit, simgrid::mc::Frame* frame,
67 /** \brief Handle a variable (DW_TAG_variable or other)
69 * \param info the resulting object fot the library/binary file (output)
70 * \param die the current DIE
71 * \param unit the DIE of the compile unit of the current DIE
72 * \param frame containg frame if any
74 static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
75 Dwarf_Die * unit, simgrid::mc::Frame* frame,
78 /** \brief Get the DW_TAG_type of the DIE
81 * \return DW_TAG_type attribute as a new string (NULL if none)
83 static std::uint64_t MC_dwarf_at_type(Dwarf_Die * die);