This commit was manufactured by cvs2svn to create branch
'reverse-20080717-branch'.

Sprout from msnyder-reverse-20080609-branch 2008-06-10 00:00:06 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'msnyder-'
Cherrypick from master 2008-07-18 00:00:05 UTC Alan Modra <amodra@gmail.com> 'daily update':
    ChangeLog
    Makefile.in
    Makefile.tpl
    bfd/ChangeLog
    bfd/Makefile.am
    bfd/Makefile.in
    bfd/bfd-in.h
    bfd/bfd-in2.h
    bfd/bfd.c
    bfd/compress.c
    bfd/config.in
    bfd/configure
    bfd/configure.in
    bfd/doc/ChangeLog
    bfd/doc/Makefile.am
    bfd/doc/Makefile.in
    bfd/dwarf2.c
    bfd/elf-m10300.c
    bfd/elf.c
    bfd/elf32-arm.c
    bfd/elf32-bfin.c
    bfd/elf32-cr16.c
    bfd/elf32-m32c.c
    bfd/elf32-m68k.c
    bfd/elf32-ppc.c
    bfd/elf32-spu.c
    bfd/elf32-spu.h
    bfd/elf64-ppc.c
    bfd/elfxx-mips.c
    bfd/syms.c
    bfd/version.h
    config/ChangeLog
    config/mh-mingw
    config/override.m4
    configure
    configure.ac
    gdb/ChangeLog
    gdb/MAINTAINERS
    gdb/Makefile.in
    gdb/NEWS
    gdb/acinclude.m4
    gdb/ada-lang.c
    gdb/alpha-linux-tdep.c
    gdb/alphafbsd-tdep.c
    gdb/alphanbsd-tdep.c
    gdb/alphaobsd-tdep.c
    gdb/auxv.c
    gdb/avr-tdep.c
    gdb/block.c
    gdb/block.h
    gdb/blockframe.c
    gdb/breakpoint.c
    gdb/breakpoint.h
    gdb/c-exp.y
    gdb/cli/cli-cmds.c
    gdb/cli/cli-decode.c
    gdb/cli/cli-decode.h
    gdb/completer.c
    gdb/config.in
    gdb/config/i386/nm-cygwin.h
    gdb/config/i386/nm-i386gnu.h
    gdb/configure
    gdb/configure.ac
    gdb/cp-abi.c
    gdb/cris-tdep.c
    gdb/defs.h
    gdb/dfp.c
    gdb/doc/ChangeLog
    gdb/doc/gdb.texinfo
    gdb/doc/observer.texi
    gdb/dwarf2-frame.c
    gdb/dwarf2read.c
    gdb/event-top.c
    gdb/findcmd.c
    gdb/findvar.c
    gdb/frame.c
    gdb/frame.h
    gdb/frv-linux-tdep.c
    gdb/frv-tdep.c
    gdb/gdb_thread_db.h
    gdb/gdbarch.c
    gdb/gdbarch.h
    gdb/gdbarch.sh
    gdb/gdbserver/ChangeLog
    gdb/gdbserver/linux-low.c
    gdb/gdbserver/remote-utils.c
    gdb/gdbserver/server.c
    gdb/gdbserver/server.h
    gdb/gdbthread.h
    gdb/glibc-tdep.c
    gdb/gnu-nat.c
    gdb/go32-nat.c
    gdb/gstdint.h
    gdb/h8300-tdep.c
    gdb/hppa-linux-tdep.c
    gdb/hppa-tdep.c
    gdb/hpux-thread.c
    gdb/i386-cygwin-tdep.c
    gdb/i386-dicos-tdep.c
    gdb/i386-tdep.c
    gdb/i386-tdep.h
    gdb/ia64-tdep.c
    gdb/inf-loop.c
    gdb/inf-ptrace.c
    gdb/inf-ttrace.c
    gdb/infcall.c
    gdb/infcmd.c
    gdb/inferior.h
    gdb/infrun.c
    gdb/interps.c
    gdb/iq2000-tdep.c
    gdb/linux-fork.c
    gdb/linux-nat.c
    gdb/linux-nat.h
    gdb/linux-thread-db.c
    gdb/m32c-tdep.c
    gdb/m32r-linux-tdep.c
    gdb/m32r-tdep.c
    gdb/m68hc11-tdep.c
    gdb/mep-tdep.c
    gdb/mi/mi-cmd-break.c
    gdb/mi/mi-cmd-disas.c
    gdb/mi/mi-cmd-env.c
    gdb/mi/mi-cmd-file.c
    gdb/mi/mi-cmd-stack.c
    gdb/mi/mi-cmd-target.c
    gdb/mi/mi-cmd-var.c
    gdb/mi/mi-cmds.c
    gdb/mi/mi-cmds.h
    gdb/mi/mi-interp.c
    gdb/mi/mi-main.c
    gdb/mi/mi-main.h
    gdb/mi/mi-parse.c
    gdb/mi/mi-parse.h
    gdb/mi/mi-symbol-cmds.c
    gdb/mips-linux-tdep.c
    gdb/mips-tdep.c
    gdb/mipsnbsd-nat.c
    gdb/mipsnbsd-tdep.c
    gdb/mn10300-tdep.c
    gdb/monitor.c
    gdb/mt-tdep.c
    gdb/nto-procfs.c
    gdb/obsd-tdep.c
    gdb/ppc-sysv-tdep.c
    gdb/proc-service.c
    gdb/procfs.c
    gdb/remote-m32r-sdi.c
    gdb/remote-mips.c
    gdb/remote-sim.c
    gdb/remote.c
    gdb/rs6000-nat.c
    gdb/rs6000-tdep.c
    gdb/score-tdep.c
    gdb/sh-tdep.c
    gdb/sh64-tdep.c
    gdb/sol-thread.c
    gdb/sol2-tdep.c
    gdb/solib-osf.c
    gdb/solib.c
    gdb/source.c
    gdb/sparc64fbsd-tdep.c
    gdb/sparc64nbsd-tdep.c
    gdb/sparc64obsd-tdep.c
    gdb/spu-linux-nat.c
    gdb/spu-tdep.c
    gdb/stack.c
    gdb/symfile.c
    gdb/symfile.h
    gdb/symtab.c
    gdb/target-descriptions.c
    gdb/target.c
    gdb/target.h
    gdb/testsuite/ChangeLog
    gdb/testsuite/gdb.arch/e500-regs.exp
    gdb/testsuite/gdb.base/chng-syms.exp
    gdb/testsuite/gdb.base/completion.exp
    gdb/testsuite/gdb.base/coremaker.c
    gdb/testsuite/gdb.base/foll-fork.exp
    gdb/testsuite/gdb.base/fullname.exp
    gdb/testsuite/gdb.base/randomize.c
    gdb/testsuite/gdb.base/randomize.exp
    gdb/testsuite/gdb.base/sigchld.c
    gdb/testsuite/gdb.base/sigchld.exp
    gdb/testsuite/gdb.base/value-double-free.c
    gdb/testsuite/gdb.base/value-double-free.exp
    gdb/testsuite/gdb.cp/class2.cc
    gdb/testsuite/gdb.cp/class2.exp
    gdb/testsuite/gdb.mi/basics.c
    gdb/testsuite/gdb.mi/mi-async.exp
    gdb/testsuite/gdb.mi/mi-break.exp
    gdb/testsuite/gdb.mi/mi-cli.exp
    gdb/testsuite/gdb.mi/mi-console.exp
    gdb/testsuite/gdb.mi/mi-syn-frame.exp
    gdb/testsuite/gdb.mi/mi2-cli.exp
    gdb/testsuite/gdb.mi/mi2-console.exp
    gdb/testsuite/gdb.mi/mi2-syn-frame.exp
    gdb/testsuite/gdb.threads/manythreads.exp
    gdb/testsuite/lib/gdb.exp
    gdb/testsuite/lib/mi-support.exp
    gdb/testsuite/lib/set_unbuffered_mode.c
    gdb/thread.c
    gdb/top.c
    gdb/utils.c
    gdb/v850-tdep.c
    gdb/valops.c
    gdb/value.c
    gdb/varobj.c
    gdb/vax-tdep.c
    gdb/vaxobsd-tdep.c
    gdb/version.in
    gdb/win32-nat.c
    gdb/xstormy16-tdep.c
    include/ChangeLog
    include/bfdlink.h
    include/coff/ChangeLog
    include/coff/ti.h
    include/dis-asm.h
    include/elf/ChangeLog
    include/elf/bfin.h
    include/elf/common.h
    include/elf/mips.h
    include/libiberty.h
    include/opcode/ChangeLog
    include/opcode/mips.h
    include/opcode/ppc.h
    include/safe-ctype.h
    intl/ChangeLog
    intl/Makefile.in
    intl/configure
    libdecnumber/ChangeLog
    libdecnumber/Makefile.in
    libdecnumber/bid/host-ieee128.c
    libdecnumber/configure
    libdecnumber/dconfig.h
    libdecnumber/decContext.c
    libdecnumber/decExcept.c
    libdecnumber/decExcept.h
    libdecnumber/decLibrary.c
    libdecnumber/decNumber.c
    libdecnumber/decNumberLocal.h
    libdecnumber/decRound.c
    libdecnumber/dpd/decimal128.c
    libdecnumber/dpd/decimal128Local.h
    libdecnumber/dpd/decimal32.c
    libdecnumber/dpd/decimal64.c
    libiberty/ChangeLog
    libiberty/configure
    libiberty/libiberty.texi
    libiberty/obstacks.texi
    libiberty/strsignal.c
    opcodes/ChangeLog
    opcodes/arm-dis.c
    opcodes/configure
    opcodes/dis-init.c
    opcodes/mips-dis.c
    opcodes/mips-opc.c
    opcodes/ppc-dis.c
    opcodes/ppc-opc.c
    sim/ChangeLog
    sim/arm/ChangeLog
    sim/arm/config.in
    sim/arm/configure
    sim/common/ChangeLog
    sim/common/common.m4
    sim/common/config.in
    sim/common/configure
    sim/cr16/ChangeLog
    sim/cr16/config.in
    sim/cr16/configure
    sim/cr16/interp.c
    sim/cris/config.in
    sim/cris/configure
    sim/d10v/ChangeLog
    sim/d10v/config.in
    sim/d10v/configure
    sim/erc32/ChangeLog
    sim/erc32/config.in
    sim/erc32/configure
    sim/frv/ChangeLog
    sim/frv/config.in
    sim/frv/configure
    sim/h8300/ChangeLog
    sim/h8300/config.in
    sim/h8300/configure
    sim/iq2000/ChangeLog
    sim/iq2000/config.in
    sim/iq2000/configure
    sim/m32c/ChangeLog
    sim/m32c/config.in
    sim/m32c/configure
    sim/m32c/m32c.opc
    sim/m32c/main.c
    sim/m32c/mem.c
    sim/m32c/mem.h
    sim/m32r/ChangeLog
    sim/m32r/config.in
    sim/m32r/configure
    sim/m68hc11/ChangeLog
    sim/m68hc11/config.in
    sim/m68hc11/configure
    sim/mcore/ChangeLog
    sim/mcore/config.in
    sim/mcore/configure
    sim/mips/ChangeLog
    sim/mips/config.in
    sim/mips/configure
    sim/mn10300/ChangeLog
    sim/mn10300/config.in
    sim/mn10300/configure
    sim/ppc/ChangeLog
    sim/ppc/Makefile.in
    sim/ppc/config.in
    sim/ppc/configure
    sim/ppc/configure.ac
    sim/sh/ChangeLog
    sim/sh/config.in
    sim/sh/configure
    sim/sh64/ChangeLog
    sim/sh64/config.in
    sim/sh64/configure
    sim/v850/ChangeLog
    sim/v850/config.in
    sim/v850/configure
    src-release
diff --git a/ChangeLog b/ChangeLog
index b6074d5..a40be7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2008-06-18  Ian Lance Taylor  <iant@google.com>
+
+	* src-release (BINUTILS_SUPPORT_DIRS): Remove mkdep and depcomp.
+
+	* src-release (BINUTILS_SUPPORT_DIRS): Add depcomp.
+
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* configure: Regenerate.
+
+2008-06-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* configure.ac: Set TOPLEVEL_CONFIGURE_ARGUMENTS early, when
+	"$@" is still intact with both Autoconf 2.59 and 2.62.
+	* configure: Regenerate.
+
+2008-06-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* Makefile.tpl: Fix comment errors.
+	* Makefile.in: Regenerate.
+
+2008-06-13  Julian Brown  <julian@codesourcery.com>
+
+	* configure.ac (arm*-*-linux-gnueabi): Don't disable building
+	of libobjc for ARM EABI Linux.
+	* configure: Regenerate.
+
+2008-06-12  David S. Miller  <davem@davemloft.net>
+	    David Edelsohn  <edelsohn@gnu.org>
+
+	* configure.ac: Add powerpc*-*-* to gold supported targets.
+	* configure: Regenerate.
+
 2008-06-08  Joseph Myers  <joseph@codesourcery.com>
 
 	PR tree-optimization/36218
diff --git a/Makefile.in b/Makefile.in
index 1bd87fd..8a43024 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -50797,7 +50797,7 @@
 
 # Bubble a bug fix through all the stages up to stage 1.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stage1-bubble
 stage1-bubble:: 
 	@r=`${PWD_COMMAND}`; export r; \
@@ -51020,7 +51020,7 @@
 
 # Bubble a bug fix through all the stages up to stage 2.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stage2-bubble
 stage2-bubble:: stage1-bubble
 	@r=`${PWD_COMMAND}`; export r; \
@@ -51264,7 +51264,7 @@
 
 # Bubble a bug fix through all the stages up to stage b2g0.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stageb2g0-bubble
 stageb2g0-bubble:: stage1-bubble
 	@r=`${PWD_COMMAND}`; export r; \
@@ -51508,7 +51508,7 @@
 
 # Bubble a bug fix through all the stages up to stage 3.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stage3-bubble
 stage3-bubble:: stage2-bubble
 	@r=`${PWD_COMMAND}`; export r; \
@@ -51806,7 +51806,7 @@
 
 # Bubble a bug fix through all the stages up to stage b3g2.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stageb3g2-bubble
 stageb3g2-bubble:: stageb2g0-bubble
 	@r=`${PWD_COMMAND}`; export r; \
@@ -52104,7 +52104,7 @@
 
 # Bubble a bug fix through all the stages up to stage 4.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stage4-bubble
 stage4-bubble:: stage3-bubble
 	@r=`${PWD_COMMAND}`; export r; \
@@ -52391,7 +52391,7 @@
 
 # Bubble a bug fix through all the stages up to stage profile.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stageprofile-bubble
 stageprofile-bubble:: stage1-bubble
 	@r=`${PWD_COMMAND}`; export r; \
@@ -52614,7 +52614,7 @@
 
 # Bubble a bug fix through all the stages up to stage feedback.  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stagefeedback-bubble
 stagefeedback-bubble:: stageprofile-bubble
 	@r=`${PWD_COMMAND}`; export r; \
diff --git a/Makefile.tpl b/Makefile.tpl
index c9b34ed..9c72014 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -1318,7 +1318,7 @@
 
 # Bubble a bug fix through all the stages up to stage [+id+].  They are
 # remade, but not reconfigured.  The next stage (if any) will not be
-# reconfigured as well.
+# reconfigured either.
 .PHONY: stage[+id+]-bubble
 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
 	@r=`${PWD_COMMAND}`; export r; \
@@ -1492,7 +1492,7 @@
 
 [+ ;; These Scheme functions build the bulk of the dependencies.
    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
-   ;; where "maybe-" is only included if HARD is true, and all-gcc
+   ;; where "maybe-" is only included if HARD is not true, and all-gcc
    ;; is taken from VAR-NAME.
    (define dep-target (lambda (module-kind var-name hard)
       (string-append
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3167126..bcb636e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,202 @@
+2008-07-16  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* elf32-bfin.c (bfin_check_relocs, bfin_relocate_section,
+	bfin_final_link_relocate, bfin_gc_mark_hook, bfin_gc_sweep_hook,
+	ELF_DYNAMIC_INTERPRETER, DEFAULT_STACK_SIZE,
+	struct _bfinfdpic_dynamic_got_info): Moved around to keep FD-PIC code
+	separate from non-FD-PIC.
+
+2008-07-14  DJ Delorie  <dj@redhat.com>
+
+	* elf-m10300.c (mn10300_elf_final_link_relocate): Correct overflow
+	checks for PCREL8, PCREL16, GOTPC16, GOTOFF16, PLT16, and GOT16
+	relocs.
+	(mn10300_elf_relax_section): Correct jump offset check when target
+	is in a different section.
+
+2008-07-15  Jie Zhang  <jie.zhang@analog.com>
+
+	* elf32-bfin.c (elf32_bfin_special_sections[]): New.
+	(elf_backend_special_sections): Define.
+
+2008-07-13  Craig Silverstein  <csilvers@google.com>
+
+	PR binutils/6743
+	* dwarf2.c (struct dwarf2_debug): New variable info_ptr_memory.
+	(find_line): Use info_ptr_memory instead of sec_info_ptr.
+	(_bfd_dwarf2_cleanup_debug_info): Likewise.
+
+2008-07-12  Jie Zhang  <jie.zhang@analog.com>
+
+	Revert
+	2008-07-12  Jie Zhang  <jie.zhang@analog.com>
+	* elf.c (_bfd_elf_map_sections_to_segments): Don't put
+	executable sections into the same segment with other
+	read only sections if --sep-code.
+	* elf32-bfin.c (elf32_bfin_code_in_l1): New variable.
+	(elf32_bfin_data_in_l1): New variable.
+	(elf32_bfin_final_write_processing): New.
+	(elf32_bfin_special_sections[]): New.
+	(elf_backend_final_write_processing): Define.
+	(elf_backend_special_sections): Define.
+
+2008-07-12  Jie Zhang  <jie.zhang@analog.com>
+
+	* elf.c (_bfd_elf_map_sections_to_segments): Don't put
+	executable sections into the same segment with other
+	read only sections if --sep-code.
+	* elf32-bfin.c (elf32_bfin_code_in_l1): New variable.
+	(elf32_bfin_data_in_l1): New variable.
+	(elf32_bfin_final_write_processing): New.
+	(elf32_bfin_special_sections[]): New.
+	(elf_backend_final_write_processing): Define.
+	(elf_backend_special_sections): Define.
+
+2008-07-11  Andreas Schwab  <schwab@suse.de>
+
+	* dwarf2.c (read_section): Take pointer to bfd_size_type instead
+	of unsigned long as last parameter.
+	(struct dwarf2_debug): Define dwarf_abbrev_size, dwarf_line_size,
+	dwarf_str_size and dwarf_ranges_size as bfd_size_type instead of
+	unsigned long.
+
+2008-07-10  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_calculate_relocation): Calculate GP and GP0
+	for all relocation types.  Allow any type of relocation to refer to
+	__gnu_local_gp.
+
+2008-07-10  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_check_mips16_stubs): Use ELF_ST_IS_MIPS16.
+	(mips_elf_calculate_relocation): Likewise.
+	(_bfd_mips_elf_add_symbol_hook): Likewise.
+	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+	(_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
+
+2008-07-10  Andreas Schwab  <schwab@suse.de>
+
+	* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Add missing
+	paren.
+
+2008-07-09  Craig Silverstein  <csilvers@google.com>
+
+	* Makefile.am (BFD32_LIBS): Add compress.lo.
+	(BFD32_LIBS_CFILES): Add compress.c.
+	(BFD_H_FILES): Likewise.
+	* Makefile.in: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* config.in: Add HAVE_ZLIB_H
+	* configure.in: Add test for libz and zlib.h
+	* configure: Regenerate.
+	* dwarf2.c (read_section): New function.
+	(read_indirect_string): Call new function read_section.
+	(read_abbrevs): Likewise.
+	(decode_line_info): Likewise.
+	(read_debug_ranges): Likewise.
+	(find_line): Call new function read_section when just one
+	.zdebug_info section is found, otherwise read and compress
+	multiple sections.
+	(_bfd_dwarf2_cleanup_debug_info): Free sec_info_ptr.
+	* elf.c (_bfd_elf_make_section_from_shdr): Add zdebug prefix.
+	(special_sections_z): New struct.
+	(special_sections): Refer to special_sections_z.
+	* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Recognize
+	sections named .zdebug_*.
+	(_bfd_mips_elf_fake_sections): Likewise.
+	* compress.c: New file.
+	(bfd_uncompress_section_contents): New function.
+	
+2008-07-07  Christophe Lyon  <christophe.lyon@st.com>
+
+	* elf32-arm.c (arm_type_of_stub): Don't crash on local symbols in
+	the presence of a PLT.
+
+2008-07-07  Alan Modra  <amodra@bigpond.net.au>
+
+	* bfd.c (bfd_demangle): Always trim off bfd_get_symbol_leading_char.
+
+2008-07-02  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-ppc.c (is_pic_glink_stub): New function.
+	(ppc_elf_get_synthetic_symtab): Don't generate symbols when
+	multiple shared/pie stubs per plt entry.
+
+2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elf.c (_bfd_elf_get_synthetic_symtab): Increment p by
+	bed->s->int_rels_per_ext_rel.
+
+2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* syms.c (BSF_SYNTHETIC): New flag.
+	* elf.c (_bfd_elf_get_synthetic_symtab): Set it.
+	* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Likewise.
+	* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.
+	* bfd-in.h (bfd_asymbol_flavour): Return bfd_target_unknown_flavour
+	for synthetic symbols.
+	* bfd-in2.h: Regenerate.
+
+2008-06-30  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* elf32-arm.c (record_arm_to_thumb_glue, record_thumb_to_arm_glue):
+	Expand comments.
+	(arm_map_one_stub): Use | 1 when setting the low bit.
+
+2008-06-29  Andreas Schwab  <schwab@suse.de>
+
+	* elf32-m68k.c (elf_m68k_relocate_section): Don't ignore existing
+	addend on _GLOBAL_OFFSET_TABLE_.
+
+2008-06-24  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* elf32-arm.c (STUB_ENTRY_NAME): Define.
+	(arm_thumb_thumb_long_branch_stub): Use bx instead of b.n.
+	(arm_pic_long_branch_stub): Mention R_ARM_REL32 instead of
+	R_ARM_ABS32.
+	(struct elf32_arm_stub_hash_entry): Add output_name.
+	(arm_build_one_stub): Move offsets into the offset argument
+	of _bfd_final_link_relocate.  Correct offset for
+	arm_thumb_arm_v4t_stub_long_branch.
+	(elf32_arm_size_stubs): Set stub_entry->output_name.
+	(elf32_arm_ouput_plt_map_sym): Rename to elf32_arm_output_map_sym.
+	Update all callers.
+	(elf32_arm_output_stub_sym): New.
+	(arm_map_one_stub): Correct formatting.  Use elf32_arm_output_stub_sym.
+
+2008-06-20  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-spu.c (needs_ovl_stub): Correctly return nonovl_stub for
+	non-branch insns.
+
+2008-06-20  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-spu.c (build_stub): Allow wraparound on stub branches.
+	(allocate_spuear_stubs, build_spuear_stubs): Return value from
+	count_stub/build_stub.
+	(spu_elf_build_stubs): Correct location of stub reloc error message.
+
+2008-06-18  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+
+        * elf32-cr16.c (ELF_MACHINE_ALT1): Define to EM_CR16_OLD.
+
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* configure: Regenerate.
+
+2008-06-17  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-spu.c (struct spu_link_hash_table): Add extra_stack_space.
+	(spu_elf_check_vma): Add extra_stack_space param, copy to htab.
+	(spu_elf_auto_overlay): Use it.
+	(RECURSE_UNMARK): Define as 0.
+	(unmark_overlay_section): Heed RECURSE_UNMARK.
+	* elf32-spu.h (spu_elf_check_vma): Update prototype.
+
+2008-06-12  DJ Delorie  <dj@redhat.com>
+
+	* elf32-m32c.c (ELF_MACHINE_ALT1): Define as EM_M32C_OLD.
+
 2008-06-09  Paul Brook  <paul@codesourcery.com>
 
 	bfd/
@@ -86,6 +285,18 @@
 	(elf32_arm_output_arch_local_syms): Generate mapping symbols for
 	long calls stubs.
 	
+2008-05-21  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-arm.c (group_sections): Reformat comments.
+
+	PR ld/6446
+	* elf32-frv.c (elf32_frv_relocate_section): Set EF_FRV_PIC by
+	default (for FDPIC). Clear it if any inter-segment relocations
+	are found.
+
+	* elf64-hppa.c (elf64_hppa_finalize_opd): Check NULL return
+	from elf_link_hash_lookup.
+
 2008-05-21  Maxim Kuvyrkov  <maxim@codesourcery.com>
 	
 	Add multi-GOT support for m68k.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 00736ec..0fd2fe9 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -42,7 +42,7 @@
 	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
 	section.lo syms.lo targets.lo hash.lo linker.lo \
 	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
-	merge.lo dwarf2.lo simple.lo
+	merge.lo dwarf2.lo simple.lo compress.lo
 
 BFD64_LIBS = archive64.lo
 
@@ -52,7 +52,7 @@
 	format.c init.c libbfd.c opncls.c reloc.c \
 	section.c syms.c targets.c hash.c linker.c \
 	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
-	merge.c dwarf2.c simple.c
+	merge.c dwarf2.c simple.c compress.c
 
 BFD64_LIBS_CFILES = archive64.c
 
@@ -938,7 +938,7 @@
 
 BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
 	reloc.c syms.c bfd.c bfdio.c bfdwin.c \
-	archive.c corefile.c targets.c format.c
+	archive.c corefile.c targets.c format.c compress.c
 BFD64_H_FILES = archive64.c
 LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \
 	cache.c reloc.c archures.c elf.c
@@ -1064,6 +1064,7 @@
   $(INCDIR)/elf/dwarf2.h
 simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
   $(INCDIR)/bfdlink.h
+compress.lo: compress.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
 archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
   $(INCDIR)/aout/ar.h
 cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 0e48abd..6c0a9cd 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -87,7 +87,7 @@
 	cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo \
 	opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo \
 	linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo \
-	stab-syms.lo merge.lo dwarf2.lo simple.lo
+	stab-syms.lo merge.lo dwarf2.lo simple.lo compress.lo
 am_libbfd_la_OBJECTS = $(am__objects_1)
 libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
@@ -295,7 +295,7 @@
 	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
 	section.lo syms.lo targets.lo hash.lo linker.lo \
 	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
-	merge.lo dwarf2.lo simple.lo
+	merge.lo dwarf2.lo simple.lo compress.lo
 
 BFD64_LIBS = archive64.lo
 BFD32_LIBS_CFILES = \
@@ -304,7 +304,7 @@
 	format.c init.c libbfd.c opncls.c reloc.c \
 	section.c syms.c targets.c hash.c linker.c \
 	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
-	merge.c dwarf2.c simple.c
+	merge.c dwarf2.c simple.c compress.c
 
 BFD64_LIBS_CFILES = archive64.c
 
@@ -971,7 +971,7 @@
 LOCAL_H_DEPS = libbfd.h sysdep.h config.h
 BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
 	reloc.c syms.c bfd.c bfdio.c bfdwin.c \
-	archive.c corefile.c targets.c format.c
+	archive.c corefile.c targets.c format.c compress.c
 
 BFD64_H_FILES = archive64.c
 LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \
@@ -994,15 +994,15 @@
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus '; \
-	      cd $(srcdir) && $(AUTOMAKE) --cygnus  \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
 		&& exit 0; \
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus  Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --cygnus  Makefile
+	  $(AUTOMAKE) --foreign  Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -1647,6 +1647,7 @@
   $(INCDIR)/elf/dwarf2.h
 simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
   $(INCDIR)/bfdlink.h
+compress.lo: compress.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
 archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
   $(INCDIR)/aout/ar.h
 cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 0366125..3a3fa3f 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -231,7 +231,10 @@
 #define bfd_asymbol_name(x) ((x)->name)
 /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
 #define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
+#define bfd_asymbol_flavour(x)			\
+  (((x)->flags & BSF_SYNTHETIC) != 0		\
+   ? bfd_target_unknown_flavour			\
+   : bfd_asymbol_bfd (x)->xvec->flavour)
 
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index f69cf07..c1ad8c7 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2,7 +2,7 @@
    generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", 
    "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c", 
    "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c", 
-   "linker.c" and "simple.c".
+   "linker.c", "simple.c" and "compress.c".
    Run "make headers" in your build bfd/ to regenerate.  */
 
 /* Main header file for the bfd library -- portable access to object files.
@@ -238,7 +238,10 @@
 #define bfd_asymbol_name(x) ((x)->name)
 /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
 #define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
+#define bfd_asymbol_flavour(x)			\
+  (((x)->flags & BSF_SYNTHETIC) != 0		\
+   ? bfd_target_unknown_flavour			\
+   : bfd_asymbol_bfd (x)->xvec->flavour)
 
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
@@ -4502,6 +4505,9 @@
      with the expression tree serialized in the symbol name.  */
 #define BSF_SRELC 0x100000
 
+  /* This symbol was created by bfd_get_synthetic_symtab.  */
+#define BSF_SYNTHETIC 0x200000
+
   flagword flags;
 
   /* A pointer to the section to which this symbol is
@@ -5462,6 +5468,10 @@
 bfd_byte *bfd_simple_get_relocated_section_contents
    (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
 
+/* Extracted from compress.c.  */
+bfd_boolean bfd_uncompress_section_contents
+   (bfd_byte **buffer, bfd_size_type *size);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 7e6e872..ed89e66 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1829,10 +1829,12 @@
   char *res, *alloc;
   const char *pre, *suf;
   size_t pre_len;
+  bfd_boolean skip_lead;
 
-  if (abfd != NULL
-      && *name != '\0'
-      && bfd_get_symbol_leading_char (abfd) == *name)
+  skip_lead = (abfd != NULL
+	       && *name != '\0'
+	       && bfd_get_symbol_leading_char (abfd) == *name);
+  if (skip_lead)
     ++name;
 
   /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
@@ -1863,7 +1865,18 @@
     free (alloc);
 
   if (res == NULL)
-    return NULL;
+    {
+      if (skip_lead)
+	{
+	  size_t len = strlen (pre) + 1;
+	  alloc = bfd_malloc (len);
+	  if (alloc == NULL)
+	    return NULL;
+	  memcpy (alloc, pre, len);
+	  return alloc;
+	}
+      return NULL;
+    }
 
   /* Put back any prefix or suffix.  */
   if (pre_len != 0 || suf != NULL)
diff --git a/bfd/compress.c b/bfd/compress.c
new file mode 100644
index 0000000..a2fcff7
--- /dev/null
+++ b/bfd/compress.c
@@ -0,0 +1,122 @@
+/* ELF attributes support (based on ARM EABI attributes).
+   Copyright 2008
+   Free Software Foundation, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   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 3 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., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+/*
+FUNCTION
+	bfd_uncompress_section_contents
+
+SYNOPSIS
+	bfd_boolean bfd_uncompress_section_contents
+	  (bfd_byte **buffer, bfd_size_type *size);
+
+DESCRIPTION
+
+	Uncompresses a section that was compressed using zlib, in place.  At
+	the call to this function, *@var{buffer} and *@var{size} should point
+	to the section contents to be uncompressed.  At the end of the
+	function, *@var{buffer} and *@var{size} will point to the uncompressed
+	contents.  This function assumes *BUFFER was allocated using
+	bfd_malloc() or equivalent.  If the section is not a valid compressed
+	section, or zlib is not installed on this machine, the input is
+	unmodified.
+
+        Returns @code{FALSE} if unable to uncompress successfully; in that case
+        the input is unmodified.  Otherwise, returns @code{TRUE}.
+*/
+
+bfd_boolean
+bfd_uncompress_section_contents (bfd_byte **buffer, bfd_size_type *size)
+{
+#ifndef HAVE_ZLIB_H
+  /* These are just to quiet gcc.  */
+  buffer = 0;
+  size = 0;
+  return FALSE;
+#else
+  bfd_size_type compressed_size = *size;
+  bfd_byte *compressed_buffer = *buffer;
+  bfd_size_type uncompressed_size;
+  bfd_byte *uncompressed_buffer;
+  z_stream strm;
+  int rc;
+  bfd_size_type header_size = 12;
+
+  /* Read the zlib header.  In this case, it should be "ZLIB" followed
+     by the uncompressed section size, 8 bytes in big-endian order.  */
+  if (compressed_size < header_size
+      || ! CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"))
+    return FALSE;
+  uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8;
+  uncompressed_size += compressed_buffer[11];
+
+  /* It is possible the section consists of several compressed
+     buffers concatenated together, so we uncompress in a loop.  */
+  strm.zalloc = NULL;
+  strm.zfree = NULL;
+  strm.opaque = NULL;
+  strm.avail_in = compressed_size - header_size;
+  strm.next_in = (Bytef*) compressed_buffer + header_size;
+  strm.avail_out = uncompressed_size;
+  uncompressed_buffer = bfd_malloc (uncompressed_size);
+  if (! uncompressed_buffer)
+    return FALSE;
+
+  rc = inflateInit (&strm);
+  while (strm.avail_in > 0)
+    {
+      if (rc != Z_OK)
+        goto fail;
+      strm.next_out = ((Bytef*) uncompressed_buffer
+                       + (uncompressed_size - strm.avail_out));
+      rc = inflate (&strm, Z_FINISH);
+      if (rc != Z_STREAM_END)
+        goto fail;
+      rc = inflateReset (&strm);
+    }
+  rc = inflateEnd (&strm);
+  if (rc != Z_OK
+      || strm.avail_out != 0)
+    goto fail;
+
+  free (compressed_buffer);
+  *buffer = uncompressed_buffer;
+  *size = uncompressed_size;
+  return TRUE;
+
+ fail:
+  free (uncompressed_buffer);
+  return FALSE;
+#endif  /* HAVE_ZLIB_H */
+}
diff --git a/bfd/config.in b/bfd/config.in
index 3864885..a8aa75f 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -224,6 +224,9 @@
 /* Define if <sys/procfs.h> has win32_pstatus_t. */
 #undef HAVE_WIN32_PSTATUS_T
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
 #undef LT_OBJDIR
diff --git a/bfd/configure b/bfd/configure
index c468bcb..8578abb 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1134,7 +1134,7 @@
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi
-    cd $ac_popdir
+    cd "$ac_popdir"
   done
 fi
 
@@ -2167,8 +2167,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2226,8 +2225,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2343,8 +2341,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2398,8 +2395,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2444,8 +2440,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2489,8 +2484,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2568,8 +2562,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2623,8 +2616,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3815,8 +3807,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3874,8 +3865,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3991,8 +3981,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4046,8 +4035,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4092,8 +4080,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4137,8 +4124,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4687,13 +4673,13 @@
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4690: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4676: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4693: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4679: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4696: output\"" >&5)
+  (eval echo "\"\$as_me:4682: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5748,7 +5734,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5751 "configure"' > conftest.$ac_ext
+  echo '#line 5737 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5875,8 +5861,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6202,8 +6187,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6373,8 +6357,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6435,8 +6418,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6848,11 +6830,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6851: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6833: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6855: \$? = $ac_status" >&5
+   echo "$as_me:6837: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7170,11 +7152,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7173: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7155: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7177: \$? = $ac_status" >&5
+   echo "$as_me:7159: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7275,11 +7257,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7278: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7260: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7282: \$? = $ac_status" >&5
+   echo "$as_me:7264: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7330,11 +7312,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7333: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7315: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7337: \$? = $ac_status" >&5
+   echo "$as_me:7319: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7833,8 +7815,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7902,8 +7883,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8196,8 +8176,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9149,8 +9128,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9587,8 +9565,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9691,8 +9668,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9757,8 +9733,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9851,8 +9826,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9917,8 +9891,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9984,8 +9957,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10051,8 +10023,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -10127,7 +10098,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10130 "configure"
+#line 10101 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10227,7 +10198,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10230 "configure"
+#line 10201 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11302,8 +11273,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11365,8 +11335,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11406,8 +11375,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11463,8 +11431,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11504,8 +11471,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11569,8 +11535,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11601,10 +11566,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11716,8 +11679,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11779,8 +11741,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11820,8 +11781,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11877,8 +11837,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11918,8 +11877,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -11983,8 +11941,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12015,10 +11972,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -12130,8 +12085,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12193,8 +12147,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12234,8 +12187,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12291,8 +12243,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12332,8 +12283,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12397,8 +12347,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12429,10 +12378,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -12621,8 +12568,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12773,8 +12719,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -12936,8 +12881,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13000,8 +12944,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13064,8 +13007,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13128,8 +13070,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13192,8 +13133,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13265,8 +13205,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13329,8 +13268,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13388,8 +13326,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13456,8 +13393,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13520,8 +13456,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13619,8 +13554,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13682,8 +13616,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13723,8 +13656,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13780,8 +13712,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13821,8 +13752,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13886,8 +13816,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -13918,10 +13847,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -14037,8 +13964,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14100,8 +14026,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14141,8 +14066,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14198,8 +14122,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14239,8 +14162,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14304,8 +14226,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14336,10 +14257,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -14455,8 +14374,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14518,8 +14436,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14559,8 +14476,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14616,8 +14532,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14657,8 +14572,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14722,8 +14636,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14754,10 +14667,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -14869,8 +14780,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14932,8 +14842,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -14973,8 +14882,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15030,8 +14938,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15071,8 +14978,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15136,8 +15042,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15168,10 +15073,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -15283,8 +15186,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15346,8 +15248,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15387,8 +15288,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15444,8 +15344,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15485,8 +15384,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15550,8 +15448,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15582,10 +15479,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -15769,8 +15664,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15841,8 +15735,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15914,8 +15807,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -15969,8 +15861,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16041,8 +15932,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16096,8 +15986,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16161,8 +16050,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16268,8 +16156,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16370,8 +16257,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16436,8 +16322,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16508,8 +16393,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16580,8 +16464,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16652,8 +16535,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16724,8 +16606,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16807,8 +16688,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16879,8 +16759,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -16951,8 +16830,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17023,8 +16901,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17095,8 +16972,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17167,8 +17043,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17239,8 +17114,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17311,8 +17185,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17383,8 +17256,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17424,6 +17296,280 @@
 
 
 
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 # If we are configured native, pick a core file support file.
 COREFILE=
 COREFLAG=
@@ -17613,8 +17759,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17736,8 +17881,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17884,8 +18028,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -17949,8 +18092,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18014,8 +18156,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18079,8 +18220,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18144,8 +18284,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18209,8 +18348,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18274,8 +18412,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18339,8 +18476,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18404,8 +18540,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18469,8 +18604,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18534,8 +18668,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18599,8 +18732,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18664,8 +18796,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18729,8 +18860,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18794,8 +18924,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -18859,8 +18988,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19505,8 +19633,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19571,8 +19698,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19634,8 +19760,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19675,8 +19800,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19732,8 +19856,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19773,8 +19896,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19838,8 +19960,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -19870,10 +19991,8 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
+  { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
+echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -20012,8 +20131,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20197,8 +20315,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -20475,8 +20592,7 @@
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -21751,11 +21867,6 @@
   *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
   esac
 
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
   # Let's still pretend it is `configure' which instantiates (i.e., don't
   # use $as_me), people would be surprised to read:
   #    /* config.h.  Generated by config.status.  */
@@ -21794,6 +21905,12 @@
 	 fi;;
       esac
     done` || { (exit 1); exit 1; }
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub
diff --git a/bfd/configure.in b/bfd/configure.in
index 947f79d..0d1f5c9 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -198,6 +198,10 @@
 AC_CHECK_DECLS(snprintf)
 AC_CHECK_DECLS(vsnprintf)
 
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+# This is used only by compress.c.
+AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+
 # If we are configured native, pick a core file support file.
 COREFILE=
 COREFLAG=
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index ff44533..4d64c8a 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-09  Craig Silverstein  <csilvers@google.com>
+
+	* Makefile.am (BFD_H_DEP): Add ../compress.c.
+	* Makefile.in: Regenerate.
+
 2008-05-14  Alan Modra  <amodra@bigpond.net.au>
 
 	* Makefile.in: Regenerate.
diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index 6ff434a..86dfdb5 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -253,6 +253,7 @@
 	$(srcdir)/../format.c		\
 	$(srcdir)/../linker.c		\
 	$(srcdir)/../simple.c		\
+	$(srcdir)/../compress.c		\
 	$(srcdir)/header.sed		\
 	$(srcdir)/proto.str		\
 	$(srcdir)/../version.h		\
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index eab24fc..69eab19 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -333,6 +333,7 @@
 	$(srcdir)/../format.c		\
 	$(srcdir)/../linker.c		\
 	$(srcdir)/../simple.c		\
+	$(srcdir)/../compress.c		\
 	$(srcdir)/header.sed		\
 	$(srcdir)/proto.str		\
 	$(srcdir)/../version.h		\
@@ -358,9 +359,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus  doc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --cygnus  doc/Makefile
+	  $(AUTOMAKE) --foreign  doc/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 34e0138..73b7b56 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -104,6 +104,12 @@
   asection *sec;
   bfd_byte *sec_info_ptr;
 
+  /* A pointer to the memory block allocated for info_ptr.  Neither
+     info_ptr nor sec_info_ptr are guaranteed to stay pointing to the
+     beginning of the malloc block.  This is used only to free the
+     memory later.  */
+  bfd_byte *info_ptr_memory;
+
   /* Pointer to the symbol table.  */
   asymbol **syms;
 
@@ -111,25 +117,25 @@
   bfd_byte *dwarf_abbrev_buffer;
 
   /* Length of the loaded .debug_abbrev section.  */
-  unsigned long dwarf_abbrev_size;
+  bfd_size_type dwarf_abbrev_size;
 
   /* Buffer for decode_line_info.  */
   bfd_byte *dwarf_line_buffer;
 
   /* Length of the loaded .debug_line section.  */
-  unsigned long dwarf_line_size;
+  bfd_size_type dwarf_line_size;
 
   /* Pointer to the .debug_str section loaded into memory.  */
   bfd_byte *dwarf_str_buffer;
 
   /* Length of the loaded .debug_str section.  */
-  unsigned long dwarf_str_size;
+  bfd_size_type dwarf_str_size;
 
   /* Pointer to the .debug_ranges section loaded into memory. */
   bfd_byte *dwarf_ranges_buffer;
 
   /* Length of the loaded .debug_ranges section. */
-  unsigned long dwarf_ranges_size;
+  bfd_size_type dwarf_ranges_size;
 
   /* If the most recent call to bfd_find_nearest_line was given an
      address in an inlined function, preserve a pointer into the
@@ -389,6 +395,79 @@
   return entry ? entry->head : NULL;
 }
 
+/* Read a section into its appropriate place in the dwarf2_debug
+   struct (indicated by SECTION_BUFFER and SECTION_SIZE).  If syms is
+   not NULL, use bfd_simple_get_relocated_section_contents to read the
+   section contents, otherwise use bfd_get_section_contents.  */
+
+static bfd_boolean
+read_section (bfd *abfd,
+              const char* section_name, const char* compressed_section_name,
+              asymbol** syms, bfd_uint64_t offset,
+              bfd_byte **section_buffer, bfd_size_type *section_size)
+{
+  asection *msec;
+  bfd_boolean section_is_compressed = FALSE;
+
+  /* read_section is a noop if the section has already been read.  */
+  if (*section_buffer)
+    return TRUE;
+
+  msec = bfd_get_section_by_name (abfd, section_name);
+  if (! msec && compressed_section_name)
+    {
+      msec = bfd_get_section_by_name (abfd, compressed_section_name);
+      section_is_compressed = TRUE;
+    }
+  if (! msec)
+    {
+      (*_bfd_error_handler) (_("Dwarf Error: Can't find %s section."), section_name);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+
+  if (syms)
+    {
+      *section_size = msec->size;
+      *section_buffer
+          = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, syms);
+      if (! *section_buffer)
+        return FALSE;
+    }
+  else
+    {
+      *section_size = msec->rawsize ? msec->rawsize : msec->size;
+      *section_buffer = bfd_malloc (*section_size);
+      if (! *section_buffer)
+        return FALSE;
+      if (! bfd_get_section_contents (abfd, msec, *section_buffer,
+                                      0, *section_size))
+        return FALSE;
+    }
+
+  if (section_is_compressed)
+    {
+      if (! bfd_uncompress_section_contents (section_buffer, section_size))
+        {
+          (*_bfd_error_handler) (_("Dwarf Error: unable to decompress %s section."), compressed_section_name);
+          bfd_set_error (bfd_error_bad_value);
+          return FALSE;
+        }
+    }
+
+  /* It is possible to get a bad value for the offset into the section
+   * that the client wants.  Validate it here to avoid trouble later.  */
+  if (offset != 0 && offset >= *section_size)
+    {
+      (*_bfd_error_handler) (_("Dwarf Error: Offset (%lu) greater than or equal to %s size (%lu)."),
+			     offset, section_name, *section_size);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
 /* VERBATIM
    The following function up to the END VERBATIM mark are
    copied directly from dwarf2read.c.  */
@@ -468,39 +547,10 @@
     offset = read_8_bytes (unit->abfd, buf);
   *bytes_read_ptr = unit->offset_size;
 
-  if (! stash->dwarf_str_buffer)
-    {
-      asection *msec;
-      bfd *abfd = unit->abfd;
-      bfd_size_type sz;
-
-      msec = bfd_get_section_by_name (abfd, ".debug_str");
-      if (! msec)
-	{
-	  (*_bfd_error_handler)
-	    (_("Dwarf Error: Can't find .debug_str section."));
-	  bfd_set_error (bfd_error_bad_value);
-	  return NULL;
-	}
-
-      sz = msec->rawsize ? msec->rawsize : msec->size;
-      stash->dwarf_str_size = sz;
-      stash->dwarf_str_buffer = bfd_alloc (abfd, sz);
-      if (! stash->dwarf_str_buffer)
-	return NULL;
-
-      if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer,
-				      0, sz))
-	return NULL;
-    }
-
-  if (offset >= stash->dwarf_str_size)
-    {
-      (*_bfd_error_handler) (_("Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)."),
-			     (unsigned long) offset, stash->dwarf_str_size);
-      bfd_set_error (bfd_error_bad_value);
-      return NULL;
-    }
+  if (! read_section (unit->abfd, ".debug_str", ".zdebug_str",
+                      0, offset,
+                      &stash->dwarf_str_buffer, &stash->dwarf_str_size))
+    return 0;
 
   str = (char *) stash->dwarf_str_buffer + offset;
   if (*str == '\0')
@@ -582,33 +632,10 @@
   unsigned int abbrev_form, hash_number;
   bfd_size_type amt;
 
-  if (! stash->dwarf_abbrev_buffer)
-    {
-      asection *msec;
-
-      msec = bfd_get_section_by_name (abfd, ".debug_abbrev");
-      if (! msec)
-	{
-	  (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_abbrev section."));
-	  bfd_set_error (bfd_error_bad_value);
-	  return 0;
-	}
-
-      stash->dwarf_abbrev_size = msec->size;
-      stash->dwarf_abbrev_buffer
-	= bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
-						     stash->syms);
-      if (! stash->dwarf_abbrev_buffer)
-	  return 0;
-    }
-
-  if (offset >= stash->dwarf_abbrev_size)
-    {
-      (*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)."),
-			     (unsigned long) offset, stash->dwarf_abbrev_size);
-      bfd_set_error (bfd_error_bad_value);
-      return 0;
-    }
+  if (! read_section (abfd, ".debug_abbrev", ".zdebug_abbrev",
+                      stash->syms, offset,
+                      &stash->dwarf_abbrev_buffer, &stash->dwarf_abbrev_size))
+    return 0;
 
   amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE;
   abbrevs = bfd_zalloc (abfd, amt);
@@ -1138,35 +1165,10 @@
   unsigned char op_code, extended_op, adj_opcode;
   bfd_size_type amt;
 
-  if (! stash->dwarf_line_buffer)
-    {
-      asection *msec;
-
-      msec = bfd_get_section_by_name (abfd, ".debug_line");
-      if (! msec)
-	{
-	  (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_line section."));
-	  bfd_set_error (bfd_error_bad_value);
-	  return 0;
-	}
-
-      stash->dwarf_line_size = msec->size;
-      stash->dwarf_line_buffer
-	= bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
-						     stash->syms);
-      if (! stash->dwarf_line_buffer)
-	return 0;
-    }
-
-  /* It is possible to get a bad value for the line_offset.  Validate
-     it here so that we won't get a segfault below.  */
-  if (unit->line_offset >= stash->dwarf_line_size)
-    {
-      (*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."),
-			     unit->line_offset, stash->dwarf_line_size);
-      bfd_set_error (bfd_error_bad_value);
-      return 0;
-    }
+  if (! read_section (abfd, ".debug_line", ".zdebug_line",
+                      stash->syms, unit->line_offset,
+                      &stash->dwarf_line_buffer, &stash->dwarf_line_size))
+    return 0;
 
   amt = sizeof (struct line_info_table);
   table = bfd_alloc (abfd, amt);
@@ -1568,27 +1570,9 @@
 read_debug_ranges (struct comp_unit *unit)
 {
   struct dwarf2_debug *stash = unit->stash;
-  if (! stash->dwarf_ranges_buffer)
-    {
-      bfd *abfd = unit->abfd;
-      asection *msec;
-
-      msec = bfd_get_section_by_name (abfd, ".debug_ranges");
-      if (! msec)
-	{
-	  (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_ranges section."));
-	  bfd_set_error (bfd_error_bad_value);
-	  return FALSE;
-	}
-
-      stash->dwarf_ranges_size = msec->size;
-      stash->dwarf_ranges_buffer
-	= bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
-						     stash->syms);
-      if (! stash->dwarf_ranges_buffer)
-	return FALSE;
-    }
-  return TRUE;
+  return read_section (unit->abfd, ".debug_ranges", ".zdebug_ranges",
+                       stash->syms, 0,
+                       &stash->dwarf_ranges_buffer, &stash->dwarf_ranges_size);
 }
 
 /* Function table functions.  */
@@ -2461,6 +2445,7 @@
    identify and discard duplicate debugging sections for different
    compilation units.  */
 #define DWARF2_DEBUG_INFO ".debug_info"
+#define DWARF2_COMPRESSED_DEBUG_INFO ".zdebug_info"
 #define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
 
 static asection *
@@ -2475,6 +2460,9 @@
       if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0)
 	return msec;
 
+      if (strcmp (msec->name, DWARF2_COMPRESSED_DEBUG_INFO) == 0)
+	return msec;
+
       if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO))
 	return msec;
 
@@ -2916,41 +2904,100 @@
       else
 	debug_bfd = abfd;
 
-      /* There can be more than one DWARF2 info section in a BFD these days.
-	 Read them all in and produce one large stash.  We do this in two
-	 passes - in the first pass we just accumulate the section sizes.
-	 In the second pass we read in the section's contents.  The allows
-	 us to avoid reallocing the data as we add sections to the stash.  */
-      for (total_size = 0; msec; msec = find_debug_info (debug_bfd, msec))
-	total_size += msec->size;
+      /* There can be more than one DWARF2 info section in a BFD these
+         days.  First handle the easy case when there's only one.  If
+         there's more than one, try case two: none of the sections is
+         compressed.  In that case, read them all in and produce one
+         large stash.  We do this in two passes - in the first pass we
+         just accumulate the section sizes, and in the second pass we
+         read in the section's contents.  (The allows us to avoid
+         reallocing the data as we add sections to the stash.)  If
+         some or all sections are compressed, then do things the slow
+         way, with a bunch of reallocs.  */
 
-      stash->info_ptr = bfd_alloc (debug_bfd, total_size);
-      if (stash->info_ptr == NULL)
-	goto done;
+      if (! find_debug_info (debug_bfd, msec))
+        {
+          /* Case 1: only one info section.  */
+          total_size = msec->size;
+          if (! read_section (debug_bfd, ".debug_info", ".zdebug_info",
+                              symbols, 0,
+                              &stash->info_ptr_memory, &total_size))
+            goto done;
+          stash->info_ptr = stash->info_ptr_memory;
+          stash->info_ptr_end = stash->info_ptr + total_size;
+        }
+      else
+        {
+          int all_uncompressed = 1;
+          for (total_size = 0; msec; msec = find_debug_info (debug_bfd, msec))
+            {
+              total_size += msec->size;
+              if (strcmp (msec->name, DWARF2_COMPRESSED_DEBUG_INFO) == 0)
+                all_uncompressed = 0;
+            }
+          if (all_uncompressed)
+            {
+              /* Case 2: multiple sections, but none is compressed.  */
+              stash->info_ptr_memory = bfd_malloc (total_size);
+              if (stash->info_ptr_memory == NULL)
+        	goto done;
 
-      stash->info_ptr_end = stash->info_ptr;
+              stash->info_ptr = stash->info_ptr_memory;
+              stash->info_ptr_end = stash->info_ptr;
 
-      for (msec = find_debug_info (debug_bfd, NULL);
-	   msec;
-	   msec = find_debug_info (debug_bfd, msec))
-	{
-	  bfd_size_type size;
-	  bfd_size_type start;
+              for (msec = find_debug_info (debug_bfd, NULL);
+        	   msec;
+        	   msec = find_debug_info (debug_bfd, msec))
+        	{
+        	  bfd_size_type size;
+        	  bfd_size_type start;
 
-	  size = msec->size;
-	  if (size == 0)
-	    continue;
+        	  size = msec->size;
+        	  if (size == 0)
+        	    continue;
 
-	  start = stash->info_ptr_end - stash->info_ptr;
+        	  start = stash->info_ptr_end - stash->info_ptr;
 
-	  if ((bfd_simple_get_relocated_section_contents
-	       (debug_bfd, msec, stash->info_ptr + start, symbols)) == NULL)
-	    continue;
+        	  if ((bfd_simple_get_relocated_section_contents
+        	       (debug_bfd, msec, stash->info_ptr + start, symbols))
+                      == NULL)
+        	    continue;
 
-	  stash->info_ptr_end = stash->info_ptr + start + size;
-	}
+        	  stash->info_ptr_end = stash->info_ptr + start + size;
+        	}
 
-      BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
+              BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
+            }
+          else
+            {
+              /* Case 3: multiple sections, some or all compressed.  */
+              stash->info_ptr_memory = bfd_malloc (1);
+              stash->info_ptr = stash->info_ptr_memory;
+              stash->info_ptr_end = stash->info_ptr;
+              for (msec = find_debug_info (debug_bfd, NULL);
+        	   msec;
+        	   msec = find_debug_info (debug_bfd, msec))
+        	{
+                  bfd_size_type size = msec->size;
+                  bfd_byte* buffer
+                      = (bfd_simple_get_relocated_section_contents
+                         (debug_bfd, msec, NULL, symbols));
+                  if (! buffer)
+                    continue;
+                  if (strcmp (msec->name, DWARF2_COMPRESSED_DEBUG_INFO) == 0)
+                    {
+                      if (! bfd_uncompress_section_contents (&buffer, &size))
+                        continue;
+                    }
+                  stash->info_ptr = bfd_realloc (stash->info_ptr,
+                                                 stash->info_ptr_end
+                                                 - stash->info_ptr + size);
+                  memcpy (stash->info_ptr_end, buffer, size);
+                  free (buffer);
+                  stash->info_ptr_end += size;
+                }
+            }
+        }
 
       stash->sec = find_debug_info (debug_bfd, NULL);
       stash->sec_info_ptr = stash->info_ptr;
@@ -3254,4 +3301,5 @@
   free (stash->dwarf_abbrev_buffer);
   free (stash->dwarf_line_buffer);
   free (stash->dwarf_ranges_buffer);
+  free (stash->info_ptr_memory);
 }
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 61ce3e1..37c4f3b 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1212,7 +1212,7 @@
       value -= offset;
       value += addend;
 
-      if ((long) value > 0xff || (long) value < -0x100)
+      if ((long) value > 0x7f || (long) value < -0x80)
 	return bfd_reloc_overflow;
 
       bfd_put_8 (input_bfd, value, hit_data);
@@ -1224,7 +1224,7 @@
       value -= offset;
       value += addend;
 
-      if ((long) value > 0xffff || (long) value < -0x10000)
+      if ((long) value > 0x7fff || (long) value < -0x8000)
 	return bfd_reloc_overflow;
 
       bfd_put_16 (input_bfd, value, hit_data);
@@ -1264,7 +1264,7 @@
       value -= offset;
       value += addend;
 
-      if ((long) value > 0xffff || (long) value < -0x10000)
+      if ((long) value > 0x7fff || (long) value < -0x8000)
 	return bfd_reloc_overflow;
 
       bfd_put_16 (input_bfd, value, hit_data);
@@ -1296,7 +1296,7 @@
 					".got")->output_section->vma;
       value += addend;
 
-      if ((long) value > 0xffff || (long) value < -0x10000)
+      if ((long) value > 0x7fff || (long) value < -0x8000)
 	return bfd_reloc_overflow;
 
       bfd_put_16 (input_bfd, value, hit_data);
@@ -1345,7 +1345,7 @@
       value -= offset;
       value += addend;
 
-      if ((long) value > 0xffff || (long) value < -0x10000)
+      if ((long) value > 0x7fff || (long) value < -0x8000)
 	return bfd_reloc_overflow;
 
       bfd_put_16 (input_bfd, value, hit_data);
@@ -1433,7 +1433,7 @@
 	}
       else if (r_type == R_MN10300_GOT16)
 	{
-	  if ((long) value > 0xffff || (long) value < -0x10000)
+	  if ((long) value > 0x7fff || (long) value < -0x8000)
 	    return bfd_reloc_overflow;
 
 	  bfd_put_16 (input_bfd, value, hit_data);
@@ -2751,6 +2751,8 @@
   for (irel = internal_relocs; irel < irelend; irel++)
     {
       bfd_vma symval;
+      bfd_signed_vma jump_offset;
+      asection *sym_sec = NULL;
       struct elf32_mn10300_link_hash_entry *h = NULL;
 
       /* If this isn't something that can be relaxed, then ignore
@@ -2790,7 +2792,6 @@
       if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
 	{
 	  Elf_Internal_Sym *isym;
-	  asection *sym_sec = NULL;
 	  const char *sym_name;
 	  char *new_name;
 
@@ -2857,6 +2858,8 @@
 	  if (h->root.root.u.def.section->output_section == NULL)
 	    continue;
 
+	  sym_sec = h->root.root.u.def.section->output_section;
+
 	  symval = (h->root.root.u.def.value
 		    + h->root.root.u.def.section->output_section->vma
 		    + h->root.root.u.def.section->output_offset);
@@ -2959,10 +2962,15 @@
 
 	  /* See if the value will fit in 16 bits, note the high value is
 	     0x7fff + 2 as the target will be two bytes closer if we are
-	     able to relax.  */
+	     able to relax, if it's in the same section.  */
+	  if (sec->output_section == sym_sec->output_section)
+	    jump_offset = 0x8001;
+	  else
+	    jump_offset = 0x7fff;
+
 	  /* Account for jumps across alignment boundaries using
 	     align_gap_adjustment.  */
-	  if ((bfd_signed_vma) value < 0x8001 - (bfd_signed_vma) align_gap_adjustment
+	  if ((bfd_signed_vma) value < jump_offset - (bfd_signed_vma) align_gap_adjustment
 	      && ((bfd_signed_vma) value > -0x8000 + (bfd_signed_vma) align_gap_adjustment))
 	    {
 	      unsigned char code;
diff --git a/bfd/elf.c b/bfd/elf.c
index c5da23b..d65c78d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -890,7 +890,14 @@
 	  { NULL,		 0  },	/* 'p' */
 	  { NULL,		 0  },	/* 'q' */
 	  { NULL,		 0  },	/* 'r' */
-	  { STRING_COMMA_LEN ("stab") }	/* 's' */
+	  { STRING_COMMA_LEN ("stab") },	/* 's' */
+	  { NULL,		 0  },	/* 't' */
+	  { NULL,		 0  },	/* 'u' */
+	  { NULL,		 0  },	/* 'v' */
+	  { NULL,		 0  },	/* 'w' */
+	  { NULL,		 0  },	/* 'x' */
+	  { NULL,		 0  },	/* 'y' */
+	  { STRING_COMMA_LEN ("zdebug") }	/* 'z' */
 	};
 
       if (name [0] == '.')
@@ -2119,6 +2126,15 @@
   { NULL,                     0,  0, 0,            0 }
 };
 
+static const struct bfd_elf_special_section special_sections_z[] =
+{
+  { STRING_COMMA_LEN (".zdebug_line"),    0, SHT_PROGBITS, 0 },
+  { STRING_COMMA_LEN (".zdebug_info"),    0, SHT_PROGBITS, 0 },
+  { STRING_COMMA_LEN (".zdebug_abbrev"),  0, SHT_PROGBITS, 0 },
+  { STRING_COMMA_LEN (".zdebug_aranges"), 0, SHT_PROGBITS, 0 },
+  { NULL,                     0,  0, 0,            0 }
+};
+
 static const struct bfd_elf_special_section *special_sections[] =
 {
   special_sections_b,		/* 'b' */
@@ -2140,6 +2156,12 @@
   special_sections_r,		/* 'r' */
   special_sections_s,		/* 's' */
   special_sections_t,		/* 't' */
+  NULL,				/* 'u' */
+  NULL,				/* 'v' */
+  NULL,				/* 'w' */
+  NULL,				/* 'x' */
+  NULL,				/* 'y' */
+  special_sections_z		/* 'z' */
 };
 
 const struct bfd_elf_special_section *
@@ -2216,7 +2238,7 @@
     return NULL;
 
   i = sec->name[1] - 'b';
-  if (i < 0 || i > 't' - 'b')
+  if (i < 0 || i > 'z' - 'b')
     return NULL;
 
   spec = special_sections[i];
@@ -8761,7 +8783,7 @@
   count = relplt->size / hdr->sh_entsize;
   size = count * sizeof (asymbol);
   p = relplt->relocation;
-  for (i = 0; i < count; i++, p++)
+  for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel)
     size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
 
   s = *ret = bfd_malloc (size);
@@ -8771,7 +8793,7 @@
   names = (char *) (s + count);
   p = relplt->relocation;
   n = 0;
-  for (i = 0; i < count; i++, p++)
+  for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel)
     {
       size_t len;
       bfd_vma addr;
@@ -8785,6 +8807,7 @@
 	 we are defining a symbol, ensure one of them is set.  */
       if ((s->flags & BSF_LOCAL) == 0)
 	s->flags |= BSF_GLOBAL;
+      s->flags |= BSF_SYNTHETIC;
       s->section = plt;
       s->value = addr - plt->vma;
       s->name = names;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index e691300..2ee0bb2 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -1898,6 +1898,8 @@
 #define ARM_BX_GLUE_SECTION_NAME ".v4_bx"
 #define ARM_BX_GLUE_ENTRY_NAME   "__bx_r%d"
 
+#define STUB_ENTRY_NAME   "__%s_veneer"
+
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
 #define ELF_DYNAMIC_INTERPRETER     "/usr/lib/ld.so.1"
@@ -2024,8 +2026,8 @@
   {
     0x4e02b540,         /* push {r6, lr} */
                         /* ldr  r6, [pc, #8] */
-    0xe7fe46fe,         /* mov  lr, pc */
-                        /* b.n  r6 */
+    0x473046fe,         /* mov  lr, pc */
+                        /* bx   r6 */
     0xbf00bd40,         /* pop  {r6, pc} */
                         /* nop */
     0x00000000,         /* dcd  R_ARM_ABS32(X) */
@@ -2046,7 +2048,7 @@
   {
     0xe59fc000,         /* ldr   r12, [pc] */
     0xe08ff00c,         /* add   pc, pc, ip */
-    0x00000000,         /* dcd   R_ARM_ABS32(X) */
+    0x00000000,         /* dcd   R_ARM_REL32(X) */
   };
 
 /* Section name for stubs is the associated section name plus this
@@ -2090,6 +2092,11 @@
   /* Where this stub is being called from, or, in the case of combined
      stub sections, the first input section in the group.  */
   asection *id_sec;
+
+  /* The name for the local symbol at the start of this stub.  The
+     stub name in the hash table has to be unique; this does not, so
+     it can be friendlier.  */
+  char *output_name;
 };
 
 /* Used to build a map of a section.  This is required for mixed-endian
@@ -2770,7 +2777,7 @@
 
   /* If the call will go through a PLT entry then we do not need
      glue.  */
-  if (globals->splt != NULL && hash->root.plt.offset != (bfd_vma) -1)
+  if (globals->splt != NULL && hash != NULL && hash->root.plt.offset != (bfd_vma) -1)
     return stub_type;
 
   if (r_type == R_ARM_THM_CALL)
@@ -3111,32 +3118,30 @@
     {
     case arm_stub_long_branch:
       _bfd_final_link_relocate (elf32_arm_howto_from_type (R_ARM_ABS32),
-				stub_bfd, stub_sec, stub_sec->contents + 4,
-				stub_entry->stub_offset, sym_value, 0);
+				stub_bfd, stub_sec, stub_sec->contents,
+				stub_entry->stub_offset + 4, sym_value, 0);
       break;
     case arm_thumb_v4t_stub_long_branch:
       _bfd_final_link_relocate (elf32_arm_howto_from_type (R_ARM_ABS32),
-				stub_bfd, stub_sec, stub_sec->contents + 8,
-				stub_entry->stub_offset, sym_value, 0);
+				stub_bfd, stub_sec, stub_sec->contents,
+				stub_entry->stub_offset + 8, sym_value, 0);
       break;
     case arm_thumb_thumb_stub_long_branch:
       _bfd_final_link_relocate (elf32_arm_howto_from_type (R_ARM_ABS32),
-				stub_bfd, stub_sec, stub_sec->contents + 12,
-				stub_entry->stub_offset, sym_value, 0);
+				stub_bfd, stub_sec, stub_sec->contents,
+				stub_entry->stub_offset + 12, sym_value, 0);
       break;
     case arm_thumb_arm_v4t_stub_long_branch:
       _bfd_final_link_relocate (elf32_arm_howto_from_type (R_ARM_ABS32),
-				stub_bfd, stub_sec, stub_sec->contents + 20,
-				stub_entry->stub_offset, sym_value, 0);
+				stub_bfd, stub_sec, stub_sec->contents,
+				stub_entry->stub_offset + 16, sym_value, 0);
       break;
     case arm_stub_pic_long_branch:
       /* We want the value relative to the address 8 bytes from the
 	 start of the stub.  */
-      sym_value -= stub_addr + 8;
-
-      _bfd_final_link_relocate (elf32_arm_howto_from_type (R_ARM_ABS32),
-				stub_bfd, stub_sec, stub_sec->contents + 8,
-				stub_entry->stub_offset, sym_value, 0);
+      _bfd_final_link_relocate (elf32_arm_howto_from_type (R_ARM_REL32),
+				stub_bfd, stub_sec, stub_sec->contents,
+				stub_entry->stub_offset + 8, sym_value, 0);
       break;
     default:
       break;
@@ -3484,6 +3489,7 @@
 		  bfd_vma sym_value;
 		  bfd_vma destination;
 		  struct elf32_arm_link_hash_entry *hash;
+		  const char *sym_name;
 		  char *stub_name;
 		  const asection *id_sec;
 		  unsigned char st_type;
@@ -3511,6 +3517,7 @@
 		  sym_value = 0;
 		  destination = 0;
 		  hash = NULL;
+		  sym_name = NULL;
 		  if (r_indx < symtab_hdr->sh_info)
 		    {
 		      /* It's a local symbol.  */
@@ -3539,6 +3546,10 @@
 				     + sym_sec->output_offset
 				     + sym_sec->output_section->vma);
 		      st_type = ELF_ST_TYPE (sym->st_info);
+		      sym_name
+			= bfd_elf_string_from_elf_section (input_bfd,
+							   symtab_hdr->sh_link,
+							   sym->st_name);
 		    }
 		  else
 		    {
@@ -3576,6 +3587,7 @@
 			  goto error_ret_free_internal;
 			}
 		      st_type = ELF_ST_TYPE (hash->root.type);
+		      sym_name = hash->root.root.root.string;
 		    }
 
 		  /* Determine what (if any) linker stub is needed.  */
@@ -3614,6 +3626,33 @@
 		  stub_entry->stub_type = stub_type;
 		  stub_entry->h = hash;
 		  stub_entry->st_type = st_type;
+
+		  if (sym_name == NULL)
+		    sym_name = "unnamed";
+		  stub_entry->output_name
+		    = bfd_alloc (htab->stub_bfd,
+				 sizeof (THUMB2ARM_GLUE_ENTRY_NAME)
+				 + strlen (sym_name));
+		  if (stub_entry->output_name == NULL)
+		    {
+		      free (stub_name);
+		      goto error_ret_free_internal;
+		    }
+
+		  /* For historical reasons, use the existing names for
+		     ARM-to-Thumb and Thumb-to-ARM stubs.  */
+		  if (r_type == (unsigned int) R_ARM_THM_CALL
+		      && st_type != STT_ARM_TFUNC)
+		    sprintf (stub_entry->output_name, THUMB2ARM_GLUE_ENTRY_NAME,
+			     sym_name);
+		  else if (r_type == (unsigned int) R_ARM_CALL
+			   && st_type == STT_ARM_TFUNC)
+		    sprintf (stub_entry->output_name, ARM2THUMB_GLUE_ENTRY_NAME,
+			     sym_name);
+		  else
+		    sprintf (stub_entry->output_name, STUB_ENTRY_NAME,
+			     sym_name);
+
 		  stub_changed = TRUE;
 		}
 
@@ -3942,7 +3981,8 @@
 
   /* The only trick here is using hash_table->arm_glue_size as the value.
      Even though the section isn't allocated yet, this is where we will be
-     putting it.  */
+     putting it.  The +1 on the value marks that the stub has not been
+     output yet - not that it is a Thumb function.  */
   bh = NULL;
   val = globals->arm_glue_size + 1;
   _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner,
@@ -4008,6 +4048,10 @@
       return;
     }
 
+  /* The only trick here is using hash_table->thumb_glue_size as the value.
+     Even though the section isn't allocated yet, this is where we will be
+     putting it.  The +1 on the value marks that the stub has not been
+     output yet - not that it is a Thumb function.  */
   bh = NULL;
   val = hash_table->thumb_glue_size + 1;
   _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner,
@@ -11030,12 +11074,12 @@
 };
 
 
-/* Output a single PLT mapping symbol.  */
+/* Output a single mapping symbol.  */
 
 static bfd_boolean
-elf32_arm_ouput_plt_map_sym (output_arch_syminfo *osi,
-			     enum map_symbol_type type,
-			     bfd_vma offset)
+elf32_arm_output_map_sym (output_arch_syminfo *osi,
+			  enum map_symbol_type type,
+			  bfd_vma offset)
 {
   static const char *names[3] = {"$a", "$t", "$d"};
   struct elf32_arm_link_hash_table *htab;
@@ -11083,20 +11127,20 @@
   addr = h->plt.offset;
   if (htab->symbian_p)
     {
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 4))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 4))
 	return FALSE;
     }
   else if (htab->vxworks_p)
     {
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 8))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 8))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr + 12))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr + 12))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 20))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 20))
 	return FALSE;
     }
   else
@@ -11109,13 +11153,13 @@
 
       if (thumb_refs > 0)
 	{
-	  if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_THUMB, addr - 4))
+	  if (!elf32_arm_output_map_sym (osi, ARM_MAP_THUMB, addr - 4))
 	    return FALSE;
 	}
 #ifdef FOUR_WORD_PLT
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 12))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 12))
 	return FALSE;
 #else
       /* A three-word PLT with no Thumb thunk contains only Arm code,
@@ -11123,7 +11167,7 @@
 	 entries with thumb thunks.  */
       if (thumb_refs > 0 || addr == 20)
 	{
-	  if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+	  if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
 	    return FALSE;
 	}
 #endif
@@ -11132,6 +11176,27 @@
   return TRUE;
 }
 
+/* Output a single local symbol for a generated stub.  */
+
+static bfd_boolean
+elf32_arm_output_stub_sym (output_arch_syminfo *osi, const char *name,
+			   bfd_vma offset, bfd_vma size)
+{
+  struct elf32_arm_link_hash_table *htab;
+  Elf_Internal_Sym sym;
+
+  htab = elf32_arm_hash_table (osi->info);
+  sym.st_value = osi->sec->output_section->vma
+		 + osi->sec->output_offset
+		 + offset;
+  sym.st_size = size;
+  sym.st_other = 0;
+  sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+  sym.st_shndx = osi->sec_shndx;
+  if (!osi->func (osi->finfo, name, &sym, osi->sec, NULL))
+    return FALSE;
+  return TRUE;
+}
 
 static bfd_boolean
 arm_map_one_stub (struct bfd_hash_entry *gen_entry,
@@ -11142,6 +11207,7 @@
   struct elf32_arm_link_hash_table *htab;
   asection *stub_sec;
   bfd_vma addr;
+  char *stub_name;
 
   /* Massage our args to the form they really have.  */
   stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry;
@@ -11153,48 +11219,60 @@
   stub_sec = stub_entry->stub_sec;
 
   /* Ensure this stub is attached to the current section being
-     processed */
+     processed.  */
   if (stub_sec != osi->sec)
     return TRUE;
 
-  addr = (bfd_vma)stub_entry->stub_offset;
+  addr = (bfd_vma) stub_entry->stub_offset;
+  stub_name = stub_entry->output_name;
 
-  switch(stub_entry->stub_type) {
+  switch (stub_entry->stub_type)
+    {
     case arm_stub_long_branch:
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+      if (!elf32_arm_output_stub_sym (osi, stub_name, addr, 8))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 4))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
+	return FALSE;
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 4))
 	return FALSE;
       break;
     case arm_thumb_v4t_stub_long_branch:
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+      if (!elf32_arm_output_stub_sym (osi, stub_name, addr, 12))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 8))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
+	return FALSE;
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 8))
 	return FALSE;
       break;
     case arm_thumb_thumb_stub_long_branch:
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_THUMB, addr))
+      if (!elf32_arm_output_stub_sym (osi, stub_name, addr | 1, 16))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 12))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_THUMB, addr))
+	return FALSE;
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 12))
 	return FALSE;
       break;
     case arm_thumb_arm_v4t_stub_long_branch:
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_THUMB, addr))
+      if (!elf32_arm_output_stub_sym (osi, stub_name, addr | 1, 20))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr + 8))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_THUMB, addr))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 16))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr + 8))
+	return FALSE;
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 16))
 	return FALSE;
       break;
     case arm_stub_pic_long_branch:
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+      if (!elf32_arm_output_stub_sym (osi, stub_name, addr, 12))
 	return FALSE;
-      if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 8))
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
+	return FALSE;
+      if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 8))
 	return FALSE;
       break;
     default:
       BFD_FAIL ();
-  }
+    }
 
   return TRUE;
 }
@@ -11240,8 +11318,8 @@
 
       for (offset = 0; offset < htab->arm_glue_size; offset += size)
 	{
-	  elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset);
-	  elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, offset + size - 4);
+	  elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, offset);
+	  elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, offset + size - 4);
 	}
     }
 
@@ -11257,8 +11335,8 @@
 
       for (offset = 0; offset < htab->thumb_glue_size; offset += size)
 	{
-	  elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_THUMB, offset);
-	  elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset + 4);
+	  elf32_arm_output_map_sym (&osi, ARM_MAP_THUMB, offset);
+	  elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, offset + 4);
 	}
     }
 
@@ -11271,7 +11349,7 @@
       osi.sec_shndx = _bfd_elf_section_from_bfd_section
 	  (output_bfd, osi.sec->output_section);
 
-      elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0);
+      elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0);
     }
 
   /* Long calls stubs. */
@@ -11308,18 +11386,18 @@
       /* VxWorks shared libraries have no PLT header.  */
       if (!info->shared)
 	{
-	  if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0))
+	  if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
 	    return FALSE;
-	  if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 12))
+	  if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 12))
 	    return FALSE;
 	}
     }
   else if (!htab->symbian_p)
     {
-      if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0))
+      if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
 	return FALSE;
 #ifndef FOUR_WORD_PLT
-      if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 16))
+      if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 16))
 	return FALSE;
 #endif
     }
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index f83abd2..a5c2400 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1131,7 +1131,592 @@
 
   return _bfd_elf_is_local_label_name (abfd, label);
 }
+
+/* Look through the relocs for a section during the first phase, and
+   allocate space in the global offset table or procedure linkage
+   table.  */
 
+static bfd_boolean
+bfin_check_relocs (bfd * abfd,
+		   struct bfd_link_info *info,
+		   asection *sec,
+                   const Elf_Internal_Rela *relocs)
+{
+  bfd *dynobj;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  bfd_signed_vma *local_got_refcounts;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+  asection *sgot;
+  asection *srelgot;
+  asection *sreloc;
+  if (info->relocatable)
+    return TRUE;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
+  sgot = NULL;
+  srelgot = NULL;
+  sreloc = NULL;
+
+  rel_end = relocs + sec->reloc_count;
+  for (rel = relocs; rel < rel_end; rel++)
+    {
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx < symtab_hdr->sh_info)
+	h = NULL;
+      else
+	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+      switch (ELF32_R_TYPE (rel->r_info))
+	{
+       /* This relocation describes the C++ object vtable hierarchy.
+           Reconstruct it for later use during GC.  */
+        case R_BFIN_GNU_VTINHERIT:
+          if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+            return FALSE;
+          break;
+
+        /* This relocation describes which C++ vtable entries
+           are actually used.  Record for later use during GC.  */
+        case R_BFIN_GNU_VTENTRY:
+          BFD_ASSERT (h != NULL);
+          if (h != NULL
+              && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+            return FALSE;
+          break;
+
+	case R_got:
+	  if (h != NULL
+	      && strcmp (h->root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
+	    break;
+	  /* Fall through.  */
+
+	  if (dynobj == NULL)
+	    {
+	      /* Create the .got section.  */
+	      elf_hash_table (info)->dynobj = dynobj = abfd;
+	      if (!_bfd_elf_create_got_section (dynobj, info))
+		return FALSE;
+	    }
+
+	  if (sgot == NULL)
+	    {
+	      sgot = bfd_get_section_by_name (dynobj, ".got");
+	      BFD_ASSERT (sgot != NULL);
+	    }
+
+	  if (srelgot == NULL && (h != NULL || info->shared))
+	    {
+	      srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+	      if (srelgot == NULL)
+		{
+		  flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+				    | SEC_IN_MEMORY | SEC_LINKER_CREATED
+				    | SEC_READONLY);
+		  srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+							 flags);
+		  if (srelgot == NULL
+		      || !bfd_set_section_alignment (dynobj, srelgot, 2))
+		    return FALSE;
+		}
+	    }
+
+	  if (h != NULL)
+	    {
+	      if (h->got.refcount == 0)
+		{
+		  /* Make sure this symbol is output as a dynamic symbol.  */
+		  if (h->dynindx == -1 && !h->forced_local)
+		    {
+		      if (!bfd_elf_link_record_dynamic_symbol (info, h))
+			return FALSE;
+		    }
+
+		  /* Allocate space in the .got section.  */
+		  sgot->size += 4;
+		  /* Allocate relocation space.  */
+		  srelgot->size += sizeof (Elf32_External_Rela);
+		}
+	      h->got.refcount++;
+	    }
+	  else
+	    {
+	      /* This is a global offset table entry for a local symbol.  */
+	      if (local_got_refcounts == NULL)
+		{
+		  bfd_size_type size;
+
+		  size = symtab_hdr->sh_info;
+		  size *= sizeof (bfd_signed_vma);
+		  local_got_refcounts = ((bfd_signed_vma *)
+					 bfd_zalloc (abfd, size));
+		  if (local_got_refcounts == NULL)
+		    return FALSE;
+		  elf_local_got_refcounts (abfd) = local_got_refcounts;
+		}
+	      if (local_got_refcounts[r_symndx] == 0)
+		{
+		  sgot->size += 4;
+		  if (info->shared)
+		    {
+		      /* If we are generating a shared object, we need to
+		         output a R_68K_RELATIVE reloc so that the dynamic
+		         linker can adjust this GOT entry.  */
+		      srelgot->size += sizeof (Elf32_External_Rela);
+		    }
+		}
+	      local_got_refcounts[r_symndx]++;
+	    }
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+  return TRUE;
+}
+
+static enum elf_reloc_type_class
+elf32_bfin_reloc_type_class (const Elf_Internal_Rela * rela)
+{
+  switch ((int) ELF32_R_TYPE (rela->r_info))
+    {
+    default:
+      return reloc_class_normal;
+    }
+}
+
+static bfd_reloc_status_type
+bfin_final_link_relocate (Elf_Internal_Rela *rel, reloc_howto_type *howto,
+			  bfd *input_bfd, asection *input_section,
+			  bfd_byte *contents, bfd_vma address,
+			  bfd_vma value, bfd_vma addend)
+{
+  int r_type = ELF32_R_TYPE (rel->r_info);
+
+  if (r_type == R_pcrel24 || r_type == R_pcrel24_jump_l)
+    {
+      bfd_reloc_status_type r = bfd_reloc_ok;
+      bfd_vma x;
+
+      if (address > bfd_get_section_limit (input_bfd, input_section))
+	return bfd_reloc_outofrange;
+
+      value += addend;
+
+      /* Perform usual pc-relative correction.  */
+      value -= input_section->output_section->vma + input_section->output_offset;
+      value -= address;
+
+      /* We are getting reloc_entry->address 2 byte off from
+	 the start of instruction. Assuming absolute postion
+	 of the reloc data. But, following code had been written assuming
+	 reloc address is starting at begining of instruction.
+	 To compensate that I have increased the value of
+	 relocation by 1 (effectively 2) and used the addr -2 instead of addr.  */
+
+      value += 2;
+      address -= 2;
+
+      if ((value & 0xFF000000) != 0
+	  && (value & 0xFF000000) != 0xFF000000)
+	r = bfd_reloc_overflow;
+
+      value >>= 1;
+
+      x = bfd_get_16 (input_bfd, contents + address);
+      x = (x & 0xff00) | ((value >> 16) & 0xff);
+      bfd_put_16 (input_bfd, x, contents + address);
+
+      x = bfd_get_16 (input_bfd, contents + address + 2);
+      x = value & 0xFFFF;
+      bfd_put_16 (input_bfd, x, contents + address + 2);
+      return r;
+    }
+
+  return _bfd_final_link_relocate (howto, input_bfd, input_section, contents,
+				   rel->r_offset, value, addend);
+
+}
+
+static bfd_boolean
+bfin_relocate_section (bfd * output_bfd,
+		       struct bfd_link_info *info,
+		       bfd * input_bfd,
+		       asection * input_section,
+		       bfd_byte * contents,
+		       Elf_Internal_Rela * relocs,
+		       Elf_Internal_Sym * local_syms,
+		       asection ** local_sections)
+{
+  bfd *dynobj;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  bfd_vma *local_got_offsets;
+  asection *sgot;
+  asection *sreloc;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+  int i = 0;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (input_bfd);
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+
+  sgot = NULL;
+  sreloc = NULL;
+
+  rel = relocs;
+  relend = relocs + input_section->reloc_count;
+  for (; rel < relend; rel++, i++)
+    {
+      int r_type;
+      reloc_howto_type *howto;
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+      Elf_Internal_Sym *sym;
+      asection *sec;
+      bfd_vma relocation = 0;
+      bfd_boolean unresolved_reloc;
+      bfd_reloc_status_type r;
+      bfd_vma address;
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+      if (r_type < 0 || r_type >= 243)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return FALSE;
+	}
+
+      if (r_type == R_BFIN_GNU_VTENTRY
+          || r_type == R_BFIN_GNU_VTINHERIT)
+	continue;
+
+      howto = bfin_reloc_type_lookup (input_bfd, r_type);
+      if (howto == NULL)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return FALSE;
+	}
+      r_symndx = ELF32_R_SYM (rel->r_info);
+
+      h = NULL;
+      sym = NULL;
+      sec = NULL;
+      unresolved_reloc = FALSE;
+
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections[r_symndx];
+	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+	}
+      else
+	{
+	  bfd_boolean warned;
+
+	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+				   r_symndx, symtab_hdr, sym_hashes,
+				   h, sec, relocation,
+				   unresolved_reloc, warned);
+	}
+
+      if (sec != NULL && elf_discarded_section (sec))
+	{
+	  /* For relocs against symbols from removed linkonce sections,
+	     or sections discarded by a linker script, we just want the
+	     section contents zeroed.  Avoid any special processing.  */
+	  _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+	  rel->r_info = 0;
+	  rel->r_addend = 0;
+	  continue;
+	}
+
+      if (info->relocatable)
+	continue;
+
+      address = rel->r_offset;
+
+      /* Then, process normally.  */
+      switch (r_type)
+	{
+	case R_BFIN_GNU_VTINHERIT:
+	case R_BFIN_GNU_VTENTRY:
+	  return bfd_reloc_ok;
+
+	case R_got:
+	  /* Relocation is to the address of the entry for this symbol
+	     in the global offset table.  */
+	  if (h != NULL
+	      && strcmp (h->root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
+	    goto do_default;
+	  /* Fall through.  */
+	  /* Relocation is the offset of the entry for this symbol in
+	     the global offset table.  */
+
+	  {
+	    bfd_vma off;
+
+	  if (dynobj == NULL)
+	    {
+	      /* Create the .got section.  */
+	      elf_hash_table (info)->dynobj = dynobj = output_bfd;
+	      if (!_bfd_elf_create_got_section (dynobj, info))
+		return FALSE;
+	    }
+
+	    if (sgot == NULL)
+	      {
+		sgot = bfd_get_section_by_name (dynobj, ".got");
+		BFD_ASSERT (sgot != NULL);
+	      }
+
+	    if (h != NULL)
+	      {
+		bfd_boolean dyn;
+
+		off = h->got.offset;
+		BFD_ASSERT (off != (bfd_vma) - 1);
+		dyn = elf_hash_table (info)->dynamic_sections_created;
+
+		if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+		    || (info->shared
+			&& (info->symbolic
+			    || h->dynindx == -1
+			    || h->forced_local)
+			&& h->def_regular))
+		  {
+		    /* This is actually a static link, or it is a
+		       -Bsymbolic link and the symbol is defined
+		       locally, or the symbol was forced to be local
+		       because of a version file..  We must initialize
+		       this entry in the global offset table.  Since
+		       the offset must always be a multiple of 4, we
+		       use the least significant bit to record whether
+		       we have initialized it already.
+
+		       When doing a dynamic link, we create a .rela.got
+		       relocation entry to initialize the value.  This
+		       is done in the finish_dynamic_symbol routine.  */
+		    if ((off & 1) != 0)
+		      off &= ~1;
+		    else
+		      {
+			bfd_put_32 (output_bfd, relocation,
+				    sgot->contents + off);
+			h->got.offset |= 1;
+		      }
+		  }
+		else
+		  unresolved_reloc = FALSE;
+	      }
+	    else
+	      {
+		BFD_ASSERT (local_got_offsets != NULL);
+		off = local_got_offsets[r_symndx];
+		BFD_ASSERT (off != (bfd_vma) - 1);
+
+		/* The offset must always be a multiple of 4.  We use
+		   the least significant bit to record whether we have
+		   already generated the necessary reloc.  */
+		if ((off & 1) != 0)
+		  off &= ~1;
+		else
+		  {
+		    bfd_put_32 (output_bfd, relocation, sgot->contents + off);
+
+		    if (info->shared)
+		      {
+			asection *s;
+			Elf_Internal_Rela outrel;
+			bfd_byte *loc;
+
+			s = bfd_get_section_by_name (dynobj, ".rela.got");
+			BFD_ASSERT (s != NULL);
+
+			outrel.r_offset = (sgot->output_section->vma
+					   + sgot->output_offset + off);
+			outrel.r_info =
+			  ELF32_R_INFO (0, R_pcrel24);
+			outrel.r_addend = relocation;
+			loc = s->contents;
+			loc +=
+			  s->reloc_count++ * sizeof (Elf32_External_Rela);
+			bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+		      }
+
+		    local_got_offsets[r_symndx] |= 1;
+		  }
+	      }
+
+	    relocation = sgot->output_offset + off;
+	    rel->r_addend = 0;
+            /* bfin : preg = [preg + 17bitdiv4offset] relocation is div by 4.  */
+            relocation /= 4;
+	  }
+	  goto do_default;
+
+	default:
+	do_default:
+	  r = bfin_final_link_relocate (rel, howto, input_bfd, input_section,
+					contents, address,
+					relocation, rel->r_addend);
+
+	  break;
+	}
+
+      /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
+         because such sections are not SEC_ALLOC and thus ld.so will
+         not process them.  */
+      if (unresolved_reloc
+	  && !((input_section->flags & SEC_DEBUGGING) != 0 && h->def_dynamic))
+	{
+	  (*_bfd_error_handler)
+	    (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
+	     input_bfd,
+	     input_section, (long) rel->r_offset, h->root.root.string);
+	  return FALSE;
+	}
+
+      if (r != bfd_reloc_ok)
+	{
+	  const char *name;
+
+	  if (h != NULL)
+	    name = h->root.root.string;
+	  else
+	    {
+	      name = bfd_elf_string_from_elf_section (input_bfd,
+						      symtab_hdr->sh_link,
+						      sym->st_name);
+	      if (name == NULL)
+		return FALSE;
+	      if (*name == '\0')
+		name = bfd_section_name (input_bfd, sec);
+	    }
+
+	  if (r == bfd_reloc_overflow)
+	    {
+	      if (!(info->callbacks->reloc_overflow
+		    (info, (h ? &h->root : NULL), name, howto->name,
+		     (bfd_vma) 0, input_bfd, input_section, rel->r_offset)))
+		return FALSE;
+	    }
+	  else
+	    {
+	      (*_bfd_error_handler)
+		(_("%B(%A+0x%lx): reloc against `%s': error %d"),
+		 input_bfd, input_section,
+		 (long) rel->r_offset, name, (int) r);
+	      return FALSE;
+	    }
+	}
+    }
+
+  return TRUE;
+}
+
+static asection *
+bfin_gc_mark_hook (asection * sec,
+		   struct bfd_link_info *info,
+		   Elf_Internal_Rela * rel,
+		   struct elf_link_hash_entry *h,
+                   Elf_Internal_Sym * sym)
+{
+  if (h != NULL)
+    switch (ELF32_R_TYPE (rel->r_info))
+      {
+      case R_BFIN_GNU_VTINHERIT:
+      case R_BFIN_GNU_VTENTRY:
+	return NULL;
+      }
+
+  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+}
+
+/* Update the got entry reference counts for the section being removed.  */
+
+static bfd_boolean
+bfin_gc_sweep_hook (bfd * abfd,
+		    struct bfd_link_info *info,
+		    asection * sec,
+                    const Elf_Internal_Rela * relocs)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  bfd_signed_vma *local_got_refcounts;
+  const Elf_Internal_Rela *rel, *relend;
+  bfd *dynobj;
+  asection *sgot;
+  asection *srelgot;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  if (dynobj == NULL)
+    return TRUE;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
+  sgot = bfd_get_section_by_name (dynobj, ".got");
+  srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+
+  relend = relocs + sec->reloc_count;
+  for (rel = relocs; rel < relend; rel++)
+    {
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+
+      switch (ELF32_R_TYPE (rel->r_info))
+	{
+	case R_got:
+	  r_symndx = ELF32_R_SYM (rel->r_info);
+	  if (r_symndx >= symtab_hdr->sh_info)
+	    {
+	      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	      if (h->got.refcount > 0)
+		{
+		  --h->got.refcount;
+		  if (h->got.refcount == 0)
+		    {
+		      /* We don't need the .got entry any more.  */
+		      sgot->size -= 4;
+		      srelgot->size -= sizeof (Elf32_External_Rela);
+		    }
+		}
+	    }
+	  else if (local_got_refcounts != NULL)
+	    {
+	      if (local_got_refcounts[r_symndx] > 0)
+		{
+		  --local_got_refcounts[r_symndx];
+		  if (local_got_refcounts[r_symndx] == 0)
+		    {
+		      /* We don't need the .got entry any more.  */
+		      sgot->size -= 4;
+		      if (info->shared)
+			srelgot->size -= sizeof (Elf32_External_Rela);
+		    }
+		}
+	    }
+	  break;
+	default:
+	  break;
+	}
+    }
+  return TRUE;
+}
+
 extern const bfd_target bfd_elf32_bfinfdpic_vec;
 #define IS_FDPIC(bfd) ((bfd)->xvec == &bfd_elf32_bfinfdpic_vec)
 
@@ -1183,6 +1768,37 @@
 #define bfinfdpic_plt_initial_offset(info) \
   (bfinfdpic_hash_table (info)->plt0)
 
+/* The name of the dynamic interpreter.  This is put in the .interp
+   section.  */
+
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+
+#define DEFAULT_STACK_SIZE 0x20000
+
+/* This structure is used to collect the number of entries present in
+   each addressable range of the got.  */
+struct _bfinfdpic_dynamic_got_info
+{
+  /* Several bits of information about the current link.  */
+  struct bfd_link_info *info;
+  /* Total size needed for GOT entries within the 18- or 32-bit
+     ranges.  */
+  bfd_vma got17m4, gothilo;
+  /* Total size needed for function descriptor entries within the 18-
+     or 32-bit ranges.  */
+  bfd_vma fd17m4, fdhilo;
+  /* Total size needed function descriptor entries referenced in PLT
+     entries, that would be profitable to place in offsets close to
+     the PIC register.  */
+  bfd_vma fdplt;
+  /* Total size needed by lazy PLT entries.  */
+  bfd_vma lzplt;
+  /* Number of relocations carried over from input object files.  */
+  unsigned long relocs;
+  /* Number of fixups introduced by relocations in input object files.  */
+  unsigned long fixups;
+};
+
 /* Create a Blackfin ELF linker hash table.  */
 
 static struct bfd_link_hash_table *
@@ -1905,224 +2521,6 @@
 
   return TRUE;
 }
-
-
-/* Look through the relocs for a section during the first phase, and
-   allocate space in the global offset table or procedure linkage
-   table.  */
-
-static bfd_boolean
-bfin_check_relocs (bfd * abfd,
-		   struct bfd_link_info *info,
-		   asection *sec,
-                   const Elf_Internal_Rela *relocs)
-{
-  bfd *dynobj;
-  Elf_Internal_Shdr *symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes;
-  bfd_signed_vma *local_got_refcounts;
-  const Elf_Internal_Rela *rel;
-  const Elf_Internal_Rela *rel_end;
-  asection *sgot;
-  asection *srelgot;
-  asection *sreloc;
-  if (info->relocatable)
-    return TRUE;
-
-  dynobj = elf_hash_table (info)->dynobj;
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (abfd);
-  local_got_refcounts = elf_local_got_refcounts (abfd);
-
-  sgot = NULL;
-  srelgot = NULL;
-  sreloc = NULL;
-
-  rel_end = relocs + sec->reloc_count;
-  for (rel = relocs; rel < rel_end; rel++)
-    {
-      unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
-
-      r_symndx = ELF32_R_SYM (rel->r_info);
-      if (r_symndx < symtab_hdr->sh_info)
-	h = NULL;
-      else
-	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
-      switch (ELF32_R_TYPE (rel->r_info))
-	{
-       /* This relocation describes the C++ object vtable hierarchy.
-           Reconstruct it for later use during GC.  */
-        case R_BFIN_GNU_VTINHERIT:
-          if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
-            return FALSE;
-          break;
-
-        /* This relocation describes which C++ vtable entries
-           are actually used.  Record for later use during GC.  */
-        case R_BFIN_GNU_VTENTRY:
-          BFD_ASSERT (h != NULL);
-          if (h != NULL
-              && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
-            return FALSE;
-          break;
-
-	case R_got:
-	  if (h != NULL
-	      && strcmp (h->root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
-	    break;
-	  /* Fall through.  */
-
-	  if (dynobj == NULL)
-	    {
-	      /* Create the .got section.  */
-	      elf_hash_table (info)->dynobj = dynobj = abfd;
-	      if (!_bfd_elf_create_got_section (dynobj, info))
-		return FALSE;
-	    }
-
-	  if (sgot == NULL)
-	    {
-	      sgot = bfd_get_section_by_name (dynobj, ".got");
-	      BFD_ASSERT (sgot != NULL);
-	    }
-
-	  if (srelgot == NULL && (h != NULL || info->shared))
-	    {
-	      srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-	      if (srelgot == NULL)
-		{
-		  flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
-				    | SEC_IN_MEMORY | SEC_LINKER_CREATED
-				    | SEC_READONLY);
-		  srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
-							 flags);
-		  if (srelgot == NULL
-		      || !bfd_set_section_alignment (dynobj, srelgot, 2))
-		    return FALSE;
-		}
-	    }
-
-	  if (h != NULL)
-	    {
-	      if (h->got.refcount == 0)
-		{
-		  /* Make sure this symbol is output as a dynamic symbol.  */
-		  if (h->dynindx == -1 && !h->forced_local)
-		    {
-		      if (!bfd_elf_link_record_dynamic_symbol (info, h))
-			return FALSE;
-		    }
-
-		  /* Allocate space in the .got section.  */
-		  sgot->size += 4;
-		  /* Allocate relocation space.  */
-		  srelgot->size += sizeof (Elf32_External_Rela);
-		}
-	      h->got.refcount++;
-	    }
-	  else
-	    {
-	      /* This is a global offset table entry for a local symbol.  */
-	      if (local_got_refcounts == NULL)
-		{
-		  bfd_size_type size;
-
-		  size = symtab_hdr->sh_info;
-		  size *= sizeof (bfd_signed_vma);
-		  local_got_refcounts = ((bfd_signed_vma *)
-					 bfd_zalloc (abfd, size));
-		  if (local_got_refcounts == NULL)
-		    return FALSE;
-		  elf_local_got_refcounts (abfd) = local_got_refcounts;
-		}
-	      if (local_got_refcounts[r_symndx] == 0)
-		{
-		  sgot->size += 4;
-		  if (info->shared)
-		    {
-		      /* If we are generating a shared object, we need to
-		         output a R_68K_RELATIVE reloc so that the dynamic
-		         linker can adjust this GOT entry.  */
-		      srelgot->size += sizeof (Elf32_External_Rela);
-		    }
-		}
-	      local_got_refcounts[r_symndx]++;
-	    }
-	  break;
-
-	default:
-	  break;
-	}
-    }
-
-  return TRUE;
-}
-
-static enum elf_reloc_type_class
-elf32_bfin_reloc_type_class (const Elf_Internal_Rela * rela)
-{
-  switch ((int) ELF32_R_TYPE (rela->r_info))
-    {
-    default:
-      return reloc_class_normal;
-    }
-}
-
-static bfd_reloc_status_type
-bfin_final_link_relocate (Elf_Internal_Rela *rel, reloc_howto_type *howto,
-			  bfd *input_bfd, asection *input_section,
-			  bfd_byte *contents, bfd_vma address,
-			  bfd_vma value, bfd_vma addend)
-{
-  int r_type = ELF32_R_TYPE (rel->r_info);
-
-  if (r_type == R_pcrel24 || r_type == R_pcrel24_jump_l)
-    {
-      bfd_reloc_status_type r = bfd_reloc_ok;
-      bfd_vma x;
-
-      if (address > bfd_get_section_limit (input_bfd, input_section))
-	return bfd_reloc_outofrange;
-
-      value += addend;
-
-      /* Perform usual pc-relative correction.  */
-      value -= input_section->output_section->vma + input_section->output_offset;
-      value -= address;
-
-      /* We are getting reloc_entry->address 2 byte off from
-	 the start of instruction. Assuming absolute postion
-	 of the reloc data. But, following code had been written assuming
-	 reloc address is starting at begining of instruction.
-	 To compensate that I have increased the value of
-	 relocation by 1 (effectively 2) and used the addr -2 instead of addr.  */
-
-      value += 2;
-      address -= 2;
-
-      if ((value & 0xFF000000) != 0
-	  && (value & 0xFF000000) != 0xFF000000)
-	r = bfd_reloc_overflow;
-
-      value >>= 1;
-
-      x = bfd_get_16 (input_bfd, contents + address);
-      x = (x & 0xff00) | ((value >> 16) & 0xff);
-      bfd_put_16 (input_bfd, x, contents + address);
-
-      x = bfd_get_16 (input_bfd, contents + address + 2);
-      x = value & 0xFFFF;
-      bfd_put_16 (input_bfd, x, contents + address + 2);
-      return r;
-    }
-
-  return _bfd_final_link_relocate (howto, input_bfd, input_section, contents,
-				   rel->r_offset, value, addend);
-
-}
-
 
 /* Relocate an Blackfin ELF section.
 
@@ -2841,302 +3239,6 @@
   return TRUE;
 }
 
-static bfd_boolean
-bfin_relocate_section (bfd * output_bfd,
-		       struct bfd_link_info *info,
-		       bfd * input_bfd,
-		       asection * input_section,
-		       bfd_byte * contents,
-		       Elf_Internal_Rela * relocs,
-		       Elf_Internal_Sym * local_syms,
-		       asection ** local_sections)
-{
-  bfd *dynobj;
-  Elf_Internal_Shdr *symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes;
-  bfd_vma *local_got_offsets;
-  asection *sgot;
-  asection *sreloc;
-  Elf_Internal_Rela *rel;
-  Elf_Internal_Rela *relend;
-  int i = 0;
-
-  dynobj = elf_hash_table (info)->dynobj;
-  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (input_bfd);
-  local_got_offsets = elf_local_got_offsets (input_bfd);
-
-  sgot = NULL;
-  sreloc = NULL;
-
-  rel = relocs;
-  relend = relocs + input_section->reloc_count;
-  for (; rel < relend; rel++, i++)
-    {
-      int r_type;
-      reloc_howto_type *howto;
-      unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
-      Elf_Internal_Sym *sym;
-      asection *sec;
-      bfd_vma relocation = 0;
-      bfd_boolean unresolved_reloc;
-      bfd_reloc_status_type r;
-      bfd_vma address;
-
-      r_type = ELF32_R_TYPE (rel->r_info);
-      if (r_type < 0 || r_type >= 243)
-	{
-	  bfd_set_error (bfd_error_bad_value);
-	  return FALSE;
-	}
-
-      if (r_type == R_BFIN_GNU_VTENTRY
-          || r_type == R_BFIN_GNU_VTINHERIT)
-	continue;
-
-      howto = bfin_reloc_type_lookup (input_bfd, r_type);
-      if (howto == NULL)
-	{
-	  bfd_set_error (bfd_error_bad_value);
-	  return FALSE;
-	}
-      r_symndx = ELF32_R_SYM (rel->r_info);
-
-      h = NULL;
-      sym = NULL;
-      sec = NULL;
-      unresolved_reloc = FALSE;
-
-      if (r_symndx < symtab_hdr->sh_info)
-	{
-	  sym = local_syms + r_symndx;
-	  sec = local_sections[r_symndx];
-	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
-	}
-      else
-	{
-	  bfd_boolean warned;
-
-	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
-				   r_symndx, symtab_hdr, sym_hashes,
-				   h, sec, relocation,
-				   unresolved_reloc, warned);
-	}
-
-      if (sec != NULL && elf_discarded_section (sec))
-	{
-	  /* For relocs against symbols from removed linkonce sections,
-	     or sections discarded by a linker script, we just want the
-	     section contents zeroed.  Avoid any special processing.  */
-	  _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
-	  rel->r_info = 0;
-	  rel->r_addend = 0;
-	  continue;
-	}
-
-      if (info->relocatable)
-	continue;
-
-      address = rel->r_offset;
-
-      /* Then, process normally.  */
-      switch (r_type)
-	{
-	case R_BFIN_GNU_VTINHERIT:
-	case R_BFIN_GNU_VTENTRY:
-	  return bfd_reloc_ok;
-
-	case R_got:
-	  /* Relocation is to the address of the entry for this symbol
-	     in the global offset table.  */
-	  if (h != NULL
-	      && strcmp (h->root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
-	    goto do_default;
-	  /* Fall through.  */
-	  /* Relocation is the offset of the entry for this symbol in
-	     the global offset table.  */
-
-	  {
-	    bfd_vma off;
-
-	  if (dynobj == NULL)
-	    {
-	      /* Create the .got section.  */
-	      elf_hash_table (info)->dynobj = dynobj = output_bfd;
-	      if (!_bfd_elf_create_got_section (dynobj, info))
-		return FALSE;
-	    }
-
-	    if (sgot == NULL)
-	      {
-		sgot = bfd_get_section_by_name (dynobj, ".got");
-		BFD_ASSERT (sgot != NULL);
-	      }
-
-	    if (h != NULL)
-	      {
-		bfd_boolean dyn;
-
-		off = h->got.offset;
-		BFD_ASSERT (off != (bfd_vma) - 1);
-		dyn = elf_hash_table (info)->dynamic_sections_created;
-
-		if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
-		    || (info->shared
-			&& (info->symbolic
-			    || h->dynindx == -1
-			    || h->forced_local)
-			&& h->def_regular))
-		  {
-		    /* This is actually a static link, or it is a
-		       -Bsymbolic link and the symbol is defined
-		       locally, or the symbol was forced to be local
-		       because of a version file..  We must initialize
-		       this entry in the global offset table.  Since
-		       the offset must always be a multiple of 4, we
-		       use the least significant bit to record whether
-		       we have initialized it already.
-
-		       When doing a dynamic link, we create a .rela.got
-		       relocation entry to initialize the value.  This
-		       is done in the finish_dynamic_symbol routine.  */
-		    if ((off & 1) != 0)
-		      off &= ~1;
-		    else
-		      {
-			bfd_put_32 (output_bfd, relocation,
-				    sgot->contents + off);
-			h->got.offset |= 1;
-		      }
-		  }
-		else
-		  unresolved_reloc = FALSE;
-	      }
-	    else
-	      {
-		BFD_ASSERT (local_got_offsets != NULL);
-		off = local_got_offsets[r_symndx];
-		BFD_ASSERT (off != (bfd_vma) - 1);
-
-		/* The offset must always be a multiple of 4.  We use
-		   the least significant bit to record whether we have
-		   already generated the necessary reloc.  */
-		if ((off & 1) != 0)
-		  off &= ~1;
-		else
-		  {
-		    bfd_put_32 (output_bfd, relocation, sgot->contents + off);
-
-		    if (info->shared)
-		      {
-			asection *s;
-			Elf_Internal_Rela outrel;
-			bfd_byte *loc;
-
-			s = bfd_get_section_by_name (dynobj, ".rela.got");
-			BFD_ASSERT (s != NULL);
-
-			outrel.r_offset = (sgot->output_section->vma
-					   + sgot->output_offset + off);
-			outrel.r_info =
-			  ELF32_R_INFO (0, R_pcrel24);
-			outrel.r_addend = relocation;
-			loc = s->contents;
-			loc +=
-			  s->reloc_count++ * sizeof (Elf32_External_Rela);
-			bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-		      }
-
-		    local_got_offsets[r_symndx] |= 1;
-		  }
-	      }
-
-	    relocation = sgot->output_offset + off;
-	    rel->r_addend = 0;
-            /* bfin : preg = [preg + 17bitdiv4offset] relocation is div by 4.  */
-            relocation /= 4;
-	  }
-	  goto do_default;
-
-	default:
-	do_default:
-	  r = bfin_final_link_relocate (rel, howto, input_bfd, input_section,
-					contents, address,
-					relocation, rel->r_addend);
-
-	  break;
-	}
-
-      /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
-         because such sections are not SEC_ALLOC and thus ld.so will
-         not process them.  */
-      if (unresolved_reloc
-	  && !((input_section->flags & SEC_DEBUGGING) != 0 && h->def_dynamic))
-	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
-	     input_bfd,
-	     input_section, (long) rel->r_offset, h->root.root.string);
-	  return FALSE;
-	}
-
-      if (r != bfd_reloc_ok)
-	{
-	  const char *name;
-
-	  if (h != NULL)
-	    name = h->root.root.string;
-	  else
-	    {
-	      name = bfd_elf_string_from_elf_section (input_bfd,
-						      symtab_hdr->sh_link,
-						      sym->st_name);
-	      if (name == NULL)
-		return FALSE;
-	      if (*name == '\0')
-		name = bfd_section_name (input_bfd, sec);
-	    }
-
-	  if (r == bfd_reloc_overflow)
-	    {
-	      if (!(info->callbacks->reloc_overflow
-		    (info, (h ? &h->root : NULL), name, howto->name,
-		     (bfd_vma) 0, input_bfd, input_section, rel->r_offset)))
-		return FALSE;
-	    }
-	  else
-	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): reloc against `%s': error %d"),
-		 input_bfd, input_section,
-		 (long) rel->r_offset, name, (int) r);
-	      return FALSE;
-	    }
-	}
-    }
-
-  return TRUE;
-}
-
-static asection *
-bfin_gc_mark_hook (asection * sec,
-		   struct bfd_link_info *info,
-		   Elf_Internal_Rela * rel,
-		   struct elf_link_hash_entry *h,
-                   Elf_Internal_Sym * sym)
-{
-  if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
-      {
-      case R_BFIN_GNU_VTINHERIT:
-      case R_BFIN_GNU_VTENTRY:
-	return NULL;
-      }
-
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
-}
-
 /* Update the relocation information for the relocations of the section
    being removed.  */
 
@@ -3249,79 +3351,6 @@
   return TRUE;
 }
 
-/* Update the got entry reference counts for the section being removed.  */
-
-static bfd_boolean
-bfin_gc_sweep_hook (bfd * abfd,
-		    struct bfd_link_info *info,
-		    asection * sec,
-                    const Elf_Internal_Rela * relocs)
-{
-  Elf_Internal_Shdr *symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes;
-  bfd_signed_vma *local_got_refcounts;
-  const Elf_Internal_Rela *rel, *relend;
-  bfd *dynobj;
-  asection *sgot;
-  asection *srelgot;
-
-  dynobj = elf_hash_table (info)->dynobj;
-  if (dynobj == NULL)
-    return TRUE;
-
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  sym_hashes = elf_sym_hashes (abfd);
-  local_got_refcounts = elf_local_got_refcounts (abfd);
-
-  sgot = bfd_get_section_by_name (dynobj, ".got");
-  srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-
-  relend = relocs + sec->reloc_count;
-  for (rel = relocs; rel < relend; rel++)
-    {
-      unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
-
-      switch (ELF32_R_TYPE (rel->r_info))
-	{
-	case R_got:
-	  r_symndx = ELF32_R_SYM (rel->r_info);
-	  if (r_symndx >= symtab_hdr->sh_info)
-	    {
-	      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-	      if (h->got.refcount > 0)
-		{
-		  --h->got.refcount;
-		  if (h->got.refcount == 0)
-		    {
-		      /* We don't need the .got entry any more.  */
-		      sgot->size -= 4;
-		      srelgot->size -= sizeof (Elf32_External_Rela);
-		    }
-		}
-	    }
-	  else if (local_got_refcounts != NULL)
-	    {
-	      if (local_got_refcounts[r_symndx] > 0)
-		{
-		  --local_got_refcounts[r_symndx];
-		  if (local_got_refcounts[r_symndx] == 0)
-		    {
-		      /* We don't need the .got entry any more.  */
-		      sgot->size -= 4;
-		      if (info->shared)
-			srelgot->size -= sizeof (Elf32_External_Rela);
-		    }
-		}
-	    }
-	  break;
-	default:
-	  break;
-	}
-    }
-  return TRUE;
-}
-
 /* We need dynamic symbols for every section, since segments can
    relocate independently.  */
 static bfd_boolean
@@ -3557,37 +3586,6 @@
   return TRUE;
 }
 
-/* The name of the dynamic interpreter.  This is put in the .interp
-   section.  */
-
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
-
-#define DEFAULT_STACK_SIZE 0x20000
-
-/* This structure is used to collect the number of entries present in
-   each addressable range of the got.  */
-struct _bfinfdpic_dynamic_got_info
-{
-  /* Several bits of information about the current link.  */
-  struct bfd_link_info *info;
-  /* Total size needed for GOT entries within the 18- or 32-bit
-     ranges.  */
-  bfd_vma got17m4, gothilo;
-  /* Total size needed for function descriptor entries within the 18-
-     or 32-bit ranges.  */
-  bfd_vma fd17m4, fdhilo;
-  /* Total size needed function descriptor entries referenced in PLT
-     entries, that would be profitable to place in offsets close to
-     the PIC register.  */
-  bfd_vma fdplt;
-  /* Total size needed by lazy PLT entries.  */
-  bfd_vma lzplt;
-  /* Number of relocations carried over from input object files.  */
-  unsigned long relocs;
-  /* Number of fixups introduced by relocations in input object files.  */
-  unsigned long fixups;
-};
-
 /* Compute the total GOT size required by each symbol in each range.
    Symbols may require up to 4 words in the GOT: an entry pointing to
    the symbol, an entry pointing to its function descriptor, and a
@@ -5572,6 +5570,14 @@
     free (internal_relocs);
   return FALSE;
 }
+
+struct bfd_elf_special_section const elf32_bfin_special_sections[] =
+{
+  { ".l1.text",		8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+  { ".l1.data",		8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+  { NULL,		0,  0, 0,            0 }
+};
+
 
 #define TARGET_LITTLE_SYM		bfd_elf32_bfin_vec
 #define TARGET_LITTLE_NAME		"elf32-bfin"
@@ -5620,6 +5626,7 @@
                                         elf32_bfin_print_private_bfd_data
 #define elf_backend_reloc_type_class    elf32_bfin_reloc_type_class
 #define elf_backend_can_gc_sections 1
+#define elf_backend_special_sections	elf32_bfin_special_sections
 #define elf_backend_can_refcount 1
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 1
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 76616b9..84130b0 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -1568,6 +1568,7 @@
 #define TARGET_LITTLE_NAME                "elf32-cr16"
 #define ELF_ARCH                          bfd_arch_cr16
 #define ELF_MACHINE_CODE                  EM_CR16
+#define ELF_MACHINE_ALT1                  EM_CR16_OLD
 #define ELF_MAXPAGESIZE                   0x1
 #define elf_symbol_leading_char           '_'
 
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index dd40541..b188426 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -1998,6 +1998,7 @@
 
 #define ELF_ARCH		bfd_arch_m32c
 #define ELF_MACHINE_CODE	EM_M32C
+#define ELF_MACHINE_ALT1	EM_M32C_OLD
 #define ELF_MAXPAGESIZE		0x1000
 
 #if 0
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 7d46fff..0b6fff3 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -3135,8 +3135,6 @@
 	  if (h != NULL
 	      && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
 	    {
-	      BFD_ASSERT (rel->r_addend == 0);
-
 	      if (elf_m68k_hash_table (info)->local_gp_p)
 		{
 		  bfd_vma sgot_output_offset;
@@ -3185,7 +3183,7 @@
 
 		  /* Adjust GOT pointer to point to the GOT
 		     assigned to input_bfd.  */
-		  rel->r_addend = sgot_output_offset + got_offset;
+		  rel->r_addend += sgot_output_offset + got_offset;
 		}
 	      else
 		BFD_ASSERT (got == NULL || got->offset == 0);
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 2dafde7..92f812f 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2292,6 +2292,29 @@
 }
 
 static bfd_boolean
+is_pic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
+{
+  bfd_byte buf[16];
+  unsigned int insn;
+
+  if (!bfd_get_section_contents (abfd, glink, buf, off, 16))
+    return FALSE;
+
+  insn = bfd_get_32 (abfd, buf);
+  if ((insn & 0xffff0000) == LWZ_11_30
+      && bfd_get_32 (abfd, buf + 4) == MTCTR_11
+      && bfd_get_32 (abfd, buf + 8) == BCTR)
+    return TRUE;
+
+  if ((insn & 0xffff0000) == ADDIS_11_30
+      && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
+      && bfd_get_32 (abfd, buf + 8) == MTCTR_11
+      && bfd_get_32 (abfd, buf + 12) == BCTR)
+    return TRUE;
+  return FALSE;
+}
+
+static bfd_boolean
 section_covers_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *section, void *ptr)
 {
   bfd_vma vma = *(bfd_vma *) ptr;
@@ -2419,12 +2442,22 @@
 	    }
     }
 
+  count = relplt->size / sizeof (Elf32_External_Rela);
+  stub_vma = glink_vma - (bfd_vma) count * 16;
+  /* If the stubs are those for -shared/-pie then we might have
+     multiple stubs for each plt entry.  If that is the case then
+     there is no way to associate stubs with their plt entries short
+     of figuring out the GOT pointer value used in the stub.  */
+  if (!bfd_get_section_contents (abfd, glink, buf,
+				 stub_vma - glink->vma, 4)
+      || ((bfd_get_32 (abfd, buf) & 0xffff0000) != LIS_11
+	  && is_pic_glink_stub (abfd, glink, stub_vma - glink->vma - 16)))
+    return 0;
+
   slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
   if (! (*slurp_relocs) (abfd, relplt, dynsyms, TRUE))
     return -1;
 
-  count = relplt->size / sizeof (Elf32_External_Rela);
-  stub_vma = glink_vma - (bfd_vma) count * 16;
   size = count * sizeof (asymbol);
   p = relplt->relocation;
   for (i = 0; i < count; i++, p++)
@@ -2450,6 +2483,7 @@
 	 we are defining a symbol, ensure one of them is set.  */
       if ((s->flags & BSF_LOCAL) == 0)
 	s->flags |= BSF_GLOBAL;
+      s->flags |= BSF_SYNTHETIC;
       s->section = glink;
       s->value = stub_vma - glink->vma;
       s->name = names;
@@ -2466,7 +2500,7 @@
   /* Add a symbol at the start of the glink branch table.  */
   memset (s, 0, sizeof *s);
   s->the_bfd = abfd;
-  s->flags = BSF_GLOBAL;
+  s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
   s->section = glink;
   s->value = glink_vma - glink->vma;
   s->name = names;
@@ -2480,7 +2514,7 @@
       /* Add a symbol for the glink PLT resolver.  */
       memset (s, 0, sizeof *s);
       s->the_bfd = abfd;
-      s->flags = BSF_GLOBAL;
+      s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
       s->section = glink;
       s->value = resolv_vma - glink->vma;
       s->name = names;
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index eac2e85..b41d35f 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -325,6 +325,11 @@
   unsigned int overlay_fixed;
   /* Local store --auto-overlay should reserve for stack and heap.  */
   unsigned int reserved;
+  /* If reserved is not specified, stack analysis will calculate a value
+     for the stack.  This parameter adjusts that value to allow for
+     negative sp access (the ABI says 2000 bytes below sp are valid,
+     and the overlay manager uses some of this area).  */
+  int extra_stack_space;
   /* Count of overlay stubs needed in non-overlay area.  */
   unsigned int non_ovly_stub;
 
@@ -814,7 +819,7 @@
      section needs a stub.  */
   if (spu_elf_section_data (sym_sec->output_section)->u.o.ovl_index
        != spu_elf_section_data (input_section->output_section)->u.o.ovl_index)
-    return ovl_stub;
+    ret = ovl_stub;
 
   /* If this insn isn't a branch then we are possibly taking the
      address of a function and passing it out somehow.  */
@@ -972,7 +977,7 @@
   if (OVL_STUB_SIZE == 16)
     val -= 12;
   if (((dest | to | from) & 3) != 0
-      || val + 0x20000 >= 0x40000)
+      || val + 0x40000 >= 0x80000)
     {
       htab->stub_err = 1;
       return FALSE;
@@ -1078,7 +1083,7 @@
       && (spu_elf_section_data (sym_sec->output_section)->u.o.ovl_index != 0
 	  || htab->non_overlay_stubs))
     {
-      count_stub (htab, NULL, NULL, nonovl_stub, h, NULL);
+      return count_stub (htab, NULL, NULL, nonovl_stub, h, NULL);
     }
   
   return TRUE;
@@ -1104,8 +1109,8 @@
       && (spu_elf_section_data (sym_sec->output_section)->u.o.ovl_index != 0
 	  || htab->non_overlay_stubs))
     {
-      build_stub (htab, NULL, NULL, nonovl_stub, h, NULL,
-		  h->root.u.def.value, sym_sec);
+      return build_stub (htab, NULL, NULL, nonovl_stub, h, NULL,
+			 h->root.u.def.value, sym_sec);
     }
   
   return TRUE;
@@ -1456,10 +1461,15 @@
 
   /* Fill in all the stubs.  */
   process_stubs (info, TRUE);
+  if (!htab->stub_err)
+    elf_link_hash_traverse (&htab->elf, build_spuear_stubs, info);
 
-  elf_link_hash_traverse (&htab->elf, build_spuear_stubs, info);
   if (htab->stub_err)
-    return FALSE;
+    {
+      (*_bfd_error_handler) (_("overlay stub relocation overflow"));
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
 
   for (i = 0; i <= htab->num_overlays; i++)
     {
@@ -1472,13 +1482,6 @@
       htab->stub_sec[i]->rawsize = 0;
     }
 
-  if (htab->stub_err)
-    {
-      (*_bfd_error_handler) (_("overlay stub relocation overflow"));
-      bfd_set_error (bfd_error_bad_value);
-      return FALSE;
-    }
-
   htab->ovtab->contents = bfd_zalloc (htab->ovtab->owner, htab->ovtab->size);
   if (htab->ovtab->contents == NULL)
     return FALSE;
@@ -1548,6 +1551,7 @@
 		   unsigned int hi,
 		   unsigned int overlay_fixed,
 		   unsigned int reserved,
+		   int extra_stack_space,
 		   void (*spu_elf_load_ovl_mgr) (void),
 		   FILE *(*spu_elf_open_overlay_script) (void),
 		   void (*spu_elf_relink) (void))
@@ -1562,6 +1566,7 @@
   htab->local_store = hi + 1 - lo;
   htab->overlay_fixed = overlay_fixed;
   htab->reserved = reserved;
+  htab->extra_stack_space = extra_stack_space;
   htab->spu_elf_load_ovl_mgr = spu_elf_load_ovl_mgr;
   htab->spu_elf_open_overlay_script = spu_elf_open_overlay_script;
   htab->spu_elf_relink = spu_elf_relink;
@@ -2923,6 +2928,11 @@
   return TRUE;
 }
 
+/* If non-zero then unmark functions called from those within sections
+   that we need to unmark.  Unfortunately this isn't reliable since the
+   call graph cannot know the destination of function pointer calls.  */
+#define RECURSE_UNMARK 0
+
 struct _uos_param {
   asection *exclude_input_section;
   asection *exclude_output_section;
@@ -2950,9 +2960,10 @@
       || fun->sec->output_section == uos_param->exclude_output_section)
     excluded = 1;
 
-  uos_param->clearing += excluded;
+  if (RECURSE_UNMARK)
+    uos_param->clearing += excluded;
 
-  if (uos_param->clearing)
+  if (RECURSE_UNMARK ? uos_param->clearing : excluded)
     {
       fun->sec->linker_mark = 0;
       if (fun->rodata)
@@ -2963,7 +2974,8 @@
     if (!unmark_overlay_section (call->fun, info, param))
       return FALSE;
 
-  uos_param->clearing -= excluded;
+  if (RECURSE_UNMARK)
+    uos_param->clearing -= excluded;
   return TRUE;
 }
 
@@ -3574,7 +3586,7 @@
       sum_stack_param.overall_stack = 0;
       if (!for_each_node (sum_stack, info, &sum_stack_param, TRUE))
 	goto err_exit;
-      htab->reserved = sum_stack_param.overall_stack + 2000;
+      htab->reserved = sum_stack_param.overall_stack + htab->extra_stack_space;
     }
   fixed_size += htab->reserved;
   fixed_size += htab->non_ovly_stub * OVL_STUB_SIZE;
diff --git a/bfd/elf32-spu.h b/bfd/elf32-spu.h
index e0141d5..ec443fd 100644
--- a/bfd/elf32-spu.h
+++ b/bfd/elf32-spu.h
@@ -62,5 +62,5 @@
 extern bfd_boolean spu_elf_build_stubs (struct bfd_link_info *, int);
 extern asection *spu_elf_check_vma (struct bfd_link_info *, int,
 				    unsigned int, unsigned int, unsigned int,
-				    unsigned int, void (*) (void),
+				    unsigned int, int, void (*) (void),
 				    FILE *(*) (void), void (*) (void));
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 06b1476..727b6ac 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2954,6 +2954,7 @@
 	      size_t len;
 
 	      *s = *syms[i];
+	      s->flags |= BSF_SYNTHETIC;
 	      s->section = sym->section;
 	      s->value = sym->value + r->addend;
 	      s->name = names;
@@ -3124,6 +3125,7 @@
 		  if ((sec->flags & SEC_CODE) != 0)
 		    s->section = sec;
 		}
+	      s->flags |= BSF_SYNTHETIC;
 	      s->value = ent - s->section->vma;
 	      s->name = names;
 	      *names++ = '.';
@@ -3145,7 +3147,7 @@
 	      /* Add a symbol for the main glink trampoline.  */
 	      memset (s, 0, sizeof *s);
 	      s->the_bfd = abfd;
-	      s->flags = BSF_GLOBAL;
+	      s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
 	      s->section = glink;
 	      s->value = resolv_vma - glink->vma;
 	      s->name = names;
@@ -3181,6 +3183,7 @@
 		 we are defining a symbol, ensure one of them is set.  */
 	      if ((s->flags & BSF_LOCAL) == 0)
 		s->flags |= BSF_GLOBAL;
+	      s->flags |= BSF_SYNTHETIC;
 	      s->section = glink;
 	      s->value = glink_vma - glink->vma;
 	      s->name = names;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 5173c0a..a67663d 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -1172,7 +1172,7 @@
     }
 
   if (h->call_stub != NULL
-      && h->root.other == STO_MIPS16)
+      && ELF_ST_IS_MIPS16 (h->root.other))
     {
       /* We don't need the call_stub; this is a 16 bit function, so
          calls from other 16 bit functions are OK.  Clobber the size
@@ -1184,7 +1184,7 @@
     }
 
   if (h->call_fp_stub != NULL
-      && h->root.other == STO_MIPS16)
+      && ELF_ST_IS_MIPS16 (h->root.other))
     {
       /* We don't need the call_stub; this is a 16 bit function, so
          calls from other 16 bit functions are OK.  Clobber the size
@@ -4099,12 +4099,12 @@
   bfd_vma symbol = 0;
   /* The final GP value to be used for the relocatable, executable, or
      shared object file being produced.  */
-  bfd_vma gp = MINUS_ONE;
+  bfd_vma gp;
   /* The place (section offset or address) of the storage unit being
      relocated.  */
   bfd_vma p;
   /* The value of GP used to create the relocatable object.  */
-  bfd_vma gp0 = MINUS_ONE;
+  bfd_vma gp0;
   /* The offset into the global offset table at which the address of
      the relocation entry symbol, adjusted by the addend, resides
      during execution.  */
@@ -4182,7 +4182,7 @@
 	}
 
       /* MIPS16 text labels should be treated as odd.  */
-      if (sym->st_other == STO_MIPS16)
+      if (ELF_ST_IS_MIPS16 (sym->st_other))
 	++symbol;
 
       /* Record the name of this symbol, for our caller.  */
@@ -4192,7 +4192,7 @@
       if (*namep == '\0')
 	*namep = bfd_section_name (input_bfd, sec);
 
-      target_is_16_bit_code_p = (sym->st_other == STO_MIPS16);
+      target_is_16_bit_code_p = ELF_ST_IS_MIPS16 (sym->st_other);
     }
   else
     {
@@ -4288,7 +4288,7 @@
 	  symbol = 0;
 	}
 
-      target_is_16_bit_code_p = (h->root.other == STO_MIPS16);
+      target_is_16_bit_code_p = ELF_ST_IS_MIPS16 (h->root.other);
     }
 
   /* If this is a 32- or 64-bit call to a 16-bit function with a stub, we
@@ -4367,8 +4367,17 @@
   local_p = mips_elf_local_relocation_p (input_bfd, relocation,
 					 local_sections, TRUE);
 
-  /* If we haven't already determined the GOT offset, or the GP value,
-     and we're going to need it, get it now.  */
+  gp0 = _bfd_get_gp_value (input_bfd);
+  gp = _bfd_get_gp_value (abfd);
+  if (dynobj)
+    gp += mips_elf_adjust_gp (abfd, mips_elf_got_info (dynobj, NULL),
+			      input_bfd);
+
+  if (gnu_local_gp_p)
+    symbol = gp;
+
+  /* If we haven't already determined the GOT offset, oand we're going
+     to need it, get it now.  */
   switch (r_type)
     {
     case R_MIPS_GOT_PAGE:
@@ -4449,29 +4458,8 @@
       /* Convert GOT indices to actual offsets.  */
       g = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, g);
       break;
-
-    case R_MIPS_HI16:
-    case R_MIPS_LO16:
-    case R_MIPS_GPREL16:
-    case R_MIPS_GPREL32:
-    case R_MIPS_LITERAL:
-    case R_MIPS16_HI16:
-    case R_MIPS16_LO16:
-    case R_MIPS16_GPREL:
-      gp0 = _bfd_get_gp_value (input_bfd);
-      gp = _bfd_get_gp_value (abfd);
-      if (dynobj)
-	gp += mips_elf_adjust_gp (abfd, mips_elf_got_info (dynobj, NULL),
-				  input_bfd);
-      break;
-
-    default:
-      break;
     }
 
-  if (gnu_local_gp_p)
-    symbol = gp;
-
   /* Relocations against the VxWorks __GOTT_BASE__ and __GOTT_INDEX__
      symbols are resolved by the loader.  Add them to .rela.dyn.  */
   if (h != NULL && is_gott_symbol (info, &h->root))
@@ -5701,7 +5689,8 @@
 	return FALSE;
       break;
     case SHT_MIPS_DWARF:
-      if (! CONST_STRNEQ (name, ".debug_"))
+      if (! CONST_STRNEQ (name, ".debug_")
+          && ! CONST_STRNEQ (name, ".zdebug_"))
 	return FALSE;
       break;
     case SHT_MIPS_SYMBOL_LIB:
@@ -5895,7 +5884,8 @@
       hdr->sh_entsize = 1;
       hdr->sh_flags |= SHF_MIPS_NOSTRIP;
     }
-  else if (CONST_STRNEQ (name, ".debug_"))
+  else if (CONST_STRNEQ (name, ".debug_")
+           || CONST_STRNEQ (name, ".zdebug_"))
     {
       hdr->sh_type = SHT_MIPS_DWARF;
 
@@ -6119,7 +6109,7 @@
   /* If this is a mips16 text symbol, add 1 to the value to make it
      odd.  This will cause something like .word SYM to come up with
      the right value when it is loaded into the PC.  */
-  if (sym->st_other == STO_MIPS16)
+  if (ELF_ST_IS_MIPS16 (sym->st_other))
     ++*valp;
 
   return TRUE;
@@ -6142,7 +6132,7 @@
       && strcmp (input_sec->name, ".scommon") == 0)
     sym->st_shndx = SHN_MIPS_SCOMMON;
 
-  if (sym->st_other == STO_MIPS16)
+  if (ELF_ST_IS_MIPS16 (sym->st_other))
     sym->st_value &= ~1;
 
   return TRUE;
@@ -8719,7 +8709,7 @@
     }
 
   /* If this is a mips16 symbol, force the value to be even.  */
-  if (sym->st_other == STO_MIPS16)
+  if (ELF_ST_IS_MIPS16 (sym->st_other))
     sym->st_value &= ~1;
 
   return TRUE;
@@ -8891,7 +8881,7 @@
     }
 
   /* If this is a mips16 symbol, force the value to be even.  */
-  if (sym->st_other == STO_MIPS16)
+  if (ELF_ST_IS_MIPS16 (sym->st_other))
     sym->st_value &= ~1;
 
   return TRUE;
diff --git a/bfd/syms.c b/bfd/syms.c
index 8831b92..371916b 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -297,6 +297,9 @@
 .     with the expression tree serialized in the symbol name.  *}
 .#define BSF_SRELC 0x100000
 .
+.  {* This symbol was created by bfd_get_synthetic_symtab.  *}
+.#define BSF_SYNTHETIC 0x200000
+.
 .  flagword flags;
 .
 .  {* A pointer to the section to which this symbol is
diff --git a/bfd/version.h b/bfd/version.h
index f38620e..b8cf43d 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20080610
+#define BFD_VERSION_DATE 20080718
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
diff --git a/config/ChangeLog b/config/ChangeLog
index 55d74f6..d568142 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,20 @@
+2008-07-11  Joseph Myers  <joseph@codesourcery.com>
+
+	* mh-mingw (LDFLAGS): Append to rather than replacing previous
+	value.
+
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* override.m4: Use m4_version_prereq throughout.
+	(_AC_ARG_VAR_VALIDATE, AC_MSG_FAILURE): Backport from git
+	Autoconf: output pwd along with fatal errors, so the right
+	config.log file is hinted at more prominently.
+	(PARSE_ARGS): Push setting of ac_pwd in this diversion.
+	(_GCC_AUTOCONF_VERSION): New, define to 2.59 if not defined.
+	(_GCC_AUTOCONF_VERSION_CHECK): New macro, require use of Autoconf
+	version _GCC_AUTOCONF_VERSION throughout the tree.
+	(m4_wrap): New override, fix for Posix semantics of m4wrap.
+
 2008-06-08  Joseph Myers  <joseph@codesourcery.com>
 
 	PR tree-optimization/36218
diff --git a/config/mh-mingw b/config/mh-mingw
index e31bfd3..4c49d5d 100644
--- a/config/mh-mingw
+++ b/config/mh-mingw
@@ -3,4 +3,4 @@
 BOOT_CFLAGS += -D__USE_MINGW_ACCESS
 CFLAGS += -D__USE_MINGW_ACCESS
 # Increase stack limit to same as Linux default.
-LDFLAGS = -Wl,--stack,8388608
+LDFLAGS += -Wl,--stack,8388608
diff --git a/config/override.m4 b/config/override.m4
index 592f641..9bb1496 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -2,10 +2,15 @@
 dnl Autoconf macros with backports of the 2.60+ fix.
 dnl - AC_CONFIG_SUBDIRS whitespace mangling,
 dnl - more lenient precious variable checks
+dnl - better configure error message
+dnl - reliance on non-Posix m4wrap (M4 1.6 or newer implement FIFO)
 dnl
-dnl This file should be a no-op for Autoconf versions != 2.59.
-dnl It can be removed once the complete tree has moved to a
-dnl newer Autoconf version.
+dnl The override bits of this file should be a no-op for the newest
+dnl Autoconf version, which means they can be removed once the complete
+dnl tree has moved to a new enough Autoconf version.
+dnl
+dnl The _GCC_AUTOCONF_VERSION_TEST ensures that exactly the desired
+dnl Autoconf version is used.  It should be kept for consistency.
 
 dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
 dnl We use it because this fix is intended for 2.59 only.
@@ -22,7 +27,36 @@
 AC_DEFUN([AC_PREREQ], [frob])
 m4_copy([_AC_PREREQ], [AC_PREREQ])
 
-ifelse(m4_PACKAGE_VERSION, [2.59], [
+
+dnl Ensure exactly this Autoconf version is used
+m4_ifndef([_GCC_AUTOCONF_VERSION],
+  [m4_define([_GCC_AUTOCONF_VERSION], [2.59])])
+
+dnl Test for the exact version when AC_INIT is expanded.
+dnl This allows to update the tree in steps (for testing)
+dnl by putting
+dnl   m4_define([_GCC_AUTOCONF_VERSION], [X.Y])
+dnl in configure.ac before AC_INIT,
+dnl without rewriting this file.
+dnl Or for updating the whole tree at once with the definition above.
+AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK],
+[m4_if(m4_defn([_GCC_AUTOCONF_VERSION]),
+  m4_defn([m4_PACKAGE_VERSION]), [],
+  [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])])
+])
+m4_define([AC_INIT], m4_defn([AC_INIT])[
+_GCC_AUTOCONF_VERSION_CHECK
+])
+
+m4_version_prereq([2.60],, [
+dnl We use $ac_pwd in some of the overrides below; ensure its definition
+m4_divert_push([PARSE_ARGS])dnl
+ac_pwd=`pwd`
+m4_divert_pop([PARSE_ARGS])dnl
+])
+
+
+m4_version_prereq([2.60],, [
 
 # _AC_OUTPUT_SUBDIRS
 # ------------------
@@ -128,13 +162,15 @@
 ])# _AC_OUTPUT_SUBDIRS
 ])
 
-ifelse(m4_PACKAGE_VERSION, [2.62],, [
+m4_version_prereq([2.63],, [
 
 # _AC_ARG_VAR_VALIDATE
 # --------------------
 # The code is the same as autoconf 2.59, but with a more lenient check
-# on precious variables that has been added in autoconf 2.62.
+# on precious variables and an output of pwd that have been added in
+# autoconf 2.62.
 m4_define([_AC_ARG_VAR_VALIDATE],
+[m4_divert_text([INIT_PREPARE],
 [# Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -184,8 +220,32 @@
   fi
 done
 if $ac_cache_corrupted; then
+  AS_MESSAGE([error: in `$ac_pwd':], 2)
   AS_MESSAGE([error: changes in the environment can compromise the build], 2)
   AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over])
-fi
+fi])dnl
 ])# _AC_ARG_VAR_VALIDATE
-])])
+])
+
+m4_version_prereq([2.63],, [
+
+# AC_MSG_FAILURE(ERROR, [EXIT-STATUS = 1])
+# ----------------------------------------
+# This is the same code as in 2.59 and 2.61, except it also outputs pwd.
+m4_define([AC_MSG_FAILURE],
+[{ AS_MESSAGE([error: in `$ac_pwd':], 2)
+AC_MSG_ERROR([$1
+See `config.log' for more details.], [$2]); }])
+])
+])
+
+m4_version_prereq([2.60],, [
+dnl M4 1.6 and newer implement m4wrap using FIFO semantics, as required
+dnl by Posix; earlier versions used LIFO semantics.  Unfortunately,
+dnl Autoconf versions before 2.60 require those LIFO semantics, so
+dnl make sure to give it to them.
+m4_define([m4_wrap], [m4_ifdef([_$0_text],
+  [m4_define([_$0_text], [$1]m4_defn([_$0_text]))],
+  [m4_define([_$0_text], [$1])m4_builtin([m4wrap],
+    [m4_default(m4_defn([_$0_text])m4_undefine([_$0_text]))])])])
+])
diff --git a/configure b/configure
index 92f62a3..1c19007 100755
--- a/configure
+++ b/configure
@@ -272,8 +272,9 @@
 PACKAGE_BUGREPORT=
 
 ac_unique_file="move-if-change"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_noncanonical host_noncanonical target_noncanonical host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN LN_S TOPLEVEL_CONFIGURE_ARGUMENTS build_libsubdir build_subdir host_subdir target_subdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE do_compare gmplibs gmpinc stage1_languages SYSROOT_CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET RPATH_ENVVAR tooldir build_tooldir CONFIGURE_GDB_TK GDB_TK INSTALL_GDB_TK build_configargs build_configdirs host_configargs configdirs target_configargs AR_FOR_BUILD AS_FOR_BUILD CC_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXX_FOR_BUILD DLLTOOL_FOR_BUILD GCJ_FOR_BUILD GFORTRAN_FOR_BUILD LDFLAGS_FOR_BUILD LD_FOR_BUILD NM_FOR_BUILD RANLIB_FOR_BUILD WINDMC_FOR_BUILD WINDRES_FOR_BUILD config_shell YACC BISON M4 LEX FLEX MAKEINFO EXPECT RUNTEST AR AS DLLTOOL LD LIPO NM RANLIB STRIP WINDRES WINDMC OBJCOPY OBJDUMP CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GCJ_FOR_TARGET GFORTRAN_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET OBJDUMP_FOR_TARGET RANLIB_FOR_TARGET STRIP_FOR_TARGET WINDRES_FOR_TARGET WINDMC_FOR_TARGET RAW_CXX_FOR_TARGET FLAGS_FOR_TARGET COMPILER_AS_FOR_TARGET COMPILER_LD_FOR_TARGET COMPILER_NM_FOR_TARGET MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT stage1_cflags stage1_checking stage2_werror_flag datarootdir docdir pdfdir htmldir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS TOPLEVEL_CONFIGURE_ARGUMENTS build build_cpu build_vendor build_os build_noncanonical host_noncanonical target_noncanonical host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN LN_S build_libsubdir build_subdir host_subdir target_subdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE do_compare gmplibs gmpinc stage1_languages SYSROOT_CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET CFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET RPATH_ENVVAR tooldir build_tooldir CONFIGURE_GDB_TK GDB_TK INSTALL_GDB_TK build_configargs build_configdirs host_configargs configdirs target_configargs AR_FOR_BUILD AS_FOR_BUILD CC_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CXX_FOR_BUILD DLLTOOL_FOR_BUILD GCJ_FOR_BUILD GFORTRAN_FOR_BUILD LDFLAGS_FOR_BUILD LD_FOR_BUILD NM_FOR_BUILD RANLIB_FOR_BUILD WINDMC_FOR_BUILD WINDRES_FOR_BUILD config_shell YACC BISON M4 LEX FLEX MAKEINFO EXPECT RUNTEST AR AS DLLTOOL LD LIPO NM RANLIB STRIP WINDRES WINDMC OBJCOPY OBJDUMP CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GCJ_FOR_TARGET GFORTRAN_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET OBJDUMP_FOR_TARGET RANLIB_FOR_TARGET STRIP_FOR_TARGET WINDRES_FOR_TARGET WINDMC_FOR_TARGET RAW_CXX_FOR_TARGET FLAGS_FOR_TARGET COMPILER_AS_FOR_TARGET COMPILER_LD_FOR_TARGET COMPILER_NM_FOR_TARGET MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT stage1_cflags stage1_checking stage2_werror_flag datarootdir docdir pdfdir htmldir LIBOBJS LTLIBOBJS'
 ac_subst_files='serialization_dependencies host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag'
+ac_pwd=`pwd`
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1447,6 +1448,8 @@
   fi
 done
 if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
   { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -1480,6 +1483,37 @@
 
 
 
+
+
+
+progname=$0
+# if PWD already has a value, it is probably wrong.
+if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
+
+# Export original configure arguments for use by sub-configures.
+# Quote arguments with shell meta charatcers.
+TOPLEVEL_CONFIGURE_ARGUMENTS=
+set -- "$progname" "$@"
+for ac_arg
+do
+  case "$ac_arg" in
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']*)
+    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
+    # if the argument is of the form -foo=baz, quote the baz part only
+    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([-a-zA-Z0-9]*=\)/\\1'/"` ;;
+  *) ;;
+  esac
+  # Add the quoted argument to the list.
+  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
+done
+if test "$silent" = yes; then
+  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
+fi
+# Remove the initial space we just introduced and, as these will be
+# expanded by make, quote '$'.
+TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
+
+
 # Find the build, host, and target systems.
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
@@ -1794,34 +1828,6 @@
 
 config_shell=${CONFIG_SHELL-/bin/sh}
 
-progname=$0
-# if PWD already has a value, it is probably wrong.
-if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
-
-# Export original configure arguments for use by sub-configures.
-# Quote arguments with shell meta charatcers.
-TOPLEVEL_CONFIGURE_ARGUMENTS=
-set -- "$progname" "$@"
-for ac_arg
-do
-  case "$ac_arg" in
-  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']*)
-    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
-    # if the argument is of the form -foo=baz, quote the baz part only
-    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([-a-zA-Z0-9]*=\)/\\1'/"` ;;
-  *) ;;
-  esac
-  # Add the quoted argument to the list.
-  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
-done
-if test "$silent" = yes; then
-  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
-fi
-# Remove the initial space we just introduced and, as these will be
-# expanded by make, quote '$'.
-TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
-
-
 moveifchange=${srcdir}/move-if-change
 
 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
@@ -2057,7 +2063,7 @@
   if test "$is_elf" = "yes"; then
     # Check for target supported by gold.
     case "${target}" in
-      i?86-*-* | x86_64-*-* | sparc*-*-*)
+      i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-*)
         configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
         ;;
     esac
@@ -2309,7 +2315,6 @@
     ;;
   arm*-*-linux-gnueabi)
     noconfigdirs="$noconfigdirs target-qthreads"
-    noconfigdirs="$noconfigdirs target-libobjc"
     case ${with_newlib} in
       no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     esac
@@ -3230,11 +3235,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -3320,11 +3327,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
 See \`config.log' for more details." >&5
 echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
@@ -3349,13 +3358,15 @@
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+	{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
@@ -3393,11 +3404,13 @@
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
@@ -3444,11 +3457,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -12897,6 +12912,7 @@
 s,@ECHO_N@,$ECHO_N,;t t
 s,@ECHO_T@,$ECHO_T,;t t
 s,@LIBS@,$LIBS,;t t
+s,@TOPLEVEL_CONFIGURE_ARGUMENTS@,$TOPLEVEL_CONFIGURE_ARGUMENTS,;t t
 s,@build@,$build,;t t
 s,@build_cpu@,$build_cpu,;t t
 s,@build_vendor@,$build_vendor,;t t
@@ -12917,7 +12933,6 @@
 s,@INSTALL_DATA@,$INSTALL_DATA,;t t
 s,@LN@,$LN,;t t
 s,@LN_S@,$LN_S,;t t
-s,@TOPLEVEL_CONFIGURE_ARGUMENTS@,$TOPLEVEL_CONFIGURE_ARGUMENTS,;t t
 s,@build_libsubdir@,$build_libsubdir,;t t
 s,@build_subdir@,$build_subdir,;t t
 s,@host_subdir@,$host_subdir,;t t
diff --git a/configure.ac b/configure.ac
index 13a7cc1..b7fb222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,6 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-#   2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+#   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
+#   Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -25,6 +26,34 @@
 AC_INIT(move-if-change)
 AC_PREREQ(2.59)
 
+progname=$0
+# if PWD already has a value, it is probably wrong.
+if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
+
+# Export original configure arguments for use by sub-configures.
+# Quote arguments with shell meta charatcers.
+TOPLEVEL_CONFIGURE_ARGUMENTS=
+set -- "$progname" "$@"
+for ac_arg
+do
+  case "$ac_arg" in
+  *" "*|*"	"*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
+    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
+    # if the argument is of the form -foo=baz, quote the baz part only
+    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
+  *) ;;
+  esac
+  # Add the quoted argument to the list.
+  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
+done
+if test "$silent" = yes; then
+  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
+fi
+# Remove the initial space we just introduced and, as these will be
+# expanded by make, quote '$'.
+TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
+AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
+
 # Find the build, host, and target systems.
 ACX_NONCANONICAL_BUILD
 ACX_NONCANONICAL_HOST
@@ -84,34 +113,6 @@
 
 config_shell=${CONFIG_SHELL-/bin/sh}
 
-progname=$0
-# if PWD already has a value, it is probably wrong.
-if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
-
-# Export original configure arguments for use by sub-configures.
-# Quote arguments with shell meta charatcers.
-TOPLEVEL_CONFIGURE_ARGUMENTS=
-set -- "$progname" "$@"
-for ac_arg
-do
-  case "$ac_arg" in
-  *" "*|*"	"*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
-    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
-    # if the argument is of the form -foo=baz, quote the baz part only
-    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
-  *) ;;
-  esac
-  # Add the quoted argument to the list.
-  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
-done
-if test "$silent" = yes; then
-  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
-fi
-# Remove the initial space we just introduced and, as these will be
-# expanded by make, quote '$'.
-TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
-AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
-
 moveifchange=${srcdir}/move-if-change
 
 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
@@ -317,7 +318,7 @@
   if test "$is_elf" = "yes"; then
     # Check for target supported by gold.
     case "${target}" in
-      i?86-*-* | x86_64-*-* | sparc*-*-*)
+      i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-*)
         configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
         ;;
     esac
@@ -563,7 +564,6 @@
     ;;
   arm*-*-linux-gnueabi)
     noconfigdirs="$noconfigdirs target-qthreads"
-    noconfigdirs="$noconfigdirs target-libobjc"
     case ${with_newlib} in
       no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     esac
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 71e9df5..a02b93a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,1331 @@
+2008-07-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* auxv.c (fprint_target_auxv): Stop at AT_NULL.
+
+2008-07-15  Andreas Schwab  <schwab@suse.de>
+
+	* valops.c (value_cast_pointers): Follow typedefs when checking
+	result of coercion.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* block.c (block_function): Renamed to ...
+	(block_linkage_function): ... this.  All callers changed.
+	* block.h (block_function): Renamed to ...
+	(block_linkage_function): ... this.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* mn10300-tdep.c (set_reg_offsets): Use get_frame_register_unsigned.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* frame.c (frame_sp_unwind): Delete.
+	(get_frame_sp): Do not use it.
+	* frame.h (frame_sp_unwind): Delete prototype.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* ia64-tdep.c (ia64_dummy_id): Use get_frame_pc.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* dwarf2-frame.c (dwarf2_frame_cache): Update comment.
+	* frame.c (frame_unwind_address_in_block): Delete.
+	(get_frame_address_in_block): Do not use it.  Check the type
+	of the next frame first.
+	(frame_cleanup_after_sniffer): Update comment.
+	* frame.h (frame_unwind_address_in_block): Delete prototype.
+	* hppa-tdep.c (hppa_find_unwind_entry_in_block): Update comment.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* frame.c (frame_func_unwind): Delete.
+	(get_frame_func): Do not use it.
+	* frame.h (frame_func_unwind): Delete prototype.
+	* hppa-tdep.c (hppa_frame_cache): Update comment.
+	* rs6000-tdep.c (rs6000_frame_cache): Update comment.
+
+2008-07-14  Stan Shebs  <stan@codesourcery.com>
+
+	* remote-sim.c (init_gdbsim_ops): Remove
+	TARGET_REDEFINE_DEFAULT_OPS.
+
+2008-07-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* findvar.c (read_var_value): Remove unused variable.
+
+2008-07-15  Luis Machado  <luisgpm@br.ibm.com>
+
+	* infrun.c (handle_inferior_event): Tag threads as stopped
+	before inserting breakpoints.
+
+2008-07-15  Hui Zhu  <teawater@gmail.com>
+
+	* MAINTAINERS: Added myself to section Write After Approval.
+
+2008-07-14  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	PR gdb/2477
+	* cp-abi.c (value_virtual_fn_field): Handle invalid pointers.
+
+2008-07-14  Pedro Alves  <pedro@codesourcery.com>
+
+	* i386-dicos-tdep.c (i386_dicos_frame_align): Delete.
+	(i386_dicos_push_dummy_code): New.
+	(i386_dicos_init_abi): Don't register i386_dicos_frame_align.
+	Register i386_dicos_push_dummy_code.
+
+2008-07-14  Markus Deuling  <deuling@de.ibm.com>
+
+	* mips-tdep.c (fp_register_arg_p): Add gdbarch as paramter.
+	(mips_n32n64_push_dummy_call, mips_o64_return_value)
+	(mips_eabi_push_dummy_call): Update call to fp_register_arg_p.
+
+	(MIPS_FPU_TYPE): Add gdbarch as parameter and replace current_gdbarch.
+	(fp_register_arg_p, mips_dump_tdep, show_mipsfpu_command)
+	(mips_n32n64_fp_arg_chunk_p): Update caller.
+
+	(mips_n32n64_fp_arg_chunk_p): Add gdbarch as paramter.
+	(mips_n32n64_push_dummy_call): Update caller.
+
+	(MIPS_LAST_ARG_REGNUM): Add gdbarch as parameter and replace
+	current_gdbarch.
+	(mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call)
+	(mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update caller.
+
+
+	(MIPS_LAST_FP_ARG_REGNUM): Add gdbarch as parameter and replace
+	current_gdbarch.
+	(mips_eabi_push_dummy_call, mips_o32_push_dummy_call)
+	(mips_o64_push_dummy_call): Update caller.
+
+	(MIPS_EABI): Add gdbarch as parameter and replace current_gdbarch.
+	(fp_register_arg_p, mips_dump_tdep): Update caller.
+
+	(set_reg_offset): Add gdbarch as parameter and replace current_gdbarch.
+	(mips16_scan_prologue, mips32_scan_prologue): Update caller.
+
+	(reset_saved_regs): Make static.  Add gdbarch as parameter.  Replace
+	current_gdbarch.
+	(mips32_scan_prologue): Update caller.
+
+	(heuristic_proc_start): Add gdbarch as parameter. Replace
+	current_gdbarch.
+	(mips_insn16_frame_cache, mips_insn32_frame_cache): Update caller.
+
+	* mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers)
+	(mipsnbsd_store_inferior_registers): Use get_regcache_arch to get at
+	the current architecture. Update call to getregs_supplies.
+	(getregs_supplies): Add gdbarch as parameter and replace
+	current_gdbarch.
+
+	* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use get_frame_arch to
+	get at the current architecture. Update call to NBSD_MIPS_JB_OFFSET and
+	NBSD_MIPS_JB_ELEMENT_SIZE.
+	(NBSD_MIPS_JB_ELEMENT_SIZE, NBSD_MIPS_JB_OFFSET): Add gdbarch and
+	replace current_gdbarch.
+
+	* remote-mips.c (mips_map_regno): Add gdbarch as parameter and replace
+	current_gdbarch.
+	(mips_fetch_registers, mips_store_registers): Update call
+	to mips_map_regno.
+	(mips_load): Use get_regcache_arch to get at the current_architecture
+	and replace current_gdbarch.
+
+2008-07-13  Pedro Alves  <pedro@codesourcery.com>
+
+	* thread.c (restore_selected_frame): On fail to restore, select
+	the innermost frame, and don't crash when warning the user.
+
+2008-07-13  Hui Zhu  <teawater@gmail.com>
+
+	* symtab.c (expand_line_sal): Fix a memory leak.
+
+2008-07-13  Pedro Alves  <pedro@codesourcery.com>
+
+	* utils.c (struct continuation): Define as inheriting struct
+	cleanup.
+	(add_continuation, do_all_continuations)
+	(discard_all_continuations, add_intermediate_continuation)
+	(do_all_intermediate_continuations)
+	(discard_all_intermediate_continuations): Adjust.
+
+2008-07-13  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Skip varobj in running threads.
+	* mi/mi-cmd-var.c (mi_cmd_var_update): If varobj's
+	thread is not stopped, skip the varobj.
+	* Makefile.in: Update dependencies.
+
+2008-07-13  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Enable all commands while inferiour is running
+	* mi/mi-main.c (mi_cmd_execute): Don't check if
+	inferiour is executing.
+
+2008-07-13  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Allow all CLI command even if target is executing.
+	* gdb/top.c (execute_command_1): Don't check if the inferiour
+	is running.
+
+2008-07-13  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-main.c (mi_cmd_execute): Remove unused variable.
+	Fix printing of frame, when frame is wrong.
+
+2008-07-12  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* spu-tdep.c (spu_frame_unwind_cache): Do not error if
+	backchain is unreadable.
+
+2008-07-12  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* spu-linux-nat.c: Include "gdbthread.h".
+	(spu_child_post_startup_inferior): Register main thread.
+	(spu_child_post_attach): Likewise.
+	* Makefile.in (spu-linux-nat.o): Update dependencies.
+
+2008-07-12  Pedro Alves  <pedro@codesourcery.com>
+
+	Rewrite continuations internals on top of cleanups and plug
+	continuation arguments leaks.
+
+	* defs.h (struct continuation): Make it opaque.
+	(add_continuation, add_intermediate_continuation): Drop the int
+	argument of the continuation hook argument.  Add
+	continuation_free_args argument.
+	(do_all_continuations, do_all_intermediate_continuations): Drop
+	the error_p argument.
+
+	* utils.c (add_continuation): Drop the int argument of the
+	continuation hook argument.  Add continuation_free_args argument.
+	Reimplement on top of cleanups.
+	(do_all_continuations): Drop error argument.  Reimplement on top
+	of cleanups.
+	(discard_all_continuations): Reimplement on top of cleanups.
+	(add_intermediate_continuation): Drop the int argument of the
+	continuation hook argument.  Add continuation_free_args argument.
+	Reimplement on top of cleanups.
+	(do_all_intermediate_continuations): Drop error argument.
+	Reimplement on top of cleanups.
+	(discard_all_intermediate_continuations): Reimplement on top of
+	cleanups.
+
+	* breakpoint.c (until_break_command_continuation): Drop error
+	argument.  Add xfree as continuation argument deleter.
+
+	* inf-loop.c (inferior_event_handler): On error, discard all
+	continuations.  Adjust to new do_all_intermediate_continuations
+	and do_all_continuations interfaces.
+
+	* infcmd.c (step_1_continuation): Drop error_p argument.  Adjust.
+	Pass xfree as continuation argument deleter.
+	(finish_command_continuation): Drop error_p argument.  Adjust.
+	(finish_command_continuation_free_arg): New.
+	(finish_command): Pass finish_command_continuation_free_arg as
+	continuation argument deleter.  Adjust to new do_all_continuations
+	interfaces.
+	(attach_command_continuation): Drop error_p argument.
+	(attach_command_continuation_free_args): New.
+	(attach_command): Pass attach_command_continuation_free_args as
+	continuation argument deleter.
+
+	* interps.c (interp_set): Adjust to new do_all_continuations
+	interfaces.
+
+	* event-top.c (stdin_event_handler): In error, also discard the
+	intermediate continuations.
+
+2008-07-12  Pedro Alves  <pedro@codesourcery.com>
+
+	Replace struct continuation_args by void* and per command structs.
+
+	* top.c (execute_command): Remove unused arg1 and arg2 locals.
+
+	* breakpoint.c (struct until_break_command_continuation_args):
+	New.
+	(until_break_command_continuation): Take a void* instead of a
+	continuations_arg.  Adjust.
+	(until_break_command): Adjust to use struct
+	until_break_command_continuation_args instead of struct
+	continuation_arg.
+
+	* infcmd.c (struct step_1_continuation_args): New.
+	(step_1_continuation): Take a void* instead of a
+	continuations_arg.  Adjust to use struct step_1_continuation_args.
+	(step_once): Adjust to use struct step_1_continuation_args.
+
+	(struct finish_command_continuation_args): New.
+	(finish_command_continuation): Take a void* instead of a
+	continuations_arg.  Adjust to use struct
+	finish_command_continuation_args.
+	(finish_command): Adjust to use struct
+	finish_command_continuation_args.
+	(struct attach_command_continuation_args): New.
+	(attach_command_continuation): Take a void* instead of a
+	continuations_arg.  Adjust to use struct
+	attach_command_continuation_args.
+	(attach_command): Adjust to use struct
+	attach_command_continuation_args.
+
+	* defs.h (struct continuation_arg): Delete.
+	(struct continuation): Replace the struct continuation_arg*
+	parameter of continuation_hook by a void*.  Replace "arg_list"
+	member by a new "args" member with void* type.
+	(add_continuation, add_intermediate_continuation): Replace struct
+	continuation_arg type usages by void* usages.
+
+	* utils.c (add_continuation, do_all_continuations)
+	(add_intermediate_continuation)
+	(do_all_intermediate_continuations): Replace struct
+	continuation_arg type usages by void* usages.  Pass "args" instead
+	of "arg_list".
+
+2008-07-12  Pedro Alves  <pedro@codesourcery.com>
+
+	* infrun.c (struct thread_stepping_state): Delete sal member.
+	(init_thread_stepping_state): Add local sal.  Use it instead of
+	tss->sal.
+	(handle_inferior_event): New local stop_pc_sal.  Use it instead of
+	tss->sal.
+	(step_into_function): Add local stop_func_sal.  Use it instead of
+	tss->sal.
+
+2008-07-12  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Implement -exec-continue/-exec-interrupt --all.
+	* infcmd.c (continue_1): New, extracted from
+	(continue_command): ...here.
+	(interrupt_target_1): New, extracted from
+	(interrupt_target_command): ...here.
+	* inferior.h (continue_1, interrupt_target_1): New.
+	* mi/mi-main.c (mi_cmd_exec_continue)
+	(mi_cmd_exec_interrupt): Handle --all.
+
+2008-07-12  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Implement --thread and --frame.
+	* gdbthread.h (find_thread_id): Declare.
+	* thread.c (find_thread_id): Make non-static.
+	* mi/mi-main.c (mi_cmd_execute): Switch to the right
+	thread and frame, if necessary.
+	* mi/mi-parse.c (mi_parse): Handle --thread and --frame.
+	* mi/mi-parse.h (strcut mi_parse): New fields thread and frame.
+
+2008-07-12  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* infrun.c (resume): Discard cleanups on early exit path.
+
+2008-07-12  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* infrun.c (normal_stop): For MI, report which threads
+	were stopped.
+
+2008-07-12  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Report thread state in -thread-info output.
+	* thread.c (print_thread_info): Add new field "state".
+
+2008-07-11  Pedro Alves  <pedro@codesourcery.com>
+
+	* infrun.c (handle_inferior_event): Also ignore a
+	TARGET_SIGNAL_TRAP on a STOP_QUIETLY_NO_SIGSTOP.
+
+2008-07-11  Tom Tromey  <tromey@redhat.com>
+
+	* completer.c (complete_line_internal): New function, from
+	complete_line.  Add 'for_help' parameter.
+	(complete_line): Use it.
+	(command_completer): Move later.  Rewrite.
+
+2008-07-11  Pedro Alves  <pedro@codesourcery.com>
+
+	* thread.c (thread_apply_command): Move making the cleanup out of
+	the loop.
+
+2008-07-11  Pedro Alves  <pedro@codesourcery.com>
+
+	Exited threads.
+
+	* thread.c (enum thread_state): New.
+	(thread_state main_thread_running): Delete, in favor of...
+	(thread_state main_thread_state): ... this.  Update throughout.
+	(clear_thread_inferior_resources): New, split from free_thread.
+	(free_thread): Call clear_thread_inferior_resources.
+	(init_thread_list): Set main thread to stopped state.
+	(add_thread_silent): Take care of PTID reuses.
+	(delete_thread): If deleting inferior_ptid or a thread with
+	refcount > 0, mark it as exited, but still keep it in the list.
+	Only notify of thread exits, if we haven't done so yet.
+	(iterate_over_threads): Make it safe to delete threads while
+	iterating over them.
+	(do_captured_list_thread_ids): Don't account for exited threads.
+	(thread_alive): Check for the THREAD_EXITED state, and don't set
+	ptid to -1 on exited threads.
+	(set_running): Update to account for extra possible states.
+	(is_thread_state): New.
+	(is_stopped, is_exited): New.
+	(is_running): Implement in terms of is_thread_state.
+	(any_running): Update.
+	(print_thread_info): Update.  Account for exited threads.  Don't
+	warn about missed frame restoring here, its done in the cleanup.
+	(switch_to_thread): Don't read from a thread that has gone.
+	(restore_current_thread): In non-stop mode, do a full context
+	switch.
+	(restore_selected_frame): Add a frame_level argument.  Rewrite.
+	(struct current_thread_cleanup): Add selected_frame_level and
+	was_stopped members.
+	(do_restore_current_thread_cleanup): Check if thread was stopped
+	and still is, and if the target has registers, stack and memory
+	before restoring the selected frame.  Don't delete the cleanup
+	argument here.
+	(restore_current_thread_cleanup_dtor): New.
+	(make_cleanup_restore_current_thread): Remove all arguments.
+	Rewrite.
+	(thread_apply_all_command): Update.  Prune threads.
+	(thread_apply_command): Update.
+	(thread_command): Account for currently selected exited thread.
+	(do_captured_thread_select): Check for a running thread.  Prune
+	threads.
+	(_initialize_thread): Make "info threads", "thread", "thread
+	apply", and "thread apply all" appliable without a selected thread.
+	* gdbthread.h (struct thread_info): Replace running_ by state_.
+	Add refcount.
+	(is_exited, is_stopped): Declare.
+	(make_cleanup_restore_current_thread): Remove all arguments.
+	* infrun.c: Include "event-top.h".
+	(fetch_inferior_event): In non-stop mode, restore selected thread
+	and frame after handling the event and running breakpoint
+	commands.  Display GDB prompt if needed.
+	(normal_stop): In non-stop mode, don't print thread switching
+	notice.
+	* cli/cli-decode.c (set_cmd_no_selected_thread_ok)
+	(get_cmd_no_selected_thread_ok): New.
+	* cli/cli-decode.h (CMD_NO_SELECTED_THREAD_OK): New.
+	(set_cmd_no_selected_thread_ok, get_cmd_no_selected_thread_ok):
+	Declare.
+	* cli/cli-cmds.c: Set "pwd", "help", "info", "show" as
+	no-selected-thread ok.
+	* top.c (execute_command): Check for non no-selected-thread-ok
+	commands.
+	* linux-nat.c (struct saved_ptids, threads_to_delete)
+	(record_dead_thread, prune_lwps): Delete.
+	(exit_lwp): Unconditionally delete thread.
+	(linux_nat_resume): Remove prune_lwps call.
+	* infcmd.c (proceed_thread_callback): Check if !is_stopped instead
+	of is_running.  Adjust to make_cleanup_restore_current_thread
+	interface change.
+	* mi/mi-main.c (mi_cmd_execute): Only allow a few commands if the
+	selected thread has exited.
+	* inf-loop.c (inferior_event_handler): Don't display the prompt
+	here.
+	* varobj.c (c_value_of_root): Update.
+	* defs.h (make_cleanup_dtor): Declare.
+	* utils.c (make_cleanup_dtor): New.
+
+	* Makefile.in (infrun.o): Depend on $(event_top_h).
+
+2008-07-11  Pedro Alves  <pedro@codesourcery.com>
+
+	Add "continue -a" and "interrupt -a" options for non-stop mode.
+
+	* infcmd.c (proceed_thread_callback, do_context_switch_to): New.
+	(continue_command): Add "-a" option.
+	(interrupt_target_command): Add "-a" option.
+	(_initialize_infcmd): Add extend help of continue and interrupt
+	command to mention the new "-a" option.  Mark "continue" async ok.
+
+2008-07-10  Doug Evans  <dje@google.com>
+
+	Add "set print symbol-loading on|off".
+	* NEWS: Document new option.
+	* symfile.h (print_symbol_loading): Declare.
+	* symfile.c (print_symbol_loading): New global.
+	(symbol_file_add_with_addrs_or_offsets): Only print "Reading symbols
+	from ..." if print_symbol_loading.
+	(_initialize_symfile): Add set/show print symbol-loading.
+	* solib.c (solib_read_symbols): Only print "Loaded symbols for ..."
+	if print_symbol_loading.
+
+2008-07-10  Pedro Alves  <pedro@codesourcery.com>
+
+	Non-stop linux native.
+
+	* linux-nat.c (linux_test_for_tracefork): Block events while we're
+	here.
+	(get_pending_status): Implement non-stop mode.
+	(linux_nat_detach): Stop threads before detaching.
+	(linux_nat_resume): In non-stop mode, always resume only a single
+	PTID.
+	(linux_handle_extended_wait): On a clone event, in non-stop mode,
+	add new lwp to GDB's thread table, and mark as running, executing
+	and stopped appropriately.
+	(linux_nat_filter_event): Don't assume there are other running
+	threads when a thread exits.
+	(linux_nat_wait): Mark the main thread as running and executing.
+	In non-stop mode, don't stop all lwps.
+	(linux_nat_kill): Stop lwps before killing them.
+	(linux_nat_thread_alive): Use signal 0 to detect if a thread is
+	alive.
+	(send_sigint_callback): New.
+	(linux_nat_stop): New.
+	(linux_nat_add_target): Set to_stop to linux_nat_stop.
+
+	* linux-nat.h (thread_db_attach_lwp): Declare.
+
+	* linux-thread-db.c (thread_get_info_callback): Check for new
+	threads if we have none.
+	(thread_from_lwp, enable_thread_event): Set proc_handle.pid to the
+	stopped lwp.  Check for new threads if we have none.
+	(thread_db_attach_lwp): New.
+	(thread_db_init): Set proc_handle.pid to inferior_ptid.
+	(check_event): Set proc_handle.pid to the stopped lwp.
+	(thread_db_find_new_threads): Set proc_handle.pid to any stopped
+	lwp available, bail out if there is none.
+
+	* linux-fork.c (linux_fork_killall): Use SIGKILL instead of
+	PTRACE_KILL.
+
+2008-07-10  Kevin Buettner  <kevinb@redhat.com>
+
+	* rs6000-tdep.c (ppc_displaced_step_fixup): Change type of
+	`current_pc' from CORE_ADDR to ULONGEST.
+
+	* remote-sim.c (gdbsim_cntrl_c): Pass remote_sim_ptid to
+	gdbsim_stop().
+
+2008-07-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* NEWS (New commands): Mention "set disable-randomization".
+	* configure.ac: Add check for HAVE_PERSONALITY and
+	HAVE_DECL_ADDR_NO_RANDOMIZE.
+	* configure, config.in: Regenerate.
+	* linux-nat.c [HAVE_PERSONALITY]: New include <sys/personality.h>.
+	[HAVE_PERSONALITY] [!HAVE_DECL_ADDR_NO_RANDOMIZE]: Set
+	ADDR_NO_RANDOMIZE.
+	(disable_randomization, show_disable_randomization)
+	(set_disable_randomization): New.
+	(linux_nat_create_inferior) [HAVE_PERSONALITY]: New variables
+	PERSONALITY_ORIG and PERSONALITY_SET.  Disable randomization upon the
+	variable DISABLE_RANDOMIZATION.
+	(_initialize_linux_nat): Call ADD_SETSHOW_BOOLEAN_CMD for the variable
+	DISABLE_RANDOMIZATION.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Adjust all targets to new target_stop interface.
+
+	* gnu-nat.c (gnu_stop): Add ptid argument.
+	* go32-nat.c (go32_stop): Add ptid argument.
+	(go32_create_inferior): Pass inferior_ptid to go32_stop.
+	* hpux-thread.c (hpux_thread_stop): Add ptid argument.
+	* monitor.c (monitor_stop): Add ptid argument.
+	(monitor_open): Pass inferior_ptid to monitor_stop.
+	(monitor_interrupt): Pass inferior_ptid to target_stop.
+	(monitor_stop): Add ptid argument.
+	* nto-procfs.c (nto_interrupt): Pass inferior_ptid to target_stop.
+	(procfs_create_inferior): Add ptid argument.
+	* procfs.c (procfs_stop): Add ptid argument.
+	* remote-m32r-sdi.c (m32r_stop): Add ptid argument.
+	* remote-sim.c (gdbsim_stop): Add ptid argument.
+	* sol-thread.c (sol_thread_stop): Add ptid argument.
+	* win32-nat.c (win32_stop): Add ptid argument.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Non-stop inferior control.
+
+	* infrun.c (resume): In non-stop mode, always resume just one
+	thread.
+	(proceed): Don't call prepare_to_proceed in non-stop mode.
+	(fetch_inferior_event): In non-stop mode, switch context before
+	handling the event.
+	(error_is_running, ensure_not_running): New.
+	(handle_inferior_event): In non-stop mode: Mark only the event
+	thread as stopped.  Require that the target module manages adding
+	threads to the thread list.  Assert that there isn't a
+	deferred_step_ptid set.  Don't switch to infwait_thread_hop_state.
+	(normal_stop): Only mark not-running if inferior hasn't exited.
+	In non-stop mode, only mark the event thread.
+
+	* thread.c:Include "cli/cli-decode.h".
+	(print_thread_info): Don't read from a running thread.
+	Output "(running)" if thread is running.
+	(switch_to_thread): Don't read stop_pc if thread is executing.
+	(do_restore_current_thread_cleanup): Don't write to a running
+	thread.
+	(thread_apply_all_command): Don't read from a running thread.  In
+	non-stop mode, do a full context-switch instead of just switching
+	threads.
+	(thread_apply_command): In non-stop mode, do a full context-switch
+	instead of just switching threads.
+	(do_captured_thread_select): Likewise.  Inform user if selected
+	thread is running.
+	(_initialize_thread): Mark "info threads" and "thread" and
+	async_ok.
+
+	* inf-loop.c (inferior_event_handler): In non-stop mode, don't
+	unregister the target from the event loop.
+
+	* infcmd.c (continue_command, step_1, jump_command)
+	(signal_command): Ensure the selected thread isn't running.
+	(interrupt_target_command): In non-stop mode, interrupt only the
+	selected thread.
+
+	* inferior.h (error_is_running, ensure_not_running): Declare.
+
+	* target.h (struct target_ops): Add ptid argument to the to_stop
+	member.
+	(target_stop): Add ptid_t argument.
+
+	* target.c (update_current_target): Add ptid argument to to_stop's
+	type.
+	(debug_to_stop): Add ptid_t argument.
+	(debug_to_rcmd): Set to_stop_ptid.
+
+	* remote.c (remote_stop): Add ptid_t argument.
+	(async_remote_interrupt): Add inferior_ptid to target_stop.
+	* inf-ptrace.c (inf_ptrace_stop): Add ptid argument.
+
+	* Makefile.in (thread.o): Depend on $(cli_decode_h).
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Don't rely on ecs->wait_for_more.
+
+	* infrun.c (proceed): Clear the stepping state, set
+	previous_inferior_ptid and clear infwait state.
+	(wait_for_inferior): Don't clear the stepping state, set
+	previous_inferior_ptid, or clear the infwait state here.
+	(fetch_inferior_event): Don't clear the stepping state, set
+	previous_inferior_ptid, or clear the infwait state here.  Don't
+	condition on wait_for_more.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Refactor infrun a bit.
+
+	* infrun.c (currently_stepping): Take a struct
+	thread_stepping_state instead of an execution_control_state.
+	(struct thread_stepping_state): New, split from
+	execution_control_state.
+	(gtss, tss): New globals.
+	(proceed): Clear the stepping state, set previous_inferior_ptid
+	and clear infwait state.
+	(init_wait_for_inferior): Clear the stepping state,
+	previous_inferior_ptid and infwait state.
+	(waiton_ptid, infwait_state): New, split from
+	execution_control_state.
+	(struct execution_control_state): Members that persist through
+	events moved out to either struct thred_stepping_state or made
+	global.  Deleted unneeded wp, saved_inferior_ptid, tmpstatus.
+	(wait_for_inferior, fetch_inferior_event): Use local
+	execution_control_state.  Update to execution_control_state split.
+	(init_execution_control_state): Adjust.
+	(init_thread_stepping_state): New, extracted from
+	init_execution_control_state.
+	(context_switch): Take a ptid instead of an
+	execution_control_state.
+	(context_switch_to): Adjust.
+	(adjust_pc_after_break): Adjust.
+	(init_infwait_state): New.
+	(handle_inferior_event): Adjust.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+	    Vladimir Prus  <vladimir@codesourcery.com>
+
+	Per-thread commands.
+
+	* gdbthread.h: Remove unneeded forward declarations.
+	Include "inferior.h".
+	(struct thread_info): Add continuations,
+	intermediate_continuations, proceed_to_finish, step_over_calls,
+	stop_step, step_multi and stop_signal members.
+	(save_infrun_state): Add continuations,
+	intermediate_continuations, proceed_to_finish, step_over_calls,
+	stop_step, step_multi, stop_signal and stop_bpstat parameters.
+	(load_infrun_state): Add continuations,
+	intermediate_continuations, proceed_to_finish, step_over_calls,
+	stop_step, step_multi, stop_signal and stop_bpstat parameters.
+
+	* thread.c (load_infrun_state): In non-stop mode, load
+	continuations, intermediate_continuations, proceed_to_finish,
+	step_over_calls, stop_step, step_multi and stop_signal.
+	(save_infrun_state): Store continuations,
+	intermediate_continuations, proceed_to_finish, step_over_calls,
+	stop_step, step_multi, stop_signal and stop_bpstat.
+	(save_infrun_state): Store continuations,
+	intermediate_continuations, proceed_to_finish, step_over_calls,
+	stop_step, step_multi, stop_signal and stop_bpstat.
+	(free_thread): Clear The thread's stop_bpstat.
+
+	* inferior.h (context_switch_to): Declare.
+
+	* infrun.c (ecss): New global.
+	(context_switch): Context switch continuations,
+	intermediate_continuations, proceed_to_finish, step_over_calls,
+	stop_step, step_multi, stop_signal and stop_bpstat.
+	(wait_for_inferior): Use global ecss.
+	(async_ecss, async_ecs): Delete.
+	(fetch_inferior_event): Use global ecss.
+	(context_switch_to): New.
+
+	* top.c (execute_command): In non-stop, only check if the current
+	thread is running, in all-stop, check if there's any thread
+	running.
+
+	* breakpoint.c (bpstat_remove_breakpoint): New.
+	(bpstat_remove_breakpoint_callback): New.
+	(delete_breakpoint): Clear the stop_bpstats of all threads.
+
+	* mi/mi-main.c (mi_cmd_execute): In non-stop, only check if the
+	current thread is running, in all-stop, check if there's any
+	thread running.
+
+	* Makefile.in (gdbthread_h): Depend on $(inferior_h).
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Add non_stop global.
+
+	* inferior.h (non_stop): Declare.
+	* infrun.c (non_stop, non_stop_1): New.
+	(set_non_stop, show_non_stop): New.
+	(_initialize_infrun): Add "set/show non-stop" command.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Adjust fork/vfork/exec to pass ptids around.
+
+	* target.h (struct target_waitstatus): Store related_pid as a ptid.
+	(inferior_has_forked, inferior_has_vforked, inferior_has_execd):
+	Take a ptid_t.
+	* breakpoint.h (struct breakpoint): Change forked_inferior_pid
+	type to ptid.
+	* breakpoint.c (print_it_typical, bpstat_check_location)
+	(print_one_breakpoint_location, set_raw_breakpoint_without_location)
+	(create_fork_vfork_event_catchpoint): Adjust.
+	* infrun.c (fork_event): Change parent_pid and child_pid types to
+	ptid.
+	(follow_exec, inferior_has_forked, inferior_has_vforked)
+	(inferior_has_execd): Take a ptid_t and don't trim it.
+	* linux-thread-db.c (thread_db_wait): Don't trim the returned ptid.
+	* linux-nat.c (linux_child_follow_fork): Adjust.
+	* inf-ptrace.c (inf_ptrace_wait): Adjust.
+	* inf-ttrace.c (inf_ttrace_wait): Adjust.
+	* win32-nat.c (get_win32_debug_event): Don't set related_pid.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	Add "executing" property to threads.
+
+	* inferior.h (target_executing): Delete.
+	* gdbthread.h (struct thread_info): Add executing_ field.
+	(set_executing, is_executing): New.
+	* thread.c (main_thread_executing): New.
+	(init_thread_list): Clear it and also main_thread_running.
+	(is_running): Return false if target has no execution.
+	(any_running, is_executing, set_executing): New.
+
+	* top.c: Include "gdbthread.h".
+	(target_executing): Delete.
+	(execute_command): Replace target_executing check by any_running.
+	* event-top.c: Include "gdbthread.h".
+	(display_gdb_prompt, command_handler): Replace target_executing by
+	is_running.
+	* inf-loop.c: Include "gdbthread.h".  Don't mark as not executing
+	here.  Replace target_executing by is_running.
+	* infrun.c (handle_inferior_event): Mark all threads as
+	not-executing.
+	* linux-nat.c (linux_nat_resume): Don't mark thread as executing
+	here.
+	* stack.c (get_selected_block): Return null if inferior is
+	executing.
+	* target.c (target_resume): Mark resumed ptid as executing.
+	* breakpoint.c (until_break_command): Replace target_executing
+	check by is_executing.
+	* remote.c (remote_async_resume): Don't mark inferior as executing
+	here.
+	* mi/mi-interp.c (mi_cmd_interpreter_exec): Replace target_executing
+	by any_running.
+
+	* mi/mi-main.c (mi_cmd_exec_interrupt, mi_cmd_execute)
+	(mi_execute_async_cli_command): Replace target_executing by
+	is_running.
+
+	* frame.c (get_current_frame): Error out if the current thread is
+	executing.
+	(has_stack_frames): New.
+	(get_selected_frame, deprecated_safe_get_selected_frame): Check
+	has_stack_frames.
+
+	* Makefile.in (event-top.o, frame.o, inf-loop.o, top.o): Depend on
+	$(gdbthread_h).
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	* symfile.c (load_command): Reopen the exec file and reread
+	symbols before anything else.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	* remote-sim.c: Include gdbthread.h.
+	(remote_sim_ptid): New global.
+	(gdbsim_create_inferior): Silently add the main task to GDB's
+	thread list.
+	(gdbsim_close, gdbsim_mourn_inferior): Silently delete the main
+	task from GDB's thread list.
+	(gdbsim_resume): Adjust to use remote_sim_ptid.
+	(gdbsim_thread_alive, gdbsim_pid_to_str): New.
+	(init_gdbsim_ops): Register gdbsim_thread_alive and
+	gdbsim_pid_to_str.
+	(_initialize_remote_sim): Initialize remote_sim_ptid.
+	* Makefile.in (remote-sim.o): Depend on $(gdbthread_h).
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	* monitor (monitor_ptid): New global.
+	(monitor_open): Silently add the main task to GDB's thread list.
+	(monitor_close, monitor_mourn_inferior): Silently delete the main
+	task from GDB's thread list.
+	(monitor_thread_alive, monitor_pid_to_str): New.
+	(init_base_monitor_ops): Register monitor_thread_alive and
+	monitor_pid_to_str.
+	(_initialize_remote_monitors): Initialize monitor_ptid.
+
+	* gdbthread.h (delete_thread_silent): Declare.
+	* thread.c (delete_thread): Rename to ...
+	(delete_thread_1): ... this.  Add "silent" parameter.  If silent,
+	don't do exit notifications.
+	(delete_thread, delete_thread_silent): New, as wrappers to
+	delete_thread_1.
+
+2008-07-08  Pedro Alves  <pedro@codesourcery.com>
+
+	* breakpoint.c (update_global_location_list): Add boolean
+	"should_insert" argument.  Only insert locations if caller told it
+	too.
+	(update_global_location_list_nothrow): Add boolean "should_insert"
+	argument.  Pass it to update_global_location_list.
+	(insert_breakpoints, create_longjmp_breakpoint)
+	(create_overlay_event_breakpoint, enable_overlay_breakpoints)
+	(create_thread_event_breakpoint, create_solib_event_breakpoint)
+	(create_fork_vfork_event_catchpoint, create_exec_event_catchpoint)
+	(enable_watchpoints_after_interactive_call_stop)
+	(set_momentary_breakpoint, create_breakpoints)
+	(break_command_really, watch_command_1)
+	(create_ada_exception_breakpoint, update_breakpoint_locations)
+	(do_enable_breakpoint, enable_command): Pass true to
+	update_global_location_list.
+	(bpstat_stop_status, disable_overlay_breakpoints)
+	(disable_watchpoints_before_interactive_call_start)
+	(delete_breakpoint, disable_breakpoint, disable_command): Pass
+	false to update_global_location_list.
+	(update_breakpoints_after_exec): Don't temporarily disable
+	always-inserted mode.
+
+2008-07-08  Pedro Alves  <pedro@codesourcery.com>
+
+	* breakpoint.c (mark_breakpoints_out): Make public.
+	(update_breakpoints_after_exec): Don't call mark_breakpoints_out
+	here.  Update comment.
+	* breakpoint.h (mark_breakpoints_out): Declare.
+
+	* linux-nat.c (linux_handle_extended_wait): On
+	TARGET_WAITKIND_EXECD, call mark_breakpoints_out.
+	* inf-ttrace.c (inf_ttrace_wait): Likewise.
+
+2008-07-08  Pedro Alves  <pedro@codesourcery.com>
+
+	* infrun.c (follow_exec): Reset shared libraries before adding the
+	main exec file.
+
+2008-07-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* breakpoint.c (bpstat_copy): Call RELEASE_VALUE on the new OLD_VAL.
+
+2008-07-07  Pedro Alves  <pedro@codesourcery.com>
+
+	* i386-dicos-tdep.c: Include "inferior.h".
+	(i386_dicos_frame_align): New.
+	(i386_dicos_init_abi): Register i386_dicos_frame_align.  Set call
+	dummy location ON_STACK.
+	* Makefile.in (i386-dicos-tdep.o): Depend on $(inferior_h).
+
+2008-07-07  Joel Brobecker  <brobecker@adacore.com>
+
+	* gstdint.h: New file.
+
+2008-07-05  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-interp.c (mi_on_resume): Don't try to report
+	resumed thread it the thread list is empty.
+
+2008-07-05  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* cli/cli-decode.c (add_setshow_optional_filename_cmd): Set
+	completer for set to filename_completer.
+
+	NEWS: Mention it.
+
+2008-07-04  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Implement -target-attach.
+	* mi/mi-cmds.c (mi_cmds): Forward -target-attach to CLI attach.
+
+2008-06-21  Hui Zhu  <teawater@gmail.com>
+
+	* target-descriptions.c (maint_print_c_tdesc_cmd): Fix a memory leak.
+
+2008-07-03  Pedro Alves  <pedro@codesourcery.com>
+
+	* config/i386/nm-cygwin.h (ATTACH_NO_WAIT): Delete.
+	* config/i386/nm-i386gnu.h (ATTACH_NO_WAIT): Delete.
+
+	* target.h (struct target_ops): Add to_attach_no_wait member.
+	(target_attach_no_wait): New.
+	* target.c (update_current_target): Inherit to_attach_no_wait.
+
+	* infcmd.c: Replace ATTACH_NO_WAIT compile time check by
+	target_attach_no_wait runtime check.
+
+	* gnu-nat.c (init_gnu_ops): Set to_attach_no_wait in gnu_ops.
+	* win32-nat.c (init_win32_ops): Set to_attach_no_wait in
+	win32_ops.
+
+2008-07-03  Pedro Alves  <pedro@codesourcery.com>
+
+	* i386-tdep.c (i386_displaced_step_fixup): Condition log printing
+	on debug_displaced being set.
+
+2008-06-30  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* frame.c (get_prev_frame_1): Call frame_unwind_find_by_frame
+	directly instead of get_frame_id.
+
+2008-06-30  Luis Machado  <luisgpm@br.ibm.com>
+
+	* rs6000-tdep.c (ppc_displaced_step_fixup): New function.
+	(deal_with_atomic_sequence): Update BC masks.
+	(rs6000_gdbarch_init): Init displaced stepping infra-structure.
+	Define BRANCH_MASK, B_INSN, BC_INSN, BXL_INSN, BP_MASK and BP_INSN.
+
+2008-06-30  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* cris-tdep.c (crisv32_single_step_through_delay): Get this frame's
+	register, not the previous frame's.
+
+2008-06-30  Luis Machado  <luisgpm@br.ibm.com>
+
+	* source.c (select_source_symtab): Make sure we skip namespace
+	symtabs when showing cpp source code.
+
+2008-06-30  Hans-Peter Nilsson  <hp@axis.com>
+
+	* MAINTAINERS (Authorized committers): Fix my email address.
+
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-cmds.c (mi_cmds): Route -exec-run, -exec-until,
+	-target-download and -target-select via CLI, so that
+	the quoting rules are the same as they were (unfortunately)
+	in all prior gdb releases.
+	* mi/mi-cmds.h (mi_cmd_exec_run, mi_cmd_exec_until)
+	(mi_cmd_target_download, mi_cmd_target_select): Remove.
+	* mi/mi-main.c (mi_cmd_exec_run, mi_cmd_exec_until)
+	(mi_cmd_target_download, mi_cmd_target_select): Remove.
+	(mi_cmd_execute): Set current_token even for commands
+	routed via CLI.
+
+2008-06-28  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* alphafbsd-tdep.c: Update for unwinder changes.
+	* alpha-linux-tdep.c: Likewise.
+	* alphanbsd-tdep.c: Likewise.
+	* alphaobsd-tdep.c: Likewise.
+	* avr-tdep.c: Likewise.
+	* cris-tdep.c: Likewise.
+	* frv-linux-tdep.c: Likewise.
+	* frv-tdep.c: Likewise.
+	* h8300-tdep.c: Likewise.
+	* hppa-linux-tdep.c: Likewise.
+	* iq2000-tdep.c: Likewise.
+	* m32c-tdep.c: Likewise.
+	* m32r-linux-tdep.c: Likewise.
+	* m32r-tdep.c: Likewise.
+	* m68hc11-tdep.c: Likewise.
+	* mep-tdep.c: Likewise.
+	* mn10300-tdep.c: Likewise.
+	* mt-tdep.c: Likewise.
+	* score-tdep.c: Likewise.
+	* sh64-tdep.c: Likewise.
+	* sh-tdep.c: Likewise.
+	* sparc64fbsd-tdep.c: Likewise.
+	* sparc64nbsd-tdep.c: Likewise.
+	* sparc64obsd-tdep.c: Likewise.
+	* v850-tdep.c: Likewise.
+	* vaxobsd-tdep.c: Likewise.
+	* vax-tdep.c: Likewise.
+	* xstormy16-tdep.c: Likewise.
+
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-main.c (enum captured_mi_execute_command_actions)
+	(captured_mi_execute_command_args): Remove.
+	(captured_mi_execute_command): Cast the closure to mi_parse
+	pointer, not to captured_mi_execute_command_args, and don't
+	set the action field thereof.
+	(mi_execute_command): Pass struct mi_parse, not
+	captured_mi_execute_command_args to captured_mi_execute_command.
+	(mi_execute_command): Remove (dead) code for suppressing
+	printing prompt.
+
+2008-06-28  Pedro Alves  <pedro@codesourcery.com>
+
+	* linux-nat.c (enum sigchld_state): New.
+	(linux_nat_async_events_state): Renamed from
+	linux_nat_async_events_enabled.
+	(linux_nat_event_pipe_push, my_waitpid): Adjust.
+	(sigchld_default_action): New.
+	(lin_lwp_attach_lwp): Adjust.  Call linux_nat_async_events
+	unconditionally.
+	(linux_nat_create_inferior): Set events state to sigchld_default
+	state.
+	(linux_nat_resume): Adjust.
+	(linux_nat_wait): Call linux_nat_async_events unconditionally.
+	(sigchld_handler): Adjust.
+	(linux_nat_async_mask): Don't set SIGCHLD actions here.
+	(get_pending_events): Adjust.
+	(linux_nat_async_events): Rewrite to handle enum sigchld_state
+	instead of a boolean.
+	(linux_nat_async): Adjust.
+	(_initialize_linux_nat): Capture default SIGCHLD action into
+	sigchld_default_action.
+
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* breakpoint.c (moribund_locations): New.
+	(bpstat_stop_status): Process moribund locations.
+	(update_global_location_list): Add removed
+	locations to moribund_locations.
+	(breakpoint_retire_moribund): New.
+	* breakpoint.h (struct bp_location): New field
+	events_till_retirement.
+	(breakpoint_retire_moribund): Declare.
+	* thread.c (thread_count): New.
+	* infrun.c (handle_inferior_event): Call
+	breakpoint_retire_moribund.
+	* gdbthread.h (thread_count): Declare.
+
+2008-06-27  Joseph Myers  <joseph@codesourcery.com>
+
+	* dfp.c (decimal_convert): Call match_endianness before and after
+	conversion.
+
+2008-06-27  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* remote.c (remote_insert_breakpoint): Ensure that if Z0
+	unsupported and we fall back to memory_insert_breakpoint, we
+	use the unmodified requested address.
+
+2008-06-27  Joel Brobecker  <brobecker@adacore.com>
+
+	* dwarf2read.c (read_attribute_value): Issue a complaint when
+	adjusting size attribute values of 0xffffffff as zero.
+
+2008-06-27  Joseph Myers  <joseph@codesourcery.com>
+
+	* i386-tdep.c (i386_16_byte_align_p): New.
+	(i386_push_dummy_call): Determine stack space required for
+	arguments going forwards allowing for 16-byte alignment, then push
+	arguments going forwards.
+
+2008-06-27  Pedro Alves  <pedro@codesourcery.com>
+
+	* infrun.c (start_remote): Don't clear thread list here.
+	* monitor.c (monitor_open): Include "gdbthread.h".  Clear thread
+	list here.
+	* remote.c (record_currthread): Upgrade the main thread and its
+	entry in the thread list if this is the first time we hear about
+	threads.
+	(remote_thread_alive): Consider magic_null_ptid or a ptid without
+	a tid member always alive.
+	(remote_find_new_threads): Don't update the main thread here.
+	(remote_start_remote): Clear thread list here.  Always add the
+	main thread.
+	(extended_remote_attach_1): Add the main thread here.
+	(extended_remote_mourn_1): Re-add the main thread here.
+	(extended_remote_create_inferior_1): Add a main thread.
+
+	* Makefile.in (monitor.o): Depend on $(gdbthread_h).
+
+2008-06-27  Pedro Alves  <pedro@codesourcery.com>
+
+	Use ptid_t.tid to store thread ids instead of ptid_t.pid.
+
+	* remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): New
+	globals.
+	(general_thread, continue_thread): Change type to ptid_t.
+	(record_currthread): Take a ptid_t parameter instead of an
+	integer.
+	(MAGIC_NULL_PID): Delete.
+	(set_thread): Take a ptid_t parameter and adjust.
+	(set_general_thread, set_continue_thread): New.
+	(remote_thread_alive, remote_newthread_step)
+	(remote_current_thread, remote_find_new_threads)
+	(remote_threads_info, remote_start_remote, remote_vcont_resume)
+	(remote_resume_1, remote_wait, extended_remote_create_inferior_1)
+	(threadalive_test, remote_pid_to_str)
+	(remote_get_thread_local_address): Adjust.
+	(_initialize_remote): Initialize magic_null_ptid, not_sent_ptid
+	and any_thread_ptid.
+
+2008-06-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* configure.ac (--enable-tui): AC_MSG_ERROR for explicit --enable-tui.
+	* configure: Regenerated.
+
+2008-06-26  Joel Brobecker  <brobecker@adacore.com>
+
+	* dwarf2read.c (read_attribute_value): Treat size attribute
+	values of 0xffffffff as if the attribute value was zero.
+
+2008-06-26  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* linux-nat.c: Add description of overall logic.
+
+2008-06-26  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* Makefile.in (GNULIB_H): Use GNULIB_STDINT_H.
+	(gdb_stdint_h, gdb_stdint.h, stamp-int): Delete.  Remove
+	all dependencies on $(gdb_stdint_h).
+	(distclean): Do not delete gdb_stdint.h.
+	* acinclude.m4: Do not use stdint.m4.
+	* configure.ac: Set GNULIB_STDINT_H.  Remove tests for stdint.h,
+	uintptr_t, and gdb_stdint.h.
+	* defs.h: Include <stdint.h>.
+	* gdb_thread_db.h: Assume stdint.h is already included.
+	* breakpoint.c, findcmd.c, hppa-tdep.c, inf-ptrace.c, proc-service.c,
+	rs6000-nat.c, spu-linux-nat.c, target.c, win32-nat.c: Do not
+	include gdb_stdint.h.
+	* configure, config.in: Regenerate.
+
+2008-06-26  Joseph Myers  <joseph@codesourcery.com>
+
+	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle passing
+	decimal floating-point values in GPRs for soft-float.
+	(do_ppc_sysv_return_value): Handle returning decimal
+	floating-point values in GPRs for soft-float.
+
+2008-06-26  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* target.c (target_read_until_error): New.
+	* target.h (target_read_until_error): Declare.
+	* mi/mi-main.c (mi_cmd_data_read_memory): Use
+	target_read_until_error.
+
+2008-06-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix a memory leak found by Hui Zhu <teawater@gmail.com>.
+	* c-exp.y (parse_number): Move the S and SAVED_CHAR initialization
+	after the DECFLOAT detection to fix a memory leak.  Remove the
+	redundant NUM initialization.  Protect the DECFLOAT detection memory
+	access before the P block.  Restore the P memory content for the
+	DECFLOAT detection.
+
+2008-06-25  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Kill the return value for all MI command functions.
+	* mi/mi-cmds.h (enum mi_cmd_result): Remove.
+	(mi_cmd_argv_ftype): Change return type to void.
+
+	* mi/mi-main.c: Adjust all function that implement
+	MI commands to return nothing.
+	(struct captured_mi_execute_command_actions):
+	Remove the rc field.
+	(mi_cmd_execute): Return nothing.
+	(mi_execute_async_cli_command): Return nothing.
+	(mi_cmd_exec_interrupt): Don't print ^done here.
+	(mi_cmd_target_select): Don't print ^connected here.
+	(captured_mi_execute_command): Don't check for MI_CMD_DONE.
+	Special-case -target-select and output ^connected, not ^done.
+
+	* mi/mi-cmd-break.c: Adjust.
+	* mi/mi-cmd-disas.c: Adjust.
+	* mi/mi-cmd-env.c: Adjust.
+	* mi/mi-cmd-file.c: Adjust.
+	* mi/mi-cmd-stack.c: Adjust.
+	* mi/mi-cmd-target.c: Adjust.
+	* mi/mi-cmd-var.c: Adjust.
+	* mi/mi-interp.c: Adjust.
+	* mi/mi-symbol-cmds.c: Adjust.
+
+2008-06-25  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Emit ^running via observer.
+	* mi/mi-interp.c (mi_cmd_interpreter_exec): Do no print
+	^running here.
+	(mi_on_resume): Print ^running if not previously output.
+	* mi/mi-main.c (running_result_record_printed): New.
+	(captured_mi_execute_command): Reset
+	running_result_record_printed.  Use running_result_record_printed
+	to decide if we should skip ^done.
+	(mi_execute_async_cli_command): Don't print ^running here.
+	* mi/mi-main.h (current_token, running_result_record_printed):
+	Declare.
+
+2008-06-24  Michael Snyder  <msnyder@specifix.com>
+
+	* infrun.c (_initialize_infrun): White space and typo fix.
+
+2008-06-23  Christopher Faylor  <me.gdb.changelog@cgf.cx>
+
+	* win32-nat.c (safe_symbol_file_add_stub): Remove unused variable.
+	(do_initial_win32_stuff): Fix problem with inability to set breakpoints
+	when first loading DLL with "dll" command.
+
+2008-06-19  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* gnu-nat.c (proc_string): Use capital T for "Thread".
+
+2008-06-19  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* win32-nat.c (win32_pid_to_str): Use capital T for "Thread".
+
+2008-06-18  Joel Brobecker  <brobecker@adacore.com>
+
+	* solib-osf.c (osf_solib_create_inferior_hook): Do nothing if
+	the target cannot run.
+
+2008-06-18  Joel Brobecker  <brobecker@adacore.com>
+
+	* solib-osf.c (osf_solib_create_inferior_hook): Do nothing if
+	we're attaching to a running process.
+
+2008-06-18  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* win32-nat.c (handle_load_dll): Give dll name and load address
+	if debug_events is on.
+	(handle_unload_dll): Likewise.
+
+2008-06-14  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Don't suppress *running when doing finish.
+	* infcall.c (call_function_by_hand): Set both
+	suppress_resume_observer and suppress_stop_observer.
+	* infcmd.c (suppress_run_stop_observers): Split into...
+	(suppress_resume_observer, suppress_stop_observer): ...those.
+	(finish_command_continuation): Clear suppress_stop_observer.
+	(finish_command): Set suppress_stop_observer.
+	* inferior.h (suppress_run_stop_observers): Split into...
+	(suppress_resume_observer, suppress_stop_observer): ...those.
+	* infrun.c (normal_stop): Check for suppress_stop_observer.
+	* thread.c (set_running): Check for suppress_resume_observer.
+
+2008-06-12  Pedro Alves  <pedro_alves@portugalmail.pt>
+	    Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* gdbarch.sh (gdbarch_skip_main_prologue): New.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	* i386-tdep.h (i386_skip_main_prologue): Declare.
+	* i386-tdep.c (i386_skip_main_prologue): New.
+	* i386-cygwin-tdep.c (i386_cygwin_init_abi): Register
+	i386_skip_main_prologue as gdbarch_skip_main_prologue gdbarch callback.
+	* symtab.c (find_function_start_sal): When pc points at the "main"
+	function, call gdbarch_skip_main_prologue.
+
+2008-06-11  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* value.c (value_primitive_field): Fetch lazy register values.
+
+2008-06-11  Pedro Alves  <pedro@codesourcery.com>
+
+	* NEWS: Mention support removal of undocumented S AA p PID stop
+	reply packet.
+
+	* remote.c (remote_wait): Remove undocumented S AA p PID support.
+
+2008-06-10  Stan Shebs  <stan@codesourcery.com>
+
+	* MAINTAINERS: Update my affiliation and address.
+
+2008-06-10  Andreas Schwab  <schwab@suse.de>
+
+	* top.c (print_gdb_version): Don't print final newline.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Implement *running.
+	* Makefile.in: Update dependencies.
+	* gdbthread.h (struct thread_info): New field
+	running_.
+	(set_running, is_running): New.
+	* thread.c (set_running, is_running): New.
+	* inferior.h (suppress_normal_stop_observer): Rename to...
+	(suppress_run_stop_observers): ..this.
+	* infcmd.c (suppress_normal_stop_observer): Rename to...
+	(suppress_run_stop_observers): ..this.
+	(finish_command_continuation, finish_command): Adjust.
+	* infcall.c (call_function_by_hand): Adjust.
+	* infrun.c (normal_stop): Call set_running.
+	* target.c (target_resume): New.  Call set_running.
+	* target.h (target_resume): Convert from macro to
+	a function.
+
+	* mi/mi-interp.c (mi_on_resume): New.
+	(mi_interpreter_init): Register mi_on_resume.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Use observers to report stop events in MI.
+	* mi/mi-interp.c (mi_on_normal_stop): New.
+	(mi_interpreter_init): Register mi_on_normal_stop.
+	(mi_interpreter_exec_continuation): Remove.
+	(mi_cmd_interpreter_exec): Don't register the above.
+	* mi/mi-main.c (captured_mi_execute_command): Don't care
+	about sync_execution.
+	(mi_execute_async_cli_command): Don't install continuation.  Don't
+	print *stopped.
+	(mi_exec_async_cli_cmd_continuation): Remove.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Suppress normal stop observer when it's problematic.
+	* inferior.h (suppress_normal_stop_observer): New.
+	* infcall.c (call_function_by_hand): Disable stop events when
+	doing function calls.
+	* infmcd.c (suppress_normal_stop_observer): New.
+	(finish_command_continuation): Call normal_stop observer
+	explicitly.
+	(finish_command): Disable stop events inside proceed.
+	* infrun.c (normal_stop): Don't call normal stop observer if
+	suppressed of if multi-step is in progress.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Remove stale code.
+	* infrun.c (finish_command): Don't pass cleanup
+	to continuation.
+	(finish_command_continuation): Don't grab cleanup from
+	the passed data, as we don't use, and cannot, use it anyway.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Introduce common cleanup for restoring integers.
+	* defs.h (make_cleanup_restore_integer): New declaration.
+	(struct cleanup): New field free_arg.
+	(make_my_cleanup_2): New.
+	* utils.c (restore_integer_closure, restore_integer)
+	(make_cleanup_restore_integer): New.
+	(make_my_cleanup): Initialize the free_arg field and
+	renamed to make_my_cleanup_2.
+	(do_my_cleanups): Call free_arg.
+	(discard_cleanups): Call free_arg.
+	* breakpoint.c (restore_always_inserted_mode): Remove.
+	(update_breakpoints_after_exec): Use make_cleanup_restore_integer.
+
 2008-06-09  Doug Evans  <dje@google.com>
 
 	* remote.c (remote_wait): Include beginning of malformed packet
@@ -76,8 +1404,8 @@
 	* infrun.c (normal_stop): Use it.
 
 2008-06-05  Vladimir Prus  <vladimir@codesourcery.com>
-            Nathan Sidwell  <nathan@codesourcery.com>
-            Joseph Myers  <joseph@codesourcery.com>
+	    Nathan Sidwell  <nathan@codesourcery.com>
+	    Joseph Myers  <joseph@codesourcery.com>
 
 	* acinclude.m4: Include ../config/acx.m4.
 	* configure.ac: Use ACX_PKGVERSION and ACX_BUGURL.
@@ -141,15 +1469,15 @@
 2008-06-05  Aleksandar Ristovski  <aristovski@qnx.com>
 
 	* bcache.c (bcache_data): Call deprecated_bcache_added function.
-	(deprecated_bcache_added): New function name. Body of function 
-	bcache_data is used here with the addition of 'added' argument. 
+	(deprecated_bcache_added): New function name. Body of function
+	bcache_data is used here with the addition of 'added' argument.
 	* bcache.h (deprecated_bcache_added): New function.
 	* symfile.c (add_psymbol_to_bcache): New helper function, takes part of
 	work from add_psymbol_to_list - initialises partial symbol and stashes
 	it in objfile's cache.
-	(append_psymbol_to_list): New helper function, takes other part of 
+	(append_psymbol_to_list): New helper function, takes other part of
 	work from add_psymbol_to_list - adds partial symbol to the given list.
-	(add_psymbol_to_list): Call helper functions instead of doing work 
+	(add_psymbol_to_list): Call helper functions instead of doing work
 	here. If adding to global list, do not duplicate partial symbols in the
 	partial symtab.
 
@@ -183,7 +1511,7 @@
 	(svr4_clear_solib): Clear main_lm_addr.
 
 2008-06-03  Michael Snyder  <msnyder@redhat.com>
-            Joseph Myers  <joseph@codesourcery.com>
+	    Joseph Myers  <joseph@codesourcery.com>
 
 	* mips-tdep.c (mips_eabi_return_value): Replace stub that always
 	returned RETURN_VALUE_STRUCT_CONVENTION with a real function.
@@ -219,7 +1547,7 @@
 2008-05-28  Aleksandar Ristovski  <aristovski@qnx.com>
 
 	* breakpoint.c (print_exception_catchpoint): In CLI add 'Temporary' for
-	temporary catchpoints.  In MI add missing fields 'reason', 'disp', 
+	temporary catchpoints.  In MI add missing fields 'reason', 'disp',
 	'bkptno'.
 	(print_mention_exception_catchpoint): Add 'Temporary' for temporary
 	catchpoints.
@@ -228,14 +1556,14 @@
 2008-05-28  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Refactor varobj_update interface.
-        * varobj.c (varobj_update): Report changes as vector.  Also
-        return not just a list of varobj, but a list of special structures
-        that tell what exactly has changed.
-        * varobj.h (enum varobj_update_error): Rename to
-        varobj_scope_status.
-        (struct varobj_update_result_t): New.
-        (varobj_update): Adjust prototype.
-        * mi/mi-cmd-var.c: Adjust for changes.
+	* varobj.c (varobj_update): Report changes as vector.  Also
+	return not just a list of varobj, but a list of special structures
+	that tell what exactly has changed.
+	* varobj.h (enum varobj_update_error): Rename to
+	varobj_scope_status.
+	(struct varobj_update_result_t): New.
+	(varobj_update): Adjust prototype.
+	* mi/mi-cmd-var.c: Adjust for changes.
 
 2008-05-28  Vladimir Prus  <vladimir@codesourcery.com>
 
@@ -887,8 +2215,8 @@
 
 2008-05-05  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * top.c (command_line_handler_continuation): Remove.
-        (execute_command): Do not install the above.
+	* top.c (command_line_handler_continuation): Remove.
+	(execute_command): Do not install the above.
 
 2008-05-05  Vladimir Prus  <vladimir@codesourcery.com>
 
@@ -1290,9 +2618,9 @@
 2008-05-03  Pedro Alves  <pedro@codesourcery.com>
 
 	* thread.c (delete_thread): Call observer_notify_thread_exit.
-        * mi/mi-interp.c (mi_interpreter_init): Register mi_thread_exit as
-        thread_exit observer.
-        (mi_thread_exit): New.
+	* mi/mi-interp.c (mi_interpreter_init): Register mi_thread_exit as
+	thread_exit observer.
+	(mi_thread_exit): New.
 
 2008-05-03  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
@@ -1322,7 +2650,7 @@
 	(find_function_start_pc): Likewise.
 	* value.c: Include "objfiles.h".
 	(value_fn_field): Handle minimal symbols pointing to function
-	descriptors. 
+	descriptors.
 	* Makefile.in (linespec.o): Update dependencies.
 	(value.o): Likewise.
 
@@ -1518,13 +2846,36 @@
 	* gdbarch.c, gdbarch.h: Regenerated.
 	* gdbarch.sh: Added two new functions target_signal_from_host and
 	target_signal_to_host.
-	* target.h (default_target_signal_from_host, 
+	* target.h (default_target_signal_from_host,
 	default_target_signal_to_host): New functions - declarations.
 	* signals/signals.c (struct gdbarch): New declaration.
 	(default_target_signal_to_host, default_target_signal_from_host): New
 	functions.
 
 2008-05-01  Daniel Jacobowitz  <dan@codesourcery.com>
+	    Pedro Alves  <pedro@codesourcery.com>
+
+	Based on work by Jan Kratochvil <jan.kratochvil@redhat.com> and Jeff
+ 	Johnston <jjohnstn@redhat.com>.
+
+	* NEWS: Mention attach to stopped process fix.
+	* infcmd.c (detach_command, disconnect_command): Discard the thread
+	list.
+	* infrun.c (handle_inferior_event): Do not ignore non-SIGSTOP while
+	attaching.  Use signal_stop_state.
+	(signal_stop_state): Check stop_soon.
+	* linux-nat.c (kill_lwp): Declare earlier.
+	(pid_is_stopped, linux_nat_post_attach_wait): New.
+	(lin_lwp_attach_lwp): Use linux_nat_post_attach_wait.  Update
+	comments.
+	(linux_nat_attach): Use linux_nat_post_attach_wait.
+	(detach_callback, linux_nat_detach): Improve handling for signalled
+	processes.
+	(linux_nat_pid_to_str): Always print out the LWP ID if it differs
+	from the process ID.
+	* Makefile.in (infcmd.o): Update.
+
+2008-05-01  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* arm-linux-tdep.h (ARM_CPSR_REGNUM): Delete definition.
 	* arm-tdep.c (arm_frame_is_thumb): New.
@@ -1554,7 +2905,7 @@
 2008-05-01  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* thread.c (add_thread): Move observer call to ...
-        (add_thread_silent): ... here.
+	(add_thread_silent): ... here.
 
 2008-04-30  Ulrich Weigand  <uweigand@de.ibm.com>
 
@@ -1821,29 +3172,29 @@
 
 2008-04-24  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * breakpoint.c (bpstat_check_location)
-        (bpstat_check_watchpoint, bpstat_check_breakpoint_conditions):
-        New, extracted from bpstat_stop_status.
-        (bpstat_stop_status): Use the above.
+	* breakpoint.c (bpstat_check_location)
+	(bpstat_check_watchpoint, bpstat_check_breakpoint_conditions):
+	New, extracted from bpstat_stop_status.
+	(bpstat_stop_status): Use the above.
 
 2008-04-24  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * mi/mi-main.c (last_async_command): Rename to current_token.
-        (previous_async_command): Remove.
-        (mi_cmd_gdb_exit): Adjust.
-        (mi_cmd_exec_interrupt): Don't dance with previous_async_command.
-        (mi_cmd_target_select): Adjust.
-        (mi_cmd_execute): Don't set previous_async_command.  Free token
-        here even in async mode.
-        (mi_execute_async_cli_command): Adjust.
-        (mi_exec_async_cli_cmd_continuation): Adjust.  Do not free the
-        token.
-        (mi_load_progress): Adjust.
+	* mi/mi-main.c (last_async_command): Rename to current_token.
+	(previous_async_command): Remove.
+	(mi_cmd_gdb_exit): Adjust.
+	(mi_cmd_exec_interrupt): Don't dance with previous_async_command.
+	(mi_cmd_target_select): Adjust.
+	(mi_cmd_execute): Don't set previous_async_command.  Free token
+	here even in async mode.
+	(mi_execute_async_cli_command): Adjust.
+	(mi_exec_async_cli_cmd_continuation): Adjust.  Do not free the
+	token.
+	(mi_load_progress): Adjust.
 
 2008-04-24  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * infcmd.c (step_1_continuation): Always disable longjmp
-        breakpoint if we're not going to do another step.
+	* infcmd.c (step_1_continuation): Always disable longjmp
+	breakpoint if we're not going to do another step.
 
 2008-04-24  Vladimir Prus  <vladimir@codesourcery.com>
 
@@ -1952,7 +3303,7 @@
 	* target.c (target_disconnect, target_detach): Remove
 	breakpoints from target.
 
-	
+
 2008-04-24  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* breakpoint.c (print_one_breakpoint_location): In MI
@@ -1989,8 +3340,8 @@
 
 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
 
-        * acinclude.m4: Add override.m4.
-        * configure: Regenerate.
+	* acinclude.m4: Add override.m4.
+	* configure: Regenerate.
 
 2008-04-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
@@ -2277,10 +3628,10 @@
 	    Vladimir Prus  <vladimir@codesourcery.com>
 
 	Fix @-varobjs.
-        * varobj.c (value_of_root): Update the expression for
-        floating varobjs.
-        * mi/mi-cmd-var.c (varobj_update_one): If type has changed,
-        report that.
+	* varobj.c (value_of_root): Update the expression for
+	floating varobjs.
+	* mi/mi-cmd-var.c (varobj_update_one): If type has changed,
+	report that.
 
 2008-04-09  Marc Khouzam  <marc.khouzam@ericsson.com>
 
@@ -2301,7 +3652,7 @@
 	*value_of_variable.
 	(varobj_get_formatted_value): New.
 	(varobj_get_value): Added format parameter to method call.
-        
+
 2008-04-08  Joel Brobecker  <brobecker@adacore.com>
 
 	* stabsread.c (cleanup_undefined_types_noname): Manually set the
@@ -2310,7 +3661,7 @@
 2008-04-08  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* target.h (enum strata): Remove the download_stratum.
-	
+
 2008-04-07  Doug Evans  <dje@google.com>
 
 	* buildsym.h (last_source_file): Add dwarf info to comment.
@@ -2325,33 +3676,33 @@
 2008-04-06  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Fix breakpoint condition that use member variables.
-        * valops.c (check_field): Remove.
-        (check_field_in): Rename to check_field.
-        (value_of_this): Use la_name_of_this.
-        * value.h (check_field): Adjust prototype.
+	* valops.c (check_field): Remove.
+	(check_field_in): Rename to check_field.
+	(value_of_this): Use la_name_of_this.
+	* value.h (check_field): Adjust prototype.
 
-        * language.h (la_value_of_this): Rename to la_name_of_this.
-        * language.c (unknown_language_defn): Specify "this" for
-        name_of_this.
-        (auto_language_defn): Likewise.
-        (local_language_defn): Likewise.
-        * ada-lang.c (ada_language_defn): Adjust comment.
-        * c-lang.c (c_language_defn): Adjust comment.
-        (cplus_language_defn): Specify "this" for name_of_this.
-        (asm_language_defn): Adjust comment.
-        (minimal_language_defn): Adjust comment.
-        * f-lang.c (f_language_defn): Specify NULL for name_of_this.
-        * jv-lang.c (java_language_defn): Specify "this" for name_of_this.
-        * m2-lang.c (m2_language_defn): Specify "this" for name_of_this.
-        * objc-lang.c (objc_language_defn): Specify "self" for
-        name_of_this.
-        * p-lang.c (pascal_language_defn): Specify "this" for
-        name_of_this.
-        * scm-lang.c (scm_language_defn): Specify NULL for name_of_this.
+	* language.h (la_value_of_this): Rename to la_name_of_this.
+	* language.c (unknown_language_defn): Specify "this" for
+	name_of_this.
+	(auto_language_defn): Likewise.
+	(local_language_defn): Likewise.
+	* ada-lang.c (ada_language_defn): Adjust comment.
+	* c-lang.c (c_language_defn): Adjust comment.
+	(cplus_language_defn): Specify "this" for name_of_this.
+	(asm_language_defn): Adjust comment.
+	(minimal_language_defn): Adjust comment.
+	* f-lang.c (f_language_defn): Specify NULL for name_of_this.
+	* jv-lang.c (java_language_defn): Specify "this" for name_of_this.
+	* m2-lang.c (m2_language_defn): Specify "this" for name_of_this.
+	* objc-lang.c (objc_language_defn): Specify "self" for
+	name_of_this.
+	* p-lang.c (pascal_language_defn): Specify "this" for
+	name_of_this.
+	* scm-lang.c (scm_language_defn): Specify NULL for name_of_this.
 
-        * symtab.c (lookup_symbol_aux): Lookup "this" in the
-        proper scope, and check for field in type of "this", without
-        trying to create a value.
+	* symtab.c (lookup_symbol_aux): Lookup "this" in the
+	proper scope, and check for field in type of "this", without
+	trying to create a value.
 
 2008-04-04  Pedro Alves  <pedro@codesourcery.com>
 
@@ -2400,7 +3751,7 @@
 2008-04-01  Aleksandar Ristovski  <aristovski@qnx.com>
 
 	* valops.c (value_cast_structs): New function. Cast related
-	STRUCT types up/down and return cast value. The body of this 
+	STRUCT types up/down and return cast value. The body of this
 	function comes mostly from value_cast_pointers.
 	(value_cast_pointers): Code for actual cast STRUCT-STRUCT moved
 	to value_cast_structs. Now value_cast_pointers needs only create
@@ -2564,14 +3915,14 @@
 2008-03-24  Nick Roberts  <nickrob@snap.net.nz>
 	    Vladimir Prus  <vladimir@codesourcery.com>
 
-        * varobj.c  (struct varobj_root): New component thread_id.
-        (varobj_get_thread_id, check_scope): New functions.
-        (c_value_of_root): Use check_scope.  Switch to the
+	* varobj.c  (struct varobj_root): New component thread_id.
+	(varobj_get_thread_id, check_scope): New functions.
+	(c_value_of_root): Use check_scope.  Switch to the
 	proper thread if necessary.
 
-        * varobj.h (varobj_get_thread_id): New extern.
+	* varobj.h (varobj_get_thread_id): New extern.
 
-        * mi/mi-cmd-var.c (print_varobj): Add thread-id field.
+	* mi/mi-cmd-var.c (print_varobj): Add thread-id field.
 
 2008-03-23  Daniel Jacobowitz  <dan@codesourcery.com>
 
@@ -2590,10 +3941,10 @@
 
 2008-03-23  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * varobj.c (struct varobj_root): Clarify
-        comment on the frame field.
-        (varobj_create): Don't set frame if we have no
-        block.
+	* varobj.c (struct varobj_root): Clarify
+	comment on the frame field.
+	(varobj_create): Don't set frame if we have no
+	block.
 
 2008-03-21  Daniel Jacobowitz  <dan@codesourcery.com>
 
@@ -2877,46 +4228,46 @@
 
 2008-03-16  Nick Hudson  <nick.hudson@dsl.pipex.com>
 
-        * Makefile.in (amd64nbsd-nat.o): New dependency.
-        * amd64nbsd-nat.c: Include "nbsd-nat.h".
-        (_initialize_amd64nbsd_nat): Update target vector to use
-        nbsd_pid_to_exec_file.
-        * config/i386/nbsd64.mh (NATDEPFILES): Add nbsd-nat.o.
+	* Makefile.in (amd64nbsd-nat.o): New dependency.
+	* amd64nbsd-nat.c: Include "nbsd-nat.h".
+	(_initialize_amd64nbsd_nat): Update target vector to use
+	nbsd_pid_to_exec_file.
+	* config/i386/nbsd64.mh (NATDEPFILES): Add nbsd-nat.o.
 
 2008-03-15  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Remove ignoring leading exec events code.
-        * fork-child.c (startup_inferior): Do not set
-        inferior_ignoring_leading_exec_events.
-        * inf-child.c (inf_child_reported_exec_events_per_exec_call): Remove.
-        (inf_child_target): Do not set to_reported_exec_events_per_exec_call.
-        * infrun.c (inferior_ignoring_leading_exec_events): Remove.
-        (handle_inferior_event): Remove code for ignoring leading exec
-        events.
-        * target.c (update_current_target): Do not inherit, or default,
-        to_reported_exec_events_per_exec_call.
-        (debug_to_reported_exec_events_per_exec_call): Remove.
-        (setup_target_debug): Do not set to_reported_exec_events_per_exec_call.
-        * target.h (target_reported_exec_events_per_exec_call): Remove.
-        (struct target): Remove the to_reported_exec_events_per_exec_call
-        field.
+	* fork-child.c (startup_inferior): Do not set
+	inferior_ignoring_leading_exec_events.
+	* inf-child.c (inf_child_reported_exec_events_per_exec_call): Remove.
+	(inf_child_target): Do not set to_reported_exec_events_per_exec_call.
+	* infrun.c (inferior_ignoring_leading_exec_events): Remove.
+	(handle_inferior_event): Remove code for ignoring leading exec
+	events.
+	* target.c (update_current_target): Do not inherit, or default,
+	to_reported_exec_events_per_exec_call.
+	(debug_to_reported_exec_events_per_exec_call): Remove.
+	(setup_target_debug): Do not set to_reported_exec_events_per_exec_call.
+	* target.h (target_reported_exec_events_per_exec_call): Remove.
+	(struct target): Remove the to_reported_exec_events_per_exec_call
+	field.
 
 2008-03-15  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Implement -thread-info.
-        * gdbthread.h (print_thread_info): Declare.
+	* gdbthread.h (print_thread_info): Declare.
 
-        * thread.c (print_thread_info): New, extracted
-        from info_threads_command and adjusted to
-        work for CLI and MI.
-        (info_threads_command): Use print_thread_info.
+	* thread.c (print_thread_info): New, extracted
+	from info_threads_command and adjusted to
+	work for CLI and MI.
+	(info_threads_command): Use print_thread_info.
 	* Makefile.in: Update dependencies.
 
-        * mi/mi-cmds.c (mi_cmds): Specify a handler
-        for -thread-info.
-        * mi/mi-cmds.h (mi_cmd_thread_info): Declare.
-        * mi/mi-main.c (mi_cmd_thread_info): New.
-        (mi_cmd_list_features): Include 'thread-info'.
+	* mi/mi-cmds.c (mi_cmds): Specify a handler
+	for -thread-info.
+	* mi/mi-cmds.h (mi_cmd_thread_info): Declare.
+	* mi/mi-main.c (mi_cmd_thread_info): New.
+	(mi_cmd_list_features): Include 'thread-info'.
 
 2008-03-14  Kevin Buettner  <kevinb@redhat.com>
 
@@ -2974,33 +4325,33 @@
 2008-03-14  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Async mode fixes.
-        * Makefile.in (infcmd.o, inf-loop.o): Update dependencies.
-        * breakpoint.c (bpstat_do_actions): In async mode,
-        don't jump to top expecting stop_bpstat to be already
-        updated.
-        * event-loop.c (start_event_loop): Call async_enable_stdin
-        on exception.
-        * event-top.c (async_enable_stdin): Do nothing if sync_execution
-        is not set.
-        (command_handler): Do not setup continuation here.
-        (command_line_handler_continuation): Move to...
-        * top.c (command_line_handler_continuation): ... here.
-        (execute_command): In async mode, register continuation.
-        Don't check frame's language in running in async mode.
-        * exceptions.c (throw_exception): Don't do exec_error_cleanups.
-        * inf-loop.c (complete_execution): Inline into...
-        (inferior_event_handler): ... here.  Clear target_executing before
-        doing any cleanups.  Don't try to show prompt if the target was
-        resumed.
-        * infcmd.c (signal_command): Add support for async mode.
-        (finish_command): Only add continuation if the target was
-        successfully resumed.
-        * remote.c (init_async_opts): Register to_get_thread_local_address
-        handler.
-        * mi/mi-interp.c (mi_cmd_interpreter_exec): Don't mess
-        with sync_execution.
-        * tui/tui-interp.c (tui_command_loop): Call async_enable_stdin
-        on exception.
+	* Makefile.in (infcmd.o, inf-loop.o): Update dependencies.
+	* breakpoint.c (bpstat_do_actions): In async mode,
+	don't jump to top expecting stop_bpstat to be already
+	updated.
+	* event-loop.c (start_event_loop): Call async_enable_stdin
+	on exception.
+	* event-top.c (async_enable_stdin): Do nothing if sync_execution
+	is not set.
+	(command_handler): Do not setup continuation here.
+	(command_line_handler_continuation): Move to...
+	* top.c (command_line_handler_continuation): ... here.
+	(execute_command): In async mode, register continuation.
+	Don't check frame's language in running in async mode.
+	* exceptions.c (throw_exception): Don't do exec_error_cleanups.
+	* inf-loop.c (complete_execution): Inline into...
+	(inferior_event_handler): ... here.  Clear target_executing before
+	doing any cleanups.  Don't try to show prompt if the target was
+	resumed.
+	* infcmd.c (signal_command): Add support for async mode.
+	(finish_command): Only add continuation if the target was
+	successfully resumed.
+	* remote.c (init_async_opts): Register to_get_thread_local_address
+	handler.
+	* mi/mi-interp.c (mi_cmd_interpreter_exec): Don't mess
+	with sync_execution.
+	* tui/tui-interp.c (tui_command_loop): Call async_enable_stdin
+	on exception.
 
 2008-03-14  Daniel Jacobowitz  <dan@codesourcery.com>
 
@@ -3018,39 +4369,39 @@
 2008-03-14  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Remove unused remote.c hooks.
-        * remote.c (deprecated_target_resume_hook)
-        (deprecated_target_wait_loop_hook): Remove.
-        (remote_resume): Do not call deprecated_target_resume_hook.
-        (remote_wait): Do not call deprecated_target_wait_loop_hook.
-        (remote_async_wait): Likewise.
+	* remote.c (deprecated_target_resume_hook)
+	(deprecated_target_wait_loop_hook): Remove.
+	(remote_resume): Do not call deprecated_target_resume_hook.
+	(remote_wait): Do not call deprecated_target_wait_loop_hook.
+	(remote_async_wait): Likewise.
 
 2008-03-14  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Implement MI notification for new threads.
-        * doc/observer.texi (new_thread): Document.
-        * observer.sh: Forward declare struct thread_info.
-        * thread.c (add_thread): Notify observer.
+	* doc/observer.texi (new_thread): Document.
+	* observer.sh: Forward declare struct thread_info.
+	* thread.c (add_thread): Notify observer.
 
-        * interps.h (interp_init_ftype): New parameter
-        top_level.
-        (interp_set): Likewise.
-        (top_level_interpreter_data): Declare.
-        * interps.c (interp_set): New parameter top_level.
-        Pass it to interpreter's init function.  Remember
-        top level interpreter.
-        (interpreter_exec_cmd): Adjust.
-        (top_level_interpreter_data): New.
-        * main.c (captured_main): Pass 1 for top_level
-        parameter of interp_set.
+	* interps.h (interp_init_ftype): New parameter
+	top_level.
+	(interp_set): Likewise.
+	(top_level_interpreter_data): Declare.
+	* interps.c (interp_set): New parameter top_level.
+	Pass it to interpreter's init function.  Remember
+	top level interpreter.
+	(interpreter_exec_cmd): Adjust.
+	(top_level_interpreter_data): New.
+	* main.c (captured_main): Pass 1 for top_level
+	parameter of interp_set.
 	* cli/cli-interp.c (cli_interpreter_init): New
-        parameter top_level.
-        * tui/tui-interp.c (tui_init): New parameter top_level.
+	parameter top_level.
+	* tui/tui-interp.c (tui_init): New parameter top_level.
 
-        * mi/mi-interp.c (mi_new_thread): New.
-        (mi_interpreter_init): If top level, register
-        observer for new threads.
+	* mi/mi-interp.c (mi_new_thread): New.
+	(mi_interpreter_init): If top level, register
+	observer for new threads.
 
-        * Makefile.in (mi-interp.o, thread.o): Update dependencies.
+	* Makefile.in (mi-interp.o, thread.o): Update dependencies.
 
 2008-03-14  Pedro Alves  <pedro@codesourcery.com>
 
@@ -3209,7 +4560,7 @@
 
 	* mi/mi-interp.c (mi_command_loop): Remove
 	commented-out code.
-	
+
 2008-03-07  Joel Brobecker  <brobecker@adacore.com>
 
 	* remote.c (extended_remote_attach_1): Make local variable pid an int
@@ -3439,9 +4790,9 @@
 2008-02-23  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Unbreak 'target async'.
-        * serial.c (serial_async): Set the
-        handler function before enabling async
-        mode.
+	* serial.c (serial_async): Set the
+	handler function before enabling async
+	mode.
 
 2008-02-22  Daniel Jacobowitz  <dan@codesourcery.com>
 
@@ -3471,13 +4822,13 @@
 
 	* alpha-tdep.c (alpha_heuristic_unwind_cache): Replace saved_regs by
 	trad_frame_saved_reg.
-	(trad-frame.h): New include. 
+	(trad-frame.h): New include.
 
 	(alpha_heuristic_frame_unwind_cache): Use trad_frame_alloc_saved_regs
-	instead of frame_obstack_zalloc. 
+	instead of frame_obstack_zalloc.
 	(alpha_heuristic_frame_prev_register): Use trad_frame_get_prev_register.
 
-	* Makefile.in (alpha-tdep.o): Add dependency to trad_frame_h. 
+	* Makefile.in (alpha-tdep.o): Add dependency to trad_frame_h.
 
 2008-02-20  Markus Deuling  <deuling@de.ibm.com>
 
@@ -3545,7 +4896,7 @@
 	of gdbarch_num_regs.
 
 	* hppa-hpux-tdep.c (hppa_hpux_sr_for_addr): Add gdbarch as parameter and
-	replace current_gdbarch by gdbarch.	
+	replace current_gdbarch by gdbarch.
 	(hppa_hpux_push_dummy_code): Update call for hppa_hpux_sr_for_addr.
 
 2008-02-18  Markus Deuling  <deuling@de.ibm.com>
@@ -3558,13 +4909,13 @@
 
 	* ppcnbsd-nat.c (getregs_supplies, getfpregs_supplies): Add gdbarch as
 	parameter and replace current_gdbarch by gdbarch.
-	
+
 	(ppcnbsd_store_inferior_registers): Use get_regcache_arch to get at
 	the current architecture. Update call for getregs_supplies and
 	getfpregs_supplies.
 	(ppcnbsd_fetch_inferior_registers): Likewise.
 
-	* ppcobsd-nat.c (getfpregs_supplies): Add gdbarch as parameter and 
+	* ppcobsd-nat.c (getfpregs_supplies): Add gdbarch as parameter and
 	replace current_gdbarch by gdbarch.
 	(ppcobsd_fetch_registers, ppcobsd_store_registers): Use
 	get_regcache_arch to get at the current architecture. Update call for
@@ -3573,7 +4924,7 @@
 2008-02-18  Markus Deuling  <deuling@de.ibm.com>
 
 	* arch-utils.c (gdbarch_from_bfd): Remove unnecessary {old,new}_gdbarch
-	variables. 
+	variables.
 
 2008-02-15  Markus Deuling  <deuling@de.ibm.com>
 
@@ -3582,7 +4933,7 @@
 2008-02-14  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* NEWS: Mention pending breakpints in MI.
-	
+
 2008-02-14  Markus Deuling  <deuling@de.ibm.com>
 
 	* Makefile.in (ALL_TARGET_OBS): Remove dependency to xtensa-linux-nat.o.
@@ -3736,8 +5087,8 @@
 
 	Update stored rendition of varobj value when format changes.
 	* varobj.c (varobj_set_display_format): Recomputed
-        print_value.
-        (c_value_of_variable): Return print_value.
+	print_value.
+	(c_value_of_variable): Return print_value.
 
 2008-02-03  Doug Evans  <dje@google.com>
 
@@ -3769,7 +5120,7 @@
 
 2008-02-02  Mark Kettenis  <kettenis@gnu.org>
 	    Luis Machado  <luisgpm@br.ibm.com>
-	    Thiago Jung Bauermann  <bauerman@br.ibm.com>	
+	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
 	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Pass floats that
 	don't fit into registerson the stack the way GCC does.
@@ -3787,18 +5138,18 @@
 	(new_symbol): Likewise.
 
 2008-02-01  Vladimir Prus  <vladimir@codesourcery.com>
-	
-        * breakpoint.c (break_command_1): Return void.
-        (break_command_really): Return void.  Rethrow
-        exceptions instead of returning.
-        (gdb_breakpoint): Remove the error_message parameter.
-        Return void.  Rename to set_breakpoint.
-        * gdb.h (gdb_breakpoint): Rename and move to...
+
+	* breakpoint.c (break_command_1): Return void.
+	(break_command_really): Return void.  Rethrow
+	exceptions instead of returning.
+	(gdb_breakpoint): Remove the error_message parameter.
+	Return void.  Rename to set_breakpoint.
+	* gdb.h (gdb_breakpoint): Rename and move to...
 	* breakpoint.h (set_breakpoint): ...here.
-        * mi/mi-cmb-break.c (mi_cmd_break_insert): Restore
-        event hooks even if exception is thrown.  Adjust to
-        gdb_breakpoint interface changes.
-	
+	* mi/mi-cmb-break.c (mi_cmd_break_insert): Restore
+	event hooks even if exception is thrown.  Adjust to
+	gdb_breakpoint interface changes.
+
 
 2008-02-01  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
@@ -3810,8 +5161,8 @@
 
 	Properly rethrow exception.  This fixes errors
 	about non-existent functions for -break-insert.
-        * breakpoint.c (break_command_really): Use throw_exception
-        for rethrowing.  If rethrowing, don't print the exception.
+	* breakpoint.c (break_command_really): Use throw_exception
+	for rethrowing.  If rethrowing, don't print the exception.
 
 2008-01-31  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
@@ -3892,13 +5243,13 @@
 2008-01-30  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Use vector for varobj_list_children interface.
-        * gdb/varobj.c (varobj_list_children): Return vector
-        of varobjs.
-        * gdb/varobj.h (varobj_list_children): Adjust
-        prototype.
-        (varobj_p): Declare.  Declare vector thereof.
-        * mi/mi-cmd-var.c (mi_cmd_var_list_children): Adjust
-        for varobj_list_children change.
+	* gdb/varobj.c (varobj_list_children): Return vector
+	of varobjs.
+	* gdb/varobj.h (varobj_list_children): Adjust
+	prototype.
+	(varobj_p): Declare.  Declare vector thereof.
+	* mi/mi-cmd-var.c (mi_cmd_var_list_children): Adjust
+	for varobj_list_children change.
 	* Makefile.in (varobj_h): Update dependencies.
 
 2008-01-30  Thiago Jung Bauermann  <bauerman@br.ibm.com>
@@ -3997,7 +5348,7 @@
 
 2008-01-29  Aleksandar Ristovski  <aristovski@qnx.com>
 
-	* varobj (adjust_value_for_child_access): Added checking for 
+	* varobj (adjust_value_for_child_access): Added checking for
 	returned value from gdb_value_ind.
 	(c_describe_child): Likewise.
 	(cplus_describe_child): Fixed a typo.
@@ -4012,39 +5363,39 @@
 	This eliminates the need to traverse value chain, doing
 	various checks, in three different places.
 
-        * breakpoint.h (struct bp_location): New fields
-        lengths and watchpoint_type.
-        (struct breakpoint): Remove the val_chain field.
-        * breakpoint.c (is_hardware_watchpoint): New.
-        (free_valchain): Remove.
-        (update_watchpoint): New.
-        (insert_bp_location): For hardware watchpoint, just
-        directly insert it.
-        (insert_breakpoints): Call update_watchpoint_locations
-        on all watchpoints.  If we have failed to insert
-        any location of a hardware watchpoint, remove all inserted
-        locations.
-        (remove_breakpoint): For hardware watchpoints, directly
-        remove location.
-        (watchpoints_triggered): Iterate over locations.
-        (bpstat_stop_status): Use only first location of
-        a resource watchpoint.
-        (delete_breakpoint): Don't call free_valchain.
-        (print_one_breakpoint): Don't print all
-        locations for watchpoints.
-        (breakpoint_re_set_one): Use update_watchpoint for
-        watchpoints.
+	* breakpoint.h (struct bp_location): New fields
+	lengths and watchpoint_type.
+	(struct breakpoint): Remove the val_chain field.
+	* breakpoint.c (is_hardware_watchpoint): New.
+	(free_valchain): Remove.
+	(update_watchpoint): New.
+	(insert_bp_location): For hardware watchpoint, just
+	directly insert it.
+	(insert_breakpoints): Call update_watchpoint_locations
+	on all watchpoints.  If we have failed to insert
+	any location of a hardware watchpoint, remove all inserted
+	locations.
+	(remove_breakpoint): For hardware watchpoints, directly
+	remove location.
+	(watchpoints_triggered): Iterate over locations.
+	(bpstat_stop_status): Use only first location of
+	a resource watchpoint.
+	(delete_breakpoint): Don't call free_valchain.
+	(print_one_breakpoint): Don't print all
+	locations for watchpoints.
+	(breakpoint_re_set_one): Use update_watchpoint for
+	watchpoints.
 
 2008-01-29  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Don't reset watchpoint block on solib load.
 
-        * breakpoint.c (insert_bp_location): For watchpoints,
-        recompute condition.
-        (breakpoint_re_set_one): Instead of recomputing value
-        and condition for watchpoints, just reset value and
-        let insert_breakpoints/insert_bp_location recompute it.
-        Don't do anything about disabled watchpoint.
+	* breakpoint.c (insert_bp_location): For watchpoints,
+	recompute condition.
+	(breakpoint_re_set_one): Instead of recomputing value
+	and condition for watchpoints, just reset value and
+	let insert_breakpoints/insert_bp_location recompute it.
+	Don't do anything about disabled watchpoint.
 
 2008-01-29  Pierre Muller  <muller@ics.u-strasbg.fr>
 
@@ -4093,32 +5444,32 @@
 2008-01-23  Vladimir Prus  <vladimir@codesourcery.com>
 	    Chris Demetriou  <cgd@google.com>
 
-        * thread.c (add_thread_silent): Renamed
-        from add_thread.
-        (print_thread_events): New variable definition.
-        (show_print_thread_events): New function.
-        (_initialize_thread): Add "set print thread-events" and
-        "show print thread-events" commands.
-        (add_thread): Announce new thread.
-        * gdbthread.h (add_thread_silent): Declare.
-        (print_thread_events): New variable declaration.
-        * inf-ttrace.c (inf_ttrace_wait): Don't
-        inform about new thread, as add_thread is always
-        called too, and will take care of that.
-        * infrun.c (handle_inferior_event): Likewise.
-        * procfs.c (procfs_wait): Likewise.
-        * remote.c (remote_currthread): Likewise.
-        * sol-thread.c (sol_thread_wait): Likewise.
-        * win32-nat.c (get_win32_debug_event): Likewise.
-        * linux-thread-db.c (attach_thread): Likewise.
-        Remove the verbose parameter.
-        (check_event): Make detach_thread be verbose
-        only if print_thread_events is set.
-        * linux-nat.c (lin_lwp_attach_lwp): Don't inform
-        about new thread.  This is called only from
-        linux-thread-db.c:attach_thread, which will take care.
-        Remove the verbose parameter.
-        * linux-nat.h (lin_lwp_attach_lwp): Adjust prototype.
+	* thread.c (add_thread_silent): Renamed
+	from add_thread.
+	(print_thread_events): New variable definition.
+	(show_print_thread_events): New function.
+	(_initialize_thread): Add "set print thread-events" and
+	"show print thread-events" commands.
+	(add_thread): Announce new thread.
+	* gdbthread.h (add_thread_silent): Declare.
+	(print_thread_events): New variable declaration.
+	* inf-ttrace.c (inf_ttrace_wait): Don't
+	inform about new thread, as add_thread is always
+	called too, and will take care of that.
+	* infrun.c (handle_inferior_event): Likewise.
+	* procfs.c (procfs_wait): Likewise.
+	* remote.c (remote_currthread): Likewise.
+	* sol-thread.c (sol_thread_wait): Likewise.
+	* win32-nat.c (get_win32_debug_event): Likewise.
+	* linux-thread-db.c (attach_thread): Likewise.
+	Remove the verbose parameter.
+	(check_event): Make detach_thread be verbose
+	only if print_thread_events is set.
+	* linux-nat.c (lin_lwp_attach_lwp): Don't inform
+	about new thread.  This is called only from
+	linux-thread-db.c:attach_thread, which will take care.
+	Remove the verbose parameter.
+	* linux-nat.h (lin_lwp_attach_lwp): Adjust prototype.
 
 2008-01-23  Nick Roberts  <nickrob@snap.net.nz>
 
@@ -4162,10 +5513,10 @@
 	* hppaobsd-tdep.c: ... here. New file.
 	* hppnbsd-tdep.c: New file.
 	* hppnbsd-nat.c: New file.
-        * Makefile.in (ALL_TARGET_OBS): Add hppanbsd-tdep.o and hppaobsd-tdep.o.
+	* Makefile.in (ALL_TARGET_OBS): Add hppanbsd-tdep.o and hppaobsd-tdep.o.
 	(ALLDEPFILES): Add hppabsd-nat.c and hppabsd-tdep.c.
-        (hppabsd-nat.o, hppabsd-tdep.o): New dependencies.
-        (hppabsd-tdep.o, hppaobsd-tdep.o): Update dependencies.
+	(hppabsd-nat.o, hppabsd-tdep.o): New dependencies.
+	(hppabsd-tdep.o, hppaobsd-tdep.o): Update dependencies.
 	* configure.host (hppa*-*-netbsd*): New entry.
 	* configure.tgt (hppa*-*-netbsd*): New entry.
 	(hppa*-*-openbsd*): Update.
@@ -4189,7 +5540,7 @@
 	* dwarf2read.c (dwarf2_add_field): Likewise.
 	* ada-lang.c (decode_packed_array, ada_value_primitive_packed_val)
 	(move_bits, ada_value_assign, value_assign_to_component): Likewise.
-	
+
 	* defs.h (BITS_BIG_ENDIAN): Remove.
 
 2008-01-18  Markus Deuling  <deuling@de.ibm.com>
@@ -4256,7 +5607,7 @@
 
 2008-01-16  Markus Deuling  <deuling@de.ibm.com>
 
-	* amd64-nat.h (amd64_native_gregset_supplies_p): Add gdbarch as 
+	* amd64-nat.h (amd64_native_gregset_supplies_p): Add gdbarch as
 	parameter.
 	* amd64-nat.c (amd64_native_gregset_supplies_p): Likewise.
 
@@ -4304,7 +5655,7 @@
 	current_gdbarch by gdbarch.
 
 	(alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the
-	current architecture by frame_info. Update alpha_heuristic_proc_start 
+	current architecture by frame_info. Update alpha_heuristic_proc_start
 	call.
 
 	(alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use
@@ -4324,11 +5675,11 @@
 	gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch.
 
 	* h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add
-	gdbarch	as parameter. Update caller.	
+	gdbarch	as parameter. Update caller.
 	(h8300_init_frame_cache): Add gdbarch as parameter. Replace
 	current_gdbarch by gdbarch. Update caller.
 
-	* hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and 
+	* hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and
 	update caller. Replace current_gdbarch by gdbarch.
 
 	* m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at
@@ -4340,7 +5691,7 @@
 	(M6811_TDEP): Remove.
 	(m68hc11_frame_prev_register): Use get_frame_arch to get at the current
 	architecture.
-	(m68hc11_scan_prologue): Add gdbarch as parameter. Replace 
+	(m68hc11_scan_prologue): Add gdbarch as parameter. Replace
 	current_gdbarch by gdbarch. Update caller.
 
 	* m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and
@@ -4356,10 +5707,10 @@
 	* ppc-linux-nat.c (fetch_register, store_register): Update caller of
 	altivec_register_p and spe_register_p.
 
-	* score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update 
+	* score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update
 	caller. Replace current_gdbarch by gdbarch.
 	(score_analyze_prologue): use get_frame_arch to get at the current
-	architecture.	
+	architecture.
 
 	* sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter.
 	* sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace
@@ -4380,7 +5731,7 @@
 	deprecated_print_address_numeric by paddress.
 	* Makefile.in (exec.o) Add dependency to arch-utils.h.
 
-	* valprint.c (val_print_string): Replace 
+	* valprint.c (val_print_string): Replace
 	deprecated_print_address_numeric.
 	* tracepoint.c (trace_mention, scope_info): Likewise.
 	* symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol)
@@ -4398,7 +5749,7 @@
 	* dwarf2read.c (dump_die): Likewise.
 	* ada-valprint.c (ada_val_print_1): Likewise.
 	* f-valprint.c (f_val_print): Likewise.
-	* linux-fork.c (info_forks_command): Likewise.	
+	* linux-fork.c (info_forks_command): Likewise.
 	* m32r-com.c (m32r_load_section, m32r_load)
 	(m32r_upload_command): Likewise.
 
@@ -4551,9 +5902,9 @@
 	execution on Solaris.  This also unbreaks pending breakpoints.
 
 	* solist.h (struct target_so_ops): New field same.
-        * solib-svr4.c (svr4_same): New.
-        (_initialize_svr4_solib): Register svr4_same.
-        * solib.c (update_solib_list): Use ops->same, if available.
+	* solib-svr4.c (svr4_same): New.
+	(_initialize_svr4_solib): Register svr4_same.
+	* solib.c (update_solib_list): Use ops->same, if available.
 
 2008-01-06  Christopher Faylor  <me+cygwin@cgf.cx>
 
@@ -4593,7 +5944,7 @@
 
 2008-01-04  Paul N. Hilfinger  <hilfinger@adacore.com>
 
-        * ada-exp.y: Allow '{type} ADDRESS' notation on left of assignment.
+	* ada-exp.y: Allow '{type} ADDRESS' notation on left of assignment.
 
 2008-01-04  Joel Brobecker  <brobecker@adacore.com>
 
@@ -4639,12 +5990,12 @@
 	(ada_to_fixed_type_1): Renamed from ada_to_fixed_type.
 	(ada_to_fixed_type): New wrapper around ada_to_fixed_type_1.
 	* ada-typeprint.c (ada_print_type): Get the typename from
-	the original type, not the base type. 
+	the original type, not the base type.
 
 2008-01-03  Jerome Guitton  <guitton@adacore.com>
 
 	* ada-lang.c (ada_value_struct_elt, to_fixed_array_type)
-	(to_fixed_array_type, ada_to_fixed_value_create, unwrap_value): 
+	(to_fixed_array_type, ada_to_fixed_value_create, unwrap_value):
 	Update calls to ada_to_fixed_type.
 	(ada_template_to_fixed_record_type_1): Ditto, but without looking
 	for the tag.
@@ -4656,7 +6007,7 @@
 
 2008-01-03  Luis Machado  <luisgpm@br.ibm.com>
 
-	* doublest.c (convert_floatformat_to_doublest): Call 
+	* doublest.c (convert_floatformat_to_doublest): Call
 	floatformat_to_doublest instead of floatformat_to_double and use
 	DOUBLEST variables.
 	(convert_doublest_to_floatformat): Call floatformat_from_doublest
@@ -4695,7 +6046,7 @@
 
 	* ada-lang.c (ada_value_equal): Dereference reference types when
 	comparing arrays.
- 
+
 2008-01-01  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	Updated copyright notices for most files.
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index ab068f1..c843ff1 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -121,7 +121,7 @@
 	Klee Dienes (Apple)
 	Paul Hilfinger (UC Berkeley)
 	Dan Jacobowitz (CodeSourcery)
-	Stan Shebs (Mozilla)
+	Stan Shebs (CodeSourcery)
 	Richard Stallman (FSF)
 	Ian Lance Taylor (C2)
 	Todd Whitesel
@@ -164,7 +164,7 @@
 Andrew Cagney			cagney@gnu.org
 Daniel Jacobowitz		dan@debian.org
 Mark Kettenis           	kettenis@gnu.org
-Stan Shebs			shebs@mozilla.com
+Stan Shebs			stan@codesourcery.com
 Michael Snyder			msnyder@specifix.com
 Ulrich Weigand			Ulrich.Weigand@de.ibm.com
 Elena Zannoni			ezannoni@redhat.com
@@ -415,7 +415,7 @@
 to do so!
 
 PowerPC			Andrew Cagney		cagney@gnu.org
-CRIS			Hans-Peter Nilsson	hp@bitrange.com
+CRIS			Hans-Peter Nilsson	hp@axis.com
 IA64			Jeff Johnston		jjohnstn@redhat.com
 MIPS			Joel Brobecker		brobecker@adacore.com
 m32r			Kei Sakamoto		sakamoto.kei@renesas.com
@@ -562,7 +562,7 @@
 Andreas Schwab					schwab@suse.de
 Keith Seitz					keiths@redhat.com
 Carlos Eduardo Seo				cseo@linux.vnet.ibm.com
-Stan Shebs					shebs@mozilla.com
+Stan Shebs					stan@codesourcery.com
 Mark Shinwell					shinwell@codesourcery.com
 Craig Silverstein				csilvers@google.com
 Aidan Skinner					aidan@velvet.net
@@ -591,6 +591,7 @@
 Eli Zaretskii					eliz@gnu.org
 Wu Zhou						woodzltc@cn.ibm.com
 Yoshinori Sato					ysato@users.sourceforge.jp
+Hui Zhu						teawater@gmail.com
 
 
 			Past Maintainers
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c14dc1a..3e82b92 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -166,7 +166,7 @@
 
 # Generated headers in the gnulib directory.  These must be listed
 # so that they are generated before other files are compiled.
-GNULIB_H = gnulib/string.h
+GNULIB_H = gnulib/string.h @GNULIB_STDINT_H@
 
 #
 # CLI sub directory definitons
@@ -707,7 +707,6 @@
 config_h = config.h
 exc_request_U_h = exc_request_U.h
 exc_request_S_h = exc_request_S.h
-gdb_stdint_h = gdb_stdint.h
 msg_reply_S_h = msg_reply_S.h
 msg_U_h = msg_U.h
 notify_S_h = notify_S.h
@@ -801,7 +800,7 @@
 gdb_stat_h = gdb_stat.h
 gdb_string_h = gdb_string.h
 gdb_thread_db_h = gdb_thread_db.h
-gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h) $(ui_out_h)
+gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h) $(ui_out_h) $(inferior_h)
 gdbtypes_h = gdbtypes.h $(hashtab_h)
 gdb_vfork_h = gdb_vfork.h
 gdb_wait_h = gdb_wait.h
@@ -1417,7 +1416,6 @@
 	rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
 	rm -f gdbserver/Makefile gdbserver/config.cache
 	rm -f nm.h config.status config.h stamp-h .gdbinit
-	rm -f gdb_stdint.h
 	rm -f y.output yacc.acts yacc.tmp y.tab.h
 	rm -f config.log config.cache
 	rm -f Makefile
@@ -1476,15 +1474,6 @@
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-gdb_stdint.h: stamp-int ; @true
-stamp-int: config.status
-	CONFIG_COMMANDS=gdb_stdint.h \
-	  CONFIG_FILES= \
-	  CONFIG_HEADERS= \
-	  CONFIG_LINKS= \
-	  $(SHELL) config.status
-	echo stamp > stamp-int
-
 config.status: configure configure.tgt configure.host
 	$(SHELL) config.status --recheck
 
@@ -1984,8 +1973,7 @@
 	$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
 	$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solib_h) \
 	$(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h) \
-	$(mi_common_h) $(memattr_h) $(ada_lang_h) $(top_h) $(hashtab_h) \
-	$(gdb_stdint_h)
+	$(mi_common_h) $(memattr_h) $(ada_lang_h) $(top_h) $(hashtab_h)
 bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
 	$(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
 	$(readline_h) $(bsd_kvm_h)
@@ -2034,7 +2022,7 @@
 core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \
 	$(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(gregset_h)
 cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \
-	$(ui_out_h) $(gdb_string_h)
+	$(ui_out_h) $(gdb_string_h) $(exceptions_h)
 cp-name-parser.o: cp-name-parser.c $(safe_ctype_h) $(libiberty_h) $(demangle_h)
 cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \
 	$(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h) $(objfiles_h) \
@@ -2118,7 +2106,7 @@
 event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
 	$(terminal_h) $(event_loop_h) $(event_top_h) $(interps_h) \
 	$(exceptions_h) $(cli_script_h) $(gdbcmd_h) $(readline_h) \
-	$(readline_history_h) $(main_h)
+	$(readline_history_h) $(main_h) $(gdbthread_h)
 exceptions.o: exceptions.c $(defs_h) $(exceptions_h) $(breakpoint_h) \
 	$(target_h) $(inferior_h) $(annotate_h) $(ui_out_h) $(gdb_assert_h) \
 	$(gdb_string_h) $(serial_h)
@@ -2136,7 +2124,7 @@
 	$(parser_defs_h) $(language_h) $(f_lang_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(block_h)
 findcmd.o: findcmd.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) $(value_h) \
-	$(target_h) $(gdb_stdint_h)
+	$(target_h)
 findvar.o: findvar.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(frame_h) \
 	$(value_h) $(gdbcore_h) $(inferior_h) $(target_h) $(gdb_string_h) \
 	$(gdb_assert_h) $(floatformat_h) $(symfile_h) $(regcache_h) \
@@ -2153,7 +2141,8 @@
 	$(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(user_regs_h) \
 	$(gdb_obstack_h) $(dummy_frame_h) $(sentinel_frame_h) $(gdbcore_h) \
 	$(annotate_h) $(language_h) $(frame_unwind_h) $(frame_base_h) \
-	$(command_h) $(gdbcmd_h) $(observer_h) $(objfiles_h) $(exceptions_h)
+	$(command_h) $(gdbcmd_h) $(observer_h) $(objfiles_h) $(exceptions_h) \
+	$(gdbthread_h)
 frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \
 	$(gdb_assert_h) $(dummy_frame_h) $(gdb_obstack_h) $(value_h) \
 	$(regcache_h)
@@ -2232,7 +2221,7 @@
 	$(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \
 	$(hppa_tdep_h) $(elf_common_h) $(regset_h) $(regcache_h)
 hppa-tdep.o: hppa-tdep.c $(defs_h) $(bfd_h) $(inferior_h) $(regcache_h) \
-	$(completer_h) $(osabi_h) $(gdb_assert_h) $(gdb_stdint_h) \
+	$(completer_h) $(osabi_h) $(gdb_assert_h) \
 	$(arch_utils_h) $(symtab_h) $(dis_asm_h) $(trad_frame_h) \
 	$(frame_unwind_h) $(frame_base_h) $(gdbcore_h) $(gdbcmd_h) \
 	$(objfiles_h) $(hppa_tdep_h) $(gdbtypes_h)
@@ -2248,7 +2237,7 @@
 	$(i386_tdep_h) $(regset_h) $(gdb_obstack_h) $(xml_support_h) \
 	$(gdbcore_h) $(solib_h) $(solib_target_h) $(i386_cygwin_tdep_h)
 i386-dicos-tdep.o: i386-dicos-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \
-	$(solib_h) $(solib_target_h)
+	$(solib_h) $(solib_target_h) $(inferior_h)
 i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \
 	$(bsd_kvm_h)
@@ -2334,19 +2323,19 @@
 	$(user_regs_h) $(exceptions_h) $(cli_decode_h) $(gdbthread_h)
 inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \
 	$(event_top_h) $(inf_loop_h) $(remote_h) $(exceptions_h) \
-	$(language_h)
+	$(language_h) $(gdbthread_h)
 inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
 	$(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \
 	$(inflow_h) $(gdb_select_h)
 inf-ptrace.o: inf-ptrace.c $(defs_h) $(command_h) $(inferior_h) $(inflow_h) \
-	$(gdbcore_h) $(regcache_h) $(gdb_stdint_h) $(gdb_assert_h) \
+	$(gdbcore_h) $(regcache_h) $(gdb_assert_h) \
 	$(gdb_string_h) $(gdb_ptrace_h) $(gdb_wait_h) $(inf_child_h)
 infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
 	$(inferior_h) $(exceptions_h) $(breakpoint_h) $(gdb_wait_h) \
 	$(gdbcore_h) $(gdbcmd_h) $(cli_script_h) $(target_h) $(gdbthread_h) \
 	$(annotate_h) $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) \
 	$(value_h) $(observer_h) $(language_h) $(solib_h) $(gdb_assert_h) \
-	$(mi_common_h) $(main_h)
+	$(mi_common_h) $(main_h) $(event_top_h)
 inf-ttrace.o: inf-ttrace.c $(defs_h) $(command_h) $(gdbcore_h) \
 	$(gdbthread_h) $(inferior_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h)
@@ -2552,7 +2541,7 @@
 	$(symtab_h) $(dwarf2_frame_h) $(osabi_h) $(target_h) $(mn10300_tdep_h)
 monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(exceptions_h) \
 	$(gdb_string_h) $(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) \
-	$(inferior_h) $(gdb_regex_h) $(srec_h) $(regcache_h)
+	$(inferior_h) $(gdb_regex_h) $(srec_h) $(regcache_h) $(gdbthread_h)
 mt-tdep.o: mt-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) $(frame_base_h) \
 	$(symtab_h) $(dis_asm_h) $(arch_utils_h) $(gdbtypes_h) \
 	$(gdb_string_h) $(regcache_h) $(reggroups_h) $(gdbcore_h) \
@@ -2645,8 +2634,7 @@
 	$(gdb_string_h) $(gdb_assert_h) $(inflow_h) $(auxv_h) \
 	$(gdb_dirent_h) $(gdb_stat_h) $(proc_utils_h) $(gregset_h)
 proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \
-	$(symtab_h) $(target_h) $(regcache_h) $(gregset_h) $(gdbcore_h) \
-	$(gdb_stdint_h)
+	$(symtab_h) $(target_h) $(regcache_h) $(gregset_h) $(gdbcore_h)
 proc-why.o: proc-why.c $(defs_h) $(proc_utils_h)
 prologue-value.o: prologue-value.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \
 	$(prologue_value_h) $(regcache_h)
@@ -2684,12 +2672,12 @@
 	$(gdb_string_h) $(terminal_h) $(target_h) $(gdbcore_h) \
 	$(gdb_callback_h) $(gdb_remote_sim_h) $(command_h) \
 	$(regcache_h) $(gdb_assert_h) $(sim_regno_h) $(arch_utils_h) \
-	$(readline_h)
+	$(readline_h) $(gdbthread_h)
 rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
 	$(xcoffsolib_h) $(symfile_h) $(objfiles_h) $(libbfd_h) $(bfd_h) \
 	$(exceptions_h) $(gdb_stabs_h) $(regcache_h) $(arch_utils_h) \
 	$(inf_ptrace_h) $(ppc_tdep_h) $(rs6000_tdep_h) $(exec_h) \
-	$(gdb_stdint_h) $(observer_h) $(gdb_stat_h)
+	$(observer_h) $(gdb_stat_h)
 rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
 	$(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) $(arch_utils_h) \
 	$(regcache_h) $(regset_h) $(doublest_h) $(value_h) $(parser_defs_h) \
@@ -2875,7 +2863,7 @@
 	$(value_h) $(gdb_assert_h) $(gdb_string_h) $(sparc_tdep_h)
 spu-linux-nat.o: spu-linux-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h) \
 	$(target_h) $(inferior_h) $(inf_ptrace_h) $(regcache_h) $(symfile_h) \
-	$(gdb_wait_h) $(gdb_stdint_h) $(spu_tdep_h)
+	$(gdb_wait_h) $(gdbthread_h) $(spu_tdep_h)
 spu-tdep.o: spu-tdep.c $(defs_h) $(arch_utils_h) $(gdbtypes_h) $(gdbcmd_h) \
 	$(gdbcore_h) $(gdb_string_h) $(gdb_assert_h) $(frame_h) \
 	$(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(symtab_h) \
@@ -2923,7 +2911,7 @@
 target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
 	$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
 	$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h) \
-	$(exceptions_h) $(target_descriptions_h) $(gdb_stdint_h)
+	$(exceptions_h) $(target_descriptions_h) $(gdbthread_h)
 target-descriptions.o: target-descriptions.c $(defs_h) $(arch_utils_h) \
 	$(target_h) $(target_descriptions_h) $(vec_h) $(xml_tdesc_h) \
 	$(gdbcmd_h) $(gdb_assert_h) $(gdbtypes_h) $(reggroups_h) \
@@ -2933,7 +2921,7 @@
 thread.o: thread.c $(defs_h) $(symtab_h) $(frame_h) $(inferior_h) \
 	$(environ_h) $(value_h) $(target_h) $(gdbthread_h) $(exceptions_h) \
 	$(command_h) $(gdbcmd_h) $(regcache_h) $(gdb_h) $(gdb_string_h) \
-	$(ui_out_h) $(observer_h) $(annotate_h)
+	$(ui_out_h) $(observer_h) $(annotate_h) $(cli_decode_h)
 top.o: top.c $(defs_h) $(gdbcmd_h) $(call_cmds_h) $(cli_cmds_h) \
 	$(cli_script_h) $(cli_setshow_h) $(cli_decode_h) $(symtab_h) \
 	$(inferior_h) $(exceptions_h) $(target_h) $(breakpoint_h) \
@@ -2941,7 +2929,7 @@
 	$(annotate_h) $(completer_h) $(top_h) $(version_h) $(serial_h) \
 	$(doublest_h) $(gdb_assert_h) $(readline_h) $(readline_history_h) \
 	$(event_top_h) $(gdb_string_h) $(gdb_stat_h) $(ui_out_h) \
-	$(cli_out_h) $(main_h) $(event_loop_h)
+	$(cli_out_h) $(main_h) $(event_loop_h) $(gdbthread_h)
 tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \
 	$(expression_h) $(gdbcmd_h) $(value_h) $(target_h) $(language_h) \
 	$(gdb_string_h) $(inferior_h) $(tracepoint_h) $(remote_h) \
@@ -3010,7 +2998,7 @@
 	$(regcache_h) $(top_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \
 	$(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(exec_h) $(solist_h) \
 	$(solib_h) $(i386_tdep_h) $(i387_tdep_h) $(gdb_obstack_h) \
-	$(xml_support_h) $(i386_cygwin_tdep_h) $(gdb_stdint_h)
+	$(xml_support_h) $(i386_cygwin_tdep_h)
 win32-termcap.o: win32-termcap.c
 wrapper.o: wrapper.c $(defs_h) $(value_h) $(exceptions_h) $(wrapper_h) \
 	$(ui_out_h)
@@ -3268,7 +3256,8 @@
 	$(mi_getopt_h) $(remote_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-target.c
 mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
-	$(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h) $(mi_getopt_h)
+	$(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h) $(mi_getopt_h) \
+	$(gdbthread_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-var.c
 mi-console.o: $(srcdir)/mi/mi-console.c $(defs_h) $(mi_console_h) \
 	$(gdb_string_h)
diff --git a/gdb/NEWS b/gdb/NEWS
index 69bc05c..e783259 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,9 @@
 
 *** Changes since GDB 6.8
 
+* Commands `set debug-file-directory', `set solib-search-path' and `set args'
+now complete on file names.
+
 * When completing in expressions, gdb will attempt to limit
 completions to allowable structure or union fields, where appropriate.
 For instance, consider:
@@ -19,6 +22,12 @@
 qSearch:memory:
   Search memory for a sequence of bytes.
 
+* Removed remote protocol undocumented extension
+
+  An undocumented extension to the remote protocol's `S' stop reply
+  packet that permited the stub to pass a process id was removed.
+  Remote servers should use the `T' stop reply packet instead.
+
 * The "disassemble" command now supports an optional /m modifier to print mixed
 source+assembly.
 
@@ -59,7 +68,11 @@
     val1 [, val2, ...]
   Search memory for a sequence of bytes.
 
-set debug timetstamp
+set print symbol-loading
+show print symbol-loading
+  Control printing of symbol loading messages.
+
+set debug timestamp
 show debug timestamp
   Display timestamps with GDB debugging output.
 
@@ -89,6 +102,12 @@
   the current CPSR value for instructions without symbols; previous
   versions of GDB behaved as if "set arm fallback-mode arm".
 
+set disable-randomization
+show disable-randomization
+  Standalone programs run with the virtual address space randomization enabled
+  by default on some platforms.  This option keeps the addresses stable across
+  multiple debugging sessions.
+
 * New targets
 
 x86 DICOS			i[34567]86-*-dicos*
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index f88d9be..a5e8a34 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -10,9 +10,6 @@
 dnl This gets autoconf bugfixes
 sinclude(../config/override.m4)
 
-dnl This gets GCC_HEADER_STDINT.
-sinclude(../config/stdint.m4)
-
 sinclude(../config/gettext-sister.m4)
 
 dnl For AC_LIB_HAVE_LINKFLAGS.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index cb85617..0eecd90 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4625,7 +4625,7 @@
   if (current_block == NULL)
     return nsyms;
 
-  current_function = block_function (current_block);
+  current_function = block_linkage_function (current_block);
   if (current_function == NULL)
     return nsyms;
 
@@ -6721,7 +6721,7 @@
 static struct symbol *
 find_old_style_renaming_symbol (const char *name, struct block *block)
 {
-  const struct symbol *function_sym = block_function (block);
+  const struct symbol *function_sym = block_linkage_function (block);
   char *rename;
 
   if (function_sym != NULL)
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 3749a2c..507db07 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -98,14 +98,14 @@
 }
 
 static CORE_ADDR
-alpha_linux_sigcontext_addr (struct frame_info *next_frame)
+alpha_linux_sigcontext_addr (struct frame_info *this_frame)
 {
   CORE_ADDR pc;
   ULONGEST sp;
   long off;
 
-  pc = frame_pc_unwind (next_frame);
-  sp = frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM);
+  pc = get_frame_pc (this_frame);
+  sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
 
   off = alpha_linux_sigtramp_offset (pc);
   gdb_assert (off >= 0);
diff --git a/gdb/alphafbsd-tdep.c b/gdb/alphafbsd-tdep.c
index 54df027..349d0a9 100644
--- a/gdb/alphafbsd-tdep.c
+++ b/gdb/alphafbsd-tdep.c
@@ -76,13 +76,13 @@
   return pc - alphafbsd_sigtramp_start;
 }
 
-/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
-   routine, return the address of the associated sigcontext structure.  */
+/* Assuming THIS_FRAME is the frame of a BSD sigtramp routine,
+   return the address of the associated sigcontext structure.  */
 
 static CORE_ADDR
-alphafbsd_sigcontext_addr (struct frame_info *next_frame)
+alphafbsd_sigcontext_addr (struct frame_info *this_frame)
 {
-  return frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM) + 24;
+  return get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM) + 24;
 }
 
 /* FreeBSD 5.0-RELEASE or later.  */
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index c85753b..b5e161a 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -253,7 +253,9 @@
   /* 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 get_frame_base (frame);
+  if (!get_next_frame (frame))
+    return 0;
+  return get_frame_base (get_next_frame (frame));
 }
 
 
diff --git a/gdb/alphaobsd-tdep.c b/gdb/alphaobsd-tdep.c
index 8a1da45..8c951d4 100644
--- a/gdb/alphaobsd-tdep.c
+++ b/gdb/alphaobsd-tdep.c
@@ -68,26 +68,26 @@
 }
 
 static CORE_ADDR
-alphaobsd_sigcontext_addr (struct frame_info *next_frame)
+alphaobsd_sigcontext_addr (struct frame_info *this_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
 
   if (alphaobsd_sigtramp_offset (pc) < 3 * ALPHA_INSN_SIZE)
     {
       /* On entry, a pointer the `struct sigcontext' is passed in %a2.  */
-      return frame_unwind_register_unsigned (next_frame, ALPHA_A0_REGNUM + 2);
+      return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM + 2);
     }
   else if (alphaobsd_sigtramp_offset (pc) < 4 * ALPHA_INSN_SIZE)
     {
       /* It is stored on the stack Before calling the signal handler.  */
       CORE_ADDR sp;
-      sp = frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM);
-      return get_frame_memory_unsigned (next_frame, sp, 8);
+      sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
+      return get_frame_memory_unsigned (this_frame, sp, 8);
     }
   else
     {
       /* It is reloaded into %a0 for the sigreturn(2) call.  */
-      return frame_unwind_register_unsigned (next_frame, ALPHA_A0_REGNUM);
+      return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM);
     }
 }
 
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 292a0d6..549b666 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -246,6 +246,8 @@
 	  break;
 	}
       ++ents;
+      if (type == AT_NULL)
+	break;
     }
 
   xfree (data);
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index f2a69f4..85f3c0a 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -872,7 +872,7 @@
    for it IS the sp for the next frame. */
 
 struct avr_unwind_cache *
-avr_frame_unwind_cache (struct frame_info *next_frame,
+avr_frame_unwind_cache (struct frame_info *this_frame,
                         void **this_prologue_cache)
 {
   CORE_ADDR pc;
@@ -886,14 +886,14 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
   (*this_prologue_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   info->size = 0;
   info->prologue_type = AVR_PROLOGUE_NONE;
 
-  pc = frame_func_unwind (next_frame, NORMAL_FRAME);
+  pc = get_frame_func (this_frame);
 
-  if ((pc > 0) && (pc < frame_pc_unwind (next_frame)))
+  if ((pc > 0) && (pc < get_frame_pc (this_frame)))
     avr_scan_prologue (pc, info);
 
   if ((info->prologue_type != AVR_PROLOGUE_NONE)
@@ -904,8 +904,8 @@
       /* The SP was moved to the FP.  This indicates that a new frame
          was created.  Get THIS frame's FP value by unwinding it from
          the next frame.  */
-      this_base = frame_unwind_register_unsigned (next_frame, AVR_FP_REGNUM);
-      high_base = frame_unwind_register_unsigned (next_frame, AVR_FP_REGNUM+1);
+      this_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM);
+      high_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM+1);
       this_base += (high_base << 8);
       
       /* The FP points at the last saved register.  Adjust the FP back
@@ -916,7 +916,7 @@
     {
       /* Assume that the FP is this frame's SP but with that pushed
          stack space added back.  */
-      this_base = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM);
+      this_base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
       prev_sp = this_base + info->size;
     }
 
@@ -928,7 +928,7 @@
 
   /* Adjust all the saved registers so that they contain addresses and not
      offsets.  */
-  for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++)
+  for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
     if (info->saved_regs[i].addr)
       {
         info->saved_regs[i].addr = (info->prev_sp - info->saved_regs[i].addr);
@@ -973,18 +973,18 @@
    frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-avr_frame_this_id (struct frame_info *next_frame,
+avr_frame_this_id (struct frame_info *this_frame,
                    void **this_prologue_cache,
                    struct frame_id *this_id)
 {
   struct avr_unwind_cache *info
-    = avr_frame_unwind_cache (next_frame, this_prologue_cache);
+    = avr_frame_unwind_cache (this_frame, this_prologue_cache);
   CORE_ADDR base;
   CORE_ADDR func;
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame, NORMAL_FRAME);
+  func = get_frame_func (this_frame);
 
   /* Hopefully the prologue analysis either correctly determined the
      frame's base (which is the SP from the previous frame), or set
@@ -997,83 +997,69 @@
   (*this_id) = id;
 }
 
-static void
-avr_frame_prev_register (struct frame_info *next_frame,
-			  void **this_prologue_cache,
-			  int regnum, int *optimizedp,
-			  enum lval_type *lvalp, CORE_ADDR *addrp,
-			  int *realnump, gdb_byte *bufferp)
+static struct value *
+avr_frame_prev_register (struct frame_info *this_frame,
+			  void **this_prologue_cache, int regnum)
 {
   struct avr_unwind_cache *info
-    = avr_frame_unwind_cache (next_frame, this_prologue_cache);
+    = avr_frame_unwind_cache (this_frame, this_prologue_cache);
 
   if (regnum == AVR_PC_REGNUM)
     {
       if (trad_frame_addr_p (info->saved_regs, regnum))
         {
-          *optimizedp = 0;
-          *lvalp = lval_memory;
-          *addrp = info->saved_regs[regnum].addr;
-          *realnump = -1;
-          if (bufferp != NULL)
-            {
-              /* Reading the return PC from the PC register is slightly
-                 abnormal.  register_size(AVR_PC_REGNUM) says it is 4 bytes,
-                 but in reality, only two bytes (3 in upcoming mega256) are
-                 stored on the stack.
+	  /* Reading the return PC from the PC register is slightly
+	     abnormal.  register_size(AVR_PC_REGNUM) says it is 4 bytes,
+	     but in reality, only two bytes (3 in upcoming mega256) are
+	     stored on the stack.
 
-                 Also, note that the value on the stack is an addr to a word
-                 not a byte, so we will need to multiply it by two at some
-                 point. 
+	     Also, note that the value on the stack is an addr to a word
+	     not a byte, so we will need to multiply it by two at some
+	     point. 
 
-                 And to confuse matters even more, the return address stored
-                 on the stack is in big endian byte order, even though most
-                 everything else about the avr is little endian. Ick!  */
+	     And to confuse matters even more, the return address stored
+	     on the stack is in big endian byte order, even though most
+	     everything else about the avr is little endian. Ick!  */
 
-              /* FIXME: number of bytes read here will need updated for the
-                 mega256 when it is available.  */
+	  /* FIXME: number of bytes read here will need updated for the
+	     mega256 when it is available.  */
 
-              ULONGEST pc;
-              unsigned char tmp;
-              unsigned char buf[2];
+	  ULONGEST pc;
+	  unsigned char tmp;
+	  unsigned char buf[2];
 
-              read_memory (info->saved_regs[regnum].addr, buf, 2);
+	  read_memory (info->saved_regs[regnum].addr, buf, 2);
 
-              /* Convert the PC read from memory as a big-endian to
-                 little-endian order. */
-              tmp = buf[0];
-              buf[0] = buf[1];
-              buf[1] = tmp;
+	  /* Convert the PC read from memory as a big-endian to
+	     little-endian order. */
+	  tmp = buf[0];
+	  buf[0] = buf[1];
+	  buf[1] = tmp;
 
-              pc = (extract_unsigned_integer (buf, 2) * 2);
-              store_unsigned_integer
-		(bufferp, register_size (get_frame_arch (next_frame), regnum),
-		 pc);
-            }
+	  pc = (extract_unsigned_integer (buf, 2) * 2);
+
+	  return frame_unwind_got_constant (this_frame, regnum, pc);
         }
+
+      return frame_unwind_got_optimized (this_frame, regnum);
     }
-  else
-    trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				  optimizedp, lvalp, addrp, realnump, bufferp);
+
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
 static const struct frame_unwind avr_frame_unwind = {
   NORMAL_FRAME,
   avr_frame_this_id,
-  avr_frame_prev_register
+  avr_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-const struct frame_unwind *
-avr_frame_sniffer (struct frame_info *next_frame)
-{
-  return &avr_frame_unwind;
-}
-
 static CORE_ADDR
-avr_frame_base_address (struct frame_info *next_frame, void **this_cache)
+avr_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
   struct avr_unwind_cache *info
-    = avr_frame_unwind_cache (next_frame, this_cache);
+    = avr_frame_unwind_cache (this_frame, this_cache);
 
   return info->base;
 }
@@ -1085,18 +1071,17 @@
   avr_frame_base_address
 };
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
+   frame.  The frame ID's base needs to match the TOS value saved by
+   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
 
 static struct frame_id
-avr_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
   ULONGEST base;
 
-  base = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM);
-  return frame_id_build (avr_make_saddr (base), frame_pc_unwind (next_frame));
+  base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
+  return frame_id_build (avr_make_saddr (base), get_frame_pc (this_frame));
 }
 
 /* When arguments must be pushed onto the stack, they go on in reverse
@@ -1322,10 +1307,10 @@
 
   set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc);
 
-  frame_unwind_append_sniffer (gdbarch, avr_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &avr_frame_unwind);
   frame_base_set_default (gdbarch, &avr_frame_base);
 
-  set_gdbarch_unwind_dummy_id (gdbarch, avr_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, avr_dummy_id);
 
   set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp);
diff --git a/gdb/block.c b/gdb/block.c
index d2f1fd7..fd96a52 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -53,10 +53,12 @@
 
 
 /* Return the symbol for the function which contains a specified
-   lexical block, described by a struct block BL.  */
+   lexical block, described by a struct block BL.  The return value
+   will not be an inlined function; the containing function will be
+   returned instead.  */
 
 struct symbol *
-block_function (const struct block *bl)
+block_linkage_function (const struct block *bl)
 {
   while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
     bl = BLOCK_SUPERBLOCK (bl);
diff --git a/gdb/block.h b/gdb/block.h
index db0644c..1e04985 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -132,7 +132,7 @@
 
 enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
 
-extern struct symbol *block_function (const struct block *);
+extern struct symbol *block_linkage_function (const struct block *);
 
 extern int contained_in (const struct block *, const struct block *);
 
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index a1a4535..289e20c 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -77,7 +77,7 @@
   bl = block_for_pc (pc);
   if (bl)
     {
-      struct symbol *symbol = block_function (bl);
+      struct symbol *symbol = block_linkage_function (bl);
 
       if (symbol)
 	{
@@ -106,7 +106,7 @@
   struct block *bl = get_frame_block (frame, 0);
   if (bl == 0)
     return 0;
-  return block_function (bl);
+  return block_linkage_function (bl);
 }
 
 
@@ -119,7 +119,7 @@
   struct block *b = block_for_pc_sect (pc, section);
   if (b == 0)
     return 0;
-  return block_function (b);
+  return block_linkage_function (b);
 }
 
 /* Return the function containing pc value PC.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 051b753..463da57 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -60,13 +60,8 @@
 #include "gdb-events.h"
 #include "mi/mi-common.h"
 
-#include "gdb_stdint.h"
-
 /* Prototypes for local functions. */
 
-static void until_break_command_continuation (struct continuation_arg *arg, 
-					      int error);
-
 static void catch_command_1 (char *, int, int);
 
 static void enable_delete_command (char *, int);
@@ -190,14 +185,12 @@
 
 static void free_bp_location (struct bp_location *loc);
 
-static void mark_breakpoints_out (void);
-
 static struct bp_location *
 allocate_bp_location (struct breakpoint *bpt, enum bptype bp_type);
 
-static void update_global_location_list (void);
+static void update_global_location_list (int);
 
-static void update_global_location_list_nothrow (void);
+static void update_global_location_list_nothrow (int);
 
 static int is_hardware_watchpoint (struct breakpoint *bpt);
 
@@ -310,6 +303,11 @@
 
 struct bp_location *bp_location_chain;
 
+/* The locations that no longer correspond to any breakpoint,
+   unlinked from bp_location_chain, but for which a hit
+   may still be reported by a target.  */
+VEC(bp_location_p) *moribund_locations = NULL;
+
 /* Number of last breakpoint made.  */
 
 int breakpoint_count;
@@ -1263,7 +1261,7 @@
     if (is_hardware_watchpoint (bpt))
       update_watchpoint (bpt, 0 /* don't reparse. */);
 
-  update_global_location_list ();
+  update_global_location_list (1);
 
   if (!always_inserted_mode && target_has_execution)
     /* update_global_location_list does not insert breakpoints
@@ -1435,30 +1433,23 @@
   return 0;
 }
 
-static void
-restore_always_inserted_mode (void *p)
-{
-  always_inserted_mode = (uintptr_t) p;
-}
-
 void
 update_breakpoints_after_exec (void)
 {
   struct breakpoint *b;
   struct breakpoint *temp;
-  struct cleanup *cleanup;
+  struct bp_location *bploc;
 
-  /* Doing this first prevents the badness of having delete_breakpoint()
-     write a breakpoint's current "shadow contents" to lift the bp.  That
-     shadow is NOT valid after an exec()! */
-  mark_breakpoints_out ();
-
-  /* The binary we used to debug is now gone, and we're updating
-     breakpoints for the new binary.  Until we're done, we should not
-     try to insert breakpoints.  */
-  cleanup = make_cleanup (restore_always_inserted_mode, 
-			  (void *) (uintptr_t) always_inserted_mode);
-  always_inserted_mode = 0;
+  /* We're about to delete breakpoints from GDB's lists.  If the
+     INSERTED flag is true, GDB will try to lift the breakpoints by
+     writing the breakpoints' "shadow contents" back into memory.  The
+     "shadow contents" are NOT valid after an exec, so GDB should not
+     do that.  Instead, the target is responsible from marking
+     breakpoints out as soon as it detects an exec.  We don't do that
+     here instead, because there may be other attempts to delete
+     breakpoints after detecting an exec and before reaching here.  */
+  ALL_BP_LOCATIONS (bploc)
+    gdb_assert (!bploc->inserted);
 
   ALL_BREAKPOINTS_SAFE (b, temp)
   {
@@ -1549,7 +1540,6 @@
   }
   /* FIXME what about longjmp breakpoints?  Re-create them here?  */
   create_overlay_event_breakpoint ("_ovly_debug_event");
-  do_cleanups (cleanup);
 }
 
 int
@@ -1703,7 +1693,7 @@
 
 /* Clear the "inserted" flag in all breakpoints.  */
 
-static void
+void
 mark_breakpoints_out (void)
 {
   struct bp_location *bpt;
@@ -2000,7 +1990,10 @@
       if (bs->commands != NULL)
 	tmp->commands = copy_command_lines (bs->commands);
       if (bs->old_val != NULL)
-	tmp->old_val = value_copy (bs->old_val);
+	{
+	  tmp->old_val = value_copy (bs->old_val);
+	  release_value (tmp->old_val);
+	}
 
       if (p == NULL)
 	/* This is the first thing in the chain.  */
@@ -2320,7 +2313,7 @@
       annotate_catchpoint (b->number);
       printf_filtered (_("\nCatchpoint %d (forked process %d), "),
 		       b->number, 
-		       b->forked_inferior_pid);
+		       ptid_get_pid (b->forked_inferior_pid));
       return PRINT_SRC_AND_LOC;
       break;
 
@@ -2328,7 +2321,7 @@
       annotate_catchpoint (b->number);
       printf_filtered (_("\nCatchpoint %d (vforked process %d), "),
 		       b->number, 
-		       b->forked_inferior_pid);
+		       ptid_get_pid (b->forked_inferior_pid));
       return PRINT_SRC_AND_LOC;
       break;
 
@@ -2658,7 +2651,8 @@
       /* If we've gotten confused in the unwinder, we might have
 	 returned a frame that can't describe this variable.  */
       if (within_current_scope
-	  && block_function (b->exp_valid_block) != get_frame_function (fr))
+	  && (block_linkage_function (b->exp_valid_block)
+	      != get_frame_function (fr)))
 	within_current_scope = 0;
 
       /* in_function_epilogue_p() returns a non-zero value if we're still
@@ -2820,17 +2814,17 @@
     return 0;
 
   if ((b->type == bp_catch_fork)
-      && !inferior_has_forked (PIDGET (inferior_ptid),
+      && !inferior_has_forked (inferior_ptid,
 			       &b->forked_inferior_pid))
     return 0;
   
   if ((b->type == bp_catch_vfork)
-      && !inferior_has_vforked (PIDGET (inferior_ptid),
+      && !inferior_has_vforked (inferior_ptid,
 				&b->forked_inferior_pid))
     return 0;
   
   if ((b->type == bp_catch_exec)
-      && !inferior_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
+      && !inferior_has_execd (inferior_ptid, &b->exec_pathname))
     return 0;
 
   return 1;
@@ -3012,10 +3006,12 @@
 {
   struct breakpoint *b = NULL;
   const struct bp_location *bl;
+  struct bp_location *loc;
   /* Root of the chain of bpstat's */
   struct bpstats root_bs[1];
   /* Pointer to the last thing in the chain currently.  */
   bpstat bs = root_bs;
+  int ix;
 
   ALL_BP_LOCATIONS (bl)
   {
@@ -3064,7 +3060,7 @@
 	if (b->disposition == disp_disable)
 	  {
 	    b->enable_state = bp_disabled;
-	    update_global_location_list ();
+	    update_global_location_list (0);
 	  }
 	if (b->silent)
 	  bs->print = 0;
@@ -3084,6 +3080,18 @@
       bs->print_it = print_it_noop;
   }
 
+  for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+    {
+      if (loc->address == bp_addr)
+	{
+	  bs = bpstat_alloc (loc, bs);
+	  /* For hits of moribund locations, we should just proceed.  */
+	  bs->stop = 0;
+	  bs->print = 0;
+	  bs->print_it = print_it_noop;
+	}
+    }
+
   bs->next = NULL;		/* Terminate the chain */
   bs = root_bs->next;		/* Re-grab the head of the chain */
 
@@ -3098,6 +3106,7 @@
   if (bs == NULL)
     for (bs = root_bs->next; bs != NULL; bs = bs->next)
       if (!bs->stop
+	  && bs->breakpoint_at->owner
 	  && (bs->breakpoint_at->owner->type == bp_hardware_watchpoint
 	      || bs->breakpoint_at->owner->type == bp_read_watchpoint
 	      || bs->breakpoint_at->owner->type == bp_access_watchpoint))
@@ -3262,6 +3271,9 @@
 	/* I suspect this can happen if it was a momentary breakpoint
 	   which has since been deleted.  */
 	continue;
+      if (bs->breakpoint_at->owner == NULL)
+	bs_class = bp_nostop;
+      else
       switch (bs->breakpoint_at->owner->type)
 	{
 	case bp_none:
@@ -3658,10 +3670,11 @@
 	if (addressprint)
 	  ui_out_field_skip (uiout, "addr");
 	annotate_field (5);
-	if (b->forked_inferior_pid != 0)
+	if (!ptid_equal (b->forked_inferior_pid, null_ptid))
 	  {
 	    ui_out_text (uiout, "process ");
-	    ui_out_field_int (uiout, "what", b->forked_inferior_pid);
+	    ui_out_field_int (uiout, "what",
+			      ptid_get_pid (b->forked_inferior_pid));
 	    ui_out_spaces (uiout, 1);
 	  }
 	break;
@@ -4330,7 +4343,7 @@
   b->frame_id = null_frame_id;
   b->dll_pathname = NULL;
   b->triggered_dll_pathname = NULL;
-  b->forked_inferior_pid = 0;
+  b->forked_inferior_pid = null_ptid;
   b->exec_pathname = NULL;
   b->ops = NULL;
   b->condition_not_parsed = 0;
@@ -4460,7 +4473,7 @@
   if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL)
     return;
   set_momentary_breakpoint_at_pc (SYMBOL_VALUE_ADDRESS (m), bp_longjmp);
-  update_global_location_list ();
+  update_global_location_list (1);
 }
 
 /* Call this routine when stepping and nexting to enable a breakpoint
@@ -4518,7 +4531,7 @@
       b->enable_state = bp_disabled;
       overlay_events_enabled = 0;
     }
-  update_global_location_list ();
+  update_global_location_list (1);
 }
 
 void
@@ -4530,7 +4543,7 @@
     if (b->type == bp_overlay_event)
     {
       b->enable_state = bp_enabled;
-      update_global_location_list ();
+      update_global_location_list (1);
       overlay_events_enabled = 1;
     }
 }
@@ -4544,7 +4557,7 @@
     if (b->type == bp_overlay_event)
     {
       b->enable_state = bp_disabled;
-      update_global_location_list ();
+      update_global_location_list (0);
       overlay_events_enabled = 0;
     }
 }
@@ -4560,7 +4573,7 @@
   /* addr_string has to be used or breakpoint_re_set will delete me.  */
   b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
 
-  update_global_location_list_nothrow ();
+  update_global_location_list_nothrow (1);
 
   return b;
 }
@@ -4606,7 +4619,7 @@
   struct breakpoint *b;
 
   b = create_internal_breakpoint (address, bp_shlib_event);
-  update_global_location_list_nothrow ();
+  update_global_location_list_nothrow (1);
   return b;
 }
 
@@ -4703,8 +4716,8 @@
   b->addr_string = NULL;
   b->enable_state = bp_enabled;
   b->disposition = tempflag ? disp_del : disp_donttouch;
-  b->forked_inferior_pid = 0;
-  update_global_location_list ();
+  b->forked_inferior_pid = null_ptid;
+  update_global_location_list (1);
 
 
   mention (b);
@@ -4743,7 +4756,7 @@
   b->addr_string = NULL;
   b->enable_state = bp_enabled;
   b->disposition = tempflag ? disp_del : disp_donttouch;
-  update_global_location_list ();
+  update_global_location_list (1);
 
   mention (b);
 }
@@ -4799,7 +4812,7 @@
 	&& breakpoint_enabled (b))
       {
 	b->enable_state = bp_call_disabled;
-	update_global_location_list ();
+	update_global_location_list (0);
       }
   }
 }
@@ -4818,7 +4831,7 @@
 	&& (b->enable_state == bp_call_disabled))
       {
 	b->enable_state = bp_enabled;
-	update_global_location_list ();
+	update_global_location_list (1);
       }
   }
 }
@@ -4844,7 +4857,7 @@
   if (in_thread_list (inferior_ptid))
     b->thread = pid_to_thread_id (inferior_ptid);
 
-  update_global_location_list_nothrow ();
+  update_global_location_list_nothrow (1);
 
   return b;
 }
@@ -5266,7 +5279,7 @@
 			 thread, ignore_count, ops, from_tty);
     }
 
-  update_global_location_list ();
+  update_global_location_list (1);
 }
 
 /* Parse ARG which is assumed to be a SAL specification possibly
@@ -5587,7 +5600,7 @@
       b->condition_not_parsed = 1;
       b->ops = ops;
 
-      update_global_location_list ();
+      update_global_location_list (1);
       mention (b);
     }
   
@@ -5688,7 +5701,7 @@
       bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
       if (bv != NULL)
 	{
-	  sym = block_function (b);
+	  sym = block_linkage_function (b);
 	  if (sym != NULL)
 	    {
 	      fixup_symbol_section (sym, sal->symtab->objfile);
@@ -6016,7 +6029,7 @@
 
   value_free_to_mark (mark);
   mention (b);
-  update_global_location_list ();
+  update_global_location_list (1);
 }
 
 /* Return count of locations need to be watched and can be handled
@@ -6136,16 +6149,24 @@
 /* Helper routines for the until_command routine in infcmd.c.  Here
    because it uses the mechanisms of breakpoints.  */
 
+struct until_break_command_continuation_args
+{
+  struct breakpoint *breakpoint;
+  struct breakpoint *breakpoint2;
+};
+
 /* This function is called by fetch_inferior_event via the
    cmd_continuation pointer, to complete the until command. It takes
    care of cleaning up the temporary breakpoints set up by the until
    command. */
 static void
-until_break_command_continuation (struct continuation_arg *arg, int error)
+until_break_command_continuation (void *arg)
 {
-  delete_breakpoint ((struct breakpoint *)(arg->data.pointer));
-  if (arg->next)
-    delete_breakpoint ((struct breakpoint *)(arg->next->data.pointer));
+  struct until_break_command_continuation_args *a = arg;
+
+  delete_breakpoint (a->breakpoint);
+  if (a->breakpoint2)
+    delete_breakpoint (a->breakpoint2);
 }
 
 void
@@ -6158,9 +6179,6 @@
   struct breakpoint *breakpoint;
   struct breakpoint *breakpoint2 = NULL;
   struct cleanup *old_chain;
-  struct continuation_arg *arg1;
-  struct continuation_arg *arg2;
-
 
   clear_proceed_status ();
 
@@ -6215,24 +6233,17 @@
      deleted when the target stops.  Otherwise, we're already stopped and
      delete breakpoints via cleanup chain.  */
 
-  if (target_can_async_p () && target_executing)
+  if (target_can_async_p () && is_running (inferior_ptid))
     {
-      arg1 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg1->next         = NULL;
-      arg1->data.pointer = breakpoint;
+      struct until_break_command_continuation_args *args;
+      args = xmalloc (sizeof (*args));
 
-      if (breakpoint2)
-	{
-	  arg2 = (struct continuation_arg *)
-	    xmalloc ( sizeof (struct continuation_arg));
-	  arg2->next         = NULL;
-	  arg2->data.pointer = breakpoint2;
-	  arg1->next = arg2;	   
-	}
+      args->breakpoint = breakpoint;
+      args->breakpoint2 = breakpoint2;
 
       discard_cleanups (old_chain);
-      add_continuation (until_break_command_continuation, arg1);
+      add_continuation (until_break_command_continuation, args,
+			xfree);
     }
   else
     do_cleanups (old_chain);
@@ -6654,7 +6665,7 @@
   b->ops = ops;
 
   mention (b);
-  update_global_location_list ();
+  update_global_location_list (1);
 }
 
 /* Implement the "catch exception" command.  */
@@ -6965,7 +6976,9 @@
   struct breakpoint *b, *temp;
 
   for (; bs; bs = bs->next)
-    if (bs->breakpoint_at && bs->breakpoint_at->owner->disposition == disp_del
+    if (bs->breakpoint_at 
+	&& bs->breakpoint_at->owner
+	&& bs->breakpoint_at->owner->disposition == disp_del
 	&& bs->stop)
       delete_breakpoint (bs->breakpoint_at->owner);
 
@@ -6976,8 +6989,23 @@
   }
 }
 
+/* If SHOULD_INSERT is true, do not insert any breakpoint locations
+   into the inferior, only remove already-inserted locations that no
+   longer should be inserted.  Functions that delete a breakpoint or
+   breakpoints should pass false, so that deleting a breakpoint
+   doesn't have the side effect of inserting the locations of other
+   breakpoints that are marked not-inserted, but should_be_inserted
+   returns true on them.
+
+   This behaviour is useful is situations close to tear-down -- e.g.,
+   after an exec, while the target still has execution, but breakpoint
+   shadows of the previous executable image should *NOT* be restored
+   to the new image; or before detaching, where the target still has
+   execution and wants to delete breakpoints from GDB's lists, and all
+   breakpoints had already been removed from the inferior.  */
+
 static void
-update_global_location_list (void)
+update_global_location_list (int should_insert)
 {
   struct breakpoint *b;
   struct bp_location **next = &bp_location_chain;
@@ -7013,6 +7041,9 @@
       /* Tells if 'loc' is found amoung the new locations.  If not, we
 	 have to free it.  */
       int found_object = 0;
+      /* Tells if the location should remain inserted in the target.  */
+      int keep_in_target = 0;
+      int removed = 0;
       for (loc2 = bp_location_chain; loc2; loc2 = loc2->global_next)
 	if (loc2 == loc)
 	  {
@@ -7029,13 +7060,12 @@
       if (loc->inserted)
 	{
 	  /* If the location is inserted now, we might have to remove it.  */
-	  int keep = 0;
 
 	  if (found_object && should_be_inserted (loc))
 	    {
 	      /* The location is still present in the location list, and still
 		 should be inserted.  Don't do anything.  */
-	      keep = 1;
+	      keep_in_target = 1;
 	    }
 	  else
 	    {
@@ -7053,30 +7083,53 @@
 		      {		  
 			loc2->inserted = 1;
 			loc2->target_info = loc->target_info;
-			keep = 1;
+			keep_in_target = 1;
 			break;
 		      }
 		  }
 	    }
 
-	  if (!keep)
-	    if (remove_breakpoint (loc, mark_uninserted))
-	      {
-		/* This is just about all we can do.  We could keep this
-		   location on the global list, and try to remove it next
-		   time, but there's no particular reason why we will
-		   succeed next time.  
-
-		   Note that at this point, loc->owner is still valid,
-		   as delete_breakpoint frees the breakpoint only
-		   after calling us.  */
-		printf_filtered (_("warning: Error removing breakpoint %d\n"), 
-				 loc->owner->number);
-	      }
+	  if (!keep_in_target)
+	    {
+	      if (remove_breakpoint (loc, mark_uninserted))
+		{
+		  /* This is just about all we can do.  We could keep this
+		     location on the global list, and try to remove it next
+		     time, but there's no particular reason why we will
+		     succeed next time.  
+		     
+		     Note that at this point, loc->owner is still valid,
+		     as delete_breakpoint frees the breakpoint only
+		     after calling us.  */
+		  printf_filtered (_("warning: Error removing breakpoint %d\n"), 
+				   loc->owner->number);
+		}
+	      removed = 1;
+	    }
 	}
 
       if (!found_object)
-	free_bp_location (loc);
+	{	      
+	  if (removed)
+	    {
+	      /* This location was removed from the targets.  In non-stop mode,
+		 a race condition is possible where we've removed a breakpoint,
+		 but stop events for that breakpoint are already queued and will
+		 arrive later.  To suppress spurious SIGTRAPs reported to user,
+		 we keep this breakpoint location for a bit, and will retire it
+		 after we see 3 * thread_count events.
+		 The theory here is that reporting of events should, 
+		 "on the average", be fair, so after that many event we'll see
+		 events from all threads that have anything of interest, and no
+		 longer need to keep this breakpoint.  This is just a 
+		 heuristic, but if it's wrong, we'll report unexpected SIGTRAP,
+		 which is usability issue, but not a correctness problem.  */	  
+	      loc->events_till_retirement = 3 * (thread_count () + 1);
+	      loc->owner = NULL;
+	    }
+
+	  free_bp_location (loc);
+	}
     }
     
   ALL_BREAKPOINTS (b)
@@ -7084,16 +7137,54 @@
       check_duplicates (b);
     }
 
-  if (always_inserted_mode && target_has_execution)
+  if (always_inserted_mode && should_insert && target_has_execution)
     insert_breakpoint_locations ();
 }
 
+void
+breakpoint_retire_moribund (void)
+{
+  struct bp_location *loc;
+  int ix;
+
+  for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+    if (--(loc->events_till_retirement) == 0)
+      {
+	free_bp_location (loc);
+	VEC_unordered_remove (bp_location_p, moribund_locations, ix);
+	--ix;
+      }
+}
+
 static void
-update_global_location_list_nothrow (void)
+update_global_location_list_nothrow (int inserting)
 {
   struct gdb_exception e;
   TRY_CATCH (e, RETURN_MASK_ERROR)
-    update_global_location_list ();
+    update_global_location_list (inserting);
+}
+
+/* Clear BPT from a BPS.  */
+static void
+bpstat_remove_breakpoint (bpstat bps, struct breakpoint *bpt)
+{
+  bpstat bs;
+  for (bs = bps; bs; bs = bs->next)
+    if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt)
+      {
+	bs->breakpoint_at = NULL;
+	bs->old_val = NULL;
+	/* bs->commands will be freed later.  */
+      }
+}
+
+/* Callback for iterate_over_threads.  */
+static int
+bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
+{
+  struct breakpoint *bpt = data;
+  bpstat_remove_breakpoint (th->stop_bpstat, bpt);
+  return 0;
 }
 
 /* Delete a breakpoint and clean up all traces of it in the data
@@ -7103,7 +7194,6 @@
 delete_breakpoint (struct breakpoint *bpt)
 {
   struct breakpoint *b;
-  bpstat bs;
   struct bp_location *loc, *next;
 
   gdb_assert (bpt != NULL);
@@ -7167,13 +7257,11 @@
          bpstat_do_actions (&stop_bpstat);
      in event-top.c won't do anything, and temporary breakpoints
      with commands won't work.  */
-  for (bs = stop_bpstat; bs; bs = bs->next)
-    if (bs->breakpoint_at && bs->breakpoint_at->owner == bpt)
-      {
-	bs->breakpoint_at = NULL;
-	bs->old_val = NULL;
-	/* bs->commands will be freed later.  */
-      }
+
+  /* Clear the current context.  */
+  bpstat_remove_breakpoint (stop_bpstat, bpt);
+  /* And from all threads.  */
+  iterate_over_threads (bpstat_remove_breakpoint_callback, bpt);
 
   /* Now that breakpoint is removed from breakpoint
      list, update the global location list.  This
@@ -7183,7 +7271,7 @@
      looks at location's owner.  It might be better
      design to have location completely self-contained,
      but it's not the case now.  */
-  update_global_location_list ();
+  update_global_location_list (0);
 
 
   /* On the chance that someone will soon try again to delete this same
@@ -7393,7 +7481,7 @@
       }
   }
 
-  update_global_location_list ();
+  update_global_location_list (1);
 }
 
 
@@ -7779,7 +7867,7 @@
 
   bpt->enable_state = bp_disabled;
 
-  update_global_location_list ();
+  update_global_location_list (0);
 
   if (deprecated_modify_breakpoint_hook)
     deprecated_modify_breakpoint_hook (bpt);
@@ -7818,7 +7906,7 @@
       struct bp_location *loc = find_location_by_number (args);
       if (loc)
 	loc->enabled = 0;
-      update_global_location_list ();
+      update_global_location_list (0);
     }
   else
     map_breakpoint_numbers (args, disable_breakpoint);
@@ -7903,7 +7991,7 @@
   if (bpt->enable_state != bp_permanent)
     bpt->enable_state = bp_enabled;
   bpt->disposition = disposition;
-  update_global_location_list ();
+  update_global_location_list (1);
   breakpoints_changed ();
   
   if (deprecated_modify_breakpoint_hook)
@@ -7954,7 +8042,7 @@
       struct bp_location *loc = find_location_by_number (args);
       if (loc)
 	loc->enabled = 1;
-      update_global_location_list ();
+      update_global_location_list (1);
     }
   else
     map_breakpoint_numbers (args, enable_breakpoint);
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 80544e4..3223857 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -298,6 +298,17 @@
 
   /* Similarly, for the breakpoint at an overlay's LMA, if necessary.  */
   struct bp_target_info overlay_target_info;
+
+  /* In a non-stop mode, it's possible that we delete a breakpoint,
+     but as we do that, some still running thread hits that breakpoint.
+     For that reason, we need to keep locations belonging to deleted
+     breakpoints for a bit, so that don't report unexpected SIGTRAP.
+     We can't keep such locations forever, so we use a heuristic --
+     after we process certain number of inferior events since
+     breakpoint was deleted, we retire all locations of that breakpoint.
+     This variable keeps a number of events still to go, when
+     it becomes 0 this location is retired.  */
+  int events_till_retirement;
 };
 
 /* This structure is a collection of function pointers that, if available,
@@ -439,7 +450,7 @@
     /* Process id of a child process whose forking triggered this
        catchpoint.  This field is only valid immediately after this
        catchpoint has triggered.  */
-    int forked_inferior_pid;
+    ptid_t forked_inferior_pid;
 
     /* Filename of a program whose exec triggered this catchpoint.
        This field is only valid immediately after this catchpoint has
@@ -815,6 +826,9 @@
 
 extern void enable_breakpoint (struct breakpoint *);
 
+/* Clear the "inserted" flag in all breakpoints.  */
+extern void mark_breakpoints_out (void);
+
 extern void make_breakpoint_permanent (struct breakpoint *);
 
 extern struct breakpoint *create_solib_event_breakpoint (CORE_ADDR);
@@ -865,4 +879,9 @@
 
 extern int breakpoints_always_inserted_mode (void);
 
+/* Called each time new event from target is processed.
+   Retires previously deleted breakpoint locations that
+   in our opinion won't ever trigger.  */
+extern void breakpoint_retire_moribund (void);
+
 #endif /* !defined (BREAKPOINT_H) */
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 0f2ee16..bd04dc2 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1118,45 +1118,46 @@
   if (parsed_float)
     {
       /* It's a float since it contains a point or an exponent.  */
-      char *s = malloc (len);
-      int num = 0;	/* number of tokens scanned by scanf */
-      char saved_char = p[len];
-
-      p[len] = 0;	/* null-terminate the token */
+      char *s;
+      int num;	/* number of tokens scanned by scanf */
+      char saved_char;
 
       /* If it ends at "df", "dd" or "dl", take it as type of decimal floating
          point.  Return DECFLOAT.  */
 
-      if (p[len - 2] == 'd' && p[len - 1] == 'f')
+      if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'f')
 	{
 	  p[len - 2] = '\0';
 	  putithere->typed_val_decfloat.type
 	    = builtin_type (current_gdbarch)->builtin_decfloat;
 	  decimal_from_string (putithere->typed_val_decfloat.val, 4, p);
-	  p[len] = saved_char;
-	  return (DECFLOAT);
+	  p[len - 2] = 'd';
+	  return DECFLOAT;
 	}
 
-      if (p[len - 2] == 'd' && p[len - 1] == 'd')
+      if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'd')
 	{
 	  p[len - 2] = '\0';
 	  putithere->typed_val_decfloat.type
 	    = builtin_type (current_gdbarch)->builtin_decdouble;
 	  decimal_from_string (putithere->typed_val_decfloat.val, 8, p);
-	  p[len] = saved_char;
-	  return (DECFLOAT);
+	  p[len - 2] = 'd';
+	  return DECFLOAT;
 	}
 
-      if (p[len - 2] == 'd' && p[len - 1] == 'l')
+      if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'l')
 	{
 	  p[len - 2] = '\0';
 	  putithere->typed_val_decfloat.type
 	    = builtin_type (current_gdbarch)->builtin_declong;
 	  decimal_from_string (putithere->typed_val_decfloat.val, 16, p);
-	  p[len] = saved_char;
-	  return (DECFLOAT);
+	  p[len - 2] = 'd';
+	  return DECFLOAT;
 	}
 
+      s = malloc (len);
+      saved_char = p[len];
+      p[len] = 0;	/* null-terminate the token */
       num = sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%s",
 		    &putithere->typed_val_float.dval, s);
       p[len] = saved_char;	/* restore the input stream */
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index b0f5fa0..efd3137 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1245,6 +1245,8 @@
   c = add_com ("pwd", class_files, pwd_command, _("\
 Print working directory.  This is used for your program as well."));
   set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
+
   c = add_cmd ("cd", class_files, cd_command, _("\
 Set working directory to DIR for debugger and program being debugged.\n\
 The change does not take effect for the program being debugged\n\
@@ -1285,6 +1287,7 @@
 	       _("Print list of commands."));
   set_cmd_completer (c, command_completer);
   set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
   add_com_alias ("q", "quit", class_support, 1);
   add_com_alias ("h", "help", class_support, 1);
 
@@ -1314,6 +1317,7 @@
 Generic command for showing things about the program being debugged."),
 		      &infolist, "info ", 0, &cmdlist);
   set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
   add_com_alias ("i", "info", class_info, 1);
 
   add_com ("complete", class_obscure, complete_command,
@@ -1323,6 +1327,7 @@
 Generic command for showing things about the debugger."),
 		      &showlist, "show ", 0, &cmdlist);
   set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
   /* Another way to get at the same thing.  */
   add_info ("set", show_command, _("Show all GDB settings."));
 
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 965b193..07bb587 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -117,6 +117,18 @@
   return cmd->flags & CMD_ASYNC_OK;
 }
 
+void
+set_cmd_no_selected_thread_ok (struct cmd_list_element *cmd)
+{
+  cmd->flags |= CMD_NO_SELECTED_THREAD_OK;
+}
+
+int
+get_cmd_no_selected_thread_ok (struct cmd_list_element *cmd)
+{
+  return cmd->flags & CMD_NO_SELECTED_THREAD_OK;
+}
+
 enum cmd_types
 cmd_type (struct cmd_list_element *cmd)
 {
@@ -539,11 +551,16 @@
 				   struct cmd_list_element **set_list,
 				   struct cmd_list_element **show_list)
 {
+  struct cmd_list_element *set_result;
+ 
   add_setshow_cmd_full (name, class, var_optional_filename, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
 			set_list, show_list,
-			NULL, NULL);
+			&set_result, NULL);
+		
+  set_cmd_completer (set_result, filename_completer);
+
 }
 
 /* Add element named NAME to both the set and show command LISTs (the
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index f133b3d..c790398 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -51,6 +51,10 @@
 /* This flag is set if the command is allowed during async execution.  */
 #define CMD_ASYNC_OK              0x8
 
+/* This flag is set if the command is allowed to run when the target
+   has execution, but there's no selected thread.  */
+#define CMD_NO_SELECTED_THREAD_OK 0x10
+
 struct cmd_list_element
   {
     /* Points to next command in this list.  */
@@ -253,6 +257,13 @@
 /* Return true if command is async-ok.  */
 extern int get_cmd_async_ok (struct cmd_list_element *);
 
+/* Mark command as ok to call when there is no selected thread.  There
+   is no way to disable this once set.  */
+extern void set_cmd_no_selected_thread_ok (struct cmd_list_element *);
+
+/* Return true if command is no-selected-thread-ok.  */
+extern int get_cmd_no_selected_thread_ok (struct cmd_list_element *);
+
 extern struct cmd_list_element *lookup_cmd (char **,
 					    struct cmd_list_element *, char *,
 					    int, int);
diff --git a/gdb/completer.c b/gdb/completer.c
index 62f0b69..e7ee817 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -429,14 +429,6 @@
   return location_completer (p, word);
 }
 
-/* Complete on command names.  Used by "help".  */
-char **
-command_completer (char *text, char *word)
-{
-  return complete_on_cmdlist (cmdlist, text, word);
-}
-
-
 /* Here are some useful test cases for completion.  FIXME: These should
    be put in the test suite.  They should be tested with both M-? and TAB.
 
@@ -467,10 +459,16 @@
 
    LINE_BUFFER is available to be looked at; it contains the entire text
    of the line.  POINT is the offset in that line of the cursor.  You
-   should pretend that the line ends at POINT.  */
+   should pretend that the line ends at POINT.
+   
+   FOR_HELP is true when completing a 'help' command.  In this case,
+   once sub-command completions are exhausted, we simply return NULL.
+   When FOR_HELP is false, we will call a sub-command's completion
+   function.  */
 
-char **
-complete_line (const char *text, char *line_buffer, int point)
+static char **
+complete_line_internal (const char *text, char *line_buffer, int point,
+			int for_help)
 {
   char **list = NULL;
   char *tmp_command, *p;
@@ -583,6 +581,8 @@
 		  rl_completer_word_break_characters =
 		    gdb_completer_command_word_break_characters;
 		}
+	      else if (for_help)
+		list = NULL;
 	      else if (c->enums)
 		{
 		  list = complete_on_enum (c->enums, p, word);
@@ -650,6 +650,8 @@
 		gdb_completer_command_word_break_characters;
 	    }
 	}
+      else if (for_help)
+	list = NULL;
       else
 	{
 	  /* There is non-whitespace beyond the command.  */
@@ -695,6 +697,21 @@
   return list;
 }
 
+/* Like complete_line_internal, but always passes 0 for FOR_HELP.  */
+
+char **
+complete_line (const char *text, char *line_buffer, int point)
+{
+  return complete_line_internal (text, line_buffer, point, 0);
+}
+
+/* Complete on command names.  Used by "help".  */
+char **
+command_completer (char *text, char *word)
+{
+  return complete_line_internal (word, text, strlen (text), 1);
+}
+
 /* Generate completions one by one for the completer.  Each time we are
    called return another potential completion to the caller.
    line_completion just completes on commands or passes the buck to the
diff --git a/gdb/config.in b/gdb/config.in
index 2a60c29..9b8ca72 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -82,6 +82,10 @@
 /* Define to 1 if you have the <curses.h> header file. */
 #undef HAVE_CURSES_H
 
+/* Define to 1 if you have the declaration of `ADDR_NO_RANDOMIZE', and to 0 if
+   you don't. */
+#undef HAVE_DECL_ADDR_NO_RANDOMIZE
+
 /* Define to 1 if you have the declaration of `free', and to 0 if you don't.
    */
 #undef HAVE_DECL_FREE
@@ -237,6 +241,9 @@
 /* Define to 1 if you have the <nlist.h> header file. */
 #undef HAVE_NLIST_H
 
+/* Define if you support the personality syscall. */
+#undef HAVE_PERSONALITY
+
 /* Define to 1 if you have the `poll' function. */
 #undef HAVE_POLL
 
@@ -494,9 +501,6 @@
 /* Define to 1 if you have the `ttrace' function. */
 #undef HAVE_TTRACE
 
-/* Define to 1 if the system has the type `uintptr_t'. */
-#undef HAVE_UINTPTR_T
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
@@ -609,21 +613,9 @@
    'sig_atomic_t'. */
 #undef SIG_ATOMIC_T_SUFFIX
 
-/* The size of a `char', as computed by sizeof. */
-#undef SIZEOF_CHAR
-
-/* The size of a `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
 /* The size of a `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
-/* The size of a `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of a `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
    'size_t'. */
 #undef SIZE_T_SUFFIX
diff --git a/gdb/config/i386/nm-cygwin.h b/gdb/config/i386/nm-cygwin.h
index 5222b60..b273439 100644
--- a/gdb/config/i386/nm-cygwin.h
+++ b/gdb/config/i386/nm-cygwin.h
@@ -16,7 +16,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define ATTACH_NO_WAIT
 #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
 void dll_symbol_command (char *, int);
 
diff --git a/gdb/config/i386/nm-i386gnu.h b/gdb/config/i386/nm-i386gnu.h
index 2be95b4..ee1fe73f 100644
--- a/gdb/config/i386/nm-i386gnu.h
+++ b/gdb/config/i386/nm-i386gnu.h
@@ -26,9 +26,6 @@
 
 extern char *gnu_target_pid_to_str (int pid);
 
-/* Don't do wait_for_inferior on attach.  */
-#define ATTACH_NO_WAIT
-
 /* Thread flavors used in re-setting the T bit.  */
 #define THREAD_STATE_FLAVOR		i386_REGS_SEGS_STATE
 #define THREAD_STATE_SIZE		i386_THREAD_STATE_COUNT
diff --git a/gdb/configure b/gdb/configure
index 5ac1a1c..e555e25 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -314,8 +314,9 @@
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_CC TCL_DEFS TCL_SHLIB_CFLAGS TCL_SHLIB_LD TCL_SHLIB_LD_LIBS TCL_SHLIB_SUFFIX TCL_DL_LIBS TCL_LD_FLAGS TCL_LD_SEARCH_FLAGS TCL_CC_SEARCH_FLAGS TCL_COMPAT_OBJS TCL_RANLIB TCL_BUILD_LIB_SPEC TCL_LIB_SPEC TCL_LIB_VERSIONS_OK TK_VERSION TK_DEFS TK_BUILD_INCLUDES TK_XINCLUDES TK_XLIBSW TK_BUILD_LIB_SPEC TK_LIB_SPEC TCLHDIR TKHDIR ITCLHDIR ITKHDIR ITCL_VERSION ITCL_DEFS ITCL_BUILD_INCLUDES ITCL_BUILD_LIB_SPEC ITCL_LIB_SPEC ITK_VERSION ITK_DEFS ITK_BUILD_INCLUDES ITK_BUILD_LIB_SPEC ITK_LIB_SPEC X_CFLAGS X_LDFLAGS X_LIBS TCL_DEPS TK_DEPS ITCLLIB ITCL_DEPS ITKLIB ITK_DEPS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_CC TCL_DEFS TCL_SHLIB_CFLAGS TCL_SHLIB_LD TCL_SHLIB_LD_LIBS TCL_SHLIB_SUFFIX TCL_DL_LIBS TCL_LD_FLAGS TCL_LD_SEARCH_FLAGS TCL_CC_SEARCH_FLAGS TCL_COMPAT_OBJS TCL_RANLIB TCL_BUILD_LIB_SPEC TCL_LIB_SPEC TCL_LIB_VERSIONS_OK TK_VERSION TK_DEFS TK_BUILD_INCLUDES TK_XINCLUDES TK_XLIBSW TK_BUILD_LIB_SPEC TK_LIB_SPEC TCLHDIR TKHDIR ITCLHDIR ITKHDIR ITCL_VERSION ITCL_DEFS ITCL_BUILD_INCLUDES ITCL_BUILD_LIB_SPEC ITCL_LIB_SPEC ITK_VERSION ITK_DEFS ITK_BUILD_INCLUDES ITK_BUILD_LIB_SPEC ITK_LIB_SPEC X_CFLAGS X_LDFLAGS X_LIBS TCL_DEPS TK_DEPS ITCLLIB ITCL_DEPS ITKLIB ITK_DEPS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
+ac_pwd=`pwd`
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1327,6 +1328,8 @@
   fi
 done
 if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
   { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -1361,6 +1364,9 @@
 
 
 
+
+
+
           ac_config_headers="$ac_config_headers config.h:config.in"
 
 echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
@@ -1697,11 +1703,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -1787,11 +1795,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
 See \`config.log' for more details." >&5
 echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
@@ -1816,13 +1826,15 @@
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+	{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
@@ -1860,11 +1872,13 @@
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
@@ -1911,11 +1925,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -2546,11 +2562,13 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=c
@@ -5874,11 +5892,13 @@
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6302,6 +6322,13 @@
 
 
 
+# For Makefile dependencies.
+GNULIB_STDINT_H=
+if test x"$STDINT_H" != x; then
+  GNULIB_STDINT_H=gnulib/$STDINT_H
+fi
+
+
 PACKAGE=gdb
 
 cat >>confdefs.h <<_ACEOF
@@ -7349,19 +7376,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_long=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -7419,11 +7450,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -7540,7 +7573,7 @@
 if test "${enable_tui+set}" = set; then
   enableval="$enable_tui"
   case $enableval in
-    yes | no)
+    yes | no | auto)
       ;;
     *)
       { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-tui" >&5
@@ -7548,7 +7581,7 @@
    { (exit 1); exit 1; }; } ;;
   esac
 else
-  enable_tui=yes
+  enable_tui=auto
 fi;
 
 # Enable gdbtk.
@@ -12847,156 +12880,6 @@
 done
 
 
-for ac_header in stdint.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists.  ##
-## ------------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
 
 
 for ac_header in string.h memory.h strings.h
@@ -16219,2855 +16102,6 @@
 done
 
 
-# Create a header we can use portably to get the standard integer types.
-
-
-inttype_headers=`echo inttypes.h sys/inttypes.h  | sed -e 's/,/ /g'`
-
-acx_cv_header_stdint=stddef.h
-acx_cv_header_stdint_kind="(already complete)"
-for i in stdint.h $inttype_headers; do
-  unset ac_cv_type_uintptr_t
-  unset ac_cv_type_uintmax_t
-  unset ac_cv_type_int_least32_t
-  unset ac_cv_type_int_fast32_t
-  unset ac_cv_type_uint64_t
-  echo $ECHO_N "looking for a compliant stdint.h in $i, $ECHO_C" >&6
-  echo "$as_me:$LINENO: checking for uintmax_t" >&5
-echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintmax_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((uintmax_t *) 0)
-  return 0;
-if (sizeof (uintmax_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uintmax_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uintmax_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6
-if test $ac_cv_type_uintmax_t = yes; then
-  acx_cv_header_stdint=$i
-else
-  continue
-fi
-
-  echo "$as_me:$LINENO: checking for uintptr_t" >&5
-echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintptr_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((uintptr_t *) 0)
-  return 0;
-if (sizeof (uintptr_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uintptr_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uintptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
-if test $ac_cv_type_uintptr_t = yes; then
-  :
-else
-  acx_cv_header_stdint_kind="(mostly complete)"
-fi
-
-  echo "$as_me:$LINENO: checking for int_least32_t" >&5
-echo $ECHO_N "checking for int_least32_t... $ECHO_C" >&6
-if test "${ac_cv_type_int_least32_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((int_least32_t *) 0)
-  return 0;
-if (sizeof (int_least32_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_int_least32_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_int_least32_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_int_least32_t" >&5
-echo "${ECHO_T}$ac_cv_type_int_least32_t" >&6
-if test $ac_cv_type_int_least32_t = yes; then
-  :
-else
-  acx_cv_header_stdint_kind="(mostly complete)"
-fi
-
-  echo "$as_me:$LINENO: checking for int_fast32_t" >&5
-echo $ECHO_N "checking for int_fast32_t... $ECHO_C" >&6
-if test "${ac_cv_type_int_fast32_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((int_fast32_t *) 0)
-  return 0;
-if (sizeof (int_fast32_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_int_fast32_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_int_fast32_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_int_fast32_t" >&5
-echo "${ECHO_T}$ac_cv_type_int_fast32_t" >&6
-if test $ac_cv_type_int_fast32_t = yes; then
-  :
-else
-  acx_cv_header_stdint_kind="(mostly complete)"
-fi
-
-  echo "$as_me:$LINENO: checking for uint64_t" >&5
-echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
-if test "${ac_cv_type_uint64_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((uint64_t *) 0)
-  return 0;
-if (sizeof (uint64_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uint64_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uint64_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
-echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
-if test $ac_cv_type_uint64_t = yes; then
-  :
-else
-  acx_cv_header_stdint_kind="(lacks uint64_t)"
-fi
-
-  break
-done
-if test "$acx_cv_header_stdint" = stddef.h; then
-  acx_cv_header_stdint_kind="(lacks uintmax_t)"
-  for i in stdint.h $inttype_headers; do
-    unset ac_cv_type_uintptr_t
-    unset ac_cv_type_uint32_t
-    unset ac_cv_type_uint64_t
-    echo $ECHO_N "looking for an incomplete stdint.h in $i, $ECHO_C" >&6
-    echo "$as_me:$LINENO: checking for uint32_t" >&5
-echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6
-if test "${ac_cv_type_uint32_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((uint32_t *) 0)
-  return 0;
-if (sizeof (uint32_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uint32_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uint32_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
-echo "${ECHO_T}$ac_cv_type_uint32_t" >&6
-if test $ac_cv_type_uint32_t = yes; then
-  acx_cv_header_stdint=$i
-else
-  continue
-fi
-
-    echo "$as_me:$LINENO: checking for uint64_t" >&5
-echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
-if test "${ac_cv_type_uint64_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((uint64_t *) 0)
-  return 0;
-if (sizeof (uint64_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uint64_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uint64_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
-echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
-
-    echo "$as_me:$LINENO: checking for uintptr_t" >&5
-echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintptr_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((uintptr_t *) 0)
-  return 0;
-if (sizeof (uintptr_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uintptr_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uintptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
-
-    break
-  done
-fi
-if test "$acx_cv_header_stdint" = stddef.h; then
-  acx_cv_header_stdint_kind="(u_intXX_t style)"
-  for i in sys/types.h $inttype_headers; do
-    unset ac_cv_type_u_int32_t
-    unset ac_cv_type_u_int64_t
-    echo $ECHO_N "looking for u_intXX_t types in $i, $ECHO_C" >&6
-    echo "$as_me:$LINENO: checking for u_int32_t" >&5
-echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6
-if test "${ac_cv_type_u_int32_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((u_int32_t *) 0)
-  return 0;
-if (sizeof (u_int32_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_u_int32_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_u_int32_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5
-echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6
-if test $ac_cv_type_u_int32_t = yes; then
-  acx_cv_header_stdint=$i
-else
-  continue
-fi
-
-    echo "$as_me:$LINENO: checking for u_int64_t" >&5
-echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6
-if test "${ac_cv_type_u_int64_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$i>
-
-int
-main ()
-{
-if ((u_int64_t *) 0)
-  return 0;
-if (sizeof (u_int64_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_u_int64_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_u_int64_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5
-echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6
-
-    break
-  done
-fi
-if test "$acx_cv_header_stdint" = stddef.h; then
-  acx_cv_header_stdint_kind="(using manual detection)"
-fi
-
-test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no
-test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no
-test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no
-test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no
-test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no
-
-# ----------------- Summarize what we found so far
-
-echo "$as_me:$LINENO: checking what to include in gdb_stdint.h" >&5
-echo $ECHO_N "checking what to include in gdb_stdint.h... $ECHO_C" >&6
-
-case `$as_basename gdb_stdint.h ||
-$as_expr X/gdb_stdint.h : '.*/\([^/][^/]*\)/*$' \| \
-	 Xgdb_stdint.h : 'X\(//\)$' \| \
-	 Xgdb_stdint.h : 'X\(/\)$' \| \
-	 .     : '\(.\)' 2>/dev/null ||
-echo X/gdb_stdint.h |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\/\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'` in
-  stdint.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5
-echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
-  inttypes.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5
-echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
-  *) ;;
-esac
-
-echo "$as_me:$LINENO: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5
-echo "${ECHO_T}$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6
-
-# ----------------- done included file, check C basic types --------
-
-# Lacking an uintptr_t?  Test size of void *
-case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
-  stddef.h:* | *:no) echo "$as_me:$LINENO: checking for void *" >&5
-echo $ECHO_N "checking for void *... $ECHO_C" >&6
-if test "${ac_cv_type_void_p+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((void * *) 0)
-  return 0;
-if (sizeof (void *))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_void_p=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_void_p=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5
-echo "${ECHO_T}$ac_cv_type_void_p" >&6
-
-echo "$as_me:$LINENO: checking size of void *" >&5
-echo $ECHO_N "checking size of void *... $ECHO_C" >&6
-if test "${ac_cv_sizeof_void_p+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_void_p" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr $ac_mid + 1`
-		    if test $ac_lo -le $ac_mid; then
-		      ac_lo= ac_hi=
-		      break
-		    fi
-		    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_hi=`expr '(' $ac_mid ')' - 1`
-		       if test $ac_mid -le $ac_hi; then
-			 ac_lo= ac_hi=
-			 break
-		       fi
-		       ac_mid=`expr 2 '*' $ac_mid`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo= ac_hi=
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_void_p=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (void *), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-long longval () { return (long) (sizeof (void *)); }
-unsigned long ulongval () { return (long) (sizeof (void *)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (void *))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (void *))))
-	exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (void *))))
-	exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_void_p=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (void *), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_void_p=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
-echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
- ;;
-esac
-
-# Lacking an uint64_t?  Test size of long
-case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
-  stddef.h:*:* | *:no:no) echo "$as_me:$LINENO: checking for long" >&5
-echo $ECHO_N "checking for long... $ECHO_C" >&6
-if test "${ac_cv_type_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((long *) 0)
-  return 0;
-if (sizeof (long))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_long=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_long=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
-echo "${ECHO_T}$ac_cv_type_long" >&6
-
-echo "$as_me:$LINENO: checking size of long" >&5
-echo $ECHO_N "checking size of long... $ECHO_C" >&6
-if test "${ac_cv_sizeof_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_long" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr $ac_mid + 1`
-		    if test $ac_lo -le $ac_mid; then
-		      ac_lo= ac_hi=
-		      break
-		    fi
-		    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_hi=`expr '(' $ac_mid ')' - 1`
-		       if test $ac_mid -le $ac_hi; then
-			 ac_lo= ac_hi=
-			 break
-		       fi
-		       ac_mid=`expr 2 '*' $ac_mid`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo= ac_hi=
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-long longval () { return (long) (sizeof (long)); }
-unsigned long ulongval () { return (long) (sizeof (long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (long))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (long))))
-	exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (long))))
-	exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_long=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long" >&6
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
- ;;
-esac
-
-if test $acx_cv_header_stdint = stddef.h; then
-  # Lacking a good header?  Test size of everything and deduce all types.
-  echo "$as_me:$LINENO: checking for int" >&5
-echo $ECHO_N "checking for int... $ECHO_C" >&6
-if test "${ac_cv_type_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((int *) 0)
-  return 0;
-if (sizeof (int))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_int=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_int=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
-echo "${ECHO_T}$ac_cv_type_int" >&6
-
-echo "$as_me:$LINENO: checking size of int" >&5
-echo $ECHO_N "checking size of int... $ECHO_C" >&6
-if test "${ac_cv_sizeof_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_int" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr $ac_mid + 1`
-		    if test $ac_lo -le $ac_mid; then
-		      ac_lo= ac_hi=
-		      break
-		    fi
-		    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_hi=`expr '(' $ac_mid ')' - 1`
-		       if test $ac_mid -le $ac_hi; then
-			 ac_lo= ac_hi=
-			 break
-		       fi
-		       ac_mid=`expr 2 '*' $ac_mid`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo= ac_hi=
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_int=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-long longval () { return (long) (sizeof (int)); }
-unsigned long ulongval () { return (long) (sizeof (int)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (int))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (int))))
-	exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (int))))
-	exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_int=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_int=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-echo "${ECHO_T}$ac_cv_sizeof_int" >&6
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
-
-
-  echo "$as_me:$LINENO: checking for short" >&5
-echo $ECHO_N "checking for short... $ECHO_C" >&6
-if test "${ac_cv_type_short+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((short *) 0)
-  return 0;
-if (sizeof (short))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_short=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_short=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
-echo "${ECHO_T}$ac_cv_type_short" >&6
-
-echo "$as_me:$LINENO: checking size of short" >&5
-echo $ECHO_N "checking size of short... $ECHO_C" >&6
-if test "${ac_cv_sizeof_short+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_short" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr $ac_mid + 1`
-		    if test $ac_lo -le $ac_mid; then
-		      ac_lo= ac_hi=
-		      break
-		    fi
-		    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_hi=`expr '(' $ac_mid ')' - 1`
-		       if test $ac_mid -le $ac_hi; then
-			 ac_lo= ac_hi=
-			 break
-		       fi
-		       ac_mid=`expr 2 '*' $ac_mid`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo= ac_hi=
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_short=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (short), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-long longval () { return (long) (sizeof (short)); }
-unsigned long ulongval () { return (long) (sizeof (short)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (short))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (short))))
-	exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (short))))
-	exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_short=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (short), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_short=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-echo "${ECHO_T}$ac_cv_sizeof_short" >&6
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
-_ACEOF
-
-
-  echo "$as_me:$LINENO: checking for char" >&5
-echo $ECHO_N "checking for char... $ECHO_C" >&6
-if test "${ac_cv_type_char+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if ((char *) 0)
-  return 0;
-if (sizeof (char))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_char=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_char=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5
-echo "${ECHO_T}$ac_cv_type_char" >&6
-
-echo "$as_me:$LINENO: checking size of char" >&5
-echo $ECHO_N "checking size of char... $ECHO_C" >&6
-if test "${ac_cv_sizeof_char+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_char" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr $ac_mid + 1`
-		    if test $ac_lo -le $ac_mid; then
-		      ac_lo= ac_hi=
-		      break
-		    fi
-		    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_hi=`expr '(' $ac_mid ')' - 1`
-		       if test $ac_mid -le $ac_hi; then
-			 ac_lo= ac_hi=
-			 break
-		       fi
-		       ac_mid=`expr 2 '*' $ac_mid`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo= ac_hi=
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_char=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (char), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-long longval () { return (long) (sizeof (char)); }
-unsigned long ulongval () { return (long) (sizeof (char)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (char))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (char))))
-	exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (char))))
-	exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_char=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (char), 77
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_char=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
-echo "${ECHO_T}$ac_cv_sizeof_char" >&6
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR $ac_cv_sizeof_char
-_ACEOF
-
-
-
-  echo "$as_me:$LINENO: checking for type equivalent to int8_t" >&5
-echo $ECHO_N "checking for type equivalent to int8_t... $ECHO_C" >&6
-  case "$ac_cv_sizeof_char" in
-    1) acx_cv_type_int8_t=char ;;
-    *) { { echo "$as_me:$LINENO: error: no 8-bit type" >&5
-echo "$as_me: error: no 8-bit type" >&2;}
-   { (exit please report a bug); exit please report a bug; }; }
-  esac
-  echo "$as_me:$LINENO: result: $acx_cv_type_int8_t" >&5
-echo "${ECHO_T}$acx_cv_type_int8_t" >&6
-
-  echo "$as_me:$LINENO: checking for type equivalent to int16_t" >&5
-echo $ECHO_N "checking for type equivalent to int16_t... $ECHO_C" >&6
-  case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in
-    2:*) acx_cv_type_int16_t=int ;;
-    *:2) acx_cv_type_int16_t=short ;;
-    *) { { echo "$as_me:$LINENO: error: no 16-bit type" >&5
-echo "$as_me: error: no 16-bit type" >&2;}
-   { (exit please report a bug); exit please report a bug; }; }
-  esac
-  echo "$as_me:$LINENO: result: $acx_cv_type_int16_t" >&5
-echo "${ECHO_T}$acx_cv_type_int16_t" >&6
-
-  echo "$as_me:$LINENO: checking for type equivalent to int32_t" >&5
-echo $ECHO_N "checking for type equivalent to int32_t... $ECHO_C" >&6
-  case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in
-    4:*) acx_cv_type_int32_t=int ;;
-    *:4) acx_cv_type_int32_t=long ;;
-    *) { { echo "$as_me:$LINENO: error: no 32-bit type" >&5
-echo "$as_me: error: no 32-bit type" >&2;}
-   { (exit please report a bug); exit please report a bug; }; }
-  esac
-  echo "$as_me:$LINENO: result: $acx_cv_type_int32_t" >&5
-echo "${ECHO_T}$acx_cv_type_int32_t" >&6
-fi
-
-# These tests are here to make the output prettier
-
-if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then
-  case "$ac_cv_sizeof_long" in
-    8) acx_cv_type_int64_t=long ;;
-  esac
-  echo "$as_me:$LINENO: checking for type equivalent to int64_t" >&5
-echo $ECHO_N "checking for type equivalent to int64_t... $ECHO_C" >&6
-  echo "$as_me:$LINENO: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5
-echo "${ECHO_T}${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6
-fi
-
-# Now we can use the above types
-
-if test "$ac_cv_type_uintptr_t" != yes; then
-  echo "$as_me:$LINENO: checking for type equivalent to intptr_t" >&5
-echo $ECHO_N "checking for type equivalent to intptr_t... $ECHO_C" >&6
-  case $ac_cv_sizeof_void_p in
-    2) acx_cv_type_intptr_t=int16_t ;;
-    4) acx_cv_type_intptr_t=int32_t ;;
-    8) acx_cv_type_intptr_t=int64_t ;;
-    *) { { echo "$as_me:$LINENO: error: no equivalent for intptr_t" >&5
-echo "$as_me: error: no equivalent for intptr_t" >&2;}
-   { (exit please report a bug); exit please report a bug; }; }
-  esac
-  echo "$as_me:$LINENO: result: $acx_cv_type_intptr_t" >&5
-echo "${ECHO_T}$acx_cv_type_intptr_t" >&6
-fi
-
-# ----------------- done all checks, emit header -------------
-          ac_config_commands="$ac_config_commands gdb_stdint.h"
-
-
-
-
 # ------------------------- #
 # Checks for declarations.  #
 # ------------------------- #
@@ -20005,72 +17039,6 @@
 
 fi
 
-echo "$as_me:$LINENO: checking for uintptr_t" >&5
-echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintptr_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdint.h>
-
-int
-main ()
-{
-if ((uintptr_t *) 0)
-  return 0;
-if (sizeof (uintptr_t))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uintptr_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uintptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
-if test $ac_cv_type_uintptr_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINTPTR_T 1
-_ACEOF
-
-
-fi
-
 
 # ------------------------------------- #
 # Checks for compiler characteristics.  #
@@ -26701,6 +23669,188 @@
 
 fi
 
+echo "$as_me:$LINENO: checking whether ADDR_NO_RANDOMIZE is declared" >&5
+echo $ECHO_N "checking whether ADDR_NO_RANDOMIZE is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_ADDR_NO_RANDOMIZE+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/personality.h>
+
+int
+main ()
+{
+#ifndef ADDR_NO_RANDOMIZE
+  char *p = (char *) ADDR_NO_RANDOMIZE;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_decl_ADDR_NO_RANDOMIZE=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_ADDR_NO_RANDOMIZE=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_ADDR_NO_RANDOMIZE" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ADDR_NO_RANDOMIZE" >&6
+if test $ac_cv_have_decl_ADDR_NO_RANDOMIZE = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ADDR_NO_RANDOMIZE 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ADDR_NO_RANDOMIZE 0
+_ACEOF
+
+
+fi
+
+
+
+if test "$cross_compiling" = yes; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/personality.h>
+int
+main ()
+{
+
+#      if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#       define ADDR_NO_RANDOMIZE 0x0040000
+#      endif
+       /* Test the flag could be set and stays set.  */
+       personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
+       if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
+	   return 1
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  have_personality=true
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_personality=false
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/personality.h>
+int
+main ()
+{
+
+#      if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#       define ADDR_NO_RANDOMIZE 0x0040000
+#      endif
+       /* Test the flag could be set and stays set.  */
+       personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
+       if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
+	   return 1
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  have_personality=true
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+have_personality=false
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+if $have_personality
+then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PERSONALITY 1
+_ACEOF
+
+fi
+
 
 
 # Check whether --with-sysroot or --without-sysroot was given.
@@ -28324,7 +25474,7 @@
 
 # Check whether we should enable the TUI, but only do so if we really
 # can.
-if test x"$enable_tui" = xyes; then
+if test x"$enable_tui" != xno; then
   if test -d $srcdir/tui; then
     if test "$ac_cv_search_waddstr" != no; then
       CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
@@ -28337,8 +25487,14 @@
       CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
       CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
     else
-      { echo "$as_me:$LINENO: WARNING: no enhanced curses library found; disabling TUI" >&5
+      if test x"$enable_tui" = xyes; then
+	{ { echo "$as_me:$LINENO: error: no enhanced curses library found; disable TUI" >&5
+echo "$as_me: error: no enhanced curses library found; disable TUI" >&2;}
+   { (exit 1); exit 1; }; }
+      else
+	{ echo "$as_me:$LINENO: WARNING: no enhanced curses library found; disabling TUI" >&5
 echo "$as_me: WARNING: no enhanced curses library found; disabling TUI" >&2;}
+      fi
     fi
   fi
 fi
@@ -29340,24 +26496,6 @@
 
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 
-GCC="$GCC"
-CC="$CC"
-acx_cv_header_stdint="$acx_cv_header_stdint"
-acx_cv_type_int8_t="$acx_cv_type_int8_t"
-acx_cv_type_int16_t="$acx_cv_type_int16_t"
-acx_cv_type_int32_t="$acx_cv_type_int32_t"
-acx_cv_type_int64_t="$acx_cv_type_int64_t"
-acx_cv_type_intptr_t="$acx_cv_type_intptr_t"
-ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t"
-ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t"
-ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
-ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
-ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t"
-ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
-ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
-ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p"
-
-
 gdb_host_cpu=$gdb_host_cpu
 nativefile=$nativefile
 
@@ -29376,7 +26514,6 @@
   "gnulib/Makefile" ) CONFIG_FILES="$CONFIG_FILES gnulib/Makefile" ;;
   "$ac_config_links_1" ) CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
   "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
-  "gdb_stdint.h" ) CONFIG_COMMANDS="$CONFIG_COMMANDS gdb_stdint.h" ;;
   "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
@@ -29589,6 +26726,7 @@
 s,@NEXT_WCHAR_H@,$NEXT_WCHAR_H,;t t
 s,@LIBGNU_LIBDEPS@,$LIBGNU_LIBDEPS,;t t
 s,@LIBGNU_LTLIBDEPS@,$LIBGNU_LTLIBDEPS,;t t
+s,@GNULIB_STDINT_H@,$GNULIB_STDINT_H,;t t
 s,@PACKAGE@,$PACKAGE,;t t
 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
 s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
@@ -30546,334 +27684,6 @@
   done
 done
  ;;
-    gdb_stdint.h )
-if test "$GCC" = yes; then
-  echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
-else
-  echo "/* generated for $CC */" > tmp-stdint.h
-fi
-
-sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-  #ifndef GCC_GENERATED_STDINT_H
-  #define GCC_GENERATED_STDINT_H 1
-
-  #include <sys/types.h>
-EOF
-
-if test "$acx_cv_header_stdint" != stdint.h; then
-  echo "#include <stddef.h>" >> tmp-stdint.h
-fi
-if test "$acx_cv_header_stdint" != stddef.h; then
-  echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h
-fi
-
-sed 's/^ *//' >> tmp-stdint.h <<EOF
-  /* glibc uses these symbols as guards to prevent redefinitions.  */
-  #ifdef __int8_t_defined
-  #define _INT8_T
-  #define _INT16_T
-  #define _INT32_T
-  #endif
-  #ifdef __uint32_t_defined
-  #define _UINT32_T
-  #endif
-
-EOF
-
-# ----------------- done header, emit basic int types -------------
-if test "$acx_cv_header_stdint" = stddef.h; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    #ifndef _UINT8_T
-    #define _UINT8_T
-    #ifndef __uint8_t_defined
-    #define __uint8_t_defined
-    typedef unsigned $acx_cv_type_int8_t uint8_t;
-    #endif
-    #endif
-
-    #ifndef _UINT16_T
-    #define _UINT16_T
-    #ifndef __uint16_t_defined
-    #define __uint16_t_defined
-    typedef unsigned $acx_cv_type_int16_t uint16_t;
-    #endif
-    #endif
-
-    #ifndef _UINT32_T
-    #define _UINT32_T
-    #ifndef __uint32_t_defined
-    #define __uint32_t_defined
-    typedef unsigned $acx_cv_type_int32_t uint32_t;
-    #endif
-    #endif
-
-    #ifndef _INT8_T
-    #define _INT8_T
-    #ifndef __int8_t_defined
-    #define __int8_t_defined
-    typedef $acx_cv_type_int8_t int8_t;
-    #endif
-    #endif
-
-    #ifndef _INT16_T
-    #define _INT16_T
-    #ifndef __int16_t_defined
-    #define __int16_t_defined
-    typedef $acx_cv_type_int16_t int16_t;
-    #endif
-    #endif
-
-    #ifndef _INT32_T
-    #define _INT32_T
-    #ifndef __int32_t_defined
-    #define __int32_t_defined
-    typedef $acx_cv_type_int32_t int32_t;
-    #endif
-    #endif
-EOF
-elif test "$ac_cv_type_u_int32_t" = yes; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */
-    #ifndef _INT8_T
-    #define _INT8_T
-    #endif
-    #ifndef _INT16_T
-    #define _INT16_T
-    #endif
-    #ifndef _INT32_T
-    #define _INT32_T
-    #endif
-
-    #ifndef _UINT8_T
-    #define _UINT8_T
-    #ifndef __uint8_t_defined
-    #define __uint8_t_defined
-    typedef u_int8_t uint8_t;
-    #endif
-    #endif
-
-    #ifndef _UINT16_T
-    #define _UINT16_T
-    #ifndef __uint16_t_defined
-    #define __uint16_t_defined
-    typedef u_int16_t uint16_t;
-    #endif
-    #endif
-
-    #ifndef _UINT32_T
-    #define _UINT32_T
-    #ifndef __uint32_t_defined
-    #define __uint32_t_defined
-    typedef u_int32_t uint32_t;
-    #endif
-    #endif
-EOF
-else
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* Some systems have guard macros to prevent redefinitions, define them.  */
-    #ifndef _INT8_T
-    #define _INT8_T
-    #endif
-    #ifndef _INT16_T
-    #define _INT16_T
-    #endif
-    #ifndef _INT32_T
-    #define _INT32_T
-    #endif
-    #ifndef _UINT8_T
-    #define _UINT8_T
-    #endif
-    #ifndef _UINT16_T
-    #define _UINT16_T
-    #endif
-    #ifndef _UINT32_T
-    #define _UINT32_T
-    #endif
-EOF
-fi
-
-# ------------- done basic int types, emit int64_t types ------------
-if test "$ac_cv_type_uint64_t" = yes; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* system headers have good uint64_t and int64_t */
-    #ifndef _INT64_T
-    #define _INT64_T
-    #endif
-    #ifndef _UINT64_T
-    #define _UINT64_T
-    #endif
-EOF
-elif test "$ac_cv_type_u_int64_t" = yes; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* system headers have an u_int64_t (and int64_t) */
-    #ifndef _INT64_T
-    #define _INT64_T
-    #endif
-    #ifndef _UINT64_T
-    #define _UINT64_T
-    #ifndef __uint64_t_defined
-    #define __uint64_t_defined
-    typedef u_int64_t uint64_t;
-    #endif
-    #endif
-EOF
-elif test -n "$acx_cv_type_int64_t"; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* architecture has a 64-bit type, $acx_cv_type_int64_t */
-    #ifndef _INT64_T
-    #define _INT64_T
-    typedef $acx_cv_type_int64_t int64_t;
-    #endif
-    #ifndef _UINT64_T
-    #define _UINT64_T
-    #ifndef __uint64_t_defined
-    #define __uint64_t_defined
-    typedef unsigned $acx_cv_type_int64_t uint64_t;
-    #endif
-    #endif
-EOF
-else
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* some common heuristics for int64_t, using compiler-specific tests */
-    #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L
-    #ifndef _INT64_T
-    #define _INT64_T
-    #ifndef __int64_t_defined
-    typedef long long int64_t;
-    #endif
-    #endif
-    #ifndef _UINT64_T
-    #define _UINT64_T
-    typedef unsigned long long uint64_t;
-    #endif
-
-    #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0
-    /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
-       does not implement __extension__.  But that compiler doesn't define
-       __GNUC_MINOR__.  */
-    # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
-    # define __extension__
-    # endif
-
-    # ifndef _INT64_T
-    # define _INT64_T
-    __extension__ typedef long long int64_t;
-    # endif
-    # ifndef _UINT64_T
-    # define _UINT64_T
-    __extension__ typedef unsigned long long uint64_t;
-    # endif
-
-    #elif !defined __STRICT_ANSI__
-    # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
-
-    #  ifndef _INT64_T
-    #  define _INT64_T
-    typedef __int64 int64_t;
-    #  endif
-    #  ifndef _UINT64_T
-    #  define _UINT64_T
-    typedef unsigned __int64 uint64_t;
-    #  endif
-    # endif /* compiler */
-
-    #endif /* ANSI version */
-EOF
-fi
-
-# ------------- done int64_t types, emit intptr types ------------
-if test "$ac_cv_type_uintptr_t" != yes; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */
-    #ifndef __uintptr_t_defined
-    typedef u$acx_cv_type_intptr_t uintptr_t;
-    #endif
-    #ifndef __intptr_t_defined
-    typedef $acx_cv_type_intptr_t  intptr_t;
-    #endif
-EOF
-fi
-
-# ------------- done intptr types, emit int_least types ------------
-if test "$ac_cv_type_int_least32_t" != yes; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* Define int_least types */
-    typedef int8_t     int_least8_t;
-    typedef int16_t    int_least16_t;
-    typedef int32_t    int_least32_t;
-    #ifdef _INT64_T
-    typedef int64_t    int_least64_t;
-    #endif
-
-    typedef uint8_t    uint_least8_t;
-    typedef uint16_t   uint_least16_t;
-    typedef uint32_t   uint_least32_t;
-    #ifdef _UINT64_T
-    typedef uint64_t   uint_least64_t;
-    #endif
-EOF
-fi
-
-# ------------- done intptr types, emit int_fast types ------------
-if test "$ac_cv_type_int_fast32_t" != yes; then
-      sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* Define int_fast types.  short is often slow */
-    typedef int8_t       int_fast8_t;
-    typedef int          int_fast16_t;
-    typedef int32_t      int_fast32_t;
-    #ifdef _INT64_T
-    typedef int64_t      int_fast64_t;
-    #endif
-
-    typedef uint8_t      uint_fast8_t;
-    typedef unsigned int uint_fast16_t;
-    typedef uint32_t     uint_fast32_t;
-    #ifdef _UINT64_T
-    typedef uint64_t     uint_fast64_t;
-    #endif
-EOF
-fi
-
-if test "$ac_cv_type_uintmax_t" != yes; then
-  sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-    /* Define intmax based on what we found */
-    #ifdef _INT64_T
-    typedef int64_t       intmax_t;
-    #else
-    typedef long          intmax_t;
-    #endif
-    #ifdef _UINT64_T
-    typedef uint64_t      uintmax_t;
-    #else
-    typedef unsigned long uintmax_t;
-    #endif
-EOF
-fi
-
-sed 's/^ *//' >> tmp-stdint.h <<EOF
-
-  #endif /* GCC_GENERATED_STDINT_H */
-EOF
-
-if test -r gdb_stdint.h && cmp -s tmp-stdint.h gdb_stdint.h; then
-  rm -f tmp-stdint.h
-else
-  mv -f tmp-stdint.h gdb_stdint.h
-fi
-
- ;;
     default )
 
 sed -e '/^NAT_FILE[ 	]*=/s,^NAT_FILE[ 	]*=[ 	]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 8d79d8b..0a92812 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -62,6 +62,13 @@
 
 gl_INIT
 
+# For Makefile dependencies.
+GNULIB_STDINT_H=
+if test x"$STDINT_H" != x; then
+  GNULIB_STDINT_H=gnulib/$STDINT_H
+fi
+AC_SUBST(GNULIB_STDINT_H)
+
 PACKAGE=gdb
 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
 AC_SUBST(PACKAGE)
@@ -260,11 +267,11 @@
 AC_ARG_ENABLE(tui,
 [  --enable-tui            enable full-screen terminal user interface (TUI)],
   [case $enableval in
-    yes | no)
+    yes | no | auto)
       ;;
     *)
       AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
-  esac],enable_tui=yes)
+  esac],enable_tui=auto)
 
 # Enable gdbtk.
 AC_ARG_ENABLE(gdbtk,
@@ -512,7 +519,6 @@
 AC_CHECK_HEADERS(signal.h)
 AC_CHECK_HEADERS(stddef.h)
 AC_CHECK_HEADERS(stdlib.h)
-AC_CHECK_HEADERS(stdint.h)
 AC_CHECK_HEADERS(string.h memory.h strings.h)
 AC_CHECK_HEADERS(sys/fault.h)
 AC_CHECK_HEADERS(sys/file.h)
@@ -566,9 +572,6 @@
 # unconditionally, so what's the point in checking these?
 AC_CHECK_HEADERS(ctype.h time.h)
 
-# Create a header we can use portably to get the standard integer types.
-GCC_HEADER_STDINT(gdb_stdint.h)
-
 # ------------------------- #
 # Checks for declarations.  #
 # ------------------------- #
@@ -593,7 +596,6 @@
 [#include <sys/types.h>
 #include <sys/socket.h>
 ])
-AC_CHECK_TYPES(uintptr_t, [], [], [#include <stdint.h>])
 
 # ------------------------------------- #
 # Checks for compiler characteristics.  #
@@ -1266,6 +1268,29 @@
   AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.])
 fi
 
+dnl Check if we can disable the virtual address space randomization.
+dnl The functionality of setarch -R.
+AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
+define([PERSONALITY_TEST], [AC_LANG_PROGRAM([#include <sys/personality.h>], [
+#      if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#       define ADDR_NO_RANDOMIZE 0x0040000
+#      endif
+       /* Test the flag could be set and stays set.  */
+       personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
+       if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
+	   return 1])])
+AC_RUN_IFELSE([PERSONALITY_TEST],
+	      [have_personality=true],
+	      [have_personality=false],
+	      [AC_LINK_IFELSE([PERSONALITY_TEST],
+			      [have_personality=true],
+			      [have_personality=false])])
+if $have_personality
+then
+    AC_DEFINE([HAVE_PERSONALITY], 1,
+	      [Define if you support the personality syscall.])
+fi
+
 dnl Handle optional features that can be enabled.
 
 AC_ARG_WITH(sysroot,
@@ -1576,7 +1601,7 @@
 
 # Check whether we should enable the TUI, but only do so if we really
 # can.
-if test x"$enable_tui" = xyes; then
+if test x"$enable_tui" != xno; then
   if test -d $srcdir/tui; then
     if test "$ac_cv_search_waddstr" != no; then
       CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
@@ -1589,7 +1614,11 @@
       CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
       CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
     else
-      AC_MSG_WARN([no enhanced curses library found; disabling TUI])
+      if test x"$enable_tui" = xyes; then
+	AC_MSG_ERROR([no enhanced curses library found; disable TUI])
+      else
+	AC_MSG_WARN([no enhanced curses library found; disabling TUI])
+      fi
     fi
   fi
 fi
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 6e200ff..250f64b 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -22,6 +22,7 @@
 #include "value.h"
 #include "cp-abi.h"
 #include "command.h"
+#include "exceptions.h"
 #include "gdbcmd.h"
 #include "ui-out.h"
 
@@ -89,9 +90,17 @@
 struct type *
 value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
 {
+  struct type *ret = NULL;
+  struct gdb_exception e;
   if ((current_cp_abi.rtti_type) == NULL)
     return NULL;
-  return (*current_cp_abi.rtti_type) (v, full, top, using_enc);
+  TRY_CATCH (e, RETURN_MASK_ERROR)
+    {
+      ret = (*current_cp_abi.rtti_type) (v, full, top, using_enc);
+    }
+  if (e.reason < 0)
+    return NULL;
+  return ret;
 }
 
 void
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 44f94dd..d2c0c2c 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -215,12 +215,12 @@
    the routine.  Otherwise, return 0.  */
 
 static CORE_ADDR
-cris_sigtramp_start (struct frame_info *next_frame)
+cris_sigtramp_start (struct frame_info *this_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
   gdb_byte buf[SIGTRAMP_LEN];
 
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
+  if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
     return 0;
 
   if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0)
@@ -229,7 +229,7 @@
 	return 0;
 
       pc -= SIGTRAMP_OFFSET1;
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
+      if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
 	return 0;
     }
 
@@ -243,12 +243,12 @@
    the routine.  Otherwise, return 0.  */
 
 static CORE_ADDR
-cris_rt_sigtramp_start (struct frame_info *next_frame)
+cris_rt_sigtramp_start (struct frame_info *this_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
   gdb_byte buf[SIGTRAMP_LEN];
 
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
+  if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
     return 0;
 
   if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0)
@@ -257,7 +257,7 @@
 	return 0;
 
       pc -= SIGTRAMP_OFFSET1;
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
+      if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
 	return 0;
     }
 
@@ -267,22 +267,22 @@
   return pc;
 }
 
-/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
-   routine, return the address of the associated sigcontext structure.  */
+/* Assuming THIS_FRAME is a frame for a GNU/Linux sigtramp routine,
+   return the address of the associated sigcontext structure.  */
 
 static CORE_ADDR
-cris_sigcontext_addr (struct frame_info *next_frame)
+cris_sigcontext_addr (struct frame_info *this_frame)
 {
   CORE_ADDR pc;
   CORE_ADDR sp;
   char buf[4];
 
-  frame_unwind_register (next_frame,
-			 gdbarch_sp_regnum (get_frame_arch (next_frame)), buf);
+  get_frame_register (this_frame,
+		      gdbarch_sp_regnum (get_frame_arch (this_frame)), buf);
   sp = extract_unsigned_integer (buf, 4);
 
   /* Look for normal sigtramp frame first.  */
-  pc = cris_sigtramp_start (next_frame);
+  pc = cris_sigtramp_start (this_frame);
   if (pc)
     {
       /* struct signal_frame (arch/cris/kernel/signal.c) contains
@@ -291,7 +291,7 @@
       return sp;
     }
 
-  pc = cris_rt_sigtramp_start (next_frame);
+  pc = cris_rt_sigtramp_start (this_frame);
   if (pc)
     {
       /* struct rt_signal_frame (arch/cris/kernel/signal.c) contains
@@ -330,10 +330,10 @@
 };
 
 static struct cris_unwind_cache *
-cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
+cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
 				  void **this_cache)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct cris_unwind_cache *info;
   CORE_ADDR pc;
@@ -347,7 +347,7 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
   (*this_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Zero all fields.  */
   info->prev_sp = 0;
@@ -359,10 +359,10 @@
   info->return_pc = 0;
   info->leaf_function = 0;
 
-  frame_unwind_register (next_frame, gdbarch_sp_regnum (gdbarch), buf);
+  get_frame_register (this_frame, gdbarch_sp_regnum (gdbarch), buf);
   info->base = extract_unsigned_integer (buf, 4);
 
-  addr = cris_sigcontext_addr (next_frame);
+  addr = cris_sigcontext_addr (this_frame);
   
   /* Layout of the sigcontext struct:
      struct sigcontext {
@@ -425,51 +425,48 @@
 }
 
 static void
-cris_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
+cris_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
                              struct frame_id *this_id)
 {
   struct cris_unwind_cache *cache =
-    cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
-  (*this_id) = frame_id_build (cache->base, frame_pc_unwind (next_frame));
+    cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
+  (*this_id) = frame_id_build (cache->base, get_frame_pc (this_frame));
 }
 
 /* Forward declaration.  */
 
-static void cris_frame_prev_register (struct frame_info *next_frame,
-				      void **this_prologue_cache,
-				      int regnum, int *optimizedp,
-				      enum lval_type *lvalp, CORE_ADDR *addrp,
-				      int *realnump, gdb_byte *bufferp);
-static void
-cris_sigtramp_frame_prev_register (struct frame_info *next_frame,
-                                   void **this_cache,
-                                   int regnum, int *optimizedp,
-                                   enum lval_type *lvalp, CORE_ADDR *addrp,
-                                   int *realnump, gdb_byte *valuep)
+static struct value *cris_frame_prev_register (struct frame_info *this_frame,
+					       void **this_cache, int regnum);
+static struct value *
+cris_sigtramp_frame_prev_register (struct frame_info *this_frame,
+                                   void **this_cache, int regnum)
 {
   /* Make sure we've initialized the cache.  */
-  cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
-  cris_frame_prev_register (next_frame, this_cache, regnum,
-                            optimizedp, lvalp, addrp, realnump, valuep);
+  cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
+  return cris_frame_prev_register (this_frame, this_cache, regnum);
+}
+
+static int
+cris_sigtramp_frame_sniffer (const struct frame_unwind *self,
+			     struct frame_info *this_frame,
+			     void **this_cache)
+{
+  if (cris_sigtramp_start (this_frame) 
+      || cris_rt_sigtramp_start (this_frame))
+    return 1;
+
+  return 0;
 }
 
 static const struct frame_unwind cris_sigtramp_frame_unwind =
 {
   SIGTRAMP_FRAME,
   cris_sigtramp_frame_this_id,
-  cris_sigtramp_frame_prev_register
+  cris_sigtramp_frame_prev_register,
+  NULL,
+  cris_sigtramp_frame_sniffer
 };
 
-static const struct frame_unwind *
-cris_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  if (cris_sigtramp_start (next_frame) 
-      || cris_rt_sigtramp_start (next_frame))
-    return &cris_sigtramp_frame_unwind;
-
-  return NULL;
-}
-
 int
 crisv32_single_step_through_delay (struct gdbarch *gdbarch,
 				   struct frame_info *this_frame)
@@ -477,18 +474,11 @@
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   ULONGEST erp;
   int ret = 0;
-  char buf[4];
 
   if (cris_mode () == cris_mode_guru)
-    {
-      frame_unwind_register (this_frame, NRP_REGNUM, buf);
-    }
+    erp = get_frame_register_unsigned (this_frame, NRP_REGNUM);
   else
-    {
-      frame_unwind_register (this_frame, ERP_REGNUM, buf);
-    }
-
-  erp = extract_unsigned_integer (buf, 4);
+    erp = get_frame_register_unsigned (this_frame, ERP_REGNUM);
 
   if (erp & 0x1)
     {
@@ -717,11 +707,11 @@
 				 struct cmd_list_element *c);
 
 static CORE_ADDR cris_scan_prologue (CORE_ADDR pc, 
-				     struct frame_info *next_frame,
+				     struct frame_info *this_frame,
 				     struct cris_unwind_cache *info);
 
 static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc, 
-					struct frame_info *next_frame,
+					struct frame_info *this_frame,
 					struct cris_unwind_cache *info);
 
 static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch, 
@@ -770,7 +760,7 @@
    for it IS the sp for the next frame.  */
 
 struct cris_unwind_cache *
-cris_frame_unwind_cache (struct frame_info *next_frame,
+cris_frame_unwind_cache (struct frame_info *this_frame,
 			 void **this_prologue_cache)
 {
   CORE_ADDR pc;
@@ -782,7 +772,7 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
   (*this_prologue_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Zero all fields.  */
   info->prev_sp = 0;
@@ -796,11 +786,9 @@
 
   /* Prologue analysis does the rest...  */
   if (cris_version () == 32)
-    crisv32_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
-			   next_frame, info);
+    crisv32_scan_prologue (get_frame_func (this_frame), this_frame, info);
   else
-    cris_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
-			next_frame, info);
+    cris_scan_prologue (get_frame_func (this_frame), this_frame, info);
 
   return info;
 }
@@ -809,18 +797,18 @@
    frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-cris_frame_this_id (struct frame_info *next_frame,
+cris_frame_this_id (struct frame_info *this_frame,
 		    void **this_prologue_cache,
 		    struct frame_id *this_id)
 {
   struct cris_unwind_cache *info
-    = cris_frame_unwind_cache (next_frame, this_prologue_cache);
+    = cris_frame_unwind_cache (this_frame, this_prologue_cache);
   CORE_ADDR base;
   CORE_ADDR func;
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame, NORMAL_FRAME);
+  func = get_frame_func (this_frame);
 
   /* Hopefully the prologue analysis either correctly determined the
      frame's base (which is the SP from the previous frame), or set
@@ -834,29 +822,25 @@
   (*this_id) = id;
 }
 
-static void
-cris_frame_prev_register (struct frame_info *next_frame,
-			  void **this_prologue_cache,
-			  int regnum, int *optimizedp,
-			  enum lval_type *lvalp, CORE_ADDR *addrp,
-			  int *realnump, gdb_byte *bufferp)
+static struct value *
+cris_frame_prev_register (struct frame_info *this_frame,
+			  void **this_prologue_cache, int regnum)
 {
   struct cris_unwind_cache *info
-    = cris_frame_unwind_cache (next_frame, this_prologue_cache);
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, bufferp);
+    = cris_frame_unwind_cache (this_frame, this_prologue_cache);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
+   frame.  The frame ID's base needs to match the TOS value saved by
+   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
 
 static struct frame_id
-cris_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+cris_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (cris_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp;
+  sp = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 static CORE_ADDR
@@ -1011,20 +995,16 @@
 {
   NORMAL_FRAME,
   cris_frame_this_id,
-  cris_frame_prev_register
+  cris_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-const struct frame_unwind *
-cris_frame_sniffer (struct frame_info *next_frame)
-{
-  return &cris_frame_unwind;
-}
-
 static CORE_ADDR
-cris_frame_base_address (struct frame_info *next_frame, void **this_cache)
+cris_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
   struct cris_unwind_cache *info
-    = cris_frame_unwind_cache (next_frame, this_cache);
+    = cris_frame_unwind_cache (this_frame, this_cache);
   return info->base;
 }
 
@@ -1113,10 +1093,10 @@
    determine that it is a prologue (1).  */
 
 static CORE_ADDR 
-cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
+cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
 		    struct cris_unwind_cache *info)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   /* Present instruction.  */
   unsigned short insn;
 
@@ -1149,11 +1129,11 @@
   val = 0;
   regsave = -1;
 
-  /* If we were called without a next_frame, that means we were called
+  /* If we were called without a this_frame, that means we were called
      from cris_skip_prologue which already tried to find the end of the
      prologue through the symbol information.  64 instructions past current
      pc is arbitrarily chosen, but at least it means we'll stop eventually.  */
-  limit = next_frame ? frame_pc_unwind (next_frame) : pc + 64;
+  limit = this_frame ? get_frame_pc (this_frame) : pc + 64;
 
   /* Find the prologue instructions.  */
   while (pc > 0 && pc < limit)
@@ -1322,9 +1302,9 @@
         }
     }
 
-  /* We only want to know the end of the prologue when next_frame and info
+  /* We only want to know the end of the prologue when this_frame and info
      are NULL (called from cris_skip_prologue i.e.).  */
-  if (next_frame == NULL && info == NULL)
+  if (this_frame == NULL && info == NULL)
     {
       return pc;
     }
@@ -1339,7 +1319,7 @@
       /* The SP was moved to the FP.  This indicates that a new frame
          was created.  Get THIS frame's FP value by unwinding it from
          the next frame.  */
-      this_base = frame_unwind_register_unsigned (next_frame, CRIS_FP_REGNUM);
+      this_base = get_frame_register_unsigned (this_frame, CRIS_FP_REGNUM);
       info->base = this_base;
       info->saved_regs[CRIS_FP_REGNUM].addr = info->base;
   
@@ -1352,8 +1332,8 @@
       ULONGEST this_base;      
       /* Assume that the FP is this frame's SP but with that pushed
          stack space added back.  */
-      this_base = frame_unwind_register_unsigned (next_frame,
-						  gdbarch_sp_regnum (gdbarch));
+      this_base = get_frame_register_unsigned (this_frame,
+					       gdbarch_sp_regnum (gdbarch));
       info->base = this_base;
       info->prev_sp = info->base + info->size;
     }
@@ -1398,10 +1378,10 @@
 }
 
 static CORE_ADDR 
-crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
+crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
 		    struct cris_unwind_cache *info)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   ULONGEST this_base;
 
   /* Unlike the CRISv10 prologue scanner (cris_scan_prologue), this is not
@@ -1416,16 +1396,16 @@
      the stack pointer is not adjusted, and (as a consequence) the return
      address is not pushed onto the stack.  */
 
-  /* We only want to know the end of the prologue when next_frame and info
+  /* We only want to know the end of the prologue when this_frame and info
      are NULL (called from cris_skip_prologue i.e.).  */
-  if (next_frame == NULL && info == NULL)
+  if (this_frame == NULL && info == NULL)
     {
       return pc;
     }
 
   /* The SP is assumed to be unaltered.  */
-  this_base = frame_unwind_register_unsigned (next_frame,
-					      gdbarch_sp_regnum (gdbarch));
+  this_base = get_frame_register_unsigned (this_frame,
+					   gdbarch_sp_regnum (gdbarch));
   info->base = this_base;
   info->prev_sp = this_base;
       
@@ -4207,22 +4187,22 @@
   
   set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
-  set_gdbarch_unwind_dummy_id (gdbarch, cris_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
 
   if (tdep->cris_dwarf2_cfi == 1)
     {
       /* Hook in the Dwarf-2 frame sniffer.  */
       set_gdbarch_dwarf2_reg_to_regnum (gdbarch, cris_dwarf2_reg_to_regnum);
       dwarf2_frame_set_init_reg (gdbarch, cris_dwarf2_frame_init_reg);
-      frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+      dwarf2_append_unwinders (gdbarch);
     }
 
   if (tdep->cris_mode != cris_mode_guru)
     {
-      frame_unwind_append_sniffer (gdbarch, cris_sigtramp_frame_sniffer);
+      frame_unwind_append_unwinder (gdbarch, &cris_sigtramp_frame_unwind);
     }
 
-  frame_unwind_append_sniffer (gdbarch, cris_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &cris_frame_unwind);
   frame_base_set_default (gdbarch, &cris_frame_base);
 
   set_solib_svr4_fetch_link_map_offsets
diff --git a/gdb/defs.h b/gdb/defs.h
index 9069156..6e6aa80 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <errno.h>		/* System call error return status.  */
 #include <limits.h>
+#include <stdint.h>
 
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
@@ -230,12 +231,18 @@
    Use make_cleanup to add an element to the cleanup chain.
    Use do_cleanups to do all cleanup actions back to a given
    point in the chain.  Use discard_cleanups to remove cleanups
-   from the chain back to a given point, not doing them.  */
+   from the chain back to a given point, not doing them.  
+
+   If the argument is pointer to allocated memory, then you need to
+   to additionally set the 'free_arg' member to a function that will
+   free that memory.  This function will be called both when the cleanup
+   is executed and when it's discarded.  */
 
 struct cleanup
   {
     struct cleanup *next;
     void (*function) (void *);
+    void (*free_arg) (void *);
     void *arg;
   };
 
@@ -326,6 +333,9 @@
 
 extern struct cleanup *make_cleanup (make_cleanup_ftype *, void *);
 
+extern struct cleanup *make_cleanup_dtor (make_cleanup_ftype *, void *,
+					  void (*dtor) (void *));
+
 extern struct cleanup *make_cleanup_freeargv (char **);
 
 struct ui_file;
@@ -339,11 +349,17 @@
 
 extern struct cleanup *make_cleanup_bfd_close (bfd *abfd);
 
+extern struct cleanup *make_cleanup_restore_integer (int *variable);
+
 extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);
 
 extern struct cleanup *make_my_cleanup (struct cleanup **,
 					make_cleanup_ftype *, void *);
 
+extern struct cleanup *make_my_cleanup2 (struct cleanup **,
+					 make_cleanup_ftype *, void *,
+					 void (*free_arg) (void *));
+
 extern struct cleanup *save_cleanups (void);
 extern struct cleanup *save_final_cleanups (void);
 extern struct cleanup *save_my_cleanups (struct cleanup **);
@@ -661,22 +677,7 @@
    used by the finish and until commands, and in the remote protocol
    when opening an extended-remote connection. */
 
-struct continuation_arg
-  {
-    struct continuation_arg *next;
-    union continuation_data {
-      void *pointer;
-      int   integer;
-      long  longint;
-    } data;
-  };
-
-struct continuation
-  {
-    void (*continuation_hook) (struct continuation_arg *, int);
-    struct continuation_arg *arg_list;
-    struct continuation *next;
-  };
+struct continuation;
 
 /* In infrun.c. */
 extern struct continuation *cmd_continuation;
@@ -684,14 +685,14 @@
 extern struct continuation *intermediate_continuation;
 
 /* From utils.c */
-extern void add_continuation (void (*)(struct continuation_arg *, int),
-			      struct continuation_arg *);
-extern void do_all_continuations (int error);
+extern void add_continuation (void (*)(void *), void *,
+			      void (*)(void *));
+extern void do_all_continuations (void);
 extern void discard_all_continuations (void);
 
-extern void add_intermediate_continuation (void (*)(struct continuation_arg *, int),
-			      struct continuation_arg *);
-extern void do_all_intermediate_continuations (int error);
+extern void add_intermediate_continuation (void (*)(void *), void *,
+					   void (*)(void *));
+extern void do_all_intermediate_continuations (void);
 extern void discard_all_intermediate_continuations (void);
 
 /* String containing the current directory (what getwd would return).  */
diff --git a/gdb/dfp.c b/gdb/dfp.c
index fff8288..9816d27 100644
--- a/gdb/dfp.c
+++ b/gdb/dfp.c
@@ -395,7 +395,12 @@
 		 int len_to)
 {
   decNumber number;
+  gdb_byte dec[16];
 
-  decimal_to_number (from, len_from, &number);
-  decimal_from_number (&number, to, len_to);
+  match_endianness (from, len_from, dec);
+
+  decimal_to_number (dec, len_from, &number);
+  decimal_from_number (&number, dec, len_to);
+
+  match_endianness (dec, len_to, to);
 }
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index c249253..8786b4a 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,25 @@
+2008-07-10  Doug Evans  <dje@google.com>
+
+	* doc/gdb.texinfo: Document "set print symbol-loading on|off".
+
+2008-07-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.texinfo (Starting): Document "set disable-randomization".
+
+2008-07-07  Andreas Schwab  <schwab@suse.de>
+
+	* gdb.texinfo (GDB/MI Target Manipulation): Fix last change.
+
+2008-07-06  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* gdb.texinfo (GDB/MI Target Manipulation): Add
+	example of -target-attach.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* observer.texi (target_resumed): New observer.
+	* gdb.texinfo (GDB/MI Output Records): Document *running.
+
 2008-06-06  Tom Tromey  <tromey@redhat.com>
 
 	* gdb.texinfo (Completion): Add field name example.
@@ -6,15 +28,15 @@
 
 	* gdb.texinfo (GDB/MI Program Context): Added example
 	to -exec-arguments
-	
+
 2008-06-05  Nick Roberts  <nickrob@snap.net.nz>
 
 	* annotate.texinfo (Multi-threaded Apps): Add entry for thread-changed
 	annotation.
 
 2008-06-05  Vladimir Prus  <vladimir@codesourcery.com>
-            Nathan Sidwell  <nathan@codesourcery.com>
-            Joseph Myers  <joseph@codesourcery.com>
+	    Nathan Sidwell  <nathan@codesourcery.com>
+	    Joseph Myers  <joseph@codesourcery.com>
 
 	* configure.ac: Include ../../config/acx.m4.  Use ACX_PKGVERSION
 	and ACX_BUGURL.
@@ -34,7 +56,7 @@
 
 	* gdb.texinfo (GDB/MI File Transfer Commands): Typo
 	in -target-file-get section.
-	
+
 2008-05-22  Pedro Alves  <pedro@codesourcery.com>
 
 	* gdb.texinfo (vAttach, vRun): Re-remove requirement of the stub
@@ -64,8 +86,8 @@
 
 2008-05-05  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * gdb.texinfo (Maintenance Commands): Clarify that "maint time"
-        will not report the time of commands that run the target.
+	* gdb.texinfo (Maintenance Commands): Clarify that "maint time"
+	will not report the time of commands that run the target.
 
 2008-05-03  Vladimir Prus  <vladimir@codesourcery.com>
 
@@ -112,8 +134,8 @@
 
 2008-04-24  Vladimir Prus  <vladimir@codesourcery.com>
 
-        * gdb.texinfo (GDB/MI Output Syntax): Clarify that async
-        output does not necessary include any tokens.
+	* gdb.texinfo (GDB/MI Output Syntax): Clarify that async
+	output does not necessary include any tokens.
 
 2008-04-22  Corinna Vinschen  <vinschen@redhat.com>
 
@@ -144,7 +166,7 @@
 
 2008-04-09  Marc Khouzam  <marc.khouzam@ericsson.com>
 
-	* gdb.texinfo (GDB/MI Variable Objects): Add anchor to 
+	* gdb.texinfo (GDB/MI Variable Objects): Add anchor to
 	-var-set-format.  Add -f option to -var-evaluate-expression.
 
 2008-04-03  Joel Brobecker  <brobecker@adacore.com>
@@ -347,7 +369,7 @@
 	* gdb.texinfo (Host I/O Packets): Fix xref syntax.
 
 2007-12-14  Vladimir Prus  <vladimir@codesourcery.com>
-	
+
 	* gdb.texinfo (GDB/MI Breakpoint Commands): Document
 	the -f option for -break-insert, remove -r option,
 	and clarify specification of location.
@@ -381,7 +403,7 @@
 
 	* gdbint.texinfo (Native Conditionals): Remove
 	mention of CLEAR_SOLIB.
-	
+
 2007-11-11  Joel Brobecker  <brobecker@adacore.com>
 
 	* gdb.texinfo (Print Settings): Add documentation for "set/show
@@ -474,12 +496,12 @@
 	* gdb.texinfo (Setting Breakpoints): Revise
 	documentation for pending breakpoints.  Document
 	breakpoints with multiple locations.
-	
+
 2007-09-19  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* gdb.texinfo (Miscellaneous gdb/mi Commands):
 	Document -list-features.
-	
+
 2007-09-15  Eli Zaretskii  <eliz@gnu.org>
 
 	* gdb.texinfo (Output): Spell out which features of C's printf are
@@ -529,7 +551,7 @@
 	* gdb.texinfo (Top): Dedicate manual to the memory of Fred Fish.
 	(title page): Include the dedication in the printed manual, as a
 	separate page after the copyright notice.
-	
+
 	* gdb.texinfo (The F Reply Packet): Avoid confusing texi2html:
 	don't break a @var across a line.
 
@@ -541,8 +563,8 @@
 2007-07-12  Nick Roberts  <nickrob@snap.net.nz>
 
 	* gdb.texinfo (Server Prefix): New node.  Adapt from existing node
-        in annotate.texinfo.
-        (Command History): Link to new node.
+	in annotate.texinfo.
+	(Command History): Link to new node.
 
 2007-07-05  Markus Deuling  <deuling@de.ibm.com>
 
@@ -685,13 +707,13 @@
 	stack-arg-size.
 
 2007-05-14  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* all-cfg.texi (GDBTUI): New.
 	* gdb.texinfo (Mode Options): Use GDBTUI variable.
 	(TUI, TUI Overview, TUI Keys, TUI Single Key Mode, TUI Commands)
 	(TUI Configuration): Edit to improve clarity and fix problems of
 	both style and content.
-	
+
 2007-05-11  Ulrich Weigand  <uweigand@de.ibm.com>
 
 	* observer.texi (GDB Observers): New observer "new_objfile".
@@ -704,7 +726,7 @@
 
 	* gdb.texinfo (GDB/MI Variable Objects): Document
 	frozen variables objects.
-	
+
 2007-04-13  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* gdb.texinfo (Memory): Reference Remote Debugging chapter.
@@ -718,16 +740,16 @@
 
 2007-04-11  Bob Wilson  <bob.wilson@acm.org>
 
-        * gdb.texinfo (Contributors, Continuing and Stepping)
-        (Fortran Defaults, HPPA, TUI, TUI Commands, Configure Options)
-        (General Query Packets, File-I/O Remote Protocol Extension)
-        (Protocol Basics, The F Reply Packet, Write)
-        (Protocol-specific Representation of Datatypes, Memory Transfer):
-        Fix hyphenation, punctuation and grammar problems.
-        (Cygwin Native): Likewise.  Also fix misuse of @pxref and use
-        'section' instead of 'subsection' in the text.
-        (Non-debug DLL Symbols): Avoid 'subsubsection' in the text.
-        (i386): Remove period from section name.
+	* gdb.texinfo (Contributors, Continuing and Stepping)
+	(Fortran Defaults, HPPA, TUI, TUI Commands, Configure Options)
+	(General Query Packets, File-I/O Remote Protocol Extension)
+	(Protocol Basics, The F Reply Packet, Write)
+	(Protocol-specific Representation of Datatypes, Memory Transfer):
+	Fix hyphenation, punctuation and grammar problems.
+	(Cygwin Native): Likewise.  Also fix misuse of @pxref and use
+	'section' instead of 'subsection' in the text.
+	(Non-debug DLL Symbols): Avoid 'subsubsection' in the text.
+	(i386): Remove period from section name.
 	(Installing GDB, Requirements, Running Configure,  Separate Objdir)
 	(Config Names, Configure Options): Use @file{configure}.
 
@@ -741,13 +763,13 @@
 	* gdbint.texinfo (SOM): Correct location of the SOM reader.
 
 2007-04-02  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* gdb.texinfo: Consistently capitalize all significant words in
 	node names, chapter titles, section titles, and headings.  Update
 	cross references to match.
 	(Starting and Stopping Trace Experiment): Make node name plural.
 	(Breakpoint related warnings): Hyphenate "Breakpoint-related".
-	
+
 2007-03-30  Pedro Alves  <pedro_alves@portugalmail.pt>
 
 	* gdb.texinfo (WinCE): Delete obsolete subsection.
@@ -786,25 +808,25 @@
 	* refcard.tex: Specify paper size for PDF output.
 
 2007-03-26  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* gdb.texinfo (Omissions from Ada, Additions to Ada): Wrap long lines.
-	
+
 2007-03-26  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* gdb.texinfo (Invoking GDB): Use @value{GDBP}.
 	(Source Path, Character Sets, Macros, Define)
 	(GDB/MI Result Records, GDB/MI Simple Examples)
 	(GDB/MI Program Execution, GDB/MI File Commands)
 	(Maintenance Commands, Packets, File-I/O Overview): Use @value{GDBN}.
 	(Bug Reporting): Use @value{GCC}.
-	
+
 2007-03-26  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* gdb.texinfo (Help): Fix formatting of examples.
 	(Variables): Use @ifnotinfo instead of @iftex.
 	(Non-debug DLL symbols): Use @ref instead of @pxref.
 	(Sparclet File): Use @samp instead of quotes.
-	
+
 2007-03-26  Bob Wilson  <bob.wilson@acm.org>
 
 	* gdb.texinfo (Variables, C): Update cross reference to GCC docs.
@@ -815,7 +837,7 @@
 	the order of the nodes.
 	(C Operators, C Constants, Debugging C): Remove extra menus.
 	(Method Names in Commands): Do not specify next/prev/up nodes.
-	
+
 2007-03-26  Bob Wilson  <bob.wilson@acm.org>
 
 	* gdb.texinfo (File Options): Add missing parenthesis.
@@ -869,7 +891,7 @@
 
 2007-02-02  Markus Deuling  <deuling@de.ibm.com>  (tiny change)
 
-        * gdbint.texinfo (Operation System ABI Variant Handling): Update
+	* gdbint.texinfo (Operation System ABI Variant Handling): Update
 	descriptions for new/deleted elements in gdb_osabi.  Add missing
 	description for function generic_elf_osabi_sniff_abi_tag_sections.
 
@@ -948,10 +970,10 @@
 	of -var-delete.
 
 2006-11-22  Vladimir Prus  <vladimir@codesourcery.com>
-        
+
 	* gdb.texinfo (Setting breakpoints): Document
-        automatic software/hardware breakpoint usage and
-        the "set breakpoint auto-hw" command.
+	automatic software/hardware breakpoint usage and
+	the "set breakpoint auto-hw" command.
 
 2006-11-21  Vladimir Prus  <vladimir@codesourcery.com>
 
@@ -1068,8 +1090,8 @@
 2006-09-07  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* gdb.texinfo (GDB/MI Stack Manipulation): Mention that
-        -stack-list-locals HIGH_FRAME argument can be larger then the
-        actual number of frames.
+	-stack-list-locals HIGH_FRAME argument can be larger then the
+	actual number of frames.
 
 2006-09-02  Bob Wilson  <bob.wilson@acm.org>
 
@@ -1099,7 +1121,7 @@
 
 2006-08-08  Vladimir Prus  <vladimir@codesourcery.com>
 
-	* gdb.texinfo (Target Commands): Remove 
+	* gdb.texinfo (Target Commands): Remove
 	'set download-write-size' and 'show download-write-size'.
 
 2006-08-01  Daniel Jacobowitz  <dan@codesourcery.com>
@@ -1409,7 +1431,7 @@
 2006-01-04  Michael Snyder  <msnyder@redhat.com>
 
 	* gdb.texinfo: Add documentation for linux-fork.
-	* gdbint.texinfo: Add internal documentation for checkpoints. 
+	* gdbint.texinfo: Add internal documentation for checkpoints.
 
 2006-01-02  Paul N. Hilfinger  <hilfinger@gnat.com>
 
@@ -1432,15 +1454,15 @@
 
 2005-12-23  Eli Zaretskii  <eliz@gnu.org>
 
-	* stabs.texinfo: 
-	* refcard.tex: 
+	* stabs.texinfo:
+	* refcard.tex:
 	* gpl.texi:
-	* gdbint.texinfo: 
-	* gdb.texinfo: 
-	* gdb-cfg.texi: 
+	* gdbint.texinfo:
+	* gdb.texinfo:
+	* gdb-cfg.texi:
 	* fdl.texi:
-	* annotate.texinfo: 
-	* all-cfg.texi: 
+	* annotate.texinfo:
+	* all-cfg.texi:
 	* Makefile.in: Add (C) after Copyright.  Update the FSF
 	address.
 
@@ -1470,7 +1492,7 @@
 	(General Query Packets): Add entries for the tracepoint packets,
 	referring to the "Tracepoint Packets" node.
 	(Tracepoints): Add reference to "Tracepoint Packets".
-	
+
 2005-11-18  Kevin Buettner  <kevinb@redhat.com>
 
 	* gdb.texinfo (set remotebreak): Add anchor.
@@ -1519,7 +1541,7 @@
 
 	* gdb.texinfo (Packets): Add index entries for 'm' packet
 	disclaimers.
-	
+
 	* gdb.texinfo (Packets): Clarify lack of restrictions on behavior
 	of stub when processing an 'm' packet.
 
@@ -1931,7 +1953,7 @@
 	* configure.in: Replace configdirs with multiple references to
 	AC_CONFIG_SUBDIRS.
 	* configure: Re-generate.
-	
+
 2005-01-04  Andrew Cagney  <cagney@gnu.org>
 
 	* gdbint.texinfo (Versions and Branches): Make the date (YYYYMMDD)
@@ -1973,8 +1995,8 @@
 2004-11-10  Jon Beniston <jon@beniston.com>
 
 	Committed by Andrew Cagney  <cagney@gnu.org>.
-        * gdb.texinfo (Remote Serial Protocol): Further describe 
-        binary transfer escaping mechanism .
+	* gdb.texinfo (Remote Serial Protocol): Further describe
+	binary transfer escaping mechanism .
 
 2004-11-08  Randolph Chung  <tausq@debian.org>
 
@@ -2053,8 +2075,8 @@
 
 2004-09-11  Paul Hilfinger  <hilfinger@gnat.com>
 
-	* gdbint.texinfo (User Interface): Change local_hex_string_custom 
-	to hex_string_custom (not historically correct, but more 
+	* gdbint.texinfo (User Interface): Change local_hex_string_custom
+	to hex_string_custom (not historically correct, but more
 	understandable, given the current code).
 
 2004-09-03  Andrew Cagney  <cagney@gnu.org>
@@ -2180,7 +2202,7 @@
 
 2004-06-06  Randolph Chung  <tausq@debian.org>
 
-	* gdb.texinfo (push_dummy_call): Update argument list to match 
+	* gdb.texinfo (push_dummy_call): Update argument list to match
 	the new push_dummy_call method signature.  Describe the function
 	argument.
 
@@ -2407,7 +2429,7 @@
 	(Coding): Add -Wunused-label to list of -Werror warnings.
 
 2004-01-08  Jason Molenda  <jmolenda@apple.com>
-            Eli Zaretskii  <eliz@gnu.org>
+	    Eli Zaretskii  <eliz@gnu.org>
 
 	* gdb.texinfo: Update copyright.
 	(Objective-C): "methodName" typeo fixed.  Add @code/@var markup
@@ -2467,7 +2489,7 @@
 2003-10-15  Kevin Buettner  <kevinb@redhat.com>
 
 	From Anthony Green  <green@redhat.com>:
-        * gdb.texinfo (Breakpoints related warnings): Insert into menu.
+	* gdb.texinfo (Breakpoints related warnings): Insert into menu.
 
 2003-10-14  Kevin Buettner  <kevinb@redhat.com>
 
@@ -2656,7 +2678,7 @@
 
 2003-06-18  Daniel Jacobowitz  <drow@mvista.com>
 
-        * gdb.texinfo (Remote Debugging): New section "Connecting to a
+	* gdb.texinfo (Remote Debugging): New section "Connecting to a
 	remote target".  Document the "detach" and "disconnect" commands.
 	(Server, Netware, Debug Session): Reference "Connecting to a
 	remote target".
@@ -3082,7 +3104,7 @@
 
 2002-11-26  Elena Zannoni  <ezannoni@redhat.com>
 
-        Fix PR gdb/723 and PR gdb/245.
+	Fix PR gdb/723 and PR gdb/245.
 	* Makefile.in (install-info): Run the install-info command as part
 	of the post install steps only.
 	(uninstall-info): New target.
@@ -3748,7 +3770,7 @@
 2001-11-30  Jim Blandy  <jimb@redhat.com>
 
 	* gdb.texinfo (Overlays): New chapter, documenting GDB's
-        overlay support.  Add to top-level menu.
+	overlay support.  Add to top-level menu.
 
 2001-11-26  Tom Tromey  <tromey@redhat.com>
 
@@ -4098,13 +4120,13 @@
 2000-07-05  Eli Zaretskii <eliz@gnu.org>
 
 	* refcard.tex: Remove \centerline from the blurb.  Patch from
-        Brian Youmans.
+	Brian Youmans.
 
 2000-06-25  Eli Zaretskii <eliz@gnu.org>
 
 	* Makefile.in (install-info): Support installation from outside of
-        the source directory.  Reported by Mark Harig
-        <markh@frazier.landmark.com>.
+	the source directory.  Reported by Mark Harig
+	<markh@frazier.landmark.com>.
 
 2000-06-20  J.T. Conklin  <jtc@redback.com>
 
@@ -4122,7 +4144,7 @@
 2000-05-24  Eli Zaretskii  <eliz@gnu.org>
 
 	* gdb.texinfo: Remove duplicate @syncodeindex.  From Brian
-        Youmans.
+	Youmans.
 
 Wed May 24 21:27:58 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
@@ -4271,8 +4293,8 @@
 
 2000-03-27  Daniel Berlin  <dan@cgsoftware.com>
 
-        * gdb.texinfo (Debugging Output): Added new section, documenting
-        the "set/show debug" commands.
+	* gdb.texinfo (Debugging Output): Added new section, documenting
+	the "set/show debug" commands.
 
 Fri Mar 24 18:06:34 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
@@ -4293,7 +4315,7 @@
 2000-03-23  Fernando Nasser  <fnasser@totem.to.cygnus.com>
 
 	From David Whedon <dwhedon@gordian.com>
-        * gdbint.texinfo : Added paragraphs about command deprecation.
+	* gdbint.texinfo : Added paragraphs about command deprecation.
 
 2000-03-22  Daniel Berlin  <dan@cgsoftware.com>
 
@@ -4746,7 +4768,7 @@
 
 Thu Apr  2 16:52:44 1998  Jason Molenda  (crash@bugshack.cygnus.com)
 
-        * LRS: Reformat a bit to keep text under 80 columns.
+	* LRS: Reformat a bit to keep text under 80 columns.
 
 Thu Apr  2 16:10:36 1998  Stan Shebs  <shebs@andros.cygnus.com>
 
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5cef05b..2920179 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -1999,6 +1999,57 @@
 This command is available when debugging locally on most targets, excluding
 @sc{djgpp}, Cygwin, MS Windows, and QNX Neutrino.
 
+@kindex set disable-randomization
+@item set disable-randomization
+@itemx set disable-randomization on
+This option (enabled by default in @value{GDBN}) will turn off the native
+randomization of the virtual address space of the started program.  This option
+is useful for multiple debugging sessions to make the execution better
+reproducible and memory addresses reusable across debugging sessions.
+
+This feature is implemented only on @sc{gnu}/Linux.  You can get the same
+behavior using
+
+@smallexample
+(@value{GDBP}) set exec-wrapper setarch `uname -m` -R
+@end smallexample
+
+@item set disable-randomization off
+Leave the behavior of the started executable unchanged.  Some bugs rear their
+ugly heads only when the program is loaded at certain addresses.  If your bug
+disappears when you run the program under @value{GDBN}, that might be because
+@value{GDBN} by default disables the address randomization on platforms, such
+as @sc{gnu}/Linux, which do that for stand-alone programs.  Use @kbd{set
+disable-randomization off} to try to reproduce such elusive bugs.
+
+The virtual address space randomization is implemented only on @sc{gnu}/Linux.
+It protects the programs against some kinds of security attacks.  In these
+cases the attacker needs to know the exact location of a concrete executable
+code.  Randomizing its location makes it impossible to inject jumps misusing
+a code at its expected addresses.
+
+Prelinking shared libraries provides a startup performance advantage but it
+makes addresses in these libraries predictable for privileged processes by
+having just unprivileged access at the target system.  Reading the shared
+library binary gives enough information for assembling the malicious code
+misusing it.  Still even a prelinked shared library can get loaded at a new
+random address just requiring the regular relocation process during the
+startup.  Shared libraries not already prelinked are always loaded at
+a randomly chosen address.
+
+Position independent executables (PIE) contain position independent code
+similar to the shared libraries and therefore such executables get loaded at
+a randomly chosen address upon startup.  PIE executables always load even
+already prelinked shared libraries at a random address.  You can build such
+executable using @command{gcc -fPIE -pie}.
+
+Heap (malloc storage), stack and custom mmap areas are always placed randomly
+(as long as the randomization is enabled).
+
+@item show disable-randomization
+Show the current setting of the explicit disable of the native randomization of
+the virtual address space of the started program.
+
 @end table
 
 @node Arguments
@@ -11482,6 +11533,22 @@
 @item show opaque-type-resolution
 Show whether opaque types are resolved or not.
 
+@kindex set print symbol-loading
+@cindex print messages when symbols are loaded
+@item set print symbol-loading
+@itemx set print symbol-loading on
+@itemx set print symbol-loading off
+The @code{set print symbol-loading} command allows you to enable or
+disable printing of messages when @value{GDBN} loads symbols.
+By default, these messages will be printed, and normally this is what
+you want.  Disabling these messages is useful when debugging applications
+with lots of shared libraries where the quantity of output can be more
+annoying than useful.
+
+@kindex show print symbol-loading
+@item show print symbol-loading
+Show whether messages will be printed when @value{GDBN} loads symbols.
+
 @kindex maint print symbols
 @cindex symbol dump
 @kindex maint print psymbols
@@ -18335,6 +18402,17 @@
 
 @table @code
 
+@item *running,thread-id="@var{thread}"
+The target is now running.  The @var{thread} field tells which
+specific thread is now running, and can be @samp{all} if all threads
+are running.  The frontend should assume that no interaction with a 
+running thread is possible after this notification is produced.
+The frontend should not assume that this notification is output
+only once for any command.  @value{GDBN} may emit this notification 
+several times, either for different threads, because it cannot resume
+all threads together, or even for a single thread, if the thread must
+be stepped though some code before letting it run freely.
+
 @item *stopped,reason="@var{reason}"
 The target has stopped.  The @var{reason} field can have one of the
 following values:
@@ -21617,8 +21695,14 @@
 The corresponding @value{GDBN} command is @samp{attach}.
 
 @subsubheading Example
-N.A.
-
+@smallexample
+(gdb)
+-target-attach 34
+=thread-created,id="1"
+*stopped,thread-id="1",frame=@{addr="0xb7f7e410",func="bar",args=[]@}
+^done
+(gdb)
+@end smallexample
 
 @subheading The @code{-target-compare-sections} Command
 @findex -target-compare-sections
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index af3835b..7d4d808 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -137,3 +137,8 @@
 The thread specified by @var{t} has exited.
 @end deftypefun
 
+@deftypefun void target_resumed (ptid_t @var{ptid})
+The target was resumed.  The @var{ptid} parameter specifies which
+thread was resume, and may be RESUME_ALL if all threads are resumed.
+@end deftypefun
+
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 3385bdb..bd1127c 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -900,7 +900,7 @@
      instruction in the associated delay slot).  This should only be
      done for "normal" frames and not for resume-type frames (signal
      handlers, sentinel frames, dummy frames).  The function
-     frame_unwind_address_in_block does just this.  It's not clear how
+     get_frame_address_in_block does just this.  It's not clear how
      reliable the method is though; there is the potential for the
      register state pre-call being different to that on return.  */
   fs->pc = get_frame_address_in_block (this_frame);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e36177a..8f1062d 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -6234,6 +6234,24 @@
 	     dwarf_form_name (form),
 	     bfd_get_filename (abfd));
     }
+
+  /* We have seen instances where the compiler tried to emit a byte
+     size attribute of -1 which ended up being encoded as an unsigned
+     0xffffffff.  Although 0xffffffff is technically a valid size value,
+     an object of this size seems pretty unlikely so we can relatively
+     safely treat these cases as if the size attribute was invalid and
+     treat them as zero by default.  */
+  if (attr->name == DW_AT_byte_size
+      && form == DW_FORM_data4
+      && DW_UNSND (attr) >= 0xffffffff)
+    {
+      complaint
+        (&symfile_complaints,
+         _("Suspicious DW_AT_byte_size value treated as zero instead of 0x%lx"),
+         DW_UNSND (attr));
+      DW_UNSND (attr) = 0;
+    }
+
   return info_ptr;
 }
 
diff --git a/gdb/event-top.c b/gdb/event-top.c
index e8e9f68..722c28e 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -32,6 +32,7 @@
 #include "exceptions.h"
 #include "cli/cli-script.h"     /* for reset_command_nest_depth */
 #include "main.h"
+#include "gdbthread.h"
 
 /* For dont_repeat() */
 #include "gdbcmd.h"
@@ -268,7 +269,7 @@
   if (!current_interp_display_prompt_p ())
     return;
 
-  if (target_executing && sync_execution)
+  if (sync_execution && is_running (inferior_ptid))
     {
       /* This is to trick readline into not trying to display the
          prompt.  Even though we display the prompt using this
@@ -424,6 +425,7 @@
       printf_unfiltered (_("error detected on stdin\n"));
       delete_file_handler (input_fd);
       discard_all_continuations ();
+      discard_all_intermediate_continuations ();
       /* If stdin died, we may as well kill gdb. */
       quit_command ((char *) 0, stdin == instream);
     }
@@ -516,7 +518,7 @@
   /* Do any commands attached to breakpoint we stopped at. Only if we
      are always running synchronously. Or if we have just executed a
      command that doesn't start the target. */
-  if (!target_can_async_p () || !target_executing)
+  if (!target_can_async_p () || !is_running (inferior_ptid))
     {
       bpstat_do_actions (&stop_bpstat);
       do_cleanups (old_chain);
diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index ad8edc8..a1dfaf3 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -23,7 +23,6 @@
 #include "gdbcmd.h"
 #include "value.h"
 #include "target.h"
-#include "gdb_stdint.h"
 
 /* Copied from bfd_put_bits.  */
 
diff --git a/gdb/findvar.c b/gdb/findvar.c
index efe5af8..1b11e59 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -494,13 +494,11 @@
     case LOC_REGISTER:
     case LOC_REGPARM_ADDR:
       {
-	struct block *b;
 	int regno = SYMBOL_VALUE (var);
 	struct value *regval;
 
 	if (frame == NULL)
 	  return 0;
-	b = get_frame_block (frame, 0);
 
 	if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
 	  {
diff --git a/gdb/frame.c b/gdb/frame.c
index 937aced..f5e0fad 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -40,6 +40,7 @@
 #include "observer.h"
 #include "objfiles.h"
 #include "exceptions.h"
+#include "gdbthread.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 
@@ -460,27 +461,24 @@
 }
 
 CORE_ADDR
-frame_func_unwind (struct frame_info *fi, enum frame_type this_type)
+get_frame_func (struct frame_info *this_frame)
 {
-  if (!fi->prev_func.p)
+  struct frame_info *next_frame = this_frame->next;
+
+  if (!next_frame->prev_func.p)
     {
       /* Make certain that this, and not the adjacent, function is
          found.  */
-      CORE_ADDR addr_in_block = frame_unwind_address_in_block (fi, this_type);
-      fi->prev_func.p = 1;
-      fi->prev_func.addr = get_pc_function_start (addr_in_block);
+      CORE_ADDR addr_in_block = get_frame_address_in_block (this_frame);
+      next_frame->prev_func.p = 1;
+      next_frame->prev_func.addr = get_pc_function_start (addr_in_block);
       if (frame_debug)
 	fprintf_unfiltered (gdb_stdlog,
-			    "{ frame_func_unwind (fi=%d) -> 0x%s }\n",
-			    fi->level, paddr_nz (fi->prev_func.addr));
+			    "{ get_frame_func (this_frame=%d) -> 0x%s }\n",
+			    this_frame->level,
+			    paddr_nz (next_frame->prev_func.addr));
     }
-  return fi->prev_func.addr;
-}
-
-CORE_ADDR
-get_frame_func (struct frame_info *fi)
-{
-  return frame_func_unwind (fi->next, get_frame_type (fi));
+  return next_frame->prev_func.addr;
 }
 
 static int
@@ -930,6 +928,9 @@
     error (_("No stack."));
   if (!target_has_memory)
     error (_("No memory."));
+  if (is_executing (inferior_ptid))
+    error (_("Target is executing."));
+
   if (current_frame == NULL)
     {
       struct frame_info *sentinel_frame =
@@ -950,6 +951,20 @@
 
 static struct frame_info *selected_frame;
 
+static int
+has_stack_frames (void)
+{
+  if (!target_has_registers || !target_has_stack || !target_has_memory)
+    return 0;
+
+  /* If the current thread is executing, don't try to read from
+     it.  */
+  if (is_executing (inferior_ptid))
+    return 0;
+
+  return 1;
+}
+
 /* Return the selected frame.  Always non-NULL (unless there isn't an
    inferior sufficient for creating a frame) in which case an error is
    thrown.  */
@@ -959,9 +974,7 @@
 {
   if (selected_frame == NULL)
     {
-      if (message != NULL && (!target_has_registers
-			      || !target_has_stack
-			      || !target_has_memory))
+      if (message != NULL && !has_stack_frames ())
 	error (("%s"), message);
       /* Hey!  Don't trust this.  It should really be re-finding the
 	 last selected frame of the currently selected thread.  This,
@@ -980,7 +993,7 @@
 struct frame_info *
 deprecated_safe_get_selected_frame (void)
 {
-  if (!target_has_registers || !target_has_stack || !target_has_memory)
+  if (!has_stack_frames ())
     return NULL;
   return get_selected_frame (NULL);
 }
@@ -1180,9 +1193,13 @@
       return this_frame->prev;
     }
 
-  /* If the frame id hasn't been built yet, it must be done before
-     setting a stop reason.  */
-  this_id = get_frame_id (this_frame);
+  /* If the frame unwinder hasn't been selected yet, we must do so
+     before setting prev_p; otherwise the check for misbehaved
+     sniffers will think that this frame's sniffer tried to unwind
+     further (see frame_cleanup_after_sniffer).  */
+  if (this_frame->unwind == NULL)
+    this_frame->unwind
+      = frame_unwind_find_by_frame (this_frame, &this_frame->prologue_cache);
 
   this_frame->prev_p = 1;
   this_frame->stop_reason = UNWIND_NO_REASON;
@@ -1190,6 +1207,7 @@
   /* Check that this frame's ID was valid.  If it wasn't, don't try to
      unwind to the prev frame.  Be careful to not apply this test to
      the sentinel frame.  */
+  this_id = get_frame_id (this_frame);
   if (this_frame->level >= 0 && !frame_id_p (this_id))
     {
       if (frame_debug)
@@ -1518,43 +1536,54 @@
   return frame_pc_unwind (frame->next);
 }
 
-/* Return an address that falls within NEXT_FRAME's caller's code
-   block, assuming that the caller is a THIS_TYPE frame.  */
-
-CORE_ADDR
-frame_unwind_address_in_block (struct frame_info *next_frame,
-			       enum frame_type this_type)
-{
-  /* A draft address.  */
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-
-  /* If NEXT_FRAME was called by a signal frame or dummy frame, then
-     we shold not adjust the unwound PC.  These frames may not call
-     their next frame in the normal way; the operating system or GDB
-     may have pushed their resume address manually onto the stack, so
-     it may be the very first instruction.  Even if the resume address
-     was not manually pushed, they expect to be returned to.  */
-  if (this_type != NORMAL_FRAME)
-    return pc;
-
-  /* If THIS frame is not inner most (i.e., NEXT isn't the sentinel),
-     and NEXT is `normal' (i.e., not a sigtramp, dummy, ....) THIS
-     frame's PC ends up pointing at the instruction following the
-     "call".  Adjust that PC value so that it falls on the call
-     instruction (which, hopefully, falls within THIS frame's code
-     block).  So far it's proved to be a very good approximation.  See
-     get_frame_type() for why ->type can't be used.  */
-  if (next_frame->level >= 0
-      && get_frame_type (next_frame) == NORMAL_FRAME)
-    --pc;
-  return pc;
-}
+/* Return an address that falls within THIS_FRAME's code block.  */
 
 CORE_ADDR
 get_frame_address_in_block (struct frame_info *this_frame)
 {
-  return frame_unwind_address_in_block (this_frame->next,
-					get_frame_type (this_frame));
+  /* A draft address.  */
+  CORE_ADDR pc = get_frame_pc (this_frame);
+
+  struct frame_info *next_frame = this_frame->next;
+
+  /* Calling get_frame_pc returns the resume address for THIS_FRAME.
+     Normally the resume address is inside the body of the function
+     associated with THIS_FRAME, but there is a special case: when
+     calling a function which the compiler knows will never return
+     (for instance abort), the call may be the very last instruction
+     in the calling function.  The resume address will point after the
+     call and may be at the beginning of a different function
+     entirely.
+
+     If THIS_FRAME is a signal frame or dummy frame, then we should
+     not adjust the unwound PC.  For a dummy frame, GDB pushed the
+     resume address manually onto the stack.  For a signal frame, the
+     OS may have pushed the resume address manually and invoked the
+     handler (e.g. GNU/Linux), or invoked the trampoline which called
+     the signal handler - but in either case the signal handler is
+     expected to return to the trampoline.  So in both of these
+     cases we know that the resume address is executable and
+     related.  So we only need to adjust the PC if THIS_FRAME
+     is a normal function.
+
+     If the program has been interrupted while THIS_FRAME is current,
+     then clearly the resume address is inside the associated
+     function.  There are three kinds of interruption: debugger stop
+     (next frame will be SENTINEL_FRAME), operating system
+     signal or exception (next frame will be SIGTRAMP_FRAME),
+     or debugger-induced function call (next frame will be
+     DUMMY_FRAME).  So we only need to adjust the PC if
+     NEXT_FRAME is a normal function.
+
+     We check the type of NEXT_FRAME first, since it is already
+     known; frame type is determined by the unwinder, and since
+     we have THIS_FRAME we've already selected an unwinder for
+     NEXT_FRAME.  */
+  if (get_frame_type (next_frame) == NORMAL_FRAME
+      && get_frame_type (this_frame) == NORMAL_FRAME)
+    return pc - 1;
+
+  return pc;
 }
 
 static int
@@ -1734,22 +1763,18 @@
 CORE_ADDR
 get_frame_sp (struct frame_info *this_frame)
 {
-  return frame_sp_unwind (this_frame->next);
-}
-
-CORE_ADDR
-frame_sp_unwind (struct frame_info *next_frame)
-{
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   /* Normality - an architecture that provides a way of obtaining any
      frame inner-most address.  */
   if (gdbarch_unwind_sp_p (gdbarch))
-    return gdbarch_unwind_sp (gdbarch, next_frame);
+    /* NOTE drow/2008-06-28: gdbarch_unwind_sp could be converted to
+       operate on THIS_FRAME now.  */
+    return gdbarch_unwind_sp (gdbarch, this_frame->next);
   /* Now things are really are grim.  Hope that the value returned by
      the gdbarch_sp_regnum register is meaningful.  */
   if (gdbarch_sp_regnum (gdbarch) >= 0)
-    return frame_unwind_register_unsigned (next_frame,
-					   gdbarch_sp_regnum (gdbarch));
+    return get_frame_register_unsigned (this_frame,
+					gdbarch_sp_regnum (gdbarch));
   internal_error (__FILE__, __LINE__, _("Missing unwind SP method"));
 }
 
@@ -1817,7 +1842,7 @@
   /* Clear cached fields dependent on the unwinder.
 
      The previous PC is independent of the unwinder, but the previous
-     function is not (see frame_unwind_address_in_block).  */
+     function is not (see get_frame_address_in_block).  */
   frame->prev_func.p = 0;
   frame->prev_func.addr = 0;
 
diff --git a/gdb/frame.h b/gdb/frame.h
index d2eb5dd..3e8f023 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -99,7 +99,7 @@
      lifetime of the frame.  While the PC (a.k.a. resume address)
      changes as the function is executed, this code address cannot.
      Typically, it is set to the address of the entry point of the
-     frame's function (as returned by frame_func_unwind().  
+     frame's function (as returned by get_frame_func).
 
      This field is valid only if code_addr_p is true.  Otherwise, this
      frame is considered to have a wildcard code address, i.e. one that
@@ -281,30 +281,16 @@
 
 extern CORE_ADDR get_frame_address_in_block (struct frame_info *this_frame);
 
-/* Similar to get_frame_address_in_block, find an address in the
-   block which logically called NEXT_FRAME, assuming it is a THIS_TYPE
-   frame.  */
-
-extern CORE_ADDR frame_unwind_address_in_block (struct frame_info *next_frame,
-						enum frame_type this_type);
-
 /* The frame's inner-most bound.  AKA the stack-pointer.  Confusingly
    known as top-of-stack.  */
 
 extern CORE_ADDR get_frame_sp (struct frame_info *);
-extern CORE_ADDR frame_sp_unwind (struct frame_info *);
-
 
 /* Following on from the `resume' address.  Return the entry point
    address of the function containing that resume address, or zero if
    that function isn't known.  */
 extern CORE_ADDR get_frame_func (struct frame_info *fi);
 
-/* Similar to get_frame_func, find the start of the function which
-   logically called NEXT_FRAME, assuming it is a THIS_TYPE frame.  */
-extern CORE_ADDR frame_func_unwind (struct frame_info *next_frame,
-				    enum frame_type this_type);
-
 /* Closely related to the resume address, various symbol table
    attributes that are determined by the PC.  Note that for a normal
    frame, the PC refers to the resume address after the return, and
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index d2a5977..015ac53 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -165,7 +165,7 @@
       } __attribute__((aligned(8)));  */
 
 static LONGEST
-frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno,
+frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
                                CORE_ADDR *sc_addr_cache_ptr)
 {
   CORE_ADDR sc_addr;
@@ -180,10 +180,10 @@
       char buf[4];
       int tramp_type;
 
-      pc = frame_pc_unwind (next_frame);
+      pc = get_frame_pc (this_frame);
       tramp_type = frv_linux_pc_in_sigtramp (pc, 0);
 
-      frame_unwind_register (next_frame, sp_regnum, buf);
+      get_frame_register (this_frame, sp_regnum, buf);
       sp = extract_unsigned_integer (buf, sizeof buf);
 
       if (tramp_type == NORMAL_SIGTRAMP)
@@ -253,10 +253,10 @@
 /* Signal trampolines.  */
 
 static struct trad_frame_cache *
-frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
+frv_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct trad_frame_cache *cache;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
   CORE_ADDR addr;
   char buf[4];
   int regnum;
@@ -266,20 +266,20 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = trad_frame_cache_zalloc (next_frame);
+  cache = trad_frame_cache_zalloc (this_frame);
 
   /* FIXME: cagney/2004-05-01: This is is long standing broken code.
      The frame ID's code address should be the start-address of the
      signal trampoline and not the current PC within that
      trampoline.  */
-  frame_unwind_register (next_frame, sp_regnum, buf);
+  get_frame_register (this_frame, sp_regnum, buf);
   this_id = frame_id_build (extract_unsigned_integer (buf, sizeof buf),
-			    frame_pc_unwind (next_frame));
+			    get_frame_pc (this_frame));
   trad_frame_set_id (cache, this_id);
 
   for (regnum = 0; regnum < frv_num_regs; regnum++)
     {
-      LONGEST reg_addr = frv_linux_sigcontext_reg_addr (next_frame, regnum,
+      LONGEST reg_addr = frv_linux_sigcontext_reg_addr (this_frame, regnum,
 							&sc_addr_cache_val);
       if (reg_addr != -1)
 	trad_frame_set_reg_addr (cache, regnum, reg_addr);
@@ -290,48 +290,47 @@
 }
 
 static void
-frv_linux_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
+frv_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
 			     struct frame_id *this_id)
 {
   struct trad_frame_cache *cache =
-    frv_linux_sigtramp_frame_cache (next_frame, this_cache);
+    frv_linux_sigtramp_frame_cache (this_frame, this_cache);
   trad_frame_get_id (cache, this_id);
 }
 
-static void
-frv_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
-				   void **this_cache,
-				   int regnum, int *optimizedp,
-				   enum lval_type *lvalp, CORE_ADDR *addrp,
-				   int *realnump, gdb_byte *valuep)
+static struct value *
+frv_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
+					void **this_cache, int regnum)
 {
   /* Make sure we've initialized the cache.  */
   struct trad_frame_cache *cache =
-    frv_linux_sigtramp_frame_cache (next_frame, this_cache);
-  trad_frame_get_register (cache, next_frame, regnum, optimizedp, lvalp,
-			   addrp, realnump, valuep);
+    frv_linux_sigtramp_frame_cache (this_frame, this_cache);
+  return trad_frame_get_register (cache, this_frame, regnum);
+}
+
+static int
+frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
+				  struct frame_info *this_frame,
+				  void **this_cache)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  char *name;
+
+  find_pc_partial_function (pc, &name, NULL, NULL);
+  if (frv_linux_pc_in_sigtramp (pc, name))
+    return 1;
+
+  return 0;
 }
 
 static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
 {
   SIGTRAMP_FRAME,
   frv_linux_sigtramp_frame_this_id,
-  frv_linux_sigtramp_frame_prev_register
+  frv_linux_sigtramp_frame_prev_register,
+  NULL,
+  frv_linux_sigtramp_frame_sniffer
 };
-
-static const struct frame_unwind *
-frv_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  char *name;
-
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  if (frv_linux_pc_in_sigtramp (pc, name))
-    return &frv_linux_sigtramp_frame_unwind;
-
-  return NULL;
-}
-
 
 /* The FRV kernel defines ELF_NGREG as 46.  We add 2 in order to include
    the loadmap addresses in the register set.  (See below for more info.)  */
@@ -485,7 +484,7 @@
 frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   /* Set the sigtramp frame sniffer.  */
-  frame_unwind_append_sniffer (gdbarch, frv_linux_sigtramp_frame_sniffer); 
+  frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind); 
   set_gdbarch_regset_from_core_section (gdbarch,
                                         frv_linux_regset_from_core_section);
 }
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index a6bbf03..7c79420 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -510,7 +510,7 @@
    arguments in any frame but the top, you'll need to do this serious
    prologue analysis.  */
 static CORE_ADDR
-frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame,
+frv_analyze_prologue (CORE_ADDR pc, struct frame_info *this_frame,
                       struct frv_unwind_cache *info)
 {
   /* When writing out instruction bitpatterns, we use the following
@@ -579,9 +579,9 @@
 
   /* If we have a frame, we don't want to scan past the frame's pc.  This
      will catch those cases where the pc is in the prologue.  */
-  if (next_frame)
+  if (this_frame)
     {
-      CORE_ADDR frame_pc = frame_pc_unwind (next_frame);
+      CORE_ADDR frame_pc = get_frame_pc (this_frame);
       if (frame_pc < lim_pc)
 	lim_pc = frame_pc;
     }
@@ -927,7 +927,7 @@
       pc = next_pc;
     }
 
-  if (next_frame && info)
+  if (this_frame && info)
     {
       int i;
       ULONGEST this_base;
@@ -938,9 +938,9 @@
          because instructions may save relative to the SP, but we need
          their addresses relative to the FP.  */
       if (fp_set)
-	this_base = frame_unwind_register_unsigned (next_frame, fp_regnum);
+	this_base = get_frame_register_unsigned (this_frame, fp_regnum);
       else
-	this_base = frame_unwind_register_unsigned (next_frame, sp_regnum);
+	this_base = get_frame_register_unsigned (this_frame, sp_regnum);
 
       for (i = 0; i < 64; i++)
 	if (gr_saved[i])
@@ -1000,10 +1000,10 @@
 
 
 static struct frv_unwind_cache *
-frv_frame_unwind_cache (struct frame_info *next_frame,
+frv_frame_unwind_cache (struct frame_info *this_frame,
 			 void **this_prologue_cache)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR pc;
   ULONGEST this_base;
   struct frv_unwind_cache *info;
@@ -1013,11 +1013,10 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache);
   (*this_prologue_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Prologue analysis does the rest...  */
-  frv_analyze_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
-			next_frame, info);
+  frv_analyze_prologue (get_frame_func (this_frame), this_frame, info);
 
   return info;
 }
@@ -1350,18 +1349,18 @@
    frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-frv_frame_this_id (struct frame_info *next_frame,
+frv_frame_this_id (struct frame_info *this_frame,
 		    void **this_prologue_cache, struct frame_id *this_id)
 {
   struct frv_unwind_cache *info
-    = frv_frame_unwind_cache (next_frame, this_prologue_cache);
+    = frv_frame_unwind_cache (this_frame, this_prologue_cache);
   CORE_ADDR base;
   CORE_ADDR func;
   struct minimal_symbol *msym_stack;
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame, NORMAL_FRAME);
+  func = get_frame_func (this_frame);
 
   /* Check if the stack is empty.  */
   msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
@@ -1379,36 +1378,28 @@
   (*this_id) = id;
 }
 
-static void
-frv_frame_prev_register (struct frame_info *next_frame,
-			  void **this_prologue_cache,
-			  int regnum, int *optimizedp,
-			  enum lval_type *lvalp, CORE_ADDR *addrp,
-			  int *realnump, gdb_byte *bufferp)
+static struct value *
+frv_frame_prev_register (struct frame_info *this_frame,
+			 void **this_prologue_cache, int regnum)
 {
   struct frv_unwind_cache *info
-    = frv_frame_unwind_cache (next_frame, this_prologue_cache);
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, bufferp);
+    = frv_frame_unwind_cache (this_frame, this_prologue_cache);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
 static const struct frame_unwind frv_frame_unwind = {
   NORMAL_FRAME,
   frv_frame_this_id,
-  frv_frame_prev_register
+  frv_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-frv_frame_sniffer (struct frame_info *next_frame)
-{
-  return &frv_frame_unwind;
-}
-
 static CORE_ADDR
-frv_frame_base_address (struct frame_info *next_frame, void **this_cache)
+frv_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
   struct frv_unwind_cache *info
-    = frv_frame_unwind_cache (next_frame, this_cache);
+    = frv_frame_unwind_cache (this_frame, this_cache);
   return info->base;
 }
 
@@ -1426,16 +1417,15 @@
 }
 
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
+   frame.  The frame ID's base needs to match the TOS value saved by
+   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
 
 static struct frame_id
-frv_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+frv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (frv_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, sp_regnum);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 static struct gdbarch *
@@ -1527,7 +1517,7 @@
 
   /* Settings for calling functions in the inferior.  */
   set_gdbarch_push_dummy_call (gdbarch, frv_push_dummy_call);
-  set_gdbarch_unwind_dummy_id (gdbarch, frv_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, frv_dummy_id);
 
   /* Settings that should be unnecessary.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -1569,7 +1559,7 @@
   gdbarch_init_osabi (info, gdbarch);
 
   /* Set the fallback (prologue based) frame sniffer.  */
-  frame_unwind_append_sniffer (gdbarch, frv_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &frv_frame_unwind);
 
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h
index 2590387..2621f6b 100644
--- a/gdb/gdb_thread_db.h
+++ b/gdb/gdb_thread_db.h
@@ -2,15 +2,6 @@
 #include <thread_db.h>
 #else
 
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-typedef uint32_t gdb_uint32_t;
-#define GDB_UINT32_C(c)	UINT32_C(c)
-#else
-typedef unsigned int gdb_uint32_t;
-#define GDB_UINT32_C(c)	c ## U
-#endif
-
 /* Copyright (C) 1999, 2000, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -119,14 +110,14 @@
 /* Bitmask of enabled events. */
 typedef struct td_thr_events
 {
-  gdb_uint32_t event_bits[TD_EVENTSIZE];
+  uint32_t event_bits[TD_EVENTSIZE];
 } td_thr_events_t;
 
 /* Event set manipulation macros. */
 #define __td_eventmask(n) \
-  (GDB_UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+  (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
 #define __td_eventword(n) \
-  ((GDB_UINT32_C ((n) - 1)) >> BT_UISHIFT)
+  ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
 
 #define td_event_emptyset(setp) \
   do {									      \
@@ -139,7 +130,7 @@
   do {									      \
     int __i;								      \
     for (__i = TD_EVENTSIZE; __i > 0; --__i)				      \
-      (setp)->event_bits[__i - 1] = GDB_UINT32_C (0xffffffff);		      \
+      (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff);		      \
   } while (0)
 
 #define td_event_addset(setp, n) \
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 6594b35..3a967a9 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -183,6 +183,7 @@
   gdbarch_integer_to_address_ftype *integer_to_address;
   gdbarch_return_value_ftype *return_value;
   gdbarch_skip_prologue_ftype *skip_prologue;
+  gdbarch_skip_main_prologue_ftype *skip_main_prologue;
   gdbarch_inner_than_ftype *inner_than;
   gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
   gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address;
@@ -313,6 +314,7 @@
   0,  /* integer_to_address */
   0,  /* return_value */
   0,  /* skip_prologue */
+  0,  /* skip_main_prologue */
   0,  /* inner_than */
   0,  /* breakpoint_from_pc */
   0,  /* adjust_breakpoint_address */
@@ -561,6 +563,7 @@
   /* Skip verify of return_value, has predicate */
   if (gdbarch->skip_prologue == 0)
     fprintf_unfiltered (log, "\n\tskip_prologue");
+  /* Skip verify of skip_main_prologue, has predicate */
   if (gdbarch->inner_than == 0)
     fprintf_unfiltered (log, "\n\tinner_than");
   if (gdbarch->breakpoint_from_pc == 0)
@@ -999,6 +1002,12 @@
                       "gdbarch_dump: single_step_through_delay = <0x%lx>\n",
                       (long) gdbarch->single_step_through_delay);
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
+                      gdbarch_skip_main_prologue_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: skip_main_prologue = <0x%lx>\n",
+                      (long) gdbarch->skip_main_prologue);
+  fprintf_unfiltered (file,
                       "gdbarch_dump: gdbarch_skip_permanent_breakpoint_p() = %d\n",
                       gdbarch_skip_permanent_breakpoint_p (gdbarch));
   fprintf_unfiltered (file,
@@ -2123,6 +2132,30 @@
 }
 
 int
+gdbarch_skip_main_prologue_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->skip_main_prologue != NULL;
+}
+
+CORE_ADDR
+gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->skip_main_prologue != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_main_prologue called\n");
+  return gdbarch->skip_main_prologue (gdbarch, ip);
+}
+
+void
+set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch,
+                              gdbarch_skip_main_prologue_ftype skip_main_prologue)
+{
+  gdbarch->skip_main_prologue = skip_main_prologue;
+}
+
+int
 gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
 {
   gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 44d1f2d..cede826 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -379,6 +379,12 @@
 extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
 extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue);
 
+extern int gdbarch_skip_main_prologue_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_skip_main_prologue_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
+extern CORE_ADDR gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
+extern void set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, gdbarch_skip_main_prologue_ftype *skip_main_prologue);
+
 typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
 extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
 extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index a38ba03..d33fd7d 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -482,6 +482,7 @@
 M:enum return_value_convention:return_value:struct type *functype, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf:functype, valtype, regcache, readbuf, writebuf
 
 m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0
+M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip
 f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
 m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
 M:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index c9ef3ab..77993c4 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,32 @@
+2008-07-12  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* linux-low.c (handle_extended_wait): Do not use "status"
+	variable uninitialized.
+
+2008-07-07  Pedro Alves  <pedro@codesourcery.com>
+
+	* server.c (handle_v_attach): Inhibit reporting dll changes.
+
+2008-06-27  Pedro Alves  <pedro@codesourcery.com>
+
+	* remote-utils.c (prepare_resume_reply): If requested, don't
+	output "thread:TID" in the T stop reply.
+
+	* server.c (disable_packet_vCont, disable_packet_Tthread)
+	(disable_packet_qC, disable_packet_qfThreadInfo): New globals.
+	(handle_query): If requested, disable support for qC, qfThreadInfo
+	and qsThreadInfo.
+	(handle_v_requests): If requested, disable support for vCont.
+	(gdbserver_show_disableable): New.
+	(main): Handle --disable-packet and --disable-packet=LIST.
+
+	* server.h (disable_packet_vCont, disable_packet_Tthread)
+	(disable_packet_qC, disable_packet_qfThreadInfo): Declare.
+
+2008-06-20  Carlos O'Donell  <carlos@codesourcery.com>
+
+	* server.c (gdbserver_usage): Mention --version.
+
 2008-06-06  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* Makefile.in (gdbreplay.o): New rule.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index b41e679..956b45c 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -149,7 +149,7 @@
   if (event == PTRACE_EVENT_CLONE)
     {
       unsigned long new_pid;
-      int ret, status;
+      int ret, status = W_STOPCODE (SIGSTOP);
 
       ptrace (PTRACE_GETEVENTMSG, inferior_pid, 0, &new_pid);
 
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 16d5442..e062be8 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -944,7 +944,7 @@
 	 Since thread support relies on qSymbol support anyway, assume GDB can handle
 	 threads.  */
 
-      if (using_threads)
+      if (using_threads && !disable_packet_Tthread)
 	{
 	  unsigned int gdb_id_from_wait;
 
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 57f5500..da9d83c 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -67,6 +67,14 @@
 /* TERMINAL_FD's original foreground group.  */
 pid_t old_foreground_pgrp;
 
+/* Set if you want to disable optional thread related packets support
+   in gdbserver, for the sake of testing GDB against stubs that don't
+   support them.  */
+int disable_packet_vCont;
+int disable_packet_Tthread;
+int disable_packet_qC;
+int disable_packet_qfThreadInfo;
+
 /* Hand back terminal ownership to the original foreground group.  */
 
 static void
@@ -475,12 +483,12 @@
   static struct inferior_list_entry *thread_ptr;
 
   /* Reply the current thread id.  */
-  if (strcmp ("qC", own_buf) == 0)
+  if (strcmp ("qC", own_buf) == 0 && !disable_packet_qC)
     {
       require_running (own_buf);
       thread_ptr = all_threads.head;
       sprintf (own_buf, "QC%x",
-	thread_to_gdb_id ((struct thread_info *)thread_ptr));
+	       thread_to_gdb_id ((struct thread_info *)thread_ptr));
       return;
     }
 
@@ -493,28 +501,31 @@
       return;
     }
 
-  if (strcmp ("qfThreadInfo", own_buf) == 0)
+  if (!disable_packet_qfThreadInfo)
     {
-      require_running (own_buf);
-      thread_ptr = all_threads.head;
-      sprintf (own_buf, "m%x", thread_to_gdb_id ((struct thread_info *)thread_ptr));
-      thread_ptr = thread_ptr->next;
-      return;
-    }
-
-  if (strcmp ("qsThreadInfo", own_buf) == 0)
-    {
-      require_running (own_buf);
-      if (thread_ptr != NULL)
+      if (strcmp ("qfThreadInfo", own_buf) == 0)
 	{
+	  require_running (own_buf);
+	  thread_ptr = all_threads.head;
 	  sprintf (own_buf, "m%x", thread_to_gdb_id ((struct thread_info *)thread_ptr));
 	  thread_ptr = thread_ptr->next;
 	  return;
 	}
-      else
+
+      if (strcmp ("qsThreadInfo", own_buf) == 0)
 	{
-	  sprintf (own_buf, "l");
-	  return;
+	  require_running (own_buf);
+	  if (thread_ptr != NULL)
+	    {
+	      sprintf (own_buf, "m%x", thread_to_gdb_id ((struct thread_info *)thread_ptr));
+	      thread_ptr = thread_ptr->next;
+	      return;
+	    }
+	  else
+	    {
+	      sprintf (own_buf, "l");
+	      return;
+	    }
 	}
     }
 
@@ -1013,6 +1024,11 @@
   pid = strtol (own_buf + 8, NULL, 16);
   if (pid != 0 && attach_inferior (pid, status, signal) == 0)
     {
+      /* Don't report shared library events after attaching, even if
+	 some libraries are preloaded.  GDB will always poll the
+	 library list.  Avoids the "stopped by shared library event"
+	 notice on the GDB side.  */
+      dlls_changed = 0;
       prepare_resume_reply (own_buf, *status, *signal);
       return 1;
     }
@@ -1098,17 +1114,20 @@
 handle_v_requests (char *own_buf, char *status, int *signal,
 		   int packet_len, int *new_packet_len)
 {
-  if (strncmp (own_buf, "vCont;", 6) == 0)
+  if (!disable_packet_vCont)
     {
-      require_running (own_buf);
-      handle_v_cont (own_buf, status, signal);
-      return;
-    }
+      if (strncmp (own_buf, "vCont;", 6) == 0)
+	{
+	  require_running (own_buf);
+	  handle_v_cont (own_buf, status, signal);
+	  return;
+	}
 
-  if (strncmp (own_buf, "vCont?", 6) == 0)
-    {
-      strcpy (own_buf, "vCont;c;C;s;S");
-      return;
+      if (strncmp (own_buf, "vCont?", 6) == 0)
+	{
+	  strcpy (own_buf, "vCont;c;C;s;S");
+	  return;
+	}
     }
 
   if (strncmp (own_buf, "vFile:", 6) == 0
@@ -1197,11 +1216,24 @@
 	   "\n"
 	   "Options:\n"
 	   "  --debug\t\tEnable debugging output.\n"
+	   "  --version\t\tDisplay version information and exit.\n"
 	   "  --wrapper WRAPPER --\tRun WRAPPER to start new programs.\n");
   if (REPORT_BUGS_TO[0] && stream == stdout)
     fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO);
 }
 
+static void
+gdbserver_show_disableable (FILE *stream)
+{
+  fprintf (stream, "Disableable packets:\n"
+	   "  vCont       \tAll vCont packets\n"
+	   "  qC          \tQuerying the current thread\n"
+	   "  qfThreadInfo\tThread listing\n"
+	   "  Tthread     \tPassing the thread specifier in the T stop reply packet\n"
+	   "  threads     \tAll of the above\n");
+}
+
+
 #undef require_running
 #define require_running(BUF)			\
   if (!target_running ())			\
@@ -1262,6 +1294,46 @@
 	}
       else if (strcmp (*next_arg, "--debug") == 0)
 	debug_threads = 1;
+      else if (strcmp (*next_arg, "--disable-packet") == 0)
+	{
+	  gdbserver_show_disableable (stdout);
+	  exit (0);
+	}
+      else if (strncmp (*next_arg,
+			"--disable-packet=",
+			sizeof ("--disable-packet=") - 1) == 0)
+	{
+	  char *packets, *tok;
+
+	  packets = *next_arg += sizeof ("--disable-packet=") - 1;
+	  for (tok = strtok (packets, ",");
+	       tok != NULL;
+	       tok = strtok (NULL, ","))
+	    {
+	      if (strcmp ("vCont", tok) == 0)
+		disable_packet_vCont = 1;
+	      else if (strcmp ("Tthread", tok) == 0)
+		disable_packet_Tthread = 1;
+	      else if (strcmp ("qC", tok) == 0)
+		disable_packet_qC = 1;
+	      else if (strcmp ("qfThreadInfo", tok) == 0)
+		disable_packet_qfThreadInfo = 1;
+	      else if (strcmp ("threads", tok) == 0)
+		{
+		  disable_packet_vCont = 1;
+		  disable_packet_Tthread = 1;
+		  disable_packet_qC = 1;
+		  disable_packet_qfThreadInfo = 1;
+		}
+	      else
+		{
+		  fprintf (stderr, "Don't know how to disable \"%s\".\n\n",
+			   tok);
+		  gdbserver_show_disableable (stderr);
+		  exit (1);
+		}
+	    }
+	}
       else
 	{
 	  fprintf (stderr, "Unknown argument: %s\n", *next_arg);
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index d0520d2..aedd14a 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -156,6 +156,11 @@
 
 extern jmp_buf toplevel;
 
+extern int disable_packet_vCont;
+extern int disable_packet_Tthread;
+extern int disable_packet_qC;
+extern int disable_packet_qfThreadInfo;
+
 /* Functions from hostio.c.  */
 extern int handle_vFile (char *, int, int *);
 
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 5f9e985..f283865 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -22,17 +22,12 @@
 #ifndef GDBTHREAD_H
 #define GDBTHREAD_H
 
-struct breakpoint;
-struct frame_id;
 struct symtab;
 
-/* For bpstat */
 #include "breakpoint.h"
-
-/* For struct frame_id.  */
 #include "frame.h"
-
 #include "ui-out.h"
+#include "inferior.h"
 
 struct thread_info
 {
@@ -41,6 +36,31 @@
 				    In fact, this may be overloaded with 
 				    kernel thread id, etc.  */
   int num;			/* Convenient handle (GDB thread id) */
+
+  /* Non-zero means the thread is executing.  Note: this is different
+     from saying that there is an active target and we are stopped at
+     a breakpoint, for instance.  This is a real indicator whether the
+     thread is off and running.  */
+  /* This field is internal to thread.c.  Never access it directly,
+     use is_executing instead.  */
+  int executing_;
+
+  /* Frontend view of the thread state.  Note that the RUNNING/STOPPED
+     states are different from EXECUTING.  When the thread is stopped
+     internally while handling an internal event, like a software
+     single-step breakpoint, EXECUTING will be false, but running will
+     still be true.  As a possible future extension, this could turn
+     into enum { stopped, exited, stepping, finishing, until(ling),
+     running ... }  */
+  /* This field is internal to thread.c.  Never access it directly,
+     use is_running instead.  */
+  int state_;
+
+  /* If this is > 0, then it means there's code out there that relies
+     on this thread being listed.  Don't delete it from the lists even
+     if we detect it exiting.  */
+  int refcount;
+
   /* State from wait_for_inferior */
   CORE_ADDR prev_pc;
   struct breakpoint *step_resume_breakpoint;
@@ -63,6 +83,20 @@
      when we finally do stop stepping.  */
   bpstat stepping_through_solib_catchpoints;
 
+  /* The below are only per-thread in non-stop mode.  */
+  /* Per-thread command support.  */
+  struct continuation *continuations;
+  struct continuation *intermediate_continuations;
+  int proceed_to_finish;
+  enum step_over_calls_kind step_over_calls;
+  int stop_step;
+  int step_multi;
+
+  enum target_signal stop_signal;
+  /* Used in continue_command to set the proceed count of the
+     breakpoint the thread stopped at.  */
+  bpstat stop_bpstat;
+
   /* Private data used by the target vector implementation.  */
   struct private_thread_info *private;
 };
@@ -87,6 +121,11 @@
 /* Delete an existing thread list entry.  */
 extern void delete_thread (ptid_t);
 
+/* Delete an existing thread list entry, and be quiet about it.  Used
+   after the process this thread having belonged to having already
+   exited, for example.  */
+extern void delete_thread_silent (ptid_t);
+
 /* Delete a step_resume_breakpoint from the thread database. */
 extern void delete_step_resume_breakpoint (void *);
 
@@ -109,11 +148,16 @@
 /* Search function to lookup a thread by 'pid'.  */
 extern struct thread_info *find_thread_pid (ptid_t ptid);
 
+/* Find thread by GDB user-visible thread number.  */
+struct thread_info *find_thread_id (int num);
+
 /* Iterator function to call a user-provided callback function
    once for each known thread.  */
 typedef int (*thread_callback_func) (struct thread_info *, void *);
 extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
 
+extern int thread_count (void);
+
 /* infrun context switch: save the debugger state for the given thread.  */
 extern void save_infrun_state (ptid_t ptid,
 			       CORE_ADDR prev_pc,
@@ -126,7 +170,15 @@
 			       int       stepping_through_solib_after_catch,
 			       bpstat    stepping_through_solib_catchpoints,
 			       int       current_line,
-			       struct symtab *current_symtab);
+			       struct symtab *current_symtab,
+			       struct continuation *continuations,
+			       struct continuation *intermediate_continuations,
+			       int proceed_to_finish,
+			       enum step_over_calls_kind step_over_calls,
+			       int stop_step,
+			       int step_multi,
+			       enum target_signal stop_signal,
+			       bpstat stop_bpstat);
 
 /* infrun context switch: load the debugger state previously saved
    for the given thread.  */
@@ -138,14 +190,46 @@
 			       CORE_ADDR *step_range_end,
 			       struct frame_id *step_frame_id,
 			       int       *another_trap,
-			       int       *stepping_through_solib_affter_catch,
+			       int       *stepping_through_solib_after_catch,
 			       bpstat    *stepping_through_solib_catchpoints,
 			       int       *current_line,
-			       struct symtab **current_symtab);
+			       struct symtab **current_symtab,
+			       struct continuation **continuations,
+			       struct continuation **intermediate_continuations,
+			       int *proceed_to_finish,
+			       enum step_over_calls_kind *step_over_calls,
+			       int *stop_step,
+			       int *step_multi,
+			       enum target_signal *stop_signal,
+			       bpstat *stop_bpstat);
 
 /* Switch from one thread to another.  */
 extern void switch_to_thread (ptid_t ptid);
 
+/* Marks thread PTID is running, or stopped. 
+   If PIDGET (PTID) is -1, marks all threads.  */
+extern void set_running (ptid_t ptid, int running);
+
+/* Reports if thread PTID is known to be running right now.  */
+extern int is_running (ptid_t ptid);
+
+/* Reports if any thread is known to be running right now.  */
+extern int any_running (void);
+
+/* Is this thread listed, but known to have exited?  We keep it listed
+   (but not visible) until it's safe to delete.  */
+extern int is_exited (ptid_t ptid);
+
+/* Is this thread stopped?  */
+extern int is_stopped (ptid_t ptid);
+
+/* Marks thread PTID as executing, or as stopped.
+   If PIDGET (PTID) is -1, marks all threads.  */
+extern void set_executing (ptid_t ptid, int executing);
+
+/* Reports if thread PTID is executing.  */
+extern int is_executing (ptid_t ptid);
+
 /* Commands with a prefix of `thread'.  */
 extern struct cmd_list_element *thread_cmd_list;
 
@@ -155,8 +239,7 @@
 
 extern void print_thread_info (struct ui_out *uiout, int thread);
 
-extern struct cleanup *make_cleanup_restore_current_thread (ptid_t,
-                                                            struct frame_id);
+extern struct cleanup *make_cleanup_restore_current_thread (void);
 
 
 #endif /* GDBTHREAD_H */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 970f663..96531a8 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2216,7 +2216,7 @@
 }
 
 static void
-gnu_stop (void)
+gnu_stop (ptid_t ptid)
 {
   error (_("to_stop target function not implemented"));
 }
@@ -2556,7 +2556,7 @@
   if (proc_is_task (proc))
     sprintf (tid_str, "process %d", proc->inf->pid);
   else
-    sprintf (tid_str, "thread %d.%d",
+    sprintf (tid_str, "Thread %d.%d",
 	     proc->inf->pid, pid_to_thread_id (MERGEPID (proc->tid, 0)));
   return tid_str;
 }
@@ -2592,6 +2592,7 @@
   gnu_ops.to_doc = "GNU Hurd process";	/* to_doc */
   gnu_ops.to_open = gnu_open;		/* to_open */
   gnu_ops.to_attach = gnu_attach;	/* to_attach */
+  gnu_ops.to_attach_no_wait = 1;	/* to_attach_no_wait */
   gnu_ops.to_detach = gnu_detach;	/* to_detach */
   gnu_ops.to_resume = gnu_resume;	/* to_resume */
   gnu_ops.to_wait = gnu_wait;		/* to_wait */
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 5173251..d4744a8 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -181,7 +181,7 @@
 			     struct mem_attrib *attrib,
 			     struct target_ops *target);
 static void go32_files_info (struct target_ops *target);
-static void go32_stop (void);
+static void go32_stop (ptid_t);
 static void go32_kill_inferior (void);
 static void go32_create_inferior (char *exec_file, char *args, char **env, int from_tty);
 static void go32_mourn_inferior (void);
@@ -560,7 +560,7 @@
 }
 
 static void
-go32_stop (void)
+go32_stop (ptid_t ptid)
 {
   normal_stop ();
   cleanup_client ();
@@ -593,7 +593,7 @@
 
   if (prog_has_started)
     {
-      go32_stop ();
+      go32_stop (inferior_ptid);
       go32_kill_inferior ();
     }
   resume_signal = -1;
diff --git a/gdb/gstdint.h b/gdb/gstdint.h
new file mode 100644
index 0000000..a0422f5
--- /dev/null
+++ b/gdb/gstdint.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* The libdecnumber library, on which GDB depends, includes a header file
+   called gstdint.h instead of relying directly on stdint.h.  GDB, on the
+   other hand, includes stdint.h directly, relying on the fact that gnulib
+   generates a copy if the system doesn't provide one or if it is missing
+   some features.  Unfortunately, gstdint.h and stdint.h cannot be included
+   at the same time, which may happen when we include a file from
+   libdecnumber.
+
+   The purpose of this file is to override the libdecnumber/gstdint.h file
+   to use stdint.h instead.  Thanks to the order of our include path,
+   files from the GDB source tree have precedence over files from our
+   dependencies.  So the presence of this file will ensure that we
+   consistently use the same stdint.h file when compiling GDB source
+   files.  */
+
+#include <stdint.h>
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 4b78d8d..1d52553 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -107,10 +107,10 @@
 }
 
 static struct frame_id
-h8300_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+h8300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (h8300_unwind_sp (gdbarch, next_frame),
-  			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 /* Normal frames.  */
@@ -420,9 +420,9 @@
 }
 
 static struct h8300_frame_cache *
-h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
+h8300_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct h8300_frame_cache *cache;
   char buf[4];
   int i;
@@ -441,14 +441,14 @@
      optional.  For these "frameless" functions the frame pointer is
      actually the frame pointer of the calling frame.  */
 
-  cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
   if (cache->base == 0)
     return cache;
 
   cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
 
-  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
-  current_pc = frame_pc_unwind (next_frame);
+  cache->pc = get_frame_func (this_frame);
+  current_pc = get_frame_pc (this_frame);
   if (cache->pc != 0)
     h8300_analyze_prologue (cache->pc, current_pc, cache);
 
@@ -462,7 +462,7 @@
          frame by looking at the stack pointer.  For truly "frameless"
          functions this might work too.  */
 
-      cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM)
+      cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM)
 		    + cache->sp_offset;
       cache->saved_sp = cache->base + BINWORD (gdbarch);
       cache->saved_regs[E_PC_REGNUM] = 0;
@@ -483,11 +483,11 @@
 }
 
 static void
-h8300_frame_this_id (struct frame_info *next_frame, void **this_cache,
+h8300_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		     struct frame_id *this_id)
 {
   struct h8300_frame_cache *cache =
-    h8300_frame_cache (next_frame, this_cache);
+    h8300_frame_cache (this_frame, this_cache);
 
   /* This marks the outermost frame.  */
   if (cache->base == 0)
@@ -496,65 +496,39 @@
   *this_id = frame_id_build (cache->saved_sp, cache->pc);
 }
 
-static void
-h8300_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			   int regnum, int *optimizedp,
-			   enum lval_type *lvalp, CORE_ADDR *addrp,
-			   int *realnump, gdb_byte *valuep)
+static struct value *
+h8300_frame_prev_register (struct frame_info *this_frame, void **this_cache,
+			   int regnum)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct h8300_frame_cache *cache =
-    h8300_frame_cache (next_frame, this_cache);
+    h8300_frame_cache (this_frame, this_cache);
 
   gdb_assert (regnum >= 0);
 
   if (regnum == E_SP_REGNUM && cache->saved_sp)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (valuep)
-	store_unsigned_integer (valuep, BINWORD (gdbarch), cache->saved_sp);
-      return;
-    }
+    return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
 
   if (regnum < gdbarch_num_regs (gdbarch)
       && cache->saved_regs[regnum] != -1)
-    {
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = cache->saved_regs[regnum];
-      *realnump = -1;
-      if (valuep)
-	read_memory (*addrp, valuep, register_size (gdbarch, regnum));
-      return;
-    }
+    return frame_unwind_got_memory (this_frame, regnum,
+                                    cache->saved_regs[regnum]);
 
-  *optimizedp = 0;
-  *lvalp = lval_register;
-  *addrp = 0;
-  *realnump = regnum;
-  if (valuep)
-    frame_unwind_register (next_frame, *realnump, valuep);
+  return frame_unwind_got_register (this_frame, regnum, regnum);
 }
 
 static const struct frame_unwind h8300_frame_unwind = {
   NORMAL_FRAME,
   h8300_frame_this_id,
-  h8300_frame_prev_register
+  h8300_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-h8300_frame_sniffer (struct frame_info *next_frame)
-{
-  return &h8300_frame_unwind;
-}
-
 static CORE_ADDR
-h8300_frame_base_address (struct frame_info *next_frame, void **this_cache)
+h8300_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct h8300_frame_cache *cache = h8300_frame_cache (next_frame, this_cache);
+  struct h8300_frame_cache *cache = h8300_frame_cache (this_frame, this_cache);
   return cache->base;
 }
 
@@ -1337,7 +1311,7 @@
   /* Frame unwinder.  */
   set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
-  set_gdbarch_unwind_dummy_id (gdbarch, h8300_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
   frame_base_set_default (gdbarch, &h8300_frame_base);
 
   /* 
@@ -1359,8 +1333,8 @@
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   /* Hook in the DWARF CFI frame unwinder.  */
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, h8300_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &h8300_frame_unwind);
 
   return gdbarch;
 
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 71bea33..ef6b65f 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -196,10 +196,10 @@
 };
 
 static struct hppa_linux_sigtramp_unwind_cache *
-hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
+hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
 					void **this_cache)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct hppa_linux_sigtramp_unwind_cache *info;
   CORE_ADDR pc, scptr;
   int i;
@@ -209,9 +209,9 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct hppa_linux_sigtramp_unwind_cache);
   *this_cache = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
-  pc = frame_pc_unwind (next_frame);
+  pc = get_frame_pc (this_frame);
   scptr = hppa_linux_sigtramp_find_sigcontext (pc);
 
   /* structure of struct sigcontext:
@@ -262,58 +262,59 @@
   info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr;
   scptr += 4;
 
-  info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+  info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
 
   return info;
 }
 
 static void
-hppa_linux_sigtramp_frame_this_id (struct frame_info *next_frame,
+hppa_linux_sigtramp_frame_this_id (struct frame_info *this_frame,
 				   void **this_prologue_cache,
 				   struct frame_id *this_id)
 {
   struct hppa_linux_sigtramp_unwind_cache *info
-    = hppa_linux_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache);
-  *this_id = frame_id_build (info->base, frame_pc_unwind (next_frame));
+    = hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
+  *this_id = frame_id_build (info->base, get_frame_pc (this_frame));
 }
 
-static void
-hppa_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
+static struct value *
+hppa_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
 					 void **this_prologue_cache,
-					 int regnum, int *optimizedp,
-					 enum lval_type *lvalp, 
-					 CORE_ADDR *addrp,
-					 int *realnump, gdb_byte *valuep)
+					 int regnum)
 {
   struct hppa_linux_sigtramp_unwind_cache *info
-    = hppa_linux_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache);
-  hppa_frame_prev_register_helper (next_frame, info->saved_regs, regnum,
-		                   optimizedp, lvalp, addrp, realnump, valuep);
+    = hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
+  return hppa_frame_prev_register_helper (this_frame,
+					  info->saved_regs, regnum);
 }
 
-static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
-  SIGTRAMP_FRAME,
-  hppa_linux_sigtramp_frame_this_id,
-  hppa_linux_sigtramp_frame_prev_register
-};
-
 /* hppa-linux always uses "new-style" rt-signals.  The signal handler's return
    address should point to a signal trampoline on the stack.  The signal
    trampoline is embedded in a rt_sigframe structure that is aligned on
    the stack.  We take advantage of the fact that sp must be 64-byte aligned,
    and the trampoline is small, so by rounding down the trampoline address
    we can find the beginning of the struct rt_sigframe.  */
-static const struct frame_unwind *
-hppa_linux_sigtramp_unwind_sniffer (struct frame_info *next_frame)
+static int
+hppa_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
+				   struct frame_info *this_frame,
+				   void **this_prologue_cache)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
 
   if (hppa_linux_sigtramp_find_sigcontext (pc))
-    return &hppa_linux_sigtramp_frame_unwind;
+    return 1;
 
-  return NULL;
+  return 0;
 }
 
+static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
+  SIGTRAMP_FRAME,
+  hppa_linux_sigtramp_frame_this_id,
+  hppa_linux_sigtramp_frame_prev_register,
+  NULL,
+  hppa_linux_sigtramp_frame_sniffer
+};
+
 /* Attempt to find (and return) the global pointer for the given
    function.
 
@@ -522,7 +523,7 @@
 
   set_gdbarch_write_pc (gdbarch, hppa_linux_target_write_pc);
 
-  frame_unwind_append_sniffer (gdbarch, hppa_linux_sigtramp_unwind_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &hppa_linux_sigtramp_frame_unwind);
 
   /* GNU/Linux uses SVR4-style shared libraries.  */
   set_solib_svr4_fetch_link_map_offsets
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 676f680..ace04a3 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -29,7 +29,6 @@
 #include "completer.h"
 #include "osabi.h"
 #include "gdb_assert.h"
-#include "gdb_stdint.h"
 #include "arch-utils.h"
 /* For argument passing to the inferior */
 #include "symtab.h"
@@ -1793,7 +1792,7 @@
   CORE_ADDR pc = get_frame_address_in_block (this_frame);
 
   /* FIXME drow/20070101: Calling gdbarch_addr_bits_remove on the
-     result of frame_unwind_address_in_block implies a problem.
+     result of get_frame_address_in_block implies a problem.
      The bits should have been removed earlier, before the return
      value of frame_pc_unwind.  That might be happening already;
      if it isn't, it should be fixed.  Then this call can be
@@ -1895,9 +1894,9 @@
        in hppa_skip_prologue will return a prologue end that is too early
        for us to notice any potential frame adjustments.  */
 
-    /* We used to use frame_func_unwind () to locate the beginning of the
-       function to pass to skip_prologue ().  However, when objects are 
-       compiled without debug symbols, frame_func_unwind can return the wrong 
+    /* We used to use get_frame_func to locate the beginning of the
+       function to pass to skip_prologue.  However, when objects are
+       compiled without debug symbols, get_frame_func can return the wrong
        function (or 0).  We can do better than that by using unwind records.  
        This only works if the Region_description of the unwind record
        indicates that it includes the entry point of the function.  
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index 4264eed..cd69e19 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -505,9 +505,9 @@
 }
 
 static void
-hpux_thread_stop (void)
+hpux_thread_stop (ptid_t ptid)
 {
-  deprecated_child_ops.to_stop ();
+  deprecated_child_ops.to_stop (ptid);
 }
 
 /* Convert a pid to printable form. */
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index 3a8d6ee..1e4205d 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -227,6 +227,8 @@
 
   set_gdbarch_skip_trampoline_code (gdbarch, i386_cygwin_skip_trampoline_code);
 
+  set_gdbarch_skip_main_prologue (gdbarch, i386_skip_main_prologue);
+
   tdep->struct_return = reg_struct_return;
 
   tdep->gregset_reg_offset = i386_win32_gregset_reg_offset;
diff --git a/gdb/i386-dicos-tdep.c b/gdb/i386-dicos-tdep.c
index e92313a..99c3d6f 100644
--- a/gdb/i386-dicos-tdep.c
+++ b/gdb/i386-dicos-tdep.c
@@ -22,6 +22,25 @@
 #include "gdb_string.h"
 #include "solib.h"
 #include "solib-target.h"
+#include "inferior.h"
+
+static CORE_ADDR
+i386_dicos_push_dummy_code (struct gdbarch *gdbarch,
+			    CORE_ADDR sp, CORE_ADDR funaddr,
+			    struct value **args, int nargs,
+			    struct type *value_type,
+			    CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+			    struct regcache *regcache)
+{
+  int bplen;
+  CORE_ADDR bppc = sp;
+
+  gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+  *bp_addr = sp - bplen;
+  *real_pc = funaddr;
+
+  return *bp_addr;
+}
 
 static void
 i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -29,6 +48,12 @@
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   set_solib_ops (gdbarch, &solib_target_so_ops);
+
+  /* There's no (standard definition of) entry point or a guaranteed
+     text location we could find with a symbol where to place the call
+     dummy, so we put it on the stack.  */
+  set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+  set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code);
 }
 
 /* Look in the elf symbol table of ABFD for a symbol named WANTED.
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index be4f4f3..4888b2b 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -450,8 +450,9 @@
              presenting them to GDB.)  */
           if (i386_breakpoint_p (insn))
             {
-              fprintf_unfiltered (gdb_stdlog,
-                                  "displaced: stepped breakpoint\n");
+              if (debug_displaced)
+                fprintf_unfiltered (gdb_stdlog,
+                                    "displaced: stepped breakpoint\n");
               eip--;
             }
 
@@ -1160,6 +1161,38 @@
   return pc;
 }
 
+/* Check that the code pointed to by PC corresponds to a call to
+   __main, skip it if so.  Return PC otherwise.  */
+
+CORE_ADDR
+i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+  gdb_byte op;
+
+  target_read_memory (pc, &op, 1);
+  if (op == 0xe8)
+    {
+      gdb_byte buf[4];
+
+      if (target_read_memory (pc + 1, buf, sizeof buf) == 0)
+ 	{
+	  /* Make sure address is computed correctly as a 32bit
+	     integer even if CORE_ADDR is 64 bit wide.  */
+ 	  struct minimal_symbol *s;
+ 	  CORE_ADDR call_dest = pc + 5 + extract_signed_integer (buf, 4);
+
+	  call_dest = call_dest & 0xffffffffU;
+ 	  s = lookup_minimal_symbol_by_pc (call_dest);
+ 	  if (s != NULL
+ 	      && SYMBOL_LINKAGE_NAME (s) != NULL
+ 	      && strcmp (SYMBOL_LINKAGE_NAME (s), "__main") == 0)
+ 	    pc += 5;
+ 	}
+    }
+
+  return pc;
+}
+
 /* This function is 64-bit safe.  */
 
 static CORE_ADDR
@@ -1489,6 +1522,34 @@
 }
 
 
+/* Check whether TYPE must be 16-byte-aligned when passed as a
+   function argument.  16-byte vectors, _Decimal128 and structures or
+   unions containing such types must be 16-byte-aligned; other
+   arguments are 4-byte-aligned.  */
+
+static int
+i386_16_byte_align_p (struct type *type)
+{
+  type = check_typedef (type);
+  if ((TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+       || (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)))
+      && TYPE_LENGTH (type) == 16)
+    return 1;
+  if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+    return i386_16_byte_align_p (TYPE_TARGET_TYPE (type));
+  if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+      || TYPE_CODE (type) == TYPE_CODE_UNION)
+    {
+      int i;
+      for (i = 0; i < TYPE_NFIELDS (type); i++)
+	{
+	  if (i386_16_byte_align_p (TYPE_FIELD_TYPE (type, i)))
+	    return 1;
+	}
+    }
+  return 0;
+}
+
 static CORE_ADDR
 i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		      struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -1497,29 +1558,68 @@
 {
   gdb_byte buf[4];
   int i;
+  int write_pass;
+  int args_space = 0;
 
-  /* Push arguments in reverse order.  */
-  for (i = nargs - 1; i >= 0; i--)
+  /* Determine the total space required for arguments and struct
+     return address in a first pass (allowing for 16-byte-aligned
+     arguments), then push arguments in a second pass.  */
+
+  for (write_pass = 0; write_pass < 2; write_pass++)
     {
-      int len = TYPE_LENGTH (value_enclosing_type (args[i]));
+      int args_space_used = 0;
+      int have_16_byte_aligned_arg = 0;
 
-      /* The System V ABI says that:
+      if (struct_return)
+	{
+	  if (write_pass)
+	    {
+	      /* Push value address.  */
+	      store_unsigned_integer (buf, 4, struct_addr);
+	      write_memory (sp, buf, 4);
+	      args_space_used += 4;
+	    }
+	  else
+	    args_space += 4;
+	}
 
-	 "An argument's size is increased, if necessary, to make it a
-	 multiple of [32-bit] words.  This may require tail padding,
-	 depending on the size of the argument."
+      for (i = 0; i < nargs; i++)
+	{
+	  int len = TYPE_LENGTH (value_enclosing_type (args[i]));
 
-	 This makes sure the stack stays word-aligned.  */
-      sp -= (len + 3) & ~3;
-      write_memory (sp, value_contents_all (args[i]), len);
-    }
+	  if (write_pass)
+	    {
+	      if (i386_16_byte_align_p (value_enclosing_type (args[i])))
+		args_space_used = align_up (args_space_used, 16);
 
-  /* Push value address.  */
-  if (struct_return)
-    {
-      sp -= 4;
-      store_unsigned_integer (buf, 4, struct_addr);
-      write_memory (sp, buf, 4);
+	      write_memory (sp + args_space_used,
+			    value_contents_all (args[i]), len);
+	      /* The System V ABI says that:
+
+	      "An argument's size is increased, if necessary, to make it a
+	      multiple of [32-bit] words.  This may require tail padding,
+	      depending on the size of the argument."
+
+	      This makes sure the stack stays word-aligned.  */
+	      args_space_used += align_up (len, 4);
+	    }
+	  else
+	    {
+	      if (i386_16_byte_align_p (value_enclosing_type (args[i])))
+		{
+		  args_space = align_up (args_space, 16);
+		  have_16_byte_aligned_arg = 1;
+		}
+	      args_space += align_up (len, 4);
+	    }
+	}
+
+      if (!write_pass)
+	{
+	  if (have_16_byte_aligned_arg)
+	    args_space = align_up (args_space, 16);
+	  sp -= args_space;
+	}
     }
 
   /* Store return address.  */
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 227ac66..d1366b6 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -170,6 +170,7 @@
 
 /* Functions exported from i386-tdep.c.  */
 extern CORE_ADDR i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name);
+extern CORE_ADDR i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc);
 
 /* Return the name of register REGNUM.  */
 extern char const *i386_register_name (struct gdbarch * gdbarch, int regnum);
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 32e0f69..991cb06 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -3436,7 +3436,7 @@
   if (gdbarch_debug >= 1)
     fprintf_unfiltered (gdb_stdlog,
 			"dummy frame id: code 0x%s, stack 0x%s, special 0x%s\n",
-			paddr_nz (frame_pc_unwind (this_frame)), 
+			paddr_nz (get_frame_pc (this_frame)),
 			paddr_nz (sp), paddr_nz (bsp));
 
   return frame_id_build_special (sp, get_frame_pc (this_frame), bsp);
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index f77bc65..725b57c 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -26,6 +26,7 @@
 #include "remote.h"
 #include "exceptions.h"
 #include "language.h"
+#include "gdbthread.h"
 
 static int fetch_inferior_event_wrapper (gdb_client_data client_data);
 
@@ -51,7 +52,8 @@
       printf_unfiltered (_("error detected from target.\n"));
       target_async (NULL, 0);
       pop_target ();
-      do_all_continuations (1);
+      discard_all_intermediate_continuations ();
+      discard_all_continuations ();
       async_enable_stdin ();
       break;
 
@@ -65,7 +67,8 @@
 	{
 	  target_async (NULL, 0);
 	  pop_target ();
-	  do_all_continuations (1);
+	  discard_all_intermediate_continuations ();
+	  discard_all_continuations ();
 	  async_enable_stdin ();
 	  display_gdb_prompt (0);
 	}
@@ -73,18 +76,14 @@
 
     case INF_EXEC_COMPLETE:
 
-      /* This is the first thing to do -- so that continuations know that
-	 the target is stopped.  For example, command_line_handler_continuation
-	 will run breakpoint commands, and if we think that the target is
-	 running, we'll refuse to execute most commands.  MI continuation
-	 presently uses target_executing to either print or not print *stopped.  */
-      target_executing = 0;
-
-      /* Unregister the inferior from the event loop. This is done so that
-	 when the inferior is not running we don't get distracted by
-	 spurious inferior output.  */
-      if (target_has_execution)
-	target_async (NULL, 0);
+      if (!non_stop)
+	{
+	  /* Unregister the inferior from the event loop. This is done
+	     so that when the inferior is not running we don't get
+	     distracted by spurious inferior output.  */
+	  if (target_has_execution)
+	    target_async (NULL, 0);
+	}
 
       /* The call to async_enable_stdin below resets 'sync_execution'.
 	 However, if sync_execution is 1 now, we also need to show the
@@ -99,13 +98,13 @@
 	 touch the inferior memory, e.g. to remove breakpoints, so run
 	 them before running breakpoint commands, which may resume the
 	 target.  */
-      do_all_intermediate_continuations (0);
+      do_all_intermediate_continuations ();
 
       /* Always finish the previous command before running any
 	 breakpoint commands.  Any stop cancels the previous command.
 	 E.g. a "finish" or "step-n" command interrupted by an
 	 unrelated breakpoint is canceled.  */
-      do_all_continuations (0);
+      do_all_continuations ();
 
       if (current_language != expected_language
 	  && language_mode == language_mode_auto)
@@ -119,26 +118,14 @@
 	  bpstat_do_actions (&stop_bpstat);
 	}
 
-      /* If no breakpoint command resumed the inferior, prepare for
-	 interaction with the user.  */
-      if (!target_executing)
-	{              
-	  if (was_sync)
-	    {
-	      display_gdb_prompt (0);
-	    }
-	  else
-	    {
-	      if (exec_done_display_p)
-		printf_unfiltered (_("completed.\n"));
-	    }
-	}
+      if (!was_sync && !is_running (inferior_ptid) && exec_done_display_p)
+	printf_unfiltered (_("completed.\n"));
       break;
 
     case INF_EXEC_CONTINUE:
       /* Is there anything left to do for the command issued to
          complete? */
-      do_all_intermediate_continuations (0);
+      do_all_intermediate_continuations ();
       break;
 
     case INF_QUIT_REQ: 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 8acc690..ee2c8fa 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -26,7 +26,6 @@
 #include "gdbcore.h"
 #include "regcache.h"
 
-#include "gdb_stdint.h"
 #include "gdb_assert.h"
 #include "gdb_string.h"
 #include "gdb_ptrace.h"
@@ -298,7 +297,7 @@
 /* Stop the inferior.  */
 
 static void
-inf_ptrace_stop (void)
+inf_ptrace_stop (ptid_t ptid)
 {
   /* Send a SIGINT to the process group.  This acts just like the user
      typed a ^C on the controlling terminal.  Note that using a
@@ -399,7 +398,7 @@
 	{
 	case PTRACE_FORK:
 	  ourstatus->kind = TARGET_WAITKIND_FORKED;
-	  ourstatus->value.related_pid = pe.pe_other_pid;
+	  ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
 
 	  /* Make sure the other end of the fork is stopped too.  */
 	  fpid = waitpid (pe.pe_other_pid, &status, 0);
@@ -414,7 +413,7 @@
 	  gdb_assert (pe.pe_other_pid == pid);
 	  if (fpid == ptid_get_pid (inferior_ptid))
 	    {
-	      ourstatus->value.related_pid = pe.pe_other_pid;
+	      ourstatus->value.related_pid = pid_to_ptid (pe.pe_other_pid);
 	      return pid_to_ptid (fpid);
 	    }
 
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 8a8399a..c0b75c7 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -839,6 +839,7 @@
   lwpid_t lwpid = ptid_get_lwp (ptid);
   ttstate_t tts;
   struct thread_info *ti;
+  ptid_t related_ptid;
 
   /* Until proven otherwise.  */
   ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
@@ -904,6 +905,12 @@
 		  tts.tts_u.tts_exec.tts_pathlen, 0) == -1)
 	perror_with_name (("ttrace"));
       ourstatus->value.execd_pathname[tts.tts_u.tts_exec.tts_pathlen] = 0;
+
+      /* At this point, all inserted breakpoints are gone.  Doing this
+	 as soon as we detect an exec prevents the badness of deleting
+	 a breakpoint writing the current "shadow contents" to lift
+	 the bp.  That shadow is NOT valid after an exec.  */
+      mark_breakpoints_out ();
       break;
 
     case TTEVT_EXIT:
@@ -912,8 +919,11 @@
       break;
 
     case TTEVT_FORK:
+      related_ptid = ptid_build (tts.tts_u.tts_fork.tts_fpid,
+				 tts.tts_u.tts_fork.tts_flwpid, 0);
+
       ourstatus->kind = TARGET_WAITKIND_FORKED;
-      ourstatus->value.related_pid = tts.tts_u.tts_fork.tts_fpid;
+      ourstatus->value.related_pid = related_ptid;
 
       /* Make sure the other end of the fork is stopped too.  */
       if (ttrace_wait (tts.tts_u.tts_fork.tts_fpid,
@@ -924,16 +934,21 @@
       gdb_assert (tts.tts_event == TTEVT_FORK);
       if (tts.tts_u.tts_fork.tts_isparent)
 	{
+	  related_ptid = ptid_build (tts.tts_u.tts_fork.tts_fpid,
+				     tts.tts_u.tts_fork.tts_flwpid, 0);
 	  ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
-	  ourstatus->value.related_pid = tts.tts_u.tts_fork.tts_fpid;
+	  ourstatus->value.related_pid = related_ptid;
 	}
       break;
 
     case TTEVT_VFORK:
       gdb_assert (!tts.tts_u.tts_fork.tts_isparent);
 
+      related_ptid = ptid_build (tts.tts_u.tts_fork.tts_fpid,
+				 tts.tts_u.tts_fork.tts_flwpid, 0);
+
       ourstatus->kind = TARGET_WAITKIND_VFORKED;
-      ourstatus->value.related_pid = tts.tts_u.tts_fork.tts_fpid;
+      ourstatus->value.related_pid = related_ptid;
 
       /* HACK: To avoid touching the parent during the vfork, switch
 	 away from it.  */
diff --git a/gdb/infcall.c b/gdb/infcall.c
index c065b59..559b4a2 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -706,6 +706,7 @@
 
   {
     struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
+    struct cleanup *old_cleanups2;
     int saved_async = 0;
 
     /* If all error()s out of proceed ended up calling normal_stop
@@ -718,8 +719,13 @@
 
     if (target_can_async_p ())
       saved_async = target_async_mask (0);
-    
+
+    old_cleanups2 = make_cleanup_restore_integer (&suppress_resume_observer);
+    suppress_resume_observer = 1;
+    make_cleanup_restore_integer (&suppress_stop_observer);
+    suppress_stop_observer = 1;
     proceed (real_pc, TARGET_SIGNAL_0, 0);
+    do_cleanups (old_cleanups2);
     
     if (saved_async)
       target_async_mask (saved_async);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 2397c30..8184cf0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -73,9 +73,6 @@
 static void print_return_value (struct type *func_type,
 				struct type *value_type);
 
-static void finish_command_continuation (struct continuation_arg *, 
-					 int error_p);
-
 static void until_next_command (int);
 
 static void until_command (char *, int);
@@ -108,7 +105,6 @@
 
 static void step_1 (int, int, char *);
 static void step_once (int skip_subroutines, int single_inst, int count, int thread);
-static void step_1_continuation (struct continuation_arg *arg, int error_p);
 
 static void next_command (char *, int);
 
@@ -206,6 +202,11 @@
    in format described in environ.h.  */
 
 struct gdb_environ *inferior_environ;
+
+/* When set, no calls to target_resumed observer will be made.  */
+int suppress_resume_observer = 0;
+/* When set, normal_stop will not call the normal_stop observer.  */
+int suppress_stop_observer = 0;
 
 /* Accessor routines. */
 
@@ -603,15 +604,54 @@
   run_command_1 (args, from_tty, 1);
 } 
 
+static int
+proceed_thread_callback (struct thread_info *thread, void *arg)
+{
+  if (!is_stopped (thread->ptid))
+    return 0;
+
+  context_switch_to (thread->ptid);
+  clear_proceed_status ();
+  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+  return 0;
+}
+
 void
-continue_command (char *proc_count_exp, int from_tty)
+continue_1 (int all_threads)
+{
+  if (non_stop && all_threads)
+    {
+      /* Don't error out if the current thread is running, because
+        there may be other stopped threads.  */
+      struct cleanup *old_chain;
+
+      /* Backup current thread and selected frame.  */
+      old_chain = make_cleanup_restore_current_thread ();
+
+      iterate_over_threads (proceed_thread_callback, NULL);
+
+      /* Restore selected ptid.  */
+      do_cleanups (old_chain);
+    }
+  else
+    {
+      ensure_not_running ();
+      clear_proceed_status ();
+      proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+    }
+}
+
+/* continue [-a] [proceed-count] [&]  */
+void
+continue_command (char *args, int from_tty)
 {
   int async_exec = 0;
+  int all_threads = 0;
   ERROR_NO_INFERIOR;
 
   /* Find out whether we must run in the background. */
-  if (proc_count_exp != NULL)
-    async_exec = strip_bg_char (&proc_count_exp);
+  if (args != NULL)
+    async_exec = strip_bg_char (&args);
 
   /* If we must run in the background, but the target can't do it,
      error out. */
@@ -626,9 +666,27 @@
       async_disable_stdin ();
     }
 
-  /* If have argument (besides '&'), set proceed count of breakpoint
-     we stopped at.  */
-  if (proc_count_exp != NULL)
+  if (args != NULL)
+    {
+      if (strncmp (args, "-a", sizeof ("-a") - 1) == 0)
+	{
+	  all_threads = 1;
+	  args += sizeof ("-a") - 1;
+	  if (*args == '\0')
+	    args = NULL;
+	}
+    }
+
+  if (!non_stop && all_threads)
+    error (_("`-a' is meaningless in all-stop mode."));
+
+  if (args != NULL && all_threads)
+    error (_("\
+Can't resume all threads and specify proceed count simultaneously."));
+
+  /* If we have an argument left, set proceed count of breakpoint we
+     stopped at.  */
+  if (args != NULL)
     {
       bpstat bs = stop_bpstat;
       int num, stat;
@@ -638,7 +696,7 @@
 	if (stat > 0)
 	  {
 	    set_ignore_count (num,
-			      parse_and_eval_long (proc_count_exp) - 1,
+			      parse_and_eval_long (args) - 1,
 			      from_tty);
 	    /* set_ignore_count prints a message ending with a period.
 	       So print two spaces before "Continuing.".  */
@@ -657,9 +715,7 @@
   if (from_tty)
     printf_filtered (_("Continuing.\n"));
 
-  clear_proceed_status ();
-
-  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+  continue_1 (all_threads);
 }
 
 /* Step until outside of current statement.  */
@@ -709,6 +765,7 @@
   int thread = -1;
 
   ERROR_NO_INFERIOR;
+  ensure_not_running ();
 
   if (count_string)
     async_exec = strip_bg_char (&count_string);
@@ -803,35 +860,34 @@
     }
 }
 
+struct step_1_continuation_args
+{
+  int count;
+  int skip_subroutines;
+  int single_inst;
+  int thread;
+};
+
 /* Called after we are done with one step operation, to check whether
    we need to step again, before we print the prompt and return control
    to the user. If count is > 1, we will need to do one more call to
    proceed(), via step_once(). Basically it is like step_once and
    step_1_continuation are co-recursive. */
 static void
-step_1_continuation (struct continuation_arg *arg, int error_p)
+step_1_continuation (void *args)
 {
-  int count;
-  int skip_subroutines;
-  int single_inst;
-  int thread;
-      
-  skip_subroutines = arg->data.integer;
-  single_inst      = arg->next->data.integer;
-  count            = arg->next->next->data.integer;
-  thread           = arg->next->next->next->data.integer;
+  struct step_1_continuation_args *a = args;
 
-  if (error_p || !step_multi || !stop_step)
+  if (!step_multi || !stop_step)
     {
-      /* We either hit an error, or stopped for some reason
-	 that is not stepping, or there are no further steps
-	 to make.  Cleanup.  */
-      if (!single_inst || skip_subroutines)
-	delete_longjmp_breakpoint (thread);
+      /* If we stopped for some reason that is not stepping there are
+	 no further steps to make.  Cleanup.  */
+      if (!a->single_inst || a->skip_subroutines)
+	delete_longjmp_breakpoint (a->thread);
       step_multi = 0;
     }
   else
-    step_once (skip_subroutines, single_inst, count - 1, thread);
+    step_once (a->skip_subroutines, a->single_inst, a->count - 1, a->thread);
 }
 
 /* Do just one step operation. If count >1 we will have to set up a
@@ -843,12 +899,9 @@
    been completed.*/
 static void 
 step_once (int skip_subroutines, int single_inst, int count, int thread)
-{ 
-  struct continuation_arg *arg1; 
-  struct continuation_arg *arg2;
-  struct continuation_arg *arg3; 
-  struct continuation_arg *arg4;
+{
   struct frame_info *frame;
+  struct step_1_continuation_args *args;
 
   if (count > 0)
     {
@@ -897,23 +950,13 @@
 
       step_multi = (count > 1);
       proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
-      arg1 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg2 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg3 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg4 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg1->next = arg2;
-      arg1->data.integer = skip_subroutines;
-      arg2->next = arg3;
-      arg2->data.integer = single_inst;
-      arg3->next = arg4;
-      arg3->data.integer = count;
-      arg4->next = NULL;
-      arg4->data.integer = thread;
-      add_intermediate_continuation (step_1_continuation, arg1);
+
+      args = xmalloc (sizeof (*args));
+      args->skip_subroutines = skip_subroutines;
+      args->single_inst = single_inst;
+      args->count = count;
+      args->thread = thread;
+      add_intermediate_continuation (step_1_continuation, args, xfree);
     }
 }
 
@@ -931,6 +974,7 @@
   int async_exec = 0;
 
   ERROR_NO_INFERIOR;
+  ensure_not_running ();
 
   /* Find out whether we must run in the background. */
   if (arg != NULL)
@@ -1031,6 +1075,7 @@
 
   dont_repeat ();		/* Too dangerous.  */
   ERROR_NO_INFERIOR;
+  ensure_not_running ();
 
   /* Find out whether we must run in the background.  */
   if (signum_exp != NULL)
@@ -1269,35 +1314,49 @@
    soon as it detects that the target has stopped. This function is
    called via the cmd_continuation pointer.  */
 
-static void
-finish_command_continuation (struct continuation_arg *arg, int error_p)
+struct finish_command_continuation_args
 {
-  struct symbol *function;
   struct breakpoint *breakpoint;
-  struct cleanup *cleanups;
+  struct symbol *function;
+};
 
-  breakpoint = (struct breakpoint *) arg->data.pointer;
-  function = (struct symbol *) arg->next->data.pointer;
-  cleanups = (struct cleanup *) arg->next->next->data.pointer;
+static void
+finish_command_continuation (void *arg)
+{
+  struct finish_command_continuation_args *a = arg;
 
-  if (!error_p)
+  if (bpstat_find_breakpoint (stop_bpstat, a->breakpoint) != NULL
+      && a->function != NULL)
     {
-      if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
-	  && function != NULL)
-	{
-	  struct type *value_type;
-	  
-	  value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
-	  if (!value_type)
-	    internal_error (__FILE__, __LINE__,
-			    _("finish_command: function has no target type"));
-	  
-	  if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
-	    print_return_value (SYMBOL_TYPE (function), value_type); 
-	}
+      struct type *value_type;
+
+      value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
+      if (!value_type)
+	internal_error (__FILE__, __LINE__,
+			_("finish_command: function has no target type"));
+
+      if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
+	print_return_value (SYMBOL_TYPE (a->function), value_type);
     }
 
-  delete_breakpoint (breakpoint);
+  /* We suppress normal call of normal_stop observer and do it here so
+     that that *stopped notification includes the return value.  */
+  /* NOTE: This is broken in non-stop mode.  There is no guarantee the
+     next stop will be in the same thread that we started doing a
+     finish on.  This suppressing (or some other replacement means)
+     should be a thread property.  */
+  observer_notify_normal_stop (stop_bpstat);
+  suppress_stop_observer = 0;
+  delete_breakpoint (a->breakpoint);
+}
+
+static void
+finish_command_continuation_free_arg (void *arg)
+{
+  /* NOTE: See finish_command_continuation.  This would go away, if
+     this suppressing is made a thread property.  */
+  suppress_stop_observer = 0;
+  xfree (arg);
 }
 
 /* "finish": Set a temporary breakpoint at the place the selected
@@ -1311,7 +1370,7 @@
   struct symbol *function;
   struct breakpoint *breakpoint;
   struct cleanup *old_chain;
-  struct continuation_arg *arg1, *arg2, *arg3;
+  struct finish_command_continuation_args *cargs;
 
   int async_exec = 0;
 
@@ -1363,28 +1422,20 @@
     }
 
   proceed_to_finish = 1;	/* We want stop_registers, please...  */
+  make_cleanup_restore_integer (&suppress_stop_observer);
+  suppress_stop_observer = 1;
   proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
 
-  arg1 =
-    (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-  arg2 =
-    (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-  arg3 =
-    (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-  arg1->next = arg2;
-  arg2->next = arg3;
-  arg3->next = NULL;
-  arg1->data.pointer = breakpoint;
-  arg2->data.pointer = function;
-  arg3->data.pointer = old_chain;
-  add_continuation (finish_command_continuation, arg1);
+  cargs = xmalloc (sizeof (*cargs));
 
-  /* Do this only if not running asynchronously or if the target
-     cannot do async execution.  Otherwise, complete this command when
-     the target actually stops, in fetch_inferior_event.  */
+  cargs->breakpoint = breakpoint;
+  cargs->function = function;
+  add_continuation (finish_command_continuation, cargs,
+		    finish_command_continuation_free_arg);
+
   discard_cleanups (old_chain);
   if (!target_can_async_p ())
-    do_all_continuations (0);
+    do_all_continuations ();
 }
 
 
@@ -1929,18 +1980,26 @@
     }
 }
 
-static void
-attach_command_continuation (struct continuation_arg *arg, int error_p)
+struct attach_command_continuation_args
 {
   char *args;
   int from_tty;
   int async_exec;
+};
 
-  args = (char *) arg->data.pointer;
-  from_tty = arg->next->data.integer;
-  async_exec = arg->next->next->data.integer;
+static void
+attach_command_continuation (void *args)
+{
+  struct attach_command_continuation_args *a = args;
+  attach_command_post_wait (a->args, a->from_tty, a->async_exec);
+}
 
-  attach_command_post_wait (args, from_tty, async_exec);
+static void
+attach_command_continuation_free_args (void *args)
+{
+  struct attach_command_continuation_args *a = args;
+  xfree (a->args);
+  xfree (a);
 }
 
 void
@@ -2011,39 +2070,34 @@
   init_wait_for_inferior ();
   clear_proceed_status ();
 
-  /* No traps are generated when attaching to inferior under Mach 3
-     or GNU hurd.  */
-#ifndef ATTACH_NO_WAIT
-  /* Careful here. See comments in inferior.h.  Basically some OSes
-     don't ignore SIGSTOPs on continue requests anymore.  We need a
-     way for handle_inferior_event to reset the stop_signal variable
-     after an attach, and this is what STOP_QUIETLY_NO_SIGSTOP is for.  */
-  stop_soon = STOP_QUIETLY_NO_SIGSTOP;
-
-  if (target_can_async_p ())
+  /* Some system don't generate traps when attaching to inferior.
+     E.g. Mach 3 or GNU hurd.  */
+  if (!target_attach_no_wait)
     {
-      /* sync_execution mode.  Wait for stop.  */
-      struct continuation_arg *arg1, *arg2, *arg3;
+      /* Careful here. See comments in inferior.h.  Basically some
+	 OSes don't ignore SIGSTOPs on continue requests anymore.  We
+	 need a way for handle_inferior_event to reset the stop_signal
+	 variable after an attach, and this is what
+	 STOP_QUIETLY_NO_SIGSTOP is for.  */
+      stop_soon = STOP_QUIETLY_NO_SIGSTOP;
 
-      arg1 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg2 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg3 =
-	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg1->next = arg2;
-      arg2->next = arg3;
-      arg3->next = NULL;
-      arg1->data.pointer = args;
-      arg2->data.integer = from_tty;
-      arg3->data.integer = async_exec;
-      add_continuation (attach_command_continuation, arg1);
-      return;
+      if (target_can_async_p ())
+	{
+	  /* sync_execution mode.  Wait for stop.  */
+	  struct attach_command_continuation_args *a;
+
+	  a = xmalloc (sizeof (*a));
+	  a->args = xstrdup (args);
+	  a->from_tty = from_tty;
+	  a->async_exec = async_exec;
+	  add_continuation (attach_command_continuation, a,
+			    attach_command_continuation_free_args);
+	  return;
+	}
+
+      wait_for_inferior (0);
     }
 
-  wait_for_inferior (0);
-#endif
-
   attach_command_post_wait (args, from_tty, async_exec);
 }
 
@@ -2088,15 +2142,40 @@
     deprecated_detach_hook ();
 }
 
+void 
+interrupt_target_1 (int all_threads)
+{
+  ptid_t ptid;
+  if (all_threads)
+    ptid = minus_one_ptid;
+  else
+    ptid = inferior_ptid;
+  target_stop (ptid);
+}
+
 /* Stop the execution of the target while running in async mode, in
-   the backgound. */
+   the backgound.  In all-stop, stop the whole process.  In non-stop
+   mode, stop the current thread only by default, or stop all threads
+   if the `-a' switch is used.  */
+
+/* interrupt [-a]  */
 void
 interrupt_target_command (char *args, int from_tty)
 {
   if (target_can_async_p ())
     {
+      int all_threads = 0;
+
       dont_repeat ();		/* Not for the faint of heart */
-      target_stop ();
+
+      if (args != NULL
+	  && strncmp (args, "-a", sizeof ("-a") - 1) == 0)
+	all_threads = 1;
+
+      if (!non_stop && all_threads)
+	error (_("-a is meaningless in all-stop mode."));
+
+      interrupt_target_1 (all_threads);
     }
 }
 
@@ -2299,13 +2378,19 @@
   if (xdb_commands)
     add_com_alias ("g", "go", class_run, 1);
 
-  add_com ("continue", class_run, continue_command, _("\
+  c = add_com ("continue", class_run, continue_command, _("\
 Continue program being debugged, after signal or breakpoint.\n\
 If proceeding from breakpoint, a number N may be used as an argument,\n\
 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
-the breakpoint won't break until the Nth time it is reached)."));
+the breakpoint won't break until the Nth time it is reached).\n\
+\n\
+If non-stop mode is enabled, continue only the current thread,\n\
+otherwise all the threads in the program are continued.  To \n\
+continue all stopped threads in non-stop mode, use the -a option.\n\
+Specifying -a and an ignore count simultaneously is an error."));
   add_com_alias ("c", "cont", class_run, 1);
   add_com_alias ("fg", "cont", class_run, 1);
+  set_cmd_async_ok (c);
 
   c = add_com ("run", class_run, run_command, _("\
 Start debugged program.  You may specify arguments to give it.\n\
@@ -2327,7 +2412,10 @@
   set_cmd_completer (c, filename_completer);
 
   c = add_com ("interrupt", class_run, interrupt_target_command,
-	       _("Interrupt the execution of the debugged program."));
+	       _("Interrupt the execution of the debugged program.\n\
+If non-stop mode is enabled, interrupt only the current thread,\n\
+otherwise all the threads in the program are stopped.  To \n\
+interrupt all running threads in non-stop mode, use the -a option."));
   set_cmd_async_ok (c);
 
   add_info ("registers", nofp_registers_info, _("\
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 1dd152a..f53af8b 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -111,12 +111,6 @@
 
 extern ptid_t inferior_ptid;
 
-/* Is the inferior running right now, as a result of a 'run&',
-   'continue&' etc command? This is used in asycn gdb to determine
-   whether a command that the user enters while the target is running
-   is allowed or not. */
-extern int target_executing;
-
 /* Are we simulating synchronous execution? This is used in async gdb
    to implement the 'run', 'continue' etc commands, which will not
    redisplay the prompt until the execution is actually over. */
@@ -138,11 +132,20 @@
 
 extern void proceed (CORE_ADDR, enum target_signal, int);
 
+extern ptid_t context_switch_to (ptid_t ptid);
+
 /* When set, stop the 'step' command if we enter a function which has
    no line number information.  The normal behavior is that we step
    over such function.  */
 extern int step_stop_if_no_debug;
 
+/* If set, the inferior should be controlled in non-stop mode.  In
+   this mode, each thread is controlled independently.  Execution
+   commands apply only to the the selected thread by default, and stop
+   events stop only the thread that had the event -- the other threads
+   are kept running freely.  */
+extern int non_stop;
+
 extern void generic_mourn_inferior (void);
 
 extern void terminal_save_ours (void);
@@ -242,6 +245,12 @@
 
 extern void follow_inferior_reset_breakpoints (void);
 
+/* Throw an error indicating the current thread is running.  */
+extern void error_is_running (void);
+
+/* Calls error_is_running if the current thread is running.  */
+extern void ensure_not_running (void);
+
 /* From infcmd.c */
 
 extern void tty_command (char *, int);
@@ -262,10 +271,14 @@
 
 extern void stepi_command (char *, int);
 
+extern void continue_1 (int all_threads);
+
 extern void continue_command (char *, int);
 
 extern void interrupt_target_command (char *args, int from_tty);
 
+extern void interrupt_target_1 (int all_threads);
+
 /* Last signal that the inferior received (why it stopped).  */
 
 extern enum target_signal stop_signal;
@@ -391,6 +404,13 @@
 void displaced_step_dump_bytes (struct ui_file *file,
                                 const gdb_byte *buf, size_t len);
 
+
+/* When set, normal_stop will not call the normal_stop observer.  */
+extern int suppress_stop_observer;
+
+/* When set, no calls to target_resumed observer will be made.  */
+extern int suppress_resume_observer;
+
 
 /* Possible values for gdbarch_call_dummy_location.  */
 #define ON_STACK 1
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2960acb..2f32a82 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -48,6 +48,7 @@
 
 #include "gdb_assert.h"
 #include "mi/mi-common.h"
+#include "event-top.h"
 
 /* Prototypes for local functions */
 
@@ -72,9 +73,9 @@
 static void set_schedlock_func (char *args, int from_tty,
 				struct cmd_list_element *c);
 
-struct execution_control_state;
+struct thread_stepping_state;
 
-static int currently_stepping (struct execution_control_state *ecs);
+static int currently_stepping (struct thread_stepping_state *tss);
 
 static void xdb_handle_command (char *args, int from_tty);
 
@@ -288,6 +289,28 @@
 static ptid_t target_last_wait_ptid;
 static struct target_waitstatus target_last_waitstatus;
 
+/* Context-switchable data.  */
+struct thread_stepping_state
+{
+  /* Should we step over breakpoint next time keep_going
+     is called?  */
+  int stepping_over_breakpoint;
+  int current_line;
+  struct symtab *current_symtab;
+  int step_after_step_resume_breakpoint;
+  int stepping_through_solib_after_catch;
+  bpstat stepping_through_solib_catchpoints;
+};
+
+struct thread_stepping_state gtss;
+struct thread_stepping_state *tss = &gtss;
+
+static void context_switch (ptid_t ptid);
+
+void init_thread_stepping_state (struct thread_stepping_state *tss);
+
+void init_infwait_state (void);
+
 /* This is used to remember when a fork, vfork or exec event
    was caught by a catchpoint, and thus the event is to be
    followed at the next resume of the inferior, and not
@@ -297,8 +320,8 @@
   enum target_waitkind kind;
   struct
   {
-    int parent_pid;
-    int child_pid;
+    ptid_t parent_pid;
+    ptid_t child_pid;
   }
   fork_event;
   char *execd_pathname;
@@ -362,9 +385,9 @@
 /* EXECD_PATHNAME is assumed to be non-NULL. */
 
 static void
-follow_exec (int pid, char *execd_pathname)
+follow_exec (ptid_t pid, char *execd_pathname)
 {
-  int saved_pid = pid;
+  ptid_t saved_pid = pid;
   struct target_ops *tgt;
 
   /* This is an exec event that we actually wish to pay attention to.
@@ -404,7 +427,7 @@
   gdb_flush (gdb_stdout);
   generic_mourn_inferior ();
   /* Because mourn_inferior resets inferior_ptid. */
-  inferior_ptid = pid_to_ptid (saved_pid);
+  inferior_ptid = saved_pid;
 
   if (gdb_sysroot && *gdb_sysroot)
     {
@@ -419,13 +442,17 @@
   /* That a.out is now the one to use. */
   exec_file_attach (execd_pathname, 0);
 
-  /* And also is where symbols can be found. */
+  /* Reset the shared library package.  This ensures that we get a
+     shlib event when the child reaches "_start", at which point the
+     dld will have had a chance to initialize the child.  */
+  /* Also, loading a symbol file below may trigger symbol lookups, and
+     we don't want those to be satisfied by the libraries of the
+     previous incarnation of this process.  */
+  no_shared_libraries (NULL, 0);
+
+  /* Load the main file's symbols.  */
   symbol_file_add_main (execd_pathname, 0);
 
-  /* Reset the shared library package.  This ensures that we get
-     a shlib event when the child reaches "_start", at which point
-     the dld will have had a chance to initialize the child. */
-  no_shared_libraries (NULL, 0);
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
   SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
 #else
@@ -941,10 +968,13 @@
       && sig == TARGET_SIGNAL_0)
     {
       if (!displaced_step_prepare (inferior_ptid))
-	/* Got placed in displaced stepping queue.  Will be resumed
-	   later when all the currently queued displaced stepping
-	   requests finish.  */
-	return;
+	{
+	  /* Got placed in displaced stepping queue.  Will be resumed
+	     later when all the currently queued displaced stepping
+	     requests finish.  */
+	  discard_cleanups (old_cleanups);
+	  return;
+	}
     }
 
   if (step && gdbarch_software_single_step_p (gdbarch))
@@ -1029,9 +1059,15 @@
 	  resume_ptid = inferior_ptid;
 	}
 
-      if ((scheduler_mode == schedlock_on)
-	  || (scheduler_mode == schedlock_step
-	      && (step || singlestep_breakpoints_inserted_p)))
+      if (non_stop)
+	{
+	  /* With non-stop mode on, threads are always handled
+	     individually.  */
+	  resume_ptid = inferior_ptid;
+	}
+      else if ((scheduler_mode == schedlock_on)
+	       || (scheduler_mode == schedlock_step
+		   && (step || singlestep_breakpoints_inserted_p)))
 	{
 	  /* User-settable 'scheduler' mode requires solo thread resume. */
 	  resume_ptid = inferior_ptid;
@@ -1192,19 +1228,27 @@
 			"infrun: proceed (addr=0x%s, signal=%d, step=%d)\n",
 			paddr_nz (addr), siggnal, step);
 
-  /* In a multi-threaded task we may select another thread
-     and then continue or step.
+  if (non_stop)
+    /* In non-stop, each thread is handled individually.  The context
+       must already be set to the right thread here.  */
+    ;
+  else
+    {
+      /* In a multi-threaded task we may select another thread and
+	 then continue or step.
 
-     But if the old thread was stopped at a breakpoint, it
-     will immediately cause another breakpoint stop without
-     any execution (i.e. it will report a breakpoint hit
-     incorrectly).  So we must step over it first.
+	 But if the old thread was stopped at a breakpoint, it will
+	 immediately cause another breakpoint stop without any
+	 execution (i.e. it will report a breakpoint hit incorrectly).
+	 So we must step over it first.
 
-     prepare_to_proceed checks the current thread against the thread
-     that reported the most recent event.  If a step-over is required
-     it returns TRUE and sets the current thread to the old thread. */
-  if (prepare_to_proceed (step))
-    oneproc = 1;
+	 prepare_to_proceed checks the current thread against the
+	 thread that reported the most recent event.  If a step-over
+	 is required it returns TRUE and sets the current thread to
+	 the old thread. */
+      if (prepare_to_proceed (step))
+	oneproc = 1;
+    }
 
   if (oneproc)
     {
@@ -1261,6 +1305,15 @@
      updated correctly when the inferior is stopped.  */
   prev_pc = regcache_read_pc (get_current_regcache ());
 
+  /* Fill in with reasonable starting values.  */
+  init_thread_stepping_state (tss);
+
+  /* We'll update this if & when we switch to a new thread. */
+  previous_inferior_ptid = inferior_ptid;
+
+  /* Reset to normal state.  */
+  init_infwait_state ();
+
   /* Resume inferior.  */
   resume (oneproc || step || bpstat_should_step (), stop_signal);
 
@@ -1281,7 +1334,6 @@
 void
 start_remote (int from_tty)
 {
-  init_thread_list ();
   init_wait_for_inferior ();
   stop_soon = STOP_QUIETLY_REMOTE;
   stepping_over_breakpoint = 0;
@@ -1333,6 +1385,10 @@
 
   target_last_wait_ptid = minus_one_ptid;
 
+  init_thread_stepping_state (tss);
+  previous_inferior_ptid = null_ptid;
+  init_infwait_state ();
+
   displaced_step_clear ();
 }
 
@@ -1363,33 +1419,23 @@
   SIGNAL_RECEIVED
 };
 
-/* This structure contains what used to be local variables in
-   wait_for_inferior.  Probably many of them can return to being
-   locals in handle_inferior_event.  */
+/* The PTID we'll do a target_wait on.*/
+ptid_t waiton_ptid;
 
+/* Current inferior wait state.  */
+enum infwait_states infwait_state;
+
+/* Data to be passed around while handling an event.  This data is
+   discarded between events.  */
 struct execution_control_state
 {
+  ptid_t ptid;
   struct target_waitstatus ws;
-  struct target_waitstatus *wp;
-  /* Should we step over breakpoint next time keep_going 
-     is called?  */
-  int stepping_over_breakpoint;
   int random_signal;
   CORE_ADDR stop_func_start;
   CORE_ADDR stop_func_end;
   char *stop_func_name;
-  struct symtab_and_line sal;
-  int current_line;
-  struct symtab *current_symtab;
-  ptid_t ptid;
-  ptid_t saved_inferior_ptid;
-  int step_after_step_resume_breakpoint;
-  int stepping_through_solib_after_catch;
-  bpstat stepping_through_solib_catchpoints;
   int new_thread_event;
-  struct target_waitstatus tmpstatus;
-  enum infwait_states infwait_state;
-  ptid_t waiton_ptid;
   int wait_some_more;
 };
 
@@ -1437,15 +1483,8 @@
   old_cleanups = make_cleanup (delete_step_resume_breakpoint,
 			       &step_resume_breakpoint);
 
-  /* wfi still stays in a loop, so it's OK just to take the address of
-     a local to get the ecs pointer.  */
   ecs = &ecss;
-
-  /* Fill in with reasonable starting values.  */
-  init_execution_control_state (ecs);
-
-  /* We'll update this if & when we switch to a new thread. */
-  previous_inferior_ptid = inferior_ptid;
+  memset (ecs, 0, sizeof (*ecs));
 
   overlay_cache_invalid = 1;
 
@@ -1460,9 +1499,9 @@
   while (1)
     {
       if (deprecated_target_wait_hook)
-	ecs->ptid = deprecated_target_wait_hook (ecs->waiton_ptid, ecs->wp);
+	ecs->ptid = deprecated_target_wait_hook (waiton_ptid, &ecs->ws);
       else
-	ecs->ptid = target_wait (ecs->waiton_ptid, ecs->wp);
+	ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
 
       if (treat_exec_as_sigtrap && ecs->ws.kind == TARGET_WAITKIND_EXECD)
         {
@@ -1484,50 +1523,57 @@
    event loop whenever a change of state is detected on the file
    descriptor corresponding to the target. It can be called more than
    once to complete a single execution command. In such cases we need
-   to keep the state in a global variable ASYNC_ECSS. If it is the
-   last time that this function is called for a single execution
-   command, then report to the user that the inferior has stopped, and
-   do the necessary cleanups. */
-
-struct execution_control_state async_ecss;
-struct execution_control_state *async_ecs;
+   to keep the state in a global variable ECSS. If it is the last time
+   that this function is called for a single execution command, then
+   report to the user that the inferior has stopped, and do the
+   necessary cleanups. */
 
 void
 fetch_inferior_event (void *client_data)
 {
-  static struct cleanup *old_cleanups;
+  struct execution_control_state ecss;
+  struct execution_control_state *ecs = &ecss;
+  struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+  int was_sync = sync_execution;
 
-  async_ecs = &async_ecss;
+  memset (ecs, 0, sizeof (*ecs));
 
-  if (!async_ecs->wait_some_more)
-    {
-      /* Fill in with reasonable starting values.  */
-      init_execution_control_state (async_ecs);
+  overlay_cache_invalid = 1;
 
-      /* We'll update this if & when we switch to a new thread. */
-      previous_inferior_ptid = inferior_ptid;
+  if (non_stop)
+    /* In non-stop mode, the user/frontend should not notice a thread
+       switch due to internal events.  Make sure we reverse to the
+       user selected thread and frame after handling the event and
+       running any breakpoint commands.  */
+    make_cleanup_restore_current_thread ();
 
-      overlay_cache_invalid = 1;
+  /* We have to invalidate the registers BEFORE calling target_wait
+     because they can be loaded from the target while in target_wait.
+     This makes remote debugging a bit more efficient for those
+     targets that provide critical registers as part of their normal
+     status mechanism. */
 
-      /* We have to invalidate the registers BEFORE calling target_wait
-         because they can be loaded from the target while in target_wait.
-         This makes remote debugging a bit more efficient for those
-         targets that provide critical registers as part of their normal
-         status mechanism. */
-
-      registers_changed ();
-    }
+  registers_changed ();
 
   if (deprecated_target_wait_hook)
-    async_ecs->ptid =
-      deprecated_target_wait_hook (async_ecs->waiton_ptid, async_ecs->wp);
+    ecs->ptid =
+      deprecated_target_wait_hook (waiton_ptid, &ecs->ws);
   else
-    async_ecs->ptid = target_wait (async_ecs->waiton_ptid, async_ecs->wp);
+    ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
+
+  if (non_stop
+      && ecs->ws.kind != TARGET_WAITKIND_IGNORE
+      && ecs->ws.kind != TARGET_WAITKIND_EXITED
+      && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED)
+    /* In non-stop mode, each thread is handled individually.  Switch
+       early, so the global state is set correctly for this
+       thread.  */
+    context_switch (ecs->ptid);
 
   /* Now figure out what to do with the result of the result.  */
-  handle_inferior_event (async_ecs);
+  handle_inferior_event (ecs);
 
-  if (!async_ecs->wait_some_more)
+  if (!ecs->wait_some_more)
     {
       delete_step_resume_breakpoint (&step_resume_breakpoint);
 
@@ -1537,6 +1583,14 @@
       else
 	inferior_event_handler (INF_EXEC_COMPLETE, NULL);
     }
+
+  /* Revert thread and frame.  */
+  do_cleanups (old_chain);
+
+  /* If the inferior was in sync execution mode, and now isn't,
+     restore the prompt.  */
+  if (was_sync && !sync_execution)
+    display_gdb_prompt (0);
 }
 
 /* Prepare an execution control state for looping through a
@@ -1545,17 +1599,24 @@
 void
 init_execution_control_state (struct execution_control_state *ecs)
 {
-  ecs->stepping_over_breakpoint = 0;
   ecs->random_signal = 0;
-  ecs->step_after_step_resume_breakpoint = 0;
-  ecs->stepping_through_solib_after_catch = 0;
-  ecs->stepping_through_solib_catchpoints = NULL;
-  ecs->sal = find_pc_line (prev_pc, 0);
-  ecs->current_line = ecs->sal.line;
-  ecs->current_symtab = ecs->sal.symtab;
-  ecs->infwait_state = infwait_normal_state;
-  ecs->waiton_ptid = pid_to_ptid (-1);
-  ecs->wp = &(ecs->ws);
+}
+
+/* Clear context switchable stepping state.  */
+
+void
+init_thread_stepping_state (struct thread_stepping_state *tss)
+{
+  struct symtab_and_line sal;
+
+  tss->stepping_over_breakpoint = 0;
+  tss->step_after_step_resume_breakpoint = 0;
+  tss->stepping_through_solib_after_catch = 0;
+  tss->stepping_through_solib_catchpoints = NULL;
+
+  sal = find_pc_line (prev_pc, 0);
+  tss->current_line = sal.line;
+  tss->current_symtab = sal.symtab;
 }
 
 /* Return the cached copy of the last pid/waitstatus returned by
@@ -1579,7 +1640,7 @@
 /* Switch thread contexts, maintaining "infrun state". */
 
 static void
-context_switch (struct execution_control_state *ecs)
+context_switch (ptid_t ptid)
 {
   /* Caution: it may happen that the new thread (or the old one!)
      is not in the thread list.  In this case we must not attempt
@@ -1592,33 +1653,61 @@
       fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ",
 			  target_pid_to_str (inferior_ptid));
       fprintf_unfiltered (gdb_stdlog, "to %s\n",
-			  target_pid_to_str (ecs->ptid));
+			  target_pid_to_str (ptid));
     }
 
-  if (in_thread_list (inferior_ptid) && in_thread_list (ecs->ptid))
+  if (in_thread_list (inferior_ptid) && in_thread_list (ptid))
     {				/* Perform infrun state context switch: */
       /* Save infrun state for the old thread.  */
       save_infrun_state (inferior_ptid, prev_pc,
 			 stepping_over_breakpoint, step_resume_breakpoint,
 			 step_range_start,
 			 step_range_end, &step_frame_id,
-			 ecs->stepping_over_breakpoint,
-			 ecs->stepping_through_solib_after_catch,
-			 ecs->stepping_through_solib_catchpoints,
-			 ecs->current_line, ecs->current_symtab);
+			 tss->stepping_over_breakpoint,
+			 tss->stepping_through_solib_after_catch,
+			 tss->stepping_through_solib_catchpoints,
+			 tss->current_line, tss->current_symtab,
+			 cmd_continuation, intermediate_continuation,
+			 proceed_to_finish,
+			 step_over_calls,
+			 stop_step,
+			 step_multi,
+			 stop_signal,
+			 stop_bpstat);
 
       /* Load infrun state for the new thread.  */
-      load_infrun_state (ecs->ptid, &prev_pc,
+      load_infrun_state (ptid, &prev_pc,
 			 &stepping_over_breakpoint, &step_resume_breakpoint,
 			 &step_range_start,
 			 &step_range_end, &step_frame_id,
-			 &ecs->stepping_over_breakpoint,
-			 &ecs->stepping_through_solib_after_catch,
-			 &ecs->stepping_through_solib_catchpoints,
-			 &ecs->current_line, &ecs->current_symtab);
+			 &tss->stepping_over_breakpoint,
+			 &tss->stepping_through_solib_after_catch,
+			 &tss->stepping_through_solib_catchpoints,
+			 &tss->current_line, &tss->current_symtab,
+			 &cmd_continuation, &intermediate_continuation,
+			 &proceed_to_finish,
+			 &step_over_calls,
+			 &stop_step,
+			 &step_multi,
+			 &stop_signal,
+			 &stop_bpstat);
     }
 
-  switch_to_thread (ecs->ptid);
+  switch_to_thread (ptid);
+}
+
+/* Context switch to thread PTID.  */
+ptid_t
+context_switch_to (ptid_t ptid)
+{
+  ptid_t current_ptid = inferior_ptid;
+
+  /* Context switch to the new thread.	*/
+  if (!ptid_equal (ptid, inferior_ptid))
+    {
+      context_switch (ptid);
+    }
+  return current_ptid;
 }
 
 static void
@@ -1689,12 +1778,33 @@
 
       if (singlestep_breakpoints_inserted_p
 	  || !ptid_equal (ecs->ptid, inferior_ptid)
-	  || !currently_stepping (ecs)
+	  || !currently_stepping (tss)
 	  || prev_pc == breakpoint_pc)
 	regcache_write_pc (regcache, breakpoint_pc);
     }
 }
 
+void
+init_infwait_state (void)
+{
+  waiton_ptid = pid_to_ptid (-1);
+  infwait_state = infwait_normal_state;
+}
+
+void
+error_is_running (void)
+{
+  error (_("\
+Cannot execute this command while the selected thread is running."));
+}
+
+void
+ensure_not_running (void)
+{
+  if (is_running (inferior_ptid))
+    error_is_running ();
+}
+
 /* Given an execution control state that has been freshly filled in
    by an event from the inferior, figure out what it means and take
    appropriate action.  */
@@ -1705,23 +1815,49 @@
   int sw_single_step_trap_p = 0;
   int stopped_by_watchpoint;
   int stepped_after_stopped_by_watchpoint = 0;
+  struct symtab_and_line stop_pc_sal;
+
+  breakpoint_retire_moribund ();
 
   /* Cache the last pid/waitstatus. */
   target_last_wait_ptid = ecs->ptid;
-  target_last_waitstatus = *ecs->wp;
+  target_last_waitstatus = ecs->ws;
 
   /* Always clear state belonging to the previous time we stopped.  */
   stop_stack_dummy = 0;
 
   adjust_pc_after_break (ecs);
 
-  switch (ecs->infwait_state)
+  reinit_frame_cache ();
+
+  /* If it's a new process, add it to the thread database */
+
+  ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
+			   && !ptid_equal (ecs->ptid, minus_one_ptid)
+			   && !in_thread_list (ecs->ptid));
+
+  if (ecs->ws.kind != TARGET_WAITKIND_EXITED
+      && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
+    add_thread (ecs->ptid);
+
+  if (ecs->ws.kind != TARGET_WAITKIND_IGNORE)
+    {
+      /* Mark the non-executing threads accordingly.  */
+      if (!non_stop
+ 	  || ecs->ws.kind == TARGET_WAITKIND_EXITED
+ 	  || ecs->ws.kind == TARGET_WAITKIND_SIGNALLED)
+ 	set_executing (pid_to_ptid (-1), 0);
+      else
+ 	set_executing (ecs->ptid, 0);
+    }
+
+  switch (infwait_state)
     {
     case infwait_thread_hop_state:
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: infwait_thread_hop_state\n");
       /* Cancel the waiton_ptid. */
-      ecs->waiton_ptid = pid_to_ptid (-1);
+      waiton_ptid = pid_to_ptid (-1);
       break;
 
     case infwait_normal_state:
@@ -1752,19 +1888,7 @@
     default:
       internal_error (__FILE__, __LINE__, _("bad switch"));
     }
-  ecs->infwait_state = infwait_normal_state;
-
-  reinit_frame_cache ();
-
-  /* If it's a new process, add it to the thread database */
-
-  ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
-			   && !ptid_equal (ecs->ptid, minus_one_ptid)
-			   && !in_thread_list (ecs->ptid));
-
-  if (ecs->ws.kind != TARGET_WAITKIND_EXITED
-      && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
-    add_thread (ecs->ptid);
+  infwait_state = infwait_normal_state;
 
   switch (ecs->ws.kind)
     {
@@ -1891,12 +2015,12 @@
       stop_signal = TARGET_SIGNAL_TRAP;
       pending_follow.kind = ecs->ws.kind;
 
-      pending_follow.fork_event.parent_pid = PIDGET (ecs->ptid);
+      pending_follow.fork_event.parent_pid = ecs->ptid;
       pending_follow.fork_event.child_pid = ecs->ws.value.related_pid;
 
       if (!ptid_equal (ecs->ptid, inferior_ptid))
 	{
-	  context_switch (ecs);
+	  context_switch (ecs->ptid);
 	  reinit_frame_cache ();
 	}
 
@@ -1926,21 +2050,27 @@
 
       /* This causes the eventpoints and symbol table to be reset.  Must
          do this now, before trying to determine whether to stop. */
-      follow_exec (PIDGET (inferior_ptid), pending_follow.execd_pathname);
+      follow_exec (inferior_ptid, pending_follow.execd_pathname);
       xfree (pending_follow.execd_pathname);
 
       stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
-      ecs->saved_inferior_ptid = inferior_ptid;
-      inferior_ptid = ecs->ptid;
 
-      stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+      {
+	/* The breakpoints module may need to touch the inferior's
+	   memory.  Switch to the (stopped) event ptid
+	   momentarily.  */
+	ptid_t saved_inferior_ptid = inferior_ptid;
+	inferior_ptid = ecs->ptid;
 
-      ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
-      inferior_ptid = ecs->saved_inferior_ptid;
+	stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+
+	ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
+	inferior_ptid = saved_inferior_ptid;
+      }
 
       if (!ptid_equal (ecs->ptid, inferior_ptid))
 	{
-	  context_switch (ecs);
+	  context_switch (ecs->ptid);
 	  reinit_frame_cache ();
 	}
 
@@ -1996,15 +2126,22 @@
       return;
     }
 
-  /* We may want to consider not doing a resume here in order to give
-     the user a chance to play with the new thread.  It might be good
-     to make that a user-settable option.  */
-
-  /* At this point, all threads are stopped (happens automatically in
-     either the OS or the native code).  Therefore we need to continue
-     all threads in order to make progress.  */
   if (ecs->new_thread_event)
     {
+      if (non_stop)
+	/* Non-stop assumes that the target handles adding new threads
+	   to the thread list.  */
+	internal_error (__FILE__, __LINE__, "\
+targets should add new threads to the thread list themselves in non-stop mode.");
+
+      /* We may want to consider not doing a resume here in order to
+	 give the user a chance to play with the new thread.  It might
+	 be good to make that a user-settable option.  */
+
+      /* At this point, all threads are stopped (happens automatically
+	 in either the OS or the native code).  Therefore we need to
+	 continue all threads in order to make progress.  */
+
       target_resume (RESUME_ALL, 0, TARGET_SIGNAL_0);
       prepare_to_wait (ecs);
       return;
@@ -2057,8 +2194,7 @@
 
 	  ecs->random_signal = 0;
 
-	  ecs->ptid = saved_singlestep_ptid;
-	  context_switch (ecs);
+	  context_switch (saved_singlestep_ptid);
 	  if (deprecated_context_hook)
 	    deprecated_context_hook (pid_to_thread_id (ecs->ptid));
 
@@ -2072,6 +2208,9 @@
 
   if (!ptid_equal (deferred_step_ptid, null_ptid))
     {
+      /* In non-stop mode, there's never a deferred_step_ptid set.  */
+      gdb_assert (!non_stop);
+
       /* If we stopped for some other reason than single-stepping, ignore
 	 the fact that we were supposed to switch back.  */
       if (stop_signal == TARGET_SIGNAL_TRAP)
@@ -2218,12 +2357,17 @@
 	  else
 	    {			/* Single step */
 	      if (!ptid_equal (inferior_ptid, ecs->ptid))
-		context_switch (ecs);
-	      ecs->waiton_ptid = ecs->ptid;
-	      ecs->wp = &(ecs->ws);
-	      ecs->stepping_over_breakpoint = 1;
+		context_switch (ecs->ptid);
 
-	      ecs->infwait_state = infwait_thread_hop_state;
+	      if (!non_stop)
+		{
+		  /* Only need to require the next event from this
+		     thread in all-stop mode.  */
+		  waiton_ptid = ecs->ptid;
+		  infwait_state = infwait_thread_hop_state;
+		}
+
+	      tss->stepping_over_breakpoint = 1;
 	      keep_going (ecs);
 	      registers_changed ();
 	      return;
@@ -2245,7 +2389,7 @@
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: context switch\n");
 
-      context_switch (ecs);
+      context_switch (ecs->ptid);
 
       if (deprecated_context_hook)
 	deprecated_context_hook (pid_to_thread_id (ecs->ptid));
@@ -2294,11 +2438,11 @@
 	remove_breakpoints ();
       registers_changed ();
       target_resume (ecs->ptid, 1, TARGET_SIGNAL_0);	/* Single step */
-      ecs->waiton_ptid = ecs->ptid;
+      waiton_ptid = ecs->ptid;
       if (HAVE_STEPPABLE_WATCHPOINT)
-	ecs->infwait_state = infwait_step_watch_state;
+	infwait_state = infwait_step_watch_state;
       else
-	ecs->infwait_state = infwait_nonstep_watch_state;
+	infwait_state = infwait_nonstep_watch_state;
       prepare_to_wait (ecs);
       return;
     }
@@ -2312,7 +2456,7 @@
 			    &ecs->stop_func_start, &ecs->stop_func_end);
   ecs->stop_func_start
     += gdbarch_deprecated_function_start_offset (current_gdbarch);
-  ecs->stepping_over_breakpoint = 0;
+  tss->stepping_over_breakpoint = 0;
   bpstat_clear (&stop_bpstat);
   stop_step = 0;
   stop_print_frame = 1;
@@ -2322,7 +2466,7 @@
   if (stop_signal == TARGET_SIGNAL_TRAP
       && stepping_over_breakpoint
       && gdbarch_single_step_through_delay_p (current_gdbarch)
-      && currently_stepping (ecs))
+      && currently_stepping (tss))
     {
       /* We're trying to step off a breakpoint.  Turns out that we're
 	 also on an instruction that needs to be stepped multiple
@@ -2338,7 +2482,7 @@
 	{
 	  /* The user issued a continue when stopped at a breakpoint.
 	     Set up for another trap and get out of here.  */
-         ecs->stepping_over_breakpoint = 1;
+         tss->stepping_over_breakpoint = 1;
          keep_going (ecs);
          return;
 	}
@@ -2350,15 +2494,15 @@
 	     case, don't decide that here, just set 
 	     ecs->stepping_over_breakpoint, making sure we 
 	     single-step again before breakpoints are re-inserted.  */
-	  ecs->stepping_over_breakpoint = 1;
+	  tss->stepping_over_breakpoint = 1;
 	}
     }
 
   /* Look at the cause of the stop, and decide what to do.
      The alternatives are:
-     1) break; to really stop and return to the debugger,
-     2) drop through to start up again
-     (set ecs->stepping_over_breakpoint to 1 to single step once)
+     1) stop_stepping and return; to really stop and return to the debugger,
+     2) keep_going and return to start up again
+     (set tss->stepping_over_breakpoint to 1 to single step once)
      3) set ecs->random_signal to 1, and the decision between 1 and 2
      will be made according to the signal handling tables.  */
 
@@ -2405,13 +2549,20 @@
 	}
 
       /* This originates from attach_command().  We need to overwrite
-         the stop_signal here, because some kernels don't ignore a
-         SIGSTOP in a subsequent ptrace(PTRACE_CONT,SIGSTOP) call.
-         See more comments in inferior.h.  On the other hand, if we
+	 the stop_signal here, because some kernels don't ignore a
+	 SIGSTOP in a subsequent ptrace(PTRACE_CONT,SIGSTOP) call.
+	 See more comments in inferior.h.  On the other hand, if we
 	 get a non-SIGSTOP, report it to the user - assume the backend
-	 will handle the SIGSTOP if it should show up later.  */
+	 will handle the SIGSTOP if it should show up later.
+
+	 Also consider that the attach is complete when we see a
+	 SIGTRAP.  Some systems (e.g. Windows), and stubs supporting
+	 target extended-remote report it instead of a SIGSTOP
+	 (e.g. gdbserver).  We already rely on SIGTRAP being our
+	 signal, so this is no exception.  */
       if (stop_soon == STOP_QUIETLY_NO_SIGSTOP
-	  && stop_signal == TARGET_SIGNAL_STOP)
+	  && (stop_signal == TARGET_SIGNAL_STOP
+	      || stop_signal == TARGET_SIGNAL_TRAP))
 	{
 	  stop_stepping (ecs);
 	  stop_signal = TARGET_SIGNAL_0;
@@ -2519,7 +2670,7 @@
                                 "breakpoint\n");
 
 	  insert_step_resume_breakpoint_at_frame (get_current_frame ());
-	  ecs->step_after_step_resume_breakpoint = 1;
+	  tss->step_after_step_resume_breakpoint = 1;
 	  keep_going (ecs);
 	  return;
 	}
@@ -2583,7 +2734,7 @@
 	  fprintf_unfiltered (gdb_stdlog,
 			      "infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME\n");
 
-	ecs->stepping_over_breakpoint = 1;
+	tss->stepping_over_breakpoint = 1;
 
 	if (!gdbarch_get_longjmp_target_p (current_gdbarch)
 	    || !gdbarch_get_longjmp_target (current_gdbarch,
@@ -2623,7 +2774,7 @@
       case BPSTAT_WHAT_SINGLE:
         if (debug_infrun)
 	  fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
-	ecs->stepping_over_breakpoint = 1;
+	tss->stepping_over_breakpoint = 1;
 	/* Still need to check other stuff, at least the case
 	   where we are stepping and step out of the right range.  */
 	break;
@@ -2677,13 +2828,13 @@
 	      bpstat_find_step_resume_breakpoint (stop_bpstat);
 	  }
 	delete_step_resume_breakpoint (&step_resume_breakpoint);
-	if (ecs->step_after_step_resume_breakpoint)
+	if (tss->step_after_step_resume_breakpoint)
 	  {
 	    /* Back when the step-resume breakpoint was inserted, we
 	       were trying to single-step off a breakpoint.  Go back
 	       to doing that.  */
-	    ecs->step_after_step_resume_breakpoint = 0;
-	    ecs->stepping_over_breakpoint = 1;
+	    tss->step_after_step_resume_breakpoint = 0;
+	    tss->stepping_over_breakpoint = 1;
 	    keep_going (ecs);
 	    return;
 	  }
@@ -2758,19 +2909,19 @@
 	         friends) until we reach non-dld code.  At that point,
 	         we can stop stepping. */
 	      bpstat_get_triggered_catchpoints (stop_bpstat,
-						&ecs->
+						&tss->
 						stepping_through_solib_catchpoints);
-	      ecs->stepping_through_solib_after_catch = 1;
+	      tss->stepping_through_solib_after_catch = 1;
 
 	      /* Be sure to lift all breakpoints, so the inferior does
 	         actually step past this point... */
-	      ecs->stepping_over_breakpoint = 1;
+	      tss->stepping_over_breakpoint = 1;
 	      break;
 	    }
 	  else
 	    {
 	      /* We want to step over this breakpoint, then keep going.  */
-	      ecs->stepping_over_breakpoint = 1;
+	      tss->stepping_over_breakpoint = 1;
 	      break;
 	    }
 	}
@@ -2793,7 +2944,7 @@
   /* Are we stepping to get the inferior out of the dynamic linker's
      hook (and possibly the dld itself) after catching a shlib
      event?  */
-  if (ecs->stepping_through_solib_after_catch)
+  if (tss->stepping_through_solib_after_catch)
     {
 #if defined(SOLIB_ADD)
       /* Have we reached our destination?  If not, keep going. */
@@ -2801,7 +2952,7 @@
 	{
           if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog, "infrun: stepping in dynamic linker\n");
-	  ecs->stepping_over_breakpoint = 1;
+	  tss->stepping_over_breakpoint = 1;
 	  keep_going (ecs);
 	  return;
 	}
@@ -2810,10 +2961,10 @@
 	 fprintf_unfiltered (gdb_stdlog, "infrun: step past dynamic linker\n");
       /* Else, stop and report the catchpoint(s) whose triggering
          caused us to begin stepping. */
-      ecs->stepping_through_solib_after_catch = 0;
+      tss->stepping_through_solib_after_catch = 0;
       bpstat_clear (&stop_bpstat);
-      stop_bpstat = bpstat_copy (ecs->stepping_through_solib_catchpoints);
-      bpstat_clear (&ecs->stepping_through_solib_catchpoints);
+      stop_bpstat = bpstat_copy (tss->stepping_through_solib_catchpoints);
+      bpstat_clear (&tss->stepping_through_solib_catchpoints);
       stop_print_frame = 1;
       stop_stepping (ecs);
       return;
@@ -3048,14 +3199,14 @@
 	}
     }
 
-  ecs->sal = find_pc_line (stop_pc, 0);
+  stop_pc_sal = find_pc_line (stop_pc, 0);
 
   /* NOTE: tausq/2004-05-24: This if block used to be done before all
      the trampoline processing logic, however, there are some trampolines 
      that have no names, so we should do trampoline handling first.  */
   if (step_over_calls == STEP_OVER_UNDEBUGGABLE
       && ecs->stop_func_name == NULL
-      && ecs->sal.line == 0)
+      && stop_pc_sal.line == 0)
     {
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepped into undebuggable function\n");
@@ -3101,7 +3252,7 @@
       return;
     }
 
-  if (ecs->sal.line == 0)
+  if (stop_pc_sal.line == 0)
     {
       /* We have no line number information.  That means to stop
          stepping (does this always happen right after one instruction,
@@ -3115,9 +3266,9 @@
       return;
     }
 
-  if ((stop_pc == ecs->sal.pc)
-      && (ecs->current_line != ecs->sal.line
-	  || ecs->current_symtab != ecs->sal.symtab))
+  if ((stop_pc == stop_pc_sal.pc)
+      && (tss->current_line != stop_pc_sal.line
+	  || tss->current_symtab != stop_pc_sal.symtab))
     {
       /* We are at the start of a different line.  So stop.  Note that
          we don't stop if we step into the middle of a different line.
@@ -3138,11 +3289,11 @@
      new line in mid-statement, we continue stepping.  This makes
      things like for(;;) statements work better.)  */
 
-  step_range_start = ecs->sal.pc;
-  step_range_end = ecs->sal.end;
+  step_range_start = stop_pc_sal.pc;
+  step_range_end = stop_pc_sal.end;
   step_frame_id = get_frame_id (get_current_frame ());
-  ecs->current_line = ecs->sal.line;
-  ecs->current_symtab = ecs->sal.symtab;
+  tss->current_line = stop_pc_sal.line;
+  tss->current_symtab = stop_pc_sal.symtab;
 
   /* In the case where we just stepped out of a function into the
      middle of a line of the caller, continue stepping, but
@@ -3179,11 +3330,11 @@
 /* Are we in the middle of stepping?  */
 
 static int
-currently_stepping (struct execution_control_state *ecs)
+currently_stepping (struct thread_stepping_state *tss)
 {
   return (((step_range_end && step_resume_breakpoint == NULL)
 	   || stepping_over_breakpoint)
-	  || ecs->stepping_through_solib_after_catch
+	  || tss->stepping_through_solib_after_catch
 	  || bpstat_should_step ());
 }
 
@@ -3194,24 +3345,24 @@
 step_into_function (struct execution_control_state *ecs)
 {
   struct symtab *s;
-  struct symtab_and_line sr_sal;
+  struct symtab_and_line stop_func_sal, sr_sal;
 
   s = find_pc_symtab (stop_pc);
   if (s && s->language != language_asm)
     ecs->stop_func_start = gdbarch_skip_prologue
 			     (current_gdbarch, ecs->stop_func_start);
 
-  ecs->sal = find_pc_line (ecs->stop_func_start, 0);
+  stop_func_sal = find_pc_line (ecs->stop_func_start, 0);
   /* Use the step_resume_break to step until the end of the prologue,
      even if that involves jumps (as it seems to on the vax under
      4.2).  */
   /* If the prologue ends in the middle of a source line, continue to
      the end of that source line (if it is still within the function).
      Otherwise, just go to end of prologue.  */
-  if (ecs->sal.end
-      && ecs->sal.pc != ecs->stop_func_start
-      && ecs->sal.end < ecs->stop_func_end)
-    ecs->stop_func_start = ecs->sal.end;
+  if (stop_func_sal.end
+      && stop_func_sal.pc != ecs->stop_func_start
+      && stop_func_sal.end < ecs->stop_func_end)
+    ecs->stop_func_start = stop_func_sal.end;
 
   /* Architectures which require breakpoint adjustment might not be able
      to place a breakpoint at the computed address.  If so, the test
@@ -3388,7 +3539,7 @@
       /* We took a signal (which we are supposed to pass through to
          the inferior, else we'd have done a break above) and we
          haven't yet gotten our trap.  Simply continue.  */
-      resume (currently_stepping (ecs), stop_signal);
+      resume (currently_stepping (tss), stop_signal);
     }
   else
     {
@@ -3405,7 +3556,7 @@
 	 already inserted breakpoints.  Therefore, we don't
 	 care if breakpoints were already inserted, or not.  */
       
-      if (ecs->stepping_over_breakpoint)
+      if (tss->stepping_over_breakpoint)
 	{
 	  if (! use_displaced_stepping (current_gdbarch))
 	    /* Since we can't do a displaced step, we have to remove
@@ -3429,7 +3580,7 @@
 	    }
 	}
 
-      stepping_over_breakpoint = ecs->stepping_over_breakpoint;
+      stepping_over_breakpoint = tss->stepping_over_breakpoint;
 
       /* Do not deliver SIGNAL_TRAP (except when the user explicitly
          specifies that such a signal should be delivered to the
@@ -3447,7 +3598,7 @@
 	stop_signal = TARGET_SIGNAL_0;
 
 
-      resume (currently_stepping (ecs), stop_signal);
+      resume (currently_stepping (tss), stop_signal);
     }
 
   prepare_to_wait (ecs);
@@ -3462,7 +3613,7 @@
 {
   if (debug_infrun)
     fprintf_unfiltered (gdb_stdlog, "infrun: prepare_to_wait\n");
-  if (ecs->infwait_state == infwait_normal_state)
+  if (infwait_state == infwait_normal_state)
     {
       overlay_cache_invalid = 1;
 
@@ -3473,8 +3624,7 @@
          as part of their normal status mechanism. */
 
       registers_changed ();
-      ecs->waiton_ptid = pid_to_ptid (-1);
-      ecs->wp = &(ecs->ws);
+      waiton_ptid = pid_to_ptid (-1);
     }
   /* This is the old end of the while loop.  Let everybody know we
      want to wait for the inferior some more and get called again
@@ -3590,6 +3740,11 @@
 
   get_last_target_status (&last_ptid, &last);
 
+  /* In non-stop mode, we don't want GDB to switch threads behind the
+     user's back, to avoid races where the user is typing a command to
+     apply to thread x, but GDB switches to thread y before the user
+     finishes entering the command.  */
+
   /* As with the notification of thread events, we want to delay
      notifying the user that we've switched thread context until
      the inferior actually stops.
@@ -3597,7 +3752,8 @@
      There's no point in saying anything if the inferior has exited.
      Note that SIGNALLED here means "exited with a signal", not
      "received a signal".  */
-  if (!ptid_equal (previous_inferior_ptid, inferior_ptid)
+  if (!non_stop
+      && !ptid_equal (previous_inferior_ptid, inferior_ptid)
       && target_has_execution
       && last.kind != TARGET_WAITKIND_SIGNALLED
       && last.kind != TARGET_WAITKIND_EXITED)
@@ -3729,8 +3885,21 @@
 	    }
 
 	  if (ui_out_is_mi_like_p (uiout))
-	    ui_out_field_int (uiout, "thread-id",
-			      pid_to_thread_id (inferior_ptid));
+	    {
+
+	      ui_out_field_int (uiout, "thread-id",
+				pid_to_thread_id (inferior_ptid));
+	      if (non_stop)
+		{
+		  struct cleanup *back_to = make_cleanup_ui_out_list_begin_end 
+		    (uiout, "stopped-threads");
+		  ui_out_field_int (uiout, NULL,
+				    pid_to_thread_id (inferior_ptid));		  		  
+		  do_cleanups (back_to);
+		}
+	      else
+		ui_out_field_string (uiout, "stopped-threads", "all");
+	    }
 	  /* The behavior of this routine with respect to the source
 	     flag is:
 	     SRC_LINE: Print only source line
@@ -3772,10 +3941,21 @@
 
 done:
   annotate_stopped ();
-  observer_notify_normal_stop (stop_bpstat);
+  if (!suppress_stop_observer && !step_multi)
+    observer_notify_normal_stop (stop_bpstat);
   /* Delete the breakpoint we stopped at, if it wants to be deleted.
      Delete any breakpoint that is to be deleted at the next stop.  */
   breakpoint_auto_delete (stop_bpstat);
+
+  if (target_has_execution
+      && last.kind != TARGET_WAITKIND_SIGNALLED
+      && last.kind != TARGET_WAITKIND_EXITED)
+    {
+      if (!non_stop)
+	set_running (pid_to_ptid (-1), 0);
+      else
+	set_running (inferior_ptid, 0);
+    }
 }
 
 static int
@@ -4315,7 +4495,7 @@
 }
 
 int
-inferior_has_forked (int pid, int *child_pid)
+inferior_has_forked (ptid_t pid, ptid_t *child_pid)
 {
   struct target_waitstatus last;
   ptid_t last_ptid;
@@ -4325,7 +4505,7 @@
   if (last.kind != TARGET_WAITKIND_FORKED)
     return 0;
 
-  if (ptid_get_pid (last_ptid) != pid)
+  if (!ptid_equal (last_ptid, pid))
     return 0;
 
   *child_pid = last.value.related_pid;
@@ -4333,7 +4513,7 @@
 }
 
 int
-inferior_has_vforked (int pid, int *child_pid)
+inferior_has_vforked (ptid_t pid, ptid_t *child_pid)
 {
   struct target_waitstatus last;
   ptid_t last_ptid;
@@ -4343,7 +4523,7 @@
   if (last.kind != TARGET_WAITKIND_VFORKED)
     return 0;
 
-  if (ptid_get_pid (last_ptid) != pid)
+  if (!ptid_equal (last_ptid, pid))
     return 0;
 
   *child_pid = last.value.related_pid;
@@ -4351,7 +4531,7 @@
 }
 
 int
-inferior_has_execd (int pid, char **execd_pathname)
+inferior_has_execd (ptid_t pid, char **execd_pathname)
 {
   struct target_waitstatus last;
   ptid_t last_ptid;
@@ -4361,7 +4541,7 @@
   if (last.kind != TARGET_WAITKIND_EXECD)
     return 0;
 
-  if (ptid_get_pid (last_ptid) != pid)
+  if (!ptid_equal (last_ptid, pid))
     return 0;
 
   *execd_pathname = xstrdup (last.value.execd_pathname);
@@ -4453,6 +4633,32 @@
 }
 
 
+int non_stop = 0;
+static int non_stop_1 = 0;
+
+static void
+set_non_stop (char *args, int from_tty,
+	      struct cmd_list_element *c)
+{
+  if (target_has_execution)
+    {
+      non_stop_1 = non_stop;
+      error (_("Cannot change this setting while the inferior is running."));
+    }
+
+  non_stop = non_stop_1;
+}
+
+static void
+show_non_stop (struct ui_file *file, int from_tty,
+	       struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("Controlling the inferior in non-stop mode is %s.\n"),
+		    value);
+}
+
+
 void
 _initialize_infrun (void)
 {
@@ -4526,6 +4732,26 @@
 			    show_debug_displaced,
 			    &setdebuglist, &showdebuglist);
 
+  add_setshow_boolean_cmd ("non-stop", no_class,
+			   &non_stop_1, _("\
+Set whether gdb controls the inferior in non-stop mode."), _("\
+Show whether gdb controls the inferior in non-stop mode."), _("\
+When debugging a multi-threaded program and this setting is\n\
+off (the default, also called all-stop mode), when one thread stops\n\
+(for a breakpoint, watchpoint, exception, or similar events), GDB stops\n\
+all other threads in the program while you interact with the thread of\n\
+interest.  When you continue or step a thread, you can allow the other\n\
+threads to run, or have them remain stopped, but while you inspect any\n\
+thread's state, all threads stop.\n\
+\n\
+In non-stop mode, when one thread stops, other threads can continue\n\
+to run freely.  You'll be able to step each thread independently,\n\
+leave it stopped or free to run as needed."),
+			   set_non_stop,
+			   show_non_stop,
+			   &setlist,
+			   &showlist);
+
   numsigs = (int) TARGET_SIGNAL_LAST;
   signal_stop = (unsigned char *) xmalloc (sizeof (signal_stop[0]) * numsigs);
   signal_print = (unsigned char *)
@@ -4622,17 +4848,16 @@
 			   &setlist, &showlist);
 
   add_setshow_boolean_cmd ("can-use-displaced-stepping", class_maintenance,
-			    &can_use_displaced_stepping, _("\
+			   &can_use_displaced_stepping, _("\
 Set debugger's willingness to use displaced stepping."), _("\
 Show debugger's willingness to use displaced stepping."), _("\
-If zero, gdb will not use to use displaced stepping to step over\n\
+If zero, gdb will not use displaced stepping to step over\n\
 breakpoints, even if such is supported by the target."),
-			    NULL,
-			    show_can_use_displaced_stepping,
-			    &maintenance_set_cmdlist,
+			   NULL,
+			   show_can_use_displaced_stepping,
+			   &maintenance_set_cmdlist,
 			   &maintenance_show_cmdlist);
 
-
   /* ptid initializations */
   null_ptid = ptid_build (0, 0, 0);
   minus_one_ptid = ptid_build (-1, 0, 0);
diff --git a/gdb/interps.c b/gdb/interps.c
index 0ebc3f4..b4c804a 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -148,7 +148,7 @@
 
   if (current_interpreter != NULL)
     {
-      do_all_continuations (0);
+      do_all_continuations ();
       ui_out_flush (uiout);
       if (current_interpreter->procs->suspend_proc
 	  && !current_interpreter->procs->suspend_proc (current_interpreter->
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index d938fe7..4843ff1 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -356,7 +356,7 @@
 }
 
 static struct iq2000_frame_cache *
-iq2000_frame_cache (struct frame_info *next_frame, void **this_cache)
+iq2000_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct iq2000_frame_cache *cache;
   CORE_ADDR current_pc;
@@ -369,16 +369,16 @@
   iq2000_init_frame_cache (cache);
   *this_cache = cache;
 
-  cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
   //if (cache->base == 0)
     //return cache;
 
-  current_pc = frame_pc_unwind (next_frame);
+  current_pc = get_frame_pc (this_frame);
   find_pc_partial_function (current_pc, NULL, &cache->pc, NULL);
   if (cache->pc != 0)
-    iq2000_scan_prologue (cache->pc, current_pc, next_frame, cache);
+    iq2000_scan_prologue (cache->pc, current_pc, this_frame, cache);
   if (!cache->using_fp)
-    cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
+    cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
 
   cache->saved_sp = cache->base + cache->framesize;
 
@@ -389,52 +389,30 @@
   return cache;
 }
 
-static void
-iq2000_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			    int regnum, int *optimizedp,
-			    enum lval_type *lvalp, CORE_ADDR *addrp,
-			    int *realnump, gdb_byte *valuep)
+static struct value *
+iq2000_frame_prev_register (struct frame_info *this_frame, void **this_cache,
+			    int regnum)
 {
-  struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
+  struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache);
+
   if (regnum == E_SP_REGNUM && cache->saved_sp)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (valuep)
-        store_unsigned_integer (valuep, 4, cache->saved_sp);
-      return;
-    }
+    return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
 
   if (regnum == E_PC_REGNUM)
     regnum = E_LR_REGNUM;
 
   if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != -1)
-    {
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = cache->saved_regs[regnum];
-      *realnump = -1;
-      if (valuep)
-        read_memory (*addrp, valuep,
-		     register_size (get_frame_arch (next_frame), regnum));
-      return;
-    }
+    return frame_unwind_got_memory (this_frame, regnum,
+                                    cache->saved_regs[regnum]);
 
-  *optimizedp = 0;
-  *lvalp = lval_register;
-  *addrp = 0; 
-  *realnump = regnum;
-  if (valuep)
-    frame_unwind_register (next_frame, (*realnump), valuep);
+  return frame_unwind_got_register (this_frame, regnum, regnum);
 }
 
 static void
-iq2000_frame_this_id (struct frame_info *next_frame, void **this_cache,
+iq2000_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		      struct frame_id *this_id)
 {
-  struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
+  struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache);
 
   /* This marks the outermost frame.  */
   if (cache->base == 0) 
@@ -446,15 +424,11 @@
 static const struct frame_unwind iq2000_frame_unwind = {
   NORMAL_FRAME,
   iq2000_frame_this_id,
-  iq2000_frame_prev_register
+  iq2000_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-iq2000_frame_sniffer (struct frame_info *next_frame)
-{
-  return &iq2000_frame_unwind;
-}
-
 static CORE_ADDR
 iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -468,16 +442,16 @@
 }
 
 static struct frame_id
-iq2000_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (iq2000_unwind_sp (gdbarch, next_frame),
-                         frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 static CORE_ADDR
-iq2000_frame_base_address (struct frame_info *next_frame, void **this_cache)
+iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
+  struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache);
 
   return cache->base;
 }
@@ -851,14 +825,14 @@
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
   set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
   set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
-  set_gdbarch_unwind_dummy_id (gdbarch, iq2000_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
 
   gdbarch_init_osabi (info, gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, iq2000_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &iq2000_frame_unwind);
 
   return gdbarch;
 }
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index a9f5fae..fcc8a29 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -337,7 +337,9 @@
     {
       pid = PIDGET (fp->ptid);
       do {
-	ptrace (PT_KILL, pid, 0, 0);
+	/* Use SIGKILL instead of PTRACE_KILL because the former works even
+	   if the thread is running, while the later doesn't.  */
+	kill (pid, SIGKILL);
 	ret = waitpid (pid, &status, 0);
 	/* We might get a SIGCHLD instead of an exit status.  This is
 	 aggravated by the first kill above - a child has just
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 47dac59..967beb4 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -50,29 +50,107 @@
 #include "event-loop.h"
 #include "event-top.h"
 
-/* Note on this file's use of signals:
+#ifdef HAVE_PERSONALITY
+# include <sys/personality.h>
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#  define ADDR_NO_RANDOMIZE 0x0040000
+# endif
+#endif /* HAVE_PERSONALITY */
 
-   We stop threads by sending a SIGSTOP.  The use of SIGSTOP instead
-   of another signal is not entirely significant; we just need for a
-   signal to be delivered, so that we can intercept it.  SIGSTOP's
-   advantage is that it can not be blocked.  A disadvantage is that it
-   is not a real-time signal, so it can only be queued once; we do not
-   keep track of other sources of SIGSTOP.
+/* This comment documents high-level logic of this file. 
 
-   Two other signals that can't be blocked are SIGCONT and SIGKILL.
-   But we can't use them, because they have special behavior when the
-   signal is generated - not when it is delivered.  SIGCONT resumes
-   the entire thread group and SIGKILL kills the entire thread group.
+Waiting for events in sync mode
+===============================
 
-   A delivered SIGSTOP would stop the entire thread group, not just the
-   thread we tkill'd.  But we never let the SIGSTOP deliver; we always
-   intercept and cancel it (by PTRACE_CONT without passing SIGSTOP).
+When waiting for an event in a specific thread, we just use waitpid, passing
+the specific pid, and not passing WNOHANG.
 
-   We could use a real-time signal instead.  This would solve those
-   problems; we could use PTRACE_GETSIGINFO to locate the specific
-   stop signals sent by GDB.  But we would still have to have some
-   support for SIGSTOP, since PTRACE_ATTACH generates it, and there
-   are races with trying to find a signal that is not blocked.  */
+When waiting for an event in all threads, waitpid is not quite good. Prior to
+version 2.4, Linux can either wait for event in main thread, or in secondary
+threads. (2.4 has the __WALL flag).  So, if we use blocking waitpid, we might
+miss an event.  The solution is to use non-blocking waitpid, together with
+sigsuspend.  First, we use non-blocking waitpid to get an event in the main 
+process, if any. Second, we use non-blocking waitpid with the __WCLONED
+flag to check for events in cloned processes.  If nothing is found, we use
+sigsuspend to wait for SIGCHLD.  When SIGCHLD arrives, it means something
+happened to a child process -- and SIGCHLD will be delivered both for events
+in main debugged process and in cloned processes.  As soon as we know there's
+an event, we get back to calling nonblocking waitpid with and without __WCLONED.
+
+Note that SIGCHLD should be blocked between waitpid and sigsuspend calls,
+so that we don't miss a signal. If SIGCHLD arrives in between, when it's
+blocked, the signal becomes pending and sigsuspend immediately
+notices it and returns.
+
+Waiting for events in async mode
+================================
+
+In async mode, GDB should always be ready to handle both user input and target
+events, so neither blocking waitpid nor sigsuspend are viable
+options. Instead, we should notify the GDB main event loop whenever there's
+unprocessed event from the target.  The only way to notify this event loop is
+to make it wait on input from a pipe, and write something to the pipe whenever
+there's event. Obviously, if we fail to notify the event loop if there's
+target event, it's bad.  If we notify the event loop when there's no event
+from target, linux-nat.c will detect that there's no event, actually, and
+report event of type TARGET_WAITKIND_IGNORE, but it will waste time and
+better avoided.
+
+The main design point is that every time GDB is outside linux-nat.c, we have a
+SIGCHLD handler installed that is called when something happens to the target
+and notifies the GDB event loop. Also, the event is extracted from the target
+using waitpid and stored for future use.  Whenever GDB core decides to handle
+the event, and calls into linux-nat.c, we disable SIGCHLD and process things
+as in sync mode, except that before waitpid call we check if there are any
+previously read events.
+
+It could happen that during event processing, we'll try to get more events
+than there are events in the local queue, which will result to waitpid call.
+Those waitpid calls, while blocking, are guarantied to always have
+something for waitpid to return.  E.g., stopping a thread with SIGSTOP, and
+waiting for the lwp to stop.
+
+The event loop is notified about new events using a pipe. SIGCHLD handler does
+waitpid and writes the results in to a pipe. GDB event loop has the other end
+of the pipe among the sources. When event loop starts to process the event
+and calls a function in linux-nat.c, all events from the pipe are transferred
+into a local queue and SIGCHLD is blocked. Further processing goes as in sync
+mode. Before we return from linux_nat_wait, we transfer all unprocessed events
+from local queue back to the pipe, so that when we get back to event loop,
+event loop will notice there's something more to do.
+
+SIGCHLD is blocked when we're inside target_wait, so that should we actually
+want to wait for some more events, SIGCHLD handler does not steal them from
+us. Technically, it would be possible to add new events to the local queue but
+it's about the same amount of work as blocking SIGCHLD.
+
+This moving of events from pipe into local queue and back into pipe when we
+enter/leave linux-nat.c is somewhat ugly. Unfortunately, GDB event loop is
+home-grown and incapable to wait on any queue.
+
+Use of signals
+==============
+
+We stop threads by sending a SIGSTOP.  The use of SIGSTOP instead of another
+signal is not entirely significant; we just need for a signal to be delivered,
+so that we can intercept it.  SIGSTOP's advantage is that it can not be
+blocked.  A disadvantage is that it is not a real-time signal, so it can only
+be queued once; we do not keep track of other sources of SIGSTOP.
+
+Two other signals that can't be blocked are SIGCONT and SIGKILL.  But we can't
+use them, because they have special behavior when the signal is generated -
+not when it is delivered.  SIGCONT resumes the entire thread group and SIGKILL
+kills the entire thread group.
+
+A delivered SIGSTOP would stop the entire thread group, not just the thread we
+tkill'd.  But we never let the SIGSTOP be delivered; we always intercept and 
+cancel it (by PTRACE_CONT without passing SIGSTOP).
+
+We could use a real-time signal instead.  This would solve those problems; we
+could use PTRACE_GETSIGINFO to locate the specific stop signals sent by GDB.
+But we would still have to have some support for SIGSTOP, since PTRACE_ATTACH
+generates it, and there are races with trying to find a signal that is not
+blocked.  */
 
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
@@ -149,6 +227,33 @@
 		    value);
 }
 
+static int disable_randomization = 1;
+
+static void
+show_disable_randomization (struct ui_file *file, int from_tty,
+			    struct cmd_list_element *c, const char *value)
+{
+#ifdef HAVE_PERSONALITY
+  fprintf_filtered (file, _("\
+Disabling randomization of debuggee's virtual address space is %s.\n"),
+		    value);
+#else /* !HAVE_PERSONALITY */
+  fputs_filtered (_("\
+Disabling randomization of debuggee's virtual address space is unsupported on\n\
+this platform.\n"), file);
+#endif /* !HAVE_PERSONALITY */
+}
+
+static void
+set_disable_randomization (char *args, int from_tty, struct cmd_list_element *c)
+{
+#ifndef HAVE_PERSONALITY
+  error (_("\
+Disabling randomization of debuggee's virtual address space is unsupported on\n\
+this platform."));
+#endif /* !HAVE_PERSONALITY */
+}
+
 static int linux_parent_pid;
 
 struct simple_pid_list
@@ -171,17 +276,6 @@
 
 /* Async mode support */
 
-/* To listen to target events asynchronously, we install a SIGCHLD
-   handler whose duty is to call waitpid (-1, ..., WNOHANG) to get all
-   the pending events into a pipe.  Whenever we're ready to handle
-   events asynchronously, this pipe is registered as the waitable file
-   handle in the event loop.  When we get to entry target points
-   coming out of the common code (target_wait, target_resume, ...),
-   that are going to call waitpid, we block SIGCHLD signals, and
-   remove all the events placed in the pipe into a local queue.  All
-   the subsequent calls to my_waitpid (a waitpid wrapper) check this
-   local queue first.  */
-
 /* True if async mode is currently on.  */
 static int linux_nat_async_enabled;
 
@@ -196,11 +290,24 @@
 /* Number of queued events in the pipe.  */
 static volatile int linux_nat_num_queued_events;
 
-/* If async mode is on, true if we're listening for events; false if
-   target events are blocked.  */
-static int linux_nat_async_events_enabled;
+/* The possible SIGCHLD handling states.  */
 
-static int linux_nat_async_events (int enable);
+enum sigchld_state
+{
+  /* SIGCHLD disabled, with action set to sigchld_handler, for the
+     sigsuspend in linux_nat_wait.  */
+  sigchld_sync,
+  /* SIGCHLD enabled, with action set to async_sigchld_handler.  */
+  sigchld_async,
+  /* Set SIGCHLD to default action.  Used while creating an
+     inferior.  */
+  sigchld_default
+};
+
+/* The current SIGCHLD handling state.  */
+static enum sigchld_state linux_nat_async_events_state;
+
+static enum sigchld_state linux_nat_async_events (enum sigchld_state enable);
 static void pipe_to_local_event_queue (void);
 static void local_event_queue_to_pipe (void);
 static void linux_nat_event_pipe_push (int pid, int status, int options);
@@ -212,6 +319,9 @@
 static int linux_nat_async_mask (int mask);
 static int kill_lwp (int lwpid, int signo);
 
+static int send_sigint_callback (struct lwp_info *lp, void *data);
+static int stop_callback (struct lwp_info *lp, void *data);
+
 /* Captures the result of a successful waitpid call, along with the
    options used in that call.  */
 struct waitpid_result
@@ -234,8 +344,8 @@
   if (debug_linux_nat_async)
     fprintf_unfiltered (gdb_stdlog,
 			"\
-QWPID: linux_nat_async_events_enabled(%d), linux_nat_num_queued_events(%d)\n",
-			linux_nat_async_events_enabled,
+QWPID: linux_nat_async_events_state(%d), linux_nat_num_queued_events(%d)\n",
+			linux_nat_async_events_state,
 			linux_nat_num_queued_events);
 
   if (flags & __WALL)
@@ -381,7 +491,7 @@
   int ret;
 
   /* There should be no concurrent calls to waitpid.  */
-  gdb_assert (!linux_nat_async_events_enabled);
+  gdb_assert (linux_nat_async_events_state == sigchld_sync);
 
   ret = queued_waitpid (pid, status, flags);
   if (ret != -1)
@@ -414,6 +524,9 @@
 {
   int child_pid, ret, status;
   long second_pid;
+  enum sigchld_state async_events_original_state;
+
+  async_events_original_state = linux_nat_async_events (sigchld_sync);
 
   linux_supports_tracefork_flag = 0;
   linux_supports_tracevforkdone_flag = 0;
@@ -444,6 +557,7 @@
       if (ret != 0)
 	{
 	  warning (_("linux_test_for_tracefork: failed to kill child"));
+	  linux_nat_async_events (async_events_original_state);
 	  return;
 	}
 
@@ -454,6 +568,7 @@
 	warning (_("linux_test_for_tracefork: unexpected wait status 0x%x from "
 		 "killed child"), status);
 
+      linux_nat_async_events (async_events_original_state);
       return;
     }
 
@@ -493,6 +608,8 @@
   if (ret != 0)
     warning (_("linux_test_for_tracefork: failed to kill child"));
   my_waitpid (child_pid, &status, 0);
+
+  linux_nat_async_events (async_events_original_state);
 }
 
 /* Return non-zero iff we have tracefork functionality available.
@@ -568,7 +685,7 @@
   parent_pid = ptid_get_lwp (last_ptid);
   if (parent_pid == 0)
     parent_pid = ptid_get_pid (last_ptid);
-  child_pid = last_status.value.related_pid;
+  child_pid = PIDGET (last_status.value.related_pid);
 
   if (! follow_child)
     {
@@ -790,17 +907,6 @@
 static int num_lwps;
 
 
-/* Since we cannot wait (in linux_nat_wait) for the initial process and
-   any cloned processes with a single call to waitpid, we have to use
-   the WNOHANG flag and call waitpid in a loop.  To optimize
-   things a bit we use `sigsuspend' to wake us up when a process has
-   something to report (it will send us a SIGCHLD if it has).  To make
-   this work we have to juggle with the signal mask.  We save the
-   original signal mask such that we can restore it before creating a
-   new process in order to avoid blocking certain signals in the
-   inferior.  We then block SIGCHLD during the waitpid/sigsuspend
-   loop.  */
-
 /* Original signal mask.  */
 static sigset_t normal_mask;
 
@@ -813,6 +919,9 @@
 
 /* SIGCHLD action for asynchronous mode.  */
 static struct sigaction async_sigchld_action;
+
+/* SIGCHLD default action, to pass to new inferiors.  */
+static struct sigaction sigchld_default_action;
 
 
 /* Prototypes for local functions.  */
@@ -968,48 +1077,12 @@
 {
   struct lwp_info *lp;
 
-  init_thread_list ();
   init_lwp_list ();
   lp = add_lwp (new_ptid);
-  add_thread_silent (new_ptid);
   lp->stopped = 1;
-}
 
-/* Record a PTID for later deletion.  */
-
-struct saved_ptids
-{
-  ptid_t ptid;
-  struct saved_ptids *next;
-};
-static struct saved_ptids *threads_to_delete;
-
-static void
-record_dead_thread (ptid_t ptid)
-{
-  struct saved_ptids *p = xmalloc (sizeof (struct saved_ptids));
-  p->ptid = ptid;
-  p->next = threads_to_delete;
-  threads_to_delete = p;
-}
-
-/* Delete any dead threads which are not the current thread.  */
-
-static void
-prune_lwps (void)
-{
-  struct saved_ptids **p = &threads_to_delete;
-
-  while (*p)
-    if (! ptid_equal ((*p)->ptid, inferior_ptid))
-      {
-	struct saved_ptids *tmp = *p;
-	delete_thread (tmp->ptid);
-	*p = tmp->next;
-	xfree (tmp);
-      }
-    else
-      p = &(*p)->next;
+  init_thread_list ();
+  add_thread_silent (new_ptid);
 }
 
 /* Handle the exit of a single thread LP.  */
@@ -1024,11 +1097,7 @@
       if (print_thread_events)
 	printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (lp->ptid));
 
-      /* Core GDB cannot deal with us deleting the current thread.  */
-      if (!ptid_equal (lp->ptid, inferior_ptid))
-	delete_thread (lp->ptid);
-      else
-	record_dead_thread (lp->ptid);
+      delete_thread (lp->ptid);
     }
 
   delete_lwp (lp->ptid);
@@ -1136,12 +1205,11 @@
 lin_lwp_attach_lwp (ptid_t ptid)
 {
   struct lwp_info *lp;
-  int async_events_were_enabled = 0;
+  enum sigchld_state async_events_original_state;
 
   gdb_assert (is_lwp (ptid));
 
-  if (target_can_async_p ())
-    async_events_were_enabled = linux_nat_async_events (0);
+  async_events_original_state = linux_nat_async_events (sigchld_sync);
 
   lp = find_lwp_pid (ptid);
 
@@ -1206,9 +1274,7 @@
       lp->stopped = 1;
     }
 
-  if (async_events_were_enabled)
-    linux_nat_async_events (1);
-
+  linux_nat_async_events (async_events_original_state);
   return 0;
 }
 
@@ -1217,11 +1283,16 @@
 			   int from_tty)
 {
   int saved_async = 0;
+#ifdef HAVE_PERSONALITY
+  int personality_orig = 0, personality_set = 0;
+#endif /* HAVE_PERSONALITY */
 
   /* The fork_child mechanism is synchronous and calls target_wait, so
      we have to mask the async mode.  */
 
   if (target_can_async_p ())
+    /* Mask async mode.  Creating a child requires a loop calling
+       wait_for_inferior currently.  */
     saved_async = linux_nat_async_mask (0);
   else
     {
@@ -1232,8 +1303,42 @@
       sigdelset (&suspend_mask, SIGCHLD);
     }
 
+  /* Set SIGCHLD to the default action, until after execing the child,
+     since the inferior inherits the superior's signal mask.  It will
+     be blocked again in linux_nat_wait, which is only reached after
+     the inferior execing.  */
+  linux_nat_async_events (sigchld_default);
+
+#ifdef HAVE_PERSONALITY
+  if (disable_randomization)
+    {
+      errno = 0;
+      personality_orig = personality (0xffffffff);
+      if (errno == 0 && !(personality_orig & ADDR_NO_RANDOMIZE))
+	{
+	  personality_set = 1;
+	  personality (personality_orig | ADDR_NO_RANDOMIZE);
+	}
+      if (errno != 0 || (personality_set
+			 && !(personality (0xffffffff) & ADDR_NO_RANDOMIZE)))
+	warning (_("Error disabling address space randomization: %s"),
+		 safe_strerror (errno));
+    }
+#endif /* HAVE_PERSONALITY */
+
   linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
 
+#ifdef HAVE_PERSONALITY
+  if (personality_set)
+    {
+      errno = 0;
+      personality (personality_orig);
+      if (errno != 0)
+	warning (_("Error restoring address space randomization: %s"),
+		 safe_strerror (errno));
+    }
+#endif /* HAVE_PERSONALITY */
+
   if (saved_async)
     linux_nat_async_mask (saved_async);
 }
@@ -1306,16 +1411,80 @@
      events are always cached in waitpid_queue.  */
 
   *status = 0;
-  if (GET_LWP (lp->ptid) == GET_LWP (last_ptid))
+
+  if (non_stop)
     {
-      if (stop_signal != TARGET_SIGNAL_0
-	  && signal_pass_state (stop_signal))
-	*status = W_STOPCODE (target_signal_to_host (stop_signal));
+      enum target_signal signo = TARGET_SIGNAL_0;
+
+      if (is_executing (lp->ptid))
+	{
+	  /* If the core thought this lwp was executing --- e.g., the
+	     executing property hasn't been updated yet, but the
+	     thread has been stopped with a stop_callback /
+	     stop_wait_callback sequence (see linux_nat_detach for
+	     example) --- we can only have pending events in the local
+	     queue.  */
+	  if (queued_waitpid (GET_LWP (lp->ptid), status, __WALL) != -1)
+	    {
+	      if (WIFSTOPPED (status))
+		signo = target_signal_from_host (WSTOPSIG (status));
+
+	      /* If not stopped, then the lwp is gone, no use in
+		 resending a signal.  */
+	    }
+	}
+      else
+	{
+	  /* If the core knows the thread is not executing, then we
+	     have the last signal recorded in
+	     thread_info->stop_signal, unless this is inferior_ptid,
+	     in which case, it's in the global stop_signal, due to
+	     context switching.  */
+
+	  if (ptid_equal (lp->ptid, inferior_ptid))
+	    signo = stop_signal;
+	  else
+	    {
+	      struct thread_info *tp = find_thread_pid (lp->ptid);
+	      gdb_assert (tp);
+	      signo = tp->stop_signal;
+	    }
+	}
+
+      if (signo != TARGET_SIGNAL_0
+	  && !signal_pass_state (signo))
+	{
+	  if (debug_linux_nat)
+	    fprintf_unfiltered (gdb_stdlog, "\
+GPT: lwp %s had signal %s, but it is in no pass state\n",
+				target_pid_to_str (lp->ptid),
+				target_signal_to_string (signo));
+	}
+      else
+	{
+	  if (signo != TARGET_SIGNAL_0)
+	    *status = W_STOPCODE (target_signal_to_host (signo));
+
+	  if (debug_linux_nat)
+	    fprintf_unfiltered (gdb_stdlog,
+				"GPT: lwp %s as pending signal %s\n",
+				target_pid_to_str (lp->ptid),
+				target_signal_to_string (signo));
+	}
     }
-  else if (target_can_async_p ())
-    queued_waitpid (GET_LWP (lp->ptid), status, __WALL);
   else
-    *status = lp->status;
+    {
+      if (GET_LWP (lp->ptid) == GET_LWP (last_ptid))
+	{
+	  if (stop_signal != TARGET_SIGNAL_0
+	      && signal_pass_state (stop_signal))
+	    *status = W_STOPCODE (target_signal_to_host (stop_signal));
+	}
+      else if (target_can_async_p ())
+	queued_waitpid (GET_LWP (lp->ptid), status, __WALL);
+      else
+	*status = lp->status;
+    }
 
   return 0;
 }
@@ -1379,6 +1548,13 @@
   if (target_can_async_p ())
     linux_nat_async (NULL, 0);
 
+  /* Stop all threads before detaching.  ptrace requires that the
+     thread is stopped to sucessfully detach.  */
+  iterate_over_lwps (stop_callback, NULL);
+  /* ... and wait until all of them have reported back that
+     they're no longer running.  */
+  iterate_over_lwps (stop_wait_callback, NULL);
+
   iterate_over_lwps (detach_callback, NULL);
 
   /* Only the initial process should be left right now.  */
@@ -1459,19 +1635,24 @@
 			signo ? strsignal (signo) : "0",
 			target_pid_to_str (inferior_ptid));
 
-  prune_lwps ();
-
   if (target_can_async_p ())
     /* Block events while we're here.  */
-    linux_nat_async_events (0);
+    linux_nat_async_events (sigchld_sync);
 
   /* A specific PTID means `step only this process id'.  */
   resume_all = (PIDGET (ptid) == -1);
 
-  if (resume_all)
-    iterate_over_lwps (resume_set_callback, NULL);
-  else
-    iterate_over_lwps (resume_clear_callback, NULL);
+  if (non_stop && resume_all)
+    internal_error (__FILE__, __LINE__,
+		    "can't resume all in non-stop mode");
+
+  if (!non_stop)
+    {
+      if (resume_all)
+	iterate_over_lwps (resume_set_callback, NULL);
+      else
+	iterate_over_lwps (resume_clear_callback, NULL);
+    }
 
   /* If PID is -1, it's the current inferior that should be
      handled specially.  */
@@ -1481,6 +1662,7 @@
   lp = find_lwp_pid (ptid);
   gdb_assert (lp != NULL);
 
+  /* Convert to something the lower layer understands.  */
   ptid = pid_to_ptid (GET_LWP (lp->ptid));
 
   /* Remember if we're stepping.  */
@@ -1554,10 +1736,7 @@
 			signo ? strsignal (signo) : "0");
 
   if (target_can_async_p ())
-    {
-      target_executing = 1;
-      target_async (inferior_event_handler, 0);
-    }
+    target_async (inferior_event_handler, 0);
 }
 
 /* Issue kill to specified lwp.  */
@@ -1626,7 +1805,7 @@
 			    _("wait returned unexpected status 0x%x"), status);
 	}
 
-      ourstatus->value.related_pid = new_pid;
+      ourstatus->value.related_pid = ptid_build (new_pid, new_pid, 0);
 
       if (event == PTRACE_EVENT_FORK)
 	ourstatus->kind = TARGET_WAITKIND_FORKED;
@@ -1634,9 +1813,12 @@
 	ourstatus->kind = TARGET_WAITKIND_VFORKED;
       else
 	{
+	  struct cleanup *old_chain;
+
 	  ourstatus->kind = TARGET_WAITKIND_IGNORE;
 	  new_lp = add_lwp (BUILD_LWP (new_pid, GET_PID (inferior_ptid)));
 	  new_lp->cloned = 1;
+	  new_lp->stopped = 1;
 
 	  if (WSTOPSIG (status) != SIGSTOP)
 	    {
@@ -1653,12 +1835,38 @@
 	  else
 	    status = 0;
 
-	  if (stopping)
-	    new_lp->stopped = 1;
-	  else
+	  if (non_stop)
 	    {
+	      /* Add the new thread to GDB's lists as soon as possible
+		 so that:
+
+		 1) the frontend doesn't have to wait for a stop to
+		 display them, and,
+
+		 2) we tag it with the correct running state.  */
+
+	      /* If the thread_db layer is active, let it know about
+		 this new thread, and add it to GDB's list.  */
+	      if (!thread_db_attach_lwp (new_lp->ptid))
+		{
+		  /* We're not using thread_db.  Add it to GDB's
+		     list.  */
+		  target_post_attach (GET_LWP (new_lp->ptid));
+		  add_thread (new_lp->ptid);
+		}
+
+	      if (!stopping)
+		{
+		  set_running (new_lp->ptid, 1);
+		  set_executing (new_lp->ptid, 1);
+		}
+	    }
+
+	  if (!stopping)
+	    {
+	      new_lp->stopped = 0;
 	      new_lp->resumed = 1;
-	      ptrace (PTRACE_CONT, lp->waitstatus.value.related_pid, 0,
+	      ptrace (PTRACE_CONT, new_pid, 0,
 		      status ? WSTOPSIG (status) : 0);
 	    }
 
@@ -1688,6 +1896,16 @@
 	  linux_parent_pid = 0;
 	}
 
+      /* At this point, all inserted breakpoints are gone.  Doing this
+	 as soon as we detect an exec prevents the badness of deleting
+	 a breakpoint writing the current "shadow contents" to lift
+	 the bp.  That shadow is NOT valid after an exec.
+
+	 Note that we have to do this after the detach_breakpoints
+	 call above, otherwise breakpoints wouldn't be lifted from the
+	 parent on a vfork, because detach_breakpoints would think
+	 that breakpoints are not inserted.  */
+      mark_breakpoints_out ();
       return 0;
     }
 
@@ -2385,13 +2603,7 @@
 	 not the end of the debugged application and should be
 	 ignored.  */
       if (num_lwps > 0)
-	{
-	  /* Make sure there is at least one thread running.  */
-	  gdb_assert (iterate_over_lwps (running_callback, NULL));
-
-	  /* Discard the event.  */
-	  return NULL;
-	}
+	return NULL;
     }
 
   /* Check if the current LWP has previously exited.  In the nptl
@@ -2521,13 +2733,14 @@
       lp->resumed = 1;
       /* Add the main thread to GDB's thread list.  */
       add_thread_silent (lp->ptid);
+      set_running (lp->ptid, 1);
+      set_executing (lp->ptid, 1);
     }
 
   sigemptyset (&flush_mask);
 
-  if (target_can_async_p ())
-    /* Block events while we're here.  */
-    target_async (NULL, 0);
+  /* Block events while we're here.  */
+  linux_nat_async_events (sigchld_sync);
 
 retry:
 
@@ -2749,19 +2962,23 @@
     fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
 			status_to_str (status), target_pid_to_str (lp->ptid));
 
-  /* Now stop all other LWP's ...  */
-  iterate_over_lwps (stop_callback, NULL);
+  if (!non_stop)
+    {
+      /* Now stop all other LWP's ...  */
+      iterate_over_lwps (stop_callback, NULL);
 
-  /* ... and wait until all of them have reported back that they're no
-     longer running.  */
-  iterate_over_lwps (stop_wait_callback, &flush_mask);
-  iterate_over_lwps (flush_callback, &flush_mask);
+      /* ... and wait until all of them have reported back that
+	 they're no longer running.  */
+      iterate_over_lwps (stop_wait_callback, &flush_mask);
+      iterate_over_lwps (flush_callback, &flush_mask);
 
-  /* If we're not waiting for a specific LWP, choose an event LWP from
-     among those that have had events.  Giving equal priority to all
-     LWPs that have had events helps prevent starvation.  */
-  if (pid == -1)
-    select_event_lwp (&lp, &status);
+      /* If we're not waiting for a specific LWP, choose an event LWP
+	 from among those that have had events.  Giving equal priority
+	 to all LWPs that have had events helps prevent
+	 starvation.  */
+      if (pid == -1)
+	select_event_lwp (&lp, &status);
+    }
 
   /* Now that we've selected our final event LWP, cancel any
      breakpoints in other LWPs that have hit a GDB breakpoint.  See
@@ -2882,7 +3099,7 @@
   if (last.kind == TARGET_WAITKIND_FORKED
       || last.kind == TARGET_WAITKIND_VFORKED)
     {
-      ptrace (PT_KILL, last.value.related_pid, 0, 0);
+      ptrace (PT_KILL, PIDGET (last.value.related_pid), 0, 0);
       wait (&status);
     }
 
@@ -2893,6 +3110,13 @@
     }
   else
     {
+      /* Stop all threads before killing them, since ptrace requires
+	 that the thread is stopped to sucessfully PTRACE_KILL.  */
+      iterate_over_lwps (stop_callback, NULL);
+      /* ... and wait until all of them have reported back that
+	 they're no longer running.  */
+      iterate_over_lwps (stop_wait_callback, NULL);
+
       /* Kill all LWP's ...  */
       iterate_over_lwps (kill_callback, NULL);
 
@@ -2945,22 +3169,22 @@
 static int
 linux_nat_thread_alive (ptid_t ptid)
 {
+  int err;
+
   gdb_assert (is_lwp (ptid));
 
-  errno = 0;
-  ptrace (PTRACE_PEEKUSER, GET_LWP (ptid), 0, 0);
+  /* Send signal 0 instead of anything ptrace, because ptracing a
+     running thread errors out claiming that the thread doesn't
+     exist.  */
+  err = kill_lwp (GET_LWP (ptid), 0);
+
   if (debug_linux_nat)
     fprintf_unfiltered (gdb_stdlog,
-			"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
+			"LLTA: KILL(SIG0) %s (%s)\n",
 			target_pid_to_str (ptid),
-			errno ? safe_strerror (errno) : "OK");
+			err ? safe_strerror (err) : "OK");
 
-  /* Not every Linux kernel implements PTRACE_PEEKUSER.  But we can
-     handle that case gracefully since ptrace will first do a lookup
-     for the process based upon the passed-in pid.  If that fails we
-     will get either -ESRCH or -EPERM, otherwise the child exists and
-     is alive.  */
-  if (errno == ESRCH || errno == EPERM)
+  if (err != 0)
     return 0;
 
   return 1;
@@ -2986,7 +3210,7 @@
 sigchld_handler (int signo)
 {
   if (linux_nat_async_enabled
-      && linux_nat_async_events_enabled
+      && linux_nat_async_events_state != sigchld_sync
       && signo == SIGCHLD)
     /* It is *always* a bug to hit this.  */
     internal_error (__FILE__, __LINE__,
@@ -3845,15 +4069,9 @@
 	{
 	  linux_nat_async (NULL, 0);
 	  linux_nat_async_mask_value = mask;
-	  /* We're in sync mode.  Make sure SIGCHLD isn't handled by
-	     async_sigchld_handler when we come out of sigsuspend in
-	     linux_nat_wait.  */
-	  sigaction (SIGCHLD, &sync_sigchld_action, NULL);
 	}
       else
 	{
-	  /* Restore the async handler.  */
-	  sigaction (SIGCHLD, &async_sigchld_action, NULL);
 	  linux_nat_async_mask_value = mask;
 	  linux_nat_async (inferior_event_handler, 0);
 	}
@@ -3911,7 +4129,8 @@
 {
   int status, options, pid;
 
-  if (!linux_nat_async_enabled || !linux_nat_async_events_enabled)
+  if (!linux_nat_async_enabled
+      || linux_nat_async_events_state != sigchld_async)
     internal_error (__FILE__, __LINE__,
 		    "get_pending_events called with async masked");
 
@@ -3965,44 +4184,75 @@
   get_pending_events ();
 }
 
-/* Enable or disable async SIGCHLD handling.  */
+/* Set SIGCHLD handling state to STATE.  Returns previous state.  */
 
-static int
-linux_nat_async_events (int enable)
+static enum sigchld_state
+linux_nat_async_events (enum sigchld_state state)
 {
-  int current_state = linux_nat_async_events_enabled;
+  enum sigchld_state current_state = linux_nat_async_events_state;
 
   if (debug_linux_nat_async)
     fprintf_unfiltered (gdb_stdlog,
-			"LNAE: enable(%d): linux_nat_async_events_enabled(%d), "
+			"LNAE: state(%d): linux_nat_async_events_state(%d), "
 			"linux_nat_num_queued_events(%d)\n",
-			enable, linux_nat_async_events_enabled,
+			state, linux_nat_async_events_state,
 			linux_nat_num_queued_events);
 
-  if (current_state != enable)
+  if (current_state != state)
     {
       sigset_t mask;
       sigemptyset (&mask);
       sigaddset (&mask, SIGCHLD);
-      if (enable)
-	{
-	  /* Unblock target events.  */
-	  linux_nat_async_events_enabled = 1;
 
-	  local_event_queue_to_pipe ();
-	  /* While in masked async, we may have not collected all the
-	     pending events.  Get them out now.  */
-	  get_pending_events ();
-	  sigprocmask (SIG_UNBLOCK, &mask, NULL);
-	}
-      else
+      /* Always block before changing state.  */
+      sigprocmask (SIG_BLOCK, &mask, NULL);
+
+      /* Set new state.  */
+      linux_nat_async_events_state = state;
+
+      switch (state)
 	{
-	  /* Block target events.  */
-	  sigprocmask (SIG_BLOCK, &mask, NULL);
-	  linux_nat_async_events_enabled = 0;
-	  /* Get events out of queue, and make them available to
-	     queued_waitpid / my_waitpid.  */
-	  pipe_to_local_event_queue ();
+	case sigchld_sync:
+	  {
+	    /* Block target events.  */
+	    sigprocmask (SIG_BLOCK, &mask, NULL);
+	    sigaction (SIGCHLD, &sync_sigchld_action, NULL);
+	    /* Get events out of queue, and make them available to
+	       queued_waitpid / my_waitpid.  */
+	    pipe_to_local_event_queue ();
+	  }
+	  break;
+	case sigchld_async:
+	  {
+	    /* Unblock target events for async mode.  */
+
+	    sigprocmask (SIG_BLOCK, &mask, NULL);
+
+	    /* Put events we already waited on, in the pipe first, so
+	       events are FIFO.  */
+	    local_event_queue_to_pipe ();
+	    /* While in masked async, we may have not collected all
+	       the pending events.  Get them out now.  */
+	    get_pending_events ();
+
+	    /* Let'em come.   */
+	    sigaction (SIGCHLD, &async_sigchld_action, NULL);
+	    sigprocmask (SIG_UNBLOCK, &mask, NULL);
+	  }
+	  break;
+	case sigchld_default:
+	  {
+	    /* SIGCHLD default mode.  */
+	    sigaction (SIGCHLD, &sigchld_default_action, NULL);
+
+	    /* Get events out of queue, and make them available to
+	       queued_waitpid / my_waitpid.  */
+	    pipe_to_local_event_queue ();
+
+	    /* Unblock SIGCHLD.  */
+	    sigprocmask (SIG_UNBLOCK, &mask, NULL);
+	  }
+	  break;
 	}
     }
 
@@ -4094,14 +4344,14 @@
       add_file_handler (linux_nat_event_pipe[0],
 			linux_nat_async_file_handler, NULL);
 
-      linux_nat_async_events (1);
+      linux_nat_async_events (sigchld_async);
     }
   else
     {
       async_client_callback = callback;
       async_client_context = context;
 
-      linux_nat_async_events (0);
+      linux_nat_async_events (sigchld_sync);
       delete_file_handler (linux_nat_event_pipe[0]);
     }
   return;
@@ -4117,21 +4367,15 @@
       if (on)
 	{
 	  gdb_assert (waitpid_queue == NULL);
-	  sigaction (SIGCHLD, &async_sigchld_action, NULL);
-
 	  if (pipe (linux_nat_event_pipe) == -1)
 	    internal_error (__FILE__, __LINE__,
 			    "creating event pipe failed.");
-
 	  fcntl (linux_nat_event_pipe[0], F_SETFL, O_NONBLOCK);
 	  fcntl (linux_nat_event_pipe[1], F_SETFL, O_NONBLOCK);
 	}
       else
 	{
-	  sigaction (SIGCHLD, &sync_sigchld_action, NULL);
-
 	  drain_queued_events (-1);
-
 	  linux_nat_num_queued_events = 0;
 	  close (linux_nat_event_pipe[0]);
 	  close (linux_nat_event_pipe[1]);
@@ -4142,6 +4386,35 @@
   linux_nat_async_enabled = on;
 }
 
+static int
+send_sigint_callback (struct lwp_info *lp, void *data)
+{
+  /* Use is_running instead of !lp->stopped, because the lwp may be
+     stopped due to an internal event, and we want to interrupt it in
+     that case too.  What we want is to check if the thread is stopped
+     from the point of view of the user.  */
+  if (is_running (lp->ptid))
+    kill_lwp (GET_LWP (lp->ptid), SIGINT);
+  return 0;
+}
+
+static void
+linux_nat_stop (ptid_t ptid)
+{
+  if (non_stop)
+    {
+      if (ptid_equal (ptid, minus_one_ptid))
+	iterate_over_lwps (send_sigint_callback, &ptid);
+      else
+	{
+	  struct lwp_info *lp = find_lwp_pid (ptid);
+	  send_sigint_callback (lp, NULL);
+	}
+    }
+  else
+    linux_ops->to_stop (ptid);
+}
+
 void
 linux_nat_add_target (struct target_ops *t)
 {
@@ -4172,6 +4445,9 @@
   t->to_terminal_inferior = linux_nat_terminal_inferior;
   t->to_terminal_ours = linux_nat_terminal_ours;
 
+  /* Methods for non-stop support.  */
+  t->to_stop = linux_nat_stop;
+
   /* We don't change the stratum; this target will sit at
      process_stratum and thread_db will set at thread_stratum.  This
      is a little strange, since this is a multi-threaded-capable
@@ -4248,6 +4524,10 @@
 			   &maintenance_set_cmdlist,
 			   &maintenance_show_cmdlist);
 
+  /* Get the default SIGCHLD action.  Used while forking an inferior
+     (see linux_nat_create_inferior/linux_nat_async_events).  */
+  sigaction (SIGCHLD, NULL, &sigchld_default_action);
+
   /* Block SIGCHLD by default.  Doing this early prevents it getting
      unblocked if an exception is thrown due to an error while the
      inferior is starting (sigsetjmp/siglongjmp).  */
@@ -4277,6 +4557,17 @@
 
   /* Install the default mode.  */
   linux_nat_set_async_mode (linux_async_permitted);
+
+  add_setshow_boolean_cmd ("disable-randomization", class_support,
+			   &disable_randomization, _("\
+Set disabling of debuggee's virtual address space randomization."), _("\
+Show disabling of debuggee's virtual address space randomization."), _("\
+When this mode is on (which is the default), randomization of the virtual\n\
+address space is disabled.  Standalone programs run with the randomization\n\
+enabled by default on some platforms."),
+			   &set_disable_randomization,
+			   &show_disable_randomization,
+			   &setlist, &showlist);
 }
 
 
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 48c9a0c..f3386f7 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -94,6 +94,8 @@
 /* Tell the thread_db layer what native target operations to use.  */
 void thread_db_init (struct target_ops *);
 
+int thread_db_attach_lwp (ptid_t ptid);
+
 /* Find process PID's pending signal set from /proc/pid/status.  */
 void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
 
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 7e40e9f..650cbaa 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -283,7 +283,10 @@
   if (thread_info == NULL)
     {
       /* New thread.  Attach to it now (why wait?).  */
-      attach_thread (thread_ptid, thp, &ti);
+      if (!have_threads ())
+	thread_db_find_new_threads ();
+      else
+	attach_thread (thread_ptid, thp, &ti);
       thread_info = find_thread_pid (thread_ptid);
       gdb_assert (thread_info != NULL);
     }
@@ -308,6 +311,8 @@
      LWP.  */
   gdb_assert (GET_LWP (ptid) != 0);
 
+  /* Access an lwp we know is stopped.  */
+  proc_handle.pid = GET_LWP (ptid);
   err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
   if (err != TD_OK)
     error (_("Cannot find user-level thread for LWP %ld: %s"),
@@ -332,6 +337,48 @@
 }
 
 
+/* Attach to lwp PTID, doing whatever else is required to have this
+   LWP under the debugger's control --- e.g., enabling event
+   reporting.  Returns true on success.  */
+int
+thread_db_attach_lwp (ptid_t ptid)
+{
+  td_thrhandle_t th;
+  td_thrinfo_t ti;
+  td_err_e err;
+
+  if (!using_thread_db)
+    return 0;
+
+  /* This ptid comes from linux-nat.c, which should always fill in the
+     LWP.  */
+  gdb_assert (GET_LWP (ptid) != 0);
+
+  /* Access an lwp we know is stopped.  */
+  proc_handle.pid = GET_LWP (ptid);
+
+  /* If we have only looked at the first thread before libpthread was
+     initialized, we may not know its thread ID yet.  Make sure we do
+     before we add another thread to the list.  */
+  if (!have_threads ())
+    thread_db_find_new_threads ();
+
+  err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
+  if (err != TD_OK)
+    /* Cannot find user-level thread.  */
+    return 0;
+
+  err = td_thr_get_info_p (&th, &ti);
+  if (err != TD_OK)
+    {
+      warning (_("Cannot get thread info: %s"), thread_db_err_str (err));
+      return 0;
+    }
+
+  attach_thread (ptid, &th, &ti);
+  return 1;
+}
+
 void
 thread_db_init (struct target_ops *target)
 {
@@ -418,6 +465,9 @@
   td_notify_t notify;
   td_err_e err;
 
+  /* Access an lwp we know is stopped.  */
+  proc_handle.pid = GET_LWP (inferior_ptid);
+
   /* Get the breakpoint address for thread EVENT.  */
   err = td_ta_event_addr_p (thread_agent, event, &notify);
   if (err != TD_OK)
@@ -761,6 +811,15 @@
   if (stop_pc != td_create_bp_addr && stop_pc != td_death_bp_addr)
     return;
 
+  /* Access an lwp we know is stopped.  */
+  proc_handle.pid = GET_LWP (ptid);
+
+  /* If we have only looked at the first thread before libpthread was
+     initialized, we may not know its thread ID yet.  Make sure we do
+     before we add another thread to the list.  */
+  if (!have_threads ())
+    thread_db_find_new_threads ();
+
   /* If we are at a create breakpoint, we do not know what new lwp
      was created and cannot specifically locate the event message for it.
      We have to call td_ta_event_getmsg() to get
@@ -951,11 +1010,27 @@
   return 0;
 }
 
+/* Search for new threads, accessing memory through stopped thread
+   PTID.  */
+
 static void
 thread_db_find_new_threads (void)
 {
   td_err_e err;
+  struct lwp_info *lp;
+  ptid_t ptid;
 
+  /* In linux, we can only read memory through a stopped lwp.  */
+  ALL_LWPS (lp, ptid)
+    if (lp->stopped)
+      break;
+
+  if (!lp)
+    /* There is no stopped thread.  Bail out.  */
+    return;
+
+  /* Access an lwp we know is stopped.  */
+  proc_handle.pid = GET_LWP (ptid);
   /* Iterate over all user-space threads to discover new threads.  */
   err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL,
 			  TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 513da03..b8cd167 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -1828,13 +1828,13 @@
 /* Stack unwinding.  */
 
 static struct m32c_prologue *
-m32c_analyze_frame_prologue (struct frame_info *next_frame,
+m32c_analyze_frame_prologue (struct frame_info *this_frame,
 			     void **this_prologue_cache)
 {
   if (! *this_prologue_cache)
     {
-      CORE_ADDR func_start = frame_func_unwind (next_frame, NORMAL_FRAME);
-      CORE_ADDR stop_addr = frame_pc_unwind (next_frame);
+      CORE_ADDR func_start = get_frame_func (this_frame);
+      CORE_ADDR stop_addr = get_frame_pc (this_frame);
 
       /* If we couldn't find any function containing the PC, then
          just initialize the prologue cache, but don't do anything.  */
@@ -1842,7 +1842,7 @@
         stop_addr = func_start;
 
       *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue);
-      m32c_analyze_prologue (get_frame_arch (next_frame),
+      m32c_analyze_prologue (get_frame_arch (this_frame),
 			     func_start, stop_addr, *this_prologue_cache);
     }
 
@@ -1851,12 +1851,12 @@
 
 
 static CORE_ADDR
-m32c_frame_base (struct frame_info *next_frame,
+m32c_frame_base (struct frame_info *this_frame,
                 void **this_prologue_cache)
 {
   struct m32c_prologue *p
-    = m32c_analyze_frame_prologue (next_frame, this_prologue_cache);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
+    = m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
 
   /* In functions that use alloca, the distance between the stack
      pointer and the frame base varies dynamically, so we can't use
@@ -1869,14 +1869,14 @@
     case prologue_with_frame_ptr:
       {
 	CORE_ADDR fb
-	  = frame_unwind_register_unsigned (next_frame, tdep->fb->num);
+	  = get_frame_register_unsigned (this_frame, tdep->fb->num);
 	return fb - p->frame_ptr_offset;
       }
 
     case prologue_sans_frame_ptr:
       {
 	CORE_ADDR sp
-	  = frame_unwind_register_unsigned (next_frame, tdep->sp->num);
+	  = get_frame_register_unsigned (this_frame, tdep->sp->num);
 	return sp - p->frame_size;
       }
 
@@ -1890,82 +1890,52 @@
 
 
 static void
-m32c_this_id (struct frame_info *next_frame,
+m32c_this_id (struct frame_info *this_frame,
 	      void **this_prologue_cache,
 	      struct frame_id *this_id)
 {
-  CORE_ADDR base = m32c_frame_base (next_frame, this_prologue_cache);
+  CORE_ADDR base = m32c_frame_base (this_frame, this_prologue_cache);
 
   if (base)
-    *this_id = frame_id_build (base,
-			       frame_func_unwind (next_frame, NORMAL_FRAME));
+    *this_id = frame_id_build (base, get_frame_func (this_frame));
   /* Otherwise, leave it unset, and that will terminate the backtrace.  */
 }
 
 
-static void
-m32c_prev_register (struct frame_info *next_frame,
-		    void **this_prologue_cache,
-		    int regnum, int *optimizedp,
-		    enum lval_type *lvalp, CORE_ADDR *addrp,
-		    int *realnump, gdb_byte *bufferp)
+static struct value *
+m32c_prev_register (struct frame_info *this_frame,
+		    void **this_prologue_cache, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
   struct m32c_prologue *p
-    = m32c_analyze_frame_prologue (next_frame, this_prologue_cache);
-  CORE_ADDR frame_base = m32c_frame_base (next_frame, this_prologue_cache);
-  int reg_size = register_size (get_frame_arch (next_frame), regnum);
+    = m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
+  CORE_ADDR frame_base = m32c_frame_base (this_frame, this_prologue_cache);
+  int reg_size = register_size (get_frame_arch (this_frame), regnum);
 
   if (regnum == tdep->sp->num)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (bufferp)
-	store_unsigned_integer (bufferp, reg_size, frame_base);
-    }
+    return frame_unwind_got_constant (this_frame, regnum, frame_base);
 
   /* If prologue analysis says we saved this register somewhere,
      return a description of the stack slot holding it.  */
-  else if (p->reg_offset[regnum] != 1)
-    {
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = frame_base + p->reg_offset[regnum];
-      *realnump = -1;
-      if (bufferp)
-	get_frame_memory (next_frame, *addrp, bufferp, reg_size);
-    }
+  if (p->reg_offset[regnum] != 1)
+    return frame_unwind_got_memory (this_frame, regnum,
+                                    frame_base + p->reg_offset[regnum]);
 
   /* Otherwise, presume we haven't changed the value of this
      register, and get it from the next frame.  */
-  else
-    {
-      *optimizedp = 0;
-      *lvalp = lval_register;
-      *addrp = 0;
-      *realnump = regnum;
-      if (bufferp)
-	frame_unwind_register (next_frame, *realnump, bufferp);
-    }
+  return frame_unwind_got_register (this_frame, regnum, regnum);
 }
 
 
 static const struct frame_unwind m32c_unwind = {
   NORMAL_FRAME,
   m32c_this_id,
-  m32c_prev_register
+  m32c_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
 
-static const struct frame_unwind *
-m32c_frame_sniffer (struct frame_info *next_frame)
-{
-  return &m32c_unwind;
-}
-
-
 static CORE_ADDR
 m32c_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
 {
@@ -2146,7 +2116,7 @@
 
 
 static struct frame_id
-m32c_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+m32c_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
   /* This needs to return a frame ID whose PC is the return address
      passed to m32c_push_dummy_call, and whose stack_addr is the SP
@@ -2154,8 +2124,9 @@
 
      m32c_unwind_sp gives us the CFA, which is the value the SP had
      before the return address was pushed.  */
-  return frame_id_build (m32c_unwind_sp (gdbarch, next_frame),
-                         frame_pc_unwind (next_frame));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, tdep->sp->num);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 
@@ -2611,14 +2582,14 @@
      know which, but I do know that the prologue analyzer works better.
      MVS 04/13/06
   */
-  frame_unwind_append_sniffer (arch, dwarf2_frame_sniffer);
+  dwarf2_append_sniffers (arch);
 #endif
-  frame_unwind_append_sniffer (arch, m32c_frame_sniffer);
+  frame_unwind_append_unwinder (arch, &m32c_unwind);
 
   /* Inferior calls.  */
   set_gdbarch_push_dummy_call (arch, m32c_push_dummy_call);
   set_gdbarch_return_value (arch, m32c_return_value);
-  set_gdbarch_unwind_dummy_id (arch, m32c_unwind_dummy_id);
+  set_gdbarch_dummy_id (arch, m32c_dummy_id);
 
   /* Trampolines.  */
   set_gdbarch_skip_trampoline_code (arch, m32c_skip_trampoline_code);
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index e22a952..5caf79b 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -84,7 +84,7 @@
    the routine.  Otherwise, return 0.  */
 
 static CORE_ADDR
-m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
+m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *this_frame)
 {
   gdb_byte buf[4];
 
@@ -98,7 +98,7 @@
 
   if (pc % 2 != 0)
     {
-      if (!safe_frame_unwind_memory (next_frame, pc, buf, 2))
+      if (!safe_frame_unwind_memory (this_frame, pc, buf, 2))
 	return 0;
 
       if (memcmp (buf, linux_sigtramp_code, 2) == 0)
@@ -107,7 +107,7 @@
 	return 0;
     }
 
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
+  if (!safe_frame_unwind_memory (this_frame, pc, buf, 4))
     return 0;
 
   if (memcmp (buf, linux_sigtramp_code, 4) != 0)
@@ -132,7 +132,7 @@
    of the routine.  Otherwise, return 0.  */
 
 static CORE_ADDR
-m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
+m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *this_frame)
 {
   gdb_byte buf[4];
 
@@ -147,12 +147,12 @@
   if (pc % 2 != 0)
     return 0;
 
-  if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
+  if (!safe_frame_unwind_memory (this_frame, pc, buf, 4))
     return 0;
 
   if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
     {
-      if (!safe_frame_unwind_memory (next_frame, pc + 4, buf, 4))
+      if (!safe_frame_unwind_memory (this_frame, pc + 4, buf, 4))
 	return 0;
 
       if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
@@ -160,7 +160,7 @@
     }
   else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
     {
-      if (!safe_frame_unwind_memory (next_frame, pc - 4, buf, 4))
+      if (!safe_frame_unwind_memory (this_frame, pc - 4, buf, 4))
 	return 0;
 
       if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
@@ -172,7 +172,7 @@
 
 static int
 m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name,
-			   struct frame_info *next_frame)
+			   struct frame_info *this_frame)
 {
   /* If we have NAME, we can optimize the search.  The trampolines are
      named __restore and __restore_rt.  However, they aren't dynamically
@@ -180,8 +180,8 @@
      be part of the preceding function.  This should always be sigaction,
      __sigaction, or __libc_sigaction (all aliases to the same function).  */
   if (name == NULL || strstr (name, "sigaction") != NULL)
-    return (m32r_linux_sigtramp_start (pc, next_frame) != 0
-	    || m32r_linux_rt_sigtramp_start (pc, next_frame) != 0);
+    return (m32r_linux_sigtramp_start (pc, this_frame) != 0
+	    || m32r_linux_rt_sigtramp_start (pc, this_frame) != 0);
 
   return (strcmp ("__restore", name) == 0
 	  || strcmp ("__restore_rt", name) == 0);
@@ -222,7 +222,7 @@
 };
 
 static struct m32r_frame_cache *
-m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
+m32r_linux_sigtramp_frame_cache (struct frame_info *this_frame,
 				 void **this_cache)
 {
   struct m32r_frame_cache *cache;
@@ -233,26 +233,26 @@
     return (*this_cache);
   cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache);
   (*this_cache) = cache;
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
-  cache->base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
   sigcontext_addr = cache->base + 4;
 
-  cache->pc = frame_pc_unwind (next_frame);
-  addr = m32r_linux_sigtramp_start (cache->pc, next_frame);
+  cache->pc = get_frame_pc (this_frame);
+  addr = m32r_linux_sigtramp_start (cache->pc, this_frame);
   if (addr == 0)
     {
       /* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
          accordingly.  */
-      addr = m32r_linux_rt_sigtramp_start (cache->pc, next_frame);
+      addr = m32r_linux_rt_sigtramp_start (cache->pc, this_frame);
       if (addr)
 	sigcontext_addr += 128;
       else
-	addr = frame_func_unwind (next_frame, NORMAL_FRAME);
+	addr = get_frame_func (this_frame);
     }
   cache->pc = addr;
 
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++)
     {
@@ -265,50 +265,49 @@
 }
 
 static void
-m32r_linux_sigtramp_frame_this_id (struct frame_info *next_frame,
+m32r_linux_sigtramp_frame_this_id (struct frame_info *this_frame,
 				   void **this_cache,
 				   struct frame_id *this_id)
 {
   struct m32r_frame_cache *cache =
-    m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
+    m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
 
   (*this_id) = frame_id_build (cache->base, cache->pc);
 }
 
-static void
-m32r_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
-					 void **this_cache,
-					 int regnum, int *optimizedp,
-					 enum lval_type *lvalp,
-					 CORE_ADDR *addrp,
-					 int *realnump, gdb_byte *valuep)
+static struct value *
+m32r_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
+					 void **this_cache, int regnum)
 {
   struct m32r_frame_cache *cache =
-    m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
+    m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
+}
+
+static int
+m32r_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
+				   struct frame_info *this_frame,
+				   void **this_cache)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  char *name;
+
+  find_pc_partial_function (pc, &name, NULL, NULL);
+  if (m32r_linux_pc_in_sigtramp (pc, name, this_frame))
+    return 1;
+
+  return 0;
 }
 
 static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
   SIGTRAMP_FRAME,
   m32r_linux_sigtramp_frame_this_id,
-  m32r_linux_sigtramp_frame_prev_register
+  m32r_linux_sigtramp_frame_prev_register,
+  NULL,
+  m32r_linux_sigtramp_frame_sniffer
 };
 
-static const struct frame_unwind *
-m32r_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  char *name;
-
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  if (m32r_linux_pc_in_sigtramp (pc, name, next_frame))
-    return &m32r_linux_sigtramp_frame_unwind;
-
-  return NULL;
-}
-
 /* Mapping between the registers in `struct pt_regs'
    format and GDB's register array layout.  */
 
@@ -409,7 +408,7 @@
      the number of registers.  */
   set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1);
 
-  frame_unwind_append_sniffer (gdbarch, m32r_linux_sigtramp_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &m32r_linux_sigtramp_frame_unwind);
 
   /* GNU/Linux uses SVR4-style shared libraries.  */
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 964ae38..53f0d20 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -513,7 +513,7 @@
    for it IS the sp for the next frame. */
 
 static struct m32r_unwind_cache *
-m32r_frame_unwind_cache (struct frame_info *next_frame,
+m32r_frame_unwind_cache (struct frame_info *this_frame,
 			 void **this_prologue_cache)
 {
   CORE_ADDR pc, scan_limit;
@@ -529,19 +529,19 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache);
   (*this_prologue_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   info->size = 0;
   info->sp_offset = 0;
   info->uses_frame = 0;
 
-  scan_limit = frame_pc_unwind (next_frame);
-  for (pc = frame_func_unwind (next_frame, NORMAL_FRAME);
+  scan_limit = get_frame_pc (this_frame);
+  for (pc = get_frame_func (this_frame);
        pc > 0 && pc < scan_limit; pc += 2)
     {
       if ((pc & 2) == 0)
 	{
-	  op = get_frame_memory_unsigned (next_frame, pc, 4);
+	  op = get_frame_memory_unsigned (this_frame, pc, 4);
 	  if ((op & 0x80000000) == 0x80000000)
 	    {
 	      /* 32-bit instruction */
@@ -552,7 +552,7 @@
 		  info->sp_offset += n;
 		}
 	      else if (((op >> 8) == 0xe4)
-		       && get_frame_memory_unsigned (next_frame, pc + 2,
+		       && get_frame_memory_unsigned (this_frame, pc + 2,
 						     2) == 0x0f24)
 		{
 		  /* ld24 r4, xxxxxx; sub sp, r4 */
@@ -569,7 +569,7 @@
 	}
 
       /* 16-bit instructions */
-      op = get_frame_memory_unsigned (next_frame, pc, 2) & 0x7fff;
+      op = get_frame_memory_unsigned (this_frame, pc, 2) & 0x7fff;
       if ((op & 0xf0ff) == 0x207f)
 	{
 	  /* st rn, @-sp */
@@ -606,7 +606,7 @@
       /* The SP was moved to the FP.  This indicates that a new frame
          was created.  Get THIS frame's FP value by unwinding it from
          the next frame.  */
-      this_base = frame_unwind_register_unsigned (next_frame, M32R_FP_REGNUM);
+      this_base = get_frame_register_unsigned (this_frame, M32R_FP_REGNUM);
       /* The FP points at the last saved register.  Adjust the FP back
          to before the first saved register giving the SP.  */
       prev_sp = this_base + info->size;
@@ -615,7 +615,7 @@
     {
       /* Assume that the FP is this frame's SP but with that pushed
          stack space added back.  */
-      this_base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
+      this_base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
       prev_sp = this_base + info->size;
     }
 
@@ -625,7 +625,7 @@
 
   /* Adjust all the saved registers so that they contain addresses and
      not offsets.  */
-  for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++)
+  for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
     if (trad_frame_addr_p (info->saved_regs, i))
       info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr);
 
@@ -814,18 +814,18 @@
    frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-m32r_frame_this_id (struct frame_info *next_frame,
+m32r_frame_this_id (struct frame_info *this_frame,
 		    void **this_prologue_cache, struct frame_id *this_id)
 {
   struct m32r_unwind_cache *info
-    = m32r_frame_unwind_cache (next_frame, this_prologue_cache);
+    = m32r_frame_unwind_cache (this_frame, this_prologue_cache);
   CORE_ADDR base;
   CORE_ADDR func;
   struct minimal_symbol *msym_stack;
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame, NORMAL_FRAME);
+  func = get_frame_func (this_frame);
 
   /* Check if the stack is empty.  */
   msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
@@ -843,36 +843,28 @@
   (*this_id) = id;
 }
 
-static void
-m32r_frame_prev_register (struct frame_info *next_frame,
-			  void **this_prologue_cache,
-			  int regnum, int *optimizedp,
-			  enum lval_type *lvalp, CORE_ADDR *addrp,
-			  int *realnump, gdb_byte *bufferp)
+static struct value *
+m32r_frame_prev_register (struct frame_info *this_frame,
+			  void **this_prologue_cache, int regnum)
 {
   struct m32r_unwind_cache *info
-    = m32r_frame_unwind_cache (next_frame, this_prologue_cache);
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, bufferp);
+    = m32r_frame_unwind_cache (this_frame, this_prologue_cache);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
 static const struct frame_unwind m32r_frame_unwind = {
   NORMAL_FRAME,
   m32r_frame_this_id,
-  m32r_frame_prev_register
+  m32r_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-m32r_frame_sniffer (struct frame_info *next_frame)
-{
-  return &m32r_frame_unwind;
-}
-
 static CORE_ADDR
-m32r_frame_base_address (struct frame_info *next_frame, void **this_cache)
+m32r_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
   struct m32r_unwind_cache *info
-    = m32r_frame_unwind_cache (next_frame, this_cache);
+    = m32r_frame_unwind_cache (this_frame, this_cache);
   return info->base;
 }
 
@@ -883,16 +875,15 @@
   m32r_frame_base_address
 };
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
+   frame.  The frame ID's base needs to match the TOS value saved by
+   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
 
 static struct frame_id
-m32r_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+m32r_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (m32r_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 
@@ -940,7 +931,7 @@
   /* Methods for saving / extracting a dummy frame's ID.  The ID's
      stack address must match the SP value returned by
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_unwind_dummy_id (gdbarch, m32r_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
 
   /* Return the unwound PC value.  */
   set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
@@ -951,7 +942,7 @@
   gdbarch_init_osabi (info, gdbarch);
 
   /* Hook in the default unwinders.  */
-  frame_unwind_append_sniffer (gdbarch, m32r_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &m32r_frame_unwind);
 
   /* Support simple overlay manager.  */
   set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index f765d44..16bb243 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -774,10 +774,10 @@
    for it IS the sp for the next frame. */
 
 struct m68hc11_unwind_cache *
-m68hc11_frame_unwind_cache (struct frame_info *next_frame,
+m68hc11_frame_unwind_cache (struct frame_info *this_frame,
                             void **this_prologue_cache)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   ULONGEST prev_sp;
   ULONGEST this_base;
   struct m68hc11_unwind_cache *info;
@@ -789,9 +789,9 @@
 
   info = FRAME_OBSTACK_ZALLOC (struct m68hc11_unwind_cache);
   (*this_prologue_cache) = info;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
-  info->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
+  info->pc = get_frame_func (this_frame);
 
   info->size = 0;
   info->return_kind = m68hc11_get_return_insn (info->pc);
@@ -799,14 +799,14 @@
   /* The SP was moved to the FP.  This indicates that a new frame
      was created.  Get THIS frame's FP value by unwinding it from
      the next frame.  */
-  this_base = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM);
+  this_base = get_frame_register_unsigned (this_frame, SOFT_FP_REGNUM);
   if (this_base == 0)
     {
       info->base = 0;
       return info;
     }
 
-  current_pc = frame_pc_unwind (next_frame);
+  current_pc = get_frame_pc (this_frame);
   if (info->pc != 0)
     m68hc11_scan_prologue (gdbarch, info->pc, current_pc, info);
 
@@ -815,7 +815,7 @@
   if (info->sp_offset != (CORE_ADDR) -1)
     {
       info->saved_regs[HARD_PC_REGNUM].addr = info->sp_offset;
-      this_base = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
+      this_base = get_frame_register_unsigned (this_frame, HARD_SP_REGNUM);
       prev_sp = this_base + info->sp_offset + 2;
       this_base += STACK_CORRECTION (gdbarch);
     }
@@ -874,18 +874,18 @@
    frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-m68hc11_frame_this_id (struct frame_info *next_frame,
+m68hc11_frame_this_id (struct frame_info *this_frame,
                        void **this_prologue_cache,
                        struct frame_id *this_id)
 {
   struct m68hc11_unwind_cache *info
-    = m68hc11_frame_unwind_cache (next_frame, this_prologue_cache);
+    = m68hc11_frame_unwind_cache (this_frame, this_prologue_cache);
   CORE_ADDR base;
   CORE_ADDR func;
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame, NORMAL_FRAME);
+  func = get_frame_func (this_frame);
 
   /* Hopefully the prologue analysis either correctly determined the
      frame's base (which is the SP from the previous frame), or set
@@ -898,67 +898,69 @@
   (*this_id) = id;
 }
 
-static void
-m68hc11_frame_prev_register (struct frame_info *next_frame,
-                             void **this_prologue_cache,
-                             int regnum, int *optimizedp,
-                             enum lval_type *lvalp, CORE_ADDR *addrp,
-                             int *realnump, gdb_byte *bufferp)
+static struct value *
+m68hc11_frame_prev_register (struct frame_info *this_frame,
+                             void **this_prologue_cache, int regnum)
 {
+  struct value *value;
   struct m68hc11_unwind_cache *info
-    = m68hc11_frame_unwind_cache (next_frame, this_prologue_cache);
+    = m68hc11_frame_unwind_cache (this_frame, this_prologue_cache);
 
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, bufferp);
+  value = trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 
-  if (regnum == HARD_PC_REGNUM)
+  /* Take into account the 68HC12 specific call (PC + page).  */
+  if (regnum == HARD_PC_REGNUM
+      && info->return_kind == RETURN_RTC
+      && USE_PAGE_REGISTER (get_frame_arch (this_frame)))
     {
-      /* Take into account the 68HC12 specific call (PC + page).  */
-      if (info->return_kind == RETURN_RTC
-          && *addrp >= 0x08000 && *addrp < 0x0c000
-          && USE_PAGE_REGISTER (get_frame_arch (next_frame)))
+      CORE_ADDR pc = value_as_long (value);
+      if (pc >= 0x08000 && pc < 0x0c000)
         {
-          int page_optimized;
-
           CORE_ADDR page;
 
-          trad_frame_get_prev_register (next_frame, info->saved_regs,
-					HARD_PAGE_REGNUM, &page_optimized,
-					0, &page, 0, 0);
-          *addrp -= 0x08000;
-          *addrp += ((page & 0x0ff) << 14);
-          *addrp += 0x1000000;
+	  release_value (value);
+	  value_free (value);
+
+	  value = trad_frame_get_prev_register (this_frame, info->saved_regs,
+						HARD_PAGE_REGNUM);
+	  page = value_as_long (value);
+	  release_value (value);
+	  value_free (value);
+
+          pc -= 0x08000;
+          pc += ((page & 0x0ff) << 14);
+          pc += 0x1000000;
+
+	  return frame_unwind_got_constant (this_frame, regnum, pc);
         }
     }
+
+  return value;
 }
 
 static const struct frame_unwind m68hc11_frame_unwind = {
   NORMAL_FRAME,
   m68hc11_frame_this_id,
-  m68hc11_frame_prev_register
+  m68hc11_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-const struct frame_unwind *
-m68hc11_frame_sniffer (struct frame_info *next_frame)
-{
-  return &m68hc11_frame_unwind;
-}
-
 static CORE_ADDR
-m68hc11_frame_base_address (struct frame_info *next_frame, void **this_cache)
+m68hc11_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
   struct m68hc11_unwind_cache *info
-    = m68hc11_frame_unwind_cache (next_frame, this_cache);
+    = m68hc11_frame_unwind_cache (this_frame, this_cache);
 
   return info->base;
 }
 
 static CORE_ADDR
-m68hc11_frame_args_address (struct frame_info *next_frame, void **this_cache)
+m68hc11_frame_args_address (struct frame_info *this_frame, void **this_cache)
 {
   CORE_ADDR addr;
   struct m68hc11_unwind_cache *info
-    = m68hc11_frame_unwind_cache (next_frame, this_cache);
+    = m68hc11_frame_unwind_cache (this_frame, this_cache);
 
   addr = info->base + info->size;
   if (info->return_kind == RETURN_RTC)
@@ -984,18 +986,17 @@
   return sp;
 }
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
+   frame.  The frame ID's base needs to match the TOS value saved by
+   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
 
 static struct frame_id
-m68hc11_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+m68hc11_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
   ULONGEST tos;
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
 
-  tos = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM);
+  tos = get_frame_register_unsigned (this_frame, SOFT_FP_REGNUM);
   tos += 2;
   return frame_id_build (tos, pc);
 }
@@ -1520,15 +1521,15 @@
   set_gdbarch_print_registers_info (gdbarch, m68hc11_print_registers_info);
 
   /* Hook in the DWARF CFI frame unwinder.  */
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, m68hc11_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &m68hc11_frame_unwind);
   frame_base_set_default (gdbarch, &m68hc11_frame_base);
   
   /* Methods for saving / extracting a dummy frame's ID.  The ID's
      stack address must match the SP value returned by
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_unwind_dummy_id (gdbarch, m68hc11_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, m68hc11_dummy_id);
 
   /* Return the unwound PC value.  */
   set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 6079236..83a41c7 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -1926,7 +1926,7 @@
 
 
 static struct mep_prologue *
-mep_analyze_frame_prologue (struct frame_info *next_frame,
+mep_analyze_frame_prologue (struct frame_info *this_frame,
                             void **this_prologue_cache)
 {
   if (! *this_prologue_cache)
@@ -1936,8 +1936,8 @@
       *this_prologue_cache 
         = FRAME_OBSTACK_ZALLOC (struct mep_prologue);
 
-      func_start = frame_func_unwind (next_frame, NORMAL_FRAME);
-      stop_addr = frame_pc_unwind (next_frame);
+      func_start = get_frame_func (this_frame);
+      stop_addr = get_frame_pc (this_frame);
 
       /* If we couldn't find any function containing the PC, then
          just initialize the prologue cache, but don't do anything.  */
@@ -1954,11 +1954,11 @@
 /* Given the next frame and a prologue cache, return this frame's
    base.  */
 static CORE_ADDR
-mep_frame_base (struct frame_info *next_frame,
+mep_frame_base (struct frame_info *this_frame,
                 void **this_prologue_cache)
 {
   struct mep_prologue *p
-    = mep_analyze_frame_prologue (next_frame, this_prologue_cache);
+    = mep_analyze_frame_prologue (this_frame, this_prologue_cache);
 
   /* In functions that use alloca, the distance between the stack
      pointer and the frame base varies dynamically, so we can't use
@@ -1969,37 +1969,34 @@
   if (p->has_frame_ptr)
     {
       CORE_ADDR fp
-        = frame_unwind_register_unsigned (next_frame, MEP_FP_REGNUM);
+        = get_frame_register_unsigned (this_frame, MEP_FP_REGNUM);
       return fp - p->frame_ptr_offset;
     }
   else
     {
       CORE_ADDR sp
-        = frame_unwind_register_unsigned (next_frame, MEP_SP_REGNUM);
+        = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
       return sp - p->frame_size;
     }
 }
 
 
 static void
-mep_frame_this_id (struct frame_info *next_frame,
+mep_frame_this_id (struct frame_info *this_frame,
                    void **this_prologue_cache,
                    struct frame_id *this_id)
 {
-  *this_id = frame_id_build (mep_frame_base (next_frame, this_prologue_cache),
-                             frame_func_unwind (next_frame, NORMAL_FRAME));
+  *this_id = frame_id_build (mep_frame_base (this_frame, this_prologue_cache),
+                             get_frame_func (this_frame));
 }
 
 
-static void
-mep_frame_prev_register (struct frame_info *next_frame,
-                         void **this_prologue_cache,
-                         int regnum, int *optimizedp,
-                         enum lval_type *lvalp, CORE_ADDR *addrp,
-                         int *realnump, gdb_byte *bufferp)
+static struct value *
+mep_frame_prev_register (struct frame_info *this_frame,
+                         void **this_prologue_cache, int regnum)
 {
   struct mep_prologue *p
-    = mep_analyze_frame_prologue (next_frame, this_prologue_cache);
+    = mep_analyze_frame_prologue (this_frame, this_prologue_cache);
 
   /* There are a number of complications in unwinding registers on the
      MeP, having to do with core functions calling VLIW functions and
@@ -2021,68 +2018,59 @@
      do this.  */
   if (regnum == MEP_PC_REGNUM)
     {
-      mep_frame_prev_register (next_frame, this_prologue_cache, MEP_LP_REGNUM,
-                               optimizedp, lvalp, addrp, realnump, bufferp);
-      store_unsigned_integer (bufferp, MEP_LP_SIZE, 
-                              (extract_unsigned_integer (bufferp, MEP_LP_SIZE)
-                               & ~1));
-      *lvalp = not_lval;
+      struct value *value;
+      CORE_ADDR lp;
+      value = mep_frame_prev_register (this_frame, this_prologue_cache,
+				       MEP_LP_REGNUM);
+      lp = value_as_long (value);
+      release_value (value);
+      value_free (value);
+
+      return frame_unwind_got_constant (this_frame, regnum, lp & ~1);
     }
   else
     {
-      CORE_ADDR frame_base = mep_frame_base (next_frame, this_prologue_cache);
-      int reg_size = register_size (get_frame_arch (next_frame), regnum);
+      CORE_ADDR frame_base = mep_frame_base (this_frame, this_prologue_cache);
+      struct value *value;
 
       /* Our caller's SP is our frame base.  */
       if (regnum == MEP_SP_REGNUM)
-        {
-          *optimizedp = 0;
-          *lvalp = not_lval;
-          *addrp = 0;
-          *realnump = -1;
-          if (bufferp)
-            store_unsigned_integer (bufferp, reg_size, frame_base);
-        }
+	return frame_unwind_got_constant (this_frame, regnum, frame_base);
 
       /* If prologue analysis says we saved this register somewhere,
          return a description of the stack slot holding it.  */
-      else if (p->reg_offset[regnum] != 1)
-        {
-          *optimizedp = 0;
-          *lvalp = lval_memory;
-          *addrp = frame_base + p->reg_offset[regnum];
-          *realnump = -1;
-          if (bufferp)
-            get_frame_memory (next_frame, *addrp, bufferp, reg_size);
-        }
+      if (p->reg_offset[regnum] != 1)
+	value = frame_unwind_got_memory (this_frame, regnum,
+					 frame_base + p->reg_offset[regnum]);
 
       /* Otherwise, presume we haven't changed the value of this
          register, and get it from the next frame.  */
       else
-        frame_register_unwind (next_frame, regnum,
-                               optimizedp, lvalp, addrp, realnump, bufferp);
+	value = frame_unwind_got_register (this_frame, regnum, regnum);
 
       /* If we need to toggle the operating mode, do so.  */
       if (regnum == MEP_PSW_REGNUM)
         {
-          int lp_optimized;
-          enum lval_type lp_lval;
-          CORE_ADDR lp_addr;
-          int lp_realnum;
-          char lp_buffer[MEP_LP_SIZE];
+	  CORE_ADDR psw, lp;
+
+	  psw = value_as_long (value);
+	  release_value (value);
+	  value_free (value);
 
           /* Get the LP's value, too.  */
-          frame_register_unwind (next_frame, MEP_LP_REGNUM,
-                                 &lp_optimized, &lp_lval, &lp_addr,
-                                 &lp_realnum, lp_buffer);
+	  value = get_frame_register_value (this_frame, MEP_LP_REGNUM);
+	  lp = value_as_long (value);
+	  release_value (value);
+	  value_free (value);
 
           /* If LP.LTOM is set, then toggle PSW.OM.  */
-          if (extract_unsigned_integer (lp_buffer, MEP_LP_SIZE) & 0x1)
-            store_unsigned_integer
-              (bufferp, MEP_PSW_SIZE,
-               (extract_unsigned_integer (bufferp, MEP_PSW_SIZE) ^ 0x1000));
-          *lvalp = not_lval;
+	  if (lp & 0x1)
+	    psw ^= 0x1000;
+
+	  return frame_unwind_got_constant (this_frame, regnum, psw);
         }
+
+      return value;
     }
 }
 
@@ -2090,17 +2078,12 @@
 static const struct frame_unwind mep_frame_unwind = {
   NORMAL_FRAME,
   mep_frame_this_id,
-  mep_frame_prev_register
+  mep_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
 
-static const struct frame_unwind *
-mep_frame_sniffer (struct frame_info *next_frame)
-{
-  return &mep_frame_unwind;
-}
-
-
 /* Our general unwinding function can handle unwinding the PC.  */
 static CORE_ADDR
 mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -2379,10 +2362,10 @@
 
 
 static struct frame_id
-mep_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+mep_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (mep_unwind_sp (gdbarch, next_frame),
-                         frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 
@@ -2500,7 +2483,7 @@
   set_gdbarch_skip_prologue (gdbarch, mep_skip_prologue);
 
   /* Frames and frame unwinding.  */
-  frame_unwind_append_sniffer (gdbarch, mep_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
   set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -2512,7 +2495,7 @@
   /* Inferior function calls.  */
   set_gdbarch_frame_align (gdbarch, mep_frame_align);
   set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call);
-  set_gdbarch_unwind_dummy_id (gdbarch, mep_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, mep_dummy_id);
 
   return gdbarch;
 }
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 3a5faf3..1bfb567 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -60,7 +60,7 @@
 /* Implements the -break-insert command.
    See the MI manual for the list of possible options.  */
 
-enum mi_cmd_result
+void
 mi_cmd_break_insert (char *command, char **argv, int argc)
 {
   char *address = NULL;
@@ -156,7 +156,6 @@
 	    error (_("mi_cmd_break_insert: Unsupported tempoary regexp breakpoint"));
 	  else
 	    rbreak_command_wrapper (address, FROM_TTY);
-	  return MI_CMD_DONE;
 	  break;
 #endif
 	default:
@@ -167,8 +166,6 @@
   deprecated_set_gdb_event_hooks (old_hooks);
   if (e.reason < 0)
     throw_exception (e);
-
-  return MI_CMD_DONE;
 }
 
 enum wp_type
@@ -184,7 +181,7 @@
    -break-watch -r <expr> --> insert a read watchpoint.
    -break-watch -a <expr> --> insert an access wp. */
 
-enum mi_cmd_result
+void
 mi_cmd_break_watch (char *command, char **argv, int argc)
 {
   char *expr = NULL;
@@ -239,5 +236,4 @@
     default:
       error (_("mi_cmd_break_watch: Unknown watchpoint type."));
     }
-  return MI_CMD_DONE;
 }
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index d2cb655..300f6b7 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -46,10 +46,9 @@
 
    MODE: 0 or 1 for disassembly only, or mixed source and disassembly,
    respectively. */
-enum mi_cmd_result
+void
 mi_cmd_disassemble (char *command, char **argv, int argc)
 {
-  enum mi_cmd_result retval;
   CORE_ADDR start;
 
   int mixed_source_and_assembly;
@@ -157,5 +156,4 @@
 		   line_num,
 		   mixed_source_and_assembly, how_many, low, high);
 
-  return MI_CMD_DONE;
 }
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index aee7994..327ddc5 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -64,7 +64,7 @@
 
 
 /* Print working directory.  */
-enum mi_cmd_result
+void
 mi_cmd_env_pwd (char *command, char **argv, int argc)
 {
   if (argc > 0)
@@ -73,27 +73,23 @@
   if (mi_version (uiout) < 2)
     {
       env_execute_cli_command ("pwd", NULL);
-      return MI_CMD_DONE;
+      return;
     }
      
   /* Otherwise the mi level is 2 or higher.  */
 
   getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   ui_out_field_string (uiout, "cwd", gdb_dirbuf);
-
-  return MI_CMD_DONE;
 }
 
 /* Change working directory.  */
-enum mi_cmd_result
+void
 mi_cmd_env_cd (char *command, char **argv, int argc)
 {
   if (argc == 0 || argc > 1)
     error (_("mi_cmd_env_cd: Usage DIRECTORY"));
           
   env_execute_cli_command ("cd", argv[0]);
-
-  return MI_CMD_DONE;
 }
 
 static void
@@ -108,7 +104,7 @@
 }
 
 /* Add one or more directories to start of executable search path.  */
-enum mi_cmd_result
+void
 mi_cmd_env_path (char *command, char **argv, int argc)
 {
   char *exec_path;
@@ -133,7 +129,7 @@
     {
       for (i = argc - 1; i >= 0; --i)
 	env_execute_cli_command ("path", argv[i]);
-      return MI_CMD_DONE;
+      return;
     }
 
   /* Otherwise the mi level is 2 or higher.  */
@@ -177,12 +173,10 @@
   xfree (exec_path);
   env = get_in_environ (inferior_environ, path_var_name);
   ui_out_field_string (uiout, "path", env);
-
-  return MI_CMD_DONE;
 }
 
 /* Add zero or more directories to the front of the source path.  */
-enum mi_cmd_result
+void
 mi_cmd_env_dir (char *command, char **argv, int argc)
 {
   int i;
@@ -205,7 +199,7 @@
     {
       for (i = argc - 1; i >= 0; --i)
 	env_execute_cli_command ("dir", argv[i]);
-      return MI_CMD_DONE;
+      return;
     }
 
   /* Otherwise mi level is 2 or higher.  */
@@ -238,21 +232,17 @@
 
   ui_out_field_string (uiout, "source-path", source_path);
   forget_cached_source_info ();
-
-  return MI_CMD_DONE;
 }
 
 /* Set the inferior terminal device name.  */
-enum mi_cmd_result
+void
 mi_cmd_inferior_tty_set (char *command, char **argv, int argc)
 {
   set_inferior_io_terminal (argv[0]);
-
-  return MI_CMD_DONE;
 }
 
 /* Print the inferior terminal device name  */
-enum mi_cmd_result
+void
 mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
 {
   const char *inferior_io_terminal = get_inferior_io_terminal ();
@@ -262,8 +252,6 @@
 
   if (inferior_io_terminal)
     ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal);
-
-  return MI_CMD_DONE;
 }
 
 void 
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 8c74170..de045cb 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -28,7 +28,7 @@
 /* Return to the client the absolute path and line number of the 
    current file being executed. */
 
-enum mi_cmd_result
+void
 mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
 {
   struct symtab_and_line st;
@@ -60,11 +60,9 @@
   ui_out_field_string (uiout, "fullname", st.symtab->fullname);
 
   ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0);
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
 {
   struct symtab *s;
@@ -113,6 +111,4 @@
   }
 
   ui_out_end (uiout, ui_out_type_list);
-
-  return MI_CMD_DONE;
 }
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index cddb8a1..baf9b6d 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -38,7 +38,7 @@
    specifying the frame numbers at which to start and stop the
    display. If the two numbers are equal, a single frame will be
    displayed. */
-enum mi_cmd_result
+void
 mi_cmd_stack_list_frames (char *command, char **argv, int argc)
 {
   int frame_low;
@@ -88,11 +88,9 @@
     }
 
   do_cleanups (cleanup_stack);
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_stack_info_depth (char *command, char **argv, int argc)
 {
   int frame_high;
@@ -115,14 +113,12 @@
     QUIT;
 
   ui_out_field_int (uiout, "depth", i);
-
-  return MI_CMD_DONE;
 }
 
 /* Print a list of the locals for the current frame. With argument of
    0, print only the names, with argument of 1 print also the
    values. */
-enum mi_cmd_result
+void
 mi_cmd_stack_list_locals (char *command, char **argv, int argc)
 {
   struct frame_info *frame;
@@ -147,13 +143,12 @@
 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
 	    mi_no_values, mi_all_values, mi_simple_values);
   list_args_or_locals (1, print_values, frame);
-  return MI_CMD_DONE;
 }
 
 /* Print a list of the arguments for the current frame. With argument
    of 0, print only the names, with argument of 1 print also the
    values. */
-enum mi_cmd_result
+void
 mi_cmd_stack_list_args (char *command, char **argv, int argc)
 {
   int frame_low;
@@ -205,8 +200,6 @@
     }
 
   do_cleanups (cleanup_stack_args);
-
-  return MI_CMD_DONE;
 }
 
 /* Print a list of the locals or the arguments for the currently
@@ -315,22 +308,20 @@
   ui_out_stream_delete (stb);
 }
 
-enum mi_cmd_result
+void
 mi_cmd_stack_select_frame (char *command, char **argv, int argc)
 {
   if (argc == 0 || argc > 1)
     error (_("mi_cmd_stack_select_frame: Usage: FRAME_SPEC"));
 
   select_frame_command (argv[0], 1 /* not used */ );
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_stack_info_frame (char *command, char **argv, int argc)
 {
   if (argc > 0)
     error (_("mi_cmd_stack_info_frame: No arguments required"));
-  
+
   print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
-  return MI_CMD_DONE;
 }
diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c
index 8ca4def..7dd55bd 100644
--- a/gdb/mi/mi-cmd-target.c
+++ b/gdb/mi/mi-cmd-target.c
@@ -23,7 +23,7 @@
 
 /* Get a file from the target.  */
 
-enum mi_cmd_result
+void
 mi_cmd_target_file_get (char *command, char **argv, int argc)
 {
   int optind = 0;
@@ -43,13 +43,11 @@
   local_file = argv[optind + 1];
 
   remote_file_get (remote_file, local_file, 0);
-
-  return MI_CMD_DONE;
 }
 
 /* Send a file to the target.  */
 
-enum mi_cmd_result
+void
 mi_cmd_target_file_put (char *command, char **argv, int argc)
 {
   int optind = 0;
@@ -69,13 +67,11 @@
   remote_file = argv[optind + 1];
 
   remote_file_put (local_file, remote_file, 0);
-
-  return MI_CMD_DONE;
 }
 
 /* Delete a file on the target.  */
 
-enum mi_cmd_result
+void
 mi_cmd_target_file_delete (char *command, char **argv, int argc)
 {
   int optind = 0;
@@ -94,7 +90,5 @@
   remote_file = argv[optind];
 
   remote_file_delete (remote_file, 0);
-
-  return MI_CMD_DONE;
 }
 
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 50f7add..53c95da 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -29,6 +29,7 @@
 #include <ctype.h>
 #include "gdb_string.h"
 #include "mi-getopt.h"
+#include "gdbthread.h"
 
 const char mi_no_values[] = "--no-values";
 const char mi_simple_values[] = "--simple-values";
@@ -78,7 +79,7 @@
 
 /* VAROBJ operations */
 
-enum mi_cmd_result
+void
 mi_cmd_var_create (char *command, char **argv, int argc)
 {
   CORE_ADDR frameaddr = 0;
@@ -138,10 +139,9 @@
   print_varobj (var, PRINT_ALL_VALUES, 0 /* don't print expression */);
 
   do_cleanups (old_cleanups);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_delete (char *command, char **argv, int argc)
 {
   char *name;
@@ -193,7 +193,6 @@
   ui_out_field_int (uiout, "ndeleted", numdel);
 
   do_cleanups (old_cleanups);
-  return MI_CMD_DONE;
 }
 
 /* Parse a string argument into a format value.  */
@@ -222,7 +221,7 @@
   error (_("Must specify the format as: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\""));
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_set_format (char *command, char **argv, int argc)
 {
   enum varobj_display_formats format;
@@ -247,10 +246,9 @@
  
   /* Report the value in the new format */
   ui_out_field_string (uiout, "value", varobj_get_value (var));
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_set_frozen (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -275,11 +273,10 @@
   /* We don't automatically return the new value, or what varobjs got new
      values during unfreezing.  If this information is required, client
      should call -var-update explicitly.  */
-  return MI_CMD_DONE;
 }
 
 
-enum mi_cmd_result
+void
 mi_cmd_var_show_format (char *command, char **argv, int argc)
 {
   enum varobj_display_formats format;
@@ -297,10 +294,9 @@
 
   /* Report the current format */
   ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_info_num_children (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -314,7 +310,6 @@
     error (_("mi_cmd_var_info_num_children: Variable object not found"));
 
   ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
-  return MI_CMD_DONE;
 }
 
 /* Parse a string argument into a print_values value.  */
@@ -364,7 +359,7 @@
     }
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_list_children (char *command, char **argv, int argc)
 {
   struct varobj *var;  
@@ -394,7 +389,7 @@
     print_values = PRINT_NO_VALUES;
 
   if (VEC_length (varobj_p, children) == 0)
-    return MI_CMD_DONE;
+    return;
 
   if (mi_version (uiout) == 1)
     cleanup_children = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
@@ -408,10 +403,9 @@
       do_cleanups (cleanup_child);
     }
   do_cleanups (cleanup_children);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_info_type (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -425,10 +419,9 @@
     error (_("mi_cmd_var_info_type: Variable object not found"));
 
   ui_out_field_string (uiout, "type", varobj_get_type (var));
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_info_path_expression (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -445,11 +438,9 @@
   path_expr = varobj_get_path_expr (var);
 
   ui_out_field_string (uiout, "path_expr", path_expr);
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_info_expression (char *command, char **argv, int argc)
 {
   enum varobj_languages lang;
@@ -467,10 +458,9 @@
 
   ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]);
   ui_out_field_string (uiout, "exp", varobj_get_expression (var));
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_show_attributes (char *command, char **argv, int argc)
 {
   int attr;
@@ -493,10 +483,9 @@
     attstr = "noneditable";
 
   ui_out_field_string (uiout, "attr", attstr);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -552,11 +541,9 @@
     ui_out_field_string (uiout, "value", varobj_get_formatted_value (var, format));
   else
     ui_out_field_string (uiout, "value", varobj_get_value (var));
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_assign (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -579,10 +566,9 @@
     error (_("mi_cmd_var_assign: Could not assign expression to variable object"));
 
   ui_out_field_string (uiout, "value", varobj_get_value (var));
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_var_update (char *command, char **argv, int argc)
 {
   struct varobj *var;
@@ -620,13 +606,26 @@
       if (nv <= 0)
 	{
 	  do_cleanups (cleanup);
-	  return MI_CMD_DONE;
+	  return;
 	}
       cr = rootlist;
       while (*cr != NULL)
 	{
-	  if (*name == '*' || varobj_floating_p (*cr))
-	    varobj_update_one (*cr, print_values, 0 /* implicit */);
+	  int thread_id = varobj_get_thread_id (*cr);
+	  int thread_stopped = 0;
+	  if (thread_id == -1 && is_stopped (inferior_ptid))
+	    thread_stopped = 1;
+	  else
+	    {	      
+	      struct thread_info *tp = find_thread_id (thread_id);
+	      if (tp)
+		thread_stopped = is_stopped (tp->ptid);
+	      else
+		thread_stopped = 1;
+	    }
+	  if (thread_stopped)
+	    if (*name == '*' || varobj_floating_p (*cr))
+	      varobj_update_one (*cr, print_values, 0 /* implicit */);
 	  cr++;
 	}
       do_cleanups (cleanup);
@@ -645,7 +644,6 @@
       varobj_update_one (var, print_values, 1 /* explicit */);
       do_cleanups (cleanup);
     }
-    return MI_CMD_DONE;
 }
 
 /* Helper for mi_cmd_var_update().  */
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index e94648b..3ae4c95 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -64,12 +64,12 @@
   { "exec-next", { NULL, 0 }, mi_cmd_exec_next},
   { "exec-next-instruction", { NULL, 0 }, mi_cmd_exec_next_instruction},
   { "exec-return", { NULL, 0 }, mi_cmd_exec_return},
-  { "exec-run", { NULL, 0 }, mi_cmd_exec_run},
+  { "exec-run", { "run", 1 }, NULL},
   { "exec-show-arguments", { NULL, 0 }, NULL },
   { "exec-signal", { NULL, 0 }, NULL },
   { "exec-step", { NULL, 0 }, mi_cmd_exec_step},
   { "exec-step-instruction", { NULL, 0 }, mi_cmd_exec_step_instruction},
-  { "exec-until", { NULL, 0 }, mi_cmd_exec_until},
+  { "exec-until", { "until", 1 }, NULL},
   { "file-clear", { NULL, 0 }, NULL },
   { "file-exec-and-symbols", { "file", 1 }, NULL },
   { "file-exec-file", { "exec-file", 1 }, NULL },
@@ -117,11 +117,11 @@
   { "symbol-list-variables", { NULL, 0 },  NULL },
   { "symbol-locate", { NULL, 0 }, NULL },
   { "symbol-type", { NULL, 0 }, NULL },
-  { "target-attach", { NULL, 0 }, NULL },
+  { "target-attach", { "attach", 1 }, NULL },
   { "target-compare-sections", { NULL, 0 }, NULL },
   { "target-detach", { "detach", 0 }, 0 },
   { "target-disconnect", { "disconnect", 0 }, 0 },
-  { "target-download", { NULL, 0 }, mi_cmd_target_download},
+  { "target-download", { "load", 1 }, NULL},
   { "target-exec-status", { NULL, 0 }, NULL },
   { "target-file-delete", { NULL, 0 }, mi_cmd_target_file_delete },
   { "target-file-get", { NULL, 0 }, mi_cmd_target_file_get },
@@ -129,7 +129,7 @@
   { "target-list-available-targets", { NULL, 0 }, NULL },
   { "target-list-current-targets", { NULL, 0 }, NULL },
   { "target-list-parameters", { NULL, 0 }, NULL },
-  { "target-select", { NULL, 0 }, mi_cmd_target_select},
+  { "target-select", { "target", 1 }, NULL},
   { "thread-info", { NULL, 0 }, mi_cmd_thread_info },
   { "thread-list-ids", { NULL, 0 }, mi_cmd_thread_list_ids},
   { "thread-select", { NULL, 0 }, mi_cmd_thread_select},
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 087b5e4..72e18c7 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -23,22 +23,6 @@
 #ifndef MI_CMDS_H
 #define MI_CMDS_H
 
-/* An MI command can return any of the following. */
-
-enum mi_cmd_result
-  {
-    /* Report the command as ``done''.  Display both the ``NNN^done''
-       message and the completion prompt.  */
-    MI_CMD_DONE = 0,
-    /* The command is still running in the forground.  Main loop should
-       display the completion prompt. */
-    MI_CMD_FORGROUND,
-    /* The MI command has already displayed its completion message.
-       Main loop will not display a completion message but will display
-       the completion prompt. */
-    MI_CMD_QUIET
-  };
-
 enum print_values {
    PRINT_NO_VALUES,
    PRINT_ALL_VALUES,
@@ -49,7 +33,7 @@
 extern const char mi_simple_values[];
 extern const char mi_all_values[];
 
-typedef enum mi_cmd_result (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
+typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
 
 /* Function implementing each command */
 extern mi_cmd_argv_ftype mi_cmd_break_insert;
@@ -72,10 +56,8 @@
 extern mi_cmd_argv_ftype mi_cmd_exec_next;
 extern mi_cmd_argv_ftype mi_cmd_exec_next_instruction;
 extern mi_cmd_argv_ftype mi_cmd_exec_return;
-extern mi_cmd_argv_ftype mi_cmd_exec_run;
 extern mi_cmd_argv_ftype mi_cmd_exec_step;
 extern mi_cmd_argv_ftype mi_cmd_exec_step_instruction;
-extern mi_cmd_argv_ftype mi_cmd_exec_until;
 extern mi_cmd_argv_ftype mi_cmd_exec_interrupt;
 extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file;
 extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_files;
@@ -91,11 +73,9 @@
 extern mi_cmd_argv_ftype mi_cmd_stack_list_locals;
 extern mi_cmd_argv_ftype mi_cmd_stack_select_frame;
 extern mi_cmd_argv_ftype mi_cmd_symbol_list_lines;
-extern mi_cmd_argv_ftype mi_cmd_target_download;
 extern mi_cmd_argv_ftype mi_cmd_target_file_get;
 extern mi_cmd_argv_ftype mi_cmd_target_file_put;
 extern mi_cmd_argv_ftype mi_cmd_target_file_delete;
-extern mi_cmd_argv_ftype mi_cmd_target_select;
 extern mi_cmd_argv_ftype mi_cmd_thread_info;
 extern mi_cmd_argv_ftype mi_cmd_thread_list_ids;
 extern mi_cmd_argv_ftype mi_cmd_thread_select;
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 8b0d909..361cf7f 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -65,9 +65,11 @@
 
 static void mi_insert_notify_hooks (void);
 static void mi_remove_notify_hooks (void);
+static void mi_on_normal_stop (struct bpstats *bs);
 
 static void mi_new_thread (struct thread_info *t);
 static void mi_thread_exit (struct thread_info *t);
+static void mi_on_resume (ptid_t ptid);
 
 static void *
 mi_interpreter_init (int top_level)
@@ -92,6 +94,8 @@
     {
       observer_attach_new_thread (mi_new_thread);
       observer_attach_thread_exit (mi_thread_exit);
+      observer_attach_normal_stop (mi_on_normal_stop);
+      observer_attach_target_resumed (mi_on_resume);
     }
 
   return mi;
@@ -171,27 +175,7 @@
   return 0;
 }
 
-static void
-mi_interpreter_exec_continuation (struct continuation_arg *arg, int error_p)
-{
-  bpstat_do_actions (&stop_bpstat);
-  /* It's not clear what to do in the case of errror -- should we assume that
-     the target is stopped, or that it still runs?  */
-  if (!target_executing)
-    {
-      fputs_unfiltered ("*stopped", raw_stdout);
-      mi_out_put (uiout, raw_stdout);
-      fputs_unfiltered ("\n", raw_stdout);
-      fputs_unfiltered ("(gdb) \n", raw_stdout);
-      gdb_flush (raw_stdout);
-    }
-  else if (target_can_async_p ())
-    {
-      add_continuation (mi_interpreter_exec_continuation, NULL);
-    }
-}
-
-enum mi_cmd_result
+void
 mi_cmd_interpreter_exec (char *command, char **argv, int argc)
 {
   struct interp *interp_to_use;
@@ -233,21 +217,9 @@
 
   mi_remove_notify_hooks ();
 
-  /* Okay, now let's see if the command set the inferior going...
-     Tricky point - have to do this AFTER resetting the interpreter, since
-     changing the interpreter will clear out all the continuations for
-     that interpreter... */
-
-  if (target_can_async_p () && target_executing)
-    {
-      fputs_unfiltered ("^running\n", raw_stdout);
-      add_continuation (mi_interpreter_exec_continuation, NULL);
-    }
-
   if (mi_error_message != NULL)
     error ("%s", mi_error_message);
   do_cleanups (old_chain);
-  return MI_CMD_DONE;
 }
 
 /*
@@ -325,12 +297,73 @@
 mi_thread_exit (struct thread_info *t)
 {
   struct mi_interp *mi = top_level_interpreter_data ();
-
   target_terminal_ours ();
   fprintf_unfiltered (mi->event_channel, "thread-exited,id=\"%d\"", t->num);
   gdb_flush (mi->event_channel);
 }
 
+static void
+mi_on_normal_stop (struct bpstats *bs)
+{
+  /* Since this can be called when CLI command is executing,
+     using cli interpreter, be sure to use MI uiout for output,
+     not the current one.  */
+  struct ui_out *uiout = interp_ui_out (top_level_interpreter ());
+  struct mi_interp *mi = top_level_interpreter_data ();
+
+  fputs_unfiltered ("*stopped", raw_stdout);
+  mi_out_put (uiout, raw_stdout);
+  mi_out_rewind (uiout);
+  fputs_unfiltered ("\n", raw_stdout);
+  gdb_flush (raw_stdout);
+}
+
+static void
+mi_on_resume (ptid_t ptid)
+{
+  /* To cater for older frontends, emit ^running, but do it only once
+     per each command.  We do it here, since at this point we know
+     that the target was successfully resumed, and in non-async mode,
+     we won't return back to MI interpreter code until the target
+     is done running, so delaying the output of "^running" until then
+     will make it impossible for frontend to know what's going on.
+
+     In future (MI3), we'll be outputting "^done" here.  */
+  if (!running_result_record_printed)
+    {
+      if (current_token)
+	fputs_unfiltered (current_token, raw_stdout);
+      fputs_unfiltered ("^running\n", raw_stdout);
+    }
+
+  if (PIDGET (ptid) == -1)
+    fprintf_unfiltered (raw_stdout, "*running,thread-id=\"all\"\n");
+  else if (thread_count () == 0)
+    {
+      /* This is a target where for single-threaded programs the thread
+	 table has zero threads.  Don't print any thread-id field.  */
+      fprintf_unfiltered (raw_stdout, "*running\n");
+    }
+  else
+    {
+      struct thread_info *ti = find_thread_pid (ptid);
+      gdb_assert (ti);
+      fprintf_unfiltered (raw_stdout, "*running,thread-id=\"%d\"\n", ti->num);
+    }
+
+  if (!running_result_record_printed)
+    {
+      running_result_record_printed = 1;
+      /* This is what gdb used to do historically -- printing prompt even if
+	 it cannot actually accept any input.  This will be surely removed
+	 for MI3, and may be removed even earler.  */
+      /* FIXME: review the use of target_is_async_p here -- is that
+	 what we want? */
+      if (!target_is_async_p ())
+	fputs_unfiltered ("(gdb) \n", raw_stdout);
+    }
+}
+
 extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */
 
 void
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 4ae509e..733fc47 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -62,29 +62,6 @@
     FROM_TTY = 0
   };
 
-/* Enumerations of the actions that may result from calling
-   captured_mi_execute_command.  */
-
-enum captured_mi_execute_command_actions
-  {
-    EXECUTE_COMMAND_DISPLAY_PROMPT,
-    EXECUTE_COMMAND_SUPPRESS_PROMPT
-  };
-
-/* This structure is used to pass information from captured_mi_execute_command
-   to mi_execute_command.  */
-struct captured_mi_execute_command_args
-{
-  /* This return result of the MI command (output).  */
-  enum mi_cmd_result rc;
-
-  /* What action to perform when the call is finished (output).  */
-  enum captured_mi_execute_command_actions action;
-
-  /* The command context to be executed (input).  */
-  struct mi_parse *command;
-};
-
 int mi_debug_p;
 struct ui_file *raw_stdout;
 
@@ -94,19 +71,16 @@
 
 static int do_timings = 0;
 
-static char *current_token;
+char *current_token;
+int running_result_record_printed = 1;
 
 extern void _initialize_mi_main (void);
-static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse);
+static void mi_cmd_execute (struct mi_parse *parse);
 
 static void mi_execute_cli_command (const char *cmd, int args_p,
 				    const char *args);
-static enum mi_cmd_result mi_execute_async_cli_command (char *cli_command, 
+static void mi_execute_async_cli_command (char *cli_command, 
 							char **argv, int argc);
-
-static void mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg, 
-						int error_p);
-
 static int register_changed_p (int regnum, struct regcache *,
 			       struct regcache *);
 static void get_register (int regnum, int format);
@@ -120,7 +94,7 @@
 static void print_diff_now (struct mi_timestamp *start);
 static void print_diff (struct mi_timestamp *start, struct mi_timestamp *end);
 
-enum mi_cmd_result
+void
 mi_cmd_gdb_exit (char *command, char **argv, int argc)
 {
   /* We have to print everything right here because we never return.  */
@@ -130,59 +104,44 @@
   mi_out_put (uiout, raw_stdout);
   /* FIXME: The function called is not yet a formal libgdb function.  */
   quit_force (NULL, FROM_TTY);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
-mi_cmd_exec_run (char *command, char **argv, int argc)
-{
-  /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  return mi_execute_async_cli_command ("run", argv, argc);
-}
-
-enum mi_cmd_result
+void
 mi_cmd_exec_next (char *command, char **argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
   return mi_execute_async_cli_command ("next", argv, argc);
 }
 
-enum mi_cmd_result
+void
 mi_cmd_exec_next_instruction (char *command, char **argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
   return mi_execute_async_cli_command ("nexti", argv, argc);
 }
 
-enum mi_cmd_result
+void
 mi_cmd_exec_step (char *command, char **argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
   return mi_execute_async_cli_command ("step", argv, argc);
 }
 
-enum mi_cmd_result
+void
 mi_cmd_exec_step_instruction (char *command, char **argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
   return mi_execute_async_cli_command ("stepi", argv, argc);
 }
 
-enum mi_cmd_result
+void
 mi_cmd_exec_finish (char *command, char **argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
   return mi_execute_async_cli_command ("finish", argv, argc);
 }
 
-enum mi_cmd_result
-mi_cmd_exec_until (char *command, char **argv, int argc)
-{
-  /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  return mi_execute_async_cli_command ("until", argv, argc);
-}
-
-enum mi_cmd_result
+void
 mi_cmd_exec_return (char *command, char **argv, int argc)
 {
   /* This command doesn't really execute the target, it just pops the
@@ -199,15 +158,17 @@
   /* Because we have called return_command with from_tty = 0, we need
      to print the frame here.  */
   print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_exec_continue (char *command, char **argv, int argc)
 {
-  /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  return mi_execute_async_cli_command ("continue", argv, argc);
+  if (argc == 0)
+    continue_1 (0);
+  else if (argc == 1 && strcmp (argv[0], "--all") == 0)
+    continue_1 (1);
+  else
+    error ("Usage: -exec-continue [--all]");
 }
 
 /* Interrupt the execution of the target.  Note how we must play around
@@ -215,23 +176,28 @@
    the result of the interrupt command, and the previous execution
    token when the target finally stops.  See comments in
    mi_cmd_execute.  */
-enum mi_cmd_result
+void
 mi_cmd_exec_interrupt (char *command, char **argv, int argc)
 {
-  if (!target_executing)
-    error ("mi_cmd_exec_interrupt: Inferior not executing.");
+  if (argc == 0)
+    {
+      if (!is_running (inferior_ptid))
+	error ("Current thread is not running.");
 
-  interrupt_target_command (NULL, 0);
-  if (current_token)
-    fputs_unfiltered (current_token, raw_stdout);
-  fputs_unfiltered ("^done", raw_stdout);
-  mi_out_put (uiout, raw_stdout);
-  mi_out_rewind (uiout);
-  fputs_unfiltered ("\n", raw_stdout);
-  return MI_CMD_QUIET;
+      interrupt_target_1 (0);
+    }
+  else if (argc == 1 && strcmp (argv[0], "--all") == 0)
+    {
+      if (!any_running ())
+	error ("Inferior not running.");
+
+      interrupt_target_1 (1);
+    }
+  else
+    error ("Usage: -exec-interrupt [--all]");
 }
 
-enum mi_cmd_result
+void
 mi_cmd_thread_select (char *command, char **argv, int argc)
 {
   enum gdb_rc rc;
@@ -247,11 +213,9 @@
       make_cleanup (xfree, mi_error_message);
       error ("%s", mi_error_message);
     }
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_thread_list_ids (char *command, char **argv, int argc)
 {
   enum gdb_rc rc;
@@ -267,11 +231,9 @@
       make_cleanup (xfree, mi_error_message);
       error ("%s", mi_error_message);
     }
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_thread_info (char *command, char **argv, int argc)
 {
   int thread = -1;
@@ -283,10 +245,9 @@
     thread = atoi (argv[0]);
 
   print_thread_info (uiout, thread);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_data_list_register_names (char *command, char **argv, int argc)
 {
   int regnum, numregs;
@@ -335,10 +296,9 @@
 			     gdbarch_register_name (current_gdbarch, regnum));
     }
   do_cleanups (cleanup);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
 {
   static struct regcache *this_regs = NULL;
@@ -403,7 +363,6 @@
 	error ("bad register number");
     }
   do_cleanups (cleanup);
-  return MI_CMD_DONE;
 }
 
 static int
@@ -439,7 +398,7 @@
    format argumetn there can be a sequence of numbers, indicating which
    registers to fetch the content of.  If the format is the only argument,
    a list of all the registers with their values is returned.  */
-enum mi_cmd_result
+void
 mi_cmd_data_list_register_values (char *command, char **argv, int argc)
 {
   int regnum, numregs, format;
@@ -497,7 +456,6 @@
 	error ("bad register number");
     }
   do_cleanups (list_cleanup);
-  return MI_CMD_DONE;
 }
 
 /* Output one register's contents in the desired format.  */
@@ -552,7 +510,7 @@
 /* Write given values into registers. The registers and values are
    given as pairs.  The corresponding MI command is 
    -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]*/
-enum mi_cmd_result
+void
 mi_cmd_data_write_register_values (char *command, char **argv, int argc)
 {
   int numregs, i;
@@ -600,13 +558,12 @@
       else
 	error ("bad register number");
     }
-  return MI_CMD_DONE;
 }
 
 /* Evaluate the value of the argument.  The argument is an
    expression. If the expression contains spaces it needs to be
    included in double quotes.  */
-enum mi_cmd_result
+void
 mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
 {
   struct expression *expr;
@@ -637,68 +594,6 @@
   ui_out_stream_delete (stb);
 
   do_cleanups (old_chain);
-
-  return MI_CMD_DONE;
-}
-
-enum mi_cmd_result
-mi_cmd_target_download (char *command, char **argv, int argc)
-{
-  char *run;
-  struct cleanup *old_cleanups = NULL;
-
-  /* There may be at most one parameter -- the name of the
-     file to download.  */
-  run = xstrprintf ("load %s", argc ? *argv : "");
-  old_cleanups = make_cleanup (xfree, run);
-  execute_command (run, 0);
-
-  do_cleanups (old_cleanups);
-  return MI_CMD_DONE;
-}
-
-/* Connect to the remote target.  */
-enum mi_cmd_result
-mi_cmd_target_select (char *command, char **argv, int argc)
-{
-  char *run = NULL;
-  struct cleanup *old_cleanups = NULL;
-  int i;
-
-  if (argc == 0)
-    error ("no target type specified");
-    
-  for (i = 0; i < argc; ++i)
-    {
-      if (i == 0)
-	run = concat ("target ", argv[0], NULL);
-      else
-	{
-	  char *prev = run;
-	  run = concat (run, " ", argv[i], NULL);
-	  xfree (prev);
-	}
-    }
-  
-  old_cleanups = make_cleanup (xfree, run);
-
-  /* target-select is always synchronous.  Once the call has returned
-     we know that we are connected.  */
-  /* NOTE: At present all targets that are connected are also
-     (implicitly) talking to a halted target.  In the future this may
-     change.  */
-  execute_command (run, 0);
-
-  do_cleanups (old_cleanups);
-
-  /* Issue the completion message here.  */
-  if (current_token)
-    fputs_unfiltered (current_token, raw_stdout);
-  fputs_unfiltered ("^connected", raw_stdout);
-  mi_out_put (uiout, raw_stdout);
-  mi_out_rewind (uiout);
-  fputs_unfiltered ("\n", raw_stdout);
-  return MI_CMD_QUIET;
 }
 
 /* DATA-MEMORY-READ:
@@ -720,7 +615,7 @@
    Returns: 
    The number of bytes read is SIZE*ROW*COL. */
 
-enum mi_cmd_result
+void
 mi_cmd_data_read_memory (char *command, char **argv, int argc)
 {
   struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
@@ -819,8 +714,8 @@
   mbuf = xcalloc (total_bytes, 1);
   make_cleanup (xfree, mbuf);
 
-  nr_bytes = target_read (&current_target, TARGET_OBJECT_MEMORY, NULL,
-			  mbuf, addr, total_bytes);
+  nr_bytes = target_read_until_error (&current_target, TARGET_OBJECT_MEMORY, 
+				      NULL, mbuf, addr, total_bytes);
   if (nr_bytes <= 0)
     error ("Unable to read memory.");
 
@@ -894,7 +789,6 @@
     do_cleanups (cleanup_list_memory);
   }
   do_cleanups (cleanups);
-  return MI_CMD_DONE;
 }
 
 /* DATA-MEMORY-WRITE:
@@ -913,7 +807,7 @@
    Writes VALUE into ADDR + (COLUMN_OFFSET * WORD_SIZE).
 
    Prints nothing.  */
-enum mi_cmd_result
+void
 mi_cmd_data_write_memory (char *command, char **argv, int argc)
 {
   CORE_ADDR addr;
@@ -978,11 +872,9 @@
   write_memory (addr, buffer, word_size);
   /* Free the buffer.  */
   do_cleanups (old_chain);
-
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_enable_timings (char *command, char **argv, int argc)
 {
   if (argc == 0)
@@ -999,14 +891,13 @@
   else
     goto usage_error;
     
-  return MI_CMD_DONE;
+  return;
 
  usage_error:
   error ("mi_cmd_enable_timings: Usage: %s {yes|no}", command);
-  return MI_CMD_DONE;
 }
 
-enum mi_cmd_result
+void
 mi_cmd_list_features (char *command, char **argv, int argc)
 {
   if (argc == 0)
@@ -1019,12 +910,10 @@
       ui_out_field_string (uiout, NULL, "thread-info");
       
       do_cleanups (cleanup);
-
-      return MI_CMD_DONE;
+      return;
     }
 
   error ("-list-features should be passed no arguments");
-  return MI_CMD_DONE;
 }
  
 /* Execute a command within a safe environment.
@@ -1037,65 +926,54 @@
 static void
 captured_mi_execute_command (struct ui_out *uiout, void *data)
 {
-  struct captured_mi_execute_command_args *args =
-    (struct captured_mi_execute_command_args *) data;
-  struct mi_parse *context = args->command;
+  struct mi_parse *context = (struct mi_parse *) data;
 
   struct mi_timestamp cmd_finished;
 
+  running_result_record_printed = 0;
   switch (context->op)
     {
-
     case MI_COMMAND:
       /* A MI command was read from the input stream.  */
       if (mi_debug_p)
 	/* FIXME: gdb_???? */
 	fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n",
 			    context->token, context->command, context->args);
-      /* FIXME: cagney/1999-09-25: Rather than this convoluted
-         condition expression, each function should return an
-         indication of what action is required and then switch on
-         that.  */
-      args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
 
       if (do_timings)
 	current_command_ts = context->cmd_start;
 
-      args->rc = mi_cmd_execute (context);
+      mi_cmd_execute (context);
 
       if (do_timings)
 	timestamp (&cmd_finished);
 
-      if (!target_can_async_p () || !target_executing)
-	{
-	  /* Print the result if there were no errors.
+      /* Print the result if there were no errors.
 
-	     Remember that on the way out of executing a command, you have
-	     to directly use the mi_interp's uiout, since the command could 
-	     have reset the interpreter, in which case the current uiout 
-	     will most likely crash in the mi_out_* routines.  */
-	  if (args->rc == MI_CMD_DONE)
-	    {
-	      fputs_unfiltered (context->token, raw_stdout);
-	      fputs_unfiltered ("^done", raw_stdout);
-	      mi_out_put (uiout, raw_stdout);
-	      mi_out_rewind (uiout);
-	      /* Have to check cmd_start, since the command could be
-		 -enable-timings.  */
-	      if (do_timings && context->cmd_start)
-		  print_diff (context->cmd_start, &cmd_finished);
-	      fputs_unfiltered ("\n", raw_stdout);
-	    }
-	  else
-	    mi_out_rewind (uiout);
-	}
-      else if (sync_execution)
+	 Remember that on the way out of executing a command, you have
+	 to directly use the mi_interp's uiout, since the command could 
+	 have reset the interpreter, in which case the current uiout 
+	 will most likely crash in the mi_out_* routines.  */
+      if (!running_result_record_printed)
 	{
-	  /* Don't print the prompt. We are executing the target in
-	     synchronous mode.  */
-	  args->action = EXECUTE_COMMAND_SUPPRESS_PROMPT;
-	  return;
+	  fputs_unfiltered (context->token, raw_stdout);
+	  /* There's no particularly good reason why target-connect results
+	     in not ^done.  Should kill ^connected for MI3.  */
+	  fputs_unfiltered (strcmp (context->command, "target-select") == 0
+			    ? "^connected" : "^done", raw_stdout);
+	  mi_out_put (uiout, raw_stdout);
+	  mi_out_rewind (uiout);
+	  /* Have to check cmd_start, since the command could be
+	     -enable-timings.  */
+	  if (do_timings && context->cmd_start)
+	    print_diff (context->cmd_start, &cmd_finished);
+	  fputs_unfiltered ("\n", raw_stdout);
 	}
+      else
+	    /* The command does not want anything to be printed.  In that
+	       case, the command probably should not have written anything
+	       to uiout, but in case it has written something, discard it.  */
+	mi_out_rewind (uiout);
       break;
 
     case CLI_COMMAND:
@@ -1109,7 +987,7 @@
 	/* Call the "console" interpreter.  */
 	argv[0] = "console";
 	argv[1] = context->command;
-	args->rc = mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
+	mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
 
 	/* If we changed interpreters, DON'T print out anything.  */
 	if (current_interp_named_p (INTERP_MI)
@@ -1117,14 +995,13 @@
 	    || current_interp_named_p (INTERP_MI2)
 	    || current_interp_named_p (INTERP_MI3))
 	  {
-	    if (args->rc == MI_CMD_DONE)
+	    if (!running_result_record_printed)
 	      {
 		fputs_unfiltered (context->token, raw_stdout);
 		fputs_unfiltered ("^done", raw_stdout);
 		mi_out_put (uiout, raw_stdout);
 		mi_out_rewind (uiout);
 		fputs_unfiltered ("\n", raw_stdout);
-		args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
 	      }
 	    else
 	      mi_out_rewind (uiout);
@@ -1142,7 +1019,6 @@
 mi_execute_command (char *cmd, int from_tty)
 {
   struct mi_parse *command;
-  struct captured_mi_execute_command_args args;
   struct ui_out *saved_uiout = uiout;
 
   /* This is to handle EOF (^D). We just quit gdb.  */
@@ -1163,8 +1039,7 @@
 	  timestamp (command->cmd_start);
 	}
 
-      args.command = command;
-      result = catch_exception (uiout, captured_mi_execute_command, &args,
+      result = catch_exception (uiout, captured_mi_execute_command, command,
 				RETURN_MASK_ALL);
       if (result.reason < 0)
 	{
@@ -1181,11 +1056,6 @@
 	}
 
       mi_parse_free (command);
-
-      if (args.action == EXECUTE_COMMAND_SUPPRESS_PROMPT)
-	/* The command is executing synchronously.  Bail out early
-	   suppressing the finished prompt.  */
-	return;
     }
 
   fputs_unfiltered ("(gdb) \n", raw_stdout);
@@ -1194,35 +1064,64 @@
   /* ..... */
 }
 
-static enum mi_cmd_result
+static void
 mi_cmd_execute (struct mi_parse *parse)
 {
   struct cleanup *cleanup;
-  enum mi_cmd_result r;
+  int i;
   free_all_values ();
 
+  current_token = xstrdup (parse->token);
+  cleanup = make_cleanup (free_current_contents, &current_token);
+
+  if (parse->frame != -1 && parse->thread == -1)
+    error (_("Cannot specify --frame without --thread"));
+  
+  if (parse->thread != -1)
+    {
+      struct thread_info *tp = find_thread_id (parse->thread);
+      if (!tp)
+	error (_("Invalid thread id: %d"), parse->thread);
+      
+      if (non_stop)
+	context_switch_to (tp->ptid);
+      else
+	switch_to_thread (tp->ptid);
+    }
+  
+  if (parse->frame != -1)
+    {
+      struct frame_info *fid;
+      int frame = parse->frame;
+      fid = find_relative_frame (get_current_frame (), &frame);
+      if (frame == 0)
+	/* find_relative_frame was successful */
+	select_frame (fid);
+      else
+	error (_("Invalid frame id: %d"), frame);
+    }
+  
   if (parse->cmd->argv_func != NULL)
     {
-      if (target_executing)
+      if (target_can_async_p ()
+	  && target_has_execution
+	  && (is_exited (inferior_ptid))
+	  && (strcmp (parse->command, "thread-info") != 0
+	      && strcmp (parse->command, "thread-list-ids") != 0
+	      && strcmp (parse->command, "thread-select") != 0))
 	{
-	  if (strcmp (parse->command, "exec-interrupt"))
-	    {
-	      struct ui_file *stb;
-	      stb = mem_fileopen ();
+	  struct ui_file *stb;
+	  stb = mem_fileopen ();
 
-	      fputs_unfiltered ("Cannot execute command ", stb);
-	      fputstr_unfiltered (parse->command, '"', stb);
-	      fputs_unfiltered (" while target running", stb);
+	  fputs_unfiltered ("Cannot execute command ", stb);
+	  fputstr_unfiltered (parse->command, '"', stb);
+	  fputs_unfiltered (" without a selected thread", stb);
 
-	      make_cleanup_ui_file_delete (stb);
-	      error_stream (stb);
-	    }
+	  make_cleanup_ui_file_delete (stb);
+	  error_stream (stb);
 	}
-      current_token = xstrdup (parse->token);
-      cleanup = make_cleanup (free_current_contents, &current_token);
-      r = parse->cmd->argv_func (parse->command, parse->argv, parse->argc);
-      do_cleanups (cleanup);
-      return r;
+
+      parse->cmd->argv_func (parse->command, parse->argv, parse->argc);
     }
   else if (parse->cmd->cli.cmd != 0)
     {
@@ -1231,7 +1130,6 @@
       /* Must be a synchronous one.  */
       mi_execute_cli_command (parse->cmd->cli.cmd, parse->cmd->cli.args_p,
 			      parse->args);
-      return MI_CMD_DONE;
     }
   else
     {
@@ -1246,10 +1144,8 @@
 
       make_cleanup_ui_file_delete (stb);
       error_stream (stb);
-
-      /* unreacheable */
-      return MI_CMD_DONE;
     }
+  do_cleanups (cleanup);
 }
 
 /* FIXME: This is just a hack so we can get some extra commands going.
@@ -1278,7 +1174,7 @@
     }
 }
 
-enum mi_cmd_result
+void
 mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
 {
   struct cleanup *old_cleanups;
@@ -1290,41 +1186,12 @@
     run = xstrprintf ("%s %s", cli_command, argc ? *argv : "");
   old_cleanups = make_cleanup (xfree, run);  
 
-  if (!target_can_async_p ())
-    {
-      /* NOTE: For synchronous targets asynchronous behavour is faked by
-         printing out the GDB prompt before we even try to execute the
-         command.  */
-      if (current_token)
-	fputs_unfiltered (current_token, raw_stdout);
-      fputs_unfiltered ("^running\n", raw_stdout);
-      fputs_unfiltered ("(gdb) \n", raw_stdout);
-      gdb_flush (raw_stdout);
-    }
-  else
-    {
-      /* FIXME: cagney/1999-11-29: Printing this message before
-         calling execute_command is wrong.  It should only be printed
-         once gdb has confirmed that it really has managed to send a
-         run command to the target.  */
-      if (current_token)
-	fputs_unfiltered (current_token, raw_stdout);
-      fputs_unfiltered ("^running\n", raw_stdout);
-
-      /* Ideally, we should be intalling continuation only when
-	 the target is already running. However, this will break right now,
-	 because continuation installed by the 'finish' command must be after
-	 the continuation that prints *stopped.  This issue will be
-	 fixed soon.  */
-      add_continuation (mi_exec_async_cli_cmd_continuation, NULL);
-    }
-
   execute_command ( /*ui */ run, 0 /*from_tty */ );
 
   if (target_can_async_p ())
     {
       /* If we're not executing, an exception should have been throw.  */
-      gdb_assert (target_executing);
+      gdb_assert (is_running (inferior_ptid));
       do_cleanups (old_cleanups);
     }
   else
@@ -1332,28 +1199,9 @@
       /* Do this before doing any printing.  It would appear that some
          print code leaves garbage around in the buffer.  */
       do_cleanups (old_cleanups);
-      /* If the target was doing the operation synchronously we fake
-         the stopped message.  */
-      fputs_unfiltered ("*stopped", raw_stdout);
-      mi_out_put (uiout, raw_stdout);
-      mi_out_rewind (uiout);
       if (do_timings)
       	print_diff_now (current_command_ts);
-      fputs_unfiltered ("\n", raw_stdout);
-      return MI_CMD_QUIET;
-    }    
-  return MI_CMD_DONE;
-}
-
-void
-mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg, int error_p)
-{
-  /* Assume 'error' means that target is stopped, too.  */
-  fputs_unfiltered ("*stopped", raw_stdout);
-  mi_out_put (uiout, raw_stdout);
-  fputs_unfiltered ("\n", raw_stdout);
-  fputs_unfiltered ("(gdb) \n", raw_stdout);
-  gdb_flush (raw_stdout);
+    }
 }
 
 void
diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h
index 1a2e93c..1aa5da2 100644
--- a/gdb/mi/mi-main.h
+++ b/gdb/mi/mi-main.h
@@ -25,5 +25,10 @@
 			      unsigned long total_section,
 			      unsigned long total_sent,
 			      unsigned long grand_total);
+
+extern char *current_token;
+
+extern int running_result_record_printed;
+
 #endif
 
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index a2dc50d..73e04aa 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -150,6 +150,8 @@
   char *chp;
   struct mi_parse *parse = XMALLOC (struct mi_parse);
   memset (parse, 0, sizeof (*parse));
+  parse->thread = -1;
+  parse->frame = -1;
 
   /* Before starting, skip leading white space. */
   while (isspace (*cmd))
@@ -199,6 +201,40 @@
   while (isspace (*chp))
     chp++;
 
+  /* Parse the --thread and --frame options, if present.  At present,
+     some important commands, like '-break-*' are implemented by forwarding
+     to the CLI layer directly.  We want to parse --thread and --frame
+     here, so as not to leave those option in the string that will be passed
+     to CLI.  */
+  for (;;)
+    {
+      char *start = chp;
+      size_t ts = sizeof ("--thread ") - 1;
+      size_t fs = sizeof ("--frame ") - 1;
+      if (strncmp (chp, "--thread ", ts) == 0)
+	{
+	  if (parse->thread != -1)
+	    error ("Duplicate '--thread' option");
+	  chp += ts;
+	  parse->thread = strtol (chp, &chp, 10);
+	}
+      else if (strncmp (chp, "--frame ", fs) == 0)
+	{
+	  if (parse->frame != -1)
+	    error ("Duplicate '--frame' option");
+	  chp += fs;
+	  parse->frame = strtol (chp, &chp, 10);
+	}
+      else
+	break;
+
+      if (*chp != '\0' && !isspace (*chp))
+	error ("Invalid value for the '%s' option",
+	       start[2] == 't' ? "--thread" : "--frame");
+      while (isspace (*chp))
+	chp++;
+    }
+
   /* For new argv commands, attempt to return the parsed argument
      list. */
   if (parse->cmd->argv_func != NULL)
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index 945c42d..aa262f5 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -46,6 +46,8 @@
     char *args;
     char **argv;
     int argc;
+    int thread;
+    int frame;
   };
 
 /* Attempts to parse CMD returning a ``struct mi_command''.  If CMD is
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index 4e8b3ff..b4b6c1a 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -27,7 +27,7 @@
    the provided (full or base) source file name.  The entries
    are sorted in ascending PC order. */
 
-enum mi_cmd_result
+void
 mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
 {
   char *filename;
@@ -60,6 +60,4 @@
     }
 
   do_cleanups (cleanup_stack);
-
-  return MI_CMD_DONE;
 }
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 976bcf7..6fadd9c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -211,14 +211,15 @@
   return mips_regnum (gdbarch)->fp0 + 12;
 }
 
-#define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \
-		   || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64)
+#define MIPS_EABI(gdbarch) (gdbarch_tdep (gdbarch)->mips_abi \
+		     == MIPS_ABI_EABI32 \
+		   || gdbarch_tdep (gdbarch)->mips_abi == MIPS_ABI_EABI64)
 
-#define MIPS_LAST_FP_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_fp_arg_regnum)
+#define MIPS_LAST_FP_ARG_REGNUM(gdbarch) (gdbarch_tdep (gdbarch)->mips_last_fp_arg_regnum)
 
-#define MIPS_LAST_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_arg_regnum)
+#define MIPS_LAST_ARG_REGNUM(gdbarch) (gdbarch_tdep (gdbarch)->mips_last_arg_regnum)
 
-#define MIPS_FPU_TYPE (gdbarch_tdep (current_gdbarch)->mips_fpu_type)
+#define MIPS_FPU_TYPE(gdbarch) (gdbarch_tdep (gdbarch)->mips_fpu_type)
 
 /* MIPS16 function addresses are odd (bit 0 is set).  Here are some
    functions to test, set, or clear bit 0 of addresses.  */
@@ -391,7 +392,7 @@
 
 #define VM_MIN_ADDRESS (CORE_ADDR)0x400000
 
-static CORE_ADDR heuristic_proc_start (CORE_ADDR);
+static CORE_ADDR heuristic_proc_start (struct gdbarch *, CORE_ADDR);
 
 static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element *);
 
@@ -1431,18 +1432,16 @@
    saved registers in a frame.  */
 
 static void
-set_reg_offset (struct mips_frame_cache *this_cache, int regnum,
-		CORE_ADDR offset)
+set_reg_offset (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache,
+		int regnum, CORE_ADDR offset)
 {
   if (this_cache != NULL
       && this_cache->saved_regs[regnum].addr == -1)
     {
-      this_cache->saved_regs[regnum
-			     + 0 * gdbarch_num_regs (current_gdbarch)].addr
-      = offset;
-      this_cache->saved_regs[regnum
-			     + 1 * gdbarch_num_regs (current_gdbarch)].addr
-      = offset;
+      this_cache->saved_regs[regnum + 0 * gdbarch_num_regs (gdbarch)].addr
+        = offset;
+      this_cache->saved_regs[regnum + 1 * gdbarch_num_regs (gdbarch)].addr
+        = offset;
     }
 }
 
@@ -1559,23 +1558,23 @@
 	{
 	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
 	  reg = mips16_to_32_reg[(inst & 0x700) >> 8];
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	}
       else if ((inst & 0xff00) == 0xf900)	/* sd reg,n($sp) */
 	{
 	  offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
 	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	}
       else if ((inst & 0xff00) == 0x6200)	/* sw $ra,n($sp) */
 	{
 	  offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
-	  set_reg_offset (this_cache, MIPS_RA_REGNUM, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM, sp + offset);
 	}
       else if ((inst & 0xff00) == 0xfa00)	/* sd $ra,n($sp) */
 	{
 	  offset = mips16_get_imm (prev_inst, inst, 8, 8, 0);
-	  set_reg_offset (this_cache, MIPS_RA_REGNUM, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM, sp + offset);
 	}
       else if (inst == 0x673d)	/* move $s1, $sp */
 	{
@@ -1593,13 +1592,13 @@
 	{
 	  offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
 	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
-	  set_reg_offset (this_cache, reg, frame_addr + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
 	}
       else if ((inst & 0xFF00) == 0x7900)	/* sd reg,offset($s1) */
 	{
 	  offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
 	  reg = mips16_to_32_reg[(inst & 0xe0) >> 5];
-	  set_reg_offset (this_cache, reg, frame_addr + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
 	}
       else if ((inst & 0xf81f) == 0xe809
                && (inst & 0x700) != 0x700)	/* entry */
@@ -1648,7 +1647,7 @@
       /* Check if a0-a3 were saved in the caller's argument save area.  */
       for (reg = 4, offset = 0; reg < areg_count + 4; reg++)
 	{
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	  offset += mips_abi_regsize (gdbarch);
 	}
 
@@ -1656,14 +1655,14 @@
       offset = -4;
       if (entry_inst & 0x20)
 	{
-	  set_reg_offset (this_cache, MIPS_RA_REGNUM, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
 
       /* Check if the s0 and s1 registers were pushed on the stack.  */
       for (reg = 16; reg < sreg_count + 16; reg++)
 	{
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
     }
@@ -1715,7 +1714,7 @@
       /* Check if A0-A3 were saved in the caller's argument save area.  */
       for (reg = MIPS_A0_REGNUM, offset = 0; reg < args + 4; reg++)
 	{
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	  offset += mips_abi_regsize (gdbarch);
 	}
 
@@ -1724,41 +1723,41 @@
       /* Check if the RA register was pushed on the stack.  */
       if (save_inst & 0x40)
 	{
-	  set_reg_offset (this_cache, MIPS_RA_REGNUM, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
 
       /* Check if the S8 register was pushed on the stack.  */
       if (xsregs > 6)
 	{
-	  set_reg_offset (this_cache, 30, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, 30, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	  xsregs--;
 	}
       /* Check if S2-S7 were pushed on the stack.  */
       for (reg = 18 + xsregs - 1; reg > 18 - 1; reg--)
 	{
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
 
       /* Check if the S1 register was pushed on the stack.  */
       if (save_inst & 0x10)
 	{
-	  set_reg_offset (this_cache, 17, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, 17, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
       /* Check if the S0 register was pushed on the stack.  */
       if (save_inst & 0x20)
 	{
-	  set_reg_offset (this_cache, 16, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, 16, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
 
       /* Check if A0-A3 were pushed on the stack.  */
       for (reg = MIPS_A0_REGNUM + 3; reg > MIPS_A0_REGNUM + 3 - astatic; reg--)
 	{
-	  set_reg_offset (this_cache, reg, sp + offset);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + offset);
 	  offset -= mips_abi_regsize (gdbarch);
 	}
     }
@@ -1808,7 +1807,7 @@
 
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
     if (start_addr == 0)
-      start_addr = heuristic_proc_start (pc);
+      start_addr = heuristic_proc_start (get_frame_arch (this_frame), pc);
     /* We can't analyze the prologue if we couldn't find the begining
        of the function.  */
     if (start_addr == 0)
@@ -1893,14 +1892,14 @@
 /* Mark all the registers as unset in the saved_regs array
    of THIS_CACHE.  Do nothing if THIS_CACHE is null.  */
 
-void
-reset_saved_regs (struct mips_frame_cache *this_cache)
+static void
+reset_saved_regs (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache)
 {
   if (this_cache == NULL || this_cache->saved_regs == NULL)
     return;
 
   {
-    const int num_regs = gdbarch_num_regs (current_gdbarch);
+    const int num_regs = gdbarch_num_regs (gdbarch);
     int i;
 
     for (i = 0; i < num_regs; i++)
@@ -1975,13 +1974,13 @@
       else if (((high_word & 0xFFE0) == 0xafa0) /* sw reg,offset($sp) */
                && !regsize_is_64_bits)
 	{
-	  set_reg_offset (this_cache, reg, sp + low_word);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + low_word);
 	}
       else if (((high_word & 0xFFE0) == 0xffa0)	/* sd reg,offset($sp) */
                && regsize_is_64_bits)
 	{
 	  /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra.  */
-	  set_reg_offset (this_cache, reg, sp + low_word);
+	  set_reg_offset (gdbarch, this_cache, reg, sp + low_word);
 	}
       else if (high_word == 0x27be)	/* addiu $30,$sp,size */
 	{
@@ -2007,7 +2006,7 @@
                      we will hit a guard that prevents the new address
                      for each register to be recomputed during the second
                      pass.  */
-                  reset_saved_regs (this_cache);
+                  reset_saved_regs (gdbarch, this_cache);
 		  goto restart;
 		}
 	    }
@@ -2037,7 +2036,7 @@
                      we will hit a guard that prevents the new address
                      for each register to be recomputed during the second
                      pass.  */
-                  reset_saved_regs (this_cache);
+                  reset_saved_regs (gdbarch, this_cache);
 	          goto restart;
 	        }
 	    }
@@ -2045,7 +2044,7 @@
       else if ((high_word & 0xFFE0) == 0xafc0 	/* sw reg,offset($30) */
                && !regsize_is_64_bits)
 	{
-	  set_reg_offset (this_cache, reg, frame_addr + low_word);
+	  set_reg_offset (gdbarch, this_cache, reg, frame_addr + low_word);
 	}
       else if ((high_word & 0xFFE0) == 0xE7A0 /* swc1 freg,n($sp) */
                || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
@@ -2145,7 +2144,7 @@
 
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
     if (start_addr == 0)
-      start_addr = heuristic_proc_start (pc);
+      start_addr = heuristic_proc_start (get_frame_arch (this_frame), pc);
     /* We can't analyze the prologue if we couldn't find the begining
        of the function.  */
     if (start_addr == 0)
@@ -2517,14 +2516,14 @@
    lines.  */
 
 static CORE_ADDR
-heuristic_proc_start (CORE_ADDR pc)
+heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   CORE_ADDR start_pc;
   CORE_ADDR fence;
   int instlen;
   int seen_adjsp = 0;
 
-  pc = gdbarch_addr_bits_remove (current_gdbarch, pc);
+  pc = gdbarch_addr_bits_remove (gdbarch, pc);
   start_pc = pc;
   fence = start_pc - heuristic_fence_post;
   if (start_pc == 0)
@@ -2633,16 +2632,17 @@
    arguments into integer registers. */
 
 static int
-fp_register_arg_p (enum type_code typecode, struct type *arg_type)
+fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
+		   struct type *arg_type)
 {
   return ((typecode == TYPE_CODE_FLT
-	   || (MIPS_EABI
+	   || (MIPS_EABI (gdbarch)
 	       && (typecode == TYPE_CODE_STRUCT
 		   || typecode == TYPE_CODE_UNION)
 	       && TYPE_NFIELDS (arg_type) == 1
 	       && TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (arg_type, 0))) 
 	       == TYPE_CODE_FLT))
-	  && MIPS_FPU_TYPE != MIPS_FPU_NONE);
+	  && MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
 }
 
 /* On o32, argument passing in GPRs depends on the alignment of the type being
@@ -2777,7 +2777,7 @@
          up before the check to see if there are any FP registers
          left.  Non MIPS_EABI targets also pass the FP in the integer
          registers so also round up normal registers.  */
-      if (regsize < 8 && fp_register_arg_p (typecode, arg_type))
+      if (regsize < 8 && fp_register_arg_p (gdbarch, typecode, arg_type))
 	{
 	  if ((float_argreg & 1))
 	    float_argreg++;
@@ -2795,8 +2795,8 @@
       /* MIPS_EABI squeezes a struct that contains a single floating
          point value into an FP register instead of pushing it onto the
          stack.  */
-      if (fp_register_arg_p (typecode, arg_type)
-	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
+      if (fp_register_arg_p (gdbarch, typecode, arg_type)
+	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
 	{
 	  /* EABI32 will pass doubles in consecutive registers, even on
 	     64-bit cores.  At one time, we used to check the size of
@@ -2861,9 +2861,9 @@
 				    partial_len);
 
 	      /* Write this portion of the argument to the stack.  */
-	      if (argreg > MIPS_LAST_ARG_REGNUM
+	      if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch)
 		  || odd_sized_struct
-		  || fp_register_arg_p (typecode, arg_type))
+		  || fp_register_arg_p (gdbarch, typecode, arg_type))
 		{
 		  /* Should shorter than int integer values be
 		     promoted to int before being stored? */
@@ -2912,8 +2912,8 @@
 	         arguments will not.  */
 	      /* Write this portion of the argument to a general
 	         purpose register.  */
-	      if (argreg <= MIPS_LAST_ARG_REGNUM
-		  && !fp_register_arg_p (typecode, arg_type))
+	      if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch)
+		  && !fp_register_arg_p (gdbarch, typecode, arg_type))
 		{
 		  LONGEST regval =
 		    extract_unsigned_integer (val, partial_len);
@@ -3020,14 +3020,15 @@
    registers.  */
 
 static int
-mips_n32n64_fp_arg_chunk_p (struct type *arg_type, int offset)
+mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
+			    int offset)
 {
   int i;
 
   if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
     return 0;
 
-  if (MIPS_FPU_TYPE != MIPS_FPU_DOUBLE)
+  if (MIPS_FPU_TYPE (gdbarch) != MIPS_FPU_DOUBLE)
     return 0;
 
   if (TYPE_LENGTH (arg_type) < offset + MIPS64_REGSIZE)
@@ -3062,7 +3063,7 @@
 
       /* This field starts at or before the requested offset, and
 	 overlaps it.  If it is a structure, recurse inwards.  */
-      return mips_n32n64_fp_arg_chunk_p (field_type, offset - pos);
+      return mips_n32n64_fp_arg_chunk_p (gdbarch, field_type, offset - pos);
     }
 
   return 0;
@@ -3141,8 +3142,8 @@
 
       val = value_contents (arg);
 
-      if (fp_register_arg_p (typecode, arg_type)
-	  && argreg <= MIPS_LAST_ARG_REGNUM)
+      if (fp_register_arg_p (gdbarch, typecode, arg_type)
+	  && argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
 	{
 	  /* This is a floating point value that fits entirely
 	     in a single register.  */
@@ -3184,11 +3185,11 @@
 		fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
 				    partial_len);
 
-	      if (fp_register_arg_p (typecode, arg_type))
-		gdb_assert (argreg > MIPS_LAST_ARG_REGNUM);
+	      if (fp_register_arg_p (gdbarch, typecode, arg_type))
+		gdb_assert (argreg > MIPS_LAST_ARG_REGNUM (gdbarch));
 
 	      /* Write this portion of the argument to the stack.  */
-	      if (argreg > MIPS_LAST_ARG_REGNUM)
+	      if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch))
 		{
 		  /* Should shorter than int integer values be
 		     promoted to int before being stored? */
@@ -3232,7 +3233,7 @@
 	         structs may go thru BOTH paths.  */
 	      /* Write this portion of the argument to a general
 	         purpose register.  */
-	      if (argreg <= MIPS_LAST_ARG_REGNUM)
+	      if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
 		{
 		  LONGEST regval;
 
@@ -3272,7 +3273,7 @@
 				      phex (regval, MIPS64_REGSIZE));
 		  regcache_cooked_write_unsigned (regcache, argreg, regval);
 
-		  if (mips_n32n64_fp_arg_chunk_p (arg_type,
+		  if (mips_n32n64_fp_arg_chunk_p (gdbarch, arg_type,
 						  TYPE_LENGTH (arg_type) - len))
 		    {
 		      if (mips_debug)
@@ -3552,7 +3553,7 @@
          up before the check to see if there are any FP registers
          left.  O32/O64 targets also pass the FP in the integer
          registers so also round up normal registers.  */
-      if (fp_register_arg_p (typecode, arg_type))
+      if (fp_register_arg_p (gdbarch, typecode, arg_type))
 	{
 	  if ((float_argreg & 1))
 	    float_argreg++;
@@ -3568,8 +3569,8 @@
          arguments in general registers can't hurt non-MIPS16 functions
          because those registers are normally skipped.  */
 
-      if (fp_register_arg_p (typecode, arg_type)
-	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
+      if (fp_register_arg_p (gdbarch, typecode, arg_type)
+	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
 	{
 	  if (register_size (gdbarch, float_argreg) < 8 && len == 8)
 	    {
@@ -3657,7 +3658,7 @@
 				    partial_len);
 
 	      /* Write this portion of the argument to the stack.  */
-	      if (argreg > MIPS_LAST_ARG_REGNUM
+	      if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch)
 		  || odd_sized_struct)
 		{
 		  /* Should shorter than int integer values be
@@ -3694,7 +3695,7 @@
 	         structs may go thru BOTH paths.  */
 	      /* Write this portion of the argument to a general
 	         purpose register.  */
-	      if (argreg <= MIPS_LAST_ARG_REGNUM)
+	      if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
 		{
 		  LONGEST regval = extract_signed_integer (val, partial_len);
 		  /* Value may need to be sign extended, because
@@ -3741,7 +3742,7 @@
 
 		  /* Prevent subsequent floating point arguments from
 		     being passed in floating point registers.  */
-		  float_argreg = MIPS_LAST_FP_ARG_REGNUM + 1;
+		  float_argreg = MIPS_LAST_FP_ARG_REGNUM (gdbarch) + 1;
 		}
 
 	      len -= partial_len;
@@ -4016,8 +4017,8 @@
          arguments in general registers can't hurt non-MIPS16 functions
          because those registers are normally skipped.  */
 
-      if (fp_register_arg_p (typecode, arg_type)
-	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
+      if (fp_register_arg_p (gdbarch, typecode, arg_type)
+	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
 	{
 	  LONGEST regval = extract_unsigned_integer (val, len);
 	  if (mips_debug)
@@ -4054,7 +4055,7 @@
 				    partial_len);
 
 	      /* Write this portion of the argument to the stack.  */
-	      if (argreg > MIPS_LAST_ARG_REGNUM
+	      if (argreg > MIPS_LAST_ARG_REGNUM (gdbarch)
 		  || odd_sized_struct)
 		{
 		  /* Should shorter than int integer values be
@@ -4099,7 +4100,7 @@
 	         structs may go thru BOTH paths.  */
 	      /* Write this portion of the argument to a general
 	         purpose register.  */
-	      if (argreg <= MIPS_LAST_ARG_REGNUM)
+	      if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
 		{
 		  LONGEST regval = extract_signed_integer (val, partial_len);
 		  /* Value may need to be sign extended, because
@@ -4130,7 +4131,7 @@
 
 		  /* Prevent subsequent floating point arguments from
 		     being passed in floating point registers.  */
-		  float_argreg = MIPS_LAST_FP_ARG_REGNUM + 1;
+		  float_argreg = MIPS_LAST_FP_ARG_REGNUM (gdbarch) + 1;
 		}
 
 	      len -= partial_len;
@@ -4168,7 +4169,7 @@
       || TYPE_CODE (type) == TYPE_CODE_UNION
       || TYPE_CODE (type) == TYPE_CODE_ARRAY)
     return RETURN_VALUE_STRUCT_CONVENTION;
-  else if (fp_register_arg_p (TYPE_CODE (type), type))
+  else if (fp_register_arg_p (gdbarch, TYPE_CODE (type), type))
     {
       /* A floating-point value.  It fits in the least significant
          part of FP0.  */
@@ -4785,7 +4786,7 @@
       return;
     }
 
-  switch (MIPS_FPU_TYPE)
+  switch (MIPS_FPU_TYPE (current_gdbarch))
     {
     case MIPS_FPU_SINGLE:
       fpu = "single-precision";
@@ -6032,13 +6033,14 @@
 		       : MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
 		       : MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
 		       : "???"));
-  fprintf_unfiltered (file, "mips_dump_tdep: MIPS_EABI = %d\n", MIPS_EABI);
+  fprintf_unfiltered (file, "mips_dump_tdep: MIPS_EABI = %d\n",
+		      MIPS_EABI (gdbarch));
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
-		      MIPS_FPU_TYPE,
-		      (MIPS_FPU_TYPE == MIPS_FPU_NONE ? "none"
-		       : MIPS_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
-		       : MIPS_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
+		      MIPS_FPU_TYPE (gdbarch),
+		      (MIPS_FPU_TYPE (gdbarch) == MIPS_FPU_NONE ? "none"
+		       : MIPS_FPU_TYPE (gdbarch) == MIPS_FPU_SINGLE ? "single"
+		       : MIPS_FPU_TYPE (gdbarch) == MIPS_FPU_DOUBLE ? "double"
 		       : "???"));
 }
 
diff --git a/gdb/mipsnbsd-nat.c b/gdb/mipsnbsd-nat.c
index 9995adf..2d74a69 100644
--- a/gdb/mipsnbsd-nat.c
+++ b/gdb/mipsnbsd-nat.c
@@ -33,16 +33,17 @@
 
 /* Determine if PT_GETREGS fetches this register.  */
 static int
-getregs_supplies (int regno)
+getregs_supplies (struct gdbarch *gdbarch, int regno)
 {
   return ((regno) >= MIPS_ZERO_REGNUM
-	  && (regno) <= gdbarch_pc_regnum (current_gdbarch));
+	  && (regno) <= gdbarch_pc_regnum (gdbarch));
 }
 
 static void
 mipsnbsd_fetch_inferior_registers (struct regcache *regcache, int regno)
 {
-  if (regno == -1 || getregs_supplies (regno))
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  if (regno == -1 || getregs_supplies (gdbarch, regno))
     {
       struct reg regs;
 
@@ -70,7 +71,8 @@
 static void
 mipsnbsd_store_inferior_registers (struct regcache *regcache, int regno)
 {
-  if (regno == -1 || getregs_supplies (regno))
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  if (regno == -1 || getregs_supplies (gdbarch, regno))
     {
       struct reg regs;
 
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
index c572409..7d75ccb 100644
--- a/gdb/mipsnbsd-tdep.c
+++ b/gdb/mipsnbsd-tdep.c
@@ -286,25 +286,26 @@
    success.  */
 
 #define NBSD_MIPS_JB_PC			(2 * 4)
-#define NBSD_MIPS_JB_ELEMENT_SIZE	mips_isa_regsize (current_gdbarch)
-#define NBSD_MIPS_JB_OFFSET		(NBSD_MIPS_JB_PC * \
-					 NBSD_MIPS_JB_ELEMENT_SIZE)
+#define NBSD_MIPS_JB_ELEMENT_SIZE(gdbarch)	mips_isa_regsize (gdbarch)
+#define NBSD_MIPS_JB_OFFSET(gdbarch)		(NBSD_MIPS_JB_PC * \
+					 NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))
 
 static int
 mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
 {
+  struct gdbarch *gdbarch = get_frame_arch (frame);
   CORE_ADDR jb_addr;
   char *buf;
 
-  buf = alloca (NBSD_MIPS_JB_ELEMENT_SIZE);
+  buf = alloca (NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch));
 
   jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
 
-  if (target_read_memory (jb_addr + NBSD_MIPS_JB_OFFSET, buf,
-  			  NBSD_MIPS_JB_ELEMENT_SIZE))
+  if (target_read_memory (jb_addr + NBSD_MIPS_JB_OFFSET (gdbarch), buf,
+  			  NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch)))
     return 0;
 
-  *pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE);
+  *pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch));
 
   return 1;
 }
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index db35b5c..88cb150 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -324,11 +324,11 @@
 
   if (frame_in_fp)
     {
-      base = frame_unwind_register_unsigned (fi, E_A3_REGNUM);
+      base = get_frame_register_unsigned (fi, E_A3_REGNUM);
     }
   else
     {
-      base = frame_unwind_register_unsigned (fi, E_SP_REGNUM)
+      base = get_frame_register_unsigned (fi, E_SP_REGNUM)
 	       + stack_extra_size;
     }
 
@@ -844,7 +844,7 @@
 /* Simple frame_unwind_cache.  
    This finds the "extra info" for the frame.  */
 struct trad_frame_cache *
-mn10300_frame_unwind_cache (struct frame_info *next_frame,
+mn10300_frame_unwind_cache (struct frame_info *this_frame,
 			    void **this_prologue_cache)
 {
   struct gdbarch *gdbarch;
@@ -855,10 +855,10 @@
   if (*this_prologue_cache)
     return (*this_prologue_cache);
 
-  gdbarch = get_frame_arch (next_frame);
-  cache_p = trad_frame_cache_zalloc (next_frame);
-  pc = gdbarch_unwind_pc (gdbarch, next_frame);
-  mn10300_analyze_prologue (gdbarch, next_frame, &cache_p, pc);
+  gdbarch = get_frame_arch (this_frame);
+  cache_p = trad_frame_cache_zalloc (this_frame);
+  pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM);
+  mn10300_analyze_prologue (gdbarch, this_frame, &cache_p, pc);
   cache = cache_p;
 
   if (find_pc_partial_function (pc, NULL, &start, &end))
@@ -867,7 +867,7 @@
 				       start));
   else
     {
-      start = frame_func_unwind (next_frame, NORMAL_FRAME);
+      start = get_frame_func (this_frame);
       trad_frame_set_id (cache,
 			 frame_id_build (trad_frame_get_this_base (cache),
 					 start));
@@ -879,65 +879,53 @@
 
 /* Here is a dummy implementation.  */
 static struct frame_id
-mn10300_unwind_dummy_id (struct gdbarch *gdbarch,
-			 struct frame_info *next_frame)
+mn10300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (frame_sp_unwind (next_frame), 
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
+  CORE_ADDR pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM);
+  return frame_id_build (sp, pc);
 }
 
 /* Trad frame implementation.  */
 static void
-mn10300_frame_this_id (struct frame_info *next_frame,
+mn10300_frame_this_id (struct frame_info *this_frame,
 		       void **this_prologue_cache,
 		       struct frame_id *this_id)
 {
   struct trad_frame_cache *cache = 
-    mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
+    mn10300_frame_unwind_cache (this_frame, this_prologue_cache);
 
   trad_frame_get_id (cache, this_id);
 }
 
-static void
-mn10300_frame_prev_register (struct frame_info *next_frame,
-			     void **this_prologue_cache,
-			     int regnum, int *optimizedp,
-			     enum lval_type *lvalp, CORE_ADDR *addrp,
-			     int *realnump, gdb_byte *bufferp)
+static struct value *
+mn10300_frame_prev_register (struct frame_info *this_frame,
+			     void **this_prologue_cache, int regnum)
 {
   struct trad_frame_cache *cache =
-    mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
+    mn10300_frame_unwind_cache (this_frame, this_prologue_cache);
 
-  trad_frame_get_register (cache, next_frame, regnum, optimizedp, 
-			   lvalp, addrp, realnump, bufferp);
-  /* Or...
-  trad_frame_get_prev_register (next_frame, cache->prev_regs, regnum, 
-			   optimizedp, lvalp, addrp, realnump, bufferp);
-  */
+  return trad_frame_get_register (cache, this_frame, regnum);
 }
 
 static const struct frame_unwind mn10300_frame_unwind = {
   NORMAL_FRAME,
   mn10300_frame_this_id, 
-  mn10300_frame_prev_register
+  mn10300_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
 static CORE_ADDR
-mn10300_frame_base_address (struct frame_info *next_frame,
+mn10300_frame_base_address (struct frame_info *this_frame,
 			    void **this_prologue_cache)
 {
   struct trad_frame_cache *cache = 
-    mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
+    mn10300_frame_unwind_cache (this_frame, this_prologue_cache);
 
   return trad_frame_get_this_base (cache);
 }
 
-static const struct frame_unwind *
-mn10300_frame_sniffer (struct frame_info *next_frame)
-{
-  return &mn10300_frame_unwind;
-}
-
 static const struct frame_base mn10300_frame_base = {
   &mn10300_frame_unwind, 
   mn10300_frame_base_address, 
@@ -966,10 +954,10 @@
 static void
 mn10300_frame_unwind_init (struct gdbarch *gdbarch)
 {
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, mn10300_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
   frame_base_set_default (gdbarch, &mn10300_frame_base);
-  set_gdbarch_unwind_dummy_id (gdbarch, mn10300_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
   set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 41308de..69632f6 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -54,13 +54,14 @@
 #include "gdb_regex.h"
 #include "srec.h"
 #include "regcache.h"
+#include "gdbthread.h"
 
 static char *dev_name;
 static struct target_ops *targ_ops;
 
 static void monitor_interrupt_query (void);
 static void monitor_interrupt_twice (int);
-static void monitor_stop (void);
+static void monitor_stop (ptid_t);
 static void monitor_dump_regs (struct regcache *regcache);
 
 #if 0
@@ -105,6 +106,13 @@
 static int first_time = 0;	/* is this the first time we're executing after 
 				   gaving created the child proccess? */
 
+
+/* This is the ptid we use while we're connected to a monitor.  Its
+   value is arbitrary, as monitor targets don't have a notion of
+   processes or threads, but we need something non-null to place in
+   inferior_ptid.  */
+static ptid_t monitor_ptid;
+
 #define TARGET_BUF_SIZE 2048
 
 /* Monitor specific debugging information.  Typically only useful to
@@ -758,7 +766,7 @@
 
   if (current_monitor->stop)
     {
-      monitor_stop ();
+      monitor_stop (inferior_ptid);
       if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0)
 	{
 	  monitor_debug ("EXP Open echo\n");
@@ -804,7 +812,12 @@
 
   push_target (targ_ops);
 
-  inferior_ptid = pid_to_ptid (42000);	/* Make run command think we are busy... */
+  /* Start afresh.  */
+  init_thread_list ();
+
+  /* Make run command think we are busy...  */
+  inferior_ptid = monitor_ptid;
+  add_thread_silent (inferior_ptid);
 
   /* Give monitor_wait something to read */
 
@@ -830,6 +843,8 @@
     }
 
   monitor_desc = NULL;
+
+  delete_thread_silent (monitor_ptid);
 }
 
 /* Terminate the open connection to the remote debugger.  Use this
@@ -968,7 +983,7 @@
   if (monitor_debug_p || remote_debug)
     fprintf_unfiltered (gdb_stdlog, "monitor_interrupt called\n");
 
-  target_stop ();
+  target_stop (inferior_ptid);
 }
 
 /* The user typed ^C twice.  */
@@ -1999,6 +2014,7 @@
 {
   unpush_target (targ_ops);
   generic_mourn_inferior ();	/* Do all the proper things now */
+  delete_thread_silent (monitor_ptid);
 }
 
 /* Tell the monitor to add a breakpoint.  */
@@ -2152,7 +2168,7 @@
 }
 
 static void
-monitor_stop (void)
+monitor_stop (ptid_t ptid)
 {
   monitor_debug ("MON stop\n");
   if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
@@ -2211,6 +2227,35 @@
   return dev_name;
 }
 
+/* Check to see if a thread is still alive.  */
+
+static int
+monitor_thread_alive (ptid_t ptid)
+{
+  if (ptid_equal (ptid, monitor_ptid))
+    /* The monitor's task is always alive.  */
+    return 1;
+
+  return 0;
+}
+
+/* Convert a thread ID to a string.  Returns the string in a static
+   buffer.  */
+
+static char *
+monitor_pid_to_str (ptid_t ptid)
+{
+  static char buf[64];
+
+  if (ptid_equal (monitor_ptid, ptid))
+    {
+      xsnprintf (buf, sizeof buf, "Thread <main>");
+      return buf;
+    }
+
+  return normal_pid_to_str (ptid);
+}
+
 static struct target_ops monitor_ops;
 
 static void
@@ -2234,6 +2279,8 @@
   monitor_ops.to_stop = monitor_stop;
   monitor_ops.to_rcmd = monitor_rcmd;
   monitor_ops.to_log_command = serial_log_command;
+  monitor_ops.to_thread_alive = monitor_thread_alive;
+  monitor_ops.to_pid_to_str = monitor_pid_to_str;
   monitor_ops.to_stratum = process_stratum;
   monitor_ops.to_has_all_memory = 1;
   monitor_ops.to_has_memory = 1;
@@ -2278,4 +2325,8 @@
 			    NULL,
 			    NULL, /* FIXME: i18n: */
 			    &setdebuglist, &showdebuglist);
+
+  /* Yes, 42000 is arbitrary.  The only sense out of it, is that it
+     isn't 0.  */
+  monitor_ptid = ptid_build (42000, 0, 42000);
 }
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index 47246fb..da6e99c 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -872,7 +872,7 @@
    the frame.  */
 
 static struct mt_unwind_cache *
-mt_frame_unwind_cache (struct frame_info *next_frame,
+mt_frame_unwind_cache (struct frame_info *this_frame,
 			void **this_prologue_cache)
 {
   struct gdbarch *gdbarch;
@@ -885,7 +885,7 @@
   if ((*this_prologue_cache))
     return (*this_prologue_cache);
 
-  gdbarch = get_frame_arch (next_frame);
+  gdbarch = get_frame_arch (this_frame);
   info = FRAME_OBSTACK_ZALLOC (struct mt_unwind_cache);
   (*this_prologue_cache) = info;
 
@@ -893,26 +893,26 @@
   info->framesize = 0;
   info->frame_base = 0;
   info->frameless_p = 1;
-  info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Grab the frame-relative values of SP and FP, needed below. 
      The frame_saved_register function will find them on the
      stack or in the registers as appropriate.  */
-  sp = frame_unwind_register_unsigned (next_frame, MT_SP_REGNUM);
-  fp = frame_unwind_register_unsigned (next_frame, MT_FP_REGNUM);
+  sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM);
+  fp = get_frame_register_unsigned (this_frame, MT_FP_REGNUM);
 
-  start_addr = frame_func_unwind (next_frame, NORMAL_FRAME);
+  start_addr = get_frame_func (this_frame);
 
   /* Return early if GDB couldn't find the function.  */
   if (start_addr == 0)
     return info;
 
-  end_addr = frame_pc_unwind (next_frame);
+  end_addr = get_frame_pc (this_frame);
   prologue_end_addr = skip_prologue_using_sal (start_addr);
   if (end_addr == 0)
   for (next_addr = start_addr; next_addr < end_addr; next_addr += 4)
     {
-      instr = get_frame_memory_unsigned (next_frame, next_addr, 4);
+      instr = get_frame_memory_unsigned (this_frame, next_addr, 4);
       if (delayed_store)	/* previous instr was a push */
 	{
 	  upper_half = delayed_store >> 16;
@@ -1028,55 +1028,49 @@
   return sp;
 }
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
+   frame.  The frame ID's base needs to match the TOS value saved by
+   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
 
 static struct frame_id
-mt_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+mt_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (mt_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
 static void
-mt_frame_this_id (struct frame_info *next_frame,
+mt_frame_this_id (struct frame_info *this_frame,
 		   void **this_prologue_cache, struct frame_id *this_id)
 {
   struct mt_unwind_cache *info =
-    mt_frame_unwind_cache (next_frame, this_prologue_cache);
+    mt_frame_unwind_cache (this_frame, this_prologue_cache);
 
   if (!(info == NULL || info->prev_sp == 0))
-    (*this_id) = frame_id_build (info->prev_sp,
-				 frame_func_unwind (next_frame, NORMAL_FRAME));
+    (*this_id) = frame_id_build (info->prev_sp, get_frame_func (this_frame));
 
   return;
 }
 
-static void
-mt_frame_prev_register (struct frame_info *next_frame,
-			 void **this_prologue_cache,
-			 int regnum, int *optimizedp,
-			 enum lval_type *lvalp, CORE_ADDR *addrp,
-			 int *realnump, gdb_byte *bufferp)
+static struct value *
+mt_frame_prev_register (struct frame_info *this_frame,
+			 void **this_prologue_cache, int regnum)
 {
   struct mt_unwind_cache *info =
-    mt_frame_unwind_cache (next_frame, this_prologue_cache);
+    mt_frame_unwind_cache (this_frame, this_prologue_cache);
 
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, bufferp);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
 static CORE_ADDR
-mt_frame_base_address (struct frame_info *next_frame,
+mt_frame_base_address (struct frame_info *this_frame,
 			void **this_prologue_cache)
 {
   struct mt_unwind_cache *info =
-    mt_frame_unwind_cache (next_frame, this_prologue_cache);
+    mt_frame_unwind_cache (this_frame, this_prologue_cache);
 
   return info->frame_base;
 }
@@ -1090,18 +1084,11 @@
 static const struct frame_unwind mt_frame_unwind = {
   NORMAL_FRAME,
   mt_frame_this_id,
-  mt_frame_prev_register
+  mt_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-/* The sniffer is a registered function that identifies our family of
-   frame unwind functions (this_id and prev_register).  */
-
-static const struct frame_unwind *
-mt_frame_sniffer (struct frame_info *next_frame)
-{
-  return &mt_frame_unwind;
-}
-
 /* Another shared interface:  the 'frame_base' object specifies how to
    unwind a frame and secure the base addresses for frame objects
    (locals, args).  */
@@ -1168,8 +1155,8 @@
 
   /* Register the DWARF 2 sniffer first, and then the traditional prologue
      based sniffer.  */
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, mt_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &mt_frame_unwind);
   frame_base_set_default (gdbarch, &mt_frame_base);
 
   /* Register the 'unwind_pc' method.  */
@@ -1179,7 +1166,7 @@
   /* Methods for saving / extracting a dummy frame's ID.  
      The ID's stack address must match the SP value returned by
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_unwind_dummy_id (gdbarch, mt_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, mt_dummy_id);
 
   return gdbarch;
 }
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 0cbff72..e37e158 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -607,7 +607,7 @@
   /* If this doesn't work, try more severe steps.  */
   signal (signo, nto_interrupt_twice);
 
-  target_stop ();
+  target_stop (inferior_ptid);
 }
 
 static ptid_t
@@ -1094,7 +1094,7 @@
 }
 
 static void
-procfs_stop (void)
+procfs_stop (ptid_t ptid)
 {
   devctl (ctl_fd, DCMD_PROC_STOP, NULL, 0, 0);
 }
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 3cb3ea3..add2d3c 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -177,13 +177,16 @@
 	    }
 	  else if (len == 8
 		   && (TYPE_CODE (type) == TYPE_CODE_INT	/* long long */
-		       || TYPE_CODE (type) == TYPE_CODE_FLT))	/* double */
+		       || TYPE_CODE (type) == TYPE_CODE_FLT	/* double */
+		       || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+			   && tdep->soft_float)))
 	    {
-	      /* "long long" or soft-float "double" passed in an odd/even
-	         register pair with the low addressed word in the odd
-	         register and the high addressed word in the even
-	         register, or when the registers run out an 8 byte
-	         aligned stack location.  */
+	      /* "long long" or soft-float "double" or "_Decimal64"
+	         passed in an odd/even register pair with the low
+	         addressed word in the odd register and the high
+	         addressed word in the even register, or when the
+	         registers run out an 8 byte aligned stack
+	         location.  */
 	      if (greg > 9)
 		{
 		  /* Just in case GREG was 10.  */
@@ -210,13 +213,16 @@
 		  greg += 2;
 		}
 	    }
-	  else if (len == 16 && TYPE_CODE (type) == TYPE_CODE_FLT
-		   && (gdbarch_long_double_format (gdbarch)
-		       == floatformats_ibm_long_double))
+	  else if (len == 16
+		   && ((TYPE_CODE (type) == TYPE_CODE_FLT
+			&& (gdbarch_long_double_format (gdbarch)
+			    == floatformats_ibm_long_double))
+		       || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+			   && tdep->soft_float)))
 	    {
-	      /* Soft-float IBM long double passed in four consecutive
-		 registers, or on the stack.  The registers are not
-		 necessarily odd/even pairs.  */
+	      /* Soft-float IBM long double or _Decimal128 passed in
+		 four consecutive registers, or on the stack.  The
+		 registers are not necessarily odd/even pairs.  */
 	      if (greg > 7)
 		{
 		  greg = 11;
@@ -596,11 +602,13 @@
 	}
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
-  if (TYPE_CODE (type) == TYPE_CODE_FLT
-      && TYPE_LENGTH (type) == 16
-      && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
+  if (TYPE_LENGTH (type) == 16
+      && ((TYPE_CODE (type) == TYPE_CODE_FLT
+	   && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
+	  || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && tdep->soft_float)))
     {
-      /* Soft-float IBM long double stored in r3, r4, r5, r6.  */
+      /* Soft-float IBM long double or _Decimal128 stored in r3, r4,
+	 r5, r6.  */
       if (readbuf)
 	{
 	  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf);
@@ -624,11 +632,14 @@
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
   if ((TYPE_CODE (type) == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
-      || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8))
+      || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
+      || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8
+	  && tdep->soft_float))
     {
       if (readbuf)
 	{
-	  /* A long long, or a double stored in the 32 bit r3/r4.  */
+	  /* A long long, double or _Decimal64 stored in the 32 bit
+	     r3/r4.  */
 	  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
 				readbuf + 0);
 	  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
@@ -636,7 +647,8 @@
 	}
       if (writebuf)
 	{
-	  /* A long long, or a double stored in the 32 bit r3/r4.  */
+	  /* A long long, double or _Decimal64 stored in the 32 bit
+	     r3/r4.  */
 	  regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
 				 writebuf + 0);
 	  regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index c135551..89851d7 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -26,7 +26,6 @@
 #include "regcache.h"
 
 #include "gdb_proc_service.h"
-#include "gdb_stdint.h"
 
 #include <sys/procfs.h>
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index da9fd4c..3551dd9 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -116,7 +116,7 @@
 static void procfs_detach (char *, int);
 static void procfs_resume (ptid_t, int, enum target_signal);
 static int procfs_can_run (void);
-static void procfs_stop (void);
+static void procfs_stop (ptid_t);
 static void procfs_files_info (struct target_ops *);
 static void procfs_fetch_registers (struct regcache *, int);
 static void procfs_store_registers (struct regcache *, int);
@@ -4756,7 +4756,7 @@
  */
 
 static void
-procfs_stop (void)
+procfs_stop (ptid_t ptid)
 {
   kill (-inferior_process_group, SIGINT);
 }
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 5a8e0c7..c048c5b 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1391,7 +1391,7 @@
 }
 
 static void
-m32r_stop (void)
+m32r_stop (ptid_t ptid)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_stop()\n");
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 3cbf8a0..df17051 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -92,7 +92,7 @@
 static ptid_t mips_wait (ptid_t ptid,
                                struct target_waitstatus *status);
 
-static int mips_map_regno (int regno);
+static int mips_map_regno (struct gdbarch *, int);
 
 static void mips_fetch_registers (struct regcache *regcache, int regno);
 
@@ -1875,24 +1875,24 @@
 #define REGNO_OFFSET 96
 
 static int
-mips_map_regno (int regno)
+mips_map_regno (struct gdbarch *gdbarch, int regno)
 {
   if (regno < 32)
     return regno;
-  if (regno >= mips_regnum (current_gdbarch)->fp0
-      && regno < mips_regnum (current_gdbarch)->fp0 + 32)
-    return regno - mips_regnum (current_gdbarch)->fp0 + 32;
-  else if (regno == mips_regnum (current_gdbarch)->pc)
+  if (regno >= mips_regnum (gdbarch)->fp0
+      && regno < mips_regnum (gdbarch)->fp0 + 32)
+    return regno - mips_regnum (gdbarch)->fp0 + 32;
+  else if (regno == mips_regnum (gdbarch)->pc)
     return REGNO_OFFSET + 0;
-  else if (regno == mips_regnum (current_gdbarch)->cause)
+  else if (regno == mips_regnum (gdbarch)->cause)
     return REGNO_OFFSET + 1;
-  else if (regno == mips_regnum (current_gdbarch)->hi)
+  else if (regno == mips_regnum (gdbarch)->hi)
     return REGNO_OFFSET + 2;
-  else if (regno == mips_regnum (current_gdbarch)->lo)
+  else if (regno == mips_regnum (gdbarch)->lo)
     return REGNO_OFFSET + 3;
-  else if (regno == mips_regnum (current_gdbarch)->fp_control_status)
+  else if (regno == mips_regnum (gdbarch)->fp_control_status)
     return REGNO_OFFSET + 4;
-  else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision)
+  else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
     return REGNO_OFFSET + 5;
   else
     /* FIXME: Is there a way to get the status register?  */
@@ -1924,7 +1924,7 @@
     {
       /* If PMON doesn't support this register, don't waste serial
          bandwidth trying to read it.  */
-      int pmon_reg = mips_map_regno (regno);
+      int pmon_reg = mips_map_regno (gdbarch, regno);
       if (regno != 0 && pmon_reg == 0)
 	val = 0;
       else
@@ -1979,7 +1979,7 @@
     }
 
   regcache_cooked_read_unsigned (regcache, regno, &val);
-  mips_request ('R', mips_map_regno (regno), val,
+  mips_request ('R', mips_map_regno (gdbarch, regno), val,
 		&err, mips_receive_wait, NULL);
   if (err)
     mips_error ("Can't write register %d: %s", regno, safe_strerror (errno));
@@ -3281,8 +3281,10 @@
       /* Work around problem where PMON monitor updates the PC after a load
          to a different value than GDB thinks it has. The following ensures
          that the write_pc() WILL update the PC value: */
-      regcache_set_valid_p (get_current_regcache (),
-			    gdbarch_pc_regnum (current_gdbarch), 0);
+      struct regcache *regcache = get_current_regcache ();
+      regcache_set_valid_p (regcache,
+			    gdbarch_pc_regnum (get_regcache_arch (regcache)),
+					       0);
     }
   if (exec_bfd)
     write_pc (bfd_get_start_address (exec_bfd));
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 918eab8..9d014e1 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -41,6 +41,7 @@
 #include "sim-regno.h"
 #include "arch-utils.h"
 #include "readline/readline.h"
+#include "gdbthread.h"
 
 /* Prototypes */
 
@@ -95,7 +96,7 @@
 
 static void gdbsim_mourn_inferior (void);
 
-static void gdbsim_stop (void);
+static void gdbsim_stop (ptid_t ptid);
 
 void simulator_command (char *args, int from_tty);
 
@@ -115,6 +116,12 @@
    back to the other sim_foo routines.  */
 static SIM_DESC gdbsim_desc = 0;
 
+/* This is the ptid we use while we're connected to the simulator.
+   Its value is arbitrary, as the simulator target don't have a notion
+   or processes or threads, but we need something non-null to place in
+   inferior_ptid.  */
+static ptid_t remote_sim_ptid;
+
 static void
 dump_mem (char *buf, int len)
 {
@@ -452,7 +459,8 @@
 		     (exec_file ? exec_file : "(NULL)"),
 		     args);
 
-  gdbsim_kill ();
+  if (ptid_equal (inferior_ptid, remote_sim_ptid))
+    gdbsim_kill ();
   remove_breakpoints ();
   init_wait_for_inferior ();
 
@@ -471,7 +479,9 @@
     argv = NULL;
   sim_create_inferior (gdbsim_desc, exec_bfd, argv, env);
 
-  inferior_ptid = pid_to_ptid (42);
+  inferior_ptid = remote_sim_ptid;
+  add_thread_silent (inferior_ptid);
+
   target_mark_running (&gdbsim_ops);
   insert_breakpoints ();	/* Needed to get correct instruction in cache */
 
@@ -580,6 +590,7 @@
 
   end_callbacks ();
   generic_mourn_inferior ();
+  delete_thread_silent (remote_sim_ptid);
 }
 
 /* Takes a program previously attached to and detaches it.
@@ -612,7 +623,7 @@
 static void
 gdbsim_resume (ptid_t ptid, int step, enum target_signal siggnal)
 {
-  if (PIDGET (inferior_ptid) != 42)
+  if (!ptid_equal (inferior_ptid, remote_sim_ptid))
     error (_("The program is not being run."));
 
   if (remote_debug)
@@ -632,7 +643,7 @@
    For simulators that do not support this operation, just abort */
 
 static void
-gdbsim_stop (void)
+gdbsim_stop (ptid_t ptid)
 {
   if (!sim_stop (gdbsim_desc))
     {
@@ -668,7 +679,7 @@
 static void
 gdbsim_cntrl_c (int signo)
 {
-  gdbsim_stop ();
+  gdbsim_stop (remote_sim_ptid);
 }
 
 static ptid_t
@@ -818,6 +829,7 @@
   remove_breakpoints ();
   target_mark_exited (&gdbsim_ops);
   generic_mourn_inferior ();
+  delete_thread_silent (remote_sim_ptid);
 }
 
 /* Pass the command argument through to the simulator verbatim.  The
@@ -849,6 +861,35 @@
   registers_changed ();
 }
 
+/* Check to see if a thread is still alive.  */
+
+static int
+gdbsim_thread_alive (ptid_t ptid)
+{
+  if (ptid_equal (ptid, remote_sim_ptid))
+    /* The simulators' task is always alive.  */
+    return 1;
+
+  return 0;
+}
+
+/* Convert a thread ID to a string.  Returns the string in a static
+   buffer.  */
+
+static char *
+gdbsim_pid_to_str (ptid_t ptid)
+{
+  static char buf[64];
+
+  if (ptid_equal (remote_sim_ptid, ptid))
+    {
+      xsnprintf (buf, sizeof buf, "Thread <main>");
+      return buf;
+    }
+
+  return normal_pid_to_str (ptid);
+}
+
 /* Define the target subroutine names */
 
 struct target_ops gdbsim_ops;
@@ -876,6 +917,8 @@
   gdbsim_ops.to_create_inferior = gdbsim_create_inferior;
   gdbsim_ops.to_mourn_inferior = gdbsim_mourn_inferior;
   gdbsim_ops.to_stop = gdbsim_stop;
+  gdbsim_ops.to_thread_alive = gdbsim_thread_alive;
+  gdbsim_ops.to_pid_to_str = gdbsim_pid_to_str;
   gdbsim_ops.to_stratum = process_stratum;
   gdbsim_ops.to_has_all_memory = 1;
   gdbsim_ops.to_has_memory = 1;
@@ -883,10 +926,6 @@
   gdbsim_ops.to_has_registers = 1;
   gdbsim_ops.to_has_execution = 1;
   gdbsim_ops.to_magic = OPS_MAGIC;
-
-#ifdef TARGET_REDEFINE_DEFAULT_OPS
-  TARGET_REDEFINE_DEFAULT_OPS (&gdbsim_ops);
-#endif
 }
 
 void
@@ -897,4 +936,8 @@
 
   add_com ("sim", class_obscure, simulator_command,
 	   _("Send a command to the simulator."));
+
+  /* Yes, 42000 is arbitrary.  The only sense out of it, is that it
+     isn't 0.  */
+  remote_sim_ptid = ptid_build (42000, 0, 42000);
 }
diff --git a/gdb/remote.c b/gdb/remote.c
index 3f7d07b..14e04da 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -138,7 +138,8 @@
 
 static void interrupt_query (void);
 
-static void set_thread (int, int);
+static void set_general_thread (struct ptid ptid);
+static void set_continue_thread (struct ptid ptid);
 
 static int remote_thread_alive (ptid_t);
 
@@ -154,7 +155,7 @@
 
 static void init_extended_remote_ops (void);
 
-static void remote_stop (void);
+static void remote_stop (ptid_t);
 
 static int ishex (int ch, int *val);
 
@@ -180,7 +181,7 @@
 
 static void remote_find_new_threads (void);
 
-static void record_currthread (int currthread);
+static void record_currthread (ptid_t currthread);
 
 static int fromhex (int a);
 
@@ -1063,11 +1064,16 @@
 
 
 
+static ptid_t magic_null_ptid;
+static ptid_t not_sent_ptid;
+static ptid_t any_thread_ptid;
 
-/* These are the threads which we last sent to the remote system.
-   -1 for all or -2 for not sent yet.  */
-static int general_thread;
-static int continue_thread;
+/* These are the threads which we last sent to the remote system.  The
+   TID member will be -1 for all or -2 for not sent yet.  */
+
+static ptid_t general_thread;
+static ptid_t continue_thread;
+
 
 /* Call this function as a result of
    1) A halt indication (T packet) containing a thread id
@@ -1076,14 +1082,38 @@
  */
 
 static void
-record_currthread (int currthread)
+record_currthread (ptid_t currthread)
 {
   general_thread = currthread;
 
   /* If this is a new thread, add it to GDB's thread list.
      If we leave it up to WFI to do this, bad things will happen.  */
-  if (!in_thread_list (pid_to_ptid (currthread)))
-    add_thread (pid_to_ptid (currthread));
+  if (!in_thread_list (currthread))
+    {
+      if (ptid_equal (pid_to_ptid (ptid_get_pid (currthread)), inferior_ptid))
+	{
+	  /* inferior_ptid has no thread member yet.  This can happen
+	     with the vAttach -> remote_wait,"TAAthread:" path if the
+	     stub doesn't support qC.  This is the first stop reported
+	     after an attach, so this is the main thread.  Update the
+	     ptid in the thread list.  */
+	  struct thread_info *th = find_thread_pid (inferior_ptid);
+	  inferior_ptid = th->ptid = currthread;
+	}
+      else if (ptid_equal (magic_null_ptid, inferior_ptid))
+	{
+	  /* inferior_ptid is not set yet.  This can happen with the
+	     vRun -> remote_wait,"TAAthread:" path if the stub
+	     doesn't support qC.  This is the first stop reported
+	     after an attach, so this is the main thread.  Update the
+	     ptid in the thread list.  */
+	  struct thread_info *th = find_thread_pid (inferior_ptid);
+	  inferior_ptid = th->ptid = currthread;
+	}
+      else
+	/* This is really a new thread.  Add it.  */
+	add_thread (currthread);
+    }
 }
 
 static char *last_pass_packet;
@@ -1145,44 +1175,76 @@
     }
 }
 
-#define MAGIC_NULL_PID 42000
-
+/* If PTID is MAGIC_NULL_PTID, don't set any thread.  If PTID is
+   MINUS_ONE_PTID, set the thread to -1, so the stub returns the
+   thread.  If GEN is set, set the general thread, if not, then set
+   the step/continue thread.  */
 static void
-set_thread (int th, int gen)
+set_thread (struct ptid ptid, int gen)
 {
   struct remote_state *rs = get_remote_state ();
+  ptid_t state = gen ? general_thread : continue_thread;
   char *buf = rs->buf;
-  int state = gen ? general_thread : continue_thread;
+  char *endbuf = rs->buf + get_remote_packet_size ();
 
-  if (state == th)
+  if (ptid_equal (state, ptid))
     return;
 
-  buf[0] = 'H';
-  buf[1] = gen ? 'g' : 'c';
-  if (th == MAGIC_NULL_PID)
-    {
-      buf[2] = '0';
-      buf[3] = '\0';
-    }
-  else if (th < 0)
-    xsnprintf (&buf[2], get_remote_packet_size () - 2, "-%x", -th);
+  *buf++ = 'H';
+  *buf++ = gen ? 'g' : 'c';
+  if (ptid_equal (ptid, magic_null_ptid))
+    xsnprintf (buf, endbuf - buf, "0");
+  else if (ptid_equal (ptid, any_thread_ptid))
+    xsnprintf (buf, endbuf - buf, "0");
+  else if (ptid_equal (ptid, minus_one_ptid))
+    xsnprintf (buf, endbuf - buf, "-1");
   else
-    xsnprintf (&buf[2], get_remote_packet_size () - 2, "%x", th);
-  putpkt (buf);
+    {
+      int tid = ptid_get_tid (ptid);
+      if (tid < 0)
+	xsnprintf (buf, endbuf - buf, "-%x", -tid);
+      else
+	xsnprintf (buf, endbuf - buf, "%x", tid);
+    }
+  putpkt (rs->buf);
   getpkt (&rs->buf, &rs->buf_size, 0);
   if (gen)
-    general_thread = th;
+    general_thread = ptid;
   else
-    continue_thread = th;
+    continue_thread = ptid;
 }
+
+static void
+set_general_thread (struct ptid ptid)
+{
+  set_thread (ptid, 1);
+}
+
+static void
+set_continue_thread (struct ptid ptid)
+{
+  set_thread (ptid, 0);
+}
+
 
-/*  Return nonzero if the thread TH is still alive on the remote system.  */
+/*  Return nonzero if the thread PTID is still alive on the remote
+    system.  */
 
 static int
 remote_thread_alive (ptid_t ptid)
 {
   struct remote_state *rs = get_remote_state ();
-  int tid = PIDGET (ptid);
+  int tid = ptid_get_tid (ptid);
+
+  if (ptid_equal (ptid, magic_null_ptid))
+    /* The main thread is always alive.  */
+    return 1;
+
+  if (ptid_get_pid (ptid) != 0 && ptid_get_tid (ptid) == 0)
+    /* The main thread is always alive.  This can happen after a
+       vAttach, if the remote side doesn't support
+       multi-threading.  */
+    return 1;
 
   if (tid < 0)
     xsnprintf (rs->buf, get_remote_packet_size (), "T-%08x", -tid);
@@ -1802,7 +1864,7 @@
 
 /* remote_find_new_threads retrieves the thread list and for each
    thread in the list, looks up the thread in GDB's internal list,
-   ading the thread if it does not already exist.  This involves
+   adding the thread if it does not already exist.  This involves
    getting partial thread lists from the remote target so, polling the
    quit_flag is required.  */
 
@@ -1853,9 +1915,8 @@
 static int
 remote_newthread_step (threadref *ref, void *context)
 {
-  ptid_t ptid;
-
-  ptid = pid_to_ptid (threadref_to_int (ref));
+  int pid = ptid_get_pid (inferior_ptid);
+  ptid_t ptid = ptid_build (pid, 0, threadref_to_int (ref));
 
   if (!in_thread_list (ptid))
     add_thread (ptid);
@@ -1868,16 +1929,23 @@
 remote_current_thread (ptid_t oldpid)
 {
   struct remote_state *rs = get_remote_state ();
+  char *p = rs->buf;
+  int tid;
+  int pid;
 
   putpkt ("qC");
   getpkt (&rs->buf, &rs->buf_size, 0);
   if (rs->buf[0] == 'Q' && rs->buf[1] == 'C')
-    /* Use strtoul here, so we'll correctly parse values whose highest
-       bit is set.  The protocol carries them as a simple series of
-       hex digits; in the absence of a sign, strtol will see such
-       values as positive numbers out of range for signed 'long', and
-       return LONG_MAX to indicate an overflow.  */
-    return pid_to_ptid (strtoul (&rs->buf[2], NULL, 16));
+    {
+      /* Use strtoul here, so we'll correctly parse values whose
+	 highest bit is set.  The protocol carries them as a simple
+	 series of hex digits; in the absence of a sign, strtol will
+	 see such values as positive numbers out of range for signed
+	 'long', and return LONG_MAX to indicate an overflow.  */
+      tid = strtoul (&rs->buf[2], NULL, 16);
+      pid = ptid_get_pid (oldpid);
+      return ptid_build (pid, 0, tid);
+    }
   else
     return oldpid;
 }
@@ -1891,8 +1959,6 @@
 {
   remote_threadlist_iterator (remote_newthread_step, 0,
 			      CRAZY_MAX_THREADS);
-  if (PIDGET (inferior_ptid) == MAGIC_NULL_PID)	/* ack ack ack */
-    inferior_ptid = remote_current_thread (inferior_ptid);
 }
 
 /*
@@ -1908,6 +1974,8 @@
   struct remote_state *rs = get_remote_state ();
   char *bufp;
   int tid;
+  int pid;
+  ptid_t new_thread;
 
   if (remote_desc == 0)		/* paranoia */
     error (_("Command can only be used when connected to the remote target."));
@@ -1930,8 +1998,10 @@
 		     positive numbers out of range for signed 'long',
 		     and return LONG_MAX to indicate an overflow.  */
 		  tid = strtoul (bufp, &bufp, 16);
-		  if (tid != 0 && !in_thread_list (pid_to_ptid (tid)))
-		    add_thread (pid_to_ptid (tid));
+		  pid = ptid_get_pid (inferior_ptid);
+		  new_thread = ptid_build (pid, 0, tid);
+		  if (tid != 0 && !in_thread_list (new_thread))
+		    add_thread (new_thread);
 		}
 	      while (*bufp++ == ',');	/* comma-separated list */
 	      putpkt ("qsThreadInfo");
@@ -1974,8 +2044,8 @@
 
   if (use_threadextra_query)
     {
-      xsnprintf (rs->buf, get_remote_packet_size (), "qThreadExtraInfo,%x",
-		 PIDGET (tp->ptid));
+      xsnprintf (rs->buf, get_remote_packet_size (), "qThreadExtraInfo,%lx",
+		 ptid_get_tid (tp->ptid));
       putpkt (rs->buf);
       getpkt (&rs->buf, &rs->buf_size, 0);
       if (rs->buf[0] != 0)
@@ -1991,7 +2061,7 @@
   use_threadextra_query = 0;
   set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME
     | TAG_MOREDISPLAY | TAG_DISPLAY;
-  int_to_threadref (&id, PIDGET (tp->ptid));
+  int_to_threadref (&id, ptid_get_tid (tp->ptid));
   if (remote_get_threadinfo (&id, set, &threadinfo))
     if (threadinfo.active)
       {
@@ -2250,8 +2320,11 @@
       strcpy (wait_status, rs->buf);
     }
 
+  /* Start afresh.  */
+  init_thread_list ();
+
   /* Let the stub know that we want it to return the thread.  */
-  set_thread (-1, 0);
+  set_continue_thread (minus_one_ptid);
 
   /* Without this, some commands which require an active target
      (such as kill) won't work.  This variable serves (at least)
@@ -2260,11 +2333,14 @@
      These functions should be split out into seperate variables,
      especially since GDB will someday have a notion of debugging
      several processes.  */
-  inferior_ptid = pid_to_ptid (MAGIC_NULL_PID);
+  inferior_ptid = magic_null_ptid;
 
   /* Now, if we have thread information, update inferior_ptid.  */
   inferior_ptid = remote_current_thread (inferior_ptid);
 
+  /* Always add the main thread.  */
+  add_thread_silent (inferior_ptid);
+
   get_offsets ();		/* Get text, data & bss offsets.  */
 
   /* Use the previously fetched status.  */
@@ -2690,8 +2766,8 @@
   init_all_packet_configs ();
   rs->explicit_packet_size = 0;
 
-  general_thread = -2;
-  continue_thread = -2;
+  general_thread = not_sent_ptid;
+  continue_thread = not_sent_ptid;
 
   /* Probe for ability to use "ThreadInfo" query, as required.  */
   use_threadinfo_query = 1;
@@ -2891,6 +2967,13 @@
 
   target_mark_running (target);
   inferior_ptid = pid_to_ptid (pid);
+
+  /* Now, if we have thread information, update inferior_ptid.  */
+  inferior_ptid = remote_current_thread (inferior_ptid);
+
+  /* Now, add the main thread to the thread list.  */
+  add_thread_silent (inferior_ptid);
+
   attach_flag = 1;
 
   /* Next, if the target can specify a description, read it.  We do
@@ -3020,10 +3103,10 @@
 
 /* Resume the remote inferior by using a "vCont" packet.  The thread
    to be resumed is PTID; STEP and SIGGNAL indicate whether the
-   resumed thread should be single-stepped and/or signalled.  If PTID's
-   PID is -1, then all threads are resumed; the thread to be stepped and/or
-   signalled is given in the global INFERIOR_PTID.  This function returns
-   non-zero iff it resumes the inferior.
+   resumed thread should be single-stepped and/or signalled.  If PTID
+   equals minus_one_ptid, then all threads are resumed; the thread to
+   be stepped and/or signalled is given in the global INFERIOR_PTID.
+   This function returns non-zero iff it resumes the inferior.
 
    This function issues a strict subset of all possible vCont commands at the
    moment.  */
@@ -3032,7 +3115,6 @@
 remote_vcont_resume (ptid_t ptid, int step, enum target_signal siggnal)
 {
   struct remote_state *rs = get_remote_state ();
-  int pid = PIDGET (ptid);
   char *outbuf;
   struct cleanup *old_cleanup;
 
@@ -3046,11 +3128,12 @@
      about overflowing BUF.  Should there be a generic
      "multi-part-packet" packet?  */
 
-  if (PIDGET (inferior_ptid) == MAGIC_NULL_PID)
+  if (ptid_equal (ptid, magic_null_ptid))
     {
-      /* MAGIC_NULL_PTID means that we don't have any active threads, so we
-	 don't have any PID numbers the inferior will understand.  Make sure
-	 to only send forms that do not specify a PID.  */
+      /* MAGIC_NULL_PTID means that we don't have any active threads,
+	 so we don't have any TID numbers the inferior will
+	 understand.  Make sure to only send forms that do not specify
+	 a TID.  */
       if (step && siggnal != TARGET_SIGNAL_0)
 	outbuf = xstrprintf ("vCont;S%02x", siggnal);
       else if (step)
@@ -3060,31 +3143,31 @@
       else
 	outbuf = xstrprintf ("vCont;c");
     }
-  else if (pid == -1)
+  else if (ptid_equal (ptid, minus_one_ptid))
     {
       /* Resume all threads, with preference for INFERIOR_PTID.  */
+      int tid = ptid_get_tid (inferior_ptid);
       if (step && siggnal != TARGET_SIGNAL_0)
-	outbuf = xstrprintf ("vCont;S%02x:%x;c", siggnal,
-			     PIDGET (inferior_ptid));
+	outbuf = xstrprintf ("vCont;S%02x:%x;c", siggnal, tid);
       else if (step)
-	outbuf = xstrprintf ("vCont;s:%x;c", PIDGET (inferior_ptid));
+	outbuf = xstrprintf ("vCont;s:%x;c", tid);
       else if (siggnal != TARGET_SIGNAL_0)
-	outbuf = xstrprintf ("vCont;C%02x:%x;c", siggnal,
-			     PIDGET (inferior_ptid));
+	outbuf = xstrprintf ("vCont;C%02x:%x;c", siggnal, tid);
       else
 	outbuf = xstrprintf ("vCont;c");
     }
   else
     {
       /* Scheduler locking; resume only PTID.  */
+      int tid = ptid_get_tid (ptid);
       if (step && siggnal != TARGET_SIGNAL_0)
-	outbuf = xstrprintf ("vCont;S%02x:%x", siggnal, pid);
+	outbuf = xstrprintf ("vCont;S%02x:%x", siggnal, tid);
       else if (step)
-	outbuf = xstrprintf ("vCont;s:%x", pid);
+	outbuf = xstrprintf ("vCont;s:%x", tid);
       else if (siggnal != TARGET_SIGNAL_0)
-	outbuf = xstrprintf ("vCont;C%02x:%x", siggnal, pid);
+	outbuf = xstrprintf ("vCont;C%02x:%x", siggnal, tid);
       else
-	outbuf = xstrprintf ("vCont;c:%x", pid);
+	outbuf = xstrprintf ("vCont;c:%x", tid);
     }
 
   gdb_assert (outbuf && strlen (outbuf) < get_remote_packet_size ());
@@ -3108,7 +3191,6 @@
 {
   struct remote_state *rs = get_remote_state ();
   char *buf;
-  int pid = PIDGET (ptid);
 
   last_sent_signal = siggnal;
   last_sent_step = step;
@@ -3120,11 +3202,12 @@
   if (remote_vcont_resume (ptid, step, siggnal))
     goto done;
 
-  /* All other supported resume packets do use Hc, so call set_thread.  */
-  if (pid == -1)
-    set_thread (0, 0);		/* Run any thread.  */
+  /* All other supported resume packets do use Hc, so set the continue
+     thread.  */
+  if (ptid_equal (ptid, minus_one_ptid))
+    set_continue_thread (any_thread_ptid);
   else
-    set_thread (pid, 0);	/* Run this thread.  */
+    set_continue_thread (ptid);
 
   buf = rs->buf;
   if (siggnal != TARGET_SIGNAL_0)
@@ -3149,13 +3232,6 @@
      NOT asynchronously.  */
   if (target_can_async_p ())
     target_async (inferior_event_handler, 0);
-  /* Tell the world that the target is now executing.  */
-  /* FIXME: cagney/1999-09-23: Is it the targets responsibility to set
-     this?  Instead, should the client of target just assume (for
-     async targets) that the target is going to start executing?  Is
-     this information already found in the continuation block?  */
-  if (target_is_async_p ())
-    target_executing = 1;
 }
 
 
@@ -3193,7 +3269,7 @@
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "remote_interrupt called\n");
 
-  target_stop ();
+  target_stop (inferior_ptid);
 }
 
 /* Perform interrupt, if the first attempt did not succeed. Just give
@@ -3247,7 +3323,7 @@
    interrupt is requested, either by the command line or the GUI, we
    will eventually end up here.  */
 static void
-remote_stop (void)
+remote_stop (ptid_t ptid)
 {
   /* Send a break or a ^C, depending on user preference.  */
   if (remote_debug)
@@ -3347,9 +3423,7 @@
 }
 
 /* Wait until the remote machine stops, then return,
-   storing status in STATUS just as `wait' would.
-   Returns "pid", which in the case of a multi-threaded
-   remote OS, is the thread-id.  */
+   storing status in STATUS just as `wait' would.  */
 
 static ptid_t
 remote_wait (ptid_t ptid, struct target_waitstatus *status)
@@ -3357,6 +3431,7 @@
   struct remote_state *rs = get_remote_state ();
   struct remote_arch_state *rsa = get_remote_arch_state ();
   ULONGEST thread_num = -1;
+  ULONGEST process_num = -1;
   ULONGEST addr;
   int solibs_changed = 0;
 
@@ -3453,7 +3528,6 @@
 		    if (strncmp (p, "thread", p1 - p) == 0)
 		      {
 			p_temp = unpack_varlen_hex (++p1, &thread_num);
-			record_currthread (thread_num);
 			p = p_temp;
 		      }
 		    else if ((strncmp (p, "watch", p1 - p) == 0)
@@ -3525,12 +3599,6 @@
 	      status->value.sig = (enum target_signal)
 		(((fromhex (buf[1])) << 4) + (fromhex (buf[2])));
 	    }
-
-	  if (buf[3] == 'p')
-	    {
-	      thread_num = strtol ((const char *) &buf[4], NULL, 16);
-	      record_currthread (thread_num);
-	    }
 	  goto got_status;
 	case 'W':		/* Target exited.  */
 	  {
@@ -3581,8 +3649,12 @@
 got_status:
   if (thread_num != -1)
     {
-      return pid_to_ptid (thread_num);
+      ptid_t ptid;
+      ptid = ptid_build (ptid_get_pid (inferior_ptid), 0, thread_num);
+      record_currthread (ptid);
+      return ptid;
     }
+
   return inferior_ptid;
 }
 
@@ -3785,7 +3857,7 @@
   struct remote_arch_state *rsa = get_remote_arch_state ();
   int i;
 
-  set_thread (PIDGET (inferior_ptid), 1);
+  set_general_thread (inferior_ptid);
 
   if (regnum >= 0)
     {
@@ -3934,7 +4006,7 @@
   struct remote_arch_state *rsa = get_remote_arch_state ();
   int i;
 
-  set_thread (PIDGET (inferior_ptid), 1);
+  set_general_thread (inferior_ptid);
 
   if (regnum >= 0)
     {
@@ -5113,7 +5185,8 @@
       /* Assume that the target has been restarted.  Set inferior_ptid
 	 so that bits of core GDB realizes there's something here, e.g.,
 	 so that the user can say "kill" again.  */
-      inferior_ptid = pid_to_ptid (MAGIC_NULL_PID);
+      inferior_ptid = remote_current_thread (magic_null_ptid);
+      add_thread_silent (inferior_ptid);
     }
   else
     {
@@ -5227,7 +5300,10 @@
 
   /* Now mark the inferior as running before we do anything else.  */
   attach_flag = 0;
-  inferior_ptid = pid_to_ptid (MAGIC_NULL_PID);
+  inferior_ptid = magic_null_ptid;
+
+  add_thread_silent (inferior_ptid);
+
   target_mark_running (&extended_remote_ops);
 
   /* Get updated offsets, if the stub uses qOffsets.  */
@@ -5256,12 +5332,13 @@
 
   if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE)
     {
-      CORE_ADDR addr;
+      CORE_ADDR addr = bp_tgt->placed_address;
       struct remote_state *rs;
       char *p;
+      int bpsize;
 
       gdbarch_breakpoint_from_pc
-	(current_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size);
+	(current_gdbarch, &addr, &bpsize);
 
       rs = get_remote_state ();
       p = rs->buf;
@@ -5269,9 +5346,9 @@
       *(p++) = 'Z';
       *(p++) = '0';
       *(p++) = ',';
-      addr = (ULONGEST) remote_address_masked (bp_tgt->placed_address);
+      addr = (ULONGEST) remote_address_masked (addr);
       p += hexnumstr (p, addr);
-      sprintf (p, ",%d", bp_tgt->placed_size);
+      sprintf (p, ",%d", bpsize);
 
       putpkt (rs->buf);
       getpkt (&rs->buf, &rs->buf_size, 0);
@@ -5281,6 +5358,8 @@
 	case PACKET_ERROR:
 	  return -1;
 	case PACKET_OK:
+	  bp_tgt->placed_address = addr;
+	  bp_tgt->placed_size = bpsize;
 	  return 0;
 	case PACKET_UNKNOWN:
 	  break;
@@ -6149,7 +6228,7 @@
   int sample_thread = SAMPLE_THREAD;
 
   printf_filtered (_("Remote threadset test\n"));
-  set_thread (sample_thread, 1);
+  set_general_thread (sample_thread);
 }
 
 
@@ -6157,8 +6236,10 @@
 threadalive_test (char *cmd, int tty)
 {
   int sample_thread = SAMPLE_THREAD;
+  int pid = ptid_get_pid (inferior_ptid);
+  ptid_t ptid = ptid_build (pid, 0, sample_thread);
 
-  if (remote_thread_alive (pid_to_ptid (sample_thread)))
+  if (remote_thread_alive (ptid))
     printf_filtered ("PASS: Thread alive test\n");
   else
     printf_filtered ("FAIL: Thread alive test\n");
@@ -6271,10 +6352,21 @@
 static char *
 remote_pid_to_str (ptid_t ptid)
 {
-  static char buf[32];
+  static char buf[64];
 
-  xsnprintf (buf, sizeof buf, "Thread %d", ptid_get_pid (ptid));
-  return buf;
+  if (ptid_equal (magic_null_ptid, ptid))
+    {
+      xsnprintf (buf, sizeof buf, "Thread <main>");
+      return buf;
+    }
+  else if (ptid_get_tid (ptid) != 0)
+    {
+      xsnprintf (buf, sizeof buf, "Thread %ld",
+		 ptid_get_tid (ptid));
+      return buf;
+    }
+
+  return normal_pid_to_str (ptid);
 }
 
 /* Get the address of the thread local variable in OBJFILE which is
@@ -6291,7 +6383,7 @@
 
       strcpy (p, "qGetTLSAddr:");
       p += strlen (p);
-      p += hexnumstr (p, PIDGET (ptid));
+      p += hexnumstr (p, ptid_get_tid (ptid));
       *p++ = ',';
       p += hexnumstr (p, offset);
       *p++ = ',';
@@ -7485,4 +7577,10 @@
 
   /* Eventually initialize fileio.  See fileio.c */
   initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);
+
+  /* Take advantage of the fact that the LWP field is not used, to tag
+     special ptids with it set to != 0.  */
+  magic_null_ptid = ptid_build (0, 1, -1);
+  not_sent_ptid = ptid_build (0, 1, -2);
+  any_thread_ptid = ptid_build (0, 1, 0);
 }
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 19872a0..27632d3 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -36,7 +36,6 @@
 #include "ppc-tdep.h"
 #include "rs6000-tdep.h"
 #include "exec.h"
-#include "gdb_stdint.h"
 #include "observer.h"
 
 #include <sys/ptrace.h>
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index b234101..08f926e 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -841,6 +841,105 @@
     return little_breakpoint;
 }
 
+/* Instruction masks for displaced stepping.  */
+#define BRANCH_MASK 0xfc000000
+#define BP_MASK 0xFC0007FE
+#define B_INSN 0x48000000
+#define BC_INSN 0x40000000
+#define BXL_INSN 0x4c000000
+#define BP_INSN 0x7C000008
+
+/* Fix up the state of registers and memory after having single-stepped
+   a displaced instruction.  */
+void
+ppc_displaced_step_fixup (struct gdbarch *gdbarch,
+			   struct displaced_step_closure *closure,
+			   CORE_ADDR from, CORE_ADDR to,
+			   struct regcache *regs)
+{
+  /* Since we use simple_displaced_step_copy_insn, our closure is a
+     copy of the instruction.  */
+  ULONGEST insn  = extract_unsigned_integer ((gdb_byte *) closure,
+					      PPC_INSN_SIZE);
+  ULONGEST opcode = 0;
+  /* Offset for non PC-relative instructions.  */
+  LONGEST offset = PPC_INSN_SIZE;
+
+  opcode = insn & BRANCH_MASK;
+
+  if (debug_displaced)
+    fprintf_unfiltered (gdb_stdlog,
+			"displaced: (ppc) fixup (0x%s, 0x%s)\n",
+			paddr_nz (from), paddr_nz (to));
+
+
+  /* Handle PC-relative branch instructions.  */
+  if (opcode == B_INSN || opcode == BC_INSN || opcode == BXL_INSN)
+    {
+      ULONGEST current_pc;
+
+      /* Read the current PC value after the instruction has been executed
+	 in a displaced location.  Calculate the offset to be applied to the
+	 original PC value before the displaced stepping.  */
+      regcache_cooked_read_unsigned (regs, gdbarch_pc_regnum (gdbarch),
+				      &current_pc);
+      offset = current_pc - to;
+
+      if (opcode != BXL_INSN)
+	{
+	  /* Check for AA bit indicating whether this is an absolute
+	     addressing or PC-relative (1: absolute, 0: relative).  */
+	  if (!(insn & 0x2))
+	    {
+	      /* PC-relative addressing is being used in the branch.  */
+	      if (debug_displaced)
+		fprintf_unfiltered
+		  (gdb_stdlog,
+		   "displaced: (ppc) branch instruction: 0x%s\n"
+		   "displaced: (ppc) adjusted PC from 0x%s to 0x%s\n",
+		   paddr_nz (insn), paddr_nz (current_pc),
+		   paddr_nz (from + offset));
+
+	      regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch),
+					      from + offset);
+	    }
+	}
+      else
+	{
+	  /* If we're here, it means we have a branch to LR or CTR.  If the
+	     branch was taken, the offset is probably greater than 4 (the next
+	     instruction), so it's safe to assume that an offset of 4 means we
+	     did not take the branch.  */
+	  if (offset == PPC_INSN_SIZE)
+	    regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch),
+					    from + PPC_INSN_SIZE);
+	}
+
+      /* Check for LK bit indicating whether we should set the link
+	 register to point to the next instruction
+	 (1: Set, 0: Don't set).  */
+      if (insn & 0x1)
+	{
+	  /* Link register needs to be set to the next instruction's PC.  */
+	  regcache_cooked_write_unsigned (regs,
+					  gdbarch_tdep (gdbarch)->ppc_lr_regnum,
+					  from + PPC_INSN_SIZE);
+	  if (debug_displaced)
+		fprintf_unfiltered (gdb_stdlog,
+				    "displaced: (ppc) adjusted LR to 0x%s\n",
+				    paddr_nz (from + PPC_INSN_SIZE));
+
+	}
+    }
+  /* Check for breakpoints in the inferior.  If we've found one, place the PC
+     right at the breakpoint instruction.  */
+  else if ((insn & BP_MASK) == BP_INSN)
+    regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), from);
+  else
+  /* Handle any other instructions that do not fit in the categories above.  */
+    regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch),
+				    from + offset);
+}
 
 /* Instruction masks used during single-stepping of atomic sequences.  */
 #define LWARX_MASK 0xfc0007fe
@@ -849,8 +948,6 @@
 #define STWCX_MASK 0xfc0007ff
 #define STWCX_INSTRUCTION 0x7c00012d
 #define STDCX_INSTRUCTION 0x7c0001ad
-#define BC_MASK 0xfc000000
-#define BC_INSTRUCTION 0x40000000
 
 /* Checks for an atomic sequence of instructions beginning with a LWARX/LDARX
    instruction and ending with a STWCX/STDCX instruction.  If such a sequence
@@ -887,7 +984,7 @@
       /* Assume that there is at most one conditional branch in the atomic
          sequence.  If a conditional branch is found, put a breakpoint in 
          its destination address.  */
-      if ((insn & BC_MASK) == BC_INSTRUCTION)
+      if ((insn & BRANCH_MASK) == BC_INSN)
         {
           int immediate = ((insn & ~3) << 16) >> 16;
           int absolute = ((insn >> 1) & 1);
@@ -2412,7 +2509,7 @@
   /* If the function appears to be frameless, check a couple of likely
      indicators that we have simply failed to find the frame setup.
      Two common cases of this are missing symbols (i.e.
-     frame_func_unwind returns the wrong address or 0), and assembly
+     get_frame_func returns the wrong address or 0), and assembly
      stubs which have a fast exit path but set up a frame on the slow
      path.
 
@@ -3214,6 +3311,17 @@
     /* Put the _Decimal128 pseudo-registers after the SPE registers.  */
     tdep->ppc_dl0_regnum += 32;
 
+  /* Setup displaced stepping.  */
+  set_gdbarch_displaced_step_copy_insn (gdbarch,
+					simple_displaced_step_copy_insn);
+  set_gdbarch_displaced_step_fixup (gdbarch, ppc_displaced_step_fixup);
+  set_gdbarch_displaced_step_free_closure (gdbarch,
+					   simple_displaced_step_free_closure);
+  set_gdbarch_displaced_step_location (gdbarch,
+				       displaced_step_at_entry_point);
+
+  set_gdbarch_max_insn_length (gdbarch, PPC_INSN_SIZE);
+
   return gdbarch;
 }
 
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 79be120..6f6ec9b 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -100,7 +100,7 @@
 
 static void
 score_analyze_pdr_section (CORE_ADDR startaddr, CORE_ADDR pc,
-                           struct frame_info *next_frame,
+                           struct frame_info *this_frame,
                            struct score_frame_cache *this_cache)
 {
   struct symbol *sym;
@@ -442,12 +442,11 @@
 }
 
 static struct frame_id
-score_unwind_dummy_id (struct gdbarch *gdbarch,
-                       struct frame_info *next_frame)
+score_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
   return frame_id_build (
-           frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM),
-           frame_pc_unwind (next_frame));
+           get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM),
+           get_frame_pc (this_frame));
 }
 
 static int
@@ -754,10 +753,10 @@
 
 static void
 score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
-                        struct frame_info *next_frame,
+                        struct frame_info *this_frame,
                         struct score_frame_cache *this_cache)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR sp;
   CORE_ADDR fp;
   CORE_ADDR cur_pc = startaddr;
@@ -777,8 +776,8 @@
   memblock_ptr = memblock =
     score_malloc_and_get_memblock (startaddr, pc - startaddr);
 
-  sp = frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
-  fp = frame_unwind_register_unsigned (next_frame, SCORE_FP_REGNUM);
+  sp = get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM);
+  fp = get_frame_register_unsigned (this_frame, SCORE_FP_REGNUM);
 
   for (; cur_pc < pc; prev_pc = cur_pc, cur_pc += inst_len)
     {
@@ -938,7 +937,7 @@
 }
 
 static struct score_frame_cache *
-score_make_prologue_cache (struct frame_info *next_frame, void **this_cache)
+score_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct score_frame_cache *cache;
 
@@ -947,17 +946,17 @@
 
   cache = FRAME_OBSTACK_ZALLOC (struct score_frame_cache);
   (*this_cache) = cache;
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Analyze the prologue.  */
   {
-    const CORE_ADDR pc = frame_pc_unwind (next_frame);
+    const CORE_ADDR pc = get_frame_pc (this_frame);
     CORE_ADDR start_addr;
 
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
     if (start_addr == 0)
       return cache;
-    score_analyze_prologue (start_addr, pc, next_frame, *this_cache);
+    score_analyze_prologue (start_addr, pc, this_frame, *this_cache);
   }
 
   /* Save SP.  */
@@ -967,47 +966,38 @@
 }
 
 static void
-score_prologue_this_id (struct frame_info *next_frame, void **this_cache,
+score_prologue_this_id (struct frame_info *this_frame, void **this_cache,
                         struct frame_id *this_id)
 {
-  struct score_frame_cache *info = score_make_prologue_cache (next_frame,
+  struct score_frame_cache *info = score_make_prologue_cache (this_frame,
                                                               this_cache);
-  (*this_id) = frame_id_build (info->base,
-                               frame_func_unwind (next_frame, NORMAL_FRAME));
+  (*this_id) = frame_id_build (info->base, get_frame_func (this_frame));
 }
 
-static void
-score_prologue_prev_register (struct frame_info *next_frame,
-                              void **this_cache,
-                              int regnum, int *optimizedp,
-                              enum lval_type *lvalp, CORE_ADDR * addrp,
-                              int *realnump, gdb_byte * valuep)
+static struct value *
+score_prologue_prev_register (struct frame_info *this_frame,
+                              void **this_cache, int regnum)
 {
-  struct score_frame_cache *info = score_make_prologue_cache (next_frame,
+  struct score_frame_cache *info = score_make_prologue_cache (this_frame,
                                                               this_cache);
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-                                optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
 static const struct frame_unwind score_prologue_unwind =
 {
   NORMAL_FRAME,
   score_prologue_this_id,
-  score_prologue_prev_register
+  score_prologue_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-score_prologue_sniffer (struct frame_info *next_frame)
-{
-  return &score_prologue_unwind;
-}
-
 static CORE_ADDR
-score_prologue_frame_base_address (struct frame_info *next_frame,
+score_prologue_frame_base_address (struct frame_info *this_frame,
                                    void **this_cache)
 {
   struct score_frame_cache *info =
-    score_make_prologue_cache (next_frame, this_cache);
+    score_make_prologue_cache (this_frame, this_cache);
   return info->fp;
 }
 
@@ -1020,7 +1010,7 @@
 };
 
 static const struct frame_base *
-score_prologue_frame_base_sniffer (struct frame_info *next_frame)
+score_prologue_frame_base_sniffer (struct frame_info *this_frame)
 {
   return &score_prologue_frame_base;
 }
@@ -1063,13 +1053,13 @@
   /* Dummy frame hooks.  */
   set_gdbarch_return_value (gdbarch, score_return_value);
   set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
-  set_gdbarch_unwind_dummy_id (gdbarch, score_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, score_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, score_push_dummy_call);
 
   /* Normal frame hooks.  */
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
   frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
-  frame_unwind_append_sniffer (gdbarch, score_prologue_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &score_prologue_unwind);
   frame_base_append_sniffer (gdbarch, score_prologue_frame_base_sniffer);
 
   return gdbarch;
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 7e49fed..73abdd1 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2512,7 +2512,7 @@
 }
 
 static struct sh_frame_cache *
-sh_frame_cache (struct frame_info *next_frame, void **this_cache)
+sh_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct sh_frame_cache *cache;
   CORE_ADDR current_pc;
@@ -2529,16 +2529,16 @@
      However, for functions that don't need it, the frame pointer is
      optional.  For these "frameless" functions the frame pointer is
      actually the frame pointer of the calling frame. */
-  cache->base = frame_unwind_register_unsigned (next_frame, FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, FP_REGNUM);
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
-  current_pc = frame_pc_unwind (next_frame);
+  cache->pc = get_frame_func (this_frame);
+  current_pc = get_frame_pc (this_frame);
   if (cache->pc != 0)
     {
       ULONGEST fpscr;
-      fpscr = frame_unwind_register_unsigned (next_frame, FPSCR_REGNUM);
+      fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM);
       sh_analyze_prologue (cache->pc, current_pc, cache, fpscr);
     }
 
@@ -2551,9 +2551,9 @@
          setup yet.  Try to reconstruct the base address for the stack
          frame by looking at the stack pointer.  For truly "frameless"
          functions this might work too.  */
-      cache->base = frame_unwind_register_unsigned
-		    (next_frame,
-		     gdbarch_sp_regnum (get_frame_arch (next_frame)));
+      cache->base = get_frame_register_unsigned
+		    (this_frame,
+		     gdbarch_sp_regnum (get_frame_arch (this_frame)));
     }
 
   /* Now that we have the base address for the stack frame we can
@@ -2569,30 +2569,17 @@
   return cache;
 }
 
-static void
-sh_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			int regnum, int *optimizedp,
-			enum lval_type *lvalp, CORE_ADDR *addrp,
-			int *realnump, gdb_byte *valuep)
+static struct value *
+sh_frame_prev_register (struct frame_info *this_frame,
+			void **this_cache, int regnum)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
-  struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
 
   gdb_assert (regnum >= 0);
 
   if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (valuep)
-	{
-	  /* Store the value.  */
-	  store_unsigned_integer (valuep, 4, cache->saved_sp);
-	}
-      return;
-    }
+    return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
 
   /* The PC of the previous frame is stored in the PR register of
      the current frame.  Frob regnum so that we pull the value from
@@ -2601,33 +2588,17 @@
     regnum = PR_REGNUM;
 
   if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
-    {
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = cache->saved_regs[regnum];
-      *realnump = -1;
-      if (valuep)
-	{
-	  /* Read the value in from memory.  */
-	  read_memory (*addrp, valuep,
-		       register_size (gdbarch, regnum));
-	}
-      return;
-    }
+    return frame_unwind_got_memory (this_frame, regnum,
+                                    cache->saved_regs[regnum]);
 
-  *optimizedp = 0;
-  *lvalp = lval_register;
-  *addrp = 0;
-  *realnump = regnum;
-  if (valuep)
-    frame_unwind_register (next_frame, (*realnump), valuep);
+  return frame_unwind_got_register (this_frame, regnum, regnum);
 }
 
 static void
-sh_frame_this_id (struct frame_info *next_frame, void **this_cache,
+sh_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		  struct frame_id *this_id)
 {
-  struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
+  struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
 
   /* This marks the outermost frame.  */
   if (cache->base == 0)
@@ -2639,15 +2610,11 @@
 static const struct frame_unwind sh_frame_unwind = {
   NORMAL_FRAME,
   sh_frame_this_id,
-  sh_frame_prev_register
+  sh_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-sh_frame_sniffer (struct frame_info *next_frame)
-{
-  return &sh_frame_unwind;
-}
-
 static CORE_ADDR
 sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -2663,16 +2630,17 @@
 }
 
 static struct frame_id
-sh_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (sh_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
+					      gdbarch_sp_regnum (gdbarch));
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 static CORE_ADDR
-sh_frame_base_address (struct frame_info *next_frame, void **this_cache)
+sh_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
+  struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
 
   return cache->base;
 }
@@ -2862,7 +2830,7 @@
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
   set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc);
-  set_gdbarch_unwind_dummy_id (gdbarch, sh_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
   set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p);
@@ -2973,8 +2941,8 @@
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, sh_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
 
   return gdbarch;
 }
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 6ad32f0..5456be7 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2263,7 +2263,7 @@
 }
 
 static struct sh64_frame_cache *
-sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
+sh64_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch;
   struct sh64_frame_cache *cache;
@@ -2273,11 +2273,11 @@
   if (*this_cache)
     return *this_cache;
 
-  gdbarch = get_frame_arch (next_frame);
+  gdbarch = get_frame_arch (this_frame);
   cache = sh64_alloc_frame_cache ();
   *this_cache = cache;
 
-  current_pc = frame_pc_unwind (next_frame);
+  current_pc = get_frame_pc (this_frame);
   cache->media_mode = pc_is_isa32 (current_pc);
 
   /* In principle, for normal frames, fp holds the frame pointer,
@@ -2285,11 +2285,11 @@
      However, for functions that don't need it, the frame pointer is
      optional.  For these "frameless" functions the frame pointer is
      actually the frame pointer of the calling frame. */
-  cache->base = frame_unwind_register_unsigned (next_frame, MEDIA_FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, MEDIA_FP_REGNUM);
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
+  cache->pc = get_frame_func (this_frame);
   if (cache->pc != 0)
     sh64_analyze_prologue (gdbarch, cache, cache->pc, current_pc);
 
@@ -2302,8 +2302,8 @@
          setup yet.  Try to reconstruct the base address for the stack
          frame by looking at the stack pointer.  For truly "frameless"
          functions this might work too.  */
-      cache->base = frame_unwind_register_unsigned
-		    (next_frame, gdbarch_sp_regnum (gdbarch));
+      cache->base = get_frame_register_unsigned
+		    (this_frame, gdbarch_sp_regnum (gdbarch));
     }
 
   /* Now that we have the base address for the stack frame we can
@@ -2319,33 +2319,17 @@
   return cache;
 }
 
-static void
-sh64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			  int regnum, int *optimizedp,
-			  enum lval_type *lvalp, CORE_ADDR *addrp,
-			  int *realnump, gdb_byte *valuep)
+static struct value *
+sh64_frame_prev_register (struct frame_info *this_frame,
+			  void **this_cache, int regnum)
 {
-  struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache);
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
 
   gdb_assert (regnum >= 0);
 
   if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (valuep)
-        {
-          /* Store the value.  */
-          store_unsigned_integer (valuep,
-	  			  register_size (gdbarch,
-				  gdbarch_sp_regnum (gdbarch)),
-				  cache->saved_sp);
-        }
-      return;
-    }
+    frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
 
   /* The PC of the previous frame is stored in the PR register of
      the current frame.  Frob regnum so that we pull the value from
@@ -2355,42 +2339,26 @@
 
   if (regnum < SIM_SH64_NR_REGS && cache->saved_regs[regnum] != -1)
     {
-      int reg_size = register_size (gdbarch, regnum);
-      int size;
-
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = cache->saved_regs[regnum];
-      *realnump = -1;
       if (gdbarch_tdep (gdbarch)->sh_abi == SH_ABI_32
           && (regnum == MEDIA_FP_REGNUM || regnum == PR_REGNUM))
-	size = 4;
-      else
-        size = reg_size;
-      if (valuep)
         {
-	  memset (valuep, 0, reg_size);
-	  if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
-	    read_memory (*addrp, valuep, size);
-	  else
-	    read_memory (*addrp, (char *) valuep + reg_size - size, size);
+	  CORE_ADDR val;
+	  val = read_memory_unsigned_integer (cache->saved_regs[regnum], 4);
+	  return frame_unwind_got_constant (this_frame, regnum, val);
         }
-      return;
+
+      return frame_unwind_got_memory (this_frame, regnum,
+				      cache->saved_regs[regnum]);
     }
 
-  *optimizedp = 0;
-  *lvalp = lval_register;
-  *addrp = 0;
-  *realnump = regnum;
-  if (valuep)
-    frame_unwind_register (next_frame, (*realnump), valuep);
+  return frame_unwind_got_register (this_frame, regnum, regnum);
 }
 
 static void
-sh64_frame_this_id (struct frame_info *next_frame, void **this_cache,
+sh64_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		    struct frame_id *this_id)
 {
-  struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache);
+  struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache);
 
   /* This marks the outermost frame.  */
   if (cache->base == 0)
@@ -2402,15 +2370,11 @@
 static const struct frame_unwind sh64_frame_unwind = {
   NORMAL_FRAME,
   sh64_frame_this_id,
-  sh64_frame_prev_register
+  sh64_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
-static const struct frame_unwind *
-sh64_frame_sniffer (struct frame_info *next_frame)
-{
-  return &sh64_frame_unwind;
-}
-
 static CORE_ADDR
 sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -2426,16 +2390,17 @@
 }
 
 static struct frame_id
-sh64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+sh64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (sh64_unwind_sp (gdbarch, next_frame),
-                         frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
+					      gdbarch_sp_regnum (gdbarch));
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 static CORE_ADDR
-sh64_frame_base_address (struct frame_info *next_frame, void **this_cache)
+sh64_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache);
+  struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache);
 
   return cache->base;
 }
@@ -2521,7 +2486,7 @@
   set_gdbarch_frame_align (gdbarch, sh64_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
   set_gdbarch_unwind_pc (gdbarch, sh64_unwind_pc);
-  set_gdbarch_unwind_dummy_id (gdbarch, sh64_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, sh64_dummy_id);
   frame_base_set_default (gdbarch, &sh64_frame_base);
 
   set_gdbarch_print_registers_info (gdbarch, sh64_print_registers_info);
@@ -2532,8 +2497,8 @@
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, sh64_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &sh64_frame_unwind);
 
   return gdbarch;
 }
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index bf31fa0..ab7ec5d 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -881,9 +881,9 @@
 }
 
 static void
-sol_thread_stop (void)
+sol_thread_stop (ptid_t ptid)
 {
-  procfs_ops.to_stop ();
+  procfs_ops.to_stop (ptid);
 }
 
 /* These routines implement the lower half of the thread_db interface,
diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c
index 02cc4db..00f1cd2 100644
--- a/gdb/solib-osf.c
+++ b/gdb/solib-osf.c
@@ -306,6 +306,11 @@
 static void
 osf_solib_create_inferior_hook (void)
 {
+  /* If we are attaching to the inferior, the shared libraries
+     have already been mapped, so nothing more to do.  */
+  if (attach_flag)
+    return;
+
   /* Nothing to do for statically bound executables.  */
 
   if (symfile_objfile == NULL
@@ -316,7 +321,14 @@
   /* Now run the target.  It will eventually get a SIGTRAP, at
      which point all of the libraries will have been mapped in and we
      can go groveling around in the rld structures to find
-     out what we need to know about them. */
+     out what we need to know about them.
+     
+     If debugging from a core file, we cannot resume the execution
+     of the inferior.  But this is actually not an issue, because
+     shared libraries have already been mapped anyways, which means
+     we have nothing more to do.  */
+  if (!target_can_run (&current_target))
+    return;
 
   clear_proceed_status ();
   stop_soon = STOP_QUIETLY;
diff --git a/gdb/solib.c b/gdb/solib.c
index a694b81..515402e 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -448,7 +448,7 @@
 			"Error while reading shared library symbols:\n",
 			RETURN_MASK_ALL))
 	{
-	  if (from_tty)
+	  if (from_tty && print_symbol_loading)
 	    printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
 	  so->symbols_loaded = 1;
 	  return 1;
diff --git a/gdb/source.c b/gdb/source.c
index fc5fe0b..e0ae0b1 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -250,7 +250,8 @@
 	return;
     }
 
-  /* All right; find the last file in the symtab list (ignoring .h's).  */
+  /* Alright; find the last file in the symtab list (ignoring .h's
+     and namespace symtabs).  */
 
   current_source_line = 1;
 
@@ -260,14 +261,15 @@
 	{
 	  const char *name = s->filename;
 	  int len = strlen (name);
-	  if (!(len > 2 && strcmp(&name[len - 2], ".h") == 0))
+	  if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
+	      || strcmp (name, "<<C++-namespaces>>") == 0)))
 	    current_source_symtab = s;
 	}
     }
   if (current_source_symtab)
     return;
 
-  /* Howabout the partial symbol tables? */
+  /* How about the partial symbol tables?  */
 
   for (ofp = object_files; ofp != NULL; ofp = ofp->next)
     {
@@ -275,7 +277,8 @@
 	{
 	  const char *name = ps->filename;
 	  int len = strlen (name);
-	  if (!(len > 2 && strcmp (&name[len - 2], ".h") == 0))
+	  if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
+	      || strcmp (name, "<<C++-namespaces>>") == 0)))
 	    cs_pst = ps;
 	}
     }
diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c
index 83694ff..77cb2d9 100644
--- a/gdb/sparc64fbsd-tdep.c
+++ b/gdb/sparc64fbsd-tdep.c
@@ -90,7 +90,7 @@
 }
 
 static struct sparc_frame_cache *
-sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame,
+sparc64fbsd_sigtramp_frame_cache (struct frame_info *this_frame,
 				   void **this_cache)
 {
   struct sparc_frame_cache *cache;
@@ -101,15 +101,15 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = sparc_frame_cache (next_frame, this_cache);
+  cache = sparc_frame_cache (this_frame, this_cache);
   gdb_assert (cache == *this_cache);
 
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* The third argument is a pointer to an instance of `ucontext_t',
      which has a member `uc_mcontext' that contains the saved
      registers.  */
-  addr = frame_unwind_register_unsigned (next_frame, SPARC_O2_REGNUM);
+  addr = get_frame_register_unsigned (this_frame, SPARC_O2_REGNUM);
   mcontext_addr = addr + 64;
 
   /* The following registers travel in the `mc_local' slots of
@@ -136,7 +136,7 @@
   /* The `local' and `in' registers have been saved in the register
      save area.  */
   addr = cache->saved_regs[SPARC_SP_REGNUM].addr;
-  sp = get_frame_memory_unsigned (next_frame, addr, 8);
+  sp = get_frame_memory_unsigned (this_frame, addr, 8);
   for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
        regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
     cache->saved_regs[regnum].addr = addr;
@@ -147,7 +147,7 @@
 #define FPRS_FEF	(1 << 2)
 
   addr = cache->saved_regs[SPARC64_FPRS_REGNUM].addr;
-  fprs = get_frame_memory_unsigned (next_frame, addr, 8);
+  fprs = get_frame_memory_unsigned (this_frame, addr, 8);
   if (fprs & FPRS_FEF)
     {
       for (regnum = SPARC_F0_REGNUM, addr = mcontext_addr + 32 * 8;
@@ -163,50 +163,49 @@
 }
 
 static void
-sparc64fbsd_sigtramp_frame_this_id (struct frame_info *next_frame,
+sparc64fbsd_sigtramp_frame_this_id (struct frame_info *this_frame,
 				    void **this_cache,
 				    struct frame_id *this_id)
 {
   struct sparc_frame_cache *cache =
-    sparc64fbsd_sigtramp_frame_cache (next_frame, this_cache);
+    sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
 
   (*this_id) = frame_id_build (cache->base, cache->pc);
 }
 
-static void
-sparc64fbsd_sigtramp_frame_prev_register (struct frame_info *next_frame,
-					  void **this_cache,
-					  int regnum, int *optimizedp,
-					  enum lval_type *lvalp,
-					  CORE_ADDR *addrp,
-					  int *realnump, gdb_byte *valuep)
+static struct value *
+sparc64fbsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
+					  void **this_cache, int regnum)
 {
   struct sparc_frame_cache *cache =
-    sparc64fbsd_sigtramp_frame_cache (next_frame, this_cache);
+    sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
+}
+
+static int
+sparc64fbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
+				    struct frame_info *this_frame,
+				    void **this_cache)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  char *name;
+
+  find_pc_partial_function (pc, &name, NULL, NULL);
+  if (sparc64fbsd_pc_in_sigtramp (pc, name))
+    return 1;
+
+  return 0;
 }
 
 static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
 {
   SIGTRAMP_FRAME,
   sparc64fbsd_sigtramp_frame_this_id,
-  sparc64fbsd_sigtramp_frame_prev_register
+  sparc64fbsd_sigtramp_frame_prev_register,
+  NULL,
+  sparc64fbsd_sigtramp_frame_sniffer
 };
-
-static const struct frame_unwind *
-sparc64fbsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  char *name;
-
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  if (sparc64fbsd_pc_in_sigtramp (pc, name))
-    return &sparc64fbsd_sigtramp_frame_unwind;
-
-  return NULL;
-}
 
 
 static void
@@ -222,7 +221,7 @@
 				 sparc64fbsd_collect_fpregset);
   tdep->sizeof_fpregset = 272;
 
-  frame_unwind_append_sniffer (gdbarch, sparc64fbsd_sigtramp_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &sparc64fbsd_sigtramp_frame_unwind);
 
   sparc64_init_abi (info, gdbarch);
 
diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c
index 67b7900..45d52ec 100644
--- a/gdb/sparc64nbsd-tdep.c
+++ b/gdb/sparc64nbsd-tdep.c
@@ -90,13 +90,13 @@
 
 struct trad_frame_saved_reg *
 sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
-				   struct frame_info *next_frame)
+				   struct frame_info *this_frame)
 {
   struct trad_frame_saved_reg *saved_regs;
   CORE_ADDR addr, sp;
   int regnum, delta;
 
-  saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* The registers are saved in bits and pieces scattered all over the
      place.  The code below records their location on the assumption
@@ -127,7 +127,7 @@
   /* The `local' and `in' registers have been saved in the register
      save area.  */
   addr = saved_regs[SPARC_SP_REGNUM].addr;
-  sp = get_frame_memory_unsigned (next_frame, addr, 8);
+  sp = get_frame_memory_unsigned (this_frame, addr, 8);
   for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
        regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
     saved_regs[regnum].addr = addr;
@@ -141,7 +141,7 @@
 	ULONGEST i7;
 
 	addr = saved_regs[SPARC_I7_REGNUM].addr;
-	i7 = get_frame_memory_unsigned (next_frame, addr, 8);
+	i7 = get_frame_memory_unsigned (this_frame, addr, 8);
 	trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
       }
   }
@@ -152,7 +152,7 @@
 }
 
 static struct sparc_frame_cache *
-sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
+sparc64nbsd_sigcontext_frame_cache (struct frame_info *this_frame,
 				    void **this_cache)
 {
   struct sparc_frame_cache *cache;
@@ -161,7 +161,7 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = sparc_frame_cache (next_frame, this_cache);
+  cache = sparc_frame_cache (this_frame, this_cache);
   gdb_assert (cache == *this_cache);
 
   /* If we couldn't find the frame's function, we're probably dealing
@@ -173,7 +173,7 @@
       /* Since we couldn't find the frame's function, the cache was
          initialized under the assumption that we're frameless.  */
       cache->frameless_p = 0;
-      addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
+      addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
       if (addr & 1)
 	addr += BIAS;
       cache->base = addr;
@@ -182,59 +182,58 @@
   /* We find the appropriate instance of `struct sigcontext' at a
      fixed offset in the signal frame.  */
   addr = cache->base + 128 + 8;
-  cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame);
+  cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame);
 
   return cache;
 }
 
 static void
-sparc64nbsd_sigcontext_frame_this_id (struct frame_info *next_frame,
+sparc64nbsd_sigcontext_frame_this_id (struct frame_info *this_frame,
 				      void **this_cache,
 				      struct frame_id *this_id)
 {
   struct sparc_frame_cache *cache =
-    sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache);
+    sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
 
   (*this_id) = frame_id_build (cache->base, cache->pc);
 }
 
-static void
-sparc64nbsd_sigcontext_frame_prev_register (struct frame_info *next_frame,
-					    void **this_cache,
-					    int regnum, int *optimizedp,
-					    enum lval_type *lvalp,
-					    CORE_ADDR *addrp,
-					    int *realnump, gdb_byte *valuep)
+static struct value *
+sparc64nbsd_sigcontext_frame_prev_register (struct frame_info *this_frame,
+					    void **this_cache, int regnum)
 {
   struct sparc_frame_cache *cache =
-    sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache);
+    sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
 }
 
-static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
+static int
+sparc64nbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
+				    struct frame_info *this_frame,
+				    void **this_cache)
 {
-  SIGTRAMP_FRAME,
-  sparc64nbsd_sigcontext_frame_this_id,
-  sparc64nbsd_sigcontext_frame_prev_register
-};
-
-static const struct frame_unwind *
-sparc64nbsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
   char *name;
 
   find_pc_partial_function (pc, &name, NULL, NULL);
   if (sparc64nbsd_pc_in_sigtramp (pc, name))
     {
       if (name == NULL || strncmp (name, "__sigtramp_sigcontext", 21))
-	return &sparc64nbsd_sigcontext_frame_unwind;
+	return 1;
     }
 
-  return NULL;
+  return 0;
 }
+
+static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
+{
+  SIGTRAMP_FRAME,
+  sparc64nbsd_sigcontext_frame_this_id,
+  sparc64nbsd_sigcontext_frame_prev_register,
+  NULL,
+  sparc64nbsd_sigtramp_frame_sniffer
+};
 
 
 static void
@@ -251,7 +250,7 @@
   /* Make sure we can single-step "new" syscalls.  */
   tdep->step_trap = sparcnbsd_step_trap;
 
-  frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &sparc64nbsd_sigcontext_frame_unwind);
 
   sparc64_init_abi (info, gdbarch);
 
diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c
index 55f0d49..9f8a84a 100644
--- a/gdb/sparc64obsd-tdep.c
+++ b/gdb/sparc64obsd-tdep.c
@@ -121,7 +121,7 @@
 }
 
 static struct sparc_frame_cache *
-sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache)
+sparc64obsd_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct sparc_frame_cache *cache;
   CORE_ADDR addr;
@@ -129,20 +129,20 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = sparc_frame_cache (next_frame, this_cache);
+  cache = sparc_frame_cache (this_frame, this_cache);
   gdb_assert (cache == *this_cache);
 
   /* If we couldn't find the frame's function, we're probably dealing
      with an on-stack signal trampoline.  */
   if (cache->pc == 0)
     {
-      cache->pc = frame_pc_unwind (next_frame);
+      cache->pc = get_frame_pc (this_frame);
       cache->pc &= ~(sparc64obsd_page_size - 1);
 
       /* Since we couldn't find the frame's function, the cache was
          initialized under the assumption that we're frameless.  */
       cache->frameless_p = 0;
-      addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
+      addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
       if (addr & 1)
 	addr += BIAS;
       cache->base = addr;
@@ -151,59 +151,59 @@
   /* We find the appropriate instance of `struct sigcontext' at a
      fixed offset in the signal frame.  */
   addr = cache->base + 128 + 16;
-  cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame);
+  cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame);
 
   return cache;
 }
 
 static void
-sparc64obsd_frame_this_id (struct frame_info *next_frame, void **this_cache,
+sparc64obsd_frame_this_id (struct frame_info *this_frame, void **this_cache,
 			   struct frame_id *this_id)
 {
   struct sparc_frame_cache *cache =
-    sparc64obsd_frame_cache (next_frame, this_cache);
+    sparc64obsd_frame_cache (this_frame, this_cache);
 
   (*this_id) = frame_id_build (cache->base, cache->pc);
 }
 
-static void
-sparc64obsd_frame_prev_register (struct frame_info *next_frame,
-				 void **this_cache,
-				 int regnum, int *optimizedp,
-				 enum lval_type *lvalp, CORE_ADDR *addrp,
-				 int *realnump, gdb_byte *valuep)
+static struct value *
+sparc64obsd_frame_prev_register (struct frame_info *this_frame,
+				 void **this_cache, int regnum)
 {
   struct sparc_frame_cache *cache =
-    sparc64obsd_frame_cache (next_frame, this_cache);
+    sparc64obsd_frame_cache (this_frame, this_cache);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
+}
+
+static int
+sparc64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
+				    struct frame_info *this_frame,
+				    void **this_cache)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  char *name;
+
+  find_pc_partial_function (pc, &name, NULL, NULL);
+  if (sparc64obsd_pc_in_sigtramp (pc, name))
+    return 1;
+
+  return 0;
 }
 
 static const struct frame_unwind sparc64obsd_frame_unwind =
 {
   SIGTRAMP_FRAME,
   sparc64obsd_frame_this_id,
-  sparc64obsd_frame_prev_register
+  sparc64obsd_frame_prev_register,
+  NULL,
+  sparc64obsd_sigtramp_frame_sniffer
 };
-
-static const struct frame_unwind *
-sparc64obsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  char *name;
-
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  if (sparc64obsd_pc_in_sigtramp (pc, name))
-    return &sparc64obsd_frame_unwind;
-
-  return NULL;
-}
 
 /* Kernel debugging support.  */
 
 static struct sparc_frame_cache *
-sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache)
+sparc64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct sparc_frame_cache *cache;
   CORE_ADDR sp, trapframe_addr;
@@ -212,13 +212,13 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = sparc_frame_cache (next_frame, this_cache);
+  cache = sparc_frame_cache (this_frame, this_cache);
   gdb_assert (cache == *this_cache);
 
-  sp = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM);
+  sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM);
   trapframe_addr = sp + BIAS + 176;
 
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr;
   cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + 8;
@@ -232,55 +232,55 @@
 }
 
 static void
-sparc64obsd_trapframe_this_id (struct frame_info *next_frame,
+sparc64obsd_trapframe_this_id (struct frame_info *this_frame,
 			       void **this_cache, struct frame_id *this_id)
 {
   struct sparc_frame_cache *cache =
-    sparc64obsd_trapframe_cache (next_frame, this_cache);
+    sparc64obsd_trapframe_cache (this_frame, this_cache);
 
   (*this_id) = frame_id_build (cache->base, cache->pc);
 }
 
-static void
-sparc64obsd_trapframe_prev_register (struct frame_info *next_frame,
-				     void **this_cache,
-				     int regnum, int *optimizedp,
-				     enum lval_type *lvalp, CORE_ADDR *addrp,
-				     int *realnump, gdb_byte *valuep)
+static struct value *
+sparc64obsd_trapframe_prev_register (struct frame_info *this_frame,
+				     void **this_cache, int regnum)
 {
   struct sparc_frame_cache *cache =
-    sparc64obsd_trapframe_cache (next_frame, this_cache);
+    sparc64obsd_trapframe_cache (this_frame, this_cache);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
 }
 
-static const struct frame_unwind sparc64obsd_trapframe_unwind =
-{
-  NORMAL_FRAME,
-  sparc64obsd_trapframe_this_id,
-  sparc64obsd_trapframe_prev_register
-};
-
-static const struct frame_unwind *
-sparc64obsd_trapframe_sniffer (struct frame_info *next_frame)
+static int
+sparc64obsd_trapframe_sniffer (const struct frame_unwind *self,
+			       struct frame_info *this_frame,
+			       void **this_cache)
 {
   CORE_ADDR pc;
   ULONGEST pstate;
   char *name;
 
   /* Check whether we are in privileged mode, and bail out if we're not.  */
-  pstate = frame_unwind_register_unsigned (next_frame, SPARC64_PSTATE_REGNUM);
+  pstate = get_frame_register_unsigned (this_frame, SPARC64_PSTATE_REGNUM);
   if ((pstate & SPARC64_PSTATE_PRIV) == 0)
-    return NULL;
+    return 0;
 
-  pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+  pc = get_frame_address_in_block (this_frame);
   find_pc_partial_function (pc, &name, NULL, NULL);
   if (name && strcmp (name, "Lslowtrap_reenter") == 0)
-    return &sparc64obsd_trapframe_unwind;
+    return 1;
 
-  return NULL;
+  return 0;
 }
+
+static const struct frame_unwind sparc64obsd_trapframe_unwind =
+{
+  NORMAL_FRAME,
+  sparc64obsd_trapframe_this_id,
+  sparc64obsd_trapframe_prev_register,
+  NULL,
+  sparc64obsd_trapframe_sniffer
+};
 
 
 /* Threads support.  */
@@ -378,8 +378,8 @@
   /* Make sure we can single-step "new" syscalls.  */
   tdep->step_trap = sparcnbsd_step_trap;
 
-  frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, sparc64obsd_trapframe_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &sparc64obsd_frame_unwind);
+  frame_unwind_append_unwinder (gdbarch, &sparc64obsd_trapframe_unwind);
 
   sparc64_init_abi (info, gdbarch);
 
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 4b0e0a6..e19b718 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -27,7 +27,7 @@
 #include "regcache.h"
 #include "symfile.h"
 #include "gdb_wait.h"
-#include "gdb_stdint.h"
+#include "gdbthread.h"
 
 #include <sys/ptrace.h>
 #include <asm/ptrace.h>
@@ -376,6 +376,8 @@
       ptrace (PT_SYSCALL, tid, (PTRACE_TYPE_ARG3) 0, 0);
       waitpid (tid, NULL, __WALL | __WNOTHREAD);
     }
+
+  add_thread_silent (ptid);
 }
 
 /* Override the post_attach routine to try load the SPE executable
@@ -395,6 +397,8 @@
       waitpid (pid, NULL, __WALL | __WNOTHREAD);
     }
 
+  add_thread_silent (inferior_ptid);
+
   /* If the user has not provided an executable file, try to extract
      the image from inside the target process.  */
   if (!get_exec_file (0))
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index aaa9879..fe04959 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -888,15 +888,17 @@
   /* Otherwise, fall back to reading the backchain link.  */
   else
     {
-      CORE_ADDR reg, backchain;
+      CORE_ADDR reg;
+      LONGEST backchain;
+      int status;
 
       /* Get the backchain.  */
       reg = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM);
-      backchain = read_memory_unsigned_integer (reg, 4);
+      status = safe_read_memory_integer (reg, 4, &backchain);
 
       /* A zero backchain terminates the frame chain.  Also, sanity
          check against the local store size limit.  */
-      if (backchain != 0 && backchain < SPU_LS_SIZE)
+      if (status && backchain > 0 && backchain < SPU_LS_SIZE)
 	{
 	  /* Assume the link register is saved into its slot.  */
 	  if (backchain + 16 < SPU_LS_SIZE)
diff --git a/gdb/stack.c b/gdb/stack.c
index 3d78f74..18c4298 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -43,6 +43,7 @@
 #include "regcache.h"
 #include "solib.h"
 #include "valprint.h"
+#include "gdbthread.h"
 
 #include "gdb_assert.h"
 #include <ctype.h>
@@ -1643,6 +1644,9 @@
   if (!target_has_stack)
     return 0;
 
+  if (is_executing (inferior_ptid))
+    return 0;
+
   return get_frame_block (get_selected_frame (NULL), addr_in_block);
 }
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index d0596e6..12f17ac 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -171,6 +171,12 @@
 		    value);
 }
 
+/* If non-zero, gdb will notify the user when it is loading symbols
+   from a file.  This is almost always what users will want to have happen;
+   but for programs with lots of dynamically linked libraries, the output
+   can be more noise than signal.  */
+
+int print_symbol_loading = 1;
 
 /* If non-zero, shared library symbols will be added automatically
    when the inferior is created, new libraries are loaded, or when
@@ -1046,9 +1052,12 @@
 	deprecated_pre_add_symbol_hook (name);
       else
 	{
-	  printf_unfiltered (_("Reading symbols from %s..."), name);
-	  wrap_here ("");
-	  gdb_flush (gdb_stdout);
+          if (print_symbol_loading)
+	    {
+	      printf_unfiltered (_("Reading symbols from %s..."), name);
+	      wrap_here ("");
+	      gdb_flush (gdb_stdout);
+	    }
 	}
     }
   syms_from_objfile (objfile, addrs, offsets, num_offsets,
@@ -1061,7 +1070,7 @@
 
   if ((flags & OBJF_READNOW) || readnow_symbol_files)
     {
-      if (from_tty || info_verbose)
+      if ((from_tty || info_verbose) && print_symbol_loading)
 	{
 	  printf_unfiltered (_("expanding to full symbols..."));
 	  wrap_here ("");
@@ -1103,7 +1112,8 @@
       xfree (debugfile);
     }
 
-  if (!have_partial_symbols () && !have_full_symbols ())
+  if (!have_partial_symbols () && !have_full_symbols ()
+      && print_symbol_loading)
     {
       wrap_here ("");
       printf_filtered (_("(no debugging symbols found)"));
@@ -1120,7 +1130,8 @@
 	deprecated_post_add_symbol_hook ();
       else
 	{
-	  printf_unfiltered (_("done.\n"));
+	  if (print_symbol_loading)
+	    printf_unfiltered (_("done.\n"));
 	}
     }
 
@@ -1708,6 +1719,11 @@
 static void
 load_command (char *arg, int from_tty)
 {
+  /* The user might be reloading because the binary has changed.  Take
+     this opportunity to check.  */
+  reopen_exec_file ();
+  reread_symbols ();
+
   if (arg == NULL)
     {
       char *parg;
@@ -1745,11 +1761,6 @@
 	}
     }
 
-  /* The user might be reloading because the binary has changed.  Take
-     this opportunity to check.  */
-  reopen_exec_file ();
-  reread_symbols ();
-
   target_load (arg, from_tty);
 
   /* After re-loading the executable, we don't really know which
@@ -4219,4 +4230,12 @@
 				     NULL,
 				     show_debug_file_directory,
 				     &setlist, &showlist);
+
+  add_setshow_boolean_cmd ("symbol-loading", no_class,
+                           &print_symbol_loading, _("\
+Set printing of symbol loading messages."), _("\
+Show printing of symbol loading messages."), NULL,
+                           NULL,
+                           NULL,
+                           &setprintlist, &showprintlist);
 }
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 948cef7..02fb7df 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -267,6 +267,13 @@
 
 			/*   Variables   */
 
+/* If non-zero, gdb will notify the user when it is loading symbols
+   from a file.  This is almost always what users will want to have happen;
+   but for programs with lots of dynamically linked libraries, the output
+   can be more noise than signal.  */
+
+extern int print_symbol_loading;
+
 /* If non-zero, shared library symbols will be added automatically
    when the inferior is created, new libraries are loaded, or when
    attaching to the inferior.  This is almost always what users will
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6adecbf..f676a0c 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2617,6 +2617,21 @@
       /* Recalculate the line number (might not be N+1).  */
       sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
     }
+
+  /* On targets with executable formats that don't have a concept of
+     constructors (ELF with .init has, PE doesn't), gcc emits a call
+     to `__main' in `main' between the prologue and before user
+     code.  */
+  if (funfirstline
+      && gdbarch_skip_main_prologue_p (current_gdbarch)
+      && SYMBOL_LINKAGE_NAME (sym)
+      && strcmp (SYMBOL_LINKAGE_NAME (sym), "main") == 0)
+    {
+      pc = gdbarch_skip_main_prologue (current_gdbarch, pc);
+      /* Recalculate the line number (might not be N+1).  */
+      sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
+    }
+
   sal.pc = pc;
 
   return sal;
@@ -4441,8 +4456,8 @@
      blocks -- for each PC found above we see if there are other PCs
      that are in the same block.  If yes, the other PCs are filtered out.  */  
 
-  filter = xmalloc (ret.nelts * sizeof (int));
-  blocks = xmalloc (ret.nelts * sizeof (struct block *));
+  filter = alloca (ret.nelts * sizeof (int));
+  blocks = alloca (ret.nelts * sizeof (struct block *));
   for (i = 0; i < ret.nelts; ++i)
     {
       filter[i] = 1;
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index e1535b3..95bf7c9 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1013,7 +1013,7 @@
     error (_("The current target description did not come from an XML file."));
 
   filename = lbasename (target_description_filename);
-  function = xmalloc (strlen (filename) + 1);
+  function = alloca (strlen (filename) + 1);
   for (inp = filename, outp = function; *inp != '\0'; inp++)
     if (*inp == '.')
       break;
diff --git a/gdb/target.c b/gdb/target.c
index be7f3a1..461cfe3 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -39,7 +39,7 @@
 #include "gdbcore.h"
 #include "exceptions.h"
 #include "target-descriptions.h"
-#include "gdb_stdint.h"
+#include "gdbthread.h"
 
 static void target_info (char *, int);
 
@@ -165,7 +165,7 @@
 
 static int debug_to_thread_alive (ptid_t);
 
-static void debug_to_stop (void);
+static void debug_to_stop (ptid_t);
 
 /* NOTE: cagney/2004-09-29: Many targets reference this variable in
    wierd and mysterious ways.  Putting the variable here lets those
@@ -405,6 +405,7 @@
       INHERIT (to_close, t);
       INHERIT (to_attach, t);
       INHERIT (to_post_attach, t);
+      INHERIT (to_attach_no_wait, t);
       INHERIT (to_detach, t);
       /* Do not inherit to_disconnect.  */
       INHERIT (to_resume, t);
@@ -629,7 +630,7 @@
 	    (char *(*) (struct thread_info *))
 	    return_zero);
   de_fault (to_stop,
-	    (void (*) (void))
+	    (void (*) (ptid_t))
 	    target_ignore);
   current_target.to_xfer_partial = current_xfer_partial;
   de_fault (to_rcmd,
@@ -1450,6 +1451,72 @@
   return len;
 }
 
+LONGEST
+target_read_until_error (struct target_ops *ops,
+			 enum target_object object,
+			 const char *annex, gdb_byte *buf,
+			 ULONGEST offset, LONGEST len)
+{
+  LONGEST xfered = 0;
+  while (xfered < len)
+    {
+      LONGEST xfer = target_read_partial (ops, object, annex,
+					  (gdb_byte *) buf + xfered,
+					  offset + xfered, len - xfered);
+      /* Call an observer, notifying them of the xfer progress?  */
+      if (xfer == 0)
+	return xfered;
+      if (xfer < 0)
+	{
+	  /* We've got an error.  Try to read in smaller blocks.  */
+	  ULONGEST start = offset + xfered;
+	  ULONGEST remaining = len - xfered;
+	  ULONGEST half;
+
+	  /* If an attempt was made to read a random memory address,
+	     it's likely that the very first byte is not accessible.
+	     Try reading the first byte, to avoid doing log N tries
+	     below.  */
+	  xfer = target_read_partial (ops, object, annex, 
+				      (gdb_byte *) buf + xfered, start, 1);
+	  if (xfer <= 0)
+	    return xfered;
+	  start += 1;
+	  remaining -= 1;
+	  half = remaining/2;
+	  
+	  while (half > 0)
+	    {
+	      xfer = target_read_partial (ops, object, annex,
+					  (gdb_byte *) buf + xfered,
+					  start, half);
+	      if (xfer == 0)
+		return xfered;
+	      if (xfer < 0)
+		{
+		  remaining = half;		  
+		}
+	      else
+		{
+		  /* We have successfully read the first half.  So, the
+		     error must be in the second half.  Adjust start and
+		     remaining to point at the second half.  */
+		  xfered += xfer;
+		  start += xfer;
+		  remaining -= xfer;
+		}
+	      half = remaining/2;
+	    }
+
+	  return xfered;
+	}
+      xfered += xfer;
+      QUIT;
+    }
+  return len;
+}
+
+
 /* An alternative to target_write with progress callbacks.  */
 
 LONGEST
@@ -1715,6 +1782,14 @@
   tcomplain ();
 }
 
+void
+target_resume (ptid_t ptid, int step, enum target_signal signal)
+{
+  dcache_invalidate (target_dcache);
+  (*current_target.to_resume) (ptid, step, signal);
+  set_executing (ptid, 1);
+  set_running (ptid, 1);
+}
 /* Look through the list of possible targets for a target that can
    follow forks.  */
 
@@ -2922,11 +2997,12 @@
 }
 
 static void
-debug_to_stop (void)
+debug_to_stop (ptid_t ptid)
 {
-  debug_target.to_stop ();
+  debug_target.to_stop (ptid);
 
-  fprintf_unfiltered (gdb_stdlog, "target_stop ()\n");
+  fprintf_unfiltered (gdb_stdlog, "target_stop (%s)\n",
+		      target_pid_to_str (ptid));
 }
 
 static void
diff --git a/gdb/target.h b/gdb/target.h
index f1e4147..e242566 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -91,13 +91,13 @@
        (e.g. it called load(2) on AIX).  */
     TARGET_WAITKIND_LOADED,
 
-    /* The program has forked.  A "related" process' ID is in
+    /* The program has forked.  A "related" process' PTID is in
        value.related_pid.  I.e., if the child forks, value.related_pid
        is the parent's ID.  */
 
     TARGET_WAITKIND_FORKED,
 
-    /* The program has vforked.  A "related" process's ID is in
+    /* The program has vforked.  A "related" process's PTID is in
        value.related_pid.  */
 
     TARGET_WAITKIND_VFORKED,
@@ -140,7 +140,7 @@
       {
 	int integer;
 	enum target_signal sig;
-	int related_pid;
+	ptid_t related_pid;
 	char *execd_pathname;
 	int syscall_id;
       }
@@ -230,6 +230,11 @@
 			    const char *annex, gdb_byte *buf,
 			    ULONGEST offset, LONGEST len);
 
+extern LONGEST target_read_until_error (struct target_ops *ops,
+					enum target_object object,
+					const char *annex, gdb_byte *buf,
+					ULONGEST offset, LONGEST len);
+  
 extern LONGEST target_write (struct target_ops *ops,
 			     enum target_object object,
 			     const char *annex, const gdb_byte *buf,
@@ -396,7 +401,7 @@
     void (*to_find_new_threads) (void);
     char *(*to_pid_to_str) (ptid_t);
     char *(*to_extra_thread_info) (struct thread_info *);
-    void (*to_stop) (void);
+    void (*to_stop) (ptid_t);
     void (*to_rcmd) (char *command, struct ui_file *output);
     char *(*to_pid_to_exec_file) (int pid);
     void (*to_log_command) (const char *);
@@ -407,6 +412,7 @@
     int to_has_registers;
     int to_has_execution;
     int to_has_thread_control;	/* control thread execution */
+    int to_attach_no_wait;
     struct section_table
      *to_sections;
     struct section_table
@@ -559,6 +565,13 @@
 #define	target_attach(args, from_tty)	\
      (*current_target.to_attach) (args, from_tty)
 
+/* Some targets don't generate traps when attaching to the inferior,
+   or their target_attach implementation takes care of the waiting.
+   These targets must set to_attach_no_wait.  */
+
+#define target_attach_no_wait \
+     (current_target.to_attach_no_wait)
+
 /* The target_attach operation places a process under debugger control,
    and stops the process.
 
@@ -586,11 +599,7 @@
    the target, or TARGET_SIGNAL_0 for no signal.  The caller may not
    pass TARGET_SIGNAL_DEFAULT.  */
 
-#define	target_resume(ptid, step, siggnal)				\
-  do {									\
-    dcache_invalidate(target_dcache);					\
-    (*current_target.to_resume) (ptid, step, siggnal);			\
-  } while (0)
+extern void target_resume (ptid_t ptid, int step, enum target_signal signal);
 
 /* Wait for process pid to do something.  PTID = -1 to wait for any
    pid to do something.  Return pid of child, or -1 in case of error;
@@ -692,11 +701,11 @@
 
 /* From infrun.c.  */
 
-extern int inferior_has_forked (int pid, int *child_pid);
+extern int inferior_has_forked (ptid_t pid, ptid_t *child_pid);
 
-extern int inferior_has_vforked (int pid, int *child_pid);
+extern int inferior_has_vforked (ptid_t pid, ptid_t *child_pid);
 
-extern int inferior_has_execd (int pid, char **execd_pathname);
+extern int inferior_has_execd (ptid_t pid, char **execd_pathname);
 
 /* From exec.c */
 
@@ -897,7 +906,7 @@
    Unix, this should act like SIGSTOP).  This function is normally
    used by GUIs to implement a stop button.  */
 
-#define target_stop current_target.to_stop
+#define target_stop(ptid) (*current_target.to_stop) (ptid)
 
 /* Send the specified COMMAND to the target's monitor
    (shell,interpreter) for execution.  The result of the query is
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d767305..adcadd7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,125 @@
+2008-07-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* gdb.base/foll-fork.exp: Fix for Linux/VDSO failure.
+
+2008-07-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* gdb.base/coremaker.c: Fix for Linux failure in gdb.base/corefile.exp
+
+2008-07-15  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* gdb.cp/class2.exp: fix for failure on spu-elf
+	
+2008-07-14  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* gdb.cp/class2.exp, gdb.cp/class2.cc: Test for PR2477.
+	
+2008-07-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/randomize.exp: Catch non-Linux targets as untested.
+
+2008-07-12  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* lib/mi-support.exp (mi_expect_stop): Adjust for the new field.
+
+2008-07-11  Kevin Buettner  <kevinb@redhat.com>
+
+	* gdb.arch/e500-regs.exp (decimal_vector): Adjust "v8_int8" portion
+	of regexp to account for changes made to GDB in the printing of
+	byte vectors.
+
+2008-07-11  Tom Tromey  <tromey@redhat.com>
+
+	* gdb.base/completion.exp: Add 'help' completion test.
+
+2008-07-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/randomize.exp: Remove dependency on tcl-8.4+.
+
+2008-07-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/randomize.exp, gdb.base/randomize.c: New files.
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	* gdb.base/chng-syms.exp: Don't expect "No symbol ...".
+
+2008-07-09  Pedro Alves  <pedro@codesourcery.com>
+
+	* gdb.base/fullname.exp: Restore pwd if compiling failed.
+
+2008-07-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/value-double-free.exp, gdb.base/value-double-free.c: New.
+
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* lib/mi-support.exp (mi_send_resuming_command_raw): Revert
+	previous commit.  Add a comment.
+
+2008-06-28  Pedro Alves  <pedro@codesourcery.com>
+
+	* gdb.base/sigchld.c, gdb.base/sigchld.exp: New test.
+
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* lib/mi-support.exp (mi_send_resuming_command_raw): Report pass.
+
+2008-06-27  Pedro Alves  <pedro@codesourcery.com>
+
+	* lib/gdb.exp (gdb_saved_set_unbuffered_mode_obj): New global.
+	(gdb_compile): If target is *-*-cygwin* or *-*-mingw*, and we're
+	compiling an executable, link in an object that forces unbuffered
+	output.
+	* lib/set_unbuffered_mode.c: New file.
+
+2008-06-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* lib/gdb.exp (prepare_for_testing): Do not drop the OPTIONS argument.
+
+2008-06-25  Vladimir Prus  <vladimir@codesourcery.com>
+
+        * gdb.mi/mi-async.exp: Use mi_sending_resuming_command_raw and
+        mi_expect_stop.
+        * gdb.mi/mi-support.exp (mi_run_cmd, mi_send_resuming_command):
+        Demand that *running is output.
+        (detect_async): Perform checking every time.
+        (mi_send_resuming_command): Extract everything into...
+        (mi_send_resuming_command_raw): ...this.
+	(mi_expect_stop): Don't accept any output before *stopped.
+
+2008-06-13  Vladimir Prus  <vladimir@codesourcery.com>
+
+	Robustify mi-simplerun.
+        * gdb.mi/basics.c (main): Add a call to sleep.
+        * gdb.mi/mi-cli.exp: Adjust for change in line numbers.
+        * gdb.mi/mi2-cli.exp: Likewise.
+        * gdb.mi/mi-break.exp: Likewise.
+
+2008-06-11  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* gdb.mi/mi-break.exp (test_ignore_count): Use mi_expect_stop.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+        * gdb.mi/mi-console.exp: Adjust.
+        * gdb.mi/mi-syn-frame.exp: Adjust.
+        * gdb.mi/mi2-console.exp: Adjust.
+        * gdb.mi/mi2-syn-frame.exp: Adjust.
+        * lib/mi-support.exp (mi_run_cmd): Adjust.
+        (mi_send_resuming_command): Adjust.
+
+2008-06-10  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* gdb.mi/mi-break.exp (test_ignore_count): Adjust stopped pattern.
+        * gdb.mi/mi-syn-frame.exp: Use mi_expect_stop instead of direct
+        testing of stopped.
+        * gdb.mi/mi2-syn-frame.exp: Likewise.
+        * lib/mi-support.exp (default_mi_gdb_start): Call detect_async.
+        (async, detect_async): New.
+        (mi_expect_stop, mi_continue_to_line): Adjust expectation
+        depending on if we're running in sync or async mode.
+
 2008-06-09  Tom Tromey  <tromey@redhat.com>
 
 	* gdb.base/completion.exp: New tests for field name completion
@@ -164,6 +286,13 @@
 
 	* gdb.asm/asmsrc1.s: Add scratch space.
 
+2008-05-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	    Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* gdb.threads/attach-into-signal.c, gdb.threads/attach-into-signal.exp,
+	gdb.threads/attach-stopped.c, gdb.threads/attach-stopped.exp,
+	gdb.threads/attachstop-mt.c, gdb.threads/attachstop-mt.exp: New.
+
 2007-05-01  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* gdb.arch/thumb-prologue.exp: Do not expect a saved PC.
diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp
index b50696f..e403e5f 100644
--- a/gdb/testsuite/gdb.arch/e500-regs.exp
+++ b/gdb/testsuite/gdb.arch/e500-regs.exp
@@ -104,15 +104,11 @@
 }
 
 # Now redo the same tests, but using the print command.
-# Note: in LE case, the char array is printed WITHOUT the last character.
-# Gdb treats the terminating null char in the array like the terminating
-# null char in a string and doesn't print it. This is not a failure, but
-# the way gdb works.
 
 if {$endianness == "big"} {
-     set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .0, 1, 0, 1., v8_int8 = ..000.000.000.001.000.000.000.001.."
+     set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .0, 1, 0, 1., v8_int8 = .0, 0, 0, 1, 0, 0, 0, 1.."
 } else {
-     set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .1, 0, 1, 0., v8_int8 = ..001.000.000.000.001.000.000.."
+     set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .1, 0, 1, 0., v8_int8 = .1, 0, 0, 0, 1, 0, 0, 0.."
 }
 
 for {set i 0} {$i < 32} {incr i 1} {
diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp
index 36ba7b9..dc54fc8 100644
--- a/gdb/testsuite/gdb.base/chng-syms.exp
+++ b/gdb/testsuite/gdb.base/chng-syms.exp
@@ -105,10 +105,10 @@
 
     gdb_run_cmd
     gdb_expect {
-	-re ".*No symbol .var1..*Program exited normally.*$gdb_prompt $" {
+	-re ".*Program exited normally.*$gdb_prompt $" {
 	    pass "running with invalidated bpt condition after executable changes" 
 	}
-	-re "No symbol .var1..*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
+	-re ".*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
 	    pass "running with invalidated bpt condition after executable changes" 
 	}
 	-re "$gdb_prompt $" { 
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index f4ab1b1..4100db3 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -364,6 +364,23 @@
         }
 
 
+send_gdb "help info wat\t"
+gdb_expect  {
+        -re "^help info watchpoints $"\
+            { send_gdb "\n"
+              gdb_expect {
+                      -re "Synonym for .*\r\n.*$gdb_prompt $"\
+                          { pass "complete help info wat" }
+                      -re ".*$gdb_prompt $" { fail "complete help info wat"}
+                      timeout   {fail "(timeout) complete help info wat"}
+                     }
+            }
+	-re "^help info wat\\\x07$" { fail "complete (2) help info wat" }
+        -re ".*$gdb_prompt $" { fail "complete (3) help info wat" }
+        timeout         { fail "(timeout) complete (3) help info wat" }
+        }
+
+
 send_gdb "p \"break1\t"
 sleep 1
 gdb_expect  {
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
index 2cfa15a..d743cc6 100644
--- a/gdb/testsuite/gdb.base/coremaker.c
+++ b/gdb/testsuite/gdb.base/coremaker.c
@@ -96,6 +96,8 @@
 	  return;
 	}
     }
+  /* Touch buf2 so kernel writes it out into 'core'. */
+  buf2[0] = buf1[0];
 }
 
 void
@@ -137,4 +139,3 @@
   func1 ();
   return 0;
 }
-
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 4b2458f..b946cb3 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -170,7 +170,7 @@
 
    send_gdb "continue\n"
    gdb_expect {
-      -re "Catchpoint.*(forked process.*),.*in .*fork.*$gdb_prompt $"\
+      -re "Catchpoint.*(forked process.*),.*in .*(fork|__kernel_vsyscall).*$gdb_prompt $"\
                       {pass "explicit child follow, catch fork"}
       -re "$gdb_prompt $" {fail "explicit child follow, catch fork"}
       timeout         {fail "(timeout) explicit child follow, catch fork"}
@@ -243,7 +243,7 @@
 
    send_gdb "continue\n"
    gdb_expect {
-      -re ".*in .*fork.*$gdb_prompt $"\
+      -re ".*in .*(fork|__kernel_vsyscall).*$gdb_prompt $"\
                       {pass "explicit parent follow, tcatch fork"}
       -re "$gdb_prompt $" {fail "explicit parent follow, tcatch fork"}
       timeout         {fail "(timeout) explicit parent follow, tcatch fork"}
diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index 8467467..3298349 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -104,6 +104,7 @@
 set save_pwd [pwd]
 cd ${subdir}
 if  { [gdb_compile "tmp-${srcfile}" "${testfile}" executable {debug}] != "" } {
+    cd $save_pwd
     return -1
 }
 cd $save_pwd
diff --git a/gdb/testsuite/gdb.base/randomize.c b/gdb/testsuite/gdb.base/randomize.c
new file mode 100644
index 0000000..950f937
--- /dev/null
+++ b/gdb/testsuite/gdb.base/randomize.c
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2008 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 3 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, see <http://www.gnu.org/licenses/>.
+
+   Please email any bugs, comments, and/or additions to this file to:
+   bug-gdb@prep.ai.mit.edu  */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int main()
+{
+  void *p;
+
+  p = malloc (1);
+
+  return 0; /* print p */
+}
diff --git a/gdb/testsuite/gdb.base/randomize.exp b/gdb/testsuite/gdb.base/randomize.exp
new file mode 100644
index 0000000..3ee9476
--- /dev/null
+++ b/gdb/testsuite/gdb.base/randomize.exp
@@ -0,0 +1,91 @@
+# Copyright 2008 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 3 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, see <http://www.gnu.org/licenses/>.
+
+set testfile randomize
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+    untested "Couldn't compile test program"
+    return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+proc address_get { testname } {
+    global gdb_prompt
+
+    if {![runto_main]} {
+	return -1
+    }
+
+    # Do not rely on printf; some test configurations don't work with stdio.
+
+    gdb_breakpoint [gdb_get_line_number "print p"]
+    gdb_continue_to_breakpoint "$testname - address set"
+
+    gdb_test_multiple "print/x p" $testname {
+	-re "\\$\[0-9\]+ = (0x\[0-9a-f\]*)\r?\n$gdb_prompt $" {
+	    pass $testname
+	    return $expect_out(1,string)
+	}
+    }
+}
+
+set test "set disable-randomization off"
+gdb_test_multiple "${test}" "${test}" {
+    -re "Disabling randomization .* unsupported .*$gdb_prompt $" {
+	untested "Disabling randomization is not supported on this Linux GDB"
+	return -1
+    }
+    -re "No symbol .* in current context.*$gdb_prompt $" {
+	untested "Disabling randomization is not supported on this GDB platform"
+	return -1
+    }
+    -re "$gdb_prompt $" {
+	pass $test
+    }
+}
+gdb_test "show disable-randomization"	      \
+         "Disabling randomization .* is off." \
+         "show disable-randomization off"
+
+set addr1 [address_get "randomized first address"]
+set addr2 [address_get "randomized second address"]
+set test "randomized addresses should not match"
+if [string equal $addr1 $addr2] {
+    untested "No randomization detected on this system"
+    return -1
+} else {
+    pass $test
+}
+
+gdb_test "set disable-randomization on"
+gdb_test "show disable-randomization"	      \
+         "Disabling randomization .* is on." \
+         "show disable-randomization on"
+
+set addr1 [address_get "fixed first address"]
+set addr2 [address_get "fixed second address"]
+set test "fixed addresses should match"
+if [string equal $addr1 $addr2] {
+    pass $test
+} else {
+    fail $test
+}
diff --git a/gdb/testsuite/gdb.base/sigchld.c b/gdb/testsuite/gdb.base/sigchld.c
new file mode 100644
index 0000000..7cee041
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigchld.c
@@ -0,0 +1,37 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2008 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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+/* Check that GDB isn't messing the SIGCHLD mask while creating an
+   inferior.  */
+
+#include <signal.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+  sigset_t mask;
+
+  sigemptyset (&mask);
+  sigprocmask (SIG_BLOCK, NULL, &mask);
+
+  if (!sigismember (&mask, SIGCHLD))
+    return 0; /* good, not blocked */
+  else
+    return 1; /* bad, blocked */
+}
diff --git a/gdb/testsuite/gdb.base/sigchld.exp b/gdb/testsuite/gdb.base/sigchld.exp
new file mode 100644
index 0000000..3151b29
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigchld.exp
@@ -0,0 +1,45 @@
+# Copyright (C) 2008 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# Check that GDB isn't messing the SIGCHLD mask while creating an
+# inferior.
+
+if [target_info exists gdb,nosignals] {
+    verbose "Skipping sigchld.exp because of nosignals."
+    continue
+}
+
+set testfile "sigchld"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+runto_main
+
+gdb_test "b [gdb_get_line_number "good, not blocked"]" \
+         ".*Breakpoint .*sigchld.*" "set breakpoint at success exit"
+
+gdb_test "b [gdb_get_line_number "bad, blocked"]" \
+         ".*Breakpoint .*sigchld.*" "set breakpoint at failure exit"
+
+gdb_test "continue" ".*good, not blocked.*" "SIGCHLD blocked in inferior"
diff --git a/gdb/testsuite/gdb.base/value-double-free.c b/gdb/testsuite/gdb.base/value-double-free.c
new file mode 100644
index 0000000..46ca150
--- /dev/null
+++ b/gdb/testsuite/gdb.base/value-double-free.c
@@ -0,0 +1,36 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2008 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 3 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, see <http://www.gnu.org/licenses/>.
+
+   Please email any bugs, comments, and/or additions to this file to:
+   bug-gdb@prep.ai.mit.edu  */
+
+volatile int var;
+
+void
+empty (void)
+{
+}
+
+int
+main (void)
+{
+  var = 1;
+  /* Workaround PR 38: We may miss the first watchpoint hit as we stop on the
+     exact instruction which would cause the watchpoint hit.  */
+  var = 2;
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.base/value-double-free.exp b/gdb/testsuite/gdb.base/value-double-free.exp
new file mode 100644
index 0000000..8494f53
--- /dev/null
+++ b/gdb/testsuite/gdb.base/value-double-free.exp
@@ -0,0 +1,38 @@
+# Copyright 2008 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 3 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, see <http://www.gnu.org/licenses/>.
+
+set testfile value-double-free
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+    untested "Couldn't compile test program"
+    return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] {
+    return -1
+}
+gdb_test "watch var" "atchpoint \[0-9\]+: var"
+gdb_test "continue" "atchpoint \[0-9\]+: var.*Old value = 0.*New value = \[12\].*"
+gdb_test "print empty()" " = void"
+# We did segfault here.
+gdb_test "help help"
diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc
index 8aba5c3..9a34309 100644
--- a/gdb/testsuite/gdb.cp/class2.cc
+++ b/gdb/testsuite/gdb.cp/class2.cc
@@ -41,6 +41,12 @@
   b2 = 902;
 }
 
+struct C : public B
+{
+  A *c1;
+  A *c2;
+};
+
 // Stop the compiler from optimizing away data.
 void refer (A *)
 {
@@ -57,16 +63,19 @@
 
 int main (void)
 {
-  A alpha, *aap, *abp;
+  A alpha, *aap, *abp, *acp;
   B beta, *bbp;
+  C gamma;
   empty e;
 
   alpha.a1 = 100;
   beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
+  gamma.c1 = 0; gamma.c2 = (A *) ~0UL;
 
   aap = &alpha; refer (aap);
   abp = &beta;  refer (abp);
   bbp = &beta;  refer (bbp);
+  acp = &gamma; refer (acp);
   refer (&e);
 
   return 0;  // marker return 0
diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp
index 4ae0947..3d8bf12 100644
--- a/gdb/testsuite/gdb.cp/class2.exp
+++ b/gdb/testsuite/gdb.cp/class2.exp
@@ -117,3 +117,10 @@
 # Printing the value of an object containing no data fields:
 
 gdb_test "p e" "= \{<No data fields>\}" "print object with no data fields"
+
+# Printing NULL pointers with "set print object on"
+
+gdb_test "set print object on" ""
+gdb_test "p acp" "= \\(C \\*\\) ${hex}"
+gdb_test "p acp->c1" "\\(A \\*\\) 0x0"
+gdb_test "p acp->c2" "\\(A \\*\\) ${hex}f"
diff --git a/gdb/testsuite/gdb.mi/basics.c b/gdb/testsuite/gdb.mi/basics.c
index e4be7b2..43e1816 100644
--- a/gdb/testsuite/gdb.mi/basics.c
+++ b/gdb/testsuite/gdb.mi/basics.c
@@ -21,6 +21,7 @@
  */
 
 #include <stdio.h>
+#include <unistd.h>
 
 int callee4 (void)
 {
@@ -61,6 +62,7 @@
   callee1 (2, "A string argument.", 3.5);
   callee1 (2, "A string argument.", 3.5);
 
+  sleep (1);
   printf ("Hello, World!");
 
   callme (1);
@@ -68,10 +70,3 @@
 
   return 0;
 }
-
-/*
-Local variables: 
-change-log-default-name: "ChangeLog-mi"
-End: 
-*/
-
diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp
index d2e3b47..9ac91fd 100644
--- a/gdb/testsuite/gdb.mi/mi-async.exp
+++ b/gdb/testsuite/gdb.mi/mi-async.exp
@@ -59,72 +59,18 @@
     set line_main_body     [expr $line_main_head + 2]
     set line_main_next     [expr $line_main_head + 3]
 
-    send_gdb "start\n"
-    gdb_expect {
-	-re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" {
-	    gdb_expect {
-		-re "\\*stopped,thread-id=\"0|1\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
-		    pass "Asynchronous response after start command"
-		}
-		-re ".*$mi_gdb_prompt$" {
-		    fail "Asynchronous response after start command (2)"
-		}
-		timeout	{
-		    fail "Asynchronous response after start command (timeout 2)"
-		}
-	    }
-	}
-	-re ".*$mi_gdb_prompt$" {
-	    fail "Asynchronous response after start command (1)"
-	}
-	timeout {fail "Asynchronous response after start command (timeout 1)"}
-    }
+    mi_send_resuming_command_raw "start" "start: send"
+    mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop"
 
-    send_gdb "next\n"
-    gdb_expect {
-	-re "\\^running\r\n\\^done\r\n$mi_gdb_prompt" {
-	    gdb_expect {
-		-re "\\*stopped,reason=\"end-stepping-range\",thread-id=\"0|1\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_next\"\}\r\n$mi_gdb_prompt$" {
-		    pass "Asynchronous response after next command"
-		}
-		-re ".*$mi_gdb_prompt$" {
-		    fail "Asynchronous response after next command (2)"
-		}
-		timeout {
-		    fail "Asynchronous response after next command (timeout 2)"
-		}
-	    }
-	}
-	-re ".*$mi_gdb_prompt$" {
-	    fail "Asynchronous response after next command (1)"
-	}
-	timeout {fail "Asynchronous response after next command (timeout 1)"}
-    }
+    mi_send_resuming_command_raw "next" "CLI next: send"
+    mi_expect_stop "end-stepping-range" "main" "" ".*basics.c" "$line_main_next" "" "CLI next: stop"
 
     mi_gdb_test "-exec-interrupt" \
 	"" \
 	""
 
-    send_gdb "start\n"
-    gdb_expect {
-	-re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" {
-	    gdb_expect {
-		-re "\\*stopped,thread-id=\"0|1\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
-		    pass "Asynchronous response after (re) start"
-		}
-		-re ".*$mi_gdb_prompt$" {
-		    fail "Asynchronous response after (re) start (2)"
-		}
-		timeout	{
-		    fail "Asynchronous response after (re) start (timeout 2)"
-		}
-	    }
-	}
-	-re ".*$mi_gdb_prompt$" {
-	    fail "Asynchronous response after (re) start (1)"
-	}
-	timeout {fail "Asynchronous response after (re) start (timeout 1)"}
-    }
+    mi_send_resuming_command_raw "start" "restart: send"
+    mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "restart: stop"
 }
 
 
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index f2f5b03..2776fda 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -158,17 +158,8 @@
 
     mi_run_cmd
 
-    gdb_expect {
-        -re ".*func=\"callme\".*args=\\\[\{name=\"i\",value=\"2\"\}\\\].*\r\n$mi_gdb_prompt$" {
-            pass "run to breakpoint with ignore count"
-        }
-        -re ".*$mi_gdb_prompt$" {
-            fail "run to breakpoint with ignore count"
-        }
-        timeout {
-            fail "run to breakpoint with ignore count (timeout)"
-        }
-    }  
+    mi_expect_stop "breakpoint-hit" "callme" "\{name=\"i\",value=\"2\"\}" ".*basics.c" "52" \
+        {"" "disp=\"keep\"" } "run to breakpoint with ignore count"
 }
 
 proc test_error {} {
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index c488449..37c484b 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -96,7 +96,7 @@
   ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
   "-interpreter-exec console \"list\""
 
-mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "27" \
+mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "28" \
     { "" "disp=\"keep\"" } "continue to callee4"
 
 # NOTE: cagney/2003-02-03: Not yet.
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
index 7d093dc..70d9342 100644
--- a/gdb/testsuite/gdb.mi/mi-console.exp
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
@@ -52,7 +52,7 @@
 
 # Next over the hello() call which will produce lots of output
 mi_gdb_test "220-exec-next" \
-	    "220\\^running" \
+	    "220\\^running(\r\n\\*running,thread-id=\"all\")?" \
 	    "Testing console output" \
 	    "Hello \\\\\"!\[\r\n\]+"
 
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 2f2ca02..59b8e44 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -46,7 +46,7 @@
 # Call foo() by hand, where we'll hit a breakpoint.
 #
 
-mi_gdb_test "401-data-evaluate-expression foo()" "401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"
+mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"
 
 
 mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
@@ -54,13 +54,9 @@
 #
 # Continue back to main()
 #
-mi_gdb_test "403-exec-continue" \
-  "403\\^running" \
-  "testing exec continue"
+mi_send_resuming_command "exec-continue" "testing exec continue"
 
-# Presently, the *stopped notification for this case does not include
-# any information.  This can be considered a bug.
-mi_gdb_test "" "\\*stopped" "finished exec continue"
+mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
   "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
@@ -75,7 +71,7 @@
     "insert breakpoint subroutine"
 
 mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
-  "406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+  ".*406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
   "data evaluate expression"
 
 # We should have both a signal handler and a call dummy frame
@@ -86,9 +82,9 @@
   "list stack frames"
 
 
-mi_gdb_test "408-exec-continue" "408\\^running"
+mi_send_resuming_command "exec-continue" "testing exec continue"
 
-mi_gdb_test "" ".*\\*stopped.*" "finished exec continue"
+mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
   "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
@@ -99,7 +95,7 @@
 # 
 
 mi_gdb_test "410-data-evaluate-expression bar()" \
-  "410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
+  ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
   "call inferior function which raises exception"
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp
index d9e3467..0f5a771 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi2-cli.exp
@@ -96,7 +96,7 @@
   ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
   "-interpreter-exec console \"list\""
 
-mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "27" \
+mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" "28" \
     { "" "disp=\"keep\"" } \
     "continue to callee4"
 
diff --git a/gdb/testsuite/gdb.mi/mi2-console.exp b/gdb/testsuite/gdb.mi/mi2-console.exp
index 88b4fdd..c5f6f81 100644
--- a/gdb/testsuite/gdb.mi/mi2-console.exp
+++ b/gdb/testsuite/gdb.mi/mi2-console.exp
@@ -53,7 +53,7 @@
 # Next over the hello() call which will produce lots of output
 send_gdb "220-exec-next\n"
 gdb_expect {
-    -re "220\\^running\r\n$mi_gdb_prompt" {
+    -re "220\\^running\r\n(\\*running,thread-id=\"all\"\r\n)?$mi_gdb_prompt" {
 	pass "Started step over hello"
     }
     timeout {
diff --git a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
index c447404..948e98d 100644
--- a/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
@@ -48,7 +48,7 @@
 # Call foo() by hand, where we'll hit a breakpoint.
 #
 
-mi_gdb_test "401-data-evaluate-expression foo()" "401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"
+mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"
 
 mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
 
@@ -56,15 +56,9 @@
 # Continue back to main()
 #
 
-send_gdb "403-exec-continue\n"
-gdb_expect {
-  -re "403\\^running\[\r\n\]+${my_mi_gdb_prompt}.*\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
-    pass "403-exec-continue"
-  }
-  timeout {
-    fail "403-exec-continue"
-  }
-}
+mi_send_resuming_command "exec-continue" "testing exec continue"
+
+mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
   "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
@@ -79,7 +73,7 @@
     "insert breakpoint subroutine"
 
 mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
-  "406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+  ".*406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
   "evaluate expression have_a_very_merry_interrupt"
 
 # We should have both a signal handler and a call dummy frame
@@ -89,16 +83,9 @@
   "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" \
   "list stack frames"
 
+mi_send_resuming_command "exec-continue" "testing exec continue"
 
-send_gdb "408-exec-continue\n"
-gdb_expect {
-  -re "408\\^running\[\r\n\]+${my_mi_gdb_prompt}.*\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
-    pass "408-exec-continue"
-  }
-  timeout {
-    fail "408-exec-continue"
-  }
-}
+mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
   "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
@@ -108,7 +95,7 @@
 # Call bar() by hand, which should get an exception while running.
 # 
 
-mi_gdb_test "410-data-evaluate-expression bar()" "410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
+mi_gdb_test "410-data-evaluate-expression bar()" ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 99d69ab9..72081a8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1536,11 +1536,18 @@
     set gdb_wrapper_initialized 1
 }
 
+# Some targets need to always link a special object in.  Save its path here.
+global gdb_saved_set_unbuffered_mode_obj
+set gdb_saved_set_unbuffered_mode_obj ""
+
 proc gdb_compile {source dest type options} {
     global GDB_TESTCASE_OPTIONS;
     global gdb_wrapper_file;
     global gdb_wrapper_flags;
     global gdb_wrapper_initialized;
+    global srcdir
+    global objdir
+    global gdb_saved_set_unbuffered_mode_obj
 
     set outdir [file dirname $dest]
 
@@ -1627,6 +1634,44 @@
 	set options [lreplace $options $nowarnings $nowarnings $flag]
     }
 
+    if { $type == "executable" } {
+	if { ([istarget "*-*-mingw*"]
+	      || [istarget "*-*-cygwin*"])} {
+	    # Force output to unbuffered mode, by linking in an object file
+	    # with a global contructor that calls setvbuf.
+	    #
+	    # Compile the special object seperatelly for two reasons:
+	    #  1) Insulate it from $options.
+	    #  2) Avoid compiling it for every gdb_compile invocation,
+	    #  which is time consuming, especially if we're remote
+	    #  host testing.
+	    #
+	    if { $gdb_saved_set_unbuffered_mode_obj == "" } {
+		verbose "compiling gdb_saved_set_unbuffered_obj"
+		set unbuf_src ${srcdir}/lib/set_unbuffered_mode.c
+		set unbuf_obj ${objdir}/set_unbuffered_mode.o
+
+		set result [gdb_compile "${unbuf_src}" "${unbuf_obj}" object {nowarnings}]
+		if { $result != "" } {
+		    return $result
+		}
+
+		set gdb_saved_set_unbuffered_mode_obj ${objdir}/set_unbuffered_mode_saved.o
+		# Link a copy of the output object, because the
+		# original may be automatically deleted.
+		remote_exec host "cp -f $unbuf_obj $gdb_saved_set_unbuffered_mode_obj"
+	    } else {
+		verbose "gdb_saved_set_unbuffered_obj already compiled"
+	    }
+
+	    # Rely on the internal knowledge that the global ctors are ran in
+	    # reverse link order.  In that case, we can use ldflags to
+	    # avoid copying the object file to the host multiple
+	    # times.
+	    lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
+	}
+    }
+
     set result [target_compile $source $dest $type $options];
 
     # Prune uninteresting compiler (and linker) output.
@@ -2732,7 +2777,7 @@
 # Please refer to build_executable for parameter description.
 proc prepare_for_testing { testname executable {sources ""} {options {debug}}} {
 
-    if {[build_executable $testname $executable $sources] == -1} {
+    if {[build_executable $testname $executable $sources $options] == -1} {
         return -1
     }
     clean_restart $executable
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 6a52c88..d32d373 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -227,6 +227,8 @@
     	}
     }
 
+    detect_async
+
     return 0;
 }
 
@@ -800,7 +802,7 @@
 	if [target_info exists gdb,do_reload_on_run] {
 	    send_gdb "220-exec-continue\n";
 	    gdb_expect 60 {
-		-re "220\\^running\[\r\n\]+$mi_gdb_prompt$" {}
+		-re "220\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt$" {}
 		default {}
 	    }
 	    return;
@@ -821,7 +823,7 @@
 
     send_gdb "220-exec-run $args\n"
     gdb_expect {
-	-re "220\\^running\r\n(=thread-created,id=\"1\"\r\n)?${mi_gdb_prompt}" {
+	-re "220\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\"\r\n)*${mi_gdb_prompt}" {
 	}
 	timeout {
 	    perror "Unable to start target"
@@ -911,6 +913,28 @@
   return [mi_step_to {.*} {.*} {.*} {.*} $test]
 }
 
+set async "unknown"
+
+proc detect_async {} {
+    global async
+    global mi_gdb_prompt
+
+    send_gdb "maint show linux-async\n"
+        
+    gdb_expect {
+        -re ".*Controlling the GNU/Linux inferior in asynchronous mode is on...*$mi_gdb_prompt$" {
+            set async 1
+        }
+        -re ".*$mi_gdb_prompt$" {
+            set async 0
+        }
+        timeout {
+            set async 0
+        }
+    }
+    return $async
+}
+
 # Wait for MI *stopped notification to appear.
 # The REASON, FUNC, ARGS, FILE and LINE are regular expressions
 # to match against whatever is output in *stopped.  ARGS should
@@ -933,6 +957,7 @@
     global hex
     global decimal
     global fullname_syntax
+    global async
 
     set after_stopped ""
     set after_reason ""
@@ -944,10 +969,28 @@
         set after_stopped [lindex $extra 0]
     }
 
+    if {$async} {
+        set prompt_re ""
+    } else {
+        set prompt_re "$mi_gdb_prompt"
+    }
+
+    if { $reason == "really-no-reason" } {
+        gdb_expect {
+          -re "\\*stopped\r\n$prompt_re$" {
+            pass "$test"
+          }
+          timeout {
+              fail "$test (unknown output after running)"
+          }
+        }
+        return
+    }
+    
     if { $reason == "exited-normally" } {
 
         gdb_expect {
-          -re "\\*stopped,reason=\"exited-normally\"\r\n$mi_gdb_prompt$" {
+          -re "\\*stopped,reason=\"exited-normally\"\r\n$prompt_re$" {
             pass "$test"
           }
           -re ".*$mi_gdb_prompt$" {fail "continue to end (2)"}
@@ -973,17 +1016,17 @@
 
     set a $after_reason
 
-    verbose -log "mi_expect_stop: expecting: .*\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped\r\n$mi_gdb_prompt$"
+    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=.*,frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped\r\n$prompt_re$"
     gdb_expect {
-	-re ".*\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped\r\n$mi_gdb_prompt$" {
+	-re "\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=.*,frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped\r\n$prompt_re$" {
 	    pass "$test"
             return $expect_out(2,string)
 	}
-	-re ".*\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
+	-re "\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",stopped-threads=.*,frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$prompt_re$" {
 	    fail "$test (stopped at wrong place)"
 	    return -1
 	}
-	-re ".*\r\n${mi_gdb_prompt}$" {
+	-re ".*\r\n$mi_gdb_prompt$" {
 	    fail "$test (unknown output after running)"
 	    return -1
 	}
@@ -1348,18 +1391,27 @@
 # Send COMMAND that must be a command that resumes
 # the inferiour (run/continue/next/etc) and consumes
 # the "^running" output from it.
-proc mi_send_resuming_command {command test} {
+proc mi_send_resuming_command_raw {command test} {
 
     global mi_gdb_prompt
 
-    send_gdb "220-$command\n"
+    send_gdb "$command\n"
     gdb_expect {
-        -re "220\\^running\r\n${mi_gdb_prompt}" {
+        -re "\\^running\r\n\\*running,thread-id=\"\[^\"\]+\"\r\n${mi_gdb_prompt}" {
+            # Note that lack of 'pass' call here -- this works around limitation
+            # in DejaGNU xfail mechanism. mi-until.exp has this:
+            #
+            #     setup_kfail gdb/2104 "*-*-*"
+            #     mi_execute_to ...
+            # 
+            # and mi_execute_to uses mi_send_resuming_command.  If we use 'pass' here,
+            # it will reset kfail, so when the actual test fails, it will be flagged
+            # as real failure.
         }
         -re ".*${mi_gdb_prompt}" {
             fail "$test (failed to resume)"
         }
-        -re "220\\^error,msg=.*" {
+        -re "\\^error,msg=.*" {
             fail "$test (MI error)"
             return -1
         }
@@ -1370,6 +1422,10 @@
     }
 }
 
+proc mi_send_resuming_command {command test} {
+    mi_send_resuming_command_raw -$command $test
+}
+
 # Helper to mi_run_inline_test below.
 # Sets a temporary breakpoint at LOCATION and runs
 # the program using COMMAND.  When the program is stopped
@@ -1388,9 +1444,16 @@
 proc mi_get_stop_line {test} {
 
   global mi_gdb_prompt
+  global async
+
+  if {$async} {
+      set prompt_re ""
+  } else {
+      set prompt_re "$mi_gdb_prompt"
+  }
 
   gdb_expect {
-      -re ".*line=\"(.*)\".*\r\n$mi_gdb_prompt$" {
+      -re ".*line=\"(.*)\".*\r\n$prompt_re$" {
           return $expect_out(1,string)
       }
       -re ".*$mi_gdb_prompt$" {
diff --git a/gdb/testsuite/lib/set_unbuffered_mode.c b/gdb/testsuite/lib/set_unbuffered_mode.c
new file mode 100644
index 0000000..aa91801
--- /dev/null
+++ b/gdb/testsuite/lib/set_unbuffered_mode.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* Force outputs to unbuffered mode.  */
+
+#include <stdio.h>
+
+static int __gdb_set_unbuffered_output (void) __attribute__ ((constructor));
+static int
+__gdb_set_unbuffered_output (void)
+{
+  setvbuf (stdout, NULL, _IONBF, BUFSIZ);
+  setvbuf (stderr, NULL, _IONBF, BUFSIZ);
+}
diff --git a/gdb/thread.c b/gdb/thread.c
index 446a55e..0767aa0 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -41,6 +41,7 @@
 #include "ui-out.h"
 #include "observer.h"
 #include "annotate.h"
+#include "cli/cli-decode.h"
 
 /* Definition of struct thread_info exported to gdbthread.h */
 
@@ -53,8 +54,6 @@
 static struct thread_info *thread_list = NULL;
 static int highest_thread_num;
 
-static struct thread_info *find_thread_id (int num);
-
 static void thread_command (char *tidstr, int from_tty);
 static void thread_apply_all_command (char *, int);
 static int thread_alive (struct thread_info *);
@@ -63,6 +62,18 @@
 static void restore_current_thread (ptid_t);
 static void prune_threads (void);
 
+/* Frontend view of the thread state.  Possible extensions: stepping,
+   finishing, until(ling),...  */
+enum thread_state
+{
+  THREAD_STOPPED,
+  THREAD_RUNNING,
+  THREAD_EXITED,
+};
+
+static enum thread_state main_thread_state = THREAD_STOPPED;
+static int main_thread_executing = 0;
+
 void
 delete_step_resume_breakpoint (void *arg)
 {
@@ -81,14 +92,25 @@
 }
 
 static void
-free_thread (struct thread_info *tp)
+clear_thread_inferior_resources (struct thread_info *tp)
 {
   /* NOTE: this will take care of any left-over step_resume breakpoints,
      but not any user-specified thread-specific breakpoints.  We can not
      delete the breakpoint straight-off, because the inferior might not
      be stopped at the moment.  */
   if (tp->step_resume_breakpoint)
-    tp->step_resume_breakpoint->disposition = disp_del_at_next_stop;
+    {
+      tp->step_resume_breakpoint->disposition = disp_del_at_next_stop;
+      tp->step_resume_breakpoint = NULL;
+    }
+
+  bpstat_clear (&tp->stop_bpstat);
+}
+
+static void
+free_thread (struct thread_info *tp)
+{
+  clear_thread_inferior_resources (tp);
 
   /* FIXME: do I ever need to call the back-end to give it a
      chance at this private data before deleting the thread?  */
@@ -104,6 +126,9 @@
   struct thread_info *tp, *tpnext;
 
   highest_thread_num = 0;
+  main_thread_state = THREAD_STOPPED;
+  main_thread_executing = 0;
+
   if (!thread_list)
     return;
 
@@ -121,6 +146,49 @@
 {
   struct thread_info *tp;
 
+  tp = find_thread_pid (ptid);
+  if (tp)
+    /* Found an old thread with the same id.  It has to be dead,
+       otherwise we wouldn't be adding a new thread with the same id.
+       The OS is reusing this id --- delete it, and recreate a new
+       one.  */
+    {
+      /* In addition to deleting the thread, if this is the current
+	 thread, then we need to also get rid of the current infrun
+	 context, and take care that delete_thread doesn't really
+	 delete the thread if it is inferior_ptid.  Create a new
+	 template thread in the list with an invalid ptid, context
+	 switch to it, delete the original thread, reset the new
+	 thread's ptid, and switch to it.  */
+
+      if (ptid_equal (inferior_ptid, ptid))
+	{
+	  tp = xmalloc (sizeof (*tp));
+	  memset (tp, 0, sizeof (*tp));
+	  tp->ptid = minus_one_ptid;
+	  tp->num = ++highest_thread_num;
+	  tp->next = thread_list;
+	  thread_list = tp;
+	  context_switch_to (minus_one_ptid);
+
+	  /* Now we can delete it.  */
+	  delete_thread (ptid);
+
+	  /* Since the context is already set to this new thread,
+	     reset its ptid, and reswitch inferior_ptid to it.  */
+	  tp->ptid = ptid;
+	  switch_to_thread (ptid);
+
+	  observer_notify_new_thread (tp);
+
+	  /* All done.  */
+	  return tp;
+	}
+      else
+	/* Just go ahead and delete it.  */
+	delete_thread (ptid);
+    }
+
   tp = (struct thread_info *) xmalloc (sizeof (*tp));
   memset (tp, 0, sizeof (*tp));
   tp->ptid = ptid;
@@ -153,8 +221,10 @@
   return add_thread_with_info (ptid, NULL);
 }
 
-void
-delete_thread (ptid_t ptid)
+/* Delete thread PTID.  If SILENT, don't notify the observer of this
+   exit.  */
+static void
+delete_thread_1 (ptid_t ptid, int silent)
 {
   struct thread_info *tp, *tpprev;
 
@@ -167,17 +237,57 @@
   if (!tp)
     return;
 
+  /* If this is the current thread, or there's code out there that
+     relies on it existing (refcount > 0) we can't delete yet.  Mark
+     it as exited, and notify it.  */
+  if (tp->refcount > 0
+      || ptid_equal (tp->ptid, inferior_ptid))
+    {
+      if (tp->state_ != THREAD_EXITED)
+	{
+	  if (!silent)
+	    observer_notify_thread_exit (tp);
+
+	  /* Tag it as exited.  */
+	  tp->state_ = THREAD_EXITED;
+
+	  /* Clear breakpoints, etc. associated with this thread.  */
+	  clear_thread_inferior_resources (tp);
+	}
+
+       /* Will be really deleted some other time.  */
+       return;
+     }
+
   if (tpprev)
     tpprev->next = tp->next;
   else
     thread_list = tp->next;
 
-  observer_notify_thread_exit (tp);
+  /* Notify thread exit, but only if we haven't already.  */
+  if (!silent && tp->state_ != THREAD_EXITED)
+    observer_notify_thread_exit (tp);
 
   free_thread (tp);
 }
 
-static struct thread_info *
+/* Delete thread PTID and notify of thread exit.  If this is
+   inferior_ptid, don't actually delete it, but tag it as exited and
+   do the notification.  If PTID is the user selected thread, clear
+   it.  */
+void
+delete_thread (ptid_t ptid)
+{
+  delete_thread_1 (ptid, 0 /* not silent */);
+}
+
+void
+delete_thread_silent (ptid_t ptid)
+{
+  delete_thread_1 (ptid, 1 /* silent */);
+}
+
+struct thread_info *
 find_thread_id (int num)
 {
   struct thread_info *tp;
@@ -220,13 +330,28 @@
 iterate_over_threads (int (*callback) (struct thread_info *, void *),
 		      void *data)
 {
+  struct thread_info *tp, *next;
+
+  for (tp = thread_list; tp; tp = next)
+    {
+      next = tp->next;
+      if ((*callback) (tp, data))
+	return tp;
+    }
+
+  return NULL;
+}
+
+int
+thread_count (void)
+{
+  int result = 0;
   struct thread_info *tp;
 
   for (tp = thread_list; tp; tp = tp->next)
-    if ((*callback) (tp, data))
-      return tp;
+    ++result;
 
-  return NULL;
+  return result;  
 }
 
 int
@@ -291,6 +416,8 @@
 
   for (tp = thread_list; tp; tp = tp->next)
     {
+      if (tp->state_ == THREAD_EXITED)
+	continue;
       num++;
       ui_out_field_int (uiout, "thread-id", tp->num);
     }
@@ -325,7 +452,15 @@
 		   int *stepping_through_solib_after_catch,
 		   bpstat *stepping_through_solib_catchpoints,
 		   int *current_line,
-		   struct symtab **current_symtab)
+		   struct symtab **current_symtab,
+		   struct continuation **continuations,
+		   struct continuation **intermediate_continuations,
+		   int *proceed_to_finish,
+		   enum step_over_calls_kind *step_over_calls,
+		   int *stop_step,
+		   int *step_multi,
+		   enum target_signal *stop_signal,
+		   bpstat *stop_bpstat)
 {
   struct thread_info *tp;
 
@@ -348,6 +483,26 @@
     tp->stepping_through_solib_catchpoints;
   *current_line = tp->current_line;
   *current_symtab = tp->current_symtab;
+
+  /* In all-stop mode, these are global state, while in non-stop mode,
+     they are per thread.  */
+  if (non_stop)
+    {
+      *continuations = tp->continuations;
+      tp->continuations = NULL;
+      *intermediate_continuations = tp->intermediate_continuations;
+      tp->intermediate_continuations = NULL;
+      *proceed_to_finish = tp->proceed_to_finish;
+      *step_over_calls = tp->step_over_calls;
+      *stop_step = tp->stop_step;
+      *step_multi = tp->step_multi;
+      *stop_signal = tp->stop_signal;
+
+      /* Swap instead of copy, so we only have to update one of
+	 them.  */
+      *stop_bpstat = tp->stop_bpstat;
+      tp->stop_bpstat = 0;
+    }
 }
 
 /* Save infrun state for the thread PID.  */
@@ -364,7 +519,15 @@
 		   int stepping_through_solib_after_catch,
 		   bpstat stepping_through_solib_catchpoints,
 		   int current_line,
-		   struct symtab *current_symtab)
+		   struct symtab *current_symtab,
+		   struct continuation *continuations,
+		   struct continuation *intermediate_continuations,
+		   int proceed_to_finish,
+		   enum step_over_calls_kind step_over_calls,
+		   int stop_step,
+		   int step_multi,
+		   enum target_signal stop_signal,
+		   bpstat stop_bpstat)
 {
   struct thread_info *tp;
 
@@ -385,19 +548,30 @@
   tp->stepping_through_solib_catchpoints = stepping_through_solib_catchpoints;
   tp->current_line = current_line;
   tp->current_symtab = current_symtab;
+
+  /* In all-stop mode, these are global state, while in non-stop mode,
+     they are per thread.  */
+  if (non_stop)
+    {
+      tp->continuations = continuations;
+      tp->intermediate_continuations = intermediate_continuations;
+      tp->proceed_to_finish = proceed_to_finish;
+      tp->step_over_calls = step_over_calls;
+      tp->stop_step = stop_step;
+      tp->step_multi = step_multi;
+      tp->stop_signal = stop_signal;
+      tp->stop_bpstat = stop_bpstat;
+    }
 }
 
 /* Return true if TP is an active thread. */
 static int
 thread_alive (struct thread_info *tp)
 {
-  if (PIDGET (tp->ptid) == -1)
+  if (tp->state_ == THREAD_EXITED)
     return 0;
   if (!target_thread_alive (tp->ptid))
-    {
-      tp->ptid = pid_to_ptid (-1);	/* Mark it as dead */
-      return 0;
-    }
+    return 0;
   return 1;
 }
 
@@ -414,10 +588,171 @@
     }
 }
 
+void
+set_running (ptid_t ptid, int running)
+{
+  struct thread_info *tp;
+
+  if (!thread_list)
+    {
+      /* This is one of the targets that does not add main
+	 thread to the thread list.  Just use a single
+	 global flag to indicate that a thread is running.  
+
+	 This problem is unique to ST programs.  For MT programs,
+	 the main thread is always present in the thread list.  If it's
+	 not, the first call to context_switch will mess up GDB internal
+	 state.  */
+      if (running
+ 	  && main_thread_state != THREAD_RUNNING
+ 	  && !suppress_resume_observer)
+	observer_notify_target_resumed (ptid);
+      main_thread_state = running ? THREAD_RUNNING : THREAD_STOPPED;
+      return;
+    }
+
+  /* We try not to notify the observer if no thread has actually changed 
+     the running state -- merely to reduce the number of messages to 
+     frontend.  Frontend is supposed to handle multiple *running just fine.  */
+  if (PIDGET (ptid) == -1)
+    {
+      int any_started = 0;
+      for (tp = thread_list; tp; tp = tp->next)
+	{
+ 	  if (tp->state_ == THREAD_EXITED)
+  	    continue;
+  	  if (running && tp->state_ == THREAD_STOPPED)
+  	    any_started = 1;
+ 	  tp->state_ = running ? THREAD_RUNNING : THREAD_STOPPED;
+	}
+      if (any_started && !suppress_resume_observer)
+	observer_notify_target_resumed (ptid);      
+    }
+  else
+    {
+      int started = 0;
+      tp = find_thread_pid (ptid);
+      gdb_assert (tp);
+      gdb_assert (tp->state_ != THREAD_EXITED);
+      if (running && tp->state_ == THREAD_STOPPED)
+ 	started = 1;
+      tp->state_ = running ? THREAD_RUNNING : THREAD_STOPPED;
+      if (started && !suppress_resume_observer)
+  	observer_notify_target_resumed (ptid);
+    }
+}
+
+static int
+is_thread_state (ptid_t ptid, enum thread_state state)
+{
+  struct thread_info *tp;
+
+  if (!target_has_execution)
+    return 0;
+
+  if (!thread_list)
+    return main_thread_state == state;
+
+  tp = find_thread_pid (ptid);
+  gdb_assert (tp);
+  return tp->state_ == state;
+}
+
+int
+is_stopped (ptid_t ptid)
+{
+  /* Without execution, this property is always true.  */
+  if (!target_has_execution)
+    return 1;
+
+  return is_thread_state (ptid, THREAD_STOPPED);
+}
+
+int
+is_exited (ptid_t ptid)
+{
+  /* Without execution, this property is always false.  */
+  if (!target_has_execution)
+    return 0;
+
+  return is_thread_state (ptid, THREAD_EXITED);
+}
+
+int
+is_running (ptid_t ptid)
+{
+   /* Without execution, this property is always false.  */
+  if (!target_has_execution)
+    return 0;
+
+  return is_thread_state (ptid, THREAD_RUNNING);
+}
+
+int
+any_running (void)
+{
+  struct thread_info *tp;
+
+  if (!target_has_execution)
+    return 0;
+
+  if (!thread_list)
+    return main_thread_state == THREAD_RUNNING;
+
+  for (tp = thread_list; tp; tp = tp->next)
+    if (tp->state_ == THREAD_RUNNING)
+      return 1;
+
+  return 0;
+}
+
+int
+is_executing (ptid_t ptid)
+{
+  struct thread_info *tp;
+
+  if (!target_has_execution)
+    return 0;
+
+  if (!thread_list)
+    return main_thread_executing;
+
+  tp = find_thread_pid (ptid);
+  gdb_assert (tp);
+  return tp->executing_;
+}
+
+void
+set_executing (ptid_t ptid, int executing)
+{
+  struct thread_info *tp;
+
+  if (!thread_list)
+    {
+      /* This target does not add the main thread to the thread list.
+	 Use a global flag to indicate that the thread is
+	 executing.  */
+      main_thread_executing = executing;
+      return;
+    }
+
+  if (PIDGET (ptid) == -1)
+    {
+      for (tp = thread_list; tp; tp = tp->next)
+	tp->executing_ = executing;
+    }
+  else
+    {
+      tp = find_thread_pid (ptid);
+      gdb_assert (tp);
+      tp->executing_ = executing;
+    }
+}
+
 /* Prints the list of threads and their details on UIOUT.
    This is a version of 'info_thread_command' suitable for
    use from MI.  
-   If REQESTED_THREAD is not -1, it's the GDB id of the thread
+   If REQUESTED_THREAD is not -1, it's the GDB id of the thread
    that should be printed.  Otherwise, all threads are
    printed.  */
 void
@@ -425,21 +760,18 @@
 {
   struct thread_info *tp;
   ptid_t current_ptid;
-  struct frame_info *cur_frame;
   struct cleanup *old_chain;
-  struct frame_id saved_frame_id;
   char *extra_info;
   int current_thread = -1;
 
-  /* Backup current thread and selected frame.  */
-  saved_frame_id = get_frame_id (get_selected_frame (NULL));
-  old_chain = make_cleanup_restore_current_thread (inferior_ptid, saved_frame_id);
-
-  make_cleanup_ui_out_list_begin_end (uiout, "threads");
-
   prune_threads ();
   target_find_new_threads ();
   current_ptid = inferior_ptid;
+
+  /* We'll be switching threads temporarily.  */
+  old_chain = make_cleanup_restore_current_thread ();
+
+  make_cleanup_ui_out_list_begin_end (uiout, "threads");
   for (tp = thread_list; tp; tp = tp->next)
     {
       struct cleanup *chain2;
@@ -447,13 +779,16 @@
       if (requested_thread != -1 && tp->num != requested_thread)
 	continue;
 
+      if (ptid_equal (tp->ptid, current_ptid))
+	current_thread = tp->num;
+
+      if (tp->state_ == THREAD_EXITED)
+	continue;
+
       chain2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 
       if (ptid_equal (tp->ptid, current_ptid))
-	{
-	  current_thread = tp->num;
-	  ui_out_text (uiout, "* ");
-	}
+	ui_out_text (uiout, "* ");
       else
 	ui_out_text (uiout, "  ");
 
@@ -461,20 +796,40 @@
       ui_out_text (uiout, " ");
       ui_out_field_string (uiout, "target-id", target_tid_to_str (tp->ptid));
 
-      extra_info = target_extra_thread_info (tp);
-      if (extra_info)
+      if (tp->state_ != THREAD_EXITED)
 	{
-	  ui_out_text (uiout, " (");
-	  ui_out_field_string (uiout, "details", extra_info);
-	  ui_out_text (uiout, ")");
+	  extra_info = target_extra_thread_info (tp);
+	  if (extra_info)
+	    {
+	      ui_out_text (uiout, " (");
+	      ui_out_field_string (uiout, "details", extra_info);
+	      ui_out_text (uiout, ")");
+	    }
+	  ui_out_text (uiout, "  ");
 	}
-      ui_out_text (uiout, "  ");
-      /* That switch put us at the top of the stack (leaf frame).  */
-      switch_to_thread (tp->ptid);
-      print_stack_frame (get_selected_frame (NULL), 
-			 /* For MI output, print frame level.  */
-			 ui_out_is_mi_like_p (uiout),
-			 LOCATION);
+
+      if (tp->state_ == THREAD_RUNNING)
+	ui_out_text (uiout, "(running)\n");
+      else
+	{
+	  /* The switch below puts us at the top of the stack (leaf
+	     frame).  */
+	  switch_to_thread (tp->ptid);
+	  print_stack_frame (get_selected_frame (NULL),
+			     /* For MI output, print frame level.  */
+			     ui_out_is_mi_like_p (uiout),
+			     LOCATION);
+	}
+
+      if (ui_out_is_mi_like_p (uiout))
+	{
+	  char *state = "stopped";
+	  if (tp->state_ == THREAD_EXITED)
+	    state = "exited";
+	  else if (tp->state_ == THREAD_RUNNING)
+	    state = "running";
+	  ui_out_field_string (uiout, "state", state);
+	}
 
       do_cleanups (chain2);
     }
@@ -485,21 +840,15 @@
 
   if (requested_thread == -1)
     {
-      gdb_assert (current_thread != -1 || !thread_list);
+      gdb_assert (current_thread != -1
+		  || !thread_list);
       if (current_thread != -1 && ui_out_is_mi_like_p (uiout))
 	ui_out_field_int (uiout, "current-thread-id", current_thread);
-    }
 
-  /*  If case we were not able to find the original frame, print the
-      new selected frame.  */
-  if (frame_find_by_id (saved_frame_id) == NULL)
-    {
-      warning (_("Couldn't restore frame in current thread, at frame 0"));
-      /* For MI, we should probably have a notification about
-	 current frame change.  But this error is not very likely, so
-	 don't bother for now.  */
-      if (!ui_out_is_mi_like_p (uiout))
-	print_stack_frame (get_selected_frame (NULL), 0, LOCATION);
+      if (current_thread != -1 && is_exited (current_ptid))
+	ui_out_message (uiout, 0, "\n\
+The current thread <Thread ID %d> has terminated.  See `help thread'.\n",
+			current_thread);
     }
 }
 
@@ -528,7 +877,14 @@
   inferior_ptid = ptid;
   reinit_frame_cache ();
   registers_changed ();
-  stop_pc = read_pc ();
+
+  /* We don't check for is_stopped, because we're called at times
+     while in the TARGET_RUNNING state, e.g., while handling an
+     internal event.  */
+  if (!is_exited (ptid) && !is_executing (ptid))
+    stop_pc = read_pc ();
+  else
+    stop_pc = ~(CORE_ADDR) 0;
 }
 
 static void
@@ -536,21 +892,66 @@
 {
   if (!ptid_equal (ptid, inferior_ptid))
     {
-      switch_to_thread (ptid);
+      if (non_stop)
+	context_switch_to (ptid);
+      else
+	switch_to_thread (ptid);
     }
 }
 
 static void
-restore_selected_frame (struct frame_id a_frame_id)
+restore_selected_frame (struct frame_id a_frame_id, int frame_level)
 {
-  struct frame_info *selected_frame_info = NULL;
+  struct frame_info *frame = NULL;
+  int count;
 
-  if (frame_id_eq (a_frame_id, null_frame_id))
-    return;        
+  gdb_assert (frame_level >= 0);
 
-  if ((selected_frame_info = frame_find_by_id (a_frame_id)) != NULL)
+  /* Restore by level first, check if the frame id is the same as
+     expected.  If that fails, try restoring by frame id.  If that
+     fails, nothing to do, just warn the user.  */
+
+  count = frame_level;
+  frame = find_relative_frame (get_current_frame (), &count);
+  if (count == 0
+      && frame != NULL
+      /* Either the frame ids match, of they're both invalid.  The
+	 latter case is not failsafe, but since it's highly unlikely
+	 the search by level finds the wrong frame, it's 99.9(9)% of
+	 the time (for all practical purposes) safe.  */
+      && (frame_id_eq (get_frame_id (frame), a_frame_id)
+	  /* Note: could be better to check every frame_id
+	     member for equality here.  */
+	  || (!frame_id_p (get_frame_id (frame))
+	      && !frame_id_p (a_frame_id))))
     {
-      select_frame (selected_frame_info);
+      /* Cool, all is fine.  */
+      select_frame (frame);
+      return;
+    }
+
+  frame = frame_find_by_id (a_frame_id);
+  if (frame != NULL)
+    {
+      /* Cool, refound it.  */
+      select_frame (frame);
+      return;
+    }
+
+  /* Nothing else to do, the frame layout really changed.  Select the
+     innermost stack frame.  */
+  select_frame (get_current_frame ());
+
+  /* Warn the user.  */
+  if (!ui_out_is_mi_like_p (uiout))
+    {
+      warning (_("\
+Couldn't restore frame #%d in current thread, at reparsed frame #0\n"),
+	       frame_level);
+      /* For MI, we should probably have a notification about
+	 current frame change.  But this error is not very
+	 likely, so don't bother for now.  */
+      print_stack_frame (get_selected_frame (NULL), 1, SRC_LINE);
     }
 }
 
@@ -558,26 +959,66 @@
 {
   ptid_t inferior_ptid;
   struct frame_id selected_frame_id;
+  int selected_frame_level;
+  int was_stopped;
 };
 
 static void
 do_restore_current_thread_cleanup (void *arg)
 {
+  struct thread_info *tp;
   struct current_thread_cleanup *old = arg;
   restore_current_thread (old->inferior_ptid);
-  restore_selected_frame (old->selected_frame_id);
+
+  /* The running state of the originally selected thread may have
+     changed, so we have to recheck it here.  */
+  if (old->was_stopped
+      && is_stopped (inferior_ptid)
+      && target_has_registers
+      && target_has_stack
+      && target_has_memory)
+    restore_selected_frame (old->selected_frame_id,
+			    old->selected_frame_level);
+}
+
+static void
+restore_current_thread_cleanup_dtor (void *arg)
+{
+  struct current_thread_cleanup *old = arg;
+  struct thread_info *tp;
+  tp = find_thread_pid (old->inferior_ptid);
+  if (tp)
+    tp->refcount--;
   xfree (old);
 }
 
 struct cleanup *
-make_cleanup_restore_current_thread (ptid_t inferior_ptid, 
-                                     struct frame_id a_frame_id)
+make_cleanup_restore_current_thread (void)
 {
-  struct current_thread_cleanup *old
-    = xmalloc (sizeof (struct current_thread_cleanup));
+  struct thread_info *tp;
+  struct frame_info *frame;
+  struct current_thread_cleanup *old;
+
+  old = xmalloc (sizeof (struct current_thread_cleanup));
   old->inferior_ptid = inferior_ptid;
-  old->selected_frame_id = a_frame_id;
-  return make_cleanup (do_restore_current_thread_cleanup, old);
+  old->was_stopped = is_stopped (inferior_ptid);
+  if (old->was_stopped
+      && target_has_registers
+      && target_has_stack
+      && target_has_memory)
+    frame = get_selected_frame (NULL);
+  else
+    frame = NULL;
+
+  old->selected_frame_id = get_frame_id (frame);
+  old->selected_frame_level = frame_relative_level (frame);
+
+  tp = find_thread_pid (inferior_ptid);
+  if (tp)
+    tp->refcount++;
+
+  return make_cleanup_dtor (do_restore_current_thread_cleanup, old,
+			    restore_current_thread_cleanup_dtor);
 }
 
 /* Apply a GDB command to a list of threads.  List syntax is a whitespace
@@ -594,46 +1035,35 @@
 {
   struct thread_info *tp;
   struct cleanup *old_chain;
-  struct cleanup *saved_cmd_cleanup_chain;
   char *saved_cmd;
-  struct frame_id saved_frame_id;
-  ptid_t current_ptid;
-  int thread_has_changed = 0;
 
   if (cmd == NULL || *cmd == '\000')
     error (_("Please specify a command following the thread ID list"));
-  
-  current_ptid = inferior_ptid;
-  saved_frame_id = get_frame_id (get_selected_frame (NULL));
-  old_chain = make_cleanup_restore_current_thread (inferior_ptid, saved_frame_id);
 
-  /* It is safe to update the thread list now, before
-     traversing it for "thread apply all".  MVS */
+  prune_threads ();
   target_find_new_threads ();
 
+  old_chain = make_cleanup_restore_current_thread ();
+
   /* Save a copy of the command in case it is clobbered by
      execute_command */
   saved_cmd = xstrdup (cmd);
-  saved_cmd_cleanup_chain = make_cleanup (xfree, (void *) saved_cmd);
+  make_cleanup (xfree, saved_cmd);
   for (tp = thread_list; tp; tp = tp->next)
     if (thread_alive (tp))
       {
-	switch_to_thread (tp->ptid);
+	if (non_stop)
+	  context_switch_to (tp->ptid);
+	else
+	  switch_to_thread (tp->ptid);
+
 	printf_filtered (_("\nThread %d (%s):\n"),
 			 tp->num, target_tid_to_str (inferior_ptid));
 	execute_command (cmd, from_tty);
 	strcpy (cmd, saved_cmd);	/* Restore exact command used previously */
       }
 
-  if (!ptid_equal (current_ptid, inferior_ptid))
-    thread_has_changed = 1;
-
-  do_cleanups (saved_cmd_cleanup_chain);
   do_cleanups (old_chain);
-  /* Print stack frame only if we changed thread.  */
-  if (thread_has_changed)
-    print_stack_frame (get_current_frame (), 1, SRC_LINE);
-
 }
 
 static void
@@ -642,11 +1072,7 @@
   char *cmd;
   char *p;
   struct cleanup *old_chain;
-  struct cleanup *saved_cmd_cleanup_chain;
   char *saved_cmd;
-  struct frame_id saved_frame_id;
-  ptid_t current_ptid;
-  int thread_has_changed = 0;
 
   if (tidlist == NULL || *tidlist == '\000')
     error (_("Please specify a thread ID list"));
@@ -656,14 +1082,10 @@
   if (*cmd == '\000')
     error (_("Please specify a command following the thread ID list"));
 
-  current_ptid = inferior_ptid;
-  saved_frame_id = get_frame_id (get_selected_frame (NULL));
-  old_chain = make_cleanup_restore_current_thread (inferior_ptid, saved_frame_id);
-
   /* Save a copy of the command in case it is clobbered by
      execute_command */
   saved_cmd = xstrdup (cmd);
-  saved_cmd_cleanup_chain = make_cleanup (xfree, (void *) saved_cmd);
+  old_chain = make_cleanup (xfree, saved_cmd);
   while (tidlist < cmd)
     {
       struct thread_info *tp;
@@ -691,6 +1113,8 @@
       else
 	end = start;
 
+      make_cleanup_restore_current_thread ();
+
       for (; start <= end; start++)
 	{
 	  tp = find_thread_id (start);
@@ -701,23 +1125,22 @@
 	    warning (_("Thread %d has terminated."), start);
 	  else
 	    {
-	      switch_to_thread (tp->ptid);
+	      if (non_stop)
+		context_switch_to (tp->ptid);
+	      else
+		switch_to_thread (tp->ptid);
+
 	      printf_filtered (_("\nThread %d (%s):\n"), tp->num,
 			       target_tid_to_str (inferior_ptid));
 	      execute_command (cmd, from_tty);
-	      strcpy (cmd, saved_cmd);	/* Restore exact command used previously */
+
+	      /* Restore exact command used previously.  */
+	      strcpy (cmd, saved_cmd);
 	    }
 	}
     }
 
-  if (!ptid_equal (current_ptid, inferior_ptid))
-    thread_has_changed = 1;
-
-  do_cleanups (saved_cmd_cleanup_chain);
   do_cleanups (old_chain);
-  /* Print stack frame only if we changed thread.  */
-  if (thread_has_changed)
-    print_stack_frame (get_current_frame (), 1, SRC_LINE);
 }
 
 /* Switch to the specified thread.  Will dispatch off to thread_apply_command
@@ -728,11 +1151,17 @@
 {
   if (!tidstr)
     {
-      /* Don't generate an error, just say which thread is current. */
       if (target_has_stack)
-	printf_filtered (_("[Current thread is %d (%s)]\n"),
-			 pid_to_thread_id (inferior_ptid),
-			 target_tid_to_str (inferior_ptid));
+	{
+	  if (is_exited (inferior_ptid))
+	    printf_filtered (_("[Current thread is %d (%s) (exited)]\n"),
+			     pid_to_thread_id (inferior_ptid),
+			     target_tid_to_str (inferior_ptid));
+	  else
+	    printf_filtered (_("[Current thread is %d (%s)]\n"),
+			     pid_to_thread_id (inferior_ptid),
+			     target_tid_to_str (inferior_ptid));
+	}
       else
 	error (_("No stack."));
       return;
@@ -769,7 +1198,10 @@
   if (!thread_alive (tp))
     error (_("Thread ID %d has terminated."), num);
 
-  switch_to_thread (tp->ptid);
+  if (non_stop)
+    context_switch_to (tp->ptid);
+  else
+    switch_to_thread (tp->ptid);
 
   ui_out_text (uiout, "[Switching to thread ");
   ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id (inferior_ptid));
@@ -777,7 +1209,17 @@
   ui_out_text (uiout, target_tid_to_str (inferior_ptid));
   ui_out_text (uiout, ")]");
 
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  /* Note that we can't reach this with an exited thread, due to the
+     thread_alive check above.  */
+  if (tp->state_ == THREAD_RUNNING)
+    ui_out_text (uiout, "(running)\n");
+  else
+    print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+
+  /* Since the current thread may have changed, see if there is any
+     exited thread we can now delete.  */
+  prune_threads ();
+
   return GDB_RC_OK;
 }
 
@@ -797,21 +1239,30 @@
 _initialize_thread (void)
 {
   static struct cmd_list_element *thread_apply_list = NULL;
+  struct cmd_list_element *c;
 
-  add_info ("threads", info_threads_command,
-	    _("IDs of currently known threads."));
+  c = add_info ("threads", info_threads_command,
+		_("IDs of currently known threads."));
+  set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
 
-  add_prefix_cmd ("thread", class_run, thread_command, _("\
+  c = add_prefix_cmd ("thread", class_run, thread_command, _("\
 Use this command to switch between threads.\n\
 The new thread ID must be currently known."),
-		  &thread_cmd_list, "thread ", 1, &cmdlist);
+		      &thread_cmd_list, "thread ", 1, &cmdlist);
+  set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
 
-  add_prefix_cmd ("apply", class_run, thread_apply_command,
-		  _("Apply a command to a list of threads."),
-		  &thread_apply_list, "thread apply ", 1, &thread_cmd_list);
+  c = add_prefix_cmd ("apply", class_run, thread_apply_command,
+		      _("Apply a command to a list of threads."),
+		      &thread_apply_list, "thread apply ", 1, &thread_cmd_list);
+  set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
 
-  add_cmd ("all", class_run, thread_apply_all_command,
-	   _("Apply a command to all threads."), &thread_apply_list);
+  c = add_cmd ("all", class_run, thread_apply_all_command,
+	       _("Apply a command to all threads."), &thread_apply_list);
+  set_cmd_async_ok (c);
+  set_cmd_no_selected_thread_ok (c);
 
   if (!xdb_commands)
     add_com_alias ("t", "thread", class_run, 1);
diff --git a/gdb/top.c b/gdb/top.c
index 3041a33..7ef539f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -46,6 +46,7 @@
 #include "gdb_assert.h"
 #include "main.h"
 #include "event-loop.h"
+#include "gdbthread.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -181,12 +182,6 @@
 
 int remote_debug = 0;
 
-/* Non-zero means the target is running. Note: this is different from
-   saying that there is an active target and we are stopped at a
-   breakpoint, for instance. This is a real indicator whether the
-   target is off and running, which gdb is doing something else. */
-int target_executing = 0;
-
 /* Sbrk location on entry to main.  Used for statistics only.  */
 #ifdef HAVE_SBRK
 char *lim_at_start;
@@ -367,6 +362,8 @@
 /* Execute the line P as a command.
    Pass FROM_TTY as second argument to the defining function.  */
 
+/* Execute command P, in the current user context.  */
+
 void
 execute_command (char *p, int from_tty)
 {
@@ -374,8 +371,6 @@
   enum language flang;
   static int warned = 0;
   char *line;
-  struct continuation_arg *arg1;
-  struct continuation_arg *arg2;
   long time_at_cmd_start = 0;
 #ifdef HAVE_SBRK
   long space_at_cmd_start = 0;
@@ -420,10 +415,13 @@
 
       c = lookup_cmd (&p, cmdlist, "", 0, 1);
 
-      /* If the target is running, we allow only a limited set of
-         commands. */
-      if (target_can_async_p () && target_executing && !get_cmd_async_ok (c))
-	error (_("Cannot execute this command while the target is running."));
+      /* If the selected thread has terminated, we allow only a
+	 limited set of commands.  */
+      if (target_can_async_p ()
+	  && is_exited (inferior_ptid)
+	  && !get_cmd_no_selected_thread_ok (c))
+	error (_("\
+Cannot execute this command without a live selected thread.  See `help thread'."));
 
       /* Pass null arg rather than an empty one.  */
       arg = *p ? p : 0;
@@ -486,7 +484,7 @@
   /* FIXME:  This should be cacheing the frame and only running when
      the frame changes.  */
 
-  if (!target_executing && target_has_stack)
+  if (target_has_stack && !is_running (inferior_ptid))
     {
       flang = get_frame_language ();
       if (!warned
@@ -1159,7 +1157,7 @@
     {
       fprintf_filtered (stream, 
 			_("\nFor bug reporting instructions, please see:\n"));
-      fprintf_filtered (stream, "%s.\n", REPORT_BUGS_TO);
+      fprintf_filtered (stream, "%s.", REPORT_BUGS_TO);
     }
 }
 
diff --git a/gdb/utils.c b/gdb/utils.c
index 76ea6b1..c787dd0 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -208,6 +208,14 @@
 }
 
 struct cleanup *
+make_cleanup_dtor (make_cleanup_ftype *function, void *arg,
+		   void (*dtor) (void *))
+{
+  return make_my_cleanup2 (&cleanup_chain,
+			   function, arg, dtor);
+}
+
+struct cleanup *
 make_final_cleanup (make_cleanup_ftype *function, void *arg)
 {
   return make_my_cleanup (&final_cleanup_chain, function, arg);
@@ -277,10 +285,36 @@
   return make_my_cleanup (&cleanup_chain, do_free_section_addr_info, addrs);
 }
 
+struct restore_integer_closure
+{
+  int *variable;
+  int value;
+};
+
+static void
+restore_integer (void *p)
+{
+  struct restore_integer_closure *closure = p;
+  *(closure->variable) = closure->value;
+}
+
+/* Remember the current value of *VARIABLE and make it restored when the cleanup
+   is run.  */
+struct cleanup *
+make_cleanup_restore_integer (int *variable)
+{
+  struct restore_integer_closure *c =
+    xmalloc (sizeof (struct restore_integer_closure));
+  c->variable = variable;
+  c->value = *variable;
+
+  return make_my_cleanup2 (&cleanup_chain, restore_integer, (void *)c,
+			   xfree);
+}
 
 struct cleanup *
-make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function,
-		 void *arg)
+make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
+		  void *arg,  void (*free_arg) (void *))
 {
   struct cleanup *new
     = (struct cleanup *) xmalloc (sizeof (struct cleanup));
@@ -288,12 +322,20 @@
 
   new->next = *pmy_chain;
   new->function = function;
+  new->free_arg = free_arg;
   new->arg = arg;
   *pmy_chain = new;
 
   return old_chain;
 }
 
+struct cleanup *
+make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function,
+		 void *arg)
+{
+  return make_my_cleanup2 (pmy_chain, function, arg, NULL);
+}
+
 /* Discard cleanups and do the actions they describe
    until we get back to the point OLD_CHAIN in the cleanup_chain.  */
 
@@ -318,6 +360,8 @@
     {
       *pmy_chain = ptr->next;	/* Do this first incase recursion */
       (*ptr->function) (ptr->arg);
+      if (ptr->free_arg)
+	(*ptr->free_arg) (ptr->arg);
       xfree (ptr);
     }
 }
@@ -345,6 +389,8 @@
   while ((ptr = *pmy_chain) != old_chain)
     {
       *pmy_chain = ptr->next;
+      if (ptr->free_arg)
+	(*ptr->free_arg) (ptr->arg);
       xfree (ptr);
     }
 }
@@ -424,20 +470,29 @@
 {
 }
 
-/* Add a continuation to the continuation list, the global list
-   cmd_continuation. The new continuation will be added at the front.*/
-void
-add_continuation (void (*continuation_hook) (struct continuation_arg *, int),
-		  struct continuation_arg *arg_list)
+/* Continuations are implemented as cleanups internally.  Inherit from
+   cleanups.  */
+struct continuation
 {
-  struct continuation *continuation_ptr;
+  struct cleanup base;
+};
 
-  continuation_ptr =
-    (struct continuation *) xmalloc (sizeof (struct continuation));
-  continuation_ptr->continuation_hook = continuation_hook;
-  continuation_ptr->arg_list = arg_list;
-  continuation_ptr->next = cmd_continuation;
-  cmd_continuation = continuation_ptr;
+/* Add a continuation to the continuation list, the global list
+   cmd_continuation. The new continuation will be added at the
+   front.  */
+void
+add_continuation (void (*continuation_hook) (void *), void *args,
+		  void (*continuation_free_args) (void *))
+{
+  struct cleanup *as_cleanup = &cmd_continuation->base;
+  make_cleanup_ftype *continuation_hook_fn = continuation_hook;
+
+  make_my_cleanup2 (&as_cleanup,
+		    continuation_hook_fn,
+		    args,
+		    continuation_free_args);
+
+  cmd_continuation = (struct continuation *) as_cleanup;
 }
 
 /* Walk down the cmd_continuation list, and execute all the
@@ -449,26 +504,20 @@
    and do the continuations from there on, instead of using the
    global beginning of list as our iteration pointer.  */
 void
-do_all_continuations (int error)
+do_all_continuations (void)
 {
-  struct continuation *continuation_ptr;
-  struct continuation *saved_continuation;
+  struct cleanup *continuation_ptr;
 
   /* Copy the list header into another pointer, and set the global
      list header to null, so that the global list can change as a side
-     effect of invoking the continuations and the processing of
-     the preexisting continuations will not be affected. */
-  continuation_ptr = cmd_continuation;
+     effect of invoking the continuations and the processing of the
+     preexisting continuations will not be affected.  */
+
+  continuation_ptr = &cmd_continuation->base;
   cmd_continuation = NULL;
 
   /* Work now on the list we have set aside.  */
-  while (continuation_ptr)
-    {
-      (continuation_ptr->continuation_hook) (continuation_ptr->arg_list, error);
-      saved_continuation = continuation_ptr;
-      continuation_ptr = continuation_ptr->next;
-      xfree (saved_continuation);
-    }
+  do_my_cleanups (&continuation_ptr, NULL);
 }
 
 /* Walk down the cmd_continuation list, and get rid of all the
@@ -476,14 +525,9 @@
 void
 discard_all_continuations (void)
 {
-  struct continuation *continuation_ptr;
-
-  while (cmd_continuation)
-    {
-      continuation_ptr = cmd_continuation;
-      cmd_continuation = continuation_ptr->next;
-      xfree (continuation_ptr);
-    }
+  struct cleanup *continuation_ptr = &cmd_continuation->base;
+  discard_my_cleanups (&continuation_ptr, NULL);
+  cmd_continuation = NULL;
 }
 
 /* Add a continuation to the continuation list, the global list
@@ -491,17 +535,18 @@
    the front.  */
 void
 add_intermediate_continuation (void (*continuation_hook)
-			       (struct continuation_arg *, int),
-			       struct continuation_arg *arg_list)
+			       (void *), void *args,
+			       void (*continuation_free_args) (void *))
 {
-  struct continuation *continuation_ptr;
+  struct cleanup *as_cleanup = &intermediate_continuation->base;
+  make_cleanup_ftype *continuation_hook_fn = continuation_hook;
 
-  continuation_ptr =
-    (struct continuation *) xmalloc (sizeof (struct continuation));
-  continuation_ptr->continuation_hook = continuation_hook;
-  continuation_ptr->arg_list = arg_list;
-  continuation_ptr->next = intermediate_continuation;
-  intermediate_continuation = continuation_ptr;
+  make_my_cleanup2 (&as_cleanup,
+		    continuation_hook_fn,
+		    args,
+		    continuation_free_args);
+
+  intermediate_continuation = (struct continuation *) as_cleanup;
 }
 
 /* Walk down the cmd_continuation list, and execute all the
@@ -513,26 +558,20 @@
    and do the continuations from there on, instead of using the
    global beginning of list as our iteration pointer.*/
 void
-do_all_intermediate_continuations (int error)
+do_all_intermediate_continuations (void)
 {
-  struct continuation *continuation_ptr;
-  struct continuation *saved_continuation;
+  struct cleanup *continuation_ptr;
 
   /* Copy the list header into another pointer, and set the global
      list header to null, so that the global list can change as a side
-     effect of invoking the continuations and the processing of
-     the preexisting continuations will not be affected. */
-  continuation_ptr = intermediate_continuation;
+     effect of invoking the continuations and the processing of the
+     preexisting continuations will not be affected.  */
+
+  continuation_ptr = &intermediate_continuation->base;
   intermediate_continuation = NULL;
 
   /* Work now on the list we have set aside.  */
-  while (continuation_ptr)
-    {
-      (continuation_ptr->continuation_hook) (continuation_ptr->arg_list, error);
-      saved_continuation = continuation_ptr;
-      continuation_ptr = continuation_ptr->next;
-      xfree (saved_continuation);
-    }
+  do_my_cleanups (&continuation_ptr, NULL);
 }
 
 /* Walk down the cmd_continuation list, and get rid of all the
@@ -540,14 +579,9 @@
 void
 discard_all_intermediate_continuations (void)
 {
-  struct continuation *continuation_ptr;
-
-  while (intermediate_continuation)
-    {
-      continuation_ptr = intermediate_continuation;
-      intermediate_continuation = continuation_ptr->next;
-      xfree (continuation_ptr);
-    }
+  struct cleanup *continuation_ptr = &intermediate_continuation->base;
+  discard_my_cleanups (&continuation_ptr, NULL);
+  continuation_ptr = NULL;
 }
 
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 5349329..7fce311 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -812,13 +812,13 @@
 }
 
 static struct v850_frame_cache *
-v850_alloc_frame_cache (struct frame_info *next_frame)
+v850_alloc_frame_cache (struct frame_info *this_frame)
 {
   struct v850_frame_cache *cache;
   int i;
 
   cache = FRAME_OBSTACK_ZALLOC (struct v850_frame_cache);
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Base address.  */
   cache->base = 0;
@@ -832,7 +832,7 @@
 }
 
 static struct v850_frame_cache *
-v850_frame_cache (struct frame_info *next_frame, void **this_cache)
+v850_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct v850_frame_cache *cache;
   CORE_ADDR current_pc;
@@ -841,7 +841,7 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = v850_alloc_frame_cache (next_frame);
+  cache = v850_alloc_frame_cache (this_frame);
   *this_cache = cache;
 
   /* In principle, for normal frames, fp holds the frame pointer,
@@ -849,16 +849,16 @@
      However, for functions that don't need it, the frame pointer is
      optional.  For these "frameless" functions the frame pointer is
      actually the frame pointer of the calling frame.  */
-  cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
-  current_pc = frame_pc_unwind (next_frame);
+  cache->pc = get_frame_func (this_frame);
+  current_pc = get_frame_pc (this_frame);
   if (cache->pc != 0)
     {
       ULONGEST ctbp;
-      ctbp = frame_unwind_register_unsigned (next_frame, E_CTBP_REGNUM);
+      ctbp = get_frame_register_unsigned (this_frame, E_CTBP_REGNUM);
       v850_analyze_prologue (cache->pc, current_pc, cache, ctbp);
     }
 
@@ -871,7 +871,7 @@
          setup yet.  Try to reconstruct the base address for the stack
          frame by looking at the stack pointer.  For truly "frameless"
          functions this might work too.  */
-      cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
+      cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
     }
 
   /* Now that we have the base address for the stack frame we can
@@ -896,25 +896,22 @@
 }
 
 
-static void
-v850_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			  int regnum, int *optimizedp,
-			  enum lval_type *lvalp, CORE_ADDR *addrp,
-			  int *realnump, gdb_byte *valuep)
+static struct value *
+v850_frame_prev_register (struct frame_info *this_frame,
+			  void **this_cache, int regnum)
 {
-  struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache);
+  struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
 
   gdb_assert (regnum >= 0);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
 }
 
 static void
-v850_frame_this_id (struct frame_info *next_frame, void **this_cache,
+v850_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		    struct frame_id *this_id)
 {
-  struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache);
+  struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
 
   /* This marks the outermost frame.  */
   if (cache->base == 0)
@@ -926,14 +923,10 @@
 static const struct frame_unwind v850_frame_unwind = {
   NORMAL_FRAME,
   v850_frame_this_id,
-  v850_frame_prev_register
+  v850_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
-    
-static const struct frame_unwind *
-v850_frame_sniffer (struct frame_info *next_frame)
-{     
-  return &v850_frame_unwind;
-}
 
 static CORE_ADDR
 v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -950,16 +943,17 @@
 }
 
 static struct frame_id
-v850_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (v850_unwind_sp (gdbarch, next_frame),
-                         frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
+					      gdbarch_sp_regnum (gdbarch));
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
   
 static CORE_ADDR
-v850_frame_base_address (struct frame_info *next_frame, void **this_cache)
+v850_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache);
+  struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
 
   return cache->base;
 }
@@ -1026,14 +1020,14 @@
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
   set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
   set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
-  set_gdbarch_unwind_dummy_id (gdbarch, v850_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, v850_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &v850_frame_unwind);
 
   return gdbarch;
 }
diff --git a/gdb/valops.c b/gdb/valops.c
index f720ea9..aad9871 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -268,7 +268,7 @@
 	v2 = coerce_ref (arg2);
       else
 	v2 = value_ind (arg2);
-      gdb_assert (TYPE_CODE (value_type (v2)) == TYPE_CODE_STRUCT
+      gdb_assert (TYPE_CODE (check_typedef (value_type (v2))) == TYPE_CODE_STRUCT
 		  && !!"Why did coercion fail?");
       v2 = value_cast_structs (t1, v2);
       /* At this point we have what we can have, un-dereference if needed.  */
diff --git a/gdb/value.c b/gdb/value.c
index 71ddf5c..b38bae0 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1354,7 +1354,12 @@
          bases, etc.  */
       v = allocate_value (value_enclosing_type (arg1));
       v->type = type;
-      if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
+
+      /* Lazy register values with offsets are not supported.  */
+      if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
+	value_fetch_lazy (arg1);
+
+      if (value_lazy (arg1))
 	set_value_lazy (v, 1);
       else
 	memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
@@ -1368,7 +1373,12 @@
       /* Plain old data member */
       offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
       v = allocate_value (type);
-      if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
+
+      /* Lazy register values with offsets are not supported.  */
+      if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
+	value_fetch_lazy (arg1);
+
+      if (value_lazy (arg1))
 	set_value_lazy (v, 1);
       else
 	memcpy (value_contents_raw (v),
diff --git a/gdb/varobj.c b/gdb/varobj.c
index e94a35e..3a0bf5e 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2198,8 +2198,7 @@
     /* Not a root var */
     return NULL;
 
-  back_to = make_cleanup_restore_current_thread (
-    inferior_ptid, get_frame_id (deprecated_safe_get_selected_frame ()));
+  back_to = make_cleanup_restore_current_thread ();
 
   /* Determine whether the variable is still around. */
   if (var->root->valid_block == NULL || var->root->floating)
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 4daf95d..618befa 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -191,12 +191,12 @@
 }
 
 static struct frame_id
-vax_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
   CORE_ADDR fp;
 
-  fp = frame_unwind_register_unsigned (next_frame, VAX_FP_REGNUM);
-  return frame_id_build (fp, frame_pc_unwind (next_frame));
+  fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM);
+  return frame_id_build (fp, get_frame_pc (this_frame));
 }
 
 
@@ -311,7 +311,7 @@
 };
 
 struct vax_frame_cache *
-vax_frame_cache (struct frame_info *next_frame, void **this_cache)
+vax_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct vax_frame_cache *cache;
   CORE_ADDR addr;
@@ -323,16 +323,16 @@
 
   /* Allocate a new cache.  */
   cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache);
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* The frame pointer is used as the base for the frame.  */
-  cache->base = frame_unwind_register_unsigned (next_frame, VAX_FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM);
   if (cache->base == 0)
     return cache;
 
   /* The register save mask and control bits determine the layout of
      the stack frame.  */
-  mask = get_frame_memory_unsigned (next_frame, cache->base + 4, 4) >> 16;
+  mask = get_frame_memory_unsigned (this_frame, cache->base + 4, 4) >> 16;
 
   /* These are always saved.  */
   cache->saved_regs[VAX_PC_REGNUM].addr = cache->base + 16;
@@ -362,7 +362,7 @@
          stack address for the arguments that were pushed onto the
          stack.  The return instruction will automatically pop the
          arguments from the stack.  */
-      numarg = get_frame_memory_unsigned (next_frame, addr, 1);
+      numarg = get_frame_memory_unsigned (this_frame, addr, 1);
       addr += 4 + numarg * 4;
     }
 
@@ -373,57 +373,49 @@
 }
 
 static void
-vax_frame_this_id (struct frame_info *next_frame, void **this_cache,
+vax_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		   struct frame_id *this_id)
 {
-  struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache);
+  struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
 
   /* This marks the outermost frame.  */
   if (cache->base == 0)
     return;
 
-  (*this_id) = frame_id_build (cache->base,
-			       frame_func_unwind (next_frame, NORMAL_FRAME));
+  (*this_id) = frame_id_build (cache->base, get_frame_func (this_frame));
 }
 
-static void
-vax_frame_prev_register (struct frame_info *next_frame, void **this_cache,
-			 int regnum, int *optimizedp,
-			 enum lval_type *lvalp, CORE_ADDR *addrp,
-			 int *realnump, gdb_byte *valuep)
+static struct value *
+vax_frame_prev_register (struct frame_info *this_frame,
+			 void **this_cache, int regnum)
 {
-  struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache);
+  struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
 
-  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
 }
 
 static const struct frame_unwind vax_frame_unwind =
 {
   NORMAL_FRAME,
   vax_frame_this_id,
-  vax_frame_prev_register
+  vax_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
-
-static const struct frame_unwind *
-vax_frame_sniffer (struct frame_info *next_frame)
-{
-  return &vax_frame_unwind;
-}
 
 
 static CORE_ADDR
-vax_frame_base_address (struct frame_info *next_frame, void **this_cache)
+vax_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache);
+  struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
 
   return cache->base;
 }
 
 static CORE_ADDR
-vax_frame_args_address (struct frame_info *next_frame, void **this_cache)
+vax_frame_args_address (struct frame_info *this_frame, void **this_cache)
 {
-  return frame_unwind_register_unsigned (next_frame, VAX_AP_REGNUM);
+  return get_frame_register_unsigned (this_frame, VAX_AP_REGNUM);
 }
 
 static const struct frame_base vax_frame_base =
@@ -505,7 +497,7 @@
 
   /* Call dummy code.  */
   set_gdbarch_push_dummy_call (gdbarch, vax_push_dummy_call);
-  set_gdbarch_unwind_dummy_id (gdbarch, vax_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, vax_dummy_id);
 
   /* Breakpoint info */
   set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
@@ -523,7 +515,7 @@
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, vax_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &vax_frame_unwind);
 
   return (gdbarch);
 }
diff --git a/gdb/vaxobsd-tdep.c b/gdb/vaxobsd-tdep.c
index 843982c..ed8acf6 100644
--- a/gdb/vaxobsd-tdep.c
+++ b/gdb/vaxobsd-tdep.c
@@ -57,9 +57,11 @@
 };
 
 static int
-vaxobsd_sigtramp_p (struct frame_info *next_frame)
+vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
+			  struct frame_info *this_frame,
+			  void **this_cache)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
   CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
   CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
   gdb_byte *buf;
@@ -70,7 +72,7 @@
     return 0;
 
   buf = alloca(sizeof vaxobsd_sigreturn);
-  if (!safe_frame_unwind_memory (next_frame, sigreturn_addr,
+  if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
 				 buf, sizeof vaxobsd_sigreturn))
     return 0;
 
@@ -81,7 +83,7 @@
 }
 
 static struct trad_frame_cache *
-vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
+vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct trad_frame_cache *cache;
   CORE_ADDR addr, base, func;
@@ -89,14 +91,14 @@
   if (*this_cache)
     return *this_cache;
 
-  cache = trad_frame_cache_zalloc (next_frame);
+  cache = trad_frame_cache_zalloc (this_frame);
   *this_cache = cache;
 
-  func = frame_pc_unwind (next_frame);
+  func = get_frame_pc (this_frame);
   func &= ~(vaxobsd_page_size - 1);
 
-  base = frame_unwind_register_unsigned (next_frame, VAX_SP_REGNUM);
-  addr = get_frame_memory_unsigned (next_frame, base - 4, 4);
+  base = get_frame_register_unsigned (this_frame, VAX_SP_REGNUM);
+  addr = get_frame_memory_unsigned (this_frame, base - 4, 4);
 
   trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
   trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
@@ -111,43 +113,32 @@
 }
 
 static void
-vaxobsd_sigtramp_frame_this_id (struct frame_info *next_frame,
+vaxobsd_sigtramp_frame_this_id (struct frame_info *this_frame,
 				void **this_cache, struct frame_id *this_id)
 {
   struct trad_frame_cache *cache =
-    vaxobsd_sigtramp_frame_cache (next_frame, this_cache);
+    vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
 
   trad_frame_get_id (cache, this_id);
 }
 
-static void
-vaxobsd_sigtramp_frame_prev_register (struct frame_info *next_frame,
-				      void **this_cache, int regnum,
-				      int *optimizedp, enum lval_type *lvalp,
-				      CORE_ADDR *addrp, int *realnump,
-				      gdb_byte *valuep)
+static struct value *
+vaxobsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
+				      void **this_cache, int regnum)
 {
   struct trad_frame_cache *cache =
-    vaxobsd_sigtramp_frame_cache (next_frame, this_cache);
+    vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
 
-  trad_frame_get_register (cache, next_frame, regnum,
-			   optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_register (cache, this_frame, regnum);
 }
 
 static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
   SIGTRAMP_FRAME,
   vaxobsd_sigtramp_frame_this_id,
-  vaxobsd_sigtramp_frame_prev_register
+  vaxobsd_sigtramp_frame_prev_register,
+  NULL,
+  vaxobsd_sigtramp_sniffer
 };
-
-static const struct frame_unwind *
-vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  if (vaxobsd_sigtramp_p (next_frame))
-    return &vaxobsd_sigtramp_frame_unwind;
-
-  return NULL;
-}
 
 
 /* OpenBSD a.out.  */
@@ -155,7 +146,7 @@
 static void
 vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  frame_unwind_append_sniffer (gdbarch, vaxobsd_sigtramp_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &vaxobsd_sigtramp_frame_unwind);
 }
 
 /* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are
diff --git a/gdb/version.in b/gdb/version.in
index 4ce0a61..d0854bc 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-6.8.50.20080610-cvs
+6.8.50.20080718-cvs
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 52ff20a..8fedf9e 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -48,7 +48,6 @@
 #include "objfiles.h"
 #include "gdb_obstack.h"
 #include "gdb_string.h"
-#include "gdb_stdint.h"
 #include "gdbthread.h"
 #include "gdbcmd.h"
 #include <sys/param.h>
@@ -106,7 +105,7 @@
 #define DEBUG_MEM(x)	if (debug_memory)	printf_unfiltered x
 #define DEBUG_EXCEPT(x)	if (debug_exceptions)	printf_unfiltered x
 
-static void win32_stop (void);
+static void win32_stop (ptid_t);
 static int win32_win32_thread_alive (ptid_t);
 static void win32_kill_inferior (void);
 
@@ -556,8 +555,6 @@
 safe_symbol_file_add_stub (void *argv)
 {
 #define p ((struct safe_symbol_file_add_args *) argv)
-  struct so_list *so = &solib_start;
-
   p->ret = symbol_file_add (p->name, p->from_tty, p->addrs, p->mainline, p->flags);
   return !!p->ret;
 #undef p
@@ -747,6 +744,9 @@
   solib_end->next = win32_make_so (dll_name, (DWORD) event->lpBaseOfDll);
   solib_end = solib_end->next;
 
+  DEBUG_EVENTS (("gdb: Loading dll \"%s\" at 0x%lx.\n", solib_end->so_name,
+		 (DWORD) solib_end->lm_info->load_addr));
+
   return 1;
 }
 
@@ -771,6 +771,8 @@
 	so->next = sodel->next;
 	if (!so->next)
 	  solib_end = so;
+	DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n", sodel->so_name));
+
 	win32_free_so (sodel);
 	solib_add (NULL, 0, NULL, auto_solib_add);
 	return 1;
@@ -1300,7 +1302,7 @@
 	      /* Kludge around a Windows bug where first event is a create
 		 thread event.  Caused when attached process does not have
 		 a main thread. */
-	      retval = ourstatus->value.related_pid = fake_create_process ();
+	      retval = fake_create_process ();
 	     if (retval)
 	       saw_create++;
 	    }
@@ -1340,7 +1342,7 @@
       /* Add the main thread */
       th = win32_add_thread (main_thread_id,
 			     current_event.u.CreateProcessInfo.hThread);
-      retval = ourstatus->value.related_pid = current_event.dwThreadId;
+      retval = current_event.dwThreadId;
       break;
 
     case EXIT_PROCESS_DEBUG_EVENT:
@@ -1520,6 +1522,7 @@
   terminal_init_inferior_with_pgrp (pid);
   target_terminal_inferior ();
 
+  stop_soon = STOP_QUIETLY;
   while (1)
     {
       stop_after_trap = 1;
@@ -1529,6 +1532,8 @@
       else
 	break;
     }
+
+  stop_soon = NO_STOP_QUIETLY;
   stop_after_trap = 0;
   return;
 }
@@ -1923,7 +1928,7 @@
    ^C on the controlling terminal. */
 
 static void
-win32_stop (void)
+win32_stop (ptid_t ptid)
 {
   DEBUG_EVENTS (("gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
   CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));
@@ -2006,7 +2011,7 @@
   if ((DWORD) pid == current_event.dwProcessId)
     sprintf (buf, "process %d", pid);
   else
-    sprintf (buf, "thread %ld.0x%x", current_event.dwProcessId, pid);
+    sprintf (buf, "Thread %ld.0x%x", current_event.dwProcessId, pid);
   return buf;
 }
 
@@ -2080,6 +2085,7 @@
   win32_ops.to_open = win32_open;
   win32_ops.to_close = win32_close;
   win32_ops.to_attach = win32_attach;
+  win32_ops.to_attach_no_wait = 1;
   win32_ops.to_detach = win32_detach;
   win32_ops.to_resume = win32_resume;
   win32_ops.to_wait = win32_wait;
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index adc2f21..eac5efd 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -311,7 +311,7 @@
 static CORE_ADDR
 xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
 			    struct xstormy16_frame_cache *cache,
-			    struct frame_info *next_frame)
+			    struct frame_info *this_frame)
 {
   CORE_ADDR next_addr;
   ULONGEST inst, inst2;
@@ -638,7 +638,7 @@
 }
 
 static struct xstormy16_frame_cache *
-xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
+xstormy16_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct xstormy16_frame_cache *cache;
   CORE_ADDR current_pc;
@@ -650,17 +650,17 @@
   cache = xstormy16_alloc_frame_cache ();
   *this_cache = cache;
 
-  cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
+  cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
-  current_pc = frame_pc_unwind (next_frame);
+  cache->pc = get_frame_func (this_frame);
+  current_pc = get_frame_pc (this_frame);
   if (cache->pc)
-    xstormy16_analyze_prologue (cache->pc, current_pc, cache, next_frame);
+    xstormy16_analyze_prologue (cache->pc, current_pc, cache, this_frame);
 
   if (!cache->uses_fp)
-    cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
+    cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
 
   cache->saved_sp = cache->base - cache->framesize;
 
@@ -671,59 +671,29 @@
   return cache;
 }
 
-static void
-xstormy16_frame_prev_register (struct frame_info *next_frame, 
-			       void **this_cache,
-			       int regnum, int *optimizedp,
-			       enum lval_type *lvalp, CORE_ADDR *addrp,
-			       int *realnump, gdb_byte *valuep)
+static struct value *
+xstormy16_frame_prev_register (struct frame_info *this_frame, 
+			       void **this_cache, int regnum)
 {
-  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
+  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
                                                                this_cache);
   gdb_assert (regnum >= 0);
 
   if (regnum == E_SP_REGNUM && cache->saved_sp)
-    {
-      *optimizedp = 0;
-      *lvalp = not_lval;
-      *addrp = 0;
-      *realnump = -1;
-      if (valuep)
-        {
-          /* Store the value.  */
-          store_unsigned_integer (valuep, xstormy16_reg_size, cache->saved_sp);
-        }
-      return;
-    }
+    return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
 
   if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
-    {
-      *optimizedp = 0;
-      *lvalp = lval_memory;
-      *addrp = cache->saved_regs[regnum];
-      *realnump = -1;
-      if (valuep)
-        {
-          /* Read the value in from memory.  */
-          read_memory (*addrp, valuep,
-                       register_size (get_frame_arch (next_frame), regnum));
-        }
-      return;
-    }
+    return frame_unwind_got_memory (this_frame, regnum,
+				    cache->saved_regs[regnum]);
 
-  *optimizedp = 0;
-  *lvalp = lval_register;
-  *addrp = 0;
-  *realnump = regnum;
-  if (valuep)
-    frame_unwind_register (next_frame, (*realnump), valuep);
+  return frame_unwind_got_register (this_frame, regnum, regnum);
 }
 
 static void
-xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache,
+xstormy16_frame_this_id (struct frame_info *this_frame, void **this_cache,
 			 struct frame_id *this_id)
 {
-  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
+  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
 							       this_cache);
 
   /* This marks the outermost frame.  */
@@ -734,9 +704,9 @@
 }
 
 static CORE_ADDR
-xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache)
+xstormy16_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
-  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
+  struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
 							       this_cache);
   return cache->base;
 }
@@ -744,7 +714,9 @@
 static const struct frame_unwind xstormy16_frame_unwind = {
   NORMAL_FRAME,
   xstormy16_frame_this_id,
-  xstormy16_frame_prev_register
+  xstormy16_frame_prev_register,
+  NULL,
+  default_frame_sniffer
 };
 
 static const struct frame_base xstormy16_frame_base = {
@@ -754,12 +726,6 @@
   xstormy16_frame_base_address
 };
 
-static const struct frame_unwind *
-xstormy16_frame_sniffer (struct frame_info *next_frame)
-{
-  return &xstormy16_frame_unwind;
-}
-
 static CORE_ADDR
 xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -773,11 +739,10 @@
 }
 
 static struct frame_id
-xstormy16_unwind_dummy_id (struct gdbarch *gdbarch,
-			   struct frame_info *next_frame)
+xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
-  return frame_id_build (xstormy16_unwind_sp (gdbarch, next_frame),
-			 frame_pc_unwind (next_frame));
+  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
+  return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
 
@@ -832,7 +797,7 @@
    */
   set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
   set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
-  set_gdbarch_unwind_dummy_id (gdbarch, xstormy16_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
 
@@ -851,8 +816,8 @@
 
   gdbarch_init_osabi (info, gdbarch);
 
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, xstormy16_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &xstormy16_frame_unwind);
 
   return gdbarch;
 }
diff --git a/include/ChangeLog b/include/ChangeLog
index 4e399f3..bf5901f 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,39 @@
+2008-07-12  Jie Zhang  <jie.zhang@analog.com>
+
+	Revert
+	2008-07-12  Jie Zhang  <jie.zhang@analog.com>
+	* bfdlink.h (struct bfd_link_info): Add sep_code member
+	variable.
+	* elf/bfin.h (EF_BFIN_CODE_IN_L1): Define.
+	(EF_BFIN_DATA_IN_L1): Define.
+
+2008-07-12  Jie Zhang  <jie.zhang@analog.com>
+
+	* bfdlink.h (struct bfd_link_info): Add sep_code member
+	variable.
+	* elf/bfin.h (EF_BFIN_CODE_IN_L1): Define.
+	(EF_BFIN_DATA_IN_L1): Define.
+
+2008-07-07  Stan Shebs  <stan@codesourcery.com>
+
+	* dis-asm.h (struct disassemble_info): Add endian_code field.
+
+2008-07-07  Joel Brobecker  <brobecker@adacore.com>
+
+	* safe-ctype.h: Add #include of ctype.h before redefining
+	the ctype.h macros.
+
+2008-07-04  Joel Brobecker  <brobecker@adacore.com>
+
+	* safe-ctype.h: Remove #error when detecting that ctype.h has been
+	included. Redefine the various macros provided by ctype.h as
+	undefined variables.
+
+2008-06-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* libiberty.h (XALLOCA, XDUP, XALLOCAVEC, XDUPVEC, XALLOCAVAR,
+	XDUPVAR, XOBNEWVEC, XOBNEWVAR): New.
+
 2008-06-06  Alan Modra  <amodra@bigpond.net.au>
 
 	* bfdlink.h (struct bfd_link_info): Add "path_separator".
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index fdd09db..ef5852a 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,13 @@
+2008-06-17  Nick Clifton  <nickc@redhat.com>
+
+	* ti.h (GET_SCNHDR_NLNNO): Provide an alternative version of this
+	macro which does not trigger an array bounds warning in gcc.
+	(PUT_SCNHDR_NLNNO): Likewise.
+	(GET_SCNHDR_FLAGS): Likewise.
+	(PUT_SCNHDR_FLAGS): Likewise.
+	(GET_SCNHDR_PAGE): Likewise.
+	(PUT_SCNHDR_PAGE): Likewise.
+
 2007-11-05  Danny Smith  <dannysmith@users.sourceforge.net>
 
 	* pe.h (COFF_ENCODE_ALIGNMENT) Define.
diff --git a/include/coff/ti.h b/include/coff/ti.h
index 4c246d4..86f7a13 100644
--- a/include/coff/ti.h
+++ b/include/coff/ti.h
@@ -2,7 +2,7 @@
    customized in a target-specific file, and then this file included (see
    tic54x.h for an example).
    
-   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2008 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
@@ -213,12 +213,81 @@
 
 /* COFF2 changes the offsets and sizes of these fields 
    Assume we're dealing with the COFF2 scnhdr structure, and adjust
-   accordingly 
- */
+   accordingly.  Note: The GNU C versions of some of these macros
+   are necessary in order to avoid compile time warnings triggered
+   gcc's array bounds checking.  The PUT_SCNHDR_PAGE macro also has
+   the advantage on not evaluating LOC twice.  */
+
 #define GET_SCNHDR_NRELOC(ABFD, LOC) \
   (COFF2_P (ABFD) ? H_GET_32 (ABFD, LOC) : H_GET_16 (ABFD, LOC))
 #define PUT_SCNHDR_NRELOC(ABFD, VAL, LOC) \
   (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, LOC) : H_PUT_16 (ABFD, VAL, LOC))
+#ifdef __GNUC__
+#define GET_SCNHDR_NLNNO(ABFD, LOC) \
+  ({ \
+    int nlnno;		\
+    char * ptr = (LOC); \
+    if (COFF2_P (ABFD)) \
+      nlnno = H_GET_32 (ABFD, ptr); \
+    else \
+      nlnno = H_GET_16 (ABFD, ptr - 2); \
+    nlnno; \
+  })
+#define PUT_SCNHDR_NLNNO(ABFD, VAL, LOC) \
+  do \
+    { \
+      char * ptr = (LOC); \
+      if (COFF2_P (ABFD)) \
+	H_PUT_32 (ABFD, VAL, ptr); \
+      else \
+	H_PUT_16 (ABFD, VAL, ptr - 2); \
+    } \
+  while (0)
+#define GET_SCNHDR_FLAGS(ABFD, LOC) \
+  ({ \
+    int flags; \
+    char * ptr = (LOC); \
+    if (COFF2_P (ABFD)) \
+      flags = H_GET_32 (ABFD, ptr); \
+    else \
+      flags = H_GET_16 (ABFD, ptr - 4); \
+    flags; \
+  })
+#define PUT_SCNHDR_FLAGS(ABFD, VAL, LOC) \
+  do \
+    { \
+      char * ptr = (LOC); \
+      if (COFF2_P (ABFD)) \
+	H_PUT_32 (ABFD, VAL, ptr); \
+      else \
+	H_PUT_16 (ABFD, VAL, ptr - 4); \
+    } \
+  while (0)
+#define GET_SCNHDR_PAGE(ABFD, LOC) \
+  ({ \
+    unsigned page; \
+    char * ptr = (LOC); \
+    if (COFF2_P (ABFD)) \
+      page = H_GET_16 (ABFD, ptr); \
+    else \
+      page = (unsigned) H_GET_8 (ABFD, ptr - 7); \
+    page; \
+  })
+/* On output, make sure that the "reserved" field is zero.  */
+#define PUT_SCNHDR_PAGE(ABFD, VAL, LOC) \
+  do \
+    { \
+      char * ptr = (LOC); \
+      if (COFF2_P (ABFD)) \
+	H_PUT_16 (ABFD, VAL, ptr); \
+      else \
+	{ \
+	  H_PUT_8 (ABFD, VAL, ptr - 7); \
+	  H_PUT_8 (ABFD, 0, ptr - 8); \
+	} \
+    } \
+  while (0)
+#else
 #define GET_SCNHDR_NLNNO(ABFD, LOC) \
   (COFF2_P (ABFD) ? H_GET_32 (ABFD, LOC) : H_GET_16 (ABFD, (LOC) - 2))
 #define PUT_SCNHDR_NLNNO(ABFD, VAL, LOC) \
@@ -229,11 +298,13 @@
   (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, LOC) : H_PUT_16 (ABFD, VAL, (LOC) - 4))
 #define GET_SCNHDR_PAGE(ABFD, LOC) \
   (COFF2_P (ABFD) ? H_GET_16 (ABFD, LOC) : (unsigned) H_GET_8 (ABFD, (LOC) - 7))
-/* on output, make sure that the "reserved" field is zero */
+/* On output, make sure that the "reserved" field is zero.  */
 #define PUT_SCNHDR_PAGE(ABFD, VAL, LOC) \
   (COFF2_P (ABFD) \
    ? H_PUT_16 (ABFD, VAL, LOC) \
    : H_PUT_8 (ABFD, VAL, (LOC) - 7), H_PUT_8 (ABFD, 0, (LOC) - 8))
+#endif
+
 
 /* TI COFF stores section size as number of bytes (address units, not octets),
    so adjust to be number of octets, which is what BFD expects */ 
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 999d6ea..db74d85 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -76,6 +76,8 @@
   unsigned long mach;
   /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
   enum bfd_endian endian;
+  /* Endianness of code, for mixed-endian situations such as ARM BE8.  */
+  enum bfd_endian endian_code;
   /* An arch/mach-specific bitmask of selected instruction subsets, mainly
      for processors with run-time-switchable instruction sets.  The default,
      zero, means that there is no constraint.  CGEN-based opcodes ports
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index f003a83..9f61982 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,21 @@
+2008-07-10  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* mips.h (ELF_ST_IS_MIPS16, ELF_ST_SET_MIPS16): New macros.
+
+2008-06-18  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+
+	* common.h (EM_CR16): Correct value.
+	(EM_CR16): Rename to EM_CR16_OLD.
+
+2008-06-12  DJ Delorie  <dj@redhat.com>
+
+	* common.h (EM_M32C_NEW): Rename to EM_M32C.
+	(EM_M32C): Rename to EM_M32C_OLD.
+
+2008-06-12  Joseph Myers  <joseph@codesourcery.com>
+
+	* common.h: Update e_machine table.
+
 2008-06-09  Takashi Yoshii  <yoshii.takashi@renesas.com>
 
 	* sh.h (EF_SH_BFD_TABLE): Set bfd_mach_sh for EF_SH_UNKNOWN.
diff --git a/include/elf/common.h b/include/elf/common.h
index c3d7d01..9175940 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -148,7 +148,7 @@
 #define EM_ST100	 60	/* STMicroelectronics ST100 processor */
 #define EM_TINYJ	 61	/* Advanced Logic Corp. TinyJ embedded processor */
 #define EM_X86_64	 62	/* Advanced Micro Devices X86-64 processor */
-
+#define EM_PDSP		 63	/* Sony DSP Processor */
 #define EM_PDP10	 64	/* Digital Equipment Corp. PDP-10 */
 #define EM_PDP11	 65	/* Digital Equipment Corp. PDP-11 */
 #define EM_FX66		 66	/* Siemens FX66 microcontroller */
@@ -180,14 +180,62 @@
 #define EM_OPENRISC	 92	/* OpenRISC 32-bit embedded processor */
 #define EM_ARC_A5	 93	/* ARC Cores Tangent-A5 */
 #define EM_XTENSA	 94	/* Tensilica Xtensa Architecture */
+#define EM_VIDEOCORE	 95	/* Alphamosaic VideoCore processor */
+#define EM_TMM_GPP	 96	/* Thompson Multimedia General Purpose Processor */
+#define EM_NS32K	 97	/* National Semiconductor 32000 series */
+#define EM_TPC		 98	/* Tenor Network TPC processor */
+#define EM_SNP1K	 99	/* Trebia SNP 1000 processor */
+#define EM_ST200	100	/* STMicroelectronics ST200 microcontroller */
 #define EM_IP2K		101	/* Ubicom IP2022 micro controller */
+#define EM_MAX		102	/* MAX Processor */
 #define EM_CR		103	/* National Semiconductor CompactRISC */
+#define EM_F2MC16	104	/* Fujitsu F2MC16 */
 #define EM_MSP430	105	/* TI msp430 micro controller */
 #define EM_BLACKFIN	106	/* ADI Blackfin */
+#define EM_SE_C33	107	/* S1C33 Family of Seiko Epson processors */
+#define EM_SEP		108	/* Sharp embedded microprocessor */
+#define EM_ARCA		109	/* Arca RISC Microprocessor */
+#define EM_UNICORE	110	/* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
+#define EM_EXCESS	111	/* eXcess: 16/32/64-bit configurable embedded CPU */
+#define EM_DXP		112	/* Icera Semiconductor Inc. Deep Execution Processor */
 #define EM_ALTERA_NIOS2	113	/* Altera Nios II soft-core processor */
 #define EM_CRX		114	/* National Semiconductor CRX */
-#define EM_CR16		115	/* National Semiconductor CompactRISC - CR16 */
+#define EM_XGATE	115	/* Motorola XGATE embedded processor */
+#define EM_C166		116	/* Infineon C16x/XC16x processor */
+#define EM_M16C		117	/* Renesas M16C series microprocessors */
+#define EM_DSPIC30F	118	/* Microchip Technology dsPIC30F Digital Signal Controller */
+#define EM_CE		119	/* Freescale Communication Engine RISC core */
+#define EM_M32C		120	/* Renesas M32C series microprocessors */
+
+#define EM_TSK3000	131	/* Altium TSK3000 core */
+#define EM_RS08		132	/* Freescale RS08 embedded processor */
+
+#define EM_ECOG2	134	/* Cyan Technology eCOG2 microprocessor */
 #define EM_SCORE        135     /* Sunplus Score */
+#define EM_DSP24	136	/* New Japan Radio (NJR) 24-bit DSP Processor */
+#define EM_VIDEOCORE3	137	/* Broadcom VideoCore III processor */
+#define EM_LATTICEMICO32 138	/* RISC processor for Lattice FPGA architecture */
+#define EM_SE_C17	139	/* Seiko Epson C17 family */
+
+#define EM_MMDSP_PLUS	160	/* STMicroelectronics 64bit VLIW Data Signal Processor */
+#define EM_CYPRESS_M8C	161	/* Cypress M8C microprocessor */
+#define EM_R32C		162	/* Renesas R32C series microprocessors */
+#define EM_TRIMEDIA	163	/* NXP Semiconductors TriMedia architecture family */
+#define EM_QDSP6	164	/* QUALCOMM DSP6 Processor */
+#define EM_8051		165	/* Intel 8051 and variants */
+#define EM_STXP7X	166	/* STMicroelectronics STxP7x family */
+#define EM_NDS32	167	/* Andes Technology compact code size embedded RISC processor family */
+#define EM_ECOG1	168	/* Cyan Technology eCOG1X family */
+#define EM_ECOG1X	168	/* Cyan Technology eCOG1X family */
+#define EM_MAXQ30	169	/* Dallas Semiconductor MAXQ30 Core Micro-controllers */
+#define EM_XIMO16	170	/* New Japan Radio (NJR) 16-bit DSP Processor */
+#define EM_MANIK	171	/* M2000 Reconfigurable RISC Microprocessor */
+#define EM_CRAYNV2	172	/* Cray Inc. NV2 vector architecture */
+#define EM_RX		173	/* Renesas RX family */
+#define EM_METAG	174	/* Imagination Technologies META processor architecture */
+#define EM_MCST_ELBRUS	175	/* MCST Elbrus general purpose hardware architecture */
+#define EM_ECOG16	176	/* Cyan Technology eCOG16 family */
+#define EM_CR16		177	/* National Semiconductor CompactRISC 16-bit processor */
 
 /* If it is necessary to assign new unofficial EM_* values, please pick large
    random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
@@ -211,6 +259,9 @@
 /* picoJava */
 #define EM_PJ_OLD      		99
 
+/* Old, unofficial value for National Semiconductor CompactRISC - CR16 */
+#define EM_CR16_OLD		115
+
 /* AVR magic number.  Written in the absense of an ABI.  */
 #define EM_AVR_OLD		0x1057
 
@@ -273,7 +324,7 @@
 #define EM_CYGNUS_MN10200	0xdead
 
 /* Renesas M32C and M16C.  */
-#define EM_M32C			0xFEB0
+#define EM_M32C_OLD		0xFEB0
 
 /* Vitesse IQ2000.  */
 #define EM_IQ2000		0xFEBA
diff --git a/include/elf/mips.h b/include/elf/mips.h
index 55ecfb3..474f54f 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -725,6 +725,8 @@
 
 /* This value is used for a mips16 .text symbol.  */
 #define STO_MIPS16		0xf0
+#define ELF_ST_IS_MIPS16(OTHER) (((OTHER) & 0xf0) == STO_MIPS16)
+#define ELF_ST_SET_MIPS16(OTHER) (((OTHER) & ~0xf0) | STO_MIPS16)
 
 /* This bit is used on Irix to indicate a symbol whose definition
    is optional - if, at final link time, it cannot be found, no
diff --git a/include/libiberty.h b/include/libiberty.h
index 6ea8761..e3eca9d 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -320,26 +320,34 @@
 
 /* Scalar allocators.  */
 
+#define XALLOCA(T)		((T *) alloca (sizeof (T)))
 #define XNEW(T)			((T *) xmalloc (sizeof (T)))
 #define XCNEW(T)		((T *) xcalloc (1, sizeof (T)))
+#define XDUP(T, P)		((T *) xmemdup ((P), sizeof (T), sizeof (T)))
 #define XDELETE(P)		free ((void*) (P))
 
 /* Array allocators.  */
 
+#define XALLOCAVEC(T, N)	((T *) alloca (sizeof (T) * (N)))
 #define XNEWVEC(T, N)		((T *) xmalloc (sizeof (T) * (N)))
 #define XCNEWVEC(T, N)		((T *) xcalloc ((N), sizeof (T)))
+#define XDUPVEC(T, P, N)	((T *) xmemdup ((P), sizeof (T) * (N), sizeof (T) * (N)))
 #define XRESIZEVEC(T, P, N)	((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
 #define XDELETEVEC(P)		free ((void*) (P))
 
 /* Allocators for variable-sized structures and raw buffers.  */
 
+#define XALLOCAVAR(T, S)	((T *) alloca ((S)))
 #define XNEWVAR(T, S)		((T *) xmalloc ((S)))
 #define XCNEWVAR(T, S)		((T *) xcalloc (1, (S)))
+#define XDUPVAR(T, P, S1, S2)	((T *) xmemdup ((P), (S1), (S2)))
 #define XRESIZEVAR(T, P, S)	((T *) xrealloc ((P), (S)))
 
 /* Type-safe obstack allocator.  */
 
 #define XOBNEW(O, T)		((T *) obstack_alloc ((O), sizeof (T)))
+#define XOBNEWVEC(O, T, N)	((T *) obstack_alloc ((O), sizeof (T) * (N)))
+#define XOBNEWVAR(O, T, S)	((T *) obstack_alloc ((O), (S)))
 #define XOBFINISH(O, T)         ((T) obstack_finish ((O)))
 
 /* hex character manipulation routines */
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 95c26e0..d217ca4 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,3 +1,22 @@
+2008-06-13  Peter Bergner  <bergner@vnet.ibm.com>
+
+	* ppc.h (ppc_cpu_t): New typedef.
+	(struct powerpc_opcode <flags>): Use it.
+	(struct powerpc_operand <insert, extract>): Likewise.
+	(struct powerpc_macro <flags>): Likewise.
+
+2008-06-12  Adam Nemet  <anemet@caviumnetworks.com>
+
+	* mips.h: Document new field descriptors +x, +X, +p, +P, +s, +S.
+	Update comment before MIPS16 field descriptors to mention MIPS16.
+	(OP_SH_BBITIND, OP_MASK_BBITIND): New bit mask and shift count for
+	BBIT.
+	(OP_SH_CINSPOS, OP_MASK_CINSPOS, OP_SH_CINSLM1, OP_MASK_CINSLM1):
+	New bit masks and shift counts for cins and exts.
+
+	* mips.h: Document new field descriptors +Q.
+	(OP_SH_SEQI, OP_MASK_SEQI): New bit mask and shift count for SEQI.
+
 2008-04-28  Adam Nemet  <anemet@caviumnetworks.com>
 
 	* mips.h (INSN_MACRO): Move it up to the the pinfo macros.
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index b7de689..8d201f6 100644
--- a/include/opcode/mips.h
+++ b/include/opcode/mips.h
@@ -215,6 +215,16 @@
 #define OP_SH_UDI4		6
 #define OP_MASK_UDI4		0xfffff
 
+/* Octeon */
+#define OP_SH_BBITIND		16
+#define OP_MASK_BBITIND		0x1f
+#define OP_SH_CINSPOS		6
+#define OP_MASK_CINSPOS		0x1f
+#define OP_SH_CINSLM1		11
+#define OP_MASK_CINSLM1		0x1f
+#define OP_SH_SEQI		6
+#define OP_MASK_SEQI		0x3ff
+
 /* This structure holds information for a particular instruction.  */
 
 struct mips_opcode
@@ -370,6 +380,20 @@
    "+3" UDI immediate bits 6-20
    "+4" UDI immediate bits 6-25
 
+   Octeon:
+   "+x" Bit index field of bbit.  Enforces: 0 <= index < 32.
+   "+X" Bit index field of bbit aliasing bbit32.  Matches if 32 <= index < 64,
+	otherwise skips to next candidate.
+   "+p" Position field of cins/cins32/exts/exts32. Enforces 0 <= pos < 32.
+   "+P" Position field of cins/exts aliasing cins32/exts32.  Matches if
+	32 <= pos < 64, otherwise skips to next candidate.
+   "+Q" Immediate field of seqi/snei.  Enforces -512 <= imm < 512.
+   "+s" Length-minus-one field of cins/exts.  Enforces: 0 <= lenm1 < 32.
+   "+S" Length-minus-one field of cins32/exts32 or cins/exts aliasing
+	cint32/exts32.  Enforces non-negative value and that
+	pos + lenm1 < 32 or pos + lenm1 < 64 depending whether previous
+	position field is "+p" or "+P".
+
    Other:
    "()" parens surrounding optional value
    ","  separates operands
@@ -385,8 +409,8 @@
    Extension character sequences used so far ("+" followed by the
    following), for quick reference when adding more:
    "1234"
-   "ABCDEFGHIT"
-   "t"
+   "ABCDEFGHIPQSTX"
+   "pstx"
 */
 
 /* These are the bits which may be set in the pinfo field of an
@@ -962,11 +986,10 @@
 #define MIPS16OP_MASK_IMM6	0x3f
 #define MIPS16OP_SH_IMM6	5
 
-/* These are the characters which may appears in the args field of an
-   instruction.  They appear in the order in which the fields appear
-   when the instruction is used.  Commas and parentheses in the args
-   string are ignored when assembling, and written into the output
-   when disassembling.
+/* These are the characters which may appears in the args field of a MIPS16
+   instruction.  They appear in the order in which the fields appear when the
+   instruction is used.  Commas and parentheses in the args string are ignored
+   when assembling, and written into the output when disassembling.
 
    "y" 3 bit register (MIPS16OP_*_RY)
    "x" 3 bit register (MIPS16OP_*_RX)
diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h
index f4023c7..7b789aa 100644
--- a/include/opcode/ppc.h
+++ b/include/opcode/ppc.h
@@ -22,6 +22,8 @@
 #ifndef PPC_H
 #define PPC_H
 
+typedef unsigned long ppc_cpu_t;
+
 /* The opcode table is an array of struct powerpc_opcode.  */
 
 struct powerpc_opcode
@@ -42,7 +44,7 @@
   /* One bit flags for the opcode.  These are used to indicate which
      specific processors support the instructions.  The defined values
      are listed below.  */
-  unsigned long flags;
+  ppc_cpu_t flags;
 
   /* An array of operand codes.  Each code is an index into the
      operand table.  They appear in the order which the operands must
@@ -183,7 +185,7 @@
      operand value is legal, *ERRMSG will be unchanged (most operands
      can accept any value).  */
   unsigned long (*insert)
-    (unsigned long instruction, long op, int dialect, const char **errmsg);
+    (unsigned long instruction, long op, ppc_cpu_t dialect, const char **errmsg);
 
   /* Extraction function.  This is used by the disassembler.  To
      extract this operand type from an instruction, check this field.
@@ -201,7 +203,7 @@
      non-zero if this operand type can not actually be extracted from
      this operand (i.e., the instruction does not match).  If the
      operand is valid, *INVALID will not be changed.  */
-  long (*extract) (unsigned long instruction, int dialect, int *invalid);
+  long (*extract) (unsigned long instruction, ppc_cpu_t dialect, int *invalid);
 
   /* One bit syntax flags.  */
   unsigned long flags;
@@ -318,7 +320,7 @@
   /* One bit flags for the opcode.  These are used to indicate which
      specific processors support the instructions.  The values are the
      same as those for the struct powerpc_opcode flags field.  */
-  unsigned long flags;
+  ppc_cpu_t flags;
 
   /* A format string to turn the macro into a normal instruction.
      Each %N in the string is replaced with operand number N (zero
diff --git a/include/safe-ctype.h b/include/safe-ctype.h
index e59b357..0266bf1 100644
--- a/include/safe-ctype.h
+++ b/include/safe-ctype.h
@@ -35,10 +35,6 @@
 #ifndef SAFE_CTYPE_H
 #define SAFE_CTYPE_H
 
-#ifdef isalpha
- #error "safe-ctype.h and ctype.h may not be used simultaneously"
-#endif
-
 /* Determine host character set.  */
 #define HOST_CHARSET_UNKNOWN 0
 #define HOST_CHARSET_ASCII   1
@@ -116,4 +112,39 @@
 #define TOUPPER(c) _sch_toupper[(c) & 0xff]
 #define TOLOWER(c) _sch_tolower[(c) & 0xff]
 
+/* Prevent the users of safe-ctype.h from accidently using the routines
+   from ctype.h.  Initially, the approach was to produce an error when
+   detecting that ctype.h has been included.  But this was causing
+   trouble as ctype.h might get indirectly included as a result of
+   including another system header (for instance gnulib's stdint.h).
+   So we include ctype.h here and then immediately redefine its macros.  */
+
+#include <ctype.h>
+#undef isalpha
+#define isalpha(c) do_not_use_isalpha_with_safe_ctype
+#undef isalnum
+#define isalnum(c) do_not_use_isalnum_with_safe_ctype
+#undef iscntrl
+#define iscntrl(c) do_not_use_iscntrl_with_safe_ctype
+#undef isdigit
+#define isdigit(c) do_not_use_isdigit_with_safe_ctype
+#undef isgraph
+#define isgraph(c) do_not_use_isgraph_with_safe_ctype
+#undef islower
+#define islower(c) do_not_use_islower_with_safe_ctype
+#undef isprint
+#define isprint(c) do_not_use_isprint_with_safe_ctype
+#undef ispunct
+#define ispunct(c) do_not_use_ispunct_with_safe_ctype
+#undef isspace
+#define isspace(c) do_not_use_isspace_with_safe_ctype
+#undef isupper
+#define isupper(c) do_not_use_isupper_with_safe_ctype
+#undef isxdigit
+#define isxdigit(c) do_not_use_isxdigit_with_safe_ctype
+#undef toupper
+#define toupper(c) do_not_use_toupper_with_safe_ctype
+#undef tolower
+#define tolower(c) do_not_use_tolower_with_safe_ctype
+
 #endif /* SAFE_CTYPE_H */
diff --git a/intl/ChangeLog b/intl/ChangeLog
index dcb14fb..74018fb 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* configure: Regenerate.
+
+2008-06-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* Makefile.in (datarootdir): New variable.
+
 2008-04-18  Paolo Bonzini  <bonzini@gnu.org>
 
 	PR bootstrap/35457
diff --git a/intl/Makefile.in b/intl/Makefile.in
index ca3814d..96211ff 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -31,6 +31,7 @@
 transform = @program_transform_name@
 libdir = @libdir@
 includedir = @includedir@
+datarootdir = @datarootdir@
 datadir = @datadir@
 localedir = $(datadir)/locale
 aliaspath = $(localedir)
diff --git a/intl/configure b/intl/configure
index 09143ceb..6605bb2 100755
--- a/intl/configure
+++ b/intl/configure
@@ -311,6 +311,7 @@
 
 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT build build_cpu build_vendor build_os host host_cpu host_vendor host_os RANLIB ac_ct_RANLIB CPP EGREP ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB ACLOCAL AUTOCONF AUTOHEADER MAINT LIBINTL_DEP INCINTL LIBOBJS LTLIBOBJS'
 ac_subst_files=''
+ac_pwd=`pwd`
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1283,6 +1284,8 @@
   fi
 done
 if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
   { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -1315,6 +1318,9 @@
 
 
 
+
+
+
           ac_config_headers="$ac_config_headers config.h"
 
 case ../config in
@@ -2090,11 +2096,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -2180,11 +2188,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
 See \`config.log' for more details." >&5
 echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
@@ -2209,13 +2219,15 @@
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+	{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
@@ -2253,11 +2265,13 @@
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
@@ -2304,11 +2318,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -3193,11 +3209,13 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=c
diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
index 91c4f08..a89179b 100644
--- a/libdecnumber/ChangeLog
+++ b/libdecnumber/ChangeLog
@@ -1,3 +1,25 @@
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* Makefile.in ($(srcdir)/aclocal.m4): Update dependencies.
+	* configure: Regenerate.
+
+2008-06-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* Makefile.in (datarootdir): New variable.
+
+2008-06-10  Joseph Myers  <joseph@codesourcery.com>
+
+	* dconfig.h: New.
+	* decContext.c, decExcept.c, decExcept.h, decLibrary.c,
+	decNumber.c, decNumberLocal.h, decRound.c, dpd/decimal128.c,
+	dpd/decimal32.c, dpd/decimal64.c: Include dconfig.h not config.h.
+	* dpd/decimal128Local.h (decimal128SetSign, decimal128ClearSign,
+	decimal128FlipSign): Use WORDS_BIGENDIAN not
+	FLOAT_WORDS_BIG_ENDIAN.
+	* bid/host-ieee128.c: Include dconfig.h.
+	(__host_to_ieee_128, __ieee_to_host_128): Swap 64-bit halves of
+	value if WORDS_BIGENDIAN.
+
 2008-04-18  Paolo Bonzini  <bonzini@gnu.org>
 
 	PR bootstrap/35457
diff --git a/libdecnumber/Makefile.in b/libdecnumber/Makefile.in
index b175059..5e1cabf 100644
--- a/libdecnumber/Makefile.in
+++ b/libdecnumber/Makefile.in
@@ -44,6 +44,7 @@
 RANLIB = @RANLIB@
 SHELL = @SHELL@
 
+datarootdir = @datarootdir@
 datadir = @datadir@
 exec_prefix = @prefix@
 libdir = @libdir@
@@ -95,7 +96,7 @@
 	cd $(srcdir) && $(AUTOCONF)
 
 $(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/../config/stdint.m4 \
-	$(srcdir)/../config/warnings.m4 \
+	$(srcdir)/../config/warnings.m4 $(srcdir)/../config/override.m4 \
 	$(srcdir)/configure.ac
 	cd $(srcdir) && $(ACLOCAL) -I ../config
 
diff --git a/libdecnumber/bid/host-ieee128.c b/libdecnumber/bid/host-ieee128.c
index 6d493e5..12632c8 100644
--- a/libdecnumber/bid/host-ieee128.c
+++ b/libdecnumber/bid/host-ieee128.c
@@ -29,20 +29,35 @@
 
 #include <string.h>
 
+#include "dconfig.h"
 #include "bid-dpd.h"
 #include "decimal128.h"
 
 void __host_to_ieee_128 (_Decimal128 in, decimal128 *out);
 void __ieee_to_host_128 (decimal128 in, _Decimal128 *out);
 
+/* The code for converting 128-bit values between DPD and BID presumes
+   that the 64-bit halves of the 128-bit value are in little-endian
+   order, so they need swapping on big-endian hosts.  */
+
 void
 __host_to_ieee_128 (_Decimal128 in, decimal128 *out)
 {
+#if WORDS_BIGENDIAN
+  memcpy ((char *) out, (char *) &in + 8, 8);
+  memcpy ((char *) out + 8, (char *) &in, 8);
+#else
   memcpy ((char *) out, (char *) &in, 16);
+#endif
 }
 
 void
 __ieee_to_host_128 (decimal128 in, _Decimal128 *out)
 {
+#if WORDS_BIGENDIAN
+  memcpy ((char *) out, (char *) &in + 8, 8);
+  memcpy ((char *) out + 8, (char *) &in, 8);
+#else
   memcpy ((char *) out, (char *) &in, 16);
+#endif
 }
diff --git a/libdecnumber/configure b/libdecnumber/configure
index ab73f46..9ff3a5e 100755
--- a/libdecnumber/configure
+++ b/libdecnumber/configure
@@ -313,6 +313,7 @@
 
 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB ACLOCAL AUTOCONF AUTOHEADER WARN_CFLAGS WARN_PEDANTIC WERROR CPP EGREP MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os enable_decimal_float ADDITIONAL_OBJS LIBOBJS LTLIBOBJS'
 ac_subst_files=''
+ac_pwd=`pwd`
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1284,6 +1285,8 @@
   fi
 done
 if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
   { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -1324,6 +1327,9 @@
 
 
 
+
+
+
 case ../config in
   [\\/]* | ?:[\\/]* ) ac_macro_dir=../config         ;;
   *)                      ac_macro_dir=$srcdir/../config ;;
@@ -1675,11 +1681,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -1765,11 +1773,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
 See \`config.log' for more details." >&5
 echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
@@ -1794,13 +1804,15 @@
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+	{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
@@ -1838,11 +1850,13 @@
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
@@ -1889,11 +1903,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -2881,11 +2897,13 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=c
@@ -4322,19 +4340,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_void_p=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (void *), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4392,11 +4414,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (void *), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -4740,19 +4764,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_long=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4810,11 +4838,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -5158,19 +5188,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_int=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5228,11 +5262,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -5572,19 +5608,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_short=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5642,11 +5682,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -5986,19 +6028,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_char=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (char), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6056,11 +6102,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (char), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -6646,19 +6694,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_int=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6716,11 +6768,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -7060,19 +7114,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_long=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -7130,11 +7188,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
diff --git a/libdecnumber/dconfig.h b/libdecnumber/dconfig.h
new file mode 100644
index 0000000..ffbad25
--- /dev/null
+++ b/libdecnumber/dconfig.h
@@ -0,0 +1,52 @@
+/* Configure decNumber for either host or target.
+   Copyright (C) 2008 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC 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, or (at your option) any later
+   version.
+
+   In addition to the permissions in the GNU General Public License,
+   the Free Software Foundation gives you unlimited permission to link
+   the compiled version of this file into combinations with other
+   programs, and to distribute those combinations without any
+   restriction coming from the use of this file.  (The General Public
+   License restrictions do apply in other respects; for example, they
+   cover modification of the file, and distribution when not linked
+   into a combine executable.)
+
+   GCC 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 GCC; see the file COPYING.  If not, write to the Free
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.  */
+
+#ifdef IN_LIBGCC2
+
+#include "tconfig.h"
+#include "coretypes.h"
+#include "tm.h"
+
+#ifndef LIBGCC2_WORDS_BIG_ENDIAN
+#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
+#endif
+
+#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
+#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN LIBGCC2_WORDS_BIG_ENDIAN
+#endif
+
+#if LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
+#define WORDS_BIGENDIAN 1
+#endif
+
+#else
+
+#include "config.h"
+
+#endif
diff --git a/libdecnumber/decContext.c b/libdecnumber/decContext.c
index 0774193..d2e3bed 100644
--- a/libdecnumber/decContext.c
+++ b/libdecnumber/decContext.c
@@ -37,7 +37,7 @@
 
 #include <string.h>	      /* for strcmp */
 #include <stdio.h>	      /* for printf if DECCHECK */
-#include "config.h"	      /* for GCC definitions */
+#include "dconfig.h"	      /* for GCC definitions */
 #include "decContext.h"	      /* context and base types */
 #include "decNumberLocal.h"   /* decNumber local types, etc. */
 
diff --git a/libdecnumber/decExcept.c b/libdecnumber/decExcept.c
index 6821702..a111aee 100644
--- a/libdecnumber/decExcept.c
+++ b/libdecnumber/decExcept.c
@@ -28,7 +28,7 @@
    02110-1301, USA.  */
 
 #include <fenv.h>
-#include "config.h"
+#include "dconfig.h"
 #include "decContext.h"
 #include "decExcept.h"
 
diff --git a/libdecnumber/decExcept.h b/libdecnumber/decExcept.h
index 12ba87d..5dc1ebb 100644
--- a/libdecnumber/decExcept.h
+++ b/libdecnumber/decExcept.h
@@ -28,7 +28,7 @@
    02110-1301, USA.  */
 
 #include <fenv.h>
-#include "config.h"
+#include "dconfig.h"
 #include "decContext.h"
 
 #define DFP_EXCEPTIONS_ENABLED 1
diff --git a/libdecnumber/decLibrary.c b/libdecnumber/decLibrary.c
index 7e5e928..86daedd 100644
--- a/libdecnumber/decLibrary.c
+++ b/libdecnumber/decLibrary.c
@@ -27,7 +27,7 @@
    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
-#include "config.h"
+#include "dconfig.h"
 #include "decContext.h"
 #include "decimal128.h"
 #include "decimal64.h"
diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c
index c5e223c..f9a624a 100644
--- a/libdecnumber/decNumber.c
+++ b/libdecnumber/decNumber.c
@@ -170,7 +170,7 @@
 #include <stdio.h>		   /* for printf [if needed] */
 #include <string.h>		   /* for strcpy */
 #include <ctype.h>		   /* for lower */
-#include "config.h"		   /* for GCC definitions */
+#include "dconfig.h"		   /* for GCC definitions */
 #include "decNumber.h"		   /* base number library */
 #include "decNumberLocal.h"	   /* decNumber local types, etc. */
 
diff --git a/libdecnumber/decNumberLocal.h b/libdecnumber/decNumberLocal.h
index c07e8cd..809eaa4 100644
--- a/libdecnumber/decNumberLocal.h
+++ b/libdecnumber/decNumberLocal.h
@@ -44,7 +44,7 @@
 
   #include <stdlib.h>	      /* for abs			      */
   #include <string.h>	      /* for memset, strcpy		      */
-  #include "config.h"	      /* for WORDS_BIGENDIAN                  */
+  #include "dconfig.h"	      /* for WORDS_BIGENDIAN                  */
 
   /* Conditional code flag -- set this to match hardware platform     */
   /* 1=little-endian, 0=big-endian	                              */
diff --git a/libdecnumber/decRound.c b/libdecnumber/decRound.c
index 6e51eb6..26740bf 100644
--- a/libdecnumber/decRound.c
+++ b/libdecnumber/decRound.c
@@ -28,7 +28,7 @@
    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
-#include "config.h"
+#include "dconfig.h"
 #include "decContext.h"
 #include "decRound.h"
 
diff --git a/libdecnumber/dpd/decimal128.c b/libdecnumber/dpd/decimal128.c
index 0e32ceb..54191aa 100644
--- a/libdecnumber/dpd/decimal128.c
+++ b/libdecnumber/dpd/decimal128.c
@@ -42,7 +42,7 @@
 #include <string.h>	      /* [for memset/memcpy] */
 #include <stdio.h>	      /* [for printf] */
 
-#include "config.h"	      /* GCC definitions */
+#include "dconfig.h"	      /* GCC definitions */
 #define	 DECNUMDIGITS 34      /* make decNumbers with space for 34 */
 #include "decNumber.h"	      /* base number library */
 #include "decNumberLocal.h"   /* decNumber local types, etc. */
diff --git a/libdecnumber/dpd/decimal128Local.h b/libdecnumber/dpd/decimal128Local.h
index b4130b5..9765427 100644
--- a/libdecnumber/dpd/decimal128Local.h
+++ b/libdecnumber/dpd/decimal128Local.h
@@ -34,14 +34,14 @@
 
 /* Set sign; this assumes the sign was previously zero.  */
 #define decimal128SetSign(d,b) \
-  { (d)->bytes[FLOAT_WORDS_BIG_ENDIAN ? 0 : 15] |= ((unsigned) (b) << 7); }
+  { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] |= ((unsigned) (b) << 7); }
 
 /* Clear sign.  */
 #define decimal128ClearSign(d) \
-  { (d)->bytes[FLOAT_WORDS_BIG_ENDIAN ? 0 : 15] &= ~0x80; }
+  { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] &= ~0x80; }
 
 /* Flip sign.  */
 #define decimal128FlipSign(d) \
-  { (d)->bytes[FLOAT_WORDS_BIG_ENDIAN ? 0 : 15] ^= 0x80; }
+  { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] ^= 0x80; }
 
 #endif
diff --git a/libdecnumber/dpd/decimal32.c b/libdecnumber/dpd/decimal32.c
index 42bddf1..d8e3f59 100644
--- a/libdecnumber/dpd/decimal32.c
+++ b/libdecnumber/dpd/decimal32.c
@@ -42,7 +42,7 @@
 #include <string.h>	      /* [for memset/memcpy] */
 #include <stdio.h>	      /* [for printf] */
 
-#include "config.h"	      /* GCC definitions */
+#include "dconfig.h"	      /* GCC definitions */
 #define	 DECNUMDIGITS  7      /* make decNumbers with space for 7 */
 #include "decNumber.h"	      /* base number library */
 #include "decNumberLocal.h"   /* decNumber local types, etc. */
diff --git a/libdecnumber/dpd/decimal64.c b/libdecnumber/dpd/decimal64.c
index c3617c4..474eb7c 100644
--- a/libdecnumber/dpd/decimal64.c
+++ b/libdecnumber/dpd/decimal64.c
@@ -42,7 +42,7 @@
 #include <string.h>	      /* [for memset/memcpy] */
 #include <stdio.h>	      /* [for printf] */
 
-#include "config.h"	      /* GCC definitions */
+#include "dconfig.h"	      /* GCC definitions */
 #define	 DECNUMDIGITS 16      /* make decNumbers with space for 16 */
 #include "decNumber.h"	      /* base number library */
 #include "decNumberLocal.h"   /* decNumber local types, etc. */
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 18d7707..b77e66d 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,17 @@
+2008-06-19  Eric Blake  <ebb9@byu.net>
+
+	Adjust strsignal to POSIX 200x prototype.
+	* strsignal.c (strsignal): Remove const.
+
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* configure: Regenerate.
+
+2008-06-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* libiberty.texi: Expand TABs, drop indentation outside examples.
+	* obstacks.texi: Likewise.
+
 2008-04-21  Aurelien Jarno  <aurelien@aurel32.net>
 
 	* libiberty/configure.ac: use -fPIC on Linux/MIPS hosts.
@@ -114,9 +128,9 @@
 	* pexecute.txh (pex_free): Document process killing.
 
 2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>
-	
+
 	* cp-demangle.c (d_dump): Handle
-	DEMANGLE_COMPONENT_RVALUE_REFERENCE. 
+	DEMANGLE_COMPONENT_RVALUE_REFERENCE.
 	(d_make_comp): Ditto.
 	(cplus_demangle_type): Ditto.
 	(d_print_comp): Ditto.
@@ -243,7 +257,7 @@
 	* testsuite/Makefile.in: Add dummy install-pdf target.
 
 2007-03-01  Peter Breitenlohner  <peb@mppmu.mpg.de>
-            Eric Botcazou  <ebotcazou@libertysurf.fr>
+	    Eric Botcazou  <ebotcazou@libertysurf.fr>
 
 	PR other/16513
 	* Makefile.in: Install library under $(MULTIOSDIR), not $(MULTISUBDIR).
@@ -254,7 +268,7 @@
 	* configure.ac: add djgpp-specific results, so we don't have to
 	link during a cross compilation.
 	* configure: Regenerated.
-	
+
 2007-01-31  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
 	* hex.c: Fix typo.
@@ -264,7 +278,7 @@
 2007-01-31  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* pex-common.h (struct pex_obj): New fields
-	stderr_pipe and read_err.	
+	stderr_pipe and read_err.
 	* pex-common.c (pex_init_common): Initialize
 	stderr_pipe.
 	(pex_run_in_environment): Add error checking
@@ -353,7 +367,7 @@
 	the end of the string.
 
 2006-11-30  Andrew Stubbs  <andrew.stubbs@st.com>
-            J"orn Rennecke <joern.rennecke@st.com>
+	    J"orn Rennecke <joern.rennecke@st.com>
 
 	PR driver/29931
 	* make-relative-prefix.c (make_relative_prefix_1): New function,
@@ -368,7 +382,7 @@
 	(std_suffixes): Add "" as first element.
 	(find_executable): Remove detection of already-present
 	extension. Try all suffixes in std_suffixes.
-				
+
 2006-11-07  Julian Brown  <julian@codesourcery.com>
 
 	* floatformat.c (get_field): Fix segfault with little-endian word
@@ -387,7 +401,7 @@
 2006-10-25  Ben Elliston  <bje@au.ibm.com>
 
 	* pexecute.txh: Wrap pexecute's "flag" argument with @var {..}.
-	
+
 2006-10-10  Brooks Moses  <bmoses@stanford.edu>
 
 	* Makefile.in: Added "pdf", "libiberty.pdf" target support.
@@ -492,8 +506,8 @@
 2006-04-06  Carlos O'Donell  <carlos@codesourcery.com>
 
 	* Makefile.in: Add install-html, install-html-am, and
-	install-html-recursive targets. Define mkdir_p and 
-	NORMAL_INSTALL. 
+	install-html-recursive targets. Define mkdir_p and
+	NORMAL_INSTALL.
 	* configure.ac: AC_SUBST datarootdir, docdir, htmldir.
 	* configure: Regenerate.
 	* testsuite/Makefile.in: Add install-html and html targets.
@@ -543,7 +557,7 @@
 2006-01-29  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
 	* configure.ac: Add -Wc++-compat to ac_libibety_warn_cflags where
-	supported. 
+	supported.
 	* configure: Regenerated.
 
 2006-01-20  Carlos O'Donell  <carlos@codesourcery.com>
@@ -573,7 +587,7 @@
 	* testsuite/test-demangle.c (main): Recognize option --ret-postfix
 	* testsuite/demangle-expected: Test cases to verify extended encoding.
 	Updated comment to document --ret-postfix option.
-	
+
 2005-11-06  Richard Guenther  <rguenther@suse.de>
 
 	* splay-tree.c (rotate_left): New function.
@@ -709,7 +723,7 @@
 2005-06-30  Daniel Berlin  <dberlin@dberlin.org>
 
 	* hashtab.c (EMPTY_ENTRY): Moved and renamed.
-	(DELETED_ENTRY): Ditto.	
+	(DELETED_ENTRY): Ditto.
 
 2005-06-20  Geoffrey Keating  <geoffk@apple.com>
 
diff --git a/libiberty/configure b/libiberty/configure
index 83e55b8..50e9ba3 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -311,6 +311,7 @@
 
 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libiberty_topdir MAINT NOTMAINT MAKEINFO BUILD_INFO PERL HAVE_PERL build build_cpu build_vendor build_os host host_cpu host_vendor host_os AR ac_ct_AR RANLIB ac_ct_RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP ac_libiberty_warn_cflags NO_MINUS_C_MINUS_O OUTPUT_OPTION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PICFLAG EGREP LIBOBJS CHECK target_header_dir pexecute INSTALL_DEST datarootdir docdir htmldir LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
+ac_pwd=`pwd`
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1283,6 +1284,8 @@
   fi
 done
 if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
   { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -1316,6 +1319,9 @@
 
 
 
+
+
+
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
 # keeping the changes in LD private, export them just because LD is
@@ -2070,11 +2076,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -2193,11 +2201,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
 See \`config.log' for more details." >&5
 echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
@@ -2222,13 +2232,15 @@
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+	{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
@@ -2266,11 +2278,13 @@
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
@@ -2318,11 +2332,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -2946,11 +2962,13 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=c
@@ -4612,19 +4630,23 @@
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_int=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+'') { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; } ;;
+   { (exit 1); exit 1; }; }; } ;;
 esac
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run test program while cross compiling
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4682,11 +4704,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
diff --git a/libiberty/libiberty.texi b/libiberty/libiberty.texi
index d3701e6..9fd6f78 100644
--- a/libiberty/libiberty.texi
+++ b/libiberty/libiberty.texi
@@ -10,7 +10,7 @@
 
 @finalout
 @c %**end of header
- 
+
 @dircategory GNU libraries
 @direntry
 * Libiberty: (libiberty).          Library of utility functions which
diff --git a/libiberty/obstacks.texi b/libiberty/obstacks.texi
index 9bddf7c..a1b1b47 100644
--- a/libiberty/obstacks.texi
+++ b/libiberty/obstacks.texi
@@ -15,20 +15,20 @@
 the padding needed to start each object on a suitable boundary.
 
 @menu
-* Creating Obstacks::		How to declare an obstack in your program.
-* Preparing for Obstacks::	Preparations needed before you can
-				 use obstacks.
+* Creating Obstacks::           How to declare an obstack in your program.
+* Preparing for Obstacks::      Preparations needed before you can
+                                use obstacks.
 * Allocation in an Obstack::    Allocating objects in an obstack.
 * Freeing Obstack Objects::     Freeing objects in an obstack.
-* Obstack Functions::		The obstack functions are both
-				 functions and macros.
+* Obstack Functions::           The obstack functions are both
+                                functions and macros.
 * Growing Objects::             Making an object bigger by stages.
-* Extra Fast Growing::		Extra-high-efficiency (though more
-				 complicated) growing objects.
+* Extra Fast Growing::          Extra-high-efficiency (though more
+                                complicated) growing objects.
 * Status of an Obstack::        Inquiries about the status of an obstack.
 * Obstacks Data Alignment::     Controlling alignment of objects in obstacks.
 * Obstack Chunks::              How obstacks obtain and release chunks;
-				 efficiency considerations.
+                                efficiency considerations.
 * Summary of Obstacks::
 @end menu
 
diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c
index 4ca9e21..666b1b4 100644
--- a/libiberty/strsignal.c
+++ b/libiberty/strsignal.c
@@ -404,10 +404,10 @@
 
 #ifndef HAVE_STRSIGNAL
 
-const char *
+char *
 strsignal (int signo)
 {
-  const char *msg;
+  char *msg;
   static char buf[32];
 
 #ifndef HAVE_SYS_SIGLIST
@@ -428,14 +428,16 @@
     {
       /* In range, but no sys_siglist or no entry at this index. */
       sprintf (buf, "Signal %d", signo);
-      msg = (const char *) buf;
+      msg = buf;
     }
   else
     {
-      /* In range, and a valid message.  Just return the message. */
-      msg = (const char *) sys_siglist[signo];
+      /* In range, and a valid message.  Just return the message.  We
+	 can safely cast away const, since POSIX says the user must
+	 not modify the result.	 */
+      msg = (char *) sys_siglist[signo];
     }
-  
+
   return (msg);
 }
 
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 6c786c7..4110c10 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,73 @@
+2008-07-10  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* mips-dis.c (_print_insn_mips): Use ELF_ST_IS_MIPS16.
+
+2008-07-07  Adam Nemet  <anemet@caviumnetworks.com>
+
+	* mips-opc.c (CP): New macro.
+	(mips_builtin_opcodes): Mark c0, c2 and c3 as CP.  Add Octeon to the
+	membership of di, dmfc0, dmtc0, ei, mfc0 and mtc0.  Add dmfc2 and
+	dmtc2 Octeon instructions.
+
+2008-07-07  Stan Shebs  <stan@codesourcery.com>
+
+	* dis-init.c (init_disassemble_info): Init endian_code field.
+	* arm-dis.c (print_insn): Disassemble code according to
+	setting of endian_code.
+	(print_insn_big_arm): Detect when BE8 extension flag has been set.
+
+2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* mips-dis.c (_print_insn_mips): Use bfd_asymbol_flavour to check
+	for ELF symbols.
+
+2008-06-25  Peter Bergner  <bergner@vnet.ibm.com>
+
+	* ppc-dis.c (powerpc_init_dialect): Handle -M464.
+	(print_ppc_disassembler_options): Likewise.
+	* ppc-opc.c (PPC464): Define.
+	(powerpc_opcodes): Add mfdcrux and mtdcrux.
+
+2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* configure: Regenerate.
+
+2008-06-13  Peter Bergner  <bergner@vnet.ibm.com>
+
+	* ppc-dis.c (print_insn_powerpc): Update prototye to use new
+	ppc_cpu_t typedef.
+	(struct dis_private): New.
+	(POWERPC_DIALECT): New define.
+	(powerpc_dialect): Renamed to...
+	(powerpc_init_dialect): This.  Update to use ppc_cpu_t and
+	struct dis_private.
+	(print_insn_big_powerpc): Update for using structure in
+	info->private_data.
+	(print_insn_little_powerpc): Likewise.
+	(operand_value_powerpc): Change type of dialect param to ppc_cpu_t.
+	(skip_optional_operands): Likewise.
+	(print_insn_powerpc): Likewise.  Remove initialization of dialect.
+	* ppc-opc.c (extract_bat, extract_bba, extract_bdm, extract_bdp,
+	extract_bo, extract_boe, extract_fxm, extract_mb6, extract_mbe,
+	extract_nb, extract_nsi, extract_rbs, extract_sh6, extract_spr,
+	extract_sprg, extract_tbr insert_bat, insert_bba, insert_bdm,
+	insert_bdp, insert_bo, insert_boe, insert_fxm, insert_mb6, insert_mbe,
+	insert_nsi, insert_ral, insert_ram, insert_raq, insert_ras, insert_rbs,
+	insert_sh6, insert_spr, insert_sprg, insert_tbr): Change the dialect
+	param to be of type ppc_cpu_t.  Update prototype.
+
+2008-06-12  Adam Nemet  <anemet@caviumnetworks.com>
+
+	* mips-dis.c (print_insn_args): Handle field descriptors +x, +p,
+	+s, +S.
+	* mips-opc.c (mips_builtin_opcodes): Add Octeon instructions
+	baddu, bbit*, cins*, dmul, pop, dpop, exts*, mtm*, mtp*, syncs,
+	syncw, syncws, vm3mulu, vm0 and vmulu.
+
+	* mips-dis.c (print_insn_args): Handle field descriptor +Q.
+	* mips-opc.c (mips_builtin_opcodes): Add Octeon instructions seq,
+	seqi, sne and snei.
+
 2008-05-30  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* i386-opc.tbl: Add vmovd with 64bit operand.
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index e9a48e5..155e495 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -3974,6 +3974,7 @@
   int           status;
   int           is_thumb = FALSE;
   int           is_data = FALSE;
+  int           little_code;
   unsigned int	size = 4;
   void	 	(*printer) (bfd_vma, struct disassemble_info *, long);
   bfd_boolean   found = FALSE;
@@ -3986,6 +3987,10 @@
       info->disassembler_options = NULL;
     }
 
+  /* Decide if our code is going to be little-endian, despite what the
+     function argument might say.  */
+  little_code = ((info->endian_code == BFD_ENDIAN_LITTLE) || little);
+
   /* First check the full symtab for a mapping symbol, even if there
      are no usable non-mapping symbols for this address.  */
   if (info->symtab != NULL
@@ -4131,7 +4136,7 @@
       size = 4;
 
       status = info->read_memory_func (pc, (bfd_byte *)b, 4, info);
-      if (little)
+      if (little_code)
 	given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
       else
 	given = (b[3]) | (b[2] << 8) | (b[1] << 16) | (b[0] << 24);
@@ -4147,7 +4152,7 @@
       size = 2;
 
       status = info->read_memory_func (pc, (bfd_byte *)b, 2, info);
-      if (little)
+      if (little_code)
 	given = (b[0]) | (b[1] << 8);
       else
 	given = (b[1]) | (b[0] << 8);
@@ -4161,7 +4166,7 @@
 	      || (given & 0xF800) == 0xE800)
 	    {
 	      status = info->read_memory_func (pc + 2, (bfd_byte *)b, 2, info);
-	      if (little)
+	      if (little_code)
 		given = (b[0]) | (b[1] << 8) | (given << 16);
 	      else
 		given = (b[1]) | (b[0] << 8) | (given << 16);
@@ -4172,7 +4177,7 @@
 	}
 
       if (ifthen_address != pc)
-	find_ifthen_state(pc, info, little);
+	find_ifthen_state(pc, info, little_code);
 
       if (ifthen_state)
 	{
@@ -4210,6 +4215,12 @@
 int
 print_insn_big_arm (bfd_vma pc, struct disassemble_info *info)
 {
+  /* Detect BE8-ness and record it in the disassembler info.  */
+  if (info->flavour == bfd_target_elf_flavour
+      && info->section != NULL
+      && (elf_elfheader (info->section->owner)->e_flags & EF_ARM_BE8))
+    info->endian_code = BFD_ENDIAN_LITTLE;
+
   return print_insn (pc, info, FALSE);
 }
 
diff --git a/opcodes/configure b/opcodes/configure
index 27fefd5..3434bbc 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -460,6 +460,7 @@
 
 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S lt_ECHO CPP WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE CC_FOR_BUILD EXEEXT_FOR_BUILD HDEFINES CGEN_MAINT_TRUE CGEN_MAINT_FALSE cgendir SHARED_LDFLAGS SHARED_LIBADD SHARED_DEPENDENCIES archdefs BFD_MACHINES LIBOBJS LTLIBOBJS'
 ac_subst_files=''
+ac_pwd=`pwd`
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1450,6 +1451,8 @@
   fi
 done
 if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
   { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -1483,6 +1486,9 @@
 
 
 
+
+
+
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
   if test -f $ac_dir/install-sh; then
@@ -1899,11 +1905,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -1989,11 +1997,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
 See \`config.log' for more details." >&5
 echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
@@ -2018,13 +2028,15 @@
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+	{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
@@ -2062,11 +2074,13 @@
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
@@ -2113,11 +2127,13 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+{ { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&5
 echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -3561,11 +3577,13 @@
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&5
 echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 
 # Provide some information about the compiler.
 echo "$as_me:$LINENO:" \
@@ -4683,13 +4701,13 @@
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4686: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4704: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4689: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4707: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4692: output\"" >&5)
+  (eval echo "\"\$as_me:4710: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5744,7 +5762,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5747 "configure"' > conftest.$ac_ext
+  echo '#line 5765 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6151,11 +6169,13 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=c
@@ -6844,11 +6864,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6847: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6867: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6851: \$? = $ac_status" >&5
+   echo "$as_me:6871: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7166,11 +7186,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7169: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7189: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7173: \$? = $ac_status" >&5
+   echo "$as_me:7193: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7271,11 +7291,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7274: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7294: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7278: \$? = $ac_status" >&5
+   echo "$as_me:7298: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7326,11 +7346,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7329: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7349: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7333: \$? = $ac_status" >&5
+   echo "$as_me:7353: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10123,7 +10143,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10126 "configure"
+#line 10146 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10223,7 +10243,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10226 "configure"
+#line 10246 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/opcodes/dis-init.c b/opcodes/dis-init.c
index dff91eb..8027963 100644
--- a/opcodes/dis-init.c
+++ b/opcodes/dis-init.c
@@ -32,6 +32,7 @@
   info->flavour = bfd_target_unknown_flavour;
   info->arch = bfd_arch_unknown;
   info->endian = BFD_ENDIAN_UNKNOWN;
+  info->endian_code = info->endian;
   info->octets_per_byte = 1;
   info->fprintf_func = fprintf_func;
   info->stream = stream;
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index a03078a..744d5a9 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -882,6 +882,33 @@
 		break;
 	      }
 
+	    case 'x':		/* bbit bit index */
+	      (*info->fprintf_func) (info->stream, "0x%lx",
+				     (l >> OP_SH_BBITIND) & OP_MASK_BBITIND);
+	      break;
+
+	    case 'p':		/* cins, cins32, exts and exts32 position */
+	      (*info->fprintf_func) (info->stream, "0x%lx",
+				     (l >> OP_SH_CINSPOS) & OP_MASK_CINSPOS);
+	      break;
+
+	    case 's':		/* cins and exts length-minus-one */
+	      (*info->fprintf_func) (info->stream, "0x%lx",
+				     (l >> OP_SH_CINSLM1) & OP_MASK_CINSLM1);
+	      break;
+
+	    case 'S':		/* cins32 and exts32 length-minus-one field */
+	      (*info->fprintf_func) (info->stream, "0x%lx",
+				     (l >> OP_SH_CINSLM1) & OP_MASK_CINSLM1);
+	      break;
+
+	    case 'Q':		/* seqi/snei immediate field */
+	      op = (l >> OP_SH_SEQI) & OP_MASK_SEQI;
+	      /* Sign-extend it.  */
+	      op = (op ^ 512) - 512;
+	      (*info->fprintf_func) (info->stream, "%d", op);
+	      break;
+
 	    default:
 	      /* xgettext:c-format */
 	      (*info->fprintf_func) (info->stream,
@@ -2039,10 +2066,10 @@
 
 #if SYMTAB_AVAILABLE
   if (info->mach == bfd_mach_mips16
-      || (info->flavour == bfd_target_elf_flavour
-	  && info->symbols != NULL
-	  && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other
-	      == STO_MIPS16)))
+      || (info->symbols != NULL
+	  && bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
+	  && ELF_ST_IS_MIPS16 ((*(elf_symbol_type **) info->symbols)
+			       ->internal_elf_sym.st_other)))
     return print_insn_mips16 (memaddr, info);
 #endif
 
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index 1787c9e..82a01f8 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -62,6 +62,7 @@
 #define WR_C1	INSN_COP
 #define WR_C2   INSN_COP
 #define WR_C3   INSN_COP
+#define CP	INSN_COP
 
 #define WR_HI	INSN_WRITE_HI
 #define RD_HI	INSN_READ_HI
@@ -244,8 +245,15 @@
 {"and.ob",  "D,S,k",	0x4bc0000c, 0xffe0003f,	WR_D|RD_S|RD_T,		0,		N54	},
 {"and.qh",  "X,Y,Q",	0x7820000c, 0xfc20003f,	WR_D|RD_S|RD_T|FP_D,	0,		MX	},
 {"andi",    "t,r,i",	0x30000000, 0xfc000000,	WR_t|RD_s,		0,		I1	},
+{"baddu",   "d,v,t",	0x70000028, 0xfc0007ff, WR_d|RD_s|RD_t,		0,		IOCT	},
 /* b is at the top of the table.  */
 /* bal is at the top of the table.  */
+{"bbit032", "s,+x,p",	0xd8000000, 0xfc000000, RD_s|CBD,		0,		IOCT	},
+{"bbit0",   "s,+X,p",	0xd8000000, 0xfc000000, RD_s|CBD,		0,		IOCT	}, /* bbit032 */
+{"bbit0",   "s,+x,p",	0xc8000000, 0xfc000000, RD_s|CBD,		0,		IOCT	},
+{"bbit132", "s,+x,p",	0xf8000000, 0xfc000000, RD_s|CBD,		0,		IOCT	},
+{"bbit1",   "s,+X,p",	0xf8000000, 0xfc000000, RD_s|CBD,		0,		IOCT	}, /* bbit132 */
+{"bbit1",   "s,+x,p",	0xe8000000, 0xfc000000, RD_s|CBD,		0,		IOCT	},
 /* bc0[tf]l? are at the bottom of the table.  */
 {"bc1any2f", "N,p",	0x45200000, 0xffe30000,	CBD|RD_CC|FP_S,		0,		M3D	},
 {"bc1any2t", "N,p",	0x45210000, 0xffe30000,	CBD|RD_CC|FP_S,		0,		M3D	},
@@ -514,6 +522,9 @@
 {"cftc1",   "d,E",	0x41000023, 0xffe007ff, TRAP|LCD|WR_d|RD_C1|FP_S, 0,		MT32	},
 {"cftc1",   "d,T",	0x41000023, 0xffe007ff, TRAP|LCD|WR_d|RD_C1|FP_S, 0,		MT32	},
 {"cftc2",   "d,E",	0x41000025, 0xffe007ff, TRAP|LCD|WR_d|RD_C2,	0,		MT32	},
+{"cins32",  "t,r,+p,+S",0x70000033, 0xfc00003f, WR_t|RD_s,		0,		IOCT	},
+{"cins",    "t,r,+P,+S",0x70000033, 0xfc00003f, WR_t|RD_s,		0,		IOCT	}, /* cins32 */
+{"cins",    "t,r,+p,+s",0x70000032, 0xfc00003f, WR_t|RD_s,		0,		IOCT	},
 {"clo",     "U,s",      0x70000021, 0xfc0007ff, WR_d|WR_t|RD_s, 	0,		I32|N55 },
 {"clz",     "U,s",      0x70000020, 0xfc0007ff, WR_d|WR_t|RD_s, 	0,		I32|N55 },
 {"ctc0",    "t,G",	0x40c00000, 0xffe007ff,	COD|RD_t|WR_CC,		0,		I1	},
@@ -567,8 +578,8 @@
 {"ddivu",   "z,s,t",    0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO,      0,		I3      },
 {"ddivu",   "d,v,t",	0,    (int) M_DDIVU_3,	INSN_MACRO,		0,		I3	},
 {"ddivu",   "d,v,I",	0,    (int) M_DDIVU_3I,	INSN_MACRO,		0,		I3	},
-{"di",      "",		0x41606000, 0xffffffff,	WR_t|WR_C0,		0,		I33	},
-{"di",      "t",	0x41606000, 0xffe0ffff,	WR_t|WR_C0,		0,		I33	},
+{"di",      "",		0x41606000, 0xffffffff,	WR_t|WR_C0,		0,		I33|IOCT},
+{"di",      "t",	0x41606000, 0xffe0ffff,	WR_t|WR_C0,		0,		I33|IOCT},
 {"dins",    "t,r,I,+I",	0,    (int) M_DINS,	INSN_MACRO,		0,		I65	},
 {"dins",    "t,r,+A,+B", 0x7c000007, 0xfc00003f, WR_t|RD_s,    		0,		I65	},
 {"dinsm",   "t,r,+A,+F", 0x7c000005, 0xfc00003f, WR_t|RD_s,    		0,		I65	},
@@ -603,14 +614,14 @@
 {"dmaccu",  "d,s,t",	0x00000069, 0xfc0007ff,	RD_s|RD_t|WR_LO|WR_d,	0,		N412	},
 {"dmaccus", "d,s,t",	0x00000469, 0xfc0007ff,	RD_s|RD_t|WR_LO|WR_d,	0,		N412	},
 {"dmadd16", "s,t",      0x00000029, 0xfc00ffff, RD_s|RD_t|MOD_LO,       0,		N411    },
-{"dmfc0",   "t,G",	0x40200000, 0xffe007ff, LCD|WR_t|RD_C0,		0,		I3	},
-{"dmfc0",   "t,+D",     0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I64     },
-{"dmfc0",   "t,G,H",    0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I64     },
+{"dmfc0",   "t,G",	0x40200000, 0xffe007ff, LCD|WR_t|RD_C0,		0,		I3|IOCT	},
+{"dmfc0",   "t,+D",     0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I64|IOCT},
+{"dmfc0",   "t,G,H",    0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I64|IOCT},
 {"dmt",     "",		0x41600bc1, 0xffffffff, TRAP,			0,		MT32	},
 {"dmt",     "t",	0x41600bc1, 0xffe0ffff, TRAP|WR_t,		0,		MT32	},
-{"dmtc0",   "t,G",	0x40a00000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC,	0,		I3	},
-{"dmtc0",   "t,+D",     0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I64     },
-{"dmtc0",   "t,G,H",    0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I64     },
+{"dmtc0",   "t,G",	0x40a00000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC,	0,		I3|IOCT	},
+{"dmtc0",   "t,+D",     0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I64|IOCT},
+{"dmtc0",   "t,G,H",    0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I64|IOCT},
 {"dmfc1",   "t,S",	0x44200000, 0xffe007ff, LCD|WR_t|RD_S|FP_D,	0,		I3	},
 {"dmfc1",   "t,G",      0x44200000, 0xffe007ff, LCD|WR_t|RD_S|FP_D,     0,		I3      },
 {"dmtc1",   "t,S",	0x44a00000, 0xffe007ff, COD|RD_t|WR_S|FP_D,	0,		I3	},
@@ -619,6 +630,7 @@
 /* dmtc2 is at the bottom of the table.  */
 /* dmfc3 is at the bottom of the table.  */
 /* dmtc3 is at the bottom of the table.  */
+{"dmul",    "d,v,t",	0x70000003, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO,	0,		IOCT	},
 {"dmul",    "d,v,t",	0,    (int) M_DMUL,	INSN_MACRO,		0,		I3	},
 {"dmul",    "d,v,I",	0,    (int) M_DMUL_I,	INSN_MACRO,		0,		I3	},
 {"dmulo",   "d,v,t",	0,    (int) M_DMULO,	INSN_MACRO,		0,		I3	},
@@ -629,6 +641,7 @@
 {"dmultu",  "s,t",      0x0000001d, 0xfc00ffff, RD_s|RD_t|WR_HILO,      0,		I3	},
 {"dneg",    "d,w",	0x0000002e, 0xffe007ff,	WR_d|RD_t,		0,		I3	}, /* dsub 0 */
 {"dnegu",   "d,w",	0x0000002f, 0xffe007ff,	WR_d|RD_t,		0,		I3	}, /* dsubu 0*/
+{"dpop",    "d,v",	0x7000002d, 0xfc1f07ff, WR_d|RD_s,		0,		IOCT	},
 {"drem",    "z,s,t",    0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO,      0,		I3      },
 {"drem",    "d,v,t",	0,    (int) M_DREM_3,	INSN_MACRO,		0,		I3	},
 {"drem",    "d,v,I",	0,    (int) M_DREM_3I,	INSN_MACRO,		0,		I3	},
@@ -680,14 +693,17 @@
 {"dsubu",   "d,v,I",	0,    (int) M_DSUBU_I,	INSN_MACRO,		0,		I3	},
 {"dvpe",    "",		0x41600001, 0xffffffff, TRAP,			0,		MT32	},
 {"dvpe",    "t",	0x41600001, 0xffe0ffff, TRAP|WR_t,		0,		MT32	},
-{"ei",      "",		0x41606020, 0xffffffff,	WR_t|WR_C0,		0,		I33	},
-{"ei",      "t",	0x41606020, 0xffe0ffff,	WR_t|WR_C0,		0,		I33	},
+{"ei",      "",		0x41606020, 0xffffffff,	WR_t|WR_C0,		0,		I33|IOCT},
+{"ei",      "t",	0x41606020, 0xffe0ffff,	WR_t|WR_C0,		0,		I33|IOCT},
 {"emt",     "",		0x41600be1, 0xffffffff, TRAP,			0,		MT32	},
 {"emt",     "t",	0x41600be1, 0xffe0ffff, TRAP|WR_t,		0,		MT32	},
 {"eret",    "",         0x42000018, 0xffffffff, 0,      		0,		I3_32	},
 {"evpe",    "",		0x41600021, 0xffffffff, TRAP,			0,		MT32	},
 {"evpe",    "t",	0x41600021, 0xffe0ffff, TRAP|WR_t,		0,		MT32	},
 {"ext",     "t,r,+A,+C", 0x7c000000, 0xfc00003f, WR_t|RD_s,    		0,		I33	},
+{"exts32",  "t,r,+p,+S",0x7000003b, 0xfc00003f, WR_t|RD_s,		0,		IOCT	},
+{"exts",    "t,r,+P,+S",0x7000003b, 0xfc00003f, WR_t|RD_s,		0,		IOCT	}, /* exts32 */
+{"exts",    "t,r,+p,+s",0x7000003a, 0xfc00003f, WR_t|RD_s,		0,		IOCT	},
 {"floor.l.d", "D,S",	0x4620000b, 0xffff003f, WR_D|RD_S|FP_D,		0,		I3_33	},
 {"floor.l.s", "D,S",	0x4600000b, 0xffff003f, WR_D|RD_S|FP_S|FP_D,	0,		I3_33	},
 {"floor.w.d", "D,S",	0x4620000f, 0xffff003f, WR_D|RD_S|FP_S|FP_D,	0,		I2	},
@@ -849,9 +865,9 @@
 {"mftlo",   "d",	0x41000021, 0xffff07ff, TRAP|WR_d|RD_a,		0,		MT32	},
 {"mftlo",   "d,*",	0x41000021, 0xfff307ff, TRAP|WR_d|RD_a,		0,		MT32	},
 {"mftr",    "d,t,!,H,$", 0x41000000, 0xffe007c8, TRAP|WR_d,		0,		MT32	},
-{"mfc0",    "t,G",	0x40000000, 0xffe007ff,	LCD|WR_t|RD_C0,		0,		I1	},
-{"mfc0",    "t,+D",     0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I32     },
-{"mfc0",    "t,G,H",    0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I32     },
+{"mfc0",    "t,G",	0x40000000, 0xffe007ff,	LCD|WR_t|RD_C0,		0,		I1|IOCT	},
+{"mfc0",    "t,+D",     0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I32|IOCT},
+{"mfc0",    "t,G,H",    0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 	0,		I32|IOCT},
 {"mfc1",    "t,S",	0x44000000, 0xffe007ff,	LCD|WR_t|RD_S|FP_S,	0,		I1	},
 {"mfc1",    "t,G",	0x44000000, 0xffe007ff,	LCD|WR_t|RD_S|FP_S,	0,		I1	},
 {"mfhc1",   "t,S",	0x44600000, 0xffe007ff,	LCD|WR_t|RD_S|FP_D,	0,		I33	},
@@ -924,9 +940,9 @@
 {"msubu",   "7,s,t",	0x70000005, 0xfc00e7ff, MOD_a|RD_s|RD_t,        0,              D33	},
 {"mtpc",    "t,P",	0x4080c801, 0xffe0ffc1,	COD|RD_t|WR_C0,		0,		M1|N5	},
 {"mtps",    "t,P",	0x4080c800, 0xffe0ffc1,	COD|RD_t|WR_C0,		0,		M1|N5	},
-{"mtc0",    "t,G",	0x40800000, 0xffe007ff,	COD|RD_t|WR_C0|WR_CC,	0,		I1	},
-{"mtc0",    "t,+D",     0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I32     },
-{"mtc0",    "t,G,H",    0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I32     },
+{"mtc0",    "t,G",	0x40800000, 0xffe007ff,	COD|RD_t|WR_C0|WR_CC,	0,		I1|IOCT	},
+{"mtc0",    "t,+D",     0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I32|IOCT},
+{"mtc0",    "t,G,H",    0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   0,		I32|IOCT},
 {"mtc1",    "t,S",	0x44800000, 0xffe007ff,	COD|RD_t|WR_S|FP_S,	0,		I1	},
 {"mtc1",    "t,G",	0x44800000, 0xffe007ff,	COD|RD_t|WR_S|FP_S,	0,		I1	},
 {"mthc1",   "t,S",	0x44e00000, 0xffe007ff,	COD|RD_t|WR_S|FP_D,	0,		I33	},
@@ -940,6 +956,12 @@
 {"mtlo",    "s",	0x00000013, 0xfc1fffff,	RD_s|WR_LO,		0,		I1	},
 {"mtlo",    "s,7",	0x00000013, 0xfc1fe7ff, RD_s|WR_LO,		0,		D32	},
 {"mtlhx",   "s",	0x00000053, 0xfc1fffff,	RD_s|MOD_HILO,		0,		SMT	},
+{"mtm0",    "s",	0x70000008, 0xfc1fffff, RD_s,			0,		IOCT	},
+{"mtm1",    "s",	0x7000000c, 0xfc1fffff, RD_s,			0,		IOCT	},
+{"mtm2",    "s",	0x7000000d, 0xfc1fffff, RD_s,			0,		IOCT	},
+{"mtp0",    "s",	0x70000009, 0xfc1fffff, RD_s,			0,		IOCT	},
+{"mtp1",    "s",	0x7000000a, 0xfc1fffff, RD_s,			0,		IOCT	},
+{"mtp2",    "s",	0x7000000b, 0xfc1fffff, RD_s,			0,		IOCT	},
 {"mttc0",   "t,G",	0x41800000, 0xffe007ff, TRAP|COD|RD_t|WR_C0|WR_CC, 0,		MT32	},
 {"mttc0",   "t,+D",	0x41800000, 0xffe007f8, TRAP|COD|RD_t|WR_C0|WR_CC, 0,		MT32	},
 {"mttc0",   "t,G,H",	0x41800000, 0xffe007f8, TRAP|COD|RD_t|WR_C0|WR_CC, 0,		MT32	},
@@ -1070,6 +1092,7 @@
 {"pickt.qh", "X,Y,Q",	0x78200003, 0xfc20003f,	WR_D|RD_S|RD_T|FP_D,	0,		MX	},
 {"pll.ps",  "D,V,T",	0x46c0002c, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	0,		I5_33	},
 {"plu.ps",  "D,V,T",	0x46c0002d, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	0,		I5_33	},
+{"pop",     "d,v",	0x7000002c, 0xfc1f07ff, WR_d|RD_s,		0,		IOCT	},
   /* pref and prefx are at the start of the table.  */
 {"pul.ps",  "D,V,T",	0x46c0002e, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	0,		I5_33	},
 {"puu.ps",  "D,V,T",	0x46c0002f, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	0,		I5_33	},
@@ -1169,10 +1192,12 @@
 {"seh",     "d,w",	0x7c000620, 0xffe007ff,	WR_d|RD_t,		0,		I33	},
 {"selsl",   "d,v,t",	0x00000005, 0xfc0007ff,	WR_d|RD_s|RD_t,		0,		L1	},
 {"selsr",   "d,v,t",	0x00000001, 0xfc0007ff,	WR_d|RD_s|RD_t,		0,		L1	},
+{"seq",	    "d,v,t",	0x7000002a, 0xfc0007ff, WR_d|RD_s|RD_t,		0,		IOCT	},
 {"seq",     "d,v,t",	0,    (int) M_SEQ,	INSN_MACRO,		0,		I1	},
 {"seq",     "d,v,I",	0,    (int) M_SEQ_I,	INSN_MACRO,		0,		I1	},
 {"seq",	"S,T",		0x46a00032,	0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	0,	IL2E	},
 {"seq",	"S,T",		0x4ba0000c,	0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	0,	IL2F	},
+{"seqi",    "t,r,+Q",	0x7000002e, 0xfc00003f, WR_t|RD_s,		0,		IOCT	},
 {"sge",     "d,v,t",	0,    (int) M_SGE,	INSN_MACRO,		0,		I1	},
 {"sge",     "d,v,I",	0,    (int) M_SGE_I,	INSN_MACRO,		0,		I1	},
 {"sgeu",    "d,v,t",	0,    (int) M_SGEU,	INSN_MACRO,		0,		I1	},
@@ -1224,8 +1249,10 @@
 {"sltu",    "d,v,I",	0,    (int) M_SLTU_I,	INSN_MACRO,		0,		I1	},
 {"sltu",	"S,T",		0x4680003c,	0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	0,	IL2E	},
 {"sltu",	"S,T",		0x4b80000d,	0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	0,	IL2F	},
+{"sne",	    "d,v,t",	0x7000002b, 0xfc0007ff, WR_d|RD_s|RD_t,		0,		IOCT	},
 {"sne",     "d,v,t",	0,    (int) M_SNE,	INSN_MACRO,		0,		I1	},
 {"sne",     "d,v,I",	0,    (int) M_SNE_I,	INSN_MACRO,		0,		I1	},
+{"snei",    "t,r,+Q",	0x7000002f, 0xfc00003f, WR_t|RD_s,		0,		IOCT	},
 {"sqrt.d",  "D,S",	0x46200004, 0xffff003f, WR_D|RD_S|FP_D,		0,		I2	},
 {"sqrt.s",  "D,S",	0x46000004, 0xffff003f, WR_D|RD_S|FP_S,		0,		I2	},
 {"sqrt.ps", "D,S",	0x46c00004, 0xffff003f, WR_D|RD_S|FP_D,		0,		SB1	},
@@ -1297,6 +1324,9 @@
 {"sync.l",  "",		0x0000000f, 0xffffffff,	INSN_SYNC,		0,		I2	},
 {"synci",   "o(b)",	0x041f0000, 0xfc1f0000,	SM|RD_b,		0,		I33	},
 {"synciobdma", "",	0x0000008f, 0xffffffff,	INSN_SYNC,		0,		IOCT	},
+{"syncs",   "",		0x0000018f, 0xffffffff,	INSN_SYNC,		0,		IOCT	},
+{"syncw",   "",		0x0000010f, 0xffffffff,	INSN_SYNC,		0,		IOCT	},
+{"syncws",  "",		0x0000014f, 0xffffffff,	INSN_SYNC,		0,		IOCT	},
 {"syscall", "",		0x0000000c, 0xffffffff,	TRAP,			0,		I1	},
 {"syscall", "B",	0x0000000c, 0xfc00003f,	TRAP,			0,		I1	},
 {"teqi",    "s,j",	0x040c0000, 0xfc1f0000, RD_s|TRAP,		0,		I2	},
@@ -1355,6 +1385,9 @@
 {"ush",     "t,A(b)",	0,    (int) M_USH_A,	INSN_MACRO,		0,		I1	},
 {"usw",     "t,o(b)",	0,    (int) M_USW,	INSN_MACRO,		0,		I1	},
 {"usw",     "t,A(b)",	0,    (int) M_USW_A,	INSN_MACRO,		0,		I1	},
+{"v3mulu",  "d,v,t",	0x70000011, 0xfc0007ff, WR_d|RD_s|RD_t,		0,		IOCT	},
+{"vmm0",    "d,v,t",	0x70000010, 0xfc0007ff, WR_d|RD_s|RD_t,		0,		IOCT	},
+{"vmulu",   "d,v,t",	0x7000000f, 0xfc0007ff, WR_d|RD_s|RD_t,		0,		IOCT	},
 {"wach.ob", "Y",	0x7a00003e, 0xffff07ff,	RD_S|FP_D,		WR_MACC,	MX|SB1	},
 {"wach.ob", "S",	0x4a00003e, 0xffff07ff,	RD_S,			0,		N54	},
 {"wach.qh", "Y",	0x7a20003e, 0xffff07ff,	RD_S|FP_D,		WR_MACC,	MX	},
@@ -1459,8 +1492,10 @@
 {"ctc2",    "t,G",	0x48c00000, 0xffe007ff,	COD|RD_t|WR_CC,		0,		I1	},
 {"dmfc2",   "t,G",	0x48200000, 0xffe007ff,	LCD|WR_t|RD_C2,		0,		I3	},
 {"dmfc2",   "t,G,H",	0x48200000, 0xffe007f8,	LCD|WR_t|RD_C2,		0,		I64	},
+{"dmfc2",   "t,i",	0x48200000, 0xffe00000,	LCD|WR_t|RD_C2,		0,		IOCT	},
 {"dmtc2",   "t,G",	0x48a00000, 0xffe007ff,	COD|RD_t|WR_C2|WR_CC,	0,		I3	},
 {"dmtc2",   "t,G,H",	0x48a00000, 0xffe007f8,	COD|RD_t|WR_C2|WR_CC,	0,		I64	},
+{"dmtc2",   "t,i",	0x48a00000, 0xffe00000,	COD|RD_t|WR_C2|WR_CC,	0,		IOCT	},
 {"mfc2",    "t,G",	0x48000000, 0xffe007ff,	LCD|WR_t|RD_C2,		0,		I1	},
 {"mfc2",    "t,G,H",	0x48000000, 0xffe007f8,	LCD|WR_t|RD_C2,		0,		I32	},
 {"mfhc2",   "t,G",	0x48600000, 0xffe007ff,	LCD|WR_t|RD_C2,		0,		I33	},
@@ -1926,10 +1961,10 @@
    change the state of the processor and if they do it's up to the
    user to put in nops as necessary.  These are at the end so that the
    disassembler recognizes more specific versions first.  */
-{"c0",      "C",	0x42000000, 0xfe000000,	0,			0,		I1	},
+{"c0",      "C",	0x42000000, 0xfe000000,	CP,			0,		I1	},
 {"c1",      "C",	0x46000000, 0xfe000000,	FP_S,			0,		I1	},
-{"c2",      "C",	0x4a000000, 0xfe000000,	0,			0,		I1	},
-{"c3",      "C",	0x4e000000, 0xfe000000,	0,			0,		I1	},
+{"c2",      "C",	0x4a000000, 0xfe000000,	CP,			0,		I1	},
+{"c3",      "C",	0x4e000000, 0xfe000000,	CP,			0,		I1	},
 {"cop0",     "C",	0,    (int) M_COP0,	INSN_MACRO,		0,		I1	},
 {"cop1",     "C",	0,    (int) M_COP1,	INSN_MACRO,		INSN2_M_FP_S,	I1	},
 {"cop2",     "C",	0,    (int) M_COP2,	INSN_MACRO,		0,		I1	},
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index e5bae64..5a9f707 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -30,17 +30,30 @@
    are provided because this file handles disassembly for the PowerPC
    in both big and little endian mode and also for the POWER (RS/6000)
    chip.  */
+static int print_insn_powerpc (bfd_vma, struct disassemble_info *, int,
+			       ppc_cpu_t);
 
-static int print_insn_powerpc (bfd_vma, struct disassemble_info *, int, int);
+struct dis_private
+{
+  /* Stash the result of parsing disassembler_options here.  */
+  ppc_cpu_t dialect;
+};
+
+#define POWERPC_DIALECT(INFO) \
+  (((struct dis_private *) ((INFO)->private_data))->dialect)
 
 /* Determine which set of machines to disassemble for.  PPC403/601 or
    BookE.  For convenience, also disassemble instructions supported
    by the AltiVec vector unit.  */
 
 static int
-powerpc_dialect (struct disassemble_info *info)
+powerpc_init_dialect (struct disassemble_info *info)
 {
-  int dialect = PPC_OPCODE_PPC;
+  ppc_cpu_t dialect = PPC_OPCODE_PPC;
+  struct dis_private *priv = calloc (sizeof (*priv), 1);
+
+  if (priv == NULL)
+    return FALSE;
 
   if (BFD_DEFAULT_TARGET_SIZE == 64)
     dialect |= PPC_OPCODE_64;
@@ -72,7 +85,8 @@
 	   && strstr (info->disassembler_options, "e300") != NULL)
     dialect |= PPC_OPCODE_E300 | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON;
   else if (info->disassembler_options
-	   && strstr (info->disassembler_options, "440") != NULL)
+	   && (strstr (info->disassembler_options, "440") != NULL
+	       || strstr (info->disassembler_options, "464") != NULL))
     dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_32
       | PPC_OPCODE_440 | PPC_OPCODE_ISEL | PPC_OPCODE_RFMCI;
   else
@@ -107,8 +121,10 @@
 	dialect |= PPC_OPCODE_64;
     }
 
-  info->private_data = (char *) 0 + dialect;
-  return dialect;
+  info->private_data = priv;
+  POWERPC_DIALECT(info) = dialect;
+
+  return TRUE;
 }
 
 /* Print a big endian PowerPC instruction.  */
@@ -116,8 +132,9 @@
 int
 print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
 {
-  int dialect = (char *) info->private_data - (char *) 0;
-  return print_insn_powerpc (memaddr, info, 1, dialect);
+  if (info->private_data == NULL && !powerpc_init_dialect (info))
+    return -1;
+  return print_insn_powerpc (memaddr, info, 1, POWERPC_DIALECT(info));
 }
 
 /* Print a little endian PowerPC instruction.  */
@@ -125,8 +142,9 @@
 int
 print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info)
 {
-  int dialect = (char *) info->private_data - (char *) 0;
-  return print_insn_powerpc (memaddr, info, 0, dialect);
+  if (info->private_data == NULL && !powerpc_init_dialect (info))
+    return -1;
+  return print_insn_powerpc (memaddr, info, 0, POWERPC_DIALECT(info));
 }
 
 /* Print a POWER (RS/6000) instruction.  */
@@ -141,7 +159,7 @@
 
 static long
 operand_value_powerpc (const struct powerpc_operand *operand,
-		       unsigned long insn, int dialect)
+		       unsigned long insn, ppc_cpu_t dialect)
 {
   long value;
   int invalid;
@@ -171,7 +189,7 @@
 
 static int
 skip_optional_operands (const unsigned char *opindex,
-			unsigned long insn, int dialect)
+			unsigned long insn, ppc_cpu_t dialect)
 {
   const struct powerpc_operand *operand;
 
@@ -193,7 +211,7 @@
 print_insn_powerpc (bfd_vma memaddr,
 		    struct disassemble_info *info,
 		    int bigendian,
-		    int dialect)
+		    ppc_cpu_t dialect)
 {
   bfd_byte buffer[4];
   int status;
@@ -202,9 +220,6 @@
   const struct powerpc_opcode *opcode_end;
   unsigned long op;
 
-  if (dialect == 0)
-    dialect = powerpc_dialect (info);
-
   status = (*info->read_memory_func) (memaddr, buffer, 4, info);
   if (status != 0)
     {
@@ -374,6 +389,7 @@
   fprintf (stream, "  e500|e500x2              Disassemble the e500 instructions\n");
   fprintf (stream, "  e500mc                   Disassemble the e500mc instructions\n");
   fprintf (stream, "  440                      Disassemble the 440 instructions\n");
+  fprintf (stream, "  464                      Disassemble the 464 instructions\n");
   fprintf (stream, "  efs                      Disassemble the EFS instructions\n");
   fprintf (stream, "  ppcps                    Disassemble the PowerPC paired singles instructions\n");
   fprintf (stream, "  power4                   Disassemble the Power4 instructions\n");
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 5a85027..f9c2059 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -38,41 +38,41 @@
 
 /* Local insertion and extraction functions.  */
 
-static unsigned long insert_bat (unsigned long, long, int, const char **);
-static long extract_bat (unsigned long, int, int *);
-static unsigned long insert_bba (unsigned long, long, int, const char **);
-static long extract_bba (unsigned long, int, int *);
-static unsigned long insert_bdm (unsigned long, long, int, const char **);
-static long extract_bdm (unsigned long, int, int *);
-static unsigned long insert_bdp (unsigned long, long, int, const char **);
-static long extract_bdp (unsigned long, int, int *);
-static unsigned long insert_bo (unsigned long, long, int, const char **);
-static long extract_bo (unsigned long, int, int *);
-static unsigned long insert_boe (unsigned long, long, int, const char **);
-static long extract_boe (unsigned long, int, int *);
-static unsigned long insert_fxm (unsigned long, long, int, const char **);
-static long extract_fxm (unsigned long, int, int *);
-static unsigned long insert_mbe (unsigned long, long, int, const char **);
-static long extract_mbe (unsigned long, int, int *);
-static unsigned long insert_mb6 (unsigned long, long, int, const char **);
-static long extract_mb6 (unsigned long, int, int *);
-static long extract_nb (unsigned long, int, int *);
-static unsigned long insert_nsi (unsigned long, long, int, const char **);
-static long extract_nsi (unsigned long, int, int *);
-static unsigned long insert_ral (unsigned long, long, int, const char **);
-static unsigned long insert_ram (unsigned long, long, int, const char **);
-static unsigned long insert_raq (unsigned long, long, int, const char **);
-static unsigned long insert_ras (unsigned long, long, int, const char **);
-static unsigned long insert_rbs (unsigned long, long, int, const char **);
-static long extract_rbs (unsigned long, int, int *);
-static unsigned long insert_sh6 (unsigned long, long, int, const char **);
-static long extract_sh6 (unsigned long, int, int *);
-static unsigned long insert_spr (unsigned long, long, int, const char **);
-static long extract_spr (unsigned long, int, int *);
-static unsigned long insert_sprg (unsigned long, long, int, const char **);
-static long extract_sprg (unsigned long, int, int *);
-static unsigned long insert_tbr (unsigned long, long, int, const char **);
-static long extract_tbr (unsigned long, int, int *);
+static unsigned long insert_bat (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_bat (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_bba (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_bba (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_bdm (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_bdm (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_bdp (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_bdp (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_bo (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_bo (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_boe (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_boe (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_fxm (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_fxm (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_mbe (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_mbe (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_mb6 (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_mb6 (unsigned long, ppc_cpu_t, int *);
+static long extract_nb (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_nsi (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_nsi (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_ral (unsigned long, long, ppc_cpu_t, const char **);
+static unsigned long insert_ram (unsigned long, long, ppc_cpu_t, const char **);
+static unsigned long insert_raq (unsigned long, long, ppc_cpu_t, const char **);
+static unsigned long insert_ras (unsigned long, long, ppc_cpu_t, const char **);
+static unsigned long insert_rbs (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_rbs (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_sh6 (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_sh6 (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_spr (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_spr (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_sprg (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_sprg (unsigned long, ppc_cpu_t, int *);
+static unsigned long insert_tbr (unsigned long, long, ppc_cpu_t, const char **);
+static long extract_tbr (unsigned long, ppc_cpu_t, int *);
 
 /* The operands table.
 
@@ -592,7 +592,7 @@
 static unsigned long
 insert_bat (unsigned long insn,
 	    long value ATTRIBUTE_UNUSED,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 21) & 0x1f) << 16);
@@ -600,7 +600,7 @@
 
 static long
 extract_bat (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid)
 {
   if (((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
@@ -617,7 +617,7 @@
 static unsigned long
 insert_bba (unsigned long insn,
 	    long value ATTRIBUTE_UNUSED,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 16) & 0x1f) << 11);
@@ -625,7 +625,7 @@
 
 static long
 extract_bba (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid)
 {
   if (((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
@@ -653,7 +653,7 @@
 static unsigned long
 insert_bdm (unsigned long insn,
 	    long value,
-	    int dialect,
+	    ppc_cpu_t dialect,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   if ((dialect & PPC_OPCODE_POWER4) == 0)
@@ -673,7 +673,7 @@
 
 static long
 extract_bdm (unsigned long insn,
-	     int dialect,
+	     ppc_cpu_t dialect,
 	     int *invalid)
 {
   if ((dialect & PPC_OPCODE_POWER4) == 0)
@@ -698,7 +698,7 @@
 static unsigned long
 insert_bdp (unsigned long insn,
 	    long value,
-	    int dialect,
+	    ppc_cpu_t dialect,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   if ((dialect & PPC_OPCODE_POWER4) == 0)
@@ -718,7 +718,7 @@
 
 static long
 extract_bdp (unsigned long insn,
-	     int dialect,
+	     ppc_cpu_t dialect,
 	     int *invalid)
 {
   if ((dialect & PPC_OPCODE_POWER4) == 0)
@@ -739,7 +739,7 @@
 /* Check for legal values of a BO field.  */
 
 static int
-valid_bo (long value, int dialect, int extract)
+valid_bo (long value, ppc_cpu_t dialect, int extract)
 {
   if ((dialect & PPC_OPCODE_POWER4) == 0)
     {
@@ -801,7 +801,7 @@
 static unsigned long
 insert_bo (unsigned long insn,
 	   long value,
-	   int dialect,
+	   ppc_cpu_t dialect,
 	   const char **errmsg)
 {
   if (!valid_bo (value, dialect, 0))
@@ -811,7 +811,7 @@
 
 static long
 extract_bo (unsigned long insn,
-	    int dialect,
+	    ppc_cpu_t dialect,
 	    int *invalid)
 {
   long value;
@@ -829,7 +829,7 @@
 static unsigned long
 insert_boe (unsigned long insn,
 	    long value,
-	    int dialect,
+	    ppc_cpu_t dialect,
 	    const char **errmsg)
 {
   if (!valid_bo (value, dialect, 0))
@@ -842,7 +842,7 @@
 
 static long
 extract_boe (unsigned long insn,
-	     int dialect,
+	     ppc_cpu_t dialect,
 	     int *invalid)
 {
   long value;
@@ -858,7 +858,7 @@
 static unsigned long
 insert_fxm (unsigned long insn,
 	    long value,
-	    int dialect,
+	    ppc_cpu_t dialect,
 	    const char **errmsg)
 {
   /* If we're handling the mfocrf and mtocrf insns ensure that exactly
@@ -902,7 +902,7 @@
 
 static long
 extract_fxm (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid)
 {
   long mask = (insn >> 12) & 0xff;
@@ -933,7 +933,7 @@
 static unsigned long
 insert_mbe (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg)
 {
   unsigned long uval, mask;
@@ -985,7 +985,7 @@
 
 static long
 extract_mbe (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid)
 {
   long ret;
@@ -1019,7 +1019,7 @@
 static unsigned long
 insert_mb6 (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((value & 0x1f) << 6) | (value & 0x20);
@@ -1027,7 +1027,7 @@
 
 static long
 extract_mb6 (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid ATTRIBUTE_UNUSED)
 {
   return ((insn >> 6) & 0x1f) | (insn & 0x20);
@@ -1038,7 +1038,7 @@
 
 static long
 extract_nb (unsigned long insn,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    int *invalid ATTRIBUTE_UNUSED)
 {
   long ret;
@@ -1057,7 +1057,7 @@
 static unsigned long
 insert_nsi (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (-value & 0xffff);
@@ -1065,7 +1065,7 @@
 
 static long
 extract_nsi (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid)
 {
   *invalid = 1;
@@ -1079,7 +1079,7 @@
 static unsigned long
 insert_ral (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg)
 {
   if (value == 0
@@ -1094,7 +1094,7 @@
 static unsigned long
 insert_ram (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg)
 {
   if ((unsigned long) value >= ((insn >> 21) & 0x1f))
@@ -1108,7 +1108,7 @@
 static unsigned long
 insert_raq (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg)
 {
   long rtvalue = (insn & RT_MASK) >> 21;
@@ -1125,7 +1125,7 @@
 static unsigned long
 insert_ras (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg)
 {
   if (value == 0)
@@ -1142,7 +1142,7 @@
 static unsigned long
 insert_rbs (unsigned long insn,
 	    long value ATTRIBUTE_UNUSED,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 21) & 0x1f) << 11);
@@ -1150,7 +1150,7 @@
 
 static long
 extract_rbs (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid)
 {
   if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
@@ -1163,7 +1163,7 @@
 static unsigned long
 insert_sh6 (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
@@ -1171,7 +1171,7 @@
 
 static long
 extract_sh6 (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid ATTRIBUTE_UNUSED)
 {
   return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
@@ -1183,7 +1183,7 @@
 static unsigned long
 insert_spr (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
@@ -1191,7 +1191,7 @@
 
 static long
 extract_spr (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid ATTRIBUTE_UNUSED)
 {
   return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
@@ -1202,7 +1202,7 @@
 static unsigned long
 insert_sprg (unsigned long insn,
 	     long value,
-	     int dialect,
+	     ppc_cpu_t dialect,
 	     const char **errmsg)
 {
   /* This check uses PPC_OPCODE_403 because PPC405 is later defined
@@ -1223,7 +1223,7 @@
 
 static long
 extract_sprg (unsigned long insn,
-	      int dialect,
+	      ppc_cpu_t dialect,
 	      int *invalid)
 {
   unsigned long val = (insn >> 16) & 0x1f;
@@ -1251,7 +1251,7 @@
 static unsigned long
 insert_tbr (unsigned long insn,
 	    long value,
-	    int dialect ATTRIBUTE_UNUSED,
+	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   if (value == 0)
@@ -1261,7 +1261,7 @@
 
 static long
 extract_tbr (unsigned long insn,
-	     int dialect ATTRIBUTE_UNUSED,
+	     ppc_cpu_t dialect ATTRIBUTE_UNUSED,
 	     int *invalid ATTRIBUTE_UNUSED)
 {
   long ret;
@@ -1666,6 +1666,7 @@
 #define PPC403	PPC_OPCODE_403
 #define PPC405	PPC403
 #define PPC440	PPC_OPCODE_440
+#define PPC464	PPC440
 #define PPC750	PPC
 #define PPC7450 PPC
 #define PPC860	PPC
@@ -3527,6 +3528,8 @@
 {"lhzxe",	X(31,287),	X_MASK,      BOOKE64,	{RT, RA0, RB}},
 {"lhepx",	X(31,287),	X_MASK,      E500MC,	{RT, RA, RB}},
 
+{"mfdcrux",	X(31,291),	X_MASK,      PPC464,	{RS, RA}},
+
 {"tlbie",	X(31,306),	XRTLRA_MASK, PPC,	{RB, L}},
 {"tlbi",	X(31,306),	XRT_MASK,    POWER,	{RA0, RB}},
 
@@ -3818,6 +3821,8 @@
 {"sthxe",	X(31,415),	X_MASK,      BOOKE64,	{RS, RA0, RB}},
 {"sthepx",	X(31,415),	X_MASK,      E500MC,	{RS, RA, RB}},
 
+{"mtdcrux",	X(31,419),	X_MASK,      PPC464,	{RA, RS}},
+
 {"slbie",	X(31,434),	XRTRA_MASK,  PPC64,	{RB}},
 
 {"ecowx",	X(31,438),	X_MASK,      PPC,	{RT, RA, RB}},
diff --git a/sim/ChangeLog b/sim/ChangeLog
index d4029d6..4e9d167 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* cris/configure: Regenerate to track ../common/common.m4 changes.
+	* cris/config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 78e5123..dff8515 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/arm/config.in b/sim/arm/config.in
index 462227e..5da8bbe 100644
--- a/sim/arm/config.in
+++ b/sim/arm/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/arm/configure b/sim/arm/configure
index 0fc3660..c1aa2cd 100755
--- a/sim/arm/configure
+++ b/sim/arm/configure
@@ -4213,6 +4213,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index c482dfd..5b8b192 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* common.m4: Add test for libz and zlib.h.
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/common/common.m4 b/sim/common/common.m4
index f587754..215208d 100644
--- a/sim/common/common.m4
+++ b/sim/common/common.m4
@@ -54,6 +54,10 @@
 AC_CHECK_LIB(socket, bind)
 AC_CHECK_LIB(nsl, gethostbyname)
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+
 . ${srcdir}/../../bfd/configure.host
 
 dnl Standard (and optional) simulator options.
diff --git a/sim/common/config.in b/sim/common/config.in
index 5df0854..3ac643d 100644
--- a/sim/common/config.in
+++ b/sim/common/config.in
@@ -127,6 +127,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
diff --git a/sim/common/configure b/sim/common/configure
index b302f6c..922cd16 100755
--- a/sim/common/configure
+++ b/sim/common/configure
@@ -3988,6 +3988,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index 515cf6b..8f54685 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,3 +1,10 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
+	* interp.c (hash): Remove incorrect prototype.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/cr16/config.in b/sim/cr16/config.in
index 1f87a2b..5da8bbe 100644
--- a/sim/cr16/config.in
+++ b/sim/cr16/config.in
@@ -1,158 +1,101 @@
-/* config.in.  Generated automatically from configure.in by autoheader.  */
+/* config.in.  Generated from configure.ac by autoheader.  */
 
-/* Define if using alloca.c.  */
-#undef C_ALLOCA
-
-/* Define to empty if the keyword does not work.  */
-#undef const
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
-   This function is required for alloca.c support on those systems.  */
-#undef CRAY_STACKSEG_END
-
-/* Define if you have alloca, as a function or macro.  */
-#undef HAVE_ALLOCA
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
-#undef HAVE_ALLOCA_H
-
-/* Define if you have a working `mmap' system call.  */
-#undef HAVE_MMAP
-
-/* Define as __inline if that's what the C compiler calls it.  */
-#undef inline
-
-/* Define to `long' if <sys/types.h> doesn't define.  */
-#undef off_t
-
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
-
-/* Define as the return type of signal handlers (int or void).  */
-#undef RETSIGTYPE
-
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-#undef size_t
-
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
-
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
-
-/* Define to 1 if NLS is requested.  */
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
 #undef ENABLE_NLS
 
-/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
-#undef HAVE_GETTEXT
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
 
-/* Define as 1 if you have the stpcpy function.  */
-#undef HAVE_STPCPY
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
 
-/* Define if your locale.h file contains LC_MESSAGES.  */
-#undef HAVE_LC_MESSAGES
-
-/* Define if you have the __argz_count function.  */
-#undef HAVE___ARGZ_COUNT
-
-/* Define if you have the __argz_next function.  */
-#undef HAVE___ARGZ_NEXT
-
-/* Define if you have the __argz_stringify function.  */
-#undef HAVE___ARGZ_STRINGIFY
-
-/* Define if you have the __setfpucw function.  */
-#undef HAVE___SETFPUCW
-
-/* Define if you have the dcgettext function.  */
-#undef HAVE_DCGETTEXT
-
-/* Define if you have the getcwd function.  */
-#undef HAVE_GETCWD
-
-/* Define if you have the getpagesize function.  */
-#undef HAVE_GETPAGESIZE
-
-/* Define if you have the getrusage function.  */
-#undef HAVE_GETRUSAGE
-
-/* Define if you have the munmap function.  */
-#undef HAVE_MUNMAP
-
-/* Define if you have the putenv function.  */
-#undef HAVE_PUTENV
-
-/* Define if you have the setenv function.  */
-#undef HAVE_SETENV
-
-/* Define if you have the setlocale function.  */
-#undef HAVE_SETLOCALE
-
-/* Define if you have the sigaction function.  */
-#undef HAVE_SIGACTION
-
-/* Define if you have the stpcpy function.  */
-#undef HAVE_STPCPY
-
-/* Define if you have the strcasecmp function.  */
-#undef HAVE_STRCASECMP
-
-/* Define if you have the strchr function.  */
-#undef HAVE_STRCHR
-
-/* Define if you have the time function.  */
-#undef HAVE_TIME
-
-/* Define if you have the <argz.h> header file.  */
-#undef HAVE_ARGZ_H
-
-/* Define if you have the <fcntl.h> header file.  */
+/* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
-/* Define if you have the <fpu_control.h> header file.  */
+/* Define to 1 if you have the <fpu_control.h> header file. */
 #undef HAVE_FPU_CONTROL_H
 
-/* Define if you have the <limits.h> header file.  */
-#undef HAVE_LIMITS_H
+/* Define to 1 if you have the `getrusage' function. */
+#undef HAVE_GETRUSAGE
 
-/* Define if you have the <locale.h> header file.  */
-#undef HAVE_LOCALE_H
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
 
-/* Define if you have the <malloc.h> header file.  */
-#undef HAVE_MALLOC_H
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
 
-/* Define if you have the <nl_types.h> header file.  */
-#undef HAVE_NL_TYPES_H
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
 
-/* Define if you have the <stdlib.h> header file.  */
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `sigaction' function. */
+#undef HAVE_SIGACTION
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Define if you have the <string.h> header file.  */
-#undef HAVE_STRING_H
-
-/* Define if you have the <strings.h> header file.  */
+/* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
-/* Define if you have the <sys/param.h> header file.  */
-#undef HAVE_SYS_PARAM_H
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
 
-/* Define if you have the <sys/resource.h> header file.  */
+/* Define to 1 if you have the <sys/resource.h> header file. */
 #undef HAVE_SYS_RESOURCE_H
 
-/* Define if you have the <sys/time.h> header file.  */
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
 #undef HAVE_SYS_TIME_H
 
-/* Define if you have the <time.h> header file.  */
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `time' function. */
+#undef HAVE_TIME
+
+/* Define to 1 if you have the <time.h> header file. */
 #undef HAVE_TIME_H
 
-/* Define if you have the <unistd.h> header file.  */
+/* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define if you have the <values.h> header file.  */
-#undef HAVE_VALUES_H
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Define to 1 if you have the `__setfpucw' function. */
+#undef HAVE___SETFPUCW
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
diff --git a/sim/cr16/configure b/sim/cr16/configure
index c3a33d1..0d0e4bd 100644
--- a/sim/cr16/configure
+++ b/sim/cr16/configure
@@ -4215,6 +4215,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index 1eed5e5..aa12a69 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -50,7 +50,6 @@
 bfd_vma text_start;
 bfd_vma text_end;
 
-static long hash PARAMS ((uint64 linsn, int));
 static struct hash_entry *lookup_hash PARAMS ((uint64 ins, int size));
 static void get_operands PARAMS ((operand_desc *s, uint64 mcode, int isize, int nops));
 static int do_run PARAMS ((uint64 mc));
diff --git a/sim/cris/config.in b/sim/cris/config.in
index 41eb086..35a6405 100644
--- a/sim/cris/config.in
+++ b/sim/cris/config.in
@@ -79,6 +79,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -97,6 +100,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/cris/configure b/sim/cris/configure
index 5d3df36..0fdcfd7 100755
--- a/sim/cris/configure
+++ b/sim/cris/configure
@@ -4223,6 +4223,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index b8b8527..5e27439 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/d10v/config.in b/sim/d10v/config.in
index 462227e..5da8bbe 100644
--- a/sim/d10v/config.in
+++ b/sim/d10v/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/d10v/configure b/sim/d10v/configure
index c3a33d1..0d0e4bd 100755
--- a/sim/d10v/configure
+++ b/sim/d10v/configure
@@ -4215,6 +4215,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index 49c1374..27d99f5 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-09  Joel Sherrill <joel.sherrill@oarcorp.com>
 
 	* sis.c: Correct spelling error.
diff --git a/sim/erc32/config.in b/sim/erc32/config.in
index 462227e..5da8bbe 100644
--- a/sim/erc32/config.in
+++ b/sim/erc32/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/erc32/configure b/sim/erc32/configure
index 69ef6b3..8b2b93f 100755
--- a/sim/erc32/configure
+++ b/sim/erc32/configure
@@ -4213,6 +4213,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index aaac69e..991755e 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/frv/config.in b/sim/frv/config.in
index 350b19e..33669c9 100644
--- a/sim/frv/config.in
+++ b/sim/frv/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/frv/configure b/sim/frv/configure
index e816f2b..a132766 100755
--- a/sim/frv/configure
+++ b/sim/frv/configure
@@ -4221,6 +4221,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index 3aeac7e..d0b6f46 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/h8300/config.in b/sim/h8300/config.in
index 36b80a2..1eae04e 100644
--- a/sim/h8300/config.in
+++ b/sim/h8300/config.in
@@ -70,6 +70,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -88,6 +91,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/h8300/configure b/sim/h8300/configure
index 6397cf6..301c2a0 100755
--- a/sim/h8300/configure
+++ b/sim/h8300/configure
@@ -4213,6 +4213,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 26b155b..9ad0a63 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/iq2000/config.in b/sim/iq2000/config.in
index 350b19e..33669c9 100644
--- a/sim/iq2000/config.in
+++ b/sim/iq2000/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/iq2000/configure b/sim/iq2000/configure
index 79cd332..fac5a51 100755
--- a/sim/iq2000/configure
+++ b/sim/iq2000/configure
@@ -4221,6 +4221,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog
index 8a30574..c77bf25 100644
--- a/sim/m32c/ChangeLog
+++ b/sim/m32c/ChangeLog
@@ -1,3 +1,18 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
+2008-06-16  DJ Delorie  <dj@redhat.com>
+
+	* m32c.opc (BRK, GDBBRK): Remove debug logic.
+	* main.c (main): Add option to set raw console.
+	* mem.h (m32c_use_raw_console): Declare.
+	* mem.c (m32c_sim_restore_console): Only restore console if it's
+	been previously set.
+	(m32c_use_raw_console): Define.
+	(mem_get_byte): Set raw console if m32c_use_raw_console is set.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/m32c/config.in b/sim/m32c/config.in
index e69de29..5e29f95 100644
--- a/sim/m32c/config.in
+++ b/sim/m32c/config.in
@@ -0,0 +1,101 @@
+/* config.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+#undef ENABLE_NLS
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <fpu_control.h> header file. */
+#undef HAVE_FPU_CONTROL_H
+
+/* Define to 1 if you have the `getrusage' function. */
+#undef HAVE_GETRUSAGE
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `sigaction' function. */
+#undef HAVE_SIGACTION
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `time' function. */
+#undef HAVE_TIME
+
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Define to 1 if you have the `__setfpucw' function. */
+#undef HAVE___SETFPUCW
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
diff --git a/sim/m32c/configure b/sim/m32c/configure
index 75209cf..95fef5c 100755
--- a/sim/m32c/configure
+++ b/sim/m32c/configure
@@ -4213,6 +4213,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/m32c/m32c.opc b/sim/m32c/m32c.opc
index 9f5bd4a..3fe6cf0 100644
--- a/sim/m32c/m32c.opc
+++ b/sim/m32c/m32c.opc
@@ -680,7 +680,7 @@
   /* We report the break to our caller with the PC still pointing at the 
      breakpoint instruction.  */
   put_reg (pc, m32c_opcode_pc);
-  if (verbose || 1)
+  if (verbose)
     printf("[break]\n");
   if (in_gdb || (regs.r_intbl == 0 && regs.r_intbh == 0))
     return M32C_MAKE_HIT_BREAK ();
@@ -700,7 +700,7 @@
   /* We report the break to our caller with the PC still pointing at the 
      breakpoint instruction.  */
   put_reg (pc, m32c_opcode_pc);
-  if (verbose || 1)
+  if (verbose)
     printf("[gdb break]\n");
   return M32C_MAKE_HIT_BREAK ();
 
diff --git a/sim/m32c/main.c b/sim/m32c/main.c
index 7187210..243be70 100644
--- a/sim/m32c/main.c
+++ b/sim/m32c/main.c
@@ -122,7 +122,7 @@
 
   in_gdb = 0;
 
-  while ((o = getopt (argc, argv, "tc:vdm:")) != -1)
+  while ((o = getopt (argc, argv, "tc:vdm:C")) != -1)
     switch (o)
       {
       case 't':
@@ -131,6 +131,9 @@
       case 'c':
 	console_port_s = optarg;
 	break;
+      case 'C':
+	m32c_use_raw_console = 1;
+	break;
       case 'v':
 	verbose++;
 	break;
@@ -151,7 +154,7 @@
 	break;
       case '?':
 	fprintf (stderr,
-		 "usage: run [-v] [-t] [-d] [-m r8c|m16c|m32cm|m32c]"
+		 "usage: run [-v] [-C] [-c port] [-t] [-d] [-m r8c|m16c|m32cm|m32c]"
 		 " program\n");
 	exit (1);
       }
diff --git a/sim/m32c/mem.c b/sim/m32c/mem.c
index 474fc5e..20d2350 100644
--- a/sim/m32c/mem.c
+++ b/sim/m32c/mem.c
@@ -50,6 +50,7 @@
 
 int m32c_console_ifd = 0;
 int m32c_console_ofd = 1;
+int m32c_use_raw_console = 0;
 
 #ifdef TIMER_A
 Timer_A timer_a;
@@ -394,7 +395,8 @@
 void
 m32c_sim_restore_console ()
 {
-  tcsetattr (m32c_console_ifd, TCSANOW, &oattr);
+  if (console_raw)
+    tcsetattr (m32c_console_ifd, TCSANOW, &oattr);
   console_raw = 0;
 }
 
@@ -409,9 +411,9 @@
     case 0x2ed:		/* m32c uart1c1 */
     case 0x3ad:		/* m16c uart1c1 */
 
-#if 0
-      if (!console_raw)
+      if (!console_raw && m32c_use_raw_console)
 	{
+	  struct termios attr;
 	  tcgetattr (m32c_console_ifd, &attr);
 	  tcgetattr (m32c_console_ifd, &oattr);
 	  /* We want each key to be sent as the user presses them.  */
@@ -420,7 +422,6 @@
 	  console_raw = 1;
 	  atexit (m32c_sim_restore_console);
 	}
-#endif
 
       if (stdin_ready ())
 	return 0x02;		/* tx empty and rx full */
diff --git a/sim/m32c/mem.h b/sim/m32c/mem.h
index ad53a01..52ad2d6 100644
--- a/sim/m32c/mem.h
+++ b/sim/m32c/mem.h
@@ -41,3 +41,5 @@
 int sign_ext (int v, int bits);
 
 void m32c_sim_restore_console ();
+
+extern int m32c_use_raw_console;
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index ac38231..1353e4e 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/m32r/config.in b/sim/m32r/config.in
index 350b19e..33669c9 100644
--- a/sim/m32r/config.in
+++ b/sim/m32r/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/m32r/configure b/sim/m32r/configure
index ec3d88f..41bacdc 100755
--- a/sim/m32r/configure
+++ b/sim/m32r/configure
@@ -4221,6 +4221,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 1737001..44ae9ab 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/m68hc11/config.in b/sim/m68hc11/config.in
index 350b19e..33669c9 100644
--- a/sim/m68hc11/config.in
+++ b/sim/m68hc11/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/m68hc11/configure b/sim/m68hc11/configure
index ec8c77d..779a98c 100755
--- a/sim/m68hc11/configure
+++ b/sim/m68hc11/configure
@@ -4219,6 +4219,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
index c471d8c..e9dbefa 100644
--- a/sim/mcore/ChangeLog
+++ b/sim/mcore/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/mcore/config.in b/sim/mcore/config.in
index 462227e..5da8bbe 100644
--- a/sim/mcore/config.in
+++ b/sim/mcore/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/mcore/configure b/sim/mcore/configure
index be744ee..e83c777 100755
--- a/sim/mcore/configure
+++ b/sim/mcore/configure
@@ -4213,6 +4213,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 78600fa..11a3c19 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/mips/config.in b/sim/mips/config.in
index 7306347..06e41e5 100644
--- a/sim/mips/config.in
+++ b/sim/mips/config.in
@@ -79,6 +79,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -97,6 +100,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/mips/configure b/sim/mips/configure
index 2b80661..d32746b 100755
--- a/sim/mips/configure
+++ b/sim/mips/configure
@@ -4229,6 +4229,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 170fb7e..43c8457 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/mn10300/config.in b/sim/mn10300/config.in
index b5a1c6e..78ca120 100644
--- a/sim/mn10300/config.in
+++ b/sim/mn10300/config.in
@@ -88,6 +88,9 @@
 /* Define to 1 if you have the <utime.h> header file. */
 #undef HAVE_UTIME_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -106,6 +109,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/mn10300/configure b/sim/mn10300/configure
index afc1d8c..62830f3 100755
--- a/sim/mn10300/configure
+++ b/sim/mn10300/configure
@@ -4222,6 +4222,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 4b7c0ee..7517c86 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,10 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure.ac: Add test for libz and zlib.h.
+	* Makefile.in (LIBS): Set from @LIBS@.
+	* configure: Regenerate.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 2cd36e9..86fc8e62 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -120,6 +120,7 @@
 BUILD_CFLAGS	= $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARNING_CFLAGS)
 
 BUILD_LDFLAGS	=
+LIBS = @LIBS@
 
 CONFIG_FILE = @sim_config@
 IGEN_OPCODE_RULES = @sim_opcode@
diff --git a/sim/ppc/config.in b/sim/ppc/config.in
index 3fac50e..ff74148 100644
--- a/sim/ppc/config.in
+++ b/sim/ppc/config.in
@@ -271,6 +271,9 @@
 /* Define to 1 if you have the `unlink' function. */
 #undef HAVE_UNLINK
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
diff --git a/sim/ppc/configure b/sim/ppc/configure
index 3b063d6..e96bf3b 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -3558,21 +3558,8 @@
 rm conftest.sed
 
 
-. ${srcdir}/../../bfd/configure.host
-
-case ${host} in
-  *mingw32*)
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_WIN32API 1
-_ACEOF
-
-    ;;
-esac
-
-          ac_config_headers="$ac_config_headers config.h:config.in"
-
-
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4061,6 +4048,297 @@
 done
 
 
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
+. ${srcdir}/../../bfd/configure.host
+
+case ${host} in
+  *mingw32*)
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_WIN32API 1
+_ACEOF
+
+    ;;
+esac
+
+          ac_config_headers="$ac_config_headers config.h:config.in"
+
+
 
 echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
 echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 076f294..730091b 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -571,6 +571,10 @@
 AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+
 . ${srcdir}/../../bfd/configure.host
 
 case ${host} in
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 5ab5652..12625c4 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/sh/config.in b/sim/sh/config.in
index 462227e..5da8bbe 100644
--- a/sim/sh/config.in
+++ b/sim/sh/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/sh/configure b/sim/sh/configure
index be744ee..e83c777 100755
--- a/sim/sh/configure
+++ b/sim/sh/configure
@@ -4213,6 +4213,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog
index c88bbce..aabac07 100644
--- a/sim/sh64/ChangeLog
+++ b/sim/sh64/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/sh64/config.in b/sim/sh64/config.in
index 350b19e..33669c9 100644
--- a/sim/sh64/config.in
+++ b/sim/sh64/config.in
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -85,6 +88,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/sh64/configure b/sim/sh64/configure
index 2a72269..5324aa3 100755
--- a/sim/sh64/configure
+++ b/sim/sh64/configure
@@ -4219,6 +4219,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index e194bbe..456533d 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure: Regenerate to track ../common/common.m4 changes.
+	* config.in: Ditto.
+
 2008-06-06  Vladimir Prus  <vladimir@codesourcery.com>
             Daniel Jacobowitz  <dan@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
diff --git a/sim/v850/config.in b/sim/v850/config.in
index b5a1c6e..78ca120 100644
--- a/sim/v850/config.in
+++ b/sim/v850/config.in
@@ -88,6 +88,9 @@
 /* Define to 1 if you have the <utime.h> header file. */
 #undef HAVE_UTIME_H
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
 /* Define to 1 if you have the `__setfpucw' function. */
 #undef HAVE___SETFPUCW
 
@@ -106,6 +109,12 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Additional package description */
+#undef PKGVERSION
+
+/* Bug reporting address */
+#undef REPORT_BUGS_TO
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
diff --git a/sim/v850/configure b/sim/v850/configure
index 3334447..039a230 100755
--- a/sim/v850/configure
+++ b/sim/v850/configure
@@ -4220,6 +4220,284 @@
 fi
 
 
+# BFD conditionally uses zlib, so we must link it in if libbfd does, by
+# using the same condition.
+echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5
+echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6
+if test "${ac_cv_search_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_zlibVersion=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_zlibVersion" = no; then
+  for ac_lib in z; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char zlibVersion ();
+int
+main ()
+{
+zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_zlibVersion="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6
+if test "$ac_cv_search_zlibVersion" != no; then
+  test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
 . ${srcdir}/../../bfd/configure.host
 
 
diff --git a/src-release b/src-release
index e79f5dd..bdb8c1d 100644
--- a/src-release
+++ b/src-release
@@ -249,7 +249,7 @@
 
 # The FSF "binutils" release includes gprof and ld.
 .PHONY: binutils.tar.bz2
-BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld elfcpp gold gprof intl setup.com makefile.vms mkdep cpu
+BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld elfcpp gold gprof intl setup.com makefile.vms cpu
 binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
 	$(MAKE) -f $(SELF) taz TOOL=binutils \
 		MD5PROG="$(MD5PROG)" \