Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Add some documentation to the MC DWARF code
[simgrid.git] / src / mc / mc_checkpoint.c
index f6612b7..c9b6085 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (c) 2008-2013 Da SimGrid Team. All rights reserved.            */
+/* Copyright (c) 2008-2013. 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. */
@@ -176,7 +177,7 @@ static void MC_get_memory_regions(mc_snapshot_t snapshot){
               }
               tok = strtok(lfields[0], "-");
               start_addr1 = (void *)strtoul(tok, NULL, 16);
-              if(lfields[1][1] == 'w' && lfields[5] == NULL){
+              if(lfields[1][1] == 'w'){
                 if(start_addr1 == std_heap){     /* Std_heap ? */
                   tok = strtok(NULL, "-");
                   end_addr = (void *)strtoul(tok, NULL, 16);
@@ -205,6 +206,7 @@ static void MC_get_memory_regions(mc_snapshot_t snapshot){
 
 }
 
+/** @brief Find the range of the different memory segments and binary paths */
 void MC_init_memory_map_info(){
  
   unsigned int i = 0;
@@ -501,7 +503,7 @@ static xbt_dynar_t MC_get_local_variables_values(void *stack_context){
   int frame_found = 0, region_type;
   void *frame_pointer_address = NULL;
   long true_ip, value;
-  int stop;
+  int stop = 0;
 
   xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
 
@@ -724,7 +726,7 @@ static void MC_dump_checkpoint_ignore(mc_snapshot_t snapshot){
 }
 
 
-mc_snapshot_t MC_take_snapshot(){
+mc_snapshot_t MC_take_snapshot(int num_state){
 
   mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1);
   snapshot->nb_processes = xbt_swag_size(simix_global->process_list);
@@ -740,7 +742,8 @@ mc_snapshot_t MC_take_snapshot(){
     //MC_get_hash_local(snapshot->hash_local, snapshot->stacks);
   }
 
-  MC_dump_checkpoint_ignore(snapshot);
+  if(num_state > 0)
+    MC_dump_checkpoint_ignore(snapshot);
 
   return snapshot;
 
@@ -755,7 +758,7 @@ void MC_restore_snapshot(mc_snapshot_t snapshot){
 }
 
 mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
-  return MC_take_snapshot();
+  return MC_take_snapshot(1);
 }
 
 void *MC_snapshot(void){