1 /* Copyright (c) 2008-2022. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "src/mc/ModelChecker.hpp"
8 #include "src/mc/mc_private.hpp"
9 #include "src/mc/mc_record.hpp"
10 #include "src/mc/mc_replay.hpp"
11 #include "src/mc/remote/AppSide.hpp"
12 #include "xbt/asserts.h"
14 /** @file mc_client_api.cpp
16 * This is the implementation of the API used by the user simulated program to
17 * communicate with the MC (declared in modelchecker.h).
20 // MC_random() is in mc_base.cpp
22 void MC_assert(int prop)
24 xbt_assert(mc_model_checker == nullptr);
27 simgrid::mc::AppSide::get()->report_assertion_failure();
28 if (MC_record_replay_is_active())
29 xbt_die("MC assertion failed");
33 void MC_automaton_new_propositional_symbol(const char* /*id*/, int (*/*fct*/)())
35 xbt_assert(mc_model_checker == nullptr);
36 if (not MC_is_active())
38 xbt_die("Support for client-side function proposition is not implemented: "
39 "use MC_automaton_new_propositional_symbol_pointer instead.");
42 void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
44 xbt_assert(mc_model_checker == nullptr);
45 if (not MC_is_active())
47 simgrid::mc::AppSide::get()->declare_symbol(name, value);
50 void MC_ignore(void* addr, size_t size)
52 xbt_assert(mc_model_checker == nullptr);
53 if (not MC_is_active())
55 simgrid::mc::AppSide::get()->ignore_memory(addr, size);
58 void MC_ignore_heap(void *address, size_t size)
60 xbt_assert(mc_model_checker == nullptr);
61 simgrid::mc::AppSide::get()->ignore_heap(address, size);
64 void MC_unignore_heap(void* address, size_t size)
66 xbt_assert(mc_model_checker == nullptr);
67 simgrid::mc::AppSide::get()->unignore_heap(address, size);