1 /* Copyright (c) 2008-2015. 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. */
14 #include "xbt/function_types.h"
15 #include "simgrid/simix.h"
16 #include "simgrid/modelchecker.h" /* our public interface (and definition of HAVE_MC) */
17 #include "xbt/automaton.h"
18 #include "xbt/dynar.h"
20 /* Maximum size of the application heap.
22 * The model-checker heap is placed at this offset from the
23 * beginning of the application heap.
25 * In the current implementation, if the application uses more
26 * than this for the application heap the application heap will
27 * smash the beginning of the model-checker heap and bad things
30 * For 64 bits systems, we have a lot of virtual memory available
31 * so we wan use a much bigger value in order to avoid bad things
35 #define STD_HEAP_SIZE (sizeof(void*)<=4 ? (100*1024*1024) : (1ll*1024*1024*1024*1024))
39 /********************************** Configuration of MC **************************************/
41 extern XBT_PUBLIC(int) _sg_do_model_check;
42 extern XBT_PRIVATE int _sg_do_model_check_record;
43 extern XBT_PRIVATE int _sg_mc_checkpoint;
44 extern XBT_PUBLIC(int) _sg_mc_sparse_checkpoint;
45 extern XBT_PUBLIC(char*) _sg_mc_property_file;
46 extern XBT_PRIVATE int _sg_mc_timeout;
47 extern XBT_PRIVATE int _sg_mc_hash;
48 extern XBT_PRIVATE int _sg_mc_max_depth;
49 extern XBT_PUBLIC(int) _sg_mc_visited;
50 extern XBT_PRIVATE char* _sg_mc_dot_output_file;
51 extern XBT_PUBLIC(int) _sg_mc_comms_determinism;
52 extern XBT_PUBLIC(int) _sg_mc_send_determinism;
53 extern XBT_PRIVATE int _sg_mc_safety;
54 extern XBT_PRIVATE int _sg_mc_liveness;
55 extern XBT_PRIVATE int _sg_mc_snapshot_fds;
56 extern XBT_PRIVATE int _sg_mc_termination;
58 extern XBT_PRIVATE xbt_dynar_t mc_heap_comparison_ignore;
59 extern XBT_PRIVATE xbt_dynar_t stacks_areas;
61 /********************************* Global *************************************/
63 XBT_PRIVATE void _mc_cfg_cb_reduce(const char *name, int pos);
64 XBT_PRIVATE void _mc_cfg_cb_checkpoint(const char *name, int pos);
65 XBT_PRIVATE void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos);
66 XBT_PRIVATE void _mc_cfg_cb_property(const char *name, int pos);
67 XBT_PRIVATE void _mc_cfg_cb_timeout(const char *name, int pos);
68 XBT_PRIVATE void _mc_cfg_cb_snapshot_fds(const char *name, int pos);
69 XBT_PRIVATE void _mc_cfg_cb_hash(const char *name, int pos);
70 XBT_PRIVATE void _mc_cfg_cb_max_depth(const char *name, int pos);
71 XBT_PRIVATE void _mc_cfg_cb_visited(const char *name, int pos);
72 XBT_PRIVATE void _mc_cfg_cb_dot_output(const char *name, int pos);
73 XBT_PRIVATE void _mc_cfg_cb_comms_determinism(const char *name, int pos);
74 XBT_PRIVATE void _mc_cfg_cb_send_determinism(const char *name, int pos);
75 XBT_PRIVATE void _mc_cfg_cb_termination(const char *name, int pos);
77 extern xbt_dynar_t mc_heap_comparison_ignore;
78 extern xbt_dynar_t stacks_areas;
80 /********************************* Global *************************************/
81 void _mc_cfg_cb_reduce(const char *name, int pos);
82 void _mc_cfg_cb_checkpoint(const char *name, int pos);
83 void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos);
84 void _mc_cfg_cb_soft_dirty(const char *name, int pos);
85 void _mc_cfg_cb_ksm(const char *name, int pos);
86 void _mc_cfg_cb_property(const char *name, int pos);
87 void _mc_cfg_cb_timeout(const char *name, int pos);
88 void _mc_cfg_cb_hash(const char *name, int pos);
89 void _mc_cfg_cb_snapshot_fds(const char *name, int pos);
90 void _mc_cfg_cb_max_depth(const char *name, int pos);
91 void _mc_cfg_cb_visited(const char *name, int pos);
92 void _mc_cfg_cb_dot_output(const char *name, int pos);
93 void _mc_cfg_cb_comms_determinism(const char *name, int pos);
94 void _mc_cfg_cb_send_determinism(const char *name, int pos);
95 void _mc_cfg_cb_termination(const char *name, int pos);
97 XBT_PUBLIC(void) MC_run(void);
98 XBT_PUBLIC(void) MC_init(void);
99 XBT_PUBLIC(void) MC_exit(void);
100 XBT_PUBLIC(void) MC_process_clock_add(smx_process_t, double);
101 XBT_PUBLIC(double) MC_process_clock_get(smx_process_t);
102 XBT_PRIVATE void MC_automaton_load(const char *file);
104 /****************************** MC ignore **********************************/
105 XBT_PUBLIC(void) MC_ignore_heap(void *address, size_t size);
106 XBT_PUBLIC(void) MC_remove_ignore_heap(void *address, size_t size);
107 XBT_PUBLIC(void) MC_ignore_local_variable(const char *var_name, const char *frame);
108 XBT_PUBLIC(void) MC_ignore_global_variable(const char *var_name);
109 XBT_PUBLIC(void) MC_register_stack_area(void *stack, smx_process_t process, void *context, size_t size);
111 /********************************* Memory *************************************/
112 XBT_PUBLIC(void) MC_memory_init(void); /* Initialize the memory subsystem */
113 XBT_PUBLIC(void) MC_memory_exit(void);
114 XBT_PUBLIC(void) MC_memory_init_server(void);
118 #endif /* _MC_MC_H */