src/mc/mc_memory_map.h
src/mc/memory_map.c
src/mc/mc_client.c
+ src/mc/mc_client_api.c
src/mc/mc_client.h
src/mc/mc_protocol.h
src/mc/mc_protocol.c
SG_BEGIN_DECL()
+/** Replay path (if any) in string representation
+ *
+ * This is a path as generated by `MC_record_stack_to_string()`.
+ */
+XBT_PUBLIC_DATA(char*) MC_record_path;
+
+/** Whether the replay mode is enabled */
+static inline bool MC_record_replay_is_active(void) {
+ return MC_record_path;
+}
+
XBT_PUBLIC(int) MC_random(int min, int max);
#ifdef HAVE_MC
#endif
-/** Replay path (if any) in string representation
- *
- * This is a path as generated by `MC_record_stack_to_string()`.
- */
-XBT_PUBLIC_DATA(char*) MC_record_path;
-
-/** Whether the replay mode is enabled */
-static inline bool MC_record_replay_is_active(void) {
- return MC_record_path;
-}
-
SG_END_DECL()
#endif /* SIMGRID_MODELCHECKER_H */
{
return MC_take_snapshot(1);
}
-
-void *MC_snapshot(void)
-{
- return simcall_mc_snapshot();
-}
}
}
}
-
-void MC_ignore(void* addr, size_t size)
-{
- if (mc_mode == MC_MODE_CLIENT) {
- s_mc_ignore_memory_message_t message;
- message.type = MC_MESSAGE_IGNORE_MEMORY;
- message.addr = addr;
- message.size = size;
- MC_client_send_message(&message, sizeof(message));
- }
-
- // TODO, remove this once the migration has been completed
- int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
- MC_SET_MC_HEAP;
- MC_process_ignore_memory(&mc_model_checker->process, addr, size);
- if (!raw_mem_set)
- MC_SET_STD_HEAP;
-}
--- /dev/null
+/* Copyright (c) 2008-2015. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <xbt/log.h>
+#include <xbt/fifo.h>
+#include <xbt/sysdep.h>
+#include <simgrid/modelchecker.h>
+
+#include "mc_record.h"
+#include "mc_private.h"
+#include "mc_mmalloc.h"
+#include "mc_model_checker.h"
+#include "mc_ignore.h"
+#include "mc_protocol.h"
+#include "mc_client.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client_api, mc,
+ "Public API for the model-checked application");
+
+void MC_assert(int prop)
+{
+ if (MC_is_active() && !prop) {
+ XBT_INFO("**************************");
+ XBT_INFO("*** PROPERTY NOT VALID ***");
+ XBT_INFO("**************************");
+ XBT_INFO("Counter-example execution trace:");
+ MC_record_dump_path(mc_stack);
+ MC_dump_stack_safety(mc_stack);
+ MC_print_statistics(mc_stats);
+ xbt_abort();
+ }
+}
+
+// TODO, MC_automaton_new_propositional_symbol
+
+void *MC_snapshot(void)
+{
+ return simcall_mc_snapshot();
+}
+
+int simcall_HANDLER_mc_compare_snapshots(smx_simcall_t simcall,
+ mc_snapshot_t s1, mc_snapshot_t s2)
+{
+ return snapshot_compare(s1, s2);
+}
+
+int MC_compare_snapshots(void *s1, void *s2)
+{
+ return simcall_mc_compare_snapshots(s1, s2);
+}
+
+void MC_cut(void)
+{
+ user_max_depth_reached = 1;
+}
+
+void MC_ignore(void* addr, size_t size)
+{
+ if (mc_mode == MC_MODE_CLIENT) {
+ s_mc_ignore_memory_message_t message;
+ message.type = MC_MESSAGE_IGNORE_MEMORY;
+ message.addr = addr;
+ message.size = size;
+ MC_client_send_message(&message, sizeof(message));
+ }
+
+ // TODO, remove this once the migration has been completed
+ int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
+ MC_SET_MC_HEAP;
+ MC_process_ignore_memory(&mc_model_checker->process, addr, size);
+ if (!raw_mem_set)
+ MC_SET_STD_HEAP;
+}
XBT_DEBUG("- Stacks : %f", mc_comp_times->stacks_comparison_time);
}
-/**************************** MC snapshot compare simcall **************************/
-/***********************************************************************************/
-
-int simcall_HANDLER_mc_compare_snapshots(smx_simcall_t simcall,
- mc_snapshot_t s1, mc_snapshot_t s2)
-{
- return snapshot_compare(s1, s2);
-}
-
-int MC_compare_snapshots(void *s1, void *s2)
-{
-
- return simcall_mc_compare_snapshots(s1, s2);
-
-}
-
}
mmalloc_set_current_heap(previous_heap);
}
-void MC_assert(int prop)
-{
- if (MC_is_active() && !prop) {
- XBT_INFO("**************************");
- XBT_INFO("*** PROPERTY NOT VALID ***");
- XBT_INFO("**************************");
- XBT_INFO("Counter-example execution trace:");
- MC_record_dump_path(mc_stack);
- MC_dump_stack_safety(mc_stack);
- MC_print_statistics(mc_stats);
- xbt_abort();
- }
-}
-
-void MC_cut(void)
-{
- user_max_depth_reached = 1;
-}
-
void MC_automaton_load(const char *file)
{