Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix SMPI builds by reintroducing a killed MC function that it actually use
[simgrid.git] / src / mc / mc_client_api.cpp
1 /* Copyright (c) 2008-2022. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
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"
13
14 /** @file mc_client_api.cpp
15  *
16  *  This is the implementation of the API used by the user simulated program to
17  *  communicate with the MC (declared in modelchecker.h).
18  */
19
20 // MC_random() is in mc_base.cpp
21
22 void MC_assert(int prop)
23 {
24   xbt_assert(mc_model_checker == nullptr);
25   if (not prop) {
26     if (MC_is_active())
27       simgrid::mc::AppSide::get()->report_assertion_failure();
28     if (MC_record_replay_is_active())
29       xbt_die("MC assertion failed");
30   }
31 }
32
33 void MC_automaton_new_propositional_symbol(const char* /*id*/, int (*/*fct*/)())
34 {
35   xbt_assert(mc_model_checker == nullptr);
36   if (not MC_is_active())
37     return;
38   xbt_die("Support for client-side function proposition is not implemented: "
39     "use MC_automaton_new_propositional_symbol_pointer instead.");
40 }
41
42 void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
43 {
44   xbt_assert(mc_model_checker == nullptr);
45   if (not MC_is_active())
46     return;
47   simgrid::mc::AppSide::get()->declare_symbol(name, value);
48 }
49
50 void MC_ignore(void* addr, size_t size)
51 {
52   xbt_assert(mc_model_checker == nullptr);
53   if (not MC_is_active())
54     return;
55   simgrid::mc::AppSide::get()->ignore_memory(addr, size);
56 }
57
58 void MC_ignore_heap(void *address, size_t size)
59 {
60   xbt_assert(mc_model_checker == nullptr);
61   simgrid::mc::AppSide::get()->ignore_heap(address, size);
62 }
63
64 void MC_unignore_heap(void* address, size_t size)
65 {
66   xbt_assert(mc_model_checker == nullptr);
67   simgrid::mc::AppSide::get()->unignore_heap(address, size);
68 }