]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* defs.h: Incorporate param.h. All users changed.
authorJohn Gilmore <gnu@cygnus>
Thu, 21 Nov 1991 18:42:05 +0000 (18:42 +0000)
committerJohn Gilmore <gnu@cygnus>
Thu, 21 Nov 1991 18:42:05 +0000 (18:42 +0000)
* param-no-tm.h:  Change users to define TM_FILE_OVERRIDE instead.
* param.h, param-no-tm.h:  Removed.
* Update copyrights in all changed files.
* dbxread.c, dwarfread.c, inflow.c, infrun.c, m2-exp.y, putenv.c,
solib.c, symtab.h, tm-umax.h, valprint.c:  Lint.
* tm-convex.h, tm-hp300hpux.h, tm-merlin.h, tm-sparc.h,
xm-merlin.h:  Avoid host include files in target descriptions.
* getpagesize.h:  Removed, libiberty copes now.

93 files changed:
gdb/ChangeLog
gdb/altos-xdep.c
gdb/am29k-tdep.c
gdb/arm-pinsn.c
gdb/arm-xdep.c
gdb/buildsym.c
gdb/c-exp.y
gdb/coffread.c
gdb/command.c
gdb/convex-pinsn.c
gdb/convex-tdep.c
gdb/convex-xdep.c
gdb/core.c
gdb/coredep.c
gdb/cplus-dem.c
gdb/dbxread.c
gdb/defs.h
gdb/dwarfread.c
gdb/elfread.c
gdb/exec.c
gdb/findvar.c
gdb/gould-pinsn.c
gdb/gould-xdep.c
gdb/hp300ux-xdep.c
gdb/i386-pinsn.c
gdb/i386-tdep.c
gdb/i386-xdep.c
gdb/i387-tdep.c
gdb/i960-pinsn.c
gdb/i960-tdep.c
gdb/ieee-float.c
gdb/inflow.c
gdb/infptrace.c
gdb/infrun.hacked.c
gdb/kdb-start.c
gdb/m2-exp.y
gdb/m68k-pinsn.c
gdb/m88k-pinsn.c
gdb/m88k-tdep.c
gdb/m88k-xdep.c
gdb/mach386-xdep.c
gdb/main.c
gdb/mem-break.c
gdb/mips-pinsn.c
gdb/mips-tdep.c
gdb/mips-xdep.c
gdb/mipsread.c
gdb/nindy-tdep.c
gdb/ns32k-pinsn.c
gdb/parse.c
gdb/printcmd.c
gdb/procfs.c
gdb/putenv.c
gdb/pyr-pinsn.c
gdb/pyr-tdep.c
gdb/pyr-xdep.c
gdb/remote-adapt.c
gdb/remote-eb.c
gdb/remote-nindy.c
gdb/remote-sa.sparc.c
gdb/remote-vx.68.c
gdb/remote-vx.c
gdb/rs6000-tdep.c
gdb/rs6000-xdep.c
gdb/signame.c
gdb/sparc-pinsn.c
gdb/sparc-xdep.c
gdb/standalone.c
gdb/sun3-xdep.c
gdb/sun386-xdep.c
gdb/symfile.c
gdb/symm-tdep.c
gdb/symm-xdep.c
gdb/symtab.c
gdb/symtab.h
gdb/tahoe-pinsn.c
gdb/tm-convex.h
gdb/tm-hp300hpux.h
gdb/tm-merlin.h
gdb/tm-sparc.h
gdb/tm-umax.h
gdb/ultra3-xdep.c
gdb/umax-xdep.c
gdb/utils.c
gdb/valops.c
gdb/valprint.c
gdb/values.c
gdb/vax-pinsn.c
gdb/xcoffexec.c
gdb/xcoffread.c
gdb/xm-convex.h
gdb/xm-merlin.h
gdb/xm-sparc.h

index 796c4964877bf452fd01d6635dedd4fe1c8b2f9c..e778cbde558ca820be097f0af01b5b60ca5bd1e0 100644 (file)
@@ -1,3 +1,15 @@
+Thu Nov 21 10:23:52 1991  John Gilmore  (gnu at cygnus.com)
+
+       * defs.h:  Incorporate param.h.  All users changed.
+       * param-no-tm.h:  Change users to define TM_FILE_OVERRIDE instead.
+       * param.h, param-no-tm.h:  Removed.
+       * Update copyrights in all changed files.
+       * dbxread.c, dwarfread.c, inflow.c, infrun.c, m2-exp.y, putenv.c,
+       solib.c, symtab.h, tm-umax.h, valprint.c:  Lint.
+       * tm-convex.h, tm-hp300hpux.h, tm-merlin.h, tm-sparc.h,
+       xm-merlin.h:  Avoid host include files in target descriptions.
+       * getpagesize.h:  Removed, libiberty copes now.
+
 Wed Nov 20 18:35:56 1991  John Gilmore  (gnu at cygnus.com)
 
        * Remove gdb/hp-include.  Support for HP a.out oddities should be
index 8cbdfc9a0d9ad57ecaf2d0e11143942616c67064..e6ff104146422452207b3ac10342a822b39ccb94 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index ce1fa8557b53b8c6add54dc93ebba561f87d3033..d4720b7df42ed17fb5539a9b424255a5e56740d8 100644 (file)
@@ -1,5 +1,5 @@
 /* Target-machine dependent code for the AMD 29000
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright 1990, 1991 Free Software Foundation, Inc.
    Contributed by Cygnus Support.  Written by Jim Kingdon.
 
 This file is part of GDB.
@@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include "frame.h"
 #include "value.h"
-#include "param.h"
 #include "symtab.h"
 #include "inferior.h"
 
index 5da799716ffb858b29956a5c030f204e63c92ba1..f4cd84a0c1fbfb803d1900cc8932e3c58d5539ec 100644 (file)
@@ -1,5 +1,5 @@
-/* Print ARM instructions for GDB, the GNU debugger.
-   Copyright (C) 1986, 1989 Free Software Foundation, Inc.
+/* Print Acorn Risc Machine instructions for GDB, the GNU debugger.
+   Copyright 1986, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <assert.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "arm-opcode.h"
 
index e03e16d3bf142b72fc8df7a8225bbc97214b0c67..5fc4de77abde53f122b6418c488ead526656ae00 100644 (file)
@@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "arm-opcode.h"
index 410417d942e13e9fed7fc5b0907ac202b2f56a98..151048499baa43d2deb2d4693f5cea91c64ad999 100644 (file)
@@ -25,7 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    make xcoffread.c more maintainable by sharing code.  */
 
 #include "defs.h"
-#include "param.h"
 #include "obstack.h"
 #include "symtab.h"
 #include "breakpoint.h"
index d3703cb5a53d6b3970159409bbe7fabdc7ca4f4e..192ed47c1cf13f089765de37b1e3f850ca655ea6 100644 (file)
@@ -31,7 +31,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
 #include "expression.h"
index 4b9f2451cef8a246269083dffb0831cbba236d80..6a9b82fbc5cf5215ee218621e36be0a57ac43d50 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 \f
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "breakpoint.h"
 #include "bfd.h"
index d8839401cd227b8972f06383ba127457d82a0518..17477069545aea87cd4e8673b7e7601a848b2e05 100644 (file)
@@ -1,5 +1,5 @@
-/* Library for reading command lines and decoding commands.
-   Copyright (C) 1986, 1989, 1990 Free Software Foundation, Inc.
+/* Handle lists of commands, their decoding and documentation, for GDB.
+   Copyright 1986, 1989, 1990, 1991 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "command.h"
 #include "symtab.h"
 #include "value.h"
index ca9e9ca4e11e7767adc7b71397f0f8f62c978c5a..9a792ac7bc37e7eac27505d482fcf7561058b011 100644 (file)
@@ -1,5 +1,5 @@
 /* Print Convex instructions for GDB, the GNU debugger.
-   Copyright (C) 1989 Free Software Foundation, Inc.
+   Copyright 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 
 /* reg (fmt_field, inst_field) --
index ce6382b948045c45a92a4cf79667ded47b645d75..8c86ae8fc9f1e2fb2f736cdd2b363633c3492486 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "command.h"
 #include "symtab.h"
 #include "value.h"
index bfce6ebd6f625e6d698248a7993756de95c1ed35..6fbcd24d3560f489fc87606890e532ddbbf6ce94 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "command.h"
 #include "symtab.h"
 #include "value.h"
index 8b6895d323c113a73a3b71649cf34552fa3b9660..c59fc55c0031a5cc1f0f0d2dd92b31b38503dd3c 100644 (file)
@@ -1,5 +1,5 @@
 /* Work with core dump and executable files, for GDB.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <signal.h>
 #include <fcntl.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"  /* required by inferior.h */
 #include "inferior.h"
 #include "symtab.h"
index 87be34992aa255ac756bed98f400ddbd087cfe08..bb26b081e17c950474981b0ecdd6552878c90c07 100644 (file)
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    this file is more machine-specific.  */
 
 #include "defs.h"
-#include "param.h"
 #include "gdbcore.h"
 #include <stdio.h>
 
index 6800f3ffd3219f8df53c3afcc83e2ae00a80fe72..b34732c68e7daee4f65ca26f6d7127499880e83d 100644 (file)
@@ -1,5 +1,5 @@
 /* Demangler for GNU C++ 
-   Copyright (C) 1989 Free Software Foundation, Inc.
+   Copyright 1989, 1991 Free Software Foundation, Inc.
    written by James Clark (jjc@jclark.uucp)
    
    This program is free software; you can redistribute it and/or modify
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-/* This is for g++ 1.36.1 (November 6 version). It will probably
-   require changes for any other version.
-
-   Modified for g++ 1.36.2 (November 18 version).
-
-   Modified for g++ 1.90.06 (December 31 version).
-
-   Modified for g++ 1.95.03 (November 13 verison).  */
+/* This is for g++ 1.95.03 (November 13 verison).  */
 
 /* This file exports one function
 
@@ -61,7 +54,6 @@
 
 /* GDB-specific, FIXME.  */
 #include "defs.h"
-#include "param.h"
 
 #ifdef USG
 #include <memory.h>
index c7741abe98cbe9a425606f4b61241c544241d903..371f923560cdf85a1778569725afdda289c0d905 100644 (file)
@@ -34,7 +34,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 
 #ifdef USG
 #include <sys/types.h>
@@ -70,7 +69,6 @@ struct dbx_symfile_info {
   char *stringtab;             /* The actual string table */
   int stringtab_size;          /* Its size */
   off_t symtab_offset;         /* Offset in file to symbol table */
-  int desc;                    /* File descriptor of symbol file */
 };
 
 
@@ -101,16 +99,12 @@ extern double atof ();
 static void read_dbx_symtab ();
 static void init_psymbol_list ();
 static void process_one_symbol ();
-static struct symbol *define_symbol ();
 void start_subfile ();
 int hashname ();
 static struct pending *copy_pending ();
 static struct symtab *read_ofile_symtab ();
 static void dbx_psymtab_to_symtab ();
 
-static const char vptr_name[] = { '_','v','p','t','r',CPLUS_MARKER,'\0' };
-static const char vb_name[] =   { '_','v','b',CPLUS_MARKER,'\0' };
-
 /* Macro to determine which symbols to ignore when reading the first symbol
    of a file.  Some machines override this definition. */
 #ifndef IGNORE_SYMBOL
@@ -135,11 +129,14 @@ static const char vb_name[] =   { '_','v','b',CPLUS_MARKER,'\0' };
 /* Nonzero means give verbose info on gdb action.  From main.c.  */
 extern int info_verbose;
 
-/* The BFD for this file -- only good while we're actively reading
-   symbols into a psymtab or a symtab.  */
+/* The BFD for this file -- implicit parameter to next_symbol_text.  */
 
 static bfd *symfile_bfd;
 
+/* The objfile for this file -- only good in process_one_symbol().  */
+
+static struct objfile *our_objfile;
+
 /* String table for the main symbol file.  It is kept in memory
    permanently, to speed up symbol reading.  Other files' symbol tables
    are read in on demand.  FIXME, this should be cleaner.  */
@@ -166,6 +163,12 @@ struct complaint unknown_symtype_complaint =
 
 struct complaint lbrac_rbrac_complaint =
   {"block start larger than block end", 0, 0};
+
+struct complaint lbrac_unmatched_complaint =
+  {"unmatched N_LBRAC before symtab pos %d", 0, 0};
+
+struct complaint lbrac_mismatch_complaint =
+  {"N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d", 0, 0};
 \f
 /* During initial symbol readin, we need to have a structure to keep
    track of which psymtabs have which bincls in them.  This structure
@@ -184,13 +187,6 @@ struct header_file_location
 static struct header_file_location *bincl_list, *next_bincl;
 static int bincls_allocated;
 
-/* When a header file is getting special overriding definitions
-   for one source file, record here the header_files index
-   of its normal definition vector.
-   At other times, this is -1.  */
-
-static int header_file_prev_index;
-
 /* Free up old header file tables, and allocate new ones.
    We're reading a new symbol file now.  */
 
@@ -327,51 +323,6 @@ explicit_lookup_type (real_filenum, index)
 }
 #endif
 \f
-/* Handle the N_BINCL and N_EINCL symbol types
-   that act like N_SOL for switching source files
-   (different subfiles, as we call them) within one object file,
-   but using a stack rather than in an arbitrary order.  */
-
-struct subfile_stack
-{
-  struct subfile_stack *next;
-  char *name;
-  int prev_index;
-};
-
-struct subfile_stack *subfile_stack;
-
-static void
-push_subfile ()
-{
-  register struct subfile_stack *tem
-    = (struct subfile_stack *) xmalloc (sizeof (struct subfile_stack));
-
-  tem->next = subfile_stack;
-  subfile_stack = tem;
-  if (current_subfile == 0 || current_subfile->name == 0)
-    abort ();
-  tem->name = current_subfile->name;
-  tem->prev_index = header_file_prev_index;
-}
-
-static char *
-pop_subfile ()
-{
-  register char *name;
-  register struct subfile_stack *link = subfile_stack;
-
-  if (link == 0)
-    abort ();
-
-  name = link->name;
-  subfile_stack = link->next;
-  header_file_prev_index = link->prev_index;
-  free (link);
-
-  return name;
-}
-\f
 static void
 record_misc_function (name, address, type)
      char *name;
@@ -412,13 +363,12 @@ dbx_symfile_read (sf, addr, mainline)
      int mainline;     /* FIXME comments above */
 {
   struct dbx_symfile_info *info = (struct dbx_symfile_info *) (sf->sym_private);
-  bfd *sym_bfd = sf->sym_bfd;
+  bfd *sym_bfd = sf->objfile->obfd;
   int val;
-  char *filename = bfd_get_filename (sym_bfd);
 
-  val = lseek (info->desc, info->symtab_offset, L_SET);
+  val = bfd_seek (sf->objfile->obfd, info->symtab_offset, L_SET);
   if (val < 0)
-    perror_with_name (filename);
+    perror_with_name (sf->objfile->name);
 
   /* If mainline, set global string table pointers, and reinitialize global
      partial symbol list.  */
@@ -431,8 +381,6 @@ dbx_symfile_read (sf, addr, mainline)
   if (mainline || global_psymbols.size == 0 || static_psymbols.size == 0)
     init_psymbol_list (info->symcount);
 
-  symfile_bfd = sym_bfd;               /* Kludge for SWAP_SYMBOL */
-
   /* FIXME POKING INSIDE BFD DATA STRUCTURES */
   symbol_size = obj_symbol_entry_size (sym_bfd);
 
@@ -445,9 +393,8 @@ dbx_symfile_read (sf, addr, mainline)
   /* Now that the symbol table data of the executable file are all in core,
      process them and define symbols accordingly.  */
 
-  read_dbx_symtab (filename, 
-                  addr - bfd_section_vma (sym_bfd, info->text_sect), /*offset*/
-                  info->desc, info->stringtab, info->stringtab_size,
+  read_dbx_symtab (addr - bfd_section_vma (sym_bfd, info->text_sect), /*offset*/
+                  sf->objfile, info->stringtab, info->stringtab_size,
                   info->symcount,
                   bfd_section_vma  (sym_bfd, info->text_sect),
                   bfd_section_size (sym_bfd, info->text_sect));
@@ -510,9 +457,7 @@ dbx_symfile_init (sf)
   struct sym_fns *sf;
 {
   int val;
-  int desc;
-  struct stat statbuf;
-  bfd *sym_bfd = sf->sym_bfd;
+  bfd *sym_bfd = sf->objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
   struct dbx_symfile_info *info;
   unsigned char size_temp[4];
@@ -522,30 +467,26 @@ dbx_symfile_init (sf)
   info = (struct dbx_symfile_info *)sf->sym_private;
 
   /* FIXME POKING INSIDE BFD DATA STRUCTURES */
-  desc = fileno ((FILE *)(sym_bfd->iostream)); /* Raw file descriptor */
 #define        STRING_TABLE_OFFSET     (sym_bfd->origin + obj_str_filepos (sym_bfd))
 #define        SYMBOL_TABLE_OFFSET     (sym_bfd->origin + obj_sym_filepos (sym_bfd))
   /* FIXME POKING INSIDE BFD DATA STRUCTURES */
 
-  info->desc = desc;
   info->text_sect = bfd_get_section_by_name (sym_bfd, ".text");
   if (!info->text_sect)
     abort();
   info->symcount = bfd_get_symcount (sym_bfd);
 
   /* Read the string table size and check it for bogosity.  */
-  val = lseek (desc, STRING_TABLE_OFFSET, L_SET);
+  val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET);
   if (val < 0)
       perror_with_name (name);
-  if (fstat (desc, &statbuf) == -1)
-      perror_with_name (name);
 
-  val = myread (desc, size_temp, sizeof (long));
+  val = bfd_read (size_temp, sizeof (long), 1, sym_bfd);
   if (val < 0)
       perror_with_name (name);
   info->stringtab_size = bfd_h_get_32 (sym_bfd, size_temp);
   
-  if (info->stringtab_size >= 0 && info->stringtab_size < statbuf.st_size)
+  if (info->stringtab_size >= 0)
     {
       info->stringtab = (char *) xmalloc (info->stringtab_size);
       /* Caller is responsible for freeing the string table.  No cleanup. */
@@ -557,11 +498,11 @@ dbx_symfile_init (sf)
 
   /* Now read in the string table in one big gulp.  */
 
-  val = lseek (desc, STRING_TABLE_OFFSET, L_SET);
+  val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET);
   if (val < 0)
     perror_with_name (name);
-  val = myread (desc, info->stringtab, info->stringtab_size);
-  if (val < 0)
+  val = bfd_read (info->stringtab, info->stringtab_size, 1, sym_bfd);
+  if (val != info->stringtab_size)
     perror_with_name (name);
 
   /* Record the position of the symbol table for later use.  */
@@ -574,9 +515,6 @@ static struct internal_nlist symbuf[4096];
 static int symbuf_idx;
 static int symbuf_end;
 
-/* I/O descriptor for reading the symbol table.  */
-static int symtab_input_desc;
-
 /* The address in memory of the string table of the object file we are
    reading (which might not be the "main" object file, but might be a
    shared library or some other dynamically loaded thing).  This is set
@@ -590,26 +528,26 @@ static char *stringtab_global;
    This function can read past the end of the symbol table
    (into the string table) but this does no harm.  */
 
-static int
-fill_symbuf ()
+static void
+fill_symbuf (sym_bfd)
+     bfd *sym_bfd;
 {
-  int nbytes = myread (symtab_input_desc, symbuf, sizeof (symbuf));
+  int nbytes = bfd_read (symbuf, sizeof (symbuf), 1, sym_bfd);
   if (nbytes < 0)
-    perror_with_name ("<symbol file>");
+    perror_with_name (bfd_get_filename (sym_bfd));
   else if (nbytes == 0)
     error ("Premature end of file reading symbol table");
   symbuf_end = nbytes / symbol_size;
   symbuf_idx = 0;
-  return 1;
 }
 
-#define SWAP_SYMBOL(symp) \
+#define SWAP_SYMBOL(symp, abfd) \
   { \
-    (symp)->n_strx = bfd_h_get_32(symfile_bfd,                 \
+    (symp)->n_strx = bfd_h_get_32(abfd,                        \
                                (unsigned char *)&(symp)->n_strx);      \
-    (symp)->n_desc = bfd_h_get_16 (symfile_bfd,                        \
+    (symp)->n_desc = bfd_h_get_16 (abfd,                       \
                                (unsigned char *)&(symp)->n_desc);      \
-    (symp)->n_value = bfd_h_get_32 (symfile_bfd,                       \
+    (symp)->n_value = bfd_h_get_32 (abfd,                      \
                                (unsigned char *)&(symp)->n_value);     \
   }
 
@@ -626,9 +564,9 @@ char *
 next_symbol_text ()
 {
   if (symbuf_idx == symbuf_end)
-    fill_symbuf ();
+    fill_symbuf (symfile_bfd);
   symnum++;
-  SWAP_SYMBOL(&symbuf[symbuf_idx]);
+  SWAP_SYMBOL(&symbuf[symbuf_idx], symfile_bfd);
   return symbuf[symbuf_idx++].n_strx + stringtab_global;
 }
 \f
@@ -778,12 +716,10 @@ ADD_PSYMBOL_TO_PLIST(NAME, NAMELENGTH, NAMESPACE, CLASS, PLIST, VALUE)
    and ADDR is its relocated address (if incremental) or 0 (if not).  */
 
 static void
-read_dbx_symtab (symfile_name, addr,
-                desc, stringtab, stringtab_size, nlistlen,
+read_dbx_symtab (addr, objfile, stringtab, stringtab_size, nlistlen,
                 text_addr, text_size)
-     char *symfile_name;
      CORE_ADDR addr;
-     int desc;
+     struct objfile *objfile;
      register char *stringtab;
      register long stringtab_size;
      register int nlistlen;
@@ -798,6 +734,7 @@ read_dbx_symtab (symfile_name, addr,
   CORE_ADDR last_o_file_start = 0;
   struct cleanup *old_chain;
   char *p;
+  bfd *abfd;
 
   /* End of the text segment of the executable file.  */
   CORE_ADDR end_of_text_addr;
@@ -829,10 +766,7 @@ read_dbx_symtab (symfile_name, addr,
     (struct partial_symtab **) alloca (dependencies_allocated *
                                       sizeof (struct partial_symtab *));
 
-  /* FIXME!!  If an error occurs, this blows away the whole symbol table! 
-     It should only blow away the psymtabs created herein.  We could
-     be reading a shared library or a dynloaded file!  */
-  old_chain = make_cleanup (free_all_psymtabs, 0);
+  old_chain = make_cleanup (free_objfile, objfile);
 
   /* Init bincl list */
   init_bincl_list (20);
@@ -846,7 +780,8 @@ read_dbx_symtab (symfile_name, addr,
   end_of_text_addr = text_addr + addr + text_size;     /* Relocate */
 #endif
 
-  symtab_input_desc = desc;    /* This is needed for fill_symbuf below */
+  symfile_bfd = objfile->obfd; /* For next_text_symbol */
+  abfd = objfile->obfd;
   symbuf_end = symbuf_idx = 0;
 
   for (symnum = 0; symnum < nlistlen; symnum++)
@@ -854,7 +789,7 @@ read_dbx_symtab (symfile_name, addr,
       /* Get the symbol for this run and pull out some info */
       QUIT;    /* allow this to be interruptable */
       if (symbuf_idx == symbuf_end)
-       fill_symbuf ();
+       fill_symbuf (abfd);
       bufp = &symbuf[symbuf_idx++];
 
       /*
@@ -862,7 +797,7 @@ read_dbx_symtab (symfile_name, addr,
        */
       if (bufp->n_type == (unsigned char)N_SLINE) continue;
 
-      SWAP_SYMBOL (bufp);
+      SWAP_SYMBOL (bufp, abfd);
 
       /* Ok.  There is a lot of code duplicated in the rest of this
          switch statement (for efficiency reasons).  Since I don't
@@ -880,7 +815,7 @@ read_dbx_symtab (symfile_name, addr,
    give a fake name, and print a single error message per symbol file read,
    rather than abort the symbol reading or flood the user with messages.  */
 #define SET_NAMESTRING()\
-  if (bufp->n_strx < 0 || bufp->n_strx >= stringtab_size) {    \
+  if (((unsigned)bufp->n_strx) >= stringtab_size) {    \
     complain (&string_table_offset_complaint, symnum);                 \
     namestring = "foo";                                                        \
   } else                                                               \
@@ -1072,12 +1007,12 @@ read_dbx_symtab (symfile_name, addr,
          /* Peek at the next symbol.  If it is also an N_SO, the
             first one just indicates the directory.  */
          if (symbuf_idx == symbuf_end)
-           fill_symbuf ();
+           fill_symbuf (abfd);
          bufp = &symbuf[symbuf_idx];
          /* n_type is only a char, so swapping swapping is irrelevant.  */
          if (bufp->n_type == (unsigned char)N_SO)
            {
-             SWAP_SYMBOL (bufp);
+             SWAP_SYMBOL (bufp, abfd);
              SET_NAMESTRING ();
              valu = bufp->n_value;
              symbuf_idx++;
@@ -1098,7 +1033,7 @@ read_dbx_symtab (symfile_name, addr,
          else
            past_first_source_file = 1;
 
-         pst = start_psymtab (symfile_name, addr,
+         pst = start_psymtab (objfile, addr,
                               namestring, valu,
                               first_symnum * symbol_size,
                               global_psymbols.next, static_psymbols.next);
@@ -1494,9 +1429,9 @@ read_dbx_symtab (symfile_name, addr,
 
 
 static struct partial_symtab *
-start_psymtab (symfile_name, addr,
+start_psymtab (objfile, addr,
               filename, textlow, ldsymoff, global_syms, static_syms)
-     char *symfile_name;
+     struct objfile *objfile;
      CORE_ADDR addr;
      char *filename;
      CORE_ADDR textlow;
@@ -1510,11 +1445,6 @@ start_psymtab (symfile_name, addr,
 
   result->addr = addr;
 
-  result->symfile_name =
-    (char *) obstack_alloc (psymbol_obstack,
-                           strlen (symfile_name) + 1);
-  strcpy (result->symfile_name, symfile_name);
-  
   result->filename =
     (char *) obstack_alloc (psymbol_obstack,
                            strlen (filename) + 1);
@@ -1535,6 +1465,10 @@ start_psymtab (symfile_name, addr,
   result->n_global_syms = 0;
   result->n_static_syms = 0;
 
+  /* Chain it to the list owned by the current object file.  */
+  result->objfile = objfile;
+  result->objfile_chain = objfile->psymtabs;
+  objfile->psymtabs = result;
 
   return result;
 }
@@ -1603,7 +1537,6 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
 
   for (i = 0; i < num_includes; i++)
     {
-      /* Eventually, put this on obstack */
       struct partial_symtab *subpst =
        (struct partial_symtab *)
          obstack_alloc (psymbol_obstack,
@@ -1614,7 +1547,11 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
                                strlen (include_list[i]) + 1);
       strcpy (subpst->filename, include_list[i]);
 
-      subpst->symfile_name = pst->symfile_name;
+      /* Chain it to the list that this object file owns.  */
+      subpst->objfile = pst->objfile;
+      subpst->objfile_chain = pst->objfile->psymtabs;
+      pst->objfile->psymtabs = subpst;
+
       subpst->addr = pst->addr;
       subpst->read_symtab_private = (char *) obstack_alloc (psymbol_obstack,
                                                   sizeof (struct symloc));
@@ -1653,15 +1590,23 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
      This happens in VxWorks.  */
   free_named_symtabs (pst->filename);
 
-  /* Put the psymtab on the psymtab list */
-  pst->next = partial_symtab_list;
-  partial_symtab_list = pst;
+  if (num_includes == 0
+   && number_dependencies == 0
+   && pst->n_global_syms == 0
+   && pst->n_static_syms == 0) {
+    /* Throw away this psymtab, it's empty.  We can't deallocate it, since
+       it is on the obstack, but we can forget to chain it on the list.  */
+    ;
+  } else {
+    /* Put the psymtab on the psymtab list */
+    pst->next = partial_symtab_list;
+    partial_symtab_list = pst;
+  }
 }
 \f
 static void
-psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset)
+psymtab_to_symtab_1 (pst, stringtab, stringtab_size, sym_offset)
      struct partial_symtab *pst;
-     int desc;
      char *stringtab;
      int stringtab_size;
      int sym_offset;
@@ -1694,7 +1639,7 @@ psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset)
            wrap_here ("");             /* Flush output */
            fflush (stdout);
          }
-       psymtab_to_symtab_1 (pst->dependencies[i], desc,
+       psymtab_to_symtab_1 (pst->dependencies[i],
                             stringtab, stringtab_size, sym_offset);
       }
 
@@ -1705,9 +1650,9 @@ psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset)
       old_chain = make_cleanup (really_free_pendings, 0);
 
       /* Read in this files symbols */
-      lseek (desc, sym_offset, L_SET);
+      bfd_seek (pst->objfile->obfd, sym_offset, L_SET);
       pst->symtab =
-       read_ofile_symtab (desc, stringtab, stringtab_size,
+       read_ofile_symtab (pst->objfile, stringtab, stringtab_size,
                           LDSYMOFF(pst),
                           LDSYMLEN(pst), pst->textlow,
                           pst->texthigh - pst->textlow, pst->addr);
@@ -1727,11 +1672,8 @@ static void
 dbx_psymtab_to_symtab (pst)
      struct partial_symtab *pst;
 {
-  int desc;
   char *stringtab;
   int stsize, val;
-  struct stat statbuf;
-  struct cleanup *old_chain;
   bfd *sym_bfd;
   long st_temp;
 
@@ -1755,44 +1697,32 @@ dbx_psymtab_to_symtab (pst)
          fflush (stdout);
        }
 
-      /* Open symbol file and read in string table.  Symbol_file_command
-        guarantees that the symbol file name will be absolute, so there is
-        no need for openp.  */
-      desc = open(pst->symfile_name, O_RDONLY, 0);
-
-      if (desc < 0)
-       perror_with_name (pst->symfile_name);
+      sym_bfd = pst->objfile->obfd;
 
-      sym_bfd = bfd_fdopenr (pst->symfile_name, NULL, desc);
-      if (!sym_bfd)
-       {
-         (void)close (desc);
-         error ("Could not open `%s' to read symbols: %s",
-                pst->symfile_name, bfd_errmsg (bfd_error));
-       }
-      old_chain = make_cleanup (bfd_close, sym_bfd);
-      if (!bfd_check_format (sym_bfd, bfd_object))
-         error ("\"%s\": can't read symbols: %s.",
-                pst->symfile_name, bfd_errmsg (bfd_error));
-
-      /* We keep the string table for symfile resident in memory, but
+      /* We keep the string table for the main symfile resident in memory, but
         not the string table for any other symbol files.  */
-      if ((symfile == 0) || 0 != strcmp(pst->symfile_name, symfile))
+      if (symfile_objfile != pst->objfile)
        {
          /* Read in the string table */
 
          /* FIXME, this uses internal BFD variables.  See above in
             dbx_symbol_file_open where the macro is defined!  */
-         lseek (desc, STRING_TABLE_OFFSET, L_SET);
+         bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET);
 
-         val = myread (desc, &st_temp, sizeof st_temp);
+         val = bfd_read (&st_temp, sizeof st_temp, 1, sym_bfd);
          if (val < 0)
-             perror_with_name (pst->symfile_name);
+             perror_with_name (pst->objfile->name);
          stsize = bfd_h_get_32 (sym_bfd, (unsigned char *)&st_temp);
+#if 0
+         /* BFD doesn't provide a way to know the total file size, sigh */
+          struct stat statbuf;
          if (fstat (desc, &statbuf) < 0)
-           perror_with_name (pst->symfile_name);
+           perror_with_name (pst->objfile->name);
          
          if (stsize >= 0 && stsize < statbuf.st_size)
+#else
+         if (stsize >= 0)
+#endif
            {
 #ifdef BROKEN_LARGE_ALLOCA
              stringtab = (char *) xmalloc (stsize);
@@ -1808,12 +1738,12 @@ dbx_psymtab_to_symtab (pst)
 
          /* FIXME, this uses internal BFD variables.  See above in
             dbx_symbol_file_open where the macro is defined!  */
-         val = lseek (desc, STRING_TABLE_OFFSET, L_SET);
+         val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, L_SET);
          if (val < 0)
-           perror_with_name (pst->symfile_name);
-         val = myread (desc, stringtab, stsize);
+           perror_with_name (pst->objfile->name);
+         val = bfd_read (stringtab, stsize, 1, sym_bfd);
          if (val < 0)
-           perror_with_name (pst->symfile_name);
+           perror_with_name (pst->objfile->name);
        }
       else
        {
@@ -1821,48 +1751,24 @@ dbx_psymtab_to_symtab (pst)
          stsize = symfile_string_table_size;
        }
 
-      symfile_bfd = sym_bfd;           /* Kludge for SWAP_SYMBOL */
       /* FIXME POKING INSIDE BFD DATA STRUCTURES */
       symbol_size = obj_symbol_entry_size (sym_bfd);
 
       /* FIXME, this uses internal BFD variables.  See above in
         dbx_symbol_file_open where the macro is defined!  */
-      psymtab_to_symtab_1 (pst, desc, stringtab, stsize,
+      psymtab_to_symtab_1 (pst, stringtab, stsize,
                           SYMBOL_TABLE_OFFSET);
 
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
       scan_file_globals ();
 
-      do_cleanups (old_chain);
-
       /* Finish up the debug error message.  */
       if (info_verbose)
        printf_filtered ("done.\n");
     }
 }
 
-/* Process a pair of symbols.  Currently they must both be N_SO's.  */
-/* ARGSUSED */
-static void
-process_symbol_pair (type1, desc1, value1, name1,
-                    type2, desc2, value2, name2)
-     int type1;
-     int desc1;
-     CORE_ADDR value1;
-     char *name1;
-     int type2;
-     int desc2;
-     CORE_ADDR value2;
-     char *name2;
-{
-  /* No need to check PCC_SOL_BROKEN, on the assumption that such
-     broken PCC's don't put out N_SO pairs.  */
-  if (last_source_file)
-    (void)end_symtab (value2, 0, 0);
-  start_symtab (name2, name1, value2);
-}
-
 /*
  * Read in a defined section of a specific object file's symbols.
  *
@@ -1879,9 +1785,9 @@ process_symbol_pair (type1, desc1, value1, name1,
  */
 
 static struct symtab *
-read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
+read_ofile_symtab (objfile, stringtab, stringtab_size, sym_offset,
                   sym_size, text_offset, text_size, offset)
-     int desc;
+     struct objfile *objfile;
      register char *stringtab;
      unsigned int stringtab_size;
      int sym_offset;
@@ -1891,15 +1797,19 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
      int offset;
 {
   register char *namestring;
-  struct internal_nlist *bufp;
+  register struct internal_nlist *bufp;
   unsigned char type;
   unsigned max_symnum;
+  register bfd *abfd;
+
   subfile_stack = 0;
 
   stringtab_global = stringtab;
   last_source_file = 0;
 
-  symtab_input_desc = desc;
+  abfd = objfile->obfd;
+  symfile_bfd = objfile->obfd; /* Implicit param to next_text_symbol */
+  our_objfile = objfile;  /* For end_symtab calls in process_one_symbol */
   symbuf_end = symbuf_idx = 0;
 
   /* It is necessary to actually read one symbol *before* the start
@@ -1910,10 +1820,10 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
      would slow down initial readin, so we look for it here instead.  */
   if (sym_offset >= (int)symbol_size)
     {
-      lseek (desc, sym_offset - symbol_size, L_INCR);
-      fill_symbuf ();
+      bfd_seek (symfile_bfd, sym_offset - symbol_size, L_INCR);
+      fill_symbuf (abfd);
       bufp = &symbuf[symbuf_idx++];
-      SWAP_SYMBOL (bufp);
+      SWAP_SYMBOL (bufp, abfd);
 
       SET_NAMESTRING ();
 
@@ -1927,12 +1837,12 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
       /* The N_SO starting this symtab is the first symbol, so we
         better not check the symbol before it.  I'm not this can
         happen, but it doesn't hurt to check for it.  */
-      lseek(desc, sym_offset, L_INCR);
+      bfd_seek (symfile_bfd, sym_offset, L_INCR);
       processing_gcc_compilation = 0;
     }
 
   if (symbuf_idx == symbuf_end)
-    fill_symbuf();
+    fill_symbuf (abfd);
   bufp = &symbuf[symbuf_idx];
   if (bufp->n_type != (unsigned char)N_SO)
     error("First symbol in segment of executable not a source symbol");
@@ -1945,9 +1855,9 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
     {
       QUIT;                    /* Allow this to be interruptable */
       if (symbuf_idx == symbuf_end)
-       fill_symbuf();
+       fill_symbuf(abfd);
       bufp = &symbuf[symbuf_idx++];
-      SWAP_SYMBOL (bufp);
+      SWAP_SYMBOL (bufp, abfd);
 
       type = bufp->n_type;
       if (type == (unsigned char)N_CATCH)
@@ -1965,37 +1875,48 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
 
       SET_NAMESTRING ();
 
-      if (type & N_STAB)
-       {
+      if (type & N_STAB) {
+       /* Check for a pair of N_SO symbols, which give both a new
+          source file name (second) and its directory (first).  */
+       if (type == (unsigned char)N_SO) {
+         /* Save the outer values */
          short bufp_n_desc = bufp->n_desc;
          unsigned long valu = bufp->n_value;
 
-         /* Check for a pair of N_SO symbols.  */
-         if (type == (unsigned char)N_SO)
-           {
-             if (symbuf_idx == symbuf_end)
-               fill_symbuf ();
-             bufp = &symbuf[symbuf_idx];
-             if (bufp->n_type == (unsigned char)N_SO)
-               {
-                 char *namestring1 = namestring;
+         if (symbuf_idx == symbuf_end)
+           fill_symbuf (abfd);
+         bufp = &symbuf[symbuf_idx];
+         if (bufp->n_type == (unsigned char)N_SO) {
+           char *namestring1 = namestring;
+
+           SWAP_SYMBOL (bufp, abfd);
+           bufp->n_value += offset;            /* Relocate */
+           symbuf_idx++;
+           symnum++;
+           SET_NAMESTRING ();
+
+           /* No need to check PCC_SOL_BROKEN, on the assumption that
+              such broken PCC's don't put out N_SO pairs.  */
+           if (last_source_file)
+             (void)end_symtab (bufp->n_value, 0, 0, objfile);
+           start_symtab (namestring, namestring1, bufp->n_value);
+         } else {
+           /* N_SO without a following N_SO */
+           process_one_symbol(type, bufp_n_desc, valu, namestring);
+           /* our_objfile is an implicit parameter.  */
+         }
+       } else {
 
-                 SWAP_SYMBOL (bufp);
-                 bufp->n_value += offset;              /* Relocate */
-                 symbuf_idx++;
-                 symnum++;
-                 SET_NAMESTRING ();
+         /* Ordinary symbol
+
+               HERE IS WHERE THE REAL WORK GETS DONE!
+                                                         */
+         process_one_symbol (type, bufp->n_desc, bufp->n_value,
+                             namestring);
+         /* our_objfile is an implicit parameter.  */
 
-                 process_symbol_pair (N_SO, bufp_n_desc, valu, namestring1,
-                                      N_SO, bufp->n_desc, bufp->n_value,
-                                      namestring);
-               }
-             else
-               process_one_symbol(type, bufp_n_desc, valu, namestring);
-           }
-         else
-           process_one_symbol (type, bufp_n_desc, valu, namestring);
        }
+      }
       /* We skip checking for a new .o or -l file; that should never
          happen in this routine. */
       else if (type == N_TEXT
@@ -2022,7 +1943,7 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
         }
     }
 
-  return end_symtab (text_offset + text_size, 0, 0);
+  return end_symtab (text_offset + text_size, 0, 0, objfile);
 }
 \f
 int
@@ -2105,21 +2026,17 @@ process_one_symbol (type, desc, valu, name)
       within_function = 1;
       if (context_stack_depth > 0)
        {
-         new = &context_stack[--context_stack_depth];
+         new = pop_context ();
          /* Make a block for the local symbols within.  */
          finish_block (new->name, &local_symbols, new->old_blocks,
                        new->start_addr, valu);
        }
       /* Stack must be empty now.  */
       if (context_stack_depth != 0)
-       error ("Invalid symbol data: unmatched N_LBRAC before symtab pos %d.",
-              symnum);
+       complain (lbrac_unmatched_complaint, symnum);
 
-      new = &context_stack[context_stack_depth++];
-      new->old_blocks = pending_blocks;
-      new->start_addr = valu;
+      new = push_context (0, valu);
       new->name = define_symbol (valu, name, desc, type);
-      local_symbols = 0;
       break;
 
     case N_CATCH:
@@ -2149,22 +2066,7 @@ process_one_symbol (type, desc, valu, name)
        valu = last_pc_address;
       }
 #endif
-      if (context_stack_depth == context_stack_size)
-       {
-         context_stack_size *= 2;
-         context_stack = (struct context_stack *)
-           xrealloc (context_stack,
-                     (context_stack_size
-                      * sizeof (struct context_stack)));
-       }
-
-      new = &context_stack[context_stack_depth++];
-      new->depth = desc;
-      new->locals = local_symbols;
-      new->old_blocks = pending_blocks;
-      new->start_addr = valu;
-      new->name = 0;
-      local_symbols = 0;
+      new = push_context (desc, valu);
       break;
 
     case N_RBRAC:
@@ -2177,9 +2079,9 @@ process_one_symbol (type, desc, valu, name)
       valu += last_source_start_addr;
 #endif
 
-      new = &context_stack[--context_stack_depth];
+      new = pop_context();
       if (desc != new->depth)
-       error ("Invalid symbol data: N_LBRAC/N_RBRAC symbol mismatch, symtab pos %d.", symnum);
+       complain (lbrac_mismatch_complaint, symnum);
 
       /* Some compilers put the variable decls inside of an
          LBRAC/RBRAC block.  This macro should be nonzero if this
@@ -2326,487 +2228,6 @@ process_one_symbol (type, desc, valu, name)
     }
 }
 \f
-/* To handle GNU C++ typename abbreviation, we need to be able to
-   fill in a type's name as soon as space for that type is allocated.
-   `type_synonym_name' is the name of the type being allocated.
-   It is cleared as soon as it is used (lest all allocated types
-   get this name).  */
-static char *type_synonym_name;
-
-/* ARGSUSED */
-static struct symbol *
-define_symbol (valu, string, desc, type)
-     unsigned int valu;
-     char *string;
-     int desc;
-     int type;
-{
-  register struct symbol *sym;
-  char *p = (char *) strchr (string, ':');
-  int deftype;
-  int synonym = 0;
-  register int i;
-
-  /* Ignore syms with empty names.  */
-  if (string[0] == 0)
-    return 0;
-
-  /* Ignore old-style symbols from cc -go  */
-  if (p == 0)
-    return 0;
-
-  sym = (struct symbol *)obstack_alloc (symbol_obstack, sizeof (struct symbol));
-
-  if (processing_gcc_compilation) {
-    /* GCC 2.x puts the line number in desc.  SunOS apparently puts in the
-       number of bytes occupied by a type or object, which we ignore.  */
-    SYMBOL_LINE(sym) = desc;
-  } else {
-    SYMBOL_LINE(sym) = 0;                      /* unknown */
-  }
-
-  if (string[0] == CPLUS_MARKER)
-    {
-      /* Special GNU C++ names.  */
-      switch (string[1])
-       {
-       case 't':
-         SYMBOL_NAME (sym) = "this";
-         break;
-       case 'v': /* $vtbl_ptr_type */
-         /* Was: SYMBOL_NAME (sym) = "vptr"; */
-         goto normal;
-       case 'e':
-         SYMBOL_NAME (sym) = "eh_throw";
-         break;
-
-       case '_':
-         /* This was an anonymous type that was never fixed up.  */
-         goto normal;
-
-       default:
-         abort ();
-       }
-    }
-  else
-    {
-    normal:
-      SYMBOL_NAME (sym)
-       = (char *) obstack_alloc (symbol_obstack, ((p - string) + 1));
-      /* Open-coded bcopy--saves function call time.  */
-      {
-       register char *p1 = string;
-       register char *p2 = SYMBOL_NAME (sym);
-       while (p1 != p)
-         *p2++ = *p1++;
-       *p2++ = '\0';
-      }
-    }
-  p++;
-  /* Determine the type of name being defined.  */
-  /* The Acorn RISC machine's compiler can put out locals that don't
-     start with "234=" or "(3,4)=", so assume anything other than the
-     deftypes we know how to handle is a local.  */
-  /* (Peter Watkins @ Computervision)
-     Handle Sun-style local fortran array types 'ar...' . 
-     (gnu@cygnus.com) -- this strchr() handles them properly?
-     (tiemann@cygnus.com) -- 'C' is for catch.  */
-  if (!strchr ("cfFGpPrStTvVXC", *p))
-    deftype = 'l';
-  else
-    deftype = *p++;
-
-  /* c is a special case, not followed by a type-number.
-     SYMBOL:c=iVALUE for an integer constant symbol.
-     SYMBOL:c=rVALUE for a floating constant symbol.
-     SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
-        e.g. "b:c=e6,0" for "const b = blob1"
-       (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;").  */
-  if (deftype == 'c')
-    {
-      if (*p++ != '=')
-       error ("Invalid symbol data at symtab pos %d.", symnum);
-      switch (*p++)
-       {
-       case 'r':
-         {
-           double d = atof (p);
-           char *dbl_valu;
-
-           SYMBOL_TYPE (sym) = builtin_type_double;
-           dbl_valu =
-             (char *) obstack_alloc (symbol_obstack, sizeof (double));
-           bcopy (&d, dbl_valu, sizeof (double));
-           SWAP_TARGET_AND_HOST (dbl_valu, sizeof (double));
-           SYMBOL_VALUE_BYTES (sym) = dbl_valu;
-           SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
-         }
-         break;
-       case 'i':
-         {
-           SYMBOL_TYPE (sym) = builtin_type_int;
-           SYMBOL_VALUE (sym) = atoi (p);
-           SYMBOL_CLASS (sym) = LOC_CONST;
-         }
-         break;
-       case 'e':
-         /* SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
-            e.g. "b:c=e6,0" for "const b = blob1"
-            (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;").  */
-         {
-           int typenums[2];
-           
-           read_type_number (&p, typenums);
-           if (*p++ != ',')
-             error ("Invalid symbol data: no comma in enum const symbol");
-           
-           SYMBOL_TYPE (sym) = *dbx_lookup_type (typenums);
-           SYMBOL_VALUE (sym) = atoi (p);
-           SYMBOL_CLASS (sym) = LOC_CONST;
-         }
-         break;
-       default:
-         error ("Invalid symbol data at symtab pos %d.", symnum);
-       }
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &file_symbols);
-      return sym;
-    }
-
-  /* Now usually comes a number that says which data type,
-     and possibly more stuff to define the type
-     (all of which is handled by read_type)  */
-
-  if (deftype == 'p' && *p == 'F')
-    /* pF is a two-letter code that means a function parameter in Fortran.
-       The type-number specifies the type of the return value.
-       Translate it into a pointer-to-function type.  */
-    {
-      p++;
-      SYMBOL_TYPE (sym)
-       = lookup_pointer_type (lookup_function_type (read_type (&p)));
-    }
-  else
-    {
-      struct type *type_read;
-      synonym = *p == 't';
-
-      if (synonym)
-       {
-         p += 1;
-         type_synonym_name = obsavestring (SYMBOL_NAME (sym),
-                                           strlen (SYMBOL_NAME (sym)));
-       }
-
-      type_read = read_type (&p);
-
-      if ((deftype == 'F' || deftype == 'f')
-         && TYPE_CODE (type_read) != TYPE_CODE_FUNC)
-      {
-#if 0
-/* This code doesn't work -- it needs to realloc and can't.  */
-       struct type *new = (struct type *)
-             obstack_alloc (symbol_obstack, sizeof (struct type));
-
-       /* Generate a template for the type of this function.  The 
-          types of the arguments will be added as we read the symbol 
-          table. */
-       *new = *lookup_function_type (type_read);
-       SYMBOL_TYPE(sym) = new;
-       in_function_type = new;
-#else
-       SYMBOL_TYPE (sym) = lookup_function_type (type_read);
-#endif
-      }
-      else
-       SYMBOL_TYPE (sym) = type_read;
-    }
-
-  switch (deftype)
-    {
-    case 'C':
-      /* The name of a caught exception.  */
-      SYMBOL_CLASS (sym) = LOC_LABEL;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      SYMBOL_VALUE_ADDRESS (sym) = valu;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    case 'f':
-      SYMBOL_CLASS (sym) = LOC_BLOCK;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &file_symbols);
-      break;
-
-    case 'F':
-      SYMBOL_CLASS (sym) = LOC_BLOCK;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &global_symbols);
-      break;
-
-    case 'G':
-      /* For a class G (global) symbol, it appears that the
-        value is not correct.  It is necessary to search for the
-        corresponding linker definition to find the value.
-        These definitions appear at the end of the namelist.  */
-      i = hashname (SYMBOL_NAME (sym));
-      SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i];
-      global_sym_chain[i] = sym;
-      SYMBOL_CLASS (sym) = LOC_STATIC;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &global_symbols);
-      break;
-
-      /* This case is faked by a conditional above,
-        when there is no code letter in the dbx data.
-        Dbx data never actually contains 'l'.  */
-    case 'l':
-      SYMBOL_CLASS (sym) = LOC_LOCAL;
-      SYMBOL_VALUE (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    case 'p':
-      /* Normally this is a parameter, a LOC_ARG.  On the i960, it
-        can also be a LOC_LOCAL_ARG depending on symbol type.  */
-#ifndef DBX_PARM_SYMBOL_CLASS
-#define        DBX_PARM_SYMBOL_CLASS(type)     LOC_ARG
-#endif
-      SYMBOL_CLASS (sym) = DBX_PARM_SYMBOL_CLASS (type);
-      SYMBOL_VALUE (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-#if 0
-      /* This doesn't work yet.  */
-      add_param_to_type (&in_function_type, sym);
-#endif
-      add_symbol_to_list (sym, &local_symbols);
-
-      /* If it's gcc-compiled, if it says `short', believe it.  */
-      if (processing_gcc_compilation || BELIEVE_PCC_PROMOTION)
-       break;
-
-#if defined(BELIEVE_PCC_PROMOTION_TYPE)
-      /* This macro is defined on machines (e.g. sparc) where
-        we should believe the type of a PCC 'short' argument,
-        but shouldn't believe the address (the address is
-        the address of the corresponding int).  Note that
-        this is only different from the BELIEVE_PCC_PROMOTION
-        case on big-endian machines.
-
-        My guess is that this correction, as opposed to changing
-        the parameter to an 'int' (as done below, for PCC
-        on most machines), is the right thing to do
-        on all machines, but I don't want to risk breaking
-        something that already works.  On most PCC machines,
-        the sparc problem doesn't come up because the calling
-        function has to zero the top bytes (not knowing whether
-        the called function wants an int or a short), so there
-        is no practical difference between an int and a short
-        (except perhaps what happens when the GDB user types
-        "print short_arg = 0x10000;"). 
-
-        Hacked for SunOS 4.1 by gnu@cygnus.com.  In 4.1, the compiler
-        actually produces the correct address (we don't need to fix it
-        up).  I made this code adapt so that it will offset the symbol
-        if it was pointing at an int-aligned location and not
-        otherwise.  This way you can use the same gdb for 4.0.x and
-        4.1 systems.  */
-
-      if (0 == SYMBOL_VALUE (sym) % sizeof (int))
-       {
-         if (SYMBOL_TYPE (sym) == builtin_type_char
-             || SYMBOL_TYPE (sym) == builtin_type_unsigned_char)
-           SYMBOL_VALUE (sym) += 3;
-         else if (SYMBOL_TYPE (sym) == builtin_type_short
-             || SYMBOL_TYPE (sym) == builtin_type_unsigned_short)
-           SYMBOL_VALUE (sym) += 2;
-       }
-      break;
-
-#else /* no BELIEVE_PCC_PROMOTION_TYPE.  */
-
-      /* If PCC says a parameter is a short or a char,
-        it is really an int.  */
-      if (SYMBOL_TYPE (sym) == builtin_type_char
-         || SYMBOL_TYPE (sym) == builtin_type_short)
-       SYMBOL_TYPE (sym) = builtin_type_int;
-      else if (SYMBOL_TYPE (sym) == builtin_type_unsigned_char
-              || SYMBOL_TYPE (sym) == builtin_type_unsigned_short)
-       SYMBOL_TYPE (sym) = builtin_type_unsigned_int;
-      break;
-
-#endif /* no BELIEVE_PCC_PROMOTION_TYPE.  */
-
-    case 'P':
-      SYMBOL_CLASS (sym) = LOC_REGPARM;
-      SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    case 'r':
-      SYMBOL_CLASS (sym) = LOC_REGISTER;
-      SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    case 'S':
-      /* Static symbol at top level of file */
-      SYMBOL_CLASS (sym) = LOC_STATIC;
-      SYMBOL_VALUE_ADDRESS (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &file_symbols);
-      break;
-
-    case 't':
-      SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-      SYMBOL_VALUE (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0
-         && (TYPE_FLAGS (SYMBOL_TYPE (sym)) & TYPE_FLAG_PERM) == 0)
-       TYPE_NAME (SYMBOL_TYPE (sym)) =
-         obsavestring (SYMBOL_NAME (sym),
-                       strlen (SYMBOL_NAME (sym)));
-       /* C++ vagaries: we may have a type which is derived from
-        a base type which did not have its name defined when the
-        derived class was output.  We fill in the derived class's
-        base part member's name here in that case.  */
-       else if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
-                || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
-               && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
-        {
-          int j;
-          for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--)
-            if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0)
-              TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) =
-                type_name_no_tag (TYPE_BASECLASS (SYMBOL_TYPE (sym), j));
-        }
-
-      add_symbol_to_list (sym, &file_symbols);
-      break;
-
-    case 'T':
-      SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-      SYMBOL_VALUE (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
-      if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0
-         && (TYPE_FLAGS (SYMBOL_TYPE (sym)) & TYPE_FLAG_PERM) == 0)
-       TYPE_NAME (SYMBOL_TYPE (sym))
-         = obconcat ("",
-                     (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_ENUM
-                      ? "enum "
-                      : (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
-                         ? "struct " : "union ")),
-                     SYMBOL_NAME (sym));
-      add_symbol_to_list (sym, &file_symbols);
-
-      if (synonym)
-       {
-         register struct symbol *typedef_sym
-           = (struct symbol *) obstack_alloc (symbol_obstack, sizeof (struct symbol));
-         SYMBOL_NAME (typedef_sym) = SYMBOL_NAME (sym);
-         SYMBOL_TYPE (typedef_sym) = SYMBOL_TYPE (sym);
-
-         SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF;
-         SYMBOL_VALUE (typedef_sym) = valu;
-         SYMBOL_NAMESPACE (typedef_sym) = VAR_NAMESPACE;
-         add_symbol_to_list (typedef_sym, &file_symbols);
-       }
-      break;
-
-    case 'V':
-      /* Static symbol of local scope */
-      SYMBOL_CLASS (sym) = LOC_STATIC;
-      SYMBOL_VALUE_ADDRESS (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    case 'v':
-      /* Reference parameter */
-      SYMBOL_CLASS (sym) = LOC_REF_ARG;
-      SYMBOL_VALUE (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    case 'X':
-      /* This is used by Sun FORTRAN for "function result value".
-        Sun claims ("dbx and dbxtool interfaces", 2nd ed)
-        that Pascal uses it too, but when I tried it Pascal used
-        "x:3" (local symbol) instead.  */
-      SYMBOL_CLASS (sym) = LOC_LOCAL;
-      SYMBOL_VALUE (sym) = valu;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      add_symbol_to_list (sym, &local_symbols);
-      break;
-
-    default:
-      error ("Invalid symbol data: unknown symbol-type code `%c' at symtab pos %d.", deftype, symnum);
-    }
-  return sym;
-}
-\f
-#if 0
-/* This would be a good idea, but it doesn't really work.  The problem
-   is that in order to get the virtual context for a particular type,
-   you need to know the virtual info from all of its basetypes,
-   and you need to have processed its methods.  Since GDB reads
-   symbols on a file-by-file basis, this means processing the symbols
-   of all the files that are needed for each baseclass, which
-   means potentially reading in all the debugging info just to fill
-   in information we may never need.  */
-
-/* This page contains subroutines of read_type.  */
-
-/* FOR_TYPE is a struct type defining a virtual function NAME with type
-   FN_TYPE.  The `virtual context' for this virtual function is the
-   first base class of FOR_TYPE in which NAME is defined with signature
-   matching FN_TYPE.  OFFSET serves as a hash on matches here.
-
-   TYPE is the current type in which we are searching.  */
-
-static struct type *
-virtual_context (for_type, type, name, fn_type, offset)
-     struct type *for_type, *type;
-     char *name;
-     struct type *fn_type;
-     int offset;
-{
-  struct type *basetype = 0;
-  int i;
-
-  if (for_type != type)
-    {
-      /* Check the methods of TYPE.  */
-      /* Need to do a check_stub_type here, but that breaks
-        things because we can get infinite regress.  */
-      for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
-       if (!strcmp (TYPE_FN_FIELDLIST_NAME (type, i), name))
-         break;
-      if (i >= 0)
-       {
-         int j = TYPE_FN_FIELDLIST_LENGTH (type, i);
-         struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
-
-         while (--j >= 0)
-           if (TYPE_FN_FIELD_VOFFSET (f, j) == offset-1)
-             return TYPE_FN_FIELD_FCONTEXT (f, j);
-       }
-    }
-  for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
-    {
-      basetype = virtual_context (for_type, TYPE_BASECLASS (type, i), name,
-                                 fn_type, offset);
-      if (basetype != for_type)
-       return basetype;
-    }
-  return for_type;
-}
-#endif
-\f
 /* Copy a pending list, used to record the contents of a common
    block for later fixup.  */
 static struct pending *
index 52d849602029fe2d68dc096640f71a278745bba9..3457ff07626f777787bdd56892242ae79cbd15ed 100644 (file)
@@ -1,4 +1,4 @@
-/* Basic definitions for GDB, the GNU debugger.
+/* Basic, host-specific, and target-specific definitions for GDB.
    Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -69,6 +69,7 @@ extern int parse_escape ();
 extern char *reg_names[];
 /* Indicate that these routines do not return to the caller.  */
 extern volatile void error(), fatal();
+extern void warning_setup(), warning();
 
 /* Various possibilities for alloca.  */
 #ifndef alloca
@@ -274,6 +275,7 @@ enum language
    language_unknown,           /* Language not known */
    language_auto,              /* Placeholder for automatic setting */
    language_c,                         /* C */
+   language_cplus,             /* C++ */
    language_m2,                        /* Modula-2 */
 };
 
@@ -292,5 +294,79 @@ char *local_hex_format_custom();           /* language.c */
 
 char *local_hex_string ();                     /* language.c */
 char *local_hex_string_custom ();              /* language.c */
+\f
+/* System-dependent parameters for GDB.
+
+   The standard thing is to include defs.h.  However, files that are
+   specific to a particular target can define TM_FILE_OVERRIDE before
+   including defs.h, then can include any particular tm-file they desire.  */
+
+/* Target machine definition.  This will be a symlink to one of the
+   tm-*.h files, built by the `configure' script.  */
+
+#ifndef TM_FILE_OVERRIDE
+#include "tm.h"
+#endif
+
+/* Host machine definition.  This will be a symlink to one of the
+   xm-*.h files, built by the `configure' script.  */
+
+#include "xm.h"
+
+/* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these.  */
+#if !defined (BIG_ENDIAN)
+#define BIG_ENDIAN 4321
+#endif
+
+#if !defined (LITTLE_ENDIAN)
+#define LITTLE_ENDIAN 1234
+#endif
+
+/* The bit byte-order has to do just with numbering of bits in
+   debugging symbols and such.  Conceptually, it's quite separate
+   from byte/word byte order.  */
+
+#if !defined (BITS_BIG_ENDIAN)
+#if TARGET_BYTE_ORDER == BIG_ENDIAN
+#define BITS_BIG_ENDIAN 1
+#endif /* Big endian.  */
+
+#if TARGET_BYTE_ORDER == LITTLE_ENDIAN
+#define BITS_BIG_ENDIAN 0
+#endif /* Little endian.  */
+#endif /* BITS_BIG_ENDIAN not defined.  */
+
+/* Swap LEN bytes at BUFFER between target and host byte-order.  */
+#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER
+#define SWAP_TARGET_AND_HOST(buffer,len)
+#else /* Target and host byte order differ.  */
+#define SWAP_TARGET_AND_HOST(buffer,len) \
+  {                                                                     \
+    char tmp;                                                           \
+    char *p = (char *)(buffer);                                                 \
+    char *q = ((char *)(buffer)) + len - 1;                             \
+    for (; p < q; p++, q--)                                             \
+      {                                                                         \
+        tmp = *q;                                                       \
+        *q = *p;                                                        \
+        *p = tmp;                                                       \
+      }                                                                         \
+  }
+#endif /* Target and host byte order differ.  */
+
+/* On some machines there are bits in addresses which are not really
+   part of the address, but are used by the kernel, the hardware, etc.
+   for special purposes.  ADDR_BITS_REMOVE takes out any such bits
+   so we get a "real" address such as one would find in a symbol
+   table.  ADDR_BITS_SET sets those bits the way the system wants
+   them.  */
+#if !defined (ADDR_BITS_REMOVE)
+#define ADDR_BITS_REMOVE(addr) (addr)
+#define ADDR_BITS_SET(addr) (addr)
+#endif /* No ADDR_BITS_REMOVE.  */
+
+#if !defined (SYS_SIGLIST_MISSING)
+#define SYS_SIGLIST_MISSING defined (USG)
+#endif /* No SYS_SIGLIST_MISSING */
 
 #endif /* no DEFS_H */
index 5eaf6a39dad7630dd630af3512bbeb51ba23668b..44e8ccfcc2eb136f667253c03cf03bc24eb17f20 100644 (file)
@@ -72,7 +72,6 @@ other things to work on, if you get bored. :-)
 #include <fcntl.h>
 
 #include "defs.h"
-#include "param.h"
 #include "bfd.h"
 #include "symtab.h"
 #include "symfile.h"
@@ -2443,9 +2442,7 @@ DESCRIPTION
 static void
 DEFUN(dwarf_psymtab_to_symtab, (pst), struct partial_symtab *pst)
 {
-  int desc;
-  bfd *sym_bfd;
-  
+
   if (!pst)
     {
       return;
index d203e2e9b5847dcd78e63dc3fb5ecc9854f2b80b..5b4294a678c8c9be18249a5929933a8655f1d0f0 100644 (file)
@@ -39,7 +39,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "elf-common.h"
 #include "elf-external.h"
 #include "elf-internal.h"
index 0c645f226a35516d0ed130070350d50c4de2ad3b..33e5e72b1a794e45d05425603336c2ce65dd820e 100644 (file)
@@ -1,5 +1,5 @@
 /* Work with executable files, for GDB. 
-   Copyright (C) 1988, 1989 Free Software Foundation, Inc.
+   Copyright 1988, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "target.h"
@@ -111,34 +110,6 @@ exec_file_command (filename, from_tty)
        error ("\"%s\": not in executable format: %s.",
               scratch_pathname, bfd_errmsg (bfd_error));
 
-#if FIXME
-/* This code needs to be incorporated into BFD */
-#ifdef COFF_ENCAPSULATE
-       /* If we have a coff header, it can give us better values for
-          text_start and exec_data_start.  This is particularly useful
-          for remote debugging of embedded systems.  */
-       if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE)
-       {
-               struct coffheader ch;
-               int val;
-               val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1);
-               if (val == -1)
-                       perror_with_name (filename);
-               val = myread (execchan, &ch, sizeof (ch));
-               if (val < 0)
-                       perror_with_name (filename);
-               text_start = ch.text_start;
-               exec_data_start = ch.data_start;
-       } else
-#endif
-              {
-               text_start =
-                 IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr);
-               exec_data_start = IS_OBJECT_FILE (exec_aouthdr)
-                 ? exec_aouthdr.a_text : N_DATADDR (exec_aouthdr);
-       }
-#endif FIXME
-
       if (build_section_table (exec_bfd, &exec_ops.sections,
                                &exec_ops.sections_end))
        error ("Can't find the file sections in `%s': %s", 
@@ -323,11 +294,14 @@ exec_files_info ()
 {
   struct section_table *p;
 
-  printf ("\tExecutable file `%s'.\n", bfd_get_filename(exec_bfd));
+  printf_filtered ("\t`%s', ", bfd_get_filename(exec_bfd));
+  wrap_here ("        ");
+  printf_filtered ("file type %s.\n", bfd_get_target(exec_bfd));
 
   for (p = exec_ops.sections; p < exec_ops.sections_end; p++) {
-    printf("\t%s", local_hex_string_custom (p->addr, "08"));
-    printf(" - %s is %s\n", local_hex_string_custom (p->endaddr, "08"),
+    printf_filtered ("\t%s", local_hex_string_custom (p->addr, "08"));
+    printf_filtered (" - %s is %s\n",
+       local_hex_string_custom (p->endaddr, "08"),
        bfd_section_name (exec_bfd, p->sec_ptr));
   }
 }
index 58da6b6a3fbdcb366908e6289108a2f8032bada6..b65853e164ef07276f9eccebb224dec40fa3dbe4 100644 (file)
@@ -1,5 +1,5 @@
 /* Find a variable's value in memory, for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
 #include "value.h"
@@ -399,7 +398,6 @@ read_var_value (var, frame)
       }
 
     case LOC_STATIC:
-    case LOC_EXTERNAL:
       addr = SYMBOL_VALUE_ADDRESS (var);
       break;
 
@@ -646,7 +644,6 @@ locate_var_value (var, frame)
 {
   CORE_ADDR addr = 0;
   struct type *type = SYMBOL_TYPE (var);
-  struct type *result_type;
   value lazy_value;
 
   /* Evaluate it first; if the result is a memory address, we're fine.
@@ -672,14 +669,7 @@ locate_var_value (var, frame)
          type = TYPE_TARGET_TYPE (type);
        }
 
-      /* Address of an array is of the type of address of it's elements.  */
-       /* FIXME, this is probably wrong now for ANSI C. */
-      result_type =
-       lookup_pointer_type (TYPE_CODE (type) == TYPE_CODE_ARRAY ?
-                            TYPE_TARGET_TYPE (type) : type);
-
-      return value_cast (result_type,
-                        value_from_long (builtin_type_long, (LONGEST) addr));
+      return value_from_longest (lookup_pointer_type (type), (LONGEST) addr);
     }
 
   /* Not a memory address; check what the problem was.  */
index 0ad9f3eafbaabf8c0992f4f85a5d41931d4d1d96..d4bcb60cbe334c9f89de8718e86b98e6aeddc495 100644 (file)
@@ -1,5 +1,5 @@
 /* Print GOULD RISC instructions for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -18,12 +18,10 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
-#include "gdbcore.h"
-
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
+#include "gdbcore.h"
 #if defined GOULD_PN
 #include "pn-opcode.h"
 #else
index bd6276dbb50ffd39829cb269449aec12bd6a41c3..3de6fd339a8ef06632cfe71a5b8223f9fffde3dc 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index 7b2c12b872433271339e7b857791121771b00e7c..801c4710ef9b1d67257d043936c8343fe7556bdf 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index 88b171a6e7bb409e6699a3b361511b0d72a402b4..eb0e17402d4f4cb6b145f0b5856d2506a4fe32d6 100644 (file)
@@ -36,7 +36,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* For the GDB interface at the bottom of the file... */
 #include "defs.h"
-#include "param.h"
 #include "gdbcore.h"
 
 #define Eb OP_E, b_mode
index 98dd25add785e5ddd744bc8a14aaa2a3310a0342..8b8fb84beba647e38915c1173e32122deed0d041 100644 (file)
@@ -3,49 +3,26 @@
 
 This file is part of GDB.
 
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "gdbcore.h"
 
-#ifdef USG
-#include <sys/types.h>
-#endif
-
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sys/user.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-#ifndef N_SET_MAGIC
-#ifdef COFF_FORMAT
-#define N_SET_MAGIC(exec, val) ((exec).magic = (val))
-#else
-#define N_SET_MAGIC(exec, val) ((exec).a_magic = (val))
-#endif
-#endif
-
-#include <sys/file.h>
-#include <sys/stat.h>
-
 /* helper functions for tm-i386.h */
 
 /* stdio style buffering to minimize calls to ptrace */
index 2d69d1dcdca294af707acc4c9630333732f4f171..f3c72d11b8a8cd5e23b2f9f2a1d610ffe3852d1c 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "language.h"
index e2e55576ffea863fbc270554aa77bb22d77875ef..0a85e2ea10c5d4f9a4385b045bd8f1808b326fb4 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "language.h"
index a651c48c5f6f5e225b87e67ec922e7e82d4829e0..f13b201c99b381222c3fb02930afbff4edf9bf53 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index 27fde37634bcfb61730ec058a006d02f5915eff2..308b21ec4b4e7914cafbaaf777ed257db06a4910 100644 (file)
@@ -25,7 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <signal.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "value.h"
 #include "frame.h"
index 69a60f2e4c807606d5500961eab3ec85bea3a602..f1e503b2864fd6b656014553412c3ad2ecc290e8 100644 (file)
@@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
-#include "param.h"
 #include "ieee-float.h"
 #include <math.h>              /* ldexp */
 
index fd8f0b84ecb6456bdbd1828e83e0c87cebc2288a..698cfb4f8be48f8a8494102b442f3bc58cddf31e 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "command.h"
@@ -60,7 +59,7 @@ static struct tchars tc_inferior;
 static struct tchars tc_ours;
 #endif
 
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
 static struct ltchars ltc_inferior;
 static struct ltchars ltc_ours;
 #endif
@@ -71,8 +70,13 @@ static int lmode_ours;
 #endif
 
 #ifdef TIOCGPGRP
+# ifdef SHORT_PGRP
+static short pgrp_inferior;
+static short pgrp_ours;
+# else
 static int pgrp_inferior;
 static int pgrp_ours;
+# endif
 #else
 static void (*sigint_ours) ();
 static void (*sigquit_ours) ();
@@ -100,7 +104,7 @@ terminal_init_inferior ()
   tc_inferior = tc_ours;
 #endif
 
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
   ltc_inferior = ltc_ours;
 #endif
 
@@ -130,7 +134,7 @@ terminal_inferior ()
 #if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
       ioctl (0, TIOCSETC, &tc_inferior);
 #endif
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
       ioctl (0, TIOCSLTC, &ltc_inferior);
 #endif
 #ifdef TIOCLGET
@@ -210,7 +214,7 @@ terminal_ours_1 (output_only)
 #if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
       ioctl (0, TIOCGETC, &tc_inferior);
 #endif
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
       ioctl (0, TIOCGLTC, &ltc_inferior);
 #endif
 #ifdef TIOCLGET
@@ -235,7 +239,7 @@ terminal_ours_1 (output_only)
 #if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
   ioctl (0, TIOCSETC, &tc_ours);
 #endif
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
   ioctl (0, TIOCSLTC, &ltc_ours);
 #endif
 #ifdef TIOCLGET
@@ -293,7 +297,7 @@ child_terminal_info (args, from_tty)
   printf_filtered ("\n");
 #endif
 
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
   printf_filtered ("ltchars: ");
   for (i = 0; i < (int)sizeof (struct ltchars); i++)
     printf_filtered ("0x%x ", ((char *)&ltc_inferior)[i]);
@@ -314,6 +318,7 @@ child_terminal_info (args, from_tty)
    become debugger target processes.  This actually switches to
    the terminal specified in the NEW_TTY_PREFORK call.  */
 
+void
 new_tty_prefork (ttyname)
      char *ttyname;
 {
@@ -342,7 +347,11 @@ new_tty ()
 
   /* Now open the specified new terminal.  */
 
+#ifdef USE_O_NOCTTY
+  tty = open(inferior_thisrun_terminal, O_RDWR | O_NOCTTY);
+#else
   tty = open(inferior_thisrun_terminal, O_RDWR);
+#endif
   if (tty == -1)
     {
       print_sys_errmsg (inferior_thisrun_terminal, errno);
@@ -483,7 +492,7 @@ Report which ones can be written.");
 #if defined(TIOCGETC) && !defined(TIOCGETC_BROKEN)
   ioctl (0, TIOCGETC, &tc_ours);
 #endif
-#ifdef TIOCGLTC
+#if defined(TIOCGLTC) && !defined(TIOCGLTC_BROKEN)
   ioctl (0, TIOCGLTC, &ltc_ours);
 #endif
 #ifdef TIOCLGET
index 9e9f508c15b7b374b5c9ebfe35685d5dcc32ac3d..f7f1f4fb49683c62d41891d011c289b064f4c718 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "target.h"
index d38bd067a79e92a47151c77af0b1fcbba04b95e4..6d726150c0e10fc579a2eb99e5928d33f4704708 100644 (file)
@@ -119,7 +119,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
 #include "inferior.h"
index 50e2fa91deb53b3089f795b2b6d683c9afcc5465..e4e0ea22c3a5f7be632ef5a9e9d5551aabeb53ac 100644 (file)
@@ -1,5 +1,5 @@
-/* Main loop for the standalone kernel debugger.
-   Copyright (C) 1989, Free Software Foundation, Inc.
+/* Main loop for the standalone kernel debugger, for GDB, the GNU Debugger.
+   Copyright 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
-#include "param.h"
 
 static char *args[] = {"kdb", "kdb-symbols", 0};
 
index 85de5e1e412117ce0167261616bfe18a2295c917..7b29b8cbac34ec8373ea33e2a74ec6846aa625d2 100644 (file)
@@ -32,7 +32,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
 #include "expression.h"
@@ -577,10 +576,25 @@ variable: NAME
                                case LOC_REGISTER:
                                case LOC_ARG:
                                case LOC_LOCAL:
+                               case LOC_REF_ARG:
+                               case LOC_REGPARM:
+                               case LOC_LOCAL_ARG:
                                  if (innermost_block == 0 ||
                                      contained_in (block_found,
                                                    innermost_block))
                                    innermost_block = block_found;
+                                 break;
+
+                               case LOC_UNDEF:
+                               case LOC_CONST:
+                               case LOC_STATIC:
+                               case LOC_TYPEDEF:
+                               case LOC_LABEL: /* maybe should go above? */
+                               case LOC_BLOCK:
+                               case LOC_CONST_BYTES:
+                                 /* These are listed so gcc -Wall will reveal
+                                    un-handled cases.  */
+                                 break;
                                }
                              write_exp_elt_opcode (OP_VAR_VALUE);
                              write_exp_elt_sym (sym);
index b648abbada5dae971a427f8d056f31431b4cf546..de43af111461bf3e3c06a5b55f53cf4a450b7936 100644 (file)
@@ -1,5 +1,5 @@
-/* Print m68k instructions for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Print Motorola 68k instructions for GDB, the GNU debugger.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "m68k-opcode.h"
 #include "gdbcore.h"
index bede269b0af9a539429895673e8c974966614538..ca9c8c735a3bee49f2bc9c762b60155ee9cb664f 100644 (file)
@@ -1,4 +1,23 @@
-/* This file has been modified by Data General Corporation, November 1989. */
+/* Print instructions for the Motorola 88000, for GDB and GNU Binutils.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
+   Contributed by Data General Corporation, November 1989.
+   Partially derived from an earlier printcmd.c.
+
+This file is part of GDB and the GNU Binutils.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "m88k-opcode.h"
@@ -7,10 +26,6 @@
 
 void sprint_address ();
 
-/* Changed hashtab to hashtable to avoid naming conflict
-   with libdc.o (used for tdesc) for m88k.
-*/
-
 INSTAB  *hashtable[HASHVAL] = {0};
 
 /*
index 594bd49b1a08e2b88524ac3857ca1e4c532a87be..27d4bea0e57b6863a45ab109c7823694df36385c 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "value.h"
index 835d8a229f22b0f999cc8e3727b6cc75a8c3223d..dc6e4da938ed7df4596b11564690647eea9f993a 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1988, 1990 Free Software Foundation, Inc.
+/* Host-dependent Motorola 88xxx support for GDB, the GNU Debugger.
+   Copyright 1988, 1990, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -18,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index 754299a7452c50b593b5ae6962978859ab3fd2b2..0b24d75722b421b0288fd8248f0eb0db5069e6f8 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "signame.h"
index 936879cf0012d3db00cf0aa1c8ee714f2dcd22eb..e36d7305107e712e9d8fdfadf65c7f67cdf0f66a 100644 (file)
@@ -1,5 +1,5 @@
-/* Top level for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
+/* Top level `main' program for GDB, the GNU debugger.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 int fclose ();
 #include "defs.h"
 #include "gdbcmd.h"
-#include "param.h"
 #include "symtab.h"
 #include "inferior.h"
 #include "signals.h"
@@ -604,6 +603,27 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
     printf_filtered ("\n");
   error_pre_print = "\n";
 
+  /* Set the initial language. */
+  {
+    extern enum language deduce_language_from_filename ();
+    extern struct partial_symtab *find_main_psymtab ();
+    struct partial_symtab *pst = find_main_psymtab ();
+    enum language lang = language_unknown;     
+    if (pst == NULL) ;
+#if 0
+    /* A better solution would set the language when reading the psymtab.
+       This would win for symbol file formats that encode the langauge,
+       such as dwarf.  But, we don't do that yet. FIXME */
+    else if (pst->language != language_unknown)
+       lang = pst->language;
+#endif
+    else if (pst->filename != NULL)
+      lang = deduce_language_from_filename (pst->filename);
+    if (lang == language_unknown) /* Make C the default language */
+       lang = language_c;
+    set_language (lang);
+  }
+
   if (corearg != NULL)
     if (!setjmp (to_top_level))
       core_file_command (corearg, !batch);
@@ -1685,7 +1705,7 @@ cd_command (dir, from_tty)
     current_directory = dir;
   else
     {
-      current_directory = concat (current_directory, "/", dir);
+      current_directory = concat (current_directory, "/", dir, NULL);
       free (dir);
     }
 
@@ -2021,7 +2041,7 @@ initialize_history()
     /* We include the current directory so that if the user changes
        directories the file written will be the same as the one
        that was read.  */
-    history_filename = concat (current_directory, "/.gdb_history", "");
+    history_filename = concat (current_directory, "/.gdb_history", NULL);
   }
   read_history (history_filename);
 }
index eebe7e251f1fe553e5a6bcc6c71db2fed9ffd7c8..7e55233e168263e0e2c2c0db508e8e50e07dda6e 100644 (file)
@@ -1,24 +1,24 @@
-/* Simulate breakpoints by patching locations in the target system.
-   Copyright (C) 1990 Free Software Foundation, Inc.
+/* Simulate breakpoints by patching locations in the target system, for GDB.
+   Copyright 1990, 1991 Free Software Foundation, Inc.
+   Contributed by Cygnus Support.  Written by John Gilmore.
 
 This file is part of GDB.
 
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
-#include "param.h"
 
 #ifdef BREAKPOINT
 /* This file is only useful if BREAKPOINT is set.  If not, we punt.  */
@@ -72,86 +72,8 @@ memory_remove_breakpoint (addr, contents_cache)
 }
 
 
-#if 0
-/* This should move back into breakpoint.c, sad to say.   Encapsulate
-    sizeof (BREAKPOINT) by export it as an int from mem-break.c.  */
+int memory_breakpoint_size = sizeof (break_insn);
 
-/* Like target_read_memory() but if breakpoints are inserted, return
-   the shadow contents instead of the breakpoints themselves.  */
-int
-read_memory_nobpt (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     unsigned len;
-{
-  int status;
-  struct breakpoint *b;
-  ALL_BREAKPOINTS (b)
-    {
-      if (b->address == NULL || !b->inserted)
-       continue;
-      else if (b->address + sizeof (break_insn) <= memaddr)
-       /* The breakpoint is entirely before the chunk of memory
-          we are reading.  */
-       continue;
-      else if (b->address >= memaddr + len)
-       /* The breakpoint is entirely after the chunk of memory we
-          are reading.  */
-       continue;
-      else
-       {
-         /* Copy the breakpoint from the shadow contents, and recurse
-            for the things before and after.  */
-         
-         /* Addresses and length of the part of the breakpoint that
-            we need to copy.  */
-         CORE_ADDR membpt = b->address;
-         unsigned int bptlen = sizeof (break_insn);
-         /* Offset within shadow_contents.  */
-         int bptoffset = 0;
-         
-         if (membpt < memaddr)
-           {
-             /* Only copy the second part of the breakpoint.  */
-             bptlen -= memaddr - membpt;
-             bptoffset = memaddr - membpt;
-             membpt = memaddr;
-           }
-
-         if (membpt + bptlen > memaddr + len)
-           {
-             /* Only copy the first part of the breakpoint.  */
-             bptlen -= (membpt + bptlen) - (memaddr + len);
-           }
-
-         bcopy (b->shadow_contents + bptoffset,
-                myaddr + membpt - memaddr, bptlen);
-
-         if (membpt > memaddr)
-           {
-             /* Copy the section of memory before the breakpoint.  */
-             status = read_memory_nobpt (memaddr, myaddr, membpt - memaddr);
-             if (status != 0)
-               return status;
-           }
-
-         if (membpt + bptlen < memaddr + len)
-           {
-             /* Copy the section of memory after the breakpoint.  */
-             status = read_memory_nobpt
-               (membpt + bptlen,
-                myaddr + membpt + bptlen - memaddr,
-                memaddr + len - (membpt + bptlen));
-             if (status != 0)
-               return status;
-           }
-         return 0;
-       }
-    }
-  /* Nothing overlaps.  Just call read_memory_noerr.  */
-  return target_read_memory (memaddr, myaddr, len);
-}
-#endif /* 0 */
 
 #else  /* BREAKPOINT */
 
@@ -175,4 +97,6 @@ memory_remove_breakpoint (addr, contents_cache)
   return 0;    /* lint */
 }
 
+int memory_breakpoint_size = -1;
+
 #endif /* BREAKPOINT */
index 6dc3e553755fb8d0255621ec4cc79a3e5101ca5b..a90448ae04d23d9c075f78b73a63926533001fe6 100644 (file)
@@ -1,5 +1,5 @@
 /* Print mips instructions for GDB, the GNU debugger.
-   Copyright (C) 1989 Free Software Foundation, Inc.
+   Copyright 1989, 1991 Free Software Foundation, Inc.
    Contributed by Nobuyuki Hikichi(hikichi@sra.co.jp)
 
 This file is part of GDB.
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "mips-opcode.h"
 
index 849758b613078f9d1874a7c0a77be23dfdd83e88..4dd70e63ea979b9474a71e4030207b36e9e9e797 100644 (file)
@@ -1,8 +1,5 @@
-/* Work with core dump and executable files, for GDB on MIPS. 
-   This code would be in core.c if it weren't machine-dependent. */
-
-/* Low level interface to ptrace, for GDB when running under Unix.
-   Copyright (C) 1988, 1989, 1990  Free Software Foundation, Inc.
+/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
+   Copyright 1988, 1989, 1990, 1991  Free Software Foundation, Inc.
    Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
    and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
 
@@ -22,16 +19,8 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-/* FIXME: Can a MIPS porter/tester determine which of these include
-   files we still need?   -- gnu@cygnus.com */
 #include <stdio.h>
-#ifdef sgi
-#include <sys/inst.h>
-#else
-#include <mips/inst.h>
-#endif
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
@@ -485,7 +474,7 @@ mips_push_dummy_frame()
   for (ireg = 32; --ireg >= 0; )
     if (PROC_FREG_MASK(proc_desc) & (1 << ireg))
       {
-       buffer = read_register (ireg);
+       buffer = read_register (ireg + FP0_REGNUM);
        write_memory (save_address, &buffer, 4);
        save_address -= 4;
       }
@@ -531,10 +520,10 @@ mips_pop_frame()
       if (PROC_REG_MASK(proc_desc) & (1 << regnum))
        write_register (regnum,
                  read_memory_integer (frame->saved_regs->regs[regnum], 4));
-    for (regnum = 64; --regnum >= 32; )
+    for (regnum = 32; --regnum >= 0; )
       if (PROC_FREG_MASK(proc_desc) & (1 << regnum))
-       write_register (regnum,
-                 read_memory_integer (frame->saved_regs->regs[regnum], 4));
+       write_register (regnum + FP0_REGNUM,
+                 read_memory_integer (frame->saved_regs->regs[regnum + FP0_REGNUM], 4));
   }
   write_register (SP_REGNUM, new_sp);
   flush_cached_frames ();
index a5b0b03e655606af986e28e891c65429f4761243..a779012815dabb96239d2c18f580d5732c3e7dc2 100644 (file)
@@ -26,7 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <mips/inst.h>
 #endif
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
index 7d010a4d12a1a6e4f61b9bb6a45be740e7ff2453..07e1a7c74d4c3628148b1b51f787eed9f729e412 100644 (file)
@@ -34,15 +34,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    a pointer in the psymtab to do this.  */
 
 #include <stdio.h>
-#include "param.h"
-#include "obstack.h"
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/stat.h>
 #include "defs.h"
 #include "symtab.h"
 #include "gdbcore.h"
 #include "symfile.h"
+#include "obstack.h"
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/stat.h>
 #ifdef CMUCS
 #include <mips/syms.h>
 #else /* not CMUCS */
@@ -1702,7 +1701,8 @@ parse_partial_symbols(end_of_text_seg, objfile)
 
                        sh = s_idx + (SYMR *) fh->isymBase;
 
-                       if (sh->sc == scUndefined || sh->sc == scNil) {
+                       if (sh->sc == scUndefined || sh->sc == scNil ||
+                           sh->index == 0xfffff) {
                                /* FIXME, premature? */
                                s_idx++;
                                continue;
@@ -2400,8 +2400,8 @@ new_psymtab(name, objfile)
 
        /* Chain it to its object file */
        pst->objfile = objfile;
-       pst->objfile_chain = sym_objfile->psymtabs;
-       sym_objfile->psymtabs = pst;
+       pst->objfile_chain = objfile->psymtabs;
+       objfile->psymtabs = pst;
        
        pst->next = partial_symtab_list;
        partial_symtab_list = pst;
index 8f7083119cf12f900b2f80ad536086424b9d3615..dcb5dd90d286d5b7337bd5658b24cd172699a959 100644 (file)
@@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
 
index 8cb24823eed04c52c6bd6a3c19d007df944a9128..3cfbae529985807f88f40937e75d8265bed8a234 100644 (file)
@@ -1,5 +1,5 @@
-/* Print 32000 instructions for GDB, the GNU debugger.
-   Copyright (C) 1986,1988 Free Software Foundation, Inc.
+/* Print National Semiconductor 32000 instructions for GDB, the GNU debugger.
+   Copyright 1986, 1988, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "ns32k-opcode.h"
 #include "gdbcore.h"
index 214df03b6b5d8307e865b09001b06990e3a85e07..ceece4d85b394e4e064bc013ea5a0c4e866dd2b0 100644 (file)
@@ -30,7 +30,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "frame.h"
 #include "expression.h"
index ec96d4919c7863af3d90a7db595a33ce0288987a..a9a2fdfa58f9d258cdee2ab54943c33d93796fb9 100644 (file)
@@ -1,5 +1,5 @@
 /* Print values for GNU debugger GDB.
-   Copyright (C) 1986-1991 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "symtab.h"
 #include "value.h"
@@ -1994,7 +1993,7 @@ where FOO is stored, etc.  FOO must be an expression whose value\n\
 resides in memory.\n",
                   "\n\
 EXP may be preceded with /FMT, where FMT is a format letter\n\
-but no count or size letter (see \"x\" command)."));
+but no count or size letter (see \"x\" command).", NULL));
   add_com_alias ("p", "print", class_vars, 1);
 
   add_com ("inspect", class_vars, inspect_command,
index ee0f6801fe049980b7f6077002d834cffce349cf..95947e8a1411566c944330fb77051b831c34e65a 100644 (file)
@@ -34,7 +34,6 @@ regardless of whether or not the actual target has floating point hardware.
 
 
 #include "defs.h"
-#include "param.h"
 
 #ifdef USE_PROC_FS     /* Entire file goes away if not using /proc */
 
index f7318f08084f0601e6099f8dedbe2ba4813347f7..bf477f9c418013ba8921192e8d25c74abd0852f0 100644 (file)
@@ -9,21 +9,16 @@
 /****************************************************************/
 
 /*
-From pacbell!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm Wed May  4 23:40:52 1988
 Path: hoptoad!pacbell!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm
 From: tholm@uvicctr.UUCP (Terrence W. Holm)
 Newsgroups: comp.os.minix
 Subject: putenv(3)
 Message-ID: <395@uvicctr.UUCP>
 Date: 5 May 88 06:40:52 GMT
-Reply-To: tholm@uvicctr.UUCP (Terrence W. Holm)
 Organization: University of Victoria, Victoria B.C. Canada
-Lines: 296
-
 
 EFTH Minix report #2  - May 1988 -  putenv(3)
 
-
 This is an implementation of putenv(3) that we
 wrote for Minix. Please consider this a public
 domain program.
@@ -31,19 +26,16 @@ domain program.
 
 #include <stdio.h>
 
-
 #define  PSIZE  sizeof(char *)
 
-
 extern  char  **environ;
 
-
 char  *index();
 char  *malloc();
 
-
 /****************************************************************/
 /*                                                             */
+/*      int                                                    */
 /*     putenv( entry )                                         */
 /*                                                             */
 /*             The "entry" should follow the form              */
@@ -70,10 +62,10 @@ char  *malloc();
 /****************************************************************/
 
 
+int
 putenv( entry )
   char *entry;
-
-  {
+{
   unsigned length;
   unsigned size;
   char     **p;
@@ -114,4 +106,4 @@ putenv( entry )
   environ = new_environ;
 
   return(NULL);
-  }
+}
index 02d626c42d358a6e49a66c18481587459de52c3b..59d19b9979583e280b8b5461aab8b3b6832abf96 100644 (file)
@@ -1,5 +1,5 @@
-/* Disassembler for the Pyramid Technology 90x
-   Copyright (C) 1988,1989 Free Software Foundation, Inc.
+/* Print Pyramid Technology 90x instructions for GDB, the GNU Debugger.
+   Copyright 1988, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB, the GNU disassembler.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "pyr-opcode.h"
 #include "gdbcore.h"
@@ -30,8 +29,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
     Pyramids. (The Pyramid-dependent handling of register values for
     windowed registers is known to be buggy.)
 
-    When debugging, these functions supplant the normal definitions of some
-    of the macros in m-pyramid.h  The quantity of information produced
+    When debugging, these functions can supplant the normal definitions of some
+    of the macros in tm-pyramid.h  The quantity of information produced
     when these functions are used makes the gdb  unusable as a
     debugger for user programs.  */
     
index f3a3cde97c75d968910d48511f5463bd2f219545..7dc2f47b71d1cb5adaf01b57d8800d47c82a0aa5 100644 (file)
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include "param.h"
 #include "defs.h"
 
 /*** Prettier register printing. ***/
index 4a89db9498e874fe63880467ab6ae90171e1d36d..4aa8489940ce7156ccefa07d462ae4e88aa0a16c 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index 6c22422285a24a2b56a3cc52e239d132baa7ba34..34abe7622259737d407c5f230daa7f7901c5e358 100644 (file)
@@ -32,8 +32,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "tm.h"
-#include "param-no-tm.h"
 #include "inferior.h"
 #include "wait.h"
 #include "value.h"
index 0315fe7bd51a87279f0e22e7084927c746b6febd..1ab87ebf6e7e332ba42105b4b755fdb9fddd936b 100644 (file)
@@ -27,9 +27,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include <string.h>
+#define         TM_FILE_OVERRIDE
 #include "defs.h"
 #include "tm-29k.h"
-#include "param-no-tm.h"
 #include "inferior.h"
 #include "wait.h"
 #include "value.h"
index 34bb3d259418cb92966ed7b9894365f77579a6f7..f4b3436677aa8c695306b43298a0a86f44d66b9c 100644 (file)
@@ -101,7 +101,6 @@ NINDY ROM monitor at the other end of the line.
 #include <setjmp.h>
 
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "target.h"
index 686699e2da69fc479c7e189aa965eb6b0fade25e..fd73358d75387c393fc9287f53ff6811a4b05443 100644 (file)
@@ -8,7 +8,6 @@
 #include <setjmp.h>
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "value.h"
 #include "inferior.h"
index 32e82028d4d00c57e900f46c6f89b71de87510cb..4848ca2d6d0645ef36fbe2d40f60980725401324 100644 (file)
@@ -1,5 +1,5 @@
 /* Memory-access and commands for remote VxWorks processes, for GDB.
-   Copyright (C) 1990  Free Software Foundation, Inc.
+   Copyright 1990, 1991 Free Software Foundation, Inc.
    Contributed by Wind River Systems and Cygnus Support.
 
 This file is part of GDB.
@@ -18,9 +18,9 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#define         TM_FILE_OVERRIDE
 #include "defs.h"
 #include "tm-vxworks68.h"
-#include "param-no-tm.h"
 #include "frame.h"
 #include "inferior.h"
 #include "wait.h"
index 42090b75616ae69aae9bc6ad97a4dcebfe60e874..d61dd923a33f00adcc9414ecfc2ce2393f1f37f3 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "wait.h"
index 4003de07daa90f10f4ce0f6cf49c56da90bac173..eb203b21f8a594313c18eef2d8562faed06de4ff 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
index 7d0917b8d342edbeb7c88a05013038f93b8eecdd..c82c0b733f7e6cebd5bbb65a2e35cfe21b9e277d 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
index 7f07893ccf6d244990e7b435e9a8032afe6c9aae..3569da601a29a16d9c319debf88bedad94d93f67 100755 (executable)
@@ -1,5 +1,5 @@
-/* Convert between signal names and numbers.
-   Copyright (C) 1990 Free Software Foundation, Inc.
+/* Convert between signal names and numbers, for GDB.
+   Copyright 1990, 1991 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* GDB-specific, FIXME.  (This is for the SYS_SIGLIST_MISSING define).  */
 #include "defs.h"
-#include "param.h"
 
 #ifdef __STDC__
 #define CONST const
index 2a63772ad7ce71d81647328701e08439b98e515d..a8cdb08e7f231d140dbd4d10dda4a5be7a2defd1 100644 (file)
@@ -1,5 +1,5 @@
-/* Disassembler for the sparc.
-   Copyright (C) 1989 Free Software Foundation, Inc.
+/* Print SPARC instructions for GDB, the GNU Debugger.
+   Copyright 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB, the GNU disassembler.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "sparc-opcode.h"
 #include "gdbcore.h"
index b09dbe888aeb7acb2e5953bee78c4af37de9927d..003829e88d61b47783002d88e151805c246ccf3c 100644 (file)
@@ -1,7 +1,5 @@
-/* Machine-dependent code which would otherwise be in inflow.c and core.c,
-   for GDB, the GNU debugger, for SPARC host systems.
-
-   Copyright (C) 1986, 1987, 1989, 1990  Free Software Foundation, Inc.
+/* Host-dependent code for SPARC host systems, for GDB, the GNU debugger.
+   Copyright 1986, 1987, 1989, 1990, 1991  Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -21,8 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "tm-sparc.h"
-#include "param-no-tm.h"
 #include "inferior.h"
 #include "target.h"
 
index 88c70536be3afcf32574b6fb97336654b6f33584..fa6d6fc44fd6dcee38b8cdad24f36e3ff0c7ed8f 100644 (file)
@@ -29,7 +29,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #endif /* SIGTSTP and SIGIO defined (must be 4.2) */
 
 #include "defs.h"
-#include "param.h"
 #include "signals.h"
 #include "symtab.h"
 #include "frame.h"
index f6394bce02ae9c52f8606aed3c58e3a3d19f0dfb..295dff83dbaa42fd38452868181c721b277ddfdd 100644 (file)
@@ -1,6 +1,5 @@
-/* Sun-3 Machine-dependent code which would otherwise be in inflow.c and core.c,
-   for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Host-dependent code for Sun-3 for GDB, the GNU debugger.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,15 +19,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "inferior.h"
+#include "gdbcore.h"
 
 #include <sys/ptrace.h>
 #define KERNEL         /* To get floating point reg definitions */
 #include <machine/reg.h>
 
-#include "gdbcore.h"
-
 extern int errno;
 
 #if defined (GDB_TARGET_IS_SUN3)
index 4ecb54223c61c04b6fd6e8b8e5f29acf0e07558c..0a356477b48d129fed9783f08e8d4680fbda7112 100644 (file)
@@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "signame.h"
index cf75a17e6430a8968d32a7e1104af3a5ceb6583c..8910930e62f270e216e42d863b80c2e36752d314 100644 (file)
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include "defs.h"
 #include "symtab.h"
-#include "param.h"
 #include "gdbcore.h"
 #include "frame.h"
 #include "target.h"
@@ -50,9 +49,12 @@ extern CORE_ADDR startup_file_start; /* From blockframe.c */
 extern CORE_ADDR startup_file_end;     /* From blockframe.c */
 
 /* Functions this file defines */
-static bfd *symfile_open();
-static struct sym_fns *symfile_init();
-static void clear_symtab_users_once();
+static struct objfile *symfile_open ();
+static struct sym_fns *symfile_init ();
+static void clear_symtab_users_once ();
+
+static void free_all_psymtabs ();
+static void free_all_symtabs ();
 
 /* List of all available sym_fns.  */
 
@@ -84,17 +86,13 @@ struct obstack obstack2;
 
 struct obstack *psymbol_obstack = &obstack2;
 
-/* File name symbols were loaded from.  */
-
-char *symfile = 0;
+/* The object file that the main symbol table was loaded from (e.g. the
+   argument to the "symbol-file" or "file" command).  */
 
-/* The modification date of the file when they were loaded.  */
-
-long /* really time_t */ symfile_mtime = 0;
+struct objfile *symfile_objfile = 0;
 
 /* Structures with which to manage partial symbol allocation.  */
 
-#include "param.h"
 struct psymbol_allocation_list global_psymbols = {0}, static_psymbols = {0};
 
 /* Flag for whether user will be reloading symbols multiple times.
@@ -311,6 +309,79 @@ discard_misc_bunches (foo)
     }
 }
 
+/* After adding things to the vector, sort or re-sort it into address order.  */
+void
+sort_misc_function_vector ()
+{
+  qsort (misc_function_vector, misc_function_count,
+        sizeof (struct misc_function),
+        compare_misc_functions);
+}
+
+/* Compact duplicate entries out of the misc function vector by walking
+   through the vector and compacting out entries with duplicate addresses
+   and matching names.
+
+   When files contain multiple sources of symbol information, it is
+   possible for the misc function vector to contain many duplicate entries.
+   As an example, SVR4 systems use ELF formatted object files, which
+   usually contain at least two different types of symbol tables (a
+   standard ELF one and a smaller dynamic linking table), as well as
+   DWARF debugging information for files compiled with -g.
+
+   Without compacting, the misc function vector for gdb itself contains
+   over a 1000 duplicates, about a third of the total table size.  Aside
+   from the potential trap of not noticing that two successive entries
+   identify the same location, this duplication impacts the time required
+   to linearly scan the table, which is done in a number of places.  So
+   just do one linear scan here and toss out the duplicates.
+
+   Note that the strings themselves are allocated on the symbol_obstack,
+   so we can't easily reclaim their memory.  They will get automatically
+   freed when the symbol table is freed.
+
+   Also note we only go up to the next to last entry within the loop
+   and then copy the last entry explicitly after the loop terminates.
+
+   Since the different sources of information for each symbol may
+   have different levels of "completeness", we may have duplicates
+   that have one entry with type "mf_unknown" and the other with a
+   known type.  So if the one we are leaving alone has type mf_unknown,
+   overwrite it's type with the type from the one we are compacting out.
+*/
+
+
+static void
+compact_misc_function_vector ()
+{
+  struct misc_function *copyfrom;
+  struct misc_function *copyto;
+
+  copyfrom = copyto = misc_function_vector;
+  while (copyfrom < misc_function_vector + misc_function_count - 1)
+    {
+      if (copyfrom -> address == (copyfrom + 1) -> address
+         && (strcmp (copyfrom -> name, (copyfrom + 1) -> name) == 0))
+       {
+         if ((copyfrom + 1) -> type == mf_unknown)
+           {
+             (copyfrom + 1) -> type = copyfrom -> type;
+           }
+         copyfrom++;
+       }
+      else
+       {
+         *copyto++ = *copyfrom++;
+       }
+    }
+  *copyto++ = *copyfrom++;
+  misc_function_count = copyto - misc_function_vector;
+  misc_function_vector = (struct misc_function *)
+    xrealloc (misc_function_vector,
+             misc_function_count * sizeof (struct misc_function));
+
+}
+
 /* INCLINK nonzero means bunches are from an incrementally-linked file.
    Add them to the existing bunches.
    Otherwise INCLINK is zero, and we start from scratch. */
@@ -365,9 +436,11 @@ condense_misc_bunches (inclink)
 
   /* Sort the misc functions by address.  */
 
-  qsort (misc_function_vector, misc_function_count,
-        sizeof (struct misc_function),
-        compare_misc_functions);
+  sort_misc_function_vector ();
+
+  /* Compact out any duplicates. */
+
+  compact_misc_function_vector ();
 }
 
 
@@ -404,14 +477,14 @@ psymtab_to_symtab (pst)
    where the text segment was loaded.  */
 
 void
-syms_from_bfd (sym_bfd, addr, mainline)
-     bfd *sym_bfd;
+syms_from_objfile (objfile, addr, mainline)
+     struct objfile *objfile;
      CORE_ADDR addr;
      int mainline;
 {
   asection *text_sect;
   struct sym_fns *sf;
-  char *realname;
+  bfd *sym_bfd = objfile->obfd;
 
   /* There is a distinction between having no symbol table
      (we refuse to read the file, leaving the old set of symbols around)
@@ -439,20 +512,15 @@ syms_from_bfd (sym_bfd, addr, mainline)
       startup_file_end = 0;
     }
 
-  sf = symfile_init (sym_bfd);
-  realname = bfd_get_filename (sym_bfd);
-  realname = savestring (realname, strlen (realname));
-  /* FIXME, this probably creates a storage leak... */
+  sf = symfile_init (objfile);
 
   if (mainline) 
     {
       /* Since no error yet, throw away the old symbol table.  */
 
-      if (symfile)
-       free (symfile);
-      symfile = 0;
-      free_all_symtabs ();
-      free_all_psymtabs ();
+      if (symfile_objfile)
+        free_objfile (symfile_objfile);
+      symfile_objfile = 0;
 
       (*sf->sym_new_init) ();
 
@@ -475,7 +543,7 @@ syms_from_bfd (sym_bfd, addr, mainline)
   if (mainline)
     {
       /* OK, make it the "real" symbol file.  */
-      symfile = realname;
+      symfile_objfile = objfile;
       symfile_fns = sf;
     }
 
@@ -501,17 +569,17 @@ symbol_file_add (name, from_tty, addr, mainline)
      CORE_ADDR addr;
      int mainline;
 {
+  struct objfile *objfile;
   bfd *sym_bfd;
 
-  sym_bfd = symfile_open (name);
-
-  if (mainline)
-    symfile_mtime = bfd_get_mtime (sym_bfd);
+  objfile = symfile_open (name);
+  sym_bfd = objfile->obfd;
 
   /* There is a distinction between having no symbol table
      (we refuse to read the file, leaving the old set of symbols around)
      and having no debugging symbols in your symbol table (we read
-     the file and end up with a mostly empty symbol table).  */
+     the file and end up with a mostly empty symbol table, but with lots
+     of stuff in the misc function vector).  */
 
   if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS))
     {
@@ -531,7 +599,7 @@ symbol_file_add (name, from_tty, addr, mainline)
       fflush (stdout);
     }
 
-  syms_from_bfd (sym_bfd, addr, mainline);
+  syms_from_objfile (objfile, addr, mainline);
 
   if (from_tty)
     {
@@ -553,15 +621,15 @@ symbol_file_command (name, from_tty)
 
   if (name == 0)
     {
-      if ((symtab_list || partial_symtab_list)
-         && from_tty
-         && !query ("Discard symbol table from `%s'? ", symfile))
-       error ("Not confirmed.");
-      if (symfile)
-       free (symfile);
-      symfile = 0;
-      free_all_symtabs ();
-      free_all_psymtabs ();
+      if (symfile_objfile) {
+        if ((symtab_list || partial_symtab_list)
+           && from_tty
+           && !query ("Discard symbol table from `%s'? ",
+                      symfile_objfile->name))
+         error ("Not confirmed.");
+       free_objfile (symfile_objfile);
+      }
+      symfile_objfile = 0;
       /* FIXME, this does not account for the main file and subsequent
          files (shared libs, dynloads, etc) having different formats. 
          It only calls the cleanup routine for the main file's format.  */
@@ -581,46 +649,112 @@ symbol_file_command (name, from_tty)
 }
 
 /* Open NAME and hand it off to BFD for preliminary analysis.  Result
-   is a BFD *, which includes a new copy of NAME dynamically allocated
-   (which will be freed by the cleanup chain).  In case of trouble,
-   error() is called.  */
+   is newly malloc'd struct objfile *, which includes a newly malloc'd`
+   copy of NAME (tilde-expanded and made absolute).
+   In case of trouble, error() is called.  */
 
-static bfd *
+static struct objfile *
 symfile_open (name)
      char *name;
 {
   bfd *sym_bfd;
   int desc;
   char *absolute_name;
+  struct objfile *objfile;
 
-  name = tilde_expand (name);
-  make_cleanup (free, name);
+  name = tilde_expand (name);  /* Returns 1st new malloc'd copy */
 
+  /* Look down path for it, allocate 2nd new malloc'd copy.  */
   desc = openp (getenv ("PATH"), 1, name, O_RDONLY, 0, &absolute_name);
-  if (desc < 0)
+  if (desc < 0) {
+    make_cleanup (free, name);
     perror_with_name (name);
-  else
-    {
-      make_cleanup (free, absolute_name);
-      name = absolute_name;
-    }
+  }
+  free (name);                 /* Free 1st new malloc'd copy */
+  name = absolute_name;                /* Keep 2nd malloc'd copy in objfile and bfd */
 
   sym_bfd = bfd_fdopenr (name, NULL, desc);
   if (!sym_bfd)
     {
       close (desc);
+      make_cleanup (free, name);
       error ("Could not open `%s' to read symbols: %s",
             name, bfd_errmsg (bfd_error));
     }
-  make_cleanup (bfd_close, sym_bfd);
 
-  if (!bfd_check_format (sym_bfd, bfd_object))
+  if (!bfd_check_format (sym_bfd, bfd_object)) {
+    bfd_close (sym_bfd);       /* This also closes desc */
+    make_cleanup (free, name);
     error ("\"%s\": can't read symbols: %s.",
           name, bfd_errmsg (bfd_error));
+  }
 
-  return sym_bfd;
+  objfile = allocate_objfile (sym_bfd, name);
+  return objfile;
 }
 
+
+/* Allocate a new objfile struct, fill it in as best we can, and return it.
+   FIXME-soon!  Eventually, the objfile will contain the obstack in which
+   the symtabs and psymtabs are contained, so they can all be blown away
+   cheaply and easily.  */
+
+struct objfile *
+allocate_objfile (abfd, filename)
+     bfd *abfd;
+     char *filename;
+{
+  struct objfile *objfile;
+
+  objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
+  bzero (objfile, sizeof (*objfile));
+
+  objfile->obfd = abfd;
+  objfile->name = filename;
+
+  objfile->symtabs = 0;                /* Don't have any yet */
+  objfile->psymtabs = 0;       /* Don't have any yet */
+
+  objfile->mtime = bfd_get_mtime (abfd);
+
+  /* Chain it to the list.  */
+  objfile->next = object_files;
+  object_files = objfile;
+
+  return objfile;
+}
+
+
+/* Destroy an objfile and all the symtabs and psymtabs under it.  */
+
+void
+free_objfile (objfile)
+     struct objfile *objfile;
+{
+  struct objfile *ofp;
+
+  if (objfile->name)
+    free (objfile->name);
+  if (objfile->obfd)
+    bfd_close (objfile->obfd);
+
+  /* Remove it from the chain of all objfiles.  */
+  if (object_files == objfile)
+    object_files = objfile->next;
+  else for (ofp = object_files; ofp; ofp = ofp->next) {
+    if (ofp->next == objfile)
+      ofp->next = objfile->next;
+  }
+
+  /* FIXME!  This should only free those associated with the objfile
+     being passed to us.  THIS IS A KLUDGE TO BOOTSTRAP US.  */
+  free_all_psymtabs ();
+  free_all_symtabs ();
+
+  free (objfile);
+}
+
+
 /* Link a new symtab_fns into the global symtab_fns list.
    Called by various _initialize routines.  */
 
@@ -638,10 +772,11 @@ add_symtab_fns (sf)
    that contains cached information about the symbol file.  */
 
 static struct sym_fns *
-symfile_init (sym_bfd)
-     bfd *sym_bfd;
+symfile_init (objfile)
+     struct objfile *objfile;
 {
   struct sym_fns *sf, *sf2;
+  bfd *sym_bfd = objfile->obfd;
 
   for (sf = symtab_fns; sf != NULL; sf = sf->next)
     {
@@ -650,6 +785,7 @@ symfile_init (sym_bfd)
          sf2 = (struct sym_fns *)xmalloc (sizeof (*sf2));      
          /* FIXME, who frees this? */
          *sf2 = *sf;
+         sf2->objfile = objfile;
          sf2->sym_bfd = sym_bfd;
          sf2->sym_private = 0;                 /* Not alloc'd yet */
          (*sf2->sym_init) (sf2);
@@ -712,11 +848,13 @@ add_symbol_file_command (arg_string, from_tty)
   symbol_file_add (name, 0, text_addr, 0);
 }
 \f
-/* Re-read symbols if the symbol-file has changed.  */
+/* Re-read symbols if a symbol-file has changed.  */
 void
 reread_symbols ()
 {
-  struct stat symstat;
+  struct objfile *objfile;
+  long new_modtime;
+  int reread_one = 0;
 
   /* With the addition of shared libraries, this should be modified,
      the load time should be saved in the partial symbol tables, since
@@ -725,16 +863,24 @@ reread_symbols ()
      and see if the symbol table that it originates from has been changed
   */
 
-  if (stat (symfile, &symstat) < 0)
-    /* Can't read symbol-file.  Assume it is up to date.  */
-    return;
-
-  if (symstat.st_mtime > symfile_mtime)
-    {
-      printf_filtered ("Symbol file has changed; re-reading symbols.\n");
-      symbol_file_command (symfile, 0);
-      breakpoint_re_set ();
+  for (objfile = object_files; objfile; objfile = objfile->next) {
+    if (objfile->obfd) {
+      objfile->obfd->mtime_set = false;                /* Force it to reread. */
+      new_modtime = bfd_get_mtime (objfile->obfd);
+      if (new_modtime != objfile->mtime) {
+       printf_filtered ("`%s' has changed; re-reading symbols.\n",
+                        objfile->name);
+       /* FIXME, this should use a different command...that would only
+          affect this objfile's symbols.  */
+       symbol_file_command (objfile->name, 0);
+        objfile->mtime = new_modtime;
+       reread_one = 1;
+      }
     }
+  }
+
+  if (reread_one)
+    breakpoint_re_set ();
 }
 
 /* This function is really horrible, but to avoid it, there would need
@@ -770,10 +916,9 @@ fill_in_vptr_fieldno (type)
 static unsigned stop_whining = 0;
 
 /* Print a complaint about the input symbols, and link the complaint block
-   into a chain for later handling.  Result is 1 if the complaint was
-   printed, 0 if it was suppressed.  */
+   into a chain for later handling.  */
 
-int
+void
 complain (complaint, val)
      struct complaint *complaint;
      char *val;
@@ -784,7 +929,7 @@ complain (complaint, val)
     complaint_root->next = complaint;
   }
   if (complaint->counter > stop_whining)
-    return 0;
+    return;
   wrap_here ("");
   if (!info_verbose) {
     puts_filtered ("During symbol reading...");
@@ -794,7 +939,6 @@ complain (complaint, val)
   wrap_here("");
   if (!info_verbose)
     puts_filtered ("\n");
-  return 1;
 }
 
 /* Clear out all complaint counters that have ever been incremented.  */
@@ -808,6 +952,23 @@ clear_complaints ()
     p->counter = 0;
 }
 \f
+enum language
+deduce_language_from_filename (filename)
+     char *filename;
+{
+  char *c = rindex (filename, '.');
+  
+  if (!c) ; /* Get default. */
+  else if(!strcmp(c,".mod"))
+     return language_m2;
+  else if(!strcmp(c,".c"))
+     return language_c;
+  else if(!strcmp(c,".cc") || !strcmp(c,".C"))
+     return language_cplus;
+
+  return language_unknown;             /* default */
+}
+\f
 /* allocate_symtab:
 
    Allocate and partly initialize a new symbol table.  Return a pointer
@@ -826,11 +987,11 @@ clear_complaints ()
  */
 
 struct symtab *
-allocate_symtab(name)
+allocate_symtab(name, objfile)
        char *name;
+       struct objfile *objfile;
 {
   register struct symtab *symtab;
-  char *c;
 
   symtab = (struct symtab *) xmalloc (sizeof (struct symtab));
   bzero (symtab, sizeof (*symtab));
@@ -839,17 +1000,16 @@ allocate_symtab(name)
   symtab->nlines = 0;
   symtab->line_charpos = 0;
   symtab->version = 0;
-  symtab->language = language_unknown;         /* default */
+  symtab->language = deduce_language_from_filename (name);
 
-  c = rindex (name, '.');
-  
-  if (!c) {
-     ; /* Don't know language of file. */
-  } else if(!strcmp(c,".mod")) {
-     symtab->language = language_m2;
-  } else if(!strcmp(c,".c") || !strcmp(c,".cc")) {
-     symtab->language = language_c;
-  }
+  /* Hook it to the objfile it comes from */
+  symtab->objfile = objfile;
+  symtab->objfile_chain = objfile->symtabs;
+  objfile->symtabs = symtab;
+
+#ifdef INIT_EXTRA_SYMTAB_INFO
+  INIT_EXTRA_SYMTAB_INFO(symtab);
+#endif
 
   return symtab;
 }
@@ -1041,6 +1201,54 @@ again2:
   return blewit;
 }
 \f
+/*
+ * Free all partial_symtab storage.
+ */
+static void
+free_all_psymtabs()
+{
+  obstack_free (psymbol_obstack, 0);
+  obstack_init (psymbol_obstack);
+  partial_symtab_list = (struct partial_symtab *) 0;
+}
+
+/* Free all the symtabs that are currently installed,
+   and all storage associated with them.
+   Leaves us in a consistent state with no symtabs installed.  */
+
+static void
+free_all_symtabs ()
+{
+  register struct symtab *s, *snext;
+
+  /* All values will be invalid because their types will be!  */
+
+  clear_value_history ();
+  clear_displays ();
+  clear_internalvars ();
+#if defined (CLEAR_SOLIB)
+  CLEAR_SOLIB ();
+#endif
+  set_default_breakpoint (0, 0, 0, 0);
+
+  current_source_symtab = 0;
+
+  for (s = symtab_list; s; s = snext)
+    {
+      snext = s->next;
+      free_symtab (s);
+    }
+  symtab_list = 0;
+  obstack_free (symbol_obstack, 0);
+  obstack_init (symbol_obstack);
+
+  if (misc_function_vector)
+    free (misc_function_vector);
+  misc_function_count = 0;
+  misc_function_vector = 0;
+  clear_pc_function_cache();
+}
+\f
 void
 _initialize_symfile ()
 {
index d7d5def3e1ff362cb3df365a0374eb382fd16718..55a75adcbd18a3af1986542262e1d1c735e18f16 100644 (file)
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
index 28713079aeec0d59a8cd0251528763cb8b1cb8cc..a0508a9f3d16a3bc1581ed0764eabe325af2b490 100644 (file)
@@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
index 27d4952dfe789f5e8846116d7fe47387bc507a8c..488bc7ece9aae936c8e8964bbe10a33dc956fed8 100644 (file)
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include "defs.h"
 #include "symtab.h"
-#include "param.h"
 #include "gdbcore.h"
 #include "frame.h"
 #include "target.h"
@@ -183,9 +182,9 @@ type_name_no_tag (type)
       if(!strncmp(name,"enum ",5))
       return name + 5;
       else return name;
+    default:
+      return name;
     }
-
-  return TYPE_NAME (type);
 }
 
 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
@@ -249,9 +248,11 @@ gdb_mangle_name (type, i, j)
                          + strlen (TYPE_FN_FIELD_PHYSNAME (f, j))
                          + 1);
 
+  /* Only needed for GNU-mangled names.  ANSI-mangled names
+     work with the normal mechanisms.  */
   if (OPNAME_PREFIX_P (field_name))
     {
-      char *opname = cplus_mangle_opname (field_name + 3);
+      char *opname = cplus_mangle_opname (field_name + 3, 0);
       if (opname == NULL)
        error ("No mangling for \"%s\"", field_name);
       mangled_name_len += strlen (opname);
@@ -457,17 +458,14 @@ lookup_struct_elt_type (type, name, noerr)
 }
 
 /* Given a type TYPE, return a type of pointers to that type.
-   May need to construct such a type if this is the first use.
-
-   C++: use TYPE_MAIN_VARIANT and TYPE_CHAIN to keep pointer
-   to member types under control.  */
+   May need to construct such a type if this is the first use.  */
 
 struct type *
 lookup_pointer_type (type)
      struct type *type;
 {
   register struct type *ptype = TYPE_POINTER_TYPE (type);
-  if (ptype) return TYPE_MAIN_VARIANT (ptype);
+  if (ptype) return ptype;
 
   /* This is the first time anyone wanted a pointer to a TYPE.  */
   if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
@@ -477,7 +475,6 @@ lookup_pointer_type (type)
                                            sizeof (struct type));
 
   bzero (ptype, sizeof (struct type));
-  TYPE_MAIN_VARIANT (ptype) = ptype;
   TYPE_TARGET_TYPE (ptype) = type;
   TYPE_POINTER_TYPE (type) = ptype;
   /* New type is permanent if type pointed to is permanent.  */
@@ -496,7 +493,7 @@ lookup_reference_type (type)
      struct type *type;
 {
   register struct type *rtype = TYPE_REFERENCE_TYPE (type);
-  if (rtype) return TYPE_MAIN_VARIANT (rtype);
+  if (rtype) return rtype;
 
   /* This is the first time anyone wanted a pointer to a TYPE.  */
   if (TYPE_FLAGS (type) & TYPE_FLAG_PERM)
@@ -506,7 +503,6 @@ lookup_reference_type (type)
                                            sizeof (struct type));
 
   bzero (rtype, sizeof (struct type));
-  TYPE_MAIN_VARIANT (rtype) = rtype;
   TYPE_TARGET_TYPE (rtype) = type;
   TYPE_REFERENCE_TYPE (type) = rtype;
   /* New type is permanent if type pointed to is permanent.  */
@@ -727,6 +723,9 @@ lookup_basetype_type (type, offset, via_virtual, via_public)
   /* In practice, this is never used.  */
   TYPE_LENGTH (btype) = 1;
   TYPE_CODE (btype) = TYPE_CODE_STRUCT;
+  TYPE_CPLUS_SPECIFIC (btype)
+    = (struct cplus_struct_type *) obstack_alloc (symbol_obstack, sizeof (struct cplus_struct_type)));
+  bzero (TYPE_CPLUS_SPECIFIC (btype), sizeof (struct cplus_struct_type));
 
   return btype;
 }
@@ -2765,7 +2764,6 @@ init_type (code, length, uns, name)
 
   type = (struct type *) xmalloc (sizeof (struct type));
   bzero (type, sizeof *type);
-  TYPE_MAIN_VARIANT (type) = type;
   TYPE_CODE (type) = code;
   TYPE_LENGTH (type) = length;
   TYPE_FLAGS (type) = uns ? TYPE_FLAG_UNSIGNED : 0;
@@ -2774,8 +2772,14 @@ init_type (code, length, uns, name)
   TYPE_NAME (type) = name;
 
   /* C++ fancies.  */
-  TYPE_NFN_FIELDS (type) = 0;
-  TYPE_N_BASECLASSES (type) = 0;
+  if (code == TYPE_CODE_STRUCT)
+    {
+      TYPE_CPLUS_SPECIFIC (type)
+       = (struct cplus_struct_type *) xmalloc (sizeof (struct cplus_struct_type));
+      TYPE_MAIN_VARIANT (type) = type;
+      TYPE_NFN_FIELDS (type) = 0;
+      TYPE_N_BASECLASSES (type) = 0;
+    }
   return type;
 }
 
index d9c76968ddf3ed973cbdb7276228947eb9f30d5a..8675a76011702a808cf287d534d4cc14825e93c7 100644 (file)
@@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #if !defined (SYMTAB_H)
 #define SYMTAB_H 1
-#include <obstack.h>
+#include "obstack.h"
 
 /* An obstack to hold objects that should be freed
    when we load a new symbol table.
@@ -32,12 +32,6 @@ extern struct obstack *psymbol_obstack;
 /* Some definitions and declarations to go with use of obstacks.  */
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
-#ifdef __STDC__
-extern void *xmalloc ();
-#else
-extern char *xmalloc ();
-#endif
-extern void free ();
 
 /* Some macros for char-based bitfields.  */
 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
index c3c675c501a10477ee3983d2a91b18108d7d85d2..1ba22a3e25ada34aabb780f1d66301b65fbc6636 100644 (file)
@@ -1,12 +1,26 @@
-/*
- * Ported by the State University of New York at Buffalo by the Distributed
- * Computer Systems Lab, Department of Computer Science, 1991.
- */
+/* Print instructions for Tahoe target machines, for GDB.
+   Copyright 1986, 1989, 1991 Free Software Foundation, Inc.
+   Contributed by the State University of New York at Buffalo, by the
+   Distributed Computer Systems Lab, Department of Computer Science, 1991.
 
-#include <stdio.h>
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "tahoe-opcode.h"
 
@@ -98,7 +112,7 @@ print_insn_arg (d, p, addr, stream)
       case 0:
       case 1:
       case 2:
-      case 3:                  /* Liter>al(short immediate byte) mode */
+      case 3:                  /* Literal (short immediate byte) mode */
        if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h')
          {
            *(int *)&floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4);
index 1ada10b667dd5f47c34a816ac0d0935805520228..a3435093e0cefb58e6a845e92c8de79ce2a02b67 100644 (file)
@@ -19,14 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #define TARGET_BYTE_ORDER BIG_ENDIAN
 
-/* I don't know if this will work for cross-debugging, even if you do get
-   the right files.  */
-/* Include certain files for dbxread.c  */
-#include <convex/filehdr.h>
-#include <convex/opthdr.h>
-#include <convex/scnhdr.h>
-#include <nlist.h>
-
 /* Define this if the C compiler puts an underscore at the front
    of external names before giving them to the linker.  */
 
index f1926a148d2eba20e6cf6050a125c35d512c9814..d900ba814503e6374a97520b0cfbea6f32d9c625 100644 (file)
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include HAVE_68881
+#define HAVE_68881
 
 /* Define BPT_VECTOR if it is different than the default.
    This is the vector number used by traps to indicate a breakpoint. */
index f782dd0ed6441e60e3283e0a75792d90bb19a889..49287f0b007172b9ea22dbc9085fa5e55da3038e 100644 (file)
@@ -19,10 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
 
-/* I don't know if this will work for cross-debugging, even if you do get
-   a copy of the right include file.  */
-#include <machine/reg.h>
-
 /* Define this if the C compiler puts an underscore at the front
    of external names before giving them to the linker.  */
 
index 15d214b48a77d97bcd818ebddc86d78b66bafb9b..aae9f100c8d8e0f9ad3c7b9a8213631db4b29c58 100644 (file)
@@ -86,11 +86,7 @@ extern CORE_ADDR sparc_pc_adjust();
 
 #define SAVED_PC_AFTER_CALL(frame) PC_ADJUST (read_register (RP_REGNUM))
 
-/* Address of the end of stack space.  We get this from the system
-   include files. */
-#include <sys/types.h>
-#include <machine/vmparam.h>
-#define STACK_END_ADDR USRSTACK
+/* Stack grows downward.  */
 
 #define INNER_THAN <
 
index 727ffcf11903b20eb6ceba80348b480d314c6074..22a4277d4db875a9e49ba353970e620e127b330a 100644 (file)
@@ -244,10 +244,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    Returns positive address > 1 if pc is between enter/exit,
    1 if pc before enter or after exit, 0 otherwise. */
 
-#ifndef CORE_ADDR
-#include "defs.h"   /* Make sure CORE_ADDR is defined.  */
-#endif
-
 extern CORE_ADDR ns32k_get_enter_addr ();
 
 /* Return number of args passed to a frame.
index c910e3d477986c4b18955ec2e17573e0c9751cea..35eff11691c7ca8aeb1de46c641e63ac3e6872b1 100644 (file)
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define DEBUG
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
index 81183766bb06d3941abd3b79ee8f5474e793558f..474416b9fe740efec18da0e403876783b322febc 100644 (file)
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 
index 36645ebd1eb1ce870004a5b98cfe1e706b756a99..bffa2ee9bdbdf1c730731fee50a3048a658aaaae 100644 (file)
@@ -26,7 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <string.h>
 
 #include "defs.h"
-#include "param.h"
 #include "signals.h"
 #include "gdbcmd.h"
 #include "terminal.h"
@@ -46,37 +45,6 @@ extern char *realloc();
 #define ISATTY(FP)     (isatty (fileno (FP)))
 #endif
 
-#ifdef MISSING_VPRINTF
-#ifdef __GNU_LIBRARY
-#undef MISSING_VPRINTF
-#else  /* !__GNU_LIBRARY */
-
-#ifndef vfprintf
-/* Can't #define it since language.c needs it (though FIXME it shouldn't) */
-void
-vfprintf (file, format, ap)
-     FILE *file;
-     char *format;
-     va_list ap;
-{
-  _doprnt (format, ap, file);
-}
-#endif /* vfprintf */
-
-#ifndef vprintf
-/* Can't #define it since printcmd.c needs it */
-void
-vprintf (format, ap)
-     char *format;
-     va_list ap;
-{
-  vfprintf (stdout, format, ap);
-}
-#endif /* vprintf */
-
-#endif /* GNU_LIBRARY */
-#endif /* MISSING_VPRINTF */
-
 void error ();
 void fatal ();
 
@@ -515,18 +483,6 @@ strsave (ptr)
   return savestring (ptr, strlen (ptr));
 }
 
-char *
-concat (s1, s2, s3)
-     char *s1, *s2, *s3;
-{
-  register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
-  register char *val = (char *) xmalloc (len);
-  strcpy (val, s1);
-  strcat (val, s2);
-  strcat (val, s3);
-  return val;
-}
-
 void
 print_spaces (n, file)
      register int n;
@@ -1032,14 +988,10 @@ fputs_demangled (linebuffer, stream, arg_mode)
    (since prompt_for_continue may do so) so this routine should not be
    called when cleanups are not in place.  */
 
-#if !defined(MISSING_VPRINTF) || defined (vsprintf)
 /* VARARGS */
 void
 vfprintf_filtered (stream, format, args)
      va_list args;
-#else
-void fprintf_filtered (stream, format, arg1, arg2, arg3, arg4, arg5, arg6)
-#endif
      FILE *stream;
      char *format;
 {
@@ -1069,16 +1021,11 @@ void fprintf_filtered (stream, format, arg1, arg2, arg3, arg4, arg5, arg6)
 
   /* This won't blow up if the restrictions described above are
      followed.   */
-#if !defined(MISSING_VPRINTF) || defined (vsprintf)
   (void) vsprintf (linebuffer, format, args);
-#else
-  (void) sprintf (linebuffer, format, arg1, arg2, arg3, arg4, arg5, arg6);
-#endif
 
   fputs_filtered (linebuffer, stream);
 }
 
-#if !defined(MISSING_VPRINTF) || defined (vsprintf)
 /* VARARGS */
 void
 fprintf_filtered (va_alist)
@@ -1112,15 +1059,6 @@ printf_filtered (va_alist)
   (void) vfprintf_filtered (stdout, format, args);
   va_end (args);
 }
-#else
-void
-printf_filtered (format, arg1, arg2, arg3, arg4, arg5, arg6)
-     char *format;
-     int arg1, arg2, arg3, arg4, arg5, arg6;
-{
-  fprintf_filtered (stdout, format, arg1, arg2, arg3, arg4, arg5, arg6);
-}
-#endif
 
 /* Easy */
 
index 07c96af55b99d0608a6e50b92f701d9f5d7aaa43..45cca2e2eeb39cc6d9083499ed5769a36d93b7a6 100644 (file)
@@ -1,5 +1,5 @@
 /* Perform non-arithmetic operations on values, for GDB.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "value.h"
 #include "frame.h"
@@ -1054,7 +1053,7 @@ search_struct_method (name, arg1, args, offset, static_memfuncp, type)
                    return (value)value_virtual_fn_field (arg1, f, j, type);
                  if (TYPE_FN_FIELD_STATIC_P (f, j) && static_memfuncp)
                    *static_memfuncp = 1;
-                 return (value)value_fn_field (arg1, i, j);
+                 return (value)value_fn_field (f, j);
                }
              j--;
            }
@@ -1169,7 +1168,7 @@ value_struct_elt (argp, args, name, static_memfuncp, err)
       if (!args[1])
        {
          /* destructors are a special case.  */
-         return (value)value_fn_field (*argp, 0,
+         return (value)value_fn_field (TYPE_FN_FIELDLIST1 (t, 0),
                                        TYPE_FN_FIELDLIST_LENGTH (t, 0));
        }
       else
@@ -1206,9 +1205,6 @@ destructor_name_p (name, type)
   if (name[0] == '~')
     {
       char *dname = type_name_no_tag (type);
-
-      if (! TYPE_HAS_DESTRUCTOR (type))
-       error ("type `%s' does not have destructor defined", dname);
       if (strcmp (dname, name+1))
        error ("name of destructor must equal name of class");
       else
index 1baf6984e6bee2a8121995026d5af5a49f41cb1f..96808501b12c673adc60bc81544be76c01ff0c08 100644 (file)
@@ -1,5 +1,5 @@
-/* Print values for GNU debugger gdb.
-   Copyright (C) 1986, 1988, 1989 Free Software Foundation, Inc.
+/* Print values for GDB, the GNU debugger.
+   Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "value.h"
 #include "gdbcore.h"
@@ -1237,6 +1236,7 @@ typedef_print (type, new, stream)
    {
 #ifdef _LANG_c
    case language_c:
+   case language_cplus:
       fprintf_filtered(stream, "typedef ");
       type_print(type,"",stream,0);
       if(TYPE_NAME ((SYMBOL_TYPE (new))) == 0
@@ -1472,6 +1472,8 @@ type_print_varspec_prefix (type, stream, show, passed_a_ptr)
     case TYPE_CODE_FLT:
     case TYPE_CODE_VOID:
     case TYPE_CODE_ERROR:
+    case TYPE_CODE_CHAR:
+    case TYPE_CODE_BOOL:
       /* These types need no prefix.  They are listed here so that
         gcc -Wall will reveal any types that haven't been handled.  */
       break;
@@ -1568,6 +1570,8 @@ type_print_varspec_suffix (type, stream, show, passed_a_ptr)
     case TYPE_CODE_FLT:
     case TYPE_CODE_VOID:
     case TYPE_CODE_ERROR:
+    case TYPE_CODE_CHAR:
+    case TYPE_CODE_BOOL:
       /* These types do not need a suffix.  They are listed so that
         gcc -Wall will report types that may not have been considered.  */
       break;
index 810e00b41a867c7421f7d4c469dc18648d4e2fdd..f141bc8cb022a49455d69057bb2014db120b78a2 100644 (file)
@@ -1,5 +1,5 @@
-/* Low level packing and unpacking of values for GDB.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Low level packing and unpacking of values for GDB, the GNU Debugger.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <string.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "value.h"
 #include "gdbcore.h"
index 011cd952dc299fd5905a0e36153199e4b99d422f..ccbf19b8e858a2d6c3dde02bb32470105fd702bd 100644 (file)
@@ -1,5 +1,5 @@
-/* Print vax instructions for GDB, the GNU debugger.
-   Copyright (C) 1986, 1989 Free Software Foundation, Inc.
+/* Print VAX instructions for GDB, the GNU debugger.
+   Copyright 1986, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
 #include "vax-opcode.h"
 
index f1bd3d8ddc3aa8f286374bd21cb2a5c6518d4464..3b3eb62727cfba834090b757749e795f5ffe190d 100644 (file)
@@ -31,7 +31,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <sys/ldr.h>
 
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "target.h"
index 912c9d11ae935fe897d4a54181174bb817f0c2e0..44ce2fa4de3f01dfbdd3297ca3597e8835eabb23 100644 (file)
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
 #include "bfd.h"
-#include "param.h"
 
 #include <stdio.h>
 
index 156214c2f5f0bccf1b14a8da76e55a3989af9275..923e6d63d5cdc8d647b5c3d022074aa44a118ca7 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions to make GDB run on Convex Unix (4bsd)
-   Copyright (C) 1989 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -44,8 +44,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Hook to call after creating inferior process.  */
 
 #define CREATE_INFERIOR_HOOK create_inferior_hook
-
-\f
-/* Interface definitions for kernel debugger KDB.  */
-
-/* (no kdb) */
index 0564f0d7ed577531789a23209bbf8d62ac64ab31..665efb035235b9b96c29433d58c1b65fe3a791c5 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions to make GDB run on a merlin under utek 2.1
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#include <machine/reg.h>
+
 /* This machine doesn't have the siginterrupt call.  */
 #define NO_SIGINTERRUPT
 
index cbdac01a57294f937416d205c25f148c4c57cb0c..0e67e93d660efa2020a1d9219148c840dcc751e6 100644 (file)
@@ -1,6 +1,7 @@
 /* Parameters for execution on a Sun 4, for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@mcc.com)
+
 This file is part of GDB.
 
 This program is free software; you can redistribute it and/or modify