Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't eat the errno of when dlopen fails (but still remove the copied binary)
[simgrid.git] / src / mc / compare.cpp
index a5845c8..2a1ddae 100644 (file)
@@ -25,8 +25,8 @@
 #include "src/xbt/mmalloc/mmprivate.h"
 
 #if HAVE_SMPI
-#include "src/smpi/private.h"
-#include "src/smpi/private.hpp"
+#include "src/smpi/include/private.h"
+#include "src/smpi/include/private.hpp"
 #endif
 
 #include "src/mc/mc_forward.hpp"
@@ -306,7 +306,7 @@ int StateComparator::initHeapInformation(xbt_mheap_t heap1, xbt_mheap_t heap2,
 static inline
 mc_mem_region_t MC_get_heap_region(simgrid::mc::Snapshot* snapshot)
 {
-  for (auto& region : snapshot->snapshot_regions)
+  for (auto const& region : snapshot->snapshot_regions)
     if (region->region_type() == simgrid::mc::RegionType::Heap)
       return region.get();
   xbt_die("No heap region");
@@ -316,7 +316,7 @@ static
 int mmalloc_compare_heap(
   simgrid::mc::StateComparator& state, simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot* snapshot2)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   /* Start comparison */
   size_t i1;
@@ -609,7 +609,7 @@ static int compare_heap_area_without_type(
   HeapLocationPairs* previous, int size,
   int check_ignore)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
   mc_mem_region_t heap_region1 = MC_get_heap_region(snapshot1);
   mc_mem_region_t heap_region2 = MC_get_heap_region(snapshot2);
 
@@ -865,7 +865,7 @@ top:
           return res;
       }
     } else {
-      for(simgrid::mc::Member& member : type->members) {
+      for (simgrid::mc::Member& member : type->members) {
         // TODO, optimize this? (for the offset case)
         void *real_member1 = simgrid::dwarf::resolve_member(
           real_area1, type, &member, (simgrid::mc::AddressSpace*) snapshot1, process_index);
@@ -926,7 +926,7 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::
         return nullptr;
     }
 
-    for(simgrid::mc::Member& member : type->members) {
+    for (simgrid::mc::Member& member : type->members) {
       if (member.has_offset_location()) {
         // We have the offset, use it directly (shortcut):
         if (member.offset() == offset)
@@ -965,7 +965,7 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index,
                       HeapLocationPairs* previous,
                       simgrid::mc::Type* type, int pointer_level)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   int res_compare;
   ssize_t block1;
@@ -1276,7 +1276,7 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state,
                                    void* real_area2, simgrid::mc::Snapshot* snapshot2, mc_mem_region_t region2,
                                    simgrid::mc::Type* type, int pointer_level)
 {
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   simgrid::mc::Type* subtype;
   simgrid::mc::Type* subsubtype;
@@ -1395,7 +1395,7 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state,
   }
   case DW_TAG_structure_type:
   case DW_TAG_class_type:
-    for(simgrid::mc::Member& member : type->members) {
+    for (simgrid::mc::Member& member : type->members) {
       void *member1 = simgrid::dwarf::resolve_member(
         real_area1, type, &member, snapshot1, process_index);
       void *member2 = simgrid::dwarf::resolve_member(
@@ -1459,7 +1459,7 @@ static int compare_global_variables(
 
   std::vector<simgrid::mc::Variable>& variables = object_info->global_variables;
 
-  for (simgrid::mc::Variable& current_var : variables) {
+  for (simgrid::mc::Variable const& current_var : variables) {
 
     // If the variable is not in this object, skip it:
     // We do not expect to find a pointer to something which is not reachable
@@ -1479,11 +1479,9 @@ static int compare_global_variables(
                (char *) current_var.address);
       return 1;
     }
-
   }
 
   return 0;
-
 }
 
 static int compare_local_variables(simgrid::mc::StateComparator& state,
@@ -1500,7 +1498,6 @@ static int compare_local_variables(simgrid::mc::StateComparator& state,
 
     unsigned int cursor = 0;
     local_variable_t current_var1, current_var2;
-    int res;
     while (cursor < stack1->local_variables.size()) {
       current_var1 = &stack1->local_variables[cursor];
       current_var2 = &stack1->local_variables[cursor];
@@ -1521,22 +1518,18 @@ static int compare_local_variables(simgrid::mc::StateComparator& state,
       // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
 
         simgrid::mc::Type* subtype = current_var1->type;
-        res =
-            compare_areas_with_type(state, process_index,
-                                    current_var1->address, snapshot1, mc_get_snapshot_region(current_var1->address, snapshot1, process_index),
-                                    current_var2->address, snapshot2, mc_get_snapshot_region(current_var2->address, snapshot2, process_index),
-                                    subtype, 0);
-
-      if (res == 1) {
-        // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
-        XBT_VERB
-            ("Local variable %s (%p - %p) in frame %s "
-             "is different between snapshots",
-             current_var1->name.c_str(),
-             current_var1->address,
-             current_var2->address,
-             current_var1->subprogram->name.c_str());
-        return res;
+        int res                    = compare_areas_with_type(
+            state, process_index, current_var1->address, snapshot1,
+            mc_get_snapshot_region(current_var1->address, snapshot1, process_index), current_var2->address, snapshot2,
+            mc_get_snapshot_region(current_var2->address, snapshot2, process_index), subtype, 0);
+
+        if (res == 1) {
+          // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
+          XBT_VERB("Local variable %s (%p - %p) in frame %s "
+                   "is different between snapshots",
+                   current_var1->name.c_str(), current_var1->address, current_var2->address,
+                   current_var1->subprogram->name.c_str());
+          return res;
       }
       cursor++;
     }
@@ -1557,7 +1550,7 @@ int snapshot_compare(int num1, simgrid::mc::Snapshot* s1, int num2, simgrid::mc:
   else
     state_comparator->clear();
 
-  simgrid::mc::Process* process = &mc_model_checker->process();
+  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
 
   int errors = 0;
 
@@ -1642,12 +1635,10 @@ int snapshot_compare(int num1, simgrid::mc::Snapshot* s1, int num2, simgrid::mc:
       XBT_DEBUG("(%d - %d) Different local variables between stacks %d", num1,
                 num2, cursor + 1);
       errors++;
-      is_diff = 1;
 #else
 
 #ifdef MC_VERBOSE
-      XBT_VERB("(%d - %d) Different local variables between stacks %d", num1,
-               num2, cursor + 1);
+      XBT_VERB("(%d - %d) Different local variables between stacks %u", num1, num2, cursor + 1);
 #endif
 
       return 1;