Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Move Frame, ModelChecker, ObjectInformation, Type, Variable in their own files
[simgrid.git] / src / mc / mc_object_info.cpp
index 7324681..a3895bf 100644 (file)
@@ -10,6 +10,9 @@
 
 #include "mc_object_info.h"
 #include "mc_private.h"
+#include "mc/Frame.hpp"
+#include "mc/Type.hpp"
+#include "mc/Variable.hpp"
 
 namespace simgrid {
 namespace mc {
@@ -65,85 +68,5 @@ Frame::Frame()
   this->object_info = nullptr;
 }
 
-// ObjectInformations
-
-ObjectInformation::ObjectInformation()
-{
-  this->flags = 0;
-  this->file_name = nullptr;
-  this->start = nullptr;
-  this->end = nullptr;
-  this->start_exec = nullptr;
-  this->end_exec = nullptr;
-  this->start_rw = nullptr;
-  this->end_rw = nullptr;
-  this->start_ro = nullptr;
-  this->end_ro = nullptr;
-  this->subprograms = xbt_dict_new_homogeneous(mc_frame_free);
-  this->functions_index = nullptr;
-}
-
-ObjectInformation::~ObjectInformation()
-{
-  xbt_free(this->file_name);
-  xbt_dict_free(&this->subprograms);
-  xbt_dynar_free(&this->functions_index);
-}
-
-/** Find the DWARF offset for this ELF object
- *
- *  An offset is applied to address found in DWARF:
- *
- *  <ul>
- *    <li>for an executable obejct, addresses are virtual address
- *        (there is no offset) i.e. \f$\text{virtual address} = \{dwarf address}\f$;</li>
- *    <li>for a shared object, the addreses are offset from the begining
- *        of the shared object (the base address of the mapped shared
- *        object must be used as offset
- *        i.e. \f$\text{virtual address} = \text{shared object base address}
- *             + \text{dwarf address}\f$.</li>
- *
- */
-void *ObjectInformation::base_address() const
-{
-  if (this->executable())
-    return nullptr;
-
-  void *result = this->start_exec;
-  if (this->start_rw != NULL && result > (void *) this->start_rw)
-    result = this->start_rw;
-  if (this->start_ro != NULL && result > (void *) this->start_ro)
-    result = this->start_ro;
-  return result;
-}
-
-mc_frame_t ObjectInformation::find_function(const void *ip) const
-{
-  xbt_dynar_t dynar = this->functions_index;
-  mc_function_index_item_t base =
-      (mc_function_index_item_t) xbt_dynar_get_ptr(dynar, 0);
-  int i = 0;
-  int j = xbt_dynar_length(dynar) - 1;
-  while (j >= i) {
-    int k = i + ((j - i) / 2);
-    if (ip < base[k].low_pc) {
-      j = k - 1;
-    } else if (ip >= base[k].high_pc) {
-      i = k + 1;
-    } else {
-      return base[k].function;
-    }
-  }
-  return nullptr;
-}
-
-simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const
-{
-  for (simgrid::mc::Variable& variable : this->global_variables)
-    if(variable.name == name)
-      return &variable;
-  return nullptr;
-}
-
 }
 }
\ No newline at end of file