Add the fullname_syntax testsuite variable. This allows GDB to make sure
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index eab60a0f5c868dae379c5fb60043a3ec32e61bac..a6a76842eea63196bda404f95f5ff11649194848 100644 (file)
@@ -659,6 +659,15 @@ static struct dwarf2_queue_item *dwarf2_queue, *dwarf2_queue_tail;
    sizes of up to at least twenty will improve startup time for
    typical inter-CU-reference binaries, at an obvious memory cost.  */
 static int dwarf2_max_cache_age = 5;
+static void
+show_dwarf2_max_cache_age (struct ui_file *file, int from_tty,
+                          struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("\
+The upper bound on the age of cached dwarf2 compilation units is %s.\n"),
+                   value);
+}
+
 
 /* Various complaints about symbol reading that don't abort the process */
 
@@ -1533,6 +1542,9 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
          also happen.) This happens in VxWorks.  */
       free_named_symtabs (pst->filename);
 
+      info_ptr = beg_of_comp_unit + cu.header.length
+                                  + cu.header.initial_length_size;
+
       if (comp_unit_die.has_stmt_list)
         {
           /* Get the list of files included in the current compilation unit,
@@ -1540,9 +1552,6 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
           dwarf2_build_include_psymtabs (&cu, &comp_unit_die, pst);
         }
 
-      info_ptr = beg_of_comp_unit + cu.header.length
-                                  + cu.header.initial_length_size;
-
       do_cleanups (back_to_inner);
     }
   do_cleanups (back_to);
@@ -1632,6 +1641,7 @@ create_all_comp_units (struct objfile *objfile)
 
       /* Read just enough information to find out where the next
         compilation unit is.  */
+      cu_header.initial_length_size = 0;
       cu_header.length = read_initial_length (objfile->obfd, info_ptr,
                                              &cu_header, &bytes_read);
 
@@ -5851,7 +5861,7 @@ read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu, int *bytes_read)
    As a side effect, this function sets the fields initial_length_size
    and offset_size in cu_header to the values appropriate for the
    length field.  (The format of the initial length field determines
-   the width of file offsets to be fetched later with fetch_offset().)
+   the width of file offsets to be fetched later with read_offset().)
    
    [ Note:  read_initial_length() and read_offset() are based on the
      document entitled "DWARF Debugging Information Format", revision
@@ -5873,43 +5883,41 @@ static LONGEST
 read_initial_length (bfd *abfd, char *buf, struct comp_unit_head *cu_header,
                      int *bytes_read)
 {
-  LONGEST retval = 0;
-
-  retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+  LONGEST length = bfd_get_32 (abfd, (bfd_byte *) buf);
 
-  if (retval == 0xffffffff)
+  if (length == 0xffffffff)
     {
-      retval = bfd_get_64 (abfd, (bfd_byte *) buf + 4);
+      length = bfd_get_64 (abfd, (bfd_byte *) buf + 4);
       *bytes_read = 12;
-      if (cu_header != NULL)
-       {
-         cu_header->initial_length_size = 12;
-         cu_header->offset_size = 8;
-       }
     }
-  else if (retval == 0)
+  else if (length == 0)
     {
-      /* Handle (non-standard) 64-bit DWARF2 formats such as that used
-         by IRIX.  */
-      retval = bfd_get_64 (abfd, (bfd_byte *) buf);
+      /* Handle the (non-standard) 64-bit DWARF2 format used by IRIX.  */
+      length = bfd_get_64 (abfd, (bfd_byte *) buf);
       *bytes_read = 8;
-      if (cu_header != NULL)
-       {
-         cu_header->initial_length_size = 8;
-         cu_header->offset_size = 8;
-       }
     }
   else
     {
       *bytes_read = 4;
-      if (cu_header != NULL)
-       {
-         cu_header->initial_length_size = 4;
-         cu_header->offset_size = 4;
-       }
     }
 
-  return retval;
+  if (cu_header)
+    {
+      gdb_assert (cu_header->initial_length_size == 0
+                 || cu_header->initial_length_size == 4
+                 || cu_header->initial_length_size == 8
+                 || cu_header->initial_length_size == 12);
+
+      if (cu_header->initial_length_size != 0
+         && cu_header->initial_length_size != *bytes_read)
+       complaint (&symfile_complaints,
+                  _("intermixed 32-bit and 64-bit DWARF sections"));
+
+      cu_header->initial_length_size = *bytes_read;
+      cu_header->offset_size = (*bytes_read == 4) ? 4 : 8;
+    }
+
+  return length;
 }
 
 /* Read an offset from the data stream.  The size of the offset is
@@ -6287,7 +6295,8 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd,
   line_ptr = dwarf2_per_objfile->line_buffer + offset;
 
   /* Read in the header.  */
-  lh->total_length = read_initial_length (abfd, line_ptr, NULL, &bytes_read);
+  lh->total_length = 
+    read_initial_length (abfd, line_ptr, &cu->header, &bytes_read);
   line_ptr += bytes_read;
   if (line_ptr + lh->total_length > (dwarf2_per_objfile->line_buffer
                                     + dwarf2_per_objfile->line_size))
@@ -6613,9 +6622,29 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
       for (file_index = 0; file_index < lh->num_file_names; file_index++)
         if (lh->file_names[file_index].included_p == 1)
           {
-            char *include_name = lh->file_names [file_index].name;
-    
-            if (strcmp (include_name, pst->filename) != 0)
+            const struct file_entry fe = lh->file_names [file_index];
+            char *include_name = fe.name;
+            char *dir_name = NULL;
+            char *pst_filename = pst->filename;
+
+            if (fe.dir_index)
+              dir_name = lh->include_dirs[fe.dir_index - 1];
+
+            if (!IS_ABSOLUTE_PATH (include_name) && dir_name != NULL)
+              {
+                include_name =
+                  concat (dir_name, SLASH_STRING, include_name, NULL);
+                make_cleanup (xfree, include_name);
+              }
+
+            if (!IS_ABSOLUTE_PATH (pst_filename) && pst->dirname != NULL)
+              {
+                pst_filename =
+                  concat (pst->dirname, SLASH_STRING, pst_filename, NULL);
+                make_cleanup (xfree, pst_filename);
+              }
+
+            if (strcmp (include_name, pst_filename) != 0)
               dwarf2_create_include_psymtab (include_name, pst, objfile);
           }
     }
@@ -6924,7 +6953,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
                   this objfile, so we don't need to duplicate it for
                   the type.  */
                if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
-                 TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NATURAL_NAME (sym);
+                 TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_SEARCH_NAME (sym);
                add_symbol_to_list (typedef_sym, list_to_add);
              }
          }
@@ -8335,7 +8364,7 @@ dump_die (struct die_info *die)
        case DW_FORM_ref_addr:
        case DW_FORM_addr:
          fprintf_unfiltered (gdb_stderr, "address: ");
-         print_address_numeric (DW_ADDR (&die->attrs[i]), 1, gdb_stderr);
+         deprecated_print_address_numeric (DW_ADDR (&die->attrs[i]), 1, gdb_stderr);
          break;
        case DW_FORM_block2:
        case DW_FORM_block4:
@@ -9630,30 +9659,27 @@ _initialize_dwarf2_read (void)
 {
   dwarf2_objfile_data_key = register_objfile_data ();
 
-  add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd,
-                 "Set DWARF 2 specific variables.\n"
-                 "Configure DWARF 2 variables such as the cache size",
+  add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd, _("\
+Set DWARF 2 specific variables.\n\
+Configure DWARF 2 variables such as the cache size"),
                   &set_dwarf2_cmdlist, "maintenance set dwarf2 ",
                   0/*allow-unknown*/, &maintenance_set_cmdlist);
 
-  add_prefix_cmd ("dwarf2", class_maintenance, show_dwarf2_cmd,
-                 "Show DWARF 2 specific variables\n"
-                 "Show DWARF 2 variables such as the cache size",
+  add_prefix_cmd ("dwarf2", class_maintenance, show_dwarf2_cmd, _("\
+Show DWARF 2 specific variables\n\
+Show DWARF 2 variables such as the cache size"),
                   &show_dwarf2_cmdlist, "maintenance show dwarf2 ",
                   0/*allow-unknown*/, &maintenance_show_cmdlist);
 
   add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
-                           &dwarf2_max_cache_age,
-                           "Set the upper bound on the age of cached "
-                           "dwarf2 compilation units.",
-                           "Show the upper bound on the age of cached "
-                           "dwarf2 compilation units.",
-                           "A higher limit means that cached "
-                           "compilation units will be stored\n"
-                           "in memory longer, and more total memory will "
-                           "be used.  Zero disables\n"
-                           "caching, which can slow down startup.",
-                           NULL, /* PRINT: The upper bound on the age of cached dwarf2 compilation units is %d.  */
-                           NULL, NULL, &set_dwarf2_cmdlist,
+                           &dwarf2_max_cache_age, _("\
+Set the upper bound on the age of cached dwarf2 compilation units."), _("\
+Show the upper bound on the age of cached dwarf2 compilation units."), _("\
+A higher limit means that cached compilation units will be stored\n\
+in memory longer, and more total memory will be used.  Zero disables\n\
+caching, which can slow down startup."),
+                           NULL,
+                           show_dwarf2_max_cache_age,
+                           &set_dwarf2_cmdlist,
                            &show_dwarf2_cmdlist);
 }
This page took 0.028773 seconds and 4 git commands to generate.