xbt_mheap_t mmalloc_set_current_heap(xbt_mheap_t new_heap);
xbt_mheap_t mmalloc_get_current_heap(void);
-int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2);
-int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2);
-int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t to_ignore1, xbt_dynar_t to_ignore2);
-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, mc_type_t type, int pointer_level);
-void reset_heap_information(void);
-
size_t mmalloc_get_bytes_used(xbt_mheap_t);
ssize_t mmalloc_get_busy_size(xbt_mheap_t, void *ptr);
--- /dev/null
+/* Copyright (c) 2010-2016. 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. */
+
+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+ This file was then part of the GNU C Library. */
+
+#ifndef SIMGRID_MC_MALLOC_HPP
+#define SIMGRID_MC_MALLOC_HPP
+
+#include <vector>
+
+#include <xbt/dynar.h>
+#include <xbt/mmalloc.h>
+
+#include "src/mc/mc_forward.hpp"
+#include "src/mc/Process.hpp"
+
+namespace simgrid {
+namespace mc {
+
+XBT_PRIVATE int mmalloc_compare_heap(Snapshot* snapshot1, Snapshot* snapshot2);
+XBT_PRIVATE int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2);
+XBT_PRIVATE int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2,
+ std::vector<simgrid::mc::IgnoredHeapRegion>* i1,
+ std::vector<simgrid::mc::IgnoredHeapRegion>* i2);
+XBT_PRIVATE int compare_heap_area(
+ int process_index, const void *area1, const void* area2,
+ Snapshot* snapshot1, Snapshot* snapshot2,
+ xbt_dynar_t previous, Type* type, int pointer_level);
+XBT_PRIVATE void reset_heap_information(void);
+
+}
+}
+
+#endif
#include "src/mc/mc_private.h"
#include "src/mc/mc_smx.h"
#include "src/mc/mc_dwarf.hpp"
-
+#include "src/mc/malloc.hpp"
#include "src/mc/Frame.hpp"
#include "src/mc/ObjectInformation.hpp"
#include "src/mc/Variable.hpp"
&& addr_pointed2 < mc_snapshot_get_heap_end(snapshot2)))
return 1;
// The pointers are both in the heap:
- return compare_heap_area(process_index, addr_pointed1, addr_pointed2, snapshot1,
+ return simgrid::mc::compare_heap_area(process_index, addr_pointed1, addr_pointed2, snapshot1,
snapshot2, nullptr, type->subtype, pointer_level);
}
alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
remote(process->heap_address),
simgrid::mc::ProcessIndexMissing, simgrid::mc::ReadOptions::lazy());
- res_init = init_heap_information(heap1, heap2, &s1->to_ignore, &s2->to_ignore);
+ res_init = simgrid::mc::init_heap_information(heap1, heap2, &s1->to_ignore, &s2->to_ignore);
if (res_init == -1) {
#ifdef MC_DEBUG
XBT_DEBUG("(%d - %d) Different heap information", num1, num2);
num2, cursor + 1);
#endif
- reset_heap_information();
+ simgrid::mc::reset_heap_information();
return 1;
#endif
}
/* Compare heap */
- if (mmalloc_compare_heap(s1, s2) > 0) {
+ if (simgrid::mc::mmalloc_compare_heap(s1, s2) > 0) {
#ifdef MC_DEBUG
XBT_DEBUG("(%d - %d) Different heap (mmalloc_compare)", num1, num2);
#endif
}
- reset_heap_information();
+ simgrid::mc::reset_heap_information();
#ifdef MC_VERBOSE
if (errors || hash_result)
#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"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_diff, xbt,
"Logging specific to mc_diff in mc");
-extern "C" {
-
/*********************************** Heap comparison ***********************************/
/***************************************************************************************/
-typedef char *type_name;
-
struct XBT_PRIVATE s_mc_diff {
s_xbt_mheap_t std_heap_copy;
std::size_t heaplimit;
return 0;
}
-}
+namespace simgrid {
+namespace mc {
int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2,
std::vector<simgrid::mc::IgnoredHeapRegion>* i1,
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()
{
#endif
}
+}
SG_END_DECL()
-XBT_PRIVATE int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2,
- std::vector<simgrid::mc::IgnoredHeapRegion>* i1,
- std::vector<simgrid::mc::IgnoredHeapRegion>* i2);
-
#endif
src/mc/mc_mmalloc.h
src/mc/mc_liveness.h
src/mc/LocationList.hpp
+ src/mc/malloc.hpp
src/mc/LocationList.cpp
src/mc/mc_liveness.cpp
src/mc/mc_record.cpp