const size_t n = process->object_infos.size();
snapshot->snapshot_regions.resize(n + 1);
int i = 0;
- for (auto const& object_info : process->object_infos) {
- add_region(i, snapshot, simgrid::mc::RegionType::Data,
+ for (auto const& object_info : process->object_infos)
+ add_region(i++, snapshot, simgrid::mc::RegionType::Data,
object_info.get(),
object_info->start_rw, object_info->start_rw,
object_info->end_rw - object_info->start_rw);
- ++i;
- }
xbt_mheap_t heap = process->get_heap();
void *start_heap = heap->base;
process->get_malloc_info());
#ifdef HAVE_SMPI
- if (mc_model_checker->process().privatized() && MC_smpi_process_count()) {
+ if (mc_model_checker->process().privatized() && MC_smpi_process_count())
// snapshot->privatization_index = smpi_loaded_page
mc_model_checker->process().read_variable(
"smpi_loaded_page", &snapshot->privatization_index,
sizeof(snapshot->privatization_index));
- } else
+ else
#endif
- {
snapshot->privatization_index = simgrid::mc::ProcessIndexMissing;
- }
}
/** \brief Fills the position of the segments (executable, read-only, read/write).
// .bss is usually after the .data:
simgrid::xbt::VmMap const& next = maps[i + 1];
if (next.pathname.empty() && (next.prot & PROT_WRITE)
- && next.start_addr == reg.end_addr) {
+ && next.start_addr == reg.end_addr)
result->end_rw = (char*) maps[i + 1].end_addr;
- }
} else if ((reg.prot & PROT_READ) && (reg.prot & PROT_EXEC)) {
xbt_assert(!result->start_exec,
"Multiple executable segments for %s, not supported",
new_var.region = region_type;
new_var.address = nullptr;
- if (current_variable.address != nullptr) {
+ if (current_variable.address != nullptr)
new_var.address = current_variable.address;
- } else if (!current_variable.location_list.empty()) {
+ else if (!current_variable.location_list.empty()) {
simgrid::dwarf::Location location =
simgrid::dwarf::resolve(
current_variable.location_list,
xbt_die("Cannot handle non-address variable");
new_var.address = location.address();
- } else {
+ } else
xbt_die("No address");
- }
result.push_back(std::move(new_var));
}
unw_cursor_t c;
// TODO, check condition check (unw_init_local==0 means end of frame)
- if (mc_unw_init_cursor(&c, stack_context) != 0) {
-
+ if (mc_unw_init_cursor(&c, stack_context) != 0)
xbt_die("Could not initialize stack unwinding");
- } else
while (1) {
s_mc_stack_frame_t stack_frame;
break;
int ret = unw_step(&c);
- if (ret == 0) {
+ if (ret == 0)
xbt_die("Unexpected end of stack.");
- } else if (ret < 0) {
+ else if (ret < 0)
xbt_die("Error while unwinding stack");
- }
}
if (result.empty()) {
&context, sizeof(context), remote(stack.context));
if (mc_unw_init_context(&st.context, &mc_model_checker->process(),
- &context) < 0) {
+ &context) < 0)
xbt_die("Could not initialise the libunwind context.");
- }
+
st.stack_frames = unwind_stack_frames(&st.context);
st.local_variables = get_local_variables_values(st.stack_frames, stack.process_index);
st.process_index = stack.process_index;
}
// Zero the memory:
- for(auto const& region : mc_model_checker->process().ignored_regions()) {
+ for(auto const& region : mc_model_checker->process().ignored_regions())
snapshot->process()->clear_bytes(remote(region.addr), region.size);
- }
}
const size_t link_size = 200;
char link[200];
res = readlink(source, link, link_size);
- if (res<0) {
+
+ if (res<0)
xbt_die("Could not read link for %s", source);
- }
- if (res==200) {
+ if (res==200)
xbt_die("Buffer to small for link of %s", source);
- }
+
link[res] = '\0';
#ifdef HAVE_SMPI
if (_sg_mc_visited > 0 || strcmp(_sg_mc_property_file, "")) {
snapshot->stacks =
take_snapshot_stacks(&snapshot);
- if (_sg_mc_hash) {
+ if (_sg_mc_hash)
snapshot->hash = simgrid::mc::hash(*snapshot);
- } else {
+ else
snapshot->hash = 0;
- }
- } else {
+ } else
snapshot->hash = 0;
- }
snapshot_ignore_restore(snapshot);
if (use_soft_dirty)
for (auto const& fd : snapshot->current_fds) {
int new_fd = open(fd.filename.c_str(), fd.flags);
- if (new_fd < 0) {
+ if (new_fd < 0)
xbt_die("Could not reopen the file %s fo restoring the file descriptor",
fd.filename.c_str());
- }
if (new_fd != fd.number) {
dup2(new_fd, fd.number);
close(new_fd);
if (!memcmp(comm1->data, comm2->data, comm1->data_size))
return NONE_DIFF;
return DATA_DIFF;
- }else{
+ } else
return DATA_DIFF;
- }
return NONE_DIFF;
}
pattern->rdv = mc_model_checker->process().read_string(remote_name);
pattern->dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc)->pid;
pattern->dst_host = MC_smx_process_get_host_name(issuer);
- } else {
+ } else
xbt_die("Unexpected call_type %i", (int) call_type);
- }
xbt_dynar_push(
xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t),
int completed = 0;
/* Complete comm pattern */
- xbt_dynar_foreach(xbt_dynar_get_as(incomplete_communications_pattern, issuer, xbt_dynar_t), cursor, current_comm_pattern) {
+ xbt_dynar_foreach(xbt_dynar_get_as(incomplete_communications_pattern, issuer, xbt_dynar_t), cursor, current_comm_pattern)
if (current_comm_pattern->comm_addr == comm_addr) {
update_comm_pattern(current_comm_pattern, comm_addr);
completed = 1;
XBT_DEBUG("Remove incomplete comm pattern for process %u at cursor %u", issuer, cursor);
break;
}
- }
+
if(!completed)
xbt_die("Corresponding communication not found!");
mc_list_comm_pattern_t pattern = xbt_dynar_get_as(
initial_communications_pattern, issuer, mc_list_comm_pattern_t);
- if (!initial_global_state->initial_communications_pattern_done) {
+ if (!initial_global_state->initial_communications_pattern_done)
/* Store comm pattern */
xbt_dynar_push(pattern->list, &comm_pattern);
- } else {
+ else {
/* Evaluate comm determinism */
deterministic_comm_pattern(issuer, comm_pattern, backtracking);
pattern->index_comm++;
XBT_DEBUG("Execute: %s", req_str);
xbt_free(req_str);
- if (dot_output != nullptr) {
+ if (dot_output != nullptr)
req_str = MC_request_get_dot_output(req, value);
- }
MC_state_set_executed_request(state, req, value);
mc_stats->executed_transitions++;
/* TODO : handle test and testany simcalls */
e_mc_call_type_t call = MC_CALL_TYPE_NONE;
- if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
+ if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
call = MC_get_call_type(req);
- }
/* Answer the request */
MC_simcall_handle(req, value); /* After this call req is no longer useful */
if (dot_output != nullptr)
fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, next_state->num, req_str);
- } else {
-
- if (dot_output != nullptr)
- fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str);
-
- }
+ } else if (dot_output != nullptr)
+ fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",
+ state->num, visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str);
xbt_fifo_unshift(mc_stack, next_state);
} else {
- if (xbt_fifo_size(mc_stack) > _sg_mc_max_depth) {
+ if (xbt_fifo_size(mc_stack) > _sg_mc_max_depth)
XBT_WARN("/!\\ Max depth reached ! /!\\ ");
- } else if (visited_state != nullptr) {
+ else if (visited_state != nullptr)
XBT_DEBUG("State already visited (equal to state %d), exploration stopped on this path.", visited_state->other_num == -1 ? visited_state->num : visited_state->other_num);
- } else {
+ else
XBT_DEBUG("There are no more processes to interleave. (depth %d)", xbt_fifo_size(mc_stack));
- }
if (!initial_global_state->initial_communications_pattern_done)
initial_global_state->initial_communications_pattern_done = 1;
return SIMGRID_MC_EXIT_DEADLOCK;
}
- while ((state = (mc_state_t) xbt_fifo_shift(mc_stack)) != nullptr) {
+ while ((state = (mc_state_t) xbt_fifo_shift(mc_stack)) != nullptr)
if (MC_state_interleave_size(state) && xbt_fifo_size(mc_stack) < _sg_mc_max_depth) {
/* We found a back-tracking point, let's loop */
XBT_DEBUG("Back-tracking to state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1);
XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1);
MC_state_delete(state, !state->in_visited_states ? 1 : 0);
}
- }
+
}
}
mc_reduce_kind = e_mc_reduce_none;
mc_model_checker->wait_for_requests();
- if (mc_mode == MC_MODE_CLIENT) {
+ if (mc_mode == MC_MODE_CLIENT)
// This will move somehwere else:
MC_client_handle_messages();
- }
/* Create exploration stack */
mc_stack = xbt_fifo_new();
mc_list_comm_pattern_t list_process_comm;
unsigned int cursor;
- xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm){
+ xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm)
list_process_comm->index_comm = (int)xbt_dynar_get_as(state->index_comm, cursor, int);
- }
- for (unsigned i = 0; i < MC_smx_get_maxpid(); i++) {
+ for (unsigned i = 0; i < MC_smx_get_maxpid(); i++)
MC_patterns_copy(
xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t),
xbt_dynar_get_as(state->incomplete_comm_pattern, i, xbt_dynar_t)
);
- }
}
void MC_state_copy_incomplete_communications_pattern(mc_state_t state)
state->index_comm = xbt_dynar_new(sizeof(unsigned int), nullptr);
mc_list_comm_pattern_t list_process_comm;
unsigned int cursor;
- xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm){
+ xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm)
xbt_dynar_push_as(state->index_comm, unsigned int, list_process_comm->index_comm);
- }
}
void MC_handle_comm_pattern(
void* addr_pointed1 = MC_region_read_pointer(region1, real_area1);
void* addr_pointed2 = MC_region_read_pointer(region2, real_area2);
- if (type->subtype && type->subtype->type == DW_TAG_subroutine_type) {
+ if (type->subtype && type->subtype->type == DW_TAG_subroutine_type)
return (addr_pointed1 != addr_pointed2);
- } else {
-
- if (addr_pointed1 == nullptr && addr_pointed2 == NULL)
- return 0;
- if (addr_pointed1 == nullptr || addr_pointed2 == NULL)
- return 1;
- if (!state.compared_pointers.insert(
- std::make_pair(addr_pointed1, addr_pointed2)).second)
- return 0;
+ if (addr_pointed1 == nullptr && addr_pointed2 == NULL)
+ return 0;
+ if (addr_pointed1 == nullptr || addr_pointed2 == NULL)
+ return 1;
+ if (!state.compared_pointers.insert(
+ std::make_pair(addr_pointed1, addr_pointed2)).second)
+ return 0;
- pointer_level++;
+ pointer_level++;
// Some cases are not handled here:
// * the pointers lead to different areas (one to the heap, the other to the RW segment ...);
return 1;
if (!type->type_id)
return (addr_pointed1 != addr_pointed2);
- else {
+ else
return compare_areas_with_type(state, process_index,
addr_pointed1, snapshot1, region1,
addr_pointed2, snapshot2, region2,
type->subtype, pointer_level);
- }
}
// TODO, We do not handle very well the case where
// it belongs to a different (non-heap) region from the current one.
- else {
+ else
return (addr_pointed1 != addr_pointed2);
- }
- }
+
break;
}
case DW_TAG_structure_type:
#ifdef HAVE_SMPI
if (r1->storage_type() == simgrid::mc::StorageType::Privatized) {
xbt_assert(process_index >= 0);
- if (r2->storage_type() != simgrid::mc::StorageType::Privatized) {
+ if (r2->storage_type() != simgrid::mc::StorageType::Privatized)
return 1;
- }
size_t process_count = MC_smpi_process_count();
xbt_assert(process_count == r1->privatized_data().size()
if (stack1->local_variables.size() != stack2->local_variables.size()) {
XBT_VERB("Different number of local variables");
return 1;
- } else {
+ }
+
unsigned int cursor = 0;
local_variable_t current_var1, current_var2;
int res;
cursor++;
}
return 0;
- }
}
int snapshot_compare(void *state1, void *state2)
#ifndef MC_DEBUG
return 1;
#endif
- } else {
+ } else
XBT_VERB("(%d - %d) Same hash : 0x%" PRIx64, num1, num2, s1->hash);
- }
}
/* Compare enabled processes */
void _mc_cfg_cb_timeout(const char *name, int pos)
{
- if (_sg_cfg_init_status && !(_sg_do_model_check || MC_record_path)) {
+ if (_sg_cfg_init_status && !(_sg_do_model_check || MC_record_path))
xbt_die
("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_timeout = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
void _mc_cfg_cb_reduce(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
char *val = xbt_cfg_get_string(_sg_cfg_set, name);
- if (!strcasecmp(val, "none")) {
+ if (!strcasecmp(val, "none"))
mc_reduce_kind = e_mc_reduce_none;
- } else if (!strcasecmp(val, "dpor")) {
+ else if (!strcasecmp(val, "dpor"))
mc_reduce_kind = e_mc_reduce_dpor;
- } else {
+ else
xbt_die("configuration option %s can only take 'none' or 'dpor' as a value",
name);
- }
}
void _mc_cfg_cb_checkpoint(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_checkpoint = xbt_cfg_get_int(_sg_cfg_set, name);
}
void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos) {
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_sparse_checkpoint = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
"(through MSG_config?), but model-checking was not activated "
"at config time (through --cfg=model-check:1). "
"This won't work, sorry.");
+
_sg_mc_soft_dirty = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
{
if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die("You are specifying a KSM value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry.");
+
_sg_mc_ksm = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
void _mc_cfg_cb_property(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a property after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_property_file = xbt_cfg_get_string(_sg_cfg_set, name);
}
void _mc_cfg_cb_hash(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a value to enable/disable the use of global hash to speedup state comparaison, but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_hash = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
void _mc_cfg_cb_snapshot_fds(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a value to enable/disable the use of FD snapshoting, but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_snapshot_fds = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
void _mc_cfg_cb_max_depth(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a max depth value after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_max_depth = xbt_cfg_get_int(_sg_cfg_set, name);
}
void _mc_cfg_cb_visited(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a number of stored visited states after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_visited = xbt_cfg_get_int(_sg_cfg_set, name);
}
void _mc_cfg_cb_dot_output(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a file name for a dot output of graph state after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_dot_output_file = xbt_cfg_get_string(_sg_cfg_set, name);
}
void _mc_cfg_cb_comms_determinism(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a value to enable/disable the detection of determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_comms_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
void _mc_cfg_cb_send_determinism(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a value to enable/disable the detection of send-determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_send_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
void _mc_cfg_cb_termination(const char *name, int pos)
{
- if (_sg_cfg_init_status && !_sg_do_model_check) {
+ if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a value to enable/disable the detection of non progressive cycles after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- }
+
_sg_mc_termination = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
unsigned int cursor = 0;
heap_area_pair_t current_pair;
- xbt_dynar_foreach(list, cursor, current_pair) {
+ xbt_dynar_foreach(list, cursor, current_pair)
if (current_pair->block1 == block1 && current_pair->block2 == block2
&& current_pair->fragment1 == fragment1
&& current_pair->fragment2 == fragment2)
return 0;
- }
return 1;
}
unsigned int cursor = 0;
heap_area_pair_t current_pair;
- xbt_dynar_foreach(list, cursor, current_pair) {
+ xbt_dynar_foreach(list, cursor, current_pair)
if (current_pair->fragment1 != -1) {
}
- }
}
/** Check whether two blocks are known to be matching
res_compare =
compare_heap_area(process_index, addr_pointed1, addr_pointed2, snapshot1,
snapshot2, previous, nullptr, 0);
- if (res_compare == 1) {
+ if (res_compare == 1)
return res_compare;
- }
i = pointer_align + sizeof(void *);
continue;
- } else {
+ } else
return 1;
- }
}
&& ((ignore1 = heap_comparison_ignore_size(state->to_ignore1, real_area1))
> 0)
&& ((ignore2 = heap_comparison_ignore_size(state->to_ignore2, real_area2))
- == ignore1)) {
+ == ignore1))
return 0;
- }
simgrid::mc::Type *subtype, *subsubtype;
int res, elm_size;
} else {
if (area_size != -1 && type->byte_size != area_size)
return -1;
- else {
+ else
return (MC_snapshot_region_memcmp(real_area1, heap_region1, real_area2, heap_region2, type->byte_size) != 0);
- }
}
break;
case DW_TAG_enumeration_type:
if (res == 1)
return res;
}
- } else {
+ } else
return -1;
- }
} else {
for(simgrid::mc::Member& member : type->members) {
// TODO, optimize this? (for the offset case)
snapshot1, snapshot2,
previous, member.type, -1,
check_ignore, 0);
- if (res == 1) {
+ if (res == 1)
return res;
- }
}
}
break;
|| (block1 > (ssize_t) state->heapsize1) || (block1 < 1)
|| ((char *) area2 < (char *) state->std_heap_copy.heapbase)
|| (block2 > (ssize_t) state->heapsize2) || (block2 < 1)) {
- if (match_pairs) {
+ if (match_pairs)
xbt_dynar_free(&previous);
- }
return 1;
}
if (heapinfo1->busy_block.size !=
heapinfo2->busy_block.size) {
- if (match_pairs) {
+ if (match_pairs)
xbt_dynar_free(&previous);
- }
return 1;
}
if (heapinfo1->busy_block.busy_size !=
heapinfo2->busy_block.busy_size) {
- if (match_pairs) {
+ if (match_pairs)
xbt_dynar_free(&previous);
- }
return 1;
}
// Remember (basic) type inference.
// The current data structure only allows us to do this for the whole block.
- if (type != nullptr && area1 == real_addr_block1) {
+ if (type != nullptr && area1 == real_addr_block1)
state->types1_(block1, 0) = type;
- }
- if (type != nullptr && area2 == real_addr_block2) {
+ if (type != nullptr && area2 == real_addr_block2)
state->types2_(block2, 0) = type;
- }
if (size <= 0) {
if (match_pairs) {
}
return -1;
} else {
- if (match_pairs) {
+ if (match_pairs)
xbt_dynar_free(&previous);
- }
return 1;
}
}
// Remember (basic) type inference.
// The current data structure only allows us to do this for the whole fragment.
- if (type != nullptr && area1 == real_addr_frag1) {
+ if (type != nullptr && area1 == real_addr_frag1)
state->types1_(block1, frag1) = type;
- }
- if (type != nullptr && area2 == real_addr_frag2) {
+ if (type != nullptr && area2 == real_addr_frag2)
state->types2_(block2, frag2) = type;
- }
+
// The type of the variable is already known:
if (type) {
new_type1 = type;
size = new_size1;
}
- if (offset1 == 0 && offset2 == 0) {
- if (!add_heap_area_pair(previous, block1, frag1, block2, frag2)) {
+ if (offset1 == 0 && offset2 == 0
+ && !add_heap_area_pair(previous, block1, frag1, block2, frag2)) {
if (match_pairs) {
match_equals(state, previous);
xbt_dynar_free(&previous);
}
return 0;
}
- }
if (size <= 0) {
if (match_pairs) {
} else {
- if (match_pairs) {
+ if (match_pairs)
xbt_dynar_free(&previous);
- }
return 1;
}
/* Start comparison */
- if (type) {
+ if (type)
res_compare =
compare_heap_area_with_type(state, process_index, area1, area2, snapshot1, snapshot2,
previous, type, size, check_ignore,
pointer_level);
- } else {
+ else
res_compare =
compare_heap_area_without_type(state, process_index, area1, area2, snapshot1, snapshot2,
previous, size, check_ignore);
- }
+
if (res_compare == 1) {
if (match_pairs)
xbt_dynar_free(&previous);
if (heapinfo[block].type == MMALLOC_TYPE_FREE || heapinfo[block].type == MMALLOC_TYPE_HEAPINFO) { /* Free block */
return -1;
- } else if (heapinfo[block].type == MMALLOC_TYPE_UNFRAGMENTED) { /* Complete block */
+ else if (heapinfo[block].type == MMALLOC_TYPE_UNFRAGMENTED) /* Complete block */
return (int) heapinfo[block].busy_block.busy_size;
- } else {
+ else
frag =
((uintptr_t) (ADDR2UINT(area) % (BLOCKSIZE))) >> heapinfo[block].type;
return (int) heapinfo[block].busy_frag.frag_size[frag];
- }
+
}
#ifndef max
int attribute)
{
Dwarf_Attribute attr;
- if (!dwarf_attr_integrate(die, attribute, &attr)) {
+ if (!dwarf_attr_integrate(die, attribute, &attr))
return nullptr;
- } else {
+ else
return dwarf_formstring(&attr);
- }
}
/** \brief Get the linkage name of a DIE.
if (low_pc) {
// DW_AT_high_pc:
Dwarf_Attribute attr;
- if (!dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
+ if (!dwarf_attr_integrate(die, DW_AT_high_pc, &attr))
xbt_die("Missing DW_AT_high_pc matching with DW_AT_low_pc");
- }
Dwarf_Sword offset;
Dwarf_Addr high_pc;
Dwarf_Die child;
int res;
for (res = dwarf_child(die, &child); res == 0;
- res = dwarf_siblingof(&child, &child)) {
+ res = dwarf_siblingof(&child, &child))
MC_dwarf_handle_die(info, &child, unit, frame, ns);
- }
}
static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
break;
// Resolve full_type:
- if (!subtype->name.empty() && subtype->byte_size == 0) {
+ if (!subtype->name.empty() && subtype->byte_size == 0)
for (auto const& object_info : process->object_infos) {
auto i = object_info->full_types_by_name.find(subtype->name);
if (i != object_info->full_types_by_name.end()
break;
}
}
- } else type->full_type = subtype;
+ else type->full_type = subtype;
}
}
ssize_t s = mc_model_checker->process().receive_message(message);
if (s == -1)
xbt_die("Could not receive message");
- else if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY) {
+ if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY)
xbt_die("%s received unexpected message %s (%i, size=%i) "
"expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
MC_mode_name(mc_mode),
MC_message_type_name(message.type), (int) message.type, (int) s,
(int) MC_MESSAGE_DEADLOCK_CHECK_REPLY, (int) sizeof(message)
);
- }
- else
- return message.value;
+ return message.value;
}
int deadlock = FALSE;
double MC_process_clock_get(smx_process_t process)
{
- if (mc_time) {
- if (process != nullptr)
- return mc_time[process->pid];
- else
- return -1;
- } else
+ if (!mc_time)
return 0;
+ if (process != nullptr)
+ return mc_time[process->pid];
+ return -1;
}
void MC_process_clock_add(smx_process_t process, double amount)