X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6bc71102f9c6ad0e9bb98c6a8c08f3556b636d3d..1bdbe2db10271b1d1948e1ee0382abcfe622a991:/src/mc/mc_diff.cpp diff --git a/src/mc/mc_diff.cpp b/src/mc/mc_diff.cpp index f7e1e8eb1a..f0d0896d4f 100644 --- a/src/mc/mc_diff.cpp +++ b/src/mc/mc_diff.cpp @@ -11,6 +11,7 @@ #include "mc/mc.h" #include "xbt/mmalloc.h" #include "mc/datatypes.h" +#include "src/mc/malloc.hpp" #include "src/mc/mc_private.h" #include "src/mc/mc_snapshot.h" #include "src/mc/mc_dwarf.hpp" @@ -18,16 +19,12 @@ using simgrid::mc::remote; -extern "C" { - XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_diff, xbt, "Logging specific to mc_diff in mc"); /*********************************** Heap comparison ***********************************/ /***************************************************************************************/ -typedef char *type_name; - struct XBT_PRIVATE s_mc_diff { s_xbt_mheap_t std_heap_copy; std::size_t heaplimit; @@ -218,7 +215,8 @@ static int equal_fragments(struct s_mc_diff *state, int b1, int f1, int b2, return 0; } -} +namespace simgrid { +namespace mc { int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, std::vector* i1, @@ -275,16 +273,14 @@ int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, memset(state->equals_to2, 0, state->heaplimit * MAX_FRAGMENT_PER_BLOCK * sizeof(s_heap_area_t)); memset(state->types1, 0, - state->heaplimit * MAX_FRAGMENT_PER_BLOCK * sizeof(type_name *)); + state->heaplimit * MAX_FRAGMENT_PER_BLOCK * sizeof(char**)); memset(state->types2, 0, - state->heaplimit * MAX_FRAGMENT_PER_BLOCK * sizeof(type_name *)); + state->heaplimit * MAX_FRAGMENT_PER_BLOCK * sizeof(char**)); return 0; } -extern "C" { - void reset_heap_information() { @@ -292,7 +288,7 @@ void reset_heap_information() // TODO, have a robust way to find it in O(1) static inline -mc_mem_region_t MC_get_heap_region(mc_snapshot_t snapshot) +mc_mem_region_t MC_get_heap_region(simgrid::mc::Snapshot* snapshot) { size_t n = snapshot->snapshot_regions.size(); for (size_t i=0; i!=n; ++i) { @@ -303,7 +299,7 @@ mc_mem_region_t MC_get_heap_region(mc_snapshot_t snapshot) xbt_die("No heap region"); } -int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) +int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot* snapshot2) { simgrid::mc::Process* process = &mc_model_checker->process(); struct s_mc_diff *state = mc_diff_info; @@ -657,8 +653,8 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) */ static int compare_heap_area_without_type(struct s_mc_diff *state, int process_index, const void *real_area1, const void *real_area2, - mc_snapshot_t snapshot1, - mc_snapshot_t snapshot2, + simgrid::mc::Snapshot* snapshot1, + simgrid::mc::Snapshot* snapshot2, xbt_dynar_t previous, int size, int check_ignore) { @@ -746,8 +742,8 @@ static int compare_heap_area_without_type(struct s_mc_diff *state, int process_i */ static int compare_heap_area_with_type(struct s_mc_diff *state, int process_index, const void *real_area1, const void *real_area2, - mc_snapshot_t snapshot1, - mc_snapshot_t snapshot2, + simgrid::mc::Snapshot* snapshot1, + simgrid::mc::Snapshot* snapshot2, xbt_dynar_t previous, simgrid::mc::Type* type, int area_size, int check_ignore, int pointer_level) @@ -955,7 +951,7 @@ top: */ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::Type* type, int offset, int area_size, - mc_snapshot_t snapshot, int process_index) + simgrid::mc::Snapshot* snapshot, int process_index) { // Beginning of the block, the infered variable type if the type of the block: @@ -1009,8 +1005,8 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc:: * @param pointer_level * @return 0 (same), 1 (different), -1 */ -int compare_heap_area(int process_index, const void *area1, const void *area2, mc_snapshot_t snapshot1, - mc_snapshot_t snapshot2, xbt_dynar_t previous, +int compare_heap_area(int process_index, const void *area1, const void *area2, simgrid::mc::Snapshot* snapshot1, + simgrid::mc::Snapshot* snapshot2, xbt_dynar_t previous, simgrid::mc::Type* type, int pointer_level) { simgrid::mc::Process* process = &mc_model_checker->process(); @@ -1589,3 +1585,4 @@ int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2) #endif } +}