From 4f0b473db654af3da6cc609b6d94b5b6d9652c4c Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Thu, 7 May 2015 12:33:52 +0200 Subject: [PATCH] [mc] Mark many MC symbols as hidden Some of them cannot be hidden because they are used in the unit tests. --- include/xbt/misc.h | 8 ++++++- src/mc/mc_base.h | 6 ++++- src/mc/mc_client.h | 12 +++++----- src/mc/mc_comm_pattern.h | 26 ++++++++++----------- src/mc/mc_dwarf.cpp | 1 + src/mc/mc_ignore.h | 4 ++-- src/mc/mc_liveness.h | 20 ++++++++-------- src/mc/mc_location.h | 21 +++++++++-------- src/mc/mc_memory_map.h | 4 ++-- src/mc/mc_mmu.h | 5 ++-- src/mc/mc_object_info.h | 34 +++++++++++++-------------- src/mc/mc_private.h | 50 ++++++++++++++++++++-------------------- src/mc/mc_process.h | 42 ++++++++++++++++++--------------- src/mc/mc_protocol.h | 12 +++++----- src/mc/mc_record.h | 12 +++++----- src/mc/mc_request.h | 16 ++++++------- src/mc/mc_safety.h | 10 ++++---- src/mc/mc_server.h | 6 ++--- src/mc/mc_smx.h | 20 ++++++++-------- src/mc/mc_snapshot.h | 31 ++++++++++++++----------- src/mc/mc_state.h | 22 +++++++++--------- src/mc/mc_unw.h | 8 +++---- src/mc/mcer_ignore.h | 8 +++---- 23 files changed, 199 insertions(+), 179 deletions(-) diff --git a/include/xbt/misc.h b/include/xbt/misc.h index a0620abe54..9bd9b24380 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -202,6 +202,12 @@ #endif +#ifdef _XBT_WIN32 +#define XBT_INTERNAL +#else +#define XBT_INTERNAL __attribute__((visibility ("hidden"))) +#endif + #if !defined (max) && !defined(__cplusplus) # define max(a,b) (((a) > (b)) ? (a) : (b)) #endif @@ -236,7 +242,7 @@ SG_BEGIN_DECL() XBT_PUBLIC_DATA(int) xbt_pagesize; /** Cache the number of bits of addresses inside a given page, log2(xbt_pagesize). */ - XBT_PUBLIC_DATA(int) xbt_pagebits; +XBT_PUBLIC_DATA(int) xbt_pagebits; XBT_PUBLIC(const char *) xbt_procname(void); diff --git a/src/mc/mc_base.h b/src/mc/mc_base.h index d972c52b40..c3a63c1bf1 100644 --- a/src/mc/mc_base.h +++ b/src/mc/mc_base.h @@ -13,6 +13,10 @@ #include "internal_config.h" #include "../simix/smx_private.h" +// Marker for symbols which should be defined as XBT_PRIVATE but are used in +// unit tests: +#define MC_SHOULD_BE_INTERNAL + SG_BEGIN_DECL() /** Check if the given simcall can be resolved @@ -35,7 +39,7 @@ int MC_request_is_visible(smx_simcall_t req); */ void MC_wait_for_requests(void); -extern double *mc_time; +XBT_INTERNAL extern double *mc_time; SG_END_DECL() diff --git a/src/mc/mc_client.h b/src/mc/mc_client.h index 6e1bdb5f02..c919dc8428 100644 --- a/src/mc/mc_client.h +++ b/src/mc/mc_client.h @@ -17,13 +17,13 @@ typedef struct s_mc_client { int fd; } s_mc_client_t, *mc_client_t; -extern mc_client_t mc_client; +extern XBT_INTERNAL mc_client_t mc_client; -void MC_client_init(void); -void MC_client_hello(void); -void MC_client_handle_messages(void); -void MC_client_send_message(void* message, size_t size); -void MC_client_send_simple_message(e_mc_message_type type); +XBT_INTERNAL void MC_client_init(void); +XBT_INTERNAL void MC_client_hello(void); +XBT_INTERNAL void MC_client_handle_messages(void); +XBT_INTERNAL void MC_client_send_message(void* message, size_t size); +XBT_INTERNAL void MC_client_send_simple_message(e_mc_message_type type); #ifdef HAVE_MC void MC_ignore(void* addr, size_t size); diff --git a/src/mc/mc_comm_pattern.h b/src/mc/mc_comm_pattern.h index 3a4a0a6d01..0f503928ef 100644 --- a/src/mc/mc_comm_pattern.h +++ b/src/mc/mc_comm_pattern.h @@ -43,12 +43,12 @@ typedef struct s_mc_list_comm_pattern{ /** * Type: `xbt_dynar_t` */ -extern xbt_dynar_t initial_communications_pattern; +extern XBT_INTERNAL xbt_dynar_t initial_communications_pattern; /** * Type: `xbt_dynar_t>` */ -extern xbt_dynar_t incomplete_communications_pattern; +extern XBT_INTERNAL xbt_dynar_t incomplete_communications_pattern; typedef enum { MC_CALL_TYPE_NONE, @@ -85,22 +85,22 @@ static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req) } } -void MC_get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking); -void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking); -void MC_comm_pattern_free_voidp(void *p); -void MC_list_comm_pattern_free_voidp(void *p); -void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigned int issuer, int backtracking); +XBT_INTERNAL void MC_get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking); +XBT_INTERNAL void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking); +XBT_INTERNAL void MC_comm_pattern_free_voidp(void *p); +XBT_INTERNAL void MC_list_comm_pattern_free_voidp(void *p); +XBT_INTERNAL void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigned int issuer, int backtracking); void MC_modelcheck_comm_determinism(void); -void MC_restore_communications_pattern(mc_state_t state); +XBT_INTERNAL void MC_restore_communications_pattern(mc_state_t state); -mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm); -xbt_dynar_t MC_comm_patterns_dup(xbt_dynar_t state); +XBT_INTERNAL mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm); +XBT_INTERNAL xbt_dynar_t MC_comm_patterns_dup(xbt_dynar_t state); -void MC_state_copy_incomplete_communications_pattern(mc_state_t state); -void MC_state_copy_index_communications_pattern(mc_state_t state); +XBT_INTERNAL void MC_state_copy_incomplete_communications_pattern(mc_state_t state); +XBT_INTERNAL void MC_state_copy_index_communications_pattern(mc_state_t state); -void MC_comm_pattern_free(mc_comm_pattern_t p); +XBT_INTERNAL void MC_comm_pattern_free(mc_comm_pattern_t p); SG_END_DECL() diff --git a/src/mc/mc_dwarf.cpp b/src/mc/mc_dwarf.cpp index 4af3c2552a..7c1bcd4942 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/mc_dwarf.cpp @@ -120,6 +120,7 @@ const char *MC_dwarf_attrname(int attr) * \param tag tag code (see the DWARF specification) * \return name of the tag */ +XBT_INTERNAL const char *MC_dwarf_tagname(int tag) { switch (tag) { diff --git a/src/mc/mc_ignore.h b/src/mc/mc_ignore.h index 3edc7eaa1d..b5ac593ae6 100644 --- a/src/mc/mc_ignore.h +++ b/src/mc/mc_ignore.h @@ -12,8 +12,8 @@ SG_BEGIN_DECL(); -void MC_stack_area_add(stack_region_t stack_area); +XBT_INTERNAL void MC_stack_area_add(stack_region_t stack_area); -xbt_dynar_t MC_checkpoint_ignore_new(void); +XBT_INTERNAL xbt_dynar_t MC_checkpoint_ignore_new(void); SG_END_DECL(); diff --git a/src/mc/mc_liveness.h b/src/mc/mc_liveness.h index fa5a246b1e..f7edd2e8f4 100644 --- a/src/mc/mc_liveness.h +++ b/src/mc/mc_liveness.h @@ -17,7 +17,7 @@ SG_BEGIN_DECL() -extern xbt_automaton_t _mc_property_automaton; +extern XBT_INTERNAL xbt_automaton_t _mc_property_automaton; typedef struct s_mc_pair{ int num; @@ -44,18 +44,18 @@ typedef struct s_mc_visited_pair{ int visited_removed; } s_mc_visited_pair_t, *mc_visited_pair_t; -mc_pair_t MC_pair_new(void); -void MC_pair_delete(mc_pair_t); -void mc_pair_free_voidp(void *p); -mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state); -void MC_visited_pair_delete(mc_visited_pair_t p); +XBT_INTERNAL mc_pair_t MC_pair_new(void); +XBT_INTERNAL void MC_pair_delete(mc_pair_t); +XBT_INTERNAL void mc_pair_free_voidp(void *p); +XBT_INTERNAL mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state); +XBT_INTERNAL void MC_visited_pair_delete(mc_visited_pair_t p); void MC_modelcheck_liveness(void); -void MC_show_stack_liveness(xbt_fifo_t stack); -void MC_dump_stack_liveness(xbt_fifo_t stack); +XBT_INTERNAL void MC_show_stack_liveness(xbt_fifo_t stack); +XBT_INTERNAL void MC_dump_stack_liveness(xbt_fifo_t stack); -extern xbt_dynar_t visited_pairs; -int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair); +XBT_INTERNAL extern xbt_dynar_t visited_pairs; +XBT_INTERNAL int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair); SG_END_DECL() diff --git a/src/mc/mc_location.h b/src/mc/mc_location.h index 4f07cb8562..88841f2226 100644 --- a/src/mc/mc_location.h +++ b/src/mc/mc_location.h @@ -14,6 +14,7 @@ #include #include +#include "mc_base.h" #include "mc_forward.h" #include "mc_object_info.h" #include "mc_forward.h" @@ -76,16 +77,16 @@ enum mc_location_type mc_get_location_type(mc_location_t location) { } } -void mc_dwarf_resolve_location(mc_location_t location, mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_address_space_t address_space, int process_index); -void mc_dwarf_resolve_locations(mc_location_t location, mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_address_space_t address_space, int process_index); +XBT_INTERNAL void mc_dwarf_resolve_location(mc_location_t location, mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_address_space_t address_space, int process_index); +MC_SHOULD_BE_INTERNAL void mc_dwarf_resolve_locations(mc_location_t location, mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_address_space_t address_space, int process_index); -void mc_dwarf_expression_clear(mc_expression_t expression); -void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops); +XBT_INTERNAL void mc_dwarf_expression_clear(mc_expression_t expression); +XBT_INTERNAL void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops); -void mc_dwarf_location_list_clear(mc_location_list_t list); +XBT_INTERNAL void mc_dwarf_location_list_clear(mc_location_list_t list); -void mc_dwarf_location_list_init_from_expression(mc_location_list_t target, size_t len, Dwarf_Op* ops); -void mc_dwarf_location_list_init(mc_location_list_t target, mc_object_info_t info, Dwarf_Die* die, Dwarf_Attribute* attr); +XBT_INTERNAL void mc_dwarf_location_list_init_from_expression(mc_location_list_t target, size_t len, Dwarf_Op* ops); +XBT_INTERNAL void mc_dwarf_location_list_init(mc_location_list_t target, mc_object_info_t info, Dwarf_Die* die, Dwarf_Attribute* attr); #define MC_EXPRESSION_STACK_SIZE 64 @@ -108,9 +109,11 @@ typedef struct s_mc_expression_state { int process_index; } s_mc_expression_state_t, *mc_expression_state_t; -int mc_dwarf_execute_expression(size_t n, const Dwarf_Op* ops, mc_expression_state_t state); +MC_SHOULD_BE_INTERNAL int mc_dwarf_execute_expression( + size_t n, const Dwarf_Op* ops, mc_expression_state_t state); -void* mc_find_frame_base(dw_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor); +MC_SHOULD_BE_INTERNAL void* mc_find_frame_base( + dw_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor); SG_END_DECL() diff --git a/src/mc/mc_memory_map.h b/src/mc/mc_memory_map.h index 12da85f89c..425d6d6cf9 100644 --- a/src/mc/mc_memory_map.h +++ b/src/mc/mc_memory_map.h @@ -41,8 +41,8 @@ struct s_memory_map { }; -memory_map_t MC_get_memory_map(pid_t pid); -void MC_free_memory_map(memory_map_t map); +XBT_INTERNAL memory_map_t MC_get_memory_map(pid_t pid); +XBT_INTERNAL void MC_free_memory_map(memory_map_t map); SG_END_DECL() diff --git a/src/mc/mc_mmu.h b/src/mc/mc_mmu.h index 1fa7423f35..71870e7487 100644 --- a/src/mc/mc_mmu.h +++ b/src/mc/mc_mmu.h @@ -10,13 +10,12 @@ #include #include +#include + #include SG_BEGIN_DECL() -extern int xbt_pagesize; -extern int xbt_pagebits; - /** @brief How many memory pages are necessary to store size bytes? * * @param size Byte size diff --git a/src/mc/mc_object_info.h b/src/mc/mc_object_info.h index bb5814b375..749c3e87b1 100644 --- a/src/mc/mc_object_info.h +++ b/src/mc/mc_object_info.h @@ -47,9 +47,9 @@ struct s_dw_type { dw_type_t full_type; // The same (but more complete) type }; -void dw_type_free(dw_type_t t); -void dw_variable_free(dw_variable_t v); -void dw_variable_free_voidp(void *t); +XBT_INTERNAL void dw_type_free(dw_type_t t); +XBT_INTERNAL void dw_variable_free(dw_variable_t v); +XBT_INTERNAL void dw_variable_free_voidp(void *t); // ***** Object info @@ -102,26 +102,26 @@ bool MC_object_info_is_privatized(mc_object_info_t info) * + \text{dwarf address}\f$. * */ -void* MC_object_base_address(mc_object_info_t info); +XBT_INTERNAL void* MC_object_base_address(mc_object_info_t info); -mc_object_info_t MC_new_object_info(void); -mc_object_info_t MC_find_object_info(memory_map_t maps, const char* name, int executable); -void MC_free_object_info(mc_object_info_t* p); +XBT_INTERNAL mc_object_info_t MC_new_object_info(void); +XBT_INTERNAL mc_object_info_t MC_find_object_info(memory_map_t maps, const char* name, int executable); +XBT_INTERNAL void MC_free_object_info(mc_object_info_t* p); -dw_frame_t MC_file_object_info_find_function(mc_object_info_t info, const void *ip); -dw_variable_t MC_file_object_info_find_variable_by_name(mc_object_info_t info, const char* name); +XBT_INTERNAL dw_frame_t MC_file_object_info_find_function(mc_object_info_t info, const void *ip); +MC_SHOULD_BE_INTERNAL dw_variable_t MC_file_object_info_find_variable_by_name(mc_object_info_t info, const char* name); -void MC_post_process_object_info(mc_process_t process, mc_object_info_t info); +XBT_INTERNAL void MC_post_process_object_info(mc_process_t process, mc_object_info_t info); -void MC_dwarf_get_variables(mc_object_info_t info); -void MC_dwarf_get_variables_libdw(mc_object_info_t info); -const char* MC_dwarf_attrname(int attr); -const char* MC_dwarf_tagname(int tag); +XBT_INTERNAL void MC_dwarf_get_variables(mc_object_info_t info); +XBT_INTERNAL void MC_dwarf_get_variables_libdw(mc_object_info_t info); +XBT_INTERNAL const char* MC_dwarf_attrname(int attr); +XBT_INTERNAL const char* MC_dwarf_tagname(int tag); // Not used: -char* get_type_description(mc_object_info_t info, char *type_name); +XBT_INTERNAL char* get_type_description(mc_object_info_t info, char *type_name); -void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_address_space_t snapshot, int process_index); +XBT_INTERNAL void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_address_space_t snapshot, int process_index); struct s_dw_variable{ Dwarf_Off dwarf_offset; /* Global offset of the field. */ @@ -157,7 +157,7 @@ struct s_mc_function_index_item { dw_frame_t function; }; -void mc_frame_free(dw_frame_t freme); +XBT_INTERNAL void mc_frame_free(dw_frame_t freme); SG_END_DECL() diff --git a/src/mc/mc_private.h b/src/mc/mc_private.h index c9ea7c2599..b5e564b180 100644 --- a/src/mc/mc_private.h +++ b/src/mc/mc_private.h @@ -50,28 +50,28 @@ typedef struct s_mc_function_index_item s_mc_function_index_item_t, *mc_function */ void MC_init_model_checker(pid_t pid, int socket); -extern FILE *dot_output; -extern const char* colors[13]; -extern xbt_parmap_t parmap; +XBT_INTERNAL extern FILE *dot_output; +XBT_INTERNAL extern const char* colors[13]; +XBT_INTERNAL extern xbt_parmap_t parmap; -extern int user_max_depth_reached; +XBT_INTERNAL extern int user_max_depth_reached; -int MC_deadlock_check(void); -void MC_replay(xbt_fifo_t stack); -void MC_replay_liveness(xbt_fifo_t stack); -void MC_show_deadlock(smx_simcall_t req); -void MC_show_stack_safety(xbt_fifo_t stack); -void MC_dump_stack_safety(xbt_fifo_t stack); -void MC_show_non_termination(void); +XBT_INTERNAL int MC_deadlock_check(void); +XBT_INTERNAL void MC_replay(xbt_fifo_t stack); +XBT_INTERNAL void MC_replay_liveness(xbt_fifo_t stack); +XBT_INTERNAL void MC_show_deadlock(smx_simcall_t req); +XBT_INTERNAL void MC_show_stack_safety(xbt_fifo_t stack); +XBT_INTERNAL void MC_dump_stack_safety(xbt_fifo_t stack); +XBT_INTERNAL void MC_show_non_termination(void); /** Stack (of `mc_state_t`) representing the current position of the * the MC in the exploration graph * * It is managed by its head (`xbt_fifo_shift` and `xbt_fifo_unshift`). */ -extern xbt_fifo_t mc_stack; +XBT_INTERNAL extern xbt_fifo_t mc_stack; -int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max); +XBT_INTERNAL int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max); /****************************** Statistics ************************************/ @@ -85,9 +85,9 @@ typedef struct mc_stats { unsigned long executed_transitions; } s_mc_stats_t, *mc_stats_t; -extern mc_stats_t mc_stats; +XBT_INTERNAL extern mc_stats_t mc_stats; -void MC_print_statistics(mc_stats_t stats); +XBT_INTERNAL void MC_print_statistics(mc_stats_t stats); /********************************** Snapshot comparison **********************************/ @@ -100,18 +100,18 @@ typedef struct s_mc_comparison_times{ double stacks_comparison_time; }s_mc_comparison_times_t, *mc_comparison_times_t; -extern __thread mc_comparison_times_t mc_comp_times; -extern __thread double mc_snapshot_comparison_time; +extern XBT_INTERNAL __thread mc_comparison_times_t mc_comp_times; +extern XBT_INTERNAL __thread double mc_snapshot_comparison_time; -int snapshot_compare(void *state1, void *state2); -void print_comparison_times(void); +XBT_INTERNAL int snapshot_compare(void *state1, void *state2); +XBT_INTERNAL void print_comparison_times(void); //#define MC_DEBUG 1 #define MC_VERBOSE 1 /********************************** Variables with DWARF **********************************/ -void MC_find_object_address(memory_map_t maps, mc_object_info_t result); +XBT_INTERNAL void MC_find_object_address(memory_map_t maps, mc_object_info_t result); /********************************** Miscellaneous **********************************/ @@ -122,7 +122,7 @@ typedef struct s_local_variable{ dw_type_t type; void *address; int region; -}s_local_variable_t, *local_variable_t; +} s_local_variable_t, *local_variable_t; /* *********** Hash *********** */ @@ -131,7 +131,7 @@ typedef struct s_local_variable{ * \param stacks stacks (mc_snapshot_stak_t) used fot the stack unwinding informations * \result resulting hash * */ -uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks); +XBT_INTERNAL uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks); /** @brief Dump the stacks of the application processes * @@ -140,11 +140,11 @@ uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks); * * Does not work when an application thread is running. */ -void MC_dump_stacks(FILE* file); +XBT_INTERNAL void MC_dump_stacks(FILE* file); -void MC_report_assertion_error(void); +XBT_INTERNAL void MC_report_assertion_error(void); -void MC_invalidate_cache(void); +XBT_INTERNAL void MC_invalidate_cache(void); SG_END_DECL() diff --git a/src/mc/mc_process.h b/src/mc/mc_process.h index 4aadece4ff..666d5f3b21 100644 --- a/src/mc/mc_process.h +++ b/src/mc/mc_process.h @@ -24,6 +24,7 @@ #include "simix/smx_private.h" #include "mc_forward.h" +#include "mc_base.h" #include "mc_mmalloc.h" // std_heap #include "mc_memory_map.h" #include "mc_address_space.h" @@ -122,24 +123,24 @@ struct s_mc_process { xbt_dynar_t checkpoint_ignore; }; -bool MC_is_process(mc_address_space_t p); +XBT_INTERNAL bool MC_is_process(mc_address_space_t p); -void MC_process_init(mc_process_t process, pid_t pid, int sockfd); -void MC_process_clear(mc_process_t process); +MC_SHOULD_BE_INTERNAL void MC_process_init(mc_process_t process, pid_t pid, int sockfd); +XBT_INTERNAL void MC_process_clear(mc_process_t process); /** Refresh the information about the process * * Do not use direclty, this is used by the getters when appropriate * in order to have fresh data. */ -void MC_process_refresh_heap(mc_process_t process); +XBT_INTERNAL void MC_process_refresh_heap(mc_process_t process); /** Refresh the information about the process * * Do not use direclty, this is used by the getters when appropriate * in order to have fresh data. * */ -void MC_process_refresh_malloc_info(mc_process_t process); +XBT_INTERNAL void MC_process_refresh_malloc_info(mc_process_t process); static inline bool MC_process_is_self(mc_process_t process) @@ -156,17 +157,18 @@ bool MC_process_is_self(mc_process_t process) * @param remote target process memory address (source) * @param len data size */ -const void* MC_process_read(mc_process_t process, +XBT_INTERNAL const void* MC_process_read(mc_process_t process, adress_space_read_flags_t flags, void* local, const void* remote, size_t len, int process_index); // Simplified versions/wrappers (whould be moved in mc_address_space): -const void* MC_process_read_simple(mc_process_t process, +XBT_INTERNAL const void* MC_process_read_simple(mc_process_t process, void* local, const void* remote, size_t len); -const void* MC_process_read_dynar_element(mc_process_t process, +XBT_INTERNAL const void* MC_process_read_dynar_element(mc_process_t process, void* local, const void* remote_dynar, size_t i, size_t len); -unsigned long MC_process_read_dynar_length(mc_process_t process, const void* remote_dynar); +XBT_INTERNAL unsigned long MC_process_read_dynar_length(mc_process_t process, + const void* remote_dynar); /** Write data to a process memory * @@ -175,20 +177,22 @@ unsigned long MC_process_read_dynar_length(mc_process_t process, const void* rem * @param remote target process memory address (target) * @param len data size */ -void MC_process_write(mc_process_t process, const void* local, void* remote, size_t len); +XBT_INTERNAL void MC_process_write(mc_process_t process, + const void* local, void* remote, size_t len); -void MC_process_clear_memory(mc_process_t process, void* remote, size_t len); +XBT_INTERNAL void MC_process_clear_memory(mc_process_t process, + void* remote, size_t len); /* Functions, variables of the process: */ -mc_object_info_t MC_process_find_object_info(mc_process_t process, const void* addr); -mc_object_info_t MC_process_find_object_info_exec(mc_process_t process, const void* addr); -mc_object_info_t MC_process_find_object_info_rw(mc_process_t process, const void* addr); +XBT_INTERNAL mc_object_info_t MC_process_find_object_info(mc_process_t process, const void* addr); +XBT_INTERNAL mc_object_info_t MC_process_find_object_info_exec(mc_process_t process, const void* addr); +XBT_INTERNAL mc_object_info_t MC_process_find_object_info_rw(mc_process_t process, const void* addr); -dw_frame_t MC_process_find_function(mc_process_t process, const void* ip); +XBT_INTERNAL dw_frame_t MC_process_find_function(mc_process_t process, const void* ip); -void MC_process_read_variable(mc_process_t process, const char* name, void* target, size_t size); -char* MC_process_read_string(mc_process_t, void* address); +XBT_INTERNAL void MC_process_read_variable(mc_process_t process, const char* name, void* target, size_t size); +XBT_INTERNAL char* MC_process_read_string(mc_process_t, void* address); static inline xbt_mheap_t MC_process_get_heap(mc_process_t process) { @@ -206,9 +210,9 @@ static inline malloc_info* MC_process_get_malloc_info(mc_process_t process) /** Find (one occurence of) the named variable definition */ -dw_variable_t MC_process_find_variable_by_name(mc_process_t process, const char* name); +XBT_INTERNAL dw_variable_t MC_process_find_variable_by_name(mc_process_t process, const char* name); -void MC_invalidate_cache(void); +XBT_INTERNAL void MC_invalidate_cache(void); SG_END_DECL() diff --git a/src/mc/mc_protocol.h b/src/mc/mc_protocol.h index 722c71d080..38c053cf82 100644 --- a/src/mc/mc_protocol.h +++ b/src/mc/mc_protocol.h @@ -103,13 +103,13 @@ typedef struct s_mc_register_symbol_message { void* data; } s_mc_register_symbol_message_t, * mc_register_symbol_message_t; -int MC_protocol_send(int socket, void* message, size_t size); -int MC_protocol_send_simple_message(int socket, e_mc_message_type type); -int MC_protocol_hello(int socket); -ssize_t MC_receive_message(int socket, void* message, size_t size, int options); +XBT_INTERNAL int MC_protocol_send(int socket, void* message, size_t size); +XBT_INTERNAL int MC_protocol_send_simple_message(int socket, e_mc_message_type type); +XBT_INTERNAL int MC_protocol_hello(int socket); +XBT_INTERNAL ssize_t MC_receive_message(int socket, void* message, size_t size, int options); -const char* MC_message_type_name(e_mc_message_type type); -const char* MC_mode_name(e_mc_mode_t mode); +XBT_INTERNAL const char* MC_message_type_name(e_mc_message_type type); +XBT_INTERNAL const char* MC_mode_name(e_mc_mode_t mode); SG_END_DECL() diff --git a/src/mc/mc_record.h b/src/mc/mc_record.h index 3ea2d77dff..1f7a677b9e 100644 --- a/src/mc/mc_record.h +++ b/src/mc/mc_record.h @@ -47,7 +47,7 @@ typedef struct s_mc_record_item { /** Convert a string representation of the path into a array of `s_mc_record_item_t` */ -xbt_dynar_t MC_record_from_string(const char* data); +XBT_INTERNAL xbt_dynar_t MC_record_from_string(const char* data); /** Generate a string representation * @@ -55,11 +55,11 @@ xbt_dynar_t MC_record_from_string(const char* data); * "pid0,value0;pid2,value2;pid3,value3". The value can be * omitted is it is null. */ -char* MC_record_stack_to_string(xbt_fifo_t stack); +XBT_INTERNAL char* MC_record_stack_to_string(xbt_fifo_t stack); /** Dump the path represented by a given stack in the log */ -void MC_record_dump_path(xbt_fifo_t stack); +XBT_INTERNAL void MC_record_dump_path(xbt_fifo_t stack); // ***** Replay @@ -68,15 +68,15 @@ void MC_record_dump_path(xbt_fifo_t stack); * \param start Array of record item * \item count Number of record items */ -void MC_record_replay(mc_record_item_t start, size_t count); +XBT_INTERNAL void MC_record_replay(mc_record_item_t start, size_t count); /** Replay a path represented by a string * * \param data String representation of the path */ -void MC_record_replay_from_string(const char* data); +XBT_INTERNAL void MC_record_replay_from_string(const char* data); -void MC_record_replay_init(void); +XBT_INTERNAL void MC_record_replay_init(void); SG_END_DECL() diff --git a/src/mc/mc_request.h b/src/mc/mc_request.h index a95ff3526f..33642d45dd 100644 --- a/src/mc/mc_request.h +++ b/src/mc/mc_request.h @@ -19,11 +19,11 @@ typedef enum e_mc_request_type { MC_REQUEST_INTERNAL, } e_mc_request_type_t; -int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2); -char* MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t type); -unsigned int MC_request_testany_fail(smx_simcall_t req); +XBT_INTERNAL int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2); +XBT_INTERNAL char* MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t type); +XBT_INTERNAL unsigned int MC_request_testany_fail(smx_simcall_t req); /*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/ -int MC_request_is_visible(smx_simcall_t req); +XBT_INTERNAL int MC_request_is_visible(smx_simcall_t req); /** Can this requests can be executed. * @@ -32,16 +32,16 @@ int MC_request_is_visible(smx_simcall_t req); * have both a source and a destination yet is not enabled * (unless timeout is enabled in the wait and enabeld in SimGridMC). */ -int MC_request_is_enabled(smx_simcall_t req); -int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx); +XBT_INTERNAL int MC_request_is_enabled(smx_simcall_t req); +XBT_INTERNAL int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx); /** Is the process ready to execute its simcall? * * This is true if the request associated with the process is ready. */ -int MC_process_is_enabled(smx_process_t process); +XBT_INTERNAL int MC_process_is_enabled(smx_process_t process); -char *MC_request_get_dot_output(smx_simcall_t req, int value); +XBT_INTERNAL char *MC_request_get_dot_output(smx_simcall_t req, int value); SG_END_DECL() diff --git a/src/mc/mc_safety.h b/src/mc/mc_safety.h index 0c82769f2c..00e4a0f559 100644 --- a/src/mc/mc_safety.h +++ b/src/mc/mc_safety.h @@ -22,7 +22,7 @@ typedef enum { e_mc_reduce_dpor } e_mc_reduce_t; -extern e_mc_reduce_t mc_reduce_kind; +extern XBT_INTERNAL e_mc_reduce_t mc_reduce_kind; void MC_modelcheck_safety(void); @@ -34,10 +34,10 @@ typedef struct s_mc_visited_state{ int other_num; // dot_output for }s_mc_visited_state_t, *mc_visited_state_t; -extern xbt_dynar_t visited_states; -mc_visited_state_t is_visited_state(mc_state_t graph_state); -void visited_state_free(mc_visited_state_t state); -void visited_state_free_voidp(void *s); +extern XBT_INTERNAL xbt_dynar_t visited_states; +XBT_INTERNAL mc_visited_state_t is_visited_state(mc_state_t graph_state); +XBT_INTERNAL void visited_state_free(mc_visited_state_t state); +XBT_INTERNAL void visited_state_free_voidp(void *s); SG_END_DECL() diff --git a/src/mc/mc_server.h b/src/mc/mc_server.h index e07d6e6230..a6fc2f8c50 100644 --- a/src/mc/mc_server.h +++ b/src/mc/mc_server.h @@ -27,10 +27,10 @@ typedef struct s_mc_server s_mc_server_t, *mc_server_t; extern mc_server_t mc_server; -void MC_server_wait_client(mc_process_t process); -void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value); +XBT_INTERNAL void MC_server_wait_client(mc_process_t process); +XBT_INTERNAL void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value); -void MC_server_loop(mc_server_t server); +XBT_INTERNAL void MC_server_loop(mc_server_t server); SG_END_DECL() diff --git a/src/mc/mc_smx.h b/src/mc/mc_smx.h index 32b78cc569..510bd2aab7 100644 --- a/src/mc/mc_smx.h +++ b/src/mc/mc_smx.h @@ -49,9 +49,9 @@ struct s_mc_smx_process_info { char* name; }; -xbt_dynar_t MC_smx_process_info_list_new(void); +XBT_INTERNAL xbt_dynar_t MC_smx_process_info_list_new(void); -void MC_process_smx_refresh(mc_process_t process); +XBT_INTERNAL void MC_process_smx_refresh(mc_process_t process); /** Get the issuer of a simcall (`req->issuer`) * @@ -62,10 +62,10 @@ void MC_process_smx_refresh(mc_process_t process); * @param process the MCed process * @param req the simcall (copied in the local process) */ -smx_process_t MC_smx_simcall_get_issuer(smx_simcall_t req); +XBT_INTERNAL smx_process_t MC_smx_simcall_get_issuer(smx_simcall_t req); -const char* MC_smx_process_get_name(smx_process_t p); -const char* MC_smx_process_get_host_name(smx_process_t p); +XBT_INTERNAL const char* MC_smx_process_get_name(smx_process_t p); +XBT_INTERNAL const char* MC_smx_process_get_host_name(smx_process_t p); #define MC_EACH_SIMIX_PROCESS(process, code) \ if (mc_mode == MC_MODE_CLIENT) { \ @@ -83,20 +83,20 @@ const char* MC_smx_process_get_host_name(smx_process_t p); } /** Execute a given simcall */ -void MC_simcall_handle(smx_simcall_t req, int value); +XBT_INTERNAL void MC_simcall_handle(smx_simcall_t req, int value); -int MC_smpi_process_count(void); +XBT_INTERNAL int MC_smpi_process_count(void); /* ***** Resolve (local/MCer structure from remote/MCed addresses) ***** */ /** Get a local copy of the process from the process remote address */ -smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address); +XBT_INTERNAL smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address); /** Get the process info structure from the process remote address */ -mc_smx_process_info_t MC_smx_resolve_process_info(smx_process_t process_remote_address); +XBT_INTERNAL mc_smx_process_info_t MC_smx_resolve_process_info(smx_process_t process_remote_address); -unsigned long MC_smx_get_maxpid(void); +XBT_INTERNAL unsigned long MC_smx_get_maxpid(void); SG_END_DECL() diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h index e01ac4e108..4d93f1c002 100644 --- a/src/mc/mc_snapshot.h +++ b/src/mc/mc_snapshot.h @@ -97,10 +97,10 @@ struct s_mc_mem_region { }; -mc_mem_region_t mc_region_new_sparse( +MC_SHOULD_BE_INTERNAL mc_mem_region_t mc_region_new_sparse( mc_region_type_t type, void *start_addr, void* data_addr, size_t size); -void MC_region_destroy(mc_mem_region_t reg); -void mc_region_restore_sparse(mc_process_t process, mc_mem_region_t reg); +MC_SHOULD_BE_INTERNAL void MC_region_destroy(mc_mem_region_t reg); +XBT_INTERNAL void mc_region_restore_sparse(mc_process_t process, mc_mem_region_t reg); static inline __attribute__ ((always_inline)) bool mc_region_contain(mc_mem_region_t region, const void* p) @@ -119,7 +119,8 @@ void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region) return (char*) snapshot_page + mc_page_offset((void*) addr); } -mc_mem_region_t mc_get_snapshot_region(const void* addr, mc_snapshot_t snapshot, int process_index); +XBT_INTERNAL mc_mem_region_t mc_get_snapshot_region( + const void* addr, mc_snapshot_t snapshot, int process_index); /** \brief Translate a pointer from process address space to snapshot address space * @@ -264,25 +265,27 @@ typedef struct s_mc_checkpoint_ignore_region{ static const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot); -mc_snapshot_t MC_take_snapshot(int num_state); -void MC_restore_snapshot(mc_snapshot_t); -void MC_free_snapshot(mc_snapshot_t); +XBT_INTERNAL mc_snapshot_t MC_take_snapshot(int num_state); +XBT_INTERNAL void MC_restore_snapshot(mc_snapshot_t); +XBT_INTERNAL void MC_free_snapshot(mc_snapshot_t); -size_t* mc_take_page_snapshot_region(mc_process_t process, +XBT_INTERNAL size_t* mc_take_page_snapshot_region(mc_process_t process, void* data, size_t page_count); -void mc_free_page_snapshot_region(size_t* pagenos, size_t page_count); -void mc_restore_page_snapshot_region( +XBT_INTERNAL void mc_free_page_snapshot_region(size_t* pagenos, size_t page_count); +XBT_INTERNAL void mc_restore_page_snapshot_region( mc_process_t process, void* start_addr, size_t page_count, size_t* pagenos); -const void* MC_region_read_fragmented(mc_mem_region_t region, void* target, const void* addr, size_t size); +MC_SHOULD_BE_INTERNAL const void* MC_region_read_fragmented( + mc_mem_region_t region, void* target, const void* addr, size_t size); -const void* MC_snapshot_read(mc_snapshot_t snapshot, adress_space_read_flags_t flags, +XBT_INTERNAL const void* MC_snapshot_read(mc_snapshot_t snapshot, + adress_space_read_flags_t flags, void* target, const void* addr, size_t size, int process_index); -int MC_snapshot_region_memcmp( +MC_SHOULD_BE_INTERNAL int MC_snapshot_region_memcmp( const void* addr1, mc_mem_region_t region1, const void* addr2, mc_mem_region_t region2, size_t size); -int MC_snapshot_memcmp( +XBT_INTERNAL int MC_snapshot_memcmp( const void* addr1, mc_snapshot_t snapshot1, const void* addr2, mc_snapshot_t snapshot2, int process_index, size_t size); diff --git a/src/mc/mc_state.h b/src/mc/mc_state.h index a60464b58d..f44ac485ab 100644 --- a/src/mc/mc_state.h +++ b/src/mc/mc_state.h @@ -13,7 +13,7 @@ SG_BEGIN_DECL() -extern mc_global_t initial_global_state; +extern XBT_INTERNAL mc_global_t initial_global_state; /* Possible exploration status of a process in a state */ typedef enum { @@ -52,16 +52,16 @@ typedef struct mc_state { xbt_dynar_t index_comm; // comm determinism verification } s_mc_state_t, *mc_state_t; -mc_state_t MC_state_new(void); -void MC_state_delete(mc_state_t state, int free_snapshot); -void MC_state_interleave_process(mc_state_t state, smx_process_t process); -unsigned int MC_state_interleave_size(mc_state_t state); -int MC_state_process_is_done(mc_state_t state, smx_process_t process); -void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value); -smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value); -smx_simcall_t MC_state_get_internal_request(mc_state_t state); -smx_simcall_t MC_state_get_request(mc_state_t state, int *value); -void MC_state_remove_interleave_process(mc_state_t state, smx_process_t process); +XBT_INTERNAL mc_state_t MC_state_new(void); +XBT_INTERNAL void MC_state_delete(mc_state_t state, int free_snapshot); +XBT_INTERNAL void MC_state_interleave_process(mc_state_t state, smx_process_t process); +XBT_INTERNAL unsigned int MC_state_interleave_size(mc_state_t state); +XBT_INTERNAL int MC_state_process_is_done(mc_state_t state, smx_process_t process); +XBT_INTERNAL void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value); +XBT_INTERNAL smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value); +XBT_INTERNAL smx_simcall_t MC_state_get_internal_request(mc_state_t state); +XBT_INTERNAL smx_simcall_t MC_state_get_request(mc_state_t state, int *value); +XBT_INTERNAL void MC_state_remove_interleave_process(mc_state_t state, smx_process_t process); SG_END_DECL() diff --git a/src/mc/mc_unw.h b/src/mc/mc_unw.h index 267c850ca8..8e87c84896 100644 --- a/src/mc/mc_unw.h +++ b/src/mc/mc_unw.h @@ -53,7 +53,7 @@ extern unw_accessors_t mc_unw_vmread_accessors; * * It works with the `s_mc_unw_context_t` context. */ -extern unw_accessors_t mc_unw_accessors; +extern XBT_INTERNAL unw_accessors_t mc_unw_accessors; // ***** Libunwind context @@ -66,16 +66,16 @@ typedef struct s_mc_unw_context { } s_mc_unw_context_t, *mc_unw_context_t; /** Initialises an already allocated context */ -int mc_unw_init_context( +XBT_INTERNAL int mc_unw_init_context( mc_unw_context_t context, mc_process_t process, unw_context_t* c); /** Destroys (but not not `free`) a context */ -int mc_unw_destroy_context(mc_unw_context_t context); +XBT_INTERNAL int mc_unw_destroy_context(mc_unw_context_t context); // ***** Libunwind cursor /** Initialises a `libunwind` cursor */ -int mc_unw_init_cursor(unw_cursor_t *cursor, mc_unw_context_t context); +XBT_INTERNAL int mc_unw_init_cursor(unw_cursor_t *cursor, mc_unw_context_t context); SG_END_DECL() diff --git a/src/mc/mcer_ignore.h b/src/mc/mcer_ignore.h index 104bc8f24f..1c56b62ab6 100644 --- a/src/mc/mcer_ignore.h +++ b/src/mc/mcer_ignore.h @@ -12,9 +12,9 @@ SG_BEGIN_DECL(); -void MCer_ignore_global_variable(const char *var_name); -void MC_heap_region_ignore_insert(mc_heap_ignore_region_t region); -void MC_heap_region_ignore_remove(void *address, size_t size); -void MC_process_ignore_memory(mc_process_t process, void *addr, size_t size); +XBT_INTERNAL void MCer_ignore_global_variable(const char *var_name); +XBT_INTERNAL void MC_heap_region_ignore_insert(mc_heap_ignore_region_t region); +XBT_INTERNAL void MC_heap_region_ignore_remove(void *address, size_t size); +XBT_INTERNAL void MC_process_ignore_memory(mc_process_t process, void *addr, size_t size); SG_END_DECL(); -- 2.20.1