Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move surf::As to s4u::As
[simgrid.git] / src / mc / mc_private.h
1 /* Copyright (c) 2007-2015. 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 #ifndef SIMGRID_MC_PRIVATE_H
8 #define SIMGRID_MC_PRIVATE_H
9
10 #include <sys/types.h>
11
12 #include "simgrid_config.h"
13 #include <stdio.h>
14 #include <stdint.h>
15 #include <stdbool.h>
16 #ifndef WIN32
17 #include <sys/mman.h>
18 #endif
19 #include <elfutils/libdw.h>
20
21 #include "mc/mc.h"
22 #include "src/mc/mc_base.h"
23 #include "mc/datatypes.h"
24 #include "xbt/fifo.h"
25 #include "xbt/config.h"
26
27 #ifdef __cplusplus
28 #include "src/xbt/memory_map.hpp"
29 #endif
30
31 #include "xbt/function_types.h"
32 #include "xbt/mmalloc.h"
33 #include "src/simix/smx_private.h"
34 #include "src/xbt/mmalloc/mmprivate.h"
35 #include "xbt/automaton.h"
36 #include <simgrid/msg.h>
37 #include "xbt/strbuff.h"
38 #include "xbt/parmap.h"
39 #include <xbt/base.h>
40
41 #include "src/mc/mc_forward.h"
42 #include "src/mc/mc_protocol.h"
43
44 SG_BEGIN_DECL()
45
46 typedef struct s_mc_function_index_item s_mc_function_index_item_t, *mc_function_index_item_t;
47
48 /********************************* MC Global **********************************/
49
50 XBT_PRIVATE void MC_init_dot_output();
51
52 XBT_PRIVATE extern FILE *dot_output;
53 XBT_PRIVATE extern const char* colors[13];
54 XBT_PRIVATE extern xbt_parmap_t parmap;
55
56 XBT_PRIVATE extern int user_max_depth_reached;
57
58 XBT_PRIVATE int MC_deadlock_check(void);
59 XBT_PRIVATE void MC_replay(xbt_fifo_t stack);
60 XBT_PRIVATE void MC_replay_liveness(xbt_fifo_t stack);
61 XBT_PRIVATE void MC_show_deadlock(smx_simcall_t req);
62 XBT_PRIVATE void MC_show_stack_safety(xbt_fifo_t stack);
63 XBT_PRIVATE void MC_dump_stack_safety(xbt_fifo_t stack);
64 XBT_PRIVATE void MC_show_non_termination(void);
65
66 /** Stack (of `mc_state_t`) representing the current position of the
67  *  the MC in the exploration graph
68  *
69  *  It is managed by its head (`xbt_fifo_shift` and `xbt_fifo_unshift`).
70  */
71 XBT_PRIVATE extern xbt_fifo_t mc_stack;
72
73 XBT_PRIVATE int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max);
74
75
76 /****************************** Statistics ************************************/
77
78 typedef struct mc_stats {
79   unsigned long state_size;
80   unsigned long visited_states;
81   unsigned long visited_pairs;
82   unsigned long expanded_states;
83   unsigned long expanded_pairs;
84   unsigned long executed_transitions;
85 } s_mc_stats_t, *mc_stats_t;
86
87 XBT_PRIVATE extern mc_stats_t mc_stats;
88
89 XBT_PRIVATE void MC_print_statistics(mc_stats_t stats);
90
91 /********************************** Snapshot comparison **********************************/
92
93 XBT_PRIVATE int snapshot_compare(void *state1, void *state2);
94
95 //#define MC_DEBUG 1
96 #define MC_VERBOSE 1
97
98 /********************************** Miscellaneous **********************************/
99
100 XBT_PRIVATE void MC_report_assertion_error(void);
101 XBT_PRIVATE void MC_report_crash(int status);
102
103 #ifdef __cplusplus
104
105 namespace simgrid {
106 namespace mc {
107
108 XBT_PRIVATE void find_object_address(
109   std::vector<simgrid::xbt::VmMap> const& maps, simgrid::mc::ObjectInformation* result);
110
111 }
112 }
113
114 #endif
115
116 SG_END_DECL()
117
118 #endif