Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use LANG=C when calling objdump
[simgrid.git] / src / mc / mc_global.c
index 558fca0..f1e1c92 100644 (file)
@@ -314,9 +314,14 @@ static dw_location_t MC_dwarf_get_location(xbt_dict_t location_list, char *expr)
 
 }
 
+/** @brief Extract the location lists from an ELF file (.debug_loc)
+ *
+ *  @return A map from the offset in the list (in hexadecimal string)
+ *          into a location list (dynar of dw_location_entry_t).
+ */
 static xbt_dict_t MC_dwarf_get_location_list(const char *elf_file){
 
-  char *command = bprintf("objdump -Wo %s", elf_file);
+  char *command = bprintf("LANG=C objdump -Wo %s", elf_file);
 
   FILE *fp = popen(command, "r");
 
@@ -371,8 +376,14 @@ static xbt_dict_t MC_dwarf_get_location_list(const char *elf_file){
     xbt_str_strip_spaces(line);
     split = xbt_str_split(line, " ");
 
+    char *key = NULL;
     while(read != -1 && strcmp("<End", (char *)xbt_dynar_get_as(split, 1, char *)) != 0){
       
+      // Take the key from the first line of the list:
+      if(key==NULL){
+        key = bprintf("%d", (int)strtoul((char *)xbt_dynar_get_as(split, 0, char *), NULL, 16));
+      }
+
       dw_location_entry_t new_entry = xbt_new0(s_dw_location_entry_t, 1);
       new_entry->lowpc = strtoul((char *)xbt_dynar_get_as(split, 1, char *), NULL, 16);
       new_entry->highpc = strtoul((char *)xbt_dynar_get_as(split, 2, char *), NULL, 16);
@@ -403,7 +414,6 @@ static xbt_dict_t MC_dwarf_get_location_list(const char *elf_file){
     }
 
 
-    char *key = bprintf("%d", (int)strtoul((char *)xbt_dynar_get_as(split, 0, char *), NULL, 16));
     xbt_dict_set(location_list, key, loclist, NULL);
     xbt_free(key);
     
@@ -495,7 +505,7 @@ static int MC_dwarf_get_variable_index(xbt_dynar_t variables, char* var, void *a
 
 static void MC_dwarf_get_variables(const char *elf_file, xbt_dict_t location_list, xbt_dict_t *local_variables, xbt_dynar_t *global_variables, xbt_dict_t *types){
 
-  char *command = bprintf("objdump -Wi %s", elf_file);
+  char *command = bprintf("LANG=C objdump -Wi %s", elf_file);
   
   FILE *fp = popen(command, "r");
 
@@ -550,6 +560,8 @@ static void MC_dwarf_get_variables(const char *elf_file, xbt_dict_t location_lis
     node_type = xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char *);
 
     if(strcmp(node_type, "(DW_TAG_subprogram)") == 0){ /* New frame */
+      /* We build/complete a dw_frame_t object
+       * and append it if necessary to the local_variables dictionnary */
 
       dw_frame_t frame = NULL;
 
@@ -665,6 +677,9 @@ static void MC_dwarf_get_variables(const char *elf_file, xbt_dict_t location_lis
         
 
     }else if(strcmp(node_type, "(DW_TAG_variable)") == 0){ /* New variable */
+      /* We build a dw_variable_t object and append it either to
+         the list of variables of the frame (local variable)
+         or to the list of global variables (global variables). */
 
       dw_variable_t var = NULL;
       
@@ -817,6 +832,7 @@ static void MC_dwarf_get_variables(const char *elf_file, xbt_dict_t location_lis
       new_variable = 1;
 
     }else if(strcmp(node_type, "(DW_TAG_inlined_subroutine)") == 0){
+      /* Update the information on the frame (we should duplicate it instead). */
 
       read = xbt_getline(&line, &n, fp);
 
@@ -871,6 +887,8 @@ static void MC_dwarf_get_variables(const char *elf_file, xbt_dict_t location_lis
              || strcmp(node_type, "(DW_TAG_volatile_type)") == 0
              || (is_pointer = !strcmp(node_type, "(DW_TAG_pointer_type)"))){
 
+      /* Create the and add it to the types dictionnary */
+
       if(strcmp(node_type, "(DW_TAG_base_type)") == 0)
         type_type = e_dw_base_type;
       else if(strcmp(node_type, "(DW_TAG_enumeration_type)") == 0)
@@ -1757,11 +1775,19 @@ void MC_init(){
   MC_ignore_global_variable("mc_snapshot_comparison_time"); 
   MC_ignore_global_variable("mc_time");
   MC_ignore_global_variable("smpi_current_rank");
-  MC_ignore_global_variable("smx_current_context_serial");
-  MC_ignore_global_variable("smx_current_context_key");
-  MC_ignore_global_variable("sysv_maestro_context");
   MC_ignore_global_variable("counter"); /* Static variable used for tracing */
+  MC_ignore_global_variable("maestro_stack_start");
+  MC_ignore_global_variable("maestro_stack_end");
+
+  MC_ignore_heap(&(simix_global->process_to_run), sizeof(simix_global->process_to_run));
+  MC_ignore_heap(&(simix_global->process_that_ran), sizeof(simix_global->process_that_ran));
+  MC_ignore_heap(simix_global->process_to_run, sizeof(*(simix_global->process_to_run)));
+  MC_ignore_heap(simix_global->process_that_ran, sizeof(*(simix_global->process_that_ran)));
+  
+  smx_process_t process;
+  xbt_swag_foreach(process, simix_global->process_list){
+    MC_ignore_heap(&(process->process_hookup), sizeof(process->process_hookup));
+  }
 
   if(raw_mem_set)
     MC_SET_RAW_MEM;
@@ -1867,7 +1893,7 @@ void MC_modelcheck_safety(void)
   MC_SET_RAW_MEM;
   /* Save the initial state */
   initial_state_safety = xbt_new0(s_mc_global_t, 1);
-  initial_state_safety->snapshot = MC_take_snapshot();
+  initial_state_safety->snapshot = MC_take_snapshot(0);
   MC_UNSET_RAW_MEM;
 
   MC_dpor();