Example #1
0
/** @brief Register a stack in the model checker
 *
 *  The stacks are allocated in the heap. The MC handle them especially
 *  when we analyse/compare the content of the heap so it must be told where
 *  they are with this function.
 *
 *  @param stack
 *  @param process Process owning the stack
 *  @param context
 *  @param size    Size of the stack
 */
void MC_register_stack_area(void *stack, smx_process_t process, void *context, size_t size)
{
  if (mc_mode != MC_MODE_CLIENT)
    return;

  xbt_mheap_t heap = mmalloc_get_current_heap();

  s_stack_region_t region;
  memset(&region, 0, sizeof(region));
  region.address = stack;
  region.context = context;
  region.size = size;
  region.block =
      ((char *) stack -
       (char *) heap->heapbase) / BLOCKSIZE + 1;
#ifdef HAVE_SMPI
  if (smpi_privatize_global_variables && process) {
    region.process_index = smpi_process_index_of_smx_process(process);
  } else
#endif
  region.process_index = -1;

  s_mc_stack_region_message_t message;
  message.type = MC_MESSAGE_STACK_REGION;
  message.stack_region = region;
  MC_client_send_message(&message, sizeof(message));
}
Example #2
0
void MC_ignore(void* addr, size_t size)
{
  if (mc_mode == MC_MODE_CLIENT) {
    s_mc_ignore_memory_message_t message;
    message.type = MC_MESSAGE_IGNORE_MEMORY;
    message.addr = addr;
    message.size = size;
    MC_client_send_message(&message, sizeof(message));
  }
}
Example #3
0
void MC_remove_ignore_heap(void *address, size_t size)
{
  if (mc_mode != MC_MODE_CLIENT)
    return;

  s_mc_ignore_memory_message_t message;
  message.type = MC_MESSAGE_UNIGNORE_HEAP;
  message.addr = (std::uintptr_t) address;
  message.size = size;
  MC_client_send_message(&message, sizeof(message));
}
Example #4
0
void MC_ignore(void* addr, size_t size)
{
    xbt_assert(mc_mode != MC_MODE_SERVER);
    if (mc_mode != MC_MODE_CLIENT)
        return;

    s_mc_ignore_memory_message_t message;
    message.type = MC_MESSAGE_IGNORE_MEMORY;
    message.addr = (std::uintptr_t) addr;
    message.size = size;
    MC_client_send_message(&message, sizeof(message));
}
Example #5
0
void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
{
    xbt_assert(mc_mode != MC_MODE_SERVER);
    if (mc_mode != MC_MODE_CLIENT)
        return;

    s_mc_register_symbol_message_t message;
    message.type = MC_MESSAGE_REGISTER_SYMBOL;
    if (strlen(name) + 1 > sizeof(message.name))
        xbt_die("Symbol is too long");
    strncpy(message.name, name, sizeof(message.name));
    message.callback = nullptr;
    message.data = value;
    MC_client_send_message(&message, sizeof(message));
}