2012-11-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index 5b57507c42f1400ef620acd1a9a54aa97e5f46ee..2d47407da31385beb8db0ae6db24913ac9a4300c 100644 (file)
@@ -1,7 +1,5 @@
 /* Read dbx symbol tables and convert to internal format, for GDB.
-   Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010, 2011.
-   Free Software Foundation, Inc.
+   Copyright (C) 1986-2004, 2008-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -107,7 +105,7 @@ struct symloc
 
 /* The objfile we are currently reading.  */
 
-static struct objfile *current_objfile;
+static struct objfile *dbxread_objfile;
 
 /* Remember what we deduced to be the source language of this psymtab.  */
 
@@ -347,10 +345,10 @@ add_this_object_header_file (int i)
 static void
 add_old_header_file (char *name, int instance)
 {
-  struct header_file *p = HEADER_FILES (current_objfile);
+  struct header_file *p = HEADER_FILES (dbxread_objfile);
   int i;
 
-  for (i = 0; i < N_HEADER_FILES (current_objfile); i++)
+  for (i = 0; i < N_HEADER_FILES (dbxread_objfile); i++)
     if (filename_cmp (p[i].name, name) == 0 && instance == p[i].instance)
       {
        add_this_object_header_file (i);
@@ -378,30 +376,30 @@ add_new_header_file (char *name, int instance)
 
   /* Make sure there is room for one more header file.  */
 
-  i = N_ALLOCATED_HEADER_FILES (current_objfile);
+  i = N_ALLOCATED_HEADER_FILES (dbxread_objfile);
 
-  if (N_HEADER_FILES (current_objfile) == i)
+  if (N_HEADER_FILES (dbxread_objfile) == i)
     {
       if (i == 0)
        {
-         N_ALLOCATED_HEADER_FILES (current_objfile) = 10;
-         HEADER_FILES (current_objfile) = (struct header_file *)
+         N_ALLOCATED_HEADER_FILES (dbxread_objfile) = 10;
+         HEADER_FILES (dbxread_objfile) = (struct header_file *)
            xmalloc (10 * sizeof (struct header_file));
        }
       else
        {
          i *= 2;
-         N_ALLOCATED_HEADER_FILES (current_objfile) = i;
-         HEADER_FILES (current_objfile) = (struct header_file *)
-           xrealloc ((char *) HEADER_FILES (current_objfile),
+         N_ALLOCATED_HEADER_FILES (dbxread_objfile) = i;
+         HEADER_FILES (dbxread_objfile) = (struct header_file *)
+           xrealloc ((char *) HEADER_FILES (dbxread_objfile),
                      (i * sizeof (struct header_file)));
        }
     }
 
   /* Create an entry for this header file.  */
 
-  i = N_HEADER_FILES (current_objfile)++;
-  hfile = HEADER_FILES (current_objfile) + i;
+  i = N_HEADER_FILES (dbxread_objfile)++;
+  hfile = HEADER_FILES (dbxread_objfile) + i;
   hfile->name = xstrdup (name);
   hfile->instance = instance;
   hfile->length = 10;
@@ -416,7 +414,7 @@ add_new_header_file (char *name, int instance)
 static struct type **
 explicit_lookup_type (int real_filenum, int index)
 {
-  struct header_file *f = &HEADER_FILES (current_objfile)[real_filenum];
+  struct header_file *f = &HEADER_FILES (dbxread_objfile)[real_filenum];
 
   if (index >= f->length)
     {
@@ -1212,7 +1210,7 @@ read_dbx_symtab (struct objfile *objfile)
   struct partial_symtab *pst;
 
   /* List of current psymtab's include files.  */
-  char **psymtab_include_list;
+  const char **psymtab_include_list;
   int includes_allocated;
   int includes_used;
 
@@ -1234,8 +1232,8 @@ read_dbx_symtab (struct objfile *objfile)
 
   includes_allocated = 30;
   includes_used = 0;
-  psymtab_include_list = (char **) alloca (includes_allocated *
-                                          sizeof (char *));
+  psymtab_include_list = (const char **) alloca (includes_allocated *
+                                                sizeof (const char *));
 
   dependencies_allocated = 30;
   dependencies_used = 0;
@@ -1637,12 +1635,12 @@ read_dbx_symtab (struct objfile *objfile)
            psymtab_include_list[includes_used++] = namestring;
            if (includes_used >= includes_allocated)
              {
-               char **orig = psymtab_include_list;
+               const char **orig = psymtab_include_list;
 
-               psymtab_include_list = (char **)
-                 alloca ((includes_allocated *= 2) * sizeof (char *));
+               psymtab_include_list = (const char **)
+                 alloca ((includes_allocated *= 2) * sizeof (const char *));
                memcpy (psymtab_include_list, orig,
-                       includes_used * sizeof (char *));
+                       includes_used * sizeof (const char *));
              }
            continue;
          }
@@ -2228,7 +2226,8 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
    FIXME:  List variables and peculiarities of same.  */
 
 struct partial_symtab *
-end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
+end_psymtab (struct partial_symtab *pst,
+            const char **include_list, int num_includes,
             int capping_symbol_offset, CORE_ADDR capping_text,
             struct partial_symtab **dependency_list, int number_dependencies,
             int textlow_not_set)
@@ -2537,7 +2536,7 @@ read_ofile_symtab (struct partial_symtab *pst)
      objfile->section_offsets.  */ 
   section_offsets = pst->section_offsets;
 
-  current_objfile = objfile;
+  dbxread_objfile = objfile;
   subfile_stack = NULL;
 
   stringtab_global = DBX_STRINGTAB (objfile);
@@ -2702,7 +2701,7 @@ read_ofile_symtab (struct partial_symtab *pst)
 
   end_stabs ();
 
-  current_objfile = NULL;
+  dbxread_objfile = NULL;
 }
 \f
 
@@ -3433,7 +3432,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
   bfd *sym_bfd = objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
   struct dbx_symfile_info *info;
-  struct cleanup *back_to = NULL;
+  struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
 
   /* There is already a dbx_symfile_info allocated by our caller.
      It might even contain some info from the ELF symtab to help us.  */
@@ -3477,7 +3476,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
   symbuf_left = bfd_section_size (objfile->obfd, stabsect);
   stabs_data = symfile_relocate_debug_section (objfile, stabsect, NULL);
   if (stabs_data)
-    back_to = make_cleanup (free_current_contents, (void *) &stabs_data);
+    make_cleanup (free_current_contents, (void *) &stabs_data);
 
   /* In an elf file, we've already installed the minimal symbols that came
      from the elf (non-stab) symbol table, so always act like an
@@ -3487,8 +3486,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
      case it does, it will install them itself.  */
   dbx_symfile_read (objfile, 0);
 
-  if (back_to)
-    do_cleanups (back_to);
+  do_cleanups (back_to);
 }
 \f
 /* Scan and build partial symbols for a file with special sections for stabs
@@ -3591,6 +3589,7 @@ static const struct sym_fns aout_sym_fns =
   default_symfile_segments,    /* Get segment information from a file.  */
   NULL,
   default_symfile_relocate,    /* Relocate a debug section.  */
+  NULL,                                /* sym_probe_fns */
   &psym_functions
 };
 
This page took 0.039804 seconds and 4 git commands to generate.