Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc: move some files related to ELF, DWARF or unwind reading into their own directory
[simgrid.git] / src / mc / inspect / LocationList.hpp
similarity index 57%
rename from src/mc/LocationList.hpp
rename to src/mc/inspect/LocationList.hpp
index 3427060..b937ef4 100644 (file)
@@ -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 <cstdint>
 #include <vector>
@@ -23,31 +23,22 @@ namespace dwarf {
 class LocationListEntry {
 public:
   typedef simgrid::xbt::Range<std::uint64_t> 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<LocationListEntry> 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