Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Disable mmalloc when !HAVE_MC.
[simgrid.git] / src / mc / mc_checkpoint.c
index 49e12af..d80a004 100644 (file)
@@ -163,7 +163,7 @@ static void MC_resolve_subtype(mc_object_info_t info, dw_type_t type) {
   // Try to find a more complete description of the type:
   // We need to fix in order to support C++.
 
-  dw_type_t subtype = xbt_dict_get_or_null(info->types_by_name, type->subtype->name);
+  dw_type_t subtype = xbt_dict_get_or_null(info->full_types_by_name, type->subtype->name);
   if(subtype!=NULL) {
     type->subtype = subtype;
   }
@@ -475,6 +475,22 @@ void* mc_translate_address(uintptr_t addr, mc_snapshot_t snapshot) {
   return (void*) addr;
 }
 
+uintptr_t mc_untranslate_address(void* addr, mc_snapshot_t snapshot) {
+  if(!snapshot) {
+    return (uintptr_t) addr;
+  }
+
+  for(size_t i=0; i!=NB_REGIONS; ++i) {
+    mc_mem_region_t region = snapshot->regions[i];
+    if(addr>=region->data && addr<=(void*)(((char*)region->data)+region->size)) {
+      size_t offset = (size_t) ((char*) addr - (char*) region->data);
+      return ((uintptr_t) region->start_addr) + offset;
+    }
+  }
+
+  return (uintptr_t) addr;
+}
+
 mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
   return MC_take_snapshot(1);
 }