Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix mc_snapshot_get_heap_end() for per-page snapshots
[simgrid.git] / src / mc / mc_private.h
index 9d07e71..ea4746a 100644 (file)
@@ -125,12 +125,7 @@ typedef struct s_mc_checkpoint_ignore_region{
 
 SG_BEGIN_DECL()
 
-inline static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) {
-  if(snapshot==NULL)
-    xbt_die("snapshot is NULL");
-  xbt_mheap_t heap = (xbt_mheap_t)snapshot->regions[0]->data;
-  return heap->breakval;
-}
+static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot);
 
 mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall);
 mc_snapshot_t MC_take_snapshot(int num_state);
@@ -149,6 +144,7 @@ void mc_softdirty_reset();
 
 typedef struct s_mc_pages_store s_mc_pages_store_t, * mc_pages_store_t;
 mc_pages_store_t mc_pages_store_new();
+const void* mc_page_store_get_page(mc_pages_store_t page_store, size_t pageno);
 
 static inline bool mc_snapshot_region_linear(mc_mem_region_t region) {
   return !region || !region->data;
@@ -160,11 +156,7 @@ int mc_snapshot_memcp(
   void* addr1, mc_snapshot_t snapshot1,
   void* addr2, mc_snapshot_t snapshot2, size_t size);
 
-static inline void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot)
-{
-  void* res;
-  return *(void**) mc_snapshot_read(addr, snapshot, &res, sizeof(void*));
-}
+static void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot);
 
 /** @brief State of the model-checker (global variables for the model checker)
  *
@@ -200,18 +192,6 @@ void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region);
  * */
 void* mc_translate_address(uintptr_t addr, mc_snapshot_t snapshot);
 
-/** \brief Translate a pointer from the snapshot address space to the application address space
- *
- *  This is the inverse of mc_translate_address.
- *
- *  Does not work for per-page snapshot, we change the logic to handle this.
- *
- * \param addr    Address in the snapshot address space
- * \param snapsot Snapshot of interest (if NULL no translation is done)
- * \return        Translated address in the application address space
- */
-uintptr_t mc_untranslate_address(void* addr, mc_snapshot_t snapshot);
-
 extern xbt_dynar_t mc_checkpoint_ignore;
 
 /********************************* MC Global **********************************/
@@ -547,7 +527,6 @@ struct s_dw_type{
 };
 
 void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_snapshot_t snapshot);
-void* mc_member_snapshot_resolve(const void* base, dw_type_t type, dw_type_t member, mc_snapshot_t snapshot);
 
 typedef struct s_dw_variable{
   Dwarf_Off dwarf_offset; /* Global offset of the field. */
@@ -688,6 +667,21 @@ bool mc_address_test(mc_address_set_t p, const void* value);
  * */
 uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks);
 
+//
+
+inline static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) {
+  if(snapshot==NULL)
+      xbt_die("snapshot is NULL");
+  char* addr = (char*) std_heap + offsetof(struct mdesc, breakval);
+  return mc_snapshot_read_pointer(addr, snapshot);
+}
+
+static inline void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot)
+{
+  void* res;
+  return *(void**) mc_snapshot_read(addr, snapshot, &res, sizeof(void*));
+}
+
 SG_END_DECL()
 
 #endif