* mi/mi-cmd-stack.c (parse_print_values): New.
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index fe1f384f510ab83ba468bfece5c7bac127ce87d6..218c85a54d96e4723b466c9c673bee88f2655b54 100644 (file)
@@ -3043,6 +3043,9 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
   struct attribute *import_attr;
   struct die_info *imported_die;
   const char *imported_name;
+  const char *imported_name_prefix;
+  const char *import_prefix;
+  char *canonical_name;
 
   import_attr = dwarf2_attr (die, DW_AT_import, cu);
   if (import_attr == NULL)
@@ -3093,8 +3096,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
 
   /* FIXME: dwarf2_name (die); for the local name after import.  */
 
-  using_directives = cp_add_using (imported_name, strlen (imported_name), 0,
-                                   using_directives);
+  /* Figure out where the statement is being imported to.  */
+  import_prefix = determine_prefix (die, cu);
+
+  /* Figure out what the scope of the imported die is and prepend it
+     to the name of the imported die.  */
+  imported_name_prefix = determine_prefix (imported_die, cu);
+
+  if (strlen (imported_name_prefix) > 0)
+    {
+      canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
+      strcpy (canonical_name, imported_name_prefix);
+      strcat (canonical_name, "::");
+      strcat (canonical_name, imported_name);
+    }
+  else
+    {
+      canonical_name = alloca (strlen (imported_name) + 1);
+      strcpy (canonical_name, imported_name);
+    }
+
+  using_directives = cp_add_using (import_prefix,canonical_name, using_directives);
 }
 
 static void
@@ -4830,7 +4852,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
      arrays with unspecified length.  */
   if (die->child == NULL)
     {
-      index_type = builtin_type_int32;
+      index_type = objfile_type (objfile)->builtin_int;
       range_type = create_range_type (NULL, index_type, 0, -1);
       type = create_array_type (NULL, element_type, range_type);
       return set_die_type (die, type, cu);
@@ -5053,9 +5075,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
       if (is_anonymous)
        {
          const char *previous_prefix = determine_prefix (die, cu);
-         cp_add_using_directive (TYPE_NAME (type),
-                                 strlen (previous_prefix),
-                                 strlen (TYPE_NAME (type)));
+         cp_add_using_directive (previous_prefix, TYPE_NAME (type));
        }
     }
 
@@ -5270,7 +5290,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
         }
     }
 
-  index_type = builtin_type_int32;
+  index_type = objfile_type (objfile)->builtin_int;
   range_type = create_range_type (NULL, index_type, 1, length);
   char_type = language_string_char_type (cu->language_defn, gdbarch);
   type = create_string_type (NULL, char_type, range_type);
@@ -5297,7 +5317,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
   struct attribute *attr;
 
   type = die_type (die, cu);
-  ftype = make_function_type (type, (struct type **) 0, cu->objfile);
+  ftype = lookup_function_type (type);
 
   /* All functions in C++, Pascal and Java have prototypes.  */
   attr = dwarf2_attr (die, DW_AT_prototyped, cu);
@@ -7735,7 +7755,6 @@ static struct symbol *
 new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   struct symbol *sym = NULL;
   char *name;
   struct attribute *attr = NULL;
@@ -7840,7 +7859,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
             to something sensible.  */
          if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
            SYMBOL_TYPE (sym)
-             = builtin_type (gdbarch)->nodebug_data_symbol;
+             = objfile_type (objfile)->nodebug_data_symbol;
 
          attr = dwarf2_attr (die, DW_AT_const_value, cu);
          if (attr)
@@ -8148,7 +8167,6 @@ dwarf2_const_value_data (struct attribute *attr,
 static struct type *
 die_type (struct die_info *die, struct dwarf2_cu *cu)
 {
-  struct gdbarch *gdbarch = get_objfile_arch (cu->objfile);
   struct type *type;
   struct attribute *type_attr;
   struct die_info *type_die;
@@ -8157,7 +8175,7 @@ die_type (struct die_info *die, struct dwarf2_cu *cu)
   if (!type_attr)
     {
       /* A missing DW_AT_type represents a void type.  */
-      return builtin_type (gdbarch)->builtin_void;
+      return objfile_type (cu->objfile)->builtin_void;
     }
   else
     type_die = follow_die_ref (die, type_attr, &cu);
This page took 0.073885 seconds and 4 git commands to generate.