#include <utility>
#include <unordered_set>
-#include <xbt/sysdep.h>
-#include <xbt/dynar.h>
+#include "xbt/dynar.h"
+#include "xbt/sysdep.h"
#include <xbt/mmalloc.h>
#include <mc/mc.h>
#include "src/xbt/mmalloc/mmprivate.h"
#if HAVE_SMPI
-#include "src/smpi/private.h"
+#include "src/smpi/include/private.h"
+#include "src/smpi/include/private.hpp"
#endif
#include "src/mc/mc_forward.hpp"
-#include "src/mc/mc_safety.h"
#include "src/mc/mc_private.h"
#include "src/mc/mc_smx.h"
#include "src/mc/mc_dwarf.hpp"
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;
}
}
- while (i2 < state.heaplimit && !equal) {
+ while (i2 < state.heaplimit && not equal) {
addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
i2++;
}
- if (!equal) {
+ if (not equal) {
XBT_DEBUG("Block %zu not found (size_used = %zu, addr = %p)", i1, heapinfo1->busy_block.busy_size, addr_block1);
i1 = state.heaplimit + 1;
nb_diff1++;
equal = 0;
/* Try first to associate to same fragment in the other heap */
- if (heapinfo2->type == heapinfo1->type
- && !state.equals_to2_(i1, j1).valid) {
+ if (heapinfo2->type == heapinfo1->type && not state.equals_to2_(i1, j1).valid) {
addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE +
(char *) state.std_heap_copy.heapbase;
addr_frag2 =
equal = 1;
}
- while (i2 < state.heaplimit && !equal) {
+ while (i2 < state.heaplimit && not equal) {
const malloc_info* heapinfo2b = (const malloc_info*) MC_region_read(
heap_region2, &heapinfo_temp2b, &heapinfos2[i2],
i2++;
}
- if (!equal) {
+ if (not equal) {
XBT_DEBUG("Block %zu, fragment %zu not found (size_used = %zd, address = %p)\n", i1, j1,
heapinfo1->busy_frag.frag_size[j1], addr_frag1);
i2 = state.heaplimit + 1;
heap_region1, &heapinfo_temp1, &heapinfos1[i], sizeof(malloc_info));
if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED && i1 == state.heaplimit && heapinfo1->busy_block.busy_size > 0 &&
- !state.equals_to1_(i, 0).valid) {
+ not state.equals_to1_(i, 0).valid) {
XBT_DEBUG("Block %zu not found (size used = %zu)", i, heapinfo1->busy_block.busy_size);
nb_diff1++;
}
if (heapinfo1->type <= 0)
continue;
for (j = 0; j < (size_t) (BLOCKSIZE >> heapinfo1->type); j++)
- if (i1 == state.heaplimit && heapinfo1->busy_frag.frag_size[j] > 0 && !state.equals_to1_(i, j).valid) {
+ if (i1 == state.heaplimit && heapinfo1->busy_frag.frag_size[j] > 0 && not state.equals_to1_(i, j).valid) {
XBT_DEBUG("Block %zu, Fragment %zu not found (size used = %zd)", i, j, heapinfo1->busy_frag.frag_size[j]);
nb_diff1++;
}
for (i=1; i < state.heaplimit; i++) {
const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read(
heap_region2, &heapinfo_temp2, &heapinfos2[i], sizeof(malloc_info));
- if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED
- && i1 == state.heaplimit
- && heapinfo2->busy_block.busy_size > 0
- && !state.equals_to2_(i, 0).valid) {
+ if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED && i1 == state.heaplimit && heapinfo2->busy_block.busy_size > 0 &&
+ not state.equals_to2_(i, 0).valid) {
XBT_DEBUG("Block %zu not found (size used = %zu)", i,
heapinfo2->busy_block.busy_size);
nb_diff2++;
continue;
for (j = 0; j < (size_t) (BLOCKSIZE >> heapinfo2->type); j++)
- if (i1 == state.heaplimit
- && heapinfo2->busy_frag.frag_size[j] > 0
- && !state.equals_to2_(i, j).valid) {
+ if (i1 == state.heaplimit && heapinfo2->busy_frag.frag_size[j] > 0 && not state.equals_to2_(i, j).valid) {
XBT_DEBUG("Block %zu, Fragment %zu not found (size used = %zd)",
i, j, heapinfo2->busy_frag.frag_size[j]);
nb_diff2++;
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);
return 1;
case DW_TAG_base_type:
- if (!type->name.empty() && type->name == "char") { /* String, hence random (arbitrary ?) size */
+ if (not type->name.empty() && type->name == "char") { /* String, hence random (arbitrary ?) size */
if (real_area1 == real_area2)
return -1;
else
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;
// Find type_size:
if (type->type == DW_TAG_pointer_type ||
- (type->type == DW_TAG_base_type && !type->name.empty() && type->name == "char"))
+ (type->type == DW_TAG_base_type && not type->name.empty() && type->name == "char"))
type_size = -1;
else
type_size = type->byte_size;
if (heapinfo1->busy_block.busy_size != heapinfo2->busy_block.busy_size)
return 1;
- if (!previous->insert(simgrid::mc::makeHeapLocationPair(block1, -1, block2, -1)).second) {
+ if (not previous->insert(simgrid::mc::makeHeapLocationPair(block1, -1, block2, -1)).second) {
if (match_pairs)
state.match_equals(previous);
return 0;
}
if (offset1 == 0 && offset2 == 0 &&
- !previous->insert(simgrid::mc::makeHeapLocationPair(block1, frag1, block2, frag2)).second) {
+ not previous->insert(simgrid::mc::makeHeapLocationPair(block1, frag1, block2, frag2)).second) {
if (match_pairs)
state.match_equals(previous);
return 0;
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;
return 0;
if (addr_pointed1 == nullptr || addr_pointed2 == nullptr)
return 1;
- if (!state.compared_pointers.insert(
- std::make_pair(addr_pointed1, addr_pointed2)).second)
+ if (not state.compared_pointers.insert(std::make_pair(addr_pointed1, addr_pointed2)).second)
return 0;
pointer_level++;
if (addr_pointed1 > process->heap_address
&& addr_pointed1 < mc_snapshot_get_heap_end(snapshot1)) {
- if (!
- (addr_pointed2 > process->heap_address
- && addr_pointed2 < mc_snapshot_get_heap_end(snapshot2)))
+ if (not(addr_pointed2 > process->heap_address && addr_pointed2 < mc_snapshot_get_heap_end(snapshot2)))
return 1;
// The pointers are both in the heap:
return simgrid::mc::compare_heap_area(state,
// The pointers are both in the current object R/W segment:
else if (region1->contain(simgrid::mc::remote(addr_pointed1))) {
- if (!region2->contain(simgrid::mc::remote(addr_pointed2)))
+ if (not region2->contain(simgrid::mc::remote(addr_pointed2)))
return 1;
- if (!type->type_id)
+ if (not type->type_id)
return (addr_pointed1 != addr_pointed2);
else
return compare_areas_with_type(state, process_index,
(char *) current_var.address);
return 1;
}
-
}
return 0;
-
}
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];
// 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++;
}
else
state_comparator->clear();
- simgrid::mc::Process* process = &mc_model_checker->process();
+ simgrid::mc::RemoteClient* process = &mc_model_checker->process();
int errors = 0;
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;
// * There MUST not be any false negative.
XBT_VERB("(%d - %d) State equality hash test is %s %s", num1, num2,
- (hash_result != 0) == (errors != 0) ? "true" : "false",
- !hash_result ? "positive" : "negative");
+ (hash_result != 0) == (errors != 0) ? "true" : "false", not hash_result ? "positive" : "negative");
}
#endif