* dw2gencfi.c, dw2gencfi.h: New files.
[binutils-gdb.git] / gdb / xcoffread.c
index 5bdb88c7ad2468dd80322b2bc28b89e9845c4949..5a0b2862fef90c5542a0f6358e7638aafd01df20 100644 (file)
@@ -1,6 +1,6 @@
 /* Read AIX xcoff symbol tables and convert to internal format, for GDB.
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Derived from coffread.c, dbxread.c, and a lot of hacking.
    Contributed by IBM Corporation.
@@ -190,10 +190,10 @@ static void xcoff_new_init (struct objfile *);
 
 static void xcoff_symfile_finish (struct objfile *);
 
-static void
-xcoff_symfile_offsets (struct objfile *, struct section_addr_info *addrs);
+static void xcoff_symfile_offsets (struct objfile *,
+                                  struct section_addr_info *addrs);
 
-static void find_linenos (bfd *, sec_ptr, PTR);
+static void find_linenos (bfd *, sec_ptr, void *);
 
 static char *coff_getfilename (union internal_auxent *, struct objfile *);
 
@@ -237,7 +237,7 @@ struct find_targ_sec_arg
 static void find_targ_sec (bfd *, asection *, void *);
 
 static void
-find_targ_sec (bfd *abfd, asection *sect, PTR obj)
+find_targ_sec (bfd *abfd, asection *sect, void *obj)
 {
   struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
   struct objfile *objfile = args->objfile;
@@ -1469,7 +1469,7 @@ process_xcoff_symbol (register struct coff_symbol *cs, struct objfile *objfile)
 
   /* default assumptions */
   SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off;
-  SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+  SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
   SYMBOL_SECTION (sym) = secnum_to_section (cs->c_secnum, objfile);
 
   if (ISFCN (cs->c_type))
@@ -1478,7 +1478,7 @@ process_xcoff_symbol (register struct coff_symbol *cs, struct objfile *objfile)
          will be patched with the type from its stab entry later on in
          patch_block_stabs (), unless the file was compiled without -g.  */
 
-      SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
+      DEPRECATED_SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
       SYMBOL_TYPE (sym) = func_symbol_type;
 
       SYMBOL_CLASS (sym) = LOC_BLOCK;
@@ -1699,7 +1699,7 @@ gotit:
  * mainline code can read the whole thing for efficiency.
  */
 static void
-find_linenos (bfd *abfd, sec_ptr asect, PTR vpinfo)
+find_linenos (bfd *abfd, sec_ptr asect, void *vpinfo)
 {
   struct coff_symfile_info *info;
   int size, count;
@@ -2554,7 +2554,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                psymtab_include_list = (char **)
                  alloca ((includes_allocated *= 2) *
                          sizeof (char *));
-               memcpy ((PTR) psymtab_include_list, (PTR) orig,
+               memcpy (psymtab_include_list, orig,
                        includes_used * sizeof (char *));
              }
            continue;
@@ -2593,7 +2593,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                namestring = STATIC_TRANSFORM_NAME (namestring);
 #endif
                add_psymbol_to_list (namestring, p - namestring,
-                                    VAR_NAMESPACE, LOC_STATIC,
+                                    VAR_DOMAIN, LOC_STATIC,
                                     &objfile->static_psymbols,
                                     0, symbol.n_value,
                                     psymtab_language, objfile);
@@ -2604,7 +2604,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                /* The addresses in these entries are reported to be
                   wrong.  See the code that reads 'G's for symtabs. */
                add_psymbol_to_list (namestring, p - namestring,
-                                    VAR_NAMESPACE, LOC_STATIC,
+                                    VAR_DOMAIN, LOC_STATIC,
                                     &objfile->global_psymbols,
                                     0, symbol.n_value,
                                     psymtab_language, objfile);
@@ -2622,7 +2622,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                        && namestring[0] != ' '))
                  {
                    add_psymbol_to_list (namestring, p - namestring,
-                                        STRUCT_NAMESPACE, LOC_TYPEDEF,
+                                        STRUCT_DOMAIN, LOC_TYPEDEF,
                                         &objfile->static_psymbols,
                                         symbol.n_value, 0,
                                         psymtab_language, objfile);
@@ -2630,26 +2630,28 @@ scan_xcoff_symtab (struct objfile *objfile)
                      {
                        /* Also a typedef with the same name.  */
                        add_psymbol_to_list (namestring, p - namestring,
-                                            VAR_NAMESPACE, LOC_TYPEDEF,
+                                            VAR_DOMAIN, LOC_TYPEDEF,
                                             &objfile->static_psymbols,
                                             symbol.n_value, 0,
                                             psymtab_language, objfile);
                        p += 1;
                      }
-                   /* The semantics of C++ state that "struct foo { ... }"
-                      also defines a typedef for "foo".  Unfortuantely, cfront
-                      never makes the typedef when translating from C++ to C.
-                      We make the typedef here so that "ptype foo" works as
-                      expected for cfront translated code.  */
-                   else if (psymtab_language == language_cplus)
-                     {
-                       /* Also a typedef with the same name.  */
-                       add_psymbol_to_list (namestring, p - namestring,
-                                            VAR_NAMESPACE, LOC_TYPEDEF,
-                                            &objfile->static_psymbols,
-                                            symbol.n_value, 0,
-                                            psymtab_language, objfile);
-                     }
+#if 0 /* OBSOLETE CFront */
+// OBSOLETE                /* The semantics of C++ state that "struct foo { ... }"
+// OBSOLETE                   also defines a typedef for "foo".  Unfortuantely, cfront
+// OBSOLETE                   never makes the typedef when translating from C++ to C.
+// OBSOLETE                   We make the typedef here so that "ptype foo" works as
+// OBSOLETE                   expected for cfront translated code.  */
+// OBSOLETE                else if (psymtab_language == language_cplus)
+// OBSOLETE                  {
+// OBSOLETE                    /* Also a typedef with the same name.  */
+// OBSOLETE                    add_psymbol_to_list (namestring, p - namestring,
+// OBSOLETE                                         VAR_DOMAIN, LOC_TYPEDEF,
+// OBSOLETE                                         &objfile->static_psymbols,
+// OBSOLETE                                         symbol.n_value, 0,
+// OBSOLETE                                         psymtab_language, objfile);
+// OBSOLETE                  }
+#endif /* OBSOLETE CFront */
                  }
                goto check_enum;
 
@@ -2657,7 +2659,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                if (p != namestring)    /* a name is there, not just :T... */
                  {
                    add_psymbol_to_list (namestring, p - namestring,
-                                        VAR_NAMESPACE, LOC_TYPEDEF,
+                                        VAR_DOMAIN, LOC_TYPEDEF,
                                         &objfile->static_psymbols,
                                         symbol.n_value, 0,
                                         psymtab_language, objfile);
@@ -2719,7 +2721,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                        /* Note that the value doesn't matter for
                           enum constants in psymtabs, just in symtabs.  */
                        add_psymbol_to_list (p, q - p,
-                                            VAR_NAMESPACE, LOC_CONST,
+                                            VAR_DOMAIN, LOC_CONST,
                                             &objfile->static_psymbols, 0,
                                             0, psymtab_language, objfile);
                        /* Point past the name.  */
@@ -2737,7 +2739,7 @@ scan_xcoff_symtab (struct objfile *objfile)
              case 'c':
                /* Constant, e.g. from "const" in Pascal.  */
                add_psymbol_to_list (namestring, p - namestring,
-                                    VAR_NAMESPACE, LOC_CONST,
+                                    VAR_DOMAIN, LOC_CONST,
                                     &objfile->static_psymbols, symbol.n_value,
                                     0, psymtab_language, objfile);
                continue;
@@ -2754,7 +2756,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                  }
                symbol.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                add_psymbol_to_list (namestring, p - namestring,
-                                    VAR_NAMESPACE, LOC_BLOCK,
+                                    VAR_DOMAIN, LOC_BLOCK,
                                     &objfile->static_psymbols,
                                     0, symbol.n_value,
                                     psymtab_language, objfile);
@@ -2775,7 +2777,7 @@ scan_xcoff_symtab (struct objfile *objfile)
                  }
                symbol.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                add_psymbol_to_list (namestring, p - namestring,
-                                    VAR_NAMESPACE, LOC_BLOCK,
+                                    VAR_DOMAIN, LOC_BLOCK,
                                     &objfile->global_psymbols,
                                     0, symbol.n_value,
                                     psymtab_language, objfile);
@@ -2798,9 +2800,11 @@ scan_xcoff_symtab (struct objfile *objfile)
              case '9':
              case '-':
              case '#':         /* for symbol identification (used in live ranges) */
-               /* added to support cfront stabs strings */
-             case 'Z':         /* for definition continuations */
-             case 'P':         /* for prototypes */
+#if 0 /* OBSOLETE CFront */
+// OBSOLETE            /* added to support cfront stabs strings */
+// OBSOLETE          case 'Z':         /* for definition continuations */
+// OBSOLETE          case 'P':         /* for prototypes */
+#endif /* OBSOLETE CFront */
                continue;
 
              case ':':