* dbxread.c (unknown_symchar_complaint): Add new complaint.
authorJohn Gilmore <gnu@cygnus>
Thu, 15 Apr 1993 09:41:59 +0000 (09:41 +0000)
committerJohn Gilmore <gnu@cygnus>
Thu, 15 Apr 1993 09:41:59 +0000 (09:41 +0000)
* stabsread.c:  Declare it.
* partial-stab.h:  Use it.

* utils.c (malloc_botch):  Don't forward-declare if NO_MMALLOC.

gdb/ChangeLog
gdb/dbxread.c
gdb/partial-stab.h
gdb/utils.c

index 0f611b11c25b828217c1854b98b725786a4eb6c2..86180bf4c7e7b6b7f1c6e21a5cb7b3f0e026adb7 100644 (file)
@@ -1,3 +1,11 @@
+Thu Apr 15 02:37:48 1993  John Gilmore  (gnu@cacophony.cygnus.com)
+
+       * dbxread.c (unknown_symchar_complaint):  Add new complaint.
+       * stabsread.c:  Declare it.
+       * partial-stab.h:  Use it.
+
+       * utils.c (malloc_botch):  Don't forward-declare if NO_MMALLOC.
+
 Wed Apr 14 17:12:51 1993  Jim Kingdon  (kingdon@cygnus.com)
 
        * stack.c (print_frame_info): Print specially if dummy frame.
index 3f9334b579b537cfd8d1ffbe16f79892317f790e..302d9cb0f679c08804b66d24f6a9088b6e79c1ba 100644 (file)
@@ -1,5 +1,6 @@
 /* Read dbx symbol tables and convert to internal format, for GDB.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993
+   Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -165,6 +166,9 @@ struct complaint string_table_offset_complaint =
 struct complaint unknown_symtype_complaint =
   {"unknown symbol type %s", 0, 0};
 
+struct complaint unknown_symchar_complaint =
+  {"unknown symbol type character `%c'", 0, 0};
+
 struct complaint lbrac_rbrac_complaint =
   {"block start larger than block end", 0, 0};
 
@@ -561,6 +565,9 @@ dbx_symfile_init (objfile)
 
   if (STRING_TABLE_OFFSET == 0)
     {
+      /* It appears that with the existing bfd code, STRING_TABLE_OFFSET
+        will never be zero, even when there is no string table.  This
+        would appear to be a bug in bfd. */
       DBX_STRINGTAB_SIZE (objfile) = 0;
       DBX_STRINGTAB (objfile) = NULL;
     }
@@ -573,28 +580,47 @@ dbx_symfile_init (objfile)
       memset ((PTR) size_temp, 0, sizeof (size_temp));
       val = bfd_read ((PTR) size_temp, sizeof (size_temp), 1, sym_bfd);
       if (val < 0)
-       perror_with_name (name);
-      
-      DBX_STRINGTAB_SIZE (objfile) = bfd_h_get_32 (sym_bfd, size_temp);
-      
-      if (DBX_STRINGTAB_SIZE (objfile) < sizeof (size_temp)
-         || DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
-       error ("ridiculous string table size (%d bytes).",
-              DBX_STRINGTAB_SIZE (objfile));
-      
-      DBX_STRINGTAB (objfile) =
-       (char *) obstack_alloc (&objfile -> psymbol_obstack,
-                               DBX_STRINGTAB_SIZE (objfile));
-      
-      /* Now read in the string table in one big gulp.  */
-      
-      val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET);
-      if (val < 0)
-       perror_with_name (name);
-      val = bfd_read (DBX_STRINGTAB (objfile), DBX_STRINGTAB_SIZE (objfile), 1,
-                     sym_bfd);
-      if (val != DBX_STRINGTAB_SIZE (objfile))
-       perror_with_name (name);
+       {
+         perror_with_name (name);
+       }
+      else if (val == 0)
+       {
+         /* With the existing bfd code, STRING_TABLE_OFFSET will be set to
+            EOF if there is no string table, and attempting to read the size
+            from EOF will read zero bytes. */
+         DBX_STRINGTAB_SIZE (objfile) = 0;
+         DBX_STRINGTAB (objfile) = NULL;
+       }
+      else
+       {
+         /* Read some data that would appear to be the string table size.
+            If there really is a string table, then it is probably the right
+            size.  Byteswap if necessary and validate the size.  Note that
+            the minimum is DBX_STRINGTAB_SIZE_SIZE.  If we just read some
+            random data that happened to be at STRING_TABLE_OFFSET, because
+            bfd can't tell us there is no string table, the sanity checks may
+            or may not catch this. */
+         DBX_STRINGTAB_SIZE (objfile) = bfd_h_get_32 (sym_bfd, size_temp);
+         
+         if (DBX_STRINGTAB_SIZE (objfile) < sizeof (size_temp)
+             || DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
+           error ("ridiculous string table size (%d bytes).",
+                  DBX_STRINGTAB_SIZE (objfile));
+         
+         DBX_STRINGTAB (objfile) =
+           (char *) obstack_alloc (&objfile -> psymbol_obstack,
+                                   DBX_STRINGTAB_SIZE (objfile));
+         
+         /* Now read in the string table in one big gulp.  */
+         
+         val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET);
+         if (val < 0)
+           perror_with_name (name);
+         val = bfd_read (DBX_STRINGTAB (objfile), DBX_STRINGTAB_SIZE (objfile), 1,
+                         sym_bfd);
+         if (val != DBX_STRINGTAB_SIZE (objfile))
+           perror_with_name (name);
+       }
     }
 }
 
@@ -1421,7 +1447,7 @@ read_ofile_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
   if (last_source_start_addr == 0)
     last_source_start_addr = text_offset;
 
-  rtn = end_symtab (text_offset + text_size, 0, 0, objfile);
+  rtn = end_symtab (text_offset + text_size, 0, 0, objfile, SECT_OFF_TEXT);
   end_stabs ();
   return (rtn);
 }
@@ -1668,7 +1694,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
              patch_subfile_names (current_subfile, name);
              break;            /* Ignore repeated SOs */
            }
-         end_symtab (valu, 0, 0, objfile);
+         end_symtab (valu, 0, 0, objfile, SECT_OFF_TEXT);
          end_stabs ();
        }
       start_stabs ();
index d69f7f63e7e48bf0c13ef9fb4398d0ae7f7d4f85..e0831433d2acbccfffae605b56b2592af2b97a3d 100644 (file)
@@ -1,6 +1,6 @@
 /* Shared code to pre-read a stab (dbx-style), when building a psymtab.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation,
-   Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993
+   Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -518,9 +518,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
              /* Global functions were ignored here, but now they
                 are put into the global psymtab like one would expect.
-                They're also in the misc fn vector... 
-                FIXME, why did it used to ignore these?  That broke
-                "i fun" on these functions.  */
+                They're also in the minimal symbol table.  */
            case 'F':
 #ifdef DBXREAD_ONLY
              /* Kludges for ELF/STABS with Sun ACC */
@@ -563,6 +561,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
                 Someone says sun cc puts out symbols like
                 /foo/baz/maclib::/usr/local/bin/maclib,
                 which would get here with a symbol type of ':'.  */
+             complain (&unknown_symchar_complaint, p[1]);
              continue;
            }
 
index 895a62a490694acf2c8a1a93b6e46c14ce2809e7..b69b21453faf71777208f9e1c68b24c4acdef172 100644 (file)
@@ -38,12 +38,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* Prototypes for local functions */
 
-#if !defined (NO_MALLOC_CHECK)
+#if defined (NO_MMALLOC) || defined (NO_MMALLOC_CHECK)
+#else
 
 static void
 malloc_botch PARAMS ((void));
 
-#endif /* NO_MALLOC_CHECK  */
+#endif /* NO_MMALLOC, etc */
 
 static void
 fatal_dump_core ();    /* Can't prototype with <varargs.h> usage... */
@@ -1135,53 +1136,6 @@ fputs_filtered (linebuffer, stream)
     }
 }
 
-
-/* fputs_demangled attempts to demangle NAME, a symbol in language LANG, using
-   demangling args ARG_MODE, and print it filtered to STREAM.  If the name is
-   not mangled, or the language for the name is unknown, or demangling is off,
-   the name is printed in its "raw" form. */
-
-void
-fputs_demangled (name, stream, arg_mode, lang)
-     char *name;
-     FILE *stream;
-     int arg_mode;
-     enum language lang;
-{
-  char *demangled;
-
-  if (name != NULL)
-    {
-      /* If user wants to see raw output, no problem.  */
-      if (!demangle)
-       {
-         fputs_filtered (name, stream);
-       }
-      else
-       {
-         switch (lang)
-           {
-           case language_cplus:
-             demangled = cplus_demangle (name, arg_mode);
-             break;
-             /* start-sanitize-chill */
-           case language_chill:
-             demangled = chill_demangle (name);
-             break;
-             /* end-sanitize-chill */
-           default:
-             demangled = NULL;
-             break;
-           }
-         fputs_filtered (demangled ? demangled : name, stream);
-         if (demangled != NULL)
-           {
-             free (demangled);
-           }
-       }
-    }
-}
-
 /* Print a variable number of ARGS using format FORMAT.  If this
    information is going to put the amount written (since the last call
    to REINITIALIZE_MORE_FILTER or the last page break) over the page size,
@@ -1366,38 +1320,49 @@ print_spaces_filtered (n, stream)
 \f
 /* C++ demangler stuff.  */
 
-/* Print NAME on STREAM, demangling if necessary.  */
+/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in language
+   LANG, using demangling args ARG_MODE, and print it filtered to STREAM.
+   If the name is not mangled, or the language for the name is unknown, or
+   demangling is off, the name is printed in its "raw" form. */
+
 void
-fprint_symbol (stream, name)
+fprintf_symbol_filtered (stream, name, lang, arg_mode)
      FILE *stream;
      char *name;
+     enum language lang;
+     int arg_mode;
 {
-  char *demangled = NULL;
+  char *demangled;
 
-  if (demangle)
+  if (name != NULL)
     {
-      /* Lacking a better method of knowing what demangler to use, pick
-        one appropriate for whatever the current language is.  (FIXME) */
-      switch (current_language -> la_language)
+      /* If user wants to see raw output, no problem.  */
+      if (!demangle)
        {
-         case language_cplus:
-           demangled = cplus_demangle (name, DMGL_PARAMS | DMGL_ANSI);
-           break;
-         /* start-sanitize-chill */
-         case language_chill:
-           demangled = chill_demangle (name);
-           break;
-         /* end-sanitize-chill */
+         fputs_filtered (name, stream);
+       }
+      else
+       {
+         switch (lang)
+           {
+           case language_cplus:
+             demangled = cplus_demangle (name, arg_mode);
+             break;
+             /* start-sanitize-chill */
+           case language_chill:
+             demangled = chill_demangle (name);
+             break;
+             /* end-sanitize-chill */
+           default:
+             demangled = NULL;
+             break;
+           }
+         fputs_filtered (demangled ? demangled : name, stream);
+         if (demangled != NULL)
+           {
+             free (demangled);
+           }
        }
-    }
-  if (demangled == NULL)
-    {
-      fputs_filtered (name, stream);
-    }
-  else
-    {
-      fputs_filtered (demangled, stream);
-      free (demangled);
     }
 }
 
This page took 0.033204 seconds and 4 git commands to generate.