+ xbt_dynar_free(&split);
+ xbt_str_rtrim(line, NULL);
+ xbt_str_strip_spaces(line);
+ split = xbt_str_split(line, " ");
+
+ if(strncmp(xbt_dynar_get_as(split, 1, char *), "DW_AT_", 6) != 0)
+ break;
+
+ node_type = xbt_dynar_get_as(split, 1, char *);
+
+ if(strcmp(node_type, "DW_AT_abstract_origin:") == 0){
+
+ origin = xbt_dynar_get_as(split, 2, char *);
+ xbt_str_ltrim(origin, "<0x");
+ xbt_str_rtrim(origin, ">");
+
+ subprogram_name = (char *)xbt_dict_get_or_null(subprograms_origin, origin);
+ subroutine_frame = xbt_dict_get_or_null(*local_variables, subprogram_name);
+
+ }else if(strcmp(node_type, "DW_AT_low_pc") == 0){
+
+ subroutine_frame->low_pc = (void *)strtoul(xbt_dynar_get_as(split, 3, char *), NULL, 16);
+
+ }else if(strcmp(node_type, "DW_AT_high_pc") == 0){
+
+ subroutine_frame->high_pc = (void *)strtoul(xbt_dynar_get_as(split, 3, char *), NULL, 16);
+ }
+
+ read = xbt_getline(&line, &n, fp);
+
+ }
+
+ }else if(strcmp(node_type, "(DW_TAG_base_type)") == 0
+ || strcmp(node_type, "(DW_TAG_enumeration_type)") == 0
+ || strcmp(node_type, "(DW_TAG_enumerator)") == 0
+ || strcmp(node_type, "(DW_TAG_typedef)") == 0
+ || strcmp(node_type, "(DW_TAG_const_type)") == 0
+ || strcmp(node_type, "(DW_TAG_subroutine_type)") == 0
+ || strcmp(node_type, "(DW_TAG_volatile_type)") == 0
+ || (is_pointer = !strcmp(node_type, "(DW_TAG_pointer_type)"))){
+
+ 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)
+ type_type = e_dw_enumeration_type;
+ else if(strcmp(node_type, "(DW_TAG_enumerator)") == 0)
+ type_type = e_dw_enumerator;
+ else if(strcmp(node_type, "(DW_TAG_typedef)") == 0)
+ type_type = e_dw_typedef;
+ else if(strcmp(node_type, "(DW_TAG_const_type)") == 0)
+ type_type = e_dw_const_type;
+ else if(strcmp(node_type, "(DW_TAG_pointer_type)") == 0)
+ type_type = e_dw_pointer_type;
+ else if(strcmp(node_type, "(DW_TAG_subroutine_type)") == 0)
+ type_type = e_dw_subroutine_type;
+ else if(strcmp(node_type, "(DW_TAG_volatile_type)") == 0)
+ type_type = e_dw_volatile_type;
+
+ strtok(xbt_dynar_get_as(split, 0, char *), "<");
+ origin = strdup(strtok(NULL, "<"));
+ xbt_str_rtrim(origin, ">:");
+
+ read = xbt_getline(&line, &n, fp);
+
+ while(read != -1){
+
+ /* Wipeout the new line character */
+ line[read - 1] = '\0';
+
+ if(n == 0 || strlen(line) == 0){
+ read = xbt_getline(&line, &n, fp);
+ continue;
+ }
+
+ xbt_dynar_free(&split);
+ xbt_str_rtrim(line, NULL);
+ xbt_str_strip_spaces(line);
+ split = xbt_str_split(line, " ");
+
+ if(strncmp(xbt_dynar_get_as(split, 1, char *), "DW_AT_", 6) != 0)
+ break;
+
+ node_type = xbt_dynar_get_as(split, 1, char *);
+
+ if(strcmp(node_type, "DW_AT_byte_size") == 0){
+ size = strtol(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*), NULL, 10);
+ if(type_type == e_dw_enumeration_type)
+ enumeration_size = size;
+ }else if(strcmp(node_type, "DW_AT_name") == 0){
+ end = xbt_str_join(split, " ");
+ xbt_dynar_free(&split);
+ split = xbt_str_split(end, "):");
+ xbt_str_ltrim(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*), NULL);
+ name = xbt_strdup(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*));
+ }else if(strcmp(node_type, "DW_AT_type") == 0){
+ type_origin = xbt_strdup(xbt_dynar_get_as(split, 3, char *));
+ xbt_str_ltrim(type_origin, "<0x");
+ xbt_str_rtrim(type_origin, ">");
+ }
+
+ read = xbt_getline(&line, &n, fp);
+ }
+
+ dw_type_t type = xbt_new0(s_dw_type_t, 1);
+ type->type = type_type;
+ if(name)
+ type->name = xbt_strdup(name);
+ else
+ type->name = xbt_strdup("undefined");
+ type->is_pointer_type = is_pointer;
+ type->id = (void *)strtoul(origin, NULL, 16);
+ if(type_origin)
+ type->dw_type_id = xbt_strdup(type_origin);
+ if(type_type == e_dw_enumerator)
+ type->size = enumeration_size;
+ else
+ type->size = size;
+ type->members = NULL;
+
+ xbt_dict_set(*types, origin, type, NULL);
+
+ xbt_free(name);
+ name = NULL;
+ xbt_free(type_origin);
+ type_origin = NULL;
+ xbt_free(end);
+ end = NULL;
+
+ is_pointer = 0;
+ size = 0;
+ xbt_free(origin);
+
+ }else if(strcmp(node_type, "(DW_TAG_structure_type)") == 0 || strcmp(node_type, "(DW_TAG_union_type)") == 0){
+
+ if(strcmp(node_type, "(DW_TAG_structure_type)") == 0)
+ struct_decl = 1;
+ else
+ union_decl = 1;
+
+ strtok(xbt_dynar_get_as(split, 0, char *), "<");
+ origin = strdup(strtok(NULL, "<"));
+ xbt_str_rtrim(origin, ">:");
+
+ read = xbt_getline(&line, &n, fp);
+
+ dw_type_t type = NULL;
+
+ while(read != -1){
+
+ while(read != -1){
+
+ /* Wipeout the new line character */
+ line[read - 1] = '\0';
+
+ if(n == 0 || strlen(line) == 0){
+ read = xbt_getline(&line, &n, fp);
+ continue;
+ }
+
+ xbt_dynar_free(&split);
+ xbt_str_rtrim(line, NULL);
+ xbt_str_strip_spaces(line);
+ split = xbt_str_split(line, " ");
+
+ node_type = xbt_dynar_get_as(split, 1, char *);
+
+ if(strncmp(node_type, "DW_AT_", 6) != 0){
+ member_end = 1;
+ break;
+ }
+
+ if(strcmp(node_type, "DW_AT_byte_size") == 0){
+ size = strtol(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*), NULL, 10);
+ }else if(strcmp(node_type, "DW_AT_name") == 0){
+ xbt_free(end);
+ end = xbt_str_join(split, " ");
+ xbt_dynar_free(&split);
+ split = xbt_str_split(end, "):");
+ xbt_str_ltrim(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*), NULL);
+ name = xbt_strdup(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*));
+ }else if(strcmp(node_type, "DW_AT_type") == 0){
+ type_origin = xbt_strdup(xbt_dynar_get_as(split, 3, char *));
+ xbt_str_ltrim(type_origin, "<0x");
+ xbt_str_rtrim(type_origin, ">");
+ }else if(strcmp(node_type, "DW_AT_data_member_location:") == 0){
+ xbt_free(end);
+ end = xbt_str_join(split, " ");
+ xbt_dynar_free(&split);
+ split = xbt_str_split(end, "DW_OP_plus_uconst:");
+ xbt_str_ltrim(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char *), NULL);
+ xbt_str_rtrim(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char *), ")");
+ offset = strtol(xbt_dynar_get_as(split, xbt_dynar_length(split) - 1, char*), NULL, 10);
+ }
+
+ read = xbt_getline(&line, &n, fp);
+
+ }