Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "[mc] Fix initialisation of dwarf expression"
[simgrid.git] / src / mc / mc_libdw.hpp
1 /* Copyright (c) 2008-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #if !defined(SIMGRID_MC_LIBDW_HPP)
8 #define SIMGRID_MC_LIBDW_HPP
9
10 #include <stdint.h>
11
12 #include <dwarf.h>
13 #include <elfutils/libdw.h>
14
15 #include "mc/Frame.hpp"
16 #include "mc/ObjectInformation.hpp"
17 #include "mc/Variable.hpp"
18
19 /** \brief Computes the the element_count of a DW_TAG_enumeration_type DIE
20  *
21  * This is the number of elements in a given array dimension.
22  *
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).
26  *
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
29  */
30 static std::uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die,
31                                                 Dwarf_Die * unit);
32
33 /** \brief Computes the number of elements of a given DW_TAG_array_type.
34  *
35  * \param die DIE for the DW_TAG_array_type
36  */
37 static std::uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit);
38
39 /** \brief Process a DIE
40  *
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
45  */
46 static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
47                                 Dwarf_Die * unit, simgrid::mc::Frame* frame,
48                                 const char *ns);
49
50 /** \brief Process a type DIE
51  */
52 static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
53                                      Dwarf_Die * unit, simgrid::mc::Frame* frame,
54                                      const char *ns);
55
56 /** \brief Calls MC_dwarf_handle_die on all childrend of the given die
57  *
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
62  */
63 static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
64                                      Dwarf_Die * unit, simgrid::mc::Frame* frame,
65                                      const char *ns);
66
67 /** \brief Handle a variable (DW_TAG_variable or other)
68  *
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
73  */
74 static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
75                                          Dwarf_Die * unit, simgrid::mc::Frame* frame,
76                                          const char *ns);
77
78 /** \brief Get the DW_TAG_type of the DIE
79  *
80  *  \param die DIE
81  *  \return DW_TAG_type attribute as a new string (NULL if none)
82  */
83 static std::uint64_t MC_dwarf_at_type(Dwarf_Die * die);
84
85 #endif