aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/altos-xdep.c1
-rw-r--r--gdb/am29k-tdep.c3
-rw-r--r--gdb/arm-pinsn.c5
-rw-r--r--gdb/arm-xdep.c1
-rw-r--r--gdb/buildsym.c1
-rw-r--r--gdb/c-exp.y1
-rw-r--r--gdb/coffread.c1
-rw-r--r--gdb/command.c5
-rw-r--r--gdb/convex-pinsn.c3
-rw-r--r--gdb/convex-tdep.c1
-rw-r--r--gdb/convex-xdep.c1
-rw-r--r--gdb/core.c3
-rw-r--r--gdb/coredep.c1
-rw-r--r--gdb/cplus-dem.c12
-rw-r--r--gdb/dbxread.c877
-rw-r--r--gdb/defs.h78
-rw-r--r--gdb/dwarfread.c5
-rw-r--r--gdb/elfread.c1
-rw-r--r--gdb/exec.c40
-rw-r--r--gdb/findvar.c14
-rw-r--r--gdb/gould-pinsn.c6
-rw-r--r--gdb/gould-xdep.c1
-rw-r--r--gdb/hp300ux-xdep.c1
-rw-r--r--gdb/i386-pinsn.c1
-rw-r--r--gdb/i386-tdep.c35
-rw-r--r--gdb/i386-xdep.c1
-rw-r--r--gdb/i387-tdep.c1
-rw-r--r--gdb/i960-pinsn.c1
-rw-r--r--gdb/i960-tdep.c1
-rw-r--r--gdb/ieee-float.c1
-rw-r--r--gdb/inflow.c25
-rw-r--r--gdb/infptrace.c1
-rw-r--r--gdb/infrun.hacked.c1
-rw-r--r--gdb/kdb-start.c5
-rw-r--r--gdb/m2-exp.y16
-rw-r--r--gdb/m68k-pinsn.c5
-rw-r--r--gdb/m88k-pinsn.c25
-rw-r--r--gdb/m88k-tdep.c1
-rw-r--r--gdb/m88k-xdep.c4
-rw-r--r--gdb/mach386-xdep.c1
-rw-r--r--gdb/main.c30
-rw-r--r--gdb/mem-break.c100
-rw-r--r--gdb/mips-pinsn.c3
-rw-r--r--gdb/mips-tdep.c23
-rw-r--r--gdb/mips-xdep.c1
-rw-r--r--gdb/mipsread.c16
-rw-r--r--gdb/nindy-tdep.c1
-rw-r--r--gdb/ns32k-pinsn.c5
-rw-r--r--gdb/parse.c1
-rw-r--r--gdb/printcmd.c5
-rw-r--r--gdb/procfs.c1
-rw-r--r--gdb/putenv.c16
-rw-r--r--gdb/pyr-pinsn.c9
-rw-r--r--gdb/pyr-tdep.c1
-rw-r--r--gdb/pyr-xdep.c1
-rw-r--r--gdb/remote-adapt.c2
-rw-r--r--gdb/remote-eb.c2
-rw-r--r--gdb/remote-nindy.c1
-rw-r--r--gdb/remote-sa.sparc.c1
-rw-r--r--gdb/remote-vx.68.c4
-rw-r--r--gdb/remote-vx.c1
-rw-r--r--gdb/rs6000-tdep.c1
-rw-r--r--gdb/rs6000-xdep.c1
-rwxr-xr-xgdb/signame.c5
-rw-r--r--gdb/sparc-pinsn.c5
-rw-r--r--gdb/sparc-xdep.c8
-rw-r--r--gdb/standalone.c1
-rw-r--r--gdb/sun3-xdep.c9
-rw-r--r--gdb/sun386-xdep.c1
-rw-r--r--gdb/symfile.c382
-rw-r--r--gdb/symm-tdep.c1
-rw-r--r--gdb/symm-xdep.c1
-rw-r--r--gdb/symtab.c34
-rw-r--r--gdb/symtab.h8
-rw-r--r--gdb/tahoe-pinsn.c28
-rw-r--r--gdb/tm-convex.h8
-rw-r--r--gdb/tm-hp300hpux.h2
-rw-r--r--gdb/tm-merlin.h4
-rw-r--r--gdb/tm-sparc.h6
-rw-r--r--gdb/tm-umax.h4
-rw-r--r--gdb/ultra3-xdep.c1
-rw-r--r--gdb/umax-xdep.c1
-rw-r--r--gdb/utils.c62
-rw-r--r--gdb/valops.c10
-rw-r--r--gdb/valprint.c10
-rw-r--r--gdb/values.c5
-rw-r--r--gdb/vax-pinsn.c5
-rw-r--r--gdb/xcoffexec.c1
-rw-r--r--gdb/xcoffread.c1
-rw-r--r--gdb/xm-convex.h7
-rw-r--r--gdb/xm-merlin.h4
-rw-r--r--gdb/xm-sparc.h3
93 files changed, 757 insertions, 1285 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 796c496..e778cbd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c
index 8cbdfc9..e6ff104 100644
--- a/gdb/altos-xdep.c
+++ b/gdb/altos-xdep.c
@@ -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"
diff --git a/gdb/am29k-tdep.c b/gdb/am29k-tdep.c
index ce1fa85..d4720b7 100644
--- a/gdb/am29k-tdep.c
+++ b/gdb/am29k-tdep.c
@@ -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"
diff --git a/gdb/arm-pinsn.c b/gdb/arm-pinsn.c
index 5da7997..f4cd84a 100644
--- a/gdb/arm-pinsn.c
+++ b/gdb/arm-pinsn.c
@@ -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"
diff --git a/gdb/arm-xdep.c b/gdb/arm-xdep.c
index e03e16d..5fc4de7 100644
--- a/gdb/arm-xdep.c
+++ b/gdb/arm-xdep.c
@@ -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"
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 410417d..1510484 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -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"
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index d3703cb..192ed47 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -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"
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 4b9f245..6a9b82f 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -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 "breakpoint.h"
#include "bfd.h"
diff --git a/gdb/command.c b/gdb/command.c
index d883940..1747706 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -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"
diff --git a/gdb/convex-pinsn.c b/gdb/convex-pinsn.c
index ca9e9ca..9a792ac 100644
--- a/gdb/convex-pinsn.c
+++ b/gdb/convex-pinsn.c
@@ -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) --
diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c
index ce6382b..8c86ae8 100644
--- a/gdb/convex-tdep.c
+++ b/gdb/convex-tdep.c
@@ -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"
diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c
index bfce6eb..6fbcd24 100644
--- a/gdb/convex-xdep.c
+++ b/gdb/convex-xdep.c
@@ -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"
diff --git a/gdb/core.c b/gdb/core.c
index 8b6895d..c59fc55 100644
--- a/gdb/core.c
+++ b/gdb/core.c
@@ -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"
diff --git a/gdb/coredep.c b/gdb/coredep.c
index 87be349..bb26b08 100644
--- a/gdb/coredep.c
+++ b/gdb/coredep.c
@@ -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>
diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c
index 6800f3f..b34732c 100644
--- a/gdb/cplus-dem.c
+++ b/gdb/cplus-dem.c
@@ -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
@@ -16,14 +16,7 @@
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>
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index c7741ab..371f923 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -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};
/* 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
-/* 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;
-}
-
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;
}
@@ -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;
+ }
}
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);
}
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)
}
}
-/* 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;
-}
-
-#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
-
/* Copy a pending list, used to record the contents of a common
block for later fixup. */
static struct pending *
diff --git a/gdb/defs.h b/gdb/defs.h
index 52d8496..3457ff0 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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 */
+
+/* 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 */
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 5eaf6a3..44e8ccf 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -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;
diff --git a/gdb/elfread.c b/gdb/elfread.c
index d203e2e..5b4294a 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -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"
diff --git a/gdb/exec.c b/gdb/exec.c
index 0c645f2..33e5e72 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -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));
}
}
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 58da6b6..b65853e 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -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. */
diff --git a/gdb/gould-pinsn.c b/gdb/gould-pinsn.c
index 0ad9f3e..d4bcb60 100644
--- a/gdb/gould-pinsn.c
+++ b/gdb/gould-pinsn.c
@@ -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
diff --git a/gdb/gould-xdep.c b/gdb/gould-xdep.c
index bd6276d..3de6fd3 100644
--- a/gdb/gould-xdep.c
+++ b/gdb/gould-xdep.c
@@ -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"
diff --git a/gdb/hp300ux-xdep.c b/gdb/hp300ux-xdep.c
index 7b2c12b..801c471 100644
--- a/gdb/hp300ux-xdep.c
+++ b/gdb/hp300ux-xdep.c
@@ -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"
diff --git a/gdb/i386-pinsn.c b/gdb/i386-pinsn.c
index 88b171a..eb0e174 100644
--- a/gdb/i386-pinsn.c
+++ b/gdb/i386-pinsn.c
@@ -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
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 98dd25a..8b8fb84 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -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 */
diff --git a/gdb/i386-xdep.c b/gdb/i386-xdep.c
index 2d69d1d..f3c72d1 100644
--- a/gdb/i386-xdep.c
+++ b/gdb/i386-xdep.c
@@ -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"
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index e2e5557..0a85e2e 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -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"
diff --git a/gdb/i960-pinsn.c b/gdb/i960-pinsn.c
index a651c48..f13b201 100644
--- a/gdb/i960-pinsn.c
+++ b/gdb/i960-pinsn.c
@@ -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"
diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c
index 27fde37..308b21e 100644
--- a/gdb/i960-tdep.c
+++ b/gdb/i960-tdep.c
@@ -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"
diff --git a/gdb/ieee-float.c b/gdb/ieee-float.c
index 69a60f2..f1e503b2 100644
--- a/gdb/ieee-float.c
+++ b/gdb/ieee-float.c
@@ -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 */
diff --git a/gdb/inflow.c b/gdb/inflow.c
index fd8f0b8..698cfb4 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -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
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index 9e9f508..f7f1f4f 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -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"
diff --git a/gdb/infrun.hacked.c b/gdb/infrun.hacked.c
index d38bd06..6d72615 100644
--- a/gdb/infrun.hacked.c
+++ b/gdb/infrun.hacked.c
@@ -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"
diff --git a/gdb/kdb-start.c b/gdb/kdb-start.c
index 50e2fa9..e4e0ea2 100644
--- a/gdb/kdb-start.c
+++ b/gdb/kdb-start.c
@@ -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};
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 85de5e1..7b29b8c 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -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);
diff --git a/gdb/m68k-pinsn.c b/gdb/m68k-pinsn.c
index b648abb..de43af1 100644
--- a/gdb/m68k-pinsn.c
+++ b/gdb/m68k-pinsn.c
@@ -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"
diff --git a/gdb/m88k-pinsn.c b/gdb/m88k-pinsn.c
index bede269..ca9c8c7 100644
--- a/gdb/m88k-pinsn.c
+++ b/gdb/m88k-pinsn.c
@@ -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};
/*
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 594bd49..27d4bea 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -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"
diff --git a/gdb/m88k-xdep.c b/gdb/m88k-xdep.c
index 835d8a2..dc6e4da 100644
--- a/gdb/m88k-xdep.c
+++ b/gdb/m88k-xdep.c
@@ -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"
diff --git a/gdb/mach386-xdep.c b/gdb/mach386-xdep.c
index 754299a..0b24d75 100644
--- a/gdb/mach386-xdep.c
+++ b/gdb/mach386-xdep.c
@@ -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"
diff --git a/gdb/main.c b/gdb/main.c
index 936879c..e36d730 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -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);
}
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index eebe7e2..7e55233 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -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 */
diff --git a/gdb/mips-pinsn.c b/gdb/mips-pinsn.c
index 6dc3e55..a90448a 100644
--- a/gdb/mips-pinsn.c
+++ b/gdb/mips-pinsn.c
@@ -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"
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 849758b..4dd70e6 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -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 ();
diff --git a/gdb/mips-xdep.c b/gdb/mips-xdep.c
index a5b0b03..a77901281 100644
--- a/gdb/mips-xdep.c
+++ b/gdb/mips-xdep.c
@@ -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"
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 7d010a4..07e1a7c 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -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;
diff --git a/gdb/nindy-tdep.c b/gdb/nindy-tdep.c
index 8f70831..dcb5dd9 100644
--- a/gdb/nindy-tdep.c
+++ b/gdb/nindy-tdep.c
@@ -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"
diff --git a/gdb/ns32k-pinsn.c b/gdb/ns32k-pinsn.c
index 8cb2482..3cfbae5 100644
--- a/gdb/ns32k-pinsn.c
+++ b/gdb/ns32k-pinsn.c
@@ -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"
diff --git a/gdb/parse.c b/gdb/parse.c
index 214df03..ceece4d 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -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"
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index ec96d49..a9a2fdf 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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,
diff --git a/gdb/procfs.c b/gdb/procfs.c
index ee0f680..95947e8 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -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 */
diff --git a/gdb/putenv.c b/gdb/putenv.c
index f7318f0..bf477f9 100644
--- a/gdb/putenv.c
+++ b/gdb/putenv.c
@@ -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);
- }
+}
diff --git a/gdb/pyr-pinsn.c b/gdb/pyr-pinsn.c
index 02d626c..59d19b9 100644
--- a/gdb/pyr-pinsn.c
+++ b/gdb/pyr-pinsn.c
@@ -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. */
diff --git a/gdb/pyr-tdep.c b/gdb/pyr-tdep.c
index f3a3cde..7dc2f47 100644
--- a/gdb/pyr-tdep.c
+++ b/gdb/pyr-tdep.c
@@ -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. ***/
diff --git a/gdb/pyr-xdep.c b/gdb/pyr-xdep.c
index 4a89db9..4aa8489 100644
--- a/gdb/pyr-xdep.c
+++ b/gdb/pyr-xdep.c
@@ -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"
diff --git a/gdb/remote-adapt.c b/gdb/remote-adapt.c
index 6c22422..34abe76 100644
--- a/gdb/remote-adapt.c
+++ b/gdb/remote-adapt.c
@@ -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"
diff --git a/gdb/remote-eb.c b/gdb/remote-eb.c
index 0315fe7..1ab87eb 100644
--- a/gdb/remote-eb.c
+++ b/gdb/remote-eb.c
@@ -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"
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 34bb3d2..f4b3436 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -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"
diff --git a/gdb/remote-sa.sparc.c b/gdb/remote-sa.sparc.c
index 686699e..fd73358 100644
--- a/gdb/remote-sa.sparc.c
+++ b/gdb/remote-sa.sparc.c
@@ -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"
diff --git a/gdb/remote-vx.68.c b/gdb/remote-vx.68.c
index 32e8202..4848ca2 100644
--- a/gdb/remote-vx.68.c
+++ b/gdb/remote-vx.68.c
@@ -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"
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index 42090b7..d61dd92 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -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"
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 4003de0..eb203b2 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -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"
diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c
index 7d0917b..c82c0b7 100644
--- a/gdb/rs6000-xdep.c
+++ b/gdb/rs6000-xdep.c
@@ -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"
diff --git a/gdb/signame.c b/gdb/signame.c
index 7f07893..3569da6 100755
--- a/gdb/signame.c
+++ b/gdb/signame.c
@@ -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
diff --git a/gdb/sparc-pinsn.c b/gdb/sparc-pinsn.c
index 2a63772..a8cdb08 100644
--- a/gdb/sparc-pinsn.c
+++ b/gdb/sparc-pinsn.c
@@ -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"
diff --git a/gdb/sparc-xdep.c b/gdb/sparc-xdep.c
index b09dbe8..003829e 100644
--- a/gdb/sparc-xdep.c
+++ b/gdb/sparc-xdep.c
@@ -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"
diff --git a/gdb/standalone.c b/gdb/standalone.c
index 88c7053..fa6d6fc 100644
--- a/gdb/standalone.c
+++ b/gdb/standalone.c
@@ -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"
diff --git a/gdb/sun3-xdep.c b/gdb/sun3-xdep.c
index f6394bc..295dff8 100644
--- a/gdb/sun3-xdep.c
+++ b/gdb/sun3-xdep.c
@@ -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)
diff --git a/gdb/sun386-xdep.c b/gdb/sun386-xdep.c
index 4ecb542..0a35647 100644
--- a/gdb/sun386-xdep.c
+++ b/gdb/sun386-xdep.c
@@ -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"
diff --git a/gdb/symfile.c b/gdb/symfile.c
index cf75a17..8910930 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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);
}
-/* 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;
}
+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 */
+}
+
/* 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;
}
+/*
+ * 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();
+}
+
void
_initialize_symfile ()
{
diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c
index d7d5def..55a75ad 100644
--- a/gdb/symm-tdep.c
+++ b/gdb/symm-tdep.c
@@ -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"
diff --git a/gdb/symm-xdep.c b/gdb/symm-xdep.c
index 2871307..a0508a9 100644
--- a/gdb/symm-xdep.c
+++ b/gdb/symm-xdep.c
@@ -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"
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 27d4952..488bc7e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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;
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index d9c7696..8675a76 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -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)))
diff --git a/gdb/tahoe-pinsn.c b/gdb/tahoe-pinsn.c
index c3c675c..1ba22a3 100644
--- a/gdb/tahoe-pinsn.c
+++ b/gdb/tahoe-pinsn.c
@@ -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);
diff --git a/gdb/tm-convex.h b/gdb/tm-convex.h
index 1ada10b..a343509 100644
--- a/gdb/tm-convex.h
+++ b/gdb/tm-convex.h
@@ -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. */
diff --git a/gdb/tm-hp300hpux.h b/gdb/tm-hp300hpux.h
index f1926a1..d900ba8 100644
--- a/gdb/tm-hp300hpux.h
+++ b/gdb/tm-hp300hpux.h
@@ -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. */
diff --git a/gdb/tm-merlin.h b/gdb/tm-merlin.h
index f782dd0..49287f0 100644
--- a/gdb/tm-merlin.h
+++ b/gdb/tm-merlin.h
@@ -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. */
diff --git a/gdb/tm-sparc.h b/gdb/tm-sparc.h
index 15d214b..aae9f10 100644
--- a/gdb/tm-sparc.h
+++ b/gdb/tm-sparc.h
@@ -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 <
diff --git a/gdb/tm-umax.h b/gdb/tm-umax.h
index 727ffcf..22a4277 100644
--- a/gdb/tm-umax.h
+++ b/gdb/tm-umax.h
@@ -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.
diff --git a/gdb/ultra3-xdep.c b/gdb/ultra3-xdep.c
index c910e3d..35eff11 100644
--- a/gdb/ultra3-xdep.c
+++ b/gdb/ultra3-xdep.c
@@ -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"
diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c
index 8118376..474416b 100644
--- a/gdb/umax-xdep.c
+++ b/gdb/umax-xdep.c
@@ -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"
diff --git a/gdb/utils.c b/gdb/utils.c
index 36645eb..bffa2ee 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -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 */
diff --git a/gdb/valops.c b/gdb/valops.c
index 07c96af..45cca2e 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -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
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 1baf698..9680850 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -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;
diff --git a/gdb/values.c b/gdb/values.c
index 810e00b..f141bc8 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -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"
diff --git a/gdb/vax-pinsn.c b/gdb/vax-pinsn.c
index 011cd95..ccbf19b 100644
--- a/gdb/vax-pinsn.c
+++ b/gdb/vax-pinsn.c
@@ -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"
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index f1bd3d8..3b3eb62 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -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"
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 912c9d1..44ce2fa 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -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>
diff --git a/gdb/xm-convex.h b/gdb/xm-convex.h
index 156214c..923e6d6 100644
--- a/gdb/xm-convex.h
+++ b/gdb/xm-convex.h
@@ -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
-
-
-/* Interface definitions for kernel debugger KDB. */
-
-/* (no kdb) */
diff --git a/gdb/xm-merlin.h b/gdb/xm-merlin.h
index 0564f0d..665efb0 100644
--- a/gdb/xm-merlin.h
+++ b/gdb/xm-merlin.h
@@ -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
diff --git a/gdb/xm-sparc.h b/gdb/xm-sparc.h
index cbdac01..0e67e93 100644
--- a/gdb/xm-sparc.h
+++ b/gdb/xm-sparc.h
@@ -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