Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorpaul bedaride <paul.bedaride@gmail.com>
Thu, 11 Oct 2012 15:43:41 +0000 (17:43 +0200)
committerpaul bedaride <paul.bedaride@gmail.com>
Thu, 11 Oct 2012 15:43:41 +0000 (17:43 +0200)
31 files changed:
ChangeLog
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/Option.cmake
buildtools/pipol/rc.fedora
examples/msg/pmm/pmm.tesh
examples/smpi/MM/CMakeLists.txt
examples/smpi/MM/MM_mpi.c
examples/smpi/MM/param.c [deleted file]
examples/smpi/MM/param.h [deleted file]
examples/smpi/MM/param_template_file.txt [deleted file]
examples/smpi/MM/topo.c [deleted file]
examples/smpi/MM/topo.h [deleted file]
include/simgrid_config.h.in
include/xbt/misc.h
include/xbt/sysdep.h
src/include/surf/maxmin.h
src/include/surf/random_mgr.h
src/instr/jedule/jedule_sd_binding.c
src/mc/mc_checkpoint.c
src/simix/smx_user.c
src/smpi/smpi_bench.c
src/surf/random_mgr.c
src/surf/surf.c
src/surf/surf_config.c
src/surf/surf_routing.c
src/surf/surf_routing_generic.c
src/xbt/mallocator.c
src/xbt/mmalloc/mm_legacy.c
src/xbt/xbt_rl_time.c
testsuite/surf/maxmin_bench.c
testsuite/surf/trace_usage.c

index fe1d304..de39bdf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    and LDFLAGS.
  * Enable tracing by default. This modules rocks you should use it.
  * Use default cmake things to detect lua instead of home grown ones.
+ * New option "enable_mallocators" to disable mallocators, for debugging
+   purpose ("on" by default).
 
  Documentation:
  * Split the doc into a user guide and a reference guide.
@@ -22,7 +24,7 @@ SimGrid (3.8) NOT RELEASED; urgency=low
  * Make it impossible to link against the wrong version of the lib
  * Bug fixes that made the host (and link) failures unusable.
  * Add a way to auto-restart process when the host in which they are
-   executing comes back (ON_FAILURE="RESTART" on deployment file, 
+   executing comes back (ON_FAILURE="RESTART" on deployment file,
    MSG_process_auto_restart_set).
  * Use the "msg_" prefix for all datatypes (instead of m_, msg_ and MSG_),
    please stop using the old ones, they are DEPRECATED.
@@ -53,9 +55,9 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    communication_amount structures is now done seamlessly thanks to the chosen
    assumptions.
  * New function SD_workstation_dump to display various information
- * New function SD_task_set_rate to throttle the bandwidth allowed to be used 
-   by a SD_TASK_COMM_E2E typed task. This rate depends on both the nominal 
-   bandwidth on the route onto which the task is  scheduled and the amount of 
+ * New function SD_task_set_rate to throttle the bandwidth allowed to be used
+   by a SD_TASK_COMM_E2E typed task. This rate depends on both the nominal
+   bandwidth on the route onto which the task is  scheduled and the amount of
    data to transfer.
    To divide the nominal bandwidth by 2, the rate then has to be :
                      rate = bandwidth/(2*amount)
@@ -63,14 +65,14 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    (from their beginning)
  * Increasing source code coverage (src/simdag is now covered at 95.8%
    on average)
-   
+
  SMPI:
  * Re-implement time-independent trace replay using SMPI (at the
    smpi_smp_* level) instead of MSG. This should replace
    examples/msg/actions/actions.c
  * Implement the exchange of non-contiguous data.
    [Khalid Hasanov & Jean-Noel Quintin] Thanks for the patch, guys.
-   
+
  XBT:
  * Functions xbt_dict_hash() and xbt_dict_hash_ext() are made public,
    and renamed to xbt_str_hash() and xbt_str_hash_ext().
index 0162d0a..5f1d02e 100644 (file)
@@ -197,6 +197,12 @@ else(enable_latency_bound_tracking)
   endif(enable_gtnets)
 endif(enable_latency_bound_tracking)
 
+if(enable_mallocators)
+  SET(MALLOCATOR_IS_WANTED 1)
+else(enable_mallocators)
+  SET(MALLOCATOR_IS_WANTED 0)
+endif(enable_mallocators)
+
 if(enable_model-checking AND HAVE_MMAP)
   SET(HAVE_MC 1)
   SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
index 0cdc764..9a66066 100644 (file)
@@ -26,6 +26,7 @@ option(enable_tracing "Tracing simulations for visualization." on)
 option(enable_latency_bound_tracking "" off)
 option(enable_coverage "Enable coverage." off)
 option(enable_memcheck "Enable memcheck." off)
+option(enable_mallocators "Enable mallocators (for debugging purpose)." on)
 option(enable_print_message "Enable print message during config." off)
 option(enable_model-checking "Turn this on to experiment with our prototype of model-checker (hinders the simulation's performance even if turned of at runtime)" off)
 option(enable_lib_static "" off)
index ca2119a..8088a64 100644 (file)
@@ -17,7 +17,7 @@ sudo yum -y -q install f2c
 sudo yum -y -q install pcre-devel pcre-static
 sudo yum -y -q install git-core
 sudo yum -y -q install ruby ruby-devel
-sudo yum -y -q install libunwind
+sudo yum -y -q install libunwind libunwind-devel
 
 which_svn=`which svn`          #svn necessary
 which_gcc=`which gcc`          #gcc gcc necessary
index 93ac619..ad275da 100644 (file)
@@ -2,7 +2,7 @@
 
 p Testing the Parallel Matrix Multiplication 
 
-! timeout 15
+! timeout 60
 $ ./pmm/msg_pmm --log=msg_pmm.thres:verbose --log=no_loc ${srcdir:=.}/../platforms/cluster.xml ${srcdir:=.}/pmm/pmm_9_deploy.xml
 > [c-0.me:node:(1) 0.000000] [msg_pmm/VERBOSE] Create job 0
 > [c-0.me:node:(1) 0.000000] [msg_pmm/VERBOSE] Create job 1
index 190a4c5..86bc8d6 100644 (file)
@@ -7,7 +7,7 @@ if(enable_smpi)
 
   include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
 
-add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c topo.c param.c Matrix_init.c)
+add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c Matrix_init.c)
 
 ### Add definitions for compile
 if(NOT WIN32)
index 6ff27c0..df0b9bc 100644 (file)
@@ -4,8 +4,6 @@
  */
 
 
-#include "topo.h"
-#include "param.h"
 #include "Matrix_init.h"
 #include "2.5D_MM.h"
 #include "xbt/log.h"
@@ -68,12 +66,11 @@ int main(int argc, char ** argv)
   while(loop==1);
 #endif
 
-  int opt, display = 0;
-  char *conf_file = NULL;
+  int opt = 0;
   optind = 1;
 
   //get the parameter from command line
-  while ((opt = getopt(argc, argv, "hdf:r:c:M:N:K:B:G:g:k:P:")) != -1) {
+  while ((opt = getopt(argc, argv, "hr:c:M:N:K:B:G:g:k:P:")) != -1) {
     switch(opt) {
       case 'h':
         XBT_INFO(
@@ -87,8 +84,6 @@ int main(int argc, char ** argv)
                     "  -k I    group rank(default: %zu)\n"
                     "  -r I    processor row size (default: %zu)\n"
                     "  -c I    processor col size (default: %zu)\n"
-                    " -f {Filename} provide the file with the configuration\n"
-                    "  -d  display the configuration file on the stderr\n"
                     "  -h      help\n",
                     m, n, k, Block_size, NB_groups, group, key, row, col);
         return 0;
@@ -122,40 +117,9 @@ int main(int argc, char ** argv)
         /*case 'P':
           str_mask = strdup(optarg);
           break;*/
-      case 'f':
-        conf_file = strdup(optarg);
-        break;
-      case 'd':
-        display = 1;
-        break;
     }
   }
-  if( display == 1 ){
-    print_conf(MPI_COMM_WORLD, myrank,NULL,NULL);
-    MPI_Barrier(MPI_COMM_WORLD);
-    MPI_Finalize();
-    exit(0);
-  }
 
-  char **conf;
-  //char ***conf_all;
-  if(conf_file == NULL){
-    conf = get_conf(MPI_COMM_WORLD, "default_conf", -1);
-  }else{
-    conf = get_conf(MPI_COMM_WORLD, conf_file, -1);
-    //conf_all = get_conf_all(conf_file);
-  }
-  if(conf == NULL){
-        XBT_INFO(
-                "No configuration for me inside the file\n");
-  }else{
-
-
-    if(NB_groups !=1){
-      /* Get my group number from the config file */
-      group = (size_t)atoi(conf[4]);
-    }
-  }
 
 
 
diff --git a/examples/smpi/MM/param.c b/examples/smpi/MM/param.c
deleted file mode 100644 (file)
index 0d932fb..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*!
- * get the parameter specific to the process from a file
- *
- */
-
-#include "topo.h"
-#include "param.h"
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(MM_param,
-                             "Messages specific for this msg example");
-
-int match(const char *s, char p);
-char** get_list_param(const char* input);
-int match(const char *s, char p)
-{
-  int c = 0;
-  while (*s != '\0') {
-    if (strncmp(s++, &p, 1)) continue;
-    c++;
-  }
-  return c;
-}
-
-char** get_list_param(const char* input){
-  if(input==NULL) return NULL;
-  char *line = strdup(input);
-  int size = match(line, ' ');
-  char **list_param = malloc(size*sizeof(char*));
-  char *pch = strtok (line," \t\n");
-  int i = 0;
-  while (pch != NULL)
-  {
-    if(strcmp(pch,"") != 0 ) {
-      list_param[i] = pch;
-      i++;
-    }
-    pch = strtok (NULL, " \t\n");
-  }
-  return list_param;
-}
-
-char** get_conf(MPI_Comm comm, const char * filename, int mynoderank)
-{
-  if(filename == NULL) return NULL;
-  if(mynoderank == -1){
-    MPI_Comm comm_node;
-    split_comm_intra_node(comm, &comm_node, -1);
-    MPI_Comm_rank ( comm_node, &mynoderank );
-    MPI_Comm_free(&comm_node);
-  }
-  char name[MPI_MAX_PROCESSOR_NAME];
-  int len;
-  MPI_Get_processor_name(name, &len);
-  FILE* conf;
-  conf = fopen(filename, "r");
-  if (conf == NULL) {
-    XBT_DEBUG(
-              "Try to open the configuration file %s\n", filename);
-    perror("fopen");
-    return NULL;
-  }
-  char *machine_name = NULL;
-  size_t number = 0;
-  int err = 1;
-  int index = -1;
-
-
-  /* Try to find the line correponding to this processor */
-  while((err = getdelim(&machine_name, &number, ' ', conf)) != -1) {
-    while(err == 1){
-      err = getdelim(&machine_name, &number, ' ', conf);
-    }
-    if(err == -1) break;
-    XBT_DEBUG(
-              "read: %s cmp to %s\n", machine_name, name);
-    /* the first element is in machine_name
-       it's normally a processor name */
-    /* remove the delimiter before doing the comparison*/
-    machine_name[strlen(machine_name)-1] = 0;
-
-    if(strcmp(machine_name,name) == 0){
-      /* the machine name match */
-
-      /* try to get for which process with the index*/
-      char* char_index=NULL;
-      err = getdelim(&char_index, &number, ' ', conf);
-      while(err == 1){
-        err = getdelim(&char_index, &number, ' ', conf);
-      }
-      if(err == -1) break;
-
-      index=atoi(char_index);
-      XBT_DEBUG(
-                "read: %d cmp to %d\n",
-                index, mynoderank);
-
-      if(index == mynoderank){
-        /* we have found the good line
-         * we rebuild the line to get every information*/
-        char* line = NULL;
-        number = 0;
-        if (getline(&line,&number,conf) == -1)
-          xbt_die("Cannot get line");
-        char* line1 = NULL;
-        asprintf(&line1,"%s %s %s",name,char_index,line);
-        return get_list_param(line1);
-      }
-    }
-
-    /*prepare for the next line*/
-    free(machine_name);
-    machine_name = NULL;
-    number = 0;
-    err = getline(&machine_name, &number,  conf);
-    if (err >= 1) {
-      free(machine_name);
-      machine_name = NULL;
-      number = 0;
-    }
-
-  }
-  XBT_DEBUG(
-            "No configuration for %s %d\n", name, mynoderank );
-  return NULL;
-}
-
-
-
-
-void print_conf(MPI_Comm comm, int rank, FILE* file, char * default_options){
-  char name[MPI_MAX_PROCESSOR_NAME];
-  int len;
-  MPI_Get_processor_name(name, &len);
-  if(file == NULL) file = stdout;
-
-  MPI_Comm comm_node;
-  split_comm_intra_node(comm, &comm_node, 0);
-
-  char ** names = get_names(comm);
-  int* index = get_index( comm,  comm_node);
-  MPI_Comm_free(&comm_node);
-  int size;
-  MPI_Comm_size(comm, &size);
-  int i=0;
-  if(rank == 0){
-    fprintf(file, "#processor_name index USER ARGS (like the cpu binding ...)\n");
-    for(i = 0; i < size; i++){
-      if(default_options != NULL)
-        fprintf(file, "%s %d %s\n", names[i],index[i],default_options);
-      else
-        fprintf(file, "%s %d\n", names[i],index[i]);
-    }
-  }
-  free(names);
-  free(index);
-  return;
-}
diff --git a/examples/smpi/MM/param.h b/examples/smpi/MM/param.h
deleted file mode 100644 (file)
index d6c2bf8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef param_H_
-#define param_H_
-
-#include <stdio.h>
-
-/*!
- * \page param Provide specific parameters to some processes
- * List of functions:
- * - get_conf - reads a file and returns the specific parameters for the process
- * - print_conf - prints the file for the platform used for this execution
- *
- * here an examples of file:
- *
- * \include utils/param_template_file.txt
- *
- * each process will get the list of arguments specific to its.
- *
- * for example, the process 3<sup>th</sup> on the node1 will receive a pointer
- * on an array of char*:
- *
- *
- *  "node1" "2" "node1_arg21" "node1_arg22" "node1_arg2"
- */
-
-/*! reads a file and returns the specific parameters for the process */
-char** get_conf(MPI_Comm comm, const char * filename, int mynoderank);
-
-
-/*! prints the file for the platform used for this execution */
-void print_conf(MPI_Comm comm, int rank, FILE* file, char * default_options);
-
-#endif /*param_H_*/
diff --git a/examples/smpi/MM/param_template_file.txt b/examples/smpi/MM/param_template_file.txt
deleted file mode 100644 (file)
index d983d3e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-node1 0 node1_arg01 node1_arg02 node1_arg03
-node1 1 node1_arg11 node1_arg12 node1_arg13
-node1 2 node1_arg21 node1_arg22 node1_arg23
-node1 3 node1_arg31 node1_arg32 node1_arg33
-node2 0 node2_arg01 node2_arg02 node2_arg03
-node2 1 node2_arg11 node2_arg12 node2_arg13
-node3 0 node3_arg01 node3_arg02 node3_arg03
-node3 1 node3_arg11 node3_arg12 node3_arg13
-node3 2 node3_arg21 node3_arg22 node3_arg23
diff --git a/examples/smpi/MM/topo.c b/examples/smpi/MM/topo.c
deleted file mode 100644 (file)
index 2c6d92a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*!
- * get the information of which thread are on the same node
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "topo.h"
-
-int split_comm_intra_node(MPI_Comm comm, MPI_Comm* comm_intra, int key) {
-  // collect processor names
-  char name[MPI_MAX_PROCESSOR_NAME];
-  int len;
-  int size;
-  char** names = get_names(comm);
-  int color = -1;
-  int i = 0;
-
-  MPI_Get_processor_name(name, &len);
-  MPI_Comm_size(comm, &size);
-  while (i < size){
-    if (strcmp(name, names[i]) == 0) {
-      break;
-    }
-    i++;
-  }
-  color = i;
-  free(names);
-  // split the communicator
-  return MPI_Comm_split(comm, color, key, comm_intra);
-}
-
-char** get_names(MPI_Comm comm){
-  char name[MPI_MAX_PROCESSOR_NAME];
-  int len;
-  int size;
-  int i;
-  char** friendly_names;
-  char*  names;
-
-  MPI_Get_processor_name(name, &len);
-  MPI_Comm_size(comm, &size);
-  friendly_names = malloc(sizeof(char*) * size);
-  names          = malloc(sizeof(char) * MPI_MAX_PROCESSOR_NAME * size);
-
-  MPI_Allgather(name, MPI_MAX_PROCESSOR_NAME, MPI_CHAR, names,
-                MPI_MAX_PROCESSOR_NAME, MPI_CHAR, comm);
-
-  for( i = 0; i < size;i++) friendly_names[i] = &names[MPI_MAX_PROCESSOR_NAME * i];
-  return friendly_names;
-}
-
-int* get_index(MPI_Comm comm, MPI_Comm comm_intra){
-  int rank = 0;
-  int size;
-  int* index;
-
-  MPI_Comm_rank(comm_intra, &rank);
-  MPI_Comm_size(comm, &size);
-  index = (int*)malloc(sizeof(int) * size);
-  MPI_Allgather(&rank, 1, MPI_INT, index, 1, MPI_INT, comm);
-  return index;
-}
-
diff --git a/examples/smpi/MM/topo.h b/examples/smpi/MM/topo.h
deleted file mode 100644 (file)
index 06e29e5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef topo_H_
-#define topo_H_
-#include <mpi.h>
-
-/*!
- * \defgroup topo.h
- * file related to the plateform description.
- *
- * provide a communicator between the process on the same node*/
-int split_comm_intra_node(MPI_Comm comm, MPI_Comm* comm_intra, int key);
-
-
-int* get_index(MPI_Comm comm, MPI_Comm comm_intra);
-char** get_names(MPI_Comm comm);
-
-#endif /*topo_H_*/
index a12421b..1c5edc8 100644 (file)
@@ -74,17 +74,14 @@ XBT_PUBLIC(void) sg_version(int *major,int *minor,int *patch);
 @simgrid_need_asprintf@
 @simgrid_need_vasprintf@
 
+#include <stdio.h>  /* FILE, getline if it exists  */
+
 /* Use that config to declare missing elements */
 #ifdef SIMGRID_NEED_GETLINE
 #include <stdlib.h> /* size_t */
-#include <stdio.h>  /* FILE*  */
 XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
-#else
-#ifndef _GNU_SOURCE
-       #define _GNU_SOURCE
-#endif
-#include <stdio.h>
 #endif
+
 #include <stdarg.h>
 
 /* snprintf related functions */
@@ -124,6 +121,9 @@ XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
 /** @} */
 
+/* Whether mallocators should be enabled or not. */
+#define MALLOCATOR_IS_WANTED @MALLOCATOR_IS_WANTED@
+
 /* Define if xbt contexts are based on our threads implementation or not */
 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
 
index 5260bce..529bfc6 100644 (file)
@@ -9,6 +9,11 @@
 #ifndef XBT_MISC_H
 #define XBT_MISC_H
 
+/* Define _GNU_SOURCE for getline, isfinite, etc. */
+#ifndef _GNU_SOURCE
+       #define _GNU_SOURCE
+#endif
+
 /* Attributes are only in recent versions of GCC */
 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
 # define _XBT_GNUC_PRINTF( format_idx, arg_idx )    \
index 4bc927c..536c12d 100644 (file)
 #ifndef _XBT_SYSDEP_H
 #define _XBT_SYSDEP_H
 
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>             /* va_list */
-
 #include "xbt/log.h"
 #include "xbt/misc.h"
 #include "xbt/asserts.h"
 
 #include "simgrid_config.h"
 
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>             /* va_list */
+
 SG_BEGIN_DECL()
 
 /* They live in asserts.h, but need to be declared before this module.
index ba06c74..9fd51c0 100644 (file)
@@ -7,10 +7,10 @@
 #ifndef _SURF_MAXMIN_H
 #define _SURF_MAXMIN_H
 
-#include <math.h>
 #include "portable.h"
 #include "xbt/misc.h"
 #include "surf/datatypes.h"
+#include <math.h>
 
 extern double sg_maxmin_precision;
 #define MAXMIN_PRECISION sg_maxmin_precision
index 3580ab4..ec942d3 100644 (file)
@@ -9,8 +9,6 @@
 
 #include "xbt/heap.h"
 #include "xbt/dict.h"
-#include <stdlib.h>
-#include <math.h>
 
 SG_BEGIN_DECL()
 
index dd3f433..a58226e 100644 (file)
@@ -6,8 +6,6 @@
  */
 
 
-#include <stdio.h>
-
 #include "xbt/asserts.h"
 #include "xbt/dynar.h"
 
@@ -20,6 +18,8 @@
 #include "instr/jedule/jedule_platform.h"
 #include "instr/jedule/jedule_output.h"
 
+#include <stdio.h>
+
 #ifdef HAVE_JEDULE
 
 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
index 1a80fd5..112ffd8 100644 (file)
@@ -86,13 +86,24 @@ void MC_take_snapshot(mc_snapshot_t snapshot)
         if (reg.start_addr == std_heap){ // only save the std heap (and not the raw one)
           MC_snapshot_add_region(snapshot, 0, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
         }
+        i++;
       } else {
         if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
           MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
+          i++;
+          reg = maps->regions[i];
+          while(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize){
+            MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
+            i++;
+            reg = maps->regions[i];
+          }
+        }else{
+          i++;
         } 
       }
+    }else{
+      i++;
     }
-    i++;
   }
 
   free_memory_map(maps);
@@ -108,7 +119,7 @@ void MC_take_snapshot_liveness(mc_snapshot_t snapshot)
   void *heap = NULL;
 
   /* Save the std heap and the writable mapped pages of libsimgrid */
-  while (i < maps->mapsize && nb_reg < 3) {
+  while (i < maps->mapsize) {
     reg = maps->regions[i];
     if ((reg.prot & PROT_WRITE)){
       if (maps->regions[i].pathname == NULL){
@@ -117,16 +128,26 @@ void MC_take_snapshot_liveness(mc_snapshot_t snapshot)
           heap = snapshot->regions[nb_reg]->data;
           nb_reg++;
         }
+        i++;
       } else {
         if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
           MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
-          nb_reg++;
           start_data_libsimgrid = reg.start_addr;
+          nb_reg++;
+          i++;
+          reg = maps->regions[i];
+          while(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize){
+            MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
+            i++;
+            reg = maps->regions[i];
+            nb_reg++;
+          }
         } else {
           if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
             MC_snapshot_add_region(snapshot, 2, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
             nb_reg++;
           }
+          i++;
         }
       }
     }else if ((reg.prot & PROT_READ)){
@@ -140,8 +161,10 @@ void MC_take_snapshot_liveness(mc_snapshot_t snapshot)
           }
         }
       }
+      i++;
+    }else{
+      i++;
     }
-    i++;
   }
 
   snapshot->stacks = take_snapshot_stacks(heap);
@@ -476,8 +499,8 @@ static xbt_strbuff_t get_local_variables_values(void *stack_context, void *heap)
                 //XBT_INFO("Variable : %s - address : NULL", current_variable->name);
                 xbt_strbuff_append(variables, bprintf("%s=NULL\n", current_variable->name));
               }else if(((long)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1,variable_value_t)->value.address) > 0xffffffff) || ((long)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1,variable_value_t)->value.address) < (long)start_text_binary)){
-                //XBT_INFO("Variable : %s - value : %d", current_variable->name, (int)(long long int)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address));
-                xbt_strbuff_append(variables, bprintf("%s=%d\n", current_variable->name, (int)(long long int)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address)));
+                //XBT_INFO("Variable : %s - value : %zd", current_variable->name, (size_t)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address));
+                xbt_strbuff_append(variables, bprintf("%s=%zd\n", current_variable->name, (size_t)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address)));
               }else{
                 //XBT_INFO("Variable : %s - address : %p", current_variable->name, *((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address));  
                 xbt_strbuff_append(variables, bprintf("%s=%p\n", current_variable->name, *((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address)));
index 50b6db4..2ad612d 100644 (file)
@@ -8,16 +8,6 @@
 #include "smx_private.h"
 #include "mc/mc.h"
 #include "xbt/ex.h"
-
-#ifndef _SVID_SOURCE
-#  define _SVID_SOURCE    /* strdup() */
-#endif
-#ifndef _ISOC99_SOURCE
-#  define _ISOC99_SOURCE  /* isfinite() */
-#endif
-#ifndef _ISO_C99_SOURCE
-#  define _ISO_C99_SOURCE /* isfinite() */
-#endif
 #include <math.h>         /* isfinite() */
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
index c3628c8..f3926a7 100644 (file)
@@ -4,7 +4,6 @@
 /* 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 <math.h> // sqrt
 #include "private.h"
 #include "xbt/dict.h"
 #include "xbt/sysdep.h"
@@ -16,6 +15,7 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <math.h> // sqrt
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
index 90326e6..d87ce7b 100644 (file)
@@ -7,6 +7,8 @@
 #include "surf/random_mgr.h"
 #include "xbt/sysdep.h"
 #include "gras_config.h" /*_XBT_WIN32*/
+#include <math.h>
+#include <stdlib.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(random, surf, "Random part of surf");
 
index 19e441e..5fb7317 100644 (file)
@@ -4,8 +4,6 @@
 /* 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 <ctype.h>
-
 #include "surf_private.h"
 #include "xbt/module.h"
 #include "mc/mc.h"
@@ -13,6 +11,8 @@
 #include "surf/surf_resource.h"
 #include "xbt/xbt_os_thread.h"
 
+#include <ctype.h>
+
 XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf,
                                 "Logging specific to SURF (kernel)");
index 4d286c2..8aa63e3 100644 (file)
@@ -6,6 +6,7 @@
 
 /* surf_config: configuration infrastructure for the simulation world       */
 
+#include "xbt/misc.h"
 #include "xbt/config.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
index 8561b86..4aadf20 100644 (file)
@@ -4,14 +4,14 @@
 /* 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 <pcre.h>               /* regular expression library */
-
 #include "simgrid/platf_interface.h"    // platform creation API internal interface
 
 #include "surf_routing_private.h"
 #include "surf/surf_routing.h"
 #include "surf/surfxml_parse_values.h"
 
+#include <pcre.h>               /* regular expression library */
+
 /**
  * @ingroup SURF_build_api
  * @brief A library containing all known workstations
index a3dd35c..6f6d587 100644 (file)
@@ -4,14 +4,14 @@
 /* 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 <pcre.h>               /* regular expression library */
-
 #include "simgrid/platf_interface.h"    // platform creation API internal interface
 
 #include "surf_routing_private.h"
 #include "surf/surf_routing.h"
 #include "surf/surfxml_parse_values.h"
 
+#include <pcre.h>               /* regular expression library */
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
 static int no_bypassroute_declared = 1;
index 285c846..e6753e1 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
 
-
-/* Change to 0 to completely disable mallocators. */
-#define MALLOCATOR_IS_WANTED 1
-
 /* Mallocators and memory mess introduced by model-checking do not mix well
  * together: the mallocator will give standard memory when we are using raw
  * memory (so these blocks are killed on restore) and the contrary (so these
@@ -53,7 +49,8 @@ xbt_mallocator_t xbt_mallocator_new(int size,
   xbt_assert(new_f != NULL && free_f != NULL, "invalid parameter");
 
   m = xbt_new0(s_xbt_mallocator_t, 1);
-  XBT_VERB("Create mallocator %p", m);
+  XBT_VERB("Create mallocator %p (%s)",
+           m, MALLOCATOR_IS_ENABLED ? "enabled" : "disabled");
   m->current_size = 0;
   m->new_f = new_f;
   m->free_f = free_f;
@@ -64,8 +61,6 @@ xbt_mallocator_t xbt_mallocator_new(int size,
     m->max_size = size;
     m->mutex = xbt_os_mutex_init();
   } else {
-    if (!MALLOCATOR_IS_WANTED) /* Warn to avoid to commit debugging settings */
-      XBT_WARN("Mallocator is disabled!");
     m->objects = NULL;
     m->max_size = 0;
     m->mutex = NULL;
index f7d0f71..96610ee 100644 (file)
@@ -69,11 +69,13 @@ void *realloc(void *p, size_t s)
 
 void free(void *p)
 {
-  xbt_mheap_t mdp = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit();
+  if (p != NULL) {
+    xbt_mheap_t mdp = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit();
 
-  LOCK(mdp);
-  mfree(mdp, p);
-  UNLOCK(mdp);
+    LOCK(mdp);
+    mfree(mdp, p);
+    UNLOCK(mdp);
+  }
 }
 #endif
 
index 1fbf9eb..5d36fd2 100644 (file)
@@ -6,8 +6,6 @@
 /* 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 <math.h>               /* floor */
-
 #include "portable.h"
 
 #include "xbt/sysdep.h"
@@ -15,6 +13,8 @@
 #include "gras/virtu.h"
 #include "xbt/xbt_os_time.h"    /* private */
 
+#include <math.h>               /* floor */
+
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu);
 double xbt_time(void)
 {
index 4d0f905..0d46aa5 100644 (file)
 #endif
 
 
-#include <stdlib.h>
-#include <stdio.h>
 #include "surf/maxmin.h"
 #include "xbt/module.h"
 #include "xbt/xbt_os_time.h"
 #include "xbt/sysdep.h"         /* time manipulation for benchmarking */
 
+#include <stdlib.h>
+#include <stdio.h>
+
 double date;
 
 double float_random(double max);
index 95514f5..5b1de6d 100644 (file)
@@ -9,13 +9,15 @@
 #pragma hdrstop
 #endif
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include "surf/trace_mgr.h"
 #include "surf/surf.h"
 
 #include "xbt/log.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
                              "Messages specific for surf example");