-/* Copyright (c) 2008-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/internal_config.h"
#include "src/xbt/mmalloc/mmprivate.h"
-#include "src/xbt/ex_interface.h"
#if HAVE_SMPI
#include "src/smpi/private.h"
}
if (i1 == state.heaplimit)
- XBT_DEBUG("Number of blocks/fragments not found in heap1 : %d", nb_diff1);
+ XBT_DEBUG("Number of blocks/fragments not found in heap1: %d", nb_diff1);
for (i=1; i < state.heaplimit; i++) {
const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read(
}
if (i1 == state.heaplimit)
- XBT_DEBUG("Number of blocks/fragments not found in heap2 : %d", nb_diff2);
+ XBT_DEBUG("Number of blocks/fragments not found in heap2: %d", nb_diff2);
return nb_diff1 > 0 || nb_diff2 > 0;
}
* @param snapshot1 Snapshot of state 1
* @param snapshot2 Snapshot of state 2
* @param previous
- * @param type_id
+ * @param type
* @param area_size either a byte_size or an elements_count (?)
* @param check_ignore
* @param pointer_level
*
* TODO, handle subfields ((*p).bar.foo, (*p)[5].bar…)
*
- * @param type_id DWARF type ID of the root address
+ * @param type DWARF type ID of the root address
* @param area_size
* @return DWARF type ID for given offset
*/
return nullptr;
default:
- /* FIXME : other cases ? */
+ /* FIXME: other cases ? */
return nullptr;
}
return -1;
break;
default:
- XBT_VERB("Unknown case : %d", type->type);
+ XBT_VERB("Unknown case: %d", type->type);
break;
}
// Compare the global variables separately for each simulates process:
for (size_t process_index = 0; process_index < process_count; process_index++) {
- int is_diff = compare_global_variables(state,
- object_info, process_index,
- &r1->privatized_data()[process_index],
- &r2->privatized_data()[process_index],
- snapshot1, snapshot2);
- if (is_diff) return 1;
+ if (compare_global_variables(state,
+ object_info, process_index,
+ &r1->privatized_data()[process_index],
+ &r2->privatized_data()[process_index],
+ snapshot1, snapshot2))
+ return 1;
}
return 0;
}
if (_sg_mc_hash) {
hash_result = (s1->hash != s2->hash);
if (hash_result) {
- XBT_VERB("(%d - %d) Different hash : 0x%" PRIx64 "--0x%" PRIx64, num1,
- num2, s1->hash, s2->hash);
+ XBT_VERB("(%d - %d) Different hash: 0x%" PRIx64 "--0x%" PRIx64, num1, num2, s1->hash, s2->hash);
#ifndef MC_DEBUG
return 1;
#endif
} else
- XBT_VERB("(%d - %d) Same hash : 0x%" PRIx64, num1, num2, s1->hash);
+ XBT_VERB("(%d - %d) Same hash: 0x%" PRIx64, num1, num2, s1->hash);
}
/* Compare enabled processes */
if (s1->enabled_processes != s2->enabled_processes) {
- XBT_VERB("(%d - %d) Different enabled processes", num1, num2);
- // return 1; ??
+ XBT_VERB("(%d - %d) Different amount of enabled processes", num1, num2);
+ return 1;
}
- unsigned long i = 0;
- size_t size_used1, size_used2;
- int is_diff = 0;
-
/* Compare size of stacks */
- while (i < s1->stacks.size()) {
- size_used1 = s1->stack_sizes[i];
- size_used2 = s2->stack_sizes[i];
+ int is_diff = 0;
+ for (unsigned long i = 0; i < s1->stacks.size(); i++) {
+ size_t size_used1 = s1->stack_sizes[i];
+ size_t size_used2 = s2->stack_sizes[i];
if (size_used1 != size_used2) {
#ifdef MC_DEBUG
- XBT_DEBUG("(%d - %d) Different size used in stacks : %zu - %zu", num1,
- num2, size_used1, size_used2);
+ XBT_DEBUG("(%d - %d) Different size used in stacks: %zu - %zu", num1, num2, size_used1, size_used2);
errors++;
is_diff = 1;
#else
#ifdef MC_VERBOSE
- XBT_VERB("(%d - %d) Different size used in stacks : %zu - %zu", num1,
- num2, size_used1, size_used2);
+ XBT_VERB("(%d - %d) Different size used in stacks: %zu - %zu", num1, num2, size_used1, size_used2);
#endif
return 1;
#endif
}
- i++;
}
+ if (is_diff) // do not proceed if there is any stacks that don't match
+ return 1;
/* Init heap information used in heap comparison algorithm */
xbt_mheap_t heap1 = (xbt_mheap_t)s1->read_bytes(
}
/* Stacks comparison */
- unsigned cursor = 0;
int diff_local = 0;
-#ifdef MC_DEBUG
- is_diff = 0;
-#endif
- mc_snapshot_stack_t stack1, stack2;
- while (cursor < s1->stacks.size()) {
- stack1 = &s1->stacks[cursor];
- stack2 = &s2->stacks[cursor];
+ for (unsigned int cursor = 0; cursor < s1->stacks.size(); cursor++) {
+ mc_snapshot_stack_t stack1 = &s1->stacks[cursor];
+ mc_snapshot_stack_t stack2 = &s2->stacks[cursor];
if (stack1->process_index != stack2->process_index) {
diff_local = 1;
return 1;
#endif
}
- cursor++;
}
size_t regions_count = s1->snapshot_regions.size();
#ifdef MC_VERBOSE
XBT_VERB("(%d - %d) Different heap (mmalloc_compare)", num1, num2);
#endif
-
return 1;
#endif
}