Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Add comments
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 9 Jan 2014 13:30:38 +0000 (14:30 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 10 Jan 2014 10:20:31 +0000 (11:20 +0100)
src/include/mc/datatypes.h
src/mc/mc_checkpoint.c
src/mc/mc_global.c
src/mc/mc_private.h

index 5c8e4d1..2d7f1c0 100644 (file)
@@ -55,11 +55,11 @@ typedef enum{
 
 typedef struct s_dw_type{
   e_dw_type_type type;
-  void *id;
-  char *name;
-  int size;
-  char *dw_type_id;
-  xbt_dynar_t members; /* if DW_TAG_structure_type */
+  void *id; /* Offset in the section (in hexadecimal form) */
+  char *name; /* Name of the type */
+  int size; /* Sometimes it si the byte size, sometimes it is the number of elements */
+  char *dw_type_id; /* DW_AT_type */
+  xbt_dynar_t members; /* if DW_TAG_structure_type, DW_TAG_union_type*/
   int is_pointer_type;
   int offset;
 }s_dw_type_t, *dw_type_t;
index b9a715c..1e2bcd1 100644 (file)
@@ -201,7 +201,7 @@ static void MC_get_memory_regions(mc_snapshot_t snapshot){
 
 }
 
-/** @brief Find the range of the different memory segments and binary paths */
+/** @brief Finds the range of the different memory segments and binary paths */
 void MC_init_memory_map_info(){
  
   unsigned int i = 0;
@@ -235,6 +235,7 @@ void MC_init_memory_map_info(){
 
 }
 
+/** \brief Finds informations about a given shared object/executable */
 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);
@@ -246,6 +247,7 @@ mc_object_info_t MC_find_object_info(memory_map_t maps, char* name) {
   return result;
 }
 
+/** \brief Fills the position of the .bss and .data sections. */
 static void MC_find_object_address(memory_map_t maps, mc_object_info_t result) {
   unsigned int i = 0;
   s_map_region_t reg;
@@ -274,6 +276,7 @@ static void MC_find_object_address(memory_map_t maps, mc_object_info_t result) {
   return result;
 }
 
+/** \brief Fills the position of the .plt and .got.plt sections. */
 static void MC_get_plt_section(mc_object_info_t info){
 
   FILE *fp;
index 2e9351e..736b0d3 100644 (file)
@@ -452,6 +452,10 @@ static xbt_dict_t MC_dwarf_get_location_list(const char *elf_file){
   return location_list;
 }
 
+/** \brief Finds a frame (DW_TAG_subprogram) from an DWARF offset in the rangd of this subprogram
+ *
+ * The offset can be an offset of a child DW_TAG_variable.
+ */
 static dw_frame_t MC_dwarf_get_frame_by_offset(xbt_dict_t all_variables, unsigned long int offset){
 
   xbt_dict_cursor_t cursor = NULL;
@@ -526,6 +530,7 @@ static int MC_dwarf_get_variable_index(xbt_dynar_t variables, char* var, void *a
 
 }
 
+/** \brief Fill DWARf debug infomations (types, frames, variables ...). */
 void MC_dwarf_get_variables(mc_object_info_t info) {
   mc_object_info_t result = info;
   const char *elf_file = info->file_name;
@@ -1158,8 +1163,10 @@ void MC_dwarf_get_variables(mc_object_info_t info) {
 
       dw_type_t type = NULL;
 
+      // Read DW_TAG_subrange_type children:
       while(read != -1){
       
+        // Read attributes of the DW_TAG_subrange_type:
         while(read != -1){
         
           /* Wipeout the new line character */
index c992fcd..9d68c04 100644 (file)
@@ -325,9 +325,9 @@ typedef struct s_mc_object_info {
   void* end_plt;
   void* start_got_plt;
   void* end_got_plt;
-  xbt_dict_t local_variables;
-  xbt_dynar_t global_variables;
-  xbt_dict_t types;
+  xbt_dict_t local_variables; // xbt_dict_t<frame_name, dw_frame_t>
+  xbt_dynar_t global_variables; // xbt_dynar_t<dw_variable_t>
+  xbt_dict_t types; // xbt_dict_t<origin as hexadecimal string, dw_type_t>
 } s_mc_object_info_t, *mc_object_info_t;
 
 mc_object_info_t MC_new_object_info();
@@ -416,9 +416,9 @@ typedef struct s_dw_frame{
   void *low_pc;
   void *high_pc;
   dw_location_t frame_base;
-  xbt_dynar_t variables; /* Cannot use dict, there may be several variables with the same name (in different lexical blocks)*/
-  unsigned long int start;
-  unsigned long int end;
+  xbt_dynar_t /* <dw_variable_t> */ variables; /* Cannot use dict, there may be several variables with the same name (in different lexical blocks)*/
+  unsigned long int start; /* DWARF offset of the subprogram */
+  unsigned long int end;   /* Dwarf offset of the next sibling */
 }s_dw_frame_t, *dw_frame_t;
 
 /********************************** Miscellaneous **********************************/