Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Cleanup mc_object_info_t code
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 2 Jan 2014 14:22:23 +0000 (15:22 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 10 Jan 2014 10:17:39 +0000 (11:17 +0100)
src/mc/mc_checkpoint.c
src/mc/mc_global.c
src/mc/mc_private.h

index 6b120af..b9a715c 100644 (file)
@@ -17,6 +17,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc,
 
 char *libsimgrid_path;
 
 
 char *libsimgrid_path;
 
+static void MC_find_object_address(memory_map_t maps, mc_object_info_t result);
 static void MC_get_plt_section(mc_object_info_t info);
 
 /************************************  Free functions **************************************/
 static void MC_get_plt_section(mc_object_info_t info);
 
 /************************************  Free functions **************************************/
@@ -234,15 +235,22 @@ void MC_init_memory_map_info(){
 
 }
 
 
 }
 
-mc_object_info_t MC_find_object_address(memory_map_t maps, char* name) {
+mc_object_info_t MC_find_object_info(memory_map_t maps, char* name) {
   mc_object_info_t result = MC_new_object_info();
   result->file_name = xbt_strdup(name);
   result->start_data = NULL;
   result->start_text = NULL;
   mc_object_info_t result = MC_new_object_info();
   result->file_name = xbt_strdup(name);
   result->start_data = NULL;
   result->start_text = NULL;
+  MC_find_object_address(maps, result);
+  MC_get_plt_section(result);
+  MC_dwarf_get_variables(result);
+  return result;
+}
 
 
+static void MC_find_object_address(memory_map_t maps, mc_object_info_t result) {
   unsigned int i = 0;
   s_map_region_t reg;
   unsigned int i = 0;
   s_map_region_t reg;
-  int len = strlen(basename(name));
+  const char* name = result->file_name;
+  int len = strlen(basename(result->file_name));
   while (i < maps->mapsize) {
     reg = maps->regions[i];
     if (maps->regions[i].pathname == NULL || memcmp(basename(maps->regions[i].pathname), basename(name), len)){
   while (i < maps->mapsize) {
     reg = maps->regions[i];
     if (maps->regions[i].pathname == NULL || memcmp(basename(maps->regions[i].pathname), basename(name), len)){
index ea39360..7521448 100644 (file)
@@ -526,7 +526,7 @@ static int MC_dwarf_get_variable_index(xbt_dynar_t variables, char* var, void *a
 
 }
 
 
 }
 
-static void MC_dwarf_get_variables(mc_object_info_t info){
+void MC_dwarf_get_variables(mc_object_info_t info) {
   mc_object_info_t result = info;
   const char *elf_file = info->file_name;
 
   mc_object_info_t result = info;
   const char *elf_file = info->file_name;
 
@@ -1749,15 +1749,10 @@ static void MC_init_debug_info() {
   memory_map_t maps = MC_get_memory_map();
 
   /* Get local variables for state equality detection */
   memory_map_t maps = MC_get_memory_map();
 
   /* Get local variables for state equality detection */
-
-  mc_binary_info = MC_find_object_address(maps, xbt_binary_name);
-  MC_dwarf_get_variables(mc_binary_info);
-
-  mc_libsimgrid_info = MC_find_object_address(maps, libsimgrid_path);
-  MC_dwarf_get_variables(mc_libsimgrid_info);
+  mc_binary_info = MC_find_object_info(maps, xbt_binary_name);
+  mc_libsimgrid_info = MC_find_object_info(maps, libsimgrid_path);
 
   MC_free_memory_map(maps);
 
   MC_free_memory_map(maps);
-
   XBT_INFO("Get debug information done !");
 }
 
   XBT_INFO("Get debug information done !");
 }
 
index 10abd85..c992fcd 100644 (file)
@@ -331,9 +331,11 @@ typedef struct s_mc_object_info {
 } s_mc_object_info_t, *mc_object_info_t;
 
 mc_object_info_t MC_new_object_info();
 } s_mc_object_info_t, *mc_object_info_t;
 
 mc_object_info_t MC_new_object_info();
-mc_object_info_t MC_find_object_address(memory_map_t maps, char* name);
+mc_object_info_t MC_find_object_info(memory_map_t maps, char* name);
 void MC_free_object_info(mc_object_info_t* p);
 
 void MC_free_object_info(mc_object_info_t* p);
 
+void MC_dwarf_get_variables(mc_object_info_t info);
+
 extern mc_object_info_t mc_libsimgrid_info;
 extern mc_object_info_t mc_binary_info;
 
 extern mc_object_info_t mc_libsimgrid_info;
 extern mc_object_info_t mc_binary_info;