Logo AND Algorithmique Numérique Distribuée

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