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;
}
-/** @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;
}
+/** \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);
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;
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;
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;
}
+/** \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;
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 */
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();
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 **********************************/