This commit was manufactured by cvs2svn to create tag
'kseitz_interps-20020829-merge'.

Sprout from gdb_5_3-branch 2002-09-03 22:29:15 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'gdb_5_3-branch'.'
Cherrypick from master 2002-08-29 22:36:52 UTC Jim Blandy <jimb@codesourcery.com> '* gdb.threads/pthreads.exp: Move the portable thread compilation':
    bfd/ChangeLog
    bfd/Makefile.am
    bfd/Makefile.in
    bfd/aoutx.h
    bfd/bfd-in.h
    bfd/bfd-in2.h
    bfd/coff64-rs6000.c
    bfd/coffcode.h
    bfd/cpu-avr.c
    bfd/cpu-pj.c
    bfd/cpu-powerpc.c
    bfd/cpu-rs6000.c
    bfd/cpu-v850.c
    bfd/cpu-z8k.c
    bfd/ecoff.c
    bfd/elf32-v850.c
    bfd/mipsbsd.c
    bfd/pdp11.c
    bfd/version.h
    gdb/ChangeLog
    gdb/Makefile.in
    gdb/ada-exp.y
    gdb/alphanbsd-tdep.c
    gdb/avr-tdep.c
    gdb/breakpoint.c
    gdb/c-exp.y
    gdb/config/i386/nbsdaout.mh
    gdb/config/i386/nbsdaout.mt
    gdb/config/i386/nbsdelf.mh
    gdb/config/i386/nbsdelf.mt
    gdb/config/i386/tm-nbsd.h
    gdb/config/i386/tm-nbsdaout.h
    gdb/config/mips/nbsd.mt
    gdb/configure.tgt
    gdb/doc/ChangeLog
    gdb/doc/gdb.texinfo
    gdb/dwarf2read.c
    gdb/f-exp.y
    gdb/i386-linux-nat.c
    gdb/i386-tdep.h
    gdb/i386bsd-tdep.c
    gdb/i386nbsd-tdep.c
    gdb/jv-exp.y
    gdb/m2-exp.y
    gdb/mipsnbsd-tdep.c
    gdb/nbsd-tdep.c
    gdb/nbsd-tdep.h
    gdb/p-exp.y
    gdb/ppcnbsd-tdep.c
    gdb/shnbsd-tdep.c
    gdb/sparcnbsd-tdep.c
    gdb/symtab.c
    gdb/testsuite/ChangeLog
    gdb/testsuite/gdb.mi/ChangeLog
    gdb/testsuite/lib/gdb.exp
    gdb/tui/ChangeLog
    gdb/tui/tui-hooks.c
    gdb/tui/tui-out.c
    gdb/tui/tui.c
    gdb/tui/tui.h
    gdb/tui/tuiData.c
    gdb/tui/tuiData.h
    gdb/tui/tuiIO.c
    gdb/tui/tuiIO.h
    gdb/tui/tuiSource.c
    gdb/tui/tuiSourceWin.c
    gdb/tui/tuiSourceWin.h
    gdb/tui/tuiStack.c
    gdb/tui/tuiWin.c
    gdb/version.in
    gdb/x86-64-linux-nat.c
    gdb/x86-64-linux-tdep.c
    opcodes/ChangeLog
    opcodes/arc-opc.c
    opcodes/mips-dis.c
    opcodes/v850-dis.c
    opcodes/v850-opc.c
Delete:
    gdb/config/i386/nbsd.mt
    gdb/testsuite/gdb.mi/gdb680.exp
    gdb/testsuite/gdb.threads/killed.c
    gdb/testsuite/gdb.threads/killed.exp
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d597c4a..b286949 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,57 +1,3 @@
-2002-09-02  Nick Clifton  <nickc@redhat.com>
-
-	* elf32-v850.c (v850_elf_final_link_relocate): Use helpful
-	names instead of cryptically overloaded bfd_reloc error
-	codes.
-	(v850_elf_relocate_section): Likewise.
-	(v850_elf_relax_section): Replace caching of external symbols
-	with caching of internal symbols obtained from calling
-	bfd_elf_get_elf_syms().
-        Fixup problems with freeing cached allocated memory blocks.
-
-
-2002-09-02  Alan Modra  <amodra@bigpond.net.au>
-
-	* cpu-pj.c (scan_mach, compatible, arch_info_struct): Remove.
-	(bfd_pj_arch): Use bfd_default_scan.
-	* cpu-v850.c (scan): Remove.
-	(N): Use bfd_default_scan.
-	* cpu-z8k.c (scan_mach): Remove.
-	(arch_info_struct, bfd_z8k_arch): Reorganize so that the default is
-	first.  Use bfd_default_scan.
-
-	* ecoff.c (_bfd_ecoff_set_arch_mach_hook): Don't use hard-coded
-	bfd_mach constants.
-	(ecoff_get_magic): Likewise.
-	* elf32-v850.c (v850_elf_object_p): Likewise.
-	(v850_elf_final_write_processing): Likewise.
-	* mipsbsd.c (MY(set_arch_mach)): Likewise.
-	(MY(write_object_contents)): Likewise.
-	* coff64-rs6000.c (xcoff64_write_object_contents): Likewise.
-	* coffcode.h (coff_write_object_contents): Likewise.
-	(coff_set_arch_mach_hook): Add comment describing machine == 0.
-	Remove unnecessary "machine" assignments.
-	(coff_write_relocs): Test for the absolute section sym by testing
-	section and flags.
-
-	* aoutx.h (NAME(aout,machine_type)): Recognize bfd_mach_i386_i386
-	and bfd_mach_i386_i386_intel_syntax.
-	* pdp11.c (NAME(aout,machine_type)): Likewise.
-
-2002-08-30  John David Anglin  <dave@hiauly1.hia.nrc.ca>
-
-	* bfd-in.h (align_power): Cast constants to bfd_vma type.
-	* bfd-in2.h (align_power): Likewise.
-
-2002-08-30  Alan Modra  <amodra@bigpond.net.au>
-
-	* Makefile.am: Run "make dep-am".
-	* Makefile.in: Regenerate.
-
-	* cpu-avr.c (compatible): Don't use hard-coded mach constants.
-	* cpu-powerpc.c (powerpc_compatible): Likewise.
-	* cpu-rs6000.c (rs6000_compatible): Likewise.
-
 2002-08-28  Catherine Moore  <clm@redhat.com>
 
 	* elf32-v850.c (v850_elf_reloc_map):  Add new relocs.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 4b5551e..583cb85 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -1058,9 +1058,9 @@
 coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
   libcoff.h coffcode.h coffswap.h
-coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
-  $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \
-  libcoff.h coffcode.h coffswap.h
+coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \
+  $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
 coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
   $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
@@ -1112,10 +1112,9 @@
   $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
-elfarmqnx-nabi.lo: elfarmqnx-nabi.c elfarm-nabi.c $(INCDIR)/elf/arm.h \
-  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/filenames.h \
-  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
-  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-qnx.h \
+elfarmqnx-nabi.lo: elfarmqnx-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
+  $(INCDIR)/filenames.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
 elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
@@ -1158,16 +1157,15 @@
   libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
 elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
-  $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \
-  elf32-target.h
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
 elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
 elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/bfdlink.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@@ -1189,14 +1187,13 @@
   $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
 elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
   $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
-  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \
-  elf32-target.h
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf32-target.h
@@ -1239,10 +1236,10 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
-elf32-ppcqnx.lo: elf32-ppcqnx.c elf32-ppc.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h
+elf32-ppcqnx.lo: elf32-ppcqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
@@ -1273,10 +1270,10 @@
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
   $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-shqnx.lo: elf32-shqnx.c elf32-sh.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h
+elf32-shqnx.lo: elf32-shqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -1533,13 +1530,12 @@
 elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf64-target.h
-elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
-  $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
-  $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
-  $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
-  ecoffswap.h elf32-target.h
+elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  genlink.h elf-bfd.h elfxx-mips.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h \
+  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
+  $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h \
+  $(INCDIR)/coff/mips.h ecoffswap.h elf32-target.h
 elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
   $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 2da51c8..470aade 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -794,7 +794,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
 OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
@@ -1588,9 +1588,9 @@
 coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
   libcoff.h coffcode.h coffswap.h
-coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
-  $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \
-  libcoff.h coffcode.h coffswap.h
+coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \
+  $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
 coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
   $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
@@ -1642,10 +1642,9 @@
   $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
-elfarmqnx-nabi.lo: elfarmqnx-nabi.c elfarm-nabi.c $(INCDIR)/elf/arm.h \
-  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/filenames.h \
-  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
-  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-qnx.h \
+elfarmqnx-nabi.lo: elfarmqnx-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
+  $(INCDIR)/filenames.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
 elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
@@ -1688,16 +1687,15 @@
   libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
 elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
-  $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \
-  elf32-target.h
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
 elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
 elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/bfdlink.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@@ -1719,14 +1717,13 @@
   $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
 elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
   $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
-  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \
-  elf32-target.h
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf32-target.h
@@ -1769,10 +1766,10 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
-elf32-ppcqnx.lo: elf32-ppcqnx.c elf32-ppc.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h
+elf32-ppcqnx.lo: elf32-ppcqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
@@ -1803,10 +1800,10 @@
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
   $(INCDIR)/elf/reloc-macros.h elf32-target.h
-elf32-shqnx.lo: elf32-shqnx.c elf32-sh.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h
+elf32-shqnx.lo: elf32-shqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -2063,13 +2060,12 @@
 elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf64-target.h
-elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
-  $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
-  $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
-  $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
-  ecoffswap.h elf32-target.h
+elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+  genlink.h elf-bfd.h elfxx-mips.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h \
+  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
+  $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h \
+  $(INCDIR)/coff/mips.h ecoffswap.h elf32-target.h
 elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
   $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 7fa334a..fffb6d9 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -757,9 +757,7 @@
       break;
 
     case bfd_arch_i386:
-      if (machine == 0
-	  || machine == bfd_mach_i386_i386
-	  || machine == bfd_mach_i386_i386_intel_syntax)
+      if (machine == 0)
 	arch_flags = M_386;
       break;
 
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 3941906..9017440 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -331,7 +331,7 @@
 /* Object and core file sections.  */
 
 #define	align_power(addr, align)	\
-  (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
+	( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
 
 typedef struct sec *sec_ptr;
 
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index abb6405..0ab4245 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -337,7 +337,7 @@
 /* Object and core file sections.  */
 
 #define	align_power(addr, align)	\
-  (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
+	( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
 
 typedef struct sec *sec_ptr;
 
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 61553be..d5cce39 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -1014,7 +1014,7 @@
 	      internal_a.o_cputype = 4;
 	      break;
 	    case bfd_arch_powerpc:
-	      if (bfd_get_mach (abfd) == bfd_mach_ppc)
+	      if (bfd_get_mach (abfd) == 0)
 		internal_a.o_cputype = 3;
 	      else
 		internal_a.o_cputype = 1;
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index e47b4d0..212c5c6 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1824,7 +1824,6 @@
   enum bfd_architecture arch;
   struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
 
-  /* Zero selects the default machine for an arch.  */
   machine = 0;
   switch (internal_f->f_magic)
     {
@@ -1832,11 +1831,13 @@
     case OR32_MAGIC_BIG:
     case OR32_MAGIC_LITTLE:
       arch = bfd_arch_or32;
+      machine = 0;
       break;
 #endif
 #ifdef PPCMAGIC
     case PPCMAGIC:
       arch = bfd_arch_powerpc;
+      machine = 0; /* what does this mean? (krk) */
       break;
 #endif
 #ifdef I386MAGIC
@@ -1845,17 +1846,20 @@
     case I386AIXMAGIC:		/* Danbury PS/2 AIX C Compiler */
     case LYNXCOFFMAGIC:	/* shadows the m68k Lynx number below, sigh */
       arch = bfd_arch_i386;
+      machine = 0;
       break;
 #endif
 #ifdef IA64MAGIC
     case IA64MAGIC:
       arch = bfd_arch_ia64;
+      machine = 0;
       break;
 #endif
 #ifdef A29K_MAGIC_BIG
     case A29K_MAGIC_BIG:
     case A29K_MAGIC_LITTLE:
       arch = bfd_arch_a29k;
+      machine = 0;
       break;
 #endif
 #ifdef ARMMAGIC
@@ -2040,6 +2044,7 @@
 #ifdef WE32KMAGIC
     case WE32KMAGIC:
       arch = bfd_arch_we32k;
+      machine = 0;
       break;
 #endif
 
@@ -2077,18 +2082,21 @@
     case SH_ARCH_MAGIC_WINCE:
 #endif
       arch = bfd_arch_sh;
+      machine = 0;
       break;
 #endif
 
 #ifdef MIPS_ARCH_MAGIC_WINCE
     case MIPS_ARCH_MAGIC_WINCE:
       arch = bfd_arch_mips;
+      machine = 0;
       break;
 #endif
 
 #ifdef H8500MAGIC
     case H8500MAGIC:
       arch = bfd_arch_h8500;
+      machine = 0;
       break;
 #endif
 
@@ -2098,6 +2106,7 @@
     case LYNXCOFFMAGIC:
 #endif
       arch = bfd_arch_sparc;
+      machine = 0;
       break;
 #endif
 
@@ -2453,8 +2462,7 @@
 #ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
                 if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s))
 #else
-		if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr
-		    && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0)
+		if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr)
 #endif
 		  /* This is a relocation relative to the absolute symbol.  */
 		  n.r_symndx = -1;
@@ -4108,7 +4116,7 @@
 	      internal_a.o_cputype = 4;
 	      break;
 	    case bfd_arch_powerpc:
-	      if (bfd_get_mach (abfd) == bfd_mach_ppc)
+	      if (bfd_get_mach (abfd) == 0)
 		internal_a.o_cputype = 3;
 	      else
 		internal_a.o_cputype = 1;
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
index b623790..1ca48e7 100644
--- a/bfd/cpu-avr.c
+++ b/bfd/cpu-avr.c
@@ -76,8 +76,8 @@
     return NULL;
 
   /* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4).  */
-  if ((a->mach == bfd_mach_avr3 && b->mach == bfd_mach_avr4)
-      || (a->mach == bfd_mach_avr4 && b->mach == bfd_mach_avr3))
+  if ((a->mach == 3 && b->mach == 4)
+      || (a->mach == 4 && b->mach == 3))
     return NULL;
 
   /* So far all newer AVR architecture cores are supersets of previous
diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c
index 8e58c89..aeb7e58 100644
--- a/bfd/cpu-pj.c
+++ b/bfd/cpu-pj.c
@@ -22,6 +22,52 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
+static boolean scan_mach
+  PARAMS ((const struct bfd_arch_info *, const char *));
+
+static boolean
+scan_mach (info, string)
+     const struct bfd_arch_info *info;
+     const char *string;
+{
+  if (strcasecmp (info->printable_name, string) == 0)
+    return true;
+  return false;
+}
+
+#if 0
+/* This routine is provided two arch_infos and returns whether
+   they'd be compatible */
+
+static const bfd_arch_info_type *
+compatible (a,b)
+     const bfd_arch_info_type *a;
+     const bfd_arch_info_type *b;
+{
+  if (a->arch != b->arch || a->mach != b->mach)
+   return NULL;
+  return a;
+}
+#endif
+
+static const bfd_arch_info_type arch_info_struct[] =
+{
+  {
+    32,				/* 32 bits in a word */
+    32,				/* 32 bits in an address */
+    8,				/* 8 bits in a byte */
+    bfd_arch_pj,
+    0,
+    "pj",			/* arch_name  */
+    "pj",			/* printable name */
+    1,
+    false,			/* not the default */
+    bfd_default_compatible,
+    scan_mach,
+    0,
+  },
+};
+
 const bfd_arch_info_type bfd_pj_arch =
 {
   32,				/* 32 bits in a word */
@@ -34,6 +80,6 @@
   1,
   true,				/* the default machine */
   bfd_default_compatible,
-  bfd_default_scan,
-  0
+  scan_mach,
+  &arch_info_struct [0]
 };
diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c
index 0174425..b282c60 100644
--- a/bfd/cpu-powerpc.c
+++ b/bfd/cpu-powerpc.c
@@ -41,7 +41,7 @@
     case bfd_arch_powerpc:
       return bfd_default_compatible (a, b);
     case bfd_arch_rs6000:
-      if (a->mach == bfd_mach_ppc)
+      if (a->mach == 0)
 	return a;
       return NULL;
     }
diff --git a/bfd/cpu-rs6000.c b/bfd/cpu-rs6000.c
index 777611e..89b9230 100644
--- a/bfd/cpu-rs6000.c
+++ b/bfd/cpu-rs6000.c
@@ -46,7 +46,7 @@
     case bfd_arch_rs6000:
       return bfd_default_compatible (a, b);
     case bfd_arch_powerpc:
-      if (b->mach == bfd_mach_rs6k)
+      if (b->mach == 0)
 	return b;
       return NULL;
     }
diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c
index 38333c8..ce61caa 100644
--- a/bfd/cpu-v850.c
+++ b/bfd/cpu-v850.c
@@ -22,9 +22,67 @@
 #include "libbfd.h"
 #include "safe-ctype.h"
 
+static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
+
+static boolean
+scan (info, string)
+     const struct bfd_arch_info * info;
+     const char * string;
+{
+  const char *ptr_src;
+  const char *ptr_tst;
+  unsigned long number;
+  enum bfd_architecture arch;
+
+  /* First test for an exact match.  */
+  if (strcasecmp (string, info->printable_name) == 0)
+    return true;
+
+  /* See how much of the supplied string matches with the
+     architecture, eg the string m68k:68020 would match the m68k entry
+     up to the :, then we get left with the machine number.  */
+  for (ptr_src = string, ptr_tst = info->arch_name;
+       *ptr_src && *ptr_tst;
+       ptr_src++, ptr_tst++)
+    if (*ptr_src != *ptr_tst)
+      break;
+
+  /* Chewed up as much of the architecture as will match;
+     if there is a colon present skip it.  */
+  if (*ptr_src == ':')
+    ptr_src ++;
+
+  if (*ptr_src == 0)
+    /* Nothing more, then only keep this one if it is
+       the default machine for this architecture.  */
+    return info->the_default;
+
+  number = 0;
+  while (ISDIGIT (*ptr_src))
+    {
+      number = number * 10 + * ptr_src  - '0';
+      ptr_src ++;
+    }
+
+  switch (number)
+    {
+    case bfd_mach_v850e:  arch = bfd_arch_v850; break;
+    default:
+      return false;
+    }
+
+  if (arch != info->arch)
+    return false;
+
+  if (number != info->mach)
+    return false;
+
+  return true;
+}
+
 #define N(number, print, default, next)  \
 {  32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \
-     bfd_default_compatible, bfd_default_scan, next }
+     bfd_default_compatible, scan, next }
 
 #define NEXT NULL
 
diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c
index b75eaea..0afdfc7 100644
--- a/bfd/cpu-z8k.c
+++ b/bfd/cpu-z8k.c
@@ -22,6 +22,8 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
+static boolean scan_mach
+  PARAMS ((const struct bfd_arch_info *, const char *));
 static const bfd_arch_info_type *compatible
   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
 
@@ -151,6 +153,22 @@
 }
 #endif
 
+static boolean
+scan_mach (info, string)
+     const struct bfd_arch_info *info;
+     const char *string;
+{
+  if (strcmp (string, "z8001") == 0 || strcmp (string, "z8k") == 0)
+    {
+      return bfd_mach_z8001 == info->mach;
+    }
+  if (strcmp (string, "z8002") == 0)
+    {
+      return bfd_mach_z8002 == info->mach;
+    }
+  return false;
+}
+
 /* This routine is provided two arch_infos and returns whether
    they'd be compatible */
 
@@ -166,12 +184,10 @@
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
-  { 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, false,
-    compatible, bfd_default_scan, 0 }
+  {32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,},
 };
 
 const bfd_arch_info_type bfd_z8k_arch =
 {
-  32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, true,
-  compatible, bfd_default_scan, &arch_info_struct[0]
+  32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, true, compatible, scan_mach, &arch_info_struct[0],
 };
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index f37ea56..82baeeb 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -205,21 +205,21 @@
     case MIPS_MAGIC_LITTLE:
     case MIPS_MAGIC_BIG:
       arch = bfd_arch_mips;
-      mach = bfd_mach_mips3000;
+      mach = 3000;
       break;
 
     case MIPS_MAGIC_LITTLE2:
     case MIPS_MAGIC_BIG2:
       /* MIPS ISA level 2: the r6000.  */
       arch = bfd_arch_mips;
-      mach = bfd_mach_mips6000;
+      mach = 6000;
       break;
 
     case MIPS_MAGIC_LITTLE3:
     case MIPS_MAGIC_BIG3:
       /* MIPS ISA level 3: the r4000.  */
       arch = bfd_arch_mips;
-      mach = bfd_mach_mips4000;
+      mach = 4000;
       break;
 
     case ALPHA_MAGIC:
@@ -252,17 +252,17 @@
 	{
 	default:
 	case 0:
-	case bfd_mach_mips3000:
+	case 3000:
 	  big = MIPS_MAGIC_BIG;
 	  little = MIPS_MAGIC_LITTLE;
 	  break;
 
-	case bfd_mach_mips6000:
+	case 6000:
 	  big = MIPS_MAGIC_BIG2;
 	  little = MIPS_MAGIC_LITTLE2;
 	  break;
 
-	case bfd_mach_mips4000:
+	case 4000:
 	  big = MIPS_MAGIC_BIG3;
 	  little = MIPS_MAGIC_LITTLE3;
 	  break;
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 57ed958..193a0bf 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1331,6 +1331,10 @@
       reloc->address += isection->output_offset;
       return bfd_reloc_ok;
     }
+#if 0
+  else if (obfd != NULL)
+    return bfd_reloc_continue;
+#endif
 
   /* Catch relocs involving undefined symbols.  */
   if (bfd_is_und_section (symbol->section)
@@ -1418,11 +1422,6 @@
 	  || (name[0] == '_' &&  name[1] == '.' && name[2] == 'L' && name[3] == '_'));
 }
 
-/* We overload some of the bfd_reloc error codes for own purposes.  */
-#define bfd_reloc_gp_not_found		bfd_reloc_other
-#define bfd_reloc_ep_not_found		bfd_reloc_continue
-#define bfd_reloc_ctbp_not_found	(bfd_reloc_dangerous + 1)
-
 /* Perform a relocation as part of a final link.  */
 
 static bfd_reloc_status_type
@@ -1497,7 +1496,7 @@
 	h = bfd_link_hash_lookup (info->hash, "__gp", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
 	    || h->type != bfd_link_hash_defined)
-	  return bfd_reloc_gp_not_found;
+	  return bfd_reloc_other;
 
 	gp = (h->u.def.value
 	      + h->u.def.section->output_section->vma
@@ -1522,7 +1521,8 @@
 	h = bfd_link_hash_lookup (info->hash, "__ep", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
 	    || h->type != bfd_link_hash_defined)
-	  return bfd_reloc_ep_not_found;
+	  /* Actually this indicates that __ep could not be found.  */
+	  return bfd_reloc_continue;
 
 	ep = (h->u.def.value
 	      + h->u.def.section->output_section->vma
@@ -1541,7 +1541,8 @@
 	h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
 	    || h->type != bfd_link_hash_defined)
-	  return bfd_reloc_ctbp_not_found;
+	  /* Actually this indicates that __ctbp could not be found.  */
+	  return bfd_reloc_dangerous + 1;
 
 	ctbp = (h->u.def.value
 	      + h->u.def.section->output_section->vma
@@ -1562,7 +1563,7 @@
 	h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
 	    || h->type != bfd_link_hash_defined)
-	  return bfd_reloc_ctbp_not_found;
+	  return (bfd_reloc_dangerous + 1);
 
 	ctbp = (h->u.def.value
 	      + h->u.def.section->output_section->vma
@@ -1761,15 +1762,15 @@
 	      msg = _("internal error: dangerous relocation");
 	      goto common_error;
 
-	    case bfd_reloc_gp_not_found:
+	    case bfd_reloc_other:
 	      msg = _("could not locate special linker symbol __gp");
 	      goto common_error;
 
-	    case bfd_reloc_ep_not_found:
+	    case bfd_reloc_continue:
 	      msg = _("could not locate special linker symbol __ep");
 	      goto common_error;
 
-	    case bfd_reloc_ctbp_not_found:
+	    case (bfd_reloc_dangerous + 1):
 	      msg = _("could not locate special linker symbol __ctbp");
 	      goto common_error;
 
@@ -1847,12 +1848,8 @@
   switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
     {
     default:
-    case E_V850_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850);
-      break;
-    case E_V850E_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e);
-      break;
+    case E_V850_ARCH:   (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, 0); break;
+    case E_V850E_ARCH:  (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e); break;
     }
   return true;
 }
@@ -1868,9 +1865,9 @@
 
   switch (bfd_get_mach (abfd))
     {
-    default:		 
-    case bfd_mach_v850:  val = E_V850_ARCH; break;
-    case bfd_mach_v850e: val = E_V850E_ARCH; break;
+    default:
+    case 0: val = E_V850_ARCH; break;
+    case bfd_mach_v850e:  val = E_V850E_ARCH; break;
     }
 
   elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
@@ -2484,16 +2481,20 @@
 {
   Elf_Internal_Shdr *	    symtab_hdr;
   Elf_Internal_Rela *	    internal_relocs;
+  Elf_Internal_Rela *	    free_relocs = NULL;
   Elf_Internal_Rela *	    irel;
   Elf_Internal_Rela *	    irelend;
   Elf_Internal_Rela *	    irelalign = NULL;
-  Elf_Internal_Sym *	    isymbuf = NULL;
   bfd_byte *		    contents = NULL;
+  bfd_byte *		    free_contents = NULL;
+  Elf32_External_Sym *	    extsyms = NULL;
+  Elf32_External_Sym *	    free_extsyms = NULL;
   bfd_vma 		    addr = 0;
   bfd_vma		    toaddr;
   int 			    align_pad_size = 0;
-  boolean                   result = true;
-
+  Elf_Internal_Shdr *       shndx_hdr = NULL;
+  Elf_External_Sym_Shndx *  shndx_buf = NULL;
+  
   * again = false;
 
   if (link_info->relocateable
@@ -2513,6 +2514,8 @@
 		      link_info->keep_memory));
   if (internal_relocs == NULL)
     goto error_return;
+  if (! link_info->keep_memory)
+    free_relocs = internal_relocs;
 
   irelend = internal_relocs + sec->reloc_count;
   
@@ -2596,22 +2599,49 @@
 		  if (contents == NULL)
 		    goto error_return;
 
+		  free_contents = contents;
+
 		  if (! bfd_get_section_contents (abfd, sec, contents,
 						  (file_ptr) 0, sec->_raw_size))
 		    goto error_return;
 		}
 	    }
 
-	  /* Read this BFD's local symbols if we haven't done so already.  */
-	  if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+	  /* Read this BFD's symbols if we haven't done so already.  */
+	  if (extsyms == NULL)
 	    {
-	      isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
-	      if (isymbuf == NULL)
-		isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
-						symtab_hdr->sh_info, 0,
-						NULL, NULL, NULL);
-	      if (isymbuf == NULL)
-		goto error_return;
+	      /* Get cached copy if it exists.  */
+	      if (symtab_hdr->contents != NULL)
+		extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
+	      else
+		{
+		  /* Go get them off disk.  */
+		  bfd_size_type amt;
+
+		  amt = symtab_hdr->sh_info;
+		  amt *= sizeof (Elf32_External_Sym);
+		  extsyms = (Elf32_External_Sym *) bfd_malloc (amt);
+		  if (extsyms == NULL)
+		    goto error_return;
+		  free_extsyms = extsyms;
+		  if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+		      || bfd_bread ((PTR) extsyms, amt, abfd) != amt)
+		    goto error_return;
+		}
+
+	      if (shndx_hdr->sh_size != 0)
+		{
+		  bfd_size_type amt;
+
+		  amt = symtab_hdr->sh_info;
+		  amt *= sizeof (Elf_External_Sym_Shndx);
+		  shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+		  if (shndx_buf == NULL)
+		    goto error_return;
+		  if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+		      || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
+		    goto error_return;
+		}
 	    }
 
 	  laddr = irel->r_offset;
@@ -2703,12 +2733,27 @@
 	
 	      if (ELF32_R_SYM (irelcall->r_info) < symtab_hdr->sh_info)
 		{
-		  Elf_Internal_Sym *  isym;
+		  unsigned int		   r_index;
+		  Elf_Internal_Sym         isym;
+		  asection *               sym_sec;
+		  Elf32_External_Sym *     esym;
+		  Elf_External_Sym_Shndx * shndx;
 
 		  /* A local symbol.  */
-		  isym = isymbuf + ELF32_R_SYM (irelcall->r_info);
+		  r_index = ELF32_R_SYM (irelcall->r_info);
+		  esym = extsyms + r_index;
+		  shndx = shndx_buf + (shndx_buf ? r_index : 0);
+		  bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym);
 
-		  symval = isym->st_value;
+		  if (isym.st_shndx == SHN_UNDEF)
+		    sym_sec = bfd_und_section_ptr;
+		  else if (isym.st_shndx == SHN_ABS)
+		    sym_sec = bfd_abs_section_ptr;
+		  else if (isym.st_shndx == SHN_COMMON)
+		    sym_sec = bfd_com_section_ptr;
+		  else
+		    sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx);
+		  symval = isym.st_value;
 		}
 	      else
 		{
@@ -2742,21 +2787,27 @@
 	      /* Get the value of the symbol referred to by the reloc.  */
 	      if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info)
 		{
-		  Elf_Internal_Sym * isym;
-		  asection *         sym_sec;
+		  unsigned int		   r_index;
+		  Elf_Internal_Sym         isym;
+		  asection *               sym_sec;
+		  Elf32_External_Sym *     esym;
+		  Elf_External_Sym_Shndx * shndx;
 
 		  /* A local symbol.  */
-		  isym = isymbuf + ELF32_R_SYM (hi_irelfn->r_info);
+		  r_index = ELF32_R_SYM (irel->r_info);
+		  esym = extsyms + r_index;
+		  shndx = shndx_buf + (shndx_buf ? r_index : 0);
+		  bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym);
           
-		  if (isym->st_shndx == SHN_UNDEF)
+		  if (isym.st_shndx == SHN_UNDEF)
 		    sym_sec = bfd_und_section_ptr;
-		  else if (isym->st_shndx == SHN_ABS)
+		  else if (isym.st_shndx == SHN_ABS)
 		    sym_sec = bfd_abs_section_ptr;
-		  else if (isym->st_shndx == SHN_COMMON)
+		  else if (isym.st_shndx == SHN_COMMON)
 		    sym_sec = bfd_com_section_ptr;
 		  else
-		    sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
-		  symval = (isym->st_value
+		    sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx);
+		  symval = (isym.st_value
 			    + sym_sec->output_section->vma
 			    + sym_sec->output_offset);
 		}
@@ -2766,7 +2817,7 @@
 		  struct elf_link_hash_entry * h;
 
 		  /* An external symbol.  */
-		  indx = ELF32_R_SYM (hi_irelfn->r_info) - symtab_hdr->sh_info;
+		  indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
 		  h = elf_sym_hashes (abfd)[indx];
 		  BFD_ASSERT (h != NULL);
 
@@ -2810,8 +2861,13 @@
 	         that would be more work, but would require less memory when
 	         the linker is run.  */
 	      elf_section_data (sec)->relocs = internal_relocs;
+	      free_relocs = NULL;
+
 	      elf_section_data (sec)->this_hdr.contents = contents;
-	      symtab_hdr->contents = (bfd_byte *) isymbuf;
+	      free_contents = NULL;
+
+	      symtab_hdr->contents = (bfd_byte *) extsyms;
+	      free_extsyms = NULL;
       
 	      /* Replace the long call with a jarl.  */
 	      irel->r_info = ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_22_PCREL);
@@ -2912,33 +2968,38 @@
 	      /* Get the value of the symbol referred to by the reloc.  */
 	      if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info)
 		{
-		  Elf_Internal_Sym *  isym;
-		  asection *          sym_sec;
+		  unsigned int		   r_index;
+		  Elf_Internal_Sym         isym;
+		  asection *               sym_sec;
+		  Elf32_External_Sym *     esym;
+		  Elf_External_Sym_Shndx * shndx;
 
 		  /* A local symbol.  */
-		  isym = isymbuf + ELF32_R_SYM (hi_irelfn->r_info);
-
-		  if (isym->st_shndx == SHN_UNDEF)
+		  r_index = ELF32_R_SYM (irel->r_info);
+		  esym = extsyms + r_index;
+		  shndx = shndx_buf + (shndx_buf ? r_index : 0);
+		  bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym);
+	  
+		  if (isym.st_shndx == SHN_UNDEF)
 		    sym_sec = bfd_und_section_ptr;
-		  else if (isym->st_shndx == SHN_ABS)
+		  else if (isym.st_shndx == SHN_ABS)
 		    sym_sec = bfd_abs_section_ptr;
-		  else if (isym->st_shndx == SHN_COMMON)
+		  else if (isym.st_shndx == SHN_COMMON)
 		    sym_sec = bfd_com_section_ptr;
 		  else
-		    sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
-		  symval = (isym->st_value
+		    sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx);
+		  symval = (isym.st_value
 			    + sym_sec->output_section->vma
 			    + sym_sec->output_offset);
 #ifdef DEBUG_RELAX
 		  {
 		    char * name = bfd_elf_string_from_elf_section
-		      (abfd, symtab_hdr->sh_link, isym->st_name);
+		      (abfd, symtab_hdr->sh_link, isym.st_name);
 
 		    fprintf (stderr, "relax long jump local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
-			     sym_sec->name, name, isym->st_name,
-			     sym_sec->output_section->vma,
-			     sym_sec->output_offset,
-			     isym->st_value, irel->r_addend);
+			     sym_sec->name, name, isym.st_name,
+			     sym_sec->output_section->vma, sym_sec->output_offset,
+			     isym.st_value, irel->r_addend);
 		  }
 #endif
 		}
@@ -2997,8 +3058,13 @@
 	         that would be more work, but would require less memory when
 	         the linker is run.  */
 	      elf_section_data (sec)->relocs = internal_relocs;
+	      free_relocs = NULL;
+
 	      elf_section_data (sec)->this_hdr.contents = contents;
-	      symtab_hdr->contents = (bfd_byte *) isymbuf;
+	      free_contents = NULL;
+
+	      symtab_hdr->contents = (bfd_byte *) extsyms;
+	      free_extsyms = NULL;
 
 	      if (foff < -0x100 || foff >= 0x100)
 		{
@@ -3096,24 +3162,19 @@
       sec->_cooked_size -= align_pad_size;
     }
 
- finish:
-  if (internal_relocs != NULL
-      && elf_section_data (sec)->relocs != internal_relocs)
-    free (internal_relocs);
-
-  if (contents != NULL
-      && elf_section_data (sec)->this_hdr.contents != (unsigned char *) contents)
-    free (contents);
-
-  if (isymbuf != NULL
-      && symtab_hdr->contents != (bfd_byte *) isymbuf)
-    free (isymbuf);
-
-  return result;
+  return true;
 
  error_return:
-  result = false;
-  goto finish;
+  if (free_relocs != NULL)
+    free (free_relocs);
+
+  if (free_contents != NULL)
+    free (free_contents);
+
+  if (free_extsyms != NULL)
+    free (free_extsyms);
+
+  return false;
 }
 
 #define TARGET_LITTLE_SYM			bfd_elf32_v850_vec
diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c
index f2802ab..85cf0ef 100644
--- a/bfd/mipsbsd.c
+++ b/bfd/mipsbsd.c
@@ -1,5 +1,5 @@
 /* BFD backend for MIPS BSD (a.out) binaries.
-   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001
    Free Software Foundation, Inc.
    Written by Ralph Campbell.
 
@@ -91,12 +91,12 @@
     {
     case M_MIPS1:
       arch = bfd_arch_mips;
-      machine = bfd_mach_mips3000;
+      machine = 3000;
       break;
 
     case M_MIPS2:
       arch = bfd_arch_mips;
-      machine = bfd_mach_mips4000;
+      machine = 4000;
       break;
 
     default:
@@ -164,8 +164,8 @@
     case bfd_arch_mips:
       switch (bfd_get_mach (abfd))
 	{
-	case bfd_mach_mips4000:
-	case bfd_mach_mips6000:
+	case 4000:
+	case 6000:
 	  N_SET_MACHTYPE (*execp, M_MIPS2);
 	  break;
 	default:
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index f751436..cb47f78 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -955,10 +955,7 @@
       break;
 
     case bfd_arch_i386:
-      if (machine == 0
-	  || machine == bfd_mach_i386_i386
-	  || machine == bfd_mach_i386_i386_intel_syntax)
-	arch_flags = M_386;
+      if (machine == 0)	arch_flags = M_386;
       break;
 
     case bfd_arch_a29k:
diff --git a/bfd/version.h b/bfd/version.h
index 8ea3083..d2a4916 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1 +1 @@
-#define BFD_VERSION_DATE 20020903
+#define BFD_VERSION_DATE 20020829
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f379860..7515c7f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,142 +1,3 @@
-2002-09-03  Theodore A. Roth  <troth@verinet.com>
-
-	* gdb/avr-tdep.c (avr_gdbarch_init): Use
-	generic_unwind_get_saved_register.
-
-2002-09-03  David Carlton  <carlton@math.stanford.edu>
-
-	* dwarf2read.c (dwarf2_add_member_fn): Add the 'type'
-	argument (PR gdb/653).  Update call to smash_to_method_type.
-	(read_structure_scope): Update call to dwarf2_add_member_fn.
-
-2002-09-03  Michal Ludvig  <mludvig@suse.cz>
-
-	* x86-64-linux-tdep.c: Include gdb_string.h
-	* x86-64-linux-nat.c: Ditto.
-
-2002-09-02  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* ada-exp.y (yyname, yyrule): Remap global variables that appear
-	when YYDEBUG is set to 1.  
-	* c-exp.y: Likewise.
-	* f-exp.y: Likewise.
-	* jv-exp.y: Likewise.
-	* m2-exp.y: Likewise.
-	* p-exp.y: Likewise.
-
-2002-09-02  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* Makefile.in (i386nbsd-tdep.o): Add $(solib_svr4_h) to
-	dependency list.
-	* i386nbsd-tdep.c (i386nbsdelf_init_abi): Set
-	solib_svr4_fetch_link_map_offsets to
-	nbsd_ilp32_solib_svr4_fetch_link_map_offsets.
-	* config/i386/nbsd.mt (TDEPFILES): Add solib.o and solib-svr4.o.
-	* config/i386/nbsdaout.mh (NATDEPFILES): Remove solib.o.
-	* config/i386/nbsdelf.mh (NATDEPFILES): Remove solib.o,
-	solib-svr4.o, and solib-legacy.o.
-	* config/i386/tm-nbsd.h: Include solib.h.
-
-2002-09-02  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* configure.tgt (i[3456]86-*-netbsdelf*): Merge with... 
-	(i[3456]86-*-netbsd*): ...this.  Set gdb_target to nbsd. 
-	(i[3456]86-*-openbsd*): Make this a separate entry.  Add a
-	comment noting that this needs its own target configuration.
-	* config/i386/nbsd.mt: New file.
-	* config/i386/nbsdaout.mt: Remove.
-	* config/i386/nbsdelf.mt: Ditto.
-	* config/i386/tm-nbsdaout.h: Ditto. 
-
-2002-09-02  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* i386nbsd-tdep.c (i386nbsd_sigtramp_offset): New function. 
-	(i386nbsd_pc_in_sigtramp): Rewrite to use i386nbsd_sigtramp_offset. 
-	(i386nbsd_init_abi): Don't initialize tdep->sigtramp_start or
-	tdep->sigtramp_end.
-	(i386nbsd_sigtramp_start, i386nbsd_sigtramp_end): Remove. 
-	* config/i386/tm-nbsd.h (SIGTRAMP_START, SIGTRAMP_END)
-	(i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove.
-
-2002-09-02  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* Makefile.in (i386nbsd-tdep.o): Add $(arch_utils_h),
-	$(i386_tdep_h), and $(nbsd_tdep_h) to dependency list.
-	* i386-tdep.h (i386bsd_init_abi): New prototype.
-	* i386bsd-tdep.c (i386bsd_init_abi): Remove "static" from
-	function declaration.
-	(_initialize_i386bsd_tdep): Don't register OS ABI handlers
-	for NetBSD-a.out or NetBSD-ELF.
-	(i386nbsd_sigtramp_start, i386nbsd_sigtramp_end)
-	(i386nbsd_sc_pc_offset, i386nbsd_sc_sp_offset)
-	(i386nbsd_init_abi, i386nbsdelf_init_abi): Move to...
-	* i386nbsd-tdep.c: ...here.  Include arch-utils.h, i386-tdep.h,
-	and nbsd-tdep.h.
-	(i386nbsd_pc_in_sigtramp): New function.
-	(i386nbsd_init_abi): Set gdbarch_pc_in_sigtramp to
-	i386nbsd_pc_in_sigtramp.
-	(_initialize_i386nbsd_tdep): Register i386nbsd_init_abi
-	and i386nbsdelf_init_abi OS ABI handlers.
-	* config/i386/nbsdaout.mt (TDEPFILES): Add nbsd-tdep.o.
-	* config/i386/nbsdelf.mt (TDEPFILES): Likewise.
-
-2002-09-02  Mark Kettenis  <kettenis@gnu.org>
-
-	* i386-linux-nat.c (dummy_sse_values): Only try to fill in the SSE
-	registers if the target really has them.
-
-2002-08-31  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* Makefile.in (mipsnbsd-tdep.o): Use $(nbsd_tdep_h) rather
-	than nbsd-tdep.h.
-
-2002-08-31  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* Makefile.in (alphanbsd-tdep.o): Add $(frame_h) to dependency
-	list.
-	* alphanbsd-tdep.c (alphanbsd_sigcontext_addr)
-	(alphanbsd_skip_sigtramp_frame): New functions. 
-	(alphanbsd_init_abi): Set tdep->skip_sigtramp_frame to
-	alphanbsd_skip_sigtramp_frame.  Set tdep->sigcontext_addr
-	to alphanbsd_sigcontext_addr. 
-
-2002-08-31  Jason Thorpe  <thorpej@wasabisystems.com>
-
-	* Makefile.in (mipsnbsd-tdep.o): Add nbsd-tdep.h to dependency
-	list.
-	(nbsd-tdep.o): Add $(gdb_string_h) to dependency list. 
-	* alphanbsd-tdep.c (alphanbsd_pc_in_sigtramp): Use
-	nbsd_pc_in_sigtramp. 
-	* mipsnbsd-tdep.c: Include nbsd-tdep.h.
-	(mipsnbsd_pc_in_sigtramp): Use nbsd_pc_in_sigtramp.
-	* nbsd-tdep.c: Include gdb_string.h.
-	(nbsd_pc_in_sigtramp): New function. 
-	* nbsd-tdep.h (nbsd_pc_in_sigtramp): New prototype. 
-	* ppcnbsd-tdep.c (ppcnbsd_pc_in_sigtramp): New function.
-	(ppcnbsd_init_abi): Set gdbarch_pc_in_sigtramp to
-	ppcnbsd_pc_in_sigtramp. 
-	* shnbsd-tdep.c (shnbsd_pc_in_sigtramp): New function.
-	(shnbsd_init_abi): Set gdbarch_pc_in_sigtramp to
-	shnbsd_pc_in_sigtramp. 
-	* sparcnbsd-tdep.c (sparcnbsd_init_abi_elf): Set
-	gdbarch_pc_in_sigtramp to nbsd_pc_in_sigtramp. 
-	* config/mips/nbsd.mt (TDEPFILES): Add nbsd-tdep.o.
-
-2002-08-30  Pierre Muller  <muller@ics.u-strasbg.fr>
-
-	* breakpoint.c (breakpoint_init_inferior): Reset the val field of
-	watchpoints to NULL.
-	(insert_breakpoints): set val field of watchpoints if NULL.
-
-
-2002-08-29  Jim Blandy  <jimb@redhat.com>
-
-	* symtab.c (lookup_symbol_aux): In the cases where we find a
-	minimal symbol of an appropriate name and use its address to
-	select a symtab to read and search, use `name' (as passed to us)
-	as the demangled name when searching the symtab's global and
-	static blocks, not the minsym's name.
-
 2002-08-29  Keith Seitz  <keiths@redhat.com>
 
 	* stack.c (print_frame_info_base): Always set current_source_symtab
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 45739e3..fdaaa8d 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1500,9 +1500,9 @@
 alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) $(alpha_tdep_h) \
 	$(alphabsd_tdep_h)
 alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h)
-alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
-	$(regcache_h) $(value_h) $(solib_svr4_h) $(alpha_tdep_h) \
-	$(alphabsd_tdep_h) $(nbsd_tdep_h)
+alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
+	$(value_h) $(solib_svr4_h) $(alpha_tdep_h) $(alphabsd_tdep_h) \
+	$(nbsd_tdep_h)
 annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
 	$(gdbtypes_h) $(breakpoint_h)
 # OBSOLETE arc-tdep.o: arc-tdep.c
@@ -1755,8 +1755,7 @@
 # OBSOLETE i386m3-nat.o: i386m3-nat.c
 # OBSOLETE i386mach-nat.o: i386mach-nat.c
 i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
-	$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
-	$(nbsd_tdep_h) $(solib_svr4_h)
+	$(regcache_h) $(i387_tdep_h)
 i386obsd-nat.o: i386obsd-nat.c $(defs_h)
 i386v-nat.o: i386v-nat.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \
 	$(gdbcore_h) $(gdb_stat_h) $(floatformat_h) $(target_h)
@@ -1906,8 +1905,7 @@
 mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(mipsnbsd_tdep_h)
 mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
-	$(target_h) $(value_h) $(osabi_h) $(mipsnbsd_tdep_h) $(solib_svr4_h) \
-	$(nbsd_tdep_h)
+	$(target_h) $(value_h) $(osabi_h) $(mipsnbsd_tdep_h) $(solib_svr4_h)
 mipsread.o: mipsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
 	$(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
 	$(coff_sym_h) $(coff_internal_h) $(coff_ecoff_h) $(libcoff_h) \
@@ -1926,7 +1924,7 @@
 monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
 	$(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) $(inferior_h) \
 	$(gdb_regex_h) $(srec_h) $(regcache_h)
-nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h)
+nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(solib_svr4_h)
 nindy-tdep.o: nindy-tdep.c $(defs_h) $(symtab_h) $(frame_h) $(gdbcore_h)
 nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
 	$(objfiles_h) $(buildsym_h) $(stabsread_h)
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 2e34e01..67185a3 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -90,8 +90,6 @@
 #define	yylloc	ada_lloc
 #define yyreds	ada_reds		/* With YYDEBUG defined */
 #define yytoks	ada_toks		/* With YYDEBUG defined */
-#define yyname	ada_name		/* With YYDEBUG defined */
-#define yyrule	ada_rule		/* With YYDEBUG defined */
 
 #ifndef YYDEBUG
 #define	YYDEBUG	1		/* Default to yydebug support */
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index bc7b1a4..519d816 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -21,7 +21,6 @@
 
 #include "defs.h"
 #include "gdbcore.h"
-#include "frame.h"
 #include "regcache.h"
 #include "value.h"
 
@@ -179,31 +178,7 @@
 static int
 alphanbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
 {
-  return (nbsd_pc_in_sigtramp (pc, func_name)
-	  || alphanbsd_sigtramp_offset (pc) >= 0);
-}
-
-static CORE_ADDR
-alphanbsd_sigcontext_addr (struct frame_info *frame)
-{
-  /* FIXME: This is not correct for all versions of NetBSD/alpha.
-     We will probably need to disassemble the trampoline to figure
-     out which trampoline frame type we have.  */
-  return frame->frame;
-}
-
-static CORE_ADDR
-alphanbsd_skip_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
-{
-  char *name;
-
-  /* FIXME: This is not correct for all versions of NetBSD/alpha.
-     We will probably need to disassemble the trampoline to figure
-     out which trampoline frame type we have.  */
-  find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
-  if (PC_IN_SIGTRAMP (pc, name))
-    return frame->frame;
-  return 0;
+  return (alphanbsd_sigtramp_offset (pc) >= 0);
 }
 
 static void
@@ -221,9 +196,7 @@
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                  nbsd_lp64_solib_svr4_fetch_link_map_offsets);
 
-  tdep->skip_sigtramp_frame = alphanbsd_skip_sigtramp_frame;
   tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
-  tdep->sigcontext_addr = alphanbsd_sigcontext_addr;
 
   tdep->jb_pc = 2;
   tdep->jb_elt_size = 8;
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index e38f13d..b245332 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1216,7 +1216,8 @@
   set_gdbarch_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type);
 
-  set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
+  /* We might need to define our own here or define FRAME_INIT_SAVED_REGS */
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
 
   set_gdbarch_print_insn (gdbarch, print_insn_avr);
 
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index b88f674..c52b4ba 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -738,19 +738,7 @@
     if (b->enable_state == bp_permanent)
       /* Permanent breakpoints cannot be inserted or removed.  */
       continue;
-    if ((b->type == bp_watchpoint
-	 || b->type == bp_hardware_watchpoint
-	 || b->type == bp_read_watchpoint
-	 || b->type == bp_access_watchpoint) && (!b->val))
-      {
-	struct value *val;
-	val = evaluate_expression (b->exp);
-	release_value (val);
-	if (VALUE_LAZY (val))
-	  value_fetch_lazy (val);
-	b->val = val;
-      } 
-    if (b->type != bp_watchpoint
+    else if (b->type != bp_watchpoint
 	&& b->type != bp_hardware_watchpoint
 	&& b->type != bp_read_watchpoint
 	&& b->type != bp_access_watchpoint
@@ -1578,14 +1566,6 @@
 	/* Likewise for watchpoints on local expressions.  */
 	if (b->exp_valid_block != NULL)
 	  delete_breakpoint (b);
-	if (context == inf_starting) 
-	  {
-	    /* Reset val field to force reread of starting value
-	       in insert_breakpoints.  */
-	    if (b->val)
-	      value_free (b->val);
-	    b->val = NULL;
-	  }
 	break;
       default:
 	/* Likewise for exception catchpoints in dynamic-linked
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index c6fc52c..ea50836 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -89,8 +89,6 @@
 #define	yylloc	c_lloc
 #define yyreds	c_reds		/* With YYDEBUG defined */
 #define yytoks	c_toks		/* With YYDEBUG defined */
-#define yyname	c_name		/* With YYDEBUG defined */
-#define yyrule	c_rule		/* With YYDEBUG defined */
 #define yylhs	c_yylhs
 #define yylen	c_yylen
 #define yydefred c_yydefred
diff --git a/gdb/config/i386/nbsdaout.mh b/gdb/config/i386/nbsdaout.mh
index 226c56c..e52f38a 100644
--- a/gdb/config/i386/nbsdaout.mh
+++ b/gdb/config/i386/nbsdaout.mh
@@ -1,5 +1,6 @@
 # Host: Intel 386 running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o solib-sunos.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \
+	solib.o solib-sunos.o
 
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/i386/nbsdaout.mt b/gdb/config/i386/nbsdaout.mt
new file mode 100644
index 0000000..aa88957
--- /dev/null
+++ b/gdb/config/i386/nbsdaout.mt
@@ -0,0 +1,3 @@
+# Target: Intel 386 running NetBSD
+TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o
+TM_FILE= tm-nbsdaout.h
diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh
index 7c27b02..0d1c4d1 100644
--- a/gdb/config/i386/nbsdelf.mh
+++ b/gdb/config/i386/nbsdelf.mh
@@ -1,4 +1,5 @@
 # Host: Intel 386 running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \
+	solib.o solib-svr4.o solib-legacy.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/i386/nbsd.mt b/gdb/config/i386/nbsdelf.mt
similarity index 71%
rename from gdb/config/i386/nbsd.mt
rename to gdb/config/i386/nbsdelf.mt
index f7f8cd6..fc80608 100644
--- a/gdb/config/i386/nbsd.mt
+++ b/gdb/config/i386/nbsdelf.mt
@@ -1,4 +1,3 @@
 # Target: Intel 386 running NetBSD
-TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o \
-	nbsd-tdep.o solib.o solib-svr4.o
+TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o
 TM_FILE= tm-nbsd.h
diff --git a/gdb/config/i386/tm-nbsd.h b/gdb/config/i386/tm-nbsd.h
index 8e58928..0d73d3a 100644
--- a/gdb/config/i386/tm-nbsd.h
+++ b/gdb/config/i386/tm-nbsd.h
@@ -22,6 +22,17 @@
 #define TM_NBSD_H
 
 #include "i386/tm-i386.h"
-#include "solib.h"
+
+/* These defines allow the recognition of sigtramps as a function name
+   <sigtramp>.
+
+   FIXME: kettenis/2002-05-12: Of course these defines will have to go
+   if we go truly "multi-arch", but I don't know yet how to get rid of
+   them.  */
+
+#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc)
+#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc)
+extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc);
+extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc);
 
 #endif /* TM_NBSD_H */
diff --git a/gdb/config/i386/tm-nbsdaout.h b/gdb/config/i386/tm-nbsdaout.h
new file mode 100644
index 0000000..25325e1
--- /dev/null
+++ b/gdb/config/i386/tm-nbsdaout.h
@@ -0,0 +1,26 @@
+/* Macro definitions for i386 running under NetBSD.
+   Copyright 2000, 2002 Free Software Foundation, Inc.
+
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef TM_NBSDAOUT_H
+#define TM_NBSDAOUT_H
+
+#include "i386/tm-nbsd.h"
+
+#endif /* TM_NBSDAOUT_H */
diff --git a/gdb/config/mips/nbsd.mt b/gdb/config/mips/nbsd.mt
index eb5d887..de52916 100644
--- a/gdb/config/mips/nbsd.mt
+++ b/gdb/config/mips/nbsd.mt
@@ -1,6 +1,5 @@
 # Target: MIPS running NetBSD
-TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o \
-	nbsd-tdep.o
+TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o
 TM_FILE= tm-nbsd.h
 
 SIM_OBS = remote-sim.o
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 896fbb1..385dbd0 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -92,8 +92,9 @@
 # OBSOLETE i[3456]86-*-aix*)	gdb_target=i386aix ;;
 i[3456]86-*-bsd*)	gdb_target=i386bsd ;;
 i[3456]86-*-freebsd*)	gdb_target=fbsd ;;
-i[3456]86-*-netbsd*)	gdb_target=nbsd ;;
-i[3456]86-*-openbsd*)	gdb_target=nbsd ;;	# FIXME: needs its own target
+i[3456]86-*-netbsdelf*)	gdb_target=nbsdelf ;;
+i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+			gdb_target=nbsdaout ;;
 # OBSOLETE i[3456]86-*-os9k)	gdb_target=i386os9k ;;
 i[3456]86-*-go32*)	gdb_target=i386aout ;;
 i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;;
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5bfecf0..37a5e3a 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,20 +1,3 @@
-2002-09-02  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* gdb.texinfo (TUI Overview): Document status line fields.
-
-2002-09-02  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* gdb.texinfo (TUI Commands): Document info win command.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* gdb.texinfo (TUI Overview): Document breakpoint markers.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* gdb.texinfo (TUI Single Key Mode): Document new SingleKey mode.
-	(TUI Keys): Likewise.
-
 2002-08-25  Andrew Cagney  <ac131313@redhat.com>
 
 	* gdb.texinfo (Examples): Use ``->'' for a packet send and ``<-''
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 4b8e4ca..c88c17d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -13101,7 +13101,6 @@
 @menu
 * TUI Overview::                TUI overview
 * TUI Keys::                    TUI key bindings
-* TUI Single Key Mode::         TUI single key mode
 * TUI Commands::                TUI specific commands
 * TUI Configuration::           TUI configuration variables
 @end menu
@@ -13142,6 +13141,8 @@
 @item source
 The source window shows the source file of the program.  The current
 line as well as active breakpoints are displayed in this window.
+The current program position is shown with the @samp{>} marker and
+active breakpoints are shown with @samp{*} markers.
 
 @item assembly
 The assembly window shows the disassembly output of the program.
@@ -13153,37 +13154,6 @@
 
 @end table
 
-The source and assembly windows show the current program position
-by highlighting the current line and marking them with the @samp{>} marker.
-Breakpoints are also indicated with two markers.  A first one
-indicates the breakpoint type:
-
-@table @code
-@item B
-Breakpoint which was hit at least once.
-
-@item b
-Breakpoint which was never hit.
-
-@item H
-Hardware breakpoint which was hit at least once.
-
-@item h
-Hardware breakpoint which was never hit.
-
-@end table
-
-The second marker indicates whether the breakpoint is enabled or not:
-
-@table @code
-@item +
-Breakpoint is enabled.
-
-@item -
-Breakpoint is disabled.
-
-@end table
-
 The source, assembly and register windows are attached to the thread
 and the frame position.  They are updated when the current thread
 changes, when the frame changes or when the program counter changes.
@@ -13209,35 +13179,6 @@
 
 @end itemize
 
-On top of the command window a status line gives various information
-concerning the current process begin debugged.  The status line is
-updated when the information it shows changes.  The following fields
-are displayed:
-
-@table @emph
-@item target
-Indicates the current gdb target
-(@pxref{Targets, ,Specifying a Debugging Target}).
-
-@item process
-Gives information about the current process or thread number.
-When no process is being debugged, this field is set to @code{No process}.
-
-@item function
-Gives the current function name for the selected frame.
-The name is demangled if demangling is turned on (@pxref{Print Settings}).
-When there is no symbol corresponding to the current program counter
-the string @code{??} is displayed.
-
-@item line
-Indicates the current line number for the selected frame.
-When the current line number is not known the string @code{??} is displayed.
-
-@item pc
-Indicates the current program counter address.
-
-@end table
-
 @node TUI Keys
 @section TUI Key Bindings
 @cindex TUI key bindings
@@ -13245,9 +13186,7 @@
 The TUI installs several key bindings in the readline keymaps
 (@pxref{Command Line Editing}).
 They allow to leave or enter in the TUI mode or they operate
-directly on the TUI layout and windows.  The TUI also provides
-a @emph{SingleKey} keymap which binds several keys directly to
-@value{GDBN} commands.  The following key bindings
+directly on the TUI layout and windows.  The following key bindings
 are installed for both TUI mode and the @value{GDBN} standard mode.
 
 @table @kbd
@@ -13280,11 +13219,6 @@
 
 Think of it as the Emacs @kbd{C-x 2} binding.
 
-@kindex C-x s
-@item C-x s
-Use the TUI @emph{SingleKey} keymap that binds single key to gdb commands
-(@pxref{TUI Single Key Mode}).
-
 @end table
 
 The following key bindings are handled only by the TUI mode:
@@ -13325,65 +13259,6 @@
 necessary to use other readline key bindings such as @key{C-p}, @key{C-n},
 @key{C-b} and @key{C-f}.
 
-@node TUI Single Key Mode
-@section TUI Single Key Mode
-@cindex TUI single key mode
-
-The TUI provides a @emph{SingleKey} mode in which it installs a particular
-key binding in the readline keymaps to connect single keys to
-some gdb commands. 
-
-@table @kbd
-@kindex c @r{(SingleKey TUI key)}
-@item c
-continue
-
-@kindex d @r{(SingleKey TUI key)}
-@item d
-down
-
-@kindex f @r{(SingleKey TUI key)}
-@item f
-finish
-
-@kindex n @r{(SingleKey TUI key)}
-@item n
-next
-
-@kindex q @r{(SingleKey TUI key)}
-@item q
-exit the @emph{SingleKey} mode.
-
-@kindex r @r{(SingleKey TUI key)}
-@item r
-run
-
-@kindex s @r{(SingleKey TUI key)}
-@item s
-step
-
-@kindex u @r{(SingleKey TUI key)}
-@item u
-up
-
-@kindex v @r{(SingleKey TUI key)}
-@item v
-info locals
-
-@kindex w @r{(SingleKey TUI key)}
-@item w
-where
-
-@end table
-
-Other keys temporarily switch to the @value{GDBN} command prompt.
-The key that was pressed is inserted in the editing buffer so that
-it is possible to type most @value{GDBN} commands without interaction
-with the TUI @emph{SingleKey} mode.  Once the command is entered the TUI
-@emph{SingleKey} mode is restored.  The only way to permanently leave
-this mode is by hitting @key{q} or @samp{@key{C-x} @key{s}}.
-
-
 @node TUI Commands
 @section TUI specific commands
 @cindex TUI commands
@@ -13395,10 +13270,6 @@
 in the TUI mode.
 
 @table @code
-@item info win
-@kindex info win
-List and give the size of all displayed windows.
-
 @item layout next
 @kindex layout next
 Display the next layout.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4ef683c..0d96e1f 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -803,8 +803,7 @@
 					  struct type *, struct objfile *);
 
 static void dwarf2_add_member_fn (struct field_info *,
-				  struct die_info *, struct type *,
-				  struct objfile *objfile,
+				  struct die_info *, struct objfile *objfile,
 				  const struct comp_unit_head *);
 
 static void dwarf2_attach_fn_fields_to_type (struct field_info *,
@@ -2260,7 +2259,7 @@
 
 static void
 dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
-		      struct type *type, struct objfile *objfile,
+		      struct objfile *objfile,
 		      const struct comp_unit_head *cu_header)
 {
   struct attribute *attr;
@@ -2328,9 +2327,7 @@
       struct type *return_type = TYPE_TARGET_TYPE (die->type);
       int nparams = TYPE_NFIELDS (die->type);
 
-      /* TYPE is the domain of this method, and DIE->TYPE is the type
-	   of the method itself (TYPE_CODE_METHOD).  */
-      smash_to_method_type (fnp->type, type,
+      smash_to_method_type (fnp->type, die->type,
 			    TYPE_TARGET_TYPE (die->type),
 			    TYPE_FIELDS (die->type),
 			    TYPE_NFIELDS (die->type),
@@ -2519,7 +2516,7 @@
 	    {
 	      /* C++ member function. */
 	      process_die (child_die, objfile, cu_header);
-	      dwarf2_add_member_fn (&fi, child_die, type, objfile, cu_header);
+	      dwarf2_add_member_fn (&fi, child_die, objfile, cu_header);
 	    }
 	  else if (child_die->tag == DW_TAG_inheritance)
 	    {
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index b900426..a26f019 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -91,8 +91,6 @@
 #define	yylloc	f_lloc
 #define yyreds	f_reds		/* With YYDEBUG defined */
 #define yytoks	f_toks		/* With YYDEBUG defined */
-#define yyname	f_name		/* With YYDEBUG defined */
-#define yyrule	f_rule		/* With YYDEBUG defined */
 #define yylhs	f_yylhs
 #define yylen	f_yylen
 #define yydefred f_yydefred
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 8458879..74c70db 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -541,17 +541,15 @@
 static void
 dummy_sse_values (void)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
   /* C doesn't have a syntax for NaN's, so write it out as an array of
      longs.  */
   static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
   static long mxcsr = 0x1f80;
   int reg;
 
-  for (reg = 0; reg < tdep->num_xmm_regs; reg++)
+  for (reg = 0; reg < 8; reg++)
     supply_register (XMM0_REGNUM + reg, (char *) dummy);
-  if (tdep->num_xmm_regs > 0)
-    supply_register (MXCSR_REGNUM, (char *) &mxcsr);
+  supply_register (MXCSR_REGNUM, (char *) &mxcsr);
 }
 
 #else
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 646001b..30128d9 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -175,6 +175,5 @@
 /* Functions exported from i386bsd-tdep.c.  */
 
 extern CORE_ADDR i386bsd_sigcontext_addr (struct frame_info *frame);
-extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *);
 
 #endif /* i386-tdep.h */
diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c
index 368fa56..2edf3ea 100644
--- a/gdb/i386bsd-tdep.c
+++ b/gdb/i386bsd-tdep.c
@@ -93,7 +93,7 @@
 int i386bsd_sc_pc_offset = 20;
 int i386bsd_sc_sp_offset = 8;
 
-void
+static void
 i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -113,6 +113,61 @@
   tdep->sc_sp_offset = i386bsd_sc_sp_offset;
 }
 
+/* NetBSD 1.0 or later.  */
+
+CORE_ADDR i386nbsd_sigtramp_start = 0xbfbfdf20;
+CORE_ADDR i386nbsd_sigtramp_end = 0xbfbfdff0;
+
+/* From <machine/signal.h>.  */
+int i386nbsd_sc_pc_offset = 44;
+int i386nbsd_sc_sp_offset = 56;
+
+static void
+i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  /* Obviously NetBSD is BSD-based.  */
+  i386bsd_init_abi (info, gdbarch);
+
+  /* NetBSD uses -freg-struct-return by default.  */
+  tdep->struct_return = reg_struct_return;
+
+  /* NetBSD uses a different memory layout.  */
+  tdep->sigtramp_start = i386nbsd_sigtramp_start;
+  tdep->sigtramp_end = i386nbsd_sigtramp_end;
+
+  /* NetBSD has a `struct sigcontext' that's different from the
+     origional 4.3 BSD.  */
+  tdep->sc_pc_offset = i386nbsd_sc_pc_offset;
+  tdep->sc_sp_offset = i386nbsd_sc_sp_offset;
+}
+
+/* NetBSD ELF.  */
+static void
+i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  /* It's still NetBSD.  */
+  i386nbsd_init_abi (info, gdbarch);
+
+  /* But ELF-based.  */
+  i386_elf_init_abi (info, gdbarch);
+
+  /* NetBSD ELF uses SVR4-style shared libraries.  */
+  set_gdbarch_in_solib_call_trampoline (gdbarch,
+					generic_in_solib_call_trampoline);
+
+  /* NetBSD ELF uses -fpcc-struct-return by default.  */
+  tdep->struct_return = pcc_struct_return;
+
+  /* We support the SSE registers on NetBSD ELF.  */
+  tdep->num_xmm_regs = I386_NUM_XREGS - 1;
+  set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS
+			+ I386_NUM_XREGS);
+}
+
 /* FreeBSD 3.0-RELEASE or later.  */
 
 CORE_ADDR i386fbsd_sigtramp_start = 0xbfbfdf20;
@@ -191,6 +246,10 @@
   gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
 				  i386bsd_aout_osabi_sniffer);
 
+  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT,
+			  i386nbsd_init_abi);
+  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF,
+ 			  i386nbsdelf_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_AOUT,
 			  i386fbsdaout_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_ELF,
diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c
index 8d32a03..634101a 100644
--- a/gdb/i386nbsd-tdep.c
+++ b/gdb/i386nbsd-tdep.c
@@ -23,13 +23,8 @@
 #include "gdbtypes.h"
 #include "gdbcore.h"
 #include "regcache.h"
-#include "arch-utils.h"
 
-#include "i386-tdep.h"
 #include "i387-tdep.h"
-#include "nbsd-tdep.h"
-
-#include "solib-svr4.h"
 
 /* Map a GDB register number to an offset in the reg structure.  */
 static int regmap[] =
@@ -142,161 +137,9 @@
   NULL					/* next */
 };
 
-/* Under NetBSD/i386, signal handler invocations can be identified by the
-   designated code sequence that is used to return from a signal handler.
-   In particular, the return address of a signal handler points to the
-   following code sequence:
-
-	leal	0x10(%esp), %eax
-	pushl	%eax
-	pushl	%eax
-	movl	$0x127, %eax		# __sigreturn14
-	int	$0x80
-
-   Each instruction has a unique encoding, so we simply attempt to match
-   the instruction the PC is pointing to with any of the above instructions.
-   If there is a hit, we know the offset to the start of the designated
-   sequence and can then check whether we really are executing in the
-   signal trampoline.  If not, -1 is returned, otherwise the offset from the
-   start of the return sequence is returned.  */
-#define RETCODE_INSN1		0x8d
-#define RETCODE_INSN2		0x50
-#define RETCODE_INSN3		0x50
-#define RETCODE_INSN4		0xb8
-#define RETCODE_INSN5		0xcd
-
-#define RETCODE_INSN2_OFF	4
-#define RETCODE_INSN3_OFF	5
-#define RETCODE_INSN4_OFF	6
-#define RETCODE_INSN5_OFF	11
-
-static const unsigned char sigtramp_retcode[] =
-{
-  RETCODE_INSN1, 0x44, 0x24, 0x10,
-  RETCODE_INSN2,
-  RETCODE_INSN3,
-  RETCODE_INSN4, 0x27, 0x01, 0x00, 0x00,
-  RETCODE_INSN5, 0x80,
-};
-
-static LONGEST
-i386nbsd_sigtramp_offset (CORE_ADDR pc)
-{
-  unsigned char ret[sizeof(sigtramp_retcode)], insn;
-  LONGEST off;
-  int i;
-
-  if (read_memory_nobpt (pc, &insn, 1) != 0)
-    return -1;
-
-  switch (insn)
-    {
-    case RETCODE_INSN1:
-      off = 0;
-      break;
-
-    case RETCODE_INSN2:
-      /* INSN2 and INSN3 are the same.  Read at the location of PC+1
-	 to determine if we're actually looking at INSN2 or INSN3.  */
-      if (read_memory_nobpt (pc + 1, &insn, 1) != 0)
-	return -1;
-
-      if (insn == RETCODE_INSN3)
-	off = RETCODE_INSN2_OFF;
-      else
-	off = RETCODE_INSN3_OFF;
-      break;
-
-    case RETCODE_INSN4:
-      off = RETCODE_INSN4_OFF;
-      break;
-
-    case RETCODE_INSN5:
-      off = RETCODE_INSN5_OFF;
-      break;
-
-    default:
-      return -1;
-    }
-
-  pc -= off;
-
-  if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0)
-    return -1;
-
-  if (memcmp (ret, sigtramp_retcode, sizeof (ret)) == 0)
-    return off;
-
-  return -1;
-}
-
-static int
-i386nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
-{
-
-  return (nbsd_pc_in_sigtramp (pc, name)
-	  || i386nbsd_sigtramp_offset (pc) >= 0);
-}
-
-/* From <machine/signal.h>.  */
-int i386nbsd_sc_pc_offset = 44;
-int i386nbsd_sc_sp_offset = 56;
-
-static void 
-i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  /* Obviously NetBSD is BSD-based.  */
-  i386bsd_init_abi (info, gdbarch);
-
-  /* NetBSD has different signal trampoline conventions.  */
-  set_gdbarch_pc_in_sigtramp (gdbarch, i386nbsd_pc_in_sigtramp);
-
-  /* NetBSD uses -freg-struct-return by default.  */
-  tdep->struct_return = reg_struct_return;
-
-  /* NetBSD has a `struct sigcontext' that's different from the
-     origional 4.3 BSD.  */
-  tdep->sc_pc_offset = i386nbsd_sc_pc_offset;
-  tdep->sc_sp_offset = i386nbsd_sc_sp_offset;
-}
-
-/* NetBSD ELF.  */
-static void
-i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  /* It's still NetBSD.  */
-  i386nbsd_init_abi (info, gdbarch);
-
-  /* But ELF-based.  */
-  i386_elf_init_abi (info, gdbarch);
-
-  /* NetBSD ELF uses SVR4-style shared libraries.  */
-  set_gdbarch_in_solib_call_trampoline (gdbarch,
-                                        generic_in_solib_call_trampoline);
-  set_solib_svr4_fetch_link_map_offsets (gdbarch,
-				 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
-
-  /* NetBSD ELF uses -fpcc-struct-return by default.  */
-  tdep->struct_return = pcc_struct_return;
-
-  /* We support the SSE registers on NetBSD ELF.  */
-  tdep->num_xmm_regs = I386_NUM_XREGS - 1;
-  set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS
-                        + I386_NUM_XREGS);
-}
-
 void
 _initialize_i386nbsd_tdep (void)
 {
   add_core_fns (&i386nbsd_core_fns);
   add_core_fns (&i386nbsd_elfcore_fns);
-
-  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT,
-			  i386nbsd_init_abi);
-  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF,
-			  i386nbsdelf_init_abi);
 }
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 70c228b..c2e5d16 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -85,8 +85,6 @@
 #define	yylloc	java_lloc
 #define yyreds	java_reds		/* With YYDEBUG defined */
 #define yytoks	java_toks		/* With YYDEBUG defined */
-#define yyname	java_name		/* With YYDEBUG defined */
-#define yyrule	java_rule		/* With YYDEBUG defined */
 #define yylhs	java_yylhs
 #define yylen	java_yylen
 #define yydefred java_yydefred
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index e291d62..707c9e2 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -87,8 +87,6 @@
 #define	yylloc	m2_lloc
 #define	yyreds	m2_reds		/* With YYDEBUG defined */
 #define	yytoks	m2_toks		/* With YYDEBUG defined */
-#define yyname	m2_name		/* With YYDEBUG defined */
-#define yyrule	m2_rule		/* With YYDEBUG defined */
 #define yylhs	m2_yylhs
 #define yylen	m2_yylen
 #define yydefred m2_yydefred
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
index 3367e36..029ae6f 100644
--- a/gdb/mipsnbsd-tdep.c
+++ b/gdb/mipsnbsd-tdep.c
@@ -26,7 +26,6 @@
 #include "value.h"
 #include "osabi.h"
 
-#include "nbsd-tdep.h"
 #include "mipsnbsd-tdep.h"
 
 #include "solib-svr4.h"
@@ -220,8 +219,7 @@
 static int
 mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
 {
-  return (nbsd_pc_in_sigtramp (pc, func_name)
-	  || mipsnbsd_sigtramp_offset (pc) >= 0);
+  return (mipsnbsd_sigtramp_offset (pc) >= 0);
 }
 
 /* Figure out where the longjmp will land.  We expect that we have
diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c
index a2d8f7d..71e229d 100644
--- a/gdb/nbsd-tdep.c
+++ b/gdb/nbsd-tdep.c
@@ -20,7 +20,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#include "gdb_string.h"
 #include "solib-svr4.h"
 
 /* Fetch (and possibly build) an appropriate link_map_offsets
@@ -97,13 +96,3 @@
 
   return lmp;
 }
-
-int
-nbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
-{
-  /* Check for libc-provided signal trampoline.  All such trampolines
-     have function names which begin with "__sigtramp".  */
-
-  return (func_name != NULL
-	  && strncmp (func_name, "__sigtramp", 10) == 0);
-}
diff --git a/gdb/nbsd-tdep.h b/gdb/nbsd-tdep.h
index 9d26ae9..ca40965 100644
--- a/gdb/nbsd-tdep.h
+++ b/gdb/nbsd-tdep.h
@@ -25,6 +25,4 @@
 struct link_map_offsets *nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void);
 struct link_map_offsets *nbsd_lp64_solib_svr4_fetch_link_map_offsets (void);
 
-int nbsd_pc_in_sigtramp (CORE_ADDR, char *);
-
 #endif /* NBSD_TDEP_H */
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index f0939e7..fbdd3f6 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -93,8 +93,6 @@
 #define	yylloc	pascal_lloc
 #define yyreds	pascal_reds		/* With YYDEBUG defined */
 #define yytoks	pascal_toks		/* With YYDEBUG defined */
-#define yyname	pascal_name		/* With YYDEBUG defined */
-#define yyrule	pascal_rule		/* With YYDEBUG defined */
 #define yylhs	pascal_yylhs
 #define yylen	pascal_yylen
 #define yydefred pascal_yydefred
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 3d052a8..6fabab7 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -196,13 +196,6 @@
   NULL					/* next */
 };
 
-static int
-ppcnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
-{
-  /* FIXME: Need to add support for kernel-provided signal trampolines.  */
-  return (nbsd_pc_in_sigtramp (pc, func_name));
-}
-
 static void
 ppcnbsd_init_abi (struct gdbarch_info info,
                   struct gdbarch *gdbarch)
@@ -210,8 +203,6 @@
   /* Stop at main.  */
   set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
 
-  set_gdbarch_pc_in_sigtramp (gdbarch, ppcnbsd_pc_in_sigtramp);
-
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
 }
diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c
index b67884d..0298226 100644
--- a/gdb/shnbsd-tdep.c
+++ b/gdb/shnbsd-tdep.c
@@ -165,19 +165,10 @@
   NULL					/* next */
 };
 
-static int
-shnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
-{
-  /* FIXME: Need to add support for kernel-provided signal trampolines.  */
-  return (nbsd_pc_in_sigtramp (pc, func_name));
-}
-
 static void
 shnbsd_init_abi (struct gdbarch_info info,
                   struct gdbarch *gdbarch)
 {
-  set_gdbarch_pc_in_sigtramp (gdbarch, shnbsd_pc_in_sigtramp);
-
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
 		                nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
 }
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index 1103eaa..ea70e51 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -500,8 +500,6 @@
 {
   sparcnbsd_init_abi_common (info, gdbarch);
 
-  set_gdbarch_pc_in_sigtramp (gdbarch, nbsd_pc_in_sigtramp);
-
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
 				         gdbarch_ptr_bit (gdbarch) == 32 ?
                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets :
diff --git a/gdb/symtab.c b/gdb/symtab.c
index c18625a..d39962e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -860,20 +860,15 @@
 	      /* This is a function which has a symtab for its address.  */
 	      bv = BLOCKVECTOR (s);
 	      block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-
-              /* This call used to pass `SYMBOL_NAME (msymbol)' as the
-                 `name' argument to lookup_block_symbol.  But the name
-                 of a minimal symbol is always mangled, so that seems
-                 to be clearly the wrong thing to pass as the
-                 unmangled name.  */
-	      sym = lookup_block_symbol (block, name, mangled_name, namespace);
+	      sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
+					 mangled_name, namespace);
 	      /* We kept static functions in minimal symbol table as well as
 	         in static scope. We want to find them in the symbol table. */
 	      if (!sym)
 		{
 		  block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-		  sym = lookup_block_symbol (block, name,
-                                             mangled_name, namespace);
+		  sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
+					     mangled_name, namespace);
 		}
 
 	      /* sym == 0 if symbol was found in the minimal symbol table
@@ -1032,19 +1027,15 @@
 	    {
 	      bv = BLOCKVECTOR (s);
 	      block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-              /* This call used to pass `SYMBOL_NAME (msymbol)' as the
-                 `name' argument to lookup_block_symbol.  But the name
-                 of a minimal symbol is always mangled, so that seems
-                 to be clearly the wrong thing to pass as the
-                 unmangled name.  */
-	      sym = lookup_block_symbol (block, name, mangled_name, namespace);
+	      sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
+					 mangled_name, namespace);
 	      /* We kept static functions in minimal symbol table as well as
 	         in static scope. We want to find them in the symbol table. */
 	      if (!sym)
 		{
 		  block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-		  sym = lookup_block_symbol (block, name,
-                                             mangled_name, namespace);
+		  sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
+					     mangled_name, namespace);
 		}
 	      /* If we found one, return it */
 	      if (sym)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d0f9ef2..cd9adf8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,13 +1,3 @@
-2002-09-03  Keith Seitz  <keiths@redhat.com>
-
-	* lib/gdb.exp (gdb_compile_pthreads): Fix "build_bin" typo.
-	Use integer comparison instead of string comparison for testing
-	whether binary was built.
-
-2002-09-03  Jim Blandy  <jimb@redhat.com>
-
-	* gdb.threads/killed.exp, gdb.threads/killed.c: New test.
-
 2002-08-29  Jim Blandy  <jimb@redhat.com>
 
 	* gdb.threads/pthreads.exp: Move the portable thread compilation
diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog
index ac00d9f..26d662c 100644
--- a/gdb/testsuite/gdb.mi/ChangeLog
+++ b/gdb/testsuite/gdb.mi/ChangeLog
@@ -1,8 +1,3 @@
-2002-09-03  Keith Seitz  <keiths@redhat.com>
-
-	* gdb680.exp: New file to test to check for uiout list/tuple
-	nesting bug.
-
 2002-03-04  Michael Chastain  <mec@shout.net>
 
 	* mi-var-cmd.exp: In test "create local variable func",
diff --git a/gdb/testsuite/gdb.mi/gdb680.exp b/gdb/testsuite/gdb.mi/gdb680.exp
deleted file mode 100644
index eee96a6..0000000
--- a/gdb/testsuite/gdb.mi/gdb680.exp
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 2002 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
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-#
-# test gdb/680
-#
-
-load_lib mi-support.exp
-set MIFLAGS "-i=mi"
-
-gdb_exit
-if [mi_gdb_start] {
-    continue
-}
-
-proc do_test {count} {
-  mi_gdb_test "-data-list-register-names -1" \
-    {\^error,msg=\"bad register number\"} \
-    "-data-list-register-names -1, try $count"
-}
-
-# Tests a bug with ui-out and nested uiout types. When 
-# an error is encountered building a nest typed, like
-# lists or tuples, the uiout is not reset to some sane
-# state. As a result, uiout still thinks it is building
-# this nested type. Execute enough of these errors and
-# an assertion failure occurs. This is most obvious
-# with invalid register number and the register commands.
-
-# MAX_UIOUT_LEVELS is set to 5.
-set counter 0
-for {set i 0} {$i < 4} {incr i} {
-  do_test $i
-}
-
-#setup_kfail "gdb/680"
-do_test $i
-
-mi_gdb_exit
-return 0
diff --git a/gdb/testsuite/gdb.threads/killed.c b/gdb/testsuite/gdb.threads/killed.c
deleted file mode 100644
index 6cb3928..0000000
--- a/gdb/testsuite/gdb.threads/killed.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <sys/types.h>
-#include <signal.h>
-#include <pthread.h>
-#include <stdio.h>
-
-int pid;
-
-void *
-child_func (void *dummy)
-{
-  kill (pid, SIGKILL);
-  exit (1);
-}
-
-int
-main ()
-{
-  pthread_t child;
-
-  pid = getpid ();
-  pthread_create (&child, 0, child_func, 0);
-  for (;;)
-    sleep (10000);
-}
diff --git a/gdb/testsuite/gdb.threads/killed.exp b/gdb/testsuite/gdb.threads/killed.exp
deleted file mode 100644
index 3712508..0000000
--- a/gdb/testsuite/gdb.threads/killed.exp
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright 2002 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
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@gnu.org
-
-# This is a regression test for gdb/568 in the sources.redhat.com
-# GNATS database.  As of early June 2002, GDB could get sort of wedged
-# debugging the program `killed.c':
-#
-# $ $D6/gdb/gdb -nw killed
-# GNU gdb 2002-06-11-cvs
-# Copyright 2002 Free Software Foundation, Inc.
-# GDB is free software, covered by the GNU General Public License, and you are
-# welcome to change it and/or distribute copies of it under certain conditions.
-# Type "show copying" to see the conditions.
-# There is absolutely no warranty for GDB.  Type "show warranty" for details.
-# This GDB was configured as "i686-pc-linux-gnu"...
-# (gdb) run
-# Starting program: /home/jimb/foo/play/killed 
-# [New Thread 1024 (LWP 6487)]
-# [New Thread 2049 (LWP 6488)]
-# [New Thread 1026 (LWP 6489)]
-# Cannot find user-level thread for LWP 6487: generic error
-# (gdb) quit
-# The program is running.  Exit anyway? (y or n) y
-# Cannot find thread 2049: generic error
-# (gdb) kill
-# Kill the program being debugged? (y or n) y
-# Cannot find thread 2049: generic error
-# (gdb) The program is running.  Exit anyway? (y or n) y
-# Cannot find thread 2049: generic error
-# (gdb) 
-# [7]+  Stopped                 $D6/gdb/gdb -nw killed
-# $ kill %7
-# 
-# [7]+  Stopped                 $D6/gdb/gdb -nw killed
-# $ kill -9 %7
-# 
-# [7]+  Stopped                 $D6/gdb/gdb -nw killed
-# $ 
-# [7]+  Killed                  $D6/gdb/gdb -nw killed
-# $ 
-
-if $tracelevel then {
-	strace $tracelevel
-}
-
-set prms_id 0
-set bug_id 0
-
-set testfile "killed"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}/${subdir}"]] != "" } {
-    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-
-
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-gdb_test "run" "" "run program to completion"
-
-# Try to quit.
-send_gdb "quit\n"
-gdb_expect {
-    -re "The program is running.  Exit anyway\\? \\(y or n\\) $" {
-        send_gdb "y\n"
-        exp_continue
-    }
-    eof {
-        pass "GDB exits after multi-threaded program exits messily"
-    }
-    -re "Cannot find thread ${decimal}: generic error\[\r\n\]*$gdb_prompt $" {
-        # setup_kfail "gdb/568"
-        fail "GDB exits after multi-threaded program exits messily (gdb/568)"
-    }
-    timeout {
-        fail "GDB exits after multi-threaded program exits messily (timeout)"
-    }
-}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f4ddc63..8949910 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1176,7 +1176,7 @@
 # against several different thread libraries, to see which one this
 # system has.
 proc gdb_compile_pthreads {source dest type options} {
-    set built_binfile 0
+    set build_binfile 0
     set why_msg "unrecognized error"
     foreach lib {-lpthreads -lpthread -lthread} {
         # This kind of wipes out whatever libs the caller may have
@@ -1201,7 +1201,7 @@
             }
         }
     }
-    if {!$built_binfile} {
+    if {$built_binfile == "0"} {
         unsupported "Couldn't compile $source: ${why_msg}"
         return -1
     }
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index dbb9f54..0e19a12 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,138 +1,3 @@
-2002-09-04  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiIO.c (tui_putc): New function to print one character.
-	(printable_part): New function from readline/complete.c.
-	(PUTX): New macro, likewise.
-	(print_filename): New function, likewise.
-	(get_y_or_n): New function, likewise and adapted for TUI.
-	(tui_rl_display_match_list): New function from readline/complete.c
-	and writes on TUI command window.
-	(tui_setup_io): Install or remove the readline hook
-	rl_completion_display_matches_hook so that completion is written
-	directly in TUI command window instead of in the TUI pipe.
-	(tui_initialize_io): Use #ifdef TUI_USE_PIPE_FOR_READLINE for the
-	TUI redirection pipe.
-	(tui_getc): Likewise for call to tui_readline_output.
-	(tui_readline_output): Likewise for function.
-	* tui.c (tui_rl_startup_hook): Always take care of gdb prompt.
-
-2002-09-02  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiWin.c (_newHeightOk): Fix compilation warnings.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiWin.c (_tuiAllWindowsInfo): Don't crash if the window
-	is not displayed.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tui-out.c (tui_out_new): Clear start_of_line.
-	* tuiSource.c (tuiVerticalSourceScroll): Use print_source_lines
-	to update the current source line.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tui-hooks.c (tui_detach_hook): New hook to know when a process dies.
-	(tui_install_hooks): Install it.
-	(tui_remove_hooks): Remove it.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiData.h (FILE_PREFIX): Don't define.
-	(blankStr, locationStr, breakStr): Don't declare.
-	(breakLocationStr, nullStr, historyLimit, setHistoryLimitTo): Likewise.
-	(displayableWinContentOf, displayableWinContentAt): Likewise.
-	(winElementHeight, winByName, freeAllWindows): Likewise.
-
-	* tuiData.c (blankStr, locationStr, breakStr): Remove.
-	(breakLocationStr, nullStr, historyLimit, setHistoryLimitTo): Remove.
-	(displayableWinContentOf, displayableWinContentAt): Remove.
-	(winElementHeight, winByName, freeAllWindows): Remove.
-
-2002-09-01  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiStack.c (tui_make_status_line): New function to create the
-	status line.
-	(tuiShowLocatorContent): Use it instead of displayableWinContentAt.
-	* tuiData.h (PROC_PREFIX): Use "In:" to reduce length of prefix.
-	(PC_PREFIX): Use upper case.
-	(SINGLE_KEY, MIN_LINE_WIDTH, MIN_PROC_WIDTH): Define.
-	(MAX_TARGET_WIDTH, MAX_PID_WIDTH): Define.
-
-2002-08-31  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiSourceWin.h (tuiUpdateAllExecInfos): Don't declare.
-	(tuiClearAllExecInfosContent): Likewise.
-	(tuiEraseAllExecInfosContent): Ditto.
-	(tuiUpdateSourceWindowsFromLocator): Ditto.
-	* tuiSourceWin.c (tuiUpdateAllExecInfos): Remove.
-	* tui.h (tui_vCheckDataValues): Don't declare.
-	(tui_vStartNewLines, tui_vAllSetHasBreakAt): Likewise.
-	(tui_vUpdateLocatorFilename, tui_vUpdateSourceWindowsWithAddr): Ditto.
-	(tui_vShowFrameInfo): Ditto.
-
-2002-08-31  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tui.c (tui_commands): Table of single key commands.
-	(tui_rl_command_key): New function to execute gdb command.
-	(tui_rl_command_mode): New function to temporarily leave SingleKey.
-	(tui_rl_next_keymap): New function to enter/leave the SingleKey mode.
-	(tui_rl_startup_hook): New function to avoid prompt display by
-	readline functions.
-	(tui_set_key_mode): New function to set the key mode and install
-	the readline keymap.
-	(tui_initialize_readline): Create TUI SingleKey readline map.
-	(tui_enable): Install rl_startup_hook.
-	(tui_disable): Remove it.
-	* tui.h (enum tui_key_mode): Declare.
-	(tui_set_key_mode, tui_current_key_mode): Declare.
-	* tuiIO.c (tui_redisplay_readline): Don't display the prompt in
-	SingleKey mode.
-	* tuiIO.h (tui_redisplay_readline): Declare.
-
-2002-08-31  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiSourceWin.c (tuiSetIsExecPointAt): Redraw the previous and
-	current line.
-
-2002-08-31  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiSource.c (tuiSetSourceContent): Remove old breakpoint code.
-	(_hasBreak): Remove.
-	(tuiShowSource): Fix comment indentation.
-	(tuiSourceIsDisplayed): Likewise.
-	(tuiVerticalSourceScroll): Likewise.
-
-2002-08-30  Stephane Carrez  <stcarrez@nerim.fr>
-
-	* tuiSourceWin.h (tui_update_all_breakpoint_info): Declare.
-	(tui_update_breakpoint_info): Declare.
-	(tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove.
-
-	* tuiSourceWin.c (tuiUpdateSourceWindowAsIs): Update breakpoint
-	information using tui_update_breakpoint_info.
-	(tui_update_all_breakpoint_info): New function to refresh all
-	execution windows.
-	(tui_update_breakpoint_info): New function to recompute the status
-	of exec info window from breakpoints.
-	(tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove.
-	(tuiSetExecInfoContent): Use the exec info flags computed by
-	tui_update_breakpoint_info to display a short status about breakpoints.
-
-	* tuiData.h (TuiExecInfoContent): New for exec info string.
-	(TuiWhichElement): Use it.
-	(TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT): New defines.
-	(TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): New defines.
-	(TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS): Likewise.
-	(TUI_EXECINFO_SIZE): Likewise.
-	* tuiData.c (initContentElement): Clear exec info string.
-
-	* tui-hooks.c (get_breakpoint): Remove.
-	(tui_event_create_breakpoint): Call tui_update_all_breakpoint_info.
-	(tui_event_delete_breakpoint): Likewise.
-	(tui_event_modify_breakpoint): Likewise.
-
 2002-08-29  Stephane Carrez  <stcarrez@nerim.fr>
 
 	* tui.c (tuiGetLowDisassemblyAddress): Moved from here.
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 35d7ce8..d605194 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -167,12 +167,44 @@
     }
 }
 
+extern struct breakpoint *breakpoint_chain;
+
+/* Find a breakpoint given its number.  Returns null if not found.  */
+static struct breakpoint *
+get_breakpoint (int number)
+{
+  struct breakpoint *bp;
+
+  for (bp = breakpoint_chain; bp; bp = bp->next)
+    {
+      if (bp->number == number)
+        return bp;
+    }
+  return 0;
+}
+
 /* Breakpoint creation hook.
    Update the screen to show the new breakpoint.  */
 static void
 tui_event_create_breakpoint (int number)
 {
-  tui_update_all_breakpoint_info ();
+  struct breakpoint *bp;
+
+  bp = get_breakpoint (number);
+  if (bp)
+    {
+      switch (bp->type)
+        {
+        case bp_breakpoint:
+        case bp_hardware_breakpoint:
+          tuiAllSetHasBreakAt (bp, 1);
+          tuiUpdateAllExecInfos ();
+          break;
+
+        default:
+          break;
+        }
+    }
 }
 
 /* Breakpoint deletion hook.
@@ -180,13 +212,35 @@
 static void
 tui_event_delete_breakpoint (int number)
 {
-  tui_update_all_breakpoint_info ();
+  struct breakpoint *bp;
+  struct breakpoint *b;
+  int clearIt;
+
+  bp = get_breakpoint (number);
+  if (bp == 0)
+    return;
+
+  /* Before turning off the visuals for the bp, check to see that
+     there are no other bps at the same address. */
+  clearIt = 0;
+  for (b = breakpoint_chain; b; b = b->next)
+    {
+      clearIt = (b == bp || b->address != bp->address);
+      if (!clearIt)
+        break;
+    }
+
+  if (clearIt)
+    {
+      tuiAllSetHasBreakAt (bp, 0);
+      tuiUpdateAllExecInfos ();
+    }
 }
 
 static void
 tui_event_modify_breakpoint (int number)
 {
-  tui_update_all_breakpoint_info ();
+  ;
 }
 
 static void
@@ -277,15 +331,6 @@
   tuiShowFrameInfo (selected_frame);
 }
 
-/* Called when the target process died or is detached.
-   Update the status line.  */
-static void
-tui_detach_hook (void)
-{
-  tuiShowFrameInfo (0);
-  tui_display_main ();
-}
-
 /* Install the TUI specific hooks.  */
 void
 tui_install_hooks (void)
@@ -301,7 +346,6 @@
 
   registers_changed_hook = tui_registers_changed_hook;
   register_changed_hook = tui_register_changed_hook;
-  detach_hook = tui_detach_hook;
 }
 
 /* Remove the TUI specific hooks.  */
@@ -314,7 +358,6 @@
   query_hook = 0;
   registers_changed_hook = 0;
   register_changed_hook = 0;
-  detach_hook = 0;
 
   /* Restore the previous event hooks.  */
   set_gdb_event_hooks (tui_old_event_hooks);
diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c
index 71ce5e0..a8cc58b 100644
--- a/gdb/tui/tui-out.c
+++ b/gdb/tui/tui-out.c
@@ -398,7 +398,7 @@
   data->stream = stream;
   data->suppress_output = 0;
   data->line = -1;
-  data->start_of_line = 0;
+  data->start_of_line = 1;
   return ui_out_new (&tui_ui_out_impl, data, flags);
 }
 
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 8bf467d..ab2c201 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -72,33 +72,7 @@
 int tui_active = 0;
 static int tui_finish_init = 1;
 
-enum tui_key_mode tui_current_key_mode = tui_command_mode;
-
-struct tui_char_command
-{
-  unsigned char key;
-  const char* cmd;
-};
-
-/* Key mapping to gdb commands when the TUI is using the single key mode.  */
-static const struct tui_char_command tui_commands[] = {
-  { 'c', "continue" },
-  { 'd', "down" },
-  { 'f', "finish" },
-  { 'n', "next" },
-  { 'r', "run" },
-  { 's', "step" },
-  { 'u', "up" },
-  { 'v', "info locals" },
-  { 'w', "where" },
-  { 0, 0 },
-};
-
-static Keymap tui_keymap;
-static Keymap tui_readline_standard_keymap;
-
-/* TUI readline command.
-   Switch the output mode between TUI/standard gdb.  */
+/* Switch the output mode between TUI/standard gdb.  */
 static int
 tui_rl_switch_mode (void)
 {
@@ -219,126 +193,19 @@
   return 0;
 }
 
-/* TUI readline command.
-   Execute the gdb command bound to the specified key.  */
-static int
-tui_rl_command_key (int count, int key)
-{
-  int i;
-
-  reinitialize_more_filter ();
-  for (i = 0; tui_commands[i].cmd; i++)
-    {
-      if (tui_commands[i].key == key)
-        {
-          /* Must save the command because it can be modified
-             by execute_command.  */
-          char* cmd = alloca (strlen (tui_commands[i].cmd) + 1);
-          strcpy (cmd, tui_commands[i].cmd);
-          execute_command (cmd, TRUE);
-          return 0;
-        }
-    }
-  return 0;
-}
-
-/* TUI readline command.
-   Temporarily leave the TUI SingleKey mode to allow editing
-   a gdb command with the normal readline.  Once the command
-   is executed, the TUI SingleKey mode is installed back.  */
-static int
-tui_rl_command_mode (int count, int key)
-{
-  tui_set_key_mode (tui_one_command_mode);
-  return rl_insert (count, key);
-}
-
-/* TUI readline command.
-   Switch between TUI SingleKey mode and gdb readline editing.  */
-static int
-tui_rl_next_keymap (void)
-{
-  tui_set_key_mode (tui_current_key_mode == tui_command_mode
-                    ? tui_single_key_mode : tui_command_mode);
-  return 0;
-}
-
-/* Readline hook to redisplay ourself the gdb prompt.
-   In the SingleKey mode, the prompt is not printed so that
-   the command window is cleaner.  It will be displayed if
-   we temporarily leave the SingleKey mode.  */
-static int
-tui_rl_startup_hook ()
-{
-  rl_already_prompted = 1;
-  if (tui_current_key_mode != tui_command_mode)
-    tui_set_key_mode (tui_single_key_mode);
-  tui_redisplay_readline ();
-  return 0;
-}
-
-/* Change the TUI key mode by installing the appropriate readline keymap.  */
-void
-tui_set_key_mode (enum tui_key_mode mode)
-{
-  tui_current_key_mode = mode;
-  rl_set_keymap (mode == tui_single_key_mode
-                 ? tui_keymap : tui_readline_standard_keymap);
-  tuiShowLocatorContent ();
-}
-
 /* Initialize readline and configure the keymap for the switching
    key shortcut.  */
 void
 tui_initialize_readline ()
 {
-  int i;
-  Keymap tui_ctlx_keymap;
-
   rl_initialize ();
 
   rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1);
-  rl_add_defun ("gdb-command", tui_rl_command_key, -1);
-  rl_add_defun ("next-keymap", tui_rl_next_keymap, -1);
-
-  tui_keymap = rl_make_bare_keymap ();
-  tui_ctlx_keymap = rl_make_bare_keymap ();
-  tui_readline_standard_keymap = rl_get_keymap ();
-
-  for (i = 0; tui_commands[i].cmd; i++)
-    rl_bind_key_in_map (tui_commands[i].key, tui_rl_command_key, tui_keymap);
-
-  rl_generic_bind (ISKMAP, "\\C-x", (char*) tui_ctlx_keymap, tui_keymap);
-
-  /* Bind all other keys to tui_rl_command_mode so that we switch
-     temporarily from SingleKey mode and can enter a gdb command.  */
-  for (i = ' ' + 1; i < 0x7f; i++)
-    {
-      int j;
-
-      for (j = 0; tui_commands[j].cmd; j++)
-        if (tui_commands[j].key == i)
-          break;
-
-      if (tui_commands[j].cmd)
-        continue;
-
-      rl_bind_key_in_map (i, tui_rl_command_mode, tui_keymap);
-    }
-
   rl_bind_key_in_map ('a', tui_rl_switch_mode, emacs_ctlx_keymap);
-  rl_bind_key_in_map ('a', tui_rl_switch_mode, tui_ctlx_keymap);
   rl_bind_key_in_map ('A', tui_rl_switch_mode, emacs_ctlx_keymap);
-  rl_bind_key_in_map ('A', tui_rl_switch_mode, tui_ctlx_keymap);
   rl_bind_key_in_map (CTRL ('A'), tui_rl_switch_mode, emacs_ctlx_keymap);
-  rl_bind_key_in_map (CTRL ('A'), tui_rl_switch_mode, tui_ctlx_keymap);
   rl_bind_key_in_map ('1', tui_rl_delete_other_windows, emacs_ctlx_keymap);
-  rl_bind_key_in_map ('1', tui_rl_delete_other_windows, tui_ctlx_keymap);
   rl_bind_key_in_map ('2', tui_rl_change_windows, emacs_ctlx_keymap);
-  rl_bind_key_in_map ('2', tui_rl_change_windows, tui_ctlx_keymap);
-  rl_bind_key_in_map ('q', tui_rl_next_keymap, tui_keymap);
-  rl_bind_key_in_map ('s', tui_rl_next_keymap, emacs_ctlx_keymap);
-  rl_bind_key_in_map ('s', tui_rl_next_keymap, tui_ctlx_keymap);
 }
 
 /* Enter in the tui mode (curses).
@@ -388,7 +255,6 @@
 
   /* Install the TUI specific hooks.  */
   tui_install_hooks ();
-  rl_startup_hook = tui_rl_startup_hook;
 
   tui_update_variables ();
   
@@ -418,8 +284,6 @@
 
   /* Remove TUI hooks.  */
   tui_remove_hooks ();
-  rl_startup_hook = 0;
-  rl_already_prompted = 0;
 
   /* Leave curses and restore previous gdb terminal setting.  */
   endwin ();
diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h
index ed66a4f..9cc538d 100644
--- a/gdb/tui/tui.h
+++ b/gdb/tui/tui.h
@@ -102,23 +102,6 @@
 /* Leave the tui mode.  */
 extern void tui_disable (void);
 
-enum tui_key_mode
-{
-  /* Plain command mode to enter gdb commands.  */
-  tui_command_mode,
-
-  /* SingleKey mode with some keys bound to gdb commands.  */
-  tui_single_key_mode,
-
-  /* Read/edit one command and return to SingleKey after it's processed.  */
-  tui_one_command_mode
-};
-
-extern enum tui_key_mode tui_current_key_mode;
-
-/* Change the TUI key mode by installing the appropriate readline keymap.  */
-extern void tui_set_key_mode (enum tui_key_mode mode);
-
 extern void tui_initialize_io (void);
 
 extern void tui_initialize_readline (void);
@@ -132,10 +115,21 @@
 
 extern struct ui_out *tui_out_new (struct ui_file *stream);
 
+/* tuiDataWin.c */
+extern void tui_vCheckDataValues (va_list);
+
+/* tuiIO.c */
+extern void tui_vStartNewLines (va_list);
+
 /* tuiLayout.c */
 extern TuiStatus tui_set_layout (const char *);
 
 /* tuiSourceWin.c */
 extern void tuiUpdateAllExecInfos (void);
+extern void tui_vAllSetHasBreakAt (va_list);
+extern void tui_vUpdateSourceWindowsWithAddr (va_list);
 
+/* tuiStack.c */
+extern void tui_vShowFrameInfo (va_list);
+extern void tui_vUpdateLocatorFilename (va_list);
 #endif /* TUI_H */
diff --git a/gdb/tui/tuiData.c b/gdb/tui/tuiData.c
index 225583e..45508e0 100644
--- a/gdb/tui/tuiData.c
+++ b/gdb/tui/tuiData.c
@@ -40,7 +40,6 @@
 #endif
 
 #include "defs.h"
-#include "symtab.h"
 #include "tui.h"
 #include "tuiData.h"
 #include "tuiGeneralWin.h"
@@ -51,10 +50,24 @@
 TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
 
 /***************************
+** Private Definitions
+****************************/
+#define FILE_WIDTH   30
+#define PROC_WIDTH   40
+#define LINE_WIDTH   4
+#define PC_WIDTH     8
+
+/***************************
 ** Private data
 ****************************/
+static char *_tuiNullStr = TUI_NULL_STR;
+static char *_tuiBlankStr = "   ";
+static char *_tuiLocationStr = "  >";
+static char *_tuiBreakStr = " * ";
+static char *_tuiBreakLocationStr = " *>";
 static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT;
 static int _termHeight, _termWidth;
+static int _historyLimit = DEFAULT_HISTORY_COUNT;
 static TuiGenWinInfo _locator;
 static TuiGenWinInfo _execInfo[2];
 static TuiWinInfoPtr _srcWinList[2];
@@ -273,6 +286,61 @@
 
 
 /*
+   ** blankStr()
+   **        Accessor for the blank string.
+ */
+char *
+blankStr (void)
+{
+  return _tuiBlankStr;
+}				/* blankStr */
+
+
+/*
+   ** locationStr()
+   **        Accessor for the location string.
+ */
+char *
+locationStr (void)
+{
+  return _tuiLocationStr;
+}				/* locationStr */
+
+
+/*
+   ** breakStr()
+   **        Accessor for the break string.
+ */
+char *
+breakStr (void)
+{
+  return _tuiBreakStr;
+}				/* breakStr */
+
+
+/*
+   ** breakLocationStr()
+   **        Accessor for the breakLocation string.
+ */
+char *
+breakLocationStr (void)
+{
+  return _tuiBreakLocationStr;
+}				/* breakLocationStr */
+
+
+/*
+   ** nullStr()
+   **        Accessor for the null string.
+ */
+char *
+nullStr (void)
+{
+  return _tuiNullStr;
+}				/* nullStr */
+
+
+/*
    ** sourceExecInfoPtr().
    **        Accessor for the source execution info ptr.
  */
@@ -307,6 +375,29 @@
 
 
 /*
+   ** historyLimit().
+   **        Accessor for the history limit
+ */
+int
+historyLimit (void)
+{
+  return _historyLimit;
+}				/* historyLimit */
+
+
+/*
+   ** setHistoryLimitTo().
+   **        Mutator for the history limit
+ */
+void
+setHistoryLimitTo (int h)
+{
+  _historyLimit = h;
+
+  return;
+}				/* setHistoryLimitTo */
+
+/*
    ** termHeight().
    **        Accessor for the termHeight
  */
@@ -458,7 +549,189 @@
     }
 
   return prev;
-}
+}				/* tuiPrevWin */
+
+
+/*
+   ** displayableWinContentOf().
+   **        Answer a the content at the location indicated by index.  Note
+   **        that if this is a locator window, the string returned should be
+   **        freed after use.
+ */
+char *
+displayableWinContentOf (TuiGenWinInfoPtr winInfo, TuiWinElementPtr elementPtr)
+{
+
+  char *string = nullStr ();
+
+  if (elementPtr != (TuiWinElementPtr) NULL || winInfo->type == LOCATOR_WIN)
+    {
+      /*
+         ** Now convert the line to a displayable string
+       */
+      switch (winInfo->type)
+	{
+	case SRC_WIN:
+	case DISASSEM_WIN:
+	  string = elementPtr->whichElement.source.line;
+	  break;
+	case CMD_WIN:
+	  string = elementPtr->whichElement.command.line;
+	  break;
+	case LOCATOR_WIN:
+	  if ((string = (char *) xmalloc (
+		      (termWidth () + 1) * sizeof (char))) == (char *) NULL)
+	      string = nullStr ();
+	  else
+	    {
+	      char lineNo[50], pc[50], buf[50], *fname, *pname;
+	      register int strSize = termWidth (), i, procWidth, fileWidth;
+
+	      /*
+	         ** First determine the amount of file/proc name width
+	         ** we have available
+	       */
+	      i = strSize - (PC_WIDTH + LINE_WIDTH
+			     + 25	/* pc and line labels */
+			     + strlen (FILE_PREFIX) + 1		/* file label */
+			     + 15 /* procedure label */ );
+	      if (i >= FILE_WIDTH + PROC_WIDTH)
+		{
+		  fileWidth = FILE_WIDTH;
+		  procWidth = PROC_WIDTH;
+		}
+	      else
+		{
+		  fileWidth = i / 2;
+		  procWidth = i - fileWidth;
+		}
+
+	      /* Now convert elements to string form */
+	      if (elementPtr != (TuiWinElementPtr) NULL &&
+		  *elementPtr->whichElement.locator.fileName != (char) 0 &&
+		  srcWin->generic.isVisible)
+		fname = elementPtr->whichElement.locator.fileName;
+	      else
+		fname = "??";
+	      if (elementPtr != (TuiWinElementPtr) NULL &&
+		  *elementPtr->whichElement.locator.procName != (char) 0)
+		pname = elementPtr->whichElement.locator.procName;
+	      else
+		pname = "??";
+	      if (elementPtr != (TuiWinElementPtr) NULL &&
+		  elementPtr->whichElement.locator.lineNo > 0)
+		sprintf (lineNo, "%d",
+			 elementPtr->whichElement.locator.lineNo);
+	      else
+		strcpy (lineNo, "??");
+	      if (elementPtr != (TuiWinElementPtr) NULL &&
+		  elementPtr->whichElement.locator.addr != 0)
+		sprintf (pc, "0x%lx",
+			 (long) elementPtr->whichElement.locator.addr);
+	      else
+		strcpy (pc, "??");
+	      /*
+	         ** Now create the locator line from the string version
+	         ** of the elements.  We could use sprintf() here but
+	         ** that wouldn't ensure that we don't overrun the size
+	         ** of the allocated buffer.  strcat_to_buf() will.
+	       */
+	      *string = (char) 0;
+	      /* Filename */
+	      strcat_to_buf (string, strSize, " ");
+	      strcat_to_buf (string, strSize, FILE_PREFIX);
+	      if (strlen (fname) > fileWidth)
+		{
+		  strncpy (buf, fname, fileWidth - 1);
+		  buf[fileWidth - 1] = '*';
+		  buf[fileWidth] = (char) 0;
+		}
+	      else
+		strcpy (buf, fname);
+	      strcat_to_buf (string, strSize, buf);
+	      /* procedure/class name */
+	      sprintf (buf, "%15s", PROC_PREFIX);
+	      strcat_to_buf (string, strSize, buf);
+	      if (strlen (pname) > procWidth)
+		{
+		  strncpy (buf, pname, procWidth - 1);
+		  buf[procWidth - 1] = '*';
+		  buf[procWidth] = (char) 0;
+		}
+	      else
+		strcpy (buf, pname);
+	      strcat_to_buf (string, strSize, buf);
+	      sprintf (buf, "%10s", LINE_PREFIX);
+	      strcat_to_buf (string, strSize, buf);
+	      strcat_to_buf (string, strSize, lineNo);
+	      sprintf (buf, "%10s", PC_PREFIX);
+	      strcat_to_buf (string, strSize, buf);
+	      strcat_to_buf (string, strSize, pc);
+	      for (i = strlen (string); i < strSize; i++)
+		string[i] = ' ';
+	      string[strSize] = (char) 0;
+	    }
+	  break;
+	case EXEC_INFO_WIN:
+	  string = elementPtr->whichElement.simpleString;
+	  break;
+	default:
+	  break;
+	}
+    }
+  return string;
+}				/* displayableWinContentOf */
+
+
+/*
+   **    winContentAt().
+   **        Answer a the content at the location indicated by index
+ */
+char *
+displayableWinContentAt (TuiGenWinInfoPtr winInfo, int index)
+{
+  return (displayableWinContentOf (winInfo, (TuiWinElementPtr) winInfo->content[index]));
+}				/* winContentAt */
+
+
+/*
+   ** winElementHeight().
+   **        Answer the height of the element in lines
+ */
+int
+winElementHeight (TuiGenWinInfoPtr winInfo, TuiWinElementPtr element)
+{
+  int h;
+
+  if (winInfo->type == DATA_WIN)
+/* FOR NOW SAY IT IS ONLY ONE LINE HIGH */
+    h = 1;
+  else
+    h = 1;
+
+  return h;
+}				/* winElementHeight */
+
+
+/*
+   **  winByName().
+   **      Answer the window represented by name
+ */
+TuiWinInfoPtr
+winByName (char *name)
+{
+  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
+  int i = 0;
+
+  while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
+    {
+      if (strcmp (name, winName (&(winList[i]->generic))) == 0)
+	winInfo = winList[i];
+      i++;
+    }
+
+  return winInfo;
+}				/* winByName */
 
 
 /*
@@ -615,8 +888,7 @@
       element->whichElement.locator.addr = 0;
       break;
     case EXEC_INFO_WIN:
-      memset(element->whichElement.simpleString, ' ',
-             sizeof(element->whichElement.simpleString));
+      element->whichElement.simpleString = blankStr ();
       break;
     default:
       break;
@@ -932,6 +1204,22 @@
 }				/* freeWinContent */
 
 
+/*
+   ** freeAllWindows().
+ */
+void
+freeAllWindows (void)
+{
+  TuiWinType type = SRC_WIN;
+
+  for (; type < MAX_MAJOR_WINDOWS; type++)
+    if (m_winPtrNotNull (winList[type]) &&
+	winList[type]->generic.type != UNDEFINED_WIN)
+      freeWindow (winList[type]);
+  return;
+}				/* freeAllWindows */
+
+
 void
 tuiDelDataWindows (TuiWinContent content, int contentSize)
 {
diff --git a/gdb/tui/tuiData.h b/gdb/tui/tuiData.h
index 8a4eb9f..36d7853 100644
--- a/gdb/tui/tuiData.h
+++ b/gdb/tui/tuiData.h
@@ -71,17 +71,10 @@
 #define MIN_WIN_HEIGHT                 3
 #define MIN_CMD_WIN_HEIGHT             3
 
-/* Strings to display in the TUI status line.  */
-#define PROC_PREFIX                    "In: "
+#define FILE_PREFIX                    "File: "
+#define PROC_PREFIX                    "Procedure: "
 #define LINE_PREFIX                    "Line: "
-#define PC_PREFIX                      "PC: "
-#define SINGLE_KEY                     "(SingleKey)"
-
-/* Minimum/Maximum length of some fields displayed in the TUI status line.  */
-#define MIN_LINE_WIDTH     4 /* Use at least 4 digits for line numbers.  */
-#define MIN_PROC_WIDTH    12
-#define MAX_TARGET_WIDTH  10
-#define MAX_PID_WIDTH     14
+#define PC_PREFIX                      "pc: "
 
 #define TUI_FLOAT_REGS_NAME                  "$FREGS"
 #define TUI_FLOAT_REGS_NAME_LOWER            "$fregs"
@@ -207,20 +200,6 @@
   }
 TuiLocatorElement, *TuiLocatorElementPtr;
 
-/* Flags to tell what kind of breakpoint is at current line.  */
-#define TUI_BP_ENABLED      0x01
-#define TUI_BP_DISABLED     0x02
-#define TUI_BP_HIT          0x04
-#define TUI_BP_CONDITIONAL  0x08
-#define TUI_BP_HARDWARE     0x10
-
-/* Position of breakpoint markers in the exec info string.  */
-#define TUI_BP_HIT_POS      0
-#define TUI_BP_BREAK_POS    1
-#define TUI_EXEC_POS        2
-#define TUI_EXECINFO_SIZE   4
-
-typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE];
 
 /* An content element in a window */
 typedef union
@@ -230,7 +209,7 @@
     TuiDataElement data;	/* elements of dataWindow */
     TuiCommandElement command;	/* command elements */
     TuiLocatorElement locator;	/* locator elements */
-    TuiExecInfoContent simpleString;	/* simple char based elements */
+    char *simpleString;		/* simple char based elements */
   }
 TuiWhichElement, *TuiWhichElementPtr;
 
@@ -346,23 +325,35 @@
 extern int addContentElements (TuiGenWinInfoPtr, int);
 extern void initContentElement (TuiWinElementPtr, TuiWinType);
 extern void freeWindow (TuiWinInfoPtr);
+extern void freeAllWindows (void);
 extern void freeWinContent (TuiGenWinInfoPtr);
 extern void freeDataContent (TuiWinContent, int);
 extern void freeAllSourceWinsContent (void);
 extern void tuiDelWindow (TuiWinInfoPtr);
 extern void tuiDelDataWindows (TuiWinContent, int);
+extern TuiWinInfoPtr winByName (char *);
 extern TuiWinInfoPtr partialWinByName (char *);
 extern char *winName (TuiGenWinInfoPtr);
+extern char *displayableWinContentOf (TuiGenWinInfoPtr, TuiWinElementPtr);
+extern char *displayableWinContentAt (TuiGenWinInfoPtr, int);
+extern int winElementHeight (TuiGenWinInfoPtr, TuiWinElementPtr);
 extern TuiLayoutType currentLayout (void);
 extern void setCurrentLayoutTo (TuiLayoutType);
 extern int termHeight (void);
 extern void setTermHeightTo (int);
 extern int termWidth (void);
 extern void setTermWidthTo (int);
+extern int historyLimit (void);
+extern void setHistoryLimit (int);
 extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int);
 extern TuiGenWinInfoPtr locatorWinInfoPtr (void);
 extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void);
 extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void);
+extern char *nullStr (void);
+extern char *blankStr (void);
+extern char *locationStr (void);
+extern char *breakStr (void);
+extern char *breakLocationStr (void);
 extern TuiListPtr sourceWindows (void);
 extern void clearSourceWindows (void);
 extern void clearSourceWindowsDetail (void);
diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c
index 01ebbe6..fe389af 100644
--- a/gdb/tui/tuiIO.c
+++ b/gdb/tui/tuiIO.c
@@ -44,7 +44,6 @@
 #include "terminal.h"
 #include "target.h"
 #include "event-loop.h"
-#include "event-top.h"
 #include "command.h"
 #include "top.h"
 #include "readline/readline.h"
@@ -80,24 +79,14 @@
    is as if TUI is not used.  Readline also uses its original getc()
    function with stdin.
 
-   Note SCz/2001-07-21: the current readline is not clean in its management of
-   the output.  Even if we install a redisplay handler, it sometimes writes on
-   a stdout file.  It is important to redirect every output produced by
-   readline, otherwise the curses window will be garbled.  This is implemented
-   with a pipe that TUI reads and readline writes to.  A gdb input handler
+   Note: the current readline is not clean in its management of the output.
+   Even if we install a redisplay handler, it sometimes writes on a stdout
+   file.  It is important to redirect every output produced by readline,
+   otherwise the curses window will be garbled.  This is implemented with
+   a pipe that TUI reads and readline writes to.  A gdb input handler
    is created so that reading the pipe is handled automatically.
    This will probably not work on non-Unix platforms.  The best fix is
-   to make readline clean enougth so that is never write on stdout.
-
-   Note SCz/2002-09-01: we now use more readline hooks and it seems that
-   with them we don't need the pipe anymore (verified by creating the pipe
-   and closing its end so that write causes a SIGPIPE).  The old pipe code
-   is still there and can be conditionally removed by
-   #undef TUI_USE_PIPE_FOR_READLINE.  */
-
-/* For gdb 5.3, prefer to continue the pipe hack as a backup wheel.  */
-#define TUI_USE_PIPE_FOR_READLINE
-/*#undef TUI_USE_PIPE_FOR_READLINE*/
+   to make readline clean enougth so that is never write on stdout.  */
 
 /* TUI output files.  */
 static struct ui_file *tui_stdout;
@@ -120,21 +109,10 @@
    Should be removed when readline is clean.  */
 static FILE *tui_rl_outstream;
 static FILE *tui_old_rl_outstream;
-#ifdef TUI_USE_PIPE_FOR_READLINE
 static int tui_readline_pipe[2];
-#endif
 
 static unsigned int _tuiHandleResizeDuringIO (unsigned int);
 
-static void
-tui_putc (char c)
-{
-  char buf[2];
-
-  buf[0] = c;
-  buf[1] = 0;
-  tui_puts (buf);
-}
 
 /* Print the string in the curses command window.  */
 void
@@ -173,7 +151,7 @@
 /* Readline callback.
    Redisplay the command line with its prompt after readline has
    changed the edited text.  */
-void
+static void
 tui_redisplay_readline (void)
 {
   int prev_col;
@@ -186,10 +164,7 @@
   char *prompt;
   int start_line;
   
-  if (tui_current_key_mode == tui_single_key_mode)
-    prompt = "";
-  else
-    prompt = get_prompt ();
+  prompt = get_prompt ();
   
   c_pos = -1;
   c_line = -1;
@@ -264,7 +239,6 @@
 {
 }
 
-#ifdef TUI_USE_PIPE_FOR_READLINE
 /* Read readline output pipe and feed the command window with it.
    Should be removed when readline is clean.  */
 static void
@@ -280,193 +254,6 @@
       tui_puts (buf);
     }
 }
-#endif
-
-/* Return the portion of PATHNAME that should be output when listing
-   possible completions.  If we are hacking filename completion, we
-   are only interested in the basename, the portion following the
-   final slash.  Otherwise, we return what we were passed.
-
-   Comes from readline/complete.c  */
-static char *
-printable_part (pathname)
-     char *pathname;
-{
-  char *temp;
-
-  temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
-#if defined (__MSDOS__)
-  if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':')
-    temp = pathname + 1;
-#endif
-  return (temp ? ++temp : pathname);
-}
-
-/* Output TO_PRINT to rl_outstream.  If VISIBLE_STATS is defined and we
-   are using it, check for and output a single character for `special'
-   filenames.  Return the number of characters we output. */
-
-#define PUTX(c) \
-    do { \
-      if (CTRL_CHAR (c)) \
-        { \
-          tui_puts ("^"); \
-          tui_putc (UNCTRL (c)); \
-          printed_len += 2; \
-        } \
-      else if (c == RUBOUT) \
-	{ \
-	  tui_puts ("^?"); \
-	  printed_len += 2; \
-	} \
-      else \
-	{ \
-	  tui_putc (c); \
-	  printed_len++; \
-	} \
-    } while (0)
-
-static int
-print_filename (to_print, full_pathname)
-     char *to_print, *full_pathname;
-{
-  int printed_len = 0;
-  char *s;
-
-  for (s = to_print; *s; s++)
-    {
-      PUTX (*s);
-    }
-  return printed_len;
-}
-
-/* The user must press "y" or "n".  Non-zero return means "y" pressed.
-   Comes from readline/complete.c  */
-static int
-get_y_or_n ()
-{
-  extern int _rl_abort_internal ();
-  int c;
-
-  for (;;)
-    {
-      c = rl_read_key ();
-      if (c == 'y' || c == 'Y' || c == ' ')
-	return (1);
-      if (c == 'n' || c == 'N' || c == RUBOUT)
-	return (0);
-      if (c == ABORT_CHAR)
-	_rl_abort_internal ();
-      beep ();
-    }
-}
-
-/* A convenience function for displaying a list of strings in
-   columnar format on readline's output stream.  MATCHES is the list
-   of strings, in argv format, LEN is the number of strings in MATCHES,
-   and MAX is the length of the longest string in MATCHES.
-
-   Comes from readline/complete.c and modified to write in
-   the TUI command window using tui_putc/tui_puts.  */
-static void
-tui_rl_display_match_list (matches, len, max)
-     char **matches;
-     int len, max;
-{
-  typedef int QSFUNC (const void *, const void *);
-  extern int _rl_qsort_string_compare (const void*, const void*);
-  extern int _rl_print_completions_horizontally;
-  
-  int count, limit, printed_len;
-  int i, j, k, l;
-  char *temp;
-
-  /* Screen dimension correspond to the TUI command window.  */
-  int screenwidth = cmdWin->generic.width;
-
-  /* If there are many items, then ask the user if she really wants to
-     see them all. */
-  if (len >= rl_completion_query_items)
-    {
-      char msg[256];
-
-      sprintf (msg, "\nDisplay all %d possibilities? (y or n)", len);
-      tui_puts (msg);
-      if (get_y_or_n () == 0)
-	{
-	  tui_puts ("\n");
-	  return;
-	}
-    }
-
-  /* How many items of MAX length can we fit in the screen window? */
-  max += 2;
-  limit = screenwidth / max;
-  if (limit != 1 && (limit * max == screenwidth))
-    limit--;
-
-  /* Avoid a possible floating exception.  If max > screenwidth,
-     limit will be 0 and a divide-by-zero fault will result. */
-  if (limit == 0)
-    limit = 1;
-
-  /* How many iterations of the printing loop? */
-  count = (len + (limit - 1)) / limit;
-
-  /* Watch out for special case.  If LEN is less than LIMIT, then
-     just do the inner printing loop.
-	   0 < len <= limit  implies  count = 1. */
-
-  /* Sort the items if they are not already sorted. */
-  if (rl_ignore_completion_duplicates == 0)
-    qsort (matches + 1, len, sizeof (char *),
-           (QSFUNC *)_rl_qsort_string_compare);
-
-  tui_putc ('\n');
-
-  if (_rl_print_completions_horizontally == 0)
-    {
-      /* Print the sorted items, up-and-down alphabetically, like ls. */
-      for (i = 1; i <= count; i++)
-	{
-	  for (j = 0, l = i; j < limit; j++)
-	    {
-	      if (l > len || matches[l] == 0)
-		break;
-	      else
-		{
-		  temp = printable_part (matches[l]);
-		  printed_len = print_filename (temp, matches[l]);
-
-		  if (j + 1 < limit)
-		    for (k = 0; k < max - printed_len; k++)
-		      tui_putc (' ');
-		}
-	      l += count;
-	    }
-	  tui_putc ('\n');
-	}
-    }
-  else
-    {
-      /* Print the sorted items, across alphabetically, like ls -x. */
-      for (i = 1; matches[i]; i++)
-	{
-	  temp = printable_part (matches[i]);
-	  printed_len = print_filename (temp, matches[i]);
-	  /* Have we reached the end of this line? */
-	  if (matches[i+1])
-	    {
-	      if (i && (limit > 1) && (i % limit) == 0)
-		tui_putc ('\n');
-	      else
-		for (k = 0; k < max - printed_len; k++)
-		  tui_putc (' ');
-	    }
-	}
-      tui_putc ('\n');
-    }
-}
 
 /* Setup the IO for curses or non-curses mode.
    - In non-curses mode, readline and gdb use the standard input and
@@ -497,8 +284,6 @@
       readline_echoing_p = 0;
       rl_outstream = tui_rl_outstream;
       rl_prompt = 0;
-      rl_completion_display_matches_hook = tui_rl_display_match_list;
-      rl_already_prompted = 0;
 
       /* Keep track of previous gdb output.  */
       tui_old_stdout = gdb_stdout;
@@ -530,9 +315,7 @@
       rl_prep_term_function = tui_old_rl_prep_terminal;
       rl_getc_function = tui_old_rl_getc_function;
       rl_outstream = tui_old_rl_outstream;
-      rl_completion_display_matches_hook = 0;
       readline_echoing_p = tui_old_readline_echoing_p;
-      rl_already_prompted = 1;
 
       /* Save tty for SIGCONT.  */
       savetty ();
@@ -580,7 +363,6 @@
      a init_ui_hook.  */
   uiout = cli_out_new (gdb_stdout);
 
-#ifdef TUI_USE_PIPE_FOR_READLINE
   /* Temporary solution for readline writing to stdout:
      redirect readline output in a pipe, read that pipe and
      output the content in the curses command window.  */
@@ -604,10 +386,8 @@
   (void) fcntl (tui_readline_pipe[0], F_SETFL, O_NDELAY);
 #endif
 #endif
+
   add_file_handler (tui_readline_pipe[0], tui_readline_output, 0);
-#else
-  tui_rl_outstream = stdout;
-#endif
 }
 
 /* Get a character from the command window.  This is called from the readline
@@ -620,11 +400,9 @@
 
   w = cmdWin->generic.handle;
 
-#ifdef TUI_USE_PIPE_FOR_READLINE
   /* Flush readline output.  */
   tui_readline_output (GDB_READABLE, 0);
-#endif
-
+  
   ch = wgetch (w);
   ch = _tuiHandleResizeDuringIO (ch);
 
diff --git a/gdb/tui/tuiIO.h b/gdb/tui/tuiIO.h
index 49c26fd..2ad92ce 100644
--- a/gdb/tui/tuiIO.h
+++ b/gdb/tui/tuiIO.h
@@ -1,5 +1,5 @@
 /* TUI support I/O functions.
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Hewlett-Packard Company.
 
    This file is part of GDB.
@@ -36,11 +36,6 @@
 /* Get a character from the command window.  */
 extern int tui_getc (FILE*);
 
-/* Readline callback.
-   Redisplay the command line with its prompt after readline has
-   changed the edited text.  */
-extern void tui_redisplay_readline (void);
-
 
 #define m_tuiStartNewLine       tuiStartNewLines(1)
 #define m_isStartSequence(ch)   (ch == 27)
diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c
index 0d59bf0..f844b36 100644
--- a/gdb/tui/tuiSource.c
+++ b/gdb/tui/tuiSource.c
@@ -54,7 +54,17 @@
 #include "tuiSource.h"
 
 
-/* Function to display source in the source window.  */
+/*****************************************
+** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
+******************************************/
+
+static struct breakpoint *_hasBreak (char *, int);
+
+
+/*
+   ** tuiSetSourceContent().
+   **    Function to display source in the source window.
+ */
 TuiStatus
 tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
 {
@@ -69,8 +79,10 @@
       if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS)
 	{
 	  lineWidth = srcWin->generic.width - 1;
-	  /* Take hilite (window border) into account, when calculating
-	     the number of lines  */
+	  /*
+	     ** Take hilite (window border) into account, when calculating
+	     ** the number of lines
+	   */
 	  nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo;
 	  desc = open_source_file (s);
 	  if (desc < 0)
@@ -129,6 +141,7 @@
 		    {
 		      TuiWinElementPtr element = (TuiWinElementPtr)
 		      srcWin->generic.content[curLine];
+		      struct breakpoint *bp;
 
 		      /* get the first character in the line */
 		      c = fgetc (stream);
@@ -150,8 +163,10 @@
 			}
 		      srcLine[curLen] = (char) 0;
 
-		      /* Set whether element is the execution point and
-		         whether there is a break point on it.  */
+		      /*
+		         ** Set whether element is the execution point and
+		         ** whether there is a break point on it.
+		       */
 		      element->whichElement.source.lineOrAddr.lineNo =
 			curLineNo;
 		      element->whichElement.source.isExecPoint =
@@ -160,6 +175,11 @@
 				 s->filename) == 0
 			 && curLineNo == ((TuiWinElementPtr)
 			 locator->content[0])->whichElement.locator.lineNo);
+		      bp = _hasBreak (s->filename, curLineNo);
+		      element->whichElement.source.hasBreak =
+			(bp != (struct breakpoint *) NULL &&
+			 (!element->whichElement.source.isExecPoint ||
+			  (bp->disposition != disp_del || bp->hit_count <= 0)));
 		      if (c != EOF)
 			{
 			  i = strlen (srcLine) - 1;
@@ -179,11 +199,13 @@
 				      srcLine[i] = '?';
 				    }
 				  else
-				    {	/* Store the charcter in the line
-					   buffer.  If it is a tab, then
-					   translate to the correct number of
-					   chars so we don't overwrite our
-					   buffer.  */
+				    {	/*
+					   ** Store the charcter in the line
+					   ** buffer.  If it is a tab, then
+					   ** translate to the correct number of
+					   ** chars so we don't overwrite our
+					   ** buffer.
+					 */
 				      if (c == '\t')
 					{
 					  int j, maxTabLen = tuiDefaultTabLen ();
@@ -202,8 +224,10 @@
 				  srcLine[i + 1] = 0;
 				}
 			      else
-				{	/* If we have not reached EOL, then eat
-                                           chars until we do  */
+				{	/*
+					   ** if we have not reached EOL, then eat
+					   ** chars until we do
+					 */
 				  while (c != EOF && c != '\n' && c != '\r')
 				    c = fgetc (stream);
 				}
@@ -233,7 +257,7 @@
 	}
     }
   return ret;
-}
+}				/* tuiSetSourceContent */
 
 
 /* elz: this function sets the contents of the source window to empty
@@ -304,30 +328,44 @@
       curr_line++;
 
     }				/* end while */
-}
+
+}				/*tuiSetSourceContentNil */
 
 
-/* Function to display source in the source window.  This function
-   initializes the horizontal scroll to 0.  */
+
+
+/*
+   ** tuiShowSource().
+   **        Function to display source in the source window.  This function
+   **        initializes the horizontal scroll to 0.
+ */
 void
 tuiShowSource (struct symtab *s, TuiLineOrAddress line, int noerror)
 {
   srcWin->detail.sourceInfo.horizontalOffset = 0;
   tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror);
-}
+
+  return;
+}				/* tuiShowSource */
 
 
-/* Answer whether the source is currently displayed in the source window.  */
+/*
+   ** tuiSourceIsDisplayed().
+   **        Answer whether the source is currently displayed in the source window.
+ */
 int
 tuiSourceIsDisplayed (char *fname)
 {
   return (srcWin->generic.contentInUse &&
 	  (strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())->
 		  content[0])->whichElement.locator.fileName, fname) == 0));
-}
+}				/* tuiSourceIsDisplayed */
 
 
-/* Scroll the source forward or backward vertically.  */
+/*
+   ** tuiVerticalSourceScroll().
+   **      Scroll the source forward or backward vertically
+ */
 void
 tuiVerticalSourceScroll (TuiScrollDirection scrollDirection,
                          int numToScroll)
@@ -359,7 +397,39 @@
 	  if (l.lineNo <= 0)
 	    l.lineNo = 1;
 	}
-
-      print_source_lines (s, l.lineNo, l.lineNo + 1, 0);
+      if (identify_source_line (s, l.lineNo, 0, -1) == 1)
+        tuiUpdateSourceWindowAsIs (srcWin, s, l, FALSE);
     }
-}
+
+  return;
+}				/* tuiVerticalSourceScroll */
+
+
+/*****************************************
+** STATIC LOCAL FUNCTIONS                 **
+******************************************/
+
+/*
+   ** _hasBreak().
+   **        Answer whether there is a break point at the input line in
+   **        the source file indicated
+ */
+static struct breakpoint *
+_hasBreak (char *sourceFileName, int lineNo)
+{
+  struct breakpoint *bpWithBreak = (struct breakpoint *) NULL;
+  struct breakpoint *bp;
+  extern struct breakpoint *breakpoint_chain;
+
+
+  for (bp = breakpoint_chain;
+       (bp != (struct breakpoint *) NULL &&
+	bpWithBreak == (struct breakpoint *) NULL);
+       bp = bp->next)
+    if (bp->source_file
+	&& (strcmp (sourceFileName, bp->source_file) == 0)
+	&& (lineNo == bp->line_number))
+      bpWithBreak = bp;
+
+  return bpWithBreak;
+}				/* _hasBreak */
diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c
index 696b8b2..b2ce594 100644
--- a/gdb/tui/tuiSourceWin.c
+++ b/gdb/tui/tuiSourceWin.c
@@ -120,7 +120,7 @@
     }
   else
     {
-      tui_update_breakpoint_info (winInfo, 0);
+      tuiEraseSourceContent (winInfo, NO_EMPTY_SOURCE_PROMPT);
       tuiShowSourceContent (winInfo);
       tuiUpdateExecInfo (winInfo);
       if (winInfo->generic.type == SRC_WIN)
@@ -375,114 +375,90 @@
 }				/* tuiHorizontalSourceScroll */
 
 
-/* Set or clear the hasBreak flag in the line whose line is lineNo.  */
+/*
+   ** tuiSetHasExecPointAt().
+   **        Set or clear the hasBreak flag in the line whose line is lineNo.
+ */
 void
 tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo)
 {
-  int changed = 0;
   int i;
   TuiWinContent content = (TuiWinContent) winInfo->generic.content;
 
   i = 0;
   while (i < winInfo->generic.contentSize)
     {
-      int newState;
-
       if (content[i]->whichElement.source.lineOrAddr.addr == l.addr)
-        newState = TRUE;
+	content[i]->whichElement.source.isExecPoint = TRUE;
       else
-	newState = FALSE;
-      if (newState != content[i]->whichElement.source.isExecPoint)
-        {
-          changed++;
-          content[i]->whichElement.source.isExecPoint = newState;
-          tui_show_source_line (winInfo, i + 1);
-        }
+	content[i]->whichElement.source.isExecPoint = FALSE;
       i++;
     }
-  if (changed)
-    tuiRefreshWin (&winInfo->generic);
-}
 
-/* Update the execution windows to show the active breakpoints.
-   This is called whenever a breakpoint is inserted, removed or
-   has its state changed.  */
+  return;
+}				/* tuiSetIsExecPointAt */
+
+/*
+   ** tuiSetHasBreakAt().
+   **        Set or clear the hasBreak flag in the line whose line is lineNo.
+ */
 void
-tui_update_all_breakpoint_info ()
-{
-  TuiList* list = sourceWindows ();
-  int i;
-
-  for (i = 0; i < list->count; i++)
-    {
-      TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i];
-
-      if (tui_update_breakpoint_info (win, FALSE))
-        {
-          tuiUpdateExecInfo (win);
-        }
-    }
-}
-
-
-/* Scan the source window and the breakpoints to update the
-   hasBreak information for each line.
-   Returns 1 if something changed and the execution window
-   must be refreshed.  */
-int
-tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
+tuiSetHasBreakAt (struct breakpoint *bp, TuiWinInfoPtr winInfo, int hasBreak)
 {
   int i;
-  int need_refresh = 0;
-  TuiSourceInfoPtr src = &win->detail.sourceInfo;
+  TuiWinContent content = (TuiWinContent) winInfo->generic.content;
 
-  for (i = 0; i < win->generic.contentSize; i++)
+  i = 0;
+  while (i < winInfo->generic.contentSize)
     {
-      struct breakpoint *bp;
-      extern struct breakpoint *breakpoint_chain;
-      int mode;
-      TuiSourceElement* line;
+      int gotIt;
+      TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
 
-      line = &((TuiWinElementPtr) win->generic.content[i])->whichElement.source;
-      if (current_only && !line->isExecPoint)
-         continue;
+      if (winInfo == srcWin)
+	{
+          TuiSourceInfoPtr src = &winInfo->detail.sourceInfo;
 
-      /* Scan each breakpoint to see if the current line has something to
-         do with it.  Identify enable/disabled breakpoints as well as
-         those that we already hit.  */
-      mode = 0;
-      for (bp = breakpoint_chain;
-           bp != (struct breakpoint *) NULL;
-           bp = bp->next)
-        {
-          if ((win == srcWin
-               && bp->source_file
-               && (strcmp (src->filename, bp->source_file) == 0)
-               && bp->line_number == line->lineOrAddr.lineNo)
-              || (win == disassemWin
-                  && bp->address == line->lineOrAddr.addr))
-            {
-              if (bp->enable_state == bp_disabled)
-                mode |= TUI_BP_DISABLED;
-              else
-                mode |= TUI_BP_ENABLED;
-              if (bp->hit_count)
-                mode |= TUI_BP_HIT;
-              if (bp->cond)
-                mode |= TUI_BP_CONDITIONAL;
-              if (bp->type == bp_hardware_breakpoint)
-                mode |= TUI_BP_HARDWARE;
-            }
-        }
-      if (line->hasBreak != mode)
-        {
-          line->hasBreak = mode;
-          need_refresh = 1;
-        }
+	  gotIt = (src->filename != (char *) NULL &&
+                   bp->source_file != NULL &&
+		   (strcmp (bp->source_file, src->filename) == 0) &&
+		   content[i]->whichElement.source.lineOrAddr.lineNo ==
+		   bp->line_number);
+	}
+      else
+	gotIt = (content[i]->whichElement.source.lineOrAddr.addr
+		 == bp->address);
+      if (gotIt)
+	{
+	  content[i]->whichElement.source.hasBreak = hasBreak;
+	  break;
+	}
+      i++;
     }
-  return need_refresh;
-}
 
+  return;
+}				/* tuiSetHasBreakAt */
+
+
+/*
+   ** tuiAllSetHasBreakAt().
+   **        Set or clear the hasBreak flag in all displayed source windows.
+ */
+void
+tuiAllSetHasBreakAt (struct breakpoint *bp, int hasBreak)
+{
+  int i;
+
+  for (i = 0; i < (sourceWindows ())->count; i++)
+    tuiSetHasBreakAt (bp,
+		      (TuiWinInfoPtr) (sourceWindows ())->list[i], hasBreak);
+
+  return;
+}				/* tuiAllSetHasBreakAt */
+
+
+/*********************************
+** EXECUTION INFO FUNCTIONS        **
+*********************************/
 
 /*
    ** tuiSetExecInfoContent().
@@ -507,37 +483,56 @@
 	{
 	  int i;
 
-          tui_update_breakpoint_info (winInfo, 1);
 	  for (i = 0; i < winInfo->generic.contentSize; i++)
 	    {
 	      TuiWinElementPtr element;
 	      TuiWinElementPtr srcElement;
-              int mode;
 
 	      element = (TuiWinElementPtr) execInfoPtr->content[i];
 	      srcElement = (TuiWinElementPtr) winInfo->generic.content[i];
+	      /*
+	         ** First check to see if we have a breakpoint that is
+	         ** temporary.  If so, and this is our current execution point,
+	         ** then clear the break indicator.
+	       */
+	      if (srcElement->whichElement.source.hasBreak &&
+		  srcElement->whichElement.source.isExecPoint)
+		{
+		  struct breakpoint *bp;
+		  int found = FALSE;
+		  extern struct breakpoint *breakpoint_chain;
 
-              memset(element->whichElement.simpleString, ' ',
-                     sizeof(element->whichElement.simpleString));
-              element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0;
-
-	      /* Now update the exec info content based upon the state
-                 of each line as indicated by the source content.  */
-              mode = srcElement->whichElement.source.hasBreak;
-              if (mode & TUI_BP_HIT)
-                element->whichElement.simpleString[TUI_BP_HIT_POS] =
-                  (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
-              else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
-                element->whichElement.simpleString[TUI_BP_HIT_POS] =
-                  (mode & TUI_BP_HARDWARE) ? 'h' : 'b';
-
-              if (mode & TUI_BP_ENABLED)
-                element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+';
-              else if (mode & TUI_BP_DISABLED)
-                element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-';
-
-              if (srcElement->whichElement.source.isExecPoint)
-                element->whichElement.simpleString[TUI_EXEC_POS] = '>';
+		  for (bp = breakpoint_chain;
+		       (bp != (struct breakpoint *) NULL && !found);
+		       bp = bp->next)
+		    {
+		      found =
+			(winInfo == srcWin &&
+			 bp->line_number ==
+		       srcElement->whichElement.source.lineOrAddr.lineNo) ||
+			(winInfo == disassemWin &&
+			 bp->address == (CORE_ADDR)
+			 srcElement->whichElement.source.lineOrAddr.addr);
+		      if (found)
+			srcElement->whichElement.source.hasBreak =
+			  (bp->disposition != disp_del || bp->hit_count <= 0);
+		    }
+		  if (!found)
+		    srcElement->whichElement.source.hasBreak = FALSE;
+		}
+	      /*
+	         ** Now update the exec info content based upon the state
+	         ** of each line as indicated by the source content.
+	       */
+	      if (srcElement->whichElement.source.hasBreak &&
+		  srcElement->whichElement.source.isExecPoint)
+		element->whichElement.simpleString = breakLocationStr ();
+	      else if (srcElement->whichElement.source.hasBreak)
+		element->whichElement.simpleString = breakStr ();
+	      else if (srcElement->whichElement.source.isExecPoint)
+		element->whichElement.simpleString = locationStr ();
+	      else
+		element->whichElement.simpleString = blankStr ();
 	    }
 	  execInfoPtr->contentSize = winInfo->generic.contentSize;
 	}
@@ -546,7 +541,7 @@
     }
 
   return ret;
-}
+}				/* tuiSetExecInfoContent */
 
 
 /*
@@ -610,6 +605,21 @@
   tuiShowExecInfoContent (winInfo);
 }				/* tuiUpdateExecInfo */
 
+
+				   /*
+				   ** tuiUpdateAllExecInfos()
+				 */
+void
+tuiUpdateAllExecInfos (void)
+{
+  int i;
+
+  for (i = 0; i < (sourceWindows ())->count; i++)
+    tuiUpdateExecInfo ((TuiWinInfoPtr) (sourceWindows ())->list[i]);
+
+  return;
+}				/* tuiUpdateAllExecInfos */
+
 TuiStatus
 tuiAllocSourceBuffer (TuiWinInfoPtr winInfo)
 {
diff --git a/gdb/tui/tuiSourceWin.h b/gdb/tui/tuiSourceWin.h
index cb00449..803cb90 100644
--- a/gdb/tui/tuiSourceWin.h
+++ b/gdb/tui/tuiSourceWin.h
@@ -22,17 +22,6 @@
 #ifndef _TUI_SOURCEWIN_H
 #define _TUI_SOURCEWIN_H
 
-/* Update the execution windows to show the active breakpoints.
-   This is called whenever a breakpoint is inserted, removed or
-   has its state changed.  */
-extern void tui_update_all_breakpoint_info (void);
-
-/* Scan the source window and the breakpoints to update the
-   hasBreak information for each line.
-   Returns 1 if something changed and the execution window
-   must be refreshed.  */
-extern int tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only);
-
 /* Function to display the "main" routine.  */
 extern void tui_display_main (void);
 extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress,
@@ -41,6 +30,7 @@
 				       int);
 extern void tuiUpdateSourceWindowsWithAddr (CORE_ADDR);
 extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int);
+extern void tuiUpdateSourceWindowsFromLocator (void);
 extern void tuiClearSourceContent (TuiWinInfoPtr, int);
 extern void tuiEraseSourceContent (TuiWinInfoPtr, int);
 extern void tuiSetSourceContentNil (TuiWinInfoPtr, char *);
@@ -50,10 +40,15 @@
 extern TuiStatus tuiSetExecInfoContent (TuiWinInfoPtr);
 extern void tuiShowExecInfoContent (TuiWinInfoPtr);
 extern void tuiEraseExecInfoContent (TuiWinInfoPtr);
+extern void tuiEraseAllExecInfosContent (void);
 extern void tuiClearExecInfoContent (TuiWinInfoPtr);
+extern void tuiClearAllExecInfosContent (void);
 extern void tuiUpdateExecInfo (TuiWinInfoPtr);
+extern void tuiUpdateAllExecInfos (void);
 
 extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr);
+extern void tuiSetHasBreakAt (struct breakpoint *, TuiWinInfoPtr, int);
+extern void tuiAllSetHasBreakAt (struct breakpoint *, int);
 extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr);
 extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int);
 extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int);
diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c
index 10bd259..d3f0404 100644
--- a/gdb/tui/tuiStack.c
+++ b/gdb/tui/tuiStack.c
@@ -44,8 +44,6 @@
 #include "breakpoint.h"
 #include "frame.h"
 #include "command.h"
-#include "inferior.h"
-#include "target.h"
 #include "top.h"
 
 #include "tui.h"
@@ -72,154 +70,6 @@
 static void tui_update_command (char *, int);
 
 
-/* Create the status line to display as much information as we
-   can on this single line: target name, process number, current
-   function, current line, current PC, SingleKey mode.  */
-static char*
-tui_make_status_line (TuiLocatorElement* loc)
-{
-  char* string;
-  char line_buf[50], buf[50], *pname;
-  int status_size = termWidth ();
-  int i, proc_width;
-  const char* pid_name;
-  const char* pc_buf;
-  int target_width;
-  int pid_width;
-  int line_width;
-  int pc_width;
-  struct ui_file *pc_out;
-
-  if (ptid_equal (inferior_ptid, null_ptid))
-    pid_name = "No process";
-  else
-    pid_name = target_pid_to_str (inferior_ptid);
-
-  target_width = strlen (target_shortname);
-  if (target_width > MAX_TARGET_WIDTH)
-    target_width = MAX_TARGET_WIDTH;
-
-  pid_width = strlen (pid_name);
-  if (pid_width > MAX_PID_WIDTH)
-    pid_width = MAX_PID_WIDTH;
-  
-  string = (char *) xmalloc (status_size + 1);
-
-  /* Translate line number and obtain its size.  */
-  if (loc->lineNo > 0)
-    sprintf (line_buf, "%d", loc->lineNo);
-  else
-    strcpy (line_buf, "??");
-  line_width = strlen (line_buf);
-  if (line_width < MIN_LINE_WIDTH)
-    line_width = MIN_LINE_WIDTH;
-
-  /* Translate PC address.  */
-  pc_out = tui_sfileopen (128);
-  print_address_numeric (loc->addr, 1, pc_out);
-  pc_buf = tui_file_get_strbuf (pc_out);
-  pc_width = strlen (pc_buf);
-  
-  /* First determine the amount of proc name width we have available.
-     The +1 are for a space separator between fields.
-     The -1 are to take into account the \0 counted by sizeof.  */
-  proc_width = (status_size
-                - (target_width + 1)
-                - (pid_width + 1)
-                - (sizeof (PROC_PREFIX) - 1 + 1)
-                - (sizeof (LINE_PREFIX) - 1 + line_width + 1)
-                - (sizeof (PC_PREFIX) - 1 + pc_width + 1)
-                - (tui_current_key_mode == tui_single_key_mode
-                   ? (sizeof (SINGLE_KEY) - 1 + 1)
-                   : 0));
-
-  /* If there is no room to print the function name, try by removing
-     some fields.  */
-  if (proc_width < MIN_PROC_WIDTH)
-    {
-      proc_width += target_width + 1;
-      target_width = 0;
-      if (proc_width < MIN_PROC_WIDTH)
-        {
-          proc_width += pid_width + 1;
-          pid_width = 0;
-          if (proc_width <= MIN_PROC_WIDTH)
-            {
-              proc_width += pc_width + sizeof (PC_PREFIX) - 1 + 1;
-              pc_width = 0;
-              if (proc_width < 0)
-                {
-                  proc_width += line_width + sizeof (LINE_PREFIX) - 1 + 1;
-                  line_width = 0;
-                  if (proc_width < 0)
-                    proc_width = 0;
-                }
-            }
-        }
-    }
-
-  /* Now convert elements to string form */
-  pname = loc->procName;
-
-  /* Now create the locator line from the string version
-     of the elements.  We could use sprintf() here but
-     that wouldn't ensure that we don't overrun the size
-     of the allocated buffer.  strcat_to_buf() will.  */
-  *string = (char) 0;
-
-  if (target_width > 0)
-    {
-      sprintf (buf, "%*.*s ",
-               -target_width, target_width, target_shortname);
-      strcat_to_buf (string, status_size, buf);
-    }
-  if (pid_width > 0)
-    {
-      sprintf (buf, "%*.*s ",
-               -pid_width, pid_width, pid_name);
-      strcat_to_buf (string, status_size, buf);
-    }
-  
-  /* Show whether we are in SingleKey mode.  */
-  if (tui_current_key_mode == tui_single_key_mode)
-    {
-      strcat_to_buf (string, status_size, SINGLE_KEY);
-      strcat_to_buf (string, status_size, " ");
-    }
-
-  /* procedure/class name */
-  if (proc_width > 0)
-    {
-      if (strlen (pname) > proc_width)
-        sprintf (buf, "%s%*.*s* ", PROC_PREFIX,
-                 1 - proc_width, proc_width - 1, pname);
-      else
-        sprintf (buf, "%s%*.*s ", PROC_PREFIX,
-                 -proc_width, proc_width, pname);
-      strcat_to_buf (string, status_size, buf);
-    }
-
-  if (line_width > 0)
-    {
-      sprintf (buf, "%s%*.*s ", LINE_PREFIX,
-               -line_width, line_width, line_buf);
-      strcat_to_buf (string, status_size, buf);
-    }
-  if (pc_width > 0)
-    {
-      strcat_to_buf (string, status_size, PC_PREFIX);
-      strcat_to_buf (string, status_size, pc_buf);
-    }
-  
-  
-  for (i = strlen (string); i < status_size; i++)
-    string[i] = ' ';
-  string[status_size] = (char) 0;
-
-  ui_file_delete (pc_out);
-  return string;
-}
-
 /* Get a printable name for the function at the address.
    The symbol name is demangled if demangling is turned on.
    Returns a pointer to a static area holding the result.  */
@@ -264,23 +114,24 @@
 
   if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL)
     {
-      TuiWinElementPtr element;
-
-      element = (TuiWinElementPtr) locator->content[0];
-
-      string = tui_make_status_line (&element->whichElement.locator);
-      wmove (locator->handle, 0, 0);
-      wstandout (locator->handle);
-      waddstr (locator->handle, string);
-      wclrtoeol (locator->handle);
-      wstandend (locator->handle);
-      tuiRefreshWin (locator);
-      wmove (locator->handle, 0, 0);
-      xfree (string);
-      locator->contentInUse = TRUE;
+      string = displayableWinContentAt (locator, 0);
+      if (string != (char *) NULL)
+	{
+	  wmove (locator->handle, 0, 0);
+	  wstandout (locator->handle);
+	  waddstr (locator->handle, string);
+          wclrtoeol (locator->handle);
+	  wstandend (locator->handle);
+	  tuiRefreshWin (locator);
+	  wmove (locator->handle, 0, 0);
+	  if (string != nullStr ())
+	    tuiFree (string);
+	  locator->contentInUse = TRUE;
+	}
     }
-}
 
+  return;
+}				/* tuiShowLocatorContent */
 
 /* Set the filename portion of the locator.  */
 static void
diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c
index fe3b8e0..82c3d49 100644
--- a/gdb/tui/tuiWin.c
+++ b/gdb/tui/tuiWin.c
@@ -928,7 +928,7 @@
   TuiWinInfoPtr winWithFocus = tuiWinWithFocus ();
 
   for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
-    if (winList[type] && winList[type]->generic.isVisible)
+    if (winList[type]->generic.isVisible)
       {
 	if (winWithFocus == winList[type])
 	  printf_filtered ("        %s\t(%d lines)  <has focus>\n",
@@ -1446,7 +1446,7 @@
 	}
       else
 	{
-	  int curTotalHeight, totalHeight, minHeight = 0;
+	  int curTotalHeight, totalHeight, minHeight;
 	  TuiWinInfoPtr firstWin, secondWin;
 
 	  if (curLayout == SRC_DISASSEM_COMMAND)
@@ -1465,7 +1465,7 @@
 	     ** line that the first and second windows share, and add one
 	     ** for the locator.
 	   */
-	  totalHeight = curTotalHeight =
+	  curTotalHeight =
 	    (firstWin->generic.height + secondWin->generic.height - 1)
 	    + cmdWin->generic.height + 1 /*locator */ ;
 	  if (primaryWinInfo == cmdWin)
diff --git a/gdb/version.in b/gdb/version.in
index 39cb08d..3a2a9df 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2002-09-03-cvs
+2002-08-29-cvs
diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c
index 1372410..7749b41 100644
--- a/gdb/x86-64-linux-nat.c
+++ b/gdb/x86-64-linux-nat.c
@@ -26,7 +26,6 @@
 #include "gdbcore.h"
 #include "regcache.h"
 #include "gdb_assert.h"
-#include "gdb_string.h"
 #include "x86-64-tdep.h"
 
 #include <sys/ptrace.h>
diff --git a/gdb/x86-64-linux-tdep.c b/gdb/x86-64-linux-tdep.c
index ac41daa..171ec9c 100644
--- a/gdb/x86-64-linux-tdep.c
+++ b/gdb/x86-64-linux-tdep.c
@@ -24,7 +24,6 @@
 #include "defs.h"
 #include "inferior.h"
 #include "gdbcore.h"
-#include "gdb_string.h"
 #include "regcache.h"
 #include "x86-64-tdep.h"
 #include "dwarf2cfi.h"
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 138483f..7fd83af 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,18 +1,3 @@
-2002-09-02  Nick Clifton  <nickc@redhat.com>
-
-	* v850-opc.c: Remove redundant references to V850EA architecture.
-
-2002-09-02  Alan Modra  <amodra@bigpond.net.au>
-
-	* arc-opc.c: Include bfd.h.
-	(arc_get_opcode_mach): Subtract off base bfd_mach value.
-
-2002-08-30  Alan Modra  <amodra@bigpond.net.au>
-
-	* v850-dis.c (disassemble): Remove bfd_mach_v850ea case.
-
-	* mips-dis.c (_print_insn_mips): Don't use hard-coded mach constants.
-
 2002-08-28  Svein E. Seldal  <Svein.Seldal@solidas.com>
 
 	* configure.in: Added bfd_tic4x_arch.
diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c
index c2d9e1b..b7afb86 100644
--- a/opcodes/arc-opc.c
+++ b/opcodes/arc-opc.c
@@ -20,7 +20,6 @@
 #include "sysdep.h"
 #include <stdio.h>
 #include "ansidecl.h"
-#include "bfd.h"
 #include "opcode/arc.h"
 
 #define INSERT_FN(fn) \
@@ -514,7 +513,7 @@
     ARC_MACH_7,
     ARC_MACH_8
   };
-  return mach_type_map[bfd_mach - bfd_mach_arc_5] | (big_p ? ARC_MACH_BIG : 0);
+  return mach_type_map[bfd_mach] | (big_p ? ARC_MACH_BIG : 0);
 }
 
 /* Initialize any tables that need it.
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index af44788..9b35a47 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -595,7 +595,7 @@
 #endif
 
 #if SYMTAB_AVAILABLE
-  if (info->mach == bfd_mach_mips16
+  if (info->mach == 16
       || (info->flavour == bfd_target_elf_flavour
 	  && info->symbols != NULL
 	  && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other
diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c
index dbd43aa..e72b1e8 100644
--- a/opcodes/v850-dis.c
+++ b/opcodes/v850-dis.c
@@ -77,6 +77,10 @@
     case bfd_mach_v850e:
       target_processor = PROCESSOR_V850E;
       break;
+
+    case bfd_mach_v850ea: 
+      target_processor = PROCESSOR_V850EA;
+      break;
     }
   
   /* Find the opcode.  */
diff --git a/opcodes/v850-opc.c b/opcodes/v850-opc.c
index 94969ac..43ce2f1 100644
--- a/opcodes/v850-opc.c
+++ b/opcodes/v850-opc.c
@@ -608,13 +608,17 @@
 { "jmp",	one (0x0060),		one (0xffe0),	      	{R1}, 			1, PROCESSOR_ALL },
   
 /* load/store instructions */
+{ "sld.bu",	one (0x0300),		one (0x0780),	      	{D7,   EP,   R2_NOTR0},	1, PROCESSOR_V850EA },
 { "sld.bu",     one (0x0060),		one (0x07f0),         	{D4,   EP,   R2_NOTR0},	1, PROCESSOR_V850E },
 
+{ "sld.hu",	one (0x0400),		one (0x0780),	      	{D8_7, EP,   R2_NOTR0},	1, PROCESSOR_V850EA },
 { "sld.hu",     one (0x0070),		one (0x07f0),         	{D5_4, EP,   R2_NOTR0},	1, PROCESSOR_V850E },
 
+{ "sld.b",      one (0x0060),		one (0x07f0),         	{D4,   EP,   R2}, 	1, PROCESSOR_V850EA },
 { "sld.b",	one (0x0300),		one (0x0780),	      	{D7,   EP,   R2},	1, PROCESSOR_V850E },
 { "sld.b",	one (0x0300),		one (0x0780),	      	{D7,   EP,   R2},	1, PROCESSOR_V850 },
 
+{ "sld.h",      one (0x0070),		one (0x07f0),         	{D5_4, EP,   R2}, 	1, PROCESSOR_V850EA },
 { "sld.h",	one (0x0400),		one (0x0780),	      	{D8_7, EP,   R2}, 	1, PROCESSOR_V850E },
 { "sld.h",	one (0x0400),		one (0x0780),	      	{D8_7, EP,   R2}, 	1, PROCESSOR_V850 },
 { "sld.w",	one (0x0500),		one (0x0781),	      	{D8_6, EP,   R2}, 	1, PROCESSOR_ALL },
@@ -622,6 +626,10 @@
 { "sst.h",	one (0x0480),		one (0x0780),	      	{R2,   D8_7, EP}, 	2, PROCESSOR_ALL },
 { "sst.w",	one (0x0501),		one (0x0781),	      	{R2,   D8_6, EP}, 	2, PROCESSOR_ALL },
 
+{ "pushml",	two (0x07e0, 0x0001),	two (0xfff0, 0x0007), 	{LIST18_L}, 		0, PROCESSOR_V850EA },
+{ "pushmh",	two (0x07e0, 0x0003),	two (0xfff0, 0x0007), 	{LIST18_H}, 		0, PROCESSOR_V850EA },
+{ "popml",	two (0x07f0, 0x0001),	two (0xfff0, 0x0007), 	{LIST18_L}, 		0, PROCESSOR_V850EA },
+{ "popmh",	two (0x07f0, 0x0003),	two (0xfff0, 0x0007), 	{LIST18_H}, 		0, PROCESSOR_V850EA },
 { "prepare",    two (0x0780, 0x0003),	two (0xffc0, 0x001f), 	{LIST12, IMM5, SP}, 	0, PROCESSOR_NOT_V850 },
 { "prepare",    two (0x0780, 0x000b),	two (0xffc0, 0x001f), 	{LIST12, IMM5, IMM16}, 	0, PROCESSOR_NOT_V850 },
 { "prepare",    two (0x0780, 0x0013),	two (0xffc0, 0x001f), 	{LIST12, IMM5, IMM16}, 	0, PROCESSOR_NOT_V850 },
@@ -669,6 +677,15 @@
 { "divh",	two (0x07e0, 0x0280),   two (0x07e0, 0x07ff), 	{R1, R2, R3}, 		0, PROCESSOR_NOT_V850 },
 { "divh",	OP  (0x02),		OP_MASK,		{R1, R2_NOTR0},		0, PROCESSOR_ALL },
   
+{ "divhn",	two (0x07e0, 0x0280),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "divhun",	two (0x07e0, 0x0282),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "divn",	two (0x07e0, 0x02c0),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "divun",	two (0x07e0, 0x02c2),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "sdivhn",	two (0x07e0, 0x0180),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "sdivhun",	two (0x07e0, 0x0182),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "sdivn",	two (0x07e0, 0x01c0),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+{ "sdivun",	two (0x07e0, 0x01c2),   two (0x07e0, 0x07c3), 	{I5DIV, R1, R2, R3}, 	0, PROCESSOR_V850EA },
+  
 { "nop",	one (0x00),		one (0xffff),		{0}, 			0, PROCESSOR_ALL },
 { "mov",	OP  (0x10),		OP_MASK,		{I5, R2_NOTR0},		0, PROCESSOR_ALL },
 { "mov",	one (0x0620),		one (0xffe0),		{IMM32, R1_NOTR0},	0, PROCESSOR_NOT_V850 },