Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d02e25ea4f469c90fa2a080ff7dd6624ca3be5b3
[simgrid.git] / src / mc / inspect / Frame.hpp
1 /* Copyright (c) 2007-2023. 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 #ifndef SIMGRID_MC_FRAME_HPP
8 #define SIMGRID_MC_FRAME_HPP
9
10 #include <cstdint>
11 #include <string>
12
13 #include "xbt/base.h"
14 #include "xbt/range.hpp"
15
16 #include "src/mc/inspect/LocationList.hpp"
17 #include "src/mc/inspect/Variable.hpp"
18 #include "src/mc/mc_forward.hpp"
19
20 namespace simgrid::mc {
21
22 /** Debug information about a given function or scope within a function */
23 class Frame {
24 public:
25   /** Kind of scope (DW_TAG_subprogram, DW_TAG_inlined_subroutine, etc.) */
26   int tag = DW_TAG_invalid;
27
28   /** Name of the function (if it is a function) */
29   std::string name;
30
31   /** Range of instruction addresses for which this scope is valid */
32   simgrid::xbt::Range<std::uint64_t> range{0, 0};
33
34   simgrid::dwarf::LocationList frame_base_location;
35
36   /** List of the variables (sorted by name) */
37   std::vector<Variable> variables;
38
39   /* Unique identifier for this scope (in the object_info)
40    *
41    * This is the global DWARF offset of the DIE. */
42   unsigned long int id = 0;
43
44   std::vector<Frame> scopes;
45
46   /** Value of `DW_AT_abstract_origin`
47    *
48    *  For inlined subprograms, this is the ID of the
49    *  parent function.
50    */
51   unsigned long int abstract_origin_id = 0;
52
53   simgrid::mc::ObjectInformation* object_info = nullptr;
54
55   void* frame_base(unw_cursor_t& unw_cursor) const;
56   void remove_variable(char* name);
57 };
58 } // namespace simgrid::mc
59
60 #endif