1 /* Copyright (c) 2007-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. */
7 #ifndef SIMGRID_MC_PRIVATE_H
8 #define SIMGRID_MC_PRIVATE_H
10 #include <sys/types.h>
12 #include "simgrid_config.h"
19 #include <elfutils/libdw.h>
22 #include "src/mc/mc_base.h"
23 #include "mc/datatypes.h"
25 #include "xbt/config.h"
28 #include "src/xbt/memory_map.hpp"
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"
42 #include "src/mc/mc_forward.hpp"
45 #include "src/mc/mc_protocol.h"
49 typedef struct s_mc_function_index_item s_mc_function_index_item_t, *mc_function_index_item_t;
51 /********************************* MC Global **********************************/
53 XBT_PRIVATE void MC_init_dot_output();
55 XBT_PRIVATE extern FILE *dot_output;
56 XBT_PRIVATE extern const char* colors[13];
57 XBT_PRIVATE extern xbt_parmap_t parmap;
59 XBT_PRIVATE extern int user_max_depth_reached;
61 XBT_PRIVATE int MC_deadlock_check(void);
62 XBT_PRIVATE void MC_replay(xbt_fifo_t stack);
63 XBT_PRIVATE void MC_replay_liveness(xbt_fifo_t stack);
64 XBT_PRIVATE void MC_show_deadlock(smx_simcall_t req);
65 XBT_PRIVATE void MC_show_stack_safety(xbt_fifo_t stack);
66 XBT_PRIVATE void MC_dump_stack_safety(xbt_fifo_t stack);
67 XBT_PRIVATE void MC_show_non_termination(void);
69 /** Stack (of `mc_state_t`) representing the current position of the
70 * the MC in the exploration graph
72 * It is managed by its head (`xbt_fifo_shift` and `xbt_fifo_unshift`).
74 XBT_PRIVATE extern xbt_fifo_t mc_stack;
76 XBT_PRIVATE int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max);
79 /****************************** Statistics ************************************/
81 typedef struct mc_stats {
82 unsigned long state_size;
83 unsigned long visited_states;
84 unsigned long visited_pairs;
85 unsigned long expanded_states;
86 unsigned long expanded_pairs;
87 unsigned long executed_transitions;
88 } s_mc_stats_t, *mc_stats_t;
90 XBT_PRIVATE extern mc_stats_t mc_stats;
92 XBT_PRIVATE void MC_print_statistics(mc_stats_t stats);
94 /********************************** Snapshot comparison **********************************/
96 XBT_PRIVATE int snapshot_compare(void *state1, void *state2);
101 /********************************** Miscellaneous **********************************/
103 XBT_PRIVATE void MC_report_assertion_error(void);
104 XBT_PRIVATE void MC_report_crash(int status);
111 XBT_PRIVATE void find_object_address(
112 std::vector<simgrid::xbt::VmMap> const& maps, simgrid::mc::ObjectInformation* result);