diff options
author | Keith Seitz <keiths@redhat.com> | 2002-10-01 00:46:48 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2002-10-01 00:46:48 +0000 |
commit | 24b8c9b305c0d4fdab9f54d39a20585c8bf84635 (patch) | |
tree | d202b91f41658f5076cb9eec4f4f839133e2720c | |
parent | 9c562db82642857e703d44ff0f22667742882b92 (diff) | |
download | gdb-24b8c9b305c0d4fdab9f54d39a20585c8bf84635.tar.gz |
Merge with kseitz_interps-20020930-merge.
347 files changed, 22578 insertions, 12459 deletions
diff --git a/COPYING.NEWLIB b/COPYING.NEWLIB index 6174ea37d28..25badedcb35 100644 --- a/COPYING.NEWLIB +++ b/COPYING.NEWLIB @@ -18,7 +18,7 @@ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -(2) DJ Delorie +(2) DJ Delorie (following only applies to go32 target) Copyright (C) 1991 DJ Delorie @@ -125,7 +125,48 @@ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -(10) Unless otherwise stated in each remaining newlib file, the remaining +(10) Stephane Carrez (m68hc11-elf/m68hc12-elf targets only) + +Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr) + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +(11) Christopher G. Demetriou + +Copyright (c) 2001 Christopher G. Demetriou +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(12) Unless otherwise stated in each remaining newlib file, the remaining files in the newlib subdirectory are governed by the following copyright. Copyright (c) 1994, 1997, 2001, 2002 Red Hat Incorporated. diff --git a/ChangeLog b/ChangeLog index 3c71ac2be5f..c92e73fd0be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,95 @@ +2002-09-30 Nick Clifton <nickc@redhat.com> + + * cpu: New top level directory. Intended to hold input files for + CGEN which have FSF copyright assignment. + * Makefile.in (BINUTILS_SUPPORT_DIRS): Add cpu directory. + +2002-09-29 Andrew Cagney <ac131313@redhat.com> + + Revert below (note that src does not contain Makefile.tpl): + * Makefile.tpl: Make subsituted variables more autoconfy. + * Makefile.in: Regenerate. + +2002-09-29 Nathanael Nerode <neroden@gcc.gnu.org> + + * configure: Revert accidentally applied changes. + + * Makefile.tpl: Make more autoconf-friendly. + * Makefile.in: Regenerate. + * configure: Make substitution more autoconf-like. + +2002-09-28 Richard Earnshaw <rearnsha@arm.com> + + * configure.in (arm-*-coff, strongarm-*-coff, xscale-*-coff): Use a + single entry to handle all these. + (arm-*-elf, strongarm-*-elf, xscale-*-elf): Likewise. Also enable + libjava on arm-*-elf. + +2002-09-27 Geoffrey Keating <geoffk@apple.com> + + * configure.in (powerpc-*-darwin*): Don't configure BFD, TK, or the + things that depend on them. + +2002-09-25 Nathanael Nerode <neroden@gcc.gnu.org> + + * Makefile.tpl: Make subsituted variables more autoconfy. + * Makefile.in: Regenerate. + * configure: Make seds more autoconfy. + +2002-09-25 Nathanael Nerode <neroden@gcc.gnu.org> + + * Makefile.tpl: Rewrite substituted lines to look autoconfy. + * Makefile.in: Regenerate. + * configure.in: Rewrite sed statements to look autoconfy. + + * Makefile.tpl: Autogenerate *-target-* lists, dependencies of + all-target-foo on configure-target-foo. + * Makefile.def: Ditto. + * Makefile.in: Rebuild. + +2002-09-22 Nathanael Nerode <neroden@gcc.gnu.org> + + * Makefile.def: New file. + * Makefile.tpl: New file. + * Makefile.in: Generate from Makefile.tpl with 'autogen Makefile.def'. + + * configure.in: Minor rearrangement. Simplify tests. + +2002-09-23 Jason Thorpe <thorpej@wasabisystems.com> + + * configure.in (with_headers): Skip copy if value is "yes". + (with_libs): Likewise. + +2002-09-20 Nathanael Nerode <neroden@gcc.gnu.org> + + * configure.in (*-*-netbsd*): Use noconfigdirs, not skipdirs. + * configure.in (sh*-*-pe*): Ditto. + * configure.in (mips*-*-pe*): Ditto. + * configure.in (*arm-wince-pe): Ditto. + + * configure.in: Rearrange. + +2002-09-12 Nick Clifton <nickc@redhat.com> + + * Import these changes from the config master repository: + + 2002-09-05 Svein E. Seldal <Svein.Seldal@solidas.com> + + * config.sub: Add tic4x target. + + 2002-09-03 Ben Elliston <bje@redhat.com> + + * config.guess: Detect NSR-D machines for nsr-tandem-nsk. + Reported by <Duncan_Stodart@insession.com>. + +2002-09-10 Jeff Johnston <jjohnstn@redhat.com> + + * COPYING.NEWLIB: More updates. + +2002-09-09 Jeff Johnston <jjohnstn@redhat.com> + + * COPYING.NEWLIB: Update. + 2002-08-23 Andrew Cagney <ac131313@redhat.com> * texinfo/texinfo.tex: Import version 2002-06-04.06. diff --git a/Makefile.in b/Makefile.in index c37a5052d5a..a386b1bc18d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,3 +1,5 @@ + +# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. # # Makefile for directory with subdirs to build. # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, @@ -41,7 +43,7 @@ includedir=${prefix}/include oldincludedir=/usr/include infodir=${prefix}/info mandir=${prefix}/man -gxx_include_dir=${includedir}/g++ +gxx_include_dir=@gxx_include_dir@ tooldir = $(exec_prefix)/$(target_alias) build_tooldir = $(exec_prefix)/$(target_alias) @@ -181,27 +183,26 @@ RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \ CC_FOR_BUILD = $(CC) CXX_FOR_BUILD = $(CXX) -SUBDIRS = "this is set via configure, don't edit this" -OTHERS = +SUBDIRS = @configdirs@ # This is set by the configure script to the list of directories which # should be built using the target tools. -TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib winsup opcodes libf2c libobjc +TARGET_CONFIGDIRS = @target_configdirs@ # Target libraries are put under this directory: # Changed by configure to $(target_alias) if cross. -TARGET_SUBDIR = . +TARGET_SUBDIR = @target_subdir@ BUILD_CONFIGDIRS = libiberty -BUILD_SUBDIR = . +BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring # directories built for the target. -TARGET_CONFIGARGS = +TARGET_CONFIGARGS = @target_configargs@ # This is set by the configure script to the arguments to use when configuring # directories built for the build system. -BUILD_CONFIGARGS = +BUILD_CONFIGARGS = @build_configargs@ # This is set by configure to REALLY_SET_LIB_PATH if --enable-shared # was used. @@ -241,11 +242,11 @@ INSTALL_TARGET_CROSS = installdirs \ $(INSTALL_DOSREL) # Should be substed by configure.in -FLAGS_FOR_TARGET = -CC_FOR_TARGET = -CXX_FOR_TARGET = -CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = -GCJ_FOR_TARGET = +FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ +CC_FOR_TARGET = @CC_FOR_TARGET@ +CXX_FOR_TARGET = @CXX_FOR_TARGET@ +CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@ +GCJ_FOR_TARGET = @GCJ_FOR_TARGET@ # If GCC_FOR_TARGET is not overriden on the command line, then this # variable is passed down to the gcc Makefile, where it is used to @@ -529,6 +530,7 @@ ALL_MODULES = \ all-automake \ all-bash \ all-bfd \ + all-opcodes \ all-binutils \ all-bison \ all-byacc \ @@ -553,6 +555,7 @@ ALL_MODULES = \ all-hello \ all-indent \ all-intl \ + all-tcl \ all-itcl \ all-ld \ all-libgui \ @@ -561,7 +564,6 @@ ALL_MODULES = \ all-m4 \ all-make \ all-mmalloc \ - all-opcodes \ all-patch \ all-perl \ all-prms \ @@ -576,7 +578,6 @@ ALL_MODULES = \ all-sim \ all-snavigator \ all-tar \ - all-tcl \ all-texinfo \ all-textutils \ all-time \ @@ -605,6 +606,7 @@ CROSS_CHECK_MODULES = \ check-automake \ check-bash \ check-bfd \ + check-opcodes \ check-binutils \ check-bzip2 \ check-db \ @@ -624,6 +626,7 @@ CROSS_CHECK_MODULES = \ check-hello \ check-indent \ check-intl \ + check-tcl \ check-itcl \ check-ld \ check-libgui \ @@ -631,8 +634,6 @@ CROSS_CHECK_MODULES = \ check-libtool \ check-m4 \ check-make \ - check-mmcheckoc \ - check-opcodes \ check-patch \ check-perl \ check-prms \ @@ -642,11 +643,10 @@ CROSS_CHECK_MODULES = \ check-sed \ check-send-pr \ check-shellutils \ - check-snavigator \ check-sid \ check-sim \ + check-snavigator \ check-tar \ - check-tcl \ check-texinfo \ check-textutils \ check-time \ @@ -669,11 +669,11 @@ INSTALL_MODULES = \ install-automake \ install-bash \ install-bfd \ - install-bzip2 \ install-opcodes \ install-binutils \ install-bison \ install-byacc \ + install-bzip2 \ install-db \ install-dejagnu \ install-diff \ @@ -770,7 +770,7 @@ ALL_TARGET_MODULES = \ all-target-libjava \ all-target-zlib \ all-target-boehm-gc \ - all-target-qthreads + all-target-qthreads # This is a list of the configure targets for all of the modules which # are compiled using the target tools. @@ -789,7 +789,7 @@ CONFIGURE_TARGET_MODULES = \ configure-target-libjava \ configure-target-zlib \ configure-target-boehm-gc \ - configure-target-qthreads + configure-target-qthreads # This is a list of the check targets for all of the modules which are # compiled using $(TARGET_FLAGS_TO_PASS). @@ -800,12 +800,12 @@ CHECK_TARGET_MODULES = \ check-target-libobjc \ check-target-winsup \ check-target-libiberty \ + check-target-gperf \ check-target-libffi \ check-target-libjava \ check-target-zlib \ check-target-boehm-gc \ - check-target-qthreads \ - check-target-gperf + check-target-qthreads # This is a list of the install targets for all of the modules which are # compiled using $(TARGET_FLAGS_TO_PASS). @@ -818,11 +818,11 @@ INSTALL_TARGET_MODULES = \ install-target-winsup \ install-target-libgloss \ install-target-libiberty \ + install-target-gperf \ install-target-libjava \ install-target-zlib \ install-target-boehm-gc \ - install-target-qthreads \ - install-target-gperf + install-target-qthreads # This is a list of the targets for which we can do a clean-{target}. CLEAN_MODULES = \ @@ -831,6 +831,7 @@ CLEAN_MODULES = \ clean-automake \ clean-bash \ clean-bfd \ + clean-opcodes \ clean-binutils \ clean-bison \ clean-byacc \ @@ -855,6 +856,7 @@ CLEAN_MODULES = \ clean-hello \ clean-indent \ clean-intl \ + clean-tcl \ clean-itcl \ clean-ld \ clean-libgui \ @@ -863,7 +865,6 @@ CLEAN_MODULES = \ clean-m4 \ clean-make \ clean-mmalloc \ - clean-opcodes \ clean-patch \ clean-perl \ clean-prms \ @@ -878,14 +879,13 @@ CLEAN_MODULES = \ clean-sim \ clean-snavigator \ clean-tar \ - clean-tcl \ clean-texinfo \ clean-textutils \ clean-time \ clean-uudecode \ clean-wdiff \ clean-zip \ - clean-zlib + clean-zlib # All of the target modules that can be cleaned CLEAN_TARGET_MODULES = \ @@ -902,7 +902,7 @@ CLEAN_TARGET_MODULES = \ clean-target-libjava \ clean-target-zlib \ clean-target-boehm-gc \ - clean-target-qthreads + clean-target-qthreads # All of the x11 modules that can be cleaned CLEAN_X11_MODULES = \ @@ -1658,7 +1658,6 @@ all-bfd: all-libiberty all-intl all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc all-intl all-bison: all-texinfo configure-target-boehm-gc: $(ALL_GCC_C) configure-target-qthreads -all-target-boehm-gc: configure-target-boehm-gc all-byacc: all-bzip2: all-db: @@ -1666,7 +1665,6 @@ all-dejagnu: all-tcl all-expect all-tk all-diff: all-libiberty all-etc: configure-target-examples: $(ALL_GCC_C) -all-target-examples: configure-target-examples all-expect: all-tcl all-tk all-fileutils: all-libiberty all-findutils: @@ -1681,7 +1679,7 @@ all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison al all-gettext: all-gnuserv: configure-target-gperf: $(ALL_GCC_CXX) -all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++-v3 +all-target-gperf: all-target-libiberty all-target-libstdc++-v3 all-gprof: all-libiberty all-bfd all-opcodes all-intl all-grep: all-libiberty all-gui: all-gdb all-libproc @@ -1693,36 +1691,32 @@ all-intl: all-itcl: all-tcl all-tk all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex all-intl configure-target-libgloss: $(ALL_GCC) -all-target-libgloss: configure-target-libgloss configure-target-newlib +all-target-libgloss: configure-target-newlib all-libgui: all-tcl all-tk all-itcl all-libiberty: all-build-libiberty: configure-build-libiberty configure-target-libffi: $(ALL_GCC_C) -all-target-libffi: configure-target-libffi configure-target-libjava: $(ALL_GCC_C) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-libffi -all-target-libjava: configure-target-libjava all-fastjar all-target-zlib all-target-boehm-gc all-target-qthreads all-target-libffi +all-target-libjava: all-fastjar all-target-zlib all-target-boehm-gc all-target-qthreads all-target-libffi configure-target-libstdc++-v3: $(ALL_GCC_C) -all-target-libstdc++-v3: configure-target-libstdc++-v3 all-target-libiberty +all-target-libstdc++-v3: all-target-libiberty all-libtool: configure-target-libf2c: $(ALL_GCC_C) -all-target-libf2c: configure-target-libf2c all-target-libiberty +all-target-libf2c: all-target-libiberty configure-target-libobjc: $(ALL_GCC_C) -all-target-libobjc: configure-target-libobjc all-target-libiberty +all-target-libobjc: all-target-libiberty all-m4: all-libiberty all-texinfo all-make: all-libiberty all-mmalloc: configure-target-newlib: $(ALL_GCC) -all-target-newlib: configure-target-newlib configure-target-libtermcap: $(ALL_GCC_C) -all-target-libtermcap: configure-target-libtermcap all-opcodes: all-bfd all-libiberty all-patch: all-libiberty all-perl: all-prms: all-libiberty configure-target-qthreads: $(ALL_GCC_C) -all-target-qthreads: configure-target-qthreads all-rcs: all-readline: all-recode: all-libiberty @@ -1742,21 +1736,38 @@ all-time: all-tix: all-tcl all-tk all-wdiff: configure-target-winsup: $(ALL_GCC_C) -all-target-winsup: all-target-libiberty all-target-libtermcap configure-target-winsup +all-target-winsup: all-target-libiberty all-target-libtermcap all-uudecode: all-libiberty all-zip: all-zlib: configure-target-zlib: $(ALL_GCC_C) -all-target-zlib: configure-target-zlib all-fastjar: all-zlib all-libiberty configure-target-fastjar: configure-target-zlib all-target-fastjar: configure-target-fastjar all-target-zlib all-target-libiberty configure-target-libiberty: $(ALL_GCC_C) -all-target-libiberty: configure-target-libiberty all-target: $(ALL_TARGET_MODULES) install-target: $(INSTALL_TARGET_MODULES) install-gdb: install-tcl install-tk install-itcl install-tix install-libgui install-sid: install-tcl install-tk + +# Dependencies of all-target-foo on configure-target-foo. +all-target-libstdc++-v3: configure-target-libstdc++-v3 +all-target-newlib: configure-target-newlib +all-target-libf2c: configure-target-libf2c +all-target-libobjc: configure-target-libobjc +all-target-libtermcap: configure-target-libtermcap +all-target-winsup: configure-target-winsup +all-target-libgloss: configure-target-libgloss +all-target-libiberty: configure-target-libiberty +all-target-gperf: configure-target-gperf +all-target-examples: configure-target-examples +all-target-libffi: configure-target-libffi +all-target-libjava: configure-target-libjava +all-target-zlib: configure-target-zlib +all-target-boehm-gc: configure-target-boehm-gc +all-target-qthreads: configure-target-qthreads + + ### other supporting targets MAKEDIRS= \ @@ -1787,6 +1798,10 @@ etags tags: TAGS # built are. TAGS: do-TAGS +# Rebuilding Makefile.in, using autogen. +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def + cd $(srcdir) && autogen Makefile.def + # with the gnu make, this is done automatically. Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag) $(gcc_version_trigger) @@ -1985,7 +2000,7 @@ gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas # The FSF "binutils" release includes gprof and ld. .PHONY: binutils.tar.bz2 -BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep +BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep cpu binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils $(MAKE) -f Makefile.in taz TOOL=binutils \ MD5PROG="$(MD5PROG)" \ diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b2869495ea2..f4fb4e00e60 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,357 @@ +2002-09-30 Gavin Romig-Koch <gavin@redhat.com> + Ken Raeburn <raeburn@cygnus.com> + Aldy Hernandez <aldyh@redhat.com> + Eric Christopher <echristo@redhat.com> + Richard Sandiford <rsandifo@redhat.com> + + * archures.c (bfd_mach_mips4120, bfd_mach_mips5400): New. + (bfd_mach_mips5500): New. + * cpu-mips.c (I_mips4120, I_mips5400, I_mips5500): New. + (arch_info_struct): Add corresponding entries here. + * elfxx-mips.c (_bfd_elf_mips_mach): Handle E_MIPS_MACH_4120, + E_MIPS_MACH_5400 and E_MIPS_MACH_5500. + (_bfd_mips_elf_final_write_processing): Handle bfd_mach_mips4120, + bfd_mach_mips5400 and bfd_mach_mips5500. + (_bfd_mips_elf_mach_extends_p): New function. + (_bfd_mips_elf_merge_private_bfd_data): Use it to help merge + the EF_MIPS_MACH flags. + * bfd-in2.h: Regenerate. + +2002-09-28 Jason Thorpe <thorpej@wasabisystems.com> + + * elf32-vax.c (elf_vax_size_dynamic_section): Don't strip + .got sections. + +2002-09-28 Alan Modra <amodra@bigpond.net.au> + + * elf.c (map_sections_to_segments): Correct test for start of + writable section in the same page as end of read-only section. + +2002-09-27 Matt Thomas <matt@3am-software.com> + + * elf32-vax.c (elf_vax_check_relocs): Remove unused + local_got_refcounts usage. Remove allocation of got slot. + (elf_vax_gc_sweep_hook): Remove unused local_got_refcounts usage. + Remove de-allocation of got slot. + (elf_vax_size_dynamic_section): Fix some indentation. Add hash + traversal for elf_vax_instantiate_got_entries. Allow empty .got + sections to be GC'ed. + (elf_vax_instantiate_got_entries): New function. + (elf_vax_relocate_section): Simplify R_VAX_GOT32 handling. Remove + tests that are now handled by elf_vax_instantiate_got_entries. + Assert GOT entry falls within .got section size. Remove redundant + comparisions. Fix comments. + +2002-09-27 Jakub Jelinek <jakub@redhat.com> + + * reloc.c: Add x86-64 TLS relocs. + * bfd-in2.h, libbfd.h: Rebuilt. + * elf64-x86-64.c (x86_64_elf_howto): Fix size fields for 32-bit + relocs. Add TLS relocs. + (x86_64_reloc_map): Add TLS relocs. + (elf64_x86_64_info_to_howto): Adjust for added TLS relocs. + (struct elf64_x86_64_link_hash_entry): Add tls_type field. + (GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE): Define. + (elf64_x86_64_hash_entry): Define. + (struct elf64_x86_64_obj_tdata): New. + (elf64_x86_64_tdata, elf64_x86_64_local_got_tls_type): Define. + (struct elf64_x86_64_link_hash_table): Add tls_ld_got. + (link_hash_newfunc): Initialize tls_type. + (elf64_x86_64_link_hash_table_create): Initialize tls_ld_got. + (elf64_x86_64_copy_indirect_symbol): Swap tls_type if necessary. + (elf64_x86_64_mkobject): New. + (elf64_x86_64_elf_object_p): Allocate struct elf64_x86_64_obj_tdata. + (elf64_x86_64_tls_transition): New. + (elf64_x86_64_check_relocs): Add r_type variable and use it. + Handle TLS relocs. + (elf64_x86_64_gc_sweep_hook): Handle TLS relocs. + (allocate_dynrelocs): Allocate GOT space for TLS relocs. + (elf64_x86_64_size_dynamic_sections): Likewise. + (dtpoff_base, tpoff): New. + (elf64_x86_64_relocate_section): Handle TLS relocs. + (elf64_x86_64_finish_dynamic_symbol): Only handle non-TLS GOT + entries. + (bfd_elf64_mkobject): Define. + + * elf32-i386.c (elf_i386_check_relocs) [R_386_TLS_LE]: Set + DF_STATIC_TLS if shared. + +2002-09-26 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> + + * elfxx-mips.c (_bfd_mips_elf_fake_sections): Don't emit unneeded + empty relocation sections. + +2002-09-26 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc_build_one_stub): Don't build glink stubs here. + (ppc64_elf_build_stubs): Build them here instead. + +2002-09-24 Jakub Jelinek <jakub@redhat.com> + + * elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE + addend into r_addend, not *r_offset. + (elf32_sparc_finish_dynamic_symbol): Likewise. + * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at + R_SPARC_RELATIVE's r_offset. + +2002-09-23 Nathan Tallent <eraxxon@alumni.rice.edu> + + * dwarf2.c (decode_line_info): Update to correctly decode + the (non-standard DWARF2) out-of-order address sequences + generated by the Intel C++ 6.0 compiler for ia64-Linux. + +2002-09-23 Mark Elbrecht <snowball3@softhome.net> + + * config.bfd: For DJGPP targets, match with any cpu and any machine. + +2002-09-23 Alan Modra <amodra@bigpond.net.au> + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs + for discarded FDEs. Remove redundant assignment. + * elflink.h (elf_bfd_discard_info): Save edited relocs. + +2002-09-22 H.J. Lu <hjl@gnu.org> + + * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge + the relocation count between different .reloc sections. + +2002-09-21 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and + ".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for + R_PPC_EMB_SDA2REL. Similarly for R_PPC_EMB_SDA21 and + R_PPC_EMB_RELSDA. + + * elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount" + unsigned. Move "symcount" assignment out of loop. + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * configure: Regenerate. + * po/SRC-POTFILES.in: Regnerate. + +2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu> + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): If address length is + zero, set it to 8 for (non-standard) 64-bit DWARF2 formats + (e.g. IRIX64). + +2002-09-19 Jakub Jelinek <jakub@redhat.com> + + * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word + even if generating R_PPC_RELATIVE reloc. + (ppc_elf_relocate_section): Make sure relocation is performed + if skip == -2. Clear memory at r_offset when creating dynamic + relocation. + +2002-09-19 Jakub Jelinek <jakub@redhat.com> + + * reloc.c (BFD_RELOC_386_TLS_TPOFF, BFD_RELOC_386_TLS_IE, + BFD_RELOC_386_TLS_GOTIE): Add. + * bfd-in2.h, libbfd.h: Rebuilt. + * elf32-i386.c (elf_howto_table): Add R_386_TLS_TPOFF, R_386_TLS_IE + and R_386_TLS_GOTIE. + (elf_i386_reloc_type_lookup): Handle it. + (struct elf_i386_link_hash_entry): Change tls_type type to unsigned + char instead of enum, change GOT_* into defines. + (GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH): Define. + (elf_i386_tls_transition): Handle R_386_TLS_IE and R_386_TLS_GOTIE. + (elf_i386_check_relocs): Likewise. Avoid crash if local symbol is + accessed both as normal and TLS symbol. Move R_386_TLS_LDM and + R_386_PLT32 cases so that R_386_TLS_IE can fall through. + Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs. + (elf_i386_gc_sweep_hook): Handle R_386_TLS_IE and R_386_TLS_GOTIE. + Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs. + (allocate_dynrelocs): Allocate 2 .got and 2 .rel.got entries if + tls_type is GOT_TLS_IE_BOTH. + (elf_i386_size_dynamic_sections): Likewise. + (elf_i386_relocate_section): Handle R_386_TLS_IE and R_386_TLS_GOTIE. + Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs. + (elf_i386_finish_dynamic_symbol): Use tls_type & GOT_TLS_IE to catch + all 4 GOT_TLS_* TLS types. + +2002-09-19 Nick Clifton <nickc@redhat.com> + + * elflink.h (elf_fix_symbol_flags): When examining weak symbols, + follow indirect links. + +2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu> + + * ecoffswap.h (ecoff_swap_pdr_in) <isym, iline>: Update to + correctly sign-extend 32-bit ECOFF null values (0xffffffff, -1) + on 64 bit machines. + (ecoff_swap_sym_in) <iss>: Likewise. + * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Fix error reading + ECOFF information: 'ioptMax' refers to the actual *size* + of the optimization symtab, not the number of entries. + +2002-09-19 Daniel Jacobowitz <drow@mvista.com> + + * elf32-arm.h (elf32_arm_adjust_dynamic_symbol): Update + ELF_LINK_HASH_NEEDS_PLT logic. + +2002-09-18 Daniel Jacobowitz <drow@mvista.com> + + * elfcode.h (elf_slurp_reloc_table_from_section): Check + correct relocation count. + +2002-09-17 Daniel Jacobowitz <drow@mvista.com> + + * bfd-in.h (bfd_get_dynamic_symcount): Define. + * bfd.c (struct _bfd): Add dynsymcount. + * bfd-in2.h: Regenerated. + * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Set + abfd->dynsymcount. + * elfcode.h (elf_slurp_reloc_table_from_section): Check + for overflow. + +2002-09-17 Stan Cox <scox@redhat.com> + + * elf64-mips.c (mips_elf64_be_swap_reloca_out): Handle type2 and type3. + (mips_elf64_final_gp): Don't make up gp value. + * elfn32-mips.c (mips_elf_final_gp): Likewise. + * elfxx-mips.c (_bfd_mips_elf_final_link): Always create + .MIPS.options/.options section. + +2002-09-17 David O'Brien <obrien@FreeBSD.org> + + * elf32-i386-fbsd.c: Always label using the EI_OSABI method. + It is benign for FreeBSD < 4.1. Minor reformatting. + * elf64-alpha-fbsd.c: Likewise. + +2002-09-17 Jakub Jelinek <jakub@redhat.com> + + * elf32-i386.c (elf_i386_relocate_section) [R_386_TLS_TPOFF32]: Negate + addend. + +2002-09-17 Alan Modra <amodra@bigpond.net.au> + + * elf64-alpha.c (alpha_elf_size_info): Make static. + +2002-09-17 Svein E. Seldal <Svein.Seldal@solidas.com> + + * coff-tic4x.c: Add function declarations and ATTRIBUTE_UNUSED. + * cpu-tic4x.c: Ditto. + +2002-09-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> + + * elf64-mips.c (define elf_backend_ignore_discarded_relocs): Remove + duplicate define. + +2002-09-16 Bruno Haible <bruno@clisp.org> + + * elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included + by a target variant implementation. + * elf64-alpha.c: Likewise. + * elf32-i386-fbsd.c: New file. + * elf64-alpha-fbsd.c: New file. + * targets.c: Support bfd_elf32_i386_freebsd_vec and + bfd_elf64_alpha_freebsd_vec. + * configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec, + bfd_elf64_alpha_freebsd_vec. + * Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo. + (BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c. + (BFD64_BACKENDS): Add elf64-alpha-fbsd.lo. + (BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c. + (elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies. + * config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD + specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate. + +2002-09-12 Jakub Jelinek <jakub@redhat.com> + + * elf32-i386.c (dtpoff_base, tpoff): Don't crash if tls_segment is + NULL. + (elf_i386_relocate_section): Return false after printing error about + unresolvable relocation. + +2002-09-12 Nick Clifton <nickc@redhat.com> + + * elf32-arm.h (elf32_arm_final_link_relocate): Fix handling of + R_ARM_THM_PC11. + +2002-09-11 Jeffrey Law <law@redhat.com> + + * elf32-h8300.c (elf32_h8_relax_section): Fix typo. + +2002-09-11 Andrew Haley <aph@cambridge.redhat.com> + + * elf.c (_bfd_elf_find_nearest_line): Check functionname_ptr and + line_ptr before deciding we've found a symbol. + +2002-09-11 Nick Clifton <nickc@redhat.com> + + * po/da.po: New Danish translation file. + * configure.in (LINGUAS): Add 'da'. + * configure: Regenerate. + +2002-09-10 Michael Snyder <msnyder@redhat.com> + + * irix-core.c (do_sections, do_sections64): New functions. + (irix_core_core_file_p): Call new functions do_sections, + do_sections64, depending on corefile (32-bit or 64-bit). + +2002-09-09 Richard Henderson <rth@redhat.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Handle PCREL21M + and PCREL21F like PCREL21B. + +2002-09-04 Kevin Buettner <kevinb@redhat.com> + + * config.bfd (mips*-*-irix6*): Add new ABI vectors. Make n32 default + vector. + +2002-09-02 Nick Clifton <nickc@redhat.com> + + * elf32-v850.c (v850_elf_final_link_relocate): Use helpful + names instead of cryptically overloaded bfd_reloc error + codes. + (v850_elf_relocate_section): Likewise. + (v850_elf_relax_section): Replace caching of external symbols + with caching of internal symbols obtained from calling + bfd_elf_get_elf_syms(). + Fixup problems with freeing cached allocated memory blocks. + +2002-09-02 Alan Modra <amodra@bigpond.net.au> + + * cpu-pj.c (scan_mach, compatible, arch_info_struct): Remove. + (bfd_pj_arch): Use bfd_default_scan. + * cpu-v850.c (scan): Remove. + (N): Use bfd_default_scan. + * cpu-z8k.c (scan_mach): Remove. + (arch_info_struct, bfd_z8k_arch): Reorganize so that the default is + first. Use bfd_default_scan. + + * ecoff.c (_bfd_ecoff_set_arch_mach_hook): Don't use hard-coded + bfd_mach constants. + (ecoff_get_magic): Likewise. + * elf32-v850.c (v850_elf_object_p): Likewise. + (v850_elf_final_write_processing): Likewise. + * mipsbsd.c (MY(set_arch_mach)): Likewise. + (MY(write_object_contents)): Likewise. + * coff64-rs6000.c (xcoff64_write_object_contents): Likewise. + * coffcode.h (coff_write_object_contents): Likewise. + (coff_set_arch_mach_hook): Add comment describing machine == 0. + Remove unnecessary "machine" assignments. + (coff_write_relocs): Test for the absolute section sym by testing + section and flags. + + * aoutx.h (NAME(aout,machine_type)): Recognize bfd_mach_i386_i386 + and bfd_mach_i386_i386_intel_syntax. + * pdp11.c (NAME(aout,machine_type)): Likewise. + +2002-08-30 John David Anglin <dave@hiauly1.hia.nrc.ca> + + * bfd-in.h (align_power): Cast constants to bfd_vma type. + * bfd-in2.h (align_power): Likewise. + +2002-08-30 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + + * cpu-avr.c (compatible): Don't use hard-coded mach constants. + * cpu-powerpc.c (powerpc_compatible): Likewise. + * cpu-rs6000.c (rs6000_compatible): Likewise. + 2002-08-28 Catherine Moore <clm@redhat.com> * elf32-v850.c (v850_elf_reloc_map): Add new relocs. @@ -1557,7 +1911,7 @@ * elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved relocs in opd for non-shared too. -2002-06-06 Jeffrey Law <law@redhat.com +2002-06-06 Jeffrey Law <law@redhat.com> * elf32-h8300.c (elf32_h8_relax_section): Ignore uninteresting relocations. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 583cb85ed85..0aa98e3b87f 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -216,6 +216,7 @@ BFD32_BACKENDS = \ elf32-hppa.lo \ elf32-i370.lo \ elf32-i386.lo \ + elf32-i386-fbsd.lo \ elf32-i386qnx.lo \ elf32-i860.lo \ elf32-i960.lo \ @@ -378,6 +379,7 @@ BFD32_BACKENDS_CFILES = \ elf32-hppa.c \ elf32-i370.c \ elf32-i386.c \ + elf32-i386-fbsd.c \ elf32-i386qnx.c \ elf32-i860.c \ elf32-i960.c \ @@ -487,6 +489,7 @@ BFD64_BACKENDS = \ efi-app-ia64.lo \ elf64-x86-64.lo \ elf64-alpha.lo \ + elf64-alpha-fbsd.lo \ elf64-hppa.lo \ elf64-ia64.lo \ elf64-gen.lo \ @@ -513,6 +516,7 @@ BFD64_BACKENDS_CFILES = \ efi-app-ia64.c \ elf64-x86-64.c \ elf64-alpha.c \ + elf64-alpha-fbsd.c \ elf64-hppa.c \ elf64-gen.c \ elfn32-mips.c \ @@ -1058,9 +1062,9 @@ coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \ coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h coffcode.h coffswap.h -coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \ + libcoff.h coffcode.h coffswap.h coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h @@ -1112,9 +1116,10 @@ elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elf32-arm.h elf32-target.h -elfarmqnx-nabi.lo: elfarmqnx-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/filenames.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ +elfarmqnx-nabi.lo: elfarmqnx-nabi.c elfarm-nabi.c $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-qnx.h \ elf32-arm.h elf32-target.h elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ @@ -1157,15 +1162,20 @@ elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \ libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h + $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-i386-fbsd.lo: elf32-i386-fbsd.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-i386.c \ + $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \ @@ -1187,13 +1197,14 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ + elf32-target.h elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h @@ -1236,10 +1247,10 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h -elf32-ppcqnx.lo: elf32-ppcqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-ppcqnx.lo: elf32-ppcqnx.c elf32-ppc.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ @@ -1270,10 +1281,10 @@ elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-shqnx.lo: elf32-shqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-shqnx.lo: elf32-shqnx.c elf32-sh.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1522,6 +1533,13 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \ libecoff.h ecoffswap.h elf64-target.h +elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf64-alpha.c \ + $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ + libcoff.h libecoff.h ecoffswap.h elf64-target.h elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -1530,12 +1548,13 @@ elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf64-target.h -elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h elf-bfd.h elfxx-mips.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h ecoffswap.h elf32-target.h +elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ + ecoffswap.h elf32-target.h elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 470aade9084..4816c1718b0 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -344,6 +344,7 @@ BFD32_BACKENDS = \ elf32-hppa.lo \ elf32-i370.lo \ elf32-i386.lo \ + elf32-i386-fbsd.lo \ elf32-i386qnx.lo \ elf32-i860.lo \ elf32-i960.lo \ @@ -507,6 +508,7 @@ BFD32_BACKENDS_CFILES = \ elf32-hppa.c \ elf32-i370.c \ elf32-i386.c \ + elf32-i386-fbsd.c \ elf32-i386qnx.c \ elf32-i860.c \ elf32-i960.c \ @@ -617,6 +619,7 @@ BFD64_BACKENDS = \ efi-app-ia64.lo \ elf64-x86-64.lo \ elf64-alpha.lo \ + elf64-alpha-fbsd.lo \ elf64-hppa.lo \ elf64-ia64.lo \ elf64-gen.lo \ @@ -644,6 +647,7 @@ BFD64_BACKENDS_CFILES = \ efi-app-ia64.c \ elf64-x86-64.c \ elf64-alpha.c \ + elf64-alpha-fbsd.c \ elf64-hppa.c \ elf64-gen.c \ elfn32-mips.c \ @@ -794,7 +798,7 @@ configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -1588,9 +1592,9 @@ coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \ coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h coffcode.h coffswap.h -coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \ + libcoff.h coffcode.h coffswap.h coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h @@ -1642,9 +1646,10 @@ elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elf32-arm.h elf32-target.h -elfarmqnx-nabi.lo: elfarmqnx-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/filenames.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ +elfarmqnx-nabi.lo: elfarmqnx-nabi.c elfarm-nabi.c $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-qnx.h \ elf32-arm.h elf32-target.h elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ @@ -1687,15 +1692,20 @@ elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \ libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h + $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-i386-fbsd.lo: elf32-i386-fbsd.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-i386.c \ + $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \ @@ -1717,13 +1727,14 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ + elf32-target.h elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h @@ -1766,10 +1777,10 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h -elf32-ppcqnx.lo: elf32-ppcqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-ppcqnx.lo: elf32-ppcqnx.c elf32-ppc.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ @@ -1800,10 +1811,10 @@ elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-shqnx.lo: elf32-shqnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h elf32-qnx.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-shqnx.lo: elf32-shqnx.c elf32-sh.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h elf32-qnx.h elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -2052,6 +2063,13 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \ libecoff.h ecoffswap.h elf64-target.h +elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf64-alpha.c \ + $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ + libcoff.h libecoff.h ecoffswap.h elf64-target.h elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -2060,12 +2078,13 @@ elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf64-target.h -elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h elf-bfd.h elfxx-mips.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h ecoffswap.h elf32-target.h +elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ + ecoffswap.h elf32-target.h elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ diff --git a/bfd/aoutx.h b/bfd/aoutx.h index fffb6d92ab6..7fa334ab48f 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -757,7 +757,9 @@ NAME(aout,machine_type) (arch, machine, unknown) break; case bfd_arch_i386: - if (machine == 0) + if (machine == 0 + || machine == bfd_mach_i386_i386 + || machine == bfd_mach_i386_i386_intel_syntax) arch_flags = M_386; break; diff --git a/bfd/archures.c b/bfd/archures.c index 3f0ba7bb65e..f84fc136d1e 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -129,11 +129,14 @@ DESCRIPTION .#define bfd_mach_mips4010 4010 .#define bfd_mach_mips4100 4100 .#define bfd_mach_mips4111 4111 +.#define bfd_mach_mips4120 4120 .#define bfd_mach_mips4300 4300 .#define bfd_mach_mips4400 4400 .#define bfd_mach_mips4600 4600 .#define bfd_mach_mips4650 4650 .#define bfd_mach_mips5000 5000 +.#define bfd_mach_mips5400 5400 +.#define bfd_mach_mips5500 5500 .#define bfd_mach_mips6000 6000 .#define bfd_mach_mips8000 8000 .#define bfd_mach_mips10000 10000 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 9017440c2a1..f30e20d0cbd 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -331,7 +331,7 @@ alent; /* Object and core file sections. */ #define align_power(addr, align) \ - ( ((addr) + ((1<<(align))-1)) & (-1 << (align))) + (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) typedef struct sec *sec_ptr; @@ -529,6 +529,8 @@ extern void warn_deprecated #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) #define bfd_count_sections(abfd) ((abfd)->section_count) +#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) + #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 0ab42452029..38e5459d20b 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -337,7 +337,7 @@ alent; /* Object and core file sections. */ #define align_power(addr, align) \ - ( ((addr) + ((1<<(align))-1)) & (-1 << (align))) + (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) typedef struct sec *sec_ptr; @@ -535,6 +535,8 @@ extern void warn_deprecated #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) #define bfd_count_sections(abfd) ((abfd)->section_count) +#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) + #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true) @@ -1522,11 +1524,14 @@ enum bfd_architecture #define bfd_mach_mips4010 4010 #define bfd_mach_mips4100 4100 #define bfd_mach_mips4111 4111 +#define bfd_mach_mips4120 4120 #define bfd_mach_mips4300 4300 #define bfd_mach_mips4400 4400 #define bfd_mach_mips4600 4600 #define bfd_mach_mips4650 4650 #define bfd_mach_mips5000 5000 +#define bfd_mach_mips5400 5400 +#define bfd_mach_mips5500 5500 #define bfd_mach_mips6000 6000 #define bfd_mach_mips8000 8000 #define bfd_mach_mips10000 10000 @@ -1629,7 +1634,6 @@ enum bfd_architecture bfd_arch_v850, /* NEC V850 */ #define bfd_mach_v850 0 #define bfd_mach_v850e 'E' -#define bfd_mach_v850ea 'A' bfd_arch_arc, /* ARC Cores */ #define bfd_mach_arc_5 0 #define bfd_mach_arc_6 1 @@ -2263,6 +2267,9 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_386_RELATIVE, BFD_RELOC_386_GOTOFF, BFD_RELOC_386_GOTPC, + BFD_RELOC_386_TLS_TPOFF, + BFD_RELOC_386_TLS_IE, + BFD_RELOC_386_TLS_GOTIE, BFD_RELOC_386_TLS_LE, BFD_RELOC_386_TLS_GD, BFD_RELOC_386_TLS_LDM, @@ -2282,6 +2289,14 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_X86_64_RELATIVE, BFD_RELOC_X86_64_GOTPCREL, BFD_RELOC_X86_64_32S, + BFD_RELOC_X86_64_DTPMOD64, + BFD_RELOC_X86_64_DTPOFF64, + BFD_RELOC_X86_64_TPOFF64, + BFD_RELOC_X86_64_TLSGD, + BFD_RELOC_X86_64_TLSLD, + BFD_RELOC_X86_64_DTPOFF32, + BFD_RELOC_X86_64_GOTTPOFF, + BFD_RELOC_X86_64_TPOFF32, /* ns32k relocations */ BFD_RELOC_NS32K_IMM_8, @@ -3462,6 +3477,9 @@ struct _bfd /* Symbol table for output BFD (with symcount entries). */ struct symbol_cache_entry **outsymbols; + /* Used for slurped dynamic symbol tables. */ + unsigned int dynsymcount; + /* Pointer to structure which contains architecture information. */ const struct bfd_arch_info *arch_info; diff --git a/bfd/bfd.c b/bfd/bfd.c index 277c74a7422..cfd77726a3e 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -128,6 +128,9 @@ CODE_FRAGMENT . {* Symbol table for output BFD (with symcount entries). *} . struct symbol_cache_entry **outsymbols; . +. {* Used for slurped dynamic symbol tables. *} +. unsigned int dynsymcount; +. . {* Pointer to structure which contains architecture information. *} . const struct bfd_arch_info *arch_info; . diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c index 1669f7cc012..561d161f82f 100644 --- a/bfd/coff-tic4x.c +++ b/bfd/coff-tic4x.c @@ -1,5 +1,6 @@ /* BFD back-end for TMS320C4X coff binaries. - Copyright (C) 1996-99, 2000, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2002 + Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) This file is part of BFD, the Binary File Descriptor library. @@ -30,9 +31,27 @@ #undef F_LSYMS #define F_LSYMS F_LSYMS_TICOFF +static boolean ticoff0_bad_format_hook + PARAMS ((bfd *, PTR )); +static boolean ticoff1_bad_format_hook + PARAMS ((bfd *, PTR )); +static boolean ticoff_bfd_is_local_label_name + PARAMS ((bfd *, const char *)); +static bfd_reloc_status_type tic4x_relocation + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char ** )); +static reloc_howto_type *tic4x_coff_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type )); +static void tic4x_lookup_howto + PARAMS ((arelent *, struct internal_reloc * )); +static reloc_howto_type *coff_tic4x_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma * )); +static void tic4x_reloc_processing + PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection * )); + + static boolean ticoff0_bad_format_hook (abfd, filehdr) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; PTR filehdr; { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; @@ -70,9 +89,6 @@ ticoff_bfd_is_local_label_name (abfd, name) #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name -static void tic4x_reloc_processing - PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); - #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\ tic4x_reloc_processing (RELENT,RELOC,SYMS,ABFD,SECT) diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index d5cce39b968..61553bea81a 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1014,7 +1014,7 @@ xcoff64_write_object_contents (abfd) internal_a.o_cputype = 4; break; case bfd_arch_powerpc: - if (bfd_get_mach (abfd) == 0) + if (bfd_get_mach (abfd) == bfd_mach_ppc) internal_a.o_cputype = 3; else internal_a.o_cputype = 1; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 212c5c6ff7f..e47b4d0050f 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1824,6 +1824,7 @@ coff_set_arch_mach_hook (abfd, filehdr) enum bfd_architecture arch; struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + /* Zero selects the default machine for an arch. */ machine = 0; switch (internal_f->f_magic) { @@ -1831,13 +1832,11 @@ coff_set_arch_mach_hook (abfd, filehdr) case OR32_MAGIC_BIG: case OR32_MAGIC_LITTLE: arch = bfd_arch_or32; - machine = 0; break; #endif #ifdef PPCMAGIC case PPCMAGIC: arch = bfd_arch_powerpc; - machine = 0; /* what does this mean? (krk) */ break; #endif #ifdef I386MAGIC @@ -1846,20 +1845,17 @@ coff_set_arch_mach_hook (abfd, filehdr) case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */ case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */ arch = bfd_arch_i386; - machine = 0; break; #endif #ifdef IA64MAGIC case IA64MAGIC: arch = bfd_arch_ia64; - machine = 0; break; #endif #ifdef A29K_MAGIC_BIG case A29K_MAGIC_BIG: case A29K_MAGIC_LITTLE: arch = bfd_arch_a29k; - machine = 0; break; #endif #ifdef ARMMAGIC @@ -2044,7 +2040,6 @@ coff_set_arch_mach_hook (abfd, filehdr) #ifdef WE32KMAGIC case WE32KMAGIC: arch = bfd_arch_we32k; - machine = 0; break; #endif @@ -2082,21 +2077,18 @@ coff_set_arch_mach_hook (abfd, filehdr) case SH_ARCH_MAGIC_WINCE: #endif arch = bfd_arch_sh; - machine = 0; break; #endif #ifdef MIPS_ARCH_MAGIC_WINCE case MIPS_ARCH_MAGIC_WINCE: arch = bfd_arch_mips; - machine = 0; break; #endif #ifdef H8500MAGIC case H8500MAGIC: arch = bfd_arch_h8500; - machine = 0; break; #endif @@ -2106,7 +2098,6 @@ coff_set_arch_mach_hook (abfd, filehdr) case LYNXCOFFMAGIC: #endif arch = bfd_arch_sparc; - machine = 0; break; #endif @@ -2462,7 +2453,8 @@ coff_write_relocs (abfd, first_undef) #ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s)) #else - if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr) + if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr + && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0) #endif /* This is a relocation relative to the absolute symbol. */ n.r_symndx = -1; @@ -4116,7 +4108,7 @@ coff_write_object_contents (abfd) internal_a.o_cputype = 4; break; case bfd_arch_powerpc: - if (bfd_get_mach (abfd) == 0) + if (bfd_get_mach (abfd) == bfd_mach_ppc) internal_a.o_cputype = 3; else internal_a.o_cputype = 1; diff --git a/bfd/config.bfd b/bfd/config.bfd index 55e2afcf86e..4aabfedaf53 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -71,7 +71,16 @@ esac case "${targ}" in # START OF targmatch.h #ifdef BFD64 - alpha*-*-netbsd* | alpha*-*-freebsd* | alpha*-*-openbsd*) + alpha*-*-freebsd*) + targ_defvec=bfd_elf64_alpha_freebsd_vec + targ_selvecs=ecoffalpha_little_vec + # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling. + case "${targ}" in + alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*) + targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;; + esac + ;; + alpha*-*-netbsd* | alpha*-*-openbsd*) targ_defvec=bfd_elf64_alpha_vec targ_selvecs=ecoffalpha_little_vec ;; @@ -368,7 +377,7 @@ case "${targ}" in i[3456]86-*-chorus*) targ_defvec=bfd_elf32_i386_vec ;; - i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* ) + *-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* ) targ_defvec=go32coff_vec targ_selvecs="go32stubbedcoff_vec i386aout_vec" ;; @@ -399,8 +408,13 @@ case "${targ}" in targ_underscore=yes ;; i[3456]86-*-freebsd*) - targ_defvec=bfd_elf32_i386_vec + targ_defvec=bfd_elf32_i386_freebsd_vec targ_selvecs=i386coff_vec + # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling. + case "${targ}" in + i[3456]86-*-freebsd3* | i[3456]86-*-freebsd4 | i[3456]86-*-freebsd4.0*) + targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;; + esac ;; i[3456]86-*-netbsdelf*) targ_defvec=bfd_elf32_i386_vec @@ -701,8 +715,8 @@ case "${targ}" in ;; #ifdef BFD64 mips*-*-irix6*) - targ_defvec=bfd_elf32_bigmips_vec - targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + targ_defvec=bfd_elf32_nbigmips_vec + targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; #endif mips*-*-irix5*) diff --git a/bfd/configure b/bfd/configure index d30361eed25..2ca10f7e37f 100755 --- a/bfd/configure +++ b/bfd/configure @@ -2661,7 +2661,7 @@ else fi -ALL_LINGUAS="fr tr ja es sv" +ALL_LINGUAS="fr tr ja es sv da" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:2667: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. @@ -6075,6 +6075,7 @@ do bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; + bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; @@ -6133,6 +6134,7 @@ do bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; @@ -6338,10 +6340,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6342: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6344: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6345 "configure" +#line 6347 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6386,17 +6388,17 @@ for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6390: checking for $ac_hdr" >&5 +echo "configure:6392: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6395 "configure" +#line 6397 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6425,12 +6427,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6429: checking for $ac_func" >&5 +echo "configure:6431: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6434 "configure" +#line 6436 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6453,7 +6455,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6478,7 +6480,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6482: checking for working mmap" >&5 +echo "configure:6484: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6486,7 +6488,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6490 "configure" +#line 6492 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6639,7 +6641,7 @@ main() } EOF -if { (eval echo configure:6643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6664,12 +6666,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6668: checking for $ac_func" >&5 +echo "configure:6670: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6673 "configure" +#line 6675 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6692,7 +6694,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 1facc24856f..ba38dd423b2 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -109,7 +109,7 @@ bfd_default_target_size=32 AC_PROG_CC -ALL_LINGUAS="fr tr ja es sv" +ALL_LINGUAS="fr tr ja es sv da" CY_GNU_GETTEXT # Permit host specific settings. @@ -576,6 +576,7 @@ do bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; + bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; @@ -634,6 +635,7 @@ do bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c index 1ca48e744ee..b623790cac1 100644 --- a/bfd/cpu-avr.c +++ b/bfd/cpu-avr.c @@ -76,8 +76,8 @@ compatible (a,b) return NULL; /* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4). */ - if ((a->mach == 3 && b->mach == 4) - || (a->mach == 4 && b->mach == 3)) + if ((a->mach == bfd_mach_avr3 && b->mach == bfd_mach_avr4) + || (a->mach == bfd_mach_avr4 && b->mach == bfd_mach_avr3)) return NULL; /* So far all newer AVR architecture cores are supersets of previous diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c index d5343ff31ef..75e84c227c6 100644 --- a/bfd/cpu-mips.c +++ b/bfd/cpu-mips.c @@ -67,11 +67,14 @@ enum I_mips4010, I_mips4100, I_mips4111, + I_mips4120, I_mips4300, I_mips4400, I_mips4600, I_mips4650, I_mips5000, + I_mips5400, + I_mips5500, I_mips6000, I_mips8000, I_mips10000, @@ -93,11 +96,14 @@ static const bfd_arch_info_type arch_info_struct[] = N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)), N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)), N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)), + N (64, 64, bfd_mach_mips4120, "mips:4120", false, NN(I_mips4120)), N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)), N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)), N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)), N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)), N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)), + N (64, 64, bfd_mach_mips5400, "mips:5400", false, NN(I_mips5400)), + N (64, 64, bfd_mach_mips5500, "mips:5500", false, NN(I_mips5500)), N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)), N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)), N (64, 64, bfd_mach_mips10000,"mips:10000", false, NN(I_mips10000)), diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c index aeb7e589ccc..8e58c89fbd7 100644 --- a/bfd/cpu-pj.c +++ b/bfd/cpu-pj.c @@ -22,52 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -static boolean scan_mach - PARAMS ((const struct bfd_arch_info *, const char *)); - -static boolean -scan_mach (info, string) - const struct bfd_arch_info *info; - const char *string; -{ - if (strcasecmp (info->printable_name, string) == 0) - return true; - return false; -} - -#if 0 -/* This routine is provided two arch_infos and returns whether - they'd be compatible */ - -static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch || a->mach != b->mach) - return NULL; - return a; -} -#endif - -static const bfd_arch_info_type arch_info_struct[] = -{ - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_pj, - 0, - "pj", /* arch_name */ - "pj", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - 0, - }, -}; - const bfd_arch_info_type bfd_pj_arch = { 32, /* 32 bits in a word */ @@ -80,6 +34,6 @@ const bfd_arch_info_type bfd_pj_arch = 1, true, /* the default machine */ bfd_default_compatible, - scan_mach, - &arch_info_struct [0] + bfd_default_scan, + 0 }; diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c index b282c6031b9..017442571c8 100644 --- a/bfd/cpu-powerpc.c +++ b/bfd/cpu-powerpc.c @@ -41,7 +41,7 @@ powerpc_compatible (a,b) case bfd_arch_powerpc: return bfd_default_compatible (a, b); case bfd_arch_rs6000: - if (a->mach == 0) + if (a->mach == bfd_mach_ppc) return a; return NULL; } diff --git a/bfd/cpu-rs6000.c b/bfd/cpu-rs6000.c index 89b92308c89..777611e603a 100644 --- a/bfd/cpu-rs6000.c +++ b/bfd/cpu-rs6000.c @@ -46,7 +46,7 @@ rs6000_compatible (a,b) case bfd_arch_rs6000: return bfd_default_compatible (a, b); case bfd_arch_powerpc: - if (b->mach == 0) + if (b->mach == bfd_mach_rs6k) return b; return NULL; } diff --git a/bfd/cpu-tic4x.c b/bfd/cpu-tic4x.c index 9d90fc62bd7..75a8a240c38 100644 --- a/bfd/cpu-tic4x.c +++ b/bfd/cpu-tic4x.c @@ -23,6 +23,10 @@ #include "sysdep.h" #include "libbfd.h" +static boolean c4x_scan + PARAMS ((const struct bfd_arch_info *, const char * )); + + static boolean c4x_scan (info, string) const struct bfd_arch_info *info; diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c index ce61caa7562..38333c8c153 100644 --- a/bfd/cpu-v850.c +++ b/bfd/cpu-v850.c @@ -22,67 +22,9 @@ #include "libbfd.h" #include "safe-ctype.h" -static boolean scan PARAMS ((const struct bfd_arch_info *, const char *)); - -static boolean -scan (info, string) - const struct bfd_arch_info * info; - const char * string; -{ - const char *ptr_src; - const char *ptr_tst; - unsigned long number; - enum bfd_architecture arch; - - /* First test for an exact match. */ - if (strcasecmp (string, info->printable_name) == 0) - return true; - - /* See how much of the supplied string matches with the - architecture, eg the string m68k:68020 would match the m68k entry - up to the :, then we get left with the machine number. */ - for (ptr_src = string, ptr_tst = info->arch_name; - *ptr_src && *ptr_tst; - ptr_src++, ptr_tst++) - if (*ptr_src != *ptr_tst) - break; - - /* Chewed up as much of the architecture as will match; - if there is a colon present skip it. */ - if (*ptr_src == ':') - ptr_src ++; - - if (*ptr_src == 0) - /* Nothing more, then only keep this one if it is - the default machine for this architecture. */ - return info->the_default; - - number = 0; - while (ISDIGIT (*ptr_src)) - { - number = number * 10 + * ptr_src - '0'; - ptr_src ++; - } - - switch (number) - { - case bfd_mach_v850e: arch = bfd_arch_v850; break; - default: - return false; - } - - if (arch != info->arch) - return false; - - if (number != info->mach) - return false; - - return true; -} - #define N(number, print, default, next) \ { 32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \ - bfd_default_compatible, scan, next } + bfd_default_compatible, bfd_default_scan, next } #define NEXT NULL diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c index 0afdfc7560a..b75eaeafd54 100644 --- a/bfd/cpu-z8k.c +++ b/bfd/cpu-z8k.c @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -static boolean scan_mach - PARAMS ((const struct bfd_arch_info *, const char *)); static const bfd_arch_info_type *compatible PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); @@ -153,22 +151,6 @@ local_bfd_reloc_type_lookup (arch, code) } #endif -static boolean -scan_mach (info, string) - const struct bfd_arch_info *info; - const char *string; -{ - if (strcmp (string, "z8001") == 0 || strcmp (string, "z8k") == 0) - { - return bfd_mach_z8001 == info->mach; - } - if (strcmp (string, "z8002") == 0) - { - return bfd_mach_z8002 == info->mach; - } - return false; -} - /* This routine is provided two arch_infos and returns whether they'd be compatible */ @@ -184,10 +166,12 @@ compatible (a, b) static const bfd_arch_info_type arch_info_struct[] = { - {32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,}, + { 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, false, + compatible, bfd_default_scan, 0 } }; const bfd_arch_info_type bfd_z8k_arch = { - 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, true, compatible, scan_mach, &arch_info_struct[0], + 32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, true, + compatible, bfd_default_scan, &arch_info_struct[0] }; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 9c5e7b8d173..7c000b9890e 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -13,21 +13,21 @@ based on Fred Fish's (Cygnus Support) implementation of DWARF 1 support in dwarfread.c -This file is part of BFD. + This file is part of BFD. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at -your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at + your option) any later version. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -1084,13 +1084,19 @@ decode_line_info (unit, stash) { /* State machine registers. */ bfd_vma address = 0; - char* filename = concat_filename (table, 1); + char * filename = concat_filename (table, 1); unsigned int line = 1; unsigned int column = 0; int is_stmt = lh.default_is_stmt; int basic_block = 0; - int end_sequence = 0, need_low_pc = 1; - bfd_vma low_pc = 0; + int end_sequence = 0; + /* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some + compilers generate address sequences that are wildly out of + order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler + for ia64-Linux). Thus, to determine the low and high + address, we must compare on every DW_LNS_copy, etc. */ + bfd_vma low_pc = 0; + bfd_vma high_pc = 0; /* Decode the table. */ while (! end_sequence) @@ -1099,7 +1105,8 @@ decode_line_info (unit, stash) line_ptr += 1; if (op_code >= lh.opcode_base) - { /* Special operand. */ + { + /* Special operand. */ adj_opcode = op_code - lh.opcode_base; address += (adj_opcode / lh.line_range) * lh.minimum_instruction_length; @@ -1107,30 +1114,30 @@ decode_line_info (unit, stash) /* Append row to matrix using current values. */ add_line_info (table, address, filename, line, column, 0); basic_block = 1; - if (need_low_pc) - { - need_low_pc = 0; - low_pc = address; - } + if (low_pc == 0 || address < low_pc) + low_pc = address; + if (address > high_pc) + high_pc = address; } else switch (op_code) { case DW_LNS_extended_op: - line_ptr += 1; /* Ignore length. */ + /* Ignore length. */ + line_ptr += 1; extended_op = read_1_byte (abfd, line_ptr); line_ptr += 1; + switch (extended_op) { case DW_LNE_end_sequence: end_sequence = 1; add_line_info (table, address, filename, line, column, end_sequence); - if (need_low_pc) - { - need_low_pc = 0; - low_pc = address; - } - arange_add (unit, low_pc, address); + if (low_pc == 0 || address < low_pc) + low_pc = address; + if (address > high_pc) + high_pc = address; + arange_add (unit, low_pc, high_pc); break; case DW_LNE_set_address: address = read_address (unit, line_ptr); @@ -1169,11 +1176,10 @@ decode_line_info (unit, stash) case DW_LNS_copy: add_line_info (table, address, filename, line, column, 0); basic_block = 0; - if (need_low_pc) - { - need_low_pc = 0; - low_pc = address; - } + if (low_pc == 0 || address < low_pc) + low_pc = address; + if (address > high_pc) + high_pc = address; break; case DW_LNS_advance_pc: address += lh.minimum_instruction_length @@ -1188,8 +1194,8 @@ decode_line_info (unit, stash) { unsigned int file; - /* The file and directory tables are 0 based, the references - are 1 based. */ + /* The file and directory tables are 0 + based, the references are 1 based. */ file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; filename = concat_filename (table, file); @@ -1214,8 +1220,9 @@ decode_line_info (unit, stash) line_ptr += 2; break; default: - { /* Unknown standard opcode, ignore it. */ + { int i; + /* Unknown standard opcode, ignore it. */ for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++) { (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); @@ -1234,10 +1241,7 @@ decode_line_info (unit, stash) LINENUMBER_PTR, are pointers to the objects to be filled in. */ static boolean -lookup_address_in_line_info_table (table, - addr, - function, - filename_ptr, +lookup_address_in_line_info_table (table, addr, function, filename_ptr, linenumber_ptr) struct line_info_table* table; bfd_vma addr; @@ -1298,9 +1302,7 @@ lookup_address_in_line_info_table (table, /* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */ static boolean -lookup_address_in_function_table (table, - addr, - function_ptr, +lookup_address_in_function_table (table, addr, function_ptr, functionname_ptr) struct funcinfo* table; bfd_vma addr; @@ -1666,9 +1668,8 @@ comp_unit_contains_address (unit, addr) false otherwise. */ static boolean -comp_unit_find_nearest_line (unit, addr, - filename_ptr, functionname_ptr, linenumber_ptr, - stash) +comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr, + linenumber_ptr, stash) struct comp_unit* unit; bfd_vma addr; const char **filename_ptr; @@ -1708,26 +1709,23 @@ comp_unit_find_nearest_line (unit, addr, } function = NULL; - func_p = lookup_address_in_function_table (unit->function_table, - addr, - &function, - functionname_ptr); - line_p = lookup_address_in_line_info_table (unit->line_table, - addr, - function, - filename_ptr, + func_p = lookup_address_in_function_table (unit->function_table, addr, + &function, functionname_ptr); + line_p = lookup_address_in_line_info_table (unit->line_table, addr, + function, filename_ptr, linenumber_ptr); return line_p || func_p; } -/* Locate a section in a BFD containing debugging info. The search starts from the - section after AFTER_SEC, or from the first section in the BFD if AFTER_SEC is - NULL. The search works by examining the names of the sections. There are two - permissiable names. The first is .debug_info. This is the standard DWARF2 name. - The second is a prefix .gnu.linkonce.wi. This is a variation on the .debug_info - section which has a checksum describing the contents appended onto the name. This - allows the linker to identify and discard duplicate debugging sections for - different compilation units. */ +/* Locate a section in a BFD containing debugging info. The search starts + from the section after AFTER_SEC, or from the first section in the BFD if + AFTER_SEC is NULL. The search works by examining the names of the + sections. There are two permissiable names. The first is .debug_info. + This is the standard DWARF2 name. The second is a prefix .gnu.linkonce.wi. + This is a variation on the .debug_info section which has a checksum + describing the contents appended onto the name. This allows the linker to + identify and discard duplicate debugging sections for different + compilation units. */ #define DWARF2_DEBUG_INFO ".debug_info" #define GNU_LINKONCE_INFO ".gnu.linkonce.wi." @@ -1766,8 +1764,7 @@ find_debug_info (abfd, after_sec) boolean _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, filename_ptr, functionname_ptr, - linenumber_ptr, - addr_size, pinfo) + linenumber_ptr, addr_size, pinfo) bfd *abfd; asection *section; asymbol **symbols; @@ -1907,6 +1904,13 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, length = read_8_bytes (abfd, stash->info_ptr + 4); stash->info_ptr += 8; } + else if (length == 0) + { + /* Handle (non-standard) 64-bit DWARF2 formats. */ + offset_size = 8; + length = read_4_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 4; + } } else length = read_8_bytes (abfd, stash->info_ptr); diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 82baeeb78c0..47b65822340 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -205,21 +205,21 @@ _bfd_ecoff_set_arch_mach_hook (abfd, filehdr) case MIPS_MAGIC_LITTLE: case MIPS_MAGIC_BIG: arch = bfd_arch_mips; - mach = 3000; + mach = bfd_mach_mips3000; break; case MIPS_MAGIC_LITTLE2: case MIPS_MAGIC_BIG2: /* MIPS ISA level 2: the r6000. */ arch = bfd_arch_mips; - mach = 6000; + mach = bfd_mach_mips6000; break; case MIPS_MAGIC_LITTLE3: case MIPS_MAGIC_BIG3: /* MIPS ISA level 3: the r4000. */ arch = bfd_arch_mips; - mach = 4000; + mach = bfd_mach_mips4000; break; case ALPHA_MAGIC: @@ -252,17 +252,17 @@ ecoff_get_magic (abfd) { default: case 0: - case 3000: + case bfd_mach_mips3000: big = MIPS_MAGIC_BIG; little = MIPS_MAGIC_LITTLE; break; - case 6000: + case bfd_mach_mips6000: big = MIPS_MAGIC_BIG2; little = MIPS_MAGIC_LITTLE2; break; - case 4000: + case bfd_mach_mips4000: big = MIPS_MAGIC_BIG3; little = MIPS_MAGIC_LITTLE3; break; @@ -553,7 +553,9 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) UPDATE_RAW_END (cbDnOffset, idnMax, backend->debug_swap.external_dnr_size); UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size); UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size); - UPDATE_RAW_END (cbOptOffset, ioptMax, backend->debug_swap.external_opt_size); + /* eraxxon@alumni.rice.edu: ioptMax refers to the size of the + optimization symtab, not the number of entries */ + UPDATE_RAW_END (cbOptOffset, ioptMax, sizeof (char)); UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext)); UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char)); UPDATE_RAW_END (cbSsExtOffset, issExtMax, sizeof (char)); diff --git a/bfd/ecoffswap.h b/bfd/ecoffswap.h index 24627d021fc..7ea03943bb0 100644 --- a/bfd/ecoffswap.h +++ b/bfd/ecoffswap.h @@ -1,23 +1,23 @@ /* Generic ECOFF swapping routines, for BFD. - Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + 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 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* NOTE: This is a header file, but it contains executable routines. This is done this way because these routines are substantially @@ -220,7 +220,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern) intern->rfdBase = H_GET_32 (abfd, ext->f_rfdBase); intern->crfd = H_GET_32 (abfd, ext->f_crfd); - /* now the fun stuff... */ + /* Now the fun stuff... */ if (bfd_header_big_endian (abfd)) { intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_BIG) @@ -263,7 +263,8 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr) struct fdr_ext *ext = (struct fdr_ext *) ext_ptr; FDR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; ECOFF_PUT_OFF (abfd, intern->adr, ext->f_adr); H_PUT_32 (abfd, intern->rss, ext->f_rss); @@ -288,7 +289,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr) H_PUT_32 (abfd, intern->rfdBase, ext->f_rfdBase); H_PUT_32 (abfd, intern->crfd, ext->f_crfd); - /* now the fun stuff... */ + /* Now the fun stuff... */ if (bfd_header_big_endian (abfd)) { ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG) @@ -355,6 +356,11 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern) intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset); #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) + if (intern->isym == (signed long) 0xffffffff) + intern->isym = -1; + if (intern->iline == (signed long) 0xffffffff) + intern->iline = -1; + intern->gp_prologue = H_GET_8 (abfd, ext->p_gp_prologue); if (bfd_header_big_endian (abfd)) { @@ -396,7 +402,8 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr) struct pdr_ext *ext = (struct pdr_ext *) ext_ptr; PDR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr); H_PUT_32 (abfd, intern->isym, ext->p_isym); @@ -494,7 +501,8 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr) struct pdr_ext *ext = (struct pdr_ext *) ext_ptr; PDR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr); H_PUT_32 (abfd, intern->isym, ext->p_isym); @@ -533,33 +541,41 @@ ecoff_swap_sym_in (abfd, ext_copy, intern) intern->iss = H_GET_32 (abfd, ext->s_iss); intern->value = ECOFF_GET_OFF (abfd, ext->s_value); - /* now the fun stuff... */ - if (bfd_header_big_endian (abfd)) { - intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG) - >> SYM_BITS1_ST_SH_BIG; - intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG) - << SYM_BITS1_SC_SH_LEFT_BIG) - | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG) - >> SYM_BITS2_SC_SH_BIG); - intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG); - intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG) - << SYM_BITS2_INDEX_SH_LEFT_BIG) - | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG) - | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG); - } else { - intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE) - >> SYM_BITS1_ST_SH_LITTLE; - intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE) - >> SYM_BITS1_SC_SH_LITTLE) - | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE) - << SYM_BITS2_SC_SH_LEFT_LITTLE); - intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE); - intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE) - >> SYM_BITS2_INDEX_SH_LITTLE) - | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE) - | ((unsigned int) ext->s_bits4[0] - << SYM_BITS4_INDEX_SH_LEFT_LITTLE); - } +#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) + if (intern->iss == (signed long) 0xffffffff) + intern->iss = -1; +#endif + + /* Now the fun stuff... */ + if (bfd_header_big_endian (abfd)) + { + intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG) + >> SYM_BITS1_ST_SH_BIG; + intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG) + << SYM_BITS1_SC_SH_LEFT_BIG) + | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG) + >> SYM_BITS2_SC_SH_BIG); + intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG); + intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG) + << SYM_BITS2_INDEX_SH_LEFT_BIG) + | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG) + | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG); + } + else + { + intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE) + >> SYM_BITS1_ST_SH_LITTLE; + intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE) + >> SYM_BITS1_SC_SH_LITTLE) + | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE) + << SYM_BITS2_SC_SH_LEFT_LITTLE); + intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE); + intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE) + >> SYM_BITS2_INDEX_SH_LITTLE) + | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE) + | ((unsigned int) ext->s_bits4[0] + << SYM_BITS4_INDEX_SH_LEFT_LITTLE); + } #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -578,37 +594,41 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr) struct sym_ext *ext = (struct sym_ext *) ext_ptr; SYMR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; H_PUT_32 (abfd, intern->iss, ext->s_iss); ECOFF_PUT_OFF (abfd, intern->value, ext->s_value); - /* now the fun stuff... */ - if (bfd_header_big_endian (abfd)) { - ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG) - & SYM_BITS1_ST_BIG) - | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG) - & SYM_BITS1_SC_BIG)); - ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG) - & SYM_BITS2_SC_BIG) - | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0) - | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG) - & SYM_BITS2_INDEX_BIG)); - ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff; - ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff; - } else { - ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE) - & SYM_BITS1_ST_LITTLE) - | ((intern->sc << SYM_BITS1_SC_SH_LITTLE) - & SYM_BITS1_SC_LITTLE)); - ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE) - & SYM_BITS2_SC_LITTLE) - | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0) - | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE) - & SYM_BITS2_INDEX_LITTLE)); - ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff; - ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff; - } + /* Now the fun stuff... */ + if (bfd_header_big_endian (abfd)) + { + ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG) + & SYM_BITS1_ST_BIG) + | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG) + & SYM_BITS1_SC_BIG)); + ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG) + & SYM_BITS2_SC_BIG) + | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0) + | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG) + & SYM_BITS2_INDEX_BIG)); + ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff; + ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff; + } + else + { + ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE) + & SYM_BITS1_ST_LITTLE) + | ((intern->sc << SYM_BITS1_SC_SH_LITTLE) + & SYM_BITS1_SC_LITTLE)); + ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE) + & SYM_BITS2_SC_LITTLE) + | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0) + | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE) + & SYM_BITS2_INDEX_LITTLE)); + ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff; + ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff; + } #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -628,23 +648,26 @@ ecoff_swap_ext_in (abfd, ext_copy, intern) *ext = *(struct ext_ext *) ext_copy; - /* now the fun stuff... */ - if (bfd_header_big_endian (abfd)) { - intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG); - intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG); - intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG); - } else { - intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE); - intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE); - intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE); - } + /* Now the fun stuff... */ + if (bfd_header_big_endian (abfd)) + { + intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG); + intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG); + intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG); + } + else + { + intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE); + intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE); + intern->weakext = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE); + } intern->reserved = 0; #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32) - intern->ifd = H_GET_S16 (abfd, ext->es_ifd); + intern->ifd = H_GET_S16 (abfd, ext->es_ifd); #endif #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - intern->ifd = H_GET_S32 (abfd, ext->es_ifd); + intern->ifd = H_GET_S32 (abfd, ext->es_ifd); #endif ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym); @@ -666,28 +689,32 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr) struct ext_ext *ext = (struct ext_ext *) ext_ptr; EXTR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; - /* now the fun stuff... */ - if (bfd_header_big_endian (abfd)) { - ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0) - | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0) - | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0)); - ext->es_bits2[0] = 0; + /* Now the fun stuff... */ + if (bfd_header_big_endian (abfd)) + { + ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0) + | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0) + | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0)); + ext->es_bits2[0] = 0; #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - ext->es_bits2[1] = 0; - ext->es_bits2[2] = 0; -#endif - } else { - ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0) - | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0) - | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0)); - ext->es_bits2[0] = 0; + ext->es_bits2[1] = 0; + ext->es_bits2[2] = 0; +#endif + } + else + { + ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0) + | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0) + | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0)); + ext->es_bits2[0] = 0; #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - ext->es_bits2[1] = 0; - ext->es_bits2[2] = 0; + ext->es_bits2[1] = 0; + ext->es_bits2[2] = 0; #endif - } + } #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32) H_PUT_S16 (abfd, intern->ifd, ext->es_ifd); @@ -792,7 +819,8 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr) struct opt_ext *ext = (struct opt_ext *) ext_ptr; OPTR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; if (bfd_header_big_endian (abfd)) { @@ -852,7 +880,8 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr) struct dnr_ext *ext = (struct dnr_ext *) ext_ptr; DNR intern[1]; - *intern = *intern_copy; /* Make it reasonable to do in-place. */ + /* Make it reasonable to do in-place. */ + *intern = *intern_copy; H_PUT_32 (abfd, intern->rfd, ext->d_rfd); H_PUT_32 (abfd, intern->index, ext->d_index); diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index eb4a69b04d0..e80fc6c9d57 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -632,11 +632,11 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec, goto free_no_table; if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie)) { - cookie->rel = rel; /* This is a FDE against discarded section, it should be deleted. */ new_size -= hdr.length + 4; sec_info->entry[sec_info->count].removed = 1; + memset (rel, 0, sizeof (*rel)); } else { diff --git a/bfd/elf.c b/bfd/elf.c index 71763d41bef..c1e2d118071 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3317,8 +3317,9 @@ map_sections_to_segments (abfd) } else if (! writable && (hdr->flags & SEC_READONLY) == 0 - && (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize) - == hdr->lma)) + && (((last_hdr->lma + last_hdr->_raw_size - 1) + & ~(maxpagesize - 1)) + != (hdr->lma & ~(maxpagesize - 1)))) { /* We don't want to put a writable section in a read only segment, unless they are on the same page in memory @@ -5572,7 +5573,11 @@ _bfd_elf_canonicalize_dynamic_symtab (abfd, alocation) asymbol **alocation; { struct elf_backend_data *bed = get_elf_backend_data (abfd); - return bed->s->slurp_symbol_table (abfd, alocation, true); + long symcount = bed->s->slurp_symbol_table (abfd, alocation, true); + + if (symcount >= 0) + bfd_get_dynamic_symcount (abfd) = symcount; + return symcount; } /* Return the size required for the dynamic reloc entries. Any @@ -6041,7 +6046,7 @@ _bfd_elf_find_nearest_line (abfd, section, symbols, offset, functionname_ptr, line_ptr, &elf_tdata (abfd)->line_info)) return false; - if (found) + if (found && (*functionname_ptr || *line_ptr)) return true; if (symbols == NULL) diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 5cd94347c31..2d59601fd02 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -1501,33 +1501,36 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, case R_ARM_THM_PC11: /* Thumb B (branch) instruction). */ { - bfd_vma relocation; + bfd_signed_vma relocation; bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; - bfd_vma check; bfd_signed_vma signed_check; #ifdef USE_REL /* Need to refetch addend. */ addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; - /* ??? Need to determine shift amount from operand size. */ - addend >>= howto->rightshift; + if (addend & ((howto->src_mask + 1) >> 1)) + { + signed_addend = -1; + signed_addend &= ~ howto->src_mask; + signed_addend |= addend; + } + else + signed_addend = addend; + /* The value in the insn has been right shifted. We need to + undo this, so that we can perform the address calculation + in terms of bytes. */ + signed_addend <<= howto->rightshift; #endif - relocation = value + addend; + relocation = value + signed_addend; relocation -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset); - check = relocation >> howto->rightshift; - - /* If this is a signed value, the rightshift just - dropped leading 1 bits (assuming twos complement). */ - if ((bfd_signed_vma) relocation >= 0) - signed_check = check; - else - signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); - + relocation >>= howto->rightshift; + signed_check = relocation; + relocation &= howto->dst_mask; relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask)); bfd_put_16 (input_bfd, relocation, hit_data); @@ -2963,16 +2966,22 @@ elf32_arm_adjust_dynamic_symbol (info, h) if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { + /* If we link a program (not a DSO), we'll get rid of unnecessary + PLT entries; we point to the actual symbols -- even for pic + relocs, because a program built with -fpic should have the same + result as one built without -fpic, specifically considering weak + symbols. + FIXME: m68k and i386 differ here, for unclear reasons. */ if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0) { /* This case can occur if we saw a PLT32 reloc in an input - file, but the symbol was never referred to by a dynamic - object. In such a case, we don't actually need to build - a procedure linkage table, and we can just do a PC32 - reloc instead. */ + file, but the symbol was not defined by a dynamic object. + In such a case, we don't actually need to build a + procedure linkage table, and we can just do a PC32 reloc + instead. */ BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; return true; } diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 48e2960998d..c1c77ec0b43 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -765,7 +765,7 @@ elf32_h8_relax_section (abfd, sec, link_info, again) Elf_Internal_Sym *isym; asection *sym_sec; - isym = isymbuf + ELF64_R_SYM (irel->r_info); + isym = isymbuf + ELF32_R_SYM (irel->r_info); sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); symval = (isym->st_value + sym_sec->output_section->vma diff --git a/bfd/elf32-i386-fbsd.c b/bfd/elf32-i386-fbsd.c new file mode 100644 index 00000000000..500e0ebc048 --- /dev/null +++ b/bfd/elf32-i386-fbsd.c @@ -0,0 +1,56 @@ +/* Intel IA-32 specific support for 32-bit ELF on FreeBSD. + Copyright 2002 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 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec +#define TARGET_LITTLE_NAME "elf32-i386-freebsd" +#define ELF_ARCH bfd_arch_i386 +#define ELF_MACHINE_CODE EM_386 +#define ELF_MAXPAGESIZE 0x1000 + +#include "bfd.h" +#include "sysdep.h" +#include "elf-bfd.h" + +/* The kernel recognizes executables as valid only if they carry a + "FreeBSD" label in the ELF header. So we put this label on all + executables and (for simplicity) also all other object files. */ + +static void elf_i386_post_process_headers + PARAMS ((bfd *, struct bfd_link_info *)); + +static void +elf_i386_post_process_headers (abfd, link_info) + bfd * abfd; + struct bfd_link_info * link_info ATTRIBUTE_UNUSED; +{ + Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ + + i_ehdrp = elf_elfheader (abfd); + + /* Put an ABI label supported by FreeBSD >= 4.1. */ + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; +#ifdef OLD_FREEBSD_ABI_LABEL + /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ + memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); +#endif +} + +#define elf_backend_post_process_headers elf_i386_post_process_headers + +#include "elf32-i386.c" diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index edf06de43e0..b71d78eb073 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -133,9 +133,18 @@ static reloc_howto_type elf_howto_table[]= R_386_ext_offset is the value to subtract from a reloc type of R_386_16 thru R_386_PC8 to form an index into this table. */ #define R_386_standard ((unsigned int) R_386_GOTPC + 1) -#define R_386_ext_offset ((unsigned int) R_386_TLS_LE - R_386_standard) +#define R_386_ext_offset ((unsigned int) R_386_TLS_TPOFF - R_386_standard) - /* The remaining relocs are a GNU extension. */ + /* These relocs are a GNU extension. */ + HOWTO(R_386_TLS_TPOFF, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_TPOFF", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_IE, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_IE", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_GOTIE, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_GOTIE", + true, 0xffffffff, 0xffffffff, false), HOWTO(R_386_TLS_LE, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_386_TLS_LE", true, 0xffffffff, 0xffffffff, false), @@ -279,7 +288,19 @@ elf_i386_reloc_type_lookup (abfd, code) TRACE ("BFD_RELOC_386_GOTPC"); return &elf_howto_table[(unsigned int) R_386_GOTPC ]; - /* The remaining relocs are a GNU extension. */ + /* These relocs are a GNU extension. */ + case BFD_RELOC_386_TLS_TPOFF: + TRACE ("BFD_RELOC_386_TLS_TPOFF"); + return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF - R_386_ext_offset]; + + case BFD_RELOC_386_TLS_IE: + TRACE ("BFD_RELOC_386_TLS_IE"); + return &elf_howto_table[(unsigned int) R_386_TLS_IE - R_386_ext_offset]; + + case BFD_RELOC_386_TLS_GOTIE: + TRACE ("BFD_RELOC_386_TLS_GOTIE"); + return &elf_howto_table[(unsigned int) R_386_TLS_GOTIE - R_386_ext_offset]; + case BFD_RELOC_386_TLS_LE: TRACE ("BFD_RELOC_386_TLS_LE"); return &elf_howto_table[(unsigned int) R_386_TLS_LE - R_386_ext_offset]; @@ -564,9 +585,14 @@ struct elf_i386_link_hash_entry /* Track dynamic relocs copied for this symbol. */ struct elf_i386_dyn_relocs *dyn_relocs; - enum { - GOT_UNKNOWN = 0, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE - } tls_type; +#define GOT_UNKNOWN 0 +#define GOT_NORMAL 1 +#define GOT_TLS_GD 2 +#define GOT_TLS_IE 4 +#define GOT_TLS_IE_POS 5 +#define GOT_TLS_IE_NEG 6 +#define GOT_TLS_IE_BOTH 7 + unsigned char tls_type; }; #define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent)) @@ -836,6 +862,11 @@ elf_i386_tls_transition (info, r_type, is_local) if (is_local) return R_386_TLS_LE_32; return R_386_TLS_IE_32; + case R_386_TLS_IE: + case R_386_TLS_GOTIE: + if (is_local) + return R_386_TLS_LE_32; + return r_type; case R_386_TLS_LDM: return R_386_TLS_LE_32; } @@ -897,10 +928,34 @@ elf_i386_check_relocs (abfd, info, sec, relocs) switch (r_type) { + case R_386_TLS_LDM: + htab->tls_ldm_got.refcount += 1; + goto create_got; + + case R_386_PLT32: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; + break; + case R_386_TLS_IE_32: + case R_386_TLS_IE: + case R_386_TLS_GOTIE: if (info->shared) info->flags |= DF_STATIC_TLS; - /* FALLTHROUGH */ + /* Fall through */ + case R_386_GOT32: case R_386_TLS_GD: /* This symbol requires a global offset table entry. */ @@ -912,7 +967,17 @@ elf_i386_check_relocs (abfd, info, sec, relocs) default: case R_386_GOT32: tls_type = GOT_NORMAL; break; case R_386_TLS_GD: tls_type = GOT_TLS_GD; break; - case R_386_TLS_IE_32: tls_type = GOT_TLS_IE; break; + case R_386_TLS_IE_32: + if (ELF32_R_TYPE (rel->r_info) == r_type) + tls_type = GOT_TLS_IE_NEG; + else + /* If this is a GD->IE transition, we may use either of + R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */ + tls_type = GOT_TLS_IE; + break; + case R_386_TLS_IE: + case R_386_TLS_GOTIE: + tls_type = GOT_TLS_IE_POS; break; } if (h != NULL) @@ -944,18 +1009,22 @@ elf_i386_check_relocs (abfd, info, sec, relocs) old_tls_type = elf_i386_local_got_tls_type (abfd) [r_symndx]; } + if ((old_tls_type & GOT_TLS_IE) && (tls_type & GOT_TLS_IE)) + tls_type |= old_tls_type; /* If a TLS symbol is accessed using IE at least once, there is no point to use dynamic model for it. */ - if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN - && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE)) + else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN + && (old_tls_type != GOT_TLS_GD + || (tls_type & GOT_TLS_IE) == 0)) { - if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD) - tls_type = GOT_TLS_IE; + if ((old_tls_type & GOT_TLS_IE) && tls_type == GOT_TLS_GD) + tls_type = old_tls_type; else { (*_bfd_error_handler) (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), h->root.root.string); + bfd_archive_filename (abfd), + h ? h->root.root.string : "<local>"); return false; } } @@ -980,28 +1049,16 @@ elf_i386_check_relocs (abfd, info, sec, relocs) if (!create_got_section (htab->elf.dynobj, info)) return false; } - break; - - case R_386_TLS_LDM: - htab->tls_ldm_got.refcount += 1; - goto create_got; - - case R_386_PLT32: - /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code which is - never referenced by a dynamic object, in which case we - don't need to generate a procedure linkage table entry - after all. */ - - /* If this is a local symbol, we resolve it directly without - creating a procedure linkage table entry. */ - if (h == NULL) - continue; + if (r_type != R_386_TLS_IE) + break; + /* Fall through */ - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.refcount += 1; - break; + case R_386_TLS_LE_32: + case R_386_TLS_LE: + if (!info->shared) + break; + info->flags |= DF_STATIC_TLS; + /* Fall through */ case R_386_32: case R_386_PC32: @@ -1161,16 +1218,6 @@ elf_i386_check_relocs (abfd, info, sec, relocs) return false; break; - case R_386_TLS_LE_32: - case R_386_TLS_LE: - if (info->shared) - { - (*_bfd_error_handler) (_("%s: TLS local exec code cannot be linked into shared objects"), - bfd_archive_filename (abfd)); - return false; - } - break; - default: break; } @@ -1233,6 +1280,7 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs) bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; + int r_type; struct elf_link_hash_entry *h; elf_section_data (sec)->local_dynrel = NULL; @@ -1243,9 +1291,10 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs) relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) - switch (elf_i386_tls_transition (info, ELF32_R_TYPE (rel->r_info), - ELF32_R_SYM (rel->r_info) - >= symtab_hdr->sh_info)) + switch ((r_type = elf_i386_tls_transition (info, + ELF32_R_TYPE (rel->r_info), + ELF32_R_SYM (rel->r_info) + >= symtab_hdr->sh_info))) { case R_386_TLS_LDM: if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0) @@ -1254,6 +1303,8 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs) case R_386_TLS_GD: case R_386_TLS_IE_32: + case R_386_TLS_IE: + case R_386_TLS_GOTIE: case R_386_GOT32: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -1267,7 +1318,15 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs) if (local_got_refcounts[r_symndx] > 0) local_got_refcounts[r_symndx] -= 1; } - break; + if (r_type != R_386_TLS_IE) + break; + /* Fall through */ + + case R_386_TLS_LE_32: + case R_386_TLS_LE: + if (!info->shared) + break; + /* Fall through */ case R_386_32: case R_386_PC32: @@ -1553,12 +1612,12 @@ allocate_dynrelocs (h, inf) h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; } - /* If R_386_TLS_IE_32 symbol is now local to the binary, + /* If R_386_TLS_{IE_32,IE,GOTIE} symbol is now local to the binary, make it a R_386_TLS_LE_32 requiring no TLS entry. */ if (h->got.refcount > 0 && !info->shared && h->dynindx == -1 - && elf_i386_hash_entry(h)->tls_type == GOT_TLS_IE) + && (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE)) h->got.offset = (bfd_vma) -1; else if (h->got.refcount > 0) { @@ -1579,13 +1638,18 @@ allocate_dynrelocs (h, inf) h->got.offset = s->_raw_size; s->_raw_size += 4; /* R_386_TLS_GD needs 2 consecutive GOT slots. */ - if (tls_type == GOT_TLS_GD) + if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE_BOTH) s->_raw_size += 4; dyn = htab->elf.dynamic_sections_created; /* R_386_TLS_IE_32 needs one dynamic relocation, - R_386_TLS_GD needs one if local symbol and two if global. */ - if ((tls_type == GOT_TLS_GD && h->dynindx == -1) - || tls_type == GOT_TLS_IE) + R_386_TLS_IE resp. R_386_TLS_GOTIE needs one dynamic relocation, + (but if both R_386_TLS_IE_32 and R_386_TLS_IE is present, we + need two), R_386_TLS_GD needs one if local symbol and two if + global. */ + if (tls_type == GOT_TLS_IE_BOTH) + htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel); + else if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + || (tls_type & GOT_TLS_IE)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); else if (tls_type == GOT_TLS_GD) htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel); @@ -1786,12 +1850,18 @@ elf_i386_size_dynamic_sections (output_bfd, info) { *local_got = s->_raw_size; s->_raw_size += 4; - if (*local_tls_type == GOT_TLS_GD) + if (*local_tls_type == GOT_TLS_GD + || *local_tls_type == GOT_TLS_IE_BOTH) s->_raw_size += 4; if (info->shared || *local_tls_type == GOT_TLS_GD - || *local_tls_type == GOT_TLS_IE) - srel->_raw_size += sizeof (Elf32_External_Rel); + || (*local_tls_type & GOT_TLS_IE)) + { + if (*local_tls_type == GOT_TLS_IE_BOTH) + srel->_raw_size += 2 * sizeof (Elf32_External_Rel); + else + srel->_raw_size += sizeof (Elf32_External_Rel); + } } else *local_got = (bfd_vma) -1; @@ -1962,7 +2032,9 @@ static bfd_vma dtpoff_base (info) struct bfd_link_info *info; { - BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL); + /* If tls_segment is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_segment == NULL) + return 0; return elf_hash_table (info)->tls_segment->start; } @@ -1977,7 +2049,9 @@ tpoff (info, address) struct elf_link_tls_segment *tls_segment = elf_hash_table (info)->tls_segment; - BFD_ASSERT (tls_segment != NULL); + /* If tls_segment is NULL, we should have signalled an error already. */ + if (tls_segment == NULL) + return 0; return (align_power (tls_segment->size, tls_segment->align) + tls_segment->start - address); } @@ -2418,8 +2492,29 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, } break; + case R_386_TLS_IE: + if (info->shared) + { + Elf_Internal_Rel outrel; + asection *sreloc; + Elf32_External_Rel *loc; + + outrel.r_offset = rel->r_offset + + input_section->output_section->vma + + input_section->output_offset; + outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE); + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + loc = (Elf32_External_Rel *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + } + /* Fall through */ + case R_386_TLS_GD: case R_386_TLS_IE_32: + case R_386_TLS_GOTIE: r_type = elf_i386_tls_transition (info, r_type, h == NULL); tls_type = GOT_UNKNOWN; if (h == NULL && local_got_offsets) @@ -2427,11 +2522,18 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, else if (h != NULL) { tls_type = elf_i386_hash_entry(h)->tls_type; - if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE) + if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE)) r_type = R_386_TLS_LE_32; } - if (r_type == R_386_TLS_GD && tls_type == GOT_TLS_IE) - r_type = R_386_TLS_IE_32; + if (tls_type == GOT_TLS_IE) + tls_type = GOT_TLS_IE_NEG; + if (r_type == R_386_TLS_GD) + { + if (tls_type == GOT_TLS_IE_POS) + r_type = R_386_TLS_GOTIE; + else if (tls_type & GOT_TLS_IE) + r_type = R_386_TLS_IE_32; + } if (r_type == R_386_TLS_LE_32) { @@ -2499,27 +2601,77 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, rel++; continue; } - else + else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_IE) { unsigned int val, type; /* IE->LE transition: - Originally it can be either: + Originally it can be one of: + movl foo, %eax + movl foo, %reg + addl foo, %reg + We change it into: + movl $foo, %eax + movl $foo, %reg + addl $foo, %reg. */ + BFD_ASSERT (rel->r_offset >= 1); + val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); + BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + if (val != 0xa1) + { + BFD_ASSERT (rel->r_offset >= 2); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + } + if (val == 0xa1) + { + /* movl foo, %eax. */ + bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 2); + } + else if (type == 0x8b) + { + /* movl */ + BFD_ASSERT ((val & 0xc7) == 0x05); + bfd_put_8 (output_bfd, 0xc7, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + } + else if (type == 0x03) + { + /* addl */ + BFD_ASSERT ((val & 0xc7) == 0x05); + bfd_put_8 (output_bfd, 0x81, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + } + else + BFD_FAIL (); + bfd_put_32 (output_bfd, -tpoff (info, relocation), + contents + rel->r_offset); + continue; + } + else + { + unsigned int val, type; + + /* {IE_32,GOTIE}->LE transition: + Originally it can be one of: subl foo(%reg1), %reg2 - or movl foo(%reg1), %reg2 + addl foo(%reg1), %reg2 We change it into: subl $foo, %reg2 - or - movl $foo, %reg2 (6 byte form) */ + movl $foo, %reg2 (6 byte form) + addl $foo, %reg2. */ BFD_ASSERT (rel->r_offset >= 2); type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4); if (type == 0x8b) { /* movl */ - BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4); bfd_put_8 (output_bfd, 0xc7, contents + rel->r_offset - 2); bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), @@ -2528,16 +2680,27 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, else if (type == 0x2b) { /* subl */ - BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4); bfd_put_8 (output_bfd, 0x81, contents + rel->r_offset - 2); bfd_put_8 (output_bfd, 0xe8 | ((val >> 3) & 7), contents + rel->r_offset - 1); } + else if (type == 0x03) + { + /* addl */ + bfd_put_8 (output_bfd, 0x81, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + } else BFD_FAIL (); - bfd_put_32 (output_bfd, tpoff (info, relocation), - contents + rel->r_offset); + if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTIE) + bfd_put_32 (output_bfd, -tpoff (info, relocation), + contents + rel->r_offset); + else + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + rel->r_offset); continue; } } @@ -2572,11 +2735,16 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, indx = h && h->dynindx != -1 ? h->dynindx : 0; if (r_type == R_386_TLS_GD) dr_type = R_386_TLS_DTPMOD32; + else if (tls_type == GOT_TLS_IE_POS) + dr_type = R_386_TLS_TPOFF; else dr_type = R_386_TLS_TPOFF32; - if (dr_type == R_386_TLS_TPOFF32 && indx == 0) + if (dr_type == R_386_TLS_TPOFF && indx == 0) bfd_put_32 (output_bfd, relocation - dtpoff_base (info), htab->sgot->contents + off); + else if (dr_type == R_386_TLS_TPOFF32 && indx == 0) + bfd_put_32 (output_bfd, dtpoff_base (info) - relocation, + htab->sgot->contents + off); else bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); @@ -2607,6 +2775,17 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, loc); } } + else if (tls_type == GOT_TLS_IE_BOTH) + { + bfd_put_32 (output_bfd, + indx == 0 ? relocation - dtpoff_base (info) : 0, + htab->sgot->contents + off + 4); + outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF); + outrel.r_offset += 4; + htab->srelgot->reloc_count++; + loc++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + } if (h != NULL) h->got.offset |= 1; @@ -2619,6 +2798,11 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type == ELF32_R_TYPE (rel->r_info)) { relocation = htab->sgot->output_offset + off; + if ((r_type == R_386_TLS_IE || r_type == R_386_TLS_GOTIE) + && tls_type == GOT_TLS_IE_BOTH) + relocation += 4; + if (r_type == R_386_TLS_IE) + relocation += htab->sgot->output_section->vma; unresolved_reloc = false; } else @@ -2664,6 +2848,17 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, memcpy (contents + roff, "\x65\xa1\0\0\0\0\x2b\x80\0\0\0", 12); contents[roff + 7] = 0x80 | (val & 7); + /* If foo is used only with foo@gotntpoff(%reg) and + foo@indntpoff, but not with foo@gottpoff(%reg), change + subl $foo@gottpoff(%reg), %eax + into: + addl $foo@gotntpoff(%reg), %eax. */ + if (r_type == R_386_TLS_GOTIE) + { + contents[roff + 6] = 0x03; + if (tls_type == GOT_TLS_IE_BOTH) + off += 4; + } bfd_put_32 (output_bfd, htab->sgot->output_offset + off, contents + roff + 8); /* Skip R_386_PLT32. */ @@ -2739,11 +2934,42 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, break; case R_386_TLS_LE_32: - relocation = tpoff (info, relocation); - break; - case R_386_TLS_LE: - relocation = -tpoff (info, relocation); + if (info->shared) + { + Elf_Internal_Rel outrel; + asection *sreloc; + Elf32_External_Rel *loc; + int indx; + + outrel.r_offset = rel->r_offset + + input_section->output_section->vma + + input_section->output_offset; + if (h != NULL && h->dynindx != -1) + indx = h->dynindx; + else + indx = 0; + if (r_type == R_386_TLS_LE_32) + outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF32); + else + outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF); + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + loc = (Elf32_External_Rel *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + if (indx) + continue; + else if (r_type == R_386_TLS_LE_32) + relocation = dtpoff_base (info) - relocation; + else + relocation -= dtpoff_base (info); + } + else if (r_type == R_386_TLS_LE_32) + relocation = tpoff (info, relocation); + else + relocation = -tpoff (info, relocation); break; default: @@ -2756,12 +2982,15 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) - (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, - h->root.root.string); + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); + return false; + } r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, rel->r_offset, @@ -2900,7 +3129,7 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym) if (h->got.offset != (bfd_vma) -1 && elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD - && elf_i386_hash_entry(h)->tls_type != GOT_TLS_IE) + && (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0) { Elf_Internal_Rel rel; Elf32_External_Rel *loc; @@ -3115,11 +3344,13 @@ elf_i386_finish_dynamic_sections (output_bfd, info) return true; } +#ifndef ELF_ARCH #define TARGET_LITTLE_SYM bfd_elf32_i386_vec #define TARGET_LITTLE_NAME "elf32-i386" #define ELF_ARCH bfd_arch_i386 #define ELF_MACHINE_CODE EM_386 #define ELF_MAXPAGESIZE 0x1000 +#endif /* ELF_ARCH */ #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index d5ed0c4c69b..6faffd203c0 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2743,11 +2743,11 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym) else { BFD_ASSERT ((h->got.offset & 1) == 0); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT); rela.r_addend = 0; } + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); bfd_elf32_swap_reloca_out (output_bfd, &rela, ((Elf32_External_Rela *) srela->contents + srela->reloc_count)); @@ -3287,13 +3287,19 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, + sreloc->reloc_count)); ++sreloc->reloc_count; - /* This reloc will be computed at runtime, so there's no - need to do anything now, unless this is a RELATIVE - reloc in an unallocated section. */ - if (skip != -1 - || (input_section->flags & SEC_ALLOC) != 0 - || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE) + if (skip == -1) continue; + + /* This reloc will be computed at runtime. We clear the memory + so that it contains predictable value. */ + if (! skip + && ((input_section->flags & SEC_ALLOC) != 0 + || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE)) + { + relocation = howto->pc_relative ? outrel.r_offset : 0; + addend = 0; + break; + } } /* Arithmetic adjust relocations that aren't going into a @@ -3390,7 +3396,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, sgot->contents + off); if (info->shared) { @@ -3412,8 +3417,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, srelgot->contents) + srelgot->reloc_count)); ++srelgot->reloc_count; + relocation = 0; } + bfd_put_32 (output_bfd, relocation, sgot->contents + off); local_got_offsets[r_symndx] |= 1; } @@ -3476,8 +3483,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sec != (asection *) 0); name = bfd_get_section_name (abfd, sec->output_section); - if (strcmp (name, ".sdata") != 0 - && strcmp (name, ".sbss") != 0) + if (! ((strncmp (name, ".sdata", 6) == 0 + && (name[6] == 0 || name[6] == '.')) + || (strncmp (name, ".sbss", 5) == 0 + && (name[5] == 0 || name[5] == '.')))) { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), @@ -3498,7 +3507,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sec != (asection *) 0); name = bfd_get_section_name (abfd, sec->output_section); - if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0) + if (! (strncmp (name, ".sdata2", 7) == 0 + || strncmp (name, ".sbss2", 6) == 0)) { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), @@ -3525,7 +3535,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sec != (asection *) 0); name = bfd_get_section_name (abfd, sec->output_section); - if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0) + if (((strncmp (name, ".sdata", 6) == 0 + && (name[6] == 0 || name[6] == '.')) + || (strncmp (name, ".sbss", 5) == 0 + && (name[5] == 0 || name[5] == '.')))) { reg = 13; addend -= (sdata->sym_hash->root.u.def.value @@ -3533,8 +3546,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, + sdata->sym_hash->root.u.def.section->output_offset); } - else if (strcmp (name, ".sdata2") == 0 - || strcmp (name, ".sbss2") == 0) + else if (strncmp (name, ".sdata2", 7) == 0 + || strncmp (name, ".sbss2", 6) == 0) { reg = 2; addend -= (sdata2->sym_hash->root.u.def.value diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 4c9b3d45aaa..be2733d36bb 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1281,7 +1281,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, sgot->contents + off); if (info->shared) { @@ -1297,7 +1296,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, + sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = 0; + outrel.r_addend = relocation; + relocation = 0; bfd_elf32_swap_reloca_out (output_bfd, &outrel, (((Elf32_External_Rela *) srelgot->contents) @@ -1305,6 +1305,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, ++srelgot->reloc_count; } + bfd_put_32 (output_bfd, relocation, sgot->contents + off); local_got_offsets[r_symndx] |= 1; } } @@ -1810,14 +1811,21 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym) if (info->shared && (info->symbolic || h->dynindx == -1) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); + { + asection *sec = h->root.u.def.section; + rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); + rela.r_addend = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); + rela.r_addend = 0; } - rela.r_addend = 0; + bfd_put_32 (output_bfd, (bfd_vma) 0, + sgot->contents + (h->got.offset &~ (bfd_vma) 1)); bfd_elf32_swap_reloca_out (output_bfd, &rela, ((Elf32_External_Rela *) srela->contents + srela->reloc_count)); diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 193a0bf4930..57ed958b32f 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1331,10 +1331,6 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err) reloc->address += isection->output_offset; return bfd_reloc_ok; } -#if 0 - else if (obfd != NULL) - return bfd_reloc_continue; -#endif /* Catch relocs involving undefined symbols. */ if (bfd_is_und_section (symbol->section) @@ -1422,6 +1418,11 @@ v850_elf_is_local_label_name (abfd, name) || (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')); } +/* We overload some of the bfd_reloc error codes for own purposes. */ +#define bfd_reloc_gp_not_found bfd_reloc_other +#define bfd_reloc_ep_not_found bfd_reloc_continue +#define bfd_reloc_ctbp_not_found (bfd_reloc_dangerous + 1) + /* Perform a relocation as part of a final link. */ static bfd_reloc_status_type @@ -1496,7 +1497,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd, h = bfd_link_hash_lookup (info->hash, "__gp", false, false, true); if (h == (struct bfd_link_hash_entry *) NULL || h->type != bfd_link_hash_defined) - return bfd_reloc_other; + return bfd_reloc_gp_not_found; gp = (h->u.def.value + h->u.def.section->output_section->vma @@ -1521,8 +1522,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd, h = bfd_link_hash_lookup (info->hash, "__ep", false, false, true); if (h == (struct bfd_link_hash_entry *) NULL || h->type != bfd_link_hash_defined) - /* Actually this indicates that __ep could not be found. */ - return bfd_reloc_continue; + return bfd_reloc_ep_not_found; ep = (h->u.def.value + h->u.def.section->output_section->vma @@ -1541,8 +1541,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd, h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true); if (h == (struct bfd_link_hash_entry *) NULL || h->type != bfd_link_hash_defined) - /* Actually this indicates that __ctbp could not be found. */ - return bfd_reloc_dangerous + 1; + return bfd_reloc_ctbp_not_found; ctbp = (h->u.def.value + h->u.def.section->output_section->vma @@ -1563,7 +1562,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd, h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true); if (h == (struct bfd_link_hash_entry *) NULL || h->type != bfd_link_hash_defined) - return (bfd_reloc_dangerous + 1); + return bfd_reloc_ctbp_not_found; ctbp = (h->u.def.value + h->u.def.section->output_section->vma @@ -1762,15 +1761,15 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section, msg = _("internal error: dangerous relocation"); goto common_error; - case bfd_reloc_other: + case bfd_reloc_gp_not_found: msg = _("could not locate special linker symbol __gp"); goto common_error; - case bfd_reloc_continue: + case bfd_reloc_ep_not_found: msg = _("could not locate special linker symbol __ep"); goto common_error; - case (bfd_reloc_dangerous + 1): + case bfd_reloc_ctbp_not_found: msg = _("could not locate special linker symbol __ctbp"); goto common_error; @@ -1848,8 +1847,12 @@ v850_elf_object_p (abfd) switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH) { default: - case E_V850_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, 0); break; - case E_V850E_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e); break; + case E_V850_ARCH: + bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850); + break; + case E_V850E_ARCH: + bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e); + break; } return true; } @@ -1865,9 +1868,9 @@ v850_elf_final_write_processing (abfd, linker) switch (bfd_get_mach (abfd)) { - default: - case 0: val = E_V850_ARCH; break; - case bfd_mach_v850e: val = E_V850E_ARCH; break; + default: + case bfd_mach_v850: val = E_V850_ARCH; break; + case bfd_mach_v850e: val = E_V850E_ARCH; break; } elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH; @@ -2481,20 +2484,16 @@ v850_elf_relax_section (abfd, sec, link_info, again) { Elf_Internal_Shdr * symtab_hdr; Elf_Internal_Rela * internal_relocs; - Elf_Internal_Rela * free_relocs = NULL; Elf_Internal_Rela * irel; Elf_Internal_Rela * irelend; Elf_Internal_Rela * irelalign = NULL; + Elf_Internal_Sym * isymbuf = NULL; bfd_byte * contents = NULL; - bfd_byte * free_contents = NULL; - Elf32_External_Sym * extsyms = NULL; - Elf32_External_Sym * free_extsyms = NULL; bfd_vma addr = 0; bfd_vma toaddr; int align_pad_size = 0; - Elf_Internal_Shdr * shndx_hdr = NULL; - Elf_External_Sym_Shndx * shndx_buf = NULL; - + boolean result = true; + * again = false; if (link_info->relocateable @@ -2514,8 +2513,6 @@ v850_elf_relax_section (abfd, sec, link_info, again) link_info->keep_memory)); if (internal_relocs == NULL) goto error_return; - if (! link_info->keep_memory) - free_relocs = internal_relocs; irelend = internal_relocs + sec->reloc_count; @@ -2599,49 +2596,22 @@ v850_elf_relax_section (abfd, sec, link_info, again) if (contents == NULL) goto error_return; - free_contents = contents; - if (! bfd_get_section_contents (abfd, sec, contents, (file_ptr) 0, sec->_raw_size)) goto error_return; } } - /* Read this BFD's symbols if we haven't done so already. */ - if (extsyms == NULL) + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) { - /* Get cached copy if it exists. */ - if (symtab_hdr->contents != NULL) - extsyms = (Elf32_External_Sym *) symtab_hdr->contents; - else - { - /* Go get them off disk. */ - bfd_size_type amt; - - amt = symtab_hdr->sh_info; - amt *= sizeof (Elf32_External_Sym); - extsyms = (Elf32_External_Sym *) bfd_malloc (amt); - if (extsyms == NULL) - goto error_return; - free_extsyms = extsyms; - if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) extsyms, amt, abfd) != amt) - goto error_return; - } - - if (shndx_hdr->sh_size != 0) - { - bfd_size_type amt; - - amt = symtab_hdr->sh_info; - amt *= sizeof (Elf_External_Sym_Shndx); - shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); - if (shndx_buf == NULL) - goto error_return; - if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt) - goto error_return; - } + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; } laddr = irel->r_offset; @@ -2733,27 +2703,12 @@ v850_elf_relax_section (abfd, sec, link_info, again) if (ELF32_R_SYM (irelcall->r_info) < symtab_hdr->sh_info) { - unsigned int r_index; - Elf_Internal_Sym isym; - asection * sym_sec; - Elf32_External_Sym * esym; - Elf_External_Sym_Shndx * shndx; + Elf_Internal_Sym * isym; /* A local symbol. */ - r_index = ELF32_R_SYM (irelcall->r_info); - esym = extsyms + r_index; - shndx = shndx_buf + (shndx_buf ? r_index : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym); + isym = isymbuf + ELF32_R_SYM (irelcall->r_info); - if (isym.st_shndx == SHN_UNDEF) - sym_sec = bfd_und_section_ptr; - else if (isym.st_shndx == SHN_ABS) - sym_sec = bfd_abs_section_ptr; - else if (isym.st_shndx == SHN_COMMON) - sym_sec = bfd_com_section_ptr; - else - sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); - symval = isym.st_value; + symval = isym->st_value; } else { @@ -2787,27 +2742,21 @@ v850_elf_relax_section (abfd, sec, link_info, again) /* Get the value of the symbol referred to by the reloc. */ if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) { - unsigned int r_index; - Elf_Internal_Sym isym; - asection * sym_sec; - Elf32_External_Sym * esym; - Elf_External_Sym_Shndx * shndx; + Elf_Internal_Sym * isym; + asection * sym_sec; /* A local symbol. */ - r_index = ELF32_R_SYM (irel->r_info); - esym = extsyms + r_index; - shndx = shndx_buf + (shndx_buf ? r_index : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym); + isym = isymbuf + ELF32_R_SYM (hi_irelfn->r_info); - if (isym.st_shndx == SHN_UNDEF) + if (isym->st_shndx == SHN_UNDEF) sym_sec = bfd_und_section_ptr; - else if (isym.st_shndx == SHN_ABS) + else if (isym->st_shndx == SHN_ABS) sym_sec = bfd_abs_section_ptr; - else if (isym.st_shndx == SHN_COMMON) + else if (isym->st_shndx == SHN_COMMON) sym_sec = bfd_com_section_ptr; else - sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); - symval = (isym.st_value + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + sym_sec->output_section->vma + sym_sec->output_offset); } @@ -2817,7 +2766,7 @@ v850_elf_relax_section (abfd, sec, link_info, again) struct elf_link_hash_entry * h; /* An external symbol. */ - indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + indx = ELF32_R_SYM (hi_irelfn->r_info) - symtab_hdr->sh_info; h = elf_sym_hashes (abfd)[indx]; BFD_ASSERT (h != NULL); @@ -2861,13 +2810,8 @@ v850_elf_relax_section (abfd, sec, link_info, again) that would be more work, but would require less memory when the linker is run. */ elf_section_data (sec)->relocs = internal_relocs; - free_relocs = NULL; - elf_section_data (sec)->this_hdr.contents = contents; - free_contents = NULL; - - symtab_hdr->contents = (bfd_byte *) extsyms; - free_extsyms = NULL; + symtab_hdr->contents = (bfd_byte *) isymbuf; /* Replace the long call with a jarl. */ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_22_PCREL); @@ -2968,38 +2912,33 @@ v850_elf_relax_section (abfd, sec, link_info, again) /* Get the value of the symbol referred to by the reloc. */ if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) { - unsigned int r_index; - Elf_Internal_Sym isym; - asection * sym_sec; - Elf32_External_Sym * esym; - Elf_External_Sym_Shndx * shndx; + Elf_Internal_Sym * isym; + asection * sym_sec; /* A local symbol. */ - r_index = ELF32_R_SYM (irel->r_info); - esym = extsyms + r_index; - shndx = shndx_buf + (shndx_buf ? r_index : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym); - - if (isym.st_shndx == SHN_UNDEF) + isym = isymbuf + ELF32_R_SYM (hi_irelfn->r_info); + + if (isym->st_shndx == SHN_UNDEF) sym_sec = bfd_und_section_ptr; - else if (isym.st_shndx == SHN_ABS) + else if (isym->st_shndx == SHN_ABS) sym_sec = bfd_abs_section_ptr; - else if (isym.st_shndx == SHN_COMMON) + else if (isym->st_shndx == SHN_COMMON) sym_sec = bfd_com_section_ptr; else - sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); - symval = (isym.st_value + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + sym_sec->output_section->vma + sym_sec->output_offset); #ifdef DEBUG_RELAX { char * name = bfd_elf_string_from_elf_section - (abfd, symtab_hdr->sh_link, isym.st_name); + (abfd, symtab_hdr->sh_link, isym->st_name); fprintf (stderr, "relax long jump local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", - sym_sec->name, name, isym.st_name, - sym_sec->output_section->vma, sym_sec->output_offset, - isym.st_value, irel->r_addend); + sym_sec->name, name, isym->st_name, + sym_sec->output_section->vma, + sym_sec->output_offset, + isym->st_value, irel->r_addend); } #endif } @@ -3058,13 +2997,8 @@ v850_elf_relax_section (abfd, sec, link_info, again) that would be more work, but would require less memory when the linker is run. */ elf_section_data (sec)->relocs = internal_relocs; - free_relocs = NULL; - elf_section_data (sec)->this_hdr.contents = contents; - free_contents = NULL; - - symtab_hdr->contents = (bfd_byte *) extsyms; - free_extsyms = NULL; + symtab_hdr->contents = (bfd_byte *) isymbuf; if (foff < -0x100 || foff >= 0x100) { @@ -3162,19 +3096,24 @@ v850_elf_relax_section (abfd, sec, link_info, again) sec->_cooked_size -= align_pad_size; } - return true; + finish: + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); - error_return: - if (free_relocs != NULL) - free (free_relocs); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != (unsigned char *) contents) + free (contents); - if (free_contents != NULL) - free (free_contents); + if (isymbuf != NULL + && symtab_hdr->contents != (bfd_byte *) isymbuf) + free (isymbuf); - if (free_extsyms != NULL) - free (free_extsyms); + return result; - return false; + error_return: + result = false; + goto finish; } #define TARGET_LITTLE_SYM bfd_elf32_v850_vec diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 068578bb245..0d42b728f40 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -417,6 +417,11 @@ struct elf_vax_link_hash_table static boolean elf_vax_discard_copies PARAMS ((struct elf_vax_link_hash_entry *, PTR)); +/* Declare this now that the above structures are defined. */ + +static boolean elf_vax_instantiate_got_entries + PARAMS ((struct elf_link_hash_entry *, PTR)); + /* Traverse an VAX ELF linker hash table. */ #define elf_vax_link_hash_traverse(table, func, info) \ @@ -567,7 +572,6 @@ elf_vax_check_relocs (abfd, info, sec, 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; @@ -580,7 +584,6 @@ elf_vax_check_relocs (abfd, info, sec, relocs) 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; @@ -651,18 +654,6 @@ elf_vax_check_relocs (abfd, info, sec, relocs) { h->got.refcount = 1; eh->got_addend = rel->r_addend; - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (!bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - /* Allocate space in the .got section. */ - sgot->_raw_size += 4; - /* Allocate relocation space. */ - srelgot->_raw_size += sizeof (Elf32_External_Rela); } else { @@ -900,25 +891,18 @@ elf_vax_gc_sweep_hook (abfd, info, sec, 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; unsigned long r_symndx; struct elf_link_hash_entry *h; bfd *dynobj; - asection *sgot; - asection *srelgot; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); dynobj = elf_hash_table (info)->dynobj; if (dynobj == NULL) return true; - 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++) { @@ -930,29 +914,7 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs) { 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->_raw_size -= 4; - srelgot->_raw_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->_raw_size -= 4; - if (info->shared) - srelgot->_raw_size -= sizeof (Elf32_External_Rela); - } - } + --h->got.refcount; } break; @@ -1219,8 +1181,15 @@ elf_vax_size_dynamic_sections (output_bfd, info) fill them in in the relocate_section routine. */ if (info->shared && info->symbolic) elf_vax_link_hash_traverse (elf_vax_hash_table (info), - elf_vax_discard_copies, - (PTR) NULL); + elf_vax_discard_copies, + (PTR) NULL); + + /* If this is a -Bsymbolic shared link or a static link, we need to + discard all the got entries we've recorded. Otherwise, we need to + instantiate (allocate space for them). */ + elf_link_hash_traverse (elf_hash_table (info), + elf_vax_instantiate_got_entries, + (PTR) info); /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate @@ -1390,6 +1359,60 @@ elf_vax_discard_copies (h, ignore) return true; } +/* This function is called via elf_link_hash_traverse. It looks for entries + that have GOT or PLT (.GOT) references. If creating a static object or a + shared object with -Bsymbolic, it resets the reference count back to 0 + and sets the offset to -1 so normal PC32 relocation will be done. If + creating a shared object or executable, space in the .got and .rela.got + will be reserved for the symbol. */ + +/*ARGSUSED*/ +static boolean +elf_vax_instantiate_got_entries (h, infoptr) + struct elf_link_hash_entry *h; + PTR infoptr; +{ + struct bfd_link_info *info = (struct bfd_link_info *) infoptr; + bfd *dynobj; + asection *sgot; + asection *srelgot; + + /* We don't care about non-GOT (and non-PLT) entries. */ + if (h->got.refcount <= 0 && h->plt.refcount <= 0) + return true; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return true; + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + + if (!elf_hash_table (info)->dynamic_sections_created + || (info->shared && info->symbolic)) + { + h->got.refcount = 0; + h->got.offset = (bfd_vma) -1; + h->plt.refcount = 0; + h->plt.offset = (bfd_vma) -1; + } + else if (h->got.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (!bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } + + /* Allocate space in the .got and .rela.got sections. */ + sgot->_raw_size += 4; + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + + return true; +} + /* Relocate an VAX ELF section. */ static boolean @@ -1537,8 +1560,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, case R_VAX_GOT32: /* 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) + if (h == NULL || h->got.offset == (bfd_vma) -1) break; /* Relocation is the offset of the entry for this symbol in @@ -1547,18 +1569,6 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, { bfd_vma off; - if (!elf_hash_table (info)->dynamic_sections_created - || (h == NULL) - || (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a -Bsymbolic link - and the symbol is defined locally or there is no symbol. - Change the GOT32 entry to a PC32 entry. */ - break; - } - if (sgot == NULL) { sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -1568,6 +1578,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (h != NULL); off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); + BFD_ASSERT (off < sgot->_raw_size); if (info->shared && h->dynindx == -1 @@ -1596,15 +1607,12 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, } relocation = sgot->output_offset + off; - /* Neither GOT relocation uses the addend. */ + /* The GOT relocation uses the addend. */ rel->r_addend = 0; - if (r_type == R_VAX_GOT32) - { - /* Change the reference to be indirect */ - contents[rel->r_offset - 1] |= 0x10; - relocation += sgot->output_section->vma; - } + /* Change the reference to be indirect. */ + contents[rel->r_offset - 1] |= 0x10; + relocation += sgot->output_section->vma; } break; @@ -1828,11 +1836,11 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, break; } - /* VAX PCREL relocations are from the end of relocation, not the start */ + /* VAX PCREL relocations are from the end of relocation, not the start. + So subtract the difference from the relocation amount since we can't + add it to the offset. */ if (howto->pc_relative && howto->pcrel_offset) - { - relocation -= bfd_get_reloc_size(howto); - } + relocation -= bfd_get_reloc_size(howto); r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, rel->r_offset, diff --git a/bfd/elf64-alpha-fbsd.c b/bfd/elf64-alpha-fbsd.c new file mode 100644 index 00000000000..061b0b81030 --- /dev/null +++ b/bfd/elf64-alpha-fbsd.c @@ -0,0 +1,56 @@ +/* Alpha specific support for 64-bit ELF on FreeBSD. + Copyright 2002 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 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec +#define TARGET_LITTLE_NAME "elf64-alpha-freebsd" +#define ELF_ARCH bfd_arch_alpha +#define ELF_MACHINE_CODE EM_ALPHA +#define ELF_MAXPAGESIZE 0x10000 + +#include "bfd.h" +#include "sysdep.h" +#include "elf-bfd.h" + +/* The kernel recognizes executables as valid only if they carry a + "FreeBSD" label in the ELF header. So we put this label on all + executables and (for simplicity) also all other object files. */ + +static void elf_alpha_post_process_headers + PARAMS ((bfd *, struct bfd_link_info *)); + +static void +elf_alpha_post_process_headers (abfd, link_info) + bfd * abfd; + struct bfd_link_info * link_info ATTRIBUTE_UNUSED; +{ + Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ + + i_ehdrp = elf_elfheader (abfd); + + /* Put an ABI label supported by FreeBSD >= 4.1. */ + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; +#ifdef OLD_FREEBSD_ABI_LABEL + /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ + memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); +#endif +} + +#define elf_backend_post_process_headers elf_alpha_post_process_headers + +#include "elf64-alpha.c" diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 4aeb32d6d39..e1d095d5231 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3403,7 +3403,7 @@ elf64_alpha_merge_ind_symbols (hi, dummy) { rin = ri->next; for (rs = rsh; rs ; rs = rs->next) - if (ri->rtype == rs->rtype) + if (ri->rtype == rs->rtype && ri->srel == rs->srel) { rs->count += ri->count; goto found_reloc; @@ -5480,7 +5480,7 @@ elf64_alpha_ecoff_debug_swap = /* Use a non-standard hash bucket size of 8. */ -const struct elf_size_info alpha_elf_size_info = +static const struct elf_size_info alpha_elf_size_info = { sizeof (Elf64_External_Ehdr), sizeof (Elf64_External_Phdr), @@ -5509,11 +5509,13 @@ const struct elf_size_info alpha_elf_size_info = NULL }; +#ifndef ELF_ARCH #define TARGET_LITTLE_SYM bfd_elf64_alpha_vec #define TARGET_LITTLE_NAME "elf64-alpha" #define ELF_ARCH bfd_arch_alpha #define ELF_MACHINE_CODE EM_ALPHA #define ELF_MAXPAGESIZE 0x10000 +#endif /* ELF_ARCH */ #define bfd_elf64_bfd_link_hash_table_create \ elf64_alpha_bfd_link_hash_table_create diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 00c312c8d8c..bf98c9136c8 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1337,13 +1337,15 @@ mips_elf64_be_swap_reloc_out (abfd, src, dst) mirel.r_offset = src[0].r_offset; BFD_ASSERT(src[0].r_offset == src[1].r_offset); +#if 0 BFD_ASSERT(src[0].r_offset == src[2].r_offset); +#endif mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info); mirel.r_sym = ELF64_R_SYM (src[0].r_info); - mirel.r_type2 = ELF64_MIPS_R_TYPE2 (src[1].r_info); + mirel.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info); mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info); - mirel.r_type3 = ELF64_MIPS_R_TYPE3 (src[2].r_info); + mirel.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info); mips_elf64_swap_reloc_out (abfd, &mirel, (Elf64_Mips_External_Rel *) dst); @@ -1369,9 +1371,9 @@ mips_elf64_be_swap_reloca_out (abfd, src, dst) BFD_ASSERT(src[1].r_addend == 0); BFD_ASSERT(src[2].r_addend == 0); - mirela.r_type2 = ELF64_MIPS_R_TYPE2 (src[1].r_info); + mirela.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info); mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info); - mirela.r_type3 = ELF64_MIPS_R_TYPE3 (src[2].r_info); + mirela.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info); mips_elf64_swap_reloca_out (abfd, &mirela, (Elf64_Mips_External_Rela *) dst); @@ -1525,7 +1527,7 @@ mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, pgp) if (relocateable) { /* Make up a value. */ - *pgp = symbol->section->output_section->vma + 0x4000; + *pgp = symbol->section->output_section->vma /*+ 0x4000*/; _bfd_set_gp_value (output_bfd, *pgp); } else if (!mips_elf64_assign_gp (output_bfd, pgp)) @@ -2689,8 +2691,6 @@ const struct elf_size_info mips_elf64_size_info = #define elf_backend_may_use_rela_p 1 #define elf_backend_default_use_rela_p 1 -#define elf_backend_ignore_discarded_relocs \ - _bfd_mips_elf_ignore_discarded_relocs #define elf_backend_write_section _bfd_mips_elf_write_section /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index d9f86260b49..91610aae7e8 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4464,27 +4464,6 @@ ppc_build_one_stub (gen_entry, in_arg) break; case ppc_stub_plt_call: - /* Build the .glink lazy link call stub. */ - p = htab->sglink->contents + htab->sglink->_cooked_size; - indx = htab->sglink->reloc_count; - if (indx < 0x8000) - { - bfd_put_32 (htab->sglink->owner, LI_R0_0 | indx, p); - p += 4; - } - else - { - bfd_put_32 (htab->sglink->owner, LIS_R0_0 | PPC_HI (indx), p); - p += 4; - bfd_put_32 (htab->sglink->owner, ORI_R0_R0_0 | PPC_LO (indx), p); - p += 4; - } - bfd_put_32 (htab->sglink->owner, - B_DOT | ((htab->sglink->contents - p) & 0x3fffffc), p); - p += 4; - htab->sglink->_cooked_size = p - htab->sglink->contents; - htab->sglink->reloc_count += 1; - /* Do the best we can for shared libraries built without exporting ".foo" for each "foo". This can happen when symbol versioning scripts strip all bar a subset of symbols. */ @@ -5149,6 +5128,8 @@ ppc64_elf_build_stubs (info) if (htab->splt != NULL) { + unsigned int indx; + /* Build the .glink plt call stub. */ plt_r2 = (htab->splt->output_offset + htab->splt->output_section->vma @@ -5156,15 +5137,33 @@ ppc64_elf_build_stubs (info) - TOC_BASE_OFF); p = htab->sglink->contents; p = build_plt_stub (htab->sglink->owner, p, (int) plt_r2, 1); - while (p - htab->sglink->contents < GLINK_CALL_STUB_SIZE) + while (p < htab->sglink->contents + GLINK_CALL_STUB_SIZE) { bfd_put_32 (htab->sglink->owner, NOP, p); p += 4; } - htab->sglink->_cooked_size = p - htab->sglink->contents; - /* Use reloc_count to count entries. */ - htab->sglink->reloc_count = 0; + /* Build the .glink lazy link call stubs. */ + indx = 0; + while (p < htab->sglink->contents + htab->sglink->_raw_size) + { + if (indx < 0x8000) + { + bfd_put_32 (htab->sglink->owner, LI_R0_0 | indx, p); + p += 4; + } + else + { + bfd_put_32 (htab->sglink->owner, LIS_R0_0 | PPC_HI (indx), p); + p += 4; + bfd_put_32 (htab->sglink->owner, ORI_R0_R0_0 | PPC_LO (indx), p); + p += 4; + } + bfd_put_32 (htab->sglink->owner, + B_DOT | ((htab->sglink->contents - p) & 0x3fffffc), p); + p += 4; + } + htab->sglink->_cooked_size = p - htab->sglink->contents; } if (htab->sbrlt->_raw_size != 0) @@ -5177,7 +5176,6 @@ ppc64_elf_build_stubs (info) /* Build the stubs as directed by the stub hash table. */ bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info); - htab->sglink->reloc_count = 0; for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 764b0d75a91..f79d76c30bd 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2727,11 +2727,12 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym) } else { - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); rela.r_addend = 0; } + bfd_put_64 (output_bfd, (bfd_vma) 0, + sgot->contents + (h->got.offset &~ (bfd_vma) 1)); bfd_elf64_swap_reloca_out (output_bfd, &rela, ((Elf64_External_Rela *) srela->contents + srela->reloc_count)); diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 9c4a9d4ec18..fa2f2ee5ec1 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -40,16 +40,16 @@ static reloc_howto_type x86_64_elf_howto_table[] = HOWTO(R_X86_64_64, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_64", false, MINUS_ONE, MINUS_ONE, false), - HOWTO(R_X86_64_PC32, 0, 4, 32, true, 0, complain_overflow_signed, + HOWTO(R_X86_64_PC32, 0, 2, 32, true, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_PC32", false, 0xffffffff, 0xffffffff, true), - HOWTO(R_X86_64_GOT32, 0, 4, 32, false, 0, complain_overflow_signed, + HOWTO(R_X86_64_GOT32, 0, 2, 32, false, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_GOT32", false, 0xffffffff, 0xffffffff, false), - HOWTO(R_X86_64_PLT32, 0, 4, 32, true, 0, complain_overflow_signed, + HOWTO(R_X86_64_PLT32, 0, 2, 32, true, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_PLT32", false, 0xffffffff, 0xffffffff, true), - HOWTO(R_X86_64_COPY, 0, 4, 32, false, 0, complain_overflow_bitfield, + HOWTO(R_X86_64_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_COPY", false, 0xffffffff, 0xffffffff, false), HOWTO(R_X86_64_GLOB_DAT, 0, 4, 64, false, 0, complain_overflow_bitfield, @@ -61,13 +61,13 @@ static reloc_howto_type x86_64_elf_howto_table[] = HOWTO(R_X86_64_RELATIVE, 0, 4, 64, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_RELATIVE", false, MINUS_ONE, MINUS_ONE, false), - HOWTO(R_X86_64_GOTPCREL, 0, 4, 32, true,0 , complain_overflow_signed, + HOWTO(R_X86_64_GOTPCREL, 0, 2, 32, true, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_GOTPCREL", false, 0xffffffff, 0xffffffff, true), - HOWTO(R_X86_64_32, 0, 4, 32, false, 0, complain_overflow_unsigned, + HOWTO(R_X86_64_32, 0, 2, 32, false, 0, complain_overflow_unsigned, bfd_elf_generic_reloc, "R_X86_64_32", false, 0xffffffff, 0xffffffff, false), - HOWTO(R_X86_64_32S, 0, 4, 32, false, 0, complain_overflow_signed, + HOWTO(R_X86_64_32S, 0, 2, 32, false, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_32S", false, 0xffffffff, 0xffffffff, false), HOWTO(R_X86_64_16, 0, 1, 16, false, 0, complain_overflow_bitfield, @@ -78,6 +78,30 @@ static reloc_howto_type x86_64_elf_howto_table[] = bfd_elf_generic_reloc, "R_X86_64_8", false, 0xff, 0xff, false), HOWTO(R_X86_64_PC8, 0, 0, 8, true, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_PC8", false, 0xff, 0xff, true), + HOWTO(R_X86_64_DTPMOD64, 0, 4, 64, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_X86_64_DTPMOD64", false, MINUS_ONE, + MINUS_ONE, false), + HOWTO(R_X86_64_DTPOFF64, 0, 4, 64, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_X86_64_DTPOFF64", false, MINUS_ONE, + MINUS_ONE, false), + HOWTO(R_X86_64_TPOFF64, 0, 4, 64, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_X86_64_TPOFF64", false, MINUS_ONE, + MINUS_ONE, false), + HOWTO(R_X86_64_TLSGD, 0, 2, 32, true, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_TLSGD", false, 0xffffffff, + 0xffffffff, true), + HOWTO(R_X86_64_TLSLD, 0, 2, 32, true, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_TLSLD", false, 0xffffffff, + 0xffffffff, true), + HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_X86_64_DTPOFF32", false, 0xffffffff, + 0xffffffff, false), + HOWTO(R_X86_64_GOTTPOFF, 0, 2, 32, true, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_GOTTPOFF", false, 0xffffffff, + 0xffffffff, true), + HOWTO(R_X86_64_TPOFF32, 0, 2, 32, false, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_TPOFF32", false, 0xffffffff, + 0xffffffff, false), /* GNU extension to record C++ vtable hierarchy. */ HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, false, 0, complain_overflow_dont, @@ -114,6 +138,14 @@ static const struct elf_reloc_map x86_64_reloc_map[] = { BFD_RELOC_16_PCREL, R_X86_64_PC16, }, { BFD_RELOC_8, R_X86_64_8, }, { BFD_RELOC_8_PCREL, R_X86_64_PC8, }, + { BFD_RELOC_X86_64_DTPMOD64, R_X86_64_DTPMOD64, }, + { BFD_RELOC_X86_64_DTPOFF64, R_X86_64_DTPOFF64, }, + { BFD_RELOC_X86_64_TPOFF64, R_X86_64_TPOFF64, }, + { BFD_RELOC_X86_64_TLSGD, R_X86_64_TLSGD, }, + { BFD_RELOC_X86_64_TLSLD, R_X86_64_TLSLD, }, + { BFD_RELOC_X86_64_DTPOFF32, R_X86_64_DTPOFF32, }, + { BFD_RELOC_X86_64_GOTTPOFF, R_X86_64_GOTTPOFF, }, + { BFD_RELOC_X86_64_TPOFF32, R_X86_64_TPOFF32, }, { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, }, { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, }, }; @@ -128,6 +160,10 @@ static boolean elf64_x86_64_grok_psinfo PARAMS ((bfd *, Elf_Internal_Note *)); static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create PARAMS ((bfd *)); +static int elf64_x86_64_tls_transition + PARAMS ((struct bfd_link_info *, int, int)); +static boolean elf64_x86_64_mkobject + PARAMS((bfd *)); static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd)); static boolean create_got_section PARAMS((bfd *, struct bfd_link_info *)); @@ -158,6 +194,10 @@ static boolean readonly_dynrelocs PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf64_x86_64_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_vma dtpoff_base + PARAMS ((struct bfd_link_info *)); +static bfd_vma tpoff + PARAMS ((struct bfd_link_info *, bfd_vma)); static boolean elf64_x86_64_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); @@ -198,13 +238,13 @@ elf64_x86_64_info_to_howto (abfd, cache_ptr, dst) r_type = ELF64_R_TYPE (dst->r_info); if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT) { - BFD_ASSERT (r_type <= (unsigned int) R_X86_64_PC8); + BFD_ASSERT (r_type <= (unsigned int) R_X86_64_TPOFF32); i = r_type; } else { BFD_ASSERT (r_type < (unsigned int) R_X86_64_max); - i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_PC8 - 1); + i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_TPOFF32 - 1); } cache_ptr->howto = &x86_64_elf_howto_table[i]; BFD_ASSERT (r_type == cache_ptr->howto->type); @@ -343,8 +383,32 @@ struct elf64_x86_64_link_hash_entry /* Track dynamic relocs copied for this symbol. */ struct elf64_x86_64_dyn_relocs *dyn_relocs; + +#define GOT_UNKNOWN 0 +#define GOT_NORMAL 1 +#define GOT_TLS_GD 2 +#define GOT_TLS_IE 3 + unsigned char tls_type; +}; + +#define elf64_x86_64_hash_entry(ent) \ + ((struct elf64_x86_64_link_hash_entry *)(ent)) + +struct elf64_x86_64_obj_tdata +{ + struct elf_obj_tdata root; + + /* tls_type for each local got entry. */ + char *local_got_tls_type; }; +#define elf64_x86_64_tdata(abfd) \ + ((struct elf64_x86_64_obj_tdata *) (abfd)->tdata.any) + +#define elf64_x86_64_local_got_tls_type(abfd) \ + (elf64_x86_64_tdata (abfd)->local_got_tls_type) + + /* x86-64 ELF linker hash table. */ struct elf64_x86_64_link_hash_table @@ -360,6 +424,11 @@ struct elf64_x86_64_link_hash_table asection *sdynbss; asection *srelbss; + union { + bfd_signed_vma refcount; + bfd_vma offset; + } tls_ld_got; + /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; }; @@ -395,6 +464,7 @@ link_hash_newfunc (entry, table, string) eh = (struct elf64_x86_64_link_hash_entry *) entry; eh->dyn_relocs = NULL; + eh->tls_type = GOT_UNKNOWN; } return entry; @@ -427,6 +497,7 @@ elf64_x86_64_link_hash_table_create (abfd) ret->sdynbss = NULL; ret->srelbss = NULL; ret->sym_sec.abfd = NULL; + ret->tls_ld_got.refcount = 0; return &ret->elf.root; } @@ -538,18 +609,67 @@ elf64_x86_64_copy_indirect_symbol (bed, dir, ind) eind->dyn_relocs = NULL; } + if (ind->root.type == bfd_link_hash_indirect + && dir->got.refcount <= 0) + { + edir->tls_type = eind->tls_type; + eind->tls_type = GOT_UNKNOWN; + } + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } static boolean -elf64_x86_64_elf_object_p (abfd) +elf64_x86_64_mkobject (abfd) bfd *abfd; { + bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return false; + return true; +} + +static boolean +elf64_x86_64_elf_object_p (abfd) + bfd *abfd; +{ + /* Allocate our special target data. */ + struct elf64_x86_64_obj_tdata *new_tdata; + bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); + new_tdata = bfd_zalloc (abfd, amt); + if (new_tdata == NULL) + return false; + new_tdata->root = *abfd->tdata.elf_obj_data; + abfd->tdata.any = new_tdata; /* Set the right machine number for an x86-64 elf64 file. */ bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64); return true; } +static int +elf64_x86_64_tls_transition (info, r_type, is_local) + struct bfd_link_info *info; + int r_type; + int is_local; +{ + if (info->shared) + return r_type; + + switch (r_type) + { + case R_X86_64_TLSGD: + case R_X86_64_GOTTPOFF: + if (is_local) + return R_X86_64_TPOFF32; + return R_X86_64_GOTTPOFF; + case R_X86_64_TLSLD: + return R_X86_64_TPOFF32; + } + + return r_type; +} + /* Look through the relocs for a section during the first phase, and calculate needed space in the global offset table, procedure linkage table, and dynamic reloc sections. */ @@ -580,10 +700,12 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { + unsigned int r_type; unsigned long r_symndx; struct elf_link_hash_entry *h; r_symndx = ELF64_R_SYM (rel->r_info); + r_type = ELF64_R_TYPE (rel->r_info); if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { @@ -598,38 +720,103 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - switch (ELF64_R_TYPE (rel->r_info)) + r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL); + switch (r_type) { - case R_X86_64_GOT32: - case R_X86_64_GOTPCREL: - /* This symbol requires a global offset table entry. */ - if (h != NULL) + case R_X86_64_TLSLD: + htab->tls_ld_got.refcount += 1; + goto create_got; + + case R_X86_64_TPOFF32: + if (info->shared) { - h->got.refcount += 1; + (*_bfd_error_handler) + (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), + bfd_archive_filename (abfd), + x86_64_elf_howto_table[r_type].name); + bfd_set_error (bfd_error_bad_value); + return false; } - else - { - bfd_signed_vma *local_got_refcounts; + break; - /* This is a global offset table entry for a local symbol. */ - local_got_refcounts = elf_local_got_refcounts (abfd); - if (local_got_refcounts == NULL) - { - bfd_size_type size; + case R_X86_64_GOTTPOFF: + if (info->shared) + info->flags |= DF_STATIC_TLS; + /* Fall through */ - 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) + case R_X86_64_GOT32: + case R_X86_64_GOTPCREL: + case R_X86_64_TLSGD: + /* This symbol requires a global offset table entry. */ + { + int tls_type, old_tls_type; + + switch (r_type) + { + default: tls_type = GOT_NORMAL; break; + case R_X86_64_TLSGD: tls_type = GOT_TLS_GD; break; + case R_X86_64_GOTTPOFF: tls_type = GOT_TLS_IE; break; + } + + if (h != NULL) + { + h->got.refcount += 1; + old_tls_type = elf64_x86_64_hash_entry (h)->tls_type; + } + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma) + sizeof (char); + 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; + elf64_x86_64_local_got_tls_type (abfd) + = (char *) (local_got_refcounts + symtab_hdr->sh_info); + } + local_got_refcounts[r_symndx] += 1; + old_tls_type + = elf64_x86_64_local_got_tls_type (abfd) [r_symndx]; + } + + /* If a TLS symbol is accessed using IE at least once, + there is no point to use dynamic model for it. */ + if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN + && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE)) + { + if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD) + tls_type = old_tls_type; + else + { + (*_bfd_error_handler) + (_("%s: %s' accessed both as normal and thread local symbol"), + bfd_archive_filename (abfd), + h ? h->root.root.string : "<local>"); return false; - elf_local_got_refcounts (abfd) = local_got_refcounts; - } - local_got_refcounts[r_symndx] += 1; - } + } + } + + if (old_tls_type != tls_type) + { + if (h != NULL) + elf64_x86_64_hash_entry (h)->tls_type = tls_type; + else + elf64_x86_64_local_got_tls_type (abfd) [r_symndx] = tls_type; + } + } /* Fall through */ //case R_X86_64_GOTPCREL: + create_got: if (htab->sgot == NULL) { if (htab->elf.dynobj == NULL) @@ -671,7 +858,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) (*_bfd_error_handler) (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), bfd_archive_filename (abfd), - x86_64_elf_howto_table[ELF64_R_TYPE (rel->r_info)].name); + x86_64_elf_howto_table[r_type].name); bfd_set_error (bfd_error_bad_value); return false; } @@ -719,9 +906,9 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) symbol. */ if ((info->shared && (sec->flags & SEC_ALLOC) != 0 - && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8) - && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16) - && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32)) + && (((r_type != R_X86_64_PC8) + && (r_type != R_X86_64_PC16) + && (r_type != R_X86_64_PC32)) || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak @@ -822,9 +1009,9 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) } p->count += 1; - if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8 - || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16 - || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32) + if (r_type == R_X86_64_PC8 + || r_type == R_X86_64_PC16 + || r_type == R_X86_64_PC32) p->pc_count += 1; } break; @@ -905,6 +1092,7 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs) bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; + int r_type; struct elf_link_hash_entry *h; elf_section_data (sec)->local_dynrel = NULL; @@ -915,8 +1103,18 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs) relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) - switch (ELF64_R_TYPE (rel->r_info)) + switch ((r_type = elf64_x86_64_tls_transition (info, + ELF64_R_TYPE (rel->r_info), + ELF64_R_SYM (rel->r_info) + >= symtab_hdr->sh_info))) { + case R_X86_64_TLSLD: + if (elf64_x86_64_hash_table (info)->tls_ld_got.refcount > 0) + elf64_x86_64_hash_table (info)->tls_ld_got.refcount -= 1; + break; + + case R_X86_64_TLSGD: + case R_X86_64_GOTTPOFF: case R_X86_64_GOT32: case R_X86_64_GOTPCREL: r_symndx = ELF64_R_SYM (rel->r_info); @@ -1226,10 +1424,18 @@ allocate_dynrelocs (h, inf) h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; } - if (h->got.refcount > 0) + /* If R_X86_64_GOTTPOFF symbol is now local to the binary, + make it a R_X86_64_TPOFF32 requiring no GOT entry. */ + if (h->got.refcount > 0 + && !info->shared + && h->dynindx == -1 + && elf64_x86_64_hash_entry (h)->tls_type == GOT_TLS_IE) + h->got.offset = (bfd_vma) -1; + else if (h->got.refcount > 0) { asection *s; boolean dyn; + int tls_type = elf64_x86_64_hash_entry (h)->tls_type; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ @@ -1243,8 +1449,19 @@ allocate_dynrelocs (h, inf) s = htab->sgot; h->got.offset = s->_raw_size; s->_raw_size += GOT_ENTRY_SIZE; + /* R_X86_64_TLSGD needs 2 consecutive GOT slots. */ + if (tls_type == GOT_TLS_GD) + s->_raw_size += GOT_ENTRY_SIZE; dyn = htab->elf.dynamic_sections_created; - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + /* R_X86_64_TLSGD needs one dynamic relocation if local symbol + and two if global. + R_X86_64_GOTTPOFF needs one dynamic relocation. */ + if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + || tls_type == GOT_TLS_IE) + htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + else if (tls_type == GOT_TLS_GD) + htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela); + else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); } else @@ -1390,6 +1607,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info) { bfd_signed_vma *local_got; bfd_signed_vma *end_local_got; + char *local_tls_type; bfd_size_type locsymcount; Elf_Internal_Shdr *symtab_hdr; asection *srel; @@ -1432,15 +1650,20 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info) symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; locsymcount = symtab_hdr->sh_info; end_local_got = local_got + locsymcount; + local_tls_type = elf64_x86_64_local_got_tls_type (ibfd); s = htab->sgot; srel = htab->srelgot; - for (; local_got < end_local_got; ++local_got) + for (; local_got < end_local_got; ++local_got, ++local_tls_type) { if (*local_got > 0) { *local_got = s->_raw_size; s->_raw_size += GOT_ENTRY_SIZE; - if (info->shared) + if (*local_tls_type == GOT_TLS_GD) + s->_raw_size += GOT_ENTRY_SIZE; + if (info->shared + || *local_tls_type == GOT_TLS_GD + || *local_tls_type == GOT_TLS_IE) srel->_raw_size += sizeof (Elf64_External_Rela); } else @@ -1448,6 +1671,17 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info) } } + if (htab->tls_ld_got.refcount > 0) + { + /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD + relocs. */ + htab->tls_ld_got.offset = htab->sgot->_raw_size; + htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE; + htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + else + htab->tls_ld_got.offset = -1; + /* Allocate global sym .plt and .got entries, and space for global sym dynamic relocs. */ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); @@ -1558,6 +1792,38 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info) return true; } +/* Return the base VMA address which should be subtracted from real addresses + when resolving @dtpoff relocation. + This is PT_TLS segment p_vaddr. */ + +static bfd_vma +dtpoff_base (info) + struct bfd_link_info *info; +{ + /* If tls_segment is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_segment == NULL) + return 0; + return elf_hash_table (info)->tls_segment->start; +} + +/* Return the relocation value for @tpoff relocation + if STT_TLS virtual address is ADDRESS. */ + +static bfd_vma +tpoff (info, address) + struct bfd_link_info *info; + bfd_vma address; +{ + struct elf_link_tls_segment *tls_segment + = elf_hash_table (info)->tls_segment; + + /* If tls_segment is NULL, we should have signalled an error already. */ + if (tls_segment == NULL) + return 0; + return address - align_power (tls_segment->size, tls_segment->align) + - tls_segment->start; +} + /* Relocate an x86_64 ELF section. */ static boolean @@ -1591,7 +1857,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, relend = relocs + input_section->reloc_count; for (; rel < relend; rel++) { - int r_type; + unsigned int r_type; reloc_howto_type *howto; unsigned long r_symndx; struct elf_link_hash_entry *h; @@ -1601,13 +1867,14 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma relocation; boolean unresolved_reloc; bfd_reloc_status_type r; + int tls_type; r_type = ELF64_R_TYPE (rel->r_info); if (r_type == (int) R_X86_64_GNU_VTINHERIT || r_type == (int) R_X86_64_GNU_VTENTRY) continue; - if (r_type < 0 || r_type >= R_X86_64_max) + if (r_type >= R_X86_64_max) { bfd_set_error (bfd_error_bad_value); return false; @@ -1933,6 +2200,313 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, break; + case R_X86_64_TLSGD: + case R_X86_64_GOTTPOFF: + r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL); + tls_type = GOT_UNKNOWN; + if (h == NULL && local_got_offsets) + tls_type = elf64_x86_64_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + { + tls_type = elf64_x86_64_hash_entry (h)->tls_type; + if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE) + r_type = R_X86_64_TPOFF32; + } + if (r_type == R_X86_64_TLSGD) + { + if (tls_type == GOT_TLS_IE) + r_type = R_X86_64_GOTTPOFF; + } + + if (r_type == R_X86_64_TPOFF32) + { + BFD_ASSERT (! unresolved_reloc); + if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSGD) + { + unsigned int i; + static unsigned char tlsgd[7] + = { 0x66, 0x66, 0x66, 0x66, 0x48, 0x8d, 0x3d }; + + /* GD->LE transition. + .long 0x66666666; leaq foo@tlsgd(%rip), %rdi + callq __tls_get_addr@plt + Change it into: + movq %fs:0, %rax + leaq foo@tpoff(%rax), %rax */ + BFD_ASSERT (rel->r_offset >= 7); + for (i = 0; i < 7; i++) + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset - 7 + i) + == tlsgd[i]); + BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset + 4) + == 0xe8); + BFD_ASSERT (rel + 1 < relend); + BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32); + memcpy (contents + rel->r_offset - 7, + "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x8d\x80\0\0\0", + 16); + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + rel->r_offset + 5); + /* Skip R_X86_64_PLT32. */ + rel++; + continue; + } + else + { + unsigned int val, type, reg; + + /* IE->LE transition: + Originally it can be one of: + movq foo@gottpoff(%rip), %reg + addq foo@gottpoff(%rip), %reg + We change it into: + movq $foo, %reg + leaq foo(%reg), %reg + addq $foo, %reg. */ + BFD_ASSERT (rel->r_offset >= 3); + val = bfd_get_8 (input_bfd, contents + rel->r_offset - 3); + BFD_ASSERT (val == 0x48 || val == 0x4c); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + BFD_ASSERT (type == 0x8b || type == 0x03); + reg = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); + BFD_ASSERT ((reg & 0xc7) == 5); + reg >>= 3; + BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + if (type == 0x8b) + { + /* movq */ + if (val == 0x4c) + bfd_put_8 (output_bfd, 0x49, + contents + rel->r_offset - 3); + bfd_put_8 (output_bfd, 0xc7, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xc0 | reg, + contents + rel->r_offset - 1); + } + else if (reg == 4) + { + /* addq -> addq - addressing with %rsp/%r12 is + special */ + if (val == 0x4c) + bfd_put_8 (output_bfd, 0x49, + contents + rel->r_offset - 3); + bfd_put_8 (output_bfd, 0x81, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xc0 | reg, + contents + rel->r_offset - 1); + } + else + { + /* addq -> leaq */ + if (val == 0x4c) + bfd_put_8 (output_bfd, 0x4d, + contents + rel->r_offset - 3); + bfd_put_8 (output_bfd, 0x8d, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0x80 | reg | (reg << 3), + contents + rel->r_offset - 1); + } + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + rel->r_offset); + continue; + } + } + + if (htab->sgot == NULL) + abort (); + + if (h != NULL) + off = h->got.offset; + else + { + if (local_got_offsets == NULL) + abort (); + + off = local_got_offsets[r_symndx]; + } + + if ((off & 1) != 0) + off &= ~1; + else + { + Elf_Internal_Rela outrel; + Elf64_External_Rela *loc; + int dr_type, indx; + + if (htab->srelgot == NULL) + abort (); + + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); + + indx = h && h->dynindx != -1 ? h->dynindx : 0; + if (r_type == R_X86_64_TLSGD) + dr_type = R_X86_64_DTPMOD64; + else + dr_type = R_X86_64_TPOFF64; + + bfd_put_64 (output_bfd, 0, htab->sgot->contents + off); + outrel.r_addend = 0; + if (dr_type == R_X86_64_TPOFF64 && indx == 0) + outrel.r_addend = relocation - dtpoff_base (info); + outrel.r_info = ELF64_R_INFO (indx, dr_type); + + loc = (Elf64_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + + if (r_type == R_X86_64_TLSGD) + { + if (indx == 0) + { + BFD_ASSERT (! unresolved_reloc); + bfd_put_64 (output_bfd, + relocation - dtpoff_base (info), + htab->sgot->contents + off + GOT_ENTRY_SIZE); + } + else + { + bfd_put_64 (output_bfd, 0, + htab->sgot->contents + off + GOT_ENTRY_SIZE); + outrel.r_info = ELF64_R_INFO (indx, + R_X86_64_DTPOFF64); + outrel.r_offset += GOT_ENTRY_SIZE; + htab->srelgot->reloc_count++; + loc++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + loc); + } + } + + if (h != NULL) + h->got.offset |= 1; + else + local_got_offsets[r_symndx] |= 1; + } + + if (off >= (bfd_vma) -2) + abort (); + if (r_type == ELF64_R_TYPE (rel->r_info)) + { + relocation = htab->sgot->output_section->vma + + htab->sgot->output_offset + off; + unresolved_reloc = false; + } + else + { + unsigned int i; + static unsigned char tlsgd[7] + = { 0x66, 0x66, 0x66, 0x66, 0x48, 0x8d, 0x3d }; + + /* GD->IE transition. + .long 0x66666666; leaq foo@tlsgd(%rip), %rdi + callq __tls_get_addr@plt + Change it into: + movq %fs:0, %rax + addq foo@gottpoff(%rip), %rax */ + BFD_ASSERT (rel->r_offset >= 7); + for (i = 0; i < 7; i++) + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset - 7 + i) + == tlsgd[i]); + BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset + 4) + == 0xe8); + BFD_ASSERT (rel + 1 < relend); + BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32); + memcpy (contents + rel->r_offset - 7, + "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0", + 16); + + relocation = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off + - rel->r_offset + - input_section->output_section->vma + - input_section->output_offset + - 9); + bfd_put_32 (output_bfd, relocation, + contents + rel->r_offset + 5); + /* Skip R_X86_64_PLT32. */ + rel++; + continue; + } + break; + + case R_X86_64_TLSLD: + if (! info->shared) + { + /* LD->LE transition: + Ensure it is: + leaq foo@tlsld(%rip), %rdi; call __tls_get_addr@plt. + We change it into: + .word 0x6666; .byte 0x66; movl %fs:0, %rax. */ + BFD_ASSERT (rel->r_offset >= 3); + BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 3) + == 0x48); + BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2) + == 0x8d); + BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 1) + == 0x3d); + BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4) + == 0xe8); + BFD_ASSERT (rel + 1 < relend); + BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32); + memcpy (contents + rel->r_offset - 3, + "\x66\x66\x66\x64\x48\x8b\x04\x25\0\0\0", 12); + /* Skip R_X86_64_PLT32. */ + rel++; + continue; + } + + if (htab->sgot == NULL) + abort (); + + off = htab->tls_ld_got.offset; + if (off & 1) + off &= ~1; + else + { + Elf_Internal_Rela outrel; + Elf64_External_Rela *loc; + + if (htab->srelgot == NULL) + abort (); + + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); + + bfd_put_64 (output_bfd, 0, + htab->sgot->contents + off); + bfd_put_64 (output_bfd, 0, + htab->sgot->contents + off + GOT_ENTRY_SIZE); + outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64); + outrel.r_addend = 0; + loc = (Elf64_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + htab->tls_ld_got.offset |= 1; + } + relocation = htab->sgot->output_section->vma + + htab->sgot->output_offset + off; + unresolved_reloc = false; + break; + + case R_X86_64_DTPOFF32: + if (info->shared) + relocation -= dtpoff_base (info); + else + relocation = tpoff (info, relocation); + break; + + case R_X86_64_TPOFF32: + BFD_ASSERT (! info->shared); + relocation = tpoff (info, relocation); + break; + default: break; } @@ -2087,13 +2661,15 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym) } } - if (h->got.offset != (bfd_vma) -1) + if (h->got.offset != (bfd_vma) -1 + && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_GD + && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE) { Elf_Internal_Rela rela; Elf64_External_Rela *loc; /* This symbol has an entry in the global offset table. Set it - up. */ + up. */ if (htab->sgot == NULL || htab->srelgot == NULL) abort (); @@ -2351,5 +2927,6 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info) #define elf_backend_relocate_section elf64_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections #define elf_backend_object_p elf64_x86_64_elf_object_p +#define bfd_elf64_mkobject elf64_x86_64_mkobject #include "elf64-target.h" diff --git a/bfd/elfcode.h b/bfd/elfcode.h index eb667eb50e2..4f54cd35ccc 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1377,6 +1377,7 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count, arelent *relent; unsigned int i; int entsize; + unsigned int symcount; allocated = (PTR) bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) @@ -1393,6 +1394,11 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count, BFD_ASSERT (entsize == sizeof (Elf_External_Rel) || entsize == sizeof (Elf_External_Rela)); + if (dynamic) + symcount = bfd_get_dynamic_symcount (abfd); + else + symcount = bfd_get_symcount (abfd); + for (i = 0, relent = relents; i < reloc_count; i++, relent++, native_relocs += entsize) @@ -1421,6 +1427,13 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count, if (ELF_R_SYM (rela.r_info) == 0) relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + else if (ELF_R_SYM (rela.r_info) > symcount) + { + (*_bfd_error_handler) + (_("%s(%s): relocation %d has invalid symbol index %ld"), + abfd->filename, asect->name, i, ELF_R_SYM (rela.r_info)); + relent->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr; + } else { asymbol **ps, *s; diff --git a/bfd/elflink.h b/bfd/elflink.h index 638f80af266..85160e90257 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -3886,9 +3886,12 @@ elf_fix_symbol_flags (h, eif) { struct elf_link_hash_entry *weakdef; + weakdef = h->weakdef; + if (h->root.type == bfd_link_hash_indirect) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + BFD_ASSERT (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak); - weakdef = h->weakdef; BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined || weakdef->root.type == bfd_link_hash_defweak); BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC); @@ -8479,7 +8482,12 @@ elf_bfd_discard_info (output_bfd, info) if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr, elf_reloc_symbol_deleted_p, &cookie)) - ret = true; + { + /* Relocs have been edited. Ensure edited version is + used later in relocate_section. */ + elf_section_data (eh)->relocs = cookie.rels; + ret = true; + } if (cookie.rels && elf_section_data (eh)->relocs != cookie.rels) free (cookie.rels); } diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 040fddfef30..916b16bd0ad 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -1505,7 +1505,7 @@ mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) if (relocateable) { /* Make up a value. */ - *pgp = symbol->section->output_section->vma + 0x4000; + *pgp = symbol->section->output_section->vma /*+ 0x4000*/; _bfd_set_gp_value (output_bfd, *pgp); } else if (!mips_elf_assign_gp (output_bfd, pgp)) diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index dca8b45cd34..2a29347365f 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -724,7 +724,9 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) irelend = internal_relocs + sec->reloc_count; for (irel = internal_relocs; irel < irelend; irel++) - if (ELFNN_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21B) + if (ELFNN_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21B + || ELFNN_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21M + || ELFNN_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21F) break; /* No branch-type relocations. */ @@ -756,7 +758,9 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) struct one_fixup *f; bfd_size_type amt; - if (ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B) + if (ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B + && ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21M + && ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21F) continue; /* Get the value of the symbol referred to by the reloc. */ diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 51326934ffd..3c8bb5d8be8 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -364,6 +364,7 @@ static INLINE int elf_mips_isa PARAMS ((flagword)); static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); static void mips_elf_irix6_finish_dynamic_symbol PARAMS ((bfd *, const char *, Elf_Internal_Sym *)); +static boolean _bfd_mips_elf_mach_extends_p PARAMS ((flagword, flagword)); /* This will be used when we sort the dynamic relocation records. */ static bfd *reldyn_sorting_bfd; @@ -3058,9 +3059,18 @@ _bfd_elf_mips_mach (flags) case E_MIPS_MACH_4111: return bfd_mach_mips4111; + case E_MIPS_MACH_4120: + return bfd_mach_mips4120; + case E_MIPS_MACH_4650: return bfd_mach_mips4650; + case E_MIPS_MACH_5400: + return bfd_mach_mips5400; + + case E_MIPS_MACH_5500: + return bfd_mach_mips5500; + case E_MIPS_MACH_SB1: return bfd_mach_mips_sb1; @@ -3644,7 +3654,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec) sh_offset == object size, and ld doesn't allow that. While the check is arguably bogus for empty or SHT_NOBITS sections, it can easily be avoided by not emitting those useless sections in the first place. */ - if ((IRIX_COMPAT (abfd) != ict_irix5 && (IRIX_COMPAT (abfd) != ict_irix6)) + if (! SGI_COMPAT (abfd) && ! NEWABI_P(abfd) && (sec->flags & SEC_RELOC) != 0) { struct bfd_elf_section_data *esd; @@ -5935,10 +5945,22 @@ _bfd_mips_elf_final_write_processing (abfd, linker) val = E_MIPS_ARCH_3 | E_MIPS_MACH_4111; break; + case bfd_mach_mips4120: + val = E_MIPS_ARCH_3 | E_MIPS_MACH_4120; + break; + case bfd_mach_mips4650: val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650; break; + case bfd_mach_mips5400: + val = E_MIPS_ARCH_4 | E_MIPS_MACH_5400; + break; + + case bfd_mach_mips5500: + val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500; + break; + case bfd_mach_mips5000: case bfd_mach_mips8000: case bfd_mach_mips10000: @@ -6984,6 +7006,8 @@ _bfd_mips_elf_final_link (abfd, info) <= g->global_gotno); } +#if 0 + /* We want to set the GP value for ld -r. */ /* On IRIX5, we omit the .options section. On IRIX6, however, we include it, even though we don't process it quite right. (Some entries are supposed to be merged.) Empirically, we seem to be @@ -7021,6 +7045,7 @@ _bfd_mips_elf_final_link (abfd, info) break; } } +#endif /* Get a value for the GP register. */ if (elf_gp (abfd) == 0) @@ -7634,6 +7659,26 @@ _bfd_mips_elf_final_link (abfd, info) return true; } +/* Return true if machine EXTENSION is an extension of machine BASE, + meaning that it should be safe to link code for the two machines + and set the output machine to EXTENSION. EXTENSION and BASE are + both submasks of EF_MIPS_MACH. */ + +static boolean +_bfd_mips_elf_mach_extends_p (base, extension) + flagword base, extension; +{ + /* The vr5500 ISA is an extension of the core vr5400 ISA, but doesn't + include the multimedia stuff. It seems better to allow vr5400 + and vr5500 code to be merged anyway, since many libraries will + just use the core ISA. Perhaps we could add some sort of ASE + flag if this ever proves a problem. */ + return (base == 0 + || (base == E_MIPS_MACH_5400 && extension == E_MIPS_MACH_5500) + || (base == E_MIPS_MACH_4100 && extension == E_MIPS_MACH_4111) + || (base == E_MIPS_MACH_4100 && extension == E_MIPS_MACH_4120)); +} + /* Merge backend specific data from an object file to the output object file when linking. */ @@ -7740,10 +7785,9 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) /* If either has no machine specified, just compare the general isa's. Some combinations of machines are ok, if the isa's match. */ - if (! new_mach - || ! old_mach - || new_mach == old_mach - ) + if (new_mach == old_mach + || _bfd_mips_elf_mach_extends_p (new_mach, old_mach) + || _bfd_mips_elf_mach_extends_p (old_mach, new_mach)) { /* Don't warn about mixing code using 32-bit ISAs, or mixing code using 64-bit ISAs. They will normally use the same data sizes @@ -7760,8 +7804,11 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) else { /* Do we need to update the mach field? */ - if (old_mach == 0 && new_mach != 0) - elf_elfheader (obfd)->e_flags |= new_mach; + if (_bfd_mips_elf_mach_extends_p (old_mach, new_mach)) + { + elf_elfheader (obfd)->e_flags &= ~EF_MIPS_MACH; + elf_elfheader (obfd)->e_flags |= new_mach; + } /* Do we need to update the ISA field? */ if (new_isa > old_isa) diff --git a/bfd/irix-core.c b/bfd/irix-core.c index 0e48a9aa681..b1a575b034d 100644 --- a/bfd/irix-core.c +++ b/bfd/irix-core.c @@ -4,21 +4,21 @@ Written by Stu Grossman, Cygnus Support. Converted to back-end form by Ian Lance Taylor, Cygnus Support -This file is part of BFD, the Binary File Descriptor library. + 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 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file can only be compiled on systems which use Irix style core files (namely, Irix 4 and Irix 5, so far). */ @@ -49,6 +49,110 @@ static int irix_core_core_file_failing_signal PARAMS ((bfd *)); static boolean irix_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); static void swap_abort PARAMS ((void)); +#ifdef CORE_MAGIC64 +static int do_sections64 PARAMS ((bfd *, struct coreout *)); +#endif +static int do_sections PARAMS ((bfd *, struct coreout *)); + +/* Helper function for irix_core_core_file_p: + 32-bit and 64-bit versions. */ + +#ifdef CORE_MAGIC64 +static int +do_sections64 (abfd, coreout) + bfd * abfd; + struct coreout * coreout; +{ + struct vmap64 vmap; + char *secname; + int i, val; + + for (i = 0; i < coreout->c_nvmap; i++) + { + val = bfd_bread ((PTR) &vmap, (bfd_size_type) sizeof vmap, abfd); + if (val != sizeof vmap) + break; + + switch (vmap.v_type) + { + case VDATA: + secname = ".data"; + break; + case VSTACK: + secname = ".stack"; + break; +#ifdef VMAPFILE + case VMAPFILE: + secname = ".mapfile"; + break; +#endif + default: + continue; + } + + /* A file offset of zero means that the + section is not contained in the corefile. */ + if (vmap.v_offset == 0) + continue; + + if (!make_bfd_asection (abfd, secname, + SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS, + vmap.v_len, vmap.v_vaddr, vmap.v_offset)) + /* Fail. */ + return 0; + } + + return 1; +} +#endif + +/* 32-bit version. */ + +static int +do_sections (abfd, coreout) + bfd * abfd; + struct coreout *coreout; +{ + struct vmap vmap; + char *secname; + int i, val; + + for (i = 0; i < coreout->c_nvmap; i++) + { + val = bfd_bread ((PTR) &vmap, (bfd_size_type) sizeof vmap, abfd); + if (val != sizeof vmap) + break; + + switch (vmap.v_type) + { + case VDATA: + secname = ".data"; + break; + case VSTACK: + secname = ".stack"; + break; +#ifdef VMAPFILE + case VMAPFILE: + secname = ".mapfile"; + break; +#endif + default: + continue; + } + + /* A file offset of zero means that the + section is not contained in the corefile. */ + if (vmap.v_offset == 0) + continue; + + if (!make_bfd_asection (abfd, secname, + SEC_ALLOC | SEC_LOAD+SEC_HAS_CONTENTS, + vmap.v_len, vmap.v_vaddr, vmap.v_offset)) + /* Fail. */ + return 0; + } + return 1; +} static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) @@ -79,8 +183,6 @@ irix_core_core_file_p (abfd) bfd *abfd; { int val; - int i; - char *secname; struct coreout coreout; struct idesc *idg, *idf, *ids; bfd_size_type amt; @@ -93,13 +195,22 @@ irix_core_core_file_p (abfd) return 0; } -#ifndef CORE_MAGICN32 -#define CORE_MAGICN32 CORE_MAGIC -#endif - if ((coreout.c_magic != CORE_MAGIC && coreout.c_magic != CORE_MAGICN32) - || coreout.c_version != CORE_VERSION1) + if (coreout.c_version != CORE_VERSION1) return 0; + /* Have we got a corefile? */ + switch (coreout.c_magic) + { + case CORE_MAGIC: break; +#ifdef CORE_MAGIC64 + case CORE_MAGIC64: break; +#endif +#ifdef CORE_MAGICN32 + case CORE_MAGICN32: break; +#endif + default: return 0; /* Un-identifiable or not corefile. */ + } + amt = sizeof (struct sgi_core_struct); core_hdr (abfd) = (struct sgi_core_struct *) bfd_zalloc (abfd, amt); if (!core_hdr (abfd)) @@ -111,45 +222,19 @@ irix_core_core_file_p (abfd) if (bfd_seek (abfd, coreout.c_vmapoffset, SEEK_SET) != 0) goto fail; - for (i = 0; i < coreout.c_nvmap; i++) + /* Process corefile sections. */ +#ifdef CORE_MAGIC64 + if (coreout.c_magic == (int) CORE_MAGIC64) { - struct vmap vmap; - - val = bfd_bread ((PTR) &vmap, (bfd_size_type) sizeof vmap, abfd); - if (val != sizeof vmap) - break; - - switch (vmap.v_type) - { - case VDATA: - secname = ".data"; - break; - case VSTACK: - secname = ".stack"; - break; -#ifdef VMAPFILE - case VMAPFILE: - secname = ".mapfile"; - break; -#endif - default: - continue; - } - - /* A file offset of zero means that the section is not contained - in the corefile. */ - if (vmap.v_offset == 0) - continue; - - if (!make_bfd_asection (abfd, secname, - SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS, - vmap.v_len, - vmap.v_vaddr, - vmap.v_offset)) + if (! do_sections64 (abfd, & coreout)) goto fail; } + else +#endif + if (! do_sections (abfd, & coreout)) + goto fail; - /* Make sure that the regs are contiguous within the core file. */ + /* Make sure that the regs are contiguous within the core file. */ idg = &coreout.c_idesc[I_GPREGS]; idf = &coreout.c_idesc[I_FPREGS]; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index e855db196a1..96e55d7c547 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -799,6 +799,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_386_RELATIVE", "BFD_RELOC_386_GOTOFF", "BFD_RELOC_386_GOTPC", + "BFD_RELOC_386_TLS_TPOFF", + "BFD_RELOC_386_TLS_IE", + "BFD_RELOC_386_TLS_GOTIE", "BFD_RELOC_386_TLS_LE", "BFD_RELOC_386_TLS_GD", "BFD_RELOC_386_TLS_LDM", @@ -816,6 +819,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_X86_64_RELATIVE", "BFD_RELOC_X86_64_GOTPCREL", "BFD_RELOC_X86_64_32S", + "BFD_RELOC_X86_64_DTPMOD64", + "BFD_RELOC_X86_64_DTPOFF64", + "BFD_RELOC_X86_64_TPOFF64", + "BFD_RELOC_X86_64_TLSGD", + "BFD_RELOC_X86_64_TLSLD", + "BFD_RELOC_X86_64_DTPOFF32", + "BFD_RELOC_X86_64_GOTTPOFF", + "BFD_RELOC_X86_64_TPOFF32", "BFD_RELOC_NS32K_IMM_8", "BFD_RELOC_NS32K_IMM_16", "BFD_RELOC_NS32K_IMM_32", diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 85cf0ef21e9..f2802ab2a5b 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -1,5 +1,5 @@ /* BFD backend for MIPS BSD (a.out) binaries. - Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ralph Campbell. @@ -91,12 +91,12 @@ MY(set_arch_mach) (abfd, machtype) { case M_MIPS1: arch = bfd_arch_mips; - machine = 3000; + machine = bfd_mach_mips3000; break; case M_MIPS2: arch = bfd_arch_mips; - machine = 4000; + machine = bfd_mach_mips4000; break; default: @@ -164,8 +164,8 @@ MY (write_object_contents) (abfd) case bfd_arch_mips: switch (bfd_get_mach (abfd)) { - case 4000: - case 6000: + case bfd_mach_mips4000: + case bfd_mach_mips6000: N_SET_MACHTYPE (*execp, M_MIPS2); break; default: diff --git a/bfd/pdp11.c b/bfd/pdp11.c index cb47f78bf25..f7514367f7d 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -955,7 +955,10 @@ NAME(aout,machine_type) (arch, machine, unknown) break; case bfd_arch_i386: - if (machine == 0) arch_flags = M_386; + if (machine == 0 + || machine == bfd_mach_i386_i386 + || machine == bfd_mach_i386_i386_intel_syntax) + arch_flags = M_386; break; case bfd_arch_a29k: diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 4c32ca064ce..27ce9a93a67 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -45,6 +45,7 @@ coff-sparc.c coff-stgo32.c coff-svm68k.c coff-tic30.c +coff-tic4x.c coff-tic54x.c coff-tic80.c coff-u68k.c @@ -98,6 +99,7 @@ cpu-s390.c cpu-sh.c cpu-sparc.c cpu-tic30.c +cpu-tic4x.c cpu-tic54x.c cpu-tic80.c cpu-v850.c @@ -135,6 +137,7 @@ elf32-h8300.c elf32-hppa.c elf32-hppa.h elf32-i370.c +elf32-i386-fbsd.c elf32-i386.c elf32-i386qnx.c elf32-i860.c @@ -151,6 +154,7 @@ elf32-openrisc.c elf32-or32.c elf32-pj.c elf32-ppc.c +elf32-ppcqnx.c elf32-s390.c elf32-sh-lin.c elf32-sh-nbsd.c @@ -158,11 +162,13 @@ elf32-sh.c elf32-sh64-com.c elf32-sh64-nbsd.c elf32-sh64.c +elf32-shqnx.c elf32-sparc.c elf32-v850.c elf32-vax.c elf32-xstormy16.c elf32.c +elf64-alpha-fbsd.c elf64-alpha.c elf64-gen.c elf64-hppa.c @@ -178,10 +184,12 @@ elf64-x86-64.c elf64.c elfarm-nabi.c elfarm-oabi.c +elfarmqnx-nabi.c elfcode.h elfcore.h elflink.c elflink.h +elfn32-mips.c elfxx-mips.c epoc-pe-arm.c epoc-pei-arm.c diff --git a/bfd/po/da.po b/bfd/po/da.po new file mode 100644 index 00000000000..6f184849c06 --- /dev/null +++ b/bfd/po/da.po @@ -0,0 +1,2745 @@ +# Danish messages for bfd. +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Keld Simonsen <keld@dkuug.dk>, 2002 +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2002-09-07 21:55+0200\n" +"Last-Translator: Keld Simonsen <keld@dkuug.dk>\n" +"Language-Team: Danish <dansk@klid.dk>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:197 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: Ukendt sektionstype i a.out.adobe-fil: %x\n" + +#: aout-cris.c:208 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: Ugyldig relokaliseringstype eksporteret: %d" + +#: aout-cris.c:252 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: Ugyldig relokaliseringstype importeret: %d" + +#: aout-cris.c:263 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: Fejlagtig relokaliseringstype importeret: %d" + +#: aoutx.h:1282 aoutx.h:1699 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: kan ikke representere sektionen \"%s\" i a.out-objektfilformat" + +#: aoutx.h:1669 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: kan ikke representere sektion for symbolet \"%s\" i a.out-objektfilformat" + +#: aoutx.h:1671 +msgid "*unknown*" +msgstr "*ukendt*" + +#: aoutx.h:3732 +#, c-format +msgid "%s: relocateable link from %s to %s not supported" +msgstr "%s: relokaliseringsbar lænke fra %s til %s understøttes inte" + +#: archive.c:1826 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "Advarsel: arkivskrivning var langsom: genskriver tidsstempel\n" + +#: archive.c:2093 +msgid "Reading archive file mod timestamp" +msgstr "Læser arkivfilens ændringstidsstempel" + +#. FIXME: bfd can't call perror. +#: archive.c:2120 +msgid "Writing updated armap timestamp" +msgstr "Skriver opdateret armap-tidsstempel" + +#: bfd.c:274 +msgid "No error" +msgstr "Ingen fejl" + +#: bfd.c:275 +msgid "System call error" +msgstr "Systemkaldsfejl" + +#: bfd.c:276 +msgid "Invalid bfd target" +msgstr "Ugyldigt bfd-mål" + +#: bfd.c:277 +msgid "File in wrong format" +msgstr "Filen er i forkert format" + +#: bfd.c:278 +msgid "Archive object file in wrong format" +msgstr "Arkivobjektfil er i forkert format" + +#: bfd.c:279 +msgid "Invalid operation" +msgstr "Ugyldig handling" + +#: bfd.c:280 +msgid "Memory exhausted" +msgstr "Hukommelsen er opbrugt" + +#: bfd.c:281 +msgid "No symbols" +msgstr "Ingen symboler" + +#: bfd.c:282 +msgid "Archive has no index; run ranlib to add one" +msgstr "Arkivet har intet index; kør ranlib for at tilføje ét" + +#: bfd.c:283 +msgid "No more archived files" +msgstr "Ikke flere arkiverede filer" + +#: bfd.c:284 +msgid "Malformed archive" +msgstr "Forvansket arkiv" + +#: bfd.c:285 +msgid "File format not recognized" +msgstr "Filformatet ikke genkendt" + +#: bfd.c:286 +msgid "File format is ambiguous" +msgstr "Filformatet er flertydigt" + +#: bfd.c:287 +msgid "Section has no contents" +msgstr "Sektionen har intet indhold" + +#: bfd.c:288 +msgid "Nonrepresentable section on output" +msgstr "Ikkerepræsenterbar sektion i uddata" + +#: bfd.c:289 +msgid "Symbol needs debug section which does not exist" +msgstr "Symbolet kræver fejlsøgningssektion som ikke eksisterer" + +#: bfd.c:290 +msgid "Bad value" +msgstr "Fejlagtigt værdi" + +#: bfd.c:291 +msgid "File truncated" +msgstr "Filen trunkeret" + +#: bfd.c:292 +msgid "File too big" +msgstr "Filen er for stor" + +#: bfd.c:293 +msgid "#<Invalid error code>" +msgstr "#<Ugyldig fejlkode>" + +#: bfd.c:700 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "BFD %s-forsikring mislykkedes %s:%d" + +#: bfd.c:719 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "Intern BFD %s-fejl, afbryder ved %s linje %d i %s\n" + +#: bfd.c:723 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "Internt BFD %s-fejl, afbryder ved %s linje %d\n" + +#: bfd.c:725 +msgid "Please report this bug.\n" +msgstr "Rapportér gerne denne fejl.\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "Advarsel: Skrivning af sektionen \"%s\" til enorm (dvs negativ) afsætsbyte 0x%lx." + +# src/menus.c:341 +#: coff-a29k.c:119 +msgid "Missing IHCONST" +msgstr "IHCONST mangler" + +# src/menus.c:341 +#: coff-a29k.c:180 +msgid "Missing IHIHALF" +msgstr "IHIHALF mangler" + +#: coff-a29k.c:212 coff-or32.c:229 +msgid "Unrecognized reloc" +msgstr "Ukendt relokalisering" + +#: coff-a29k.c:408 +msgid "missing IHCONST reloc" +msgstr "IHCONST-relokalisering mangler" + +#: coff-a29k.c:498 +msgid "missing IHIHALF reloc" +msgstr "IHIHALF-relokalisering mangler" + +#: coff-alpha.c:881 coff-alpha.c:918 coff-alpha.c:1989 coff-mips.c:1432 +msgid "GP relative relocation used when GP not defined" +msgstr "GP-relativ relokalisering bruges når GP ikke er defineret" + +#: coff-alpha.c:1485 +msgid "using multiple gp values" +msgstr "bruger flere gp-værdier" + +#: coff-arm.c:1066 elf32-arm.h:285 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: kunne ikke finde THUMB-klistret \"%s\" til \"%s\"" + +#: coff-arm.c:1096 elf32-arm.h:320 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: kunne ikke finde ARM-klistret \"%s\" til \"%s\"" + +#: coff-arm.c:1391 coff-arm.c:1486 elf32-arm.h:887 elf32-arm.h:991 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): advarsel: samvirken er ikke aktiveret." + +#: coff-arm.c:1395 elf32-arm.h:994 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " første forekomst: %s: arm-kald til thumb" + +#: coff-arm.c:1490 elf32-arm.h:890 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " første forekomst: %s: thumb-kald til arm" + +#: coff-arm.c:1493 +msgid " consider relinking with --support-old-code enabled" +msgstr " overvej omlænkning med --support-old-code aktiveret" + +#: coff-arm.c:1785 coff-tic80.c:686 cofflink.c:3031 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: fejlagtig relokaliseringsadresse 0x%lx i sektionen \"%s\"" + +#: coff-arm.c:2127 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: utilladt symbolindex i relokalisering: %d" + +#: coff-arm.c:2255 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "FEJL: %s kompileret for APCS-%d, mens %s er kompileret for APCS-%d" + +#: coff-arm.c:2270 elf32-arm.h:2297 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "FEJL: %s overfører flydende tal i flydende talsregister, mens %s overfører dem i heltalsregister" + +#: coff-arm.c:2273 elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "FEJL: %s overfører flydende tal i heltalsregister, mens %s overfører dem i flydendetalsregister" + +#: coff-arm.c:2288 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "FEJL: %s er kompileret som positionsuafhængig kode, mens målet %s har absolut position" + +#: coff-arm.c:2291 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "FEJL: %s er kompileret som kode med absolut position, mens målet %s er positionsuafhængigt" + +#: coff-arm.c:2320 elf32-arm.h:2358 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "Advarsel: %s understøtter samvirken, mens %s derimod ikke gør det" + +#: coff-arm.c:2323 elf32-arm.h:2365 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "Advarsel: %s understøtter ikke samvirken, mens %s derimod gør det" + +#: coff-arm.c:2350 +#, c-format +msgid "private flags = %x:" +msgstr "private flag = %x:" + +#: coff-arm.c:2358 elf32-arm.h:2418 +msgid " [floats passed in float registers]" +msgstr " [flydende tal overført i flydendetalsregistre]" + +#: coff-arm.c:2360 +msgid " [floats passed in integer registers]" +msgstr " [flydende tal overført i heltalsregistre]" + +#: coff-arm.c:2363 elf32-arm.h:2421 +msgid " [position independent]" +msgstr " [positionsuafhængigt]" + +#: coff-arm.c:2365 +msgid " [absolute position]" +msgstr " [absolut position]" + +#: coff-arm.c:2369 +msgid " [interworking flag not initialised]" +msgstr " [samvirkendeflag er ikke initieret]" + +#: coff-arm.c:2371 +msgid " [interworking supported]" +msgstr " [samvirken understøttes]" + +#: coff-arm.c:2373 +msgid " [interworking not supported]" +msgstr " [samvirken understøttes ikke]" + +#: coff-arm.c:2421 elf32-arm.h:2124 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "Advarsel: Sætter ikke samvirkeflaget for %s da den allerede er angivet som ikke-samvirkende" + +#: coff-arm.c:2425 elf32-arm.h:2128 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "Advarsel: Fjerner samvirkeflaget for %s på grund af anmodning udefra" + +#: coff-i960.c:136 coff-i960.c:485 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "usikker kaldskonvention for ikke-COFF-symbol" + +#: coff-m68k.c:481 coff-mips.c:2429 elf32-m68k.c:2157 elf32-mips.c:1844 +msgid "unsupported reloc type" +msgstr "relokaliseringstypen understøttes ikke" + +#: coff-mips.c:874 elf32-mips.c:1062 elf64-mips.c:1609 +msgid "GP relative relocation when _gp not defined" +msgstr "GP-relativ relokalisering når _gp ikke var defineret" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2466 +msgid "reloc against unsupported section" +msgstr "relokalisering mod sektion som ikke understøttes" + +#: coff-mips.c:2474 +msgid "reloc not properly aligned" +msgstr "relokalisering ikke på lige grænse" + +#: coff-rs6000.c:2766 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: relokaliseringstypen 0x%02x understøttes ikke" + +#: coff-rs6000.c:2859 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: TOC-relokalisering ved 0x%x til symbolet \"%s\" uden nogen TOC-post" + +#: coff-rs6000.c:3590 coff64-rs6000.c:2091 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: symbolet \"%s\" har ukendt smclas %d" + +#: coff-tic54x.c:279 coff-tic80.c:449 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Ukendt relokaliseringstype 0x%x" + +#: coff-tic54x.c:390 coffcode.h:4974 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: advarsel: utilladt symbolindex %ld i relokaliseringerne" + +#: coff-w65.c:363 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "ignorerer relokalisering %s\n" + +#: coffcode.h:1086 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): Sektionsflaget %s (0x%x) ignoreredes" + +#: coffcode.h:2143 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "Ukendt TI COFF-mål-id \"0x%x\"" + +#: coffcode.h:4365 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: advarsel: utilladt symbolindex %ld i linjenummer" + +#: coffcode.h:4379 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: advarsel: dobbelt linjenummersinformation for \"%s\"" + +#: coffcode.h:4736 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: Ukendt lagringsklasse %d for %s-symbolet \"%s\"" + +#: coffcode.h:4867 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "advarsel: %s: lokalt symbol \"%s\" har ingen sektion" + +#: coffcode.h:5012 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: utilladt relokaliseringstype %d på adresse 0x%lx" + +#: coffgen.c:1661 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: fejlagtig strengtabelstørrelse %lu" + +#: cofflink.c:534 elflink.h:1912 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "Advarsel: typen på symbol \"%s\" ændredes fra %d til %d i %s" + +#: cofflink.c:2321 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: relokaliseringer i sektionen \"%s\", men den har intet indhold" + +#: cofflink.c:2664 coffswap.h:877 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: relokalisering giver overløb: 0x%lx > 0xffff" + +#: cofflink.c:2673 coffswap.h:864 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: advarsel: %s: linjenummer giver overløb: 0x%lx > 0xffff" + +#: dwarf2.c:382 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Dwarf-fejl: Kan ikke finde sektionen .debug_str." + +#: dwarf2.c:399 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "Dwarf-fejl: DW_FORM_strp-afstanden (%lu) større end eller lig med størrelsen på .debug_str (%lu)." + +#: dwarf2.c:543 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Dwarf-fejl: Kan ikke finde sektionen .debug_abbrev." + +#: dwarf2.c:560 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "Dwarf-fejl: Forkortningsafstanden (%lu) større end eller lig med størrelsen .debug_abbrev (%lu)." + +#: dwarf2.c:757 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Dwarf-fejl: Ugyldig eller ubehandlet FORM-værdi: %u." + +#: dwarf2.c:852 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Dwarf-fejl: vanskabt linjenummerssektion (fejlagtigt filnummer)." + +#: dwarf2.c:938 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Dwarf-fejl: Kan ikke finde sektionen .debug_line." + +#: dwarf2.c:961 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "Dwarf-fejl: Linjeafstanden (%lu) større end eller lig med størrelsen .debug_line (%lu)." + +#: dwarf2.c:1159 +msgid "Dwarf Error: mangled line number section." +msgstr "Dwarf-fejl: vanskabt linjenummerssektion." + +#: dwarf2.c:1355 dwarf2.c:1566 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Dwarf-fejl: Kunne ikke finde forkortningsnumret %u." + +#: dwarf2.c:1527 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Dwarf-fejl: fandt dwarf version \"%u\", denne læser håndterer kun information fra version 2." + +#: dwarf2.c:1534 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Dwarf-fejl: fandt adressestørrelsen \"%u\", denne læser kan ikke håndtere størrelser større end \"%u\"." + +#: dwarf2.c:1557 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Dwarf-fejl: Fejlagtigt forkortningsnummer: %u." + +#: ecoff.c:1318 +#, c-format +msgid "Unknown basic type %d" +msgstr "Ukendt grundtype %d" + +#: ecoff.c:1578 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Symbol slut+1: %ld" + +#: ecoff.c:1585 ecoff.c:1588 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" Første symbol: %ld" + +#: ecoff.c:1600 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Symbol slut+1: %-7ld Typ: %s" + +#: ecoff.c:1607 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Lokalt symbol: %ld" + +#: ecoff.c:1615 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; symbol slut+1: %ld" + +#: ecoff.c:1620 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" union; symbol slut+1: %ld" + +#: ecoff.c:1625 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; symbol slut+1: %ld" + +#: ecoff.c:1631 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Type: %s" + +#: elf-hppa.h:1476 elf-hppa.h:1509 elf32-ppc.c:3091 elf32-sh.c:4213 +#: elf64-sh64.c:1659 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: advarsel: uløselig relokalisering mod symbol \"%s\" fra sektionen %s" + +#: elf-m10200.c:446 elf-m10300.c:656 elf32-arm.h:2084 elf32-avr.c:833 +#: elf32-cris.c:1403 elf32-d10v.c:481 elf32-fr30.c:635 elf32-frv.c:809 +#: elf32-h8300.c:548 elf32-i860.c:1031 elf32-m32r.c:1278 elf32-openrisc.c:439 +#: elf32-v850.c:1691 elf32-xstormy16.c:933 elf64-mmix.c:1302 +msgid "internal error: out of range error" +msgstr "intern fejl: udenfor intervallet" + +#: elf-m10200.c:450 elf-m10300.c:660 elf32-arm.h:2088 elf32-avr.c:837 +#: elf32-cris.c:1407 elf32-d10v.c:485 elf32-fr30.c:639 elf32-frv.c:813 +#: elf32-h8300.c:552 elf32-i860.c:1035 elf32-m32r.c:1282 elf32-openrisc.c:443 +#: elf32-v850.c:1695 elf32-xstormy16.c:937 elf64-mmix.c:1306 elfxx-mips.c:5264 +msgid "internal error: unsupported relocation error" +msgstr "intern fejl: relokaliseringen understøttes ikke" + +#: elf-m10200.c:454 elf-m10300.c:664 elf32-arm.h:2092 elf32-d10v.c:489 +#: elf32-h8300.c:556 elf32-m32r.c:1286 +msgid "internal error: dangerous error" +msgstr "intern fejl: farlig fejl" + +#: elf-m10200.c:458 elf-m10300.c:668 elf32-arm.h:2096 elf32-avr.c:845 +#: elf32-cris.c:1415 elf32-d10v.c:493 elf32-fr30.c:647 elf32-frv.c:821 +#: elf32-h8300.c:560 elf32-i860.c:1043 elf32-m32r.c:1290 elf32-openrisc.c:451 +#: elf32-v850.c:1715 elf32-xstormy16.c:945 elf64-mmix.c:1314 +msgid "internal error: unknown error" +msgstr "intern fejl: ukendt fejl" + +#: elf.c:343 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: ugyldig strengafstand %u >= %lu for sektionen \"%s\"" + +#: elf.c:589 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: ugyldig SHT_GROUP-post" + +#: elf.c:660 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s: ingen gruppeinformation for sektionen %s" + +#: elf.c:1023 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"Programhoved:\n" + +#: elf.c:1073 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Dynamisk sektion:\n" + +#: elf.c:1202 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Versionsdefinitioner:\n" + +#: elf.c:1225 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Versionsreferencer:\n" + +#: elf.c:1230 +#, c-format +msgid " required from %s:\n" +msgstr " kræves fra %s:\n" + +#: elf.c:1902 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%s: ugyldig lænke %lu for relokaliseringssektion %s (index %u)" + +#: elf.c:3603 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: Ikke tilstrækkeligt med plads for programhoveder (allokerede %u, behøver %u)" + +#: elf.c:3708 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: Ikke tilstrækkeligt med plads for programhoveder, forsøg at lænke med -N" + +#: elf.c:3833 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Fejl: Første sektion i segmentet (%s) begynder ved 0x%x mens segmentet begynder ved 0x%x" + +#: elf.c:4148 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: advarsel: allokeret sektion \"%s\" ikke i segment" + +#: elf.c:4472 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: symbol \"%s\" kræves men er ikke tilstede" + +#: elf.c:4749 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: advarsel: Tomt indlæsningsbart segment opdaget, er dette meningen?\n" + +#: elf.c:6193 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: relokaliseringstypen %s understøttes ikke" + +#: elf32-arm.h:1221 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: Advarsel: Arm BLX-instruktion bruger Arm-funktionen \"%s\" som mål." + +#: elf32-arm.h:1417 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: Advarsel: Thumb BLX-instruktionen bruger thumb-funktionen \"%s\" som mål." + +#: elf32-arm.h:1914 elf32-sh.c:4125 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): %s relokalisering mod SEC_MERGE-sektion" + +#: elf32-arm.h:2008 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: advarsel: uløselig relokalisering %d mod symbol \"%s\" fra sektionen %s" + +#: elf32-arm.h:2176 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "Advarsel: Fjerner samvirkendeflaget i %s eftersom ikke-samvirkende kode i %s er lænket med det" + +#: elf32-arm.h:2271 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "FEJL: %s er kompileret for EABI version %d, mens %s er kompileret for version %d" + +#: elf32-arm.h:2285 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "FEJL: %s er kompileret for APCS-%d, mens målet %s bruger APCS-%d" + +#: elf32-arm.h:2313 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s uses FPA instructions" +msgstr "FEJL: %s bruger VFP-instruktioner, mens %s bruger FPA-instruktioner" + +#: elf32-arm.h:2318 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s uses VFP instructions" +msgstr "FEJL: %s bruger FPA-instruktioner, mens %s bruger VFP-instruktioner" + +#: elf32-arm.h:2338 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "FEJL: %s bruger programmeret flydende tal, mens %s bruger maskinens flydende tal" + +#: elf32-arm.h:2343 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "FEJL: %s bruger maskinens flydende tal, mens %s bruger programmeret flydende tal" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2396 elf32-cris.c:2988 elf32-m68k.c:410 elf32-vax.c:543 +#: elfxx-mips.c:7756 +#, c-format +msgid "private flags = %lx:" +msgstr "private flag = %lx:" + +#: elf32-arm.h:2405 +msgid " [interworking enabled]" +msgstr " [samvirkende er aktiveret]" + +#: elf32-arm.h:2413 +msgid " [VFP float format]" +msgstr " [VFP-flydende talsformat]" + +#: elf32-arm.h:2415 +msgid " [FPA float format]" +msgstr " [FPA-flydende talsformat]" + +#: elf32-arm.h:2424 +msgid " [new ABI]" +msgstr " [nyt ABI]" + +#: elf32-arm.h:2427 +msgid " [old ABI]" +msgstr " [gammelt ABI]" + +#: elf32-arm.h:2430 +msgid " [software FP]" +msgstr " [programmeret FP]" + +#: elf32-arm.h:2438 +msgid " [Version1 EABI]" +msgstr " [Version1 EABI]" + +#: elf32-arm.h:2441 elf32-arm.h:2452 +msgid " [sorted symbol table]" +msgstr " [sorteret symboltabel]" + +#: elf32-arm.h:2443 elf32-arm.h:2454 +msgid " [unsorted symbol table]" +msgstr " [usorteret symboltabel]" + +#: elf32-arm.h:2449 +msgid " [Version2 EABI]" +msgstr " [Version2 EABI]" + +#: elf32-arm.h:2457 +msgid " [dynamic symbols use segment index]" +msgstr " [dynamiske symboler bruger segmentindex]" + +#: elf32-arm.h:2460 +msgid " [mapping symbols precede others]" +msgstr " [mapningssymboler foretrækkes frem for andre]" + +#: elf32-arm.h:2467 +msgid " <EABI version unrecognised>" +msgstr " <EABI-version genkendes ikke>" + +#: elf32-arm.h:2474 +msgid " [relocatable executable]" +msgstr " [relokaliseringsbar kørbar fil]" + +#: elf32-arm.h:2477 +msgid " [has entry point]" +msgstr " [har startpunkt]" + +#: elf32-arm.h:2482 +msgid "<Unrecognised flag bits set>" +msgstr "<Ukendte flagbit er sat>" + +#: elf32-avr.c:841 elf32-cris.c:1411 elf32-fr30.c:643 elf32-frv.c:817 +#: elf32-i860.c:1039 elf32-openrisc.c:447 elf32-v850.c:1699 +#: elf32-xstormy16.c:941 elf64-mmix.c:1310 +msgid "internal error: dangerous relocation" +msgstr "intern fejl: farlig relokalisering" + +#: elf32-cris.c:949 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: uløselig relokalisering %s mod symbol \"%s\" fra sektionen %s" + +#: elf32-cris.c:1012 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s: Hverken nogen PLT eller GOT for relokalisering %s mod symbol \"%s\" fra sektionen %s" + +#: elf32-cris.c:1015 elf32-cris.c:1141 +msgid "[whose name is lost]" +msgstr "[hvis navn er tabt]" + +#: elf32-cris.c:1130 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "%s: relokalisering %s med ikke-tomt addendum %d mod lokalt symbol fra sektionen %s" + +#: elf32-cris.c:1137 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: relokalisering %s med ikke-tomt addendum %d mod symbol \"%s\" fra sektionen %s" + +#: elf32-cris.c:1155 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: relokaliseringen %s er ikke tilladt for globalt symbol: \"%s\" fra sektionen %s" + +#: elf32-cris.c:1170 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: relokalisering %s i sektionen %s uden GOT oprettet" + +#: elf32-cris.c:1288 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: Intern inkonsistens; ingen relokaliseringssektion %s" + +#: elf32-cris.c:2514 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, sektion %s:\n" +" relokaliseringen %s bør ikke bruges i et delt objekt; genoversæt med -fPIC" + +#: elf32-cris.c:2991 +msgid " [symbols have a _ prefix]" +msgstr " [symboler har et _-prefix]" + +#: elf32-cris.c:3030 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: bruger symboler med _-prefix, men skriver fil med symboler uden prefix" + +#: elf32-cris.c:3031 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: bruger symboler uden prefix, men skriver fil med symboler med _-prefix" + +#: elf32-frv.c:1217 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: kompileret med %s og lænket med moduler som bruger ikke-pic-relokalisering" + +#: elf32-frv.c:1267 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: kompileret med %s og lænket med moduler som kompileredes med %s" + +#: elf32-frv.c:1279 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: bruger andre ukendte e_flags-felter (0x%lx) end tidligere moduler (0x%lx)" + +#: elf32-frv.c:1315 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "private flag = 0x%lx:" + +#: elf32-gen.c:82 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: Relokalisering i generisk ELF (EM: %d)" + +#: elf32-hppa.c:671 elf64-ppc.c:2323 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: kan ikke oprette stubstarten %s" + +#: elf32-hppa.c:956 elf32-hppa.c:3555 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): kan ikke nå %s, genoversæt med -ffunction-sections" + +#: elf32-hppa.c:1338 elf64-x86-64.c:673 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relokaliseringen %s kan ikke bruges når et delt objekt oprettes; genoversæt med -fPIC" + +#: elf32-hppa.c:1358 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relokaliseringen %s bør ikke bruges når et delt objekt oprettes; genoversæt med -fPIC" + +#: elf32-hppa.c:1551 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "Kunne ikke finde relokaliseringssektion for %s" + +#: elf32-hppa.c:2855 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: dobbelt eksportstub %s" + +#: elf32-hppa.c:3433 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): retter %s" + +#: elf32-hppa.c:4080 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): kan ikke håndtere %s for %s" + +#: elf32-hppa.c:4393 +msgid ".got section not immediately after .plt section" +msgstr ".got-sektionen følger ikke umiddelbart efter .plt-sektion" + +#: elf32-i386.c:379 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: ugyldig relokaliseringstype %d" + +#: elf32-i386.c:876 elf32-s390.c:649 elf64-s390.c:595 elf64-x86-64.c:591 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: fejlagtigt symbolindex: %d" + +#: elf32-i386.c:948 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: \"%s\" kaldt både som lokalt normalt symbol og lokalt trådsymbol" + +#: elf32-i386.c:1072 elf32-s390.c:808 elf64-ppc.c:2827 elf64-s390.c:759 +#: elf64-x86-64.c:761 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: fejlagtig relokaliseringssektionsnavn \"%s\"" + +#: elf32-i386.c:1159 elf64-alpha.c:4768 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: lokal TLS-eksekveringskode kan ikke lænkes ind i delte objekter" + +#: elf32-i386.c:2747 elf32-s390.c:1981 elf32-sparc.c:1571 elf64-ppc.c:5918 +#: elf64-s390.c:1945 elf64-sparc.c:2578 elf64-x86-64.c:1948 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): uløselig relokalisering mod symbol \"%s\"" + +#: elf32-i386.c:2784 elf32-s390.c:2019 elf64-ppc.c:5977 elf64-s390.c:1983 +#: elf64-x86-64.c:1986 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): relokalisering mod \"%s\": fejl %d" + +#: elf32-m32r.c:924 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "SDA-relokalisering når _SDA_BASE_ ikke er defineret" + +#: elf32-ia64.c:3687 elf32-m32r.c:1013 elf32-ppc.c:2987 elf64-alpha.c:4185 +#: elf64-alpha.c:4313 elf64-ia64.c:3687 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: ukendt relokaliseringstype %d" + +#: elf32-m32r.c:1221 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: Målet (%s) for en %s-relokalisering er i forkert sektion (%s)" + +#: elf32-m32r.c:1947 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Instruktionsopsætning passer ikke med tidligere moduler" + +#: elf32-m32r.c:1970 +#, c-format +msgid "private flags = %lx" +msgstr "private flag = %lx" + +#: elf32-m32r.c:1975 +msgid ": m32r instructions" +msgstr ": m32r-instruktioner" + +#: elf32-m32r.c:1976 +msgid ": m32rx instructions" +msgstr ": m32rx-instruktioner" + +#: elf32-m68k.c:413 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:416 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:354 elf32-mcore.c:457 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: Relokalisering %s (%d) understøttes ikke i øjeblikket.\n" + +#: elf32-mcore.c:442 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: Ukendt relokaliseringstype %d\n" + +#: elf32-mips.c:1152 elf64-mips.c:1783 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "32-bit gp-relativ relokalisering forekom for et eksternt symbol" + +#: elf32-mips.c:1301 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "Lænkning af mips16-objekter til %s-format understøttes ikke" + +#: elf32-ppc.c:1460 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: kompileret med -mrelocatable og lænket med moduler som kompileredes normalt" + +#: elf32-ppc.c:1468 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: kompileret normalt og lænket med moduler som kompileredes med -mrelocatable" + +#: elf32-ppc.c:1494 elf64-sparc.c:2989 elfxx-mips.c:7713 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: bruger andre e_flags-felter (0x%lx) end tidligere moduler (0x%lx)" + +#: elf32-ppc.c:1592 +#, c-format +msgid "%s: Unknown special linker type %d" +msgstr "%s: Ukendt speciallænkertype %d" + +#: elf32-ppc.c:2273 elf32-ppc.c:2307 elf32-ppc.c:2342 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: relokaliseringen %s kan ikke bruges når et delt objekt oprettes" + +#: elf32-ppc.c:3126 elf64-ppc.c:5473 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: ukendt relokaliseringstype %d for symbol %s" + +#: elf32-ppc.c:3482 elf32-ppc.c:3503 elf32-ppc.c:3553 +#, c-format +msgid "%s: The target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: Målet (%s) for en %s-relokalisering er i forkert uddatasektion (%s)" + +#: elf32-ppc.c:3619 +#, c-format +msgid "%s: Relocation %s is not yet supported for symbol %s." +msgstr "%s: Relokaliseringen %s understøttes ikke endnu for symbol %s." + +#: elf32-sh.c:1964 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: advarsel: fejlagtig R_SH_USES-afstand" + +#: elf32-sh.c:1976 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: advarsel: R_SH_USES peger til ukendt instruktion 0x%x" + +#: elf32-sh.c:1993 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: advarsel: fejlagtig R_SH_USES-indlæsningsafstand" + +#: elf32-sh.c:2008 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: advarsel: kunne ikke finde forventet relokalisering" + +#: elf32-sh.c:2036 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: advarsel: symbol i uventet sektion" + +#: elf32-sh.c:2153 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: advarsel: kunne ikke finde forventet COUNT-relokalisering" + +#: elf32-sh.c:2162 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: advarsel: fejlagtigt antal" + +#: elf32-sh.c:2550 elf32-sh.c:2926 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: fatalt: relokalisering giver overløb ved forenklingen" + +#: elf32-sh.c:4073 elf64-sh64.c:1576 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "Uventet STO_SH5_ISA32 på lokalt symbol håndteres ikke" + +#: elf32-sh.c:4284 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: fatalt: ujusteret grenmål for relokalisering for forenklingsunderstøttelse" + +#: elf32-sh64.c:203 elf64-sh64.c:2364 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: kompileret som 32-bitsobjekt og %s er 64-bit" + +#: elf32-sh64.c:206 elf64-sh64.c:2367 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: kompileret som 64-bitsobjekt og %s er 32-bit" + +#: elf32-sh64.c:208 elf64-sh64.c:2369 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: objektstørrelsen stemmer ikke overens med den hos målet %s" + +#: elf32-sh64.c:440 elf64-sh64.c:2941 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: mødte dataetikettesymbol i inddata" + +#: elf32-sh64.c:523 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "PTB passer ikke: en SHmedia-adresse (bit 0 == 1)" + +#: elf32-sh64.c:526 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "PTA passer ikke: en SHcompact-adresse (bit 0 == 0)" + +#: elf32-sh64.c:544 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: GAS-fejl: uventet PTB-instruktion med R_SH_PT_16" + +#: elf32-sh64.c:593 elf64-sh64.c:1703 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%s: fejl: ojusteret relokaliseringstype %d på %08x relokalisering %08x\n" + +#: elf32-sh64.c:677 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: kunne ikke udskrive tilføjede .cranges-poster" + +#: elf32-sh64.c:739 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: kunne ikke udskrive sorterede cranges-poster" + +#: elf32-sparc.c:1535 elf64-sparc.c:2224 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: nok kompileret uden -fPIC?" + +#: elf32-sparc.c:2002 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: kompileret for et 64-bitssystem og målet er 32-bit" + +#: elf32-sparc.c:2016 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s: lænker little endian-filer med big endian-filer" + +#: elf32-v850.c:682 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "Variabel \"%s\" kan ikke befinde sig i flere små dataområder" + +#: elf32-v850.c:685 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "Variabel \"%s\" kan kun være i et af de små, tomme og bittesmå dataområder" + +#: elf32-v850.c:688 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "Variabel \"%s\" kan ikke være i både små og tomme dataområder samtidigt" + +#: elf32-v850.c:691 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "Variabel \"%s\" kan ikke være i både små og bittesmå dataområder samtidigt" + +#: elf32-v850.c:694 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "Variabel \"%s\" kan ikke være i både tomme og bittesmå dataområder samtidigt" + +#: elf32-v850.c:1072 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "MISLYKKEDES med at finde tidligere HI16-relokalisering\n" + +#: elf32-v850.c:1703 +msgid "could not locate special linker symbol __gp" +msgstr "kunne ikke lokalisere specielt lænkersymbol __gp" + +#: elf32-v850.c:1707 +msgid "could not locate special linker symbol __ep" +msgstr "kunne ikke lokalisere specielt lænkersymbol __ep" + +#: elf32-v850.c:1711 +msgid "could not locate special linker symbol __ctbp" +msgstr "kunne ikke lokalisere specielt lænkersymbol __ctbp" + +#: elf32-v850.c:1875 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: Arkitekturen passer ikke sammen med tidligere moduler" + +#: elf32-v850.c:1895 +#, c-format +msgid "private flags = %lx: " +msgstr "private flag = %lx: " + +#: elf32-v850.c:1900 +msgid "v850 architecture" +msgstr "v850-arkitektur" + +#: elf32-v850.c:1901 +msgid "v850e architecture" +msgstr "v850e-arkitektur" + +#: elf32-v850.c:1902 +msgid "v850ea architecture" +msgstr "v850ea-arkitektur" + +#: elf32-vax.c:546 +msgid " [nonpic]" +msgstr " [ikke-pic]" + +#: elf32-vax.c:549 +msgid " [d-float]" +msgstr " [d-flydende tal]" + +#: elf32-vax.c:552 +msgid " [g-float]" +msgstr " [g-flydende tal]" + +#: elf32-vax.c:674 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%s: advarsel: GOT-addendum %ld til \"%s\" stemmer ikke overens med tidligere GOT-addendum %ld" + +#: elf32-vax.c:1679 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%s: advarsel: PLT-addendum %d til \"%s\" fra sektionen %s ignoreredes" + +#: elf32-vax.c:1814 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%s: advarsel: %s-relokalisering mod symbol \"%s\" fra sektionen %s" + +#: elf32-vax.c:1820 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%s: advarsel: %s-relokalisering til 0x%x fra sektionen %s" + +#: elf32-ia64.c:2280 elf32-xstormy16.c:414 elf64-ia64.c:2280 +msgid "non-zero addend in @fptr reloc" +msgstr "ikke-tomt addendum i @fptr-relokalisering" + +#: elf64-alpha.c:1097 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "GPDISP-relokalisering fandt ingen ldah- og lda-instruktioner" + +#: elf64-alpha.c:3675 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: .got-subsegment overskrider 64 kB (størrelse %d)" + +#: elf64-alpha.c:4498 elf64-alpha.c:4510 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: gp-relativ relokalisering mod dynamisk symbol %s" + +#: elf64-alpha.c:4536 elf64-alpha.c:4676 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: pc-relativ relokalisering mod dynamisk symbol %s" + +#: elf64-alpha.c:4564 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: ændring i gp: BRSGP %s" + +#: elf64-alpha.c:4589 +msgid "<unknown>" +msgstr "<ukendt>" + +#: elf64-alpha.c:4594 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: !samegp-relokalisering mod symbol uden .prologue: %s" + +#: elf64-alpha.c:4639 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: uhåndteret dynamisk relokalisering mod %s" + +#: elf64-alpha.c:4752 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: dtp-relativ relokalisering mod dynamisk symbol %s" + +#: elf64-alpha.c:4775 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: tp-relativ relokalisering mod dynamisk symbol %s" + +#: elf64-hppa.c:2080 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "stubpost for %s kan ikke læse in .plt, dp-afstand = %ld" + +#: elf64-mmix.c:1002 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: Intern inkkonsistensfejl for værdien for\n" +" lænkerallokeret globalt register: lænket: 0x%lx%08lx != afslappet: 0x%lx%08lx\n" + +#: elf64-mmix.c:1386 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s: base-plus-afstandsrelokalisering mod registersymbol: (ukendt) i %s" + +#: elf64-mmix.c:1391 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%s: base-plus-afstandsrelokalisering mod registersymbol: %s i %s" + +#: elf64-mmix.c:1435 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s: registerrelokalisering mod ikke-registersymbol: (ukendt) i %s" + +#: elf64-mmix.c:1440 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s: registerrelokalisering mod ikke-registersymbol: %s i %s" + +#: elf64-mmix.c:1477 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: LOCAL-direktivet er kun gyldigt med et register eller en absolutværdi" + +#: elf64-mmix.c:1505 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s: LOCAL-direktiv: Register $%ld er ikke et lokalt register. Første globale register er $%ld." + +#: elf64-mmix.c:1965 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s: Fejl: flere definitioner af \"%s\"; begyndelsen på %s er sat i en tidligere lænket fil\n" + +#: elf64-mmix.c:2024 +msgid "Register section has contents\n" +msgstr "Registersektion har indhold\n" + +#: elf64-mmix.c:2186 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"Intern inkonsekvens: genstående %u != max %u.\n" +" Rapportér gerne denne fejl." + +#: elf64-ppc.c:1669 libbfd.c:1435 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s: kompileret for et big endian-system og målet er little endian" + +#: elf64-ppc.c:1671 libbfd.c:1437 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s: kompileret for et little endian-system og målet er big endian" + +#: elf64-ppc.c:3610 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: uventet relokaliseringstype %u i .opd-sektion" + +#: elf64-ppc.c:3630 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: .opd er ikke en almindelig vektor med opd-poster" + +#: elf64-ppc.c:3672 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: udefineret symbol \"%s\" i .opd-sektion" + +#: elf64-ppc.c:4397 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "kan ikke finde grenstub \"%s\"" + +#: elf64-ppc.c:4436 elf64-ppc.c:4501 +#, c-format +msgid "linkage table error against `%s'" +msgstr "lænketabelsfejl mod \"%s\"" + +#: elf64-ppc.c:4573 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "kan ikke bygge grenstub \"%s\"" + +#: elf64-ppc.c:5179 +msgid "stubs don't match calculated size" +msgstr "stubbe stemmer ikke overens med beregnet størrelse" + +#: elf64-ppc.c:5828 +#, c-format +msgid "%s: Relocation %s is not supported for symbol %s." +msgstr "%s: Relokaliseringen %s understøttes ikke for symbol %s." + +#: elf64-ppc.c:5872 +#, c-format +msgid "%s: error: relocation %s not a multiple of 4" +msgstr "%s: fejl: relokaliseringen %s er ikke en multipel af 4" + +#: elf64-sparc.c:1280 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: uhåndteret relokaliseringstype %d" + +#: elf64-sparc.c:1317 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: Kun register %%g[2367] kan deklareres med STT_REGISTER" + +#: elf64-sparc.c:1337 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "Register %%g%d brugt inkompatibelt: %s i %s, tidligere %s i %s" + +#: elf64-sparc.c:1360 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "Symbol \"%s\" har forskellige typer: REGISTER i %s, tidligere %s i %s" + +#: elf64-sparc.c:1406 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "Symbol \"%s\" har forskellige typer: %s i %s, tidligere REGISTER i %s" + +#: elf64-sparc.c:2970 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: lænker UltraSPARC-specifik med HAL-specifik kode" + +#: elfcode.h:1198 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: versionsantal (%ld) stemmer ikke med symbolantal (%ld)" + +#: elflink.c:440 +#, c-format +msgid "%s: Section %s is too large to add hole of %ld bytes" +msgstr "%s: Sektionen %s er for stor til at stoppa hul med %ld byte i" + +#: elflink.h:1090 +#, c-format +msgid "%s: warning: unexpected redefinition of `%s'" +msgstr "%s: advarsel: uventet omdefinition af \"%s\"" + +#: elflink.h:1727 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: ugyldig version %u (max %d)" + +#: elflink.h:1768 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: ugyldig krævet version %d" + +#: elflink.h:1890 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s" +msgstr "Advarsel: størrelsen på symbol \"%s\" ændredes fra %lu til %lu i %s" + +#: elflink.h:3174 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: .preinit_array-sektionen er ikke tilladt i DSO" + +#: elflink.h:4030 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "advarsel: typen og størrelsen på dynamisk symbol \"%s\" er ikke defineret" + +#: elflink.h:4345 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: udefineret symbolnavn med version %s" + +#: elflink.h:4611 elflink.h:4619 elflink.h:6508 elflink.h:7600 +msgid "Error: out of memory" +msgstr "Fejl: ikke mere hukommelse" + +#: elflink.h:4781 +msgid "Not enough memory to sort relocations" +msgstr "Ikke nok hukommelse til at sortere relokaliseringer" + +#: elflink.h:5682 elflink.h:5725 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: kunne ikke finde uddatasektionen %s" + +#: elflink.h:5688 +#, c-format +msgid "warning: %s section has zero size" +msgstr "advarsel: %s-sektionen har nulstørrelse" + +#: elflink.h:6275 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: kunne ikke finde uddatasektionen %s for inddatasektionen %s" + +#: elflink.h:6486 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%s: relokaliseringsstørrelsen stemmer ikke overens i %s-sektionen %s" + +#: elflink.h:6849 +msgid "warning: relocation against removed section; zeroing" +msgstr "advarsel: relokalisering mod fjernet sektion; nulstiller" + +#: elflink.h:6879 +msgid "warning: relocation against removed section" +msgstr "advarsel: relokalisering mod fjernet sektion" + +#: elflink.h:6892 +#, c-format +msgid "local symbols in discarded section %s" +msgstr "lokale symboler i bortkastet sektion %s" + +#: elfxx-mips.c:734 +msgid "static procedure (no name)" +msgstr "statisk procedure (intet navn)" + +#: elfxx-mips.c:1601 +msgid "not enough GOT space for local GOT entries" +msgstr "ikke nok med GOT-plads for lokale GOT-poster" + +#: elfxx-mips.c:2750 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: hop til stubrutine som ikke er jal" + +#: elfxx-mips.c:4270 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: Fejlagtig relokalisering for sektion %s opdaget" + +#: elfxx-mips.c:4348 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: CALL16-relokalisering ved 0x%lx er ikke mod globalt symbol" + +#: elfxx-mips.c:7301 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: ugyldigt sektionsnavn \"%s\"" + +#: elfxx-mips.c:7615 +#, c-format +msgid "%s: linking PIC files with non-PIC files" +msgstr "%s: lænker PIC-filer med ikke-PIC-filer" + +#: elfxx-mips.c:7625 +#, c-format +msgid "%s: linking abicalls files with non-abicalls files" +msgstr "%s: lænker abicalls-filer med ikke-abicalls-filer" + +#: elfxx-mips.c:7654 +#, c-format +msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +msgstr "%s: ISA (-mips%d) passer ikke med tidligere moduler (-mips%d)" + +#: elfxx-mips.c:7676 +#, c-format +msgid "%s: ISA mismatch (%d) with previous modules (%d)" +msgstr "%s: ISA (%d) passer ikke med tidligere moduler (%d)" + +#: elfxx-mips.c:7699 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: ABI passer ikke: lænker %s-modul med tidligere %s-moduler" + +#: elfxx-mips.c:7759 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:7761 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:7763 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:7765 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:7767 +msgid " [abi unknown]" +msgstr " [ukendt abi]" + +#: elfxx-mips.c:7769 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:7771 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:7773 +msgid " [no abi set]" +msgstr " [intet abi sat]" + +#: elfxx-mips.c:7776 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:7778 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:7780 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:7782 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:7784 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:7786 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:7788 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:7790 +msgid " [unknown ISA]" +msgstr " [ukendt ISA]" + +#: elfxx-mips.c:7793 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:7796 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:7799 +msgid " [32bitmode]" +msgstr " [32-bittilstand]" + +#: elfxx-mips.c:7801 +msgid " [not 32bitmode]" +msgstr " [ikke 32-bittilstand]" + +#: i386linux.c:458 m68klinux.c:462 sparclinux.c:459 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "Uddatafilen kræver delt bibliotek \"%s\"\n" + +#: i386linux.c:466 m68klinux.c:470 sparclinux.c:467 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Uddatafilen kræver delt bibliotek \"%s.so.%s\"\n" + +#: i386linux.c:655 i386linux.c:705 m68klinux.c:662 m68klinux.c:710 +#: sparclinux.c:657 sparclinux.c:707 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "Symbol %s er ikke defineret for rettelser\n" + +#: i386linux.c:729 m68klinux.c:734 sparclinux.c:731 +msgid "Warning: fixup count mismatch\n" +msgstr "Advarsel: antal rettelser stemmer ikke\n" + +#: ieee.c:235 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: strengen er for lang (%d tegn, max 65535)" + +#: ieee.c:365 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: ukendt symbol \"%s\" flag 0x%x" + +#: ieee.c:877 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: ikke implementeret ATI-post %u for symbol %u" + +#: ieee.c:902 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: uventet ATN-type %d i ekstern del" + +#: ieee.c:924 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: uventet type efter ATN" + +#: ihex.c:258 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: uventet tegn \"%s\" i hexadecimal Intel-fil\n" + +#: ihex.c:366 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%u: fejlagtig kontrolsum i hexadecimal Intel-fil (forventede %u, fandt %u)" + +#: ihex.c:420 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på post for udvidet adresse i hexadecimal Intel-fil" + +#: ihex.c:437 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på udvidet startadresse i hexadecimal Intel-fil" + +#: ihex.c:454 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på post for udvidet lineær adresse i hexadecimal Intel-fil" + +#: ihex.c:471 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på post for udvidet lineær startadresse i hexadecimal Intel-fil" + +#: ihex.c:488 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%u: ukendt ihex-type %u i hexadecimal Intel-fil\n" + +#: ihex.c:607 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: intern fejl i ihex_read_section" + +#: ihex.c:642 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: fejlagtig sektionslængde i ihex_read_sektion" + +#: ihex.c:860 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: adressen 0x%s er udenfor intervallet for hexadecimal Intel-fil" + +#: libbfd.c:492 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "mapper ikke: data=%lx mappet=%d\n" + +#: libbfd.c:495 +msgid "not mapping: env var not set\n" +msgstr "mapper ikke: miljøvariabel er ikke sat\n" + +#: libbfd.c:1466 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "Forældet %s kaldt ved %s linje %d i %s\n" + +#: libbfd.c:1469 +#, c-format +msgid "Deprecated %s called\n" +msgstr "Forældet %s kaldt\n" + +#: linker.c:1873 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%s: indirekte symbol \"%s\" til \"%s\" er en løkke" + +#: linker.c:2776 +#, c-format +msgid "Attempt to do relocateable link with %s input and %s output" +msgstr "Forsøg at lave en relokaliseringsbar lænke med %s-inddata og %s-uddata" + +#: merge.c:892 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: adgang udover slutningen på sammenslagt sektion (%ld + %ld)" + +#: mmo.c:460 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: Ingen kerne til at allokere sektionsnavn %s\n" + +#: mmo.c:536 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: Ingen kerne for at allokere et %d byte langt symbol\n" + +#: mmo.c:1245 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: ugyldig mmo-fil: initieringsværdi for $255 er ikke \"Main\"\n" + +#: mmo.c:1391 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "%s: bred tegnsekvens som ikke understøttes 0x%02X 0x%02X efter symbolnavnet som begynder med \"%s\"\n" + +#: mmo.c:1633 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: ugyldig mmo-fil: lopkod \"%d\" understøttes ikke\n" + +#: mmo.c:1643 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: ugyldig mmo-fil: forventede YZ = 1 fik YZ = %d for lop_quote\n" + +#: mmo.c:1679 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "%s: ugyldig mmo-fil: forventede z = 1 eller z = 2, fik z = %d for lop_loc\n" + +#: mmo.c:1725 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: ugyldig mmo-fil: forventede z = 1 eller z = 2, fik z = %d for lop_fixo\n" + +#: mmo.c:1764 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: ugyldig mmo-fil: forventede y = 0, fik y = %d for lop_fixrx\n" + +#: mmo.c:1773 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "%s: ugyldig mmo-fil: forventede z = 16 eller z = 24, fik z = %d for lop_fixr\n" + +#: mmo.c:1796 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "%s: ugyldig mmo-fil: indledende byte i operandord skal være 0 eller 1, fik %d for lop_fixrx\n" + +#: mmo.c:1819 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: kan ikke allokere filnavn for fil nummer %d, %d byte\n" + +#: mmo.c:1839 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: ugyldig mmo-fil: fil nummer %d \"%s\", var allerede angivet som \"%s\"\n" + +#: mmo.c:1852 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "%s: ugyldig mmo-fil: filnavnet for nummer %d blev ikke angivet inden brug\n" + +#: mmo.c:1958 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "%s: ugyldig mmo-fil: felter y og z i lop_stab er ikke-tomme, y: %d, z: %d\n" + +#: mmo.c:1994 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: ugyldig mmo-fil: lop_end er ikke sidste objekt i fil\n" + +#: mmo.c:2007 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "%s: ugyldig mmo-fil: YZ i lop_end (%ld) er ikke lig med antal af tetraer til den foregående lop_stab (%ld)\n" + +#: mmo.c:2670 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: ugyldig symboltabel: dubletsymbol \"%s\"\n" + +#: mmo.c:2921 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "%s: Fejlagtig symboldefinition: \"Main\" er sat til %s i stedet for startadressen %s\n" + +#: mmo.c:3011 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "%s: advarsel: symboltabellen er for stor for mmo, større end 65535 32-bit ord: %d. Kun \"Main\" vil blive sendt.\n" + +#: mmo.c:3056 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: intern fejl, symboltabellen ændrede størrelse fra %d til %d ord\n" + +#: mmo.c:3111 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: intern fejl, den interne registersektion %s havde indhold\n" + +#: mmo.c:3163 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: ingen initierede registre; sektionslængde 0\n" + +#: mmo.c:3169 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: for mange initierede registre; sektionslængde %ld\n" + +#: mmo.c:3174 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: ugyldig startadresse for initierede registre med længden %ld: 0x%lx%08lx\n" + +#: oasys.c:1029 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: kan ikke repræsentere sektionen \"%s\" i oasys" + +#: osf-core.c:132 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Uhåndteret sektionstype %d for OSF/1-hukommelsesfil\n" + +#: pe-mips.c:658 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: \"ld -r\" understøttes ikke med PE MIPS-objekt\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:794 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: uimplementeret %s\n" + +#: pe-mips.c:820 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: hop for langt bort\n" + +#: pe-mips.c:847 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: fejlagtigt par/reflo efter refhi\n" + +#. XXX code yet to be written. +#: peicode.h:785 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: Uhåndteret importtype; %x" + +#: peicode.h:790 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: Ukendt importtype; %x" + +#: peicode.h:804 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: Ukendt importnavnstype; %x" + +#: peicode.h:1162 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: Ukendt maskintype (0x%x) i Import Library Format-arkiv" + +#: peicode.h:1174 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: Kendt men uhåndteret maskintype (0x%x) i Import Library Format-arkiv" + +#: peicode.h:1191 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: størrelsesfeltet er nul i Import Library Format-hoved" + +#: peicode.h:1219 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: streng ikke nultermineret i ILF-objektfil." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"ppcboot-hoved:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Startafstand = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Længde = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Flagfelt = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Partitionsnavn = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Start på partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Slut på partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Sektor for partition[%d] = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Længde på partition[%d] = 0x%.8lx (%ld)\n" + +#: som.c:5398 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers er ikke implementeret" + +#: srec.c:301 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: Uventet tegn \"%s\" i S-postfil\n" + +# Vad er stabs? +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): Stabpost har ugyldigt strengindex." + +#: syms.c:1044 +msgid "Unsupported .stab relocation" +msgstr ".stab-relokalisering som ikke understøttes" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) mislykkedes" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) mislykkedes" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "Størrelsen passer ikke på sektion %s=%lx, %s=%lx" + +#: vms-gsd.c:702 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "ukendt gsd/egsd-undertype %d" + +#: vms-hdr.c:406 +msgid "Object module NOT error-free !\n" +msgstr "Objektmodulet IKKE fejlfri!\n" + +#: vms-misc.c:543 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "Stakken giver overløb (%d) i _bfd_vms_push" + +#: vms-misc.c:561 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "Stakken giver underløb i _bfd_vms_pop" + +#: vms-misc.c:919 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted kaldt med nul byte" + +#: vms-misc.c:924 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted called kaldt med for mange byte" + +#: vms-misc.c:1055 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "Symbol %s erstattet med %s\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "mislykkedes med at gå ind i %s" + +#: vms-tir.c:81 +msgid "No Mem !" +msgstr "Ingen hukommelse!" + +#: vms-tir.c:362 +#, c-format +msgid "bad section index in %s" +msgstr "fejlagtigt sektionsindex i %s" + +#: vms-tir.c:375 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "STA-kommando %s understøttes ikke" + +#: vms-tir.c:380 vms-tir.c:1240 +#, c-format +msgid "reserved STA cmd %d" +msgstr "reserveret STA-kommando %d" + +#: vms-tir.c:491 vms-tir.c:514 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: intet symbol \"%s\"" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:581 vms-tir.c:693 vms-tir.c:803 vms-tir.c:821 vms-tir.c:829 +#: vms-tir.c:838 vms-tir.c:1563 +#, c-format +msgid "%s: not supported" +msgstr "%s: understøttes ikke" + +#: vms-tir.c:586 vms-tir.c:1418 +#, c-format +msgid "%s: not implemented" +msgstr "%s: ikke implementeret" + +#: vms-tir.c:590 vms-tir.c:1422 +#, c-format +msgid "reserved STO cmd %d" +msgstr "reserveret STO-kommando %d" + +#: vms-tir.c:708 vms-tir.c:1568 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "reserveret OPR-kommando %d" + +#: vms-tir.c:776 vms-tir.c:1632 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "reserveret CTL-kommando %d" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1148 +msgid "stack-from-image not implemented" +msgstr "stack-from-image er ikke implementeret" + +#: vms-tir.c:1166 +msgid "stack-entry-mask not fully implemented" +msgstr "stack-entry-mask er ikke helt implementeret" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1180 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH er ikke helt implementeret" + +#: vms-tir.c:1199 +msgid "stack-local-symbol not fully implemented" +msgstr "stack-local-symbol er ikke helt implementeret" + +#: vms-tir.c:1212 +msgid "stack-literal not fully implemented" +msgstr "stack-literal er ikke helt implementeret" + +#: vms-tir.c:1233 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "stack-local-symbol-entry-point-mask er ikke helt implementeret" + +#: vms-tir.c:1510 vms-tir.c:1522 vms-tir.c:1534 vms-tir.c:1546 vms-tir.c:1611 +#: vms-tir.c:1619 vms-tir.c:1627 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: ikke helt implementeret" + +#: vms-tir.c:1684 +#, c-format +msgid "obj code %d not found" +msgstr "objektkode %d kunne ikke findes" + +#: vms-tir.c:2019 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC uden relokaliseringer i sektion %s" + +#: vms-tir.c:2307 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Uhåndteret relokalisering %s" + +#: xcofflink.c:1243 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: \"%s\" har linjenumre men ingen omsluttende sektion" + +#: xcofflink.c:1296 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: klasse %d-symbol \"%s\" har ingen ydre poster" + +#: xcofflink.c:1319 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: symbol \"%s\" har ukendt csect-type %d" + +#: xcofflink.c:1331 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: fejlagtig XTY_ER-symbol \"%s\": klasse %d scnum %d scnlen %d" + +#: xcofflink.c:1367 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: XMC_TC0-symbol \"%s\" er klasse %d scnlen %d" + +#: xcofflink.c:1519 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect \"%s\" er ikke i omsluttende sektion" + +#: xcofflink.c:1626 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: fejlagtigt placeret XTY_LD \"%s\"" + +#: xcofflink.c:1957 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: relokaliseringen %s:%d er ikke i csect" + +#: xcofflink.c:2092 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: XCOFF delt objekt når ikke XCOFF-uddata produceres" + +#: xcofflink.c:2113 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: dynamisk objekt uden nogen .loader-sektion" + +#: xcofflink.c:2758 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: intet sådant symbol" + +#: xcofflink.c:2891 +msgid "error: undefined symbol __rtinit" +msgstr "fejl: udefineret symbol __rtinit" + +#: xcofflink.c:3453 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "advarsel: forsøg på at eksportere udefineret symbol \"%s\"" + +#: xcofflink.c:4447 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "TOC giver overløb: 0x%lx > 0x10000; prøv -mminimal-toc ved kompilering" + +#: xcofflink.c:5287 xcofflink.c:5756 xcofflink.c:5818 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: indlæserrelokalisering i ukendt sektion \"%s\"" + +#: xcofflink.c:5309 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: \"%s\" i indlæserrelokalisering men ikke indlæsersym" + +#: xcofflink.c:5324 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: indlæserrelokalisering i skrivebeskyttet sektion %s" + +#: elf32-ia64.c:2222 elf64-ia64.c:2222 +msgid "@pltoff reloc against local symbol" +msgstr "@pltoff-relokalisering mod lokalt symbol" + +#: elf32-ia64.c:3562 elf64-ia64.c:3562 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: kort datasegment løb over (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3573 elf64-ia64.c:3573 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp dækker ikke kort datasegment" + +#: elf32-ia64.c:3858 elf64-ia64.c:3858 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: lænker ikke-pic-kode i delt bibliotek" + +#: elf32-ia64.c:3891 elf64-ia64.c:3891 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: @gprel-relokalisering mod dynamisk symbol %s" + +#: elf32-ia64.c:4030 elf64-ia64.c:4030 +#, c-format +msgid "%s: dynamic relocation against speculation fixup" +msgstr "%s: dynamisk relokalisering uden spekulationsrettelser" + +#: elf32-ia64.c:4038 elf64-ia64.c:4038 +#, c-format +msgid "%s: speculation fixup against undefined weak symbol" +msgstr "%s: spekulationsfix mod udefineret svagt symbol" + +#: elf32-ia64.c:4271 elf64-ia64.c:4271 +msgid "unsupported reloc" +msgstr "relokaliseringen understøttes ikke" + +#: elf32-ia64.c:4551 elf64-ia64.c:4551 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: lænker fang-ved-NULL-dereference med ikkefangende filer" + +#: elf32-ia64.c:4560 elf64-ia64.c:4560 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s: lænker big endian-filer med little endian-filer" + +#: elf32-ia64.c:4569 elf64-ia64.c:4569 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: lænker 64-bitfiler med 32-bitfiler" + +#: elf32-ia64.c:4578 elf64-ia64.c:4578 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: lænker konstant-gp-filer med ikke-konstant-gp-filer" + +#: elf32-ia64.c:4588 elf64-ia64.c:4588 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: lænker auto-pic-filer med ikke-auto-pic-filer" + +#: peigen.c:962 pepigen.c:962 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: linjenummer giver overløb: 0x%lx > 0xffff" + +#: peigen.c:979 pepigen.c:979 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: relokalisering giver overløb 1: 0x%lx > 0xffff" + +#: peigen.c:993 pepigen.c:993 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Exportkatalog [.edata (eller hvor vi fandt det)]" + +#: peigen.c:994 pepigen.c:994 +msgid "Import Directory [parts of .idata]" +msgstr "Importkatalog [dele af .idata]" + +#: peigen.c:995 pepigen.c:995 +msgid "Resource Directory [.rsrc]" +msgstr "Resursekatalog [.rsrc]" + +#: peigen.c:996 pepigen.c:996 +msgid "Exception Directory [.pdata]" +msgstr "Undtagelseskatalog [.pdata]" + +#: peigen.c:997 pepigen.c:997 +msgid "Security Directory" +msgstr "Sikkerhedskatalog" + +#: peigen.c:998 pepigen.c:998 +msgid "Base Relocation Directory [.reloc]" +msgstr "Baserelokaliseringskatalog [.reloc]" + +#: peigen.c:999 pepigen.c:999 +msgid "Debug Directory" +msgstr "Fejlsøgningskatalog" + +#: peigen.c:1000 pepigen.c:1000 +msgid "Description Directory" +msgstr "Beskrivelseskatalog" + +#: peigen.c:1001 pepigen.c:1001 +msgid "Special Directory" +msgstr "Specialkatalog" + +#: peigen.c:1002 pepigen.c:1002 +msgid "Thread Storage Directory [.tls]" +msgstr "Trådlagringskatalog [.tls]" + +#: peigen.c:1003 pepigen.c:1003 +msgid "Load Configuration Directory" +msgstr "Indlæsningskonfigurationskatalog" + +#: peigen.c:1004 pepigen.c:1004 +msgid "Bound Import Directory" +msgstr "Katalog over bundne importer" + +#: peigen.c:1005 pepigen.c:1005 +msgid "Import Address Table Directory" +msgstr "Importadressetabelkatalog" + +#: peigen.c:1006 pepigen.c:1006 +msgid "Delay Import Directory" +msgstr "Katalog over forskinkede importer" + +#: peigen.c:1007 peigen.c:1008 pepigen.c:1007 pepigen.c:1008 +msgid "Reserved" +msgstr "Reserveret" + +#: peigen.c:1071 pepigen.c:1071 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Der findes en importtabel, men sektionen som indeholder den kunne ikke findes\n" + +#: peigen.c:1076 pepigen.c:1076 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"Der findes en importtabel i %s på 0x%lx\n" + +#: peigen.c:1113 pepigen.c:1113 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"Funktionsidentifikatorer fundet på startadressen: %04lx\n" + +#: peigen.c:1116 pepigen.c:1116 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tkodebase %08lx toc (indlæsningsbar/reelt) %08lx/%08lx\n" + +#: peigen.c:1122 pepigen.c:1122 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"Ingen reldata-sektion! Funktionsidentifikatorer afkodedes ikke.\n" + +#: peigen.c:1127 pepigen.c:1127 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Importtabellerne (tolket indhold i %s-sektion)\n" + +# Vad er thunk? +#: peigen.c:1130 pepigen.c:1130 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: Tips- Tids- Fremad- DLL- Første\n" +" tabel stempel kæde navn thunk\n" + +#: peigen.c:1181 pepigen.c:1181 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tDLL-navn: %s\n" + +#: peigen.c:1192 pepigen.c:1192 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: Tips/Ordn Medlemsnavn Bundet till\n" + +#: peigen.c:1217 pepigen.c:1217 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Der findes en første thunk, men sektionen som indeholder den kunne ikke findes\n" + +#: peigen.c:1357 pepigen.c:1357 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Der findes en eksporttabel, men sektionen som indeholder den kunne ikke findes\n" + +#: peigen.c:1362 pepigen.c:1362 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"Det findes en eksporttabel i %s ved 0x%lx\n" + +#: peigen.c:1393 pepigen.c:1393 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Eksporttabellerne (tolket indhold i %s-sektion)\n" + +#: peigen.c:1397 pepigen.c:1397 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Eksportflag \t\t\t%lx\n" + +#: peigen.c:1400 pepigen.c:1400 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "Tids/datostempel \t\t%lx\n" + +#: peigen.c:1403 pepigen.c:1403 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Større/mindre \t\t\t%d/%d\n" + +#: peigen.c:1406 pepigen.c:1406 +msgid "Name \t\t\t\t" +msgstr "Navn \t\t\t\t" + +#: peigen.c:1412 pepigen.c:1412 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "Ordningsbase \t\t\t%ld\n" + +#: peigen.c:1415 pepigen.c:1415 +msgid "Number in:\n" +msgstr "Tal i:\n" + +#: peigen.c:1418 pepigen.c:1418 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tEksportadressetabel \t\t%08lx\n" + +#: peigen.c:1422 pepigen.c:1422 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\t[Navnepeger/Ordningstal]-tabel\t%08lx\n" + +#: peigen.c:1425 pepigen.c:1425 +msgid "Table Addresses\n" +msgstr "Tabeladresser\n" + +#: peigen.c:1428 pepigen.c:1428 +msgid "\tExport Address Table \t\t" +msgstr "\tEksportadressetabel \t\t" + +#: peigen.c:1433 pepigen.c:1433 +msgid "\tName Pointer Table \t\t" +msgstr "\tNavnepegertabel \t\t" + +#: peigen.c:1438 pepigen.c:1438 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tOrdningstalstabel \t\t\t" + +#: peigen.c:1453 pepigen.c:1453 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Eksportadressetabel -- Ordningsbase %ld\n" + +#: peigen.c:1472 pepigen.c:1472 +msgid "Forwarder RVA" +msgstr "Videresender-RVA" + +#: peigen.c:1483 pepigen.c:1483 +msgid "Export RVA" +msgstr "Eksport-RVA" + +#: peigen.c:1490 pepigen.c:1490 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"[Ordningstals-/Navnepeger-]tabel\n" + +#: peigen.c:1545 pepigen.c:1545 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "Advarsel, størrelsen på .pdata-sektionen (%ld) er ikke en multipel af %d\n" + +#: peigen.c:1549 pepigen.c:1549 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"Funktionstabellen (tolket indhold fra .pdata-sektionen)\n" + +#: peigen.c:1552 pepigen.c:1552 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tStartadresse Slutadresse Tilbagespolings-information\n" + +#: peigen.c:1554 pepigen.c:1554 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tStart- Slut- EH- EH- Prologsluts- Undtagelses-\n" +" \t\tadresse adresse håndterere data adresse maske\n" + +#: peigen.c:1624 pepigen.c:1624 +msgid " Register save millicode" +msgstr " Registergemnings millikode" + +#: peigen.c:1627 pepigen.c:1627 +msgid " Register restore millicode" +msgstr " Registergenskabnings millikode" + +#: peigen.c:1630 pepigen.c:1630 +msgid " Glue code sequence" +msgstr " Klisterkodesekvens" + +#: peigen.c:1682 pepigen.c:1682 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"PE-filbaserelokaliseringer (tolket indhold i .reloc-sektionen)\n" + +#: peigen.c:1712 pepigen.c:1712 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Virtuel adresse: %08lx Områdesstørrelse %ld (0x%lx) Antal rettelser %ld\n" + +#: peigen.c:1725 pepigen.c:1725 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\trelokalisering %4d afstand %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1765 pepigen.c:1765 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Karakteristik 0x%x\n" diff --git a/bfd/reloc.c b/bfd/reloc.c index e60c26e0512..71f17402be0 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2123,6 +2123,12 @@ ENUMX ENUMX BFD_RELOC_386_GOTPC ENUMX + BFD_RELOC_386_TLS_TPOFF +ENUMX + BFD_RELOC_386_TLS_IE +ENUMX + BFD_RELOC_386_TLS_GOTIE +ENUMX BFD_RELOC_386_TLS_LE ENUMX BFD_RELOC_386_TLS_GD @@ -2159,6 +2165,22 @@ ENUMX BFD_RELOC_X86_64_GOTPCREL ENUMX BFD_RELOC_X86_64_32S +ENUMX + BFD_RELOC_X86_64_DTPMOD64 +ENUMX + BFD_RELOC_X86_64_DTPOFF64 +ENUMX + BFD_RELOC_X86_64_TPOFF64 +ENUMX + BFD_RELOC_X86_64_TLSGD +ENUMX + BFD_RELOC_X86_64_TLSLD +ENUMX + BFD_RELOC_X86_64_DTPOFF32 +ENUMX + BFD_RELOC_X86_64_GOTTPOFF +ENUMX + BFD_RELOC_X86_64_TPOFF32 ENUMDOC x86-64/elf relocations diff --git a/bfd/targets.c b/bfd/targets.c index 8d893eb2575..b9be8e7535f 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -520,6 +520,7 @@ extern const bfd_target bfd_elf32_h8300_vec; extern const bfd_target bfd_elf32_hppa_linux_vec; extern const bfd_target bfd_elf32_hppa_vec; extern const bfd_target bfd_elf32_i370_vec; +extern const bfd_target bfd_elf32_i386_freebsd_vec; extern const bfd_target bfd_elf32_i386_vec; extern const bfd_target bfd_elf32_i386qnx_vec; extern const bfd_target bfd_elf32_i860_little_vec; @@ -575,6 +576,7 @@ extern const bfd_target bfd_elf32_us_cris_vec; extern const bfd_target bfd_elf32_v850_vec; extern const bfd_target bfd_elf32_vax_vec; extern const bfd_target bfd_elf32_xstormy16_vec; +extern const bfd_target bfd_elf64_alpha_freebsd_vec; extern const bfd_target bfd_elf64_alpha_vec; extern const bfd_target bfd_elf64_big_generic_vec; extern const bfd_target bfd_elf64_bigmips_vec; @@ -798,6 +800,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_hppa_linux_vec, &bfd_elf32_hppa_vec, &bfd_elf32_i370_vec, + &bfd_elf32_i386_freebsd_vec, &bfd_elf32_i386_vec, &bfd_elf32_i386qnx_vec, &bfd_elf32_i860_little_vec, @@ -857,6 +860,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_vax_vec, &bfd_elf32_xstormy16_vec, #ifdef BFD64 + &bfd_elf64_alpha_freebsd_vec, &bfd_elf64_alpha_vec, &bfd_elf64_big_generic_vec, &bfd_elf64_bigmips_vec, diff --git a/bfd/version.h b/bfd/version.h index d2a49164f98..6a77c2a2dcd 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1 +1 @@ -#define BFD_VERSION_DATE 20020829 +#define BFD_VERSION_DATE 20020930 diff --git a/config.guess b/config.guess index c5438deabca..181f0a2b4f5 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-08-23' +timestamp='2002-09-12' # 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 @@ -446,6 +446,9 @@ EOF Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:*:*:PowerMAX_OS) echo powerpc-harris-powermax exit 0 ;; @@ -1108,7 +1111,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) diff --git a/config.sub b/config.sub index b0222f7ea0b..2a55e05cd66 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-08-22' +timestamp='2002-09-12' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -229,7 +229,7 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ + | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ @@ -294,7 +294,7 @@ case $basic_machine in | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ @@ -329,7 +329,7 @@ case $basic_machine in | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ @@ -913,6 +913,10 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff @@ -1047,10 +1051,6 @@ case $basic_machine in pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; diff --git a/configure b/configure index 339b23d3e7e..ec9bebf5020 100755 --- a/configure +++ b/configure @@ -1356,8 +1356,7 @@ EOF rm -f ${subdir}/Makefile.tm2 sedtemp=sed.$$ cat >$sedtemp <<EOF -s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}: -s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}: +s:@configdirs@:${configdirs}: EOF sed -f $sedtemp \ ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2 @@ -1365,21 +1364,21 @@ EOF rm -f ${subdir}/Makefile.tem mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem fi - sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \ - -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \ - -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \ - -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \ - -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \ - -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \ - -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \ - -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \ - -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \ - -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \ - -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \ - -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \ - -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \ - -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \ - -e "s|^ALL_BUILD_MODULES =.*|ALL_BUILD_MODULES =${all_build_modules}|" \ + sed -e "s|@prefix@|${prefix}|" \ + -e "s|@exec_prefix@|${exec_prefix}|" \ + -e "s|@bindir@|${bindir}|" \ + -e "s|@sbindir@|${sbindir}|" \ + -e "s|@libexecdir@|${libexecdir}|" \ + -e "s|@datadir@|${datadir}|" \ + -e "s|@sysconfdir@|${sysconfdir}|" \ + -e "s|@sharedstatedir@|${sharedstatedir}|" \ + -e "s|@localstatedir@|${localstatedir}|" \ + -e "s|@libdir@|${libdir}|" \ + -e "s|@includedir@|${includedir}|" \ + -e "s|@oldincludedir@|${oldincludedir}|" \ + -e "s|@infodir@|${infodir}|" \ + -e "s|@mandir@|${mandir}|" \ + -e "s|@all_build_modules@|${all_build_modules}|" \ -e "/^CC[ ]*=/{ :loop1 /\\\\$/ N @@ -1408,20 +1407,18 @@ EOF t loop4 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}% }" \ - -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \ - -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \ + -e "s|@config_shell@|${config_shell}|" \ + -e "s|@srcdir@|${makesrcdir}|" \ -e "s///" \ - -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \ - -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \ - -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \ - -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \ - -e "s|^build_tooldir[ ]*=.*$|build_tooldir = ${tooldir}|" \ - -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \ - -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \ - -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \ + -e "s:@program_transform_name@:${program_transform_name}:" \ + -e "s|@tooldir@|${tooldir}|" \ + -e "s|@build_tooldir@|${tooldir}|" \ + -e "s:@DEFAULT_YACC@:${DEFAULT_YACC}:" \ + -e "s:@DEFAULT_LEX@:${DEFAULT_LEX}:" \ + -e "s:@DEFAULT_M4@:${DEFAULT_M4}:" \ ${subdir}/Makefile.tem >> ${Makefile} - sed -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem + sed -e "s:@GDB_TK@:${GDB_TK}:" ${Makefile} >${Makefile}.tem mv -f ${Makefile}.tem ${Makefile} # If this is a Canadian Cross, preset the values of many more diff --git a/configure.in b/configure.in index a945dcb2432..3041dd4a7c4 100644 --- a/configure.in +++ b/configure.in @@ -80,22 +80,6 @@ target_tools="target-examples target-groff target-gperf" ################################################################################ -## These two lists are of directories that are to be removed from the -## ${configdirs} list for either cross-compilations or for native- -## compilations. For example, it doesn't make that much sense to -## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in -## a native environment. - -# directories to be built in the native environment only -# -# This must be a single line because of the way it is searched by grep in -# the code below. -native_only="autoconf automake libtool fileutils find gawk gettext grep gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms snavigator gnuserv target-gperf" - -# directories to be built in a cross environment only -# -cross_only="target-libgloss target-newlib target-opcodes" - ## All tools belong in one of the four categories, and are assigned above ## We assign ${configdirs} this way to remove all embedded newlines. This ## is important because configure will choke if they ever get through. @@ -184,8 +168,12 @@ case ${with_x} in esac # Some tools are only suitable for building in a "native" situation. -# Remove these if host!=target. Similarly, some are only suitable -# for cross toolchains; remove if host=target. +# Remove these if host!=target. +native_only="autoconf automake libtool fileutils find gawk gettext grep gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms snavigator gnuserv target-gperf" + +# Similarly, some are only suitable for cross toolchains. +# Remove these if host=target. +cross_only="target-libgloss target-newlib target-opcodes" case $is_cross_compiler in no) skipdirs="${skipdirs} ${cross_only}" ;; @@ -277,7 +265,7 @@ case "${target}" in ;; *-*-netbsd*) # Skip some stuff on all NetBSD configurations. - skipdirs="$skipdirs target-newlib target-libiberty target-libgloss" + noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss" # Skip some stuff that's unsupported on some NetBSD configurations. case "${target}" in @@ -333,7 +321,7 @@ case "${target}" in noconfigdirs="$noconfigdirs expect dejagnu" # the C++ libraries don't build on top of CE's C libraries noconfigdirs="$noconfigdirs ${libstdcxx_version}" - skipdirs="$skipdirs target-newlib" + noconfigdirs="$noconfigdirs target-newlib" case "${host}" in *-*-cygwin*) ;; # keep gdb and readline *) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}" @@ -343,6 +331,12 @@ case "${target}" in arc-*-*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; + arm-*-coff | strongarm-*-coff | xscale-*-coff) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; + arm-*-elf* | strongarm-*-elf* | xscale-*-elf*) + noconfigdirs="$noconfigdirs target-libffi target-qthreads" + ;; arm-*-pe*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; @@ -358,18 +352,6 @@ case "${target}" in thumb-*-oabi) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; - strongarm-*-elf) - noconfigdirs="$noconfigdirs ${libgcj}" - ;; - strongarm-*-coff) - noconfigdirs="$noconfigdirs ${libgcj}" - ;; - xscale-*-elf) - noconfigdirs="$noconfigdirs target-libffi target-qthreads" - ;; - xscale-*-coff) - noconfigdirs="$noconfigdirs ${libgcj}" - ;; thumb-*-pe) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; @@ -539,6 +521,9 @@ case "${target}" in powerpc-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" ;; + powerpc-*-darwin*) + noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb tk itcl tix libgui gprof ${libgcj}" + ;; powerpc-*-eabi) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -755,8 +740,7 @@ for dir in . $skipdirs $noconfigdirs ; do dirname=`echo $dir | sed -e s/target-//g` if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"` - if test -r $srcdir/$dirname/configure \ - || test -r $srcdir/$dirname/configure.in ; then + if test -r $srcdir/$dirname/configure ; then if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then true else @@ -766,8 +750,7 @@ for dir in . $skipdirs $noconfigdirs ; do fi if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"` - if test -r $srcdir/$dirname/configure \ - || test -r $srcdir/$dirname/configure.in ; then + if test -r $srcdir/$dirname/configure ; then if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then true else @@ -783,7 +766,7 @@ if test -n "${target_configdirs}" ; then others= for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do if test "$i" != "libiberty" ; then - if test -r $srcdir/$i/configure || test -r $srcdir/$i/configure.in ; then + if test -r $srcdir/$i/configure ; then others=yes; break; fi @@ -876,36 +859,41 @@ esac copy_dirs= -# Handle --with-headers=XXX. The contents of the named directory are -# copied to $(tooldir)/sys-include. +# Handle --with-headers=XXX. If the value is not "yes", the contents of +# the named directory are copied to $(tooldir)/sys-include. if test x"${with_headers}" != x ; then if test x${is_cross_compiler} = xno ; then echo 1>&2 '***' --with-headers is only supported when cross compiling exit 1 fi - case "${exec_prefixoption}" in - "") x=${prefix} ;; - *) x=${exec_prefix} ;; - esac - copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include" + if test x"${with_headers}" != xyes ; then + case "${exec_prefixoption}" in + "") x=${prefix} ;; + *) x=${exec_prefix} ;; + esac + copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include" + fi fi -# Handle --with-libs=XXX. Multiple directories are permitted. The -# contents are copied to $(tooldir)/lib. +# Handle --with-libs=XXX. If the value is not "yes", the contents of +# the name directories are copied to $(tooldir)/lib. Multiple directories +# are permitted. if test x"${with_libs}" != x ; then if test x${is_cross_compiler} = xno ; then echo 1>&2 '***' --with-libs is only supported when cross compiling exit 1 fi - # Copy the libraries in reverse order, so that files in the first named - # library override files in subsequent libraries. - case "${exec_prefixoption}" in - "") x=${prefix} ;; - *) x=${exec_prefix} ;; - esac - for l in ${with_libs}; do - copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}" - done + if test x"${with_libs}" != xyes ; then + # Copy the libraries in reverse order, so that files in the first named + # library override files in subsequent libraries. + case "${exec_prefixoption}" in + "") x=${prefix} ;; + *) x=${exec_prefix} ;; + esac + for l in ${with_libs}; do + copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}" + done + fi fi # Handle ${copy_dirs} @@ -1127,25 +1115,6 @@ if test -n "${host_makefile_frag}" ; then host_makefile_frag=mh-frag fi -# If we aren't going to be using gcc, see if we can extract a definition -# of CC from the fragment. -# Actually, use the 'pre-extracted' version above. -if test -z "${CC}" && test "${build}" = "${host}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - found= - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc; then - found=yes - break - fi - done - IFS="$save_ifs" - if test -z "${found}" && test -n "${tentative_cc}" ; then - CC=$tentative_cc - fi -fi - case "${target}" in v810*) target_makefile_frag="config/mt-v810" @@ -1282,6 +1251,25 @@ case "${host}" in ;; esac +# If we aren't going to be using gcc, see if we can extract a definition +# of CC from the fragment. +# Actually, use the 'pre-extracted' version above. +if test -z "${CC}" && test "${build}" = "${host}" ; then + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + found= + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc; then + found=yes + break + fi + done + IFS="$save_ifs" + if test -z "${found}" && test -n "${tentative_cc}" ; then + CC=$tentative_cc + fi +fi + # post-target: # Make sure that the compiler is able to generate an executable. If it @@ -1551,17 +1539,17 @@ qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'` sedtemp=sed.$$ cat >$sedtemp <<EOF -s:^TARGET_CONFIGDIRS[ ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}: -s%^TARGET_CONFIGARGS[ ]*=.*$%TARGET_CONFIGARGS = ${targargs}% -s%^FLAGS_FOR_TARGET[ ]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}% -s%^CC_FOR_TARGET[ ]*=.*$%CC_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}% -s%^GCJ_FOR_TARGET[ ]*=.*$%GCJ_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}% -s%^CXX_FOR_TARGET[ ]*=.*$%CXX_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}% -s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[ ]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = \$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}% -s%^TARGET_SUBDIR[ ]*=.*$%TARGET_SUBDIR = ${target_subdir}% -s%^BUILD_SUBDIR[ ]*=.*$%BUILD_SUBDIR = ${build_subdir}% -s%^BUILD_CONFIGARGS[ ]*=.*$%BUILD_CONFIGARGS = ${buildargs}% -s%^gxx_include_dir[ ]*=.*$%gxx_include_dir=${gxx_include_dir}% +s:@target_configdirs@:${target_configdirs}: +s%@target_configargs@%${targargs}% +s%@FLAGS_FOR_TARGET@%${FLAGS_FOR_TARGET}% +s%@CC_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}% +s%@GCJ_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}% +s%@CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}% +s%@CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}% +s%@target_subdir@%${target_subdir}% +s%@build_subdir@%${build_subdir}% +s%@build_configargs@%${buildargs}% +s%@gxx_include_dir@%${gxx_include_dir}% EOF sed -f $sedtemp Makefile > Makefile.tem rm -f Makefile $sedtemp diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 66da24de954..cce4699d220 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -182,6 +182,951 @@ (mi_execute_command): Don't print the prompt if the command return is MI_CMD_QUIET. +2002-09-30 Keith Seitz <keiths@redhat.com> + + * gdb-events.sh (selected_thread_changed): New event. + * gdb-events.c: Regenerated. + * gdb-events.h: Regenerated. + +2002-09-30 Hans-Peter Nilsson <hp@bitrange.com> + + * MAINTAINERS: Add self to Write After Approval list. + +2002-09-30 Fernando Nasser <fnasser@redhat.com> + + * disasm.c: New file. + * disasm.h: New file. + * mi/mi-cmd-disas.c (gdb_dis_asm_read_memory): Moved to disasm.c. + (compare_lines): Ditto. + (dump_insns): Ditto. + (do_mixed_source_and_assembly): Moved to disasm.c. Added uiout argument. + (do_assembly_only): Ditto. + (do_disassembly): Renamed to gdb_disassembly and moved to disasm.c. + Sdded uiout argument. + * Makefile.in: Add new files. Reorder SFILES list. Update dependencies. + Include libgdb.a later in the insight executable. + +2002-09-29 Andrew Cagney <ac131313@redhat.com> + + * config/djgpp/fnchange.lst: Rename bfd/elf64-alpha.c and + bfd/elf64-alpha-fbsd.c. + +2002-09-29 Andrew Cagney <ac131313@redhat.com> + + * config/djgpp/fnchange.lst: Rename i386gnu-nat.c and + i386gnu-tdep.c. + +2002-09-29 Andrew Cagney <ac131313@redhat.com> + + * gnu-nat.h (debug): Use __FILE__ and __LINE__ instead of + __FUNCTION__. + * gnu-nat.c (do_mach_notify_no_senders): Replace __FUNCTION__ with + function name. + (do_mach_notify_port_deleted, do_mach_notify_msg_accepted): Ditto. + (do_mach_notify_port_destroyed, do_mach_notify_send_once): Ditto. + (S_proc_setmsgport_reply, S_proc_getmsgport_reply): Ditto. + (S_msg_sig_post_reply): Ditto. + +2002-09-28 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_use_struct_convention): Use definition according + to ABI. + (sh_push_arguments): Store in register with correct endianess. + (sh_default_store_return_value): Ditto. + (sh_gdbarch_init): Set sizeof long double to 8. + +2002-09-27 Mark Kettenis <kettenis@gnu.org> + + * defs.h: Move inclusion of "ansidecl.h" before "gdb_locale.h". + Fix some whitespace problems. + +2002-09-27 David Carlton <carlton@math.stanford.edu> + + * Makefile.in (cris-tdep.o): Depend on gdb_string_h. + (mcore-tdep.o): Ditto. + (ns32k-tdep.o): Ditto. + (ns32knbsd-tdep.o): Ditto. + (sh3-rom.o): Ditto. + (vax-tdep.o): Ditto. + * cris-tdep.c: #include "gdb_string.h" + * mcore-tdep.c: Ditto. + * ns32k-tdep.c: Ditto. + * ns32knbsd-tdep.c: Ditto. + * sh3-rom.c: Ditto. + * vax-tdep.c: Ditto. + +2002-09-27 David Carlton <carlton@math.stanford.edu> + + * config/djgpp/fnchange.lst: Add entries for + gdb/testsuite/gdb.c++/m-static files. + +2002-09-27 Jim Wilson <wilson@redhat.com> + + * MAINTAINERS: Add myself to the Write After Approval list. + +2002-09-26 Martin M. Hunt <hunt@redhat.com> + + * mips-tdep.c (find_proc_desc): Initialize startaddr. + + +2002-09-26 Andrew Cagney <ac131313@redhat.com> + + * rs6000-tdep.c (rs6000_frame_chain): Don't chain past the dummy + frame. + +2002-09-26 Andrew Cagney <ac131313@redhat.com> + + * rs6000-tdep.c (rs6000_extract_struct_value_address): Return 0. + (rs6000_struct_return_address): Delete variable. + (rs6000_store_struct_return): Update. + (rs6000_gdbarch_init): Set extract_struct_value_address instead of + deprecated_extract_struct_value_address. + (rs6000_frame_align): New function. + (rs6000_gdbarch_init): Set frame_align. + +2002-09-26 Andrew Cagney <ac131313@redhat.com> + + From Grace Sainsbury <graces@redhat.com>: + * Makefile.in (gdbtk-main.o): New target. + (gdb.o): New target. + (main_h): Define. + (main.o): Update dependencies. + (gdb$(EXEEXT)): Add gdb.o. + (SUBDIR_GDBTK_SRCS): Add gdbtk-main.c. + (SUBDIR_GDBTK_ALL, SUBDIR_GDBTK_UNINSTALL): Set. + (SUBDIR_GDBTK_CLEAN): Set. + (install-gdbtk): Install the insight binary. + (uninstall-gdbtk): New target. + (all-gdbtk, clean-gdbtk): New rule. + * top.c (use_windows): Default to zero. + * main.c: Include "main.h". + (main): Delete. + (struct captured_main_args): Delete. + (gdb_main): New function. + * main.h: New file. + * gdb.c: New File. + +2002-09-25 Andrew Cagney <cagney@redhat.com> + + * frame.c: Include "gdb_string.h" and "builtin-regs.h". + (frame_map_regnum_to_name): New function. + (frame_map_name_to_regnum): New function. + * frame.h (frame_map_name_to_regnum): Declare. + (frame_map_regnum_to_name): Declare. + * builtin-regs.c (builtin_reg_map_regnum_to_name): New function. + * builtin-regs.h (builtin_reg_map_regnum_to_name): Declare. + * parse.c: Do not include "builtin-regs.h". + (target_map_name_to_register): Delete function. + (write_dollar_variable): Use frame_map_name_to_regnum. + * parser-defs.h (target_map_name_to_register): Delete declaration. + * expprint.c: Include "frame.h". + (print_subexp): Use frame_map_regnum_to_name. + * eval.c (evaluate_subexp_standard): Use frame_map_regnum_to_name. + * infcmd.c (registers_info): Use frame_map_name_to_regnum. + +2002-09-25 Andrew Cagney <ac131313@redhat.com> + + * rs6000-tdep.c (rs6000_frame_saved_pc): If the link register + wasn't saved, and the next innermost frame is a dummy, return the + dummy frame's link register. + +2002-09-24 Jim Blandy <jimb@redhat.com> + + Fix from Paul Breed: + * main.c (captured_main): Add a `break' after the case for 'b'. + +2002-09-24 Keith Seitz <keiths@redhat.com> + + * varobj.c (c_type_of_child): Use get_target_type instead + of TYPE_TARGET_TYPE. + +2002-09-22 Fernando Nasser <fnasser@redhat.com> + + * source.c (get_current_or_default_source_symtab_and_line): Remove + function. + (set_default_source_symtab_and_line): New function. Attempts to + determine a source file to list lines from if one is not currently + defined. + (get_current_source_symtab_and_line): Initialize sal.pc and + sal.end fields. + (set_current_source_symtab_and_line): Mark argument as const. + * source.h: Update declarations and comments. + * linespec.c (decode_line_1): Replace call to removed routine above. + * stack.c (print_frame_info_base): Ditto. + * cli/cli-cmds.c (edit_command): Ditto. + (list_command): Ditto. + +2002-09-22 Fernando Nasser <fnasser@redhat.com> + + * source.c (get_current__or_default_source_symtab_and_line): Initialize + sal.pc and sal.end fields. + (get_current_or_default_source_symtab_and_line): Ditto. + * breakpoint.c (parse_breakpoint_sals): Use correct accessor function + so we do not cause a new source symtab to be searched for (reverting an + unintentional change from the 2002-09-20 patch). + * scm-lang.c (scm_unpac): Ditto. + +2002-09-21 Andrew Cagney <cagney@redhat.com> + + * complaints.c (symfile_explanations): Remove new-line from + ``isolated_message''. + (vcomplaint): When ISOLATED_MESSAGE, force a line break. + (clear_complaints): When a SUBSEQUENT_MESSAGE, force a line break. + +2002-09-20 Nick Clifton <nickc@redhat.com> + + * NEWS: Announce that V850EA ISA is no longer supported. + * v850-tdep.c: Remove reference to bfd_mach_v850ea. + +2002-09-20 David Carlton <carlton@math.stanford.edu> + + * Makefile.in (c-lang.o): Correct dependencies. + (utils.o): Gather dependencies. + (charset.o): Move. + * c-lang.c: #include "gdb_string.h" + +2002-09-20 Fernando Nasser <fnasser@redhat.com> + + From 2002-07-02 George Helffrich <george@gly.bris.ac.uk> + * cli/cli-cmds.c (list_command): New function. Implements the new + cli edit command. + (_init_cli_cmds): Add new command definition. + * gdb.1: Document edit command. + * doc/gdb.texinfo: Document edit command. + +2002-09-20 Fernando Nasser <fnasser@redhat.com> + + * source.c: Make global variables current_source_symtab and + current_source_line static. + (list_command): Moved to cli/cli-cmds.c. + (ambiguous_line_spec): Moved to cli/cli-cmds.c. + (get_first_line_listed): New accessor function. + (get_lines_to_list): New accessor function. + (get_current_source_symtab_and_line): New function. Retrieves the + position in the source code that we consider current. + (get_current_or_default_source_symtab_and_line): New function. + Like the above but attempts to determine a default position if one + is not currently defined. + (set_current_source_symtab_and_line): New function. Sets the source + code position considered current and returns the previously set one. + (clear_current_source_symtab_and_line): Reset stored information about + a current source line. + (_initialize_source): Remove registration for the "list" command and + its alias. + * source.h: Add declarations for the new functions above. + * symtab.h: Remove declarations for the global variables mentioned + above. + * breakpoint.c (parse_breakpoint_sals): Use accessor functions to + obtain current source line. + * linespec.c (decode_line_1): Ditto. + * macroscope.c (default_macro_scope): Ditto. + * scm-lang.c (scm_unpac): Ditto. + * stack.c (print_frame_info_base): Ditto. + * symfile.c (clear_symtab_users): Ditto. + * symtab.c (decode_line_spec): Ditto. + * cli/cli-cmds.c (list_command): Moved here from source.c. + (ambiguous_line_spec): Moved here from source.c. + (_init_cli_cmds): Add definition for "list" and its alias. + * Makefile.in: Update dependencies. + +2002-09-20 Corinna Vinschen <vinschen@redhat.com> + + * h8300-tdep.c (h8300_examine_prologue): Match saved regs location + with what gcc thinks is correct. + +2002-09-20 Corinna Vinschen <vinschen@redhat.com> + + * h8300-tdep.c (h8300_examine_prologue): Fix loop for saved regs in + multiple register push instruction. + +2002-09-19 Jim Blandy <jimb@redhat.com> + + Add support for distinct host and target character sets. + * charset.c, charset.h: New files. + * c-exp.y: #include "charset.h". + (yylex): Convert character and string literals to the target + character set, before returning them as the semantic value of the + token. + * c-lang.c: #include "charset.h". + (c_emit_char): Use charset-specific methods to recognize + characters with backslash escape forms, to decide which characters + to print literally and which to print using numeric escape + sequences, and to convert target characters to host characters + before printing. + * utils.c: #include "charset.h". + (no_control_char_error): New function. + (parse_escape): Use charset-specific methods to recognize + backslash escapes, parse `control character' notation, and convert + characters from the host character set to the target character set. + * configure.in: Set the default host character set. + Check where to find iconv, and what its argument types might be. + * acinclude.m4 (AM_ICONV): New macro, borrowed from GCC. + * Makefile.in (SFILES): List charset.c. + (COMMON_OBS): List charset.o. + (charset.o): New rule. + (charset_h): New header dependency variable. + (c-lang.o, utils.o, c-exp.tab.o): Note dependency on $(charset_h). + (LIBICONV): New variable, set by configure. + (CLIBS): Include $(LIBICONV) here. + * aclocal.m4, config.in, configure: Regenerated. + +2002-09-19 Joel Brobecker <brobecker@gnat.com> + + * ada-exp.y: Add missing semicolons to end rules. Fixes a + bison 1.35 warning. + +2002-09-19 Richard Earnshaw <rearnsha@arm.com> + + * gdb_mbuild.sh: New file. + +2002-09-19 Andrew Cagney <ac131313@redhat.com> + + * objc-exp.y, objc-lang.h, objc-lang.c: Fix copyright notice. + +2002-09-18 Andrew Cagney <ac131313@redhat.com> + + * breakpoint.c, c-exp.y, defs.h, elfread.c, expression.h, + jv-exp.y, language.c, language.h, p-exp.y, parse.c, parser-defs.h, + printcmd.c, source.c, stabsread.c, symfile.c, symtab.h, utils.c, + valops.c, value.h: Revert previous change. + +2002-09-18 Michael Snyder <msnyder@redhat.com> + + Preliminary support for Objective-C: + * defs.h (language_objc): New enum value. + (puts_filtered_tabular): Declaration only, exported from utils.c. + (skip_quoted): Delete, declared in completer.h. + * c-exp.y: Include completer.h. + * p-exp.y: Ditto. + * jv-exp.y: Ditto. + * expression.h (OP_MSGCALL, OP_SELECTOR, OP_SELF, OP_NSSTRING): + New operator enum values. + * language.h (CAST_IS_CONVERSION): Test for language_objc. + * language.c (binop_result_type): Handle language_objc case. + (integral_type, character_type, string_type, boolean_type, + structured_type, binop_type_check): Ditto. + * symtab.h (SYMBOL_OBJC_DEMANGLED_NAME): Define. + (struct objc_specific): Add to general_symbol_info. + (SYMBOL_INIT_LANGUAGE_SPECIFIC): Add objc initialization. + (SYMBOL_DEMANGLED_NAME): Handle objc case. + * parser-defs.h (struct objc_class_str): New struct type. + (start_msglist, end_msglist, add_msglist): Declaration only, + exported from objc-lang.c. + * value.h (value_of_local, value_nsstring, + call_function_by_hand_expecting_type): Exported from valops.c. + * valops.c (find_function_addr): Export. + (call_function_by_hand_expecting_type): New function. + (value_of_local): New function. + * symfile.c (init_filename_language_table): Add ".m" extension + for Objective-C. + * utils.c (puts_filtered_tabular): New function. + (fprintf_symbol_filtered): Add objc demangling support (disabled). + (set/show demangle): Extend help-string to refer to ObjC. + * elfread.c (elf_symtab_read): Skip Objective-C special symbols. + * stabsread.c (symbol_reference_defined): Objective-C symbols + may contain colons: make allowances when scanning stabs strings + for colons. + (objc_find_colon): New function. + * printcmd.c (address_info): If language == objc then print + "self" instead of "this". + * parse.c (length_of_subexp): Handle new operators OP_MSGCALL, + OP_NSSTRING, and OP_SELF. + (prefixify_subexp): Ditto. + * source.c (print_source_lines): Mention objc in comment. + * breakpoint.c (parse_breakpoint_sals): Recognize Objective-C + method names. + +2002-09-18 Andrew Cagney <ac131313@redhat.com> + + * complaints.h: Update copyright. + (struct complaints): Declare. + (struct complaint): Make `message' constant. + (internal_complaint): Declare. + (complaint): Declare. + (complaint_root): Delete declaration. + (symfile_complaints): Delete declaration. + (struct complaints): Add opaque declaration. + (clear_complaints): Add a complaints parameter. + * complaints.c: Update copyright. + (enum complaint_series): Define. + (complaint_root): Delete. + (struct complaints): Define. + (complaint_sentinel, symfile_complaint_book): New variables. + (symfile_explanations, symfile_complaints): New variables. + New variables. + (get_complaints): New function. + (vcomplaint): New function. + (complaint): New function. + (internal_complaint): New function. + (complain): Call vcomplain with symfile_complaint. + (clear_complaints): Rewrite. + (_initialize_complaints): Use add_setshow_command. + * Makefile.in (complaints.o): Update dependencies. + * symfile.c (syms_from_objfile): Add symfile_complaints parameter + to call to clear_complaints. + (new_symfile_objfile, reread_symbols): Ditto. + (oldsyms_complaint): Delete. + (empty_symtab_complaint, unknown_option_complaint): Delete. + (free_named_symtabs): Use complaint instead of complain. + +2002-09-18 Michael Snyder <msnyder@redhat.com> + + Contributed by Apple Computer, Inc. Merged with current sources + by Adam Fedor <fedor@doc.com> [cagney]. + + * objc-lang.c: First clean-up round: comments, indentation. + * objc-lang.h: Ditto. + * objc-lang.y: Ditto. + +2002-09-18 Andrew Cagney <ac131313@redhat.com> + + * maint.c (maintenance_internal_error): Print the parameter as the + error message. + (maintenance_internal_warning): New function. + (_initialize_maint_cmds): Add command `maint internal-warning'. + + * defs.h (internal_warning, internal_vwarning): Declare. + * utils.c (struct internal_problem): Define. + (internal_vproblem): New function. + (internal_warning): New function. + (internal_vwarning): New function. + (internal_warning_problem, internal_error_problem): New variables. + (internal_verror): Just call internal_vproblem. + +2002-09-18 Michael Snyder <msnyder@redhat.com> + + * objc-lang.c: New file, support for Objective-C. + Preliminary check-in, not yet integrated into gdb. + * objc-lang.h: New file. + * objc-exp.y: New file. + +2002-09-18 Andrew Cagney <ac131313@redhat.com> + + * infrun.c (signal_stop_update): Convert definition to ISO C. + (signal_print_update): Ditto. + (signal_pass_update): Ditto. + * inflow.c (terminal_save_ours): Ditto. + + * h8300-tdep.c (h8300_gdbarch_init): Use C instead of C++ + comments. + + * config/djgpp/fnchange.lst: Handle name clashes between + bfd/coff-tic30.c, bfd/coff-tic4x.c, bfd/coff-tic54x.c and + bfd/coff-tic80.c. + + * i386-linux-tdep.h: Fix tipo. + +2002-09-18 Adam Fedor <fedor@gnu.org> + + * MAINTAINERS: Add myself to the Write After Approval list. + +2002-09-18 Jim Blandy <jimb@redhat.com> + + * dbxread.c, mdebugread.c: Revert my change of 2001-10-23. Moving + texthigh and textlow to reader-specific structs caused + objfile_relocate to miss them. This is fixable, but the work that + the change was supposed to prepare GDB for never got done anyway. + +2002-09-18 David Carlton <carlton@math.stanford.edu> + + * MAINTAINERS: Alphabetize Write After Approval list. + +2002-09-18 Daniel Jacobowitz <drow@mvista.com> + + Fix PR gdb/709 + * values.c (value_static_field): Call read_var_value. + +2002-09-18 Andrew Cagney <ac131313@redhat.com> + + * valops.c (hand_function_call): Align the initial stack pointer + and STRUCT_ADDR using frame_align. When STRUCT_RETURN and + FRAME_ALIGN_P, use STRUCT_ADDR to obtain the called function's + return value. + * mips-tdep.c (mips_frame_align): New function. + (mips_gdbarch_init): Set frame_align. + * gdbarch.sh (FRAME_ALIGN): New method. + * gdbarch.h, gdbarch.c: Re-generate. + +2002-09-18 Michal Ludvig <mludvig@suse.cz> + + * x86-64-linux-nat.c (x86_64_regmap): Added CS and SS + registers. + +2002-09-17 Andrew Cagney <ac131313@redhat.com> + + * NEWS: Mention that MIPS $fp behavior changed. + * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register): Delete + reference to FP_REGNUM. + (mipsnbsd_cannot_store_register): Ditto. + * mips-linux-nat.c: Update copyright. + (mips_linux_cannot_fetch_register): Delete reference to FP_REGNUM. + (mips_linux_cannot_store_register): Ditto. + * mips-linux-tdep.c (supply_gregset): Ditto. Update copyright. + * config/mips/tm-mips.h: Update copyright. + (FP_REGNUM): Delete macro. + (MIPS_REGISTER_NAMES): Replace "fp" with "". + * config/mips/tm-irix6.h (FP_REGNUM): Delete macro. + * mips-tdep.c (mips_gdbarch_init): Set read_fp to mips_read_sp. + (mips_r3041_reg_names, mips_r3051_reg_names) + (mips_r3081_reg_names): Replace "fp" with "". + Fix PR gdb/480. + +2002-09-17 Theodore A. Roth <troth@verinet.com> + + * gdb/avr-tdep.c(avr_scan_prologue): Fix bad call to + generic_read_register_dummy() (PR gdb/703). + (avr_push_return_address): #if 0 out unused vars. + (avr_gdbarch_init): Enable use of avr_push_return_address(). + +2002-09-17 Michael Snyder <msnyder@redhat.com> + + * m32r-stub.c (restore_and_return): Postpone restoring of PSW. + RTE will take care of it. + +2002-09-17 Andrew Cagney <ac131313@redhat.com> + + * arch-utils.c (legacy_virtual_frame_pointer): If FP_REGNUM is + invalid, return SP_REGNUM. + +2002-09-17 Michael Snyder <msnyder@redhat.com> + + * mips-tdep.c (mips_pop_frame): Read saved values of floating + point registers without sign extension. + +2002-09-17 Andrew Cagney <cagney@redhat.com> + + * blockframe.c (deprecated_read_register_dummy): Rename + generic_read_register_dummy. + * frame.c (frame_unwind_signed_register): New function. + (frame_unwind_unsigned_register): New function. + * frame.h (frame_unwind_signed_register): Declare. + (frame_unwind_unsigned_register): Declare. + (deprecated_read_register_dummy): Rename + generic_read_register_dummy. + + * h8300-tdep.c (h8300_frame_chain): Update. + (h8300_frame_saved_pc): Update. + * xstormy16-tdep.c (xstormy16_frame_saved_pc): Update. + * rs6000-tdep.c (rs6000_frame_saved_pc): Update. + * s390-tdep.c (s390_frame_saved_pc_nofix): Update. + (s390_frame_chain): Update. + * v850-tdep.c (v850_find_callers_reg): Update. + (v850_frame_saved_pc): Update. + * m32r-tdep.c (m32r_init_extra_frame_info): Update. + (m32r_find_callers_reg): Update. + (m32r_frame_saved_pc): Update. + * sh-tdep.c (sh_find_callers_reg): Update. + (sh64_get_saved_pr): Update. + (sh_init_extra_frame_info): Update. + (sh_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + * mcore-tdep.c (mcore_find_callers_reg): Update. + (mcore_frame_saved_pc): Update. + (mcore_init_extra_frame_info): Update. + * i386-tdep.c (i386_frame_saved_pc): Update. + * ia64-tdep.c (ia64_frame_saved_pc): Update. + (ia64_init_extra_frame_info): Update. + (ia64_init_extra_frame_info): Update. + * d10v-tdep.c (d10v_frame_saved_pc): Update. + * cris-tdep.c (cris_init_extra_frame_info): Update. + * avr-tdep.c (avr_frame_chain): Update. + (avr_init_extra_frame_info): Update. + (avr_frame_saved_pc): Update. + * arm-tdep.c (arm_find_callers_reg): Update. + (arm_init_extra_frame_info): Update. + (arm_frame_saved_pc): Update. + +2002-09-17 Tom Tromey <tromey@redhat.com> + + * c-lang.c (c_emit_char): Don't treat \0 specially unless quoter + is "'". + +2002-09-17 Corinna Vinschen <vinschen@redhat.com> + + * MAINTAINERS: Remove "non multi-arched" text from h8300. + * h8300-tdep.c (h8300_next_prologue_insn) Renamed from + NEXT_PROLOGUE_INSN. + (h8300_examine_prologue): Call h8300_next_prologue_insn instead of + NEXT_PROLOGUE_INSN. + +2002-09-16 Joel Brobecker <brobecker@gnat.com> + + * osfsolib.c: Remove file, replaced by solib-osf.c. + * Makefile.in: Remove compilation rules for osfsolib.c. + +2002-09-16 David Carlton <carlton@math.stanford.edu> + + * cp-valprint.c (cp_print_class_method): Correct args to + check_stub_method_group. + +2002-09-16 Corinna Vinschen <vinschen@redhat.com> + + * h8300-tdep.c: Multiarch. Drop `set machine' command in favor of + `set architecture'. Unify naming convention of functions. + (h8300_skip_prologue): Improve prologue analysis. + (h8300_push_arguments): Rewritten to more closely match GCC's + bizarre argument-passing behavior, along with the comment describing + said behavior. + * remote-hms.c (hms_regnames): Don't use NUM_REGS in definition. + * config/h8300/tm-h8300.h: Multiarch. Just keep stuff needed by + sim, remote-e7000.c, remote-hms.c and remote.c + +2002-09-15 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (gdb_print_insn_i386): Removed. + (i386_print_insn): New function. + (i386_gdbarch_init): Set print_insn to i386_print_insns. + (_initialize_i386_tdep): Don't initialize tm_print_insn and + tm_print_insn_info. + +2002-09-14 Mark Kettenis <kettenis@gnu.org> + + * gdbtypes.c (check_stub_method_group): Initialize found_stub to + zero. + +2002-09-14 Corinna Vinschen <vinschen@redhat.com> + + * arch-utils.c (legacy_pc_in_sigtramp): Move preprocessor expression + for IN_SIGTRAMP to here. Use IN_SIGTRAMP only if it's defined. + Guard usage of SIGTRAMP_START() by using SIGTRAMP_START_P. + +2002-09-13 Christopher Faylor <cgf@redhat.com> + + * win32-nat.c (child_create_inferior): Honor 'tty' command. + +2002-09-13 Daniel Jacobowitz <drow@mvista.com> + + * gdbtypes.c (check_stub_method): Make static. + (check_stub_method_group): New function. + * gdbtypes.h: Update prototypes. + * cp-support.c: New file. + * cp-support.h: New file. + + * stabsread.c: Include "cp-abi.h" and "cp-support.h". + (update_method_name_from_physname): New function. + (read_member_functions): Correct method names for operators + and v3 constructors/destructors. Separate v2 constructors and + destructors. + * Makefile.in (stabsread.o): Update dependencies. + (SFILES): Add cp-support.c. + (COMMON_OBS): Add cp-support.o. + (cp_support_h, cp-support.o): Add. + + * cp-valprint.c (cp_print_class_method): Call + check_stub_method_group instead of check_stub_method. Remove + extraneous QUITs. + * p-valprint.c (pascal_object_print_class_method): Likewise. + * valops.c (search_struct_method): Likewise. + (find_method_list, value_struct_elt_for_reference): Likewise. + +2002-09-13 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (SIGTRAMP_END): Change to a predicate function. + * gdbarch.h, gdbarch.c: Regenerate. + +2002-09-13 Andrew Cagney <ac131313@redhat.com> + + * frame.c (find_saved_register): Delete function. + * frame.h (find_saved_register): Delete declaration. + Fix PR gdb/631. + +Fri Sep 13 14:59:55 2002 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (read_next_frame_reg): Re-hack using + frame_register_unwind. + +Fri Sep 13 07:42:09 2002 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_get_saved_register): Re-hack using + frame_register_unwind. + +2002-09-12 Joel Brobecker <brobecker@gnat.com> + + * gdbarch.sh (NAME_OF_MALLOC): New variable in the architecture + vector. Will be useful for Interix. + * gdbarch.h, gdbarch.c: Regenerate. + + * valops.c (value_allocate_space_in_inferior): Replace hard-coded + name of the malloc function by NAME_OF_MALLOC. + +2002-09-12 Joel Brobecker <brobecker@gnat.com> + + * value.h (find_function_in_inferior): Add const keyword to + one of the parameters. Allows us to invoke this function with + a const char *. + * valops.c (find_function_in_inferior): Likewise. + +2002-09-12 Joel Brobecker <brobecker@gnat.com> + + * exec.c (xfer_memory): Fix compilation warning with old versions + of GCC. + * tracepoint.c (trace_find_tracepoint_command): Likewise. + +2002-09-12 David Carlton <carlton@math.stanford.edu> + + * symtab.h: Run through gdb_indent.h. + Add 2002 to Copyright year list. + +2002-09-12 Alan Modra <amodra@bigpond.net.au> + + * x86-64-tdep.c (_initialize_x86_64_tdep): Don't use hard-coded + mach constants. + * MAINTAINERS: Add myself to write after approval list. + +2002-09-11 J. Brobecker <brobecker@gnat.com> + + * osabi.c (gdb_osabi_name): Add entry for GDB_OSABI_INTERIX. + +2002-09-11 J. Brobecker <brobecker@gnat.com> + + * osabi.h (gdb_osabi): Add new GDB_OSABI_INTERIX enum value for + Interix. + +2002-06-05 Paul N. Hilfinger <hilfingr@otisco.mckusick.com> + + * procfs.c (do_detach): Clear current signal, not just fault. + Corrects problem with breakpoint trap signal leaking to detached + process on Tru64. + +2002-09-10 Michael Snyder <msnyder@redhat.com> + + * buildsym.c (finish_block): Protect against null pointer. + +2002-09-10 Andrew Cagney <cagney@redhat.com> + + * infcmd.c (default_print_registers_info): Send all output to + ``file'' instead of ``gdb_stdout''. + +2002-09-10 Michael Snyder <msnyder@redhat.com> + + * mips-tdep.c (mips_extract_struct_value_address): Make val a + LONGEST, and use signed register read (addresses are sign- + extended for mips). + +2002-09-10 Stephane Carrez <stcarrez@nerim.fr> + + * event-loop.c (gdb_do_one_event): Make public. + * event-loop.h (gdb_do_one_event): Declare. + +2002-09-10 Jeff Law <law@redhat.com> + + * infttrace.c (child_resume): Simplify and rework to avoid + TT_PROC_CONTINUE. + +2002-09-09 Fred Fish <fnf@intrinsity.com> + + * printcmd.c (print_scalar_formatted): "len" is the number of + target bytes, NOT the number of target bits. + +2002-09-09 Elena Zannoni <ezannoni@redhat.com> + + From: Emmanuel Thome' <thome@lix.polytechnique.fr> + * top.c (init_main): Set rl_terminal_name. + +2002-09-08 Aidan Skinner <aidan@velvet.net> + + * ada-lang.c (ada_array_bound, ada_type_match, + _initialize_ada_language): Fix K&R definitions. + * ada-tasks.c (get_current_task): Fix K&R definitions. + * ada-valprint.c (adjust_type_signedness): Fix K&R definitions. + +2002-09-07 Christopher Faylor <cgf@redhat.com> + + * MAINTAINERS: Remove CE from list of maintainership responsibilities. + Add XP. + +2002-09-06 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (i386_register_virtual_type, + i386_register_convertible, i386_register_convert_to_virtual, + i386_register_comvert_to_raw): Use FP_REGNUM_P and SSE_REGNUM_P + instead of IS_FP_REGNUM and IS_SSE_REGNUM. + (i386_gdbarch_init): Fix comment. Add comments on calls that set + sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum. + Don't set push_arguments twice. + + * i386bsd-tdep.c (i386bsd_init_abi): Set sigtramp_start and + sigtramp_end to i386bsd_sigtramp_start and i386bsd_sigtramp_end. + * i386nbsd-tdep.c (i386nbsd_init_abi): Set sigtramp_start and + sigtramp_end to NULL. + * config/i386/tm-fbsd.h (SIGTRAMP_START, SIGTRAMP_END): Remove + defines. + (i386bsd_sigtramp_start, i386_sigtramp_end): Remove prototypes. + + * i386nbsd-tdep.c (i386nbsd_pc_in_sigtramp): Remove spurious + whitespace. + + * gdbarch.sh (SIGTRAMP_START, SIGTRAMP_END): New methods. + * gdbarch.h, gdbarch.c: Re-generate. + * blockframe.c (find_pc_sect_partial_function): Convert to use + SIGTRAMP_START_P predicate. + +2002-09-05 Michael Snyder <msnyder@redhat.com> + + * arm-tdep.c (arm_init_extra_frame_info): Distinguish between + generic_dummy_frame method and old method. Also distinguish + between ARM_FP_REGNUM and THUMB_FP_REGNUM. + (arm_extract_return_value): Use new regcache method. + + * mips-tdep.c (mips_n32n64_push_arguments): Remove alignment + adjustment that doesn't conform to the ABI. + (mips_extract_struct_value_address): Retrieve V0_REGNUM from + saved regcache, not from current regcache. + +2002-09-05 Andrew Cagney <ac131313@redhat.com> + + * NEWS: Update for 5.3. Add new section ``Changes since 5.3''. + * README: Update. + +2002-09-04 Jason Thorpe <thorpej@wasabisystems.com> + + * arm-tdep.c (arm_addr_bits_remove): Don't check for Thumb mode + if arm_apcs_32 is false. + +2002-09-04 Andrew Cagney <ac131313@redhat.com> + + GDB 5.3 branch created. + +2002-09-03 Theodore A. Roth <troth@verinet.com> + + * gdb/avr-tdep.c (avr_gdbarch_init): Use + generic_unwind_get_saved_register. + +2002-09-03 David Carlton <carlton@math.stanford.edu> + + * dwarf2read.c (dwarf2_add_member_fn): Add the 'type' + argument (PR gdb/653). Update call to smash_to_method_type. + (read_structure_scope): Update call to dwarf2_add_member_fn. + +2002-09-03 Michal Ludvig <mludvig@suse.cz> + + * x86-64-linux-tdep.c: Include gdb_string.h + * x86-64-linux-nat.c: Ditto. + +2002-09-02 Jason Thorpe <thorpej@wasabisystems.com> + + * ada-exp.y (yyname, yyrule): Remap global variables that appear + when YYDEBUG is set to 1. + * c-exp.y: Likewise. + * f-exp.y: Likewise. + * jv-exp.y: Likewise. + * m2-exp.y: Likewise. + * p-exp.y: Likewise. + +2002-09-02 Jason Thorpe <thorpej@wasabisystems.com> + + * Makefile.in (i386nbsd-tdep.o): Add $(solib_svr4_h) to + dependency list. + * i386nbsd-tdep.c (i386nbsdelf_init_abi): Set + solib_svr4_fetch_link_map_offsets to + nbsd_ilp32_solib_svr4_fetch_link_map_offsets. + * config/i386/nbsd.mt (TDEPFILES): Add solib.o and solib-svr4.o. + * config/i386/nbsdaout.mh (NATDEPFILES): Remove solib.o. + * config/i386/nbsdelf.mh (NATDEPFILES): Remove solib.o, + solib-svr4.o, and solib-legacy.o. + * config/i386/tm-nbsd.h: Include solib.h. + +2002-09-02 Jason Thorpe <thorpej@wasabisystems.com> + + * configure.tgt (i[3456]86-*-netbsdelf*): Merge with... + (i[3456]86-*-netbsd*): ...this. Set gdb_target to nbsd. + (i[3456]86-*-openbsd*): Make this a separate entry. Add a + comment noting that this needs its own target configuration. + * config/i386/nbsd.mt: New file. + * config/i386/nbsdaout.mt: Remove. + * config/i386/nbsdelf.mt: Ditto. + * config/i386/tm-nbsdaout.h: Ditto. + +2002-09-02 Jason Thorpe <thorpej@wasabisystems.com> + + * i386nbsd-tdep.c (i386nbsd_sigtramp_offset): New function. + (i386nbsd_pc_in_sigtramp): Rewrite to use i386nbsd_sigtramp_offset. + (i386nbsd_init_abi): Don't initialize tdep->sigtramp_start or + tdep->sigtramp_end. + (i386nbsd_sigtramp_start, i386nbsd_sigtramp_end): Remove. + * config/i386/tm-nbsd.h (SIGTRAMP_START, SIGTRAMP_END) + (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove. + +2002-09-02 Jason Thorpe <thorpej@wasabisystems.com> + + * Makefile.in (i386nbsd-tdep.o): Add $(arch_utils_h), + $(i386_tdep_h), and $(nbsd_tdep_h) to dependency list. + * i386-tdep.h (i386bsd_init_abi): New prototype. + * i386bsd-tdep.c (i386bsd_init_abi): Remove "static" from + function declaration. + (_initialize_i386bsd_tdep): Don't register OS ABI handlers + for NetBSD-a.out or NetBSD-ELF. + (i386nbsd_sigtramp_start, i386nbsd_sigtramp_end) + (i386nbsd_sc_pc_offset, i386nbsd_sc_sp_offset) + (i386nbsd_init_abi, i386nbsdelf_init_abi): Move to... + * i386nbsd-tdep.c: ...here. Include arch-utils.h, i386-tdep.h, + and nbsd-tdep.h. + (i386nbsd_pc_in_sigtramp): New function. + (i386nbsd_init_abi): Set gdbarch_pc_in_sigtramp to + i386nbsd_pc_in_sigtramp. + (_initialize_i386nbsd_tdep): Register i386nbsd_init_abi + and i386nbsdelf_init_abi OS ABI handlers. + * config/i386/nbsdaout.mt (TDEPFILES): Add nbsd-tdep.o. + * config/i386/nbsdelf.mt (TDEPFILES): Likewise. + +2002-09-02 Mark Kettenis <kettenis@gnu.org> + + * i386-linux-nat.c (dummy_sse_values): Only try to fill in the SSE + registers if the target really has them. + +2002-08-31 Jason Thorpe <thorpej@wasabisystems.com> + + * Makefile.in (mipsnbsd-tdep.o): Use $(nbsd_tdep_h) rather + than nbsd-tdep.h. + +2002-08-31 Jason Thorpe <thorpej@wasabisystems.com> + + * Makefile.in (alphanbsd-tdep.o): Add $(frame_h) to dependency + list. + * alphanbsd-tdep.c (alphanbsd_sigcontext_addr) + (alphanbsd_skip_sigtramp_frame): New functions. + (alphanbsd_init_abi): Set tdep->skip_sigtramp_frame to + alphanbsd_skip_sigtramp_frame. Set tdep->sigcontext_addr + to alphanbsd_sigcontext_addr. + +2002-08-31 Jason Thorpe <thorpej@wasabisystems.com> + + * Makefile.in (mipsnbsd-tdep.o): Add nbsd-tdep.h to dependency + list. + (nbsd-tdep.o): Add $(gdb_string_h) to dependency list. + * alphanbsd-tdep.c (alphanbsd_pc_in_sigtramp): Use + nbsd_pc_in_sigtramp. + * mipsnbsd-tdep.c: Include nbsd-tdep.h. + (mipsnbsd_pc_in_sigtramp): Use nbsd_pc_in_sigtramp. + * nbsd-tdep.c: Include gdb_string.h. + (nbsd_pc_in_sigtramp): New function. + * nbsd-tdep.h (nbsd_pc_in_sigtramp): New prototype. + * ppcnbsd-tdep.c (ppcnbsd_pc_in_sigtramp): New function. + (ppcnbsd_init_abi): Set gdbarch_pc_in_sigtramp to + ppcnbsd_pc_in_sigtramp. + * shnbsd-tdep.c (shnbsd_pc_in_sigtramp): New function. + (shnbsd_init_abi): Set gdbarch_pc_in_sigtramp to + shnbsd_pc_in_sigtramp. + * sparcnbsd-tdep.c (sparcnbsd_init_abi_elf): Set + gdbarch_pc_in_sigtramp to nbsd_pc_in_sigtramp. + * config/mips/nbsd.mt (TDEPFILES): Add nbsd-tdep.o. + +2002-08-30 Pierre Muller <muller@ics.u-strasbg.fr> + + * breakpoint.c (breakpoint_init_inferior): Reset the val field of + watchpoints to NULL. + (insert_breakpoints): set val field of watchpoints if NULL. + + +2002-08-29 Jim Blandy <jimb@redhat.com> + + * symtab.c (lookup_symbol_aux): In the cases where we find a + minimal symbol of an appropriate name and use its address to + select a symtab to read and search, use `name' (as passed to us) + as the demangled name when searching the symtab's global and + static blocks, not the minsym's name. + 2002-08-29 Keith Seitz <keiths@redhat.com> * stack.c (print_frame_info_base): Always set current_source_symtab @@ -227,6 +1172,11 @@ * breakpoint.c: Include cli/cli-script.h. * Makefile.in (breakpoint.o): Update dependencies. +2002-08-26 Michael Snyder <msnyder@redhat.com> + + * breakpoint.c (insert_breakpoints): Protect all references + to 'process_warning'. Shorten long lines. + 2002-08-26 Joel Brobecker <brobecker@gnat.com> * cli/cli-script.c (copy_command_lines): New function. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 212007e5b70..cb667800664 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -82,7 +82,6 @@ maintainer works with the native maintainer when resolving API issues. h8300 --target=h8300hms -Werror Maintenance only - Not multi-arch, work in progress h8500 --target=h8500hms -Werror Maintenance only @@ -223,7 +222,7 @@ AIX Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de djgpp native Eli Zaretskii eliz@gnu.org DJ Delorie dj@redhat.com -MS Windows (NT, CE, '00, 9x, Me) host & native +MS Windows (NT, '00, 9x, Me, XP) host & native Chris Faylor cgf@redhat.com GNU/Linux/x86 native & host Mark Kettenis kettenis@gnu.org @@ -367,16 +366,17 @@ Stephane Carrez stcarrez@nerim.fr Michael Chastain mec@shout.net Eric Christopher echristo@redhat.com Nick Clifton nickc@redhat.com -Philippe De Muyter phdm@macqel.be +DJ Delorie dj@redhat.com Chris G. Demetriou cgd@broadcom.com +Philippe De Muyter phdm@macqel.be Klee Dienes kdienes@apple.com -DJ Delorie dj@redhat.com Richard Earnshaw rearnsha@arm.com Frank Ch. Eigler fche@redhat.com Ben Elliston bje@redhat.com Anthony Green green@redhat.com Matthew Green mrg@eterna.com.au Chris Faylor cgf@redhat.com +Adam Fedor fedor@gnu.org Fred Fish fnf@ninemoons.com Orjan Friberg orjanf@axis.com Ben Harris bjh21@netbsd.org @@ -394,8 +394,8 @@ Andreas Jaeger aj@suse.de Geoff Keating geoffk@redhat.com Mark Kettenis kettenis@gnu.org Jim Kingdon jkingdon@engr.sgi.com ++ -Jeff Law law@redhat.com Jonathan Larmour jlarmour@redhat.co.uk +Jeff Law law@redhat.com Robert Lipe rjl@sco.com H.J. Lu hjl@lucon.org Michal Ludvig mludvig@suse.cz @@ -403,9 +403,11 @@ Glen McCready gkm@redhat.com Greg McGary greg@mcgary.org Jason Merrill jason@redhat.com David S. Miller davem@redhat.com +Alan Modra amodra@bigpond.net.au Jason Molenda jmolenda@apple.com Pierre Muller muller@sources.redhat.com Fernando Nasser fnasser@redhat.com +Hans-Peter Nilsson hp@bitrange.com David O'Brien obrien@freebsd.org Alexandre Oliva aoliva@redhat.com Tom Rix trix@redhat.com @@ -416,12 +418,12 @@ Mark Salter msalter@redhat.com Peter Schauer Peter.Schauer@regent Andreas Schwab schwab@suse.de Keith Seitz keiths@redhat.com +Stan Shebs shebs@apple.com Aidan Skinner aidan@velvet.net Jiri Smid smid@suse.cz David Smith dsmith@redhat.com Stephen P. Smith ischis2@home.com Jackie Smith Cashion jsmith@redhat.com -Stan Shebs shebs@apple.com Michael Snyder msnyder@redhat.com Petr Sorfa petrs@caldera.com Gary Thomas gthomas@redhat.com @@ -429,6 +431,7 @@ Jason Thorpe thorpej@wasabisystems.com Tom Tromey tromey@redhat.com Corinna Vinschen vinschen@redhat.com Keith Walker keith.walker@arm.com +Jim Wilson wilson@redhat.com Elena Zannoni ezannoni@redhat.com Eli Zaretskii eliz@gnu.org diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 0c6f922452c..0248cdde0d3 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -138,6 +138,9 @@ INTL_DEPS = @INTLDEPS@ INTL_SRC = $(srcdir)/$(INTL_DIR) INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC) +# Where is the ICONV library? This can be empty if libc has iconv. +LIBICONV = @LIBICONV@ + # # CLI sub directory definitons # @@ -287,16 +290,17 @@ SUBDIR_GDBTK_SRCS = \ gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-bp.c \ gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c \ gdbtk/generic/gdbtk-register.c gdbtk/generic/gdbtk-stack.c \ - gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c + gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c \ + gdbtk/generic/gdbtk-main.c SUBDIR_GDBTK_DEPS = \ $(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS) SUBDIR_GDBTK_INITS = gdbtk/generic/gdbtk.c SUBDIR_GDBTK_LDFLAGS= SUBDIR_GDBTK_CFLAGS= -DGDBTK -SUBDIR_GDBTK_ALL= -SUBDIR_GDBTK_CLEAN= +SUBDIR_GDBTK_ALL= all-gdbtk +SUBDIR_GDBTK_CLEAN= clean-gdbtk SUBDIR_GDBTK_INSTALL= install-gdbtk -SUBDIR_GDBTK_UNINSTALL= +SUBDIR_GDBTK_UNINSTALL= uninstall-gdbtk CONFIG_OBS= @CONFIG_OBS@ CONFIG_LIB_OBS= @CONFIG_LIB_OBS@ @@ -369,6 +373,7 @@ INSTALLED_LIBS=-lbfd -lreadline -lopcodes -liberty \ -lmmalloc -lintl -liberty CLIBS = $(SIM) $(BFD) $(READLINE) $(OPCODES) $(INTL) $(LIBIBERTY) \ $(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \ + $(LIBICONV) \ $(MMALLOC) $(LIBIBERTY) $(WIN32LIBS) CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ $(OPCODES) $(MMALLOC) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) @@ -525,28 +530,30 @@ TARGET_FLAGS_TO_PASS = \ # SFILES is used in building the distribution archive. SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ - ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ - buildsym.c c-exp.y c-lang.c c-typeprint.c c-valprint.c \ - coffread.c \ - complaints.c completer.c corefile.c cp-valprint.c dbxread.c \ - demangle.c dwarfread.c dwarf2read.c elfread.c environ.c eval.c \ - event-loop.c event-top.c \ - expprint.c f-exp.y f-lang.c f-typeprint.c f-valprint.c \ - findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c osabi.c \ - inf-loop.c infcmd.c inflow.c infrun.c language.c \ - kod.c kod-cisco.c \ - ui-out.c cli-out.c interps.c \ - varobj.c wrapper.c \ + ax-general.c ax-gdb.c \ + bcache.c blockframe.c breakpoint.c buildsym.c builtin-regs.c \ + c-exp.y c-lang.c c-typeprint.c c-valprint.c \ + charset.c cli-out.c coffread.c complaints.c completer.c corefile.c \ + cp-abi.c cp-support.c cp-valprint.c \ + dbxread.c demangle.c disasm.c doublest.c dwarfread.c dwarf2read.c \ + elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \ + f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \ + gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ + hpacc-abi.c \ + inf-loop.c infcmd.c inflow.c infrun.c interps.c \ jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \ - m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \ - memattr.c mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \ - p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \ - macrotab.c macroexp.c macrocmd.c macroscope.c \ - printcmd.c remote.c scm-exp.c scm-lang.c \ - scm-valprint.c source.c stabsread.c stack.c symfile.c \ - symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \ - typeprint.c utils.c valarith.c valops.c valprint.c values.c \ - serial.c ser-unix.c mdebugread.c \ + kod.c kod-cisco.c \ + language.c linespec.c \ + m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c \ + macrotab.c macroexp.c macrocmd.c macroscope.c main.c maint.c \ + mdebugread.c memattr.c mem-break.c minsyms.c mipsread.c \ + nlmread.c \ + objfiles.c osabi.c \ + p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \ + regcache.c remote.c \ + scm-exp.c scm-lang.c scm-valprint.c serial.c ser-unix.c source.c \ + stabsread.c stack.c std-regs.c symfile.c symmisc.c symtab.c \ + target.c thread.c top.c tracepoint.c typeprint.c \ tui/tui.c tui/tui.h tui/tuiCommand.c tui/tuiCommand.h \ tui/tuiData.c tui/tuiData.h tui/tuiDataWin.c tui/tuiDataWin.h \ tui/tuiDisassem.c tui/tuiDisassem.h tui/tuiGeneralWin.c \ @@ -555,10 +562,9 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ tui/tuiSource.h tui/tuiSourceWin.c tui/tuiSourceWin.h \ tui/tuiStack.c tui/tuiStack.h tui/tuiWin.c tui/tuiWin.h \ tui/tui-file.h tui/tui-file.c tui/tui-out.c tui/tui-hooks.c \ - ui-file.h ui-file.c \ - frame.c doublest.c \ - builtin-regs.c std-regs.c \ - gnu-v2-abi.c gnu-v3-abi.c hpacc-abi.c cp-abi.c + ui-out.c utils.c ui-file.h ui-file.c \ + valarith.c valops.c valprint.c values.c varobj.c \ + wrapper.c LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c @@ -626,10 +632,12 @@ command_h = command.h complaints_h = complaints.h completer_h = completer.h cp_abi_h = cp-abi.h +cp_support_h = cp-support.h dcache_h = dcache.h defs_h = defs.h $(config_h) $(gdb_locale_h) $(gdb_signals_h) $(ansidecl_h) \ $(libiberty_h) $(progress_h) $(bfd_h) $(tui_h) $(ui_file_h) $(xm_h) \ $(nm_h) $(tm_h) $(fopen_same_h) $(gdbarch_h) $(arch_utils_h) +disasm_h = disasm.h doublest_h = doublest.h $(floatformat_h) dst_h = dst.h dwarf2cfi_h = dwarf2cfi.h @@ -674,6 +682,7 @@ m2_lang_h = m2-lang.h macroexp_h = macroexp.h macroscope_h = macroscope.h $(macrotab_h) $(symtab_h) macrotab_h = macrotab.h +main_h = main.h memattr_h = memattr.h minimon_h = minimon.h mipsnbsd_tdep_h = mipsnbsd-tdep.h @@ -767,6 +776,8 @@ tuiSourceWin_h = $(srcdir)/tui/tuiSourceWin.h tuiStack_h = $(srcdir)/tui/tuiStack.h tuiWin_h = $(srcdir)/tui/tuiWin.h +charset_h = charset.h + # Header files that need to have srcdir added. Note that in the cases # where we use a macro like $(gdbcmd_h), things are carefully arranged # so that each .h file is listed exactly once (M-x tags-search works @@ -818,6 +829,7 @@ TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \ TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR) COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ + charset.o disasm.o \ source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \ symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \ expprint.o environ.o stack.o thread.o \ @@ -843,7 +855,7 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ nlmread.o serial.o mdebugread.o top.o utils.o \ ui-file.o \ frame.o doublest.o \ - gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o + gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o OBS = $(COMMON_OBS) $(ANNOTATE_OBS) @@ -921,25 +933,8 @@ uninstall: force $(CONFIG_UNINSTALL) true ; \ fi ; \ rm -f $(bindir)/$$transformed_name$(EXEEXT) $(man1dir)/$$transformed_name.1 - rm -rf $(GDBTK_LIBRARY) @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do -install-gdbtk: - $(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY) ; \ - $(SHELL) $(srcdir)/../mkinstalldirs $(libdir)/insight$(GDBTK_VERSION) ; \ - $(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl $(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \ - $(SHELL) $(srcdir)/../mkinstalldirs \ - $(GDBTK_LIBRARY)/images \ - $(GDBTK_LIBRARY)/images2 ; \ - $(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY)/help \ - $(GDBTK_LIBRARY)/help/images \ - $(GDBTK_LIBRARY)/help/trace ; \ - cd $(srcdir)/gdbtk/library ; \ - for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html help/trace/*.html help/trace/index.toc help/images/*.gif; \ - do \ - $(INSTALL_DATA) $$i $(GDBTK_LIBRARY)/$$i ; \ - done ; - # We do this by grepping through sources. If that turns out to be too slow, # maybe we could just require every .o file to have an initialization routine # of a given name (top.o -> _initialize_top, etc.). @@ -1009,11 +1004,11 @@ init.c: $(INIT_FILES) init.o: init.c $(defs_h) $(call_cmds_h) # Removing the old gdb first works better if it is running, at least on SunOS. -gdb$(EXEEXT): main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) +gdb$(EXEEXT): gdb.o main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) rm -f gdb$(EXEEXT) - $(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -o gdb$(EXEEXT) \ - main.o libgdb.a $(CONFIG_OBS) $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS)\ - $(LOADLIBES) + $(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ + -o gdb$(EXEEXT) gdb.o main.o $(CONFIG_OBS) libgdb.a \ + $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) nlm: force rootme=`pwd`; export rootme; $(MAKE) $(TARGET_FLAGS_TO_PASS) DO=all DODIRS=nlm subdir_do @@ -1439,6 +1434,7 @@ z8k-tdep.o: $(srcdir)/z8k-tdep.c c-exp.tab.o: c-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(value_h) $(parser_defs_h) $(language_h) $(c_lang_h) $(bfd_h) \ + $(charset_h) \ $(symfile_h) $(objfiles_h) jv-exp.tab.o: jv-exp.tab.c jv-lang.h $(defs_h) $(expression_h) \ @@ -1501,9 +1497,9 @@ alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) $(alpha_tdep_h) \ $(alphabsd_tdep_h) alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h) -alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ - $(value_h) $(solib_svr4_h) $(alpha_tdep_h) $(alphabsd_tdep_h) \ - $(nbsd_tdep_h) +alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \ + $(regcache_h) $(value_h) $(solib_svr4_h) $(alpha_tdep_h) \ + $(alphabsd_tdep_h) $(nbsd_tdep_h) annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \ $(gdbtypes_h) $(breakpoint_h) # OBSOLETE arc-tdep.o: arc-tdep.c @@ -1541,7 +1537,7 @@ breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \ $(command_h) $(inferior_h) $(gdbthread_h) $(target_h) $(language_h) \ $(gdb_string_h) $(demangle_h) $(annotate_h) $(symfile_h) \ $(objfiles_h) $(linespec_h) $(completer_h) $(gdb_h) $(ui_out_h) \ - $(cli_script_h) $(gdb_events_h) + $(cli_script_h) $(gdb_events_h) $(source_h) buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(complaints_h) \ $(gdb_string_h) $(expression_h) $(language_h) $(bcache_h) \ @@ -1551,7 +1547,7 @@ builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(gdb_assert_h) c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \ - $(macroscope_h) $(gdb_assert_h) + $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \ @@ -1563,6 +1559,7 @@ c-valprint.o: c-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \ # OBSOLETE ch-lang.o: ch-lang.c # OBSOLETE ch-typeprint.o: ch-typeprint.c # OBSOLETE ch-valprint.o: ch-valprint.c +charset.o: charset.c $(defs_h) $(charset_h) $(gdbcmd_h) gdb_assert.h cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h) $(gdb_string_h) \ $(gdb_assert_h) coff-solib.o: coff-solib.c $(defs_h) $(frame_h) $(bfd_h) $(gdbcore_h) \ @@ -1572,7 +1569,8 @@ coffread.o: coffread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(demangle_h) \ $(coff_internal_h) $(libcoff_h) $(symfile_h) $(objfiles_h) \ $(buildsym_h) $(gdb_stabs_h) $(stabsread_h) $(complaints_h) \ $(target_h) $(gdb_assert_h) -complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdbcmd_h) +complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdb_assert_h) \ + $(command_h) $(gdbcmd_h) completer.o: completer.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(filenames_h) $(cli_decode_h) $(gdbcmd_h) $(completer_h) copying.o: copying.c $(defs_h) $(command_h) $(gdbcmd_h) @@ -1589,6 +1587,7 @@ corelow.o: corelow.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ $(symtab_h) $(command_h) $(bfd_h) $(target_h) $(gdbcore_h) \ $(gdbthread_h) $(regcache_h) $(symfile_h) cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(gdb_string_h) +cp-support.o: cp-support.c $(defs_h) $(cp_support_h) cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(command_h) $(gdbcmd_h) \ $(demangle_h) $(annotate_h) $(gdb_string_h) $(c_lang_h) $(target_h) \ @@ -1598,7 +1597,7 @@ cpu32bug-rom.o: cpu32bug-rom.c $(defs_h) $(gdbcore_h) $(target_h) \ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \ $(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \ $(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \ - $(solib_h) $(solib_svr4_h) + $(solib_h) $(solib_svr4_h) $(gdb_string_h) # OBSOLETE cxux-nat.o: cxux-nat.c d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \ $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) $(inferior_h) \ @@ -1620,6 +1619,8 @@ demangle.o: demangle.c $(defs_h) $(command_h) $(gdbcmd_h) $(demangle_h) \ $(gdb_string_h) dink32-rom.o: dink32-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(symfile_h) $(inferior_h) $(regcache_h) +disasm.o: disasm.c $(defs_h) $(gdb_string_h) $(target_h) $(value_h) \ + $(disasm_h) $(ui_out_h) doublest.o: doublest.c $(defs_h) $(doublest_h) $(floatformat_h) \ $(gdb_assert_h) $(gdb_string_h) $(gdbtypes_h) dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h) @@ -1679,6 +1680,7 @@ frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(regcache_h) gcore.o: gcore.c $(defs_h) $(cli_decode_h) $(inferior_h) $(gdbcore_h) \ $(elf_bfd_h) $(symfile_h) $(objfiles_h) +gdb.o: gdb.c $(defs_h) $(main_h) $(gdb_string_h) gdb-events.o: gdb-events.c $(defs_h) $(gdb_events_h) $(gdbcmd_h) gdbarch.o: gdbarch.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) $(inferior_h) \ $(gdb_string_h) $(symtab_h) $(frame_h) $(inferior_h) $(breakpoint_h) \ @@ -1758,7 +1760,8 @@ i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ # OBSOLETE i386m3-nat.o: i386m3-nat.c # OBSOLETE i386mach-nat.o: i386mach-nat.c i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \ - $(regcache_h) $(i387_tdep_h) + $(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \ + $(nbsd_tdep_h) $(solib_svr4_h) i386obsd-nat.o: i386obsd-nat.c $(defs_h) i386v-nat.o: i386v-nat.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \ $(gdbcore_h) $(gdb_stat_h) $(floatformat_h) $(target_h) @@ -1822,7 +1825,7 @@ lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \ $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ $(symfile_h) $(objfiles_h) $(demangle_h) $(value_h) $(completer_h) \ - $(cp_abi_h) + $(cp_abi_h) $(source_h) linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \ $(cli_decode_h) $(gdb_string_h) @@ -1867,13 +1870,13 @@ macrocmd.o: macrocmd.c $(defs_h) $(macrotab_h) $(macroexp_h) $(macroscope_h) \ macroexp.o: macroexp.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(macrotab_h) \ $(macroexp_h) $(gdb_assert_h) macroscope.o: macroscope.c $(defs_h) $(macroscope_h) $(symtab_h) $(target_h) \ - $(frame_h) $(inferior_h) + $(frame_h) $(inferior_h) $(source_h) macrotab.o: macrotab.c $(defs_h) $(gdb_obstack_h) $(splay_tree_h) \ $(symtab_h) $(symfile_h) $(objfiles_h) $(macrotab_h) $(gdb_assert_h) \ $(bcache_h) $(complaints_h) main.o: main.c $(defs_h) $(top_h) $(target_h) $(inferior_h) $(symfile_h) \ $(gdbcore_h) $(getopt_h) $(gdb_stat_h) $(gdb_string_h) \ - $(event_loop_h) $(ui_out_h) + $(event_loop_h) $(ui_out_h) $(main_h) maint.o: maint.c $(defs_h) $(command_h) $(gdbcmd_h) $(symtab_h) \ $(gdbtypes_h) $(demangle_h) $(gdbcore_h) $(expression_h) \ $(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h) @@ -1881,7 +1884,7 @@ mcore-rom.o: mcore-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(gdb_string_h) $(regcache_h) $(serial_h) mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \ $(gdbcmd_h) $(regcache_h) $(symfile_h) $(gdbcore_h) $(inferior_h) \ - $(arch_utils_h) + $(arch_utils_h) $(gdb_string_h) mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(symfile_h) $(objfiles_h) $(gdb_obstack_h) $(buildsym_h) \ $(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \ @@ -1908,7 +1911,8 @@ mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h) mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(mipsnbsd_tdep_h) mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ - $(target_h) $(value_h) $(osabi_h) $(mipsnbsd_tdep_h) $(solib_svr4_h) + $(target_h) $(value_h) $(osabi_h) $(mipsnbsd_tdep_h) $(solib_svr4_h) \ + $(nbsd_tdep_h) mipsread.o: mipsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \ $(coff_sym_h) $(coff_internal_h) $(coff_ecoff_h) $(libcoff_h) \ @@ -1927,16 +1931,16 @@ mon960-rom.o: mon960-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \ $(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) $(inferior_h) \ $(gdb_regex_h) $(srec_h) $(regcache_h) -nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(solib_svr4_h) +nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h) nindy-tdep.o: nindy-tdep.c $(defs_h) $(symtab_h) $(frame_h) $(gdbcore_h) nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(buildsym_h) $(stabsread_h) ns32k-tdep.o: ns32k-tdep.c $(defs_h) $(frame_h) $(gdbtypes_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(target_h) $(arch_utils_h) \ - $(ns32k_tdep_h) + $(ns32k_tdep_h) $(gdb_string_h) ns32knbsd-nat.o: ns32knbsd-nat.c $(defs_h) $(inferior_h) $(target_h) \ $(gdbcore_h) $(regcache_h) -ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) +ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) $(gdb_string_h) objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \ $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) @@ -1947,9 +1951,6 @@ op50-rom.o: op50-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) # OBSOLETE os9kread.o: os9kread.c osabi.o: osabi.c $(defs_h) $(gdb_string_h) $(osabi_h) $(elf_bfd_h) -osfsolib.o: osfsolib.c $(defs_h) $(gdb_string_h) $(symtab_h) $(bfd_h) \ - $(symfile_h) $(objfiles_h) $(gdbcore_h) $(command_h) $(target_h) \ - $(frame_h) $(gdb_regex_h) $(inferior_h) $(language_h) $(gdbcmd_h) p-lang.o: p-lang.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(parser_defs_h) $(language_h) $(p_lang_h) \ $(valprint_h) @@ -2094,7 +2095,7 @@ scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(scm_tags_h) scm-lang.o: scm-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(value_h) $(c_lang_h) $(scm_lang_h) \ - $(scm_tags_h) $(gdb_string_h) $(gdbcore_h) + $(scm_tags_h) $(gdb_string_h) $(gdbcore_h) $(source_h) scm-valprint.o: scm-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(parser_defs_h) $(language_h) $(value_h) \ $(scm_lang_h) $(valprint_h) $(gdbcore_h) @@ -2113,7 +2114,8 @@ sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \ $(regcache_h) $(doublest_h) $(sh_tdep_h) $(elf_bfd_h) \ $(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h) sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ - $(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(sh_tdep_h) + $(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h) \ + $(sh_tdep_h) shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) $(shnbsd_tdep_h) shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(value_h) \ $(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) $(shnbsd_tdep_h) @@ -2175,11 +2177,11 @@ stabsread.o: stabsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(gdb_obstack_h) \ $(symtab_h) $(gdbtypes_h) $(expression_h) $(symfile_h) $(objfiles_h) \ $(aout_stab_gnu_h) $(libaout_h) $(aout_aout64_h) $(gdb_stabs_h) \ $(buildsym_h) $(complaints_h) $(demangle_h) $(language_h) \ - $(doublest_h) $(stabsread_h) + $(doublest_h) $(stabsread_h) $(cp_abi_h) $(cp_support_h) stack.o: stack.c $(defs_h) $(gdb_string_h) $(value_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(language_h) $(frame_h) $(gdbcmd_h) \ $(gdbcore_h) $(target_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \ - $(annotate_h) $(ui_out_h) + $(annotate_h) $(ui_out_h) $(source_h) standalone.o: standalone.c $(gdb_stat_h) $(defs_h) $(symtab_h) $(frame_h) \ $(inferior_h) $(gdb_wait_h) std-regs.o: std-regs.c $(defs_h) $(builtin_regs_h) $(frame_h) $(gdbtypes_h) \ @@ -2190,7 +2192,7 @@ symfile.o: symfile.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \ $(gdbcmd_h) $(breakpoint_h) $(language_h) $(complaints_h) \ $(demangle_h) $(inferior_h) $(gdb_stabs_h) $(gdb_obstack_h) \ - $(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) + $(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) $(source_h) symm-nat.o: symm-nat.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ $(target_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) $(gdbcore_h) symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ @@ -2203,7 +2205,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \ $(language_h) $(demangle_h) $(inferior_h) $(linespec_h) \ $(filenames_h) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \ - $(cp_abi_h) + $(cp_abi_h) $(source_h) 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) @@ -2234,7 +2236,7 @@ ui-out.o: ui-out.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \ utils.o: utils.c $(config_h) $(defs_h) $(gdb_assert_h) $(gdb_string_h) \ $(event_top_h) $(gdbcmd_h) $(serial_h) $(bfd_h) $(target_h) \ $(demangle_h) $(expression_h) $(language_h) $(annotate_h) \ - $(filenames_h) $(inferior_h) $(mmalloc_h) + $(filenames_h) $(inferior_h) $(mmalloc_h) $(charset_h) uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \ $(regcache_h) $(gregset_h) v850-tdep.o: v850-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ @@ -2261,7 +2263,7 @@ varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \ $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h) vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(frame_h) $(value_h) $(arch_utils_h) \ - $(vax_tdep_h) + $(gdb_string_h) $(vax_tdep_h) w89k-rom.o: w89k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(xmodem_h) $(regcache_h) win32-nat.o: win32-nat.c $(defs_h) $(tm_h) $(frame_h) $(inferior_h) \ @@ -2304,7 +2306,8 @@ z8k-tdep.o: z8k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbcmd_h) \ cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(defs_h) $(completer_h) $(target_h) \ $(gdb_wait_h) $(gdb_regex_h) $(gdb_string_h) $(filenames_h) \ $(ui_out_h) $(top_h) $(cli_decode_h) $(cli_script_h) \ - $(cli_setshow_h) $(cli_cmds_h) + $(cli_setshow_h) $(cli_cmds_h) $(source_h) $(linespec_h) \ + $(expression_h) $(language_h) $(objfiles_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ $(gdb_regex_h) $(gdb_string_h) $(ui_out_h) $(cli_cmds_h) \ @@ -2334,6 +2337,55 @@ cli-utils.o: $(srcdir)/cli/cli-utils.c $(defs_h) $(cli_utils_h) # Need to explicitly specify the compile rule as make will do nothing # or try to compile the object file into the mi directory. +all-gdbtk: insight$(EXEEXT) + +install-gdbtk: + transformed_name=`t='$(program_transform_name)'; \ + echo insight | sed -e $$t` ; \ + if test "x$$transformed_name" = x; then \ + transformed_name=insight ; \ + else \ + true ; \ + fi ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(bindir) + $(INSTALL_PROGRAM) insight$(EXEEXT) $(bindir)/$$transformed_name$(EXEEXT) ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY) ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(libdir)/insight$(GDBTK_VERSION) ; \ + $(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl $(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \ + $(SHELL) $(srcdir)/../mkinstalldirs \ + $(GDBTK_LIBRARY)/images \ + $(GDBTK_LIBRARY)/images2 ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY)/help \ + $(GDBTK_LIBRARY)/help/images \ + $(GDBTK_LIBRARY)/help/trace ; \ + cd $(srcdir)/gdbtk/library ; \ + for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html help/trace/*.html help/trace/index.toc help/images/*.gif; \ + do \ + $(INSTALL_DATA) $$i $(GDBTK_LIBRARY)/$$i ; \ + done ; + +uninstall-gdbtk: + transformed_name=`t='$(program_transform_name)'; \ + echo insight | sed -e $$t` ; \ + if test "x$$transformed_name" = x; then \ + transformed_name=insight ; \ + else \ + true ; \ + fi ; \ + rm -f $(bindir)/$$transformed_name$(EXEEXT) ; \ + rm -rf $(GDBTK_LIBRARY) + +clean-gdbtk: + rm -f insight$(EXEEXT) + +# Removing the old gdb first works better if it is running, at least on SunOS. +insight$(EXEEXT): gdbtk-main.o main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) \ + $(CDEPS) $(TDEPLIBS) + rm -f insight$(EXEEXT) + $(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ + -o insight$(EXEEXT) gdbtk-main.o main.o $(CONFIG_OBS) libgdb.a \ + $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) + gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico $(WINDRES) --include $(srcdir)/gdbtk $(srcdir)/gdbtk/gdb.rc gdbres.o @@ -2377,6 +2429,12 @@ gdbtk-hooks.o: $(srcdir)/gdbtk/generic/gdbtk-hooks.c \ $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ $(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\" +gdbtk-main.o: $(srcdir)/gdbtk/generic/gdbtk-main.c $(defs_h) $(main_h) \ + $(gdb_string_h) + $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \ + $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ + $(srcdir)/gdbtk/generic/gdbtk-main.c -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\" + gdbtk-register.o: $(srcdir)/gdbtk/generic/gdbtk-register.c \ $(srcdir)/gdbtk/generic/gdbtk.h \ $(srcdir)/gdbtk/generic/gdbtk-cmds.h \ @@ -2420,7 +2478,7 @@ mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \ $(mi_getopt_h) $(gdb_events_h) $(gdb_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \ - $(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) + $(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \ $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) @@ -1,7 +1,21 @@ What has changed in GDB? (Organized release by release) -*** Changes since GDB 5.2: +*** Changes since GDB 5.3: + +* REMOVED configurations and files + +V850EA ISA + +* MIPS $fp behavior changed + +The convenience variable $fp, for the MIPS, now consistently returns +the address of the current frame's base. Previously, depending on the +context, $fp could refer to either $sp or the current frame's base +address. See ``8.10 Registers'' in the manual ``Debugging with GDB: +The GNU Source-Level Debugger''. + +*** Changes in GDB 5.3: * ``gdbserver'' now supports multi-threaded applications on some targets diff --git a/gdb/README b/gdb/README index 64526ae2dfb..e8759c1d55e 100644 --- a/gdb/README +++ b/gdb/README @@ -1,5 +1,5 @@ - README for gdb-5.2.1 release - Updated 19 July, 2002 by Andrew Cagney + README for gdb-5.3 release + Updated 5th September, 2002 by Andrew Cagney This is GDB, the GNU source-level debugger. @@ -20,7 +20,7 @@ Unpacking and Installation -- quick overview In this release, the GDB debugger sources, the generic GNU include files, the BFD ("binary file description") library, the readline library, and other libraries all have directories of their own -underneath the gdb-5.2.1 directory. The idea is that a variety of GNU +underneath the gdb-5.3 directory. The idea is that a variety of GNU tools can share a common copy of these things. Be aware of variation over time--for example don't try to build gdb with a copy of bfd from a release other than the gdb release (such as a binutils release), @@ -29,8 +29,8 @@ Configuration scripts and makefiles exist to cruise up and down this directory tree and automatically build all the pieces in the right order. - When you unpack the gdb-5.2.1.tar.gz file, you'll find a directory -called `gdb-5.2.1', which contains: + When you unpack the gdb-5.3.tar.gz file, you'll find a directory +called `gdb-5.3', which contains: COPYING config.sub intl missing opcodes COPYING.LIB configure libiberty mkinstalldirs readline @@ -44,7 +44,7 @@ called `gdb-5.2.1', which contains: You can build GDB right in the source directory: - cd gdb-5.2.1 + cd gdb-5.3 ./configure make cp gdb/gdb /usr/local/bin/gdb (or wherever you want) @@ -58,12 +58,12 @@ You can build GDB in any empty build directory: mkdir build cd build - <full path to your sources>/gdb-5.2.1/configure + <full path to your sources>/gdb-5.3/configure make cp gdb/gdb /usr/local/bin/gdb (or wherever you want) (Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly -different; see the file gdb-5.2.1/gdb/config/djgpp/README for details.) +different; see the file gdb-5.3/gdb/config/djgpp/README for details.) This will configure and build all the libraries as well as GDB. If `configure' can't determine your system type, specify one as its @@ -94,7 +94,7 @@ documentation and TeX (or `texi2roff') to typeset the printed version. GDB includes an already formatted copy of the on-line Info version of this manual in the `gdb/doc' subdirectory. The main Info file is -`gdb-5.2.1/gdb/doc/gdb.info', and it refers to subordinate files +`gdb-5.3/gdb/doc/gdb.info', and it refers to subordinate files matching `gdb.info*' in the same directory. If necessary, you can print out these files, or read them with any editor; but they are easier to read using the `info' subsystem in GNU Emacs or the @@ -106,7 +106,7 @@ Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'. If you have `makeinfo' installed, and are in the top level GDB -source directory (`gdb-5.2.1', in the case of version 5.2.1), you can make +source directory (`gdb-5.3', in the case of version 5.3), you can make the Info file by typing: cd gdb/doc @@ -115,7 +115,7 @@ the Info file by typing: If you want to typeset and print copies of this manual, you need TeX, a program to print its DVI output files, and `texinfo.tex', the Texinfo definitions file. This file is included in the GDB -distribution, in the directory `gdb-5.2.1/texinfo'. +distribution, in the directory `gdb-5.3/texinfo'. TeX is a typesetting program; it does not print files directly, but produces output files called DVI files. To print a typeset document, @@ -129,11 +129,11 @@ without any extension or a `.dvi' extension. This file tells TeX how to typeset a document written in Texinfo format. On its own, TeX cannot read, much less typeset a Texinfo file. `texinfo.tex' is distributed with GDB and is located in the -`gdb-5.2.1/texinfo' directory. +`gdb-5.3/texinfo' directory. If you have TeX and a DVI printer program installed, you can typeset and print this manual. First switch to the the `gdb' subdirectory of -the main source directory (for example, to `gdb-5.2.1/gdb') and then type: +the main source directory (for example, to `gdb-5.3/gdb') and then type: make doc/gdb.dvi @@ -156,55 +156,55 @@ preparing GDB for installation; you can then use `make' to build the a single directory, whose name is usually composed by appending the version number to `gdb'. - For example, the GDB version 5.2.1 distribution is in the `gdb-5.2.1' + For example, the GDB version 5.3 distribution is in the `gdb-5.3' directory. That directory contains: -`gdb-5.2.1/{COPYING,COPYING.LIB}' +`gdb-5.3/{COPYING,COPYING.LIB}' Standard GNU license files. Please read them. -`gdb-5.2.1/bfd' +`gdb-5.3/bfd' source for the Binary File Descriptor library -`gdb-5.2.1/config*' +`gdb-5.3/config*' script for configuring GDB, along with other support files -`gdb-5.2.1/gdb' +`gdb-5.3/gdb' the source specific to GDB itself -`gdb-5.2.1/include' +`gdb-5.3/include' GNU include files -`gdb-5.2.1/libiberty' +`gdb-5.3/libiberty' source for the `-liberty' free software library -`gdb-5.2.1/mmalloc' +`gdb-5.3/mmalloc' source for the GNU memory-mapped malloc package -`gdb-5.2.1/opcodes' +`gdb-5.3/opcodes' source for the library of opcode tables and disassemblers -`gdb-5.2.1/readline' +`gdb-5.3/readline' source for the GNU command-line interface NOTE: The readline library is compiled for use by GDB, but will not be installed on your system when "make install" is issued. -`gdb-5.2.1/sim' +`gdb-5.3/sim' source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc) -`gdb-5.2.1/intl' +`gdb-5.3/intl' source for the GNU gettext library, for internationalization. This is slightly modified from the standalone gettext distribution you can get from GNU. -`gdb-5.2.1/texinfo' +`gdb-5.3/texinfo' The `texinfo.tex' file, which you need in order to make a printed manual using TeX. -`gdb-5.2.1/etc' +`gdb-5.3/etc' Coding standards, useful files for editing GDB, and other miscellanea. -`gdb-5.2.1/utils' +`gdb-5.3/utils' A grab bag of random utilities. Note: the following instructions are for building GDB on Unix or @@ -213,14 +213,14 @@ MS-DOS/MS-Windows are in the file gdb/config/djgpp/README. The simplest way to configure and build GDB is to run `configure' from the `gdb-VERSION-NUMBER' source directory, which in this example -is the `gdb-5.2.1' directory. +is the `gdb-5.3' directory. First switch to the `gdb-VERSION-NUMBER' source directory if you are not already in it; then run `configure'. For example: - cd gdb-5.2.1 + cd gdb-5.3 ./configure make @@ -236,8 +236,8 @@ you may need to run `sh' on it explicitly: sh configure If you run `configure' from a directory that contains source -directories for multiple libraries or programs, such as the `gdb-5.2.1' -source directory for version 5.2.1, `configure' creates configuration +directories for multiple libraries or programs, such as the `gdb-5.3' +source directory for version 5.3, `configure' creates configuration files for every directory level underneath (unless you tell it not to, with the `--norecursion' option). @@ -245,10 +245,10 @@ with the `--norecursion' option). directories in the GDB distribution, if you only want to configure that subdirectory; but be sure to specify a path to it. - For example, with version 5.2.1, type the following to configure only + For example, with version 5.3, type the following to configure only the `bfd' subdirectory: - cd gdb-5.2.1/bfd + cd gdb-5.3/bfd ../configure You can install `gdb' anywhere; it has no hardwired paths. However, @@ -277,13 +277,13 @@ directory. If the path to `configure' would be the same as the argument to `--srcdir', you can leave out the `--srcdir' option; it will be assumed.) - For example, with version 5.2.1, you can build GDB in a separate + For example, with version 5.3, you can build GDB in a separate directory for a Sun 4 like this: - cd gdb-5.2.1 + cd gdb-5.3 mkdir ../gdb-sun4 cd ../gdb-sun4 - ../gdb-5.2.1/configure + ../gdb-5.3/configure make When `configure' builds a configuration using a remote source @@ -304,8 +304,8 @@ called `configure' (or one of its subdirectories). The `Makefile' that `configure' generates in each source directory also runs recursively. If you type `make' in a source directory such -as `gdb-5.2.1' (or in a separate configured directory configured with -`--srcdir=PATH/gdb-5.2.1'), you will build all the required libraries, +as `gdb-5.3' (or in a separate configured directory configured with +`--srcdir=PATH/gdb-5.3'), you will build all the required libraries, and then build GDB. When you have multiple hosts or targets configured in separate @@ -348,7 +348,7 @@ you can use it to test your guesses on abbreviations--for example: Invalid configuration `i786v': machine `i786v' not recognized `config.sub' is also distributed in the GDB source directory -(`gdb-5.2.1', for version 5.2.1). +(`gdb-5.3', for version 5.3). `configure' options @@ -495,7 +495,7 @@ As an alternative, the bug report can be submitted, via e-mail, to the address "bug-gdb@gnu.org". When submitting a bug, please include the GDB version number (e.g., -gdb-5.2.1), and how you configured it (e.g., "sun4" or "mach386 host, +gdb-5.3), and how you configured it (e.g., "sun4" or "mach386 host, i586-intel-synopsys target"). Since GDB now supports so many different configurations, it is important that you be precise about this. If at all possible, you should include the actual banner that @@ -550,17 +550,17 @@ ftp://sources.redhat.com/pub/dejagnu/ will contain a recent snapshot. Once DejaGNU is installed, you can run the tests in one of the following ways: - (1) cd gdb-5.2.1 + (1) cd gdb-5.3 make check-gdb or - (2) cd gdb-5.2.1/gdb + (2) cd gdb-5.3/gdb make check or - (3) cd gdb-5.2.1/gdb/testsuite + (3) cd gdb-5.3/gdb/testsuite make site.exp (builds the site specific file) runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate) diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 12f4c483a6b..8aa4602475a 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -976,3 +976,71 @@ case "x$am_cv_prog_cc_stdc" in *) CC="$CC $am_cv_prog_cc_stdc" ;; esac ]) + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 index 5b9d643f04d..87016210486 100644 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -879,6 +879,74 @@ ifelse(yes,no,[ AC_DEFUN([CY_GNU_GETTEXT],) ]) +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include <stdlib.h> +#include <iconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) + # Copyright 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 67185a3e497..70a4b584f1c 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -90,6 +90,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define yylloc ada_lloc #define yyreds ada_reds /* With YYDEBUG defined */ #define yytoks ada_toks /* With YYDEBUG defined */ +#define yyname ada_name /* With YYDEBUG defined */ +#define yyrule ada_rule /* With YYDEBUG defined */ #ifndef YYDEBUG #define YYDEBUG 1 /* Default to yydebug support */ @@ -254,6 +256,7 @@ simple_exp : type '\'' save_qualifier { type_qualifier = $1; } '(' exp ')' ; save_qualifier : { $$ = type_qualifier; } + ; simple_exp : simple_exp '(' exp DOTDOT exp ')' @@ -530,7 +533,7 @@ exp : CHARLIT (convert_char_literal (type_qualifier, $1.val)); write_exp_elt_opcode (OP_LONG); } - + ; exp : FLOAT { write_exp_elt_opcode (OP_DOUBLE); @@ -546,6 +549,7 @@ exp : NULL_PTR write_exp_elt_longcst ((LONGEST)(0)); write_exp_elt_opcode (OP_LONG); } + ; exp : STRING { /* Ada strings are converted into array constants diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c58d46338ea..2838df7e68c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1852,10 +1852,7 @@ ada_array_bound_from_type (struct type * arr_type, int n, int which, supplied by run-time quantities other than discriminants. */ struct value * -ada_array_bound (arr, n, which) - struct value *arr; - int n; - int which; +ada_array_bound (struct value *arr, int n, int which) { struct type *arr_type = VALUE_TYPE (arr); @@ -2334,10 +2331,7 @@ ada_resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, liberal. FIXME: TOO liberal, in fact. */ static int -ada_type_match (ftype, atype, may_deref) - struct type *ftype; - struct type *atype; - int may_deref; +ada_type_match (struct type *ftype, struct type *atype, int may_deref) { CHECK_TYPEDEF (ftype); CHECK_TYPEDEF (atype); @@ -8104,7 +8098,7 @@ const struct language_defn ada_language_defn = { }; void -_initialize_ada_language () +_initialize_ada_language (void) { builtin_type_ada_int = init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 1c39e3ddecf..e822371748c 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -4,7 +4,7 @@ . This file is part of GDB. - [$Id: ada-tasks.c,v 1.4 2002/08/18 18:07:22 aidan Exp $] + [$Id: ada-tasks.c,v 1.5 2002/09/08 17:43:40 aidan Exp $] Authors: Roch-Alexandre Nomine Beguin, Arnaud Charlet <charlet@gnat.com> This program is free software; you can redistribute it and/or modify @@ -270,7 +270,7 @@ get_self_id (void) } int -get_current_task () +get_current_task (void) { int result; diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index fc2db703035..0a0c99add1e 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -75,8 +75,7 @@ static int ada_val_print_1 (struct type *, char *, int, CORE_ADDR, /* Make TYPE unsigned if its range of values includes no negatives. */ static void -adjust_type_signedness (type) - struct type *type; +adjust_type_signedness (struct type *type) { if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE && TYPE_LOW_BOUND (type) >= 0) diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index 519d8164ca3..bc7b1a410db 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -21,6 +21,7 @@ #include "defs.h" #include "gdbcore.h" +#include "frame.h" #include "regcache.h" #include "value.h" @@ -178,7 +179,31 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc) static int alphanbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) { - return (alphanbsd_sigtramp_offset (pc) >= 0); + return (nbsd_pc_in_sigtramp (pc, func_name) + || alphanbsd_sigtramp_offset (pc) >= 0); +} + +static CORE_ADDR +alphanbsd_sigcontext_addr (struct frame_info *frame) +{ + /* FIXME: This is not correct for all versions of NetBSD/alpha. + We will probably need to disassemble the trampoline to figure + out which trampoline frame type we have. */ + return frame->frame; +} + +static CORE_ADDR +alphanbsd_skip_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc) +{ + char *name; + + /* FIXME: This is not correct for all versions of NetBSD/alpha. + We will probably need to disassemble the trampoline to figure + out which trampoline frame type we have. */ + find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); + if (PC_IN_SIGTRAMP (pc, name)) + return frame->frame; + return 0; } static void @@ -196,7 +221,9 @@ alphanbsd_init_abi (struct gdbarch_info info, set_solib_svr4_fetch_link_map_offsets (gdbarch, nbsd_lp64_solib_svr4_fetch_link_map_offsets); + tdep->skip_sigtramp_frame = alphanbsd_skip_sigtramp_frame; tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset; + tdep->sigcontext_addr = alphanbsd_sigcontext_addr; tdep->jb_pc = 2; tdep->jb_elt_size = 8; diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index ecdecaf9a1a..a056177553e 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -423,8 +423,19 @@ legacy_virtual_frame_pointer (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset) { - gdb_assert (FP_REGNUM >= 0); - *frame_regnum = FP_REGNUM; + /* FIXME: cagney/2002-09-13: This code is used when identifying the + frame pointer of the current PC. It is assuming that a single + register and an offset can determine this. I think it should + instead generate a byte code expression as that would work better + with things like Dwarf2's CFI. */ + if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS) + *frame_regnum = FP_REGNUM; + else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS) + *frame_regnum = SP_REGNUM; + else + /* Should this be an internal error? I guess so, it is reflecting + an architectural limitation in the current design. */ + internal_error (__FILE__, __LINE__, "No virtual frame pointer available"); *frame_offset = 0; } @@ -438,18 +449,6 @@ generic_register_size (int regnum) return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum)); } -#if !defined (IN_SIGTRAMP) -#if defined (SIGTRAMP_START) -#define IN_SIGTRAMP(pc, name) \ - ((pc) >= SIGTRAMP_START(pc) \ - && (pc) < SIGTRAMP_END(pc) \ - ) -#else -#define IN_SIGTRAMP(pc, name) \ - (name && STREQ ("_sigtramp", name)) -#endif -#endif - /* Assume all registers are adjacent. */ int @@ -470,7 +469,14 @@ generic_register_byte (int regnum) int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name) { - return IN_SIGTRAMP(pc, name); +#if !defined (IN_SIGTRAMP) + if (SIGTRAMP_START_P ()) + return (pc) >= SIGTRAMP_START (pc) && (pc) < SIGTRAMP_END (pc); + else + return name && strcmp ("_sigtramp", name) == 0; +#else + return IN_SIGTRAMP (pc, name); +#endif } int diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index b896b688650..82444d1c594 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -225,10 +225,10 @@ arm_pc_is_thumb_dummy (CORE_ADDR memaddr) static CORE_ADDR arm_addr_bits_remove (CORE_ADDR val) { - if (arm_pc_is_thumb (val)) - return (val & (arm_apcs_32 ? 0xfffffffe : 0x03fffffe)); + if (arm_apcs_32) + return (val & (arm_pc_is_thumb (val) ? 0xfffffffe : 0xfffffffc)); else - return (val & (arm_apcs_32 ? 0xfffffffc : 0x03fffffc)); + return (val & 0x03fffffc); } /* When reading symbols, we need to zap the low bit of the address, @@ -995,7 +995,7 @@ arm_find_callers_reg (struct frame_info *fi, int regnum) if (USE_GENERIC_DUMMY_FRAMES && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) { - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); } else if (fi->saved_regs[regnum] != 0) { @@ -1110,8 +1110,8 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) && PC_IN_CALL_DUMMY (fi->next->pc, 0, 0)) /* For generic dummy frames, pull the value direct from the frame. Having an unwind function to do this would be nice. */ - sp = generic_read_register_dummy (fi->next->pc, fi->next->frame, - ARM_SP_REGNUM); + sp = deprecated_read_register_dummy (fi->next->pc, fi->next->frame, + ARM_SP_REGNUM); else sp = (fi->next->frame - fi->next->extra_info->frameoffset + fi->next->extra_info->framesize); @@ -1143,7 +1143,8 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) fi->extra_info->frameoffset = 0; } - else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame)) + else if (!USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame)) { CORE_ADDR rp; CORE_ADDR callers_sp; @@ -1162,7 +1163,10 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) callers_sp = read_memory_integer (fi->saved_regs[ARM_SP_REGNUM], REGISTER_RAW_SIZE (ARM_SP_REGNUM)); - fi->extra_info->framereg = ARM_FP_REGNUM; + if (arm_pc_is_thumb (fi->pc)) + fi->extra_info->framereg = THUMB_FP_REGNUM; + else + fi->extra_info->framereg = ARM_FP_REGNUM; fi->extra_info->framesize = callers_sp - sp; fi->extra_info->frameoffset = fi->frame - sp; } @@ -1217,7 +1221,7 @@ arm_frame_saved_pc (struct frame_info *fi) /* If a dummy frame, pull the PC out of the frame's register buffer. */ if (USE_GENERIC_DUMMY_FRAMES && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) - return generic_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM); if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset, fi->frame)) @@ -2279,9 +2283,12 @@ arm_extract_return_value (struct type *type, the address in which a function should return its structure value. */ static CORE_ADDR -arm_extract_struct_value_address (char *regbuf) +arm_extract_struct_value_address (struct regcache *regcache) { - return extract_address (regbuf, REGISTER_RAW_SIZE(ARM_A1_REGNUM)); + ULONGEST ret; + + regcache_cooked_read_unsigned (regcache, ARM_A1_REGNUM, &ret); + return ret; } /* Will a function return an aggregate type in memory or in a @@ -2929,7 +2936,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_return_value (gdbarch, arm_store_return_value); set_gdbarch_store_struct_return (gdbarch, arm_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention); - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, + set_gdbarch_extract_struct_value_address (gdbarch, arm_extract_struct_value_address); /* Single stepping. */ diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index b24533223c6..c67e4e8d8d5 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -524,7 +524,6 @@ avr_scan_prologue (struct frame_info *fi) { fi->frame = locals; - /* TRoth: Does -1 mean we're in main? */ fi->extra_info->is_main = 1; return; } @@ -755,7 +754,8 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, fi->frame); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + AVR_PC_REGNUM); } else if (!fi->next) /* this is the innermost frame? */ fi->frame = read_register (fi->extra_info->framereg); @@ -867,8 +867,8 @@ static CORE_ADDR avr_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return generic_read_register_dummy (frame->pc, frame->frame, - AVR_PC_REGNUM); + return deprecated_read_register_dummy (frame->pc, frame->frame, + AVR_PC_REGNUM); else return frame->extra_info->return_pc; } @@ -957,10 +957,10 @@ avr_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { unsigned char buf[2]; int wordsize = 2; +#if 0 struct minimal_symbol *msymbol; CORE_ADDR mon_brk; - - fprintf_unfiltered (gdb_stderr, "avr_push_return_address() was called\n"); +#endif buf[0] = 0; buf[1] = 0; @@ -1033,10 +1033,9 @@ avr_frame_chain (struct frame_info *frame) if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) { /* initialize the return_pc now */ - frame->extra_info->return_pc = generic_read_register_dummy (frame->pc, - frame-> - frame, - AVR_PC_REGNUM); + frame->extra_info->return_pc + = deprecated_read_register_dummy (frame->pc, frame->frame, + AVR_PC_REGNUM); return frame->frame; } return (frame->extra_info->is_main ? 0 @@ -1216,8 +1215,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_max_register_virtual_size (gdbarch, 4); set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type); - /* We might need to define our own here or define FRAME_INIT_SAVED_REGS */ - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register); set_gdbarch_print_insn (gdbarch, print_insn_avr); @@ -1241,7 +1239,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_extract_return_value (gdbarch, avr_extract_return_value); set_gdbarch_push_arguments (gdbarch, avr_push_arguments); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); -/* set_gdbarch_push_return_address (gdbarch, avr_push_return_address); */ + set_gdbarch_push_return_address (gdbarch, avr_push_return_address); set_gdbarch_pop_frame (gdbarch, avr_pop_frame); set_gdbarch_deprecated_store_return_value (gdbarch, avr_store_return_value); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index b2c5d0eabe9..674285d7074 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -816,8 +816,7 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name, /* If sigtramp is in the u area, it counts as a function (especially important for step_1). */ -#if defined SIGTRAMP_START - if (PC_IN_SIGTRAMP (mapped_pc, (char *) NULL)) + if (SIGTRAMP_START_P () && PC_IN_SIGTRAMP (mapped_pc, (char *) NULL)) { cache_pc_function_low = SIGTRAMP_START (mapped_pc); cache_pc_function_high = SIGTRAMP_END (mapped_pc); @@ -825,7 +824,6 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name, cache_pc_function_section = section; goto return_cached_value; } -#endif msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section); pst = find_pc_sect_psymtab (mapped_pc, section); @@ -1210,7 +1208,7 @@ generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) Find a saved register from before GDB calls a function in the inferior */ CORE_ADDR -generic_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) +deprecated_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) { struct regcache *dummy_regs = generic_find_dummy_frame (pc, fp); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0fa899ce37c..153f1c50078 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -41,6 +41,7 @@ #include "annotate.h" #include "symfile.h" #include "objfiles.h" +#include "source.h" #include "linespec.h" #include "completer.h" #include "gdb.h" @@ -717,15 +718,13 @@ insert_breakpoints (void) int val = 0; int disabled_breaks = 0; int hw_breakpoint_error = 0; +#ifdef ONE_PROCESS_WRITETEXT int process_warning = 0; +#endif static char message1[] = "Error inserting catchpoint %d:\n"; static char message[sizeof (message1) + 30]; -#ifdef ONE_PROCESS_WRITETEXT - process_warning = 1; -#endif - struct ui_file *tmp_error_stream = mem_fileopen (); make_cleanup_ui_file_delete (tmp_error_stream); @@ -738,7 +737,19 @@ insert_breakpoints (void) if (b->enable_state == bp_permanent) /* Permanent breakpoints cannot be inserted or removed. */ continue; - else if (b->type != bp_watchpoint + if ((b->type == bp_watchpoint + || b->type == bp_hardware_watchpoint + || b->type == bp_read_watchpoint + || b->type == bp_access_watchpoint) && (!b->val)) + { + struct value *val; + val = evaluate_expression (b->exp); + release_value (val); + if (VALUE_LAZY (val)) + value_fetch_lazy (val); + b->val = val; + } + if (b->type != bp_watchpoint && b->type != bp_hardware_watchpoint && b->type != bp_read_watchpoint && b->type != bp_access_watchpoint @@ -825,17 +836,21 @@ insert_breakpoints (void) if (!disabled_breaks) { fprintf_unfiltered (tmp_error_stream, - "Cannot insert breakpoint %d.\n", b->number); + "Cannot insert breakpoint %d.\n", + b->number); fprintf_unfiltered (tmp_error_stream, "Temporarily disabling shared library breakpoints:\n"); } disabled_breaks = 1; - fprintf_unfiltered (tmp_error_stream, "breakpoint #%d\n", b->number); + fprintf_unfiltered (tmp_error_stream, + "breakpoint #%d\n", b->number); } else #endif { +#ifdef ONE_PROCESS_WRITETEXT process_warning = 1; +#endif if (b->type == bp_hardware_breakpoint) { hw_breakpoint_error = 1; @@ -845,8 +860,11 @@ insert_breakpoints (void) } else { - fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number); - fprintf_filtered (tmp_error_stream, "Error accessing memory address "); + fprintf_unfiltered (tmp_error_stream, + "Cannot insert breakpoint %d.\n", + b->number); + fprintf_filtered (tmp_error_stream, + "Error accessing memory address "); print_address_numeric (b->address, 1, tmp_error_stream); fprintf_filtered (tmp_error_stream, ": %s.\n", safe_strerror (val)); @@ -881,7 +899,8 @@ insert_breakpoints (void) fprintf_unfiltered (tmp_error_stream, "Cannot insert catchpoint %d; disabling it.\n", b->number); - fprintf_filtered (tmp_error_stream, "Error accessing memory address "); + fprintf_filtered (tmp_error_stream, + "Error accessing memory address "); print_address_numeric (b->address, 1, tmp_error_stream); fprintf_filtered (tmp_error_stream, ": %s.\n", safe_strerror (val)); @@ -1010,11 +1029,11 @@ insert_breakpoints (void) value chain brings us here. */ if (!b->inserted) { - process_warning = 1; remove_breakpoint (b, mark_uninserted); hw_breakpoint_error = 1; fprintf_unfiltered (tmp_error_stream, - "Cannot insert hardware watchpoint %d.\n", b->number); + "Could not insert hardware watchpoint %d.\n", + b->number); val = -1; } } @@ -1061,7 +1080,8 @@ insert_breakpoints (void) } if (val < 0) { - fprintf_unfiltered (tmp_error_stream, "Cannot insert catchpoint %d.", b->number); + fprintf_unfiltered (tmp_error_stream, + "Cannot insert catchpoint %d.", b->number); } else b->inserted = 1; @@ -1077,13 +1097,15 @@ insert_breakpoints (void) message about possibly exhausted resources. */ if (hw_breakpoint_error) { - fprintf_unfiltered (tmp_error_stream, "Could not insert hardware breakpoints:\n" - "You may have requested too many hardware breakpoints/watchpoints.\n"); + fprintf_unfiltered (tmp_error_stream, + "Could not insert hardware breakpoints:\n\ +You may have requested too many hardware breakpoints/watchpoints.\n"); } - +#ifdef ONE_PROCESS_WRITETEXT if (process_warning) - fprintf_unfiltered (tmp_error_stream,"The same program may be running in another process."); - + fprintf_unfiltered (tmp_error_stream, + "The same program may be running in another process."); +#endif target_terminal_ours_for_output (); error_stream (tmp_error_stream); } @@ -1566,6 +1588,14 @@ breakpoint_init_inferior (enum inf_context context) /* Likewise for watchpoints on local expressions. */ if (b->exp_valid_block != NULL) delete_breakpoint (b); + if (context == inf_starting) + { + /* Reset val field to force reread of starting value + in insert_breakpoints. */ + if (b->val) + value_free (b->val); + b->val = NULL; + } break; default: /* Likewise for exception catchpoints in dynamic-linked @@ -4586,8 +4616,11 @@ parse_breakpoint_sals (char **address, current_source_symtab (which is decode_line_1's default). This should produce the results we want almost all of the time while leaving default_breakpoint_* alone. */ + + struct symtab_and_line cursal = get_current_source_symtab_and_line (); + if (default_breakpoint_valid - && (!current_source_symtab + && (!cursal.symtab || (strchr ("+-", (*address)[0]) != NULL))) *sals = decode_line_1 (address, 1, default_breakpoint_symtab, default_breakpoint_line, addr_string); diff --git a/gdb/buildsym.c b/gdb/buildsym.c index b1962dffeae..9d9b4f74482 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -422,7 +422,9 @@ finish_block (struct symbol *symbol, struct pending **listhead, start of this scope that don't have superblocks yet. */ opblock = NULL; - for (pblock = pending_blocks; pblock != old_blocks; pblock = pblock->next) + for (pblock = pending_blocks; + pblock && pblock != old_blocks; + pblock = pblock->next) { if (BLOCK_SUPERBLOCK (pblock->block) == NULL) { diff --git a/gdb/builtin-regs.c b/gdb/builtin-regs.c index 8c488e3a557..07e5fcca58a 100644 --- a/gdb/builtin-regs.c +++ b/gdb/builtin-regs.c @@ -68,6 +68,15 @@ builtin_reg_map_name_to_regnum (const char *name, int len) return -1; } +const char * +builtin_reg_map_regnum_to_name (int regnum) +{ + int reg = regnum - (NUM_REGS + NUM_PSEUDO_REGS); + if (reg < 0 || reg >= nr_builtin_regs) + return NULL; + return builtin_regs[reg].name; +} + struct value * value_of_builtin_reg (int regnum, struct frame_info *frame) { diff --git a/gdb/builtin-regs.h b/gdb/builtin-regs.h index b35c4e91362..fb9fbcf8f8e 100644 --- a/gdb/builtin-regs.h +++ b/gdb/builtin-regs.h @@ -26,6 +26,8 @@ extern int builtin_reg_map_name_to_regnum (const char *str, int len); +extern const char *builtin_reg_map_regnum_to_name (int regnum); + extern struct value *value_of_builtin_reg (int regnum, struct frame_info *frame); diff --git a/gdb/c-exp.y b/gdb/c-exp.y index ea5083646e0..376f6d56370 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -49,6 +49,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" /* Required by objfiles.h. */ #include "symfile.h" /* Required by objfiles.h. */ #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "charset.h" /* Flag indicating we're dealing with HP-compiled objects */ extern int hp_som_som_object_present; @@ -89,6 +90,8 @@ extern int hp_som_som_object_present; #define yylloc c_lloc #define yyreds c_reds /* With YYDEBUG defined */ #define yytoks c_toks /* With YYDEBUG defined */ +#define yyname c_name /* With YYDEBUG defined */ +#define yyrule c_rule /* With YYDEBUG defined */ #define yylhs c_yylhs #define yylen c_yylen #define yydefred c_yydefred @@ -1312,6 +1315,15 @@ yylex () c = parse_escape (&lexptr); else if (c == '\'') error ("Empty character constant."); + else if (! host_char_to_target (c, &c)) + { + int toklen = lexptr - tokstart + 1; + char *tok = alloca (toklen + 1); + memcpy (tok, tokstart, toklen); + tok[toklen] = '\0'; + error ("There is no character corresponding to %s in the target " + "character set `%s'.", tok, target_charset ()); + } yylval.typed_val_int.val = c; yylval.typed_val_int.type = builtin_type_char; @@ -1462,6 +1474,8 @@ yylex () tempbufindex = 0; do { + char *char_start_pos = tokptr; + /* Grow the static temp buffer if necessary, including allocating the first one on demand. */ if (tempbufindex + 1 >= tempbufsize) @@ -1484,7 +1498,19 @@ yylex () tempbuf[tempbufindex++] = c; break; default: - tempbuf[tempbufindex++] = *tokptr++; + c = *tokptr++; + if (! host_char_to_target (c, &c)) + { + int len = tokptr - char_start_pos; + char *copy = alloca (len + 1); + memcpy (copy, char_start_pos, len); + copy[len] = '\0'; + + error ("There is no character corresponding to `%s' " + "in the target character set `%s'.", + copy, target_charset ()); + } + tempbuf[tempbufindex++] = c; break; } } while ((*tokptr != '"') && (*tokptr != '\0')); diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 9ee92ad8b8c..4b4af164ec5 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -29,6 +29,8 @@ #include "valprint.h" #include "macroscope.h" #include "gdb_assert.h" +#include "charset.h" +#include "gdb_string.h" extern void _initialize_c_language (void); static void c_emit_char (int c, struct ui_file * stream, int quoter); @@ -40,52 +42,30 @@ static void c_emit_char (int c, struct ui_file * stream, int quoter); static void c_emit_char (register int c, struct ui_file *stream, int quoter) { + const char *escape; + int host_char; + c &= 0xFF; /* Avoid sign bit follies */ - if (PRINT_LITERAL_FORM (c)) + escape = c_target_char_has_backslash_escape (c); + if (escape) { - if (c == '\\' || c == quoter) - { - fputs_filtered ("\\", stream); - } - fprintf_filtered (stream, "%c", c); + if (quoter == '"' && strcmp (escape, "0") == 0) + /* Print nulls embedded in double quoted strings as \000 to + prevent ambiguity. */ + fprintf_filtered (stream, "\\000"); + else + fprintf_filtered (stream, "\\%s", escape); } - else + else if (target_char_to_host (c, &host_char) + && host_char_print_literally (host_char)) { - switch (c) - { - case '\n': - fputs_filtered ("\\n", stream); - break; - case '\b': - fputs_filtered ("\\b", stream); - break; - case '\t': - fputs_filtered ("\\t", stream); - break; - case '\f': - fputs_filtered ("\\f", stream); - break; - case '\r': - fputs_filtered ("\\r", stream); - break; - case '\013': - fputs_filtered ("\\v", stream); - break; - case '\033': - fputs_filtered ("\\e", stream); - break; - case '\007': - fputs_filtered ("\\a", stream); - break; - case '\0': - fputs_filtered ("\\0", stream); - break; - default: - fprintf_filtered (stream, "\\%.3o", (unsigned int) c); - break; - } + if (host_char == '\\' || host_char == quoter) + fputs_filtered ("\\", stream); + fprintf_filtered (stream, "%c", host_char); } + else + fprintf_filtered (stream, "\\%.3o", (unsigned int) c); } void diff --git a/gdb/charset.c b/gdb/charset.c new file mode 100644 index 00000000000..00e10659a54 --- /dev/null +++ b/gdb/charset.c @@ -0,0 +1,1274 @@ +/* Character set conversion support for GDB. + Copyright 2001 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "charset.h" +#include "gdbcmd.h" +#include "gdb_assert.h" + +#include <stddef.h> +#include <string.h> +#include <ctype.h> + +#ifdef HAVE_ICONV +#include <iconv.h> +#endif + + +/* How GDB's character set support works + + GDB has two global settings: + + - The `current host character set' is the character set GDB should + use in talking to the user, and which (hopefully) the user's + terminal knows how to display properly. + + - The `current target character set' is the character set the + program being debugged uses. + + There are commands to set each of these, and mechanisms for + choosing reasonable default values. GDB has a global list of + character sets that it can use as its host or target character + sets. + + The header file `charset.h' declares various functions that + different pieces of GDB need to perform tasks like: + + - printing target strings and characters to the user's terminal + (mostly target->host conversions), + + - building target-appropriate representations of strings and + characters the user enters in expressions (mostly host->target + conversions), + + and so on. + + Now, many of these operations are specific to a particular + host/target character set pair. If GDB supports N character sets, + there are N^2 possible pairs. This means that, the larger GDB's + repertoire of character sets gets, the more expensive it gets to add + new character sets. + + To make sure that GDB can do the right thing for every possible + pairing of host and target character set, while still allowing + GDB's repertoire to scale, we use a two-tiered approach: + + - We maintain a global table of "translations" --- groups of + functions specific to a particular pair of character sets. + + - However, a translation can be incomplete: some functions can be + omitted. Where there is not a translation to specify exactly + what function to use, we provide reasonable defaults. The + default behaviors try to use the "iconv" library functions, which + support a wide range of character sets. However, even if iconv + is not available, there are fallbacks to support trivial + translations: when the host and target character sets are the + same. */ + + +/* The character set and translation structures. */ + + +/* A character set GDB knows about. GDB only supports character sets + with stateless encodings, in which every character is one byte + long. */ +struct charset { + + /* A singly-linked list of all known charsets. */ + struct charset *next; + + /* The name of the character set. Comparisons on character set + names are case-insensitive. */ + const char *name; + + /* Non-zero iff this character set can be used as a host character + set. At present, GDB basically assumes that the host character + set is a superset of ASCII. */ + int valid_host_charset; + + /* Pointers to charset-specific functions that depend only on a + single character set, and data pointers to pass to them. */ + int (*host_char_print_literally) (void *baton, + int host_char); + void *host_char_print_literally_baton; + + int (*target_char_to_control_char) (void *baton, + int target_char, + int *target_ctrl_char); + void *target_char_to_control_char_baton; +}; + + +/* A translation from one character set to another. */ +struct translation { + + /* A singly-linked list of all known translations. */ + struct translation *next; + + /* This structure describes functions going from the FROM character + set to the TO character set. Comparisons on character set names + are case-insensitive. */ + const char *from, *to; + + /* Pointers to translation-specific functions, and data pointers to + pass to them. These pointers can be zero, indicating that GDB + should fall back on the default behavior. We hope the default + behavior will be correct for many from/to pairs, reducing the + number of translations that need to be registered explicitly. */ + + /* TARGET_CHAR is in the `from' charset. + Returns a string in the `to' charset. */ + const char *(*c_target_char_has_backslash_escape) (void *baton, + int target_char); + void *c_target_char_has_backslash_escape_baton; + + /* HOST_CHAR is in the `from' charset. + TARGET_CHAR points to a char in the `to' charset. */ + int (*c_parse_backslash) (void *baton, int host_char, int *target_char); + void *c_parse_backslash_baton; + + /* This is used for the host_char_to_target and target_char_to_host + functions. */ + int (*convert_char) (void *baton, int from, int *to); + void *convert_char_baton; +}; + + + +/* The global lists of character sets and translations. */ + + +/* Character set names are always compared ignoring case. */ +static int +strcmp_case_insensitive (const char *p, const char *q) +{ + while (*p && *q && tolower (*p) == tolower (*q)) + p++, q++; + + return tolower (*p) - tolower (*q); +} + + +/* The global list of all the charsets GDB knows about. */ +static struct charset *all_charsets; + + +static void +register_charset (struct charset *cs) +{ + struct charset **ptr; + + /* Put the new charset on the end, so that the list ends up in the + same order as the registrations in the _initialize function. */ + for (ptr = &all_charsets; *ptr; ptr = &(*ptr)->next) + ; + + cs->next = 0; + *ptr = cs; +} + + +static struct charset * +lookup_charset (const char *name) +{ + struct charset *cs; + + for (cs = all_charsets; cs; cs = cs->next) + if (! strcmp_case_insensitive (name, cs->name)) + return cs; + + return NULL; +} + + +/* The global list of translations. */ +static struct translation *all_translations; + + +static void +register_translation (struct translation *t) +{ + t->next = all_translations; + all_translations = t; +} + + +static struct translation * +lookup_translation (const char *from, const char *to) +{ + struct translation *t; + + for (t = all_translations; t; t = t->next) + if (! strcmp_case_insensitive (from, t->from) + && ! strcmp_case_insensitive (to, t->to)) + return t; + + return 0; +} + + + +/* Constructing charsets. */ + +/* Allocate, initialize and return a straightforward charset. + Use this function, rather than creating the structures yourself, + so that we can add new fields to the structure in the future without + having to tweak all the old charset descriptions. */ +static struct charset * +simple_charset (const char *name, + int valid_host_charset, + int (*host_char_print_literally) (void *baton, int host_char), + void *host_char_print_literally_baton, + int (*target_char_to_control_char) (void *baton, + int target_char, + int *target_ctrl_char), + void *target_char_to_control_char_baton) +{ + struct charset *cs = xmalloc (sizeof (*cs)); + + memset (cs, 0, sizeof (*cs)); + cs->name = name; + cs->valid_host_charset = valid_host_charset; + cs->host_char_print_literally = host_char_print_literally; + cs->host_char_print_literally_baton = host_char_print_literally_baton; + cs->target_char_to_control_char = target_char_to_control_char; + cs->target_char_to_control_char_baton = target_char_to_control_char_baton; + + return cs; +} + + + +/* ASCII functions. */ + +static int +ascii_print_literally (void *baton, int c) +{ + c &= 0xff; + + return (0x20 <= c && c <= 0x7e); +} + + +static int +ascii_to_control (void *baton, int c, int *ctrl_char) +{ + *ctrl_char = (c & 037); + return 1; +} + + +/* ISO-8859 family functions. */ + + +static int +iso_8859_print_literally (void *baton, int c) +{ + c &= 0xff; + + return ((0x20 <= c && c <= 0x7e) /* ascii printables */ + || (! sevenbit_strings && 0xA0 <= c)); /* iso 8859 printables */ +} + + +static int +iso_8859_to_control (void *baton, int c, int *ctrl_char) +{ + *ctrl_char = (c & 0200) | (c & 037); + return 1; +} + + +/* Construct an ISO-8859-like character set. */ +static struct charset * +iso_8859_family_charset (const char *name) +{ + return simple_charset (name, 1, + iso_8859_print_literally, 0, + iso_8859_to_control, 0); +} + + + +/* EBCDIC family functions. */ + + +static int +ebcdic_print_literally (void *baton, int c) +{ + c &= 0xff; + + return (64 <= c && c <= 254); +} + + +static int +ebcdic_to_control (void *baton, int c, int *ctrl_char) +{ + /* There are no control character equivalents in EBCDIC. Use + numeric escapes. */ + return 0; +} + + +/* Construct an EBCDIC-like character set. */ +static struct charset * +ebcdic_family_charset (const char *name) +{ + return simple_charset (name, 0, + ebcdic_print_literally, 0, + ebcdic_to_control, 0); +} + + + + + +/* Fallback functions using iconv. */ + +#if defined(HAVE_ICONV) + +struct cached_iconv { + struct charset *from, *to; + iconv_t i; +}; + + +/* Make sure the iconv cache *CI contains an iconv descriptor + translating from FROM to TO. If it already does, fine; otherwise, + close any existing descriptor, and open up a new one. On success, + return zero; on failure, return -1 and set errno. */ +static int +check_iconv_cache (struct cached_iconv *ci, + struct charset *from, + struct charset *to) +{ + iconv_t i; + + /* Does the cached iconv descriptor match the conversion we're trying + to do now? */ + if (ci->from == from + && ci->to == to + && ci->i != (iconv_t) 0) + return 0; + + /* It doesn't. If we actually had any iconv descriptor open at + all, close it now. */ + if (ci->i != (iconv_t) 0) + { + i = ci->i; + ci->i = (iconv_t) 0; + + if (iconv_close (i) == -1) + error ("Error closing `iconv' descriptor for " + "`%s'-to-`%s' character conversion: %s", + ci->from->name, ci->to->name, safe_strerror (errno)); + } + + /* Open a new iconv descriptor for the required conversion. */ + i = iconv_open (to->name, from->name); + if (i == (iconv_t) -1) + return -1; + + ci->i = i; + ci->from = from; + ci->to = to; + + return 0; +} + + +/* Convert FROM_CHAR using the cached iconv conversion *CI. Return + non-zero if the conversion was successful, zero otherwise. */ +static int +cached_iconv_convert (struct cached_iconv *ci, int from_char, int *to_char) +{ + char from; + ICONV_CONST char *from_ptr = &from; + char to, *to_ptr = &to; + size_t from_left = sizeof (from), to_left = sizeof (to); + + gdb_assert (ci->i != (iconv_t) 0); + + from = from_char; + if (iconv (ci->i, &from_ptr, &from_left, &to_ptr, &to_left) + == (size_t) -1) + { + /* These all suggest that the input or output character sets + have multi-byte encodings of some characters, which means + it's unsuitable for use as a GDB character set. We should + never have selected it. */ + gdb_assert (errno != E2BIG && errno != EINVAL); + + /* This suggests a bug in the code managing *CI. */ + gdb_assert (errno != EBADF); + + /* This seems to mean that there is no equivalent character in + the `to' character set. */ + if (errno == EILSEQ) + return 0; + + /* Anything else is mysterious. */ + internal_error ("Error converting character `%d' from `%s' to `%s' " + "character set: %s", + from_char, ci->from->name, ci->to->name, + safe_strerror (errno)); + } + + /* If the pointers weren't advanced across the input, that also + suggests something was wrong. */ + gdb_assert (from_left == 0 && to_left == 0); + + *to_char = (unsigned char) to; + return 1; +} + + +static void +register_iconv_charsets () +{ + /* Here we should check whether various character sets were + recognized by the local iconv implementation. + + The first implementation registered a bunch of character sets + recognized by iconv, but then we discovered that iconv on Solaris + and iconv on GNU/Linux had no character sets in common. So we + replaced them with the hard-coded tables that appear later in the + file. */ +} + +#endif /* defined (HAVE_ICONV) */ + + +/* Fallback routines for systems without iconv. */ + +#if ! defined (HAVE_ICONV) +struct cached_iconv { char nothing; }; + +static int +check_iconv_cache (struct cached_iconv *ci, + struct charset *from, + struct charset *to) +{ + errno = EINVAL; + return -1; +} + +static int +cached_iconv_convert (struct cached_iconv *ci, int from_char, int *to_char) +{ + /* This function should never be called. */ + gdb_assert (0); +} + +static void +register_iconv_charsets () +{ +} + +#endif /* ! defined(HAVE_ICONV) */ + + +/* Default trivial conversion functions. */ + +static int +identity_either_char_to_other (void *baton, int either_char, int *other_char) +{ + *other_char = either_char; + return 1; +} + + + +/* Default non-trivial conversion functions. */ + + +static char backslashable[] = "abefnrtv"; +static char *backslashed[] = {"a", "b", "e", "f", "n", "r", "t", "v", "0"}; +static char represented[] = "\a\b\e\f\n\r\t\v"; + + +/* Translate TARGET_CHAR into the host character set, and see if it + matches any of our standard escape sequences. */ +static const char * +default_c_target_char_has_backslash_escape (void *baton, int target_char) +{ + int host_char; + const char *ix; + + /* If target_char has no equivalent in the host character set, + assume it doesn't have a backslashed form. */ + if (! target_char_to_host (target_char, &host_char)) + return NULL; + + ix = strchr (represented, host_char); + if (ix) + return backslashed[ix - represented]; + else + return NULL; +} + + +/* Translate the backslash the way we would in the host character set, + and then try to translate that into the target character set. */ +static int +default_c_parse_backslash (void *baton, int host_char, int *target_char) +{ + const char *ix; + + ix = strchr (backslashable, host_char); + + if (! ix) + return 0; + else + return host_char_to_target (represented[ix - backslashable], + target_char); +} + + +/* Convert using a cached iconv descriptor. */ +static int +iconv_convert (void *baton, int from_char, int *to_char) +{ + struct cached_iconv *ci = baton; + return cached_iconv_convert (ci, from_char, to_char); +} + + + +/* Conversion tables. */ + + +/* I'd much rather fall back on iconv whenever possible. But the + character set names you use with iconv aren't standardized at all, + a lot of platforms have really meager character set coverage, etc. + I wanted to have at least something we could use to exercise the + test suite on all platforms. + + In the long run, we should have a configure-time process explore + somehow which character sets the host platform supports, and some + arrangement that allows GDB users to use platform-indepedent names + for character sets. */ + + +/* We generated these tables using iconv on a GNU/Linux machine. */ + + +static int ascii_to_iso_8859_1_table[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 32 */ + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 48 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 64 */ + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 80 */ + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 96 */ + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, /* 112 */ + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, /* 128 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 144 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 160 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 208 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 224 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 240 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int ascii_to_ebcdic_us_table[] = { + 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, /* 32 */ + 64, 90,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, /* 48 */ + 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, /* 64 */ + 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214, /* 80 */ + 215,216,217,226,227,228,229,230,231,232,233, -1,224, -1, -1,109, /* 96 */ + 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, /* 112 */ + 151,152,153,162,163,164,165,166,167,168,169,192, 79,208,161, 7, /* 128 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 144 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 160 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 208 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 224 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 240 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int ascii_to_ibm1047_table[] = { + 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, /* 32 */ + 64, 90,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, /* 48 */ + 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, /* 64 */ + 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214, /* 80 */ + 215,216,217,226,227,228,229,230,231,232,233,173,224,189, 95,109, /* 96 */ + 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, /* 112 */ + 151,152,153,162,163,164,165,166,167,168,169,192, 79,208,161, 7, /* 128 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 144 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 160 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 208 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 224 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 240 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int iso_8859_1_to_ascii_table[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 32 */ + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 48 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 64 */ + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 80 */ + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 96 */ + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, /* 112 */ + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, /* 128 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 144 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 160 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 208 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 224 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 240 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int iso_8859_1_to_ebcdic_us_table[] = { + 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, /* 32 */ + 64, 90,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, /* 48 */ + 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, /* 64 */ + 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214, /* 80 */ + 215,216,217,226,227,228,229,230,231,232,233, -1,224, -1, -1,109, /* 96 */ + 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, /* 112 */ + 151,152,153,162,163,164,165,166,167,168,169,192, 79,208,161, 7, /* 128 */ + 32, 33, 34, 35, 36, 21, 6, 23, 40, 41, 42, 43, 44, 9, 10, 27, /* 144 */ + 48, 49, 26, 51, 52, 53, 54, 8, 56, 57, 58, 59, 4, 20, 62,255, /* 160 */ + -1, -1, 74, -1, -1, -1,106, -1, -1, -1, -1, -1, 95, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 208 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 224 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 240 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int iso_8859_1_to_ibm1047_table[] = { + 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, /* 32 */ + 64, 90,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, /* 48 */ + 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, /* 64 */ + 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214, /* 80 */ + 215,216,217,226,227,228,229,230,231,232,233,173,224,189, 95,109, /* 96 */ + 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, /* 112 */ + 151,152,153,162,163,164,165,166,167,168,169,192, 79,208,161, 7, /* 128 */ + 32, 33, 34, 35, 36, 21, 6, 23, 40, 41, 42, 43, 44, 9, 10, 27, /* 144 */ + 48, 49, 26, 51, 52, 53, 54, 8, 56, 57, 58, 59, 4, 20, 62,255, /* 160 */ + 65,170, 74,177,159,178,106,181,187,180,154,138,176,202,175,188, /* 176 */ + 144,143,234,250,190,160,182,179,157,218,155,139,183,184,185,171, /* 192 */ + 100,101, 98,102, 99,103,158,104,116,113,114,115,120,117,118,119, /* 208 */ + 172,105,237,238,235,239,236,191,128,253,254,251,252,186,174, 89, /* 224 */ + 68, 69, 66, 70, 67, 71,156, 72, 84, 81, 82, 83, 88, 85, 86, 87, /* 240 */ + 140, 73,205,206,203,207,204,225,112,221,222,219,220,141,142,223 /* 256 */ +}; + + +static int ebcdic_us_to_ascii_table[] = { + 0, 1, 2, 3, -1, 9, -1,127, -1, -1, -1, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, -1, -1, 8, -1, 24, 25, -1, -1, 28, 29, 30, 31, /* 32 */ + -1, -1, -1, -1, -1, 10, 23, 27, -1, -1, -1, -1, -1, 5, 6, 7, /* 48 */ + -1, -1, 22, -1, -1, -1, -1, 4, -1, -1, -1, -1, 20, 21, -1, 26, /* 64 */ + 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 60, 40, 43,124, /* 80 */ + 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 36, 42, 41, 59, -1, /* 96 */ + 45, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 37, 95, 62, 63, /* 112 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 58, 35, 64, 39, 61, 34, /* 128 */ + -1, 97, 98, 99,100,101,102,103,104,105, -1, -1, -1, -1, -1, -1, /* 144 */ + -1,106,107,108,109,110,111,112,113,114, -1, -1, -1, -1, -1, -1, /* 160 */ + -1,126,115,116,117,118,119,120,121,122, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + 123, 65, 66, 67, 68, 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, -1, /* 208 */ + 125, 74, 75, 76, 77, 78, 79, 80, 81, 82, -1, -1, -1, -1, -1, -1, /* 224 */ + 92, -1, 83, 84, 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, /* 240 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int ebcdic_us_to_iso_8859_1_table[] = { + 0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19,157,133, 8,135, 24, 25,146,143, 28, 29, 30, 31, /* 32 */ + 128,129,130,131,132, 10, 23, 27,136,137,138,139,140, 5, 6, 7, /* 48 */ + 144,145, 22,147,148,149,150, 4,152,153,154,155, 20, 21,158, 26, /* 64 */ + 32, -1, -1, -1, -1, -1, -1, -1, -1, -1,162, 46, 60, 40, 43,124, /* 80 */ + 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 36, 42, 41, 59,172, /* 96 */ + 45, 47, -1, -1, -1, -1, -1, -1, -1, -1,166, 44, 37, 95, 62, 63, /* 112 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 58, 35, 64, 39, 61, 34, /* 128 */ + -1, 97, 98, 99,100,101,102,103,104,105, -1, -1, -1, -1, -1, -1, /* 144 */ + -1,106,107,108,109,110,111,112,113,114, -1, -1, -1, -1, -1, -1, /* 160 */ + -1,126,115,116,117,118,119,120,121,122, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + 123, 65, 66, 67, 68, 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, -1, /* 208 */ + 125, 74, 75, 76, 77, 78, 79, 80, 81, 82, -1, -1, -1, -1, -1, -1, /* 224 */ + 92, -1, 83, 84, 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, /* 240 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, -1, -1, -1,159 /* 256 */ +}; + + +static int ebcdic_us_to_ibm1047_table[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 32 */ + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 48 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 64 */ + 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, 75, 76, 77, 78, 79, /* 80 */ + 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, 91, 92, 93, 94,176, /* 96 */ + 96, 97, -1, -1, -1, -1, -1, -1, -1, -1,106,107,108,109,110,111, /* 112 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1,121,122,123,124,125,126,127, /* 128 */ + -1,129,130,131,132,133,134,135,136,137, -1, -1, -1, -1, -1, -1, /* 144 */ + -1,145,146,147,148,149,150,151,152,153, -1, -1, -1, -1, -1, -1, /* 160 */ + -1,161,162,163,164,165,166,167,168,169, -1, -1, -1, -1, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + 192,193,194,195,196,197,198,199,200,201, -1, -1, -1, -1, -1, -1, /* 208 */ + 208,209,210,211,212,213,214,215,216,217, -1, -1, -1, -1, -1, -1, /* 224 */ + 224, -1,226,227,228,229,230,231,232,233, -1, -1, -1, -1, -1, -1, /* 240 */ + 240,241,242,243,244,245,246,247,248,249, -1, -1, -1, -1, -1,255 /* 256 */ +}; + + +static int ibm1047_to_ascii_table[] = { + 0, 1, 2, 3, -1, 9, -1,127, -1, -1, -1, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, -1, -1, 8, -1, 24, 25, -1, -1, 28, 29, 30, 31, /* 32 */ + -1, -1, -1, -1, -1, 10, 23, 27, -1, -1, -1, -1, -1, 5, 6, 7, /* 48 */ + -1, -1, 22, -1, -1, -1, -1, 4, -1, -1, -1, -1, 20, 21, -1, 26, /* 64 */ + 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 60, 40, 43,124, /* 80 */ + 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 36, 42, 41, 59, 94, /* 96 */ + 45, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 37, 95, 62, 63, /* 112 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 58, 35, 64, 39, 61, 34, /* 128 */ + -1, 97, 98, 99,100,101,102,103,104,105, -1, -1, -1, -1, -1, -1, /* 144 */ + -1,106,107,108,109,110,111,112,113,114, -1, -1, -1, -1, -1, -1, /* 160 */ + -1,126,115,116,117,118,119,120,121,122, -1, -1, -1, 91, -1, -1, /* 176 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, /* 192 */ + 123, 65, 66, 67, 68, 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, -1, /* 208 */ + 125, 74, 75, 76, 77, 78, 79, 80, 81, 82, -1, -1, -1, -1, -1, -1, /* 224 */ + 92, -1, 83, 84, 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, /* 240 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, -1, -1, -1, -1 /* 256 */ +}; + + +static int ibm1047_to_iso_8859_1_table[] = { + 0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19,157,133, 8,135, 24, 25,146,143, 28, 29, 30, 31, /* 32 */ + 128,129,130,131,132, 10, 23, 27,136,137,138,139,140, 5, 6, 7, /* 48 */ + 144,145, 22,147,148,149,150, 4,152,153,154,155, 20, 21,158, 26, /* 64 */ + 32,160,226,228,224,225,227,229,231,241,162, 46, 60, 40, 43,124, /* 80 */ + 38,233,234,235,232,237,238,239,236,223, 33, 36, 42, 41, 59, 94, /* 96 */ + 45, 47,194,196,192,193,195,197,199,209,166, 44, 37, 95, 62, 63, /* 112 */ + 248,201,202,203,200,205,206,207,204, 96, 58, 35, 64, 39, 61, 34, /* 128 */ + 216, 97, 98, 99,100,101,102,103,104,105,171,187,240,253,254,177, /* 144 */ + 176,106,107,108,109,110,111,112,113,114,170,186,230,184,198,164, /* 160 */ + 181,126,115,116,117,118,119,120,121,122,161,191,208, 91,222,174, /* 176 */ + 172,163,165,183,169,167,182,188,189,190,221,168,175, 93,180,215, /* 192 */ + 123, 65, 66, 67, 68, 69, 70, 71, 72, 73,173,244,246,242,243,245, /* 208 */ + 125, 74, 75, 76, 77, 78, 79, 80, 81, 82,185,251,252,249,250,255, /* 224 */ + 92,247, 83, 84, 85, 86, 87, 88, 89, 90,178,212,214,210,211,213, /* 240 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,179,219,220,217,218,159 /* 256 */ +}; + + +static int ibm1047_to_ebcdic_us_table[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 16 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 32 */ + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 48 */ + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 64 */ + 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, 75, 76, 77, 78, 79, /* 80 */ + 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, 91, 92, 93, 94, -1, /* 96 */ + 96, 97, -1, -1, -1, -1, -1, -1, -1, -1,106,107,108,109,110,111, /* 112 */ + -1, -1, -1, -1, -1, -1, -1, -1, -1,121,122,123,124,125,126,127, /* 128 */ + -1,129,130,131,132,133,134,135,136,137, -1, -1, -1, -1, -1, -1, /* 144 */ + -1,145,146,147,148,149,150,151,152,153, -1, -1, -1, -1, -1, -1, /* 160 */ + -1,161,162,163,164,165,166,167,168,169, -1, -1, -1, -1, -1, -1, /* 176 */ + 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192 */ + 192,193,194,195,196,197,198,199,200,201, -1, -1, -1, -1, -1, -1, /* 208 */ + 208,209,210,211,212,213,214,215,216,217, -1, -1, -1, -1, -1, -1, /* 224 */ + 224, -1,226,227,228,229,230,231,232,233, -1, -1, -1, -1, -1, -1, /* 240 */ + 240,241,242,243,244,245,246,247,248,249, -1, -1, -1, -1, -1,255 /* 256 */ +}; + + +static int +table_convert_char (void *baton, int from, int *to) +{ + int *table = (int *) baton; + + if (0 <= from && from <= 255 + && table[from] != -1) + { + *to = table[from]; + return 1; + } + else + return 0; +} + + +static struct translation * +table_translation (const char *from, const char *to, int *table, + const char *(*c_target_char_has_backslash_escape) + (void *baton, int target_char), + void *c_target_char_has_backslash_escape_baton, + int (*c_parse_backslash) (void *baton, + int host_char, + int *target_char), + void *c_parse_backslash_baton) +{ + struct translation *t = xmalloc (sizeof (*t)); + + memset (t, 0, sizeof (*t)); + t->from = from; + t->to = to; + t->c_target_char_has_backslash_escape = c_target_char_has_backslash_escape; + t->c_target_char_has_backslash_escape_baton + = c_target_char_has_backslash_escape_baton; + t->c_parse_backslash = c_parse_backslash; + t->c_parse_backslash_baton = c_parse_backslash_baton; + t->convert_char = table_convert_char; + t->convert_char_baton = (void *) table; + + return t; +} + + +static struct translation * +simple_table_translation (const char *from, const char *to, int *table) +{ + return table_translation (from, to, table, 0, 0, 0, 0); +} + + + +/* Setting and retrieving the host and target charsets. */ + + +/* The current host and target character sets. */ +static struct charset *current_host_charset, *current_target_charset; + +/* The current functions and batons we should use for the functions in + charset.h. */ + +static const char *(*c_target_char_has_backslash_escape_func) + (void *baton, int target_char); +static void *c_target_char_has_backslash_escape_baton; + +static int (*c_parse_backslash_func) (void *baton, + int host_char, + int *target_char); +static void *c_parse_backslash_baton; + +static int (*host_char_to_target_func) (void *baton, + int host_char, + int *target_char); +static void *host_char_to_target_baton; + +static int (*target_char_to_host_func) (void *baton, + int target_char, + int *host_char); +static void *target_char_to_host_baton; + + +/* Cached iconv conversions, that might be useful to fallback + routines. */ +static struct cached_iconv cached_iconv_host_to_target; +static struct cached_iconv cached_iconv_target_to_host; + + +/* Set the host and target character sets to HOST and TARGET. */ +static void +set_host_and_target_charsets (struct charset *host, struct charset *target) +{ + struct translation *h2t, *t2h; + + /* If they're not both initialized yet, then just do nothing for + now. As soon as we're done running our initialize function, + everything will be initialized. */ + if (! host || ! target) + { + current_host_charset = host; + current_target_charset = target; + return; + } + + h2t = lookup_translation (host->name, target->name); + t2h = lookup_translation (target->name, host->name); + + /* If the translations don't provide conversion functions, make sure + iconv can back them up. Do this *before* modifying any state. */ + if (host != target) + { + if (! h2t || ! h2t->convert_char) + { + if (check_iconv_cache (&cached_iconv_host_to_target, host, target) + < 0) + error ("GDB can't convert from the `%s' character set to `%s'.", + host->name, target->name); + } + if (! t2h || ! t2h->convert_char) + { + if (check_iconv_cache (&cached_iconv_target_to_host, target, host) + < 0) + error ("GDB can't convert from the `%s' character set to `%s'.", + target->name, host->name); + } + } + + if (t2h && t2h->c_target_char_has_backslash_escape) + { + c_target_char_has_backslash_escape_func + = t2h->c_target_char_has_backslash_escape; + c_target_char_has_backslash_escape_baton + = t2h->c_target_char_has_backslash_escape_baton; + } + else + c_target_char_has_backslash_escape_func + = default_c_target_char_has_backslash_escape; + + if (h2t && h2t->c_parse_backslash) + { + c_parse_backslash_func = h2t->c_parse_backslash; + c_parse_backslash_baton = h2t->c_parse_backslash_baton; + } + else + c_parse_backslash_func = default_c_parse_backslash; + + if (h2t && h2t->convert_char) + { + host_char_to_target_func = h2t->convert_char; + host_char_to_target_baton = h2t->convert_char_baton; + } + else if (host == target) + host_char_to_target_func = identity_either_char_to_other; + else + { + host_char_to_target_func = iconv_convert; + host_char_to_target_baton = &cached_iconv_host_to_target; + } + + if (t2h && t2h->convert_char) + { + target_char_to_host_func = t2h->convert_char; + target_char_to_host_baton = t2h->convert_char_baton; + } + else if (host == target) + target_char_to_host_func = identity_either_char_to_other; + else + { + target_char_to_host_func = iconv_convert; + target_char_to_host_baton = &cached_iconv_target_to_host; + } + + current_host_charset = host; + current_target_charset = target; +} + + +static struct charset * +lookup_charset_or_error (const char *name) +{ + struct charset *cs = lookup_charset (name); + + if (! cs) + error ("GDB doesn't know of any character set named `%s'.", name); + + return cs; +} + + +static void +check_valid_host_charset (struct charset *cs) +{ + if (! cs->valid_host_charset) + error ("GDB can't use `%s' as its host character set.", cs->name); +} + + +void +set_host_charset (const char *charset) +{ + struct charset *cs = lookup_charset_or_error (charset); + check_valid_host_charset (cs); + set_host_and_target_charsets (cs, current_target_charset); +} + + +const char * +host_charset () +{ + return current_host_charset->name; +} + + +void +set_target_charset (const char *charset) +{ + struct charset *cs = lookup_charset_or_error (charset); + + set_host_and_target_charsets (current_host_charset, cs); +} + + +const char * +target_charset () +{ + return current_target_charset->name; +} + + + +/* Public character management functions. */ + + +const char * +c_target_char_has_backslash_escape (int target_char) +{ + return ((*c_target_char_has_backslash_escape_func) + (c_target_char_has_backslash_escape_baton, target_char)); +} + + +int +c_parse_backslash (int host_char, int *target_char) +{ + return (*c_parse_backslash_func) (c_parse_backslash_baton, + host_char, target_char); +} + + +int +host_char_print_literally (int host_char) +{ + return ((*current_host_charset->host_char_print_literally) + (current_host_charset->host_char_print_literally_baton, + host_char)); +} + + +int +target_char_to_control_char (int target_char, int *target_ctrl_char) +{ + return ((*current_target_charset->target_char_to_control_char) + (current_target_charset->target_char_to_control_char_baton, + target_char, target_ctrl_char)); +} + + +int +host_char_to_target (int host_char, int *target_char) +{ + return ((*host_char_to_target_func) + (host_char_to_target_baton, host_char, target_char)); +} + + +int +target_char_to_host (int target_char, int *host_char) +{ + return ((*target_char_to_host_func) + (target_char_to_host_baton, target_char, host_char)); +} + + + +/* Commands. */ + + +/* List the valid character sets. If HOST_ONLY is non-zero, list only + those character sets which can be used as GDB's host character set. */ +static void +list_charsets (int host_only) +{ + struct charset *cs; + + printf_filtered ("Valid character sets are:\n"); + + for (cs = all_charsets; cs; cs = cs->next) + if (host_only && cs->valid_host_charset) + printf_filtered (" %s\n", cs->name); + else + printf_filtered (" %s %s\n", + cs->name, + cs->valid_host_charset ? "*" : " "); + + if (! host_only) + printf_filtered ("* - can be used as a host character set\n"); +} + + +static void +set_charset_command (char *arg, int from_tty) +{ + if (! arg || arg[0] == '\0') + list_charsets (0); + else + { + struct charset *cs = lookup_charset_or_error (arg); + check_valid_host_charset (cs); + set_host_and_target_charsets (cs, cs); + } +} + + +static void +set_host_charset_command (char *arg, int from_tty) +{ + if (! arg || arg[0] == '\0') + list_charsets (1); + else + { + struct charset *cs = lookup_charset_or_error (arg); + check_valid_host_charset (cs); + set_host_and_target_charsets (cs, current_target_charset); + } +} + + +static void +set_target_charset_command (char *arg, int from_tty) +{ + if (! arg || arg[0] == '\0') + list_charsets (0); + else + { + struct charset *cs = lookup_charset_or_error (arg); + set_host_and_target_charsets (current_host_charset, cs); + } +} + + +static void +show_charset_command (char *arg, int from_tty) +{ + if (current_host_charset == current_target_charset) + { + printf_filtered ("The current host and target character set is `%s'.\n", + host_charset ()); + } + else + { + printf_filtered ("The current host character set is `%s'.\n", + host_charset ()); + printf_filtered ("The current target character set is `%s'.\n", + target_charset ()); + } +} + + + +/* The charset.c module initialization function. */ + +#ifndef GDB_DEFAULT_HOST_CHARSET +#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1" +#endif + +#ifndef GDB_DEFAULT_TARGET_CHARSET +#define GDB_DEFAULT_TARGET_CHARSET "ISO-8859-1" +#endif + +void +_initialize_charset (void) +{ + /* Register all the character set GDB knows about. + + You should use the same names that iconv does, where possible, to + take advantage of the iconv-based default behaviors. + + CAUTION: if you register a character set, you must also register + as many translations as are necessary to make that character set + interoperate correctly with all the other character sets. We do + provide default behaviors when no translation is available, or + when a translation's function pointer for a particular operation + is zero. Hopefully, these defaults will be correct often enough + that we won't need to provide too many translations. */ + register_charset (simple_charset ("ascii", 1, + ascii_print_literally, 0, + ascii_to_control, 0)); + register_charset (iso_8859_family_charset ("iso-8859-1")); + register_charset (ebcdic_family_charset ("ebcdic-us")); + register_charset (ebcdic_family_charset ("ibm1047")); + register_iconv_charsets (); + + { + struct { char *from; char *to; int *table; } tlist[] = { + { "ascii", "iso-8859-1", ascii_to_iso_8859_1_table }, + { "ascii", "ebcdic-us", ascii_to_ebcdic_us_table }, + { "ascii", "ibm1047", ascii_to_ibm1047_table }, + { "iso-8859-1", "ascii", iso_8859_1_to_ascii_table }, + { "iso-8859-1", "ebcdic-us", iso_8859_1_to_ebcdic_us_table }, + { "iso-8859-1", "ibm1047", iso_8859_1_to_ibm1047_table }, + { "ebcdic-us", "ascii", ebcdic_us_to_ascii_table }, + { "ebcdic-us", "iso-8859-1", ebcdic_us_to_iso_8859_1_table }, + { "ebcdic-us", "ibm1047", ebcdic_us_to_ibm1047_table }, + { "ibm1047", "ascii", ibm1047_to_ascii_table }, + { "ibm1047", "iso-8859-1", ibm1047_to_iso_8859_1_table }, + { "ibm1047", "ebcdic-us", ibm1047_to_ebcdic_us_table } + }; + + int i; + + for (i = 0; i < (sizeof (tlist) / sizeof (tlist[0])); i++) + register_translation (simple_table_translation (tlist[i].from, + tlist[i].to, + tlist[i].table)); + } + + set_host_charset (GDB_DEFAULT_HOST_CHARSET); + set_target_charset (GDB_DEFAULT_TARGET_CHARSET); + + add_cmd ("charset", class_support, set_charset_command, + "Use CHARSET as the host and target character set.\n" + "The `host character set' is the one used by the system GDB is running on.\n" + "The `target character set' is the one used by the program being debugged.\n" + "You may only use supersets of ASCII for your host character set; GDB does\n" + "not support any others.\n" + "To see a list of the character sets GDB supports, type `set charset'\n" + "with no argument.", + &setlist); + + add_cmd ("host-charset", class_support, set_host_charset_command, + "Use CHARSET as the host character set.\n" + "The `host character set' is the one used by the system GDB is running on.\n" + "You may only use supersets of ASCII for your host character set; GDB does\n" + "not support any others.\n" + "To see a list of the character sets GDB supports, type `set host-charset'\n" + "with no argument.", + &setlist); + + add_cmd ("target-charset", class_support, set_target_charset_command, + "Use CHARSET as the target character set.\n" + "The `target character set' is the one used by the program being debugged.\n" + "GDB translates characters and strings between the host and target\n" + "character sets as needed.\n" + "To see a list of the character sets GDB supports, type `set target-charset'\n" + "with no argument.", + &setlist); + + add_cmd ("charset", class_support, show_charset_command, + "Show the current host and target character sets.", + &showlist); + add_alias_cmd ("host-charset", "charset", class_alias, 1, &showlist); + add_alias_cmd ("target-charset", "charset", class_alias, 1, &showlist); +} diff --git a/gdb/charset.h b/gdb/charset.h new file mode 100644 index 00000000000..10578cb9243 --- /dev/null +++ b/gdb/charset.h @@ -0,0 +1,120 @@ +/* Character set conversion support for GDB. + Copyright 2001 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef CHARSET_H +#define CHARSET_H + + +/* If the target program uses a different character set than the host, + GDB has some support for translating between the two; GDB converts + characters and strings to the host character set before displaying + them, and converts characters and strings appearing in expressions + entered by the user to the target character set. + + At the moment, GDB only supports single-byte, stateless character + sets. This includes the ISO-8859 family (ASCII extended with + accented characters, and (I think) Cyrillic, for European + languages), and the EBCDIC family (used on IBM's mainframes). + Unfortunately, it excludes many Asian scripts, the fixed- and + variable-width Unicode encodings, and other desireable things. + Patches are welcome! (For example, it would be nice if the Java + string support could simply get absorbed into some more general + multi-byte encoding support.) + + Furthermore, GDB's code pretty much assumes that the host character + set is some superset of ASCII; there are plenty if ('0' + n) + expressions and the like. + + When the `iconv' library routine supports a character set meeting + the requirements above, it's easy to plug an entry into GDB's table + that uses iconv to handle the details. */ + + +/* Set the host character set to CHARSET. CHARSET must be a superset + of ASCII, since GDB's code assumes this. */ +void set_host_charset (const char *charset); + + +/* Set the target character set to CHARSET. */ +void set_target_charset (const char *charset); + + +/* Return the name of the current host/target character set. The + result is owned by the charset module; the caller should not free + it. */ +const char *host_charset (void); +const char *target_charset (void); + + +/* In general, the set of C backslash escapes (\n, \f) is specific to + the character set. Not all character sets will have form feed + characters, for example. + + The following functions allow GDB to parse and print control + characters in a character-set-independent way. They are both + language-specific (to C and C++) and character-set-specific. + Putting them here is a compromise. */ + + +/* If the target character TARGET_CHAR have a backslash escape in the + C language (i.e., a character like 'n' or 't'), return the host + character string that should follow the backslash. Otherwise, + return zero. + + When this function returns non-zero, the string it returns is + statically allocated; the caller is not responsible for freeing it. */ +const char *c_target_char_has_backslash_escape (int target_char); + + +/* If the host character HOST_CHAR is a valid backslash escape in the + C language for the target character set, return non-zero, and set + *TARGET_CHAR to the target character the backslash escape represents. + Otherwise, return zero. */ +int c_parse_backslash (int host_char, int *target_char); + + +/* Return non-zero if the host character HOST_CHAR can be printed + literally --- that is, if it can be readably printed as itself in a + character or string constant. Return zero if it should be printed + using some kind of numeric escape, like '\031' in C, '^(25)' in + Chill, or #25 in Pascal. */ +int host_char_print_literally (int host_char); + + +/* If the host character HOST_CHAR has an equivalent in the target + character set, set *TARGET_CHAR to that equivalent, and return + non-zero. Otherwise, return zero. */ +int host_char_to_target (int host_char, int *target_char); + + +/* If the target character TARGET_CHAR has an equivalent in the host + character set, set *HOST_CHAR to that equivalent, and return + non-zero. Otherwise, return zero. */ +int target_char_to_host (int target_char, int *host_char); + + +/* If the target character TARGET_CHAR has a corresponding control + character (also in the target character set), set *TARGET_CTRL_CHAR + to the control character, and return non-zero. Otherwise, return + zero. */ +int target_char_to_control_char (int target_char, int *target_ctrl_char); + + +#endif /* CHARSET_H */ diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 799e1f464d6..c44975adebf 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -25,7 +25,12 @@ #include "gdb_wait.h" /* For shell escape implementation */ #include "gdb_regex.h" /* Used by apropos_command */ #include "gdb_string.h" +#include "linespec.h" +#include "expression.h" +#include "language.h" #include "filenames.h" /* for DOSish file names */ +#include "objfiles.h" +#include "source.h" #include "ui-out.h" @@ -51,7 +56,7 @@ extern void set_history (char *, int); extern void show_commands (char *, int); -/* Prototypes for local functions */ +/* Prototypes for local command functions */ static void complete_command (char *, int); @@ -79,7 +84,15 @@ static void make_command (char *, int); static void shell_escape (char *, int); +static void edit_command (char *, int); + +static void list_command (char *, int); + void apropos_command (char *, int); + +/* Prototypes for local utility functions */ + +static void ambiguous_line_spec (struct symtabs_and_lines *); /* Limit the call depth of user-defined commands */ int max_user_call_depth; @@ -526,6 +539,287 @@ shell_escape (char *arg, int from_tty) } static void +edit_command (char *arg, int from_tty) +{ + struct symtabs_and_lines sals; + struct symtab_and_line sal; + struct symbol *sym; + char *arg1; + int cmdlen, log10; + unsigned m; + char *editor; + char *p; + + /* Pull in the current default source line if necessary */ + if (arg == 0) + { + set_default_source_symtab_and_line (); + sal = get_current_source_symtab_and_line (); + } + + /* bare "edit" edits file with present line. */ + + if (arg == 0) + { + if (sal.symtab == 0) + error ("No default source file yet."); + sal.line += get_lines_to_list () / 2; + } + else + { + + /* Now should only be one argument -- decode it in SAL */ + + arg1 = arg; + sals = decode_line_1 (&arg1, 0, 0, 0, 0); + + if (! sals.nelts) return; /* C++ */ + if (sals.nelts > 1) { + ambiguous_line_spec (&sals); + xfree (sals.sals); + return; + } + + sal = sals.sals[0]; + xfree (sals.sals); + + if (*arg1) + error ("Junk at end of line specification."); + + /* if line was specified by address, + first print exactly which line, and which file. + In this case, sal.symtab == 0 means address is outside + of all known source files, not that user failed to give a filename. */ + if (*arg == '*') + { + if (sal.symtab == 0) + /* FIXME-32x64--assumes sal.pc fits in long. */ + error ("No source file for address %s.", + local_hex_string((unsigned long) sal.pc)); + sym = find_pc_function (sal.pc); + if (sym) + { + print_address_numeric (sal.pc, 1, gdb_stdout); + printf_filtered (" is in "); + fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout); + printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line); + } + else + { + print_address_numeric (sal.pc, 1, gdb_stdout); + printf_filtered (" is at %s:%d.\n", + sal.symtab->filename, sal.line); + } + } + + /* If what was given does not imply a symtab, it must be an undebuggable + symbol which means no source code. */ + + if (sal.symtab == 0) + error ("No line number known for %s.", arg); + } + + if ((editor = (char *) getenv ("EDITOR")) == NULL) + editor = "/bin/ex"; + + /* Approximate base-10 log of line to 1 unit for digit count */ + for(log10=32, m=0x80000000; !(sal.line & m) && log10>0; log10--, m=m>>1); + log10 = 1 + (int)((log10 + (0 == ((m-1) & sal.line)))/3.32192809); + + cmdlen = strlen(editor) + 1 + + (NULL == sal.symtab->dirname ? 0 : strlen(sal.symtab->dirname) + 1) + + (NULL == sal.symtab->filename? 0 : strlen(sal.symtab->filename)+ 1) + + log10 + 2; + + p = xmalloc(cmdlen); + sprintf(p,"%s +%d %s%s",editor,sal.line, + (NULL == sal.symtab->dirname ? "./" : + (NULL != sal.symtab->filename && *(sal.symtab->filename) != '/') ? + sal.symtab->dirname : ""), + (NULL == sal.symtab->filename ? "unknown" : sal.symtab->filename) + ); + shell_escape(p, from_tty); + + xfree(p); +} + +static void +list_command (char *arg, int from_tty) +{ + struct symtabs_and_lines sals, sals_end; + struct symtab_and_line sal, sal_end, cursal; + struct symbol *sym; + char *arg1; + int no_end = 1; + int dummy_end = 0; + int dummy_beg = 0; + int linenum_beg = 0; + char *p; + + /* Pull in the current default source line if necessary */ + if (arg == 0 || arg[0] == '+' || arg[0] == '-') + { + set_default_source_symtab_and_line (); + cursal = get_current_source_symtab_and_line (); + } + + /* "l" or "l +" lists next ten lines. */ + + if (arg == 0 || STREQ (arg, "+")) + { + print_source_lines (cursal.symtab, cursal.line, + cursal.line + get_lines_to_list (), 0); + return; + } + + /* "l -" lists previous ten lines, the ones before the ten just listed. */ + if (STREQ (arg, "-")) + { + print_source_lines (cursal.symtab, + max (get_first_line_listed () - get_lines_to_list (), 1), + get_first_line_listed (), 0); + return; + } + + /* Now if there is only one argument, decode it in SAL + and set NO_END. + If there are two arguments, decode them in SAL and SAL_END + and clear NO_END; however, if one of the arguments is blank, + set DUMMY_BEG or DUMMY_END to record that fact. */ + + if (!have_full_symbols () && !have_partial_symbols ()) + error ("No symbol table is loaded. Use the \"file\" command."); + + arg1 = arg; + if (*arg1 == ',') + dummy_beg = 1; + else + { + sals = decode_line_1 (&arg1, 0, 0, 0, 0); + + if (!sals.nelts) + return; /* C++ */ + if (sals.nelts > 1) + { + ambiguous_line_spec (&sals); + xfree (sals.sals); + return; + } + + sal = sals.sals[0]; + xfree (sals.sals); + } + + /* Record whether the BEG arg is all digits. */ + + for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++); + linenum_beg = (p == arg1); + + while (*arg1 == ' ' || *arg1 == '\t') + arg1++; + if (*arg1 == ',') + { + no_end = 0; + arg1++; + while (*arg1 == ' ' || *arg1 == '\t') + arg1++; + if (*arg1 == 0) + dummy_end = 1; + else + { + if (dummy_beg) + sals_end = decode_line_1 (&arg1, 0, 0, 0, 0); + else + sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0); + if (sals_end.nelts == 0) + return; + if (sals_end.nelts > 1) + { + ambiguous_line_spec (&sals_end); + xfree (sals_end.sals); + return; + } + sal_end = sals_end.sals[0]; + xfree (sals_end.sals); + } + } + + if (*arg1) + error ("Junk at end of line specification."); + + if (!no_end && !dummy_beg && !dummy_end + && sal.symtab != sal_end.symtab) + error ("Specified start and end are in different files."); + if (dummy_beg && dummy_end) + error ("Two empty args do not say what lines to list."); + + /* if line was specified by address, + first print exactly which line, and which file. + In this case, sal.symtab == 0 means address is outside + of all known source files, not that user failed to give a filename. */ + if (*arg == '*') + { + if (sal.symtab == 0) + /* FIXME-32x64--assumes sal.pc fits in long. */ + error ("No source file for address %s.", + local_hex_string ((unsigned long) sal.pc)); + sym = find_pc_function (sal.pc); + if (sym) + { + print_address_numeric (sal.pc, 1, gdb_stdout); + printf_filtered (" is in "); + fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout); + printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line); + } + else + { + print_address_numeric (sal.pc, 1, gdb_stdout); + printf_filtered (" is at %s:%d.\n", + sal.symtab->filename, sal.line); + } + } + + /* If line was not specified by just a line number, + and it does not imply a symtab, it must be an undebuggable symbol + which means no source code. */ + + if (!linenum_beg && sal.symtab == 0) + error ("No line number known for %s.", arg); + + /* If this command is repeated with RET, + turn it into the no-arg variant. */ + + if (from_tty) + *arg = 0; + + if (dummy_beg && sal_end.symtab == 0) + error ("No default source file yet. Do \"help list\"."); + if (dummy_beg) + print_source_lines (sal_end.symtab, + max (sal_end.line - (get_lines_to_list () - 1), 1), + sal_end.line + 1, 0); + else if (sal.symtab == 0) + error ("No default source file yet. Do \"help list\"."); + else if (no_end) + { + int first_line = sal.line - get_lines_to_list () / 2; + + if (first_line < 1) first_line = 1; + + print_source_lines (sal.symtab, + first_line, + first_line + get_lines_to_list (), + 0); + } + else + print_source_lines (sal.symtab, sal.line, + (dummy_end + ? sal.line + get_lines_to_list () + : sal_end.line + 1), + 0); +} + +static void make_command (char *arg, int from_tty) { char *p; @@ -594,6 +888,21 @@ apropos_command (char *searchstr, int from_tty) xfree (pattern_fastmap); } +/* Print a list of files and line numbers which a user may choose from + in order to list a function which was specified ambiguously (as with + `list classname::overloadedfuncname', for example). The vector in + SALS provides the filenames and line numbers. */ + +static void +ambiguous_line_spec (struct symtabs_and_lines *sals) +{ + int i; + + for (i = 0; i < sals->nelts; ++i) + printf_filtered ("file: \"%s\", line number: %d\n", + sals->sals[i].symtab->filename, sals->sals[i].line); +} + static void set_debug (char *arg, int from_tty) { @@ -812,6 +1121,43 @@ from the target.", &setlist), With no arguments, run an inferior shell."); set_cmd_completer (c, filename_completer); + c = add_com ("edit", class_files, edit_command, + concat ("Edit specified file or function.\n\ +With no argument, edits file containing most recent line listed.\n\ +", "\ +Editing targets can be specified in these ways:\n\ + FILE:LINENUM, to edit at that line in that file,\n\ + FUNCTION, to edit at the beginning of that function,\n\ + FILE:FUNCTION, to distinguish among like-named static functions.\n\ + *ADDRESS, to edit at the line containing that address.\n\ +Uses EDITOR environment variable contents as editor (or ex as default).",NULL)); + + c->completer = location_completer; + + add_com ("list", class_files, list_command, + concat ("List specified function or line.\n\ +With no argument, lists ten more lines after or around previous listing.\n\ +\"list -\" lists the ten lines before a previous ten-line listing.\n\ +One argument specifies a line, and ten lines are listed around that line.\n\ +Two arguments with comma between specify starting and ending lines to list.\n\ +", "\ +Lines can be specified in these ways:\n\ + LINENUM, to list around that line in current file,\n\ + FILE:LINENUM, to list around that line in that file,\n\ + FUNCTION, to list around beginning of that function,\n\ + FILE:FUNCTION, to distinguish among like-named static functions.\n\ + *ADDRESS, to list around the line containing that address.\n\ +With two args if one is empty it stands for ten lines away from the other arg.", NULL)); + + if (!xdb_commands) + add_com_alias ("l", "list", class_files, 1); + else + add_com_alias ("v", "list", class_files, 1); + + if (dbx_commands) + add_com_alias ("file", "list", class_files, 1); + + /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would be a really useful feature. Unfortunately, the below wont do this. Instead it adds support for the form ``(gdb) ! ls'' diff --git a/gdb/complaints.c b/gdb/complaints.c index 04e49a23979..84cf6a2e303 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -1,6 +1,7 @@ /* Support for complaint handling during symbol reading in GDB. - Copyright 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2000 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2000, 2002 Free + Software Foundation, Inc. This file is part of GDB. @@ -21,148 +22,300 @@ #include "defs.h" #include "complaints.h" +#include "gdb_assert.h" +#include "command.h" #include "gdbcmd.h" extern void _initialize_complaints (void); +/* Should each complaint message be self explanatory, or should we assume that + a series of complaints is being produced? */ + +/* case 1: First message of a series that must + start off with explanation. case 2: Subsequent message of a series + that needs no explanation (the user already knows we have a problem + so we can just state our piece). */ +enum complaint_series { + /* Isolated self explanatory message. */ + ISOLATED_MESSAGE, + /* First message of a series, includes an explanation. */ + FIRST_MESSAGE, + /* First message of a series, but does not need to include any sort + of explanation. */ + SHORT_FIRST_MESSAGE, + /* Subsequent message of a series that needs no explanation (the + user already knows we have a problem so we can just state our + piece). */ + SUBSEQUENT_MESSAGE +}; + /* Structure to manage complaints about symbol file contents. */ -struct complaint complaint_root[1] = +struct complain { - { - (char *) NULL, /* Complaint message */ - 0, /* Complaint counter */ - complaint_root /* Next complaint. */ - } + const char *file; + int line; + const char *fmt; + int counter; + struct complain *next; }; -/* How many complaints about a particular thing should be printed before - we stop whining about it? Default is no whining at all, since so many - systems have ill-constructed symbol files. */ +struct complaints +{ + struct complain *root; -static unsigned int stop_whining = 0; + /* Should each complaint be self explanatory, or should we assume + that a series of complaints is being produced? case 0: Isolated + self explanatory message. case 1: First message of a series that + must start off with explanation. case 2: Subsequent message of a + series that needs no explanation (the user already knows we have + a problem so we can just state our piece). */ + int series; -/* Should each complaint be self explanatory, or should we assume that - a series of complaints is being produced? - case 0: self explanatory message. - case 1: First message of a series that must start off with explanation. - case 2: Subsequent message, when user already knows we are reading - symbols and we can just state our piece. */ + /* The explanatory messages that should accompany the complaint. + NOTE: cagney/2002-08-14: In a desperate attempt at being vaguely + i18n friendly, this is an array of two messages. When present, + EXPLANATION[SERIES] is used to wrap the message. */ + const char **explanation; +}; -static int complaint_series = 0; +static struct complain complaint_sentinel; - +/* The symbol table complaint table. */ -/* Functions to handle complaints during symbol reading. */ +static const char *symfile_explanations[] = { + "During symbol reading, %s.", + "During symbol reading...%s...", + "%s...", + "%s...", + NULL +}; -/* Print a complaint about the input symbols, and link the complaint block - into a chain for later handling. */ +static struct complaints symfile_complaint_book = { + &complaint_sentinel, + 0, + symfile_explanations +}; +struct complaints *symfile_complaints = &symfile_complaint_book; -void -complain (struct complaint *complaint,...) +/* Wrapper function to, on-demand, fill in a complaints object. */ + +static struct complaints * +get_complaints (struct complaints **c) { - va_list args; - va_start (args, complaint); + if ((*c) != NULL) + return (*c); + (*c) = XMALLOC (struct complaints); + (*c)->root = &complaint_sentinel; + (*c)->series = ISOLATED_MESSAGE; + (*c)->explanation = NULL; + return (*c); +} - complaint->counter++; - if (complaint->next == NULL) +static struct complain * +find_complaint (struct complaints *complaints, const char *file, + int line, const char *fmt) +{ + struct complain *complaint; + + /* Find the complaint in the table. A more efficient search + algorithm (based on hash table or something) could be used. But + that can wait until someone shows evidence that this lookup is + a real bottle neck. */ + for (complaint = complaints->root; + complaint != NULL; + complaint = complaint->next) { - complaint->next = complaint_root->next; - complaint_root->next = complaint; + if (complaint->fmt == fmt + && complaint->file == file + && complaint->line == line) + return complaint; } + + /* Oops not seen before, fill in a new complaint. */ + complaint = XMALLOC (struct complain); + complaint->fmt = fmt; + complaint->file = file; + complaint->line = line; + complaint->counter = 0; + complaint->next = NULL; + + /* File it, return it. */ + complaint->next = complaints->root; + complaints->root = complaint; + return complaint; +} + + +/* How many complaints about a particular thing should be printed + before we stop whining about it? Default is no whining at all, + since so many systems have ill-constructed symbol files. */ + +static unsigned int stop_whining = 0; + +/* Print a complaint, and link the complaint block into a chain for + later handling. */ + +static void +vcomplaint (struct complaints **c, const char *file, int line, const char *fmt, + va_list args) +{ + struct complaints *complaints = get_complaints (c); + struct complain *complaint = find_complaint (complaints, file, line, fmt); + enum complaint_series series; + gdb_assert (complaints != NULL); + + complaint->counter++; if (complaint->counter > stop_whining) + return; + + if (info_verbose) + series = SUBSEQUENT_MESSAGE; + else + series = complaints->series; + + if (complaint->file != NULL) + internal_vwarning (complaint->file, complaint->line, complaint->fmt, args); + else if (warning_hook) + (*warning_hook) (complaint->fmt, args); + else { - return; + if (complaints->explanation == NULL) + /* A [v]warning() call always appends a newline. */ + vwarning (complaint->fmt, args); + else + { + char *msg; + struct cleanup *cleanups; + xvasprintf (&msg, complaint->fmt, args); + cleanups = make_cleanup (xfree, msg); + wrap_here (""); + if (series != SUBSEQUENT_MESSAGE) + begin_line (); + fprintf_filtered (gdb_stderr, + complaints->explanation[series], + msg); + /* Force a line-break after any isolated message. For the + other cases, clear_complaints() takes care of any missing + trailing newline, the wrap_here() is just a hint. */ + if (series == ISOLATED_MESSAGE) + /* It would be really nice to use begin_line() here. + Unfortunatly that function doesn't track GDB_STDERR and + consequently will sometimes supress a line when it + shouldn't. */ + fputs_filtered ("\n", gdb_stderr); + else + wrap_here (""); + do_cleanups (cleanups); + } } - wrap_here (""); - switch (complaint_series + (info_verbose << 1)) + switch (series) { - - /* Isolated messages, must be self-explanatory. */ - case 0: - if (warning_hook) - (*warning_hook) (complaint->message, args); - else - { - begin_line (); - fputs_filtered ("During symbol reading, ", gdb_stderr); - wrap_here (""); - vfprintf_filtered (gdb_stderr, complaint->message, args); - fputs_filtered (".\n", gdb_stderr); - } + case ISOLATED_MESSAGE: break; - - /* First of a series, without `set verbose'. */ - case 1: - if (warning_hook) - (*warning_hook) (complaint->message, args); - else - { - begin_line (); - fputs_filtered ("During symbol reading...", gdb_stderr); - vfprintf_filtered (gdb_stderr, complaint->message, args); - fputs_filtered ("...", gdb_stderr); - wrap_here (""); - complaint_series++; - } + case FIRST_MESSAGE: + complaints->series = SUBSEQUENT_MESSAGE; + break; + case SUBSEQUENT_MESSAGE: + case SHORT_FIRST_MESSAGE: + complaints->series = SUBSEQUENT_MESSAGE; break; - - /* Subsequent messages of a series, or messages under `set verbose'. - (We'll already have produced a "Reading in symbols for XXX..." - message and will clean up at the end with a newline.) */ - default: - if (warning_hook) - (*warning_hook) (complaint->message, args); - else - { - vfprintf_filtered (gdb_stderr, complaint->message, args); - fputs_filtered ("...", gdb_stderr); - wrap_here (""); - } } - /* If GDB dumps core, we'd like to see the complaints first. Presumably - GDB will not be sending so many complaints that this becomes a - performance hog. */ + + /* If GDB dumps core, we'd like to see the complaints first. + Presumably GDB will not be sending so many complaints that this + becomes a performance hog. */ + gdb_flush (gdb_stderr); +} + +void +complaint (struct complaints **complaints, const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + vcomplaint (complaints, NULL/*file*/, 0/*line*/, fmt, args); + va_end (args); +} + +void +internal_complaint (struct complaints **complaints, const char *file, + int line, const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + vcomplaint (complaints, file, line, fmt, args); + va_end (args); +} + +void +complain (struct complaint *complaint, ...) +{ + va_list args; + va_start (args, complaint); + vcomplaint (&symfile_complaints, NULL/*file*/, 0/*line*/, + complaint->message, args); va_end (args); } -/* Clear out all complaint counters that have ever been incremented. - If sym_reading is 1, be less verbose about successive complaints, - since the messages are appearing all together during a command that - reads symbols (rather than scattered around as psymtabs get fleshed - out into symtabs at random times). If noisy is 1, we are in a - noisy symbol reading command, and our caller will print enough - context for the user to figure it out. */ +/* Clear out / initialize all complaint counters that have ever been + incremented. If LESS_VERBOSE is 1, be less verbose about + successive complaints, since the messages are appearing all + together during a command that is reporting a contiguous block of + complaints (rather than being interleaved with other messages). If + noisy is 1, we are in a noisy command, and our caller will print + enough context for the user to figure it out. */ void -clear_complaints (int sym_reading, int noisy) +clear_complaints (struct complaints **c, int less_verbose, int noisy) { - struct complaint *p; + struct complaints *complaints = get_complaints (c); + struct complain *p; - for (p = complaint_root->next; p != complaint_root; p = p->next) + for (p = complaints->root; p != NULL; p = p->next) { p->counter = 0; } - if (!sym_reading && !noisy && complaint_series > 1 && !warning_hook) + switch (complaints->series) { - /* Terminate previous series, since caller won't. */ - puts_filtered ("\n"); + case FIRST_MESSAGE: + /* Haven't yet printed anything. */ + break; + case SHORT_FIRST_MESSAGE: + /* Haven't yet printed anything. */ + break; + case ISOLATED_MESSAGE: + /* The code above, always forces a line-break. No need to do it + here. */ + break; + case SUBSEQUENT_MESSAGE: + /* It would be really nice to use begin_line() here. + Unfortunatly that function doesn't track GDB_STDERR and + consequently will sometimes supress a line when it shouldn't. */ + fputs_unfiltered ("\n", gdb_stderr); + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); } - complaint_series = sym_reading ? 1 + noisy : 0; + if (!less_verbose) + complaints->series = ISOLATED_MESSAGE; + else if (!noisy) + complaints->series = FIRST_MESSAGE; + else + complaints->series = SHORT_FIRST_MESSAGE; } void _initialize_complaints (void) { - add_show_from_set - (add_set_cmd ("complaints", class_support, var_zinteger, - (char *) &stop_whining, - "Set max number of complaints about incorrect symbols.", - &setlist), - &showlist); + add_setshow_cmd ("complaints", class_support, var_zinteger, + &stop_whining, + "Set max number of complaints about incorrect symbols.", + "Show max number of complaints about incorrect symbols.", + NULL, NULL, + &setlist, &showlist); } diff --git a/gdb/complaints.h b/gdb/complaints.h index ecd822f5b04..c176b190588 100644 --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -1,6 +1,7 @@ /* Definitions for complaint handling during symbol reading in GDB. - Copyright 1990, 1991, 1992, 1995, 1998, 2000 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1995, 1998, 2000, 2002 Free Software + Foundation, Inc. This file is part of GDB. @@ -23,8 +24,37 @@ #if !defined (COMPLAINTS_H) #define COMPLAINTS_H +/* Opaque object used to track the number of complaints of a + particular category. */ +struct complaints; + +/* Predefined categories. */ +extern struct complaints *symfile_complaints; + +/* Register a complaint. */ +extern void complaint (struct complaints **complaints, const char *fmt, + ...) ATTR_FORMAT (printf, 2, 3); +extern void internal_complaint (struct complaints **complaints, + const char *file, int line, const char *fmt, + ...) ATTR_FORMAT (printf, 4, 5); + +/* Clear out / initialize all complaint counters that have ever been + incremented. If LESS_VERBOSE is 1, be less verbose about + successive complaints, since the messages are appearing all + together during a command that is reporting a contiguous block of + complaints (rather than being interleaved with other messages). If + noisy is 1, we are in a noisy command, and our caller will print + enough context for the user to figure it out. */ + +extern void clear_complaints (struct complaints **complaints, + int less_verbose, int noisy); + -/* Support for complaining about things in the symbol file that aren't +/* Legacy interfaces to keep the old code working (until it is all + converted to the above). While the structure below contains a + number of fields, all but .message are ignored. + + Support for complaining about things in the symbol file that aren't catastrophic. Each such thing gets a counter. The first time we have the problem, @@ -32,22 +62,12 @@ if verbose, we report how many of each problem we had. */ struct complaint - { - char *message; - unsigned counter; - struct complaint *next; - }; - -/* Root of the chain of complaints that have at some point been issued. - This is used to reset the counters, and/or report the total counts. */ - -extern struct complaint complaint_root[1]; - -/* Functions that handle complaints. (in complaints.c) */ +{ + const char *message; + unsigned counter_ignored; + struct complaint *next_ignored; +}; extern void complain (struct complaint *, ...); -extern void clear_complaints (int, int); - - #endif /* !defined (COMPLAINTS_H) */ diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 47e5483d643..0cb63a5d9af 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -3,8 +3,10 @@ @V@/bfd/ChangeLog-9495 @V@/bfd/ChangeLog.9495 @V@/bfd/ChangeLog-9697 @V@/bfd/ChangeLog.9697 @V@/bfd/ChangeLog-9899 @V@/bfd/ChangeLog.9899 -@V@/bfd/coff-tic54x.c @V@/bfd/coff-tc54x.c -@V@/bfd/coff-tic80.c @V@/bfd/coff-tc80.c +@V@/bfd/coff-tic30.c @V@/bfd/cofftic30.c +@V@/bfd/coff-tic4x.c @V@/bfd/cofftic40.c +@V@/bfd/coff-tic54x.c @V@/bfd/cofftic54x.c +@V@/bfd/coff-tic80.c @V@/bfd/cofftic80.c @V@/bfd/cpu-ia64-opc.c @V@/bfd/cpuia64-opc.c @V@/bfd/cpu-m68hc11.c @V@/bfd/cm68hc11.c @V@/bfd/cpu-m68hc12.c @V@/bfd/cm68hc12.c @@ -26,6 +28,8 @@ @V@/bfd/elf32-sh-nbsd.c @V@/bfd/e32shn.c @V@/bfd/elf32-sh64.c @V@/bfd/e32sh64.c @V@/bfd/elf32-sh64-nbsd.c @V@/bfd/e32sh64n.c +@V@/bfd/elf64-alpha.c @V@/bfd/e64alphf.c +@V@/bfd/elf64-alpha-fbsd.c @V@/bfd/e64alph.c @V@/bfd/elf64-sh64.c @V@/bfd/e64sh64.c @V@/bfd/elf64-sh64-nbsd.c @V@/bfd/e64sh64n.c @V@/dejagnu/baseboards/mn10200-cygmon.exp @V@/dejagnu/baseboards/mn10200cygmon.exp @@ -129,6 +133,8 @@ @V@/gdb/i386-linux-tdep.c @V@/gdb/i386linux-tdep.c @V@/gdb/i386bsd-nat.c @V@/gdb/i3bsd-nat.c @V@/gdb/i386bsd-tdep.c @V@/gdb/i3bsd-tdep.c +@V@/gdb/i386gnu-nat.c @V@/gdb/i3gnu-nat.c +@V@/gdb/i386gnu-tdep.c @V@/gdb/i3gnu-tdep.c @V@/gdb/i386nbsd-nat.c @V@/gdb/i3nbsd-nat.c @V@/gdb/i386nbsd-tdep.c @V@/gdb/i3nbsd-tdep.c @V@/gdb/ia64-aix-nat.c @V@/gdb/ia64aix-nat.c @@ -207,6 +213,10 @@ @V@/gdb/testsuite/gdb.c++/inherit.exp @V@/gdb/testsuite/gdb.cxx/inherit.exp @V@/gdb/testsuite/gdb.c++/local.cc @V@/gdb/testsuite/gdb.cxx/local.cc @V@/gdb/testsuite/gdb.c++/local.exp @V@/gdb/testsuite/gdb.cxx/local.exp +@V@/gdb/testsuite/gdb.c++/m-static.cc @V@/gdb/testsuite/gdb.cxx/m-static.cc +@V@/gdb/testsuite/gdb.c++/m-static1.cc @V@/gdb/testsuite/gdb.cxx/m-stat1.cc +@V@/gdb/testsuite/gdb.c++/m-static.exp @V@/gdb/testsuite/gdb.cxx/m-static.exp +@V@/gdb/testsuite/gdb.c++/m-static.h @V@/gdb/testsuite/gdb.cxx/m-static.h @V@/gdb/testsuite/gdb.c++/member-ptr.cc @V@/gdb/testsuite/gdb.cxx/member-ptr.cc @V@/gdb/testsuite/gdb.c++/member-ptr.exp @V@/gdb/testsuite/gdb.cxx/member-ptr.exp @V@/gdb/testsuite/gdb.c++/method.cc @V@/gdb/testsuite/gdb.cxx/method.cc diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index 3020e4d27c8..4e600575045 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -18,17 +18,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "regcache.h" - /* Contributed by Steve Chamberlain sac@cygnus.com */ -struct frame_info; -struct frame_saved_regs; -struct value; -struct type; - -/* 1 if debugging H8/300H application */ +#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL /* NOTE: ezannoni 2000-07-18: these variables are part of sim, defined in sim/h8300/compile.c. They really should not be used this @@ -36,279 +28,12 @@ struct type; GDB_TARGET_IS_H8300 in remote-e7000.c */ extern int h8300hmode; extern int h8300smode; - -/* Number of bytes in a word */ - -#define BINWORD (h8300hmode?4:2) - -#define EXTRA_FRAME_INFO \ - struct frame_saved_regs *fsr; \ - CORE_ADDR from_pc; \ - CORE_ADDR args_pointer;\ - CORE_ADDR locals_pointer ; - -/* Zero the frame_saved_regs pointer when the frame is initialized, - so that FRAME_FIND_SAVED_REGS () will know to allocate and - initialize a frame_saved_regs struct the first time it is called. - Set the arg_pointer to -1, which is not valid; 0 and other values - indicate real, cached values. */ - -#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ - h8300_init_extra_frame_info (fromleaf, fi) - -extern void h8300_init_extra_frame_info (); - -#undef TARGET_INT_BIT -#define TARGET_INT_BIT 16 -#undef TARGET_LONG_BIT -#define TARGET_LONG_BIT 32 -#undef TARGET_PTR_BIT -#define TARGET_PTR_BIT (h8300hmode ? 32:16) - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -#define SKIP_PROLOGUE(ip) (h8300_skip_prologue(ip)) -extern CORE_ADDR h8300_skip_prologue (); - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -#define SAVED_PC_AFTER_CALL(frame) \ - read_memory_unsigned_integer (read_register (SP_REGNUM), BINWORD) - -/* Stack grows downward. */ - -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -/*#define BREAKPOINT {0x7A, 0xFF} */ -#define BREAKPOINT {0x01, 0x80} /* Sleep */ -#define REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */ -/* If your kernel resets the pc after the trap happens you may need to - define this before including this file. */ - -#define DECR_PC_AFTER_BREAK 0 - -/* Say how long registers are. */ - -#define REGISTER_SIZE 4 - -#define NUM_REGS 14 - -#define REGISTER_BYTES (NUM_REGS * 4) - -/* Index within `registers' of the first byte of the space for - register N. */ - -#define REGISTER_BYTE(N) ((N) * 4) - -/* Number of bytes of storage in the actual machine representation - for register N. On the H8/300, all regs are 2 bytes. */ - -#define REGISTER_RAW_SIZE(N) (h8300hmode ? 4 : 2) - -/* Number of bytes of storage in the program's representation - for register N. */ - -#define REGISTER_VIRTUAL_SIZE(N) (h8300hmode ? 4 : 2) - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE 4 - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ - -#define MAX_REGISTER_VIRTUAL_SIZE 4 - -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -#define REGISTER_VIRTUAL_TYPE(N) \ -(h8300hmode ? builtin_type_unsigned_long : builtin_type_unsigned_short) - -/* Initializer for an array of names of registers. - Entries beyond the first NUM_REGS are ignored. */ - -#define REGISTER_NAMES \ - {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles","tick","inst",""} - -/* An array of names of registers. */ - -extern char **h8300_register_names; -#define REGISTER_NAME(i) h8300_register_names[i] - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define ARG0_REGNUM 0 /* first reg in which an arg may be passed */ -#define ARGLAST_REGNUM 2 /* last reg in which an arg may be passed */ -#define FP_REGNUM 6 /* Contain saddress of executing stack frame */ -#define SP_REGNUM 7 /* Contains address of top of stack */ -#define CCR_REGNUM 8 /* Contains processor status */ -#define PC_REGNUM 9 /* Contains program counter */ -#define EXR_REGNUM 11 /* Contains processor status */ - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -/* FIXME: Won't work with both h8/300's. */ - -extern void h8300_extract_return_value (struct type *, char *, char *); -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - h8300_extract_return_value (TYPE, (char *)(REGBUF), (char *)(VALBUF)) - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. Assumes floats are passed - in d0/d1. */ -/* FIXME: Won't work with both h8/300's. */ - -extern void h8300_store_return_value (struct type *, char *); -#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ - h8300_store_return_value(TYPE, (char *) (VALBUF)) - -/* struct passing and returning stuff */ -#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \ - write_register (0, STRUCT_ADDR) - -#define USE_STRUCT_CONVENTION(gcc_p, type) (1) - -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - extract_address (REGBUF + REGISTER_BYTE (0), \ - REGISTER_RAW_SIZE (0)) - -/* Describe the pointer in each stack frame to the previous stack frame - (its caller). */ - -/* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. - - However, if FRAME_CHAIN_VALID returns zero, - it means the given frame is the outermost one and has no caller. */ - -#define FRAME_CHAIN(FRAME) h8300_frame_chain(FRAME) -CORE_ADDR h8300_frame_chain (struct frame_info *); - -/* In the case of the H8/300, the frame's nominal address - is the address of a 2-byte word containing the calling frame's address. */ - -/* Use the alternate method of avoiding running up off the end of - the frame chain or following frames back into the startup code. - See the comments in objfile.h */ - -#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) - -/* Define other aspects of the stack frame. */ - -/* A macro that tells us whether the function invocation represented - by FI does not have a frame on the stack associated with it. If it - does not, FRAMELESS is set to 1, else 0. */ -#define FRAMELESS_FUNCTION_INVOCATION(FI) \ - (frameless_look_for_prologue (FI)) - -/* Any function with a frame looks like this - SECOND ARG - FIRST ARG - RET PC - SAVED R2 - SAVED R3 - SAVED FP <-FP POINTS HERE - LOCALS0 - LOCALS1 <-SP POINTS HERE - */ - -#define FRAME_SAVED_PC(FRAME) h8300_frame_saved_pc(FRAME) -extern CORE_ADDR h8300_frame_saved_pc (struct frame_info *); - -#define FRAME_ARGS_ADDRESS(fi) h8300_frame_args_address(fi) -extern CORE_ADDR h8300_frame_args_address (struct frame_info *); - -#define FRAME_LOCALS_ADDRESS(fi) h8300_frame_locals_address(fi) -extern CORE_ADDR h8300_frame_locals_address (struct frame_info *); - -/* Set VAL to the number of args passed to frame described by FI. - Can set VAL to -1, meaning no way to tell. */ - -/* We can't tell how many args there are - now that the C compiler delays popping them. */ - -#define FRAME_NUM_ARGS(fi) (-1) - -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 0 - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - h8300_frame_find_saved_regs(frame_info, &(frame_saved_regs)) -extern void h8300_frame_find_saved_regs (struct frame_info *, - struct frame_saved_regs *); - - -typedef unsigned short INSN_WORD; - - -#define PRINT_REGISTER_HOOK(regno) h8300_print_register_hook(regno) -extern void h8300_print_register_hook (int); - #define GDB_TARGET_IS_H8300 +/* Needed for remote.c */ +#define REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */ +/* Needed for remote-hms.c */ +#define CCR_REGNUM 8 +/* Needed for remote-e7000.c */ #define NUM_REALREGS (h8300smode?11:10) -#define NOP { 0x01, 0x80} /* A sleep insn */ - -#define BELIEVE_PCC_PROMOTION 1 - -/* - * CALL_DUMMY stuff: - */ - -#define USE_GENERIC_DUMMY_FRAMES 1 -#define CALL_DUMMY {0} -#define CALL_DUMMY_LENGTH (0) -#define CALL_DUMMY_ADDRESS() entry_point_address () -#define CALL_DUMMY_LOCATION AT_ENTRY_POINT -#define CALL_DUMMY_START_OFFSET (0) -#define CALL_DUMMY_BREAKPOINT_OFFSET (0) - -extern CORE_ADDR h8300_push_arguments (int nargs, - struct value **args, - CORE_ADDR sp, - unsigned char struct_return, - CORE_ADDR struct_addr); -extern CORE_ADDR h8300_push_return_address (CORE_ADDR, CORE_ADDR); -extern void h8300_pop_frame (void); - -#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP) -#define FIX_CALL_DUMMY(DUMMY, START_SP, FUNADDR, NARGS, ARGS, TYPE, GCCP) -#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ - (h8300_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)) -/* Push an empty stack frame, to record the current PC, etc. */ -#define PUSH_DUMMY_FRAME generic_push_dummy_frame () -/* Discard from the stack the innermost frame, restoring all registers. */ -#define POP_FRAME h8300_pop_frame () -#define PUSH_RETURN_ADDRESS(PC, SP) h8300_push_return_address (PC, SP) -/* override the standard get_saved_register function with - one that takes account of generic CALL_DUMMY frames */ -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ - generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) diff --git a/gdb/config/i386/nbsdelf.mt b/gdb/config/i386/nbsd.mt index fc80608e01e..f7f8cd6e70c 100644 --- a/gdb/config/i386/nbsdelf.mt +++ b/gdb/config/i386/nbsd.mt @@ -1,3 +1,4 @@ # Target: Intel 386 running NetBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o +TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o \ + nbsd-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h diff --git a/gdb/config/i386/nbsdaout.mh b/gdb/config/i386/nbsdaout.mh index e52f38a5b21..226c56cc445 100644 --- a/gdb/config/i386/nbsdaout.mh +++ b/gdb/config/i386/nbsdaout.mh @@ -1,6 +1,5 @@ # Host: Intel 386 running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ - solib.o solib-sunos.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o solib-sunos.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsdaout.h diff --git a/gdb/config/i386/nbsdaout.mt b/gdb/config/i386/nbsdaout.mt deleted file mode 100644 index aa88957b9ea..00000000000 --- a/gdb/config/i386/nbsdaout.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Intel 386 running NetBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o -TM_FILE= tm-nbsdaout.h diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh index 0d1c4d1badc..7c27b02f3ac 100644 --- a/gdb/config/i386/nbsdelf.mh +++ b/gdb/config/i386/nbsdelf.mh @@ -1,5 +1,4 @@ # Host: Intel 386 running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ - solib.o solib-svr4.o solib-legacy.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/i386/tm-fbsd.h b/gdb/config/i386/tm-fbsd.h index 1975a9b458b..433ef849383 100644 --- a/gdb/config/i386/tm-fbsd.h +++ b/gdb/config/i386/tm-fbsd.h @@ -27,16 +27,4 @@ #include <sys/param.h> #endif -/* These defines allow the recognition of sigtramps as a function name - <sigtramp>. - - FIXME: kettenis/2002-05-12: Of course these defines will have to go - if we go truly "multi-arch", but I don't know yet how to get rid of - them. */ - -#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc) -#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc) -extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc); -extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc); - #endif /* TM_FBSD_H */ diff --git a/gdb/config/i386/tm-nbsd.h b/gdb/config/i386/tm-nbsd.h index 0d73d3a0d96..8e589281325 100644 --- a/gdb/config/i386/tm-nbsd.h +++ b/gdb/config/i386/tm-nbsd.h @@ -22,17 +22,6 @@ #define TM_NBSD_H #include "i386/tm-i386.h" - -/* These defines allow the recognition of sigtramps as a function name - <sigtramp>. - - FIXME: kettenis/2002-05-12: Of course these defines will have to go - if we go truly "multi-arch", but I don't know yet how to get rid of - them. */ - -#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc) -#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc) -extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc); -extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc); +#include "solib.h" #endif /* TM_NBSD_H */ diff --git a/gdb/config/mips/nbsd.mt b/gdb/config/mips/nbsd.mt index de529166c56..eb5d8871d79 100644 --- a/gdb/config/mips/nbsd.mt +++ b/gdb/config/mips/nbsd.mt @@ -1,5 +1,6 @@ # Target: MIPS running NetBSD -TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o +TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o \ + nbsd-tdep.o TM_FILE= tm-nbsd.h SIM_OBS = remote-sim.o diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h index ac710a465a6..6a91ebc6239 100644 --- a/gdb/config/mips/tm-irix6.h +++ b/gdb/config/mips/tm-irix6.h @@ -1,6 +1,6 @@ /* Target machine description for SGI Iris under Irix 6.x, for GDB. - Copyright 2001 - Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -38,7 +38,6 @@ #undef BADVADDR_REGNUM #undef FCRCS_REGNUM #undef FCRIR_REGNUM -#undef FP_REGNUM /* Number of machine registers */ @@ -74,7 +73,6 @@ #define LO_REGNUM 68 /* ... */ #define FCRCS_REGNUM 69 /* FP control/status */ #define FCRIR_REGNUM 70 /* FP implementation/revision */ -#define FP_REGNUM 30 /* S8 register is the Frame Pointer */ #undef REGISTER_BYTES diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index d87c4a74981..ded8e109e12 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -1,7 +1,8 @@ /* Definitions to make GDB run on a mips box under 4.3bsd. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000 - Free Software Foundation, Inc. + + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Contributed by Per Bothner (bothner@cs.wisc.edu) at U.Wisconsin and by Alessandro Forin (af@cs.cmu.edu) at CMU.. @@ -86,7 +87,7 @@ extern int mips_step_skips_delay (CORE_ADDR); "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ - "fsr", "fir", "fp", "", \ + "fsr", "fir", ""/*"fp"*/, "", \ "", "", "", "", "", "", "", "", \ "", "", "", "", "", "", "", "", \ } @@ -115,7 +116,6 @@ extern int mips_step_skips_delay (CORE_ADDR); #define FPA0_REGNUM (FP0_REGNUM+12) /* First float argument register */ #define FCRCS_REGNUM 70 /* FP control/status */ #define FCRIR_REGNUM 71 /* FP implementation/revision */ -#define FP_REGNUM 72 /* Pseudo register that contains true address of executing stack frame */ #define UNUSED_REGNUM 73 /* Never used, FIXME */ #define FIRST_EMBED_REGNUM 74 /* First CP0 register for embedded use */ #define PRID_REGNUM 89 /* Processor ID */ diff --git a/gdb/configure b/gdb/configure index 9befcab3d80..e8a83ab0547 100755 --- a/gdb/configure +++ b/gdb/configure @@ -62,6 +62,8 @@ ac_help="$ac_help --enable-sim Link gdb with simulator" ac_help="$ac_help --enable-shared Use shared libraries" +ac_help="$ac_help + --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -79,7 +81,6 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= -sitefile= srcdir= target=NONE verbose= @@ -194,7 +195,6 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -365,11 +365,6 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -535,16 +530,12 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -else - CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -585,7 +576,7 @@ fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:589: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:580: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -611,7 +602,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:615: checking for $ac_word" >&5 +echo "configure:606: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -641,7 +632,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:645: checking for $ac_word" >&5 +echo "configure:636: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -692,7 +683,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:696: checking for $ac_word" >&5 +echo "configure:687: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -724,7 +715,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:728: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:719: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -735,12 +726,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 739 "configure" +#line 730 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -766,12 +757,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:770: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:761: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:775: checking whether we are using GNU C" >&5 +echo "configure:766: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -780,7 +771,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -799,7 +790,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:803: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:794: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -831,7 +822,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:835: checking how to run the C preprocessor" >&5 +echo "configure:826: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -846,13 +837,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 850 "configure" +#line 841 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -863,13 +854,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 867 "configure" +#line 858 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -880,13 +871,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 884 "configure" +#line 875 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -911,9 +902,9 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:915: checking for AIX" >&5 +echo "configure:906: checking for AIX" >&5 cat > conftest.$ac_ext <<EOF -#line 917 "configure" +#line 908 "configure" #include "confdefs.h" #ifdef _AIX yes @@ -935,7 +926,7 @@ rm -f conftest* echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:939: checking for POSIXized ISC" >&5 +echo "configure:930: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -959,7 +950,7 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:963: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:954: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -976,7 +967,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" cat > conftest.$ac_ext <<EOF -#line 980 "configure" +#line 971 "configure" #include "confdefs.h" #include <stdarg.h> #include <stdio.h> @@ -1013,7 +1004,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } EOF -if { (eval echo configure:1017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else @@ -1084,7 +1075,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1088: checking host system type" >&5 +echo "configure:1079: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1105,7 +1096,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1109: checking target system type" >&5 +echo "configure:1100: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1123,7 +1114,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1127: checking build system type" >&5 +echo "configure:1118: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1148,7 +1139,7 @@ test "$host_alias" != "$target_alias" && ALL_LINGUAS= echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1152: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1143: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1177,7 +1168,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1181: checking for $ac_word" >&5 +echo "configure:1172: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1205,12 +1196,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1209: checking for ANSI C header files" >&5 +echo "configure:1200: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1214 "configure" +#line 1205 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1218,7 +1209,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1235,7 +1226,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1239 "configure" +#line 1230 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1253,7 +1244,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1257 "configure" +#line 1248 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1274,7 +1265,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1278 "configure" +#line 1269 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1285,7 +1276,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1309,12 +1300,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1313: checking for working const" >&5 +echo "configure:1304: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1318 "configure" +#line 1309 "configure" #include "confdefs.h" int main() { @@ -1363,7 +1354,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1384,21 +1375,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1388: checking for inline" >&5 +echo "configure:1379: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 1395 "configure" +#line 1386 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:1402: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1424,12 +1415,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1428: checking for off_t" >&5 +echo "configure:1419: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1433 "configure" +#line 1424 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1457,12 +1448,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1461: checking for size_t" >&5 +echo "configure:1452: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1466 "configure" +#line 1457 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1492,19 +1483,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1496: checking for working alloca.h" >&5 +echo "configure:1487: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1501 "configure" +#line 1492 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1525,12 +1516,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1529: checking for alloca" >&5 +echo "configure:1520: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1534 "configure" +#line 1525 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1558,7 +1549,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1590,12 +1581,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1594: checking whether alloca needs Cray hooks" >&5 +echo "configure:1585: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1599 "configure" +#line 1590 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1620,12 +1611,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1624: checking for $ac_func" >&5 +echo "configure:1615: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1629 "configure" +#line 1620 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1648,7 +1639,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1675,7 +1666,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1679: checking stack direction for C alloca" >&5 +echo "configure:1670: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1683,7 +1674,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1687 "configure" +#line 1678 "configure" #include "confdefs.h" find_stack_direction () { @@ -1702,7 +1693,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:1706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1723,21 +1714,21 @@ EOF fi -for ac_hdr in unistd.h +for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1731: checking for $ac_hdr" >&5 +echo "configure:1722: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1736 "configure" +#line 1727 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1766,12 +1757,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1770: checking for $ac_func" >&5 +echo "configure:1761: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1775 "configure" +#line 1766 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1794,7 +1785,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1819,7 +1810,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1823: checking for working mmap" >&5 +echo "configure:1814: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1827,7 +1818,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 1831 "configure" +#line 1822 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -1855,11 +1846,24 @@ else #include <fcntl.h> #include <sys/mman.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#if HAVE_STDLIB_H +# include <stdlib.h> +#endif + +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif + +#if HAVE_UNISTD_H +# include <unistd.h> +#endif + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -1967,7 +1971,7 @@ main() } EOF -if { (eval echo configure:1971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -1995,17 +1999,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1999: checking for $ac_hdr" >&5 +echo "configure:2003: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2004 "configure" +#line 2008 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2035,12 +2039,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2039: checking for $ac_func" >&5 +echo "configure:2043: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2044 "configure" +#line 2048 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2063,7 +2067,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2092,12 +2096,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2096: checking for $ac_func" >&5 +echo "configure:2100: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2101 "configure" +#line 2105 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2120,7 +2124,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2154,19 +2158,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2158: checking for LC_MESSAGES" >&5 +echo "configure:2162: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2163 "configure" +#line 2167 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -2187,7 +2191,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2191: checking whether NLS is requested" >&5 +echo "configure:2195: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -2207,7 +2211,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2211: checking whether included gettext is requested" >&5 +echo "configure:2215: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -2226,17 +2230,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2230: checking for libintl.h" >&5 +echo "configure:2234: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2235 "configure" +#line 2239 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2253,19 +2257,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:2257: checking for gettext in libc" >&5 +echo "configure:2261: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2262 "configure" +#line 2266 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -2281,7 +2285,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:2285: checking for bindtextdomain in -lintl" >&5 +echo "configure:2289: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2289,7 +2293,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2293 "configure" +#line 2297 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2300,7 +2304,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:2304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2316,19 +2320,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:2320: checking for gettext in libintl" >&5 +echo "configure:2324: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2325 "configure" +#line 2329 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -2356,7 +2360,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2360: checking for $ac_word" >&5 +echo "configure:2364: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2390,12 +2394,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2394: checking for $ac_func" >&5 +echo "configure:2398: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2399 "configure" +#line 2403 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2418,7 +2422,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2445,7 +2449,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2449: checking for $ac_word" >&5 +echo "configure:2453: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2481,7 +2485,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2485: checking for $ac_word" >&5 +echo "configure:2489: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2513,7 +2517,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 2517 "configure" +#line 2521 "configure" #include "confdefs.h" int main() { @@ -2521,7 +2525,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:2525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -2553,7 +2557,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2557: checking for $ac_word" >&5 +echo "configure:2561: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2587,7 +2591,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2591: checking for $ac_word" >&5 +echo "configure:2595: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2623,7 +2627,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2627: checking for $ac_word" >&5 +echo "configure:2631: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2713,7 +2717,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:2717: checking for catalogs to be installed" >&5 +echo "configure:2721: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -2741,17 +2745,17 @@ echo "configure:2717: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:2745: checking for linux/version.h" >&5 +echo "configure:2749: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2750 "configure" +#line 2754 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2875,12 +2879,12 @@ EOF fi -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2884: checking for $ac_word" >&5 +echo "configure:2888: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2921,7 +2925,7 @@ done # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2925: checking for a BSD compatible install" >&5 +echo "configure:2929: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2982,7 +2986,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2986: checking for $ac_word" >&5 +echo "configure:2990: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3014,7 +3018,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3018: checking for $ac_word" >&5 +echo "configure:3022: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3046,7 +3050,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3050: checking for $ac_word" >&5 +echo "configure:3054: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3081,7 +3085,7 @@ fi # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3085: checking for $ac_word" >&5 +echo "configure:3089: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3113,7 +3117,7 @@ fi # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3117: checking for $ac_word" >&5 +echo "configure:3121: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3147,7 +3151,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3151: checking for $ac_word" >&5 +echo "configure:3155: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3181,7 +3185,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3185: checking for $ac_word" >&5 +echo "configure:3189: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3232,12 +3236,12 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3236: checking return type of signal handlers" >&5 +echo "configure:3240: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3241 "configure" +#line 3245 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -3254,7 +3258,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3262: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3274,12 +3278,12 @@ EOF echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3278: checking for ANSI C header files" >&5 +echo "configure:3282: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3283 "configure" +#line 3287 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -3287,7 +3291,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3291: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3304,7 +3308,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3308 "configure" +#line 3312 "configure" #include "confdefs.h" #include <string.h> EOF @@ -3322,7 +3326,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3326 "configure" +#line 3330 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -3343,7 +3347,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 3347 "configure" +#line 3351 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3354,7 +3358,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3398,17 +3402,17 @@ for ac_hdr in ctype.h nlist.h link.h thread_db.h proc_service.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3402: checking for $ac_hdr" >&5 +echo "configure:3406: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3407 "configure" +#line 3411 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3435,12 +3439,12 @@ fi done echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:3439: checking whether stat file-mode macros are broken" >&5 +echo "configure:3443: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3444 "configure" +#line 3448 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -3492,12 +3496,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3496: checking for working const" >&5 +echo "configure:3500: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3501 "configure" +#line 3505 "configure" #include "confdefs.h" int main() { @@ -3546,7 +3550,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:3550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3567,21 +3571,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3571: checking for inline" >&5 +echo "configure:3575: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 3578 "configure" +#line 3582 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:3585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3611,12 +3615,12 @@ for ac_func in bcopy btowc bzero canonicalize_file_name isascii poll \ realpath sbrk setpgid setpgrp sigaction sigprocmask sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3615: checking for $ac_func" >&5 +echo "configure:3619: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3620 "configure" +#line 3624 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3639,7 +3643,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3666,19 +3670,19 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3670: checking for working alloca.h" >&5 +echo "configure:3674: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3675 "configure" +#line 3679 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3699,12 +3703,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3703: checking for alloca" >&5 +echo "configure:3707: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3708 "configure" +#line 3712 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3732,7 +3736,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3764,12 +3768,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3768: checking whether alloca needs Cray hooks" >&5 +echo "configure:3772: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3773 "configure" +#line 3777 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3794,12 +3798,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3798: checking for $ac_func" >&5 +echo "configure:3802: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3803 "configure" +#line 3807 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3822,7 +3826,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3849,7 +3853,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3853: checking stack direction for C alloca" >&5 +echo "configure:3857: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3857,7 +3861,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3861 "configure" +#line 3865 "configure" #include "confdefs.h" find_stack_direction () { @@ -3876,7 +3880,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3898,12 +3902,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3902: checking for pid_t" >&5 +echo "configure:3906: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3907 "configure" +#line 3911 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3932,17 +3936,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:3936: checking for vfork.h" >&5 +echo "configure:3940: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3941 "configure" +#line 3945 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3967,18 +3971,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:3971: checking for working vfork" >&5 +echo "configure:3975: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:3977: checking for vfork" >&5 +echo "configure:3981: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3982 "configure" +#line 3986 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -4001,7 +4005,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:4005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -4023,7 +4027,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 4027 "configure" +#line 4031 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -4118,7 +4122,7 @@ main() { } } EOF -if { (eval echo configure:4122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -4142,7 +4146,7 @@ fi if test "$cross_compiling" = no; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:4146: checking whether setpgrp takes no argument" >&5 +echo "configure:4150: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4150,7 +4154,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 4154 "configure" +#line 4158 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -4170,7 +4174,7 @@ main() } EOF -if { (eval echo configure:4174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -4195,12 +4199,12 @@ fi else echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:4199: checking whether setpgrp takes no argument" >&5 +echo "configure:4203: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4204 "configure" +#line 4208 "configure" #include "confdefs.h" #include <unistd.h> @@ -4214,7 +4218,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4218: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_func_setpgrp_void=no else @@ -4238,12 +4242,12 @@ fi # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do # since sigsetjmp might only be defined as a macro. echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:4242: checking for sigsetjmp" >&5 +echo "configure:4246: checking for sigsetjmp" >&5 if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4247 "configure" +#line 4251 "configure" #include "confdefs.h" #include <setjmp.h> @@ -4252,7 +4256,7 @@ int main() { sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); ; return 0; } EOF -if { (eval echo configure:4256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_func_sigsetjmp=yes else @@ -4275,19 +4279,19 @@ fi # See if <machine/reg.h> supports the %fs and %gs i386 segment registers. # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6 -echo "configure:4279: checking for r_fs in struct reg" >&5 +echo "configure:4283: checking for r_fs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4284 "configure" +#line 4288 "configure" #include "confdefs.h" #include <machine/reg.h> int main() { struct reg r; r.r_fs; ; return 0; } EOF -if { (eval echo configure:4291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_fs=yes else @@ -4307,19 +4311,19 @@ EOF fi echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6 -echo "configure:4311: checking for r_gs in struct reg" >&5 +echo "configure:4315: checking for r_gs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4316 "configure" +#line 4320 "configure" #include "confdefs.h" #include <machine/reg.h> int main() { struct reg r; r.r_gs; ; return 0; } EOF -if { (eval echo configure:4323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_gs=yes else @@ -4341,19 +4345,19 @@ fi # See if <sys/ptrace.h> provides the PTRACE_GETREGS request. echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:4345: checking for PTRACE_GETREGS" >&5 +echo "configure:4349: checking for PTRACE_GETREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4350 "configure" +#line 4354 "configure" #include "confdefs.h" #include <sys/ptrace.h> int main() { PTRACE_GETREGS; ; return 0; } EOF -if { (eval echo configure:4357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getregs=yes else @@ -4375,19 +4379,19 @@ fi # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request. echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:4379: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:4383: checking for PTRACE_GETFPXREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4384 "configure" +#line 4388 "configure" #include "confdefs.h" #include <sys/ptrace.h> int main() { PTRACE_GETFPXREGS; ; return 0; } EOF -if { (eval echo configure:4391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getfpxregs=yes else @@ -4409,12 +4413,12 @@ fi # See if <sys/ptrace.h> provides the PT_GETDBREGS request. echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6 -echo "configure:4413: checking for PT_GETDBREGS" >&5 +echo "configure:4417: checking for PT_GETDBREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4418 "configure" +#line 4422 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ptrace.h> @@ -4422,7 +4426,7 @@ int main() { PT_GETDBREGS; ; return 0; } EOF -if { (eval echo configure:4426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getdbregs=yes else @@ -4444,12 +4448,12 @@ fi # See if <sys/ptrace.h> provides the PT_GETXMMREGS request. echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6 -echo "configure:4448: checking for PT_GETXMMREGS" >&5 +echo "configure:4452: checking for PT_GETXMMREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4453 "configure" +#line 4457 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ptrace.h> @@ -4457,7 +4461,7 @@ int main() { PT_GETXMMREGS; ; return 0; } EOF -if { (eval echo configure:4461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getxmmregs=yes else @@ -4479,7 +4483,7 @@ fi echo $ac_n "checking for socketpair in -lsocket""... $ac_c" 1>&6 -echo "configure:4483: checking for socketpair in -lsocket" >&5 +echo "configure:4487: checking for socketpair in -lsocket" >&5 ac_lib_var=`echo socket'_'socketpair | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4487,7 +4491,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 4491 "configure" +#line 4495 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4498,7 +4502,7 @@ int main() { socketpair() ; return 0; } EOF -if { (eval echo configure:4502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4528,12 +4532,12 @@ fi for ac_func in socketpair do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4532: checking for $ac_func" >&5 +echo "configure:4536: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4537 "configure" +#line 4541 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4556,7 +4560,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4583,12 +4587,12 @@ done echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4587: checking whether malloc must be declared" >&5 +echo "configure:4591: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4592 "configure" +#line 4596 "configure" #include "confdefs.h" #include <stdio.h> @@ -4609,7 +4613,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4630,12 +4634,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4634: checking whether realloc must be declared" >&5 +echo "configure:4638: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4639 "configure" +#line 4643 "configure" #include "confdefs.h" #include <stdio.h> @@ -4656,7 +4660,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4664: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4677,12 +4681,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4681: checking whether free must be declared" >&5 +echo "configure:4685: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4686 "configure" +#line 4690 "configure" #include "confdefs.h" #include <stdio.h> @@ -4703,7 +4707,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -4724,12 +4728,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:4728: checking whether strerror must be declared" >&5 +echo "configure:4732: checking whether strerror must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4733 "configure" +#line 4737 "configure" #include "confdefs.h" #include <stdio.h> @@ -4750,7 +4754,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:4754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -4771,12 +4775,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:4775: checking whether strdup must be declared" >&5 +echo "configure:4779: checking whether strdup must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4780 "configure" +#line 4784 "configure" #include "confdefs.h" #include <stdio.h> @@ -4797,7 +4801,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:4801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -4818,12 +4822,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4822: checking whether strstr must be declared" >&5 +echo "configure:4826: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4827 "configure" +#line 4831 "configure" #include "confdefs.h" #include <stdio.h> @@ -4844,7 +4848,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4865,12 +4869,12 @@ EOF fi echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:4869: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:4873: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4874 "configure" +#line 4878 "configure" #include "confdefs.h" #include <stdio.h> @@ -4891,7 +4895,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:4895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_canonicalize_file_name=no else @@ -4917,9 +4921,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:4921: checking for HPUX save_state structure" >&5 +echo "configure:4925: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext <<EOF -#line 4923 "configure" +#line 4927 "configure" #include "confdefs.h" #include <machine/save_state.h> EOF @@ -4934,7 +4938,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 4938 "configure" +#line 4942 "configure" #include "confdefs.h" #include <machine/save_state.h> EOF @@ -5004,12 +5008,12 @@ fi if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5008: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5012: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5013 "configure" +#line 5017 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5018,7 +5022,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5026: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5040,12 +5044,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5044: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:5048: checking for prrun_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5049 "configure" +#line 5053 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5054,7 +5058,7 @@ int main() { prrun_t avar ; return 0; } EOF -if { (eval echo configure:5058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -5076,12 +5080,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6 echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5080: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:5084: checking for gregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5085 "configure" +#line 5089 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5090,7 +5094,7 @@ int main() { gregset_t avar ; return 0; } EOF -if { (eval echo configure:5094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -5112,12 +5116,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6 echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5116: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:5120: checking for fpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5121 "configure" +#line 5125 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5126,7 +5130,7 @@ int main() { fpregset_t avar ; return 0; } EOF -if { (eval echo configure:5130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -5148,12 +5152,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_fpregset_t" 1>&6 echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5152: checking for prgregset_t in sys/procfs.h" >&5 +echo "configure:5156: checking for prgregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5157 "configure" +#line 5161 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5162,7 +5166,7 @@ int main() { prgregset_t avar ; return 0; } EOF -if { (eval echo configure:5166: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset_t=yes else @@ -5184,12 +5188,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6 echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5188: checking for prfpregset_t in sys/procfs.h" >&5 +echo "configure:5192: checking for prfpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5193 "configure" +#line 5197 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5198,7 +5202,7 @@ int main() { prfpregset_t avar ; return 0; } EOF -if { (eval echo configure:5202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset_t=yes else @@ -5220,12 +5224,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6 echo $ac_n "checking for prgregset32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5224: checking for prgregset32_t in sys/procfs.h" >&5 +echo "configure:5228: checking for prgregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5229 "configure" +#line 5233 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5234,7 +5238,7 @@ int main() { prgregset32_t avar ; return 0; } EOF -if { (eval echo configure:5238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset32_t=yes else @@ -5256,12 +5260,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset32_t" 1>&6 echo $ac_n "checking for prfpregset32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5260: checking for prfpregset32_t in sys/procfs.h" >&5 +echo "configure:5264: checking for prfpregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5265 "configure" +#line 5269 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5270,7 +5274,7 @@ int main() { prfpregset32_t avar ; return 0; } EOF -if { (eval echo configure:5274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset32_t=yes else @@ -5292,12 +5296,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset32_t" 1>&6 echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5296: checking for lwpid_t in sys/procfs.h" >&5 +echo "configure:5300: checking for lwpid_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5301 "configure" +#line 5305 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5306,7 +5310,7 @@ int main() { lwpid_t avar ; return 0; } EOF -if { (eval echo configure:5310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpid_t=yes else @@ -5328,12 +5332,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6 echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5332: checking for psaddr_t in sys/procfs.h" >&5 +echo "configure:5336: checking for psaddr_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5337 "configure" +#line 5341 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5342,7 +5346,7 @@ int main() { psaddr_t avar ; return 0; } EOF -if { (eval echo configure:5346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psaddr_t=yes else @@ -5364,12 +5368,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6 echo $ac_n "checking for prsysent_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5368: checking for prsysent_t in sys/procfs.h" >&5 +echo "configure:5372: checking for prsysent_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5373 "configure" +#line 5377 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5378,7 +5382,7 @@ int main() { prsysent_t avar ; return 0; } EOF -if { (eval echo configure:5382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prsysent_t=yes else @@ -5400,12 +5404,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prsysent_t" 1>&6 echo $ac_n "checking for pr_sigset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5404: checking for pr_sigset_t in sys/procfs.h" >&5 +echo "configure:5408: checking for pr_sigset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5409 "configure" +#line 5413 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5414,7 +5418,7 @@ int main() { pr_sigset_t avar ; return 0; } EOF -if { (eval echo configure:5418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigset_t=yes else @@ -5436,12 +5440,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigset_t" 1>&6 echo $ac_n "checking for pr_sigaction64_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5440: checking for pr_sigaction64_t in sys/procfs.h" >&5 +echo "configure:5444: checking for pr_sigaction64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5445 "configure" +#line 5449 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5450,7 +5454,7 @@ int main() { pr_sigaction64_t avar ; return 0; } EOF -if { (eval echo configure:5454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes else @@ -5472,12 +5476,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigaction64_t" 1>&6 echo $ac_n "checking for pr_siginfo64_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5476: checking for pr_siginfo64_t in sys/procfs.h" >&5 +echo "configure:5480: checking for pr_siginfo64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5481 "configure" +#line 5485 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5486,7 +5490,7 @@ int main() { pr_siginfo64_t avar ; return 0; } EOF -if { (eval echo configure:5490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes else @@ -5513,7 +5517,7 @@ EOF if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6 -echo "configure:5517: checking whether prfpregset_t type is broken" >&5 +echo "configure:5521: checking whether prfpregset_t type is broken" >&5 if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5521,7 +5525,7 @@ else gdb_cv_prfpregset_t_broken=yes else cat > conftest.$ac_ext <<EOF -#line 5525 "configure" +#line 5529 "configure" #include "confdefs.h" #include <sys/procfs.h> int main () @@ -5531,7 +5535,7 @@ else return 0; } EOF -if { (eval echo configure:5535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_prfpregset_t_broken=no else @@ -5556,12 +5560,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5560: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:5564: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5565 "configure" +#line 5569 "configure" #include "confdefs.h" #include <unistd.h> #include <sys/types.h> @@ -5574,7 +5578,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -5598,19 +5602,19 @@ fi if test ${host} = ${target} ; then echo $ac_n "checking for member l_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:5602: checking for member l_addr in struct link_map" >&5 +echo "configure:5606: checking for member l_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5607 "configure" +#line 5611 "configure" #include "confdefs.h" #include <link.h> int main() { struct link_map lm; (void) lm.l_addr; ; return 0; } EOF -if { (eval echo configure:5614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5618: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_l_members=yes else @@ -5632,12 +5636,12 @@ EOF echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:5636: checking for member lm_addr in struct link_map" >&5 +echo "configure:5640: checking for member lm_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5641 "configure" +#line 5645 "configure" #include "confdefs.h" #include <sys/types.h> #include <link.h> @@ -5645,7 +5649,7 @@ int main() { struct link_map lm; (void) lm.lm_addr; ; return 0; } EOF -if { (eval echo configure:5649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_lm_members=yes else @@ -5667,12 +5671,12 @@ EOF echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6 -echo "configure:5671: checking for member som_addr in struct so_map" >&5 +echo "configure:5675: checking for member som_addr in struct so_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5676 "configure" +#line 5680 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_NLIST_H @@ -5683,7 +5687,7 @@ int main() { struct so_map lm; (void) lm.som_addr; ; return 0; } EOF -if { (eval echo configure:5687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_so_map_with_som_members=yes else @@ -5705,12 +5709,12 @@ EOF echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6 -echo "configure:5709: checking for struct link_map32 in sys/link.h" >&5 +echo "configure:5713: checking for struct link_map32 in sys/link.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5714 "configure" +#line 5718 "configure" #include "confdefs.h" #define _SYSCALL32 #include <sys/link.h> @@ -5718,7 +5722,7 @@ int main() { struct link_map32 l; ; return 0; } EOF -if { (eval echo configure:5722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map32=yes else @@ -5744,7 +5748,7 @@ EOF fi echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:5748: checking for main in -lm" >&5 +echo "configure:5752: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5752,14 +5756,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 5756 "configure" +#line 5760 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:5763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5788,7 +5792,7 @@ fi echo $ac_n "checking for wctype in -lc""... $ac_c" 1>&6 -echo "configure:5792: checking for wctype in -lc" >&5 +echo "configure:5796: checking for wctype in -lc" >&5 ac_lib_var=`echo c'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5796,7 +5800,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <<EOF -#line 5800 "configure" +#line 5804 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5807,7 +5811,7 @@ int main() { wctype() ; return 0; } EOF -if { (eval echo configure:5811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5826,7 +5830,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6 -echo "configure:5830: checking for wctype in -lw" >&5 +echo "configure:5834: checking for wctype in -lw" >&5 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5834,7 +5838,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <<EOF -#line 5838 "configure" +#line 5842 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5845,7 +5849,7 @@ int main() { wctype() ; return 0; } EOF -if { (eval echo configure:5849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5877,12 +5881,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:5881: checking for long long support in compiler" >&5 +echo "configure:5885: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5886 "configure" +#line 5890 "configure" #include "confdefs.h" int main() { @@ -5892,7 +5896,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -5914,7 +5918,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:5918: checking for long long support in printf" >&5 +echo "configure:5922: checking for long long support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5922,7 +5926,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <<EOF -#line 5926 "configure" +#line 5930 "configure" #include "confdefs.h" int main () { @@ -5936,7 +5940,7 @@ int main () { return (strcmp ("0x0123456789abcdef", buf)); } EOF -if { (eval echo configure:5940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_long=yes else @@ -5960,19 +5964,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6 -echo "configure:5964: checking for long double support in compiler" >&5 +echo "configure:5968: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5969 "configure" +#line 5973 "configure" #include "confdefs.h" int main() { long double foo; ; return 0; } EOF -if { (eval echo configure:5976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5980: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -5994,7 +5998,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:5998: checking for long double support in printf" >&5 +echo "configure:6002: checking for long double support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6002,7 +6006,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <<EOF -#line 6006 "configure" +#line 6010 "configure" #include "confdefs.h" int main () { @@ -6012,7 +6016,7 @@ int main () { return (strncmp ("3.14159", buf, 7)); } EOF -if { (eval echo configure:6016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_double=yes else @@ -6036,7 +6040,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6 -echo "configure:6040: checking for long double support in scanf" >&5 +echo "configure:6044: checking for long double support in scanf" >&5 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6044,7 +6048,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext <<EOF -#line 6048 "configure" +#line 6052 "configure" #include "confdefs.h" int main () { @@ -6054,7 +6058,7 @@ int main () { return !(f > 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:6058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_scanf_has_long_double=yes else @@ -6076,21 +6080,21 @@ EOF fi echo "$ac_t""$gdb_cv_scanf_has_long_double" 1>&6 -for ac_hdr in unistd.h +for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6084: checking for $ac_hdr" >&5 +echo "configure:6088: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6089 "configure" +#line 6093 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6094: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6119,12 +6123,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6123: checking for $ac_func" >&5 +echo "configure:6127: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6128 "configure" +#line 6132 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6147,7 +6151,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6172,7 +6176,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6176: checking for working mmap" >&5 +echo "configure:6180: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6180,7 +6184,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6184 "configure" +#line 6188 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6208,11 +6212,24 @@ else #include <fcntl.h> #include <sys/mman.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#if HAVE_STDLIB_H +# include <stdlib.h> +#endif + +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif + +#if HAVE_UNISTD_H +# include <unistd.h> +#endif + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -6320,7 +6337,7 @@ main() } EOF -if { (eval echo configure:6324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6346,7 +6363,7 @@ fi case ${host_os} in aix*) echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6 -echo "configure:6350: checking for -bbigtoc option" >&5 +echo "configure:6367: checking for -bbigtoc option" >&5 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6360,14 +6377,14 @@ else LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc cat > conftest.$ac_ext <<EOF -#line 6364 "configure" +#line 6381 "configure" #include "confdefs.h" int main() { int i; ; return 0; } EOF -if { (eval echo configure:6371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -6390,7 +6407,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then case ${host_os} in hpux*) echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6 -echo "configure:6394: checking for HPUX/OSF thread support" >&5 +echo "configure:6411: checking for HPUX/OSF thread support" >&5 if test -f /usr/include/dce/cma_config.h ; then if test "$GCC" = "yes" ; then echo "$ac_t""yes" 1>&6 @@ -6409,7 +6426,7 @@ EOF ;; solaris*) echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:6413: checking for Solaris thread debugging library" >&5 +echo "configure:6430: checking for Solaris thread debugging library" >&5 if test -f /usr/lib/libthread_db.so.1 ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -6419,7 +6436,7 @@ EOF CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:6423: checking for dlopen in -ldl" >&5 +echo "configure:6440: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6427,7 +6444,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 6431 "configure" +#line 6448 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6438,7 +6455,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:6442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6470,17 +6487,17 @@ fi # all symbols visible in the dynamic symbol table. hold_ldflags=$LDFLAGS echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6 -echo "configure:6474: checking for the ld -export-dynamic flag" >&5 +echo "configure:6491: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <<EOF -#line 6477 "configure" +#line 6494 "configure" #include "confdefs.h" int main() { int i; ; return 0; } EOF -if { (eval echo configure:6484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -6499,13 +6516,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in <proc_service.h> # at one point. echo $ac_n "checking if <proc_service.h> is old""... $ac_c" 1>&6 -echo "configure:6503: checking if <proc_service.h> is old" >&5 +echo "configure:6520: checking if <proc_service.h> is old" >&5 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6509 "configure" +#line 6526 "configure" #include "confdefs.h" #include <proc_service.h> @@ -6516,7 +6533,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -6735,7 +6752,7 @@ WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6 -echo "configure:6739: checking compiler warning flags" >&5 +echo "configure:6756: checking compiler warning flags" >&5 # Separate out the -Werror flag as some files just cannot be # compiled with it enabled. for w in ${build_warnings}; do @@ -6745,14 +6762,14 @@ echo "configure:6739: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <<EOF -#line 6749 "configure" +#line 6766 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:6756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -6812,12 +6829,12 @@ fi if test $want_included_regex = false; then echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6816: checking for GNU regex" >&5 +echo "configure:6833: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6821 "configure" +#line 6838 "configure" #include "confdefs.h" #include <gnu-versions.h> #include <sys/types.h> @@ -6829,7 +6846,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6858,12 +6875,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:6862: checking for cygwin" >&5 +echo "configure:6879: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6867 "configure" +#line 6884 "configure" #include "confdefs.h" #if defined (__CYGWIN__) || defined (__CYGWIN32__) @@ -6901,7 +6918,7 @@ if test x$gdb_cv_os_cygwin = xyes; then else TERM_LIB= echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:6905: checking for tgetent in -lncurses" >&5 +echo "configure:6922: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6909,7 +6926,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 6913 "configure" +#line 6930 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6920,7 +6937,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:6924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6939,7 +6956,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6 -echo "configure:6943: checking for tgetent in -lHcurses" >&5 +echo "configure:6960: checking for tgetent in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6947,7 +6964,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 6951 "configure" +#line 6968 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6958,7 +6975,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:6962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6977,7 +6994,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 -echo "configure:6981: checking for tgetent in -ltermlib" >&5 +echo "configure:6998: checking for tgetent in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6985,7 +7002,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <<EOF -#line 6989 "configure" +#line 7006 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6996,7 +7013,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7015,7 +7032,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:7019: checking for tgetent in -ltermcap" >&5 +echo "configure:7036: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7023,7 +7040,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 7027 "configure" +#line 7044 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7034,7 +7051,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7053,7 +7070,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:7057: checking for tgetent in -lcurses" >&5 +echo "configure:7074: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7061,7 +7078,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 7065 "configure" +#line 7082 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7072,7 +7089,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7091,7 +7108,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6 -echo "configure:7095: checking for tgetent in -lterminfo" >&5 +echo "configure:7112: checking for tgetent in -lterminfo" >&5 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7099,7 +7116,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <<EOF -#line 7103 "configure" +#line 7120 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7110,7 +7127,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7275,7 +7292,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:7279: checking for Tcl configuration" >&5 +echo "configure:7296: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7383,7 +7400,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:7387: checking for Tk configuration" >&5 +echo "configure:7404: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7492,7 +7509,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:7496: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:7513: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -7558,17 +7575,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:7562: checking for tclInt.h" >&5 +echo "configure:7579: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7567 "configure" +#line 7584 "configure" #include "confdefs.h" #include <tclInt.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7628,7 +7645,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:7632: checking for Tk private headers" >&5 +echo "configure:7649: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -7694,17 +7711,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:7698: checking for tk.h" >&5 +echo "configure:7715: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7703 "configure" +#line 7720 "configure" #include "confdefs.h" #include <tk.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7750,7 +7767,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7754: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:7771: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do if test -f $i/generic/itcl.h ; then @@ -7773,7 +7790,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7777: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:7794: checking for Itk private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itkh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do if test -f $i/generic/itk.h ; then @@ -7796,7 +7813,7 @@ fi echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7800: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:7817: checking for Tix private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_tixh}" = x ; then for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do if test -f $i/generic/tix.h ; then @@ -7848,7 +7865,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:7852: checking for Itcl configuration" >&5 +echo "configure:7869: checking for Itcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7951,7 +7968,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:7955: checking for Itk configuration" >&5 +echo "configure:7972: checking for Itk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8054,7 +8071,7 @@ if test "${with_tixconfig+set}" = set; then fi echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6 -echo "configure:8058: checking for Tix configuration" >&5 +echo "configure:8075: checking for Tix configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8200,7 +8217,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:8204: checking for X" >&5 +echo "configure:8221: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -8262,12 +8279,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 8266 "configure" +#line 8283 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8271: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8336,14 +8353,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 8340 "configure" +#line 8357 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:8347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -8635,7 +8652,7 @@ fi # ``gdbserver'' can only be built in a native configuration. if test x"${target}" = x"${host}"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:8639: checking whether gdbserver is supported on this host" >&5 +echo "configure:8656: checking whether gdbserver is supported on this host" >&5 if test x"${build_gdbserver}" = xyes ; then configdirs="${configdirs} gdbserver" SUBDIRS="${SUBDIRS} gdbserver" @@ -8697,7 +8714,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:8701: checking whether ln -s works" >&5 +echo "configure:8718: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8721,12 +8738,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:8725: checking for Cygwin environment" >&5 +echo "configure:8742: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8730 "configure" +#line 8747 "configure" #include "confdefs.h" int main() { @@ -8737,7 +8754,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:8741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -8754,19 +8771,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:8758: checking for mingw32 environment" >&5 +echo "configure:8775: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8763 "configure" +#line 8780 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:8770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -8785,7 +8802,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:8789: checking for executable suffix" >&5 +echo "configure:8806: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8795,10 +8812,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:8799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:8816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *.c | *.o | *.obj) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -8816,6 +8833,141 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6 ac_exeext=$EXEEXT + +cat >> confdefs.h <<\EOF +#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1" +EOF + + + + + # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + +fi + + + echo $ac_n "checking for iconv""... $ac_c" 1>&6 +echo "configure:8858: checking for iconv" >&5 +if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat > conftest.$ac_ext <<EOF +#line 8866 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <iconv.h> +int main() { +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); +; return 0; } +EOF +if { (eval echo configure:8876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_func_iconv=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + cat > conftest.$ac_ext <<EOF +#line 8888 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <iconv.h> +int main() { +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); +; return 0; } +EOF +if { (eval echo configure:8898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + LIBS="$am_save_LIBS" + fi + +fi + +echo "$ac_t""$am_cv_func_iconv" 1>&6 + if test "$am_cv_func_iconv" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ICONV 1 +EOF + + echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 +echo "configure:8919: checking for iconv declaration" >&5 + if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <<EOF +#line 8925 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <iconv.h> +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int main() { + +; return 0; } +EOF +if { (eval echo configure:8944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_proto_iconv_arg1="" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_proto_iconv_arg1="const" +fi +rm -f conftest* + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" +fi + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + echo "$ac_t""${ac_t:- + }$am_cv_proto_iconv" 1>&6 + cat >> confdefs.h <<EOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +EOF + + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + + + subdirs="$configdirs" trap '' 1 2 15 @@ -9097,6 +9249,7 @@ s%@tm_h@%$tm_h%g s%@nm_h@%$nm_h%g s%@LN_S@%$LN_S%g s%@EXEEXT@%$EXEEXT%g +s%@LIBICONV@%$LIBICONV%g s%@subdirs@%$subdirs%g CEOF @@ -9106,7 +9259,7 @@ cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. diff --git a/gdb/configure.in b/gdb/configure.in index edc72c3aa94..7bb455e39fd 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -1362,6 +1362,18 @@ AC_LINK_FILES($files, $links) dnl Check for exe extension set on certain hosts (e.g. Win32) AC_EXEEXT +dnl Detect the character set used by this host. + +dnl At the moment, we just assume it's ISO-8859-1 (which is a +dnl superset of ASCII containing the characters needed for French, +dnl German, Spanish, Italian, and possibly others), but if were +dnl *were* to support any host character sets other than ISO-8859-1, +dnl here's where we'd detect it. +AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1", + [Define to be a string naming the default host character set.]) + +AM_ICONV + AC_CONFIG_SUBDIRS($configdirs) AC_OUTPUT(Makefile .gdbinit:gdbinit.in, [ diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 385dbd02b3d..896fbb18cb3 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -92,9 +92,8 @@ i[3456]86-ncr-*) gdb_target=ncr3000 ;; # OBSOLETE i[3456]86-*-aix*) gdb_target=i386aix ;; i[3456]86-*-bsd*) gdb_target=i386bsd ;; i[3456]86-*-freebsd*) gdb_target=fbsd ;; -i[3456]86-*-netbsdelf*) gdb_target=nbsdelf ;; -i[3456]86-*-netbsd* | i[3456]86-*-openbsd*) - gdb_target=nbsdaout ;; +i[3456]86-*-netbsd*) gdb_target=nbsd ;; +i[3456]86-*-openbsd*) gdb_target=nbsd ;; # FIXME: needs its own target # OBSOLETE i[3456]86-*-os9k) gdb_target=i386os9k ;; i[3456]86-*-go32*) gdb_target=i386aout ;; i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;; diff --git a/gdb/cp-support.c b/gdb/cp-support.c new file mode 100644 index 00000000000..46363a8b3bf --- /dev/null +++ b/gdb/cp-support.c @@ -0,0 +1,141 @@ +/* Helper routines for C++ support in GDB. + Copyright 2002 Free Software Foundation, Inc. + + Contributed by MontaVista Software. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "cp-support.h" +#include "gdb_string.h" +#include "demangle.h" + +/* Find the last component of the demangled C++ name NAME. NAME + must be a method name including arguments, in order to correctly + locate the last component. + + This function return a pointer to the first colon before the + last component, or NULL if the name had only one component. */ + +static const char * +find_last_component (const char *name) +{ + const char *p; + int depth; + + /* Functions can have local classes, so we need to find the + beginning of the last argument list, not the end of the first + one. */ + p = name + strlen (name) - 1; + while (p > name && *p != ')') + p--; + + if (p == name) + return NULL; + + /* P now points at the `)' at the end of the argument list. Walk + back to the beginning. */ + p--; + depth = 1; + while (p > name && depth > 0) + { + if (*p == '<' || *p == '(') + depth--; + else if (*p == '>' || *p == ')') + depth++; + p--; + } + + if (p == name) + return NULL; + + while (p > name && *p != ':') + p--; + + if (p == name || p == name + 1 || p[-1] != ':') + return NULL; + + return p - 1; +} + +/* Return the name of the class containing method PHYSNAME. */ + +char * +class_name_from_physname (const char *physname) +{ + char *ret = NULL; + const char *end; + int depth = 0; + char *demangled_name = cplus_demangle (physname, DMGL_ANSI); + + if (demangled_name == NULL) + return NULL; + + end = find_last_component (demangled_name); + if (end != NULL) + { + ret = xmalloc (end - demangled_name + 1); + memcpy (ret, demangled_name, end - demangled_name); + ret[end - demangled_name] = '\0'; + } + + xfree (demangled_name); + return ret; +} + +/* Return the name of the method whose linkage name is PHYSNAME. */ + +char * +method_name_from_physname (const char *physname) +{ + char *ret = NULL; + const char *end; + int depth = 0; + char *demangled_name = cplus_demangle (physname, DMGL_ANSI); + + if (demangled_name == NULL) + return NULL; + + end = find_last_component (demangled_name); + if (end != NULL) + { + char *args; + int len; + + /* Skip "::". */ + end = end + 2; + + /* Find the argument list, if any. */ + args = strchr (end, '('); + if (args == NULL) + len = strlen (end + 2); + else + { + args --; + while (*args == ' ') + args --; + len = args - end + 1; + } + ret = xmalloc (len + 1); + memcpy (ret, end, len); + ret[len] = 0; + } + + xfree (demangled_name); + return ret; +} diff --git a/gdb/config/i386/tm-nbsdaout.h b/gdb/cp-support.h index 25325e1fe10..a7d333f28b2 100644 --- a/gdb/config/i386/tm-nbsdaout.h +++ b/gdb/cp-support.h @@ -1,5 +1,7 @@ -/* Macro definitions for i386 running under NetBSD. - Copyright 2000, 2002 Free Software Foundation, Inc. +/* Helper routines for C++ support in GDB. + Copyright 2002 Free Software Foundation, Inc. + + Contributed by MontaVista Software. This file is part of GDB. @@ -18,9 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef TM_NBSDAOUT_H -#define TM_NBSDAOUT_H - -#include "i386/tm-nbsd.h" +extern char *class_name_from_physname (const char *physname); -#endif /* TM_NBSDAOUT_H */ +extern char *method_name_from_physname (const char *physname); diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index b7922dab879..28dc0259c24 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -97,13 +97,11 @@ cp_print_class_method (char *valaddr, f = TYPE_FN_FIELDLIST1 (domain, i); len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i); + check_stub_method_group (domain, i); for (j = 0; j < len2; j++) { - QUIT; if (TYPE_FN_FIELD_VOFFSET (f, j) == offset) { - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (domain, i, j); kind = "virtual "; goto common; } @@ -129,15 +127,11 @@ cp_print_class_method (char *valaddr, f = TYPE_FN_FIELDLIST1 (domain, i); len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i); + check_stub_method_group (domain, i); for (j = 0; j < len2; j++) { - QUIT; - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (domain, i, j); if (STREQ (SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j))) - { - goto common; - } + goto common; } } } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index c53c7ea87ac..5d64d43f1f6 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "solib.h" /* Support for shared libraries. */ #include "solib-svr4.h" /* For struct link_map_offsets. */ +#include "gdb_string.h" enum cris_num_regs @@ -1214,9 +1215,10 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); fi->extra_info->return_pc = - generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); /* FIXME: Is this necessarily true? */ fi->extra_info->leaf_function = 0; diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 4e021069609..d338ff47810 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -513,9 +513,9 @@ static CORE_ADDR d10v_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return d10v_make_iaddr (generic_read_register_dummy (frame->pc, - frame->frame, - PC_REGNUM)); + return d10v_make_iaddr (deprecated_read_register_dummy (frame->pc, + frame->frame, + PC_REGNUM)); else return ((frame)->extra_info->return_pc); } diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 1d6024a597d..6592b74338b 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -76,14 +76,6 @@ struct symloc { - /* The start (inclusive) and end (exclusive) addresses for this - partial symtab's text. STABS doesn't reliably give us nice - start and end addresses for each function. Instead, we are - told the addresses of various boundary points, and we have to - gather those together to build ranges. These are our running - best guess as to the range of text addresses for this psymtab. */ - CORE_ADDR textlow, texthigh; - /* Offset within the file symbol table of first local symbol for this file. */ @@ -112,8 +104,6 @@ struct symloc #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff) #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen) #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private)) -#define TEXTLOW(p) (SYMLOC(p)->textlow) -#define TEXTHIGH(p) (SYMLOC(p)->texthigh) #define SYMBOL_SIZE(p) (SYMLOC(p)->symbol_size) #define SYMBOL_OFFSET(p) (SYMLOC(p)->symbol_offset) #define STRING_OFFSET(p) (SYMLOC(p)->string_offset) @@ -607,19 +597,6 @@ dbx_symfile_read (struct objfile *objfile, int mainline) read_dbx_dynamic_symtab (objfile); - /* Take the text ranges the STABS partial symbol scanner computed - for each of the psymtabs and convert it into the canonical form - for psymtabs. */ - { - struct partial_symtab *p; - - ALL_OBJFILE_PSYMTABS (objfile, p) - { - p->textlow = TEXTLOW (p); - p->texthigh = TEXTHIGH (p); - } - } - /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ @@ -1445,12 +1422,12 @@ read_dbx_symtab (struct objfile *objfile) if (past_first_source_file && pst /* The gould NP1 uses low values for .o and -l symbols which are not the address. */ - && nlist.n_value >= TEXTLOW (pst)) + && nlist.n_value >= pst->textlow) { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, - nlist.n_value > TEXTHIGH (pst) - ? nlist.n_value : TEXTHIGH (pst), + nlist.n_value > pst->texthigh + ? nlist.n_value : pst->texthigh, dependency_list, dependencies_used, textlow_not_set); pst = (struct partial_symtab *) 0; includes_used = 0; @@ -1572,7 +1549,7 @@ read_dbx_symtab (struct objfile *objfile) { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, - valu > TEXTHIGH (pst) ? valu : TEXTHIGH (pst), + valu > pst->texthigh ? valu : pst->texthigh, dependency_list, dependencies_used, prev_textlow_not_set); pst = (struct partial_symtab *) 0; @@ -1731,8 +1708,8 @@ read_dbx_symtab (struct objfile *objfile) function relative stabs, or the address of the function's end for old style stabs. */ valu = nlist.n_value + last_function_start; - if (TEXTHIGH (pst) == 0 || valu > TEXTHIGH (pst)) - TEXTHIGH (pst) = valu; + if (pst->texthigh == 0 || valu > pst->texthigh) + pst->texthigh = valu; break; } @@ -1934,7 +1911,7 @@ read_dbx_symtab (struct objfile *objfile) } if (pst && textlow_not_set) { - TEXTLOW (pst) = nlist.n_value; + pst->textlow = nlist.n_value; textlow_not_set = 0; } #endif @@ -1950,12 +1927,12 @@ read_dbx_symtab (struct objfile *objfile) the partial symbol table. */ if (pst && (textlow_not_set - || (nlist.n_value < TEXTLOW (pst) + || (nlist.n_value < pst->textlow && (nlist.n_value != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))))) { - TEXTLOW (pst) = nlist.n_value; + pst->textlow = nlist.n_value; textlow_not_set = 0; } add_psymbol_to_list (namestring, p - namestring, @@ -1999,7 +1976,7 @@ read_dbx_symtab (struct objfile *objfile) } if (pst && textlow_not_set) { - TEXTLOW (pst) = nlist.n_value; + pst->textlow = nlist.n_value; textlow_not_set = 0; } #endif @@ -2015,12 +1992,12 @@ read_dbx_symtab (struct objfile *objfile) the partial symbol table. */ if (pst && (textlow_not_set - || (nlist.n_value < TEXTLOW (pst) + || (nlist.n_value < pst->textlow && (nlist.n_value != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))))) { - TEXTLOW (pst) = nlist.n_value; + pst->textlow = nlist.n_value; textlow_not_set = 0; } add_psymbol_to_list (namestring, p - namestring, @@ -2132,7 +2109,7 @@ read_dbx_symtab (struct objfile *objfile) case N_ENDM: #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Solaris 2 end of module, finish current partial symbol table. - end_psymtab will set TEXTHIGH (pst) to the proper value, which + end_psymtab will set pst->texthigh to the proper value, which is necessary if a module compiled without debugging info follows this module. */ if (pst) @@ -2212,7 +2189,7 @@ read_dbx_symtab (struct objfile *objfile) end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, - text_end > TEXTHIGH (pst) ? text_end : TEXTHIGH (pst), + text_end > pst->texthigh ? text_end : pst->texthigh, dependency_list, dependencies_used, textlow_not_set); } @@ -2238,8 +2215,6 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow, result->read_symtab_private = (char *) obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); - TEXTLOW (result) = result->textlow; - TEXTHIGH (result) = result->texthigh; LDSYMOFF (result) = ldsymoff; result->read_symtab = dbx_psymtab_to_symtab; SYMBOL_SIZE (result) = symbol_size; @@ -2275,7 +2250,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, if (capping_symbol_offset != -1) LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); - TEXTHIGH (pst) = capping_text; + pst->texthigh = capping_text; #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Under Solaris, the N_SO symbols always have a value of 0, @@ -2293,7 +2268,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, a reliable texthigh by taking the address plus size of the last function in the file. */ - if (TEXTHIGH (pst) == 0 && last_function_name) + if (pst->texthigh == 0 && last_function_name) { char *p; int n; @@ -2319,14 +2294,14 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, } if (minsym) - TEXTHIGH (pst) = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym); + pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym); last_function_name = NULL; } /* this test will be true if the last .o file is only data */ if (textlow_not_set) - TEXTLOW (pst) = TEXTHIGH (pst); + pst->textlow = pst->texthigh; else { struct partial_symtab *p1; @@ -2339,12 +2314,12 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, ALL_OBJFILE_PSYMTABS (objfile, p1) { - if (TEXTHIGH (p1) == 0 && TEXTLOW (p1) != 0 && p1 != pst) + if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst) { - TEXTHIGH (p1) = TEXTLOW (pst); + p1->texthigh = pst->textlow; /* if this file has only data, then make textlow match texthigh */ - if (TEXTLOW (p1) == 0) - TEXTLOW (p1) = TEXTHIGH (p1); + if (p1->textlow == 0) + p1->textlow = p1->texthigh; } } } @@ -2381,8 +2356,8 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, sizeof (struct symloc)); LDSYMOFF (subpst) = LDSYMLEN (subpst) = - TEXTLOW (subpst) = - TEXTHIGH (subpst) = 0; + subpst->textlow = + subpst->texthigh = 0; /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ @@ -2550,8 +2525,8 @@ read_ofile_symtab (struct partial_symtab *pst) objfile = pst->objfile; sym_offset = LDSYMOFF (pst); sym_size = LDSYMLEN (pst); - text_offset = TEXTLOW (pst); - text_size = TEXTHIGH (pst) - TEXTLOW (pst); + text_offset = pst->textlow; + text_size = pst->texthigh - pst->textlow; /* This cannot be simply objfile->section_offsets because of elfstab_offset_sections() which initializes the psymtab section offsets information in a special way, and that is different from @@ -2696,13 +2671,13 @@ read_ofile_symtab (struct partial_symtab *pst) /* In a Solaris elf file, this variable, which comes from the value of the N_SO symbol, will still be 0. Luckily, text_offset, - which comes from TEXTLOW (pst) is correct. */ + which comes from pst->textlow is correct. */ if (last_source_start_addr == 0) last_source_start_addr = text_offset; /* In reordered executables last_source_start_addr may not be the lower bound for this symtab, instead use text_offset which comes - from TEXTLOW (pst) which is correct. */ + from pst->textlow which is correct. */ if (last_source_start_addr > text_offset) last_source_start_addr = text_offset; diff --git a/gdb/defs.h b/gdb/defs.h index dc2bd90833a..2416bcd1a50 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -24,27 +24,33 @@ #ifndef DEFS_H #define DEFS_H -#include "config.h" /* Generated by configure */ +#include "config.h" /* Generated by configure. */ + #include <stdio.h> -#include <errno.h> /* System call error return status */ +#include <errno.h> /* System call error return status. */ #include <limits.h> #ifdef HAVE_STDDEF_H #include <stddef.h> #else -#include <sys/types.h> /* for size_t */ +#include <sys/types.h> /* For size_t. */ #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +/* First include ansidecl.h so we can use the various macro definitions + here and in all subsequent file inclusions. */ + +#include "ansidecl.h" + #include "gdb_locale.h" /* For ``enum target_signal''. */ #include "gdb/signals.h" -/* Just in case they're not defined in stdio.h. */ +/* Just in case they're not defined in stdio.h. */ #ifndef SEEK_SET #define SEEK_SET 0 @@ -53,12 +59,7 @@ #define SEEK_CUR 1 #endif -/* First include ansidecl.h so we can use the various macro definitions - here and in all subsequent file inclusions. */ - -#include "ansidecl.h" - -#include <stdarg.h> /* for va_list */ +#include <stdarg.h> /* For va_list. */ #include "libiberty.h" @@ -889,6 +890,12 @@ extern NORETURN void internal_verror (const char *file, int line, extern NORETURN void internal_error (const char *file, int line, const char *, ...) ATTR_NORETURN ATTR_FORMAT (printf, 3, 4); +extern void internal_vwarning (const char *file, int line, + const char *, va_list ap); + +extern void internal_warning (const char *file, int line, + const char *, ...) ATTR_FORMAT (printf, 3, 4); + extern NORETURN void nomem (long) ATTR_NORETURN; /* Reasons for calling throw_exception(). NOTE: all reason values diff --git a/gdb/disasm.c b/gdb/disasm.c new file mode 100644 index 00000000000..8ce9a155166 --- /dev/null +++ b/gdb/disasm.c @@ -0,0 +1,374 @@ +/* Disassemble support for GDB. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "target.h" +#include "value.h" +#include "ui-out.h" +#include "gdb_string.h" + +#include "disasm.h" + +/* Disassemble functions. + FIXME: We should get rid of all the duplicate code in gdb that does + the same thing: disassemble_command() and the gdbtk variation. */ + +/* This Structure is used to store line number information. + We need a different sort of line table from the normal one cuz we can't + depend upon implicit line-end pc's for lines to do the + reordering in this function. */ + +struct dis_line_entry +{ + int line; + CORE_ADDR start_pc; + CORE_ADDR end_pc; +}; + +/* This variable determines where memory used for disassembly is read from. */ +int gdb_disassemble_from_exec = -1; + +/* This is the memory_read_func for gdb_disassemble when we are + disassembling from the exec file. */ +static int +gdb_dis_asm_read_memory (bfd_vma memaddr, bfd_byte * myaddr, + unsigned int len, disassemble_info * info) +{ + extern struct target_ops exec_ops; + int res; + + errno = 0; + res = xfer_memory (memaddr, myaddr, len, 0, 0, &exec_ops); + + if (res == len) + return 0; + else if (errno == 0) + return EIO; + else + return errno; +} + +static int +compare_lines (const PTR mle1p, const PTR mle2p) +{ + struct dis_line_entry *mle1, *mle2; + int val; + + mle1 = (struct dis_line_entry *) mle1p; + mle2 = (struct dis_line_entry *) mle2p; + + val = mle1->line - mle2->line; + + if (val != 0) + return val; + + return mle1->start_pc - mle2->start_pc; +} + +static int +dump_insns (struct ui_out *uiout, disassemble_info * di, + CORE_ADDR low, CORE_ADDR high, + int how_many, struct ui_stream *stb) +{ + int num_displayed = 0; + CORE_ADDR pc; + + /* parts of the symbolic representation of the address */ + int unmapped; + char *filename = NULL; + char *name = NULL; + int offset; + int line; + + for (pc = low; pc < high;) + { + QUIT; + if (how_many >= 0) + { + if (num_displayed >= how_many) + break; + else + num_displayed++; + } + ui_out_tuple_begin (uiout, NULL); + ui_out_field_core_addr (uiout, "address", pc); + + if (!build_address_symbolic (pc, 0, &name, &offset, &filename, + &line, &unmapped)) + { + /* We don't care now about line, filename and + unmapped. But we might in the future. */ + ui_out_text (uiout, " <"); + ui_out_field_string (uiout, "func-name", name); + ui_out_text (uiout, "+"); + ui_out_field_int (uiout, "offset", offset); + ui_out_text (uiout, ">:\t"); + } + if (filename != NULL) + xfree (filename); + if (name != NULL) + xfree (name); + + ui_file_rewind (stb->stream); + pc += TARGET_PRINT_INSN (pc, di); + ui_out_field_stream (uiout, "inst", stb); + ui_file_rewind (stb->stream); + ui_out_tuple_end (uiout); + ui_out_text (uiout, "\n"); + } + return num_displayed; +} + +/* The idea here is to present a source-O-centric view of a + function to the user. This means that things are presented + in source order, with (possibly) out of order assembly + immediately following. */ +static void +do_mixed_source_and_assembly (struct ui_out *uiout, + struct disassemble_info *di, int nlines, + struct linetable_entry *le, + CORE_ADDR low, CORE_ADDR high, + struct symtab *symtab, + int how_many, struct ui_stream *stb) +{ + int newlines = 0; + struct dis_line_entry *mle; + struct symtab_and_line sal; + int i; + int out_of_order = 0; + int next_line = 0; + CORE_ADDR pc; + int num_displayed = 0; + + mle = (struct dis_line_entry *) alloca (nlines + * sizeof (struct dis_line_entry)); + + /* Copy linetable entries for this function into our data + structure, creating end_pc's and setting out_of_order as + appropriate. */ + + /* First, skip all the preceding functions. */ + + for (i = 0; i < nlines - 1 && le[i].pc < low; i++); + + /* Now, copy all entries before the end of this function. */ + + for (; i < nlines - 1 && le[i].pc < high; i++) + { + if (le[i].line == le[i + 1].line && le[i].pc == le[i + 1].pc) + continue; /* Ignore duplicates */ + + /* Skip any end-of-function markers. */ + if (le[i].line == 0) + continue; + + mle[newlines].line = le[i].line; + if (le[i].line > le[i + 1].line) + out_of_order = 1; + mle[newlines].start_pc = le[i].pc; + mle[newlines].end_pc = le[i + 1].pc; + newlines++; + } + + /* If we're on the last line, and it's part of the function, + then we need to get the end pc in a special way. */ + + if (i == nlines - 1 && le[i].pc < high) + { + mle[newlines].line = le[i].line; + mle[newlines].start_pc = le[i].pc; + sal = find_pc_line (le[i].pc, 0); + mle[newlines].end_pc = sal.end; + newlines++; + } + + /* Now, sort mle by line #s (and, then by addresses within + lines). */ + + if (out_of_order) + qsort (mle, newlines, sizeof (struct dis_line_entry), compare_lines); + + /* Now, for each line entry, emit the specified lines (unless + they have been emitted before), followed by the assembly code + for that line. */ + + ui_out_list_begin (uiout, "asm_insns"); + + for (i = 0; i < newlines; i++) + { + int close_list = 1; + /* Print out everything from next_line to the current line. */ + if (mle[i].line >= next_line) + { + if (next_line != 0) + { + /* Just one line to print. */ + if (next_line == mle[i].line) + { + ui_out_tuple_begin (uiout, "src_and_asm_line"); + print_source_lines (symtab, next_line, mle[i].line + 1, 0); + } + else + { + /* Several source lines w/o asm instructions associated. */ + for (; next_line < mle[i].line; next_line++) + { + ui_out_tuple_begin (uiout, "src_and_asm_line"); + print_source_lines (symtab, next_line, next_line + 1, + 0); + ui_out_list_begin (uiout, "line_asm_insn"); + ui_out_list_end (uiout); + ui_out_tuple_end (uiout); + } + /* Print the last line and leave list open for + asm instructions to be added. */ + ui_out_tuple_begin (uiout, "src_and_asm_line"); + print_source_lines (symtab, next_line, mle[i].line + 1, 0); + } + } + else + { + ui_out_tuple_begin (uiout, "src_and_asm_line"); + print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0); + } + + next_line = mle[i].line + 1; + ui_out_list_begin (uiout, "line_asm_insn"); + /* Don't close the list if the lines are not in order. */ + if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line) + close_list = 0; + } + + num_displayed += dump_insns (uiout, di, mle[i].start_pc, mle[i].end_pc, + how_many, stb); + if (close_list) + { + ui_out_list_end (uiout); + ui_out_tuple_end (uiout); + ui_out_text (uiout, "\n"); + close_list = 0; + } + if (how_many >= 0) + if (num_displayed >= how_many) + break; + } + ui_out_list_end (uiout); +} + + +static void +do_assembly_only (struct ui_out *uiout, disassemble_info * di, + CORE_ADDR low, CORE_ADDR high, + int how_many, struct ui_stream *stb) +{ + int num_displayed = 0; + + ui_out_list_begin (uiout, "asm_insns"); + + num_displayed = dump_insns (uiout, di, low, high, how_many, stb); + + ui_out_list_end (uiout); +} + +void +gdb_disassembly (struct ui_out *uiout, + char *file_string, + int line_num, + int mixed_source_and_assembly, + int how_many, CORE_ADDR low, CORE_ADDR high) +{ + static disassemble_info di; + static int di_initialized; + /* To collect the instruction outputted from opcodes. */ + static struct ui_stream *stb = NULL; + struct symtab *symtab = NULL; + struct linetable_entry *le = NULL; + int nlines = -1; + + if (!di_initialized) + { + /* We don't add a cleanup for this, because the allocation of + the stream is done once only for each gdb run, and we need to + keep it around until the end. Hopefully there won't be any + errors in the init code below, that make this function bail + out. */ + stb = ui_out_stream_new (uiout); + INIT_DISASSEMBLE_INFO_NO_ARCH (di, stb->stream, + (fprintf_ftype) fprintf_unfiltered); + di.flavour = bfd_target_unknown_flavour; + di.memory_error_func = dis_asm_memory_error; + di.print_address_func = dis_asm_print_address; + di_initialized = 1; + } + + di.mach = TARGET_PRINT_INSN_INFO->mach; + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + di.endian = BFD_ENDIAN_BIG; + else + di.endian = BFD_ENDIAN_LITTLE; + + /* If gdb_disassemble_from_exec == -1, then we use the following heuristic to + determine whether or not to do disassembly from target memory or from the + exec file: + + If we're debugging a local process, read target memory, instead of the + exec file. This makes disassembly of functions in shared libs work + correctly. Also, read target memory if we are debugging native threads. + + Else, we're debugging a remote process, and should disassemble from the + exec file for speed. However, this is no good if the target modifies its + code (for relocation, or whatever). */ + + if (gdb_disassemble_from_exec == -1) + { + if (strcmp (target_shortname, "child") == 0 + || strcmp (target_shortname, "procfs") == 0 + || strcmp (target_shortname, "vxprocess") == 0 + || strstr (target_shortname, "-threads") != NULL) + gdb_disassemble_from_exec = 0; /* It's a child process, read inferior mem */ + else + gdb_disassemble_from_exec = 1; /* It's remote, read the exec file */ + } + + if (gdb_disassemble_from_exec) + di.read_memory_func = gdb_dis_asm_read_memory; + else + di.read_memory_func = dis_asm_read_memory; + + /* Assume symtab is valid for whole PC range */ + symtab = find_pc_symtab (low); + + if (symtab != NULL && symtab->linetable != NULL) + { + /* Convert the linetable to a bunch of my_line_entry's. */ + le = symtab->linetable->item; + nlines = symtab->linetable->nitems; + } + + if (!mixed_source_and_assembly || nlines <= 0 + || symtab == NULL || symtab->linetable == NULL) + do_assembly_only (uiout, &di, low, high, how_many, stb); + + else if (mixed_source_and_assembly) + do_mixed_source_and_assembly (uiout, &di, nlines, le, low, + high, symtab, how_many, stb); + + gdb_flush (gdb_stdout); +} diff --git a/gdb/disasm.h b/gdb/disasm.h new file mode 100644 index 00000000000..beaaf4aaa3d --- /dev/null +++ b/gdb/disasm.h @@ -0,0 +1,29 @@ +/* Disassemble support for GDB. + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef DISASM_H +#define DISASM_H + +extern void gdb_disassembly (struct ui_out *uiout, + char *file_string, + int line_num, + int mixed_source_and_assembly, + int how_many, CORE_ADDR low, CORE_ADDR high); +#endif diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index fbd6b4ddfc1..d8e4a1e27b9 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -8,6 +8,77 @@ * gdb.texinfo: Add chapter on interpreters. Refer the command-line option "-i"/"--interpreter" to this chapter. +2002-09-29 Hans-Peter Nilsson <hp@bitrange.com> + + * gdb.texinfo (Packets): Fix typos "alligned". + Correct z3/Z3 description. Correct z4/Z4 title. + +2002-09-27 Andrew Cagney <ac131313@redhat.com> + + * all-cfg.texi: Use @sc for GDB and GCC. Update copyright. + +2002-09-25 Kevin Buettner <kevinb@redhat.com> + + * gdb.texinfo: Use GNU/Linux instead of Linux. + +2002-09-25 Andrew Cagney <ac131313@redhat.com> + + * gdb.texinfo (Packets): Replace @samp{} with ``an empty string''. + +2002-09-24 Andrew Cagney <ac131313@redhat.com> + + * gdb.texinfo: Replace @example with @smallexample. + +2002-09-20 Kevin Buettner <kevinb@redhat.com> + + From Eli Zaretskii <eliz@is.elta.co.il>: + * gdb.texinfo (Character Sets): Use @smallexample instead of + @example. Use GNU/Linux instead of Linux. + +2002-09-20 Jim Blandy <jimb@redhat.com> + + * gdb.texinfo: Add character set documentation. + +2002-09-19 Andrew Cagney <ac131313@redhat.com> + + * gdb.texinfo (Packets): Revise `z' and `Z' packet documentation. + (Packets): Add cross reference from `b' packet to `z' packets. + +2002-09-19 Andrew Cagney <ac131313@redhat.com> + + * gdb.texinfo (Maintenance Commands): Document ``maint + internal-error'' and ``maint internal-warning''. + + * gdbint.texinfo (Target Architecture Definition): Revise + description of STACK_ALIGN. Add description of FRAME_ALIGN. + +2002-09-19 Joel Brobecker <brobecker@gnat.com> + + * gdbint.texinfo (Target Conditionals): Document the new + NAME_OF_MALLOC macro. + +2002-09-05 Andrew Cagney <ac131313@redhat.com> + + * gdb.texinfo (Contributors): Mention 5.2 and 5.3 release + engineer. + +2002-09-02 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.texinfo (TUI Overview): Document status line fields. + +2002-09-02 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.texinfo (TUI Commands): Document info win command. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.texinfo (TUI Overview): Document breakpoint markers. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.texinfo (TUI Single Key Mode): Document new SingleKey mode. + (TUI Keys): Likewise. + 2002-08-25 Andrew Cagney <ac131313@redhat.com> * gdb.texinfo (Examples): Use ``->'' for a packet send and ``<-'' diff --git a/gdb/doc/all-cfg.texi b/gdb/doc/all-cfg.texi index 6dee4e4ef67..b680ea2b492 100644 --- a/gdb/doc/all-cfg.texi +++ b/gdb/doc/all-cfg.texi @@ -1,5 +1,6 @@ @c GDB MANUAL configuration file. -@c Copyright 1993, 1995, 1999 Free Software Foundation, Inc. +@c +@c Copyright 1993, 1995, 1999, 2002 Free Software Foundation, Inc. @c @c NOTE: While the GDB manual is configurable (by changing these @c switches), its configuration is ***NOT*** automatically tied in to @@ -31,15 +32,14 @@ @set GDBP gdb @c @c Name of GDB product. Used in running text. -@set GDBN GDB +@set GDBN @sc{gdb} @c @c Name of host. Should not be used in generic configs, but generic @c value may catch some flubs. @set HOST machine specific @c @c Name of GCC product -@set NGCC GCC +@set NGCC @sc{gcc} @c @c Name of GCC program @set GCC gcc - diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 5a8ef7f1bf6..16f459e8674 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -31,7 +31,10 @@ @set EDITION Ninth @c !!set GDB manual's revision date -@set DATE December 2001 +@set DATE June 2002 + +@c !!set GDB edit command default editor +@set EDITOR /bin/ex @c THIS MANUAL REQUIRES TEXINFO 4.0 OR LATER. @@ -345,7 +348,7 @@ omitted from this list, we would like to add your names! So that they may not regard their many labors as thankless, we particularly thank those who shepherded @value{GDBN} through major releases: -Andrew Cagney (releases 5.0 and 5.1); +Andrew Cagney (releases 5.3, 5.2, 5.1 and 5.0); Jim Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs (release 4.14); @@ -392,7 +395,7 @@ Tim Tucker contributed support for the Gould NP1 and Gould Powernode. Pace Willison contributed Intel 386 support. Jay Vosburgh contributed Symmetry support. -Andreas Schwab contributed M68K Linux support. +Andreas Schwab contributed M68K @sc{gnu}/Linux support. Rich Schaefer and Peter Schauer helped with support of SunOS shared libraries. @@ -2615,7 +2618,7 @@ times slower than normal execution. (But this may still be worth it, to catch errors where you have no clue what part of your program is the culprit.) -On some systems, such as HP-UX, Linux and some other x86-based targets, +On some systems, such as HP-UX, @sc{gnu}/Linux and some other x86-based targets, @value{GDBN} includes support for hardware watchpoints, which do not slow down the running of your program. @@ -3922,7 +3925,10 @@ For example: After such a printout, the @code{list} command with no arguments prints ten lines centered on the point of execution in the frame. -@xref{List, ,Printing source lines}. +You can also edit the program at the point of execution with your favorite +editing program by typing @code{edit}. +@xref{List, ,Printing source lines}, +for details. @table @code @kindex down-silently @@ -4029,6 +4035,7 @@ prefer to use Emacs facilities to view source; see @ref{Emacs, ,Using @menu * List:: Printing source lines +* Edit:: Editing source files * Search:: Searching source files * Source Path:: Specifying source directories * Machine Code:: Source and machine code @@ -4151,6 +4158,69 @@ Specifies the line containing the program address @var{address}. @var{address} may be any expression. @end table +@node Edit +@section Editing source files +@cindex editing source files + +@kindex edit +@kindex e @r{(@code{edit})} +To edit the lines in a source file, use the @code{edit} command. +The editing program of your choice +is invoked with the current line set to +the active line in the program. +Alternatively, there are several ways to specify what part of the file you +want to print if you want to see other parts of the program. + +Here are the forms of the @code{edit} command most commonly used: + +@table @code +@item edit +Edit the current source file at the active line number in the program. + +@item edit @var{number} +Edit the current source file with @var{number} as the active line number. + +@item edit @var{function} +Edit the file containing @var{function} at the beginning of its definition. + +@item edit @var{filename}:@var{number} +Specifies line @var{number} in the source file @var{filename}. + +@item edit @var{filename}:@var{function} +Specifies the line that begins the body of the +function @var{function} in the file @var{filename}. You only need the +file name with a function name to avoid ambiguity when there are +identically named functions in different source files. + +@item edit *@var{address} +Specifies the line containing the program address @var{address}. +@var{address} may be any expression. +@end table + +@subsection Choosing your editor +You can customize @value{GDBN} to use any editor you want +@footnote{ +The only restriction is that your editor (say @code{ex}), recognizes the +following command-line syntax: +@smallexample +ex +@var{number} file +@end smallexample +The optional numeric value +@var{number} designates the active line in +the file.}. By default, it is @value{EDITOR}, but you can change this +by setting the environment variable @code{EDITOR} before using +@value{GDBN}. For example, to configure @value{GDBN} to use the +@code{vi} editor, you could use these commands with the @code{sh} shell: +@smallexample +EDITOR=/usr/bin/vi +export EDITOR +gdb ... +@end smallexample +or in the @code{csh} shell, +@smallexample +setenv EDITOR /usr/bin/vi +gdb ... +@end smallexample + @node Search @section Searching source files @cindex searching @@ -4417,6 +4487,8 @@ Table}. * Vector Unit:: Vector Unit * Memory Region Attributes:: Memory region attributes * Dump/Restore Files:: Copy between memory and a file +* Character Sets:: Debugging programs that use a different + character set than GDB does @end menu @node Expressions @@ -5803,6 +5875,254 @@ the @var{bias} argument is applied. @end table +@node Character Sets +@section Character Sets +@cindex character sets +@cindex charset +@cindex translating between character sets +@cindex host character set +@cindex target character set + +If the program you are debugging uses a different character set to +represent characters and strings than the one @value{GDBN} uses itself, +@value{GDBN} can automatically translate between the character sets for +you. The character set @value{GDBN} uses we call the @dfn{host +character set}; the one the inferior program uses we call the +@dfn{target character set}. + +For example, if you are running @value{GDBN} on a @sc{gnu}/Linux system, which +uses the ISO Latin 1 character set, but you are using @value{GDBN}'s +remote protocol (@pxref{Remote,Remote Debugging}) to debug a program +running on an IBM mainframe, which uses the @sc{ebcdic} character set, +then the host character set is Latin-1, and the target character set is +@sc{ebcdic}. If you give @value{GDBN} the command @code{set +target-charset ebcdic-us}, then @value{GDBN} translates between +@sc{ebcdic} and Latin 1 as you print character or string values, or use +character and string literals in expressions. + +@value{GDBN} has no way to automatically recognize which character set +the inferior program uses; you must tell it, using the @code{set +target-charset} command, described below. + +Here are the commands for controlling @value{GDBN}'s character set +support: + +@table @code +@item set target-charset @var{charset} +@kindex set target-charset +Set the current target character set to @var{charset}. We list the +character set names @value{GDBN} recognizes below, but if you invoke the +@code{set target-charset} command with no argument, @value{GDBN} lists +the character sets it supports. +@end table + +@table @code +@item set host-charset @var{charset} +@kindex set host-charset +Set the current host character set to @var{charset}. + +By default, @value{GDBN} uses a host character set appropriate to the +system it is running on; you can override that default using the +@code{set host-charset} command. + +@value{GDBN} can only use certain character sets as its host character +set. We list the character set names @value{GDBN} recognizes below, and +indicate which can be host character sets, but if you invoke the +@code{set host-charset} command with no argument, @value{GDBN} lists the +character sets it supports, placing an asterisk (@samp{*}) after those +it can use as a host character set. + +@item set charset @var{charset} +@kindex set charset +Set the current host and target character sets to @var{charset}. If you +invoke the @code{set charset} command with no argument, it lists the +character sets it supports. @value{GDBN} can only use certain character +sets as its host character set; it marks those in the list with an +asterisk (@samp{*}). + +@item show charset +@itemx show host-charset +@itemx show target-charset +@kindex show charset +@kindex show host-charset +@kindex show target-charset +Show the current host and target charsets. The @code{show host-charset} +and @code{show target-charset} commands are synonyms for @code{show +charset}. + +@end table + +@value{GDBN} currently includes support for the following character +sets: + +@table @code + +@item ASCII +@cindex ASCII character set +Seven-bit U.S. @sc{ascii}. @value{GDBN} can use this as its host +character set. + +@item ISO-8859-1 +@cindex ISO 8859-1 character set +@cindex ISO Latin 1 character set +The ISO Latin 1 character set. This extends ASCII with accented +characters needed for French, German, and Spanish. @value{GDBN} can use +this as its host character set. + +@item EBCDIC-US +@itemx IBM1047 +@cindex EBCDIC character set +@cindex IBM1047 character set +Variants of the @sc{ebcdic} character set, used on some of IBM's +mainframe operating systems. (@sc{gnu}/Linux on the S/390 uses U.S. @sc{ascii}.) +@value{GDBN} cannot use these as its host character set. + +@end table + +Note that these are all single-byte character sets. More work inside +GDB is needed to support multi-byte or variable-width character +encodings, like the UTF-8 and UCS-2 encodings of Unicode. + +Here is an example of @value{GDBN}'s character set support in action. +Assume that the following source code has been placed in the file +@file{charset-test.c}: + +@smallexample +#include <stdio.h> + +char ascii_hello[] + = @{72, 101, 108, 108, 111, 44, 32, 119, + 111, 114, 108, 100, 33, 10, 0@}; +char ibm1047_hello[] + = @{200, 133, 147, 147, 150, 107, 64, 166, + 150, 153, 147, 132, 90, 37, 0@}; + +main () +@{ + printf ("Hello, world!\n"); +@} +@end smallexample + +In this program, @code{ascii_hello} and @code{ibm1047_hello} are arrays +containing the string @samp{Hello, world!} followed by a newline, +encoded in the @sc{ascii} and @sc{ibm1047} character sets. + +We compile the program, and invoke the debugger on it: + +@smallexample +$ gcc -g charset-test.c -o charset-test +$ gdb -nw charset-test +GNU gdb 2001-12-19-cvs +Copyright 2001 Free Software Foundation, Inc. +@dots{} +(gdb) +@end smallexample + +We can use the @code{show charset} command to see what character sets +@value{GDBN} is currently using to interpret and display characters and +strings: + +@smallexample +(gdb) show charset +The current host and target character set is `iso-8859-1'. +(gdb) +@end smallexample + +For the sake of printing this manual, let's use @sc{ascii} as our +initial character set: +@smallexample +(gdb) set charset ascii +(gdb) show charset +The current host and target character set is `ascii'. +(gdb) +@end smallexample + +Let's assume that @sc{ascii} is indeed the correct character set for our +host system --- in other words, let's assume that if @value{GDBN} prints +characters using the @sc{ascii} character set, our terminal will display +them properly. Since our current target character set is also +@sc{ascii}, the contents of @code{ascii_hello} print legibly: + +@smallexample +(gdb) print ascii_hello +$1 = 0x401698 "Hello, world!\n" +(gdb) print ascii_hello[0] +$2 = 72 'H' +(gdb) +@end smallexample + +@value{GDBN} uses the target character set for character and string +literals you use in expressions: + +@smallexample +(gdb) print '+' +$3 = 43 '+' +(gdb) +@end smallexample + +The @sc{ascii} character set uses the number 43 to encode the @samp{+} +character. + +@value{GDBN} relies on the user to tell it which character set the +target program uses. If we print @code{ibm1047_hello} while our target +character set is still @sc{ascii}, we get jibberish: + +@smallexample +(gdb) print ibm1047_hello +$4 = 0x4016a8 "\310\205\223\223\226k@@\246\226\231\223\204Z%" +(gdb) print ibm1047_hello[0] +$5 = 200 '\310' +(gdb) +@end smallexample + +If we invoke the @code{set target-charset} command without an argument, +@value{GDBN} tells us the character sets it supports: + +@smallexample +(gdb) set target-charset +Valid character sets are: + ascii * + iso-8859-1 * + ebcdic-us + ibm1047 +* - can be used as a host character set +@end smallexample + +We can select @sc{ibm1047} as our target character set, and examine the +program's strings again. Now the @sc{ascii} string is wrong, but +@value{GDBN} translates the contents of @code{ibm1047_hello} from the +target character set, @sc{ibm1047}, to the host character set, +@sc{ascii}, and they display correctly: + +@smallexample +(gdb) set target-charset ibm1047 +(gdb) show charset +The current host character set is `ascii'. +The current target character set is `ibm1047'. +(gdb) print ascii_hello +$6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012" +(gdb) print ascii_hello[0] +$7 = 72 '\110' +(gdb) print ibm1047_hello +$8 = 0x4016a8 "Hello, world!\n" +(gdb) print ibm1047_hello[0] +$9 = 200 'H' +(gdb) +@end smallexample + +As above, @value{GDBN} uses the target character set for character and +string literals you use in expressions: + +@smallexample +(gdb) print '+' +$10 = 78 '+' +(gdb) +@end smallexample + +The IBM1047 character set uses the number 78 to encode the @samp{+} +character. + + @node Macros @chapter C Preprocessor Macros @@ -10870,7 +11190,7 @@ this facility, the command @code{info proc} is available to report on several kinds of information about the process running your program. @code{info proc} works only on SVR4 systems that include the @code{procfs} code. This includes OSF/1 (Digital Unix), Solaris, Irix, -and Unixware, but not HP-UX or Linux, for example. +and Unixware, but not HP-UX or @sc{gnu}/Linux, for example. @table @code @kindex info proc @@ -13161,6 +13481,7 @@ interpreter-exec mi "-data-list-register-names" @menu * TUI Overview:: TUI overview * TUI Keys:: TUI key bindings +* TUI Single Key Mode:: TUI single key mode * TUI Commands:: TUI specific commands * TUI Configuration:: TUI configuration variables @end menu @@ -13201,8 +13522,6 @@ window is always visible. @item source The source window shows the source file of the program. The current line as well as active breakpoints are displayed in this window. -The current program position is shown with the @samp{>} marker and -active breakpoints are shown with @samp{*} markers. @item assembly The assembly window shows the disassembly output of the program. @@ -13214,6 +13533,37 @@ changed are highlighted. @end table +The source and assembly windows show the current program position +by highlighting the current line and marking them with the @samp{>} marker. +Breakpoints are also indicated with two markers. A first one +indicates the breakpoint type: + +@table @code +@item B +Breakpoint which was hit at least once. + +@item b +Breakpoint which was never hit. + +@item H +Hardware breakpoint which was hit at least once. + +@item h +Hardware breakpoint which was never hit. + +@end table + +The second marker indicates whether the breakpoint is enabled or not: + +@table @code +@item + +Breakpoint is enabled. + +@item - +Breakpoint is disabled. + +@end table + The source, assembly and register windows are attached to the thread and the frame position. They are updated when the current thread changes, when the frame changes or when the program counter changes. @@ -13239,6 +13589,35 @@ assembly and registers @end itemize +On top of the command window a status line gives various information +concerning the current process begin debugged. The status line is +updated when the information it shows changes. The following fields +are displayed: + +@table @emph +@item target +Indicates the current gdb target +(@pxref{Targets, ,Specifying a Debugging Target}). + +@item process +Gives information about the current process or thread number. +When no process is being debugged, this field is set to @code{No process}. + +@item function +Gives the current function name for the selected frame. +The name is demangled if demangling is turned on (@pxref{Print Settings}). +When there is no symbol corresponding to the current program counter +the string @code{??} is displayed. + +@item line +Indicates the current line number for the selected frame. +When the current line number is not known the string @code{??} is displayed. + +@item pc +Indicates the current program counter address. + +@end table + @node TUI Keys @section TUI Key Bindings @cindex TUI key bindings @@ -13246,7 +13625,9 @@ assembly and registers The TUI installs several key bindings in the readline keymaps (@pxref{Command Line Editing}). They allow to leave or enter in the TUI mode or they operate -directly on the TUI layout and windows. The following key bindings +directly on the TUI layout and windows. The TUI also provides +a @emph{SingleKey} keymap which binds several keys directly to +@value{GDBN} commands. The following key bindings are installed for both TUI mode and the @value{GDBN} standard mode. @table @kbd @@ -13279,6 +13660,11 @@ previous layout and the new one. Think of it as the Emacs @kbd{C-x 2} binding. +@kindex C-x s +@item C-x s +Use the TUI @emph{SingleKey} keymap that binds single key to gdb commands +(@pxref{TUI Single Key Mode}). + @end table The following key bindings are handled only by the TUI mode: @@ -13319,6 +13705,65 @@ for scrolling. This means they are not available for readline. It is necessary to use other readline key bindings such as @key{C-p}, @key{C-n}, @key{C-b} and @key{C-f}. +@node TUI Single Key Mode +@section TUI Single Key Mode +@cindex TUI single key mode + +The TUI provides a @emph{SingleKey} mode in which it installs a particular +key binding in the readline keymaps to connect single keys to +some gdb commands. + +@table @kbd +@kindex c @r{(SingleKey TUI key)} +@item c +continue + +@kindex d @r{(SingleKey TUI key)} +@item d +down + +@kindex f @r{(SingleKey TUI key)} +@item f +finish + +@kindex n @r{(SingleKey TUI key)} +@item n +next + +@kindex q @r{(SingleKey TUI key)} +@item q +exit the @emph{SingleKey} mode. + +@kindex r @r{(SingleKey TUI key)} +@item r +run + +@kindex s @r{(SingleKey TUI key)} +@item s +step + +@kindex u @r{(SingleKey TUI key)} +@item u +up + +@kindex v @r{(SingleKey TUI key)} +@item v +info locals + +@kindex w @r{(SingleKey TUI key)} +@item w +where + +@end table + +Other keys temporarily switch to the @value{GDBN} command prompt. +The key that was pressed is inserted in the editing buffer so that +it is possible to type most @value{GDBN} commands without interaction +with the TUI @emph{SingleKey} mode. Once the command is entered the TUI +@emph{SingleKey} mode is restored. The only way to permanently leave +this mode is by hitting @key{q} or @samp{@key{C-x} @key{s}}. + + @node TUI Commands @section TUI specific commands @cindex TUI commands @@ -13330,6 +13775,10 @@ is in the standard mode, using these commands will automatically switch in the TUI mode. @table @code +@item info win +@kindex info win +List and give the size of all displayed windows. + @item layout next @kindex layout next Display the next layout. @@ -14270,6 +14719,30 @@ Shared library events. @end table +@kindex maint internal-error +@kindex maint internal-warning +@item maint internal-error +@itemx maint internal-warning +Cause @value{GDBN} to call the internal function @code{internal_error} +or @code{internal_warning} and hence behave as though an internal error +or internal warning has been detected. In addition to reporting the +internal problem, these functions give the user the opportunity to +either quit @value{GDBN} or create a core file of the current +@value{GDBN} session. + +@smallexample +(gdb) @kbd{maint internal-error testing, 1, 2} +@dots{}/maint.c:121: internal-error: testing, 1, 2 +A problem internal to GDB has been detected. Further +debugging may prove unreliable. +Quit this debugging session? (y or n) @kbd{n} +Create a core file? (y or n) @kbd{n} +(gdb) +@end smallexample + +Takes an optional parameter that is used as the text of the error or +warning message. + @kindex maint print registers @kindex maint print raw-registers @kindex maint print cooked-registers @@ -14470,8 +14943,10 @@ of view, nothing actually happened.} @cindex @code{B} packet Set (@var{mode} is @samp{S}) or clear (@var{mode} is @samp{C}) a -breakpoint at @var{addr}. @emph{This has been replaced by the @samp{Z} -and @samp{z} packets.} +breakpoint at @var{addr}. + +This packet has been replaced by the @samp{Z} and @samp{z} packets +(@pxref{insert breakpoint or watchpoint packet}). @item @code{c}@var{addr} --- continue @cindex @code{c} packet @@ -14638,7 +15113,7 @@ Reserved for future use. Read @var{length} bytes of memory starting at address @var{addr}. Neither @value{GDBN} nor the stub assume that sized memory transfers are -assumed using word alligned accesses. FIXME: @emph{A word aligned memory +assumed using word aligned accesses. FIXME: @emph{A word aligned memory transfer mechanism is needed.} Reply: @@ -14646,7 +15121,7 @@ Reply: @item @var{XX@dots{}} @var{XX@dots{}} is mem contents. Can be fewer bytes than requested if able to read only part of the data. Neither @value{GDBN} nor the stub assume -that sized memory transfers are assumed using word alligned +that sized memory transfers are assumed using word aligned accesses. FIXME: @emph{A word aligned memory transfer mechanism is needed.} @item E@var{NN} @@ -14843,32 +15318,128 @@ Reserved for future use. Reserved for future use. -@item @code{z}@var{t}@code{,}@var{addr}@code{,}@var{length} --- remove break or watchpoint @strong{(draft)} +@item @code{z}@var{type}@code{,}@var{addr}@code{,}@var{length} --- remove breakpoint or watchpoint @strong{(draft)} +@itemx @code{Z}@var{type}@code{,}@var{addr}@code{,}@var{length} --- insert breakpoint or watchpoint @strong{(draft)} +@anchor{insert breakpoint or watchpoint packet} @cindex @code{z} packet +@cindex @code{Z} packets -@xref{insert breakpoint or watchpoint packet}. +Insert (@code{Z}) or remove (@code{z}) a @var{type} breakpoint or +watchpoint starting at address @var{address} and covering the next +@var{length} bytes. -@item @code{Z}@var{t}@code{,}@var{addr}@code{,}@var{length} --- insert break or watchpoint @strong{(draft)} -@anchor{insert breakpoint or watchpoint packet} -@cindex @code{Z} packet +Each breakpoint and watchpoint packet @var{type} is documented +separately. + +@emph{Implementation notes: A remote target shall return an empty string +for an unrecognized breakpoint or watchpoint packet @var{type}. A +remote target shall support either both or neither of a given +@code{Z}@var{type}@dots{} and @code{z}@var{type}@dots{} packet pair. To +avoid potential problems with duplicate packets, the operations should +be implemented in an idempotent way.} -@var{t} is type: @samp{0} - software breakpoint, @samp{1} - hardware -breakpoint, @samp{2} --- write watchpoint, @samp{3} - read watchpoint, -@samp{4} - access watchpoint; @var{addr} is address; @var{length} is in -bytes. For a software breakpoint, @var{length} specifies the size of -the instruction to be patched. For hardware breakpoints and watchpoints -@var{length} specifies the memory region to be monitored. To avoid -potential problems with duplicate packets, the operations should be -implemented in an idempotent way. +@item @code{z}@code{0}@code{,}@var{addr}@code{,}@var{length} --- remove memory breakpoint @strong{(draft)} +@item @code{Z}@code{0}@code{,}@var{addr}@code{,}@var{length} --- insert memory breakpoint @strong{(draft)} +@cindex @code{z0} packet +@cindex @code{Z0} packet + +Insert (@code{Z0}) or remove (@code{z0}) a memory breakpoint at address +@code{addr} of size @code{length}. + +A memory breakpoint is implemented by replacing the instruction at +@var{addr} with a software breakpoint or trap instruction. The +@code{length} is used by targets that indicates the size of the +breakpoint (in bytes) that should be inserted (e.g., the @sc{arm} and +@sc{mips} can insert either a 2 or 4 byte breakpoint). + +@emph{Implementation note: It is possible for a target to copy or move +code that contains memory breakpoints (e.g., when implementing +overlays). The behavior of this packet, in the presence of such a +target, is not defined.} Reply: @table @samp +@item OK +success +@item +not supported @item E@var{NN} for an error +@end table + +@item @code{z}@code{1}@code{,}@var{addr}@code{,}@var{length} --- remove hardware breakpoint @strong{(draft)} +@item @code{Z}@code{1}@code{,}@var{addr}@code{,}@var{length} --- insert hardware breakpoint @strong{(draft)} +@cindex @code{z1} packet +@cindex @code{Z1} packet + +Insert (@code{Z1}) or remove (@code{z1}) a hardware breakpoint at +address @code{addr} of size @code{length}. + +A hardware breakpoint is implemented using a mechanism that is not +dependant on being able to modify the target's memory. + +@emph{Implementation note: A hardware breakpoint is not affected by code +movement.} + +Reply: +@table @samp @item OK -for success -@item @samp{} -If not supported. +success +@item +not supported +@item E@var{NN} +for an error +@end table + +@item @code{z}@code{2}@code{,}@var{addr}@code{,}@var{length} --- remove write watchpoint @strong{(draft)} +@item @code{Z}@code{2}@code{,}@var{addr}@code{,}@var{length} --- insert write watchpoint @strong{(draft)} +@cindex @code{z2} packet +@cindex @code{Z2} packet + +Insert (@code{Z2}) or remove (@code{z2}) a write watchpoint. + +Reply: +@table @samp +@item OK +success +@item +not supported +@item E@var{NN} +for an error +@end table + +@item @code{z}@code{3}@code{,}@var{addr}@code{,}@var{length} --- remove read watchpoint @strong{(draft)} +@item @code{Z}@code{3}@code{,}@var{addr}@code{,}@var{length} --- insert read watchpoint @strong{(draft)} +@cindex @code{z3} packet +@cindex @code{Z3} packet + +Insert (@code{Z3}) or remove (@code{z3}) a read watchpoint. + +Reply: +@table @samp +@item OK +success +@item +not supported +@item E@var{NN} +for an error +@end table + +@item @code{z}@code{4}@code{,}@var{addr}@code{,}@var{length} --- remove access watchpoint @strong{(draft)} +@item @code{Z}@code{4}@code{,}@var{addr}@code{,}@var{length} --- insert access watchpoint @strong{(draft)} +@cindex @code{z4} packet +@cindex @code{Z4} packet + +Insert (@code{Z4}) or remove (@code{z4}) an access watchpoint. + +Reply: +@table @samp +@item OK +success +@item +not supported +@item E@var{NN} +for an error @end table @end table diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 548cad5624e..a0cbcbf2876 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -41,7 +41,7 @@ Software Foundation raise funds for GNU development.'' @page @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision: 1.85.2.4 $} % For use in headers, footers too +\xdef\manvers{\$Revision: 1.85.2.5 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Solutions\par \hfill \manvers\par @@ -3175,6 +3175,23 @@ Define this to an expression that returns 1 if the function invocation represented by @var{fi} does not have a stack frame associated with it. Otherwise return 0. +@item frame_align (@var{address}) +@anchor{frame_align} +@findex frame_align +Define this to adjust @var{address} so that it meets the alignment +requirements for the start of a new stack frame. A stack frame's +alignment requirements are typically stronger than a target processors +stack alignment requirements (@pxref{STACK_ALIGN}). + +This function is used to ensure that, when creating a dummy frame, both +the initial stack pointer and (if needed) the address of the return +value are correctly aligned. + +Unlike @code{STACK_ALIGN}, this function always adjusts the address in +the direction of stack growth. + +By default, no frame based stack alignment is performed. + @item FRAME_ARGS_ADDRESS_CORRECT @findex FRAME_ARGS_ADDRESS_CORRECT See @file{stack.c}. @@ -3690,9 +3707,15 @@ declarations) into @value{GDBN} regnums. If not defined, no conversion will be done. @item STACK_ALIGN (@var{addr}) +@anchor{STACK_ALIGN} @findex STACK_ALIGN -Define this to adjust the address to the alignment required for the -processor's stack. +Define this to increase @var{addr} so that it meets the alignment +requirements for the processor's stack. + +Unlike @ref{frame_align}, this function always adjusts @var{addr} +upwards. + +By default, no stack alignment is performed. @item STEP_SKIPS_DELAY (@var{addr}) @findex STEP_SKIPS_DELAY @@ -3862,6 +3885,12 @@ not defined, it will default to @code{0xf}. @item REMOTE_BPT_VECTOR Defaults to @code{1}. + +@item NAME_OF_MALLOC +@findex NAME_OF_MALLOC +A string containing the name of the function to call in order to +allocate some memory in the inferior. The default value is "malloc". + @end ftable @section Adding a New Target diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 0d96e1ff74d..4ef683c13dc 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -803,7 +803,8 @@ static void dwarf2_attach_fields_to_type (struct field_info *, struct type *, struct objfile *); static void dwarf2_add_member_fn (struct field_info *, - struct die_info *, struct objfile *objfile, + struct die_info *, struct type *, + struct objfile *objfile, const struct comp_unit_head *); static void dwarf2_attach_fn_fields_to_type (struct field_info *, @@ -2259,7 +2260,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, static void dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - struct objfile *objfile, + struct type *type, struct objfile *objfile, const struct comp_unit_head *cu_header) { struct attribute *attr; @@ -2327,7 +2328,9 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, struct type *return_type = TYPE_TARGET_TYPE (die->type); int nparams = TYPE_NFIELDS (die->type); - smash_to_method_type (fnp->type, die->type, + /* TYPE is the domain of this method, and DIE->TYPE is the type + of the method itself (TYPE_CODE_METHOD). */ + smash_to_method_type (fnp->type, type, TYPE_TARGET_TYPE (die->type), TYPE_FIELDS (die->type), TYPE_NFIELDS (die->type), @@ -2516,7 +2519,7 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, { /* C++ member function. */ process_die (child_die, objfile, cu_header); - dwarf2_add_member_fn (&fi, child_die, objfile, cu_header); + dwarf2_add_member_fn (&fi, child_die, type, objfile, cu_header); } else if (child_die->tag == DW_TAG_inheritance) { diff --git a/gdb/eval.c b/gdb/eval.c index 33ec9438a04..cbcf862e53a 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -448,7 +448,8 @@ evaluate_subexp_standard (struct type *expect_type, struct value *val = value_of_register (regno, selected_frame); (*pos) += 2; if (val == NULL) - error ("Value of register %s not available.", REGISTER_NAME (regno)); + error ("Value of register %s not available.", + frame_map_regnum_to_name (regno)); else return val; } diff --git a/gdb/event-loop.c b/gdb/event-loop.c index f0984878665..aa0b46f3a5f 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -211,7 +211,6 @@ static void create_file_handler (int fd, int mask, handler_func * proc, gdb_clie static void invoke_async_signal_handler (void); static void handle_file_event (int event_file_desc); static int gdb_wait_for_event (void); -static int gdb_do_one_event (void *data); static int check_async_ready (void); static void async_queue_event (gdb_event * event_ptr, queue_position position); static gdb_event *create_file_event (int fd); @@ -347,7 +346,7 @@ process_event (void) can happen if there are no event sources to wait for). If an error occurs catch_errors() which calls this function returns zero. */ -static int +int gdb_do_one_event (void *data) { /* Any events already waiting in the queue? */ diff --git a/gdb/event-loop.h b/gdb/event-loop.h index 2f2ff003f6a..748f48605d6 100644 --- a/gdb/event-loop.h +++ b/gdb/event-loop.h @@ -85,6 +85,7 @@ queue_position; /* Exported functions from event-loop.c */ extern void start_event_loop (void); +extern int gdb_do_one_event (void *data); extern void delete_file_handler (int fd); extern void add_file_handler (int fd, handler_func * proc, gdb_client_data client_data); extern void mark_async_signal_handler (struct async_signal_handler *async_handler_ptr); diff --git a/gdb/exec.c b/gdb/exec.c index 0228f419465..3a3e888b955 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -507,26 +507,28 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, strcmp (section->name, p->the_bfd_section->name) != 0) continue; /* not the section we need */ if (memaddr >= p->addr) - if (memend <= p->endaddr) - { - /* Entire transfer is within this section. */ - res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, - memaddr - p->addr, len); - return (res != 0) ? len : 0; - } - else if (memaddr >= p->endaddr) - { - /* This section ends before the transfer starts. */ - continue; - } - else - { - /* This section overlaps the transfer. Just do half. */ - len = p->endaddr - memaddr; - res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, - memaddr - p->addr, len); - return (res != 0) ? len : 0; - } + { + if (memend <= p->endaddr) + { + /* Entire transfer is within this section. */ + res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, + memaddr - p->addr, len); + return (res != 0) ? len : 0; + } + else if (memaddr >= p->endaddr) + { + /* This section ends before the transfer starts. */ + continue; + } + else + { + /* This section overlaps the transfer. Just do half. */ + len = p->endaddr - memaddr; + res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, + memaddr - p->addr, len); + return (res != 0) ? len : 0; + } + } else nextsectaddr = min (nextsectaddr, p->addr); } diff --git a/gdb/expprint.c b/gdb/expprint.c index 9f3f1715321..aa8b8762012 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -26,6 +26,7 @@ #include "value.h" #include "language.h" #include "parser-defs.h" +#include "frame.h" /* For frame_map_regnum_to_name. */ #ifdef HAVE_CTYPE_H #include <ctype.h> @@ -119,10 +120,12 @@ print_subexp (register struct expression *exp, register int *pos, return; case OP_REGISTER: - (*pos) += 2; - fprintf_filtered (stream, "$%s", - REGISTER_NAME (longest_to_int (exp->elts[pc + 1].longconst))); - return; + { + int regnum = longest_to_int (exp->elts[pc + 1].longconst); + (*pos) += 2; + fprintf_filtered (stream, "$%s", frame_map_regnum_to_name (regnum)); + return; + } case OP_BOOL: (*pos) += 2; diff --git a/gdb/f-exp.y b/gdb/f-exp.y index a26f019fe96..b9004264eec 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -91,6 +91,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define yylloc f_lloc #define yyreds f_reds /* With YYDEBUG defined */ #define yytoks f_toks /* With YYDEBUG defined */ +#define yyname f_name /* With YYDEBUG defined */ +#define yyrule f_rule /* With YYDEBUG defined */ #define yylhs f_yylhs #define yylen f_yylen #define yydefred f_yydefred diff --git a/gdb/frame.c b/gdb/frame.c index 3b17bf5abf0..1ad3b09f3bd 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -27,6 +27,8 @@ #include "inferior.h" /* for inferior_ptid */ #include "regcache.h" #include "gdb_assert.h" +#include "gdb_string.h" +#include "builtin-regs.h" /* Return a frame uniq ID that can be used to, later re-find the frame. */ @@ -78,43 +80,6 @@ frame_find_by_id (struct frame_id id) return NULL; } -/* FIND_SAVED_REGISTER () - - Return the address in which frame FRAME's value of register REGNUM - has been saved in memory. Or return zero if it has not been saved. - If REGNUM specifies the SP, the value we return is actually - the SP value, not an address where it was saved. */ - -CORE_ADDR -find_saved_register (struct frame_info *frame, int regnum) -{ - register struct frame_info *frame1 = NULL; - register CORE_ADDR addr = 0; - - if (frame == NULL) /* No regs saved if want current frame */ - return 0; - - /* Note that the following loop assumes that registers used in - frame x will be saved only in the frame that x calls and frames - interior to it. */ - while (1) - { - QUIT; - frame1 = get_next_frame (frame); - if (frame1 == 0) - break; - frame = frame1; - FRAME_INIT_SAVED_REGS (frame1); - if (frame1->saved_regs[regnum]) - { - addr = frame1->saved_regs[regnum]; - break; - } - } - - return addr; -} - void frame_register_unwind (struct frame_info *frame, int regnum, int *optimizedp, enum lval_type *lvalp, @@ -159,6 +124,33 @@ frame_register_unwind (struct frame_info *frame, int regnum, optimizedp, lvalp, addrp, realnump, bufferp); } +void +frame_unwind_signed_register (struct frame_info *frame, int regnum, + LONGEST *val) +{ + int optimized; + CORE_ADDR addr; + int realnum; + enum lval_type lval; + void *buf = alloca (MAX_REGISTER_RAW_SIZE); + frame_register_unwind (frame, regnum, &optimized, &lval, &addr, + &realnum, buf); + (*val) = extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); +} + +void +frame_unwind_unsigned_register (struct frame_info *frame, int regnum, + ULONGEST *val) +{ + int optimized; + CORE_ADDR addr; + int realnum; + enum lval_type lval; + void *buf = alloca (MAX_REGISTER_RAW_SIZE); + frame_register_unwind (frame, regnum, &optimized, &lval, &addr, + &realnum, buf); + (*val) = extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); +} void generic_unwind_get_saved_register (char *raw_buffer, @@ -243,3 +235,44 @@ frame_register_read (struct frame_info *frame, int regnum, void *myaddr) return !optim; } + + +/* Map between a frame register number and its name. A frame register + space is a superset of the cooked register space --- it also + includes builtin registers. */ + +int +frame_map_name_to_regnum (const char *name, int len) +{ + int i; + + /* Search register name space. */ + for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) + if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i)) + && strncmp (name, REGISTER_NAME (i), len) == 0) + { + return i; + } + + /* Try builtin registers. */ + i = builtin_reg_map_name_to_regnum (name, len); + if (i >= 0) + { + /* A builtin register doesn't fall into the architecture's + register range. */ + gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS); + return i; + } + + return -1; +} + +const char * +frame_map_regnum_to_name (int regnum) +{ + if (regnum < 0) + return NULL; + if (regnum < NUM_REGS + NUM_PSEUDO_REGS) + return REGISTER_NAME (regnum); + return builtin_reg_map_regnum_to_name (regnum); +} diff --git a/gdb/frame.h b/gdb/frame.h index 20ffff00daf..79bb3d95a6f 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -296,16 +296,17 @@ extern void print_frame_info (struct frame_info *, int, int, int); extern void show_frame_info (struct frame_info *, int, int, int); -extern CORE_ADDR find_saved_register (struct frame_info *, int); - extern struct frame_info *block_innermost_frame (struct block *); extern struct frame_info *find_frame_addr_in_frame_chain (CORE_ADDR); extern CORE_ADDR sigtramp_saved_pc (struct frame_info *); -extern CORE_ADDR generic_read_register_dummy (CORE_ADDR pc, - CORE_ADDR fp, int); +/* NOTE: cagney/2002-09-13: There is no need for this function. + Instead either of frame_unwind_signed_register() or + frame_unwind_unsigned_register() can be used. */ +extern CORE_ADDR deprecated_read_register_dummy (CORE_ADDR pc, + CORE_ADDR fp, int); extern void generic_push_dummy_frame (void); extern void generic_pop_current_frame (void (*)(struct frame_info *)); extern void generic_pop_dummy_frame (void); @@ -344,6 +345,15 @@ extern void frame_register_unwind (struct frame_info *frame, int regnum, CORE_ADDR *addrp, int *realnump, void *valuep); +/* Unwind FRAME so that the value of register REGNUM, in the previous + frame is returned. Simplified versions of frame_register_unwind. */ +/* NOTE: cagney/2002-09-13: Return void as one day these functions may + be changed to return an indication that the read succeeded. */ +extern void frame_unwind_signed_register (struct frame_info *frame, + int regnum, LONGEST *val); +extern void frame_unwind_unsigned_register (struct frame_info *frame, + int regnum, ULONGEST *val); + extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); extern void get_saved_register (char *raw_buffer, int *optimized, @@ -356,4 +366,11 @@ extern void get_saved_register (char *raw_buffer, int *optimized, extern int frame_register_read (struct frame_info *frame, int regnum, void *buf); +/* Map between a frame register number and its name. A frame register + space is a superset of the cooked register space --- it also + includes builtin registers. */ + +extern int frame_map_name_to_regnum (const char *name, int strlen); +extern const char *frame_map_regnum_to_name (int regnum); + #endif /* !defined (FRAME_H) */ diff --git a/gdb/gdb.1 b/gdb/gdb.1 index 55272c689d5..dbe3178f7d1 100644 --- a/gdb/gdb.1 +++ b/gdb/gdb.1 @@ -1,7 +1,7 @@ .\" Copyright 1991, 1999 Free Software Foundation, Inc. .\" See section COPYING for conditions for redistribution .\" $Id: gdb.1,v 1.4 1999/01/05 00:50:50 jsm Exp $ -.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools" +.TH gdb 1 "22may2002" "GNU Tools" "GNU Tools" .SH NAME gdb \- The GNU Debugger .SH SYNOPSIS @@ -150,6 +150,12 @@ Execute next program line (after stopping); step \c \& any function calls in the line. .TP +.B edit \fR[\|\fIfile\fB:\fR\|]\fIfunction +look at the program line where it is presently stopped. +.TP +.B list \fR[\|\fIfile\fB:\fR\|]\fIfunction +type the text of the program in the vicinity of where it is presently stopped. +.TP .B step Execute next program line (after stopping); step \c .I into\c diff --git a/gdb/gdb.c b/gdb/gdb.c new file mode 100644 index 00000000000..c0bc4875b32 --- /dev/null +++ b/gdb/gdb.c @@ -0,0 +1,34 @@ +/* Main function for CLI gdb. + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "main.h" +#include "gdb_string.h" + +int +main (int argc, char **argv) +{ + struct captured_main_args args; + memset (&args, 0, sizeof args); + args.argc = argc; + args.argv = argv; + args.use_windows = 0; + return gdb_main (&args); +} diff --git a/gdb/gdb_mbuild.sh b/gdb/gdb_mbuild.sh new file mode 100755 index 00000000000..ae40b02c69a --- /dev/null +++ b/gdb/gdb_mbuild.sh @@ -0,0 +1,153 @@ +#!/bin/sh + +# Multi-build script for testing compilation of all maintained configs of GDB. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Contributed by Richard Earnshaw (rearnsha@arm.com) + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +usage() { + echo "Usage: gdb_mbuild.sh <srcdir> <builddir> [<parjobs>]" + echo " Environment variables examined (with default if not defined):" + echo " AWK (awk) -- must be GNU awk" + echo " MAKE (make)" + echo + echo " Note: Everything in <builddir>/gdb-allcross will be blown away." + exit 1; +} + +if [ $# -ne 2 -a $# -ne 3 ] ; then + usage +fi + +### COMMAND LINE PARAMETERS + +# Where the sources live +srcdir=$1 + +# Where the builds occur +buildbase=$2 + +# Number of parallel make jobs (you probably want about 2 jobs per cpu for +# maximum throughput) +if [ $# -eq 3 ]; then + par=$3 +else + par="1" +fi + +### ENVIRONMENT PARAMETERS +# Must be GNU awk +awk=${AWK:-awk} + +# Version of make to use +make=${MAKE:-make} + + +# Where builds will live +builddir=${buildbase}/gdb-allcross + +# Where logs will go. NB. Must not be a sub-dir of builddir or you will loose +# them. +logdir=${buildbase}/gdb-logdir + +# Where to look for the list of targets to test +maintainers=${srcdir}/gdb/MAINTAINERS + +# Get the list of targets and the build options +alltarg=`${awk} < "${maintainers}" ' + $2 ~ /--target=.*/ { + targets = gensub (/^.*--target=/, "", 1, $2) + warnings = gensub (/[)]*$/, "", 1, $3) + split (targets, targ, /,/) + for (i in targ) { + print targ[i], warnings + } + }'` + +# Back up the log files +cd ${logdir} + +if [ -f build.out ] +then + mv build.out build.old +fi +if [ -f config.out ] +then + mv config.out config.old +fi +if [ -f fail.sum ] +then + mv fail.sum fail.old +fi + +if [ ! -d ${builddir} ] +then + echo ${builddir} does not exist + exit 1 +fi + +cd ${builddir} +rm -rf * + +MAKE=${make} +export MAKE + +jobs=1 +# For each target, configure and build it. +while read targ opts +do + if [ ${opts} != "broken" ] + then + trap 'echo cleaning up ...; rm -rf ${builddir}/*; exit 1' 1 2 15 + echo ${targ} + mkdir ${targ} + cd ${targ} + ${srcdir}/configure --target=$targ \ + --enable-gdb-build-warnings=$opts \ + >> ${logdir}/config.tout.$targ 2>&1 & + cd .. + jobs=`expr ${jobs} + 1` + if [ ${jobs} -gt ${par} ] + then + wait + jobs=1 + fi + fi +done << EOF +$alltarg +EOF + +wait + +cat ${logdir}/config.tout.* > ${logdir}/config.out +rm -f ${logdir}/config.tout.* + +for targ in * +do + cd $targ + if ${make} -j ${par} all-gdb >> ${logdir}/build.out 2>&1 + then + true + else + echo ">>>>>>>>>>>>>" >> ${logdir}/fail.sum + echo "$targ (${opts})" >> ${logdir}/fail.sum + tail -20 ${logdir}/build.out >> ${logdir}/fail.sum + echo >> ${logdir}/fail.sum + echo $targ build failed + fi + rm -rf * + cd .. +done diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e930642f15f..bc27aaeef6a 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -244,6 +244,7 @@ struct gdbarch gdbarch_saved_pc_after_call_ftype *saved_pc_after_call; gdbarch_frame_num_args_ftype *frame_num_args; gdbarch_stack_align_ftype *stack_align; + gdbarch_frame_align_ftype *frame_align; int extra_stack_alignment_needed; gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr; gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos; @@ -260,11 +261,14 @@ struct gdbarch gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline; gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp; + gdbarch_sigtramp_start_ftype *sigtramp_start; + gdbarch_sigtramp_end_ftype *sigtramp_end; gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p; gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments; gdbarch_dwarf2_build_frame_info_ftype *dwarf2_build_frame_info; gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special; gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special; + const char * name_of_malloc; }; @@ -414,11 +418,15 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, + 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, 0, 0, + "malloc", /* startup_gdbarch() */ }; @@ -549,6 +557,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->construct_inferior_arguments = construct_inferior_arguments; current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special; current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special; + current_gdbarch->name_of_malloc = "malloc"; /* gdbarch_alloc() */ return current_gdbarch; @@ -768,6 +777,7 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->frame_num_args == 0)) fprintf_unfiltered (log, "\n\tframe_num_args"); /* Skip verify of stack_align, has predicate */ + /* Skip verify of frame_align, has predicate */ /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ /* Skip verify of reg_struct_has_addr, has predicate */ /* Skip verify of save_dummy_frame_tos, has predicate */ @@ -786,11 +796,14 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */ /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ /* Skip verify of pc_in_sigtramp, invalid_p == 0 */ + /* Skip verify of sigtramp_start, has predicate */ + /* Skip verify of sigtramp_end, has predicate */ /* Skip verify of in_function_epilogue_p, invalid_p == 0 */ /* Skip verify of construct_inferior_arguments, invalid_p == 0 */ /* Skip verify of dwarf2_build_frame_info, has predicate */ /* Skip verify of elf_make_msymbol_special, invalid_p == 0 */ /* Skip verify of coff_make_msymbol_special, invalid_p == 0 */ + /* Skip verify of name_of_malloc, invalid_p == 0 */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -817,6 +830,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) GDB_MULTI_ARCH); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, + "gdbarch_dump: frame_align = 0x%08lx\n", + (long) current_gdbarch->frame_align); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, "gdbarch_dump: in_function_epilogue_p = 0x%08lx\n", (long) current_gdbarch->in_function_epilogue_p); if (GDB_MULTI_ARCH) @@ -1479,6 +1496,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->memory_remove_breakpoint /*MEMORY_REMOVE_BREAKPOINT ()*/); #endif +#ifdef NAME_OF_MALLOC + fprintf_unfiltered (file, + "gdbarch_dump: NAME_OF_MALLOC # %s\n", + XSTRING (NAME_OF_MALLOC)); + fprintf_unfiltered (file, + "gdbarch_dump: NAME_OF_MALLOC = %ld\n", + (long) NAME_OF_MALLOC); +#endif #ifdef NPC_REGNUM fprintf_unfiltered (file, "gdbarch_dump: NPC_REGNUM # %s\n", @@ -1862,6 +1887,28 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->sdb_reg_to_regnum /*SDB_REG_TO_REGNUM ()*/); #endif +#ifdef SIGTRAMP_END + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SIGTRAMP_END(pc)", + XSTRING (SIGTRAMP_END (pc))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: SIGTRAMP_END = 0x%08lx\n", + (long) current_gdbarch->sigtramp_end + /*SIGTRAMP_END ()*/); +#endif +#ifdef SIGTRAMP_START + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SIGTRAMP_START(pc)", + XSTRING (SIGTRAMP_START (pc))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: SIGTRAMP_START = 0x%08lx\n", + (long) current_gdbarch->sigtramp_start + /*SIGTRAMP_START ()*/); +#endif #ifdef SIZEOF_CALL_DUMMY_WORDS fprintf_unfiltered (file, "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS # %s\n", @@ -4470,6 +4517,32 @@ set_gdbarch_stack_align (struct gdbarch *gdbarch, } int +gdbarch_frame_align_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->frame_align != 0; +} + +CORE_ADDR +gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->frame_align == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_frame_align invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_align called\n"); + return gdbarch->frame_align (gdbarch, address); +} + +void +set_gdbarch_frame_align (struct gdbarch *gdbarch, + gdbarch_frame_align_ftype frame_align) +{ + gdbarch->frame_align = frame_align; +} + +int gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -4781,6 +4854,58 @@ set_gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, } int +gdbarch_sigtramp_start_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->sigtramp_start != 0; +} + +CORE_ADDR +gdbarch_sigtramp_start (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->sigtramp_start == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_sigtramp_start invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_sigtramp_start called\n"); + return gdbarch->sigtramp_start (pc); +} + +void +set_gdbarch_sigtramp_start (struct gdbarch *gdbarch, + gdbarch_sigtramp_start_ftype sigtramp_start) +{ + gdbarch->sigtramp_start = sigtramp_start; +} + +int +gdbarch_sigtramp_end_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->sigtramp_end != 0; +} + +CORE_ADDR +gdbarch_sigtramp_end (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->sigtramp_end == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_sigtramp_end invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_sigtramp_end called\n"); + return gdbarch->sigtramp_end (pc); +} + +void +set_gdbarch_sigtramp_end (struct gdbarch *gdbarch, + gdbarch_sigtramp_end_ftype sigtramp_end) +{ + gdbarch->sigtramp_end = sigtramp_end; +} + +int gdbarch_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR addr) { gdb_assert (gdbarch != NULL); @@ -4882,6 +5007,23 @@ set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdbarch->coff_make_msymbol_special = coff_make_msymbol_special; } +const char * +gdbarch_name_of_malloc (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of name_of_malloc, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_name_of_malloc called\n"); + return gdbarch->name_of_malloc; +} + +void +set_gdbarch_name_of_malloc (struct gdbarch *gdbarch, + const char * name_of_malloc) +{ + gdbarch->name_of_malloc = name_of_malloc; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index b76bf4abfa0..2f26cba9a13 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2014,6 +2014,12 @@ extern void set_gdbarch_stack_align (struct gdbarch *gdbarch, gdbarch_stack_alig #endif #endif +extern int gdbarch_frame_align_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADDR address); +extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address); +extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align); + /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (EXTRA_STACK_ALIGNMENT_NEEDED) #define EXTRA_STACK_ALIGNMENT_NEEDED (1) @@ -2385,6 +2391,80 @@ extern void set_gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, gdbarch_pc_in_s #endif #endif +#if defined (SIGTRAMP_START) +/* Legacy for systems yet to multi-arch SIGTRAMP_START */ +#if !defined (SIGTRAMP_START_P) +#define SIGTRAMP_START_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (SIGTRAMP_START_P) +#define SIGTRAMP_START_P() (0) +#endif + +extern int gdbarch_sigtramp_start_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIGTRAMP_START_P) +#error "Non multi-arch definition of SIGTRAMP_START" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIGTRAMP_START_P) +#define SIGTRAMP_START_P() (gdbarch_sigtramp_start_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (SIGTRAMP_START) +#define SIGTRAMP_START(pc) (internal_error (__FILE__, __LINE__, "SIGTRAMP_START"), 0) +#endif + +typedef CORE_ADDR (gdbarch_sigtramp_start_ftype) (CORE_ADDR pc); +extern CORE_ADDR gdbarch_sigtramp_start (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void set_gdbarch_sigtramp_start (struct gdbarch *gdbarch, gdbarch_sigtramp_start_ftype *sigtramp_start); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIGTRAMP_START) +#error "Non multi-arch definition of SIGTRAMP_START" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIGTRAMP_START) +#define SIGTRAMP_START(pc) (gdbarch_sigtramp_start (current_gdbarch, pc)) +#endif +#endif + +#if defined (SIGTRAMP_END) +/* Legacy for systems yet to multi-arch SIGTRAMP_END */ +#if !defined (SIGTRAMP_END_P) +#define SIGTRAMP_END_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (SIGTRAMP_END_P) +#define SIGTRAMP_END_P() (0) +#endif + +extern int gdbarch_sigtramp_end_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIGTRAMP_END_P) +#error "Non multi-arch definition of SIGTRAMP_END" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIGTRAMP_END_P) +#define SIGTRAMP_END_P() (gdbarch_sigtramp_end_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (SIGTRAMP_END) +#define SIGTRAMP_END(pc) (internal_error (__FILE__, __LINE__, "SIGTRAMP_END"), 0) +#endif + +typedef CORE_ADDR (gdbarch_sigtramp_end_ftype) (CORE_ADDR pc); +extern CORE_ADDR gdbarch_sigtramp_end (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void set_gdbarch_sigtramp_end (struct gdbarch *gdbarch, gdbarch_sigtramp_end_ftype *sigtramp_end); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIGTRAMP_END) +#error "Non multi-arch definition of SIGTRAMP_END" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIGTRAMP_END) +#define SIGTRAMP_END(pc) (gdbarch_sigtramp_end (current_gdbarch, pc)) +#endif +#endif + /* A target might have problems with watchpoints as soon as the stack frame of the current function has been destroyed. This mostly happens as the first action in a funtion's epilogue. in_function_epilogue_p() @@ -2483,6 +2563,22 @@ extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdba #endif #endif +/* Default (value) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (NAME_OF_MALLOC) +#define NAME_OF_MALLOC ("malloc") +#endif + +extern const char * gdbarch_name_of_malloc (struct gdbarch *gdbarch); +extern void set_gdbarch_name_of_malloc (struct gdbarch *gdbarch, const char * name_of_malloc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (NAME_OF_MALLOC) +#error "Non multi-arch definition of NAME_OF_MALLOC" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NAME_OF_MALLOC) +#define NAME_OF_MALLOC (gdbarch_name_of_malloc (current_gdbarch)) +#endif +#endif + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 1ce71afa7c1..0ee74df6f44 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -572,6 +572,7 @@ f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_pc_after_call:struct frame_info *frame:f f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0 # F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0 +M:::CORE_ADDR:frame_align:CORE_ADDR address:address v:2:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0::: F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0 F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0 @@ -636,6 +637,8 @@ f:2:IN_SOLIB_RETURN_TRAMPOLINE:int:in_solib_return_trampoline:CORE_ADDR pc, char # Some code also depends on SIGTRAMP_START and SIGTRAMP_END but other # does not. f:2:PC_IN_SIGTRAMP:int:pc_in_sigtramp:CORE_ADDR pc, char *name:pc, name:::legacy_pc_in_sigtramp::0 +F:2:SIGTRAMP_START:CORE_ADDR:sigtramp_start:CORE_ADDR pc:pc +F::SIGTRAMP_END:CORE_ADDR:sigtramp_end:CORE_ADDR pc:pc # A target might have problems with watchpoints as soon as the stack # frame of the current function has been destroyed. This mostly happens # as the first action in a funtion's epilogue. in_function_epilogue_p() @@ -658,6 +661,7 @@ m::CONSTRUCT_INFERIOR_ARGUMENTS:char *:construct_inferior_arguments:int argc, ch F:2:DWARF2_BUILD_FRAME_INFO:void:dwarf2_build_frame_info:struct objfile *objfile:objfile:::0 f:2:ELF_MAKE_MSYMBOL_SPECIAL:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym:::default_elf_make_msymbol_special::0 f:2:COFF_MAKE_MSYMBOL_SPECIAL:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym:::default_coff_make_msymbol_special::0 +v::NAME_OF_MALLOC:const char *:name_of_malloc::::"malloc":"malloc"::0 EOF } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 6ebbf2db1b6..40223943b7c 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1672,7 +1672,7 @@ safe_parse_type (char *p, int length) which info used to be in the stab's but was removed to hack back the space required for them. */ -void +static void check_stub_method (struct type *type, int method_id, int signature_id) { struct fn_field *f; @@ -1781,6 +1781,49 @@ check_stub_method (struct type *type, int method_id, int signature_id) xfree (demangled_name); } +/* This is the external interface to check_stub_method, above. This function + unstubs all of the signatures for TYPE's METHOD_ID method name. After + calling this function TYPE_FN_FIELD_STUB will be cleared for each signature + and TYPE_FN_FIELDLIST_NAME will be correct. + + This function unfortunately can not die until stabs do. */ + +void +check_stub_method_group (struct type *type, int method_id) +{ + int len = TYPE_FN_FIELDLIST_LENGTH (type, method_id); + struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id); + int j, found_stub = 0; + + for (j = 0; j < len; j++) + if (TYPE_FN_FIELD_STUB (f, j)) + { + found_stub = 1; + check_stub_method (type, method_id, j); + } + + /* GNU v3 methods with incorrect names were corrected when we read in + type information, because it was cheaper to do it then. The only GNU v2 + methods with incorrect method names are operators and destructors; + destructors were also corrected when we read in type information. + + Therefore the only thing we need to handle here are v2 operator + names. */ + if (found_stub && strncmp (TYPE_FN_FIELD_PHYSNAME (f, 0), "_Z", 2) != 0) + { + int ret; + char dem_opname[256]; + + ret = cplus_demangle_opname (TYPE_FN_FIELDLIST_NAME (type, method_id), + dem_opname, DMGL_ANSI); + if (!ret) + ret = cplus_demangle_opname (TYPE_FN_FIELDLIST_NAME (type, method_id), + dem_opname, 0); + if (ret) + TYPE_FN_FIELDLIST_NAME (type, method_id) = xstrdup (dem_opname); + } +} + const struct cplus_struct_type cplus_struct_default; void @@ -3435,7 +3478,6 @@ build_gdbtypes (void) "__bfd_vma", (struct objfile *) NULL); } - extern void _initialize_gdbtypes (void); void _initialize_gdbtypes (void) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 5c41398aabb..a0b754aa928 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1124,7 +1124,7 @@ extern struct type *check_typedef (struct type *); #define CHECK_TYPEDEF(TYPE) (TYPE) = check_typedef (TYPE) -extern void check_stub_method (struct type *, int, int); +extern void check_stub_method_group (struct type *, int); extern struct type *lookup_primitive_typename (char *); diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 59aad5dd7f3..e332dba3f3d 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1759,31 +1759,31 @@ ill_rpc (char *fun) error_t do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t count) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("do_mach_notify_no_senders"); } error_t do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("do_mach_notify_port_deleted"); } error_t do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("do_mach_notify_msg_accepted"); } error_t do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t name) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("do_mach_notify_port_destroyed"); } error_t do_mach_notify_send_once (mach_port_t notify) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("do_mach_notify_send_once"); } @@ -1845,13 +1845,13 @@ error_t S_proc_setmsgport_reply (mach_port_t reply, error_t err, mach_port_t old_msg_port) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("S_proc_setmsgport_reply"); } error_t S_proc_getmsgport_reply (mach_port_t reply, error_t err, mach_port_t msg_port) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("S_proc_getmsgport_reply"); } @@ -1890,7 +1890,7 @@ S_msg_sig_post_untraced_reply (mach_port_t reply, error_t err) error_t S_msg_sig_post_reply (mach_port_t reply, error_t err) { - return ill_rpc (__FUNCTION__); + return ill_rpc ("S_msg_sig_post_reply"); } diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h index cc430835f2c..bcdfe6e7779 100644 --- a/gdb/gnu-nat.h +++ b/gdb/gnu-nat.h @@ -96,6 +96,6 @@ extern int gnu_debug_flag; #define debug(msg, args...) \ do { if (gnu_debug_flag) \ - fprintf_unfiltered (gdb_stdlog, "%s: " msg "\r\n", __FUNCTION__ , ##args); } while (0) + fprintf_unfiltered (gdb_stdlog, "%s:%d: " msg "\r\n", __FILE__ , __LINE__ , ##args); } while (0) #endif /* __GNU_NAT_H__ */ diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index f992d4bd6b9..affd8dd58ec 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -26,20 +26,50 @@ */ #include "defs.h" -#include "frame.h" -#include "symtab.h" -#include "dis-asm.h" -#include "gdbcmd.h" -#include "gdbtypes.h" -#include "gdbcore.h" -#include "gdb_string.h" #include "value.h" +#include "inferior.h" +#include "symfile.h" +#include "arch-utils.h" #include "regcache.h" +#include "gdbcore.h" +#include "objfiles.h" +#include "gdbcmd.h" -extern int h8300hmode, h8300smode; +/* Extra info which is saved in each frame_info. */ +struct frame_extra_info +{ + CORE_ADDR from_pc; + CORE_ADDR args_pointer; + CORE_ADDR locals_pointer; +}; -#undef NUM_REGS -#define NUM_REGS (h8300smode?12:11) +#define E_NUM_REGS (h8300smode ? 14 : 13) + +enum +{ + h8300_reg_size = 2, + h8300h_reg_size = 4, + h8300_max_reg_size = 4, +}; +#define BINWORD (h8300hmode ? h8300h_reg_size : h8300_reg_size) + +enum gdb_regnum +{ + E_R0_REGNUM, E_ER0_REGNUM = E_R0_REGNUM, E_ARG0_REGNUM = E_R0_REGNUM, + E_R1_REGNUM, E_ER1_REGNUM = E_R1_REGNUM, + E_R2_REGNUM, E_ER2_REGNUM = E_R2_REGNUM, E_ARGLAST_REGNUM = E_R2_REGNUM, + E_R3_REGNUM, E_ER3_REGNUM = E_R3_REGNUM, + E_R4_REGNUM, E_ER4_REGNUM = E_R4_REGNUM, + E_R5_REGNUM, E_ER5_REGNUM = E_R5_REGNUM, + E_R6_REGNUM, E_ER6_REGNUM = E_R6_REGNUM, E_FP_REGNUM = E_R6_REGNUM, + E_SP_REGNUM, + E_CCR_REGNUM, + E_PC_REGNUM, + E_CYCLES_REGNUM, + E_TICK_REGNUM, E_EXR_REGNUM = E_TICK_REGNUM, + E_INST_REGNUM, E_TICKS_REGNUM = E_INST_REGNUM, + E_INSTS_REGNUM +}; #define UNSIGNED_SHORT(X) ((X) & 0xffff) @@ -53,24 +83,95 @@ extern int h8300hmode, h8300smode; #define IS_MOVK_R5(x) (x==0x7905) #define IS_SUB_R5SP(x) (x==0x1957) -/* The register names change depending on whether the h8300h processor - type is selected. */ +/* If the instruction at PC is an argument register spill, return its + length. Otherwise, return zero. -static char *original_register_names[] = REGISTER_NAMES; + An argument register spill is an instruction that moves an argument + from the register in which it was passed to the stack slot in which + it really lives. It is a byte, word, or longword move from an + argument register to a negative offset from the frame pointer. */ -static char *h8300h_register_names[] = { - "er0", "er1", "er2", "er3", "er4", "er5", "er6", - "sp", "ccr", "pc", "cycles", "exr", "tick", "inst" -}; +static int +h8300_is_argument_spill (CORE_ADDR pc) +{ + int w = read_memory_unsigned_integer (pc, 2); + + if ((w & 0xfff0) == 0x6ee0 /* mov.b Rs,@(d:16,er6) */ + && 8 <= (w & 0xf) && (w & 0xf) <= 10) /* Rs is R0L, R1L, or R2L */ + { + int w2 = read_memory_integer (pc + 2, 2); + + /* ... and d:16 is negative. */ + if (w2 < 0) + return 4; + } + else if (w == 0x7860) + { + int w2 = read_memory_integer (pc + 2, 2); -char **h8300_register_names = original_register_names; + if ((w2 & 0xfff0) == 0x6aa0) /* mov.b Rs, @(d:24,er6) */ + { + LONGEST disp = read_memory_integer (pc + 4, 4); -/* Local function declarations. */ + /* ... and d:24 is negative. */ + if (disp < 0 && disp > 0xffffff) + return 8; + } + } + else if ((w & 0xfff0) == 0x6fe0 /* mov.w Rs,@(d:16,er6) */ + && (w & 0xf) <= 2) /* Rs is R0, R1, or R2 */ + { + int w2 = read_memory_integer (pc + 2, 2); -static CORE_ADDR examine_prologue (); -static void set_machine_hook (char *filename); + /* ... and d:16 is negative. */ + if (w2 < 0) + return 4; + } + else if (w == 0x78e0) + { + int w2 = read_memory_integer (pc + 2, 2); -CORE_ADDR + if ((w2 & 0xfff0) == 0x6ba0) /* mov.b Rs, @(d:24,er6) */ + { + LONGEST disp = read_memory_integer (pc + 4, 4); + + /* ... and d:24 is negative. */ + if (disp < 0 && disp > 0xffffff) + return 8; + } + } + else if (w == 0x0100) + { + int w2 = read_memory_integer (pc + 2, 2); + + if ((w2 & 0xfff0) == 0x6fe0 /* mov.l Rs,@(d:16,er6) */ + && (w2 & 0xf) <= 2) /* Rs is ER0, ER1, or ER2 */ + { + int w3 = read_memory_integer (pc + 4, 2); + + /* ... and d:16 is negative. */ + if (w3 < 0) + return 6; + } + else if (w2 == 0x78e0) + { + int w3 = read_memory_integer (pc + 4, 2); + + if ((w3 & 0xfff0) == 0x6ba0) /* mov.l Rs, @(d:24,er6) */ + { + LONGEST disp = read_memory_integer (pc + 6, 4); + + /* ... and d:24 is negative. */ + if (disp < 0 && disp > 0xffffff) + return 10; + } + } + } + + return 0; +} + +static CORE_ADDR h8300_skip_prologue (CORE_ADDR start_pc) { short int w; @@ -137,10 +238,21 @@ h8300_skip_prologue (CORE_ADDR start_pc) if (IS_SUBL_SP (w)) start_pc += 6 + adjust; + /* Check for spilling an argument register to the stack frame. + This could also be an initializing store from non-prologue code, + but I don't think there's any harm in skipping that. */ + for (;;) + { + int spill_size = h8300_is_argument_spill (start_pc); + if (spill_size == 0) + break; + start_pc += spill_size; + } + return start_pc; } -int +static int gdb_print_insn_h8300 (bfd_vma memaddr, disassemble_info * info) { if (h8300smode) @@ -151,82 +263,13 @@ gdb_print_insn_h8300 (bfd_vma memaddr, disassemble_info * info) return print_insn_h8300 (memaddr, info); } -/* Given a GDB frame, determine the address of the calling function's frame. - This will be used to create a new GDB frame struct, and then - INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. - - For us, the frame address is its stack pointer value, so we look up - the function prologue to determine the caller's sp value, and return it. */ - -CORE_ADDR -h8300_frame_chain (struct frame_info *thisframe) -{ - if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame)) - { /* initialize the from_pc now */ - thisframe->from_pc = generic_read_register_dummy (thisframe->pc, - thisframe->frame, - PC_REGNUM); - return thisframe->frame; - } - h8300_frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0); - return thisframe->fsr->regs[SP_REGNUM]; -} - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. - - We cache the result of doing this in the frame_obstack, since it is - fairly expensive. */ - -void -h8300_frame_find_saved_regs (struct frame_info *fi, - struct frame_saved_regs *fsr) -{ - register struct frame_saved_regs *cache_fsr; - CORE_ADDR ip; - struct symtab_and_line sal; - CORE_ADDR limit; - - if (!fi->fsr) - { - cache_fsr = (struct frame_saved_regs *) - frame_obstack_alloc (sizeof (struct frame_saved_regs)); - memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); - - fi->fsr = cache_fsr; - - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - { /* no more to do. */ - if (fsr) - *fsr = *fi->fsr; - return; - } - /* Find the start and end of the function prologue. If the PC - is in the function prologue, we only consider the part that - has executed already. */ - - ip = get_pc_function_start (fi->pc); - sal = find_pc_line (ip, 0); - limit = (sal.end && sal.end < fi->pc) ? sal.end : fi->pc; - - /* This will fill in fields in *fi as well as in cache_fsr. */ - examine_prologue (ip, limit, fi->frame, cache_fsr, fi); - } - - if (fsr) - *fsr = *fi->fsr; -} - /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or is not the address of a valid instruction, the address of the next instruction beyond ADDR otherwise. *PWORD1 receives the first word of the instruction. */ -CORE_ADDR -NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, INSN_WORD * pword1) +static CORE_ADDR +h8300_next_prologue_insn (CORE_ADDR addr, CORE_ADDR lim, unsigned short* pword1) { char buf[2]; if (addr < lim + 8) @@ -248,18 +291,29 @@ NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, INSN_WORD * pword1) `fi' is a struct frame_info pointer; we fill in various fields in it to reflect the offsets of the arg pointer and the locals pointer. */ +/* Any function with a frame looks like this + SECOND ARG + FIRST ARG + RET PC + SAVED R2 + SAVED R3 + SAVED FP <-FP POINTS HERE + LOCALS0 + LOCALS1 <-SP POINTS HERE + */ + static CORE_ADDR -examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, - CORE_ADDR after_prolog_fp, struct frame_saved_regs *fsr, - struct frame_info *fi) +h8300_examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, + CORE_ADDR after_prolog_fp, CORE_ADDR *fsr, + struct frame_info *fi) { register CORE_ADDR next_ip; int r; int have_fp = 0; - INSN_WORD insn_word; + unsigned short insn_word; /* Number of things pushed onto stack, starts at 2/4, 'cause the PC is already there */ - unsigned int reg_save_depth = h8300hmode ? 4 : 2; + unsigned int reg_save_depth = BINWORD; unsigned int auto_depth = 0; /* Number of bytes of autos */ @@ -270,18 +324,18 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, memset (in_frame, 1, 11); for (r = 0; r < 8; r++) { - fsr->regs[r] = 0; + fsr[r] = 0; } if (after_prolog_fp == 0) { - after_prolog_fp = read_register (SP_REGNUM); + after_prolog_fp = read_register (E_SP_REGNUM); } /* If the PC isn't valid, quit now. */ if (ip == 0 || ip & (h8300hmode ? ~0xffffff : ~0xffff)) return 0; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); if (insn_word == 0x0100) { @@ -290,13 +344,13 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, } /* Skip over any fp push instructions */ - fsr->regs[6] = after_prolog_fp; + fsr[E_FP_REGNUM] = after_prolog_fp; while (next_ip && IS_PUSH_FP (insn_word)) { ip = next_ip + adjust; in_frame[insn_word & 0x7] = reg_save_depth; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); reg_save_depth += 2 + adjust; } @@ -304,7 +358,7 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, if (next_ip && IS_MOV_SP_FP (insn_word)) { ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); have_fp = 1; } @@ -317,7 +371,7 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, { auto_depth += IS_SUB2_SP (insn_word) ? 2 : 4; ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); } } else @@ -325,10 +379,10 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, if (next_ip && IS_MOVK_R5 (insn_word)) { ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); auto_depth += insn_word; - next_ip = NEXT_PROLOGUE_INSN (next_ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (next_ip, limit, &insn_word); auto_depth += insn_word; } if (next_ip && IS_SUBL_SP (insn_word)) @@ -337,7 +391,7 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, auto_depth += read_memory_unsigned_integer (ip, 4); ip += 4; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); } } @@ -352,16 +406,16 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, if (insn_word == 0x0100) { ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); adjust = 2; } if (IS_PUSH (insn_word)) { - ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); - fsr->regs[r] = after_prolog_fp + auto_depth; auto_depth += 2 + adjust; + fsr[insn_word & 0x7] = after_prolog_fp - auto_depth; + ip = next_ip; + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); continue; } @@ -372,50 +426,79 @@ examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, int start, i; ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word); + next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); start = insn_word & 0x7; - for (i = start; i <= start + count; i++) + for (i = start; i < start + count; i++) { - fsr->regs[i] = after_prolog_fp + auto_depth; auto_depth += 4; + fsr[i] = after_prolog_fp - auto_depth; } } break; } /* The args are always reffed based from the stack pointer */ - fi->args_pointer = after_prolog_fp; + fi->extra_info->args_pointer = after_prolog_fp; /* Locals are always reffed based from the fp */ - fi->locals_pointer = after_prolog_fp; + fi->extra_info->locals_pointer = after_prolog_fp; /* The PC is at a known place */ - fi->from_pc = + fi->extra_info->from_pc = read_memory_unsigned_integer (after_prolog_fp + BINWORD, BINWORD); /* Rememeber any others too */ - in_frame[PC_REGNUM] = 0; + in_frame[E_PC_REGNUM] = 0; if (have_fp) /* We keep the old FP in the SP spot */ - fsr->regs[SP_REGNUM] = - read_memory_unsigned_integer (fsr->regs[6], BINWORD); + fsr[E_SP_REGNUM] = read_memory_unsigned_integer (fsr[E_FP_REGNUM], BINWORD); else - fsr->regs[SP_REGNUM] = after_prolog_fp + auto_depth; + fsr[E_SP_REGNUM] = after_prolog_fp + auto_depth; return (ip); } -void -h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi) +static void +h8300_frame_init_saved_regs (struct frame_info *fi) { - fi->fsr = 0; /* Not yet allocated */ - fi->args_pointer = 0; /* Unknown */ - fi->locals_pointer = 0; /* Unknown */ - fi->from_pc = 0; - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - { /* anything special to do? */ - return; + CORE_ADDR func_addr, func_end; + + if (!fi->saved_regs) + { + frame_saved_regs_zalloc (fi); + + /* Find the beginning of this function, so we can analyze its + prologue. */ + if (find_pc_partial_function (fi->pc, NULL, &func_addr, &func_end)) + { + struct symtab_and_line sal = find_pc_line (func_addr, 0); + CORE_ADDR limit = (sal.end && sal.end < fi->pc) ? sal.end : fi->pc; + /* This will fill in fields in fi. */ + h8300_examine_prologue (func_addr, limit, fi->frame, fi->saved_regs, fi); + } + /* Else we're out of luck (can't debug completely stripped code). + FIXME. */ + } +} + +/* Given a GDB frame, determine the address of the calling function's frame. + This will be used to create a new GDB frame struct, and then + INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. + + For us, the frame address is its stack pointer value, so we look up + the function prologue to determine the caller's sp value, and return it. */ + +static CORE_ADDR +h8300_frame_chain (struct frame_info *thisframe) +{ + if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame)) + { /* initialize the from_pc now */ + thisframe->extra_info->from_pc = + deprecated_read_register_dummy (thisframe->pc, thisframe->frame, + E_PC_REGNUM); + return thisframe->frame; } + return thisframe->saved_regs[E_SP_REGNUM]; } /* Return the saved PC from this frame. @@ -423,168 +506,213 @@ h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi) If the frame has a memory copy of SRP_REGNUM, use that. If not, just use the register SRP_REGNUM itself. */ -CORE_ADDR +static CORE_ADDR h8300_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return generic_read_register_dummy (frame->pc, frame->frame, PC_REGNUM); + return deprecated_read_register_dummy (frame->pc, frame->frame, + E_PC_REGNUM); else - return frame->from_pc; + return frame->extra_info->from_pc; } -CORE_ADDR +static void +h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi) +{ + if (!fi->extra_info) + { + fi->extra_info = (struct frame_extra_info *) + frame_obstack_alloc (sizeof (struct frame_extra_info)); + fi->extra_info->from_pc = 0; + fi->extra_info->args_pointer = 0; /* Unknown */ + fi->extra_info->locals_pointer = 0; /* Unknown */ + + if (!fi->pc) + { + if (fi->next) + fi->pc = h8300_frame_saved_pc (fi->next); + } + h8300_frame_init_saved_regs (fi); + } +} + +static CORE_ADDR h8300_frame_locals_address (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) return (CORE_ADDR) 0; /* Not sure what else to do... */ - if (!fi->locals_pointer) - { - struct frame_saved_regs ignore; - - get_frame_saved_regs (fi, &ignore); - - } - return fi->locals_pointer; + return fi->extra_info->locals_pointer; } /* Return the address of the argument block for the frame described by FI. Returns 0 if the address is unknown. */ -CORE_ADDR +static CORE_ADDR h8300_frame_args_address (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) return (CORE_ADDR) 0; /* Not sure what else to do... */ - if (!fi->args_pointer) - { - struct frame_saved_regs ignore; - - get_frame_saved_regs (fi, &ignore); - - } - - return fi->args_pointer; + return fi->extra_info->args_pointer; } +/* Round N up or down to the nearest multiple of UNIT. + Evaluate N only once, UNIT several times. + UNIT must be a power of two. */ +#define round_up(n, unit) (((n) + (unit) - 1) & -(unit)) +#define round_down(n, unit) ((n) & -(unit)) + /* Function: push_arguments Setup the function arguments for calling a function in the inferior. + In this discussion, a `word' is 16 bits on the H8/300s, and 32 bits + on the H8/300H. + + There are actually two ABI's here: -mquickcall (the default) and + -mno-quickcall. With -mno-quickcall, all arguments are passed on + the stack after the return address, word-aligned. With + -mquickcall, GCC tries to use r0 -- r2 to pass registers. Since + GCC doesn't indicate in the object file which ABI was used to + compile it, GDB only supports the default --- -mquickcall. + + Here are the rules for -mquickcall, in detail: + + Each argument, whether scalar or aggregate, is padded to occupy a + whole number of words. Arguments smaller than a word are padded at + the most significant end; those larger than a word are padded at + the least significant end. + + The initial arguments are passed in r0 -- r2. Earlier arguments go in + lower-numbered registers. Multi-word arguments are passed in + consecutive registers, with the most significant end in the + lower-numbered register. + + If an argument doesn't fit entirely in the remaining registers, it + is passed entirely on the stack. Stack arguments begin just after + the return address. Once an argument has overflowed onto the stack + this way, all subsequent arguments are passed on the stack. + + The above rule has odd consequences. For example, on the h8/300s, + if a function takes two longs and an int as arguments: + - the first long will be passed in r0/r1, + - the second long will be passed entirely on the stack, since it + doesn't fit in r2, + - and the int will be passed on the stack, even though it could fit + in r2. + + A weird exception: if an argument is larger than a word, but not a + whole number of words in length (before padding), it is passed on + the stack following the rules for stack arguments above, even if + there are sufficient registers available to hold it. Stranger + still, the argument registers are still `used up' --- even though + there's nothing in them. + + So, for example, on the h8/300s, if a function expects a three-byte + structure and an int, the structure will go on the stack, and the + int will go in r2, not r0. + + If the function returns an aggregate type (struct, union, or class) + by value, the caller must allocate space to hold the return value, + and pass the callee a pointer to this space as an invisible first + argument, in R0. + + For varargs functions, the last fixed argument and all the variable + arguments are always passed on the stack. This means that calls to + varargs functions don't work properly unless there is a prototype + in scope. + + Basically, this ABI is not good, for the following reasons: + - You can't call vararg functions properly unless a prototype is in scope. + - Structure passing is inconsistent, to no purpose I can see. + - It often wastes argument registers, of which there are only three + to begin with. */ - On the Hitachi H8/300 architecture, there are three registers (R0 to R2) - which are dedicated for passing function arguments. Up to the first - three arguments (depending on size) may go into these registers. - The rest go on the stack. - - Arguments that are smaller than WORDSIZE bytes will still take up a - whole register or a whole WORDSIZE word on the stack, and will be - right-justified in the register or the stack word. This includes - chars and small aggregate types. Note that WORDSIZE depends on the - cpu type. - - Arguments that are larger than WORDSIZE bytes will be split between - two or more registers as available, but will NOT be split between a - register and the stack. - - An exceptional case exists for struct arguments (and possibly other - aggregates such as arrays) -- if the size is larger than WORDSIZE - bytes but not a multiple of WORDSIZE bytes. In this case the - argument is never split between the registers and the stack, but - instead is copied in its entirety onto the stack, AND also copied - into as many registers as there is room for. In other words, space - in registers permitting, two copies of the same argument are passed - in. As far as I can tell, only the one on the stack is used, - although that may be a function of the level of compiler - optimization. I suspect this is a compiler bug. Arguments of - these odd sizes are left-justified within the word (as opposed to - arguments smaller than WORDSIZE bytes, which are right-justified). - - If the function is to return an aggregate type such as a struct, - the caller must allocate space into which the callee will copy the - return value. In this case, a pointer to the return value location - is passed into the callee in register R0, which displaces one of - the other arguments passed in via registers R0 to R2. */ - -CORE_ADDR +static CORE_ADDR h8300_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - unsigned char struct_return, CORE_ADDR struct_addr) + int struct_return, CORE_ADDR struct_addr) { int stack_align, stack_alloc, stack_offset; - int wordsize; - int argreg; - int argnum; - struct type *type; - CORE_ADDR regval; - char *val; - char valbuf[4]; - int len; - - if (h8300hmode || h8300smode) + int wordsize = BINWORD; + int reg; + int argument; + + /* First, make sure the stack is properly aligned. */ + sp = round_down (sp, wordsize); + + /* Now make sure there's space on the stack for the arguments. We + may over-allocate a little here, but that won't hurt anything. */ + stack_alloc = 0; + for (argument = 0; argument < nargs; argument++) + stack_alloc += round_up (TYPE_LENGTH (VALUE_TYPE (args[argument])), + wordsize); + sp -= stack_alloc; + + /* Now load as many arguments as possible into registers, and push + the rest onto the stack. */ + reg = E_ARG0_REGNUM; + stack_offset = 0; + + /* If we're returning a structure by value, then we must pass a + pointer to the buffer for the return value as an invisible first + argument. */ + if (struct_return) + write_register (reg++, struct_addr); + + for (argument = 0; argument < nargs; argument++) { - stack_align = 3; - wordsize = 4; - } - else - { - stack_align = 1; - wordsize = 2; - } - - /* first force sp to a n-byte alignment */ - sp = sp & ~stack_align; - - /* Now make sure there's space on the stack */ - for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++) - stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + stack_align) - & ~stack_align); - sp -= stack_alloc; /* make room on stack for args */ - /* we may over-allocate a little here, but that won't hurt anything */ - - argreg = ARG0_REGNUM; - if (struct_return) /* "struct return" pointer takes up one argreg */ - { - write_register (argreg++, struct_addr); - } - - /* Now load as many as possible of the first arguments into - registers, and push the rest onto the stack. There are 3N bytes - in three registers available. Loop thru args from first to last. */ - - for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++) - { - type = VALUE_TYPE (args[argnum]); - len = TYPE_LENGTH (type); - memset (valbuf, 0, sizeof (valbuf)); - if (len < wordsize) - { - /* the purpose of this is to right-justify the value within the word */ - memcpy (valbuf + (wordsize - len), - (char *) VALUE_CONTENTS (args[argnum]), len); - val = valbuf; - } + struct type *type = VALUE_TYPE (args[argument]); + int len = TYPE_LENGTH (type); + char *contents = (char *) VALUE_CONTENTS (args[argument]); + + /* Pad the argument appropriately. */ + int padded_len = round_up (len, wordsize); + char *padded = alloca (padded_len); + + memset (padded, 0, padded_len); + memcpy (len < wordsize ? padded + padded_len - len : padded, + contents, len); + + /* Could the argument fit in the remaining registers? */ + if (padded_len <= (E_ARGLAST_REGNUM - reg + 1) * wordsize) + { + /* Are we going to pass it on the stack anyway, for no good + reason? */ + if (len > wordsize && len % wordsize) + { + /* I feel so unclean. */ + write_memory (sp + stack_offset, padded, padded_len); + stack_offset += padded_len; + + /* That's right --- even though we passed the argument + on the stack, we consume the registers anyway! Love + me, love my dog. */ + reg += padded_len / wordsize; + } + else + { + /* Heavens to Betsy --- it's really going in registers! + It would be nice if we could use write_register_bytes + here, but on the h8/300s, there are gaps between + the registers in the register file. */ + int offset; + + for (offset = 0; offset < padded_len; offset += wordsize) + { + ULONGEST word = extract_address (padded + offset, wordsize); + write_register (reg++, word); + } + } + } else - val = (char *) VALUE_CONTENTS (args[argnum]); - - if (len > - (ARGLAST_REGNUM + 1 - argreg) * REGISTER_RAW_SIZE (ARG0_REGNUM) - || (len > wordsize && (len & stack_align) != 0)) - { /* passed on the stack */ - write_memory (sp + stack_offset, val, - len < wordsize ? wordsize : len); - stack_offset += (len + stack_align) & ~stack_align; - } - /* NOTE WELL!!!!! This is not an "else if" clause!!! - That's because some *&^%$ things get passed on the stack - AND in the registers! */ - if (len <= - (ARGLAST_REGNUM + 1 - argreg) * REGISTER_RAW_SIZE (ARG0_REGNUM)) - while (len > 0) - { /* there's room in registers */ - regval = extract_address (val, wordsize); - write_register (argreg, regval); - len -= wordsize; - val += wordsize; - argreg++; - } + { + /* It doesn't fit in registers! Onto the stack it goes. */ + write_memory (sp + stack_offset, padded, padded_len); + stack_offset += padded_len; + + /* Once one argument has spilled onto the stack, all + subsequent arguments go on the stack. */ + reg = E_ARGLAST_REGNUM + 1; + } } + return sp; } @@ -594,16 +722,11 @@ h8300_push_arguments (int nargs, struct value **args, CORE_ADDR sp, empty CALL_DUMMY, ie. the target will not actually be executing a JSR/BSR instruction. */ -CORE_ADDR +static CORE_ADDR h8300_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { unsigned char buf[4]; - int wordsize; - - if (h8300hmode || h8300smode) - wordsize = 4; - else - wordsize = 2; + int wordsize = BINWORD; sp -= wordsize; store_unsigned_integer (buf, wordsize, CALL_DUMMY_ADDRESS ()); @@ -616,11 +739,10 @@ h8300_push_return_address (CORE_ADDR pc, CORE_ADDR sp) was created. Usually used either by the "RETURN" command, or by call_function_by_hand after the dummy_frame is finished. */ -void +static void h8300_pop_frame (void) { - unsigned regnum; - struct frame_saved_regs fsr; + unsigned regno; struct frame_info *frame = get_current_frame (); if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) @@ -629,21 +751,20 @@ h8300_pop_frame (void) } else { - get_frame_saved_regs (frame, &fsr); - - for (regnum = 0; regnum < 8; regnum++) + for (regno = 0; regno < 8; regno++) { - /* Don't forget SP_REGNUM is a frame_saved_regs struct is the + /* Don't forget E_SP_REGNUM is a frame_saved_regs struct is the actual value we want, not the address of the value we want. */ - if (fsr.regs[regnum] && regnum != SP_REGNUM) - write_register (regnum, - read_memory_integer (fsr.regs[regnum], BINWORD)); - else if (fsr.regs[regnum] && regnum == SP_REGNUM) - write_register (regnum, frame->frame + 2 * BINWORD); + if (frame->saved_regs[regno] && regno != E_SP_REGNUM) + write_register (regno, + read_memory_integer (frame->saved_regs[regno], + BINWORD)); + else if (frame->saved_regs[regno] && regno == E_SP_REGNUM) + write_register (regno, frame->frame + 2 * BINWORD); } - /* Don't forget the update the PC too! */ - write_pc (frame->from_pc); + /* Don't forget to update the PC too! */ + write_register (E_PC_REGNUM, frame->extra_info->from_pc); } flush_cached_frames (); } @@ -652,17 +773,11 @@ h8300_pop_frame (void) Figure out where in REGBUF the called function has left its return value. Copy that into VALBUF. Be sure to account for CPU type. */ -void +static void h8300_extract_return_value (struct type *type, char *regbuf, char *valbuf) { - int wordsize, len; - - if (h8300smode || h8300hmode) - wordsize = 4; - else - wordsize = 2; - - len = TYPE_LENGTH (type); + int wordsize = BINWORD; + int len = TYPE_LENGTH (type); switch (len) { @@ -671,7 +786,7 @@ h8300_extract_return_value (struct type *type, char *regbuf, char *valbuf) memcpy (valbuf, regbuf + REGISTER_BYTE (0) + (wordsize - len), len); break; case 4: /* (long), (float) */ - if (h8300smode || h8300hmode) + if (wordsize == 4) { memcpy (valbuf, regbuf + REGISTER_BYTE (0), 4); } @@ -692,17 +807,13 @@ h8300_extract_return_value (struct type *type, char *regbuf, char *valbuf) Place the appropriate value in the appropriate registers. Primarily used by the RETURN command. */ -void +static void h8300_store_return_value (struct type *type, char *valbuf) { - int wordsize, len, regval; - - if (h8300hmode || h8300smode) - wordsize = 4; - else - wordsize = 2; + int regval; + int wordsize = BINWORD; + int len = TYPE_LENGTH (type); - len = TYPE_LENGTH (type); switch (len) { case 1: /* char */ @@ -712,7 +823,7 @@ h8300_store_return_value (struct type *type, char *valbuf) break; case 4: /* long, float */ regval = extract_address (valbuf, len); - if (h8300smode || h8300hmode) + if (wordsize == 4) { write_register (0, regval); } @@ -728,112 +839,62 @@ h8300_store_return_value (struct type *type, char *valbuf) } } -struct cmd_list_element *setmemorylist; +static struct cmd_list_element *setmachinelist; -static void -set_register_names (void) +static const char * +h8300_register_name (int regno) { - if (h8300hmode != 0) - h8300_register_names = h8300h_register_names; + /* The register names change depending on whether the h8300h processor + type is selected. */ + static char *h8300_register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", + "sp", "ccr","pc","cycles", "tick", "inst", "" + }; + static char *h8300s_register_names[] = { + "er0", "er1", "er2", "er3", "er4", "er5", "er6", + "sp", "ccr", "pc", "cycles", "exr", "tick", "inst" + }; + char **register_names = + h8300smode ? h8300s_register_names : h8300_register_names; + if (regno < 0 || regno >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "h8300_register_name: illegal register number %d", regno); else - h8300_register_names = original_register_names; -} - -static void -h8300_command (char *args, int from_tty) -{ - extern int h8300hmode; - h8300hmode = 0; - h8300smode = 0; - set_register_names (); + return register_names[regno]; } static void -h8300h_command (char *args, int from_tty) +h8300_print_register (int regno) { - extern int h8300hmode; - h8300hmode = 1; - h8300smode = 0; - set_register_names (); -} - -static void -h8300s_command (char *args, int from_tty) -{ - extern int h8300smode; - extern int h8300hmode; - h8300smode = 1; - h8300hmode = 1; - set_register_names (); -} - -static void -set_machine (char *args, int from_tty) -{ - printf_unfiltered ("\"set machine\" must be followed by h8300, h8300h"); - printf_unfiltered ("or h8300s"); - help_list (setmemorylist, "set memory ", -1, gdb_stdout); -} + long val = read_register (regno); + const char *name = h8300_register_name (regno); -/* set_machine_hook is called as the exec file is being opened, but - before the symbol file is opened. This allows us to set the - h8300hmode flag based on the machine type specified in the exec - file. This in turn will cause subsequently defined pointer types - to be 16 or 32 bits as appropriate for the machine. */ + if (!name || !*name) + return; -static void -set_machine_hook (char *filename) -{ - if (bfd_get_mach (exec_bfd) == bfd_mach_h8300s) - { - h8300smode = 1; - h8300hmode = 1; - } - else if (bfd_get_mach (exec_bfd) == bfd_mach_h8300h) + printf_filtered ("%-14s ", name); + if (h8300hmode) { - h8300smode = 0; - h8300hmode = 1; + if (val) + printf_filtered ("0x%08lx %-8ld", val, val); + else + printf_filtered ("0x%-8lx %-8ld", val, val); } else { - h8300smode = 0; - h8300hmode = 0; + if (val) + printf_filtered ("0x%04lx %-4ld", val, val); + else + printf_filtered ("0x%-4lx %-4ld", val, val); } - set_register_names (); -} - -void -_initialize_h8300m (void) -{ - add_prefix_cmd ("machine", no_class, set_machine, - "set the machine type", - &setmemorylist, "set machine ", 0, &setlist); - - add_cmd ("h8300", class_support, h8300_command, - "Set machine to be H8/300.", &setmemorylist); - - add_cmd ("h8300h", class_support, h8300h_command, - "Set machine to be H8/300H.", &setmemorylist); - - add_cmd ("h8300s", class_support, h8300s_command, - "Set machine to be H8/300S.", &setmemorylist); - - /* Add a hook to set the machine type when we're loading a file. */ - - specify_exec_file_hook (set_machine_hook); -} - -void -h8300_print_register_hook (int regno) -{ - if (regno == CCR_REGNUM) + if (regno == E_CCR_REGNUM) { /* CCR register */ int C, Z, N, V; - unsigned char b[REGISTER_SIZE]; + unsigned char b[h8300h_reg_size]; unsigned char l; frame_register_read (selected_frame, regno, b); - l = b[REGISTER_VIRTUAL_SIZE (CCR_REGNUM) - 1]; + l = b[REGISTER_VIRTUAL_SIZE (E_CCR_REGNUM) - 1]; printf_unfiltered ("\t"); printf_unfiltered ("I-%d ", (l & 0x80) != 0); printf_unfiltered ("UI-%d ", (l & 0x40) != 0); @@ -868,24 +929,243 @@ h8300_print_register_hook (int regno) if ((Z | (N ^ V)) == 1) printf_unfiltered ("<= "); } - - if (regno == EXR_REGNUM && h8300smode) + else if (regno == E_EXR_REGNUM && h8300smode) { /* EXR register */ - unsigned char b[REGISTER_SIZE]; + unsigned char b[h8300h_reg_size]; unsigned char l; frame_register_read (selected_frame, regno, b); - l = b[REGISTER_VIRTUAL_SIZE (EXR_REGNUM) - 1]; + l = b[REGISTER_VIRTUAL_SIZE (E_EXR_REGNUM) - 1]; printf_unfiltered ("\t"); printf_unfiltered ("T-%d - - - ", (l & 0x80) != 0); printf_unfiltered ("I2-%d ", (l & 4) != 0); printf_unfiltered ("I1-%d ", (l & 2) != 0); printf_unfiltered ("I0-%d", (l & 1) != 0); } + printf_filtered ("\n"); +} + +static void +h8300_do_registers_info (int regno, int cpregs) +{ + if (regno < 0) + for (regno = 0; regno < E_NUM_REGS; ++regno) + h8300_print_register (regno); + else + h8300_print_register (regno); +} + +static CORE_ADDR +h8300_saved_pc_after_call (struct frame_info *ignore) +{ + return read_memory_unsigned_integer (read_register (E_SP_REGNUM), BINWORD); +} + +static int +h8300_register_byte (int regno) +{ + if (regno < 0 || regno >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "h8300_register_byte: illegal register number %d", regno); + else + return regno * BINWORD; +} + +static int +h8300_register_raw_size (int regno) +{ + if (regno < 0 || regno >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "h8300_register_raw_size: illegal register number %d", + regno); + else + return BINWORD; +} + +static struct type * +h8300_register_virtual_type (int regno) +{ + if (regno < 0 || regno >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "h8300_register_virtual_type: illegal register number %d", + regno); + else + return h8300hmode ? + builtin_type_unsigned_long : builtin_type_unsigned_short; +} + +static void +h8300_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + write_register (0, addr); +} + +static int +h8300_use_struct_convention (int gcc_p, struct type *type) +{ + return 1; +} + +static CORE_ADDR +h8300_extract_struct_value_address (char *regbuf) +{ + return extract_address (regbuf + h8300_register_byte (E_ARG0_REGNUM), + h8300_register_raw_size (E_ARG0_REGNUM)); +} + +const static unsigned char * +h8300_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) +{ + /*static unsigned char breakpoint[] = { 0x7A, 0xFF };*/ /* ??? */ + static unsigned char breakpoint[] = { 0x01, 0x80 }; /* Sleep */ + + *lenptr = sizeof (breakpoint); + return breakpoint; +} + +static void +h8300_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, + struct frame_info *frame, const char *args) +{ + fprintf_filtered (file, "\ +No floating-point info available for this processor.\n"); +} + +static struct gdbarch * +h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +{ + static LONGEST call_dummy_words[1] = { 0 }; + struct gdbarch_tdep *tdep = NULL; + struct gdbarch *gdbarch; + + arches = gdbarch_list_lookup_by_info (arches, &info); + if (arches != NULL) + return arches->gdbarch; + +#if 0 + tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); +#endif + + if (info.bfd_arch_info->arch != bfd_arch_h8300) + return NULL; + + switch (info.bfd_arch_info->mach) + { + case bfd_mach_h8300: + h8300smode = 0; + h8300hmode = 0; + break; + case bfd_mach_h8300h: + h8300smode = 0; + h8300hmode = 1; + break; + case bfd_mach_h8300s: + h8300smode = 1; + h8300hmode = 1; + break; + } + + gdbarch = gdbarch_alloc (&info, 0); + + /* + * Basic register fields and methods. + */ + + set_gdbarch_num_regs (gdbarch, E_NUM_REGS); + set_gdbarch_num_pseudo_regs (gdbarch, 0); + set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); + set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); + set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); + set_gdbarch_register_name (gdbarch, h8300_register_name); + set_gdbarch_register_size (gdbarch, BINWORD); + set_gdbarch_register_bytes (gdbarch, E_NUM_REGS * BINWORD); + set_gdbarch_register_byte (gdbarch, h8300_register_byte); + set_gdbarch_register_raw_size (gdbarch, h8300_register_raw_size); + set_gdbarch_max_register_raw_size (gdbarch, h8300h_reg_size); + set_gdbarch_register_virtual_size (gdbarch, h8300_register_raw_size); + set_gdbarch_max_register_virtual_size (gdbarch, h8300h_reg_size); + set_gdbarch_register_virtual_type (gdbarch, h8300_register_virtual_type); + set_gdbarch_do_registers_info (gdbarch, h8300_do_registers_info); + set_gdbarch_print_float_info (gdbarch, h8300_print_float_info); + + /* + * Frame Info + */ + set_gdbarch_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info); + set_gdbarch_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs); + set_gdbarch_frame_chain (gdbarch, h8300_frame_chain); + set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register); + set_gdbarch_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call); + set_gdbarch_frame_saved_pc (gdbarch, h8300_frame_saved_pc); + set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue); + set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); + set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address); + set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address); + + /* + * Miscelany + */ + /* Stack grows up. */ + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); + /* PC stops zero byte after a trap instruction + (which means: exactly on trap instruction). */ + set_gdbarch_decr_pc_after_break (gdbarch, 0); + /* This value is almost never non-zero... */ + set_gdbarch_function_start_offset (gdbarch, 0); + /* This value is almost never non-zero... */ + set_gdbarch_frame_args_skip (gdbarch, 0); + /* OK to default this value to 'unknown'. */ + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + set_gdbarch_frameless_function_invocation (gdbarch, + frameless_look_for_prologue); + + /* W/o prototype, coerce float args to double. */ + /* set_gdbarch_coerce_float_to_double (gdbarch, standard_coerce_float_to_double); */ + + /* + * Call Dummies + * + * These values and methods are used when gdb calls a target function. */ + set_gdbarch_use_generic_dummy_frames (gdbarch, 1); + set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); + set_gdbarch_push_return_address (gdbarch, h8300_push_return_address); + set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value); + set_gdbarch_push_arguments (gdbarch, h8300_push_arguments); + set_gdbarch_pop_frame (gdbarch, h8300_pop_frame); + set_gdbarch_store_struct_return (gdbarch, h8300_store_struct_return); + set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address); + set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention); + set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); + set_gdbarch_call_dummy_address (gdbarch, entry_point_address); + set_gdbarch_call_dummy_start_offset (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + set_gdbarch_call_dummy_length (gdbarch, 0); + set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy); + set_gdbarch_call_dummy_p (gdbarch, 1); + set_gdbarch_call_dummy_words (gdbarch, call_dummy_words); + set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); + set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); + /* set_gdbarch_call_dummy_stack_adjust */ + set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); + set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc); + + set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_ptr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT); + + /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */ + set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); + set_gdbarch_believe_pcc_promotion (gdbarch, 1); + + return gdbarch; } void _initialize_h8300_tdep (void) { tm_print_insn = gdb_print_insn_h8300; + register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init); } diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 74c70dbbff1..84588795699 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -541,15 +541,17 @@ store_fpxregs (int tid, int regno) static void dummy_sse_values (void) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* C doesn't have a syntax for NaN's, so write it out as an array of longs. */ static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static long mxcsr = 0x1f80; int reg; - for (reg = 0; reg < 8; reg++) + for (reg = 0; reg < tdep->num_xmm_regs; reg++) supply_register (XMM0_REGNUM + reg, (char *) dummy); - supply_register (MXCSR_REGNUM, (char *) &mxcsr); + if (tdep->num_xmm_regs > 0) + supply_register (MXCSR_REGNUM, (char *) &mxcsr); } #else diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index 3c30130ede9..95b168ac88e 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -1,6 +1,6 @@ -/* Target-dependent code for Linux/x86. - Copyright 2002 - Free Software Foundation, Inc. +/* Target-dependent code for GNU/Linux x86. + + Copyright 2002 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 4a2eab6ae1a..5a19308294f 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -535,8 +535,8 @@ static CORE_ADDR i386_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, 0, 0)) - return generic_read_register_dummy (frame->pc, frame->frame, - PC_REGNUM); + return deprecated_read_register_dummy (frame->pc, frame->frame, + PC_REGNUM); if (frame->signal_handler_caller) return i386_sigtramp_saved_pc (frame); @@ -1102,10 +1102,10 @@ i386_register_virtual_type (int regnum) if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) return lookup_pointer_type (builtin_type_void); - if (IS_FP_REGNUM (regnum)) + if (FP_REGNUM_P (regnum)) return builtin_type_i387_ext; - if (IS_SSE_REGNUM (regnum)) + if (SSE_REGNUM_P (regnum)) return builtin_type_vec128i; if (mmx_regnum_p (regnum)) @@ -1175,7 +1175,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, static int i386_register_convertible (int regnum) { - return IS_FP_REGNUM (regnum); + return FP_REGNUM_P (regnum); } /* Convert data from raw format for register REGNUM in buffer FROM to @@ -1185,7 +1185,7 @@ static void i386_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { - gdb_assert (IS_FP_REGNUM (regnum)); + gdb_assert (FP_REGNUM_P (regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -1208,7 +1208,7 @@ static void i386_register_convert_to_raw (struct type *type, int regnum, char *from, char *to) { - gdb_assert (IS_FP_REGNUM (regnum)); + gdb_assert (FP_REGNUM_P (regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -1288,15 +1288,17 @@ i386_pc_in_sigtramp (CORE_ADDR pc, char *name) deals with switching between those. */ static int -gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info) +i386_print_insn (bfd_vma pc, disassemble_info *info) { - if (disassembly_flavor == att_flavor) - return print_insn_i386_att (memaddr, info); - else if (disassembly_flavor == intel_flavor) - return print_insn_i386_intel (memaddr, info); - /* Never reached -- disassembly_flavour is always either att_flavor - or intel_flavor. */ - internal_error (__FILE__, __LINE__, "failed internal consistency check"); + gdb_assert (disassembly_flavor == att_flavor + || disassembly_flavor == intel_flavor); + + /* FIXME: kettenis/20020915: Until disassembler_options is properly + constified, cast to prevent a compiler warning. */ + info->disassembler_options = (char *) disassembly_flavor; + info->mach = gdbarch_bfd_arch_info (current_gdbarch)->mach; + + return print_insn_i386 (pc, info); } @@ -1460,7 +1462,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) on having a `long double' that's not `long' at all. */ set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); - /* Although the i386 extended floating-point has only 80 significant + /* Although the i387 extended floating-point has only 80 significant bits, a `long double' actually takes up 96, probably to enforce alignment. */ set_gdbarch_long_double_bit (gdbarch, 96); @@ -1469,11 +1471,11 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tm-symmetry.h currently override this. Sigh. */ set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS); - set_gdbarch_sp_regnum (gdbarch, 4); - set_gdbarch_fp_regnum (gdbarch, 5); - set_gdbarch_pc_regnum (gdbarch, 8); - set_gdbarch_ps_regnum (gdbarch, 9); - set_gdbarch_fp0_regnum (gdbarch, 16); + set_gdbarch_sp_regnum (gdbarch, 4); /* %esp */ + set_gdbarch_fp_regnum (gdbarch, 5); /* %ebp */ + set_gdbarch_pc_regnum (gdbarch, 8); /* %eip */ + set_gdbarch_ps_regnum (gdbarch, 9); /* %eflags */ + set_gdbarch_fp0_regnum (gdbarch, 16); /* %st(0) */ /* Use the "default" register numbering scheme for stabs and COFF. */ set_gdbarch_stab_reg_to_regnum (gdbarch, i386_stab_reg_to_regnum); @@ -1518,7 +1520,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_convert_to_raw (gdbarch, i386_register_convert_to_raw); set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register); - set_gdbarch_push_arguments (gdbarch, i386_push_arguments); set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point); @@ -1570,6 +1571,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write); + set_gdbarch_print_insn (gdbarch, i386_print_insn); + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch, osabi); @@ -1601,9 +1604,6 @@ _initialize_i386_tdep (void) { register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init); - tm_print_insn = gdb_print_insn_i386; - tm_print_insn_info.mach = bfd_lookup_arch (bfd_arch_i386, 0)->mach; - /* Add the variable that controls the disassembly flavor. */ { struct cmd_list_element *new_cmd; @@ -1624,7 +1624,7 @@ and the default value is \"att\".", struct cmd_list_element *new_cmd; new_cmd = add_set_enum_cmd ("struct-convention", no_class, - valid_conventions, + valid_conventions, &struct_convention, "\ Set the convention for returning small structs, valid values \ are \"default\", \"pcc\" and \"reg\", and the default value is \"default\".", diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 30128d9341a..646001baa34 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -175,5 +175,6 @@ extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *); /* Functions exported from i386bsd-tdep.c. */ extern CORE_ADDR i386bsd_sigcontext_addr (struct frame_info *frame); +extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *); #endif /* i386-tdep.h */ diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c index 2edf3eaf107..a76012368ce 100644 --- a/gdb/i386bsd-tdep.c +++ b/gdb/i386bsd-tdep.c @@ -93,13 +93,17 @@ i386bsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name) int i386bsd_sc_pc_offset = 20; int i386bsd_sc_sp_offset = 8; -static void +void i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); set_gdbarch_pc_in_sigtramp (gdbarch, i386bsd_pc_in_sigtramp); + /* Allow the recognition of sigtramps as a function named <sigtramp>. */ + set_gdbarch_sigtramp_start (gdbarch, i386bsd_sigtramp_start); + set_gdbarch_sigtramp_end (gdbarch, i386bsd_sigtramp_end); + /* Assume SunOS-style shared libraries. */ set_gdbarch_in_solib_call_trampoline (gdbarch, i386bsd_aout_in_solib_call_trampoline); @@ -113,61 +117,6 @@ i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->sc_sp_offset = i386bsd_sc_sp_offset; } -/* NetBSD 1.0 or later. */ - -CORE_ADDR i386nbsd_sigtramp_start = 0xbfbfdf20; -CORE_ADDR i386nbsd_sigtramp_end = 0xbfbfdff0; - -/* From <machine/signal.h>. */ -int i386nbsd_sc_pc_offset = 44; -int i386nbsd_sc_sp_offset = 56; - -static void -i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - /* Obviously NetBSD is BSD-based. */ - i386bsd_init_abi (info, gdbarch); - - /* NetBSD uses -freg-struct-return by default. */ - tdep->struct_return = reg_struct_return; - - /* NetBSD uses a different memory layout. */ - tdep->sigtramp_start = i386nbsd_sigtramp_start; - tdep->sigtramp_end = i386nbsd_sigtramp_end; - - /* NetBSD has a `struct sigcontext' that's different from the - origional 4.3 BSD. */ - tdep->sc_pc_offset = i386nbsd_sc_pc_offset; - tdep->sc_sp_offset = i386nbsd_sc_sp_offset; -} - -/* NetBSD ELF. */ -static void -i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - /* It's still NetBSD. */ - i386nbsd_init_abi (info, gdbarch); - - /* But ELF-based. */ - i386_elf_init_abi (info, gdbarch); - - /* NetBSD ELF uses SVR4-style shared libraries. */ - set_gdbarch_in_solib_call_trampoline (gdbarch, - generic_in_solib_call_trampoline); - - /* NetBSD ELF uses -fpcc-struct-return by default. */ - tdep->struct_return = pcc_struct_return; - - /* We support the SSE registers on NetBSD ELF. */ - tdep->num_xmm_regs = I386_NUM_XREGS - 1; - set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS - + I386_NUM_XREGS); -} - /* FreeBSD 3.0-RELEASE or later. */ CORE_ADDR i386fbsd_sigtramp_start = 0xbfbfdf20; @@ -246,10 +195,6 @@ _initialize_i386bsd_tdep (void) gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour, i386bsd_aout_osabi_sniffer); - gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT, - i386nbsd_init_abi); - gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF, - i386nbsdelf_init_abi); gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_AOUT, i386fbsdaout_init_abi); gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_ELF, diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 634101ad35f..4558a35d2c8 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -23,8 +23,13 @@ #include "gdbtypes.h" #include "gdbcore.h" #include "regcache.h" +#include "arch-utils.h" +#include "i386-tdep.h" #include "i387-tdep.h" +#include "nbsd-tdep.h" + +#include "solib-svr4.h" /* Map a GDB register number to an offset in the reg structure. */ static int regmap[] = @@ -137,9 +142,165 @@ static struct core_fns i386nbsd_elfcore_fns = NULL /* next */ }; +/* Under NetBSD/i386, signal handler invocations can be identified by the + designated code sequence that is used to return from a signal handler. + In particular, the return address of a signal handler points to the + following code sequence: + + leal 0x10(%esp), %eax + pushl %eax + pushl %eax + movl $0x127, %eax # __sigreturn14 + int $0x80 + + Each instruction has a unique encoding, so we simply attempt to match + the instruction the PC is pointing to with any of the above instructions. + If there is a hit, we know the offset to the start of the designated + sequence and can then check whether we really are executing in the + signal trampoline. If not, -1 is returned, otherwise the offset from the + start of the return sequence is returned. */ +#define RETCODE_INSN1 0x8d +#define RETCODE_INSN2 0x50 +#define RETCODE_INSN3 0x50 +#define RETCODE_INSN4 0xb8 +#define RETCODE_INSN5 0xcd + +#define RETCODE_INSN2_OFF 4 +#define RETCODE_INSN3_OFF 5 +#define RETCODE_INSN4_OFF 6 +#define RETCODE_INSN5_OFF 11 + +static const unsigned char sigtramp_retcode[] = +{ + RETCODE_INSN1, 0x44, 0x24, 0x10, + RETCODE_INSN2, + RETCODE_INSN3, + RETCODE_INSN4, 0x27, 0x01, 0x00, 0x00, + RETCODE_INSN5, 0x80, +}; + +static LONGEST +i386nbsd_sigtramp_offset (CORE_ADDR pc) +{ + unsigned char ret[sizeof(sigtramp_retcode)], insn; + LONGEST off; + int i; + + if (read_memory_nobpt (pc, &insn, 1) != 0) + return -1; + + switch (insn) + { + case RETCODE_INSN1: + off = 0; + break; + + case RETCODE_INSN2: + /* INSN2 and INSN3 are the same. Read at the location of PC+1 + to determine if we're actually looking at INSN2 or INSN3. */ + if (read_memory_nobpt (pc + 1, &insn, 1) != 0) + return -1; + + if (insn == RETCODE_INSN3) + off = RETCODE_INSN2_OFF; + else + off = RETCODE_INSN3_OFF; + break; + + case RETCODE_INSN4: + off = RETCODE_INSN4_OFF; + break; + + case RETCODE_INSN5: + off = RETCODE_INSN5_OFF; + break; + + default: + return -1; + } + + pc -= off; + + if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0) + return -1; + + if (memcmp (ret, sigtramp_retcode, sizeof (ret)) == 0) + return off; + + return -1; +} + +static int +i386nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + return (nbsd_pc_in_sigtramp (pc, name) + || i386nbsd_sigtramp_offset (pc) >= 0); +} + +/* From <machine/signal.h>. */ +int i386nbsd_sc_pc_offset = 44; +int i386nbsd_sc_sp_offset = 56; + +static void +i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Obviously NetBSD is BSD-based. */ + i386bsd_init_abi (info, gdbarch); + + /* NetBSD has different signal trampoline conventions. */ + set_gdbarch_pc_in_sigtramp (gdbarch, i386nbsd_pc_in_sigtramp); + /* FIXME: kettenis/20020906: We should probably provide + NetBSD-specific versions of these functions if we want to + recognize signal trampolines that live on the stack. */ + set_gdbarch_sigtramp_start (gdbarch, NULL); + set_gdbarch_sigtramp_end (gdbarch, NULL); + + /* NetBSD uses -freg-struct-return by default. */ + tdep->struct_return = reg_struct_return; + + /* NetBSD has a `struct sigcontext' that's different from the + origional 4.3 BSD. */ + tdep->sc_pc_offset = i386nbsd_sc_pc_offset; + tdep->sc_sp_offset = i386nbsd_sc_sp_offset; +} + +/* NetBSD ELF. */ +static void +i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* It's still NetBSD. */ + i386nbsd_init_abi (info, gdbarch); + + /* But ELF-based. */ + i386_elf_init_abi (info, gdbarch); + + /* NetBSD ELF uses SVR4-style shared libraries. */ + set_gdbarch_in_solib_call_trampoline (gdbarch, + generic_in_solib_call_trampoline); + set_solib_svr4_fetch_link_map_offsets (gdbarch, + nbsd_ilp32_solib_svr4_fetch_link_map_offsets); + + /* NetBSD ELF uses -fpcc-struct-return by default. */ + tdep->struct_return = pcc_struct_return; + + /* We support the SSE registers on NetBSD ELF. */ + tdep->num_xmm_regs = I386_NUM_XREGS - 1; + set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS + + I386_NUM_XREGS); +} + void _initialize_i386nbsd_tdep (void) { add_core_fns (&i386nbsd_core_fns); add_core_fns (&i386nbsd_elfcore_fns); + + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT, + i386nbsd_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF, + i386nbsdelf_init_abi); } diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 18741944a5a..53f21a46b1f 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -723,7 +723,7 @@ ia64_frame_saved_pc (struct frame_info *frame) if (frame->signal_handler_caller) return read_sigcontext_register (frame, pc_regnum); else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - return generic_read_register_dummy (frame->pc, frame->frame, pc_regnum); + return deprecated_read_register_dummy (frame->pc, frame->frame, pc_regnum); else { FRAME_INIT_SAVED_REGS (frame); @@ -1500,10 +1500,12 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) } else if (next_frame_is_call_dummy) { - bsp = generic_read_register_dummy (frame->next->pc, frame->next->frame, - IA64_BSP_REGNUM); - cfm = generic_read_register_dummy (frame->next->pc, frame->next->frame, - IA64_CFM_REGNUM); + bsp = deprecated_read_register_dummy (frame->next->pc, + frame->next->frame, + IA64_BSP_REGNUM); + cfm = deprecated_read_register_dummy (frame->next->pc, + frame->next->frame, + IA64_CFM_REGNUM); } else { @@ -1518,8 +1520,8 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) else if (frn->next && PC_IN_CALL_DUMMY (frn->next->pc, frn->next->frame, frn->next->frame)) - cfm = generic_read_register_dummy (frn->next->pc, frn->next->frame, - IA64_PFS_REGNUM); + cfm = deprecated_read_register_dummy (frn->next->pc, frn->next->frame, + IA64_PFS_REGNUM); else cfm = read_register (IA64_PFS_REGNUM); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 433332555e8..a1d030bbce5 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1653,14 +1653,14 @@ default_print_registers_info (struct gdbarch *gdbarch, { /* Print the register in hex. */ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, - gdb_stdout, 'x', 1, 0, Val_pretty_default); + file, 'x', 1, 0, Val_pretty_default); /* If not a vector register, print it also according to its natural format. */ if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) { - printf_filtered ("\t"); + fprintf_filtered (file, "\t"); val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); + file, 0, 1, 0, Val_pretty_default); } } @@ -1701,7 +1701,7 @@ registers_info (char *addr_exp, int fpregs) ++end; numregs = NUM_REGS + NUM_PSEUDO_REGS; - regnum = target_map_name_to_register (addr_exp, end - addr_exp); + regnum = frame_map_name_to_regnum (addr_exp, end - addr_exp); if (regnum >= 0) goto found; diff --git a/gdb/inflow.c b/gdb/inflow.c index b37fc541c91..d286b5e36dc 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -205,7 +205,7 @@ terminal_init_inferior_with_pgrp (int pgrp) and gdb must be able to restore it correctly. */ void -terminal_save_ours () +terminal_save_ours (void) { if (gdb_has_a_terminal ()) { diff --git a/gdb/infrun.c b/gdb/infrun.c index b6c23425459..0f0c96b62ec 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3531,9 +3531,7 @@ signal_pass_state (int signo) } int -signal_stop_update (signo, state) - int signo; - int state; +signal_stop_update (int signo, int state) { int ret = signal_stop[signo]; signal_stop[signo] = state; @@ -3541,9 +3539,7 @@ signal_stop_update (signo, state) } int -signal_print_update (signo, state) - int signo; - int state; +signal_print_update (int signo, int state) { int ret = signal_print[signo]; signal_print[signo] = state; @@ -3551,9 +3547,7 @@ signal_print_update (signo, state) } int -signal_pass_update (signo, state) - int signo; - int state; +signal_pass_update (int signo, int state) { int ret = signal_program[signo]; signal_program[signo] = state; diff --git a/gdb/infttrace.c b/gdb/infttrace.c index 7433b7c7292..a1a789c59a1 100644 --- a/gdb/infttrace.c +++ b/gdb/infttrace.c @@ -4539,98 +4539,41 @@ child_resume (ptid_t ptid, int step, enum target_signal signal) else { - /* TT_LWP_CONTINUE can pass signals to threads, - * TT_PROC_CONTINUE can't. So if there are any - * signals to pass, we have to use the (slower) - * loop over the stopped threads. - * - * Equally, if we have to not continue some threads, - * due to saved events, we have to use the loop. - */ - if ((signal != 0) || saved_signals_exist ()) + /* TT_LWP_CONTINUE can pass signals to threads, TT_PROC_CONTINUE can't. + Therefore, we really can't use TT_PROC_CONTINUE here. + + Consider a process which stopped due to signal which gdb decides + to handle and not pass on to the inferior. In that case we must + clear the pending signal by restarting the inferior using + TT_LWP_CONTINUE and pass zero as the signal number. Else the + pending signal will be passed to the inferior. interrupt.exp + in the testsuite does this precise thing and fails due to the + unwanted signal delivery to the inferior. */ + if (resume_all_threads) { - if (resume_all_threads) - { - #ifdef THREAD_DEBUG - if (debug_on) - printf ("Doing a continue by loop of all threads\n"); -#endif - - threads_continue_all_with_signals (tid, signal); - - clear_all_handled (); - clear_all_stepping_mode (); - } - - else - { -#ifdef THREAD_DEBUG - printf ("Doing a continue w/signal of just thread %d\n", tid); + if (debug_on) + printf ("Doing a continue by loop of all threads\n"); #endif - threads_continue_one_with_signal (tid, signal); + threads_continue_all_with_signals (tid, signal); - /* Clear the "handled" state of this thread, because - * we'll soon get a new event for it. Other events - * can stay as they were. - */ - clear_handled (tid); - clear_stepping_mode (tid); - } + clear_all_handled (); + clear_all_stepping_mode (); } - else { - /* No signals to send. - */ - if (resume_all_threads) - { -#ifdef THREAD_DEBUG - if (debug_on) - printf ("Doing a continue by process of process %d\n", tid); -#endif - - if (more_events_left > 0) - { - warning ("Losing buffered events on continue."); - more_events_left = 0; - } - - call_ttrace (TT_PROC_CONTINUE, - tid, - TT_NIL, - TT_NIL, - TT_NIL); - - clear_all_handled (); - clear_all_stepping_mode (); - } - - else - { #ifdef THREAD_DEBUG - if (debug_on) - { - printf ("Doing a continue of just thread %d\n", tid); - if (is_terminated (tid)) - printf ("Why are we continuing a dead thread? (5)\n"); - } + printf ("Doing a continue w/signal of just thread %d\n", tid); #endif - call_ttrace (TT_LWP_CONTINUE, - tid, - TT_NIL, - TT_NIL, - TT_NIL); + threads_continue_one_with_signal (tid, signal); - /* Clear the "handled" state of this thread, because - * we'll soon get a new event for it. Other events - * can stay as they were. - */ - clear_handled (tid); - clear_stepping_mode (tid); - } + /* Clear the "handled" state of this thread, because we + will soon get a new event for it. Other events can + stay as they were. */ + clear_handled (tid); + clear_stepping_mode (tid); } } diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index c2e5d16c68e..70c228b9575 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -85,6 +85,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define yylloc java_lloc #define yyreds java_reds /* With YYDEBUG defined */ #define yytoks java_toks /* With YYDEBUG defined */ +#define yyname java_name /* With YYDEBUG defined */ +#define yyrule java_rule /* With YYDEBUG defined */ #define yylhs java_yylhs #define yylen java_yylen #define yydefred java_yydefred diff --git a/gdb/linespec.c b/gdb/linespec.c index 8e51021fc44..5631fd31433 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -26,6 +26,7 @@ #include "command.h" #include "symfile.h" #include "objfiles.h" +#include "source.h" #include "demangle.h" #include "value.h" #include "completer.h" @@ -545,8 +546,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, if (default_symtab == 0) { - default_symtab = current_source_symtab; - default_line = current_source_line; + /* Use whatever we have for the default source line. We don't use + get_current_or_default_symtab_and_line as it can recurse and call + us back! */ + struct symtab_and_line cursal = + get_current_source_symtab_and_line (); + + default_symtab = cursal.symtab; + default_line = cursal.line; } /* See if arg is *PC */ @@ -1020,13 +1027,19 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* This is where we need to make sure that we have good defaults. We must guarantee that this section of code is never executed when we are called with just a function name, since - select_source_symtab calls us with such an argument */ + set_default_source_symtab_and_line uses + select_source_symtab that calls us with such an argument */ if (s == 0 && default_symtab == 0) { - select_source_symtab (0); - default_symtab = current_source_symtab; - default_line = current_source_line; + struct symtab_and_line cursal; + + /* Make sure we have at least a default source file. */ + set_default_source_symtab_and_line (); + cursal = get_current_source_symtab_and_line (); + + default_symtab = cursal.symtab; + default_line = cursal.line; } if (**argptr == '+') diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 707c9e21091..e291d62b1cb 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -87,6 +87,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define yylloc m2_lloc #define yyreds m2_reds /* With YYDEBUG defined */ #define yytoks m2_toks /* With YYDEBUG defined */ +#define yyname m2_name /* With YYDEBUG defined */ +#define yyrule m2_rule /* With YYDEBUG defined */ #define yylhs m2_yylhs #define yylen m2_yylen #define yydefred m2_yydefred diff --git a/gdb/m32r-stub.c b/gdb/m32r-stub.c index cb956264d67..a691a657a23 100644 --- a/gdb/m32r-stub.c +++ b/gdb/m32r-stub.c @@ -1288,8 +1288,7 @@ restore_and_return: ld r13, @r0+ ; restore r13 ld r14, @r0+ ; restore r14 ld r15, @r0+ ; restore r15 - ld r1, @r0+ ; restore cr0 == PSW - mvtc r1, cr0 + addi r0, #4 ; don't restore PSW (rte will do it) ld r1, @r0+ ; restore cr1 == CBR (no-op, because it's read only) mvtc r1, cr1 ld r1, @r0+ ; restore cr2 == SPI diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index b4ee7775b76..b1bc3ed037b 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -390,7 +390,8 @@ m32r_init_extra_frame_info (struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); fi->framesize = 0; return; } @@ -462,7 +463,7 @@ m32r_find_callers_reg (struct frame_info *fi, int regnum) { for (; fi; fi = fi->next) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else if (fi->fsr.regs[regnum] != 0) return read_memory_integer (fi->fsr.regs[regnum], REGISTER_RAW_SIZE (regnum)); @@ -554,7 +555,7 @@ CORE_ADDR m32r_frame_saved_pc (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); else return m32r_find_callers_reg (fi, RP_REGNUM); } diff --git a/gdb/macroscope.c b/gdb/macroscope.c index 08ff6ebff58..083dc1f4e4a 100644 --- a/gdb/macroscope.c +++ b/gdb/macroscope.c @@ -23,6 +23,7 @@ #include "macroscope.h" #include "symtab.h" +#include "source.h" #include "target.h" #include "frame.h" #include "inferior.h" @@ -84,11 +85,14 @@ default_macro_scope (void) evaluator to evaluate their numeric arguments. If the current language is C, then that may call this function to choose a scope for macro expansion. If you don't have any - symbol files loaded, then select_source_symtab will raise an + symbol files loaded, then get_current_or_default would raise an error. But `set width' shouldn't raise an error just because it can't decide which scope to macro-expand its argument in. */ - sal.symtab = current_source_symtab; - sal.line = current_source_line; + struct symtab_and_line cursal = + get_current_source_symtab_and_line (); + + sal.symtab = cursal.symtab; + sal.line = cursal.line; } return sal_macro_scope (sal); diff --git a/gdb/main.c b/gdb/main.c index 92b63f42eb2..52320e4fe3e 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -37,6 +37,8 @@ #include "event-loop.h" #include "ui-out.h" +#include "main.h" + /* If nonzero, display time usage both at startup and for each command. */ int display_time; @@ -110,12 +112,6 @@ captured_command_loop (void *data) return 1; } -struct captured_main_args - { - int argc; - char **argv; - }; - static int captured_main (void *data) { @@ -399,6 +395,7 @@ extern int gdbtk_test (char *); else baud_rate = i; } + break; case 'l': { int i; @@ -737,12 +734,10 @@ extern int gdbtk_test (char *); } int -main (int argc, char **argv) +gdb_main (struct captured_main_args *args) { - struct captured_main_args args; - args.argc = argc; - args.argv = argv; - catch_errors (captured_main, &args, "", RETURN_MASK_ALL); + use_windows = args->use_windows; + catch_errors (captured_main, args, "", RETURN_MASK_ALL); return 0; } diff --git a/gdb/main.h b/gdb/main.h new file mode 100644 index 00000000000..8ee189e8a9d --- /dev/null +++ b/gdb/main.h @@ -0,0 +1,34 @@ +/* Main interface for GDB, the GNU debugger. + + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef MAIN_H +#define MAIN_H + +struct captured_main_args +{ + int argc; + char **argv; + int use_windows; +}; + +extern int gdb_main (struct captured_main_args *); + +#endif diff --git a/gdb/maint.c b/gdb/maint.c index f09703f7729..6a849f9c871 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -118,8 +118,18 @@ maintenance_dump_me (char *args, int from_tty) static void maintenance_internal_error (char *args, int from_tty) { - internal_error (__FILE__, __LINE__, - "internal maintenance"); + internal_error (__FILE__, __LINE__, "%s", (args == NULL ? "" : args)); +} + +/* Stimulate the internal error mechanism that GDB uses when an + internal problem is detected. Allows testing of the mechanism. + Also useful when the user wants to drop a core file but not exit + GDB. */ + +static void +maintenance_internal_warning (char *args, int from_tty) +{ + internal_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args)); } /* Someday we should allow demangling for things other than just @@ -697,6 +707,11 @@ itself a SIGQUIT signal.", Cause GDB to behave as if an internal error was detected.", &maintenancelist); + add_cmd ("internal-warning", class_maintenance, maintenance_internal_warning, + "Give GDB an internal warning.\n\ +Cause GDB to behave as if an internal warning was reported.", + &maintenancelist); + add_cmd ("demangle", class_maintenance, maintenance_demangle, "Demangle a C++ mangled name.\n\ Call internal GDB demangler routine to demangle a C++ link name\n\ diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index a53aaa00c92..41114b44735 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -27,6 +27,7 @@ #include "gdbcore.h" #include "inferior.h" #include "arch-utils.h" +#include "gdb_string.h" /* Functions declared and used only in this file */ @@ -756,7 +757,7 @@ mcore_find_callers_reg (struct frame_info *fi, int regnum) for (; fi != NULL; fi = fi->next) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else if (fi->saved_regs[regnum] != 0) return read_memory_integer (fi->saved_regs[regnum], REGISTER_SIZE); @@ -772,7 +773,7 @@ mcore_frame_saved_pc (struct frame_info * fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); else return mcore_find_callers_reg (fi, PR_REGNUM); } @@ -1049,7 +1050,7 @@ mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, SP_REGNUM); } else mcore_analyze_prologue (fi, 0, 0); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index d920f8dae86..1695afdf178 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -106,11 +106,6 @@ extern void _initialize_mdebugread (void); struct symloc { - /* Our running best guess as to the range of text addresses for - this psymtab. After we've read everything in, we use this to - build pst->text_addrs. */ - CORE_ADDR textlow, texthigh; - /* Index of the FDR that this psymtab represents. */ int fdr_idx; /* The BFD that the psymtab was created from. */ @@ -126,8 +121,6 @@ struct symloc }; #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private) -#define TEXTLOW(p) (PST_PRIVATE(p)->textlow) -#define TEXTHIGH(p) (PST_PRIVATE(p)->texthigh) #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx) #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd) #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap) @@ -497,19 +490,6 @@ mdebug_build_psymtabs (struct objfile *objfile, parse_partial_symbols (objfile); - /* Take the text ranges the partial symbol scanner computed for each - of the psymtabs and convert it into the canonical form for - psymtabs. */ - { - struct partial_symtab *p; - - ALL_OBJFILE_PSYMTABS (objfile, p) - { - p->textlow = TEXTLOW (p); - p->texthigh = TEXTHIGH (p); - } - } - #if 0 /* Check to make sure file was compiled with -g. If not, warn the user of this limitation. */ @@ -2169,7 +2149,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines, halt = base + fh->cbLine; base += pr->cbLineOffset; - adr = TEXTLOW (pst) + pr->adr - lowest_pdr_addr; + adr = pst->textlow + pr->adr - lowest_pdr_addr; l = adr >> 2; /* in words */ for (lineno = pr->lnLow; base < halt;) @@ -2550,8 +2530,6 @@ parse_partial_symbols (struct objfile *objfile) memset (pst->read_symtab_private, 0, sizeof (struct symloc)); save_pst = pst; - TEXTLOW (pst) = pst->textlow; - TEXTHIGH (pst) = pst->texthigh; FDR_IDX (pst) = f_idx; CUR_BFD (pst) = cur_bfd; DEBUG_SWAP (pst) = debug_swap; @@ -2587,7 +2565,7 @@ parse_partial_symbols (struct objfile *objfile) psymtab_language = prev_language; PST_PRIVATE (pst)->pst_language = psymtab_language; - TEXTHIGH (pst) = TEXTLOW (pst); + pst->texthigh = pst->textlow; /* For stabs-in-ecoff files, the second symbol must be @stab. This symbol is emitted by mips-tfile to signal that the @@ -2654,10 +2632,10 @@ parse_partial_symbols (struct objfile *objfile) /* Kludge for Irix 5.2 zero fh->adr. */ if (!relocatable - && (TEXTLOW (pst) == 0 || procaddr < TEXTLOW (pst))) - TEXTLOW (pst) = procaddr; - if (high > TEXTHIGH (pst)) - TEXTHIGH (pst) = high; + && (pst->textlow == 0 || procaddr < pst->textlow)) + pst->textlow = procaddr; + if (high > pst->texthigh) + pst->texthigh = high; } } else if (sh.st == stStatic) @@ -3231,10 +3209,11 @@ parse_partial_symbols (struct objfile *objfile) case N_ENDM: #ifdef SOFUN_ADDRESS_MAYBE_MISSING - /* Solaris 2 end of module, finish current partial symbol table. - END_PSYMTAB will set TEXTHIGH (pst) to the proper value, which - is necessary if a module compiled without debugging info - follows this module. */ + /* Solaris 2 end of module, finish current partial + symbol table. END_PSYMTAB will set + pst->texthigh to the proper value, which is + necessary if a module compiled without + debugging info follows this module. */ if (pst) { pst = (struct partial_symtab *) 0; @@ -3245,8 +3224,8 @@ parse_partial_symbols (struct objfile *objfile) continue; case N_RBRAC: - if (sh.value > TEXTHIGH (save_pst)) - TEXTHIGH (save_pst) = sh.value; + if (sh.value > save_pst->texthigh) + save_pst->texthigh = sh.value; continue; case N_EINCL: case N_DSLINE: @@ -3413,12 +3392,12 @@ parse_partial_symbols (struct objfile *objfile) /* Kludge for Irix 5.2 zero fh->adr. */ if (!relocatable - && (TEXTLOW (pst) == 0 || procaddr < TEXTLOW (pst))) - TEXTLOW (pst) = procaddr; + && (pst->textlow == 0 || procaddr < pst->textlow)) + pst->textlow = procaddr; high = procaddr + sh.value; - if (high > TEXTHIGH (pst)) - TEXTHIGH (pst) = high; + if (high > pst->texthigh) + pst->texthigh = high; continue; case stStatic: /* Variable */ @@ -3592,16 +3571,16 @@ parse_partial_symbols (struct objfile *objfile) empty and put on the free list. */ fdr_to_pst[f_idx].pst = end_psymtab (save_pst, psymtab_include_list, includes_used, - -1, TEXTHIGH (save_pst), + -1, save_pst->texthigh, dependency_list, dependencies_used, textlow_not_set); includes_used = 0; dependencies_used = 0; - if (objfile->ei.entry_point >= TEXTLOW (save_pst) && - objfile->ei.entry_point < TEXTHIGH (save_pst)) + if (objfile->ei.entry_point >= save_pst->textlow && + objfile->ei.entry_point < save_pst->texthigh) { - objfile->ei.entry_file_lowpc = TEXTLOW (save_pst); - objfile->ei.entry_file_highpc = TEXTHIGH (save_pst); + objfile->ei.entry_file_lowpc = save_pst->textlow; + objfile->ei.entry_file_highpc = save_pst->texthigh; } /* The objfile has its functions reordered if this partial symbol @@ -3617,15 +3596,15 @@ parse_partial_symbols (struct objfile *objfile) other cases. */ save_pst = fdr_to_pst[f_idx].pst; if (save_pst != NULL - && TEXTLOW (save_pst) != 0 + && save_pst->textlow != 0 && !(objfile->flags & OBJF_REORDERED)) { ALL_OBJFILE_PSYMTABS (objfile, pst) { if (save_pst != pst - && TEXTLOW (save_pst) >= TEXTLOW (pst) - && TEXTLOW (save_pst) < TEXTHIGH (pst) - && TEXTHIGH (save_pst) > TEXTHIGH (pst)) + && save_pst->textlow >= pst->textlow + && save_pst->textlow < pst->texthigh + && save_pst->texthigh > pst->texthigh) { objfile->flags |= OBJF_REORDERED; break; @@ -3829,7 +3808,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) /* Do nothing if this is a dummy psymtab. */ if (pst->n_global_syms == 0 && pst->n_static_syms == 0 - && TEXTLOW (pst) == 0 && TEXTHIGH (pst) == 0) + && pst->textlow == 0 && pst->texthigh == 0) return; /* Now read the symbols for this symtab */ @@ -3977,7 +3956,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) if (! last_symtab_ended) { - st = end_symtab (TEXTHIGH (pst), pst->objfile, SECT_OFF_TEXT (pst->objfile)); + st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT (pst->objfile)); end_stabs (); } @@ -4067,7 +4046,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) top_stack->cur_st = st; top_stack->cur_block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (st), STATIC_BLOCK); - BLOCK_START (top_stack->cur_block) = TEXTLOW (pst); + BLOCK_START (top_stack->cur_block) = pst->textlow; BLOCK_END (top_stack->cur_block) = 0; top_stack->blocktype = stFile; top_stack->maxsyms = 2 * f_max; diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index fd8558d728e..d895a044529 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -151,6 +151,31 @@ (mi_init_ui): Remove. (_initialize_mi_main): Remove. No longer needed. +2002-09-29 Andrew Cagney <ac131313@redhat.com> + + * mi-out.c (mi_version): New function. + * mi-out.h (mi_version): Declare. + +2002-09-27 Andrew Cagney <ac131313@redhat.com> + + From 2002-07-12 Mo DeJong <supermo@bayarea.net> + * gdbmi.texinfo (var-evaluate-expression): Note that + var-list-children must be invoked before child variable + values can be evaluated. + +2002-09-26 Elena Zannoni <ezannoni@redhat.com> + + * mi-cmd-disas.c (dump_insns): Add text only output for CLI. + (do_mixed_source_and_assembly): Ditto. + +2002-09-11 Keith Seitz <keiths@redhat.com> + + * mi-main.c (mi_cmd_data_list_register_names): Use cleanups + for the uiout list. Do the cleanups when returning an error. + (mi_cmd_data_list_changed_registers): Ditto. + (mi_cmd_data_list_register_values): Use cleanups for the uiout list + and tuples. Do the cleanups when returning errors. + 2002-07-29 Andrew Cagney <ac131313@redhat.com> * mi-cmd-var.c: Include "gdb_string.h". diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo index e2d6c0fd24e..6efedd32ee3 100644 --- a/gdb/mi/gdbmi.texinfo +++ b/gdb/mi/gdbmi.texinfo @@ -3854,6 +3854,9 @@ for the object: value=@var{value} @end example +Note that one must invoke @code{-var-list-children} for a variable +before the value of a child variable can be evaluated. + @subheading The @code{-var-assign} Command @findex -var-assign diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index 028dc0758f3..168ca171666 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -24,348 +24,9 @@ #include "value.h" #include "mi-cmds.h" #include "mi-getopt.h" -#include "ui-out.h" #include "gdb_string.h" - -/* Disassemble functions. FIXME: these do not really belong here. We - should get rid of all the duplicate code in gdb that does the same - thing: disassemble_command() and the gdbtk variation. */ - -/* This Structure is used in mi_cmd_disassemble. - We need a different sort of line table from the normal one cuz we can't - depend upon implicit line-end pc's for lines to do the - reordering in this function. */ - -struct dis_line_entry -{ - int line; - CORE_ADDR start_pc; - CORE_ADDR end_pc; -}; - -/* This variable determines where memory used for disassembly is read from. */ -int gdb_disassemble_from_exec = -1; - -/* This is the memory_read_func for gdb_disassemble when we are - disassembling from the exec file. */ -static int -gdb_dis_asm_read_memory (bfd_vma memaddr, bfd_byte * myaddr, - unsigned int len, disassemble_info * info) -{ - extern struct target_ops exec_ops; - int res; - - errno = 0; - res = xfer_memory (memaddr, myaddr, len, 0, 0, &exec_ops); - - if (res == len) - return 0; - else if (errno == 0) - return EIO; - else - return errno; -} - -static int -compare_lines (const PTR mle1p, const PTR mle2p) -{ - struct dis_line_entry *mle1, *mle2; - int val; - - mle1 = (struct dis_line_entry *) mle1p; - mle2 = (struct dis_line_entry *) mle2p; - - val = mle1->line - mle2->line; - - if (val != 0) - return val; - - return mle1->start_pc - mle2->start_pc; -} - -static int -dump_insns (disassemble_info * di, CORE_ADDR low, CORE_ADDR high, - int how_many, struct ui_stream *stb) -{ - int num_displayed = 0; - CORE_ADDR pc; - - /* parts of the symbolic representation of the address */ - int unmapped; - char *filename = NULL; - char *name = NULL; - int offset; - int line; - - for (pc = low; pc < high;) - { - QUIT; - if (how_many >= 0) - { - if (num_displayed >= how_many) - break; - else - num_displayed++; - } - ui_out_tuple_begin (uiout, NULL); - ui_out_field_core_addr (uiout, "address", pc); - - if (!build_address_symbolic (pc, 0, &name, &offset, &filename, - &line, &unmapped)) - { - /* We don't care now about line, filename and - unmapped. But we might in the future. */ - ui_out_field_string (uiout, "func-name", name); - ui_out_field_int (uiout, "offset", offset); - } - if (filename != NULL) - xfree (filename); - if (name != NULL) - xfree (name); - - ui_file_rewind (stb->stream); - pc += TARGET_PRINT_INSN (pc, di); - ui_out_field_stream (uiout, "inst", stb); - ui_file_rewind (stb->stream); - ui_out_tuple_end (uiout); - } - return num_displayed; -} - -/* The idea here is to present a source-O-centric view of a - function to the user. This means that things are presented - in source order, with (possibly) out of order assembly - immediately following. */ -static void -do_mixed_source_and_assembly (struct disassemble_info *di, int nlines, - struct linetable_entry *le, - CORE_ADDR low, CORE_ADDR high, - struct symtab *symtab, - int how_many, struct ui_stream *stb) -{ - int newlines = 0; - struct dis_line_entry *mle; - struct symtab_and_line sal; - int i; - int out_of_order = 0; - int next_line = 0; - CORE_ADDR pc; - int num_displayed = 0; - - mle = (struct dis_line_entry *) alloca (nlines - * sizeof (struct dis_line_entry)); - - /* Copy linetable entries for this function into our data - structure, creating end_pc's and setting out_of_order as - appropriate. */ - - /* First, skip all the preceding functions. */ - - for (i = 0; i < nlines - 1 && le[i].pc < low; i++); - - /* Now, copy all entries before the end of this function. */ - - for (; i < nlines - 1 && le[i].pc < high; i++) - { - if (le[i].line == le[i + 1].line && le[i].pc == le[i + 1].pc) - continue; /* Ignore duplicates */ - - /* Skip any end-of-function markers. */ - if (le[i].line == 0) - continue; - - mle[newlines].line = le[i].line; - if (le[i].line > le[i + 1].line) - out_of_order = 1; - mle[newlines].start_pc = le[i].pc; - mle[newlines].end_pc = le[i + 1].pc; - newlines++; - } - - /* If we're on the last line, and it's part of the function, - then we need to get the end pc in a special way. */ - - if (i == nlines - 1 && le[i].pc < high) - { - mle[newlines].line = le[i].line; - mle[newlines].start_pc = le[i].pc; - sal = find_pc_line (le[i].pc, 0); - mle[newlines].end_pc = sal.end; - newlines++; - } - - /* Now, sort mle by line #s (and, then by addresses within - lines). */ - - if (out_of_order) - qsort (mle, newlines, sizeof (struct dis_line_entry), compare_lines); - - /* Now, for each line entry, emit the specified lines (unless - they have been emitted before), followed by the assembly code - for that line. */ - - ui_out_list_begin (uiout, "asm_insns"); - - for (i = 0; i < newlines; i++) - { - int close_list = 1; - /* Print out everything from next_line to the current line. */ - if (mle[i].line >= next_line) - { - if (next_line != 0) - { - /* Just one line to print. */ - if (next_line == mle[i].line) - { - ui_out_tuple_begin (uiout, "src_and_asm_line"); - print_source_lines (symtab, next_line, mle[i].line + 1, 0); - } - else - { - /* Several source lines w/o asm instructions associated. */ - for (; next_line < mle[i].line; next_line++) - { - ui_out_tuple_begin (uiout, "src_and_asm_line"); - print_source_lines (symtab, next_line, next_line + 1, - 0); - ui_out_list_begin (uiout, "line_asm_insn"); - ui_out_list_end (uiout); - ui_out_tuple_end (uiout); - } - /* Print the last line and leave list open for - asm instructions to be added. */ - ui_out_tuple_begin (uiout, "src_and_asm_line"); - print_source_lines (symtab, next_line, mle[i].line + 1, 0); - } - } - else - { - ui_out_tuple_begin (uiout, "src_and_asm_line"); - print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0); - } - - next_line = mle[i].line + 1; - ui_out_list_begin (uiout, "line_asm_insn"); - /* Don't close the list if the lines are not in order. */ - if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line) - close_list = 0; - } - - num_displayed += dump_insns (di, mle[i].start_pc, mle[i].end_pc, - how_many, stb); - if (close_list) - { - ui_out_list_end (uiout); - ui_out_tuple_end (uiout); - close_list = 0; - } - if (how_many >= 0) - if (num_displayed >= how_many) - break; - } - ui_out_list_end (uiout); -} - - -static void -do_assembly_only (disassemble_info * di, CORE_ADDR low, - CORE_ADDR high, int how_many, struct ui_stream *stb) -{ - int num_displayed = 0; - - ui_out_list_begin (uiout, "asm_insns"); - - num_displayed = dump_insns (di, low, high, how_many, stb); - - ui_out_list_end (uiout); -} - -enum mi_cmd_result -do_disassembly (char *file_string, - int line_num, - int mixed_source_and_assembly, - int how_many, CORE_ADDR low, CORE_ADDR high) -{ - static disassemble_info di; - static int di_initialized; - /* To collect the instruction outputted from opcodes. */ - static struct ui_stream *stb = NULL; - struct symtab *symtab = NULL; - struct linetable_entry *le = NULL; - int nlines = -1; - - if (!di_initialized) - { - /* We don't add a cleanup for this, because the allocation of - the stream is done once only for each gdb run, and we need to - keep it around until the end. Hopefully there won't be any - errors in the init code below, that make this function bail - out. */ - stb = ui_out_stream_new (uiout); - INIT_DISASSEMBLE_INFO_NO_ARCH (di, stb->stream, - (fprintf_ftype) fprintf_unfiltered); - di.flavour = bfd_target_unknown_flavour; - di.memory_error_func = dis_asm_memory_error; - di.print_address_func = dis_asm_print_address; - di_initialized = 1; - } - - di.mach = TARGET_PRINT_INSN_INFO->mach; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - di.endian = BFD_ENDIAN_BIG; - else - di.endian = BFD_ENDIAN_LITTLE; - - /* If gdb_disassemble_from_exec == -1, then we use the following heuristic to - determine whether or not to do disassembly from target memory or from the - exec file: - - If we're debugging a local process, read target memory, instead of the - exec file. This makes disassembly of functions in shared libs work - correctly. Also, read target memory if we are debugging native threads. - - Else, we're debugging a remote process, and should disassemble from the - exec file for speed. However, this is no good if the target modifies its - code (for relocation, or whatever). */ - - if (gdb_disassemble_from_exec == -1) - { - if (strcmp (target_shortname, "child") == 0 - || strcmp (target_shortname, "procfs") == 0 - || strcmp (target_shortname, "vxprocess") == 0 - || strstr (target_shortname, "-threads") != NULL) - gdb_disassemble_from_exec = 0; /* It's a child process, read inferior mem */ - else - gdb_disassemble_from_exec = 1; /* It's remote, read the exec file */ - } - - if (gdb_disassemble_from_exec) - di.read_memory_func = gdb_dis_asm_read_memory; - else - di.read_memory_func = dis_asm_read_memory; - - /* Assume symtab is valid for whole PC range */ - symtab = find_pc_symtab (low); - - if (symtab != NULL && symtab->linetable != NULL) - { - /* Convert the linetable to a bunch of my_line_entry's. */ - le = symtab->linetable->item; - nlines = symtab->linetable->nitems; - } - - if (!mixed_source_and_assembly || nlines <= 0 - || symtab == NULL || symtab->linetable == NULL) - do_assembly_only (&di, low, high, how_many, stb); - - else if (mixed_source_and_assembly) - do_mixed_source_and_assembly (&di, nlines, le, low, - high, symtab, how_many, stb); - - gdb_flush (gdb_stdout); - - return MI_CMD_DONE; -} +#include "ui-out.h" +#include "disasm.h" /* The arguments to be passed on the command line and parsed here are: @@ -493,8 +154,10 @@ mi_cmd_disassemble (char *command, char **argv, int argc) error ("mi_cmd_disassemble: No function contains specified address"); } - retval = do_disassembly (file_string, - line_num, - mixed_source_and_assembly, how_many, low, high); - return retval; + gdb_disassembly (uiout, + file_string, + line_num, + mixed_source_and_assembly, how_many, low, high); + + return MI_CMD_DONE; } diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index ef695aae51f..533c2fbd9c4 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -282,7 +282,8 @@ enum mi_cmd_result mi_cmd_data_list_register_names (char *command, char **argv, int argc) { int regnum, numregs; - int i, numbers; + int i; + struct cleanup *cleanup; /* Note that the test for a valid register must include checking the REGISTER_NAME because NUM_REGS may be allocated for the union of @@ -291,28 +292,8 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc) the particular processor being debugged. */ numregs = NUM_REGS + NUM_PSEUDO_REGS; - numbers = 0; - if (!gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0) - && !gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1) - && argc > 0 && *argv[0] == '-') - { - if (strncmp (argv[0], "-numbers", strlen (argv[0])) == 0) - { - numbers = 1; - --argc; - ++argv; - } - else - { - xasprintf (&mi_error_message, - "mi_cmd_data_list_register_names: invalid option \"%s\"", - argv[0]); - return MI_CMD_ERROR; - } - } - - ui_out_list_begin (uiout, "register-names"); + cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-names"); if (argc == 0) /* No args, just do all the regs */ { @@ -324,17 +305,7 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc) || *(REGISTER_NAME (regnum)) == '\0') ui_out_field_string (uiout, NULL, ""); else - { - if (numbers) - { - ui_out_tuple_begin (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - ui_out_field_string (uiout, "name", REGISTER_NAME (regnum)); - ui_out_tuple_end (uiout); - } - else - ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum)); - } + ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum)); } } @@ -344,36 +315,17 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc) regnum = atoi (argv[i]); if (regnum < 0 || regnum >= numregs) { + do_cleanups (cleanup); xasprintf (&mi_error_message, "bad register number"); return MI_CMD_ERROR; } if (REGISTER_NAME (regnum) == NULL || *(REGISTER_NAME (regnum)) == '\0') - { - if (numbers) - { - ui_out_tuple_begin (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - ui_out_field_string (uiout, "name", ""); - ui_out_tuple_end (uiout); - } - else - ui_out_field_string (uiout, NULL, ""); - } + ui_out_field_string (uiout, NULL, ""); else - { - if (numbers) - { - ui_out_tuple_begin (uiout, NULL); - ui_out_field_int (uiout, "number", regnum); - ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum)); - ui_out_tuple_end (uiout); - } - else - ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum)); - } + ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum)); } - ui_out_list_end (uiout); + do_cleanups (cleanup); return MI_CMD_DONE; } @@ -382,6 +334,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) { int regnum, numregs, changed; int i; + struct cleanup *cleanup; /* Note that the test for a valid register must include checking the REGISTER_NAME because NUM_REGS may be allocated for the union of @@ -391,7 +344,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) numregs = NUM_REGS; - ui_out_list_begin (uiout, "changed-registers"); + cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changed-registers"); if (argc == 0) /* No args, just do all the regs */ { @@ -405,6 +358,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) changed = register_changed_p (regnum); if (changed < 0) { + do_cleanups (cleanup); xasprintf (&mi_error_message, "mi_cmd_data_list_changed_registers: Unable to read register contents."); return MI_CMD_ERROR; @@ -427,6 +381,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) changed = register_changed_p (regnum); if (changed < 0) { + do_cleanups (cleanup); xasprintf (&mi_error_message, "mi_cmd_data_list_register_change: Unable to read register contents."); return MI_CMD_ERROR; @@ -436,11 +391,12 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc) } else { + do_cleanups (cleanup); xasprintf (&mi_error_message, "bad register number"); return MI_CMD_ERROR; } } - ui_out_list_end (uiout); + do_cleanups (cleanup); return MI_CMD_DONE; } @@ -476,6 +432,7 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc) { int regnum, numregs, format, result; int i; + struct cleanup *list_cleanup, *tuple_cleanup; /* Note that the test for a valid register must include checking the REGISTER_NAME because NUM_REGS may be allocated for the union of @@ -501,7 +458,7 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc) return MI_CMD_ERROR; } - ui_out_list_begin (uiout, "register-values"); + list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values"); if (argc == 1) /* No args, beside the format: do all the regs */ { @@ -512,12 +469,15 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc) if (REGISTER_NAME (regnum) == NULL || *(REGISTER_NAME (regnum)) == '\0') continue; - ui_out_tuple_begin (uiout, NULL); + tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); ui_out_field_int (uiout, "number", regnum); result = get_register (regnum, format); if (result == -1) - return MI_CMD_ERROR; - ui_out_tuple_end (uiout); + { + do_cleanups (list_cleanup); + return MI_CMD_ERROR; + } + do_cleanups (tuple_cleanup); } } @@ -531,20 +491,24 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc) && REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != '\000') { - ui_out_tuple_begin (uiout, NULL); + tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); ui_out_field_int (uiout, "number", regnum); result = get_register (regnum, format); if (result == -1) - return MI_CMD_ERROR; - ui_out_tuple_end (uiout); + { + do_cleanups (list_cleanup); + return MI_CMD_ERROR; + } + do_cleanups (tuple_cleanup); } else { + do_cleanups (list_cleanup); xasprintf (&mi_error_message, "bad register number"); return MI_CMD_ERROR; } } - ui_out_list_end (uiout); + do_cleanups (list_cleanup); return MI_CMD_DONE; } diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 947720bc10c..f7ed7ecfbdc 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -428,6 +428,15 @@ mi_out_put (struct ui_out *uiout, ui_file_rewind (data->buffer); } +/* Current MI version. */ + +int +mi_version (struct ui_out *uiout) +{ + struct ui_out_data *data = ui_out_data (uiout); + return data->mi_version; +} + /* initalize private members at startup */ struct ui_out * diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index 1ae693f4761..817f2eb53b9 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -30,4 +30,7 @@ extern void mi_out_put (struct ui_out *uiout, struct ui_file *stream); extern void mi_out_rewind (struct ui_out *uiout); extern void mi_out_buffered (struct ui_out *uiout, char *string); +/* Return the version number of the current MI. */ +extern int mi_version (struct ui_out *uiout); + #endif /* MI_OUT_H */ diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index cec16d3175f..454520d35e7 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -1,5 +1,6 @@ /* Native-dependent code for GNU/Linux on MIPS processors. - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -28,9 +29,7 @@ int mips_linux_cannot_fetch_register (int regno) { - if (regno >= FP_REGNUM) - return 1; - else if (regno == PS_REGNUM) + if (regno == PS_REGNUM) return 1; else if (regno == ZERO_REGNUM) return 1; @@ -41,9 +40,7 @@ mips_linux_cannot_fetch_register (int regno) int mips_linux_cannot_store_register (int regno) { - if (regno >= FP_REGNUM) - return 1; - else if (regno == PS_REGNUM) + if (regno == PS_REGNUM) return 1; else if (regno == ZERO_REGNUM) return 1; diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index b8d41db2e3b..03279d8098a 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -1,5 +1,6 @@ /* Target-dependent code for GNU/Linux on MIPS processors. - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -100,7 +101,6 @@ supply_gregset (elf_gregset_t *gregsetp) supply_register (CAUSE_REGNUM, (char *)(regp + EF_CP0_CAUSE)); /* Fill inaccessible registers with zero. */ - supply_register (FP_REGNUM, zerobuf); supply_register (UNUSED_REGNUM, zerobuf); for (regi = FIRST_EMBED_REGNUM; regi < LAST_EMBED_REGNUM; regi++) supply_register (regi, zerobuf); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 58e1a8b128d..95b288ce6da 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -388,7 +388,7 @@ char *mips_r3041_reg_names[] = { "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - "fsr", "fir", "fp", "", + "fsr", "fir", "",/*"fp"*/ "", "", "", "bus", "ccfg", "", "", "", "", "", "", "port", "cmp", "", "", "epc", "prid", }; @@ -405,7 +405,7 @@ char *mips_r3051_reg_names[] = { "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - "fsr", "fir", "fp", "", + "fsr", "fir", ""/*"fp"*/, "", "inx", "rand", "elo", "", "ctxt", "", "", "", "", "", "ehi", "", "", "", "epc", "prid", }; @@ -422,7 +422,7 @@ char *mips_r3081_reg_names[] = { "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - "fsr", "fir", "fp", "", + "fsr", "fir", ""/*"fp"*/, "", "inx", "rand", "elo", "cfg", "ctxt", "", "", "", "", "", "ehi", "", "", "", "epc", "prid", }; @@ -1589,21 +1589,29 @@ mips_frame_init_saved_regs (struct frame_info *frame) static CORE_ADDR read_next_frame_reg (struct frame_info *fi, int regno) { - for (; fi; fi = fi->next) + int optimized; + CORE_ADDR addr; + int realnum; + enum lval_type lval; + void *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); + frame_register_unwind (fi, regno, &optimized, &lval, &addr, &realnum, + raw_buffer); + /* FIXME: cagney/2002-09-13: This is just soooo bad. The MIPS + should have a pseudo register range that correspons to the ABI's, + rather than the ISA's, view of registers. These registers would + then implicitly describe their size and hence could be used + without the below munging. */ + if (lval == lval_memory) { - /* We have to get the saved sp from the sigcontext - if it is a signal handler frame. */ - if (regno == SP_REGNUM && !fi->signal_handler_caller) - return fi->frame; - else + if (regno < 32) { - if (fi->saved_regs == NULL) - FRAME_INIT_SAVED_REGS (fi); - if (fi->saved_regs[regno]) - return read_memory_integer (ADDR_BITS_REMOVE (fi->saved_regs[regno]), MIPS_SAVED_REGSIZE); + /* Only MIPS_SAVED_REGSIZE bytes of GP registers are + saved. */ + return read_memory_integer (addr, MIPS_SAVED_REGSIZE); } } - return read_signed_register (regno); + + return extract_signed_integer (raw_buffer, REGISTER_VIRTUAL_SIZE (regno)); } /* mips_addr_bits_remove - remove useless address bits */ @@ -2328,7 +2336,7 @@ static mips_extra_func_info_t find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int cur_frame) { mips_extra_func_info_t proc_desc; - CORE_ADDR startaddr; + CORE_ADDR startaddr = 0; proc_desc = non_heuristic_proc_desc (pc, &startaddr); @@ -2576,6 +2584,14 @@ mips_type_needs_double_align (struct type *type) #define ROUND_DOWN(n,a) ((n) & ~((a)-1)) #define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1)) +/* Adjust the address downward (direction of stack growth) so that it + is correctly aligned for a new stack frame. */ +static CORE_ADDR +mips_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + return ROUND_DOWN (addr, 16); +} + static CORE_ADDR mips_eabi_push_arguments (int nargs, struct value **args, @@ -2955,10 +2971,6 @@ mips_n32n64_push_arguments (int nargs, typecode == TYPE_CODE_PTR || typecode == TYPE_CODE_FLT) && len <= 4) longword_offset = MIPS_STACK_ARGSIZE - len; - else if ((typecode == TYPE_CODE_STRUCT || - typecode == TYPE_CODE_UNION) && - TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE) - longword_offset = MIPS_STACK_ARGSIZE - len; } if (mips_debug) @@ -3778,13 +3790,21 @@ mips_pop_frame (void) if (frame->saved_regs == NULL) FRAME_INIT_SAVED_REGS (frame); for (regnum = 0; regnum < NUM_REGS; regnum++) - { - if (regnum != SP_REGNUM && regnum != PC_REGNUM - && frame->saved_regs[regnum]) - write_register (regnum, - read_memory_integer (frame->saved_regs[regnum], - MIPS_SAVED_REGSIZE)); - } + if (regnum != SP_REGNUM && regnum != PC_REGNUM + && frame->saved_regs[regnum]) + { + /* Floating point registers must not be sign extended, + in case MIPS_SAVED_REGSIZE = 4 but sizeof (FP0_REGNUM) == 8. */ + + if (FP0_REGNUM <= regnum && regnum < FP0_REGNUM + 32) + write_register (regnum, + read_memory_unsigned_integer (frame->saved_regs[regnum], + MIPS_SAVED_REGSIZE)); + else + write_register (regnum, + read_memory_integer (frame->saved_regs[regnum], + MIPS_SAVED_REGSIZE)); + } write_register (SP_REGNUM, new_sp); flush_cached_frames (); @@ -4906,12 +4926,15 @@ mips_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) } static CORE_ADDR -mips_extract_struct_value_address (struct regcache *ignore) +mips_extract_struct_value_address (struct regcache *regcache) { /* FIXME: This will only work at random. The caller passes the struct_return address in V0, but it is not preserved. It may still be there, or this may be a random value. */ - return read_register (V0_REGNUM); + LONGEST val; + + regcache_cooked_read_signed (regcache, V0_REGNUM, &val); + return val; } /* Exported procedure: Is PC in the signal trampoline code */ @@ -5427,59 +5450,47 @@ mips_coerce_float_to_double (struct type *formal, struct type *actual) static void mips_get_saved_register (char *raw_buffer, - int *optimized, + int *optimizedp, CORE_ADDR *addrp, struct frame_info *frame, int regnum, - enum lval_type *lval) + enum lval_type *lvalp) { - CORE_ADDR addr; + CORE_ADDR addrx; + enum lval_type lvalx; + int optimizedx; + int realnum; if (!target_has_registers) error ("No registers."); - /* Normal systems don't optimize out things with register numbers. */ - if (optimized != NULL) - *optimized = 0; - addr = find_saved_register (frame, regnum); - if (addr != 0) + /* Make certain that all needed parameters are present. */ + if (addrp == NULL) + addrp = &addrx; + if (lvalp == NULL) + lvalp = &lvalx; + if (optimizedp == NULL) + optimizedp = &optimizedx; + frame_register_unwind (get_next_frame (frame), regnum, optimizedp, lvalp, + addrp, &realnum, raw_buffer); + /* FIXME: cagney/2002-09-13: This is just so bad. The MIPS should + have a pseudo register range that correspons to the ABI's, rather + than the ISA's, view of registers. These registers would then + implicitly describe their size and hence could be used without + the below munging. */ + if ((*lvalp) == lval_memory) { - if (lval != NULL) - *lval = lval_memory; - if (regnum == SP_REGNUM) - { - if (raw_buffer != NULL) - { - /* Put it back in target format. */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - (LONGEST) addr); - } - if (addrp != NULL) - *addrp = 0; - return; - } if (raw_buffer != NULL) { - LONGEST val; if (regnum < 32) - /* Only MIPS_SAVED_REGSIZE bytes of GP registers are - saved. */ - val = read_memory_integer (addr, MIPS_SAVED_REGSIZE); - else - val = read_memory_integer (addr, REGISTER_RAW_SIZE (regnum)); - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), val); + { + /* Only MIPS_SAVED_REGSIZE bytes of GP registers are + saved. */ + LONGEST val = read_memory_integer ((*addrp), MIPS_SAVED_REGSIZE); + store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), val); + } } } - else - { - if (lval != NULL) - *lval = lval_register; - addr = REGISTER_BYTE (regnum); - if (raw_buffer != NULL) - read_register_gen (regnum, raw_buffer); - } - if (addrp != NULL) - *addrp = addr; } /* Immediately after a function call, return the saved pc. @@ -5920,7 +5931,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_register_name (gdbarch, mips_register_name); set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_fp (gdbarch, generic_target_read_fp); + set_gdbarch_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ set_gdbarch_read_sp (gdbarch, mips_read_sp); set_gdbarch_write_sp (gdbarch, generic_target_write_sp); @@ -5960,6 +5971,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words)); set_gdbarch_push_return_address (gdbarch, mips_push_return_address); + set_gdbarch_frame_align (gdbarch, mips_frame_align); set_gdbarch_register_convertible (gdbarch, mips_register_convertible); set_gdbarch_register_convert_to_virtual (gdbarch, mips_register_convert_to_virtual); diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index 029ae6f28bc..73ba3847ba4 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -26,6 +26,7 @@ #include "value.h" #include "osabi.h" +#include "nbsd-tdep.h" #include "mipsnbsd-tdep.h" #include "solib-svr4.h" @@ -219,7 +220,8 @@ mipsnbsd_sigtramp_offset (CORE_ADDR pc) static int mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) { - return (mipsnbsd_sigtramp_offset (pc) >= 0); + return (nbsd_pc_in_sigtramp (pc, func_name) + || mipsnbsd_sigtramp_offset (pc) >= 0); } /* Figure out where the longjmp will land. We expect that we have @@ -256,16 +258,14 @@ mipsnbsd_get_longjmp_target (CORE_ADDR *pc) static int mipsnbsd_cannot_fetch_register (int regno) { - return (regno >= FP_REGNUM - || regno == ZERO_REGNUM + return (regno == ZERO_REGNUM || regno == FCRIR_REGNUM); } static int mipsnbsd_cannot_store_register (int regno) { - return (regno >= FP_REGNUM - || regno == ZERO_REGNUM + return (regno == ZERO_REGNUM || regno == FCRIR_REGNUM); } diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c index 71e229d57b0..a2d8f7d1533 100644 --- a/gdb/nbsd-tdep.c +++ b/gdb/nbsd-tdep.c @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "gdb_string.h" #include "solib-svr4.h" /* Fetch (and possibly build) an appropriate link_map_offsets @@ -96,3 +97,13 @@ nbsd_lp64_solib_svr4_fetch_link_map_offsets (void) return lmp; } + +int +nbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + /* Check for libc-provided signal trampoline. All such trampolines + have function names which begin with "__sigtramp". */ + + return (func_name != NULL + && strncmp (func_name, "__sigtramp", 10) == 0); +} diff --git a/gdb/nbsd-tdep.h b/gdb/nbsd-tdep.h index ca40965184f..9d26ae9f859 100644 --- a/gdb/nbsd-tdep.h +++ b/gdb/nbsd-tdep.h @@ -25,4 +25,6 @@ struct link_map_offsets *nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void); struct link_map_offsets *nbsd_lp64_solib_svr4_fetch_link_map_offsets (void); +int nbsd_pc_in_sigtramp (CORE_ADDR, char *); + #endif /* NBSD_TDEP_H */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 58c2e13c10c..e60b1c0ef36 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -30,6 +30,7 @@ #include "arch-utils.h" #include "ns32k-tdep.h" +#include "gdb_string.h" static int sign_extend (int value, int bits); static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); diff --git a/gdb/ns32knbsd-tdep.c b/gdb/ns32knbsd-tdep.c index 1ca0b3b39ac..d5ec8282453 100644 --- a/gdb/ns32knbsd-tdep.c +++ b/gdb/ns32knbsd-tdep.c @@ -22,6 +22,7 @@ #include "defs.h" #include "ns32k-tdep.h" +#include "gdb_string.h" static int ns32knbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name) diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y new file mode 100644 index 00000000000..54b99b00610 --- /dev/null +++ b/gdb/objc-exp.y @@ -0,0 +1,1841 @@ +/* YACC parser for C expressions, for GDB. + + Copyright 1986, 1989, 1990, 1991, 1993, 1994, 2002 Free Software + Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Parse a C expression from text in a string, and return the result + as a struct expression pointer. That structure contains arithmetic + operations in reverse polish, with constants represented by + operations that are followed by special data. See expression.h for + the details of the format. What is important here is that it can + be built up sequentially during the process of parsing; the lower + levels of the tree always come first in the result. + + Note that malloc's and realloc's in this file are transformed to + xmalloc and xrealloc respectively by the same sed command in the + makefile that remaps any other malloc/realloc inserted by the + parser generator. Doing this with #defines and trying to control + the interaction with include files (<malloc.h> and <stdlib.h> for + example) just became too messy, particularly when such includes can + be inserted at random times by the parser generator. */ + +%{ + +#include "defs.h" +#include "gdb_string.h" +#include <ctype.h> +#include "expression.h" + +#include "objc-lang.h" /* For objc language constructs. */ + +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "c-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */ +#include "top.h" +#include "completer.h" /* For skip_quoted(). */ + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc), as well as gratuitiously global symbol names, so we can have + multiple yacc generated parsers in gdb. Note that these are only + the variables produced by yacc. If other parser generators (bison, + byacc, etc) produce additional global names that conflict at link + time, then those parser generators need to be fixed instead of + adding those names to this list. */ + +#define yymaxdepth objc_maxdepth +#define yyparse objc_parse +#define yylex objc_lex +#define yyerror objc_error +#define yylval objc_lval +#define yychar objc_char +#define yydebug objc_debug +#define yypact objc_pact +#define yyr1 objc_r1 +#define yyr2 objc_r2 +#define yydef objc_def +#define yychk objc_chk +#define yypgo objc_pgo +#define yyact objc_act +#define yyexca objc_exca +#define yyerrflag objc_errflag +#define yynerrs objc_nerrs +#define yyps objc_ps +#define yypv objc_pv +#define yys objc_s +#define yy_yys objc_yys +#define yystate objc_state +#define yytmp objc_tmp +#define yyv objc_v +#define yy_yyv objc_yyv +#define yyval objc_val +#define yylloc objc_lloc +#define yyreds objc_reds /* With YYDEBUG defined */ +#define yytoks objc_toks /* With YYDEBUG defined */ +#define yyname objc_name /* With YYDEBUG defined */ +#define yyrule objc_rule /* With YYDEBUG defined */ +#define yylhs objc_yylhs +#define yylen objc_yylen +#define yydefred objc_yydefred +#define yydgoto objc_yydgoto +#define yysindex objc_yysindex +#define yyrindex objc_yyrindex +#define yygindex objc_yygindex +#define yytable objc_yytable +#define yycheck objc_yycheck + +#ifndef YYDEBUG +#define YYDEBUG 0 /* Default to no yydebug support. */ +#endif + +int +yyparse PARAMS ((void)); + +static int +yylex PARAMS ((void)); + +void +yyerror PARAMS ((char *)); + +%} + +/* Although the yacc "value" of an expression is not used, + since the result is stored in the structure being created, + other node types do have values. */ + +%union + { + LONGEST lval; + struct { + LONGEST val; + struct type *type; + } typed_val_int; + struct { + DOUBLEST dval; + struct type *type; + } typed_val_float; + struct symbol *sym; + struct type *tval; + struct stoken sval; + struct ttype tsym; + struct symtoken ssym; + int voidval; + struct block *bval; + enum exp_opcode opcode; + struct internalvar *ivar; + struct objc_class_str class; + + struct type **tvec; + int *ivec; + } + +%{ +/* YYSTYPE gets defined by %union. */ +static int +parse_number PARAMS ((char *, int, int, YYSTYPE *)); +%} + +%type <voidval> exp exp1 type_exp start variable qualified_name lcurly +%type <lval> rcurly +%type <tval> type typebase +%type <tvec> nonempty_typelist +/* %type <bval> block */ + +/* Fancy type parsing. */ +%type <voidval> func_mod direct_abs_decl abs_decl +%type <tval> ptype +%type <lval> array_mod + +%token <typed_val_int> INT +%token <typed_val_float> FLOAT + +/* Both NAME and TYPENAME tokens represent symbols in the input, and + both convey their data as strings. But a TYPENAME is a string that + happens to be defined as a typedef or builtin type name (such as + int or char) and a NAME is any other symbol. Contexts where this + distinction is not important can use the nonterminal "name", which + matches either NAME or TYPENAME. */ + +%token <sval> STRING +%token <sval> NSSTRING /* ObjC Foundation "NSString" literal */ +%token <sval> SELECTOR /* ObjC "@selector" pseudo-operator */ +%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */ +%token <tsym> TYPENAME +%token <class> CLASSNAME /* ObjC Class name */ +%type <sval> name +%type <ssym> name_not_typename +%type <tsym> typename + +/* A NAME_OR_INT is a symbol which is not known in the symbol table, + but which would parse as a valid number in the current input radix. + E.g. "c" when input_radix==16. Depending on the parse, it will be + turned into a name or into a number. */ + +%token <ssym> NAME_OR_INT + +%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON +%token TEMPLATE +%token ERROR + +/* Special type cases, put in to allow the parser to distinguish + different legal basetypes. */ +%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD + +%token <voidval> VARIABLE + +%token <opcode> ASSIGN_MODIFY + +/* C++ */ +%token THIS + +%left ',' +%left ABOVE_COMMA +%right '=' ASSIGN_MODIFY +%right '?' +%left OROR +%left ANDAND +%left '|' +%left '^' +%left '&' +%left EQUAL NOTEQUAL +%left '<' '>' LEQ GEQ +%left LSH RSH +%left '@' +%left '+' '-' +%left '*' '/' '%' +%right UNARY INCREMENT DECREMENT +%right ARROW '.' '[' '(' +%token <ssym> BLOCKNAME +%type <bval> block +%left COLONCOLON + + +%% + +start : exp1 + | type_exp + ; + +type_exp: type + { write_exp_elt_opcode(OP_TYPE); + write_exp_elt_type($1); + write_exp_elt_opcode(OP_TYPE);} + ; + +/* Expressions, including the comma operator. */ +exp1 : exp + | exp1 ',' exp + { write_exp_elt_opcode (BINOP_COMMA); } + ; + +/* Expressions, not including the comma operator. */ +exp : '*' exp %prec UNARY + { write_exp_elt_opcode (UNOP_IND); } + +exp : '&' exp %prec UNARY + { write_exp_elt_opcode (UNOP_ADDR); } + +exp : '-' exp %prec UNARY + { write_exp_elt_opcode (UNOP_NEG); } + ; + +exp : '!' exp %prec UNARY + { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } + ; + +exp : '~' exp %prec UNARY + { write_exp_elt_opcode (UNOP_COMPLEMENT); } + ; + +exp : INCREMENT exp %prec UNARY + { write_exp_elt_opcode (UNOP_PREINCREMENT); } + ; + +exp : DECREMENT exp %prec UNARY + { write_exp_elt_opcode (UNOP_PREDECREMENT); } + ; + +exp : exp INCREMENT %prec UNARY + { write_exp_elt_opcode (UNOP_POSTINCREMENT); } + ; + +exp : exp DECREMENT %prec UNARY + { write_exp_elt_opcode (UNOP_POSTDECREMENT); } + ; + +exp : SIZEOF exp %prec UNARY + { write_exp_elt_opcode (UNOP_SIZEOF); } + ; + +exp : exp ARROW name + { write_exp_elt_opcode (STRUCTOP_PTR); + write_exp_string ($3); + write_exp_elt_opcode (STRUCTOP_PTR); } + ; + +exp : exp ARROW qualified_name + { /* exp->type::name becomes exp->*(&type::name) */ + /* Note: this doesn't work if name is a + static member! FIXME */ + write_exp_elt_opcode (UNOP_ADDR); + write_exp_elt_opcode (STRUCTOP_MPTR); } + ; +exp : exp ARROW '*' exp + { write_exp_elt_opcode (STRUCTOP_MPTR); } + ; + +exp : exp '.' name + { write_exp_elt_opcode (STRUCTOP_STRUCT); + write_exp_string ($3); + write_exp_elt_opcode (STRUCTOP_STRUCT); } + ; + + +exp : exp '.' qualified_name + { /* exp.type::name becomes exp.*(&type::name) */ + /* Note: this doesn't work if name is a + static member! FIXME */ + write_exp_elt_opcode (UNOP_ADDR); + write_exp_elt_opcode (STRUCTOP_MEMBER); } + ; + +exp : exp '.' '*' exp + { write_exp_elt_opcode (STRUCTOP_MEMBER); } + ; + +exp : exp '[' exp1 ']' + { write_exp_elt_opcode (BINOP_SUBSCRIPT); } + ; +/* + * The rules below parse ObjC message calls of the form: + * '[' target selector {':' argument}* ']' + */ + +exp : '[' TYPENAME + { + CORE_ADDR class; + + class = lookup_objc_class (copy_name ($2.stoken)); + if (class == 0) + error ("%s is not an ObjC Class", + copy_name ($2.stoken)); + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (builtin_type_int); + write_exp_elt_longcst ((LONGEST) class); + write_exp_elt_opcode (OP_LONG); + start_msglist(); + } + msglist ']' + { write_exp_elt_opcode (OP_MSGCALL); + end_msglist(); + write_exp_elt_opcode (OP_MSGCALL); + } + ; + +exp : '[' CLASSNAME + { + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (builtin_type_int); + write_exp_elt_longcst ((LONGEST) $2.class); + write_exp_elt_opcode (OP_LONG); + start_msglist(); + } + msglist ']' + { write_exp_elt_opcode (OP_MSGCALL); + end_msglist(); + write_exp_elt_opcode (OP_MSGCALL); + } + ; + +exp : '[' exp + { start_msglist(); } + msglist ']' + { write_exp_elt_opcode (OP_MSGCALL); + end_msglist(); + write_exp_elt_opcode (OP_MSGCALL); + } + ; + +msglist : name + { add_msglist(&$1, 0); } + | msgarglist + ; + +msgarglist : msgarg + | msgarglist msgarg + ; + +msgarg : name ':' exp + { add_msglist(&$1, 1); } + | ':' exp /* Unnamed arg. */ + { add_msglist(0, 1); } + | ',' exp /* Variable number of args. */ + { add_msglist(0, 0); } + ; + +exp : exp '(' + /* This is to save the value of arglist_len + being accumulated by an outer function call. */ + { start_arglist (); } + arglist ')' %prec ARROW + { write_exp_elt_opcode (OP_FUNCALL); + write_exp_elt_longcst ((LONGEST) end_arglist ()); + write_exp_elt_opcode (OP_FUNCALL); } + ; + +lcurly : '{' + { start_arglist (); } + ; + +arglist : + ; + +arglist : exp + { arglist_len = 1; } + ; + +arglist : arglist ',' exp %prec ABOVE_COMMA + { arglist_len++; } + ; + +rcurly : '}' + { $$ = end_arglist () - 1; } + ; +exp : lcurly arglist rcurly %prec ARROW + { write_exp_elt_opcode (OP_ARRAY); + write_exp_elt_longcst ((LONGEST) 0); + write_exp_elt_longcst ((LONGEST) $3); + write_exp_elt_opcode (OP_ARRAY); } + ; + +exp : lcurly type rcurly exp %prec UNARY + { write_exp_elt_opcode (UNOP_MEMVAL); + write_exp_elt_type ($2); + write_exp_elt_opcode (UNOP_MEMVAL); } + ; + +exp : '(' type ')' exp %prec UNARY + { write_exp_elt_opcode (UNOP_CAST); + write_exp_elt_type ($2); + write_exp_elt_opcode (UNOP_CAST); } + ; + +exp : '(' exp1 ')' + { } + ; + +/* Binary operators in order of decreasing precedence. */ + +exp : exp '@' exp + { write_exp_elt_opcode (BINOP_REPEAT); } + ; + +exp : exp '*' exp + { write_exp_elt_opcode (BINOP_MUL); } + ; + +exp : exp '/' exp + { write_exp_elt_opcode (BINOP_DIV); } + ; + +exp : exp '%' exp + { write_exp_elt_opcode (BINOP_REM); } + ; + +exp : exp '+' exp + { write_exp_elt_opcode (BINOP_ADD); } + ; + +exp : exp '-' exp + { write_exp_elt_opcode (BINOP_SUB); } + ; + +exp : exp LSH exp + { write_exp_elt_opcode (BINOP_LSH); } + ; + +exp : exp RSH exp + { write_exp_elt_opcode (BINOP_RSH); } + ; + +exp : exp EQUAL exp + { write_exp_elt_opcode (BINOP_EQUAL); } + ; + +exp : exp NOTEQUAL exp + { write_exp_elt_opcode (BINOP_NOTEQUAL); } + ; + +exp : exp LEQ exp + { write_exp_elt_opcode (BINOP_LEQ); } + ; + +exp : exp GEQ exp + { write_exp_elt_opcode (BINOP_GEQ); } + ; + +exp : exp '<' exp + { write_exp_elt_opcode (BINOP_LESS); } + ; + +exp : exp '>' exp + { write_exp_elt_opcode (BINOP_GTR); } + ; + +exp : exp '&' exp + { write_exp_elt_opcode (BINOP_BITWISE_AND); } + ; + +exp : exp '^' exp + { write_exp_elt_opcode (BINOP_BITWISE_XOR); } + ; + +exp : exp '|' exp + { write_exp_elt_opcode (BINOP_BITWISE_IOR); } + ; + +exp : exp ANDAND exp + { write_exp_elt_opcode (BINOP_LOGICAL_AND); } + ; + +exp : exp OROR exp + { write_exp_elt_opcode (BINOP_LOGICAL_OR); } + ; + +exp : exp '?' exp ':' exp %prec '?' + { write_exp_elt_opcode (TERNOP_COND); } + ; + +exp : exp '=' exp + { write_exp_elt_opcode (BINOP_ASSIGN); } + ; + +exp : exp ASSIGN_MODIFY exp + { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode ($2); + write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } + ; + +exp : INT + { write_exp_elt_opcode (OP_LONG); + write_exp_elt_type ($1.type); + write_exp_elt_longcst ((LONGEST)($1.val)); + write_exp_elt_opcode (OP_LONG); } + ; + +exp : NAME_OR_INT + { YYSTYPE val; + parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val); + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (val.typed_val_int.type); + write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); + write_exp_elt_opcode (OP_LONG); + } + ; + + +exp : FLOAT + { write_exp_elt_opcode (OP_DOUBLE); + write_exp_elt_type ($1.type); + write_exp_elt_dblcst ($1.dval); + write_exp_elt_opcode (OP_DOUBLE); } + ; + +exp : variable + ; + +exp : VARIABLE + /* Already written by write_dollar_variable. */ + ; + +exp : SELECTOR + { + write_exp_elt_opcode (OP_SELECTOR); + write_exp_string ($1); + write_exp_elt_opcode (OP_SELECTOR); } + +exp : SIZEOF '(' type ')' %prec UNARY + { write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (builtin_type_int); + CHECK_TYPEDEF ($3); + write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3)); + write_exp_elt_opcode (OP_LONG); } + ; + +exp : STRING + { /* C strings are converted into array + constants with an explicit null byte + added at the end. Thus the array upper + bound is the string length. There is no + such thing in C as a completely empty + string. */ + char *sp = $1.ptr; int count = $1.length; + while (count-- > 0) + { + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (builtin_type_char); + write_exp_elt_longcst ((LONGEST)(*sp++)); + write_exp_elt_opcode (OP_LONG); + } + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (builtin_type_char); + write_exp_elt_longcst ((LONGEST)'\0'); + write_exp_elt_opcode (OP_LONG); + write_exp_elt_opcode (OP_ARRAY); + write_exp_elt_longcst ((LONGEST) 0); + write_exp_elt_longcst ((LONGEST) ($1.length)); + write_exp_elt_opcode (OP_ARRAY); } + ; + +exp : NSSTRING /* ObjC NextStep NSString constant + * of the form '@' '"' string '"'. + */ + { write_exp_elt_opcode (OP_NSSTRING); + write_exp_string ($1); + write_exp_elt_opcode (OP_NSSTRING); } + ; + +/* C++. */ +exp : THIS + { write_exp_elt_opcode (OP_THIS); + write_exp_elt_opcode (OP_THIS); } + ; + +/* end of C++. */ + +block : BLOCKNAME + { + if ($1.sym != 0) + $$ = SYMBOL_BLOCK_VALUE ($1.sym); + else + { + struct symtab *tem = + lookup_symtab (copy_name ($1.stoken)); + if (tem) + $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK); + else + error ("No file or function \"%s\".", + copy_name ($1.stoken)); + } + } + ; + +block : block COLONCOLON name + { struct symbol *tem + = lookup_symbol (copy_name ($3), $1, + VAR_NAMESPACE, (int *) NULL, + (struct symtab **) NULL); + if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + error ("No function \"%s\" in specified context.", + copy_name ($3)); + $$ = SYMBOL_BLOCK_VALUE (tem); } + ; + +variable: block COLONCOLON name + { struct symbol *sym; + sym = lookup_symbol (copy_name ($3), $1, + VAR_NAMESPACE, (int *) NULL, + (struct symtab **) NULL); + if (sym == 0) + error ("No symbol \"%s\" in specified context.", + copy_name ($3)); + + write_exp_elt_opcode (OP_VAR_VALUE); + /* block_found is set by lookup_symbol. */ + write_exp_elt_block (block_found); + write_exp_elt_sym (sym); + write_exp_elt_opcode (OP_VAR_VALUE); } + ; + +qualified_name: typebase COLONCOLON name + { + struct type *type = $1; + if (TYPE_CODE (type) != TYPE_CODE_STRUCT + && TYPE_CODE (type) != TYPE_CODE_UNION) + error ("`%s' is not defined as an aggregate type.", + TYPE_NAME (type)); + + write_exp_elt_opcode (OP_SCOPE); + write_exp_elt_type (type); + write_exp_string ($3); + write_exp_elt_opcode (OP_SCOPE); + } + | typebase COLONCOLON '~' name + { + struct type *type = $1; + struct stoken tmp_token; + if (TYPE_CODE (type) != TYPE_CODE_STRUCT + && TYPE_CODE (type) != TYPE_CODE_UNION) + error ("`%s' is not defined as an aggregate type.", + TYPE_NAME (type)); + + if (!STREQ (type_name_no_tag (type), $4.ptr)) + error ("invalid destructor `%s::~%s'", + type_name_no_tag (type), $4.ptr); + + tmp_token.ptr = (char*) alloca ($4.length + 2); + tmp_token.length = $4.length + 1; + tmp_token.ptr[0] = '~'; + memcpy (tmp_token.ptr+1, $4.ptr, $4.length); + tmp_token.ptr[tmp_token.length] = 0; + write_exp_elt_opcode (OP_SCOPE); + write_exp_elt_type (type); + write_exp_string (tmp_token); + write_exp_elt_opcode (OP_SCOPE); + } + ; + +variable: qualified_name + | COLONCOLON name + { + char *name = copy_name ($2); + struct symbol *sym; + struct minimal_symbol *msymbol; + + sym = + lookup_symbol (name, (const struct block *) NULL, + VAR_NAMESPACE, (int *) NULL, + (struct symtab **) NULL); + if (sym) + { + write_exp_elt_opcode (OP_VAR_VALUE); + write_exp_elt_block (NULL); + write_exp_elt_sym (sym); + write_exp_elt_opcode (OP_VAR_VALUE); + break; + } + + msymbol = lookup_minimal_symbol (name, NULL, NULL); + if (msymbol != NULL) + { + write_exp_msymbol (msymbol, + lookup_function_type (builtin_type_int), + builtin_type_int); + } + else + if (!have_full_symbols () && !have_partial_symbols ()) + error ("No symbol table is loaded. Use the \"file\" command."); + else + error ("No symbol \"%s\" in current context.", name); + } + ; + +variable: name_not_typename + { struct symbol *sym = $1.sym; + + if (sym) + { + if (symbol_read_needs_frame (sym)) + { + if (innermost_block == 0 || + contained_in (block_found, + innermost_block)) + innermost_block = block_found; + } + + write_exp_elt_opcode (OP_VAR_VALUE); + /* We want to use the selected frame, not + another more inner frame which happens to + be in the same block. */ + write_exp_elt_block (NULL); + write_exp_elt_sym (sym); + write_exp_elt_opcode (OP_VAR_VALUE); + } + else if ($1.is_a_field_of_this) + { + /* C++/ObjC: it hangs off of `this'/'self'. + Must not inadvertently convert from a + method call to data ref. */ + if (innermost_block == 0 || + contained_in (block_found, innermost_block)) + innermost_block = block_found; + write_exp_elt_opcode (OP_SELF); + write_exp_elt_opcode (OP_SELF); + write_exp_elt_opcode (STRUCTOP_PTR); + write_exp_string ($1.stoken); + write_exp_elt_opcode (STRUCTOP_PTR); + } + else + { + struct minimal_symbol *msymbol; + register char *arg = copy_name ($1.stoken); + + msymbol = + lookup_minimal_symbol (arg, NULL, NULL); + if (msymbol != NULL) + { + write_exp_msymbol (msymbol, + lookup_function_type (builtin_type_int), + builtin_type_int); + } + else if (!have_full_symbols () && + !have_partial_symbols ()) + error ("No symbol table is loaded. Use the \"file\" command."); + else + error ("No symbol \"%s\" in current context.", + copy_name ($1.stoken)); + } + } + ; + + +ptype : typebase + /* "const" and "volatile" are curently ignored. A type + qualifier before the type is currently handled in the + typebase rule. The reason for recognizing these here + (shift/reduce conflicts) might be obsolete now that some + pointer to member rules have been deleted. */ + | typebase CONST_KEYWORD + | typebase VOLATILE_KEYWORD + | typebase abs_decl + { $$ = follow_types ($1); } + | typebase CONST_KEYWORD abs_decl + { $$ = follow_types ($1); } + | typebase VOLATILE_KEYWORD abs_decl + { $$ = follow_types ($1); } + ; + +abs_decl: '*' + { push_type (tp_pointer); $$ = 0; } + | '*' abs_decl + { push_type (tp_pointer); $$ = $2; } + | '&' + { push_type (tp_reference); $$ = 0; } + | '&' abs_decl + { push_type (tp_reference); $$ = $2; } + | direct_abs_decl + ; + +direct_abs_decl: '(' abs_decl ')' + { $$ = $2; } + | direct_abs_decl array_mod + { + push_type_int ($2); + push_type (tp_array); + } + | array_mod + { + push_type_int ($1); + push_type (tp_array); + $$ = 0; + } + + | direct_abs_decl func_mod + { push_type (tp_function); } + | func_mod + { push_type (tp_function); } + ; + +array_mod: '[' ']' + { $$ = -1; } + | '[' INT ']' + { $$ = $2.val; } + ; + +func_mod: '(' ')' + { $$ = 0; } + | '(' nonempty_typelist ')' + { free ((PTR)$2); $$ = 0; } + ; + +/* We used to try to recognize more pointer to member types here, but + that didn't work (shift/reduce conflicts meant that these rules + never got executed). The problem is that + int (foo::bar::baz::bizzle) + is a function type but + int (foo::bar::baz::bizzle::*) + is a pointer to member type. Stroustrup loses again! */ + +type : ptype + | typebase COLONCOLON '*' + { $$ = lookup_member_type (builtin_type_int, $1); } + ; + +typebase /* Implements (approximately): (type-qualifier)* type-specifier. */ + : TYPENAME + { $$ = $1.type; } + | CLASSNAME + { + if ($1.type == NULL) + error ("No symbol \"%s\" in current context.", + copy_name($1.stoken)); + else + $$ = $1.type; + } + | INT_KEYWORD + { $$ = builtin_type_int; } + | LONG + { $$ = builtin_type_long; } + | SHORT + { $$ = builtin_type_short; } + | LONG INT_KEYWORD + { $$ = builtin_type_long; } + | UNSIGNED LONG INT_KEYWORD + { $$ = builtin_type_unsigned_long; } + | LONG LONG + { $$ = builtin_type_long_long; } + | LONG LONG INT_KEYWORD + { $$ = builtin_type_long_long; } + | UNSIGNED LONG LONG + { $$ = builtin_type_unsigned_long_long; } + | UNSIGNED LONG LONG INT_KEYWORD + { $$ = builtin_type_unsigned_long_long; } + | SHORT INT_KEYWORD + { $$ = builtin_type_short; } + | UNSIGNED SHORT INT_KEYWORD + { $$ = builtin_type_unsigned_short; } + | DOUBLE_KEYWORD + { $$ = builtin_type_double; } + | LONG DOUBLE_KEYWORD + { $$ = builtin_type_long_double; } + | STRUCT name + { $$ = lookup_struct (copy_name ($2), + expression_context_block); } + | CLASS name + { $$ = lookup_struct (copy_name ($2), + expression_context_block); } + | UNION name + { $$ = lookup_union (copy_name ($2), + expression_context_block); } + | ENUM name + { $$ = lookup_enum (copy_name ($2), + expression_context_block); } + | UNSIGNED typename + { $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); } + | UNSIGNED + { $$ = builtin_type_unsigned_int; } + | SIGNED_KEYWORD typename + { $$ = lookup_signed_typename (TYPE_NAME($2.type)); } + | SIGNED_KEYWORD + { $$ = builtin_type_int; } + | TEMPLATE name '<' type '>' + { $$ = lookup_template_type(copy_name($2), $4, + expression_context_block); + } + /* "const" and "volatile" are curently ignored. A type + qualifier after the type is handled in the ptype rule. I + think these could be too. */ + | CONST_KEYWORD typebase { $$ = $2; } + | VOLATILE_KEYWORD typebase { $$ = $2; } + ; + +typename: TYPENAME + | INT_KEYWORD + { + $$.stoken.ptr = "int"; + $$.stoken.length = 3; + $$.type = builtin_type_int; + } + | LONG + { + $$.stoken.ptr = "long"; + $$.stoken.length = 4; + $$.type = builtin_type_long; + } + | SHORT + { + $$.stoken.ptr = "short"; + $$.stoken.length = 5; + $$.type = builtin_type_short; + } + ; + +nonempty_typelist + : type + { $$ = (struct type **) malloc (sizeof (struct type *) * 2); + $<ivec>$[0] = 1; /* Number of types in vector. */ + $$[1] = $1; + } + | nonempty_typelist ',' type + { int len = sizeof (struct type *) * (++($<ivec>1[0]) + 1); + $$ = (struct type **) realloc ((char *) $1, len); + $$[$<ivec>$[0]] = $3; + } + ; + +name : NAME { $$ = $1.stoken; } + | BLOCKNAME { $$ = $1.stoken; } + | TYPENAME { $$ = $1.stoken; } + | CLASSNAME { $$ = $1.stoken; } + | NAME_OR_INT { $$ = $1.stoken; } + ; + +name_not_typename : NAME + | BLOCKNAME +/* These would be useful if name_not_typename was useful, but it is + just a fake for "variable", so these cause reduce/reduce conflicts + because the parser can't tell whether NAME_OR_INT is a + name_not_typename (=variable, =exp) or just an exp. If + name_not_typename was ever used in an lvalue context where only a + name could occur, this might be useful. */ + | NAME_OR_INT */ + ; + +%% + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. LEN is the + number of characters in it. */ + +/*** Needs some error checking for the float case. ***/ + +static int +parse_number (p, len, parsed_float, putithere) + register char *p; + register int len; + int parsed_float; + YYSTYPE *putithere; +{ + /* FIXME: Shouldn't these be unsigned? We don't deal with negative + values here, and we do kind of silly things like cast to + unsigned. */ + register LONGEST n = 0; + register LONGEST prevn = 0; + unsigned LONGEST un; + + register int i = 0; + register int c; + register int base = input_radix; + int unsigned_p = 0; + + /* Number of "L" suffixes encountered. */ + int long_p = 0; + + /* We have found a "L" or "U" suffix. */ + int found_suffix = 0; + + unsigned LONGEST high_bit; + struct type *signed_type; + struct type *unsigned_type; + + if (parsed_float) + { + char c; + + /* It's a float since it contains a point or an exponent. */ + + if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) + sscanf (p, "%g", &putithere->typed_val_float.dval); + else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) + sscanf (p, "%lg", &putithere->typed_val_float.dval); + else + { +#ifdef PRINTF_HAS_LONG_DOUBLE + sscanf (p, "%Lg", &putithere->typed_val_float.dval); +#else + /* Scan it into a double, then assign it to the long double. + This at least wins with values representable in the range + of doubles. */ + double temp; + sscanf (p, "%lg", &temp); + putithere->typed_val_float.dval = temp; +#endif + } + + /* See if it has `f' or `l' suffix (float or long double). */ + + c = tolower (p[len - 1]); + + if (c == 'f') + putithere->typed_val_float.type = builtin_type_float; + else if (c == 'l') + putithere->typed_val_float.type = builtin_type_long_double; + else if (isdigit (c) || c == '.') + putithere->typed_val_float.type = builtin_type_double; + else + return ERROR; + + return FLOAT; + } + + /* Handle base-switching prefixes 0x, 0t, 0d, and 0. */ + if (p[0] == '0') + switch (p[1]) + { + case 'x': + case 'X': + if (len >= 3) + { + p += 2; + base = 16; + len -= 2; + } + break; + + case 't': + case 'T': + case 'd': + case 'D': + if (len >= 3) + { + p += 2; + base = 10; + len -= 2; + } + break; + + default: + base = 8; + break; + } + + while (len-- > 0) + { + c = *p++; + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c != 'l' && c != 'u') + n *= base; + if (c >= '0' && c <= '9') + { + if (found_suffix) + return ERROR; + n += i = c - '0'; + } + else + { + if (base > 10 && c >= 'a' && c <= 'f') + { + if (found_suffix) + return ERROR; + n += i = c - 'a' + 10; + } + else if (c == 'l') + { + ++long_p; + found_suffix = 1; + } + else if (c == 'u') + { + unsigned_p = 1; + found_suffix = 1; + } + else + return ERROR; /* Char not a digit. */ + } + if (i >= base) + return ERROR; /* Invalid digit in this base. */ + + /* Portably test for overflow (only works for nonzero values, so + make a second check for zero). FIXME: Can't we just make n + and prevn unsigned and avoid this? */ + if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) + unsigned_p = 1; /* Try something unsigned. */ + + /* Portably test for unsigned overflow. + FIXME: This check is wrong; for example it doesn't find + overflow on 0x123456789 when LONGEST is 32 bits. */ + if (c != 'l' && c != 'u' && n != 0) + { + if ((unsigned_p && (unsigned LONGEST) prevn >= (unsigned LONGEST) n)) + error ("Numeric constant too large."); + } + prevn = n; + } + + /* An integer constant is an int, a long, or a long long. An L + suffix forces it to be long; an LL suffix forces it to be long + long. If not forced to a larger size, it gets the first type of + the above that it fits in. To figure out whether it fits, we + shift it right and see whether anything remains. Note that we + can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one + operation, because many compilers will warn about such a shift + (which always produces a zero result). Sometimes TARGET_INT_BIT + or TARGET_LONG_BIT will be that big, sometimes not. To deal with + the case where it is we just always shift the value more than + once, with fewer bits each time. */ + + un = (unsigned LONGEST)n >> 2; + if (long_p == 0 + && (un >> (TARGET_INT_BIT - 2)) == 0) + { + high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1); + + /* A large decimal (not hex or octal) constant (between INT_MAX + and UINT_MAX) is a long or unsigned long, according to ANSI, + never an unsigned int, but this code treats it as unsigned + int. This probably should be fixed. GCC gives a warning on + such constants. */ + + unsigned_type = builtin_type_unsigned_int; + signed_type = builtin_type_int; + } + else if (long_p <= 1 + && (un >> (TARGET_LONG_BIT - 2)) == 0) + { + high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1); + unsigned_type = builtin_type_unsigned_long; + signed_type = builtin_type_long; + } + else + { + high_bit = (((unsigned LONGEST)1) + << (TARGET_LONG_LONG_BIT - 32 - 1) + << 16 + << 16); + if (high_bit == 0) + /* A long long does not fit in a LONGEST. */ + high_bit = + (unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1); + unsigned_type = builtin_type_unsigned_long_long; + signed_type = builtin_type_long_long; + } + + putithere->typed_val_int.val = n; + + /* If the high bit of the worked out type is set then this number + has to be unsigned. */ + + if (unsigned_p || (n & high_bit)) + { + putithere->typed_val_int.type = unsigned_type; + } + else + { + putithere->typed_val_int.type = signed_type; + } + + return INT; +} + +struct token +{ + char *operator; + int token; + enum exp_opcode opcode; +}; + +static const struct token tokentab3[] = + { + {">>=", ASSIGN_MODIFY, BINOP_RSH}, + {"<<=", ASSIGN_MODIFY, BINOP_LSH} + }; + +static const struct token tokentab2[] = + { + {"+=", ASSIGN_MODIFY, BINOP_ADD}, + {"-=", ASSIGN_MODIFY, BINOP_SUB}, + {"*=", ASSIGN_MODIFY, BINOP_MUL}, + {"/=", ASSIGN_MODIFY, BINOP_DIV}, + {"%=", ASSIGN_MODIFY, BINOP_REM}, + {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, + {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, + {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, + {"++", INCREMENT, BINOP_END}, + {"--", DECREMENT, BINOP_END}, + {"->", ARROW, BINOP_END}, + {"&&", ANDAND, BINOP_END}, + {"||", OROR, BINOP_END}, + {"::", COLONCOLON, BINOP_END}, + {"<<", LSH, BINOP_END}, + {">>", RSH, BINOP_END}, + {"==", EQUAL, BINOP_END}, + {"!=", NOTEQUAL, BINOP_END}, + {"<=", LEQ, BINOP_END}, + {">=", GEQ, BINOP_END} + }; + +/* Read one token, getting characters through lexptr. */ + +static int +yylex () +{ + int c, tokchr; + int namelen; + unsigned int i; + char *tokstart; + char *tokptr; + int tempbufindex; + static char *tempbuf; + static int tempbufsize; + + retry: + + tokstart = lexptr; + /* See if it is a special token of length 3. */ + for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) + if (STREQN (tokstart, tokentab3[i].operator, 3)) + { + lexptr += 3; + yylval.opcode = tokentab3[i].opcode; + return tokentab3[i].token; + } + + /* See if it is a special token of length 2. */ + for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) + if (STREQN (tokstart, tokentab2[i].operator, 2)) + { + lexptr += 2; + yylval.opcode = tokentab2[i].opcode; + return tokentab2[i].token; + } + + switch (tokchr = *tokstart) + { + case 0: + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '\'': + /* We either have a character constant ('0' or '\177' for + example) or we have a quoted symbol reference ('foo(int,int)' + in C++ for example). */ + lexptr++; + c = *lexptr++; + if (c == '\\') + c = parse_escape (&lexptr); + else if (c == '\'') + error ("Empty character constant."); + + yylval.typed_val_int.val = c; + yylval.typed_val_int.type = builtin_type_char; + + c = *lexptr++; + if (c != '\'') + { + namelen = skip_quoted (tokstart, + get_gdb_completer_word_break_characters()) + - tokstart; + if (namelen > 2) + { + lexptr = tokstart + namelen; + if (lexptr[-1] != '\'') + error ("Unmatched single quote."); + namelen -= 2; + tokstart++; + goto tryname; + } + error ("Invalid character constant."); + } + return INT; + + case '(': + paren_depth++; + lexptr++; + return '('; + + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return ')'; + + case ',': + if (comma_terminates && paren_depth == 0) + return 0; + lexptr++; + return ','; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] < '0' || lexptr[1] > '9') + goto symbol; /* Nope, must be a symbol. */ + /* FALL THRU into number case. */ + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, toktype = FLOAT; + /* Initialize toktype to anything other than ERROR. */ + register char *p = tokstart; + int hex = input_radix > 10; + int local_radix = input_radix; + if (tokchr == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + local_radix = 16; + } + else if (tokchr == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) + { + p += 2; + hex = 0; + local_radix = 10; + } + + for (;; ++p) + { + /* This test includes !hex because 'e' is a valid hex digit + and thus does not indicate a floating point number when + the radix is hex. */ + + if (!hex && (*p == 'e' || *p == 'E')) + if (got_e) + toktype = ERROR; /* Only one 'e' in a float. */ + else + got_e = 1; + /* This test does not include !hex, because a '.' always + indicates a decimal floating point number regardless of + the radix. */ + else if (*p == '.') + if (got_dot) + toktype = ERROR; /* Only one '.' in a float. */ + else + got_dot = 1; + else if (got_e && (p[-1] == 'e' || p[-1] == 'E') && + (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + /* Always take decimal digits; parse_number handles radix + error. */ + else if (*p >= '0' && *p <= '9') + continue; + /* We will take letters only if hex is true, and only up + to what the input radix would permit. FSF was content + to rely on parse_number to validate; but it leaks. */ + else if (*p >= 'a' && *p <= 'z') + { + if (!hex || *p >= ('a' + local_radix - 10)) + toktype = ERROR; + } + else if (*p >= 'A' && *p <= 'Z') + { + if (!hex || *p >= ('A' + local_radix - 10)) + toktype = ERROR; + } + else break; + } + if (toktype != ERROR) + toktype = parse_number (tokstart, p - tokstart, + got_dot | got_e, &yylval); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error ("Invalid number \"%s\".", err_copy); + } + lexptr = p; + return toktype; + } + + case '+': + case '-': + case '*': + case '/': + case '%': + case '|': + case '&': + case '^': + case '~': + case '!': +#if 0 + case '@': /* Moved out below. */ +#endif + case '<': + case '>': + case '[': + case ']': + case '?': + case ':': + case '=': + case '{': + case '}': + symbol: + lexptr++; + return tokchr; + + case '@': + if (strncmp(tokstart, "@selector", 9) == 0) + { + tokptr = strchr(tokstart, '('); + if (tokptr == NULL) + { + error ("Missing '(' in @selector(...)"); + } + tempbufindex = 0; + tokptr++; /* Skip the '('. */ + do { + /* Grow the static temp buffer if necessary, including + allocating the first one on demand. */ + if (tempbufindex + 1 >= tempbufsize) + { + tempbuf = (char *) realloc (tempbuf, tempbufsize += 64); + } + tempbuf[tempbufindex++] = *tokptr++; + } while ((*tokptr != ')') && (*tokptr != '\0')); + if (*tokptr++ != ')') + { + error ("Missing ')' in @selector(...)"); + } + tempbuf[tempbufindex] = '\0'; + yylval.sval.ptr = tempbuf; + yylval.sval.length = tempbufindex; + lexptr = tokptr; + return SELECTOR; + } + if (tokstart[1] != '"') + { + lexptr++; + return tokchr; + } + /* ObjC NextStep NSString constant: fall thru and parse like + STRING. */ + tokstart++; + + case '"': + + /* Build the gdb internal form of the input string in tempbuf, + translating any standard C escape forms seen. Note that the + buffer is null byte terminated *only* for the convenience of + debugging gdb itself and printing the buffer contents when + the buffer contains no embedded nulls. Gdb does not depend + upon the buffer being null byte terminated, it uses the + length string instead. This allows gdb to handle C strings + (as well as strings in other languages) with embedded null + bytes. */ + + tokptr = ++tokstart; + tempbufindex = 0; + + do { + /* Grow the static temp buffer if necessary, including + allocating the first one on demand. */ + if (tempbufindex + 1 >= tempbufsize) + { + tempbuf = (char *) realloc (tempbuf, tempbufsize += 64); + } + switch (*tokptr) + { + case '\0': + case '"': + /* Do nothing, loop will terminate. */ + break; + case '\\': + tokptr++; + c = parse_escape (&tokptr); + if (c == -1) + { + continue; + } + tempbuf[tempbufindex++] = c; + break; + default: + tempbuf[tempbufindex++] = *tokptr++; + break; + } + } while ((*tokptr != '"') && (*tokptr != '\0')); + if (*tokptr++ != '"') + { + error ("Unterminated string in expression."); + } + tempbuf[tempbufindex] = '\0'; /* See note above. */ + yylval.sval.ptr = tempbuf; + yylval.sval.length = tempbufindex; + lexptr = tokptr; + return (tokchr == '@' ? NSSTRING : STRING); + } + + if (!(tokchr == '_' || tokchr == '$' || + (tokchr >= 'a' && tokchr <= 'z') || (tokchr >= 'A' && tokchr <= 'Z'))) + /* We must have come across a bad character (e.g. ';'). */ + error ("Invalid character '%c' in expression.", c); + + /* It's a name. See how long it is. */ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) + { + if (c == '<') + { + int i = namelen; + while (tokstart[++i] && tokstart[i] != '>'); + if (tokstart[i] == '>') + namelen = i; + } + c = tokstart[++namelen]; + } + + /* The token "if" terminates the expression and is NOT + removed from the input stream. */ + if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + { + return 0; + } + + lexptr += namelen; + + tryname: + + /* Catch specific keywords. Should be done with a data structure. */ + switch (namelen) + { + case 8: + if (STREQN (tokstart, "unsigned", 8)) + return UNSIGNED; + if (current_language->la_language == language_cplus + && STREQN (tokstart, "template", 8)) + return TEMPLATE; + if (STREQN (tokstart, "volatile", 8)) + return VOLATILE_KEYWORD; + break; + case 6: + if (STREQN (tokstart, "struct", 6)) + return STRUCT; + if (STREQN (tokstart, "signed", 6)) + return SIGNED_KEYWORD; + if (STREQN (tokstart, "sizeof", 6)) + return SIZEOF; + if (STREQN (tokstart, "double", 6)) + return DOUBLE_KEYWORD; + break; + case 5: + if ((current_language->la_language == language_cplus) + && STREQN (tokstart, "class", 5)) + return CLASS; + if (STREQN (tokstart, "union", 5)) + return UNION; + if (STREQN (tokstart, "short", 5)) + return SHORT; + if (STREQN (tokstart, "const", 5)) + return CONST_KEYWORD; + break; + case 4: + if (STREQN (tokstart, "enum", 4)) + return ENUM; + if (STREQN (tokstart, "long", 4)) + return LONG; + if (current_language->la_language == language_cplus + && STREQN (tokstart, "this", 4)) + { + static const char this_name[] = { + CPLUS_MARKER, 't', 'h', 'i', 's', '\0' + }; + + if (lookup_symbol (this_name, expression_context_block, + VAR_NAMESPACE, (int *) NULL, + (struct symtab **) NULL)) + return THIS; + } + break; + case 3: + if (STREQN (tokstart, "int", 3)) + return INT_KEYWORD; + break; + default: + break; + } + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + if (*tokstart == '$') + { + write_dollar_variable (yylval.sval); + return VARIABLE; + } + + /* Use token-type BLOCKNAME for symbols that happen to be defined as + functions or symtabs. If this is not so, then ... + Use token-type TYPENAME for symbols that happen to be defined + currently as names of types; NAME for other symbols. + The caller is not constrained to care about the distinction. */ + { + char *tmp = copy_name (yylval.sval); + struct symbol *sym; + int is_a_field_of_this = 0, *need_this; + int hextype; + + if (current_language->la_language == language_cplus || + current_language->la_language == language_objc) + need_this = &is_a_field_of_this; + else + need_this = (int *) NULL; + + sym = lookup_symbol (tmp, expression_context_block, + VAR_NAMESPACE, + need_this, + (struct symtab **) NULL); + /* Call lookup_symtab, not lookup_partial_symtab, in case there + are no psymtabs (coff, xcoff, or some future change to blow + away the psymtabs once symbols are read). */ + if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) || + lookup_symtab (tmp)) + { + yylval.ssym.sym = sym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this; + return BLOCKNAME; + } + if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + { +#if 1 + /* Despite the following flaw, we need to keep this code + enabled. Because we can get called from + check_stub_method, if we don't handle nested types then + it screws many operations in any program which uses + nested types. */ + /* In "A::x", if x is a member function of A and there + happens to be a type (nested or not, since the stabs + don't make that distinction) named x, then this code + incorrectly thinks we are dealing with nested types + rather than a member function. */ + + char *p; + char *namestart; + struct symbol *best_sym; + + /* Look ahead to detect nested types. This probably should + be done in the grammar, but trying seemed to introduce a + lot of shift/reduce and reduce/reduce conflicts. It's + possible that it could be done, though. Or perhaps a + non-grammar, but less ad hoc, approach would work well. */ + + /* Since we do not currently have any way of distinguishing + a nested type from a non-nested one (the stabs don't tell + us whether a type is nested), we just ignore the + containing type. */ + + p = lexptr; + best_sym = sym; + while (1) + { + /* Skip whitespace. */ + while (*p == ' ' || *p == '\t' || *p == '\n') + ++p; + if (*p == ':' && p[1] == ':') + { + /* Skip the `::'. */ + p += 2; + /* Skip whitespace. */ + while (*p == ' ' || *p == '\t' || *p == '\n') + ++p; + namestart = p; + while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9') + || (*p >= 'a' && *p <= 'z') + || (*p >= 'A' && *p <= 'Z')) + ++p; + if (p != namestart) + { + struct symbol *cur_sym; + /* As big as the whole rest of the expression, + which is at least big enough. */ + char *ncopy = alloca (strlen (tmp) + + strlen (namestart) + 3); + char *tmp1; + + tmp1 = ncopy; + memcpy (tmp1, tmp, strlen (tmp)); + tmp1 += strlen (tmp); + memcpy (tmp1, "::", 2); + tmp1 += 2; + memcpy (tmp1, namestart, p - namestart); + tmp1[p - namestart] = '\0'; + cur_sym = lookup_symbol (ncopy, + expression_context_block, + VAR_NAMESPACE, (int *) NULL, + (struct symtab **) NULL); + if (cur_sym) + { + if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) + { + best_sym = cur_sym; + lexptr = p; + } + else + break; + } + else + break; + } + else + break; + } + else + break; + } + + yylval.tsym.type = SYMBOL_TYPE (best_sym); +#else /* not 0 */ + yylval.tsym.type = SYMBOL_TYPE (sym); +#endif /* not 0 */ + return TYPENAME; + } + if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0) + return TYPENAME; + + /* See if it's an ObjC classname. */ + if (!sym) + { + CORE_ADDR Class = lookup_objc_class(tmp); + if (Class) + { + extern struct symbol *lookup_struct_typedef(); + yylval.class.class = Class; + if ((sym = lookup_struct_typedef (tmp, + expression_context_block, + 1))) + yylval.class.type = SYMBOL_TYPE (sym); + return CLASSNAME; + } + } + + /* Input names that aren't symbols but ARE valid hex numbers, + when the input radix permits them, can be names or numbers + depending on the parse. Note we support radixes > 16 here. */ + if (!sym && + ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || + (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) + { + YYSTYPE newlval; /* Its value is ignored. */ + hextype = parse_number (tokstart, namelen, 0, &newlval); + if (hextype == INT) + { + yylval.ssym.sym = sym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this; + return NAME_OR_INT; + } + } + + /* Any other kind of symbol. */ + yylval.ssym.sym = sym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this; + return NAME; + } +} + +void +yyerror (msg) + char *msg; +{ + if (*lexptr == '\0') + error("A %s near end of expression.", (msg ? msg : "error")); + else + error ("A %s in expression, near `%s'.", (msg ? msg : "error"), + lexptr); +} diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c new file mode 100644 index 00000000000..dc839518b24 --- /dev/null +++ b/gdb/objc-lang.c @@ -0,0 +1,1960 @@ +/* Objective-C language support routines for GDB, the GNU debugger. + + Copyright 2002 Free Software Foundation, Inc. + + Contributed by Apple Computer, Inc. + Written by Michael Snyder. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "symtab.h" +#include "gdbtypes.h" +#include "expression.h" +#include "parser-defs.h" +#include "language.h" +#include "c-lang.h" +#include "objc-lang.h" +#include "complaints.h" +#include "value.h" +#include "symfile.h" +#include "objfiles.h" +#include "string.h" /* for strchr */ +#include "target.h" /* for target_has_execution */ +#include "gdbcore.h" +#include "gdbcmd.h" +#include "frame.h" +#include "gdb_regex.h" +#include "regcache.h" + +#include <ctype.h> + +struct objc_object { + CORE_ADDR isa; +}; + +struct objc_class { + CORE_ADDR isa; + CORE_ADDR super_class; + CORE_ADDR name; + long version; + long info; + long instance_size; + CORE_ADDR ivars; + CORE_ADDR methods; + CORE_ADDR cache; + CORE_ADDR protocols; +}; + +struct objc_super { + CORE_ADDR receiver; + CORE_ADDR class; +}; + +struct objc_method { + CORE_ADDR name; + CORE_ADDR types; + CORE_ADDR imp; +}; + +/* Complaints about ObjC classes, selectors, etc. */ + +static struct complaint noclass_lookup_complaint = { + "no way to lookup Objective-C classes", 0, 0 +}; + +static struct complaint nosel_lookup_complaint = { + "no way to lookup Objective-C selectors", 0, 0 +}; + + +#if (!defined __GNUC__ || __GNUC__ < 2 || __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4)) +#define __CHECK_FUNCTION ((__const char *) 0) +#else +#define __CHECK_FUNCTION __PRETTY_FUNCTION__ +#endif + +#define CHECK(expression) \ + ((void) ((expression) ? 0 : gdb_check (#expression, __FILE__, __LINE__, \ + __CHECK_FUNCTION))) + +#define CHECK_FATAL(expression) \ + ((void) ((expression) ? 0 : gdb_check_fatal (#expression, __FILE__, \ + __LINE__, __CHECK_FUNCTION))) + +static void +gdb_check (const char *str, const char *file, + unsigned int line, const char *func) +{ + error ("assertion failure on line %u of \"%s\" in function \"%s\": %s\n", + line, file, func, str); +} + +static void +gdb_check_fatal (const char *str, const char *file, + unsigned int line, const char *func) +{ + internal_error (file, line, + "assertion failure in function \"%s\": %s\n", func, str); +} + +/* Lookup a structure type named "struct NAME", visible in lexical + block BLOCK. If NOERR is nonzero, return zero if NAME is not + suitably defined. */ + +struct symbol * +lookup_struct_typedef (char *name, struct block *block, int noerr) +{ + register struct symbol *sym; + + sym = lookup_symbol (name, block, STRUCT_NAMESPACE, 0, + (struct symtab **) NULL); + + if (sym == NULL) + { + if (noerr) + return 0; + else + error ("No struct type named %s.", name); + } + if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT) + { + if (noerr) + return 0; + else + error ("This context has class, union or enum %s, not a struct.", + name); + } + return sym; +} + +CORE_ADDR +lookup_objc_class (char *classname) +{ + struct value * function, *classval; + + if (! target_has_execution) + { + /* Can't call into inferior to lookup class. */ + return 0; + } + + if (lookup_minimal_symbol("objc_lookUpClass", 0, 0)) + function = find_function_in_inferior("objc_lookUpClass"); + else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0)) + function = find_function_in_inferior("objc_lookup_class"); + else + { + complain (&noclass_lookup_complaint, 0); + return 0; + } + + classval = value_string (classname, strlen (classname) + 1); + classval = value_coerce_array (classval); + return (CORE_ADDR) value_as_long (call_function_by_hand (function, + 1, &classval)); +} + +int +lookup_child_selector (char *selname) +{ + struct value * function, *selstring; + + if (! target_has_execution) + { + /* Can't call into inferior to lookup selector. */ + return 0; + } + + if (lookup_minimal_symbol("sel_getUid", 0, 0)) + function = find_function_in_inferior("sel_getUid"); + else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0)) + function = find_function_in_inferior("sel_get_any_uid"); + else + { + complain (&nosel_lookup_complaint, 0); + return 0; + } + + selstring = value_coerce_array (value_string (selname, + strlen (selname) + 1)); + return value_as_long (call_function_by_hand (function, 1, &selstring)); +} + +struct value * +value_nsstring (char *ptr, int len) +{ + struct value *stringValue[3]; + struct value *function, *nsstringValue; + struct symbol *sym; + struct type *type; + + if (!target_has_execution) + return 0; /* Can't call into inferior to create NSString. */ + + if (!(sym = lookup_struct_typedef("NSString", 0, 1)) && + !(sym = lookup_struct_typedef("NXString", 0, 1))) + type = lookup_pointer_type(builtin_type_void); + else + type = lookup_pointer_type(SYMBOL_TYPE (sym)); + + stringValue[2] = value_string(ptr, len); + stringValue[2] = value_coerce_array(stringValue[2]); + /* _NSNewStringFromCString replaces "istr" after Lantern2A. */ + if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0)) + { + function = find_function_in_inferior("_NSNewStringFromCString"); + nsstringValue = call_function_by_hand(function, 1, &stringValue[2]); + } + else if (lookup_minimal_symbol("istr", 0, 0)) + { + function = find_function_in_inferior("istr"); + nsstringValue = call_function_by_hand(function, 1, &stringValue[2]); + } + else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0)) + { + function = find_function_in_inferior("+[NSString stringWithCString:]"); + stringValue[0] = value_from_longest + (builtin_type_long, lookup_objc_class ("NSString")); + stringValue[1] = value_from_longest + (builtin_type_long, lookup_child_selector ("stringWithCString:")); + nsstringValue = call_function_by_hand(function, 3, &stringValue[0]); + } + else + error ("NSString: internal error -- no way to create new NSString"); + + VALUE_TYPE(nsstringValue) = type; + return nsstringValue; +} + +/* Objective-C name demangling. */ + +char * +objc_demangle (const char *mangled) +{ + char *demangled, *cp; + + if (mangled[0] == '_' && + (mangled[1] == 'i' || mangled[1] == 'c') && + mangled[2] == '_') + { + cp = demangled = xmalloc(strlen(mangled) + 2); + + if (mangled[1] == 'i') + *cp++ = '-'; /* for instance method */ + else + *cp++ = '+'; /* for class method */ + + *cp++ = '['; /* opening left brace */ + strcpy(cp, mangled+3); /* tack on the rest of the mangled name */ + + while (*cp && *cp == '_') + cp++; /* skip any initial underbars in class name */ + + if (!(cp = strchr(cp, '_'))) /* find first non-initial underbar */ + { + free(demangled); /* not mangled name */ + return NULL; + } + if (cp[1] == '_') { /* easy case: no category name */ + *cp++ = ' '; /* replace two '_' with one ' ' */ + strcpy(cp, mangled + (cp - demangled) + 2); + } + else { + *cp++ = '('; /* less easy case: category name */ + if (!(cp = strchr(cp, '_'))) + { + free(demangled); /* not mangled name */ + return NULL; + } + *cp++ = ')'; + *cp++ = ' '; /* overwriting 1st char of method name... */ + strcpy(cp, mangled + (cp - demangled)); /* get it back */ + } + + while (*cp && *cp == '_') + cp++; /* skip any initial underbars in method name */ + + for (; *cp; cp++) + if (*cp == '_') + *cp = ':'; /* replace remaining '_' with ':' */ + + *cp++ = ']'; /* closing right brace */ + *cp++ = 0; /* string terminator */ + return demangled; + } + else + return NULL; /* Not an objc mangled name. */ +} + +/* Print the character C on STREAM as part of the contents of a + literal string whose delimiter is QUOTER. Note that that format + for printing characters and strings is language specific. */ + +static void +objc_emit_char (register int c, struct ui_file *stream, int quoter) +{ + + c &= 0xFF; /* Avoid sign bit follies. */ + + if (PRINT_LITERAL_FORM (c)) + { + if (c == '\\' || c == quoter) + { + fputs_filtered ("\\", stream); + } + fprintf_filtered (stream, "%c", c); + } + else + { + switch (c) + { + case '\n': + fputs_filtered ("\\n", stream); + break; + case '\b': + fputs_filtered ("\\b", stream); + break; + case '\t': + fputs_filtered ("\\t", stream); + break; + case '\f': + fputs_filtered ("\\f", stream); + break; + case '\r': + fputs_filtered ("\\r", stream); + break; + case '\033': + fputs_filtered ("\\e", stream); + break; + case '\007': + fputs_filtered ("\\a", stream); + break; + default: + fprintf_filtered (stream, "\\%.3o", (unsigned int) c); + break; + } + } +} + +static void +objc_printchar (int c, struct ui_file *stream) +{ + fputs_filtered ("'", stream); + objc_emit_char (c, stream, '\''); + fputs_filtered ("'", stream); +} + +/* Print the character string STRING, printing at most LENGTH + characters. Printing stops early if the number hits print_max; + repeat counts are printed as appropriate. Print ellipses at the + end if we had to stop before printing LENGTH characters, or if + FORCE_ELLIPSES. */ + +static void +objc_printstr (struct ui_file *stream, char *string, + unsigned int length, int force_ellipses) +{ + register unsigned int i; + unsigned int things_printed = 0; + int in_quotes = 0; + int need_comma = 0; + extern int inspect_it; + extern int repeat_count_threshold; + extern int print_max; + + /* If the string was not truncated due to `set print elements', and + the last byte of it is a null, we don't print that, in + traditional C style. */ + if ((!force_ellipses) && length > 0 && string[length-1] == '\0') + length--; + + if (length == 0) + { + fputs_filtered ("\"\"", stream); + return; + } + + for (i = 0; i < length && things_printed < print_max; ++i) + { + /* Position of the character we are examining to see whether it + is repeated. */ + unsigned int rep1; + /* Number of repetitions we have detected so far. */ + unsigned int reps; + + QUIT; + + if (need_comma) + { + fputs_filtered (", ", stream); + need_comma = 0; + } + + rep1 = i + 1; + reps = 1; + while (rep1 < length && string[rep1] == string[i]) + { + ++rep1; + ++reps; + } + + if (reps > repeat_count_threshold) + { + if (in_quotes) + { + if (inspect_it) + fputs_filtered ("\\\", ", stream); + else + fputs_filtered ("\", ", stream); + in_quotes = 0; + } + objc_printchar (string[i], stream); + fprintf_filtered (stream, " <repeats %u times>", reps); + i = rep1 - 1; + things_printed += repeat_count_threshold; + need_comma = 1; + } + else + { + if (!in_quotes) + { + if (inspect_it) + fputs_filtered ("\\\"", stream); + else + fputs_filtered ("\"", stream); + in_quotes = 1; + } + objc_emit_char (string[i], stream, '"'); + ++things_printed; + } + } + + /* Terminate the quotes if necessary. */ + if (in_quotes) + { + if (inspect_it) + fputs_filtered ("\\\"", stream); + else + fputs_filtered ("\"", stream); + } + + if (force_ellipses || i < length) + fputs_filtered ("...", stream); +} + +/* Create a fundamental C type using default reasonable for the + current target. + + Some object/debugging file formats (DWARF version 1, COFF, etc) do + not define fundamental types such as "int" or "double". Others + (stabs or DWARF version 2, etc) do define fundamental types. For + the formats which don't provide fundamental types, gdb can create + such types using this function. + + FIXME: Some compilers distinguish explicitly signed integral types + (signed short, signed int, signed long) from "regular" integral + types (short, int, long) in the debugging information. There is + some disagreement as to how useful this feature is. In particular, + gcc does not support this. Also, only some debugging formats allow + the distinction to be passed on to a debugger. For now, we always + just use "short", "int", or "long" as the type name, for both the + implicit and explicitly signed types. This also makes life easier + for the gdb test suite since we don't have to account for the + differences in output depending upon what the compiler and + debugging format support. We will probably have to re-examine the + issue when gdb starts taking it's fundamental type information + directly from the debugging information supplied by the compiler. + fnf@cygnus.com */ + +static struct type * +objc_create_fundamental_type (struct objfile *objfile, int typeid) +{ + register struct type *type = NULL; + + switch (typeid) + { + default: + /* FIXME: For now, if we are asked to produce a type not in + this language, create the equivalent of a C integer type + with the name "<?type?>". When all the dust settles from + the type reconstruction work, this should probably become + an error. */ + type = init_type (TYPE_CODE_INT, + TARGET_INT_BIT / TARGET_CHAR_BIT, + 0, "<?type?>", objfile); + warning ("internal error: no C/C++ fundamental type %d", typeid); + break; + case FT_VOID: + type = init_type (TYPE_CODE_VOID, + TARGET_CHAR_BIT / TARGET_CHAR_BIT, + 0, "void", objfile); + break; + case FT_CHAR: + type = init_type (TYPE_CODE_INT, + TARGET_CHAR_BIT / TARGET_CHAR_BIT, + 0, "char", objfile); + break; + case FT_SIGNED_CHAR: + type = init_type (TYPE_CODE_INT, + TARGET_CHAR_BIT / TARGET_CHAR_BIT, + 0, "signed char", objfile); + break; + case FT_UNSIGNED_CHAR: + type = init_type (TYPE_CODE_INT, + TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned char", objfile); + break; + case FT_SHORT: + type = init_type (TYPE_CODE_INT, + TARGET_SHORT_BIT / TARGET_CHAR_BIT, + 0, "short", objfile); + break; + case FT_SIGNED_SHORT: + type = init_type (TYPE_CODE_INT, + TARGET_SHORT_BIT / TARGET_CHAR_BIT, + 0, "short", objfile); /* FIXME-fnf */ + break; + case FT_UNSIGNED_SHORT: + type = init_type (TYPE_CODE_INT, + TARGET_SHORT_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned short", objfile); + break; + case FT_INTEGER: + type = init_type (TYPE_CODE_INT, + TARGET_INT_BIT / TARGET_CHAR_BIT, + 0, "int", objfile); + break; + case FT_SIGNED_INTEGER: + type = init_type (TYPE_CODE_INT, + TARGET_INT_BIT / TARGET_CHAR_BIT, + 0, "int", objfile); /* FIXME -fnf */ + break; + case FT_UNSIGNED_INTEGER: + type = init_type (TYPE_CODE_INT, + TARGET_INT_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned int", objfile); + break; + case FT_LONG: + type = init_type (TYPE_CODE_INT, + TARGET_LONG_BIT / TARGET_CHAR_BIT, + 0, "long", objfile); + break; + case FT_SIGNED_LONG: + type = init_type (TYPE_CODE_INT, + TARGET_LONG_BIT / TARGET_CHAR_BIT, + 0, "long", objfile); /* FIXME -fnf */ + break; + case FT_UNSIGNED_LONG: + type = init_type (TYPE_CODE_INT, + TARGET_LONG_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long", objfile); + break; + case FT_LONG_LONG: + type = init_type (TYPE_CODE_INT, + TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + 0, "long long", objfile); + break; + case FT_SIGNED_LONG_LONG: + type = init_type (TYPE_CODE_INT, + TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + 0, "signed long long", objfile); + break; + case FT_UNSIGNED_LONG_LONG: + type = init_type (TYPE_CODE_INT, + TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); + break; + case FT_FLOAT: + type = init_type (TYPE_CODE_FLT, + TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 0, "float", objfile); + break; + case FT_DBL_PREC_FLOAT: + type = init_type (TYPE_CODE_FLT, + TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "double", objfile); + break; + case FT_EXT_PREC_FLOAT: + type = init_type (TYPE_CODE_FLT, + TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "long double", objfile); + break; + } + return (type); +} + + +/* Table mapping opcodes into strings for printing operators + and precedences of the operators. */ + +static const struct op_print objc_op_print_tab[] = + { + {",", BINOP_COMMA, PREC_COMMA, 0}, + {"=", BINOP_ASSIGN, PREC_ASSIGN, 1}, + {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0}, + {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0}, + {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0}, + {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0}, + {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0}, + {"==", BINOP_EQUAL, PREC_EQUAL, 0}, + {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0}, + {"<=", BINOP_LEQ, PREC_ORDER, 0}, + {">=", BINOP_GEQ, PREC_ORDER, 0}, + {">", BINOP_GTR, PREC_ORDER, 0}, + {"<", BINOP_LESS, PREC_ORDER, 0}, + {">>", BINOP_RSH, PREC_SHIFT, 0}, + {"<<", BINOP_LSH, PREC_SHIFT, 0}, + {"+", BINOP_ADD, PREC_ADD, 0}, + {"-", BINOP_SUB, PREC_ADD, 0}, + {"*", BINOP_MUL, PREC_MUL, 0}, + {"/", BINOP_DIV, PREC_MUL, 0}, + {"%", BINOP_REM, PREC_MUL, 0}, + {"@", BINOP_REPEAT, PREC_REPEAT, 0}, + {"-", UNOP_NEG, PREC_PREFIX, 0}, + {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0}, + {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0}, + {"*", UNOP_IND, PREC_PREFIX, 0}, + {"&", UNOP_ADDR, PREC_PREFIX, 0}, + {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0}, + {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0}, + {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0}, + {NULL, 0, 0, 0} +}; + +struct type ** const (objc_builtin_types[]) = +{ + &builtin_type_int, + &builtin_type_long, + &builtin_type_short, + &builtin_type_char, + &builtin_type_float, + &builtin_type_double, + &builtin_type_void, + &builtin_type_long_long, + &builtin_type_signed_char, + &builtin_type_unsigned_char, + &builtin_type_unsigned_short, + &builtin_type_unsigned_int, + &builtin_type_unsigned_long, + &builtin_type_unsigned_long_long, + &builtin_type_long_double, + &builtin_type_complex, + &builtin_type_double_complex, + 0 +}; + +const struct language_defn objc_language_defn = { + "objective-c", /* Language name */ + language_objc, + objc_builtin_types, + range_check_off, + type_check_off, + case_sensitive_on, + objc_parse, + objc_error, + evaluate_subexp_standard, + objc_printchar, /* Print a character constant */ + objc_printstr, /* Function to print string constant */ + objc_emit_char, + objc_create_fundamental_type, /* Create fundamental type in this language */ + c_print_type, /* Print a type using appropriate syntax */ + c_val_print, /* Print a value using appropriate syntax */ + c_value_print, /* Print a top-level value */ + {"", "", "", ""}, /* Binary format info */ + {"0%lo", "0", "o", ""}, /* Octal format info */ + {"%ld", "", "d", ""}, /* Decimal format info */ + {"0x%lx", "0x", "x", ""}, /* Hex format info */ + objc_op_print_tab, /* Expression operators for printing */ + 1, /* C-style arrays */ + 0, /* String lower bound */ + &builtin_type_char, /* Type of string elements */ + LANG_MAGIC +}; + +/* + * ObjC: + * Following functions help construct Objective-C message calls + */ + +struct selname /* For parsing Objective-C. */ + { + struct selname *next; + char *msglist_sel; + int msglist_len; + }; + +static int msglist_len; +static struct selname *selname_chain; +static char *msglist_sel; + +void +start_msglist(void) +{ + register struct selname *new = + (struct selname *) xmalloc (sizeof (struct selname)); + + new->next = selname_chain; + new->msglist_len = msglist_len; + new->msglist_sel = msglist_sel; + msglist_len = 0; + msglist_sel = (char *)xmalloc(1); + *msglist_sel = 0; + selname_chain = new; +} + +void +add_msglist(struct stoken *str, int addcolon) +{ + char *s, *p; + int len, plen; + + if (str == 0) { /* Unnamed arg, or... */ + if (addcolon == 0) { /* variable number of args. */ + msglist_len++; + return; + } + p = ""; + plen = 0; + } else { + p = str->ptr; + plen = str->length; + } + len = plen + strlen(msglist_sel) + 2; + s = (char *)xmalloc(len); + strcpy(s, msglist_sel); + strncat(s, p, plen); + free(msglist_sel); + msglist_sel = s; + if (addcolon) { + s[len-2] = ':'; + s[len-1] = 0; + msglist_len++; + } else + s[len-2] = '\0'; +} + +int +end_msglist(void) +{ + register int val = msglist_len; + register struct selname *sel = selname_chain; + register char *p = msglist_sel; + int selid; + + selname_chain = sel->next; + msglist_len = sel->msglist_len; + msglist_sel = sel->msglist_sel; + selid = lookup_child_selector(p); + if (!selid) + error("Can't find selector \"%s\"", p); + write_exp_elt_longcst (selid); + free(p); + write_exp_elt_longcst (val); /* Number of args */ + free(sel); + + return val; +} + +/* + * Function: specialcmp (char *a, char *b) + * + * Special strcmp: treats ']' and ' ' as end-of-string. + * Used for qsorting lists of objc methods (either by class or selector). + */ + +int specialcmp(char *a, char *b) +{ + while (*a && *a != ' ' && *a != ']' && *b && *b != ' ' && *b != ']') + { + if (*a != *b) + return *a - *b; + a++, b++; + } + if (*a && *a != ' ' && *a != ']') + return 1; /* a is longer therefore greater */ + if (*b && *b != ' ' && *b != ']') + return -1; /* a is shorter therefore lesser */ + return 0; /* a and b are identical */ +} + +/* + * Function: compare_selectors (void *, void *) + * + * Comparison function for use with qsort. Arguments are symbols or + * msymbols Compares selector part of objc method name alphabetically. + */ + +static int +compare_selectors (void *a, void *b) +{ + char *aname, *bname; + + if ((aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a)) == NULL || + (bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b)) == NULL) + error ("internal: compare_selectors(1)"); + + if ((aname = strchr(aname, ' ')) == NULL || + (bname = strchr(bname, ' ')) == NULL) + error ("internal: compare_selectors(2)"); + + return specialcmp (aname+1, bname+1); +} + +/* + * Function: selectors_info (regexp, from_tty) + * + * Implements the "Info selectors" command. Takes an optional regexp + * arg. Lists all objective c selectors that match the regexp. Works + * by grepping thru all symbols for objective c methods. Output list + * is sorted and uniqued. + */ + +static void +selectors_info (char *regexp, int from_tty) +{ + struct objfile *objfile; + struct minimal_symbol *msymbol; + char *name; + char *val; + int matches = 0; + int maxlen = 0; + int ix; + char myregexp[2048]; + char asel[256]; + struct symbol **sym_arr; + int plusminus = 0; + + if (regexp == NULL) + strcpy(myregexp, ".*]"); /* Null input, match all objc methods. */ + else + { + if (*regexp == '+' || *regexp == '-') + { /* User wants only class methods or only instance methods. */ + plusminus = *regexp++; + while (*regexp == ' ' || *regexp == '\t') + regexp++; + } + if (*regexp == '\0') + strcpy(myregexp, ".*]"); + else + { + strcpy(myregexp, regexp); + if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */ + myregexp[strlen(myregexp) - 1] = ']'; /* end of method name */ + else + strcat(myregexp, ".*]"); + } + } + + if (regexp != NULL) + if (0 != (val = re_comp (myregexp))) + error ("Invalid regexp (%s): %s", val, regexp); + + /* First time thru is JUST to get max length and count. */ + ALL_MSYMBOLS (objfile, msymbol) + { + QUIT; + if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL) + name = SYMBOL_NAME (msymbol); + if (name && + (name[0] == '-' || name[0] == '+') && + name[1] == '[') /* Got a method name. */ + { + /* Filter for class/instance methods. */ + if (plusminus && name[0] != plusminus) + continue; + /* Find selector part. */ + name = (char *) strchr(name+2, ' '); + if (regexp == NULL || re_exec(++name) != 0) + { + char *mystart = name; + char *myend = (char *) strchr(mystart, ']'); + + if (myend && (myend - mystart > maxlen)) + maxlen = myend - mystart; /* Get longest selector. */ + matches++; + } + } + } + if (matches) + { + printf_filtered ("Selectors matching \"%s\":\n\n", + regexp ? regexp : "*"); + + sym_arr = alloca (matches * sizeof (struct symbol *)); + matches = 0; + ALL_MSYMBOLS (objfile, msymbol) + { + QUIT; + if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL) + name = SYMBOL_NAME (msymbol); + if (name && + (name[0] == '-' || name[0] == '+') && + name[1] == '[') /* Got a method name. */ + { + /* Filter for class/instance methods. */ + if (plusminus && name[0] != plusminus) + continue; + /* Find selector part. */ + name = (char *) strchr(name+2, ' '); + if (regexp == NULL || re_exec(++name) != 0) + sym_arr[matches++] = (struct symbol *) msymbol; + } + } + + qsort (sym_arr, matches, sizeof (struct minimal_symbol *), + compare_selectors); + /* Prevent compare on first iteration. */ + asel[0] = 0; + for (ix = 0; ix < matches; ix++) /* Now do the output. */ + { + char *p = asel; + + QUIT; + if ((name = SYMBOL_DEMANGLED_NAME (sym_arr[ix])) == NULL) + name = SYMBOL_NAME (sym_arr[ix]); + name = strchr (name, ' ') + 1; + if (p[0] && specialcmp(name, p) == 0) + continue; /* Seen this one already (not unique). */ + + /* Copy selector part. */ + while (*name && *name != ']') + *p++ = *name++; + *p++ = '\0'; + /* Print in columns. */ + puts_filtered_tabular(asel, maxlen + 1, 0); + } + begin_line(); + } + else + printf_filtered ("No selectors matching \"%s\"\n", regexp ? regexp : "*"); +} + +/* + * Function: compare_classes (void *, void *) + * + * Comparison function for use with qsort. Arguments are symbols or + * msymbols Compares class part of objc method name alphabetically. + */ + +static int +compare_classes (void *a, void *b) +{ + char *aname, *bname; + + if ((aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a)) == NULL || + (bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b)) == NULL) + error ("internal: compare_classes(1)"); + + return specialcmp (aname+1, bname+1); +} + +/* + * Function: classes_info(regexp, from_tty) + * + * Implements the "info classes" command for objective c classes. + * Lists all objective c classes that match the optional regexp. + * Works by grepping thru the list of objective c methods. List will + * be sorted and uniqued (since one class may have many methods). + * BUGS: will not list a class that has no methods. + */ + +static void +classes_info (char *regexp, int from_tty) +{ + struct objfile *objfile; + struct minimal_symbol *msymbol; + char *name; + char *val; + int matches = 0; + int maxlen = 0; + int ix; + char myregexp[2048]; + char aclass[256]; + struct symbol **sym_arr; + + if (regexp == NULL) + strcpy(myregexp, ".* "); /* Null input: match all objc classes. */ + else + { + strcpy(myregexp, regexp); + if (myregexp[strlen(myregexp) - 1] == '$') + /* In the method name, the end of the class name is marked by ' '. */ + myregexp[strlen(myregexp) - 1] = ' '; + else + strcat(myregexp, ".* "); + } + + if (regexp != NULL) + if (0 != (val = re_comp (myregexp))) + error ("Invalid regexp (%s): %s", val, regexp); + + /* First time thru is JUST to get max length and count. */ + ALL_MSYMBOLS (objfile, msymbol) + { + QUIT; + if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL) + name = SYMBOL_NAME (msymbol); + if (name && + (name[0] == '-' || name[0] == '+') && + name[1] == '[') /* Got a method name. */ + if (regexp == NULL || re_exec(name+2) != 0) + { + /* Compute length of classname part. */ + char *mystart = name + 2; + char *myend = (char *) strchr(mystart, ' '); + + if (myend && (myend - mystart > maxlen)) + maxlen = myend - mystart; + matches++; + } + } + if (matches) + { + printf_filtered ("Classes matching \"%s\":\n\n", + regexp ? regexp : "*"); + sym_arr = alloca (matches * sizeof (struct symbol *)); + matches = 0; + ALL_MSYMBOLS (objfile, msymbol) + { + QUIT; + if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL) + name = SYMBOL_NAME (msymbol); + if (name && + (name[0] == '-' || name[0] == '+') && + name[1] == '[') /* Got a method name. */ + if (regexp == NULL || re_exec(name+2) != 0) + sym_arr[matches++] = (struct symbol *) msymbol; + } + + qsort (sym_arr, matches, sizeof (struct minimal_symbol *), + compare_classes); + /* Prevent compare on first iteration. */ + aclass[0] = 0; + for (ix = 0; ix < matches; ix++) /* Now do the output. */ + { + char *p = aclass; + + QUIT; + if ((name = SYMBOL_DEMANGLED_NAME (sym_arr[ix])) == NULL) + name = SYMBOL_NAME (sym_arr[ix]); + name += 2; + if (p[0] && specialcmp(name, p) == 0) + continue; /* Seen this one already (not unique). */ + + /* Copy class part of method name. */ + while (*name && *name != ' ') + *p++ = *name++; + *p++ = '\0'; + /* Print in columns. */ + puts_filtered_tabular(aclass, maxlen + 1, 0); + } + begin_line(); + } + else + printf_filtered ("No classes matching \"%s\"\n", regexp ? regexp : "*"); +} + +/* + * Function: find_imps (char *selector, struct symbol **sym_arr) + * + * Input: a string representing a selector + * a pointer to an array of symbol pointers + * possibly a pointer to a symbol found by the caller. + * + * Output: number of methods that implement that selector. Side + * effects: The array of symbol pointers is filled with matching syms. + * + * By analogy with function "find_methods" (symtab.c), builds a list + * of symbols matching the ambiguous input, so that "decode_line_2" + * (symtab.c) can list them and ask the user to choose one or more. + * In this case the matches are objective c methods + * ("implementations") matching an objective c selector. + * + * Note that it is possible for a normal (c-style) function to have + * the same name as an objective c selector. To prevent the selector + * from eclipsing the function, we allow the caller (decode_line_1) to + * search for such a function first, and if it finds one, pass it in + * to us. We will then integrate it into the list. We also search + * for one here, among the minsyms. + * + * NOTE: if NUM_DEBUGGABLE is non-zero, the sym_arr will be divided + * into two parts: debuggable (struct symbol) syms, and + * non_debuggable (struct minimal_symbol) syms. The debuggable + * ones will come first, before NUM_DEBUGGABLE (which will thus + * be the index of the first non-debuggable one). + */ + +/* + * Function: total_number_of_imps (char *selector); + * + * Input: a string representing a selector + * Output: number of methods that implement that selector. + * + * By analogy with function "total_number_of_methods", this allows + * decode_line_1 (symtab.c) to detect if there are objective c methods + * matching the input, and to allocate an array of pointers to them + * which can be manipulated by "decode_line_2" (also in symtab.c). + */ + +char * +parse_selector (char *method, char **selector) +{ + char *s1 = NULL; + char *s2 = NULL; + int found_quote = 0; + + char *nselector = NULL; + + CHECK (selector != NULL); + + s1 = method; + + while (isspace (*s1)) + s1++; + if (*s1 == '\'') + { + found_quote = 1; + s1++; + } + while (isspace (*s1)) + s1++; + + nselector = s1; + s2 = s1; + + for (;;) { + if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':')) + *s1++ = *s2; + else if (isspace (*s2)) + ; + else if ((*s2 == '\0') || (*s2 == '\'')) + break; + else + return NULL; + s2++; + } + *s1++ = '\0'; + + while (isspace (*s2)) + s2++; + if (found_quote) + { + if (*s2 == '\'') + s2++; + while (isspace (*s2)) + s2++; + } + + if (selector != NULL) + *selector = nselector; + + return s2; +} + +char * +parse_method (char *method, char *type, char **class, + char **category, char **selector) +{ + char *s1 = NULL; + char *s2 = NULL; + int found_quote = 0; + + char ntype = '\0'; + char *nclass = NULL; + char *ncategory = NULL; + char *nselector = NULL; + + CHECK (type != NULL); + CHECK (class != NULL); + CHECK (category != NULL); + CHECK (selector != NULL); + + s1 = method; + + while (isspace (*s1)) + s1++; + if (*s1 == '\'') + { + found_quote = 1; + s1++; + } + while (isspace (*s1)) + s1++; + + if ((s1[0] == '+') || (s1[0] == '-')) + ntype = *s1++; + + while (isspace (*s1)) + s1++; + + if (*s1 != '[') + return NULL; + s1++; + + nclass = s1; + while (isalnum (*s1) || (*s1 == '_')) + s1++; + + s2 = s1; + while (isspace (*s2)) + s2++; + + if (*s2 == '(') + { + s2++; + while (isspace (*s2)) + s2++; + ncategory = s2; + while (isalnum (*s2) || (*s2 == '_')) + s2++; + *s2++ = '\0'; + } + + /* Truncate the class name now that we're not using the open paren. */ + *s1++ = '\0'; + + nselector = s2; + s1 = s2; + + for (;;) { + if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':')) + *s1++ = *s2; + else if (isspace (*s2)) + ; + else if (*s2 == ']') + break; + else + return NULL; + s2++; + } + *s1++ = '\0'; + s2++; + + while (isspace (*s2)) + s2++; + if (found_quote) + { + if (*s2 != '\'') + return NULL; + s2++; + while (isspace (*s2)) + s2++; + } + + if (type != NULL) + *type = ntype; + if (class != NULL) + *class = nclass; + if (category != NULL) + *category = ncategory; + if (selector != NULL) + *selector = nselector; + + return s2; +} + +void +find_methods (struct symtab *symtab, char type, + const char *class, const char *category, + const char *selector, struct symbol **syms, + unsigned int *nsym, unsigned int *ndebug) +{ + struct objfile *objfile = NULL; + struct minimal_symbol *msymbol = NULL; + struct block *block = NULL; + struct symbol *sym = NULL; + + char *symname = NULL; + + char ntype = '\0'; + char *nclass = NULL; + char *ncategory = NULL; + char *nselector = NULL; + + unsigned int csym = 0; + unsigned int cdebug = 0; + + static char *tmp = NULL; + static unsigned int tmplen = 0; + + CHECK (nsym != NULL); + CHECK (ndebug != NULL); + + if (symtab) + block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK); + + ALL_MSYMBOLS (objfile, msymbol) + { + QUIT; + + if ((msymbol->type != mst_text) && (msymbol->type != mst_file_text)) + /* Not a function or method. */ + continue; + + if (symtab) + if ((SYMBOL_VALUE_ADDRESS (msymbol) < block->startaddr) || + (SYMBOL_VALUE_ADDRESS (msymbol) >= block->endaddr)) + /* Not in the specified symtab. */ + continue; + + symname = SYMBOL_DEMANGLED_NAME (msymbol); + if (symname == NULL) + symname = SYMBOL_NAME (msymbol); + if (symname == NULL) + continue; + + if ((symname[0] != '-' && symname[0] != '+') || (symname[1] != '[')) + /* Not a method name. */ + continue; + + while ((strlen (symname) + 1) >= tmplen) + { + tmplen = (tmplen == 0) ? 1024 : tmplen * 2; + tmp = xrealloc (tmp, tmplen); + } + strcpy (tmp, symname); + + if (parse_method (tmp, &ntype, &nclass, &ncategory, &nselector) == NULL) + continue; + + if ((type != '\0') && (ntype != type)) + continue; + + if ((class != NULL) + && ((nclass == NULL) || (strcmp (class, nclass) != 0))) + continue; + + if ((category != NULL) && + ((ncategory == NULL) || (strcmp (category, ncategory) != 0))) + continue; + + if ((selector != NULL) && + ((nselector == NULL) || (strcmp (selector, nselector) != 0))) + continue; + + sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); + if (sym != NULL) + { + const char *newsymname = SYMBOL_DEMANGLED_NAME (sym); + + if (newsymname == NULL) + newsymname = SYMBOL_NAME (sym); + if (strcmp (symname, newsymname) == 0) + { + /* Found a high-level method sym: swap it into the + lower part of sym_arr (below num_debuggable). */ + if (syms != NULL) + { + syms[csym] = syms[cdebug]; + syms[cdebug] = sym; + } + csym++; + cdebug++; + } + else + { + warning ( +"debugging symbol \"%s\" does not match minimal symbol (\"%s\"); ignoring", + newsymname, symname); + if (syms != NULL) + syms[csym] = (struct symbol *) msymbol; + csym++; + } + } + else + { + /* Found a non-debuggable method symbol. */ + if (syms != NULL) + syms[csym] = (struct symbol *) msymbol; + csym++; + } + } + + if (nsym != NULL) + *nsym = csym; + if (ndebug != NULL) + *ndebug = cdebug; +} + +char *find_imps (struct symtab *symtab, struct block *block, + char *method, struct symbol **syms, + unsigned int *nsym, unsigned int *ndebug) +{ + char type = '\0'; + char *class = NULL; + char *category = NULL; + char *selector = NULL; + + unsigned int csym = 0; + unsigned int cdebug = 0; + + unsigned int ncsym = 0; + unsigned int ncdebug = 0; + + char *buf = NULL; + char *tmp = NULL; + + CHECK (nsym != NULL); + CHECK (ndebug != NULL); + + if (nsym != NULL) + *nsym = 0; + if (ndebug != NULL) + *ndebug = 0; + + buf = (char *) alloca (strlen (method) + 1); + strcpy (buf, method); + tmp = parse_method (buf, &type, &class, &category, &selector); + + if (tmp == NULL) { + + struct symtab *sym_symtab = NULL; + struct symbol *sym = NULL; + struct minimal_symbol *msym = NULL; + + strcpy (buf, method); + tmp = parse_selector (buf, &selector); + + if (tmp == NULL) + return NULL; + + sym = lookup_symbol (selector, block, VAR_NAMESPACE, 0, &sym_symtab); + if (sym != NULL) + { + if (syms) + syms[csym] = sym; + csym++; + cdebug++; + } + + if (sym == NULL) + msym = lookup_minimal_symbol (selector, 0, 0); + + if (msym != NULL) + { + if (syms) + syms[csym] = msym; + csym++; + } + } + + if (syms != NULL) + find_methods (symtab, type, class, category, selector, + syms + csym, &ncsym, &ncdebug); + else + find_methods (symtab, type, class, category, selector, + NULL, &ncsym, &ncdebug); + + /* If we didn't find any methods, just return. */ + if (ncsym == 0 && ncdebug == 0) + return method; + + /* Take debug symbols from the second batch of symbols and swap them + * with debug symbols from the first batch. Repeat until either the + * second section is out of debug symbols or the first section is + * full of debug symbols. Either way we have all debug symbols + * packed to the beginning of the buffer. + */ + + if (syms != NULL) + { + while ((cdebug < csym) && (ncdebug > 0)) + { + struct symbol *s = NULL; + /* First non-debugging symbol. */ + unsigned int i = cdebug; + /* Last of second batch of debug symbols. */ + unsigned int j = csym + ncdebug - 1; + + s = syms[j]; + syms[j] = syms[i]; + syms[i] = s; + + /* We've moved a symbol from the second debug section to the + first one. */ + cdebug++; + ncdebug--; + } + } + + csym += ncsym; + cdebug += ncdebug; + + if (nsym != NULL) + *nsym = csym; + if (ndebug != NULL) + *ndebug = cdebug; + + if (syms == NULL) + return method + (tmp - buf); + + if (csym > 1) + { + /* Sort debuggable symbols. */ + if (cdebug > 1) + qsort (syms, cdebug, sizeof (struct minimal_symbol *), + compare_classes); + + /* Sort minimal_symbols. */ + if ((csym - cdebug) > 1) + qsort (&syms[cdebug], csym - cdebug, + sizeof (struct minimal_symbol *), compare_classes); + } + /* Terminate the sym_arr list. */ + syms[csym] = 0; + + return method + (tmp - buf); +} + +void +print_object_command (char *args, int from_tty) +{ + struct value *object, *function, *description; + CORE_ADDR string_addr; + int i = 0; + char c = -1; + + if (!args || !*args) + error ( +"The 'print-object' command requires an argument (an Objective-C object)"); + + { + struct expression *expr = parse_expression (args); + register struct cleanup *old_chain = + make_cleanup (free_current_contents, &expr); + int pc = 0; + +#if 1 + object = expr->language_defn->evaluate_exp (builtin_type_void_data_ptr, + expr, &pc, EVAL_NORMAL); +#else + object = evaluate_subexp (builtin_type_void_data_ptr, + expr, &pc, EVAL_NORMAL); +#endif + do_cleanups (old_chain); + } + + if (!(function = find_function_in_inferior ("_NSPrintForDebugger"))) + error ("Unable to locate _NSPrintForDebugger in child process"); + + description = call_function_by_hand (function, 1, &object); + + if ((string_addr = value_as_long (description)) == 0) + error ("object returns null description"); + + read_memory (string_addr + i++, &c, 1); + if (c != '\0') + do + { /* Read and print characters up to EOS. */ + QUIT; + printf_filtered ("%c", c); + read_memory (string_addr + i++, &c, 1); + } while (c != 0); + else + printf_filtered("<object returns empty description>"); + printf_filtered ("\n"); +} + +/* The data structure 'methcalls' is used to detect method calls (thru + * ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.), + * and ultimately find the method being called. + */ + +struct objc_methcall { + char *name; + /* Return instance method to be called. */ + CORE_ADDR (*stop_at) (CORE_ADDR); + /* Start of pc range corresponding to method invocation. */ + CORE_ADDR begin; + /* End of pc range corresponding to method invocation. */ + CORE_ADDR end; +}; + +static int resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc); +static int resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc); +static int resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc); +static int resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc); + +static struct objc_methcall methcalls[] = { + { "_objc_msgSend", resolve_msgsend, 0, 0}, + { "_objc_msgSend_stret", resolve_msgsend_stret, 0, 0}, + { "_objc_msgSendSuper", resolve_msgsend_super, 0, 0}, + { "_objc_msgSendSuper_stret", resolve_msgsend_super_stret, 0, 0}, + { "_objc_getClass", NULL, 0, 0}, + { "_objc_getMetaClass", NULL, 0, 0} +}; + +#define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0])) + +/* The following function, "find_objc_msgsend", fills in the data + * structure "objc_msgs" by finding the addresses of each of the + * (currently four) functions that it holds (of which objc_msgSend is + * the first). This must be called each time symbols are loaded, in + * case the functions have moved for some reason. + */ + +void +find_objc_msgsend (void) +{ + unsigned int i; + for (i = 0; i < nmethcalls; i++) { + + struct minimal_symbol *func; + + /* Try both with and without underscore. */ + func = lookup_minimal_symbol (methcalls[i].name, NULL, NULL); + if ((func == NULL) && (methcalls[i].name[0] == '_')) { + func = lookup_minimal_symbol (methcalls[i].name + 1, NULL, NULL); + } + if (func == NULL) { + methcalls[i].begin = 0; + methcalls[i].end = 0; + continue; + } + + methcalls[i].begin = SYMBOL_VALUE_ADDRESS (func); + do { + methcalls[i].end = SYMBOL_VALUE_ADDRESS (++func); + } while (methcalls[i].begin == methcalls[i].end); + } +} + +/* find_objc_msgcall (replaces pc_off_limits) + * + * ALL that this function now does is to determine whether the input + * address ("pc") is the address of one of the Objective-C message + * dispatch functions (mainly objc_msgSend or objc_msgSendSuper), and + * if so, it returns the address of the method that will be called. + * + * The old function "pc_off_limits" used to do a lot of other things + * in addition, such as detecting shared library jump stubs and + * returning the address of the shlib function that would be called. + * That functionality has been moved into the SKIP_TRAMPOLINE_CODE and + * IN_SOLIB_TRAMPOLINE macros, which are resolved in the target- + * dependent modules. + */ + +struct objc_submethod_helper_data { + CORE_ADDR (*f) (CORE_ADDR, CORE_ADDR *); + CORE_ADDR pc; + CORE_ADDR *new_pc; +}; + +int +find_objc_msgcall_submethod_helper (PTR arg) +{ + struct objc_submethod_helper_data *s = + (struct objc_submethod_helper_data *) arg; + + if (s->f (s->pc, s->new_pc) == 0) + return 1; + else + return 0; +} + +int +find_objc_msgcall_submethod (CORE_ADDR (*f) (CORE_ADDR, CORE_ADDR *), + CORE_ADDR pc, + CORE_ADDR *new_pc) +{ + struct objc_submethod_helper_data s; + + s.f = f; + s.pc = pc; + s.new_pc = new_pc; + + if (catch_errors (find_objc_msgcall_submethod_helper, + (PTR) &s, + "Unable to determine target of Objective-C method call (ignoring):\n", + RETURN_MASK_ALL) == 0) + return 1; + else + return 0; +} + +int +find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc) +{ + unsigned int i; + + find_objc_msgsend (); + if (new_pc != NULL) { *new_pc = 0; } + + for (i = 0; i < nmethcalls; i++) + if ((pc >= methcalls[i].begin) && (pc < methcalls[i].end)) + { + if (methcalls[i].stop_at != NULL) + return find_objc_msgcall_submethod (methcalls[i].stop_at, + pc, new_pc); + else + return 0; + } + + return 0; +} + +void +_initialize_objc_language (void) +{ + add_language (&objc_language_defn); + add_info ("selectors", selectors_info, /* INFO SELECTORS command. */ + "All Objective-C selectors, or those matching REGEXP."); + add_info ("classes", classes_info, /* INFO CLASSES command. */ + "All Objective-C classes, or those matching REGEXP."); + add_com ("print-object", class_vars, print_object_command, + "Ask an Objective-C object to print itself.\n"); + add_com_alias ("po", "print-object", class_vars, 1); +} + +#if defined (__powerpc__) || defined (__ppc__) +static unsigned long FETCH_ARGUMENT (int i) +{ + return read_register (3 + i); +} +#elif defined (__i386__) +static unsigned long FETCH_ARGUMENT (int i) +{ + CORE_ADDR stack = read_register (SP_REGNUM); + return read_memory_unsigned_integer (stack + (4 * (i + 1)), 4); +} +#elif defined (__sparc__) +static unsigned long FETCH_ARGUMENT (int i) +{ + return read_register (O0_REGNUM + i); +} +#elif defined (__hppa__) || defined (__hppa) +static unsigned long FETCH_ARGUMENT (int i) +{ + return read_register (R0_REGNUM + 26 - i); +} +#else +#error unknown architecture +#endif + +#if defined (__hppa__) || defined (__hppa) +static CORE_ADDR CONVERT_FUNCPTR (CORE_ADDR pc) +{ + if (pc & 0x2) + pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, 4); + + return pc; +} +#else +static CORE_ADDR CONVERT_FUNCPTR (CORE_ADDR pc) +{ + return pc; +} +#endif + +static void +read_objc_method (CORE_ADDR addr, struct objc_method *method) +{ + method->name = read_memory_unsigned_integer (addr + 0, 4); + method->types = read_memory_unsigned_integer (addr + 4, 4); + method->imp = read_memory_unsigned_integer (addr + 8, 4); +} + +static +unsigned long read_objc_methlist_nmethods (CORE_ADDR addr) +{ + return read_memory_unsigned_integer (addr + 4, 4); +} + +static void +read_objc_methlist_method (CORE_ADDR addr, unsigned long num, + struct objc_method *method) +{ + CHECK_FATAL (num < read_objc_methlist_nmethods (addr)); + read_objc_method (addr + 8 + (12 * num), method); +} + +static void +read_objc_object (CORE_ADDR addr, struct objc_object *object) +{ + object->isa = read_memory_unsigned_integer (addr, 4); +} + +static void +read_objc_super (CORE_ADDR addr, struct objc_super *super) +{ + super->receiver = read_memory_unsigned_integer (addr, 4); + super->class = read_memory_unsigned_integer (addr + 4, 4); +}; + +static void +read_objc_class (CORE_ADDR addr, struct objc_class *class) +{ + class->isa = read_memory_unsigned_integer (addr, 4); + class->super_class = read_memory_unsigned_integer (addr + 4, 4); + class->name = read_memory_unsigned_integer (addr + 8, 4); + class->version = read_memory_unsigned_integer (addr + 12, 4); + class->info = read_memory_unsigned_integer (addr + 16, 4); + class->instance_size = read_memory_unsigned_integer (addr + 18, 4); + class->ivars = read_memory_unsigned_integer (addr + 24, 4); + class->methods = read_memory_unsigned_integer (addr + 28, 4); + class->cache = read_memory_unsigned_integer (addr + 32, 4); + class->protocols = read_memory_unsigned_integer (addr + 36, 4); +} + +CORE_ADDR +find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel) +{ + CORE_ADDR subclass = class; + + while (subclass != 0) + { + + struct objc_class class_str; + unsigned mlistnum = 0; + + read_objc_class (subclass, &class_str); + + for (;;) + { + CORE_ADDR mlist; + unsigned long nmethods; + unsigned long i; + + mlist = read_memory_unsigned_integer (class_str.methods + + (4 * mlistnum), 4); + if (mlist == 0) + break; + + nmethods = read_objc_methlist_nmethods (mlist); + + for (i = 0; i < nmethods; i++) + { + struct objc_method meth_str; + read_objc_methlist_method (mlist, i, &meth_str); + +#if 0 + fprintf (stderr, + "checking method 0x%lx against selector 0x%lx\n", + meth_str.name, sel); +#endif + + if (meth_str.name == sel) + return CONVERT_FUNCPTR (meth_str.imp); + } + mlistnum++; + } + subclass = class_str.super_class; + } + + return 0; +} + +CORE_ADDR +find_implementation (CORE_ADDR object, CORE_ADDR sel) +{ + struct objc_object ostr; + + if (object == 0) + return 0; + read_objc_object (object, &ostr); + if (ostr.isa == 0) + return 0; + + return find_implementation_from_class (ostr.isa, sel); +} + +static int +resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc) +{ + CORE_ADDR object; + CORE_ADDR sel; + CORE_ADDR res; + + object = FETCH_ARGUMENT (0); + sel = FETCH_ARGUMENT (1); + + res = find_implementation (object, sel); + if (new_pc != 0) + *new_pc = res; + if (res == 0) + return 1; + return 0; +} + +static int +resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc) +{ + CORE_ADDR object; + CORE_ADDR sel; + CORE_ADDR res; + + object = FETCH_ARGUMENT (1); + sel = FETCH_ARGUMENT (2); + + res = find_implementation (object, sel); + if (new_pc != 0) + *new_pc = res; + if (res == 0) + return 1; + return 0; +} + +static int +resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc) +{ + struct objc_super sstr; + + CORE_ADDR super; + CORE_ADDR sel; + CORE_ADDR res; + + super = FETCH_ARGUMENT (0); + sel = FETCH_ARGUMENT (1); + + read_objc_super (super, &sstr); + if (sstr.class == 0) + return 0; + + res = find_implementation_from_class (sstr.class, sel); + if (new_pc != 0) + *new_pc = res; + if (res == 0) + return 1; + return 0; +} + +static int +resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc) +{ + struct objc_super sstr; + + CORE_ADDR super; + CORE_ADDR sel; + CORE_ADDR res; + + super = FETCH_ARGUMENT (1); + sel = FETCH_ARGUMENT (2); + + read_objc_super (super, &sstr); + if (sstr.class == 0) + return 0; + + res = find_implementation_from_class (sstr.class, sel); + if (new_pc != 0) + *new_pc = res; + if (res == 0) + return 1; + return 0; +} diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h new file mode 100644 index 00000000000..87e315b5c06 --- /dev/null +++ b/gdb/objc-lang.h @@ -0,0 +1,57 @@ +/* Objective-C language support definitions for GDB, the GNU debugger. + + Copyright 1992 Free Software Foundation, Inc. + + Contributed by Apple Computer, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifdef __STDC__ /* Forward decls for prototypes. */ +struct value; +#endif + +extern int objc_parse (void); /* Defined in c-exp.y */ + +extern void objc_error (char *); /* Defined in c-exp.y */ + +extern int c_val_print (struct type *, char *, int, + CORE_ADDR, struct ui_file *, int, + int, int, enum val_prettyprint); + +extern int c_value_print (struct value *, struct ui_file *, + int, enum val_prettyprint); + +extern CORE_ADDR lookup_objc_class (char *classname); +extern int lookup_child_selector (char *methodname); + +char *objc_demangle (const char *mangled); + +int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc); + +char *parse_selector (char *method, char **selector); + +char *parse_method (char *method, char *type, + char **class, char **category, + char **selector); + +void find_methods (struct symtab *symtab, char type, + const char *class, const char *category, + const char *selector, struct symbol **syms, + unsigned int *nsym, unsigned int *ndebug); + +char *find_imps (struct symtab *symtab, struct block *block, + char *method, struct symbol **syms, + unsigned int *nsym, unsigned int *ndebug); diff --git a/gdb/osabi.c b/gdb/osabi.c index 682dbba9c6f..7caebf3d3c5 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -45,6 +45,7 @@ static const char * const gdb_osabi_names[] = "NetWare", "Irix", "LynxOS", + "Interix", "ARM EABI v1", "ARM EABI v2", diff --git a/gdb/osabi.h b/gdb/osabi.h index f62bde71c4e..56bb0a11f38 100644 --- a/gdb/osabi.h +++ b/gdb/osabi.h @@ -41,6 +41,7 @@ enum gdb_osabi GDB_OSABI_NETWARE, GDB_OSABI_IRIX, GDB_OSABI_LYNXOS, + GDB_OSABI_INTERIX, GDB_OSABI_ARM_EABI_V1, GDB_OSABI_ARM_EABI_V2, diff --git a/gdb/osfsolib.c b/gdb/osfsolib.c deleted file mode 100644 index 345ab0831a9..00000000000 --- a/gdb/osfsolib.c +++ /dev/null @@ -1,938 +0,0 @@ -/* Handle OSF/1 shared libraries for GDB, the GNU Debugger. - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* FIXME: Most of this code could be merged with solib.c by using - next_link_map_member and xfer_link_map_member in solib.c. */ - -#include "defs.h" - -#include <sys/types.h> -#include <signal.h> -#include "gdb_string.h" -#include <fcntl.h> - -#include "symtab.h" -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include "gdbcore.h" -#include "command.h" -#include "target.h" -#include "frame.h" -#include "gdb_regex.h" -#include "inferior.h" -#include "language.h" -#include "gdbcmd.h" - -#define MAX_PATH_SIZE 1024 /* FIXME: Should be dynamic */ - -/* When handling shared libraries, GDB has to find out the pathnames - of all shared libraries that are currently loaded (to read in their - symbols) and where the shared libraries are loaded in memory - (to relocate them properly from their prelinked addresses to the - current load address). - - Under OSF/1 there are two possibilities to get at this information: - 1) Peek around in the runtime loader structures. - These are not documented, and they are not defined in the system - header files. The definitions below were obtained by experimentation, - but they seem stable enough. - 2) Use the undocumented libxproc.a library, which contains the - equivalent ldr_* routines. - This approach is somewhat cleaner, but it requires that the GDB - executable is dynamically linked. In addition it requires a - NAT_CLIBS= -lxproc -Wl,-expect_unresolved,ldr_process_context - linker specification for GDB and all applications that are using - libgdb. - We will use the peeking approach until it becomes unwieldy. */ - -#ifndef USE_LDR_ROUTINES - -/* Definition of runtime loader structures, found by experimentation. */ -#define RLD_CONTEXT_ADDRESS 0x3ffc0000000 - -typedef struct - { - CORE_ADDR next; - CORE_ADDR previous; - CORE_ADDR unknown1; - char *module_name; - CORE_ADDR modinfo_addr; - long module_id; - CORE_ADDR unknown2; - CORE_ADDR unknown3; - long region_count; - CORE_ADDR regioninfo_addr; - } -ldr_module_info_t; - -typedef struct - { - long unknown1; - CORE_ADDR regionname_addr; - long protection; - CORE_ADDR vaddr; - CORE_ADDR mapaddr; - long size; - long unknown2[5]; - } -ldr_region_info_t; - -typedef struct - { - CORE_ADDR unknown1; - CORE_ADDR unknown2; - CORE_ADDR head; - CORE_ADDR tail; - } -ldr_context_t; - -static ldr_context_t ldr_context; - -#else - -#include <loader.h> -static ldr_process_t fake_ldr_process; - -/* Called by ldr_* routines to read memory from the current target. */ - -static int ldr_read_memory (CORE_ADDR, char *, int, int); - -static int -ldr_read_memory (CORE_ADDR memaddr, char *myaddr, int len, int readstring) -{ - int result; - char *buffer; - - if (readstring) - { - target_read_string (memaddr, &buffer, len, &result); - if (result == 0) - strcpy (myaddr, buffer); - xfree (buffer); - } - else - result = target_read_memory (memaddr, myaddr, len); - - if (result != 0) - result = -result; - return result; -} - -#endif - -/* Define our own link_map structure. - This will help to share code with solib.c. */ - -struct link_map -{ - CORE_ADDR l_offset; /* prelink to load address offset */ - char *l_name; /* full name of loaded object */ - ldr_module_info_t module_info; /* corresponding module info */ -}; - -#define LM_OFFSET(so) ((so) -> lm.l_offset) -#define LM_NAME(so) ((so) -> lm.l_name) - -struct so_list - { - struct so_list *next; /* next structure in linked list */ - struct link_map lm; /* copy of link map from inferior */ - struct link_map *lmaddr; /* addr in inferior lm was read from */ - CORE_ADDR lmend; /* upper addr bound of mapped object */ - char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */ - char symbols_loaded; /* flag: symbols read in yet? */ - char from_tty; /* flag: print msgs? */ - struct objfile *objfile; /* objfile for loaded lib */ - struct section_table *sections; - struct section_table *sections_end; - struct section_table *textsection; - bfd *abfd; - }; - -static struct so_list *so_list_head; /* List of known shared objects */ - -extern int fdmatch (int, int); /* In libiberty */ - -/* Local function prototypes */ - -static void sharedlibrary_command (char *, int); - -static void info_sharedlibrary_command (char *, int); - -static int symbol_add_stub (char *); - -static struct so_list *find_solib (struct so_list *); - -static struct link_map *first_link_map_member (void); - -static struct link_map *next_link_map_member (struct so_list *); - -static void xfer_link_map_member (struct so_list *, struct link_map *); - -static int solib_map_sections (char *); - -/* - - LOCAL FUNCTION - - solib_map_sections -- open bfd and build sections for shared lib - - SYNOPSIS - - static int solib_map_sections (struct so_list *so) - - DESCRIPTION - - Given a pointer to one of the shared objects in our list - of mapped objects, use the recorded name to open a bfd - descriptor for the object, build a section table, and then - relocate all the section addresses by the base address at - which the shared object was mapped. - - FIXMES - - In most (all?) cases the shared object file name recorded in the - dynamic linkage tables will be a fully qualified pathname. For - cases where it isn't, do we really mimic the systems search - mechanism correctly in the below code (particularly the tilde - expansion stuff?). - */ - -static int -solib_map_sections (char *arg) -{ - struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */ - char *filename; - char *scratch_pathname; - int scratch_chan; - struct section_table *p; - struct cleanup *old_chain; - bfd *abfd; - - filename = tilde_expand (so->so_name); - old_chain = make_cleanup (xfree, filename); - - scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, - &scratch_pathname); - if (scratch_chan < 0) - { - scratch_chan = openp (getenv ("LD_LIBRARY_PATH"), 1, filename, - O_RDONLY, 0, &scratch_pathname); - } - if (scratch_chan < 0) - { - perror_with_name (filename); - } - /* Leave scratch_pathname allocated. bfd->name will point to it. */ - - abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan); - if (!abfd) - { - close (scratch_chan); - error ("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - /* Leave bfd open, core_xfer_memory and "info files" need it. */ - so->abfd = abfd; - abfd->cacheable = 1; - - if (!bfd_check_format (abfd, bfd_object)) - { - error ("\"%s\": not in executable format: %s.", - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - if (build_section_table (abfd, &so->sections, &so->sections_end)) - { - error ("Can't find the file sections in `%s': %s", - bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ())); - } - - for (p = so->sections; p < so->sections_end; p++) - { - /* Relocate the section binding addresses as recorded in the shared - object's file by the offset to get the address to which the - object was actually mapped. */ - p->addr += LM_OFFSET (so); - p->endaddr += LM_OFFSET (so); - so->lmend = (CORE_ADDR) max (p->endaddr, so->lmend); - if (STREQ (p->the_bfd_section->name, ".text")) - { - so->textsection = p; - } - } - - /* Free the file names, close the file now. */ - do_cleanups (old_chain); - - return (1); -} - -/* - - LOCAL FUNCTION - - first_link_map_member -- locate first member in dynamic linker's map - - SYNOPSIS - - static struct link_map *first_link_map_member (void) - - DESCRIPTION - - Read in a copy of the first member in the inferior's dynamic - link map from the inferior's dynamic linker structures, and return - a pointer to the copy in our address space. - */ - -static struct link_map * -first_link_map_member (void) -{ - struct link_map *lm = NULL; - static struct link_map first_lm; - -#ifdef USE_LDR_ROUTINES - ldr_module_t mod_id = LDR_NULL_MODULE; - size_t retsize; - - fake_ldr_process = ldr_core_process (); - ldr_set_core_reader (ldr_read_memory); - ldr_xdetach (fake_ldr_process); - if (ldr_xattach (fake_ldr_process) != 0 - || ldr_next_module (fake_ldr_process, &mod_id) != 0 - || mod_id == LDR_NULL_MODULE - || ldr_inq_module (fake_ldr_process, mod_id, - &first_lm.module_info, sizeof (ldr_module_info_t), - &retsize) != 0) - return lm; -#else - CORE_ADDR ldr_context_addr; - - if (target_read_memory ((CORE_ADDR) RLD_CONTEXT_ADDRESS, - (char *) &ldr_context_addr, - sizeof (CORE_ADDR)) != 0 - || target_read_memory (ldr_context_addr, - (char *) &ldr_context, - sizeof (ldr_context_t)) != 0 - || target_read_memory ((CORE_ADDR) ldr_context.head, - (char *) &first_lm.module_info, - sizeof (ldr_module_info_t)) != 0) - return lm; -#endif - - lm = &first_lm; - - /* The first entry is for the main program and should be skipped. */ - lm->l_name = NULL; - - return lm; -} - -static struct link_map * -next_link_map_member (struct so_list *so_list_ptr) -{ - struct link_map *lm = NULL; - static struct link_map next_lm; -#ifdef USE_LDR_ROUTINES - ldr_module_t mod_id = so_list_ptr->lm.module_info.lmi_modid; - size_t retsize; - - if (ldr_next_module (fake_ldr_process, &mod_id) != 0 - || mod_id == LDR_NULL_MODULE - || ldr_inq_module (fake_ldr_process, mod_id, - &next_lm.module_info, sizeof (ldr_module_info_t), - &retsize) != 0) - return lm; - - lm = &next_lm; - lm->l_name = lm->module_info.lmi_name; -#else - CORE_ADDR ldr_context_addr; - - /* Reread context in case ldr_context.tail was updated. */ - - if (target_read_memory ((CORE_ADDR) RLD_CONTEXT_ADDRESS, - (char *) &ldr_context_addr, - sizeof (CORE_ADDR)) != 0 - || target_read_memory (ldr_context_addr, - (char *) &ldr_context, - sizeof (ldr_context_t)) != 0 - || so_list_ptr->lm.module_info.modinfo_addr == ldr_context.tail - || target_read_memory (so_list_ptr->lm.module_info.next, - (char *) &next_lm.module_info, - sizeof (ldr_module_info_t)) != 0) - return lm; - - lm = &next_lm; - lm->l_name = lm->module_info.module_name; -#endif - return lm; -} - -static void -xfer_link_map_member (struct so_list *so_list_ptr, struct link_map *lm) -{ - int i; - so_list_ptr->lm = *lm; - - /* OSF/1 shared libraries are pre-linked to particular addresses, - but the runtime loader may have to relocate them if the - address ranges of the libraries used by the target executable clash, - or if the target executable is linked with the -taso option. - The offset is the difference between the address where the shared - library is mapped and the pre-linked address of the shared library. - - FIXME: GDB is currently unable to relocate the shared library - sections by different offsets. If sections are relocated by - different offsets, put out a warning and use the offset of the - first section for all remaining sections. */ - LM_OFFSET (so_list_ptr) = 0; - - /* There is one entry that has no name (for the inferior executable) - since it is not a shared object. */ - if (LM_NAME (so_list_ptr) != 0) - { - -#ifdef USE_LDR_ROUTINES - int len = strlen (LM_NAME (so_list_ptr) + 1); - - if (len > MAX_PATH_SIZE) - len = MAX_PATH_SIZE; - strncpy (so_list_ptr->so_name, LM_NAME (so_list_ptr), MAX_PATH_SIZE); - so_list_ptr->so_name[MAX_PATH_SIZE - 1] = '\0'; - - for (i = 0; i < lm->module_info.lmi_nregion; i++) - { - ldr_region_info_t region_info; - size_t retsize; - CORE_ADDR region_offset; - - if (ldr_inq_region (fake_ldr_process, lm->module_info.lmi_modid, - i, ®ion_info, sizeof (region_info), - &retsize) != 0) - break; - region_offset = (CORE_ADDR) region_info.lri_mapaddr - - (CORE_ADDR) region_info.lri_vaddr; - if (i == 0) - LM_OFFSET (so_list_ptr) = region_offset; - else if (LM_OFFSET (so_list_ptr) != region_offset) - warning ("cannot handle shared library relocation for %s (%s)", - so_list_ptr->so_name, region_info.lri_name); - } -#else - int errcode; - char *buffer; - target_read_string ((CORE_ADDR) LM_NAME (so_list_ptr), &buffer, - MAX_PATH_SIZE - 1, &errcode); - if (errcode != 0) - error ("xfer_link_map_member: Can't read pathname for load map: %s\n", - safe_strerror (errcode)); - strncpy (so_list_ptr->so_name, buffer, MAX_PATH_SIZE - 1); - xfree (buffer); - so_list_ptr->so_name[MAX_PATH_SIZE - 1] = '\0'; - - for (i = 0; i < lm->module_info.region_count; i++) - { - ldr_region_info_t region_info; - CORE_ADDR region_offset; - - if (target_read_memory (lm->module_info.regioninfo_addr - + i * sizeof (region_info), - (char *) ®ion_info, - sizeof (region_info)) != 0) - break; - region_offset = region_info.mapaddr - region_info.vaddr; - if (i == 0) - LM_OFFSET (so_list_ptr) = region_offset; - else if (LM_OFFSET (so_list_ptr) != region_offset) - { - char *region_name; - target_read_string (region_info.regionname_addr, &buffer, - MAX_PATH_SIZE - 1, &errcode); - if (errcode == 0) - region_name = buffer; - else - region_name = "??"; - warning ("cannot handle shared library relocation for %s (%s)", - so_list_ptr->so_name, region_name); - xfree (buffer); - } - } -#endif - - catch_errors (solib_map_sections, (char *) so_list_ptr, - "Error while mapping shared library sections:\n", - RETURN_MASK_ALL); - } -} - -/* - - LOCAL FUNCTION - - find_solib -- step through list of shared objects - - SYNOPSIS - - struct so_list *find_solib (struct so_list *so_list_ptr) - - DESCRIPTION - - This module contains the routine which finds the names of any - loaded "images" in the current process. The argument in must be - NULL on the first call, and then the returned value must be passed - in on subsequent calls. This provides the capability to "step" down - the list of loaded objects. On the last object, a NULL value is - returned. - - The arg and return value are "struct link_map" pointers, as defined - in <link.h>. - */ - -static struct so_list * -find_solib (struct so_list *so_list_ptr) -{ - struct so_list *so_list_next = NULL; - struct link_map *lm = NULL; - struct so_list *new; - - if (so_list_ptr == NULL) - { - /* We are setting up for a new scan through the loaded images. */ - if ((so_list_next = so_list_head) == NULL) - { - /* Find the first link map list member. */ - lm = first_link_map_member (); - } - } - else - { - /* We have been called before, and are in the process of walking - the shared library list. Advance to the next shared object. */ - lm = next_link_map_member (so_list_ptr); - so_list_next = so_list_ptr->next; - } - if ((so_list_next == NULL) && (lm != NULL)) - { - /* Get next link map structure from inferior image and build a local - abbreviated load_map structure */ - new = (struct so_list *) xmalloc (sizeof (struct so_list)); - memset ((char *) new, 0, sizeof (struct so_list)); - new->lmaddr = lm; - /* Add the new node as the next node in the list, or as the root - node if this is the first one. */ - if (so_list_ptr != NULL) - { - so_list_ptr->next = new; - } - else - { - so_list_head = new; - } - so_list_next = new; - xfer_link_map_member (new, lm); - } - return (so_list_next); -} - -/* A small stub to get us past the arg-passing pinhole of catch_errors. */ - -static int -symbol_add_stub (char *arg) -{ - register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ - CORE_ADDR text_addr = 0; - struct section_addr_info section_addrs; - - memset (§ion_addrs, 0, sizeof (section_addrs)); - if (so->textsection) - text_addr = so->textsection->addr; - else if (so->abfd != NULL) - { - asection *lowest_sect; - - /* If we didn't find a mapped non zero sized .text section, set up - text_addr so that the relocation in symbol_file_add does no harm. */ - - lowest_sect = bfd_get_section_by_name (so->abfd, ".text"); - if (lowest_sect == NULL) - bfd_map_over_sections (so->abfd, find_lowest_section, - (PTR) &lowest_sect); - if (lowest_sect) - text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so); - } - - section_addrs.other[0].addr = text_addr; - section_addrs.other[0].name = ".text"; - so->objfile = symbol_file_add (so->so_name, so->from_tty, - §ion_addrs, 0, OBJF_SHARED); - return (1); -} - -/* - - GLOBAL FUNCTION - - solib_add -- add a shared library file to the symtab and section list - - SYNOPSIS - - void solib_add (char *arg_string, int from_tty, - struct target_ops *target, int readsyms) - - DESCRIPTION - - */ - -void -solib_add (char *arg_string, int from_tty, struct target_ops *target, int readsyms) -{ - register struct so_list *so = NULL; /* link map state variable */ - - /* Last shared library that we read. */ - struct so_list *so_last = NULL; - - char *re_err; - int count; - int old; - - if (!readsyms) - return; - - if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) - { - error ("Invalid regexp: %s", re_err); - } - - - /* Add the shared library sections to the section table of the - specified target, if any. */ - if (target) - { - /* Count how many new section_table entries there are. */ - so = NULL; - count = 0; - while ((so = find_solib (so)) != NULL) - { - if (so->so_name[0]) - { - count += so->sections_end - so->sections; - } - } - - if (count) - { - /* Add these section table entries to the target's table. */ - - old = target_resize_to_sections (target, count); - - while ((so = find_solib (so)) != NULL) - { - if (so->so_name[0]) - { - count = so->sections_end - so->sections; - memcpy ((char *) (target->to_sections + old), - so->sections, - (sizeof (struct section_table)) * count); - old += count; - } - } - } - } - - /* Now add the symbol files. */ - so = NULL; - while ((so = find_solib (so)) != NULL) - { - if (so->so_name[0] && re_exec (so->so_name)) - { - so->from_tty = from_tty; - if (so->symbols_loaded) - { - if (from_tty) - { - printf_unfiltered ("Symbols already loaded for %s\n", so->so_name); - } - } - else if (catch_errors - (symbol_add_stub, (char *) so, - "Error while reading shared library symbols:\n", - RETURN_MASK_ALL)) - { - so_last = so; - so->symbols_loaded = 1; - } - } - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - if (so_last) - reinit_frame_cache (); -} - -/* - - LOCAL FUNCTION - - info_sharedlibrary_command -- code for "info sharedlibrary" - - SYNOPSIS - - static void info_sharedlibrary_command () - - DESCRIPTION - - Walk through the shared library list and print information - about each attached library. - */ - -static void -info_sharedlibrary_command (char *ignore, int from_tty) -{ - register struct so_list *so = NULL; /* link map state variable */ - int header_done = 0; - - if (exec_bfd == NULL) - { - printf_unfiltered ("No executable file.\n"); - return; - } - while ((so = find_solib (so)) != NULL) - { - if (so->so_name[0]) - { - unsigned long txt_start = 0; - unsigned long txt_end = 0; - - if (!header_done) - { - printf_unfiltered ("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read", - "Shared Object Library"); - header_done++; - } - if (so->textsection) - { - txt_start = (unsigned long) so->textsection->addr; - txt_end = (unsigned long) so->textsection->endaddr; - } - printf_unfiltered ("%-20s", local_hex_string_custom (txt_start, "08l")); - printf_unfiltered ("%-20s", local_hex_string_custom (txt_end, "08l")); - printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No"); - printf_unfiltered ("%s\n", so->so_name); - } - } - if (so_list_head == NULL) - { - printf_unfiltered ("No shared libraries loaded at this time.\n"); - } -} - -/* - - GLOBAL FUNCTION - - solib_address -- check to see if an address is in a shared lib - - SYNOPSIS - - char *solib_address (CORE_ADDR address) - - DESCRIPTION - - Provides a hook for other gdb routines to discover whether or - not a particular address is within the mapped address space of - a shared library. Any address between the base mapping address - and the first address beyond the end of the last mapping, is - considered to be within the shared library address space, for - our purposes. - - For example, this routine is called at one point to disable - breakpoints which are in shared libraries that are not currently - mapped in. - */ - -char * -solib_address (CORE_ADDR address) -{ - register struct so_list *so = 0; /* link map state variable */ - - while ((so = find_solib (so)) != NULL) - { - if (so->so_name[0] && so->textsection) - { - if ((address >= (CORE_ADDR) so->textsection->addr) && - (address < (CORE_ADDR) so->textsection->endaddr)) - return (so->so_name); - } - } - return (0); -} - -/* Called by free_all_symtabs */ - -void -clear_solib (void) -{ - struct so_list *next; - char *bfd_filename; - - disable_breakpoints_in_shlibs (1); - - while (so_list_head) - { - if (so_list_head->sections) - { - xfree (so_list_head->sections); - } - if (so_list_head->abfd) - { - remove_target_sections (so_list_head->abfd); - bfd_filename = bfd_get_filename (so_list_head->abfd); - if (!bfd_close (so_list_head->abfd)) - warning ("cannot close \"%s\": %s", - bfd_filename, bfd_errmsg (bfd_get_error ())); - } - else - /* This happens for the executable on SVR4. */ - bfd_filename = NULL; - - next = so_list_head->next; - if (bfd_filename) - xfree (bfd_filename); - xfree (so_list_head); - so_list_head = next; - } -} - -/* - - GLOBAL FUNCTION - - solib_create_inferior_hook -- shared library startup support - - SYNOPSIS - - void solib_create_inferior_hook() - - DESCRIPTION - - When gdb starts up the inferior, it nurses it along (through the - shell) until it is ready to execute it's first instruction. At this - point, this function gets called via expansion of the macro - SOLIB_CREATE_INFERIOR_HOOK. - For a statically bound executable, this first instruction is the - one at "_start", or a similar text label. No further processing is - needed in that case. - For a dynamically bound executable, this first instruction is somewhere - in the rld, and the actual user executable is not yet mapped in. - We continue the inferior again, rld then maps in the actual user - executable and any needed shared libraries and then sends - itself a SIGTRAP. - At that point we discover the names of all shared libraries and - read their symbols in. - - FIXME - - This code does not properly handle hitting breakpoints which the - user might have set in the rld itself. Proper handling would have - to check if the SIGTRAP happened due to a kill call. - - Also, what if child has exit()ed? Must exit loop somehow. - */ - -void -solib_create_inferior_hook (void) -{ - - /* Nothing to do for statically bound executables. */ - - if (symfile_objfile == NULL - || symfile_objfile->obfd == NULL - || ((bfd_get_file_flags (symfile_objfile->obfd) & DYNAMIC) == 0)) - return; - - /* 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. */ - - clear_proceed_status (); - stop_soon_quietly = 1; - stop_signal = TARGET_SIGNAL_0; - do - { - target_resume (minus_one_ptid, 0, stop_signal); - wait_for_inferior (); - } - while (stop_signal != TARGET_SIGNAL_TRAP); - - /* solib_add will call reinit_frame_cache. - But we are stopped in the runtime loader and we do not have symbols - for the runtime loader. So heuristic_proc_start will be called - and will put out an annoying warning. - Delaying the resetting of stop_soon_quietly until after symbol loading - suppresses the warning. */ - solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); - stop_soon_quietly = 0; -} - - -/* - - LOCAL FUNCTION - - sharedlibrary_command -- handle command to explicitly add library - - SYNOPSIS - - static void sharedlibrary_command (char *args, int from_tty) - - DESCRIPTION - - */ - -static void -sharedlibrary_command (char *args, int from_tty) -{ - dont_repeat (); - solib_add (args, from_tty, (struct target_ops *) 0, 1); -} - -void -_initialize_solib (void) -{ - add_com ("sharedlibrary", class_files, sharedlibrary_command, - "Load shared object library symbols for files matching REGEXP."); - add_info ("sharedlibrary", info_sharedlibrary_command, - "Status of loaded shared object libraries."); - - add_show_from_set - (add_set_cmd ("auto-solib-add", class_support, var_boolean, - (char *) &auto_solib_add, - "Set autoloading of shared library symbols.\n\ -If \"on\", symbols from all shared object libraries will be loaded\n\ -automatically when the inferior begins execution, when the dynamic linker\n\ -informs gdb that a new library has been loaded, or when attaching to the\n\ -inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.", - &setlist), - &showlist); -} diff --git a/gdb/p-exp.y b/gdb/p-exp.y index fbdd3f69e18..f0939e7bbbf 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -93,6 +93,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define yylloc pascal_lloc #define yyreds pascal_reds /* With YYDEBUG defined */ #define yytoks pascal_toks /* With YYDEBUG defined */ +#define yyname pascal_name /* With YYDEBUG defined */ +#define yyrule pascal_rule /* With YYDEBUG defined */ #define yylhs pascal_yylhs #define yylen pascal_yylen #define yydefred pascal_yydefred diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 06a821605fe..a99d4e98972 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -620,13 +620,11 @@ pascal_object_print_class_method (char *valaddr, struct type *type, f = TYPE_FN_FIELDLIST1 (domain, i); len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i); + check_stub_method_group (domain, i); for (j = 0; j < len2; j++) { - QUIT; if (TYPE_FN_FIELD_VOFFSET (f, j) == offset) { - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (domain, i, j); kind = "virtual "; goto common; } @@ -646,15 +644,11 @@ pascal_object_print_class_method (char *valaddr, struct type *type, f = TYPE_FN_FIELDLIST1 (domain, i); len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i); + check_stub_method_group (domain, i); for (j = 0; j < len2; j++) { - QUIT; - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (domain, i, j); if (STREQ (SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j))) - { - goto common; - } + goto common; } } } diff --git a/gdb/parse.c b/gdb/parse.c index c5de0af3334..29b8e3c3709 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -47,7 +47,6 @@ #include "inferior.h" /* for NUM_PSEUDO_REGS. NOTE: replace with "gdbarch.h" when appropriate. */ #include "doublest.h" -#include "builtin-regs.h" #include "gdb_assert.h" @@ -106,42 +105,6 @@ struct funcall static struct funcall *funcall_chain; -/* The generic method for targets to specify how their registers are - named. The mapping can be derived from two sources: REGISTER_NAME; - or builtin regs. */ - -int -target_map_name_to_register (char *str, int len) -{ - int i; - - /* Search register name space. */ - for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) - if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i)) - && STREQN (str, REGISTER_NAME (i), len)) - { - return i; - } - - /* Try builtin registers. */ - i = builtin_reg_map_name_to_regnum (str, len); - if (i >= 0) - { - gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS); - return i; - } - - /* Try builtin registers. */ - i = builtin_reg_map_name_to_regnum (str, len); - if (i >= 0) - { - gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS); - return i; - } - - return -1; -} - /* Begin counting arguments for a function call, saving the data about any containing call. */ @@ -491,7 +454,7 @@ write_dollar_variable (struct stoken str) /* Handle tokens that refer to machine registers: $ followed by a register name. */ - i = target_map_name_to_register (str.ptr + 1, str.length - 1); + i = frame_map_name_to_regnum (str.ptr + 1, str.length - 1); if (i >= 0) goto handle_register; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 748208ae6d1..b522241a464 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -210,12 +210,6 @@ struct op_print int right_assoc; }; -/* The generic method for targets to specify how their registers are - named. The mapping can be derived from two sources: REGISTER_NAME; - and builtin regs. */ - -extern int target_map_name_to_register (char *, int); - /* Function used to avoid direct calls to fprintf in the code generated by the bison parser. */ diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index 6fabab7c5b4..3d052a83ff2 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -196,6 +196,13 @@ static struct core_fns ppcnbsd_elfcore_fns = NULL /* next */ }; +static int +ppcnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + /* FIXME: Need to add support for kernel-provided signal trampolines. */ + return (nbsd_pc_in_sigtramp (pc, func_name)); +} + static void ppcnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -203,6 +210,8 @@ ppcnbsd_init_abi (struct gdbarch_info info, /* Stop at main. */ set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid); + set_gdbarch_pc_in_sigtramp (gdbarch, ppcnbsd_pc_in_sigtramp); + set_solib_svr4_fetch_link_map_offsets (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 2e57050105f..8542b8a9a5b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -391,10 +391,10 @@ print_scalar_formatted (char *valaddr, struct type *type, int format, int size, val_long = unpack_long (type, valaddr); /* If the value is a pointer, and pointers and addresses are not the - same, then at this point, the value's length is TARGET_ADDR_BIT, not - TYPE_LENGTH (type). */ + same, then at this point, the value's length (in target bytes) is + TARGET_ADDR_BIT/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */ if (TYPE_CODE (type) == TYPE_CODE_PTR) - len = TARGET_ADDR_BIT; + len = TARGET_ADDR_BIT / TARGET_CHAR_BIT; /* If we are printing it as unsigned, truncate it in case it is actually a negative signed value (e.g. "print/u (short)-1" should print 65535 diff --git a/gdb/procfs.c b/gdb/procfs.c index ff8a7d3fb25..fe5987601c6 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3627,6 +3627,9 @@ do_detach (int signo) if (!proc_clear_current_fault (pi)) proc_warn (pi, "do_detach, clear_current_fault", __LINE__); + if (signo == 0 && !proc_clear_current_signal (pi)) + proc_warn (pi, "do_detach, clear_current_signal", __LINE__); + if (!proc_set_run_on_last_close (pi)) proc_warn (pi, "do_detach, set_rlc", __LINE__); } diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c index 4a2b088c508..438d6c6d6c7 100644 --- a/gdb/remote-hms.c +++ b/gdb/remote-hms.c @@ -64,9 +64,9 @@ hms_supply_register (char *regname, int regnamelen, char *val, int vallen) * registers either. So, typing "info reg sp" becomes a "r30". */ -static char *hms_regnames[NUM_REGS] = +static char *hms_regnames[] = { - "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "CCR", "PC" + "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "CCR", "PC", "", "", "", "" }; /* diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index f6618618272..e6a68ef202b 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1032,6 +1032,13 @@ rs6000_fix_call_dummy (char *dummyname, CORE_ADDR pc, CORE_ADDR fun, } } +/* All the ABI's require 16 byte alignment. */ +static CORE_ADDR +rs6000_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + return (addr & -16); +} + /* Pass the arguments in either registers, or in the stack. In RS/6000, the first eight words of the argument list (that might be less than eight parameters if some parameters occupy more than one word) are @@ -1363,13 +1370,6 @@ rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) } } -/* Keep structure return address in this variable. - FIXME: This is a horrid kludge which should not be allowed to continue - living. This only allows a single nested call to a structure-returning - function. Come on, guys! -- gnu@cygnus.com, Aug 92 */ - -static CORE_ADDR rs6000_struct_return_address; - /* Return whether handle_inferior_event() should proceed through code starting at PC in function NAME when stepping. @@ -1511,7 +1511,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize); if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); func_start = get_pc_function_start (fi->pc); @@ -1527,6 +1527,16 @@ rs6000_frame_saved_pc (struct frame_info *fi) if (fi->next->signal_handler_caller) return read_memory_addr (fi->next->frame + SIG_FRAME_LR_OFFSET, wordsize); + else if (PC_IN_CALL_DUMMY (get_next_frame (fi)->pc, 0, 0)) + /* The link register wasn't saved by this frame and the next + (inner, newer) frame is a dummy. Get the link register + value by unwinding it from that [dummy] frame. */ + { + ULONGEST lr; + frame_unwind_unsigned_register (get_next_frame (fi), + tdep->ppc_lr_regnum, &lr); + return lr; + } else return read_memory_addr (FRAME_CHAIN (fi) + tdep->lr_frame_offset, wordsize); @@ -1731,7 +1741,9 @@ rs6000_frame_chain (struct frame_info *thisframe) int wordsize = gdbarch_tdep (current_gdbarch)->wordsize; if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame)) - return thisframe->frame; /* dummy frame same as caller's frame */ + /* A dummy frame always correctly chains back to the previous + frame. */ + return read_memory_addr ((thisframe)->frame, wordsize); if (inside_entry_file (thisframe->pc) || thisframe->pc == entry_point_address ()) @@ -1748,13 +1760,6 @@ rs6000_frame_chain (struct frame_info *thisframe) fp = FRAME_FP (thisframe); else fp = read_memory_addr ((thisframe)->frame, wordsize); - - lr = read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum); - if (lr == entry_point_address ()) - if (fp != 0 && (fpp = read_memory_addr (fp, wordsize)) != 0) - if (PC_IN_CALL_DUMMY (lr, fpp, fpp)) - return fpp; - return fp; } @@ -1979,18 +1984,12 @@ rs6000_stab_reg_to_regnum (int num) } /* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. - - In RS/6000, struct return addresses are passed as an extra parameter in r3. - In function return, callee is not responsible of returning this address - back. Since gdb needs to find it, we will store in a designated variable - `rs6000_struct_return_address'. */ + subroutine will return. */ static void rs6000_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) { write_register (3, addr); - rs6000_struct_return_address = addr; } /* Write into appropriate registers a function return value @@ -2048,9 +2047,20 @@ rs6000_store_return_value (struct type *type, char *valbuf) as a CORE_ADDR (or an expression that can be used as one). */ static CORE_ADDR -rs6000_extract_struct_value_address (char *regbuf) -{ - return rs6000_struct_return_address; +rs6000_extract_struct_value_address (struct regcache *regcache) +{ + /* FIXME: cagney/2002-09-26: PR gdb/724: When making an inferior + function call GDB knows the address of the struct return value + and hence, should not need to call this function. Unfortunately, + the current hand_function_call() code only saves the most recent + struct address leading to occasional calls. The code should + instead maintain a stack of such addresses (in the dummy frame + object). */ + /* NOTE: cagney/2002-09-26: Return 0 which indicates that we've + really got no idea where the return value is being stored. While + r3, on function entry, contained the address it will have since + been reused (scratch) and hence wouldn't be valid */ + return 0; } /* Return whether PC is in a dummy function call. @@ -2877,6 +2887,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy); + set_gdbarch_frame_align (gdbarch, rs6000_frame_align); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_push_return_address (gdbarch, ppc_push_return_address); @@ -2900,7 +2911,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments); set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return); - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); + set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame); set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 49a15a2f46a..f19e4ddfdd8 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -956,7 +956,7 @@ s390_frame_saved_pc_nofix (struct frame_info *fi) return fi->extra_info->saved_pc; if (deprecated_generic_find_dummy_frame (fi->pc, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM); s390_frame_init_saved_regs (fi); if (fi->extra_info) @@ -1010,8 +1010,8 @@ s390_frame_chain (struct frame_info *thisframe) CORE_ADDR prev_fp = 0; if (deprecated_generic_find_dummy_frame (thisframe->pc, thisframe->frame)) - return generic_read_register_dummy (thisframe->pc, thisframe->frame, - S390_SP_REGNUM); + return deprecated_read_register_dummy (thisframe->pc, thisframe->frame, + S390_SP_REGNUM); else { int sigreturn = 0; diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 00d679730cd..5b2f0c5b665 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -29,6 +29,7 @@ #include "c-lang.h" #include "scm-lang.h" #include "scm-tags.h" +#include "source.h" #include "gdb_string.h" #include "gdbcore.h" @@ -133,9 +134,11 @@ scm_unpack (struct type *type, char *valaddr, enum type_code context) static int in_eval_c (void) { - if (current_source_symtab && current_source_symtab->filename) + struct symtab_and_line cursal = get_current_source_symtab_and_line (); + + if (cursal.symtab && cursal.symtab->filename) { - char *filename = current_source_symtab->filename; + char *filename = cursal.symtab->filename; int len = strlen (filename); if (len >= 6 && strcmp (filename + len - 6, "eval.c") == 0) return 1; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index b133b035f6b..c5e5bf457d2 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -884,7 +884,14 @@ sh_saved_pc_after_call (struct frame_info *frame) static int sh_use_struct_convention (int gcc_p, struct type *type) { +#if 0 return (TYPE_LENGTH (type) > 1); +#else + int len = TYPE_LENGTH (type); + int nelem = TYPE_NFIELDS (type); + return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) && + (len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4); +#endif } static int @@ -986,7 +993,7 @@ sh_find_callers_reg (struct frame_info *fi, int regnum) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) /* When the caller requests PR from the dummy frame, we return PC because that's where the previous routine appears to have done a call from. */ - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else { FRAME_INIT_SAVED_REGS (fi); @@ -1008,7 +1015,7 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) /* When the caller requests PR from the dummy frame, we return PC because that's where the previous routine appears to have done a call from. */ - return generic_read_register_dummy (fi->pc, fi->frame, pr_regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, pr_regnum); else { FRAME_INIT_SAVED_REGS (fi); @@ -1722,11 +1729,11 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, - SP_REGNUM); - fi->extra_info->return_pc = generic_read_register_dummy (fi->pc, - fi->frame, - PC_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); + fi->extra_info->return_pc = deprecated_read_register_dummy (fi->pc, + fi->frame, + PC_REGNUM); fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4); fi->extra_info->leaf_function = 0; return; @@ -1754,10 +1761,10 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* We need to setup fi->frame here because run_stack_dummy gets it wrong by assuming it's always FP. */ - fi->frame = generic_read_register_dummy (fi->pc, fi->frame, - SP_REGNUM); + fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame, + SP_REGNUM); fi->extra_info->return_pc = - generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4); fi->extra_info->leaf_function = 0; return; @@ -2045,8 +2052,11 @@ sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (len < 4) { /* value gets right-justified in the register or stack word */ - memcpy (valbuf + (4 - len), - (char *) VALUE_CONTENTS (args[argnum]), len); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + memcpy (valbuf + (4 - len), + (char *) VALUE_CONTENTS (args[argnum]), len); + else + memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len); val = valbuf; } else @@ -2457,8 +2467,11 @@ sh_default_store_return_value (struct type *type, char *valbuf) { /* Add leading zeros to the value. */ memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM)); - memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type), - valbuf, TYPE_LENGTH (type)); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type), + valbuf, TYPE_LENGTH (type)); + else + memcpy (buf, valbuf, TYPE_LENGTH (type)); write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, REGISTER_RAW_SIZE (R0_REGNUM)); } @@ -4544,7 +4557,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);/*??should be 8?*/ + set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_use_generic_dummy_frames (gdbarch, 1); set_gdbarch_call_dummy_length (gdbarch, 0); diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index f450ac9d5fc..7d07fa53c80 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -27,6 +27,7 @@ #include "srec.h" #include "arch-utils.h" #include "regcache.h" +#include "gdb_string.h" #include "sh-tdep.h" diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c index 02982267ba2..b67884d2cea 100644 --- a/gdb/shnbsd-tdep.c +++ b/gdb/shnbsd-tdep.c @@ -165,10 +165,19 @@ static struct core_fns shnbsd_elfcore_fns = NULL /* next */ }; +static int +shnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + /* FIXME: Need to add support for kernel-provided signal trampolines. */ + return (nbsd_pc_in_sigtramp (pc, func_name)); +} + static void shnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { + set_gdbarch_pc_in_sigtramp (gdbarch, shnbsd_pc_in_sigtramp); + set_solib_svr4_fetch_link_map_offsets (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); } diff --git a/gdb/source.c b/gdb/source.c index c7c1ce2f5d2..5c88a55db81 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -79,8 +79,6 @@ static void forward_search_command (char *, int); static void line_info (char *, int); -static void list_command (char *, int); - static void ambiguous_line_spec (struct symtabs_and_lines *); static void source_info (char *, int); @@ -94,11 +92,11 @@ char *source_path; /* Symtab of default file for listing lines of. */ -struct symtab *current_source_symtab; +static struct symtab *current_source_symtab; /* Default next line to list. */ -int current_source_line; +static int current_source_line; /* Default number of lines to print with commands like "list". This is based on guessing how many long (i.e. more than chars_per_line @@ -123,6 +121,93 @@ static int first_line_listed; static struct symtab *last_source_visited = NULL; static int last_source_error = 0; +/* Return the first line listed by print_source_lines. + Used by command interpreters to request listing from + a previous point. */ + +int +get_first_line_listed (void) +{ + return first_line_listed; +} + +/* Return the default number of lines to print with commands like the + cli "list". The caller of print_source_lines must use this to + calculate the end line and use it in the call to print_source_lines + as it does not automatically use this value. */ + +int +get_lines_to_list (void) +{ + return lines_to_list; +} + +/* Return the current source file for listing and next line to list. + NOTE: The returned sal pc and end fields are not valid. */ + +struct symtab_and_line +get_current_source_symtab_and_line (void) +{ + struct symtab_and_line cursal; + + cursal.symtab = current_source_symtab; + cursal.line = current_source_line; + cursal.pc = 0; + cursal.end = 0; + + return cursal; +} + +/* If the current source file for listing is not set, try and get a default. + Usually called before get_current_source_symtab_and_line() is called. + It may err out if a default cannot be determined. + We must be cautious about where it is called, as it can recurse as the + process of determining a new default may call the caller! + Use get_current_source_symtab_and_line only to get whatever + we have without erroring out or trying to get a default. */ + +void +set_default_source_symtab_and_line (void) +{ + struct symtab_and_line cursal; + + if (!have_full_symbols () && !have_partial_symbols ()) + error ("No symbol table is loaded. Use the \"file\" command."); + + /* Pull in a current source symtab if necessary */ + if (current_source_symtab == 0) + select_source_symtab (0); +} + +/* Return the current default file for listing and next line to list + (the returned sal pc and end fields are not valid.) + and set the current default to whatever is in SAL. + NOTE: The returned sal pc and end fields are not valid. */ + +struct symtab_and_line +set_current_source_symtab_and_line (const struct symtab_and_line *sal) +{ + struct symtab_and_line cursal; + + cursal.symtab = current_source_symtab; + cursal.line = current_source_line; + + current_source_symtab = sal->symtab; + current_source_line = sal->line; + cursal.pc = 0; + cursal.end = 0; + + return cursal; +} + +/* Reset any information stored about a default file and line to print. */ + +void +clear_current_source_symtab_and_line (void) +{ + current_source_symtab = 0; + current_source_line = 0; +} /* Set the source file default for the "list" command to be S. @@ -1110,8 +1195,6 @@ print_source_lines (struct symtab *s, int line, int stopline, int noerror) print_source_lines_base (s, line, stopline, noerror); } - - /* Print a list of files and line numbers which a user may choose from in order to list a function which was specified ambiguously (as with `list classname::overloadedfuncname', for example). The vector in @@ -1126,182 +1209,6 @@ ambiguous_line_spec (struct symtabs_and_lines *sals) printf_filtered ("file: \"%s\", line number: %d\n", sals->sals[i].symtab->filename, sals->sals[i].line); } - -static void -list_command (char *arg, int from_tty) -{ - struct symtabs_and_lines sals, sals_end; - struct symtab_and_line sal, sal_end; - struct symbol *sym; - char *arg1; - int no_end = 1; - int dummy_end = 0; - int dummy_beg = 0; - int linenum_beg = 0; - char *p; - - if (!have_full_symbols () && !have_partial_symbols ()) - error ("No symbol table is loaded. Use the \"file\" command."); - - /* Pull in a current source symtab if necessary */ - if (current_source_symtab == 0 && - (arg == 0 || arg[0] == '+' || arg[0] == '-')) - select_source_symtab (0); - - /* "l" or "l +" lists next ten lines. */ - - if (arg == 0 || STREQ (arg, "+")) - { - if (current_source_symtab == 0) - error ("No default source file yet. Do \"help list\"."); - print_source_lines (current_source_symtab, current_source_line, - current_source_line + lines_to_list, 0); - return; - } - - /* "l -" lists previous ten lines, the ones before the ten just listed. */ - if (STREQ (arg, "-")) - { - if (current_source_symtab == 0) - error ("No default source file yet. Do \"help list\"."); - print_source_lines (current_source_symtab, - max (first_line_listed - lines_to_list, 1), - first_line_listed, 0); - return; - } - - /* Now if there is only one argument, decode it in SAL - and set NO_END. - If there are two arguments, decode them in SAL and SAL_END - and clear NO_END; however, if one of the arguments is blank, - set DUMMY_BEG or DUMMY_END to record that fact. */ - - arg1 = arg; - if (*arg1 == ',') - dummy_beg = 1; - else - { - sals = decode_line_1 (&arg1, 0, 0, 0, 0); - - if (!sals.nelts) - return; /* C++ */ - if (sals.nelts > 1) - { - ambiguous_line_spec (&sals); - xfree (sals.sals); - return; - } - - sal = sals.sals[0]; - xfree (sals.sals); - } - - /* Record whether the BEG arg is all digits. */ - - for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++); - linenum_beg = (p == arg1); - - while (*arg1 == ' ' || *arg1 == '\t') - arg1++; - if (*arg1 == ',') - { - no_end = 0; - arg1++; - while (*arg1 == ' ' || *arg1 == '\t') - arg1++; - if (*arg1 == 0) - dummy_end = 1; - else - { - if (dummy_beg) - sals_end = decode_line_1 (&arg1, 0, 0, 0, 0); - else - sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0); - if (sals_end.nelts == 0) - return; - if (sals_end.nelts > 1) - { - ambiguous_line_spec (&sals_end); - xfree (sals_end.sals); - return; - } - sal_end = sals_end.sals[0]; - xfree (sals_end.sals); - } - } - - if (*arg1) - error ("Junk at end of line specification."); - - if (!no_end && !dummy_beg && !dummy_end - && sal.symtab != sal_end.symtab) - error ("Specified start and end are in different files."); - if (dummy_beg && dummy_end) - error ("Two empty args do not say what lines to list."); - - /* if line was specified by address, - first print exactly which line, and which file. - In this case, sal.symtab == 0 means address is outside - of all known source files, not that user failed to give a filename. */ - if (*arg == '*') - { - if (sal.symtab == 0) - /* FIXME-32x64--assumes sal.pc fits in long. */ - error ("No source file for address %s.", - local_hex_string ((unsigned long) sal.pc)); - sym = find_pc_function (sal.pc); - if (sym) - { - print_address_numeric (sal.pc, 1, gdb_stdout); - printf_filtered (" is in "); - fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout); - printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line); - } - else - { - print_address_numeric (sal.pc, 1, gdb_stdout); - printf_filtered (" is at %s:%d.\n", - sal.symtab->filename, sal.line); - } - } - - /* If line was not specified by just a line number, - and it does not imply a symtab, it must be an undebuggable symbol - which means no source code. */ - - if (!linenum_beg && sal.symtab == 0) - error ("No line number known for %s.", arg); - - /* If this command is repeated with RET, - turn it into the no-arg variant. */ - - if (from_tty) - *arg = 0; - - if (dummy_beg && sal_end.symtab == 0) - error ("No default source file yet. Do \"help list\"."); - if (dummy_beg) - print_source_lines (sal_end.symtab, - max (sal_end.line - (lines_to_list - 1), 1), - sal_end.line + 1, 0); - else if (sal.symtab == 0) - error ("No default source file yet. Do \"help list\"."); - else if (no_end) - { - int first_line = sal.line - lines_to_list / 2; - - if (first_line < 1) first_line = 1; - - print_source_lines (sal.symtab, first_line, first_line + lines_to_list, - 0); - } - else - print_source_lines (sal.symtab, sal.line, - (dummy_end - ? sal.line + lines_to_list - : sal_end.line + 1), - 0); -} /* Print info on range of pc's in a specified line. */ @@ -1662,29 +1569,6 @@ The matching line number is also stored as the value of \"$_\"."); add_com_alias ("?", "reverse-search", class_files, 0); } - add_com ("list", class_files, list_command, - concat ("List specified function or line.\n\ -With no argument, lists ten more lines after or around previous listing.\n\ -\"list -\" lists the ten lines before a previous ten-line listing.\n\ -One argument specifies a line, and ten lines are listed around that line.\n\ -Two arguments with comma between specify starting and ending lines to list.\n\ -", "\ -Lines can be specified in these ways:\n\ - LINENUM, to list around that line in current file,\n\ - FILE:LINENUM, to list around that line in that file,\n\ - FUNCTION, to list around beginning of that function,\n\ - FILE:FUNCTION, to distinguish among like-named static functions.\n\ - *ADDRESS, to list around the line containing that address.\n\ -With two args if one is empty it stands for ten lines away from the other arg.", NULL)); - - if (!xdb_commands) - add_com_alias ("l", "list", class_files, 1); - else - add_com_alias ("v", "list", class_files, 1); - - if (dbx_commands) - add_com_alias ("file", "list", class_files, 1); - add_show_from_set (add_set_cmd ("listsize", class_support, var_uinteger, (char *) &lines_to_list, diff --git a/gdb/source.h b/gdb/source.h index 8dbf8517056..ba7d45f5260 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -31,4 +31,36 @@ extern int open_source_file (struct symtab *s); lines. */ extern void find_source_lines (struct symtab *s, int desc); +/* Return the first line listed by print_source_lines. + Used by command interpreters to request listing from + a previous point. */ +extern int get_first_line_listed (void); + +/* Return the default number of lines to print with commands like the + cli "list". The caller of print_source_lines must use this to + calculate the end line and use it in the call to print_source_lines + as it does not automatically use this value. */ +extern int get_lines_to_list (void); + +/* Return the current source file for listing and next line to list. + NOTE: The returned sal pc and end fields are not valid. */ +extern struct symtab_and_line get_current_source_symtab_and_line (void); + +/* If the current source file for listing is not set, try and get a default. + Usually called before get_current_source_symtab_and_line() is called. + It may err out if a default cannot be determined. + We must be cautious about where it is called, as it can recurse as the + process of determining a new default may call the caller! + Use get_current_source_symtab_and_line only to get whatever + we have without erroring out or trying to get a default. */ +extern void set_default_source_symtab_and_line (void); + +/* Return the current default file for listing and next line to list + (the returned sal pc and end fields are not valid.) + and set the current default to whatever is in SAL. + NOTE: The returned sal pc and end fields are not valid. */ +extern struct symtab_and_line set_current_source_symtab_and_line (const struct symtab_and_line *); + +/* Reset any information stored about a default file and line to print. */ +extern void clear_current_source_symtab_and_line (void); #endif diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c index ea70e517b6d..1103eaa62c1 100644 --- a/gdb/sparcnbsd-tdep.c +++ b/gdb/sparcnbsd-tdep.c @@ -500,6 +500,8 @@ sparcnbsd_init_abi_elf (struct gdbarch_info info, { sparcnbsd_init_abi_common (info, gdbarch); + set_gdbarch_pc_in_sigtramp (gdbarch, nbsd_pc_in_sigtramp); + set_solib_svr4_fetch_link_map_offsets (gdbarch, gdbarch_ptr_bit (gdbarch) == 32 ? nbsd_ilp32_solib_svr4_fetch_link_map_offsets : diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 6011769cf6a..4697b4067e7 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -44,6 +44,8 @@ #include "demangle.h" #include "language.h" #include "doublest.h" +#include "cp-abi.h" +#include "cp-support.h" #include <ctype.h> @@ -3080,6 +3082,27 @@ rs6000_builtin_type (int typenum) /* This page contains subroutines of read_type. */ +/* Replace *OLD_NAME with the method name portion of PHYSNAME. */ + +static void +update_method_name_from_physname (char **old_name, char *physname) +{ + char *method_name; + + method_name = method_name_from_physname (physname); + + if (method_name == NULL) + error ("bad physname %s\n", physname); + + if (strcmp (*old_name, method_name) != 0) + { + xfree (*old_name); + *old_name = method_name; + } + else + xfree (method_name); +} + /* Read member function stabs info for C++ classes. The form of each member function data is: @@ -3377,6 +3400,164 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, } else { + int has_stub = 0; + int has_destructor = 0, has_other = 0; + int is_v3 = 0; + struct next_fnfield *tmp_sublist; + + /* Various versions of GCC emit various mostly-useless + strings in the name field for special member functions. + + For stub methods, we need to defer correcting the name + until we are ready to unstub the method, because the current + name string is used by gdb_mangle_name. The only stub methods + of concern here are GNU v2 operators; other methods have their + names correct (see caveat below). + + For non-stub methods, in GNU v3, we have a complete physname. + Therefore we can safely correct the name now. This primarily + affects constructors and destructors, whose name will be + __comp_ctor or __comp_dtor instead of Foo or ~Foo. Cast + operators will also have incorrect names; for instance, + "operator int" will be named "operator i" (i.e. the type is + mangled). + + For non-stub methods in GNU v2, we have no easy way to + know if we have a complete physname or not. For most + methods the result depends on the platform (if CPLUS_MARKER + can be `$' or `.', it will use minimal debug information, or + otherwise the full physname will be included). + + Rather than dealing with this, we take a different approach. + For v3 mangled names, we can use the full physname; for v2, + we use cplus_demangle_opname (which is actually v2 specific), + because the only interesting names are all operators - once again + barring the caveat below. Skip this process if any method in the + group is a stub, to prevent our fouling up the workings of + gdb_mangle_name. + + The caveat: GCC 2.95.x (and earlier?) put constructors and + destructors in the same method group. We need to split this + into two groups, because they should have different names. + So for each method group we check whether it contains both + routines whose physname appears to be a destructor (the physnames + for and destructors are always provided, due to quirks in v2 + mangling) and routines whose physname does not appear to be a + destructor. If so then we break up the list into two halves. + Even if the constructors and destructors aren't in the same group + the destructor will still lack the leading tilde, so that also + needs to be fixed. + + So, to summarize what we expect and handle here: + + Given Given Real Real Action + method name physname physname method name + + __opi [none] __opi__3Foo operator int opname + [now or later] + Foo _._3Foo _._3Foo ~Foo separate and + rename + operator i _ZN3FoocviEv _ZN3FoocviEv operator int demangle + __comp_ctor _ZN3FooC1ERKS_ _ZN3FooC1ERKS_ Foo demangle + */ + + tmp_sublist = sublist; + while (tmp_sublist != NULL) + { + if (tmp_sublist->fn_field.is_stub) + has_stub = 1; + if (tmp_sublist->fn_field.physname[0] == '_' + && tmp_sublist->fn_field.physname[1] == 'Z') + is_v3 = 1; + + if (is_destructor_name (tmp_sublist->fn_field.physname)) + has_destructor++; + else + has_other++; + + tmp_sublist = tmp_sublist->next; + } + + if (has_destructor && has_other) + { + struct next_fnfieldlist *destr_fnlist; + struct next_fnfield *last_sublist; + + /* Create a new fn_fieldlist for the destructors. */ + + destr_fnlist = (struct next_fnfieldlist *) + xmalloc (sizeof (struct next_fnfieldlist)); + make_cleanup (xfree, destr_fnlist); + memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist)); + destr_fnlist->fn_fieldlist.name + = obconcat (&objfile->type_obstack, "", "~", + new_fnlist->fn_fieldlist.name); + + destr_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) + obstack_alloc (&objfile->type_obstack, + sizeof (struct fn_field) * has_destructor); + memset (destr_fnlist->fn_fieldlist.fn_fields, 0, + sizeof (struct fn_field) * has_destructor); + tmp_sublist = sublist; + last_sublist = NULL; + i = 0; + while (tmp_sublist != NULL) + { + if (!is_destructor_name (tmp_sublist->fn_field.physname)) + { + tmp_sublist = tmp_sublist->next; + continue; + } + + destr_fnlist->fn_fieldlist.fn_fields[i++] + = tmp_sublist->fn_field; + if (last_sublist) + last_sublist->next = tmp_sublist->next; + else + sublist = tmp_sublist->next; + last_sublist = tmp_sublist; + tmp_sublist = tmp_sublist->next; + } + + destr_fnlist->fn_fieldlist.length = has_destructor; + destr_fnlist->next = fip->fnlist; + fip->fnlist = destr_fnlist; + nfn_fields++; + total_length += has_destructor; + length -= has_destructor; + } + else if (is_v3) + { + /* v3 mangling prevents the use of abbreviated physnames, + so we can do this here. There are stubbed methods in v3 + only: + - in -gstabs instead of -gstabs+ + - or for static methods, which are output as a function type + instead of a method type. */ + + update_method_name_from_physname (&new_fnlist->fn_fieldlist.name, + sublist->fn_field.physname); + } + else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~') + { + new_fnlist->fn_fieldlist.name = concat ("~", main_fn_name, NULL); + xfree (main_fn_name); + } + else if (!has_stub) + { + char dem_opname[256]; + int ret; + ret = cplus_demangle_opname (new_fnlist->fn_fieldlist.name, + dem_opname, DMGL_ANSI); + if (!ret) + ret = cplus_demangle_opname (new_fnlist->fn_fieldlist.name, + dem_opname, 0); + if (ret) + new_fnlist->fn_fieldlist.name + = obsavestring (dem_opname, strlen (dem_opname), + &objfile->type_obstack); + } + new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) obstack_alloc (&objfile->type_obstack, sizeof (struct fn_field) * length); diff --git a/gdb/stack.c b/gdb/stack.c index 30ebc09dee7..83fd26e476b 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -33,6 +33,7 @@ #include "gdbcmd.h" #include "gdbcore.h" #include "target.h" +#include "source.h" #include "breakpoint.h" #include "demangle.h" #include "inferior.h" @@ -108,7 +109,6 @@ struct frame_info *parse_frame_specification (char *); static void frame_info (char *, int); extern int addressprint; /* Print addresses, or stay symbolic only? */ -extern int lines_to_list; /* # of lines "list" command shows by default */ /* The "selected" stack frame is used by default for local and arg access. May be zero, for no selected frame. */ @@ -398,14 +398,13 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args) print_frame (fi, level, source, args, sal); source_print = (source == SRC_LINE || source == SRC_AND_LOC); + if (sal.symtab) - { - current_source_symtab = sal.symtab; - current_source_line = sal.line; - } + set_current_source_symtab_and_line (&sal); if (source_print && sal.symtab) { + struct symtab_and_line cursal; int done = 0; int mid_statement = (source == SRC_LINE) && (fi->pc != sal.pc); @@ -435,7 +434,11 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args) print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); } } - current_source_line = max (sal.line - lines_to_list / 2, 1); + /* Make sure we have at least a default source file */ + set_default_source_symtab_and_line (); + cursal = get_current_source_symtab_and_line (); + cursal.line = max (sal.line - get_lines_to_list () / 2, 1); + set_current_source_symtab_and_line (&cursal); } if (source != 0) diff --git a/gdb/symfile.c b/gdb/symfile.c index 8d63484af11..66bbf714984 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -31,6 +31,7 @@ #include "value.h" #include "symfile.h" #include "objfiles.h" +#include "source.h" #include "gdbcmd.h" #include "breakpoint.h" #include "language.h" @@ -81,21 +82,6 @@ static void clear_symtab_users_cleanup (void *ignore); /* Global variables owned by this file */ int readnow_symbol_files; /* Read full symbols immediately */ -struct complaint oldsyms_complaint = -{ - "Replacing old symbols for `%s'", 0, 0 -}; - -struct complaint empty_symtab_complaint = -{ - "Empty symbol table found for `%s'", 0, 0 -}; - -struct complaint unknown_option_complaint = -{ - "Unknown option `%s' ignored", 0, 0 -}; - /* External variables and functions referenced. */ extern void report_transfer_performance (unsigned long, time_t, time_t); @@ -706,7 +692,7 @@ syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs, initial symbol reading for this file. */ (*objfile->sf->sym_init) (objfile); - clear_complaints (1, verbo); + clear_complaints (&symfile_complaints, 1, verbo); (*objfile->sf->sym_offsets) (objfile, addrs); @@ -818,7 +804,7 @@ new_symfile_objfile (struct objfile *objfile, int mainline, int verbo) } /* We're done reading the symbol file; finish off complaints. */ - clear_complaints (0, verbo); + clear_complaints (&symfile_complaints, 0, verbo); } /* Process a symbol file, as either the main file or as a dynamically @@ -1801,7 +1787,7 @@ reread_symbols (void) } (*objfile->sf->sym_init) (objfile); - clear_complaints (1, 1); + clear_complaints (&symfile_complaints, 1, 1); /* The "mainline" parameter is a hideous hack; I think leaving it zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ @@ -1815,7 +1801,7 @@ reread_symbols (void) objfile->flags |= OBJF_SYMS; /* We're done reading the symbol file; finish off complaints. */ - clear_complaints (0, 1); + clear_complaints (&symfile_complaints, 0, 1); /* Getting new symbols may change our opinion about what is frameless. */ @@ -2118,8 +2104,7 @@ clear_symtab_users (void) clear_internalvars (); breakpoint_re_set (); set_default_breakpoint (0, 0, 0, 0); - current_source_symtab = 0; - current_source_line = 0; + clear_current_source_symtab_and_line (); clear_pc_function_cache (); if (target_new_objfile_hook) target_new_objfile_hook (NULL); @@ -2305,15 +2290,16 @@ again2: || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))) { - complain (&oldsyms_complaint, name); - + complaint (&symfile_complaints, "Replacing old symbols for `%s'", + name); clear_symtab_users_queued++; make_cleanup (clear_symtab_users_once, 0); blewit = 1; } else { - complain (&empty_symtab_complaint, name); + complaint (&symfile_complaints, "Empty symbol table found for `%s'", + name); } free_symtab (s); diff --git a/gdb/symtab.c b/gdb/symtab.c index d39962ec033..a4322926e2f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -38,6 +38,7 @@ #include "demangle.h" #include "inferior.h" #include "linespec.h" +#include "source.h" #include "filenames.h" /* for FILENAME_CMP */ #include "gdb_obstack.h" @@ -860,15 +861,20 @@ lookup_symbol_aux (const char *name, const char *mangled_name, /* This is a function which has a symtab for its address. */ bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol), - mangled_name, namespace); + + /* This call used to pass `SYMBOL_NAME (msymbol)' as the + `name' argument to lookup_block_symbol. But the name + of a minimal symbol is always mangled, so that seems + to be clearly the wrong thing to pass as the + unmangled name. */ + sym = lookup_block_symbol (block, name, mangled_name, namespace); /* We kept static functions in minimal symbol table as well as in static scope. We want to find them in the symbol table. */ if (!sym) { block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); - sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol), - mangled_name, namespace); + sym = lookup_block_symbol (block, name, + mangled_name, namespace); } /* sym == 0 if symbol was found in the minimal symbol table @@ -1027,15 +1033,19 @@ lookup_symbol_aux (const char *name, const char *mangled_name, { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol), - mangled_name, namespace); + /* This call used to pass `SYMBOL_NAME (msymbol)' as the + `name' argument to lookup_block_symbol. But the name + of a minimal symbol is always mangled, so that seems + to be clearly the wrong thing to pass as the + unmangled name. */ + sym = lookup_block_symbol (block, name, mangled_name, namespace); /* We kept static functions in minimal symbol table as well as in static scope. We want to find them in the symbol table. */ if (!sym) { block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); - sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol), - mangled_name, namespace); + sym = lookup_block_symbol (block, name, + mangled_name, namespace); } /* If we found one, return it */ if (sym) @@ -3958,11 +3968,19 @@ struct symtabs_and_lines decode_line_spec (char *string, int funfirstline) { struct symtabs_and_lines sals; + struct symtab_and_line cursal; + if (string == 0) error ("Empty line specification."); + + /* We use whatever is set as the current source line. We do not try + and get a default or it will recursively call us! */ + cursal = get_current_source_symtab_and_line (); + sals = decode_line_1 (&string, funfirstline, - current_source_symtab, current_source_line, + cursal.symtab, cursal.line, (char ***) NULL); + if (*string) error ("Junk at end of line specification: %s", string); return sals; diff --git a/gdb/symtab.h b/gdb/symtab.h index 7f511f070cd..a78607d584e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1,6 +1,6 @@ /* Symbol table definitions for GDB. Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001 + 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -46,78 +46,78 @@ struct obstack; have tens or hundreds of thousands of these. */ struct general_symbol_info - { - /* Name of the symbol. This is a required field. Storage for the name is - allocated on the psymbol_obstack or symbol_obstack for the associated - objfile. */ +{ + /* Name of the symbol. This is a required field. Storage for the name is + allocated on the psymbol_obstack or symbol_obstack for the associated + objfile. */ - char *name; + char *name; - /* Value of the symbol. Which member of this union to use, and what - it means, depends on what kind of symbol this is and its - SYMBOL_CLASS. See comments there for more details. All of these - are in host byte order (though what they point to might be in - target byte order, e.g. LOC_CONST_BYTES). */ + /* Value of the symbol. Which member of this union to use, and what + it means, depends on what kind of symbol this is and its + SYMBOL_CLASS. See comments there for more details. All of these + are in host byte order (though what they point to might be in + target byte order, e.g. LOC_CONST_BYTES). */ - union - { - /* The fact that this is a long not a LONGEST mainly limits the - range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not - sure that is a big deal. */ - long ivalue; + union + { + /* The fact that this is a long not a LONGEST mainly limits the + range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not + sure that is a big deal. */ + long ivalue; - struct block *block; + struct block *block; - char *bytes; + char *bytes; - CORE_ADDR address; + CORE_ADDR address; - /* for opaque typedef struct chain */ + /* for opaque typedef struct chain */ - struct symbol *chain; - } - value; + struct symbol *chain; + } + value; - /* Since one and only one language can apply, wrap the language specific - information inside a union. */ + /* Since one and only one language can apply, wrap the language specific + information inside a union. */ - union - { - struct cplus_specific /* For C++ */ - /* and Java */ - { - char *demangled_name; - } - cplus_specific; + union + { + struct cplus_specific /* For C++ */ + /* and Java */ + { + char *demangled_name; + } + cplus_specific; #if 0 - /* OBSOLETE struct chill_specific *//* For Chill */ - /* OBSOLETE { */ - /* OBSOLETE char *demangled_name; */ - /* OBSOLETE } */ - /* OBSOLETE chill_specific; */ +/* OBSOLETE struct chill_specific *//* For Chill */ + /* OBSOLETE { */ + /* OBSOLETE char *demangled_name; */ + /* OBSOLETE } */ + /* OBSOLETE chill_specific; */ #endif - } - language_specific; + } + language_specific; - /* Record the source code language that applies to this symbol. - This is used to select one of the fields from the language specific - union above. */ + /* Record the source code language that applies to this symbol. + This is used to select one of the fields from the language specific + union above. */ - enum language language BYTE_BITFIELD; + enum language language BYTE_BITFIELD; - /* Which section is this symbol in? This is an index into - section_offsets for this objfile. Negative means that the symbol - does not get relocated relative to a section. - Disclaimer: currently this is just used for xcoff, so don't - expect all symbol-reading code to set it correctly (the ELF code - also tries to set it correctly). */ + /* Which section is this symbol in? This is an index into + section_offsets for this objfile. Negative means that the symbol + does not get relocated relative to a section. + Disclaimer: currently this is just used for xcoff, so don't + expect all symbol-reading code to set it correctly (the ELF code + also tries to set it correctly). */ - short section; + short section; - /* The bfd section associated with this symbol. */ + /* The bfd section associated with this symbol. */ - asection *bfd_section; - }; + asection *bfd_section; +}; extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); @@ -160,9 +160,9 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \ (symbol_init_demangled_name (&symbol->ginfo, (obstack))) extern void symbol_init_demangled_name (struct general_symbol_info *symbol, - struct obstack *obstack); + struct obstack *obstack); + - /* Macro that returns the demangled name for a symbol based on the language for that symbol. If no demangled name exists, returns NULL. */ @@ -233,82 +233,82 @@ extern void symbol_init_demangled_name (struct general_symbol_info *symbol, used to figure out what full symbol table entries need to be read in. */ struct minimal_symbol - { +{ - /* The general symbol info required for all types of symbols. + /* The general symbol info required for all types of symbols. - The SYMBOL_VALUE_ADDRESS contains the address that this symbol - corresponds to. */ + The SYMBOL_VALUE_ADDRESS contains the address that this symbol + corresponds to. */ - struct general_symbol_info ginfo; + struct general_symbol_info ginfo; - /* The info field is available for caching machine-specific information - so it doesn't have to rederive the info constantly (over a serial line). - It is initialized to zero and stays that way until target-dependent code - sets it. Storage for any data pointed to by this field should be allo- - cated on the symbol_obstack for the associated objfile. - The type would be "void *" except for reasons of compatibility with older - compilers. This field is optional. + /* The info field is available for caching machine-specific information + so it doesn't have to rederive the info constantly (over a serial line). + It is initialized to zero and stays that way until target-dependent code + sets it. Storage for any data pointed to by this field should be allo- + cated on the symbol_obstack for the associated objfile. + The type would be "void *" except for reasons of compatibility with older + compilers. This field is optional. - Currently, the AMD 29000 tdep.c uses it to remember things it has decoded - from the instructions in the function header, and the MIPS-16 code uses - it to identify 16-bit procedures. */ + Currently, the AMD 29000 tdep.c uses it to remember things it has decoded + from the instructions in the function header, and the MIPS-16 code uses + it to identify 16-bit procedures. */ - char *info; + char *info; #ifdef SOFUN_ADDRESS_MAYBE_MISSING - /* Which source file is this symbol in? Only relevant for mst_file_*. */ - char *filename; + /* Which source file is this symbol in? Only relevant for mst_file_*. */ + char *filename; #endif - /* Classification types for this symbol. These should be taken as "advisory - only", since if gdb can't easily figure out a classification it simply - selects mst_unknown. It may also have to guess when it can't figure out - which is a better match between two types (mst_data versus mst_bss) for - example. Since the minimal symbol info is sometimes derived from the - BFD library's view of a file, we need to live with what information bfd - supplies. */ - - enum minimal_symbol_type - { - mst_unknown = 0, /* Unknown type, the default */ - mst_text, /* Generally executable instructions */ - mst_data, /* Generally initialized data */ - mst_bss, /* Generally uninitialized data */ - mst_abs, /* Generally absolute (nonrelocatable) */ - /* GDB uses mst_solib_trampoline for the start address of a shared - library trampoline entry. Breakpoints for shared library functions - are put there if the shared library is not yet loaded. - After the shared library is loaded, lookup_minimal_symbol will - prefer the minimal symbol from the shared library (usually - a mst_text symbol) over the mst_solib_trampoline symbol, and the - breakpoints will be moved to their true address in the shared - library via breakpoint_re_set. */ - mst_solib_trampoline, /* Shared library trampoline code */ - /* For the mst_file* types, the names are only guaranteed to be unique - within a given .o file. */ - mst_file_text, /* Static version of mst_text */ - mst_file_data, /* Static version of mst_data */ - mst_file_bss /* Static version of mst_bss */ - } - type BYTE_BITFIELD; - - /* Minimal symbols with the same hash key are kept on a linked - list. This is the link. */ - - struct minimal_symbol *hash_next; - - /* Minimal symbols are stored in two different hash tables. This is - the `next' pointer for the demangled hash table. */ - - struct minimal_symbol *demangled_hash_next; - }; + /* Classification types for this symbol. These should be taken as "advisory + only", since if gdb can't easily figure out a classification it simply + selects mst_unknown. It may also have to guess when it can't figure out + which is a better match between two types (mst_data versus mst_bss) for + example. Since the minimal symbol info is sometimes derived from the + BFD library's view of a file, we need to live with what information bfd + supplies. */ + + enum minimal_symbol_type + { + mst_unknown = 0, /* Unknown type, the default */ + mst_text, /* Generally executable instructions */ + mst_data, /* Generally initialized data */ + mst_bss, /* Generally uninitialized data */ + mst_abs, /* Generally absolute (nonrelocatable) */ + /* GDB uses mst_solib_trampoline for the start address of a shared + library trampoline entry. Breakpoints for shared library functions + are put there if the shared library is not yet loaded. + After the shared library is loaded, lookup_minimal_symbol will + prefer the minimal symbol from the shared library (usually + a mst_text symbol) over the mst_solib_trampoline symbol, and the + breakpoints will be moved to their true address in the shared + library via breakpoint_re_set. */ + mst_solib_trampoline, /* Shared library trampoline code */ + /* For the mst_file* types, the names are only guaranteed to be unique + within a given .o file. */ + mst_file_text, /* Static version of mst_text */ + mst_file_data, /* Static version of mst_data */ + mst_file_bss /* Static version of mst_bss */ + } + type BYTE_BITFIELD; + + /* Minimal symbols with the same hash key are kept on a linked + list. This is the link. */ + + struct minimal_symbol *hash_next; + + /* Minimal symbols are stored in two different hash tables. This is + the `next' pointer for the demangled hash table. */ + + struct minimal_symbol *demangled_hash_next; +}; #define MSYMBOL_INFO(msymbol) (msymbol)->info #define MSYMBOL_TYPE(msymbol) (msymbol)->type - + /* All of the name-scope contours of the program are represented by `struct block' objects. All of these objects are pointed to by the blockvector. @@ -336,12 +336,12 @@ struct minimal_symbol the blocks appear in the order of a depth-first tree walk. */ struct blockvector - { - /* Number of blocks in the list. */ - int nblocks; - /* The blocks themselves. */ - struct block *block[1]; - }; +{ + /* Number of blocks in the list. */ + int nblocks; + /* The blocks themselves. */ + struct block *block[1]; +}; #define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks #define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n] @@ -353,66 +353,66 @@ struct blockvector #define FIRST_LOCAL_BLOCK 2 struct block - { +{ - /* Addresses in the executable code that are in this block. */ + /* Addresses in the executable code that are in this block. */ - CORE_ADDR startaddr; - CORE_ADDR endaddr; + CORE_ADDR startaddr; + CORE_ADDR endaddr; - /* The symbol that names this block, if the block is the body of a - function; otherwise, zero. */ + /* The symbol that names this block, if the block is the body of a + function; otherwise, zero. */ - struct symbol *function; + struct symbol *function; - /* The `struct block' for the containing block, or 0 if none. + /* The `struct block' for the containing block, or 0 if none. - The superblock of a top-level local block (i.e. a function in the - case of C) is the STATIC_BLOCK. The superblock of the - STATIC_BLOCK is the GLOBAL_BLOCK. */ + The superblock of a top-level local block (i.e. a function in the + case of C) is the STATIC_BLOCK. The superblock of the + STATIC_BLOCK is the GLOBAL_BLOCK. */ - struct block *superblock; + struct block *superblock; - /* Version of GCC used to compile the function corresponding - to this block, or 0 if not compiled with GCC. When possible, - GCC should be compatible with the native compiler, or if that - is not feasible, the differences should be fixed during symbol - reading. As of 16 Apr 93, this flag is never used to distinguish - between gcc2 and the native compiler. + /* Version of GCC used to compile the function corresponding + to this block, or 0 if not compiled with GCC. When possible, + GCC should be compatible with the native compiler, or if that + is not feasible, the differences should be fixed during symbol + reading. As of 16 Apr 93, this flag is never used to distinguish + between gcc2 and the native compiler. - If there is no function corresponding to this block, this meaning - of this flag is undefined. */ + If there is no function corresponding to this block, this meaning + of this flag is undefined. */ - unsigned char gcc_compile_flag; + unsigned char gcc_compile_flag; - /* The symbols for this block are either in a simple linear list or - in a simple hashtable. Blocks which correspond to a function - (which have a list of symbols corresponding to arguments) use - a linear list, as do some older symbol readers (currently only - mdebugread and dstread). Other blocks are hashed. + /* The symbols for this block are either in a simple linear list or + in a simple hashtable. Blocks which correspond to a function + (which have a list of symbols corresponding to arguments) use + a linear list, as do some older symbol readers (currently only + mdebugread and dstread). Other blocks are hashed. - The hashtable uses the same hash function as the minsym hashtables, - found in minsyms.c:minsym_hash_iw. Symbols are hashed based on - their demangled name if appropriate, and on their name otherwise. - The hash function ignores space, and stops at the beginning of the - argument list if any. + The hashtable uses the same hash function as the minsym hashtables, + found in minsyms.c:minsym_hash_iw. Symbols are hashed based on + their demangled name if appropriate, and on their name otherwise. + The hash function ignores space, and stops at the beginning of the + argument list if any. - The table is laid out in NSYMS/5 buckets and symbols are chained via - their hash_next field. */ + The table is laid out in NSYMS/5 buckets and symbols are chained via + their hash_next field. */ - /* If this is really a hashtable of the symbols, this flag is 1. */ + /* If this is really a hashtable of the symbols, this flag is 1. */ - unsigned char hashtable; + unsigned char hashtable; - /* Number of local symbols. */ + /* Number of local symbols. */ - int nsyms; + int nsyms; - /* The symbols. If some of them are arguments, then they must be - in the order in which we would like to print them. */ + /* The symbols. If some of them are arguments, then they must be + in the order in which we would like to print them. */ - struct symbol *sym[1]; - }; + struct symbol *sym[1]; +}; #define BLOCK_START(bl) (bl)->startaddr #define BLOCK_END(bl) (bl)->endaddr @@ -456,250 +456,248 @@ struct block namespace and ignores symbol definitions in other name spaces. */ typedef enum - { - /* UNDEF_NAMESPACE is used when a namespace has not been discovered or - none of the following apply. This usually indicates an error either - in the symbol information or in gdb's handling of symbols. */ +{ + /* UNDEF_NAMESPACE is used when a namespace has not been discovered or + none of the following apply. This usually indicates an error either + in the symbol information or in gdb's handling of symbols. */ - UNDEF_NAMESPACE, + UNDEF_NAMESPACE, - /* VAR_NAMESPACE is the usual namespace. In C, this contains variables, - function names, typedef names and enum type values. */ + /* VAR_NAMESPACE is the usual namespace. In C, this contains variables, + function names, typedef names and enum type values. */ - VAR_NAMESPACE, + VAR_NAMESPACE, - /* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names. - Thus, if `struct foo' is used in a C program, it produces a symbol named - `foo' in the STRUCT_NAMESPACE. */ + /* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names. + Thus, if `struct foo' is used in a C program, it produces a symbol named + `foo' in the STRUCT_NAMESPACE. */ - STRUCT_NAMESPACE, + STRUCT_NAMESPACE, - /* LABEL_NAMESPACE may be used for names of labels (for gotos); - currently it is not used and labels are not recorded at all. */ + /* LABEL_NAMESPACE may be used for names of labels (for gotos); + currently it is not used and labels are not recorded at all. */ - LABEL_NAMESPACE, + LABEL_NAMESPACE, - /* Searching namespaces. These overlap with VAR_NAMESPACE, providing - some granularity with the search_symbols function. */ + /* Searching namespaces. These overlap with VAR_NAMESPACE, providing + some granularity with the search_symbols function. */ - /* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and - METHODS_NAMESPACE */ - VARIABLES_NAMESPACE, + /* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and + METHODS_NAMESPACE */ + VARIABLES_NAMESPACE, - /* All functions -- for some reason not methods, though. */ - FUNCTIONS_NAMESPACE, + /* All functions -- for some reason not methods, though. */ + FUNCTIONS_NAMESPACE, - /* All defined types */ - TYPES_NAMESPACE, + /* All defined types */ + TYPES_NAMESPACE, - /* All class methods -- why is this separated out? */ - METHODS_NAMESPACE - - } + /* All class methods -- why is this separated out? */ + METHODS_NAMESPACE +} namespace_enum; /* An address-class says where to find the value of a symbol. */ enum address_class - { - /* Not used; catches errors */ - - LOC_UNDEF, +{ + /* Not used; catches errors */ - /* Value is constant int SYMBOL_VALUE, host byteorder */ + LOC_UNDEF, - LOC_CONST, + /* Value is constant int SYMBOL_VALUE, host byteorder */ - /* Value is at fixed address SYMBOL_VALUE_ADDRESS */ + LOC_CONST, - LOC_STATIC, + /* Value is at fixed address SYMBOL_VALUE_ADDRESS */ - /* Value is in register. SYMBOL_VALUE is the register number. */ + LOC_STATIC, - LOC_REGISTER, + /* Value is in register. SYMBOL_VALUE is the register number. */ - /* It's an argument; the value is at SYMBOL_VALUE offset in arglist. */ + LOC_REGISTER, - LOC_ARG, + /* It's an argument; the value is at SYMBOL_VALUE offset in arglist. */ - /* Value address is at SYMBOL_VALUE offset in arglist. */ + LOC_ARG, - LOC_REF_ARG, + /* Value address is at SYMBOL_VALUE offset in arglist. */ - /* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER - except this is an argument. Probably the cleaner way to handle - this would be to separate address_class (which would include - separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus - FRAME_LOCALS_ADDRESS), and an is_argument flag. + LOC_REF_ARG, - For some symbol formats (stabs, for some compilers at least), - the compiler generates two symbols, an argument and a register. - In some cases we combine them to a single LOC_REGPARM in symbol - reading, but currently not for all cases (e.g. it's passed on the - stack and then loaded into a register). */ + /* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER + except this is an argument. Probably the cleaner way to handle + this would be to separate address_class (which would include + separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus + FRAME_LOCALS_ADDRESS), and an is_argument flag. - LOC_REGPARM, + For some symbol formats (stabs, for some compilers at least), + the compiler generates two symbols, an argument and a register. + In some cases we combine them to a single LOC_REGPARM in symbol + reading, but currently not for all cases (e.g. it's passed on the + stack and then loaded into a register). */ - /* Value is in specified register. Just like LOC_REGPARM except the - register holds the address of the argument instead of the argument - itself. This is currently used for the passing of structs and unions - on sparc and hppa. It is also used for call by reference where the - address is in a register, at least by mipsread.c. */ + LOC_REGPARM, - LOC_REGPARM_ADDR, + /* Value is in specified register. Just like LOC_REGPARM except the + register holds the address of the argument instead of the argument + itself. This is currently used for the passing of structs and unions + on sparc and hppa. It is also used for call by reference where the + address is in a register, at least by mipsread.c. */ - /* Value is a local variable at SYMBOL_VALUE offset in stack frame. */ + LOC_REGPARM_ADDR, - LOC_LOCAL, + /* Value is a local variable at SYMBOL_VALUE offset in stack frame. */ - /* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace - STRUCT_NAMESPACE all have this class. */ + LOC_LOCAL, - LOC_TYPEDEF, + /* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace + STRUCT_NAMESPACE all have this class. */ - /* Value is address SYMBOL_VALUE_ADDRESS in the code */ + LOC_TYPEDEF, - LOC_LABEL, + /* Value is address SYMBOL_VALUE_ADDRESS in the code */ - /* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'. - In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address - of the block. Function names have this class. */ + LOC_LABEL, - LOC_BLOCK, + /* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'. + In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address + of the block. Function names have this class. */ - /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in - target byte order. */ + LOC_BLOCK, - LOC_CONST_BYTES, + /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in + target byte order. */ - /* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from - LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in - that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the - arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args - in regs then copies to frame. */ + LOC_CONST_BYTES, - LOC_LOCAL_ARG, + /* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from + LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in + that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the + arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args + in regs then copies to frame. */ - /* Value is at SYMBOL_VALUE offset from the current value of - register number SYMBOL_BASEREG. This exists mainly for the same - things that LOC_LOCAL and LOC_ARG do; but we need to do this - instead because on 88k DWARF gives us the offset from the - frame/stack pointer, rather than the offset from the "canonical - frame address" used by COFF, stabs, etc., and we don't know how - to convert between these until we start examining prologues. + LOC_LOCAL_ARG, - Note that LOC_BASEREG is much less general than a DWARF expression. - We don't need the generality (at least not yet), and storing a general - DWARF expression would presumably take up more space than the existing - scheme. */ + /* Value is at SYMBOL_VALUE offset from the current value of + register number SYMBOL_BASEREG. This exists mainly for the same + things that LOC_LOCAL and LOC_ARG do; but we need to do this + instead because on 88k DWARF gives us the offset from the + frame/stack pointer, rather than the offset from the "canonical + frame address" used by COFF, stabs, etc., and we don't know how + to convert between these until we start examining prologues. - LOC_BASEREG, + Note that LOC_BASEREG is much less general than a DWARF expression. + We don't need the generality (at least not yet), and storing a general + DWARF expression would presumably take up more space than the existing + scheme. */ - /* Same as LOC_BASEREG but it is an argument. */ + LOC_BASEREG, - LOC_BASEREG_ARG, + /* Same as LOC_BASEREG but it is an argument. */ - /* Value is at fixed address, but the address of the variable has - to be determined from the minimal symbol table whenever the - variable is referenced. - This happens if debugging information for a global symbol is - emitted and the corresponding minimal symbol is defined - in another object file or runtime common storage. - The linker might even remove the minimal symbol if the global - symbol is never referenced, in which case the symbol remains - unresolved. */ + LOC_BASEREG_ARG, - LOC_UNRESOLVED, + /* Value is at fixed address, but the address of the variable has + to be determined from the minimal symbol table whenever the + variable is referenced. + This happens if debugging information for a global symbol is + emitted and the corresponding minimal symbol is defined + in another object file or runtime common storage. + The linker might even remove the minimal symbol if the global + symbol is never referenced, in which case the symbol remains + unresolved. */ - /* Value is at a thread-specific location calculated by a - target-specific method. */ + LOC_UNRESOLVED, - LOC_THREAD_LOCAL_STATIC, + /* Value is at a thread-specific location calculated by a + target-specific method. */ - /* The variable does not actually exist in the program. - The value is ignored. */ + LOC_THREAD_LOCAL_STATIC, - LOC_OPTIMIZED_OUT, + /* The variable does not actually exist in the program. + The value is ignored. */ - /* The variable is static, but actually lives at * (address). - * I.e. do an extra indirection to get to it. - * This is used on HP-UX to get at globals that are allocated - * in shared libraries, where references from images other - * than the one where the global was allocated are done - * with a level of indirection. - */ + LOC_OPTIMIZED_OUT, - LOC_INDIRECT + /* The variable is static, but actually lives at * (address). + * I.e. do an extra indirection to get to it. + * This is used on HP-UX to get at globals that are allocated + * in shared libraries, where references from images other + * than the one where the global was allocated are done + * with a level of indirection. + */ - }; + LOC_INDIRECT +}; /* Linked list of symbol's live ranges. */ struct range_list - { - CORE_ADDR start; - CORE_ADDR end; - struct range_list *next; - }; +{ + CORE_ADDR start; + CORE_ADDR end; + struct range_list *next; +}; /* Linked list of aliases for a particular main/primary symbol. */ struct alias_list - { - struct symbol *sym; - struct alias_list *next; - }; +{ + struct symbol *sym; + struct alias_list *next; +}; struct symbol - { +{ - /* The general symbol info required for all types of symbols. */ + /* The general symbol info required for all types of symbols. */ - struct general_symbol_info ginfo; + struct general_symbol_info ginfo; - /* Data type of value */ + /* Data type of value */ - struct type *type; + struct type *type; - /* Name space code. */ + /* Name space code. */ #ifdef __MFC4__ - /* FIXME: don't conflict with C++'s namespace */ - /* would be safer to do a global change for all namespace identifiers. */ + /* FIXME: don't conflict with C++'s namespace */ + /* would be safer to do a global change for all namespace identifiers. */ #define namespace _namespace #endif - namespace_enum namespace BYTE_BITFIELD; + namespace_enum namespace BYTE_BITFIELD; - /* Address class */ + /* Address class */ - enum address_class aclass BYTE_BITFIELD; + enum address_class aclass BYTE_BITFIELD; - /* Line number of definition. FIXME: Should we really make the assumption - that nobody will try to debug files longer than 64K lines? What about - machine generated programs? */ + /* Line number of definition. FIXME: Should we really make the assumption + that nobody will try to debug files longer than 64K lines? What about + machine generated programs? */ - unsigned short line; + unsigned short line; - /* Some symbols require an additional value to be recorded on a per- - symbol basis. Stash those values here. */ + /* Some symbols require an additional value to be recorded on a per- + symbol basis. Stash those values here. */ - union - { - /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */ - short basereg; - } - aux_value; + union + { + /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */ + short basereg; + } + aux_value; - /* Link to a list of aliases for this symbol. - Only a "primary/main symbol may have aliases. */ - struct alias_list *aliases; + /* Link to a list of aliases for this symbol. + Only a "primary/main symbol may have aliases. */ + struct alias_list *aliases; - /* List of ranges where this symbol is active. This is only - used by alias symbols at the current time. */ - struct range_list *ranges; + /* List of ranges where this symbol is active. This is only + used by alias symbols at the current time. */ + struct range_list *ranges; - struct symbol *hash_next; - }; + struct symbol *hash_next; +}; #define SYMBOL_NAMESPACE(symbol) (symbol)->namespace @@ -718,21 +716,21 @@ struct symbol normal symtab once the partial_symtab has been referenced. */ struct partial_symbol - { +{ - /* The general symbol info required for all types of symbols. */ + /* The general symbol info required for all types of symbols. */ - struct general_symbol_info ginfo; + struct general_symbol_info ginfo; - /* Name space code. */ + /* Name space code. */ - namespace_enum namespace BYTE_BITFIELD; + namespace_enum namespace BYTE_BITFIELD; - /* Address class (for info_symbols) */ + /* Address class (for info_symbols) */ - enum address_class aclass BYTE_BITFIELD; + enum address_class aclass BYTE_BITFIELD; - }; +}; #define PSYMBOL_NAMESPACE(psymbol) (psymbol)->namespace #define PSYMBOL_CLASS(psymbol) (psymbol)->aclass @@ -742,10 +740,10 @@ struct partial_symbol line numbers and addresses in the program text. */ struct sourcevector - { - int length; /* Number of source files described */ - struct source *source[1]; /* Descriptions of the files */ - }; +{ + int length; /* Number of source files described */ + struct source *source[1]; /* Descriptions of the files */ +}; /* Each item represents a line-->pc (or the reverse) mapping. This is somewhat more wasteful of space than one might wish, but since only @@ -753,10 +751,10 @@ struct sourcevector waste much space. */ struct linetable_entry - { - int line; - CORE_ADDR pc; - }; +{ + int line; + CORE_ADDR pc; +}; /* The order of entries in the linetable is significant. They should be sorted by increasing values of the pc field. If there is more than @@ -776,22 +774,22 @@ struct linetable_entry zero length. */ struct linetable - { - int nitems; +{ + int nitems; - /* Actually NITEMS elements. If you don't like this use of the - `struct hack', you can shove it up your ANSI (seriously, if the - committee tells us how to do it, we can probably go along). */ - struct linetable_entry item[1]; - }; + /* Actually NITEMS elements. If you don't like this use of the + `struct hack', you can shove it up your ANSI (seriously, if the + committee tells us how to do it, we can probably go along). */ + struct linetable_entry item[1]; +}; /* All the information on one source file. */ struct source - { - char *name; /* Name of file */ - struct linetable contents; - }; +{ + char *name; /* Name of file */ + struct linetable contents; +}; /* How to relocate the symbols from each section in a symbol file. Each struct contains an array of offsets. @@ -804,9 +802,9 @@ struct source extract offset values in the struct. */ struct section_offsets - { - CORE_ADDR offsets[1]; /* As many as needed. */ - }; +{ + CORE_ADDR offsets[1]; /* As many as needed. */ +}; #define ANOFFSET(secoff, whichone) \ ((whichone == -1) \ @@ -823,100 +821,100 @@ struct section_offsets These objects are chained through the `next' field. */ struct symtab - { +{ - /* Chain of all existing symtabs. */ + /* Chain of all existing symtabs. */ - struct symtab *next; + struct symtab *next; - /* List of all symbol scope blocks for this symtab. May be shared - between different symtabs (and normally is for all the symtabs - in a given compilation unit). */ + /* List of all symbol scope blocks for this symtab. May be shared + between different symtabs (and normally is for all the symtabs + in a given compilation unit). */ - struct blockvector *blockvector; + struct blockvector *blockvector; - /* Table mapping core addresses to line numbers for this file. - Can be NULL if none. Never shared between different symtabs. */ + /* Table mapping core addresses to line numbers for this file. + Can be NULL if none. Never shared between different symtabs. */ - struct linetable *linetable; + struct linetable *linetable; - /* Section in objfile->section_offsets for the blockvector and - the linetable. Probably always SECT_OFF_TEXT. */ + /* Section in objfile->section_offsets for the blockvector and + the linetable. Probably always SECT_OFF_TEXT. */ - int block_line_section; + int block_line_section; - /* If several symtabs share a blockvector, exactly one of them - should be designated the primary, so that the blockvector - is relocated exactly once by objfile_relocate. */ + /* If several symtabs share a blockvector, exactly one of them + should be designated the primary, so that the blockvector + is relocated exactly once by objfile_relocate. */ - int primary; + int primary; - /* The macro table for this symtab. Like the blockvector, this - may be shared between different symtabs --- and normally is for - all the symtabs in a given compilation unit. */ - struct macro_table *macro_table; + /* The macro table for this symtab. Like the blockvector, this + may be shared between different symtabs --- and normally is for + all the symtabs in a given compilation unit. */ + struct macro_table *macro_table; - /* Name of this source file. */ + /* Name of this source file. */ - char *filename; + char *filename; - /* Directory in which it was compiled, or NULL if we don't know. */ + /* Directory in which it was compiled, or NULL if we don't know. */ - char *dirname; + char *dirname; - /* This component says how to free the data we point to: - free_contents => do a tree walk and free each object. - free_nothing => do nothing; some other symtab will free - the data this one uses. - free_linetable => free just the linetable. FIXME: Is this redundant - with the primary field? */ + /* This component says how to free the data we point to: + free_contents => do a tree walk and free each object. + free_nothing => do nothing; some other symtab will free + the data this one uses. + free_linetable => free just the linetable. FIXME: Is this redundant + with the primary field? */ - enum free_code - { - free_nothing, free_contents, free_linetable - } - free_code; + enum free_code + { + free_nothing, free_contents, free_linetable + } + free_code; - /* Pointer to one block of storage to be freed, if nonzero. */ - /* This is IN ADDITION to the action indicated by free_code. */ + /* Pointer to one block of storage to be freed, if nonzero. */ + /* This is IN ADDITION to the action indicated by free_code. */ - char *free_ptr; + char *free_ptr; - /* Total number of lines found in source file. */ + /* Total number of lines found in source file. */ - int nlines; + int nlines; - /* line_charpos[N] is the position of the (N-1)th line of the - source file. "position" means something we can lseek() to; it - is not guaranteed to be useful any other way. */ + /* line_charpos[N] is the position of the (N-1)th line of the + source file. "position" means something we can lseek() to; it + is not guaranteed to be useful any other way. */ - int *line_charpos; + int *line_charpos; - /* Language of this source file. */ + /* Language of this source file. */ - enum language language; + enum language language; - /* String that identifies the format of the debugging information, such - as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful - for automated testing of gdb but may also be information that is - useful to the user. */ + /* String that identifies the format of the debugging information, such + as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful + for automated testing of gdb but may also be information that is + useful to the user. */ - char *debugformat; + char *debugformat; - /* String of version information. May be zero. */ + /* String of version information. May be zero. */ - char *version; + char *version; - /* Full name of file as found by searching the source path. - NULL if not yet known. */ + /* Full name of file as found by searching the source path. + NULL if not yet known. */ - char *fullname; + char *fullname; - /* Object file from which this symbol information was read. */ + /* Object file from which this symbol information was read. */ - struct objfile *objfile; + struct objfile *objfile; - }; +}; #define BLOCKVECTOR(symtab) (symtab)->blockvector #define LINETABLE(symtab) (symtab)->linetable @@ -934,88 +932,88 @@ struct symtab style execution of a bunch of .o's. */ struct partial_symtab - { +{ - /* Chain of all existing partial symtabs. */ + /* Chain of all existing partial symtabs. */ - struct partial_symtab *next; + struct partial_symtab *next; - /* Name of the source file which this partial_symtab defines */ + /* Name of the source file which this partial_symtab defines */ - char *filename; + char *filename; - /* Full path of the source file. NULL if not known. */ + /* Full path of the source file. NULL if not known. */ - char *fullname; + char *fullname; - /* Information about the object file from which symbols should be read. */ + /* Information about the object file from which symbols should be read. */ - struct objfile *objfile; + struct objfile *objfile; - /* Set of relocation offsets to apply to each section. */ + /* Set of relocation offsets to apply to each section. */ - struct section_offsets *section_offsets; + struct section_offsets *section_offsets; - /* Range of text addresses covered by this file; texthigh is the - beginning of the next section. */ + /* Range of text addresses covered by this file; texthigh is the + beginning of the next section. */ - CORE_ADDR textlow; - CORE_ADDR texthigh; + CORE_ADDR textlow; + CORE_ADDR texthigh; - /* Array of pointers to all of the partial_symtab's which this one - depends on. Since this array can only be set to previous or - the current (?) psymtab, this dependency tree is guaranteed not - to have any loops. "depends on" means that symbols must be read - for the dependencies before being read for this psymtab; this is - for type references in stabs, where if foo.c includes foo.h, declarations - in foo.h may use type numbers defined in foo.c. For other debugging - formats there may be no need to use dependencies. */ + /* Array of pointers to all of the partial_symtab's which this one + depends on. Since this array can only be set to previous or + the current (?) psymtab, this dependency tree is guaranteed not + to have any loops. "depends on" means that symbols must be read + for the dependencies before being read for this psymtab; this is + for type references in stabs, where if foo.c includes foo.h, declarations + in foo.h may use type numbers defined in foo.c. For other debugging + formats there may be no need to use dependencies. */ - struct partial_symtab **dependencies; + struct partial_symtab **dependencies; - int number_of_dependencies; + int number_of_dependencies; - /* Global symbol list. This list will be sorted after readin to - improve access. Binary search will be the usual method of - finding a symbol within it. globals_offset is an integer offset - within global_psymbols[]. */ + /* Global symbol list. This list will be sorted after readin to + improve access. Binary search will be the usual method of + finding a symbol within it. globals_offset is an integer offset + within global_psymbols[]. */ - int globals_offset; - int n_global_syms; + int globals_offset; + int n_global_syms; - /* Static symbol list. This list will *not* be sorted after readin; - to find a symbol in it, exhaustive search must be used. This is - reasonable because searches through this list will eventually - lead to either the read in of a files symbols for real (assumed - to take a *lot* of time; check) or an error (and we don't care - how long errors take). This is an offset and size within - static_psymbols[]. */ + /* Static symbol list. This list will *not* be sorted after readin; + to find a symbol in it, exhaustive search must be used. This is + reasonable because searches through this list will eventually + lead to either the read in of a files symbols for real (assumed + to take a *lot* of time; check) or an error (and we don't care + how long errors take). This is an offset and size within + static_psymbols[]. */ - int statics_offset; - int n_static_syms; + int statics_offset; + int n_static_syms; - /* Pointer to symtab eventually allocated for this source file, 0 if - !readin or if we haven't looked for the symtab after it was readin. */ + /* Pointer to symtab eventually allocated for this source file, 0 if + !readin or if we haven't looked for the symtab after it was readin. */ - struct symtab *symtab; + struct symtab *symtab; - /* Pointer to function which will read in the symtab corresponding to - this psymtab. */ + /* Pointer to function which will read in the symtab corresponding to + this psymtab. */ - void (*read_symtab) (struct partial_symtab *); + void (*read_symtab) (struct partial_symtab *); - /* Information that lets read_symtab() locate the part of the symbol table - that this psymtab corresponds to. This information is private to the - format-dependent symbol reading routines. For further detail examine - the various symbol reading modules. Should really be (void *) but is - (char *) as with other such gdb variables. (FIXME) */ + /* Information that lets read_symtab() locate the part of the symbol table + that this psymtab corresponds to. This information is private to the + format-dependent symbol reading routines. For further detail examine + the various symbol reading modules. Should really be (void *) but is + (char *) as with other such gdb variables. (FIXME) */ - char *read_symtab_private; + char *read_symtab_private; - /* Non-zero if the symtab corresponding to this psymtab has been readin */ + /* Non-zero if the symtab corresponding to this psymtab has been readin */ - unsigned char readin; - }; + unsigned char readin; +}; /* A fast way to get from a psymtab to its symtab (after the first time). */ #define PSYMTAB_TO_SYMTAB(pst) \ @@ -1037,14 +1035,6 @@ struct partial_symtab /* External variables and functions for the objects described above. */ -/* This symtab variable specifies the current file for printing source lines */ - -extern struct symtab *current_source_symtab; - -/* This is the next line to print for listing source lines. */ - -extern int current_source_line; - /* See the comment in symfile.c about how current_objfile is used. */ extern struct objfile *current_objfile; @@ -1213,17 +1203,17 @@ extern void install_minimal_symbols (struct objfile *); extern void msymbols_sort (struct objfile *objfile); struct symtab_and_line - { - struct symtab *symtab; - asection *section; - /* Line number. Line numbers start at 1 and proceed through symtab->nlines. - 0 is never a valid line number; it is used to indicate that line number - information is not available. */ - int line; - - CORE_ADDR pc; - CORE_ADDR end; - }; +{ + struct symtab *symtab; + asection *section; + /* Line number. Line numbers start at 1 and proceed through symtab->nlines. + 0 is never a valid line number; it is used to indicate that line number + information is not available. */ + int line; + + CORE_ADDR pc; + CORE_ADDR end; +}; #define INIT_SAL(sal) { \ (sal)->symtab = 0; \ @@ -1234,10 +1224,10 @@ struct symtab_and_line } struct symtabs_and_lines - { - struct symtab_and_line *sals; - int nelts; - }; +{ + struct symtab_and_line *sals; + int nelts; +}; @@ -1248,22 +1238,22 @@ struct symtabs_and_lines /* Enums for exception-handling support */ enum exception_event_kind - { - EX_EVENT_THROW, - EX_EVENT_CATCH - }; +{ + EX_EVENT_THROW, + EX_EVENT_CATCH +}; /* Type for returning info about an exception */ struct exception_event_record - { - enum exception_event_kind kind; - struct symtab_and_line throw_sal; - struct symtab_and_line catch_sal; - /* This may need to be extended in the future, if - some platforms allow reporting more information, - such as point of rethrow, type of exception object, - type expected by catch clause, etc. */ - }; +{ + enum exception_event_kind kind; + struct symtab_and_line throw_sal; + struct symtab_and_line catch_sal; + /* This may need to be extended in the future, if + some platforms allow reporting more information, + such as point of rethrow, type of exception object, + type expected by catch clause, etc. */ +}; #define CURRENT_EXCEPTION_KIND (current_exception_event->kind) #define CURRENT_EXCEPTION_CATCH_SAL (current_exception_event->catch_sal) @@ -1356,7 +1346,8 @@ extern struct partial_symtab *find_main_psymtab (void); extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *); -extern struct symtab_and_line find_function_start_sal (struct symbol *sym, int); +extern struct symtab_and_line find_function_start_sal (struct symbol *sym, + int); /* blockframe.c */ @@ -1387,36 +1378,37 @@ extern struct partial_symbol *fixup_psymbol_section (struct partial_symbol /* When using search_symbols, a list of the following structs is returned. Callers must free the search list using free_search_symbols! */ struct symbol_search - { - /* The block in which the match was found. Could be, for example, - STATIC_BLOCK or GLOBAL_BLOCK. */ - int block; +{ + /* The block in which the match was found. Could be, for example, + STATIC_BLOCK or GLOBAL_BLOCK. */ + int block; - /* Information describing what was found. + /* Information describing what was found. - If symtab abd symbol are NOT NULL, then information was found - for this match. */ - struct symtab *symtab; - struct symbol *symbol; + If symtab abd symbol are NOT NULL, then information was found + for this match. */ + struct symtab *symtab; + struct symbol *symbol; - /* If msymbol is non-null, then a match was made on something for - which only minimal_symbols exist. */ - struct minimal_symbol *msymbol; + /* If msymbol is non-null, then a match was made on something for + which only minimal_symbols exist. */ + struct minimal_symbol *msymbol; - /* A link to the next match, or NULL for the end. */ - struct symbol_search *next; - }; + /* A link to the next match, or NULL for the end. */ + struct symbol_search *next; +}; extern void search_symbols (char *, namespace_enum, int, char **, struct symbol_search **); extern void free_search_symbols (struct symbol_search *); -extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search *); +extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search + *); /* The name of the ``main'' function. FIXME: cagney/2001-03-20: Can't make main_name() const since some of the calling code currently assumes that the string isn't const. */ extern void set_main_name (const char *name); -extern /*const*/ char *main_name (void); +extern /*const */ char *main_name (void); #endif /* !defined(SYMTAB_H) */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c2b5820bf76..b2b729c405c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -48,6 +48,161 @@ out what version of MI is running. Use this to determine the proper output of setting a breakpoint. +2002-09-29 Andrew Cagney <ac131313@redhat.com> + + * mi0-basics.exp, mi0-break.exp, mi0-console.exp: Delete. + * mi0-disassemble.exp, mi0-eval.exp: Delete. + * mi0-hack-cli.exp, mi0-read-memory.exp: Delete. + * mi0-regs.exp, mi0-return.exp, mi0-simplerun.exp: Delete. + * mi0-stack.exp, mi0-stepi.exp, mi0-until.exp: Delete. + * mi0-var-block.exp, mi0-var-child.exp: Delete. + * mi0-var-cmd.exp, mi0-var-display.exp, mi0-watch.exp: Delete. + +2002-09-27 Kevin Buettner <kevinb@redhat.com> + + * gdb.base/annota1.exp (info break): Make directory components of + path optional since not all compilers emit this debug information. + + * gdb.base/shlib-call.exp (step inside shr2): Don't fail if first + step ends up stepping out of the function instead of stopping on + the epilogue. + +2002-09-26 Keith Seitz <keiths@redhat.com> + + * lib/insight-support.exp (gdbtk_start): Figure out where + the insight executable is based on where gdb is. Use this + executable to start insight instead of gdb. + +2002-09-25 Andrew Cagney <cagney@redhat.com> + + * gdb.base/pc-fp.exp, gdb.base/pc-fp.c: New test. + +2002-09-24 Andrew Cagney <ac131313@redhat.com> + + * gdb.gdb/complaints.exp (test_initial_complaints): Rename + test_isolated_complaints. + (test_empty_complaint): New function. + (test_empty_complaints): New function. Check no output when no + complaints. + +2002-09-19 Jim Blandy <jimb@redhat.com> + + * gdb.base/charset.exp, gdb.base/charset.c: New files. + +2002-09-19 Andrew Cagney <ac131313@redhat.com> + + * gdb.gdb/complaints.exp: New file. + +2002-09-18 Andrew Cagney <ac131313@redhat.com> + + * gdb.base/maint.exp: Check `help maint internal-warning'. + +2002-09-18 David Carlton <carlton@math.stanford.edu> + + * gdb.c++/m-static.exp: Remove breakpoints depending on line + numbers, and replace them by a single breakpoint after the + constructors are all finished. + Add test 4. + * gdb.c++/m-static.cc: Add test 4. + * gdb.c++/m-static.h: New file. + * gdb.c++/m-static1.cc: New file. + + * gdb.c++/printmethod.exp: New file. + * gdb.c++/printmethod.cc: New file. + + * gdb.c++/pr-574.exp: New file. + * gdb.c++/pr-574.cc: New file. + +2002-09-18 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/ending-run.exp: Add handling of "step to end of run" for + embedded targets which never actually exit. + +2002-09-18 Fernando Nasser <fnasser@redhat.com> + + * gdb.base/ending-run.exp: Properly mark "continue after exit" and + "don't step after run" as unresolved or unsupported, instead of xfail. + +2002-09-18 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/ending-run.exp: Fix expected string for _wrap_main to + allow correct handling of #ifdef UNDERSCORES from dejagnu/testglue.c. + Add newline to expected string in "step out of main (status wrapper)" + case. + +2002-09-18 Corinna Vinschen <vinschen@redhat.com> + + * lib/gdb.exp (rerun_to_main): Allow restarting application. + * gdb.base/ena-dis-br.exp (rerun_to_main): Eliminate. + +2002-09-17 Tom Tromey <tromey@redhat.com> + + * gdb.base/printcmds.exp (test_print_string_constants): Expect + \000, not \0, in double-quoted string. + +2002-09-14 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/command.exp: Don't expect a "Program exited normally" + string after running the commands execution on breakpoint tests. + +2002-09-13 Corinna Vinschen <vinschen@redhat.com> + + * lib/gdb.exp (gdb_continue_to_end): Fix typo in expected string. + +2002-09-12 Joel Brobecker <brobecker@gnat.com> + + * gdb.base/call-strs.exp: Fix a small typo in one of the comments. + +2002-09-10 Keith Seitz <keiths@redhat.com> + + * lib/mi-support.exp (mi_runto): New proc. Does the same as gdb's + runto proc. + (mi_run_to_main): Use mi_runto. + (mi_execute_to): Renamed from mi_run_to. Changed all callers. + +2002-09-10 Keith Seitz <keiths@redhat.com> + + * lib/mi-support.exp: (mi_run_to_main): Allow anything to precede + regexp for stopping at main. Could have multiple event notifications. + Don't assume that main was declared with no parameters. + (mi_next): Use mi_step_to. + (mi_step): Use mi_next_to. + +2002-09-09 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/default.exp: Fix expected string in `info float' test. + +2002-09-09 Ben Elliston <bje@redhat.com> + + * config/mips.exp: Update comments. + * config/mips-idt.exp: Likewise. + * config/nind.exp: Likewise. + * config/slite.exp: Likewise. + * config/sparclet.exp: Likewise. + * config/udi.exp: Likewise. + * config/vx.exp: Likewise. + * config/vxworks29k.exp: Likewise. + +2002-09-05 Jim Blandy <jimb@redhat.com> + + * gdb.threads/killed.exp: Fix test failure message. + +2002-09-04 Keith Seitz <keiths@redhat.com> + + * lib/mi-support.exp: Update copyright. + (mi_gdb_test): Increase the priority of the expected pattern + so that it matches gdb_test. + +2002-09-03 Keith Seitz <keiths@redhat.com> + + * lib/gdb.exp (gdb_compile_pthreads): Fix "build_bin" typo. + Use integer comparison instead of string comparison for testing + whether binary was built. + +2002-09-03 Jim Blandy <jimb@redhat.com> + + * gdb.threads/killed.exp, gdb.threads/killed.c: New test. + 2002-08-29 Jim Blandy <jimb@redhat.com> * gdb.threads/pthreads.exp: Move the portable thread compilation diff --git a/gdb/testsuite/config/mips-idt.exp b/gdb/testsuite/config/mips-idt.exp index 72664dff1b1..ecac87b2de0 100644 --- a/gdb/testsuite/config/mips-idt.exp +++ b/gdb/testsuite/config/mips-idt.exp @@ -14,9 +14,4 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - load_lib ../config/monitor.exp - - diff --git a/gdb/testsuite/config/mips.exp b/gdb/testsuite/config/mips.exp index 72664dff1b1..ecac87b2de0 100644 --- a/gdb/testsuite/config/mips.exp +++ b/gdb/testsuite/config/mips.exp @@ -14,9 +14,4 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - load_lib ../config/monitor.exp - - diff --git a/gdb/testsuite/config/nind.exp b/gdb/testsuite/config/nind.exp index d8aecdbc60a..0f84013b051 100644 --- a/gdb/testsuite/config/nind.exp +++ b/gdb/testsuite/config/nind.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - # This file was written by Rob Savoye. (rob@cygnus.com) load_lib gdb.exp diff --git a/gdb/testsuite/config/slite.exp b/gdb/testsuite/config/slite.exp index 3656665536c..b5f44288734 100644 --- a/gdb/testsuite/config/slite.exp +++ b/gdb/testsuite/config/slite.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - # This file was written by Ian Lance Taylor <ian@cygnus.com>. # GDB support routines for a board using the MIPS remote debugging diff --git a/gdb/testsuite/config/sparclet.exp b/gdb/testsuite/config/sparclet.exp index 83dc8c4e079..4e2e96b60d9 100644 --- a/gdb/testsuite/config/sparclet.exp +++ b/gdb/testsuite/config/sparclet.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - # This file was written by Michael Snyder <msnyder@cygnus.com>. # GDB support routines for a board using the sparclet remote debugging diff --git a/gdb/testsuite/config/udi.exp b/gdb/testsuite/config/udi.exp index 2360d6b8d3d..4a35232729c 100644 --- a/gdb/testsuite/config/udi.exp +++ b/gdb/testsuite/config/udi.exp @@ -16,9 +16,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - # This file was written by Rob Savoye. (rob@cygnus.com) load_lib gdb.exp diff --git a/gdb/testsuite/config/vx.exp b/gdb/testsuite/config/vx.exp index b02142c5052..4a457c0b684 100644 --- a/gdb/testsuite/config/vx.exp +++ b/gdb/testsuite/config/vx.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - # This file was written by Rob Savoye. (rob@cygnus.com) # diff --git a/gdb/testsuite/config/vxworks29k.exp b/gdb/testsuite/config/vxworks29k.exp index 795963b97bf..b815fe711f9 100644 --- a/gdb/testsuite/config/vxworks29k.exp +++ b/gdb/testsuite/config/vxworks29k.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - # This file was written by Brendan Kehoe (brendan@cygnus.com). # We need this file here because the targetname for the 29k board diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index bda2bec3975..e4483e3b471 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -115,7 +115,7 @@ gdb_expect { # send_gdb "info break\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${srcdir}/${subdir}/${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at (${srcdir}/${subdir}/)?${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ {pass "breakpoint info"} -re ".*$gdb_prompt$" { fail "breakpoint info" } timeout { fail "breakpoint info (timeout)" } diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp index 63fc27427fd..281ee235512 100644 --- a/gdb/testsuite/gdb.base/call-strs.exp +++ b/gdb/testsuite/gdb.base/call-strs.exp @@ -113,7 +113,7 @@ gdb_expect { } -#step +#next send_gdb "next\n" gdb_expect { -re ".*str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);.*$gdb_prompt $" {pass "next over strcpy"} diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c new file mode 100644 index 00000000000..ece684a1ef9 --- /dev/null +++ b/gdb/testsuite/gdb.base/charset.c @@ -0,0 +1,131 @@ +/* Test GDB's character set support + Jim Blandy <jimb@cygnus.com> --- December 2001 */ + +#include <stdio.h> + + +/* X_string is a null-terminated string in the X charset whose + elements are as follows. X should be the name the `set charset' + command uses for the character set, in lower-case, with any + non-identifier characters replaced with underscores. Where a + character set doesn't have the given character, the string should + contain the character 'x'. + + [0] --- the `alert' character, '\a' + [1] --- the `backspace' character, '\b' + [2] --- the `escape' character, '\e' + [3] --- the `form feed' character, '\f' + [4] --- the `line feed' character, '\n' + [5] --- the `carriage return' character, '\r' + [6] --- the `horizontal tab' character, '\t' + [7] --- the `vertical tab' character, '\v' + [8 .. 33] --- the uppercase letters A-Z + [34 .. 59] --- the lowercase letters a-z + [60 .. 69] --- the digits 0-9 + [70] --- the `cent' character + [71] --- a control character with no defined backslash escape + + Feel free to extend these as you like. */ + +#define NUM_CHARS (72) + +char ascii_string[NUM_CHARS]; +char iso_8859_1_string[NUM_CHARS]; +char ebcdic_us_string[NUM_CHARS]; +char ibm1047_string[NUM_CHARS]; + + +void +init_string (char string[], + char x, + char alert, char backspace, char escape, char form_feed, + char line_feed, char carriage_return, char horizontal_tab, + char vertical_tab, char cent, char misc_ctrl) +{ + memset (string, x, NUM_CHARS); + string[0] = alert; + string[1] = backspace; + string[2] = escape; + string[3] = form_feed; + string[4] = line_feed; + string[5] = carriage_return; + string[6] = horizontal_tab; + string[7] = vertical_tab; + string[70] = cent; + string[71] = misc_ctrl; +} + + +void +fill_run (char string[], int start, int len, int first) +{ + int i; + + for (i = 0; i < len; i++) + string[start + i] = first + i; +} + + +int main () +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + (void) malloc (1); + /* Initialize ascii_string. */ + init_string (ascii_string, + 120, + 7, 8, 27, 12, + 10, 13, 9, + 11, 120, 17); + fill_run (ascii_string, 8, 26, 65); + fill_run (ascii_string, 34, 26, 97); + fill_run (ascii_string, 60, 10, 48); + + /* Initialize iso_8859_1_string. */ + init_string (iso_8859_1_string, + 120, + 7, 8, 27, 12, + 10, 13, 9, + 11, 162, 17); + fill_run (iso_8859_1_string, 8, 26, 65); + fill_run (iso_8859_1_string, 34, 26, 97); + fill_run (iso_8859_1_string, 60, 10, 48); + + /* Initialize ebcdic_us_string. */ + init_string (ebcdic_us_string, + 167, + 47, 22, 39, 12, + 37, 13, 5, + 11, 74, 17); + /* In EBCDIC, the upper-case letters are broken into three separate runs. */ + fill_run (ebcdic_us_string, 8, 9, 193); + fill_run (ebcdic_us_string, 17, 9, 209); + fill_run (ebcdic_us_string, 26, 8, 226); + /* The lower-case letters are, too. */ + fill_run (ebcdic_us_string, 34, 9, 129); + fill_run (ebcdic_us_string, 43, 9, 145); + fill_run (ebcdic_us_string, 52, 8, 162); + /* The digits, at least, are contiguous. */ + fill_run (ebcdic_us_string, 60, 10, 240); + + /* Initialize ibm1047_string. */ + init_string (ibm1047_string, + 167, + 47, 22, 39, 12, + 37, 13, 5, + 11, 74, 17); + /* In EBCDIC, the upper-case letters are broken into three separate runs. */ + fill_run (ibm1047_string, 8, 9, 193); + fill_run (ibm1047_string, 17, 9, 209); + fill_run (ibm1047_string, 26, 8, 226); + /* The lower-case letters are, too. */ + fill_run (ibm1047_string, 34, 9, 129); + fill_run (ibm1047_string, 43, 9, 145); + fill_run (ibm1047_string, 52, 8, 162); + /* The digits, at least, are contiguous. */ + fill_run (ibm1047_string, 60, 10, 240); + + puts ("All set!"); /* all strings initialized */ +} diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp new file mode 100644 index 00000000000..8e765aa3a95 --- /dev/null +++ b/gdb/testsuite/gdb.base/charset.exp @@ -0,0 +1,486 @@ +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# Test GDB's character set support. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "charset" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# Start with a fresh gdb. +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# Parse the output from a `show charset' command. Return the host +# and target charset as a two-element list. +proc parse_show_charset_output {testname} { + global gdb_prompt + + gdb_expect { + -re "The current host and target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" { + set host_charset $expect_out(1,string) + set target_charset $expect_out(1,string) + pass $testname + } + -re "The current host character set is `(.*)'\\.\[\r\n\]+The current target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" { + set host_charset $expect_out(1,string) + set target_charset $expect_out(2,string) + pass $testname + } + -re ".*$gdb_prompt $" { + fail $testname + } + timeout { + fail "$testname (timeout)" + } + } + + return [list $host_charset $target_charset] +} + + +# Try the various `show charset' commands. These are all aliases of each +# other; `show target-charset' and `show host-charset' actually print +# both the host and target charsets. + +send_gdb "show charset\n" +set show_charset [parse_show_charset_output "show charset"] + +send_gdb "show target-charset\n" +set show_target_charset [parse_show_charset_output "show target-charset"] + +if {! [string compare $show_charset $show_target_charset]} { + pass "check `show target-charset' against `show charset'" +} else { + fail "check `show target-charset' against `show charset'" +} + +send_gdb "show host-charset\n" +set show_host_charset [parse_show_charset_output "show host-charset"] + +if {! [string compare $show_charset $show_host_charset]} { + pass "check `show host-charset' against `show charset'" +} else { + fail "check `show host-charset' against `show charset'" +} + + +# Get the list of supported charsets. +send_gdb "set charset\n" + +# True iff we've seen the "Valid character sets are:" message. +set seen_valid 0 + +# True iff we've seen the "can be used as a host character set" message. +set seen_can_host 0 + +# A Tcl array mapping the names of all the character sets we've seen +# to "1" if the character set can be used as a host character set, or +# "0" otherwise. We can use `array names charsets' just to get a list +# of all character sets. +array set charsets {} + +proc all_charset_names {} { + global charsets + return [array names charsets] +} + +proc charset_exists {charset} { + global charsets + return [info exists charsets($charset)] +} + +proc valid_host_charset {charset} { + global charsets + return $charsets($charset) +} + +gdb_expect { + -re "Valid character sets are:\[\r\n\]+" { + # There's no ^ at the beginning of the pattern above, so that + # expect can skip the echoed `set charset' command. + set seen_valid 1 + exp_continue + } + -re "^ (\[^ \t\n\]*) \\*\[\r\n\]+" { + set charsets($expect_out(1,string)) 1 + exp_continue + } + -re "^ (\[^ \t\n\]*)\[ \t\]*\[\r\n\]+" { + set charsets($expect_out(1,string)) 0 + exp_continue + } + -re "^\\* - can be used as a host character set\[\r\n\]+" { + set seen_can_host 1 + exp_continue + } + -re ".*${gdb_prompt} $" { + # We don't do an exp_continue here. + } + timeout { + fail "get valid character sets (timeout)" + } +} + + +# Check that we've seen all the right pieces of the output, and that +# we can at least use ASCII as a host character set. +if {$seen_valid && $seen_can_host && [charset_exists ascii]} { + # We can't do the below as part of the test above, since all the + # [] substitution takes place before any expression evaluation + # takes place; && doesn't really short circuit things the way + # you'd like. We'd get an "can't read $charsets(ascii)" error + # even when `info exists' had returned zero. + if {[valid_host_charset ascii]} { + pass "get valid character sets" + } else { + fail "get valid character sets" + } +} else { + fail "get valid character sets (no ascii charset)" +} + + +# Try using `set host-charset' on an invalid character set. +gdb_test "set host-charset my_grandma_bonnie" \ + "GDB doesn't know of any character set named `my_grandma_bonnie'." \ + "try `set host-charset' with invalid charset" + + +# Try using `set target-charset' on an invalid character set. +gdb_test "set target-charset my_grandma_bonnie" \ + "GDB doesn't know of any character set named `my_grandma_bonnie'." \ + "try `set target-charset' with invalid charset" + + +# Make sure that GDB supports every host/target charset combination. +foreach host_charset [all_charset_names] { + if {[valid_host_charset $host_charset]} { + + set testname "try `set host-charset $host_charset'" + send_gdb "set host-charset $host_charset\n" + gdb_expect { + -re "GDB doesn't know of any character set named.*\[\r\n]+${gdb_prompt} $" { + # How did it get into `charsets' then? + fail "$testname (didn't recognize name)" + } + -re "GDB can't use `.*' as its host character set\\.\[\r\n]+${gdb_prompt} $" { + # Well, then why does its `charsets' entry say it can? + fail $testname + } + -re "${gdb_prompt} $" { + pass $testname + } + timeout { + fail "$testname (timeout)" + } + } + + # Check that the command actually had its intended effect: + # $host_charset should now be the host character set. + send_gdb "show charset\n" + set result [parse_show_charset_output "parse `show charset' after `set host-charset $host_charset'"] + if {! [string compare [lindex $result 0] $host_charset]} { + pass "check effect of `set host-charset $host_charset'" + } else { + fail "check effect of `set host-charset $host_charset'" + } + + # Now try setting every possible target character set, + # given that host charset. + foreach target_charset [all_charset_names] { + set testname "try `set target-charset $target_charset'" + send_gdb "set target-charset $target_charset\n" + gdb_expect { + -re "GDB doesn't know of any character set named.*\[\r\n]+${gdb_prompt} $" { + fail "$testname (didn't recognize name)" + } + -re "GDB can't convert from the .* character set to .*\\.\[\r\n\]+${gdb_prompt} $" { + # This is a serious problem. GDB should be able to convert + # between any arbitrary pair of character sets. + fail "$testname (can't convert)" + } + -re "${gdb_prompt} $" { + pass $testname + } + timeout { + fail "$testname (timeout)" + } + } + + # Check that the command actually had its intended effect: + # $target_charset should now be the target charset. + send_gdb "show charset\n" + set result [parse_show_charset_output "parse `show charset' after `set target-charset $target_charset'"] + if {! [string compare $result [list $host_charset $target_charset]]} { + pass "check effect of `set target-charset $target_charset'" + } else { + fail "check effect of `set target-charset $target_charset'" + } + + # Test handling of characters in the host charset which + # can't be translated into the target charset. \xA2 is + # `cent' in ISO-8859-1, which has no equivalent in ASCII. + # + # On some systems, the pseudo-tty through which we + # communicate with GDB insists on stripping the high bit + # from input characters, meaning that `cent' turns into + # `"'. Since ISO-8859-1 and ASCII are identical in the + # lower 128 characters, it's tough to see how we can test + # this behavior on such systems, so we just xfail it. + # + # Note: the \x16 (Control-V) is an escape to allow \xA2 to + # get past readline. + if {! [string compare $host_charset iso-8859-1] && ! [string compare $target_charset ascii]} { + + set testname "untranslatable character in character literal" + send_gdb "print '\x16\xA2'\n" + gdb_expect { + -re "There is no character corresponding to .* in the target character set .*\\.\[\r\n\]+$gdb_prompt $" { + pass $testname + } + -re " = 34 '\"'\[\r\n\]+$gdb_prompt $" { + xfail "$testname (DejaGNU's pseudo-tty strips eighth bit)" + } + -re "$gdb_prompt $" { + fail $testname + } + timeout { + fail "$testname (timeout)" + } + } + + set testname "untranslatable character in string literal" + # If the PTTY zeros bit seven, then this turns into + # print """ + # which gets us a syntax error. We don't care. + send_gdb "print \"\x16\xA2\"\n" + gdb_expect { + -re "There is no character corresponding to .* in the target character set .*\\.\[\r\n\]+$gdb_prompt $" { + pass $testname + } + -re "Unterminated string in expression.\[\r\n\]+$gdb_prompt $" { + xfail "$testname (DejaGNU's pseudo-tty strips eighth bit)" + } + -re "$gdb_prompt $" { + fail $testname + } + timeout { + fail "$testname (timeout)" + } + } + + set testname "untranslatable characters in backslash escape" + send_gdb "print '\\\x16\xA2'\n" + gdb_expect { + -re "The escape sequence .* is equivalent to plain .*, which has no equivalent\[\r\n\]+in the .* character set\\.\[\r\n\]+$gdb_prompt $" { + pass $testname + } + -re " = 34 '\"'\[\r\n\]+$gdb_prompt $" { + xfail "$testname (DejaGNU's pseudo-tty strips eighth bit)" + } + -re "$gdb_prompt $" { + fail $testname + } + timeout { + fail "$testname (timeout)" + } + } + } + } + } +} + + +# Set the host character set to plain ASCII, and try actually printing +# some strings in various target character sets. We need to run the +# test program to the point at which the strings have been +# initialized. +gdb_test "break [gdb_get_line_number "all strings initialized"]" \ + ".*Breakpoint.* at .*" \ + "set breakpoint after all strings have been initialized" +gdb_run_cmd +gdb_expect { + -re "Breakpoint.*all strings initialized.*$gdb_prompt $" { + pass "run until all strings have been initialized" + } + -re "$gdb_prompt $" { + fail "run until all strings have been initialized" + } + timeout { + fail "run until all strings have been initialized (timeout)" + } +} + + +gdb_test "set host-charset ascii" "" +foreach target_charset [all_charset_names] { + send_gdb "set target-charset $target_charset\n" + gdb_expect { + -re "$gdb_prompt $" { + pass "set target-charset $target_charset" + } + timeout { + fail "set target-charset $target_charset (timeout)" + } + } + + # Try printing the null character. There seems to be a bug in + # gdb_test that requires us to use gdb_expect here. + send_gdb "print '\\0'\n" + gdb_expect { + -re "\\\$${decimal} = 0 '\\\\0'\[\r\n\]+$gdb_prompt $" { + pass "print the null character in ${target_charset}" + } + -re "$gdb_prompt $" { + fail "print the null character in ${target_charset}" + } + timeout { + fail "print the null character in ${target_charset} (timeout)" + } + } + + # Compute the name of the variable in the test program that holds + # a string in $target_charset. The variable's name is the + # character set's name, in lower-case, with all non-identifier + # characters replaced with '_', with "_string" stuck on the end. + set var_name [string tolower "${target_charset}_string"] + regsub -all -- "\[^a-z0-9_\]" $var_name "_" var_name + + # Compute a regexp matching the results we expect. This is static, + # but it's easier than writing it out. + regsub -all "." "abefnrtv" "(\\\\&|x)" escapes + set uppercase "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + set lowercase "abcdefghijklmnopqrstuvwxyz" + set digits "0123456789" + set octal_escape "\\\\\[0-9\]\[0-9\]\[0-9\]" + + send_gdb "print $var_name\n" + # ${escapes}${uppercase}${lowercase}${digits}${octal}${octal} + gdb_expect { + -re ".* = \"(\\\\a|x)(\\\\b|x)(\\\\e|x)(\\\\f|x)(\\\\n|x)(\\\\r|x)(\\\\t|x)(\\\\v|x)${uppercase}${lowercase}${digits}(\\\\\[0-9\]\[0-9\]\[0-9\]|x)(\\\\\[0-9\]\[0-9\]\[0-9\]|x).*\"\[\r\n\]+$gdb_prompt $" { + pass "print string in $target_charset" + } + -re "$gdb_prompt $" { + fail "print string in $target_charset" + } + timeout { + fail "print string in $target_charset (timeout)" + } + } + + # Try entering a character literal, and see if it comes back unchanged. + gdb_test "print 'A'" \ + " = \[0-9-\]+ 'A'" \ + "parse character literal in ${target_charset}" + + # Check that the character literal was encoded correctly. + gdb_test "print 'A' == $var_name\[8\]" \ + " = 1" \ + "check value of parsed character literal in ${target_charset}" + + # Try entering a string literal, and see if it comes back unchanged. + gdb_test "print \"abcdefABCDEF012345\"" \ + " = \"abcdefABCDEF012345\"" \ + "parse string literal in ${target_charset}" + + # Check that the string literal was encoded correctly. + gdb_test "print \"q\"\[0\] == $var_name\[50\]" \ + " = 1" \ + "check value of parsed string literal in ${target_charset}" + + # Test handling of characters in the target charset which + # can't be translated into the host charset. + if {! [string compare $target_charset iso-8859-1]} { + gdb_test "print iso_8859_1_string\[70\]" \ + " = \[0-9-\]+ '\\\\242'" \ + "print character with no equivalent in host character set" + gdb_test "print iso_8859_1_string + 70" \ + " = ${hex} \"\\\\242.*\"" \ + "print string with no equivalent in host character set" + } + + # Make sure that we don't apply the ISO-8859-1 `print_literally' + # function to ASCII. + if {! [string compare $target_charset ascii]} { + gdb_test "print iso_8859_1_string\[70\]" \ + " = \[0-9-\]+ '\\\\242'" \ + "print ASCII unprintable character" + gdb_test "print iso_8859_1_string + 70" \ + " = ${hex} \"\\\\242.*\"" \ + "print ASCII unprintable string" + } + + # Try printing characters with backslash escape equivalents. + set escapees {a b e f n r t v} + for {set i 0} {$i < [llength $escapees]} {incr i} { + set escape [lindex $escapees $i] + send_gdb "print $var_name\[$i\]\n" + set have_escape 1 + gdb_expect { + -re "= \[0-9-\]+ '\\\\${escape}'\[\r\n\]+$gdb_prompt $" { + pass "try printing '\\${escape}' in ${target_charset}" + } + -re "= \[0-9-\]+ 'x'\[\r\n\]+$gdb_prompt $" { + xfail "try printing '\\${escape}' in ${target_charset} (no such escape)" + set have_escape 0 + } + -re "$gdb_prompt $" { + fail "try printing '\\${escape}' in ${target_charset}" + } + timeout { + fail "try printing '\\${escape}' in ${target_charset} (timeout)" + } + } + + if {$have_escape} { + + # Try parsing a backslash escape in a character literal. + gdb_test "print '\\${escape}' == $var_name\[$i\]" \ + " = 1" \ + "check value of '\\${escape}' in ${target_charset}" + + # Try parsing a backslash escape in a string literal. + gdb_test "print \"\\${escape}\"\[0\] == $var_name\[$i\]" \ + " = 1" \ + "check value of \"\\${escape}\" in ${target_charset}" + } + } + + # Try printing a character escape that doesn't exist. We should + # get the unescaped character, in the target character set. + gdb_test "print '\\q'" " = \[0-9-\]+ 'q'" \ + "print escape that doesn't exist in $target_charset" + gdb_test "print '\\q' == $var_name\[50\]" " = 1" \ + "check value of escape that doesn't exist in $target_charset" +} + +gdb_exit diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 3db28b187b6..d35353d6469 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -490,7 +490,7 @@ proc bp_deleted_in_command_test {} { gdb_run_cmd gdb_expect { - -re ".*factorial command-list executed.*1.*Program exited normally.*$gdb_prompt $" { + -re ".*factorial command-list executed.*1.*$gdb_prompt $" { pass "run factorial until breakpoint" } -re ".*$gdb_prompt $" { @@ -547,7 +547,7 @@ proc temporary_breakpoint_commands {} { gdb_run_cmd gdb_expect { - -re ".*factorial tbreak commands executed.*1.*Program exited normally.*" { + -re ".*factorial tbreak commands executed.*1.*$gdb_prompt $" { pass "run factorial until temporary breakpoint" } timeout { fail "(timeout) run factorial until temporary breakpoint" } diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index ea8ba503c6b..078e41688ae 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -327,7 +327,7 @@ if { [istarget "arm*-*-*"] || \ } elseif [istarget "i\[3456\]86-*-*"] then { gdb_test "info float" "R7:.*Status Word:.*Opcode:.*" "info float" } else { - gdb_test "info float" "No floating point info available for this processor." "info float" + gdb_test "info float" "No floating.point info available for this processor." "info float" } #test info functions gdb_test "info functions" "All defined functions:" "info functions" diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 40b0bda3fd4..93f6707097c 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -38,30 +38,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -proc rerun_to_main {} { - global gdb_prompt - - if [target_info exists use_gdb_stub] { - gdb_run_cmd - gdb_expect { - -re ".*Breakpoint .*main .*$gdb_prompt $"\ - {pass "rerun to main" ; return 0} - -re "$gdb_prompt $"\ - {fail "rerun to main" ; return 0} - timeout {fail "(timeout) rerun to main" ; return 0} - } - } else { - send_gdb "run\n" - gdb_expect { - -re "Starting program.*$gdb_prompt $"\ - {pass "rerun to main" ; return 0} - -re "$gdb_prompt $"\ - {fail "rerun to main" ; return 0} - timeout {fail "(timeout) rerun to main" ; return 0} - } - } -} - gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 69f2b26917c..f7e954f4aad 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -195,7 +195,7 @@ gdb_expect { -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { pass "step out of main" } - -re ".*in __wrap_main ().*$gdb_prompt $" { + -re ".*in __wrap__?main ().*$gdb_prompt $" { pass "step out of main (status wrapper)" } -re ".*$gdb_prompt $" { fail "step out of main (at end 2)" } @@ -233,6 +233,9 @@ gdb_expect { # every BSP's exit function behaves differently, so there's no single # way to tell whether we've exited gracefully or not. So don't run # these tests when use_gdb_stub is set, or when we're running under Cygmon. +set program_exited_normally 0 +set program_not_exited 0 +set program_in_exit 0 if {! [target_info exists use_gdb_stub] && (! [target_info exists use_cygmon] || ! [target_info use_cygmon])} { global program_exited; @@ -244,33 +247,57 @@ if {! [target_info exists use_gdb_stub] # then we won't get the "Single-stepping until function # exit" message. pass "step to end of run" + set program_exited_normally 1 } - -re "Single.*EXIT code 0.*Program exited normally.*$gdb_prompt $" { + -re "Single.*EXIT code 0\r\n.*Program exited normally.*$gdb_prompt $" { + pass "step to end of run (status wrapper)" + set program_exited_normally 1 + } + -re "Single.*EXIT code 0\r\n.*$gdb_prompt $" { pass "step to end of run (status wrapper)" } -re ".*Single.*Program exited.*$gdb_prompt $" { pass "step to end of run" + set program_exited_normally 1 } -re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" { pass "step to end of run" - gdb_test "c" ".*" "continue after exit" + set program_in_exit 1 } -re ".*Single.*_int_reset.*$gdb_prompt $" { pass "step to end of run" - setup_xfail "xstormy16-*-*" + if {![istarget "xstormy16-*-*"]} { + set program_exited_normally 1 + } } -re ".*$gdb_prompt $" { fail "step to end of run" + set program_not_exited 1 } timeout { fail "(timeout) step to end of run" + set program_not_exited 1 } } } + if {$program_in_exit} { + if {[gdb_test "c" ".*" "continue after exit"] == 0} { + set program_exited_normally 1 + } + } else { + unsupported "continue after exit" + } + set timeout $old_timeout - gdb_test "n" ".*The program is not being run.*" "don't step after run" + if {$program_exited_normally} { + gdb_test "n" ".*The program is not being run.*" "don't step after run" + } elseif {$program_not_exited} { + unresolved "don't step after run" + } else { + unsupported "don't step after run" + } set exec_output [remote_exec host "ls core"] diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index ac2e9f87526..51f4c9db208 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -513,6 +513,14 @@ gdb_expect { timeout { fail "(timeout) help maint internal-error" } } +send_gdb "help maint internal-warning\n" +gdb_expect { + -re "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*$gdb_prompt $"\ + { pass "help maint internal-warning" } + -re ".*$gdb_prompt $" { fail "help maint internal-warning" } + timeout { fail "(timeout) help maint internal-warning" } + } + send_gdb "help maint print statistics\n" gdb_expect { -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\ diff --git a/gdb/testsuite/gdb.base/pc-fp.c b/gdb/testsuite/gdb.base/pc-fp.c new file mode 100644 index 00000000000..8c89a0f0b81 --- /dev/null +++ b/gdb/testsuite/gdb.base/pc-fp.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +void +foo (int i) +{ + i++; + printf ("In foo %d\n", i); +} + +int +main () +{ + foo (1); +} diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp new file mode 100644 index 00000000000..f94e3314388 --- /dev/null +++ b/gdb/testsuite/gdb.base/pc-fp.exp @@ -0,0 +1,94 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# The doco makes reference to built-in registers -- $pc and $fp. If +# the ISA contains registers by that name then they should be +# displayed. If the ISA contains registers identified as being +# equivalent, but have different names, then GDB will provide these as +# aliases. If the ISA doesn't provide any equivalent registers, then +# GDB will provide registers that map onto the frame's PC and FP. + +if $tracelevel then { + strace $tracelevel +} + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "pc-fp" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile}] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +proc get_valueofx { fmt exp default } { + global gdb_prompt + send_gdb "print${fmt} ${exp}\n" + gdb_expect { + -re "\\$\[0-9\]* = (0x\[0-9a-zA-Z\]+).*$gdb_prompt $" { + set val $expect_out(1,string) + pass "get value of ${exp} ($val)" + } + timeout { + set size ${default} + fail "get value of ${exp} (timeout)" + } + } + return ${val} +} + +# Get the value of PC and FP + +set valueof_pc [get_valueofx "/x" "\$pc" "0"] +set valueof_fp [get_valueofx "/x" "\$fp" "0"] + +# Check that the sequence $REGNAME -> REGNUM -> $REGNAME works. Use +# display since that encodes and then decodes the expression parameter +# (and hence uses the mechanisms we're trying to test). + +gdb_test "display/i \$pc" "1: x/i +\\\$pc +${valueof_pc}.*" +gdb_test "display/w \$fp" "2: x/xw +\\\$fp +${valueof_fp}.*" + +# FIXME: cagney/2002-09-04: Should also check that ``info registers +# $pc'' et.al.'' come back with the same value as the above displays +# and a print --- assuming that is that people agree to such behavour. +# Need to re-write default_print_registers_info() for it to work (and +# such a rewrite is on the reggroups branch). + +# gdb_test "info registers \$pc" "${valueof_pc}" +# gdb_test "info registers \$fp" "${valueof_fp}" diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 7062fc55dc7..b0232dd62a3 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -620,7 +620,7 @@ proc test_print_string_constants {} { set timeout 60; gdb_test "p \"a string\"" " = \"a string\"" - gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\0 null\"" + gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\000 null\"" gdb_test "p \"abcd\"\[2\]" " = 99 'c'" gdb_test "p sizeof (\"abcdef\")" " = 7" gdb_test "ptype \"foo\"" " = char \\\[4\\\]" diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index dd88274d1be..8fe8b22da39 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -239,18 +239,27 @@ gdb_expect { #step -return send_gdb "step\n" + # A step at this point will either take us entirely out of + # the function or into the function's epilogue. The exact + # behavior will differ depending upon upon whether or not + # the compiler emits line number information for the epilogue. gdb_expect { - -re ".*\\\}.*$gdb_prompt $" { pass "step inside shr2 (shlib func)"} - -re ".*$gdb_prompt $" { fail "step inside shr2 (shlib func)" } - timeout { fail "step inside shr2 (shlib func) (timeout)" } - } - - send_gdb "step\n" - gdb_expect { - -re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" { pass "step out of shr2 to main"} - -re ".*$gdb_prompt $" { fail "step out of shr2 to main" } + -re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" { + pass "step out of shr2 to main" + } + -re ".*\\\}.*$gdb_prompt $" { + pass "step out of shr2 to main (stopped in shr2 epilogue)" + send_gdb "step\n" + gdb_expect { + -re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" { pass "step out of shr2 epilogue to main"} + -re ".*$gdb_prompt $" { fail "step out of shr2 epilogue to main" } + timeout { fail "step out of shr2 epilogue to main (timeout)" } + } + } + -re ".*$gdb_prompt $" { fail "step out of shr2" } timeout { fail "step out of shr2 to main (timeout)" } } + #print mainshr1(1) send_gdb "print mainshr1(1)\n" diff --git a/gdb/testsuite/gdb.c++/m-static.cc b/gdb/testsuite/gdb.c++/m-static.cc index 24338014365..ae1484851b6 100644 --- a/gdb/testsuite/gdb.c++/m-static.cc +++ b/gdb/testsuite/gdb.c++/m-static.cc @@ -53,6 +53,10 @@ namespace __gnu_test template<typename T> gnu_obj_2<int> gnu_obj_3<T>::data(etruscan); + + // 2002-08-16 + // Test four. +#include "m-static.h" } // instantiate templates explicitly so their static members will exist @@ -67,6 +71,7 @@ int main() gnu_obj_1 test1(egyptian, 4589); gnu_obj_2<long> test2(roman); gnu_obj_3<long> test3(greek); + gnu_obj_4 test4; - return 0; + return 0; // breakpoint: constructs-done } diff --git a/gdb/testsuite/gdb.c++/m-static.exp b/gdb/testsuite/gdb.c++/m-static.exp index c05983b6538..d291135fb06 100644 --- a/gdb/testsuite/gdb.c++/m-static.exp +++ b/gdb/testsuite/gdb.c++/m-static.exp @@ -16,6 +16,7 @@ # Tests for member static data # 2002-05-13 Benjamin Kosnik <bkoz@redhat.com> +# 2002-08-22 David Carlton <carlton@math.stanford.edu> # This file is part of the gdb testsuite @@ -33,9 +34,10 @@ set bug_id 0 set testfile "m-static" set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" "${binfile}" executable {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -54,9 +56,13 @@ if ![runto_main] then { continue } +# First, run to after we've constructed all the objects: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + + # One. -gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68" # simple object, static const bool gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool" @@ -71,8 +77,6 @@ gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long" gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum" # Two. -gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69" # derived template object, base static const bool gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool" @@ -90,8 +94,6 @@ gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum" # Three. -gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71" # template object, static derived template data member's base static const bool gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool" @@ -108,5 +110,19 @@ gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, st # template object, static derived template data member's static enum gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum" +# 2002-08-16 +# Four. + +# static const int initialized in another file. +gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere" + +# static const int that nobody initializes. From PR gdb/635. +gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere" + +# Perhaps at some point test4 should also include a test for a static +# const int that was initialized in the header file. But I'm not sure +# that GDB's current behavior in such situations is either consistent +# across platforms or optimal, so I'm not including one now. + gdb_exit return 0 diff --git a/gdb/testsuite/gdb.c++/m-static.h b/gdb/testsuite/gdb.c++/m-static.h new file mode 100644 index 00000000000..137d3b75c50 --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-static.h @@ -0,0 +1,11 @@ +// 2002-08-16 + +class gnu_obj_4 +{ + public: + static const int elsewhere; + static const int nowhere; + // At some point, perhaps: + // static const int everywhere = 317; +}; + diff --git a/gdb/testsuite/gdb.c++/m-static1.cc b/gdb/testsuite/gdb.c++/m-static1.cc new file mode 100644 index 00000000000..f88c9ce2522 --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-static1.cc @@ -0,0 +1,9 @@ +// 2002-08-16 + +namespace __gnu_test { +#include "m-static.h" +} + +using namespace __gnu_test; + +const int gnu_obj_4::elsewhere = 221; diff --git a/gdb/testsuite/gdb.c++/pr-574.cc b/gdb/testsuite/gdb.c++/pr-574.cc new file mode 100644 index 00000000000..eb06b61b7ae --- /dev/null +++ b/gdb/testsuite/gdb.c++/pr-574.cc @@ -0,0 +1,22 @@ +/* + An attempt to replicate PR gdb/574 with a shorter program. + + Printing out *theB failed if the program was compiled with GCC 2.95. +*/ + +class A { +public: + virtual void foo() {}; // Stick in a virtual function. + int a; // Stick in a data member. +}; + +class B : public A { + static int b; // Stick in a static data member. +}; + +int main() +{ + B *theB = new B; + + return 0; // breakpoint: constructs-done +} diff --git a/gdb/testsuite/gdb.c++/pr-574.exp b/gdb/testsuite/gdb.c++/pr-574.exp new file mode 100644 index 00000000000..5beacd10fee --- /dev/null +++ b/gdb/testsuite/gdb.c++/pr-574.exp @@ -0,0 +1,72 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for the bug mentioned in PR gdb/574. It's a bit +# idiosyncratic, so I gave it its own file. + +# 2002-08-16 David Carlton <carlton@math.stanford.edu> + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "pr-574" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed the object: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + +# This failed, as long as the code was compiled with GCC v. 2. + +# Different compilers order the data for <A> differently, so I'm not +# matching the result exactly. + +gdb_test "print *theB" "\\$\[0-9\]* = {<A> = {\[^}\]*}, static b = <optimized out>}" "PR gdb/574" + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/printmethod.cc b/gdb/testsuite/gdb.c++/printmethod.cc new file mode 100644 index 00000000000..d32e1b1d1c4 --- /dev/null +++ b/gdb/testsuite/gdb.c++/printmethod.cc @@ -0,0 +1,14 @@ +/* Create some objects, and try to print out their methods. */ + +class A { +public: + virtual void virt() {}; + void nonvirt() {}; +}; + +int main() +{ + A *theA = new A; + + return 0; // breakpoint: constructs-done +} diff --git a/gdb/testsuite/gdb.c++/printmethod.exp b/gdb/testsuite/gdb.c++/printmethod.exp new file mode 100644 index 00000000000..9b96cbfc468 --- /dev/null +++ b/gdb/testsuite/gdb.c++/printmethod.exp @@ -0,0 +1,69 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This tries to print out methods of classes. + +# 2002-08-16 David Carlton <carlton@math.stanford.edu> + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "printmethod" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed the object: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + +# The first of these is for PR gdb/653. + +gdb_test "print theA->virt" "\\$\[0-9\]* = &A::virt\\(\\)" "print virtual method." +gdb_test "print theA->nonvirt" "Cannot take address of a method" "print nonvirtual method." + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp new file mode 100644 index 00000000000..3d3426f2474 --- /dev/null +++ b/gdb/testsuite/gdb.gdb/complaints.exp @@ -0,0 +1,318 @@ +# Copyright 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Andrew Cagney (cagney at redhat dot com), +# derived from xfullpath.exp (written by Joel Brobecker), derived from +# selftest.exp (written by Rob Savoye). + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +# are we on a target board +if [is_remote target] { + return +} + +proc setup_test { executable } { + global gdb_prompt + global timeout + + # load yourself into the debugger + # This can take a relatively long time, particularly for testing where + # the executable is being accessed over a network, or where gdb does not + # support partial symbols for a particular target and has to load the + # entire symbol table. Set the timeout to 10 minutes, which should be + # adequate for most environments (it *has* timed out with 5 min on a + # SPARCstation SLC under moderate load, so this isn't unreasonable). + # After gdb is started, set the timeout to 30 seconds for the duration + # of this test, and then back to the original value. + + set oldtimeout $timeout + set timeout 600 + verbose "Timeout is now $timeout seconds" 2 + if {[gdb_load $executable] <0} then { + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + + # Set a breakpoint at main + gdb_test "break captured_command_loop" \ + "Breakpoint.*at.* file.*, line.*" \ + "breakpoint in captured_command_loop" + + # run yourself + # It may take a very long time for the inferior gdb to start (lynx), + # so we bump it back up for the duration of this command. + set timeout 600 + + set description "run until breakpoint at captured_command_loop" + send_gdb "run -nw\n" + gdb_expect { + -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.* at .*main.c:.*$gdb_prompt $" { + pass "$description" + } + -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.*$gdb_prompt $" { + xfail "$description (line numbers scrambled?)" + } + -re "vfork: No more processes.*$gdb_prompt $" { + fail "$description (out of virtual memory)" + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + -re ".*$gdb_prompt $" { + fail "$description" + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + timeout { + fail "$description (timeout)" + } + } + + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + + return 0 +} + +proc test_initial_complaints { } { + + global gdb_prompt + + # Unsupress complaints + gdb_test "set stop_whining = 2" + + # Prime the system + gdb_test "call complaint (&symfile_complaints, \"Register a complaint\")" \ + "During symbol reading, Register a complaint." + + # Check that the complaint was inserted and where + gdb_test "print symfile_complaints->root->fmt" \ + ".\[0-9\]+ =.*\"Register a complaint\"" + + # Re-issue the first message #1 + gdb_test "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \ + "During symbol reading, Register a complaint." + + # Check that there is only one thing in the list + gdb_test "print symfile_complaints->root->next == &complaint_sentinel" \ + ".\[0-9\]+ = 1" "list has one entry" + + # Add a second complaint, expect it + gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \ + "During symbol reading, Testing. Testing. Testing.." + + return 0 +} + +proc test_serial_complaints { } { + + global gdb_prompt + + gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start" + + # Prime the system + send_gdb "call complaint (&symfile_complaints, \"serial line 1\")\n" + gdb_expect { + -re "During symbol reading...serial line 1...$gdb_prompt " { + pass "serial line 1" + } + "$gdb_prompt" { + fail "serial line 1" + } + timeout { + fail "serial line 1 (timeout)" + } + } + + # Add a second complaint, expect it + send_gdb "call complaint (&symfile_complaints, \"serial line 2\")\n" + gdb_expect { + -re "serial line 2...$gdb_prompt " { + pass "serial line 2" + } + "$gdb_prompt" { + fail "serial line 2" + } + timeout { + fail "serial line 2 (timeout)" + } + } + + send_gdb "call clear_complaints (&symfile_complaints, 1, 0)\n" + gdb_expect { + -re "\r\n\r\n$gdb_prompt " { + pass "serial end" + } + "$gdb_prompt" { + fail "serial end" + } + timeout { + fail "serial end (timeout)" + } + } + + return 0 +} + +# For short complaints, all are the same + +proc test_short_complaints { } { + + global gdb_prompt + + gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start" + + # Prime the system + send_gdb "call complaint (&symfile_complaints, \"short line 1\")\n" + gdb_expect { + -re "short line 1...$gdb_prompt " { + pass "short line 1" + } + "$gdb_prompt" { + fail "short line 1" + } + timeout { + fail "short line 1 (timeout)" + } + } + + # Add a second complaint, expect it + send_gdb "call complaint (&symfile_complaints, \"short line 2\")\n" + gdb_expect { + -re "short line 2...$gdb_prompt " { + pass "short line 2" + } + "$gdb_prompt" { + fail "short line 2" + } + timeout { + fail "short line 2 (timeout)" + } + } + + send_gdb "call clear_complaints (&symfile_complaints, 1, 0)\n" + gdb_expect { + -re "\r\n\r\n$gdb_prompt " { + pass "short end" + } + "$gdb_prompt" { + fail "short end" + } + timeout { + fail "short end (timeout)" + } + } + + return 0 +} + +# Check that nothing comes out when there haven't been any real +# complaints. Note that each test is really checking the previous +# command. + +proc test_empty_complaint { cmd msg } { + global gdb_prompt + send_gdb $cmd + gdb_expect { + -re "\r\n\r\n$gdb_prompt " { + fail $msg + } + "\r\n$gdb_prompt" { + pass $msg + } + timeout { + fail "$msg (timeout)" + } + } + +} + +proc test_empty_complaints { } { + + test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)\n" \ + "empty non-verbose non-noisy clear" + test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)\n" \ + "empty verbose non-noisy clear" + test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)\n" \ + "empty verbose noisy clear" + test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)\n" \ + "empty non-verbose noisy clear" + + return 0 +} + +# Find a pathname to a file that we would execute if the shell was asked +# to run $arg using the current PATH. + +proc find_gdb { arg } { + + # If the arg directly specifies an existing executable file, then + # simply use it. + + if [file executable $arg] then { + return $arg + } + + set result [which $arg] + if [string match "/" [ string range $result 0 0 ]] then { + return $result + } + + # If everything fails, just return the unqualified pathname as default + # and hope for best. + + return $arg +} + +# Run the test with self. +# Copy the file executable file in case this OS doesn't like to edit its own +# text space. + +set GDB_FULLPATH [find_gdb $GDB] + +# Remove any old copy lying around. +remote_file host delete x$tool + +gdb_start + +set file [remote_download host $GDB_FULLPATH x$tool] + +set setup_result [setup_test $file ] +if {$setup_result <0} then { + return -1 +} + +test_initial_complaints +test_serial_complaints +test_short_complaints +test_empty_complaints + +gdb_exit; +catch "remote_file host delete $file"; diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog index 41ce9d898ba..49df9580035 100644 --- a/gdb/testsuite/gdb.mi/ChangeLog +++ b/gdb/testsuite/gdb.mi/ChangeLog @@ -60,6 +60,64 @@ mi-var-display.exp mi-watch.exp: Update to conform to MI2 notify-async-output (events). +2002-09-25 Keith Seitz <keiths@redhat.com> + + * mi-pthreads.exp (get_mi_thread_list): Check if expect_out + exists before using it. + (check_mi_and_console_threads): Likewise. + * gdb669.exp (get_mi_thread_list): Likewise. + (check_mi_and_console_threads): Likewise. + +2002-09-24 Keith Seitz <keiths@redhat.com> + + * configure.in: Add config header. + Check for pthread.h. + * configure: Regenerate. + * config.in: New file. + * pthreads.c: New file. + * mi-pthreads.exp: New file to test thread functionality. + * gdb669.exp: New file. + +2002-09-17 Keith Seitz <keiths@redhat.com> + + * mi-var-cmd.exp: Add tests to check when varobj pinned to a + selected frame changes type. + +2002-09-17 Keith Seitz <keiths@redhat.com> + + * mi-console.exp: Update copyright. + * mi-var-block.exp: Likewise. + * mi-var-cmd.exp: Likewise. + * mi-var-display.exp: Likewise. + * mi0-console.exp: Likewise. + * mi0-var-child.exp: Likewise. + * mi0-var-cmd.exp: Likewise. + * mi0-var-display.exp: Likewise. + +2002-09-16 Keith Seitz <keiths@redhat.com> + + * gdb701.exp: New file for testing varobj target type bug. + * gdb701.c: New file. + +2002-09-13 Keith Seitz <keiths@redhat.com> + + * mi-var-child.exp: Use mi_step_to and mi_execute_to instead + of a bunch of repeated send_gdb/gdb_expect statements. + Fix line numbers. + +2002-09-10 Keith Seitz <keiths@redhat.com> + + * mi-simplerun.exp (test_controlled_execution): Follow renaming of + mi_run_to to mi_execute_to. + * mi-var-cmd.exp: Likewise. + * mi0-simplerun.exp: Likewise. + * mi0-var-cmd.exp: Likewise. + +2002-09-03 Keith Seitz <keiths@redhat.com> + + * gdb680.exp: New file to test to check for uiout list/tuple + nesting bug. + 2002-03-04 Michael Chastain <mec@shout.net> * mi-var-cmd.exp: In test "create local variable func", diff --git a/gdb/testsuite/gdb.mi/gdb669.exp b/gdb/testsuite/gdb.mi/gdb669.exp new file mode 100644 index 00000000000..4f294b964ea --- /dev/null +++ b/gdb/testsuite/gdb.mi/gdb669.exp @@ -0,0 +1,200 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file checks for the bug gdb/669, where the console +# command "info threads" and the MI command "-thread-list-ids" +# return different threads in the system. + +# This only works with native configurations +if {![isnative]} { + return +} + +load_lib mi-support.exp +set MIFLAGS "-i=mi" + +gdb_exit +if {[mi_gdb_start]} { + continue +} + +# The procs below are all stolen from mi-pthreads.exp. Any updates +# should also be made to the procs there. + +proc get_mi_thread_list {name} { + global expect_out + + # MI will return a list of thread ids: + # + # -thread-list-ids + # ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N" + # (gdb) + mi_gdb_test "-thread-list-ids" \ + {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \ + "-thread_list_ids ($name)" + + set output {} + if {[info exists expect_out(buffer)]} { + set output $expect_out(buffer) + } + set thread_list {} + if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} { + fail "finding threads in MI output ($name)" + } else { + pass "finding threads in MI output ($name)" + + # Make list of console threads + set start [expr {[string first \{ $threads] + 1}] + set end [expr {[string first \} $threads] - 1}] + set threads [string range $threads $start $end] + foreach thread [split $threads ,] { + if {[scan $thread {thread-id="%d"} num]} { + lappend thread_list $num + } + } + } + + return $thread_list +} + +# Check that MI and the console know of the same threads. +# Appends NAME to all test names. +proc check_mi_and_console_threads {name} { + global expect_out + + mi_gdb_test "-thread-list-ids" \ + {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \ + "-thread-list-ids ($name)" + set mi_output {} + if {[info exists expect_out(buffer)]} { + set mi_output $expect_out(buffer) + } + + # GDB will return a list of thread ids and some more info: + # + # (gdb) + # -interpreter-exec console "info threads" + # ~" 4 Thread 2051 (LWP 7734) 0x401166b1 in __libc_nanosleep () at __libc_nanosleep:-1" + # ~" 3 Thread 1026 (LWP 7733) () at __libc_nanosleep:-1" + # ~" 2 Thread 2049 (LWP 7732) 0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63" + # ~"* 1 Thread 1024 (LWP 7731) main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160" + # FIXME: kseitz/2002-09-05: Don't use the hack-cli method. + mi_gdb_test "info threads" \ + {.*(~".*"[\r\n]*)+.*} \ + "info threads ($name)" + set console_output {} + if {[info exists expect_out(buffer)]} { + set console_output $expect_out(buffer) + } + + # Make a list of all known threads to console (gdb's thread IDs) + set console_thread_list {} + foreach line [split $console_output \n] { + if {[string index $line 0] == "~"} { + # This is a line from the console; trim off "~", " ", "*", and "\"" + set line [string trim $line ~\ \"\*] + if {[scan $line "%d" id] == 1} { + lappend console_thread_list $id + } + } + } + + # Now find the result string from MI + set mi_result "" + foreach line [split $mi_output \n] { + if {[string range $line 0 4] == "^done"} { + set mi_result $line + } + } + if {$mi_result == ""} { + fail "finding MI result string ($name)" + } else { + pass "finding MI result string ($name)" + } + + # Finally, extract the thread ids and compare them to the console + set num_mi_threads_str "" + if {![regexp {number-of-threads="[0-9]+"} $mi_result num_mi_threads_str]} { + fail "finding number of threads in MI output ($name)" + } else { + pass "finding number of threads in MI output ($name)" + + # Extract the number of threads from the MI result + if {![scan $num_mi_threads_str {number-of-threads="%d"} num_mi_threads]} { + fail "got number of threads from MI ($name)" + } else { + pass "got number of threads from MI ($name)" + + # Check if MI and console have same number of threads + if {$num_mi_threads != [llength $console_thread_list]} { + fail "console and MI have same number of threads ($name)" + } else { + pass "console and MI have same number of threads ($name)" + + # Get MI thread list + set mi_thread_list [get_mi_thread_list $name] + + # Check if MI and console have the same threads + set fails 0 + foreach ct [lsort $console_thread_list] mt [lsort $mi_thread_list] { + if {$ct != $mt} { + incr fails + } + } + if {$fails > 0} { + fail "MI and console have same threads ($name)" + + # Send a list of failures to the log + send_log "Console has thread ids: $console_thread_list\n" + send_log "MI has thread ids: $mi_thread_list\n" + } else { + pass "MI and console have same threads ($name)" + } + } + } + } +} + +# +# Start here +# +set testfile "pthreads" +set srcfile "$testfile.c" +set binfile "$objdir/$subdir/$testfile" + +set options [list debug incdir=$subdir] +if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] + != "" } { + gdb_suppress_entire_file \ + "Testcase compile failed, so all tests in this file will automatically fail." +} + +mi_gdb_reinitialize_dir $srcdir/$subdir +mi_gdb_load $binfile + +mi_run_to_main +check_mi_and_console_threads "at main" + +for {set i 0} {$i < 4} {incr i} { + mi_next "next, try $i" + check_mi_and_console_threads "try $i" +} + +mi_gdb_exit + diff --git a/gdb/testsuite/gdb.mi/mi0-hack-cli.exp b/gdb/testsuite/gdb.mi/gdb680.exp index 3fc6c26c290..eee96a69ac1 100644 --- a/gdb/testsuite/gdb.mi/mi0-hack-cli.exp +++ b/gdb/testsuite/gdb.mi/gdb680.exp @@ -1,4 +1,4 @@ -# Copyright 1999 Free Software Foundation, Inc. +# Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,24 +17,40 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu - -# Some basic checks for the CLI. +# +# test gdb/680 +# load_lib mi-support.exp -set MIFLAGS "-i=mi0" +set MIFLAGS "-i=mi" gdb_exit if [mi_gdb_start] { continue } -mi_gdb_test "show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n\\^done" \ - "show architecture" +proc do_test {count} { + mi_gdb_test "-data-list-register-names -1" \ + {\^error,msg=\"bad register number\"} \ + "-data-list-register-names -1, try $count" +} + +# Tests a bug with ui-out and nested uiout types. When +# an error is encountered building a nest typed, like +# lists or tuples, the uiout is not reset to some sane +# state. As a result, uiout still thinks it is building +# this nested type. Execute enough of these errors and +# an assertion failure occurs. This is most obvious +# with invalid register number and the register commands. + +# MAX_UIOUT_LEVELS is set to 5. +set counter 0 +for {set i 0} {$i < 4} {incr i} { + do_test $i +} -mi_gdb_test "47show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n47\\^done" \ - "47show architecture" +#setup_kfail "gdb/680" +do_test $i mi_gdb_exit return 0 diff --git a/gdb/testsuite/gdb.mi/gdb701.c b/gdb/testsuite/gdb.mi/gdb701.c new file mode 100644 index 00000000000..16e5c297340 --- /dev/null +++ b/gdb/testsuite/gdb.mi/gdb701.c @@ -0,0 +1,15 @@ +struct _foo +{ + int x; + int y; + int z; +}; + +typedef struct _foo Foo; + +int +main (int argc, char *argv[]) +{ + Foo *foo = 0; + exit (0); +} diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp new file mode 100644 index 00000000000..703ec6a9fc3 --- /dev/null +++ b/gdb/testsuite/gdb.mi/gdb701.exp @@ -0,0 +1,67 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# +# test gdb/701 +# + +load_lib mi-support.exp +set MIFLAGS "-i=mi" + +gdb_exit +if [mi_gdb_start] { + continue +} + +set testfile gdb701 +set srcfile "$testfile.c" +set binfile $objdir/$subdir/$testfile +if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all test in this file will automatically fail." +} + +# When varobj reports the types of objects, it often isn't really reporting +# the type as GDB knows it. For example, in this testcase, we have a +# structure which has been typedefed. A varobj of this type would really have +# a type of "TYPE_CODE_TYPEDEF". It's target type is "TYPE_CODE_STRUCT". Varobj +# should skip over the TYPEDEF type when figuring out the varobj's children. +# If it doesn't, Bad Things Happen(TM). + +# Run to main +mi_run_to_main + +# Step over "foo = 0" +mi_next "step over \"foo = 0\"" + +mi_gdb_test "-var-create fooPtr * foo" \ + "(&\".*\"\r\n)*\\^done,name=\"fooPtr\",numchild=\"3\",type=\"Foo \\*\"" \ + "create fooPtr" + +mi_gdb_test "-var-list-children fooPtr" \ + "(&\".*\"\r\n)*\\^done,numchild=\"3\",.*" \ + "list children of fooPtr" + +foreach i [list x y z] { + mi_gdb_test "-var-list-children fooPtr.$i" \ + "(&\".*\"\r\n)*\\^done,numchild=\"0\"" \ + "list children of fooPtr.$i" +} + +mi_gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp index 5edf1fb5b2f..6dfca47519f 100644 --- a/gdb/testsuite/gdb.mi/mi-console.exp +++ b/gdb/testsuite/gdb.mi/mi-console.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002 Cygnus Solutions. +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp index 33b84ca3b0f..487eecab18f 100644 --- a/gdb/testsuite/gdb.mi/mi-pthreads.exp +++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp @@ -45,18 +45,18 @@ proc get_mi_thread_list {name} { # ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N" # (gdb) mi_gdb_test "-thread-list-ids" \ - {\^done,thread-ids=\[(thread-id="[0-9]+"(,)*)+\],number-of-threads="[0-9]+"} \ + {\^done,thread-ids=\{(thread-id="[0-9]+"(,)*)+\},number-of-threads="[0-9]+"} \ "-thread_list_ids ($name)" set thread_list {} - if {![regexp {thread-ids=\[(thread-id="[0-9]+"(,)?)*\]} $expect_out(buffer) threads]} { + if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $expect_out(buffer) threads]} { fail "finding threads in MI output ($name)" } else { pass "finding threads in MI output ($name)" # Make list of console threads - set start [expr {[string first \[ $threads] + 1}] - set end [expr {[string first \] $threads] - 1}] + set start [expr {[string first \{ $threads] + 1}] + set end [expr {[string first \} $threads] - 1}] set threads [string range $threads $start $end] foreach thread [split $threads ,] { if {[scan $thread {thread-id="%d"} num]} { @@ -74,7 +74,7 @@ proc check_mi_and_console_threads {name} { global expect_out mi_gdb_test "-thread-list-ids" \ - {\^done,thread-ids=\[(thread-id="[0-9]+"(,)*)+\],number-of-threads="[0-9]+"} \ + {\^done,thread-ids=\{(thread-id="[0-9]+"(,)*)+\},number-of-threads="[0-9]+"} \ "-thread-list-ids ($name)" set mi_output $expect_out(buffer) diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp index e6d40a8fb0c..4c6629700a3 100644 --- a/gdb/testsuite/gdb.mi/mi-simplerun.exp +++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp @@ -140,7 +140,7 @@ proc test_controlled_execution {} { # FIXME: A string argument is not printed right; should be fixed and # we should look for the right thing here. - mi_run_to "exec-step 3" "end-stepping-range" "callee4" "" \ + mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \ "basics.c" "8" "" "step to callee4" # FIXME: A string argument is not printed right; should be fixed and diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 54dd403d2f1..18b5a29d86f 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -1,5 +1,5 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. -# +# Copyright (C) 1999, 2000, 2002 Free Software Foundation + # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -42,19 +42,7 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -mi_gdb_test "200-break-insert do_children_tests" \ - "=breakpoint-create,number=\"1\"\r\n200\\^done" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"190\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_children_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"} - timeout {fail "run to do_children_tests (timeout 2)"} -} +mi_runto do_children_tests ##### ##### # # @@ -567,16 +555,8 @@ mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr # Step to "struct_declarations.integer = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"192\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - +set line 192 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step to line $line" # Test: c_variable-4.81 # Desc: create local variable "weird" @@ -774,15 +754,8 @@ mi_gdb_test "-var-update *" \ "update all vars. None changed" # Step over "struct_declarations.integer = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"193\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 193 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.2 # Desc: check that integer changed @@ -794,16 +767,8 @@ mi_gdb_test "-var-update *" \ # weird->char_ptr = "hello"; # bar = 2121; # foo = &bar; - -send_gdb "-exec-step 3\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"196\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 196 +mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -812,15 +777,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.char_ptr" # Step over "struct_declarations.int_ptr_ptr = &foo;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"197\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 197 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -829,15 +787,8 @@ mi_gdb_test "-var-update *" \ "update all vars int_ptr_ptr and children changed" # Step over "weird->long_array[0] = 1234;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"198\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 198 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -846,15 +797,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.long_array.0 changed" # Step over "struct_declarations.long_array[1] = 2345;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"199\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 199 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -863,15 +807,8 @@ mi_gdb_test "-var-update *" \ "update all vars struct_declarations.long_array.1 changed" # Step over "weird->long_array[2] = 3456;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"200\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 200 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -887,15 +824,8 @@ mi_gdb_test "-var-update *" \ # struct_declarations.long_array[7] = 8901; # weird->long_array[8] = 9012; # struct_declarations.long_array[9] = 1234; -send_gdb "-exec-step 7\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"208\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 208 +mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" # Test: c_variable-5.8 # Desc: check that long_array[3-9] changed @@ -905,15 +835,8 @@ mi_gdb_test "-var-update *" \ # Step over "weird->func_ptr = nothing;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"211\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 211 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.9 # Desc: check that func_ptr changed @@ -933,15 +856,8 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ # Step over all lines: # ... # psnp = &snp0; -send_gdb "-exec-step 43\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"254\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 254 +mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -1211,15 +1127,8 @@ mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \ "get children of psnp->ptrs.0.next.next.ptrs" # Step over "snp0.char_ptr = &b3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"255\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 255 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1228,16 +1137,8 @@ mi_gdb_test "-var-update *" \ "update all vars psnp->char_ptr (and 0.char_ptr) changed" # Step over "snp1.char_ptr = &c3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"256\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - +set line 256 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1247,16 +1148,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp2.char_ptr = &a3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"257\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - +set line 257 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1266,15 +1159,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp0.long_ptr = &y3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"258\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} +set line 258 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1284,16 +1170,8 @@ mi_gdb_test "-var-update *" \ # Step over "snp1.long_ptr = &x3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"259\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - +set line 259 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1309,16 +1187,8 @@ clear_xfail *-*-* # # Step over "snp2.long_ptr = &z3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - +set line 260 +mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index b81e8d0d6bd..8352734b14d 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -227,7 +227,7 @@ mi_gdb_test "-var-update *" \ # lsimple.unsigned_integer = 255; # lsimple.character = 'a'; -mi_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ +mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ "var-cmd.c" "119" "" "step at do_locals_tests (5)" # Test: c_variable-2.6 @@ -243,7 +243,7 @@ mi_gdb_test "-var-update *" \ # lpsimple = &lsimple; # func = nothing; -mi_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ +mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ "var-cmd.c" "125" "" "step at do_locals_tests (6)" # Test: c_variable-2.7 @@ -262,7 +262,7 @@ mi_gdb_test "-var-update *" \ # lsimple.unsigned_integer = 4321; # lsimple.character = 'b'; -mi_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ +mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ "var-cmd.c" "133" "" "step at do_locals_tests (7)" # Test: c_variable-2.8 @@ -519,5 +519,34 @@ mi_gdb_test "-var-delete l" \ "\\^done,ndeleted=\"1\"" \ "delete var l" +# Test whether we can follow the name of a variable through multiple +# stack frames. +mi_gdb_test "-break-insert do_special_tests" \ + "=breakpoint-create,number=\"\[0-9\]+\"\r\n\\^done" \ + "set breakpoint at do_special_tests" + +mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests} + +mi_gdb_test "-var-create selected_a @ a" \ + {\^done,name="selected_a",numchild="0",type="int"} \ + "create selected_a" + +mi_gdb_test "-break-insert incr_a" \ + "=breakpoint-create,number=\"\[0-9\]+\"\r\n\\^done" \ + "set breakpoint at incr_a" + +mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a} + +mi_gdb_test "-var-update selected_a" \ + {\^done,changelist=\{name="selected_a",in_scope="true",new_type="char",new_num_children="0"\}} \ + "update selected_a in incr_a" + +mi_next "step a line in incr_a" +mi_next "return from incr_a to do_special_tests" + +mi_gdb_test "-var-update selected_a" \ + {\^done,changelist=\{name="selected_a",in_scope="true",new_type="int",new_num_children="0"\}} \ + "update selected_a in do_special_tests" + mi_gdb_exit return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-basics.exp b/gdb/testsuite/gdb.mi/mi0-basics.exp deleted file mode 100644 index d463244b816..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-basics.exp +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -# In this file we want to test if the operations needed by the following -# procedures work, so it makes no sense using them here. - -# mi_delete_breakpoints -# mi_gdb_reinitialize_dir $srcdir/$subdir -# mi_gdb_load ${binfile} - -# Test if the MI interpreter has been configured - -proc test_mi_interpreter_selection {} { - global mi_gdb_prompt - global gdb_prompt - - # All this test expects is to get the prompt back - # with no syntax error message - send_gdb "-gdb-version\n" - gdb_expect { - -re "GNU gdb .*\r\n$mi_gdb_prompt$" \ - { pass "acceptance of MI operations" - return 1} - -re ".*\r\n$mi_gdb_prompt$" \ - { fail "acceptance of MI operations" - note "Skipping all other MI tests." } - -re "Undefined command.*$gdb_prompt $" \ - { fail "acceptance of MI operations" - note "Skipping all other MI tests." } - -re ".*$gdb_prompt $" \ - { fail "acceptance of MI operations" - note "Skipping all other MI tests." } - timeout { fail "acceptance of MI operations (timeout)" - note "Skipping all other MI tests." } - } - return 0 -} - -proc test_exec_and_symbol_mi_operatons {} { - global mi_gdb_prompt - global binfile - - # Load symbols and specify executable on a single operation - # Tests: - # -file-exec-and-symbols - - # Can't use mi_gdb_test as if this doesn't work, - # we must give up on the whole test file - send_gdb "-file-exec-and-symbols ${binfile}\n" - gdb_expect { - -re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" \ - { pass "file-exec-and-symbols operation" } - timeout { fail "file-exec-and-symbols operation (timeout)" - note "Skipping all other MI tests." - return 0} - } - - # The following is not used by mi-support.exp, but we test here so - # we get done with loading a program basics. - - # Do it again, but now load symbols and specify executable with - # two separate operations - # Tests: - # -file-clear - # -file-exec-file - # -file-symbol-file - - # FIXME: file-clear is not implemented yet. -# mi_gdb_test "-file-clear" \ -# "\\\^done" \ -# "file-clear operation" - - mi_gdb_test "-file-exec-file ${binfile}" \ - "\\\^done" \ - "file-exec-file operation" - - mi_gdb_test "-file-symbol-file ${binfile}" \ - "\\\^done" \ - "file-symbol-file operation" - - # FIXME: if we cannot load we have to skip all other tests. -} - -proc test_breakpoints_deletion {} { - global mi_gdb_prompt - global srcfile - - # Clear all breakpoints and list to confirm - # Tests: - # -break-delete (all) - # -break-list - - # The all parameter is actually no parameter. - mi_gdb_test "200-break-delete" \ - "\\\^done" \ - "break-delete (all) operation" - - mi_gdb_test "201-break-list" \ - ".*\\\^done,BreakpointTable=\\\{\\\}" \ - "all breakpoints removed" -} - -proc test_dir_specification {} { - global mi_gdb_prompt - global srcdir - global subdir - - # Clear the search directories, then specify one to be searched - # Tests: - # -environment-directory - # -environment-directory arg - -#exp_internal 1 - mi_gdb_test "202-environment-directory" \ - "\\\^done" \ - "environment-directory operation" - - mi_gdb_test "203-environment-directory ${srcdir}/${subdir}" \ - "\\\^done" \ - "environment-directory arg operation" -#exp_internal 0 -} - -if [test_mi_interpreter_selection] { - test_exec_and_symbol_mi_operatons - test_breakpoints_deletion - test_dir_specification -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-break.exp b/gdb/testsuite/gdb.mi/mi0-break.exp deleted file mode 100644 index b763587ae69..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-break.exp +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 1999 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_tbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -t main - # -break-insert -t basics.c:callee2 - # -break-insert -t basics.c:15 - # -break-insert -t srcfile:6 - # -break-list - - mi_gdb_test "222-break-insert -t main" \ - "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert -t operation" - - mi_gdb_test "333-break-insert -t basics.c:callee2" \ - "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \ - "insert temp breakpoint at basics.c:callee2" - - mi_gdb_test "444-break-insert -t basics.c:15" \ - "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \ - "insert temp breakpoint at basics.c:15 (callee3)" - - # Getting the quoting right is tricky. That is "\"<file>\":6" - mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":6\"" \ - "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \ - "insert temp breakpoint at \"<fullfilename>\":6 (callee4)" - - mi_gdb_test "666-break-list" \ - "666\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \ - "list of breakpoints" - - mi_gdb_test "777-break-delete" \ - "777\\^done" \ - "delete temp breakpoints" -} - -proc test_rbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -r main - # -break-insert -r callee2 - # -break-insert -r callee - # -break-insert -r .*llee - # -break-list - - setup_xfail "*-*-*" - mi_gdb_test "122-break-insert -r main" \ - "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \ - "break-insert -r operation" - - setup_xfail "*-*-*" - mi_gdb_test "133-break-insert -r callee2" \ - "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\}" \ - "insert breakpoint with regexp callee2" - - setup_xfail "*-*-*" - mi_gdb_test "144-break-insert -r callee" \ - "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"27\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"17\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"8\"\}" \ - "insert breakpoint with regexp callee" - - setup_xfail "*-*-*" - mi_gdb_test "155-break-insert -r \.\*llee" \ - "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"27\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"17\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"8\"\}" \ - "insert breakpoint with regexp .*llee" - - setup_xfail "*-*-*" - mi_gdb_test "166-break-list" \ - "166\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete" \ - "177\\^done" \ - "delete temp breakpoints" -} - -test_tbreak_creation_and_listing -test_rbreak_creation_and_listing - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-console.exp b/gdb/testsuite/gdb.mi/mi0-console.exp deleted file mode 100644 index a2343db9c59..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-console.exp +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 1999, 2000, 2001 Cygnus Solutions. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -# This test only works when talking to a target that routes its output -# through GDB. Check that we're either talking to a simulator or a -# remote target. - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "mi-console" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -# Halt in main -mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*mi-console.c\",line=\"13\",times=\"0\"\}" \ - "break-insert operation" -mi_run_cmd -gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*mi-console.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } -} - -# Next over the hello() call which will produce lots of output -send_gdb "47-exec-next\n" -gdb_expect { - -re "47\\^running\r\n$mi_gdb_prompt" { - pass "Started step over hello" - } - timeout { - fail "Started step over hello (timeout)" - } -} - -gdb_expect { - -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" { - pass "Hello message" - } - -re "Hello" { - - # Probably a native system where GDB doesn't have direct - # control over the inferior console. - # For this to work, GDB would need to run the inferior process - # under a PTY and then use the even-loops ability to wait on - # multiple event sources to channel the output back through the - # MI. - - fail "Hello message (known bug)" - } - timeout { - fail "Hello message (timeout)" - } -} - -gdb_expect { - -re "47\\*stopped.*$mi_gdb_prompt$" { - pass "Finished step over hello" - } - timeout { - fail "Finished step over hello (timeout)" - } -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-disassemble.exp b/gdb/testsuite/gdb.mi/mi0-disassemble.exp deleted file mode 100644 index ca0b3a61a3b..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-disassemble.exp +++ /dev/null @@ -1,224 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test Machine interface (MI) operations for disassembly. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\}" \ - "list of breakpoints" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args - # Tests: - # -exec-run - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # FIXME: We are accepting a duplicate file and line info temporarely. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" {fail "run to main (2)"} - timeout {fail "run to main (timeout 2)"} - } -} - -proc test_disassembly_only {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassemble -s $pc -e "$pc+8" -- 0 - # -data-disassembly -f basics.c -l 32 -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \ - "111\\^done,asm_insns=\{\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\}" \ - "data-disassemble from pc to pc+12 assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -- 0" \ - "222\\^done,asm_insns=\{\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\}" \ - "data-disassemble file & line, assembly only" -} - -proc test_disassembly_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l 32 -n 20 -- 0 - # -data-disassembly -f basics.c -l 32 -n 0 -- 0 - # -data-disassembly -f basics.c -l 32 -n 50 -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 0" \ - "222\\^done,asm_insns=\{\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\}" \ - "data-disassemble file, line, number assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 0" \ - "222\\^done,asm_insns=\{\}" \ - "data-disassemble file, line, number (zero lines) assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 0" \ - "222\\^done,asm_insns=\{\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\}" \ - "data-disassemble file, line, number (more than main lines) assembly only" -} - - -proc test_disassembly_mixed {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l 21 -- 1 - # -data-disassembly -s $pc -e "$pc+8" -- 1 - - mi_gdb_test "002-data-disassemble -f basics.c -l 21 -- 1" \ - "002\\^done,asm_insns=\{src_and_asm_line=\{line=\"21\",file=\".*basics.c\",line_asm_insn=\{\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\}\},.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\{.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\}\}\}" \ - "data-disassemble file, line assembly mixed" - - # - # In mixed mode, the lowest level of granularity is the source line. - # So we are going to get the disassembly for the source line at - # which we are now, even if we have specified that the range is only 2 insns. - # - mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 1" \ - "003\\^done,asm_insns=\{src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\{\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\}\}\}" \ - "data-disassemble range assembly mixed" -} - -proc test_disassembly_mixed_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l 32 -n 20 -- 1 - # -data-disassembly -f basics.c -l 32 -n 0 -- 1 - # -data-disassembly -f basics.c -l 32 -n 50 -- 1 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 1" \ - "222\\^done,asm_insns=\{src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\{\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\}" \ - "data-disassemble file, line, number assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 1" \ - "222\\^done,asm_insns=\{src_and_asm_line=\{line=\"31\",file=\".*basics.c\",line_asm_insn=\{\}\}\}" \ - "data-disassemble file, line, number (zero lines) assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 1" \ - "222\\^done,asm_insns=\{src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\{\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\}" \ - "data-disassemble file, line, number (more than main lines) assembly mixed" -} - -proc test_disassembly_bogus_args {} { - global mi_gdb_prompt - global hex - - # Test that bogus input to disassembly command is rejected. - # Tests: - # -data-disassembly -f foo -l abc -n 0 -- 0 - # -data-disassembly -s foo -e bar -- 0 - # -data-disassembly -s $pc -f basics.c -- 0 - # -data-disassembly -f basics.c -l 32 -- 9 - - mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \ - ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \ - "data-disassemble bogus filename" - - mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \ - "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \ - "data-disassemble bogus address" - - mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \ - "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \ - "data-disassemble mix different args" - - mi_gdb_test "789-data-disassemble -f basics.c -l 32 -- 9" \ - "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \ - "data-disassemble wrong mode arg" - -} - -test_breakpoints_creation_and_listing -test_running_the_program -test_disassembly_only -test_disassembly_mixed -test_disassembly_bogus_args -test_disassembly_lines_limit -test_disassembly_mixed_lines_limit - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-eval.exp b/gdb/testsuite/gdb.mi/mi0-eval.exp deleted file mode 100644 index 0b0ea083488..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-eval.exp +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify -data-evaluate-expression. There are really minimal tests. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - - mi_gdb_test "300-break-insert callee4" \ - "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "insert breakpoint at callee4" - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \ - { pass "run to callee4" } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} - } - - send_gdb "101-exec-next\n" - gdb_expect { - -re "101\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"9\"\}\r\n$mi_gdb_prompt$" \ - { pass "next in callee4" } - -re ".*$mi_gdb_prompt$" {fail "next in callee4 (2)"} - timeout {fail "next in callee4 (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "next in callee4 (1)"} - timeout {fail "next in callee4 (timeout 1)"} - } - -} - -test_running_the_program - -mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" - -mi_gdb_test "311-data-evaluate-expression &A" "311\\^done,value=\"$hex\"" "eval &A" - -mi_gdb_test "411-data-evaluate-expression A+3" "411\\^done,value=\"4\"" "eval A+3" - -mi_gdb_test "511-data-evaluate-expression \"A + 3\"" "511\\^done,value=\"4\"" "eval A + 3" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-read-memory.exp b/gdb/testsuite/gdb.mi/mi0-read-memory.exp deleted file mode 100644 index 0bc294970b6..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-read-memory.exp +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "mi-read-memory" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - - -mi_run_to_main - -#mi_next "do initialization" -send_gdb "101-exec-next\n" -gdb_expect { - -re "101\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \ - { pass "do initialization" } - -re ".*$mi_gdb_prompt$" {fail "do initialization (2)"} - timeout {fail "do initialization (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "do initialization (1)"} - timeout {fail "do initialization (timeout 1)"} -} - -mi_gdb_test "1-data-read-memory" \ - "1\\^error,msg=\".*\"" \ - "no arguments" - - -mi_gdb_test "2-data-read-memory bytes x 1 3 2" \ - "2\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x00\",\"0x01\"}},{addr=\"$hex\",data={\"0x02\",\"0x03\"}},{addr=\"$hex\",data={\"0x04\",\"0x05\"}}}" \ - "3x2, one byte" - - -mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \ - "9\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x00\",\"0x01\"}},{addr=\"$hex\",data={\"0x02\",\"0x03\"}},{addr=\"$hex\",data={\"0x04\",\"0x05\"}}}" \ - "3x2, one byte offset by -6" - - -mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \ - "3\\^done,addr=\"$hex\",nr-bytes=\"4\",total-bytes=\"4\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x0100\",\"0x0102\"}}}" \ - "expression in quotes" - - -mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \ - "4\\^done,addr=\"$hex\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x10\",\"0x11\",\"0x12\",\"0x13\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x14\",\"0x15\",\"0x16\",\"0x17\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x18\",\"0x19\",\"0x1a\",\"0x1b\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x1c\",\"0x1d\",\"0x1e\",\"0x1f\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x20\",\"0x21\",\"0x22\",\"0x23\"},ascii=\" !\\\\\"#\"},{addr=\"$hex\",data={\"0x24\",\"0x25\",\"0x26\",\"0x27\"},ascii=\"\\$%&'\"},{addr=\"$hex\",data={\"0x28\",\"0x29\",\"0x2a\",\"0x2b\"},ascii=\"().+\"},{addr=\"$hex\",data={\"0x2c\",\"0x2d\",\"0x2e\",\"0x2f\"},ascii=\",-\./\"}}" \ - "ascii and data" - - -mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \ - "5\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"128\"}}}" \ - "decimal" - -mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \ - "6\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0200\"}}}" \ - "octal" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-regs.exp b/gdb/testsuite/gdb.mi/mi0-regs.exp deleted file mode 100644 index b6db903593d..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-regs.exp +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and look at registers. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\}" \ - "list of breakpoints" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args - # Tests: - # -exec-run - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # FIXME: We are accepting a duplicate file and line info temporarely. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" {fail "run to main (2)"} - timeout {fail "run to main (timeout 2)"} - } -} - -proc sparc_register_tests_no_exec { } { - # Test the generic IDT chip. - mi_gdb_test "111-data-list-register-values" \ - ".*111\\^error,msg=\"mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> \\\[<regnum1>...<regnumN>\\\]\"" \ - "wrong arguments" - - mi_gdb_test "111-data-list-register-values x" \ - ".*111\\^error,msg=\"mi_cmd_data_list_register_values: No registers\.\"" \ - "no executable" -} - -# These tests exercise IDT-specific MIPS registers for several -# different processor models. - -# This should detect the actual processor in use and change -# the expected results appropriately. FIXME - -proc sparc_register_tests { } { - global hex - global decimal - set octal "\[0-7\]+" - set binary "\[0-1\]+" - set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))" - set float2 "\\-?\[0-9\]+" - - mi_gdb_test "111-data-list-register-names" \ - "111\\^done,register-names=\{\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \ - "list register names" - - mi_gdb_test "222-data-list-register-values x" \ - "222\\^done,register-values=\{\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\}" \ - "register values x" - - mi_gdb_test "333-data-list-register-values f" \ - "333\\^done,register-values=\{\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"71\",value=\"$float\"\}\}" \ - "register values f" - - mi_gdb_test "444-data-list-register-values d" \ - "444\\^done,register-values=\{\{number=\"0\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\}" \ - "register values d" - - mi_gdb_test "555-data-list-register-values o" \ - "555\\^done,register-values=\{\{number=\"0\",value=\"$octal\"\}.*\{number=\"71\",value=\"$octal\"\}\}" \ - "register values o" - - mi_gdb_test "666-data-list-register-values t" \ - "666\\^done,register-values=\{\{number=\"0\",value=\"$binary\"\}.*\{number=\"71\",value=\"$binary\"\}\}" \ - "register values t" - - # On the sparc, registers 0-31 are int, 32-63 float, 64-71 int - - mi_gdb_test "777-data-list-register-values N" \ - "777\\^done,register-values=\{\{number=\"0\",value=\"$decimal\"\}.*\{number=\"31\",value=\"$decimal\"\},\{number=\"32\",value=\"$float\"\}.*\{number=\"63\",value=\"$float\"\},\{number=\"64\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\}" \ - "register values N" - - mi_gdb_test "888-data-list-register-values r" \ - "888\\^done,register-values=\{\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\}" \ - "register values r" - - mi_gdb_test "999-data-list-register-names 68 69 70 71" \ - "999\\^done,register-names=\{\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \ - "list names of some regs" - - mi_gdb_test "001-data-list-register-values x 68 69 70 71" \ - "001\\^done,register-values=\{\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\}" \ - "list values of some regs" - - # Don't know how useful this test is - - mi_gdb_test "002-data-list-changed-registers" \ - "002\\^done,changed-registers=\{(\"${decimal}\"(,\"${decimal}\")*)?\}" \ - "list changed registers" -} - -if [istarget "sparc-*-*"] then { - sparc_register_tests_no_exec - test_breakpoints_creation_and_listing - test_running_the_program - sparc_register_tests -} else { - verbose "mi-regs.exp tests ignored for this target" -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-return.exp b/gdb/testsuite/gdb.mi/mi0-return.exp deleted file mode 100644 index b396fe8d163..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-return.exp +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-return. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_to_callee4 {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert callee4" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" { - pass "run to callee4" - } - -re ".*$mi_gdb_prompt$" { - fail "run to callee4 (2)" - } - timeout { - fail "run to callee4 (timeout)" - } - } - - mi_gdb_test "205-break-delete" \ - "205\\^done.*" \ - "delete all breakpoints" - -} - -proc test_return_simple {} { - global mi_gdb_prompt - global hex - - send_gdb "111-exec-return\n" - gdb_expect { - -re "111\\^done,frame=\{level=\"0 \",addr=\"$hex\",func=\"callee3\",args=\{.*\},file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"} - -re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" } - timeout { fail "return from callee4 now (timeout)" - } - } -} - -test_running_to_callee4 -test_return_simple - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-simplerun.exp b/gdb/testsuite/gdb.mi/mi0-simplerun.exp deleted file mode 100644 index 9113e1fa30b..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-simplerun.exp +++ /dev/null @@ -1,201 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "201-break-insert basics.c:callee2" \ - "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \ - "insert breakpoint at basics.c:callee2" - - mi_gdb_test "202-break-insert basics.c:15" \ - "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \ - "insert breakpoint at basics.c:15 (callee3)" - - mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \ - "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \ - "insert breakpoint at \"<fullfilename>\":6 (callee4)" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \ - "list of breakpoints" - - mi_gdb_test "205-break-disable 2 3 4" \ - "205\\^done.*" \ - "disabling of breakpoints" - - mi_gdb_test "206-break-info 2" \ - "206\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"2\",.*,enabled=\"n\",.*\}\}" \ - "list of breakpoints, 16 disabled" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - # -gdb-set - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } -} - -proc test_controlled_execution {} { - global mi_gdb_prompt - global hex - - # Continue execution until a breakpoint is reached, step into calls, verifying - # if the arguments are correctly shown, continue to the end of a called - # function, step over a call (next). - # Tests: - # -exec-continue - # -exec-next - # -exec-step - # -exec-finish - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - mi0_next_to "main" "" "basics.c" "33" "next at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``\\\\\"'' is for \". - mi0_step_to "callee1" \ - "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \ - "basics.c" "27" "step at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - mi0_run_to "exec-step 3" "end-stepping-range" "callee4" "" \ - "basics.c" "8" "" "step to callee4" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``.'' is part of ``gdb-result-var="$1"'' - mi0_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish" -} - -proc test_controlling_breakpoints {} { - global mi_gdb_prompt - - # Enable, delete, set ignore counts in breakpoints - # (disable was already tested above) - # Tests: - # -break-delete - # -break-enable - # -break-after - # -break-condition - -} - -proc test_program_termination {} { - global mi_gdb_prompt - - # Run to completion: normal and forced - # Tests: - # -exec-abort - # (normal termination of inferior) - - # FIXME: "stopped" doesn't seem appropriate. - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - send_gdb "999-exec-continue\n" - gdb_expect { - -re "999\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "999\\*stopped,reason=\"exited-normally\"\r\n$mi_gdb_prompt$" { - pass "continue to end" - } - -re ".*$mi_gdb_prompt$" {fail "continue to end (2)"} - timeout {fail "continue to end (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "continue to end (1)"} - timeout {fail "continue to end (timeout 1)"} - } -} - -test_breakpoints_creation_and_listing -test_running_the_program -test_controlled_execution -test_controlling_breakpoints -test_program_termination - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-stack.exp b/gdb/testsuite/gdb.mi/mi0-stack.exp deleted file mode 100644 index 270aa84ff6f..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-stack.exp +++ /dev/null @@ -1,218 +0,0 @@ -# Copyright 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that stack commands work. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -mi_gdb_test "200-break-insert callee4" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" { - pass "run to callee4" - } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} -} - - -proc test_stack_frame_listing {} { - global mi_gdb_prompt - global hex - - # Obtain a stack trace - # Tests: - # -stack-list-frames - # -stack-list-frames 1 1 - # -stack-list-frames 1 3 - - mi_gdb_test "231-stack-list-frames" \ - "231\\^done,stack=\{frame=\{level=\"0 \",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2 \",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3 \",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4 \",addr=\"$hex\",func=\"main\",.*\}\}" \ - "stack frame listing" - mi_gdb_test "232-stack-list-frames 1 1" \ - "232\\^done,stack=\{frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\}\}" \ - "stack frame listing 1 1" - mi_gdb_test "233-stack-list-frames 1 3" \ - "233\\^done,stack=\{frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2 \",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3 \",addr=\"$hex\",func=\"callee1\",.*\}\}" \ - "stack frame listing 1 3" - - mi_gdb_test "234-stack-list-frames 1" \ - "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack frame listing wrong" -} - -proc test_stack_args_listing {} { - global mi_gdb_prompt - global hex - - # Obtain lists for args for the stack frames - # Tests: - # -stack-list-arguments 0 - # -stack-list-arguments 0 1 1 - # -stack-list-arguments 0 1 3 - # -stack-list-arguments 1 - # -stack-list-arguments 1 1 1 - # -stack-list-arguments 1 1 3 - # -stack-list-arguments - - mi_gdb_test "231-stack-list-arguments 0" \ - "231\\^done,stack-args=\{frame=\{level=\"0\",args=\{\}\},frame=\{level=\"1\",args=\{name=\"strarg\"\}\},frame=\{level=\"2\",args=\{name=\"intarg\",name=\"strarg\"\}\},frame=\{level=\"3\",args=\{name=\"intarg\",name=\"strarg\",name=\"fltarg\"\}\},frame=\{level=\"4\",args=\{\}\}\}" \ - "stack args listing 0" - - mi_gdb_test "232-stack-list-arguments 0 1 1" \ - "232\\^done,stack-args=\{frame=\{level=\"1\",args=\{name=\"strarg\"\}\}\}" \ - "stack args listing 0 1 1" - - mi_gdb_test "233-stack-list-arguments 0 1 3" \ - "233\\^done,stack-args=\{frame=\{level=\"1\",args=\{name=\"strarg\"\}\},frame=\{level=\"2\",args=\{name=\"intarg\",name=\"strarg\"\}\},frame=\{level=\"3\",args=\{name=\"intarg\",name=\"strarg\",name=\"fltarg\"\}\}\}" \ - "stack args listing 0 1 3" - - mi_gdb_test "231-stack-list-arguments 1" \ - "231\\^done,stack-args=\{frame=\{level=\"0\",args=\{\}\},frame=\{level=\"1\",args=\{\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"2\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"3\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\}\},frame=\{level=\"4\",args=\{\}\}\}" \ - "stack args listing 1" - - mi_gdb_test "232-stack-list-arguments 1 1 1" \ - "232\\^done,stack-args=\{frame=\{level=\"1\",args=\{\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\}\}" \ - "stack args listing 1 1 1" - - mi_gdb_test "233-stack-list-arguments 1 1 3" \ - "233\\^done,stack-args=\{frame=\{level=\"1\",args=\{\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"2\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"3\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\}\}\}" \ - "stack args listing 1 1 3" - - mi_gdb_test "234-stack-list-arguments" \ - "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack args listing wrong" -} - -proc test_stack_info_depth {} { - global mi_gdb_prompt - global hex - - # Obtain depth of stack - # Tests: - # -stack-info-depth - # -stack-info-depth 3 - # -stack-info-depth 99 - - mi_gdb_test "231-stack-info-depth" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth" - - mi_gdb_test "231-stack-info-depth 3" \ - "231\\^done,depth=\"3\"" \ - "stack info-depth 3" - - mi_gdb_test "231-stack-info-depth 99" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth 99" - - mi_gdb_test "231-stack-info-depth 99 99" \ - "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \ - "stack info-depth wrong usage" -} - -proc test_stack_locals_listing {} { - global mi_gdb_prompt - global hex - - # Obtain lists for locals for the stack frames - # Tests: - # -stack-list-locals 0 - # -stack-list-locals 1 - # -stack-list-arguments - - mi_gdb_test "232-stack-list-locals 0" \ - "232\\^done,locals=\{name=\"A\",name=\"B\",name=\"C\"\}" \ - "stack locals listing 0" - -# step until A, B, C, have some reasonable values. -send_gdb "-exec-next 3\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "next's in callee4" - } - timeout { fail "next in callee4 (timeout)" } -} - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\{\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\}" \ - "stack locals listing 1" - - mi_gdb_test "234-stack-list-locals" \ - "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \ - "stack locals listing wrong" - - mi_gdb_test "232-stack-select-frame 1" \ - "232\\^done" \ - "stack select frame 1" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\{\}" \ - "stack locals listing for new frame" - -# this should be a no-op - - mi_gdb_test "232-stack-select-frame" \ - "232\\^done" \ - "stack select same frame" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\{\}" \ - "stack locals for same frame (level 1)" - -} - -test_stack_frame_listing -test_stack_args_listing -test_stack_locals_listing -test_stack_info_depth - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-stepi.exp b/gdb/testsuite/gdb.mi/mi0-stepi.exp deleted file mode 100644 index 456b2a1a9bc..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-stepi.exp +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-step-instruction and exec-next-instruction. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_to_main {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } -} - -proc test_stepi_nexti {} { - global mi_gdb_prompt - global hex - - send_gdb "111-exec-step-instruction\n" - gdb_expect { - -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" { - pass "step-instruction at main" - } - timeout { - fail "step-instruction at main (timeout)" - } - } - send_gdb "222-exec-next-instruction\n" - gdb_expect { - -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" { - pass "next-instruction at main" - } - timeout { - fail "next-instruction at main (timeout)" - } - } - send_gdb "333-exec-next-instruction\n" - gdb_expect { - -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" { - pass "next-instruction at main" - } - timeout { - fail "next-instruction at main (timeout)" - } - } -} - -test_running_to_main -test_stepi_nexti - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-until.exp b/gdb/testsuite/gdb.mi/mi0-until.exp deleted file mode 100644 index 1cf58a80971..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-until.exp +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-until. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "until" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_to_foo {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert 10" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*until.c\",line=\"10\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"10\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } - - mi_gdb_test "100-break-delete 1" "100\\^done" "break-delete 1" - -} - -proc test_until {} { - global mi_gdb_prompt - global hex - - send_gdb "111-exec-until\n" - gdb_expect { - -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"12\"\}\r\n$mi_gdb_prompt$" { - pass "until after while loop" - } - timeout { - fail "until after while loop (timeout)" - } - } - - send_gdb "222-exec-until 15\n" - gdb_expect { - -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"15\"\}\r\n$mi_gdb_prompt$" { - pass "until line number" - } - timeout { - fail "until line number (timeout)" - } - } - - send_gdb "333-exec-until until.c:17\n" - gdb_expect { - -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"17\"\}\r\n$mi_gdb_prompt$" { - pass "until line number:file" - } - timeout { - fail "until line number:file (timeout)" - } - } - - # This is supposed to NOT stop at line 25. It stops right after foo is over. - - send_gdb "444-exec-until until.c:25\n" - gdb_expect { - -re "444\\^running\r\n${mi_gdb_prompt}444\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*until.c\",line=\"24\"\}\r\n$mi_gdb_prompt$" { - pass "until after current function" - } - timeout { - fail "until after current function (timeout)" - } - } - -} - -test_running_to_foo -test_until - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-var-block.exp b/gdb/testsuite/gdb.mi/mi0-var-block.exp deleted file mode 100644 index 023213912d8..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-var-block.exp +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright (C) 1999 2000 s Solutions -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_gdb_test "200-break-insert do_block_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_block_tests\",file=\".*var-cmd.c\",line=\"154\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_block_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"} - timeout {fail "run to do_block_tests (timeout 2)"} -} - -# Test: c_variable-3.2 -# Desc: create cb and foo -mi_gdb_test "-var-create cb * cb" \ - "\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \ - "create local variable cb" - -mi_gdb_test "-var-create foo * foo" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create local variable foo" - -# step to "foo = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"158\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} - - -# Be paranoid and assume 3.2 created foo -mi_gdb_test "-var-delete foo" \ - "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \ - "delete var foo" - - -# Test: c_variable-3.3 -# Desc: create foo -mi_gdb_test "-var-create foo * foo" \ - "\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \ - "create local variable foo" - -# step to "foo2 = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"161\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} - -# Test: c_variable-3.4 -# Desc: check foo, cb changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",name=\"cb\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: cb foo changed" - -# step to "foo = 321;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"164\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} - -# Test: c_variable-3.5 -# Desc: create inner block foo -mi_gdb_test "-var-create inner_foo * foo" \ - "\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \ - "create local variable inner_foo" - -# step to "foo2 = 0;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"166\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} - -# Test: c_variable-3.6 -# Desc: create foo2 -mi_gdb_test "-var-create foo2 * foo2" \ - "\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \ - "create local variable foo2" - -# Test: c_variable-3.7 -# Desc: check that outer foo in scope and inner foo out of scope -# Note: also a known gdb problem -setup_xfail *-*-* -mi_gdb_test "-var-update inner_foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -setup_xfail *-*-* -mi_gdb_test "-var-evaluate-expression inner_foo" \ - "\\^done,value=\{FIXME\}" \ - "evaluate inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\{\}" \ - "update foo: did not change" - -mi_gdb_test "-var-delete inner_foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var inner_foo" - -# step to "foo = 0;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"168\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} - -# Test: c_variable-3.8 -# Desc: check that foo2 out of scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo2: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -# step to "cb = 21;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"171\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} - - -# Test: c_variable-3.9 -# Desc: check that only cb is in scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo2 should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -setup_xfail *-*-* -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -mi_gdb_test "-var-update cb" \ - "\\^done,changelist=\{\}" \ - "update cb" - -# Test: c_variable-3.10 -# Desc: names of editable variables -#gdbtk_test c_variable-3.10 {names of editable variables} { -# editable_variables -#} {{foo cb foo2} {}} - -# Done with block tests -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -mi_gdb_test "-var-delete foo2" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo2" - -mi_gdb_test "-var-delete cb" \ - "\\^done,ndeleted=\"1\"" \ - "delete var cb" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-var-child.exp b/gdb/testsuite/gdb.mi/mi0-var-child.exp deleted file mode 100644 index bd7462206fc..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-var-child.exp +++ /dev/null @@ -1,1333 +0,0 @@ -# Copyright (C) 1999 2000 Cygnus Solutions -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_gdb_test "200-break-insert do_children_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"190\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"190\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_children_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"} - timeout {fail "run to do_children_tests (timeout 2)"} -} - -##### ##### -# # -# children tests # -# # -##### ##### - - -# Test: c_variable-4.2 -# Desc: create variable "struct_declarations" -mi_gdb_test "-var-create struct_declarations * struct_declarations" \ - "\\^done,name=\"struct_declarations\",numchild=\"11\",type=\"struct _struct_decl\"" \ - "create local variable struct_declarations" - -# Test: c_variable-4.3 -# Desc: children of struct_declarations -# STABS doesn't give us argument types for the func ptr structs, but -# Dwarf 2 does. -mi_gdb_test "-var-list-children struct_declarations" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of struct_declarations" - -#gdbtk_test c_variable-4.3 {children of struct_declarations} { -# get_children struct_declarations -#} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2} - -# Test: c_variable-4.4 -# Desc: number of children of struct_declarations -mi_gdb_test "-var-info-num-children struct_declarations" \ - "\\^done,numchild=\"11\"" \ - "get number of children of struct_declarations" - -# Test: c_variable-4.5 -# Desc: children of struct_declarations.integer -mi_gdb_test "-var-list-children struct_declarations.integer" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.integer" - -# Test: c_variable-4.6 -# Desc: number of children of struct_declarations.integer -mi_gdb_test "-var-info-num-children struct_declarations.integer" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.integer" - -# Test: c_variable-4.7 -# Desc: children of struct_declarations.character -mi_gdb_test "-var-list-children struct_declarations.character" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.character" - -# Test: c_variable-4.8 -# Desc: number of children of struct_declarations.character -mi_gdb_test "-var-info-num-children struct_declarations.character" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.character" - -# Test: c_variable-4.9 -# Desc: children of struct_declarations.char_ptr -mi_gdb_test "-var-list-children struct_declarations.char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.char_ptr.\\*char_ptr\",exp=\"\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.char_ptr" - -# Test: c_variable-4.10 -# Desc: number of children of struct_declarations.char_ptr -mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.char_ptr" - -# Test: c_variable-4.11 -# Desc: children of struct_declarations.long_int -mi_gdb_test "-var-list-children struct_declarations.long_int" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_int" - -# Test: c_variable-4.12 -# Desc: number of children of struct_declarations.long_int -mi_gdb_test "-var-info-num-children struct_declarations.long_int" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_int" - -# Test: c_variable-4.13 -# Desc: children of int_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",exp=\"\\*int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of struct_declarations.int_ptr_ptr" - -#gdbtk_test c_variable-4.13 {children of int_ptr_ptr} { -# get_children struct_declarations.int_ptr_ptr -#} {*int_ptr_ptr} - -# Test: c_variable-4.14 -# Desc: number of children of int_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.int_ptr_ptr" - - -# Test: c_variable-4.15 -# Desc: children of struct_declarations.long_array -mi_gdb_test "-var-list-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of struct_declarations.long_array" - -# Test: c_variable-4.16 -# Desc: number of children of struct_declarations.long_array -mi_gdb_test "-var-info-num-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.long_array" - -# Test: c_variable-4.17 -# Desc: children of struct_declarations.func_ptr -mi_gdb_test "-var-list-children struct_declarations.func_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr" - - -# Test: c_variable-4.18 -# Desc: number of children of struct_declarations.func_ptr -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr" - - -# Test: c_variable-4.19 -# Desc: children of struct_declarations.func_ptr_struct -mi_gdb_test "-var-list-children struct_declarations.func_ptr_struct" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr_struct" - -# Test: c_variable-4.20 -# Desc: number of children of struct_declarations.func_ptr_struct -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_struct" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr_struct" - - -# Test: c_variable-4.21 -# Desc: children of struct_declarations.func_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.func_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr_ptr" - -# Test: c_variable-4.22 -# Desc: number of children of struct_declarations.func_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr_ptr" - - -# Test: c_variable-4.23 -# Desc: children of struct_declarations.u1 -mi_gdb_test "-var-list-children struct_declarations.u1" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.u1.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.u1.b\",exp=\"b\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.u1.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.u1.d\",exp=\"d\",numchild=\"0\",type=\"enum foo\"\}\}" \ - "get children of struct_declarations.u1" - -# Test: c_variable-4.24 -# Desc: number of children of struct_declarations.u1 -mi_gdb_test "-var-info-num-children struct_declarations.u1" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.u1" - -# Test: c_variable-4.25 -# Desc: children of struct_declarations.s2 -mi_gdb_test "-var-list-children struct_declarations.s2" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.s2.u2\",exp=\"u2\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2.g\",exp=\"g\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.s2.h\",exp=\"h\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.i\",exp=\"i\",numchild=\"10\",type=\"long int \\\[10\\\]\"\}\}" \ - "get children of struct_declarations.s2" -#gdbtk_test c_variable-4.25 {children of struct_declarations.s2} { -# get_children struct_declarations.s2 -#} {u2 g h i} - -# Test: c_variable-4.26 -# Desc: number of children of struct_declarations.s2 -mi_gdb_test "-var-info-num-children struct_declarations.s2" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.s2" - - -# Test: c_variable-4.27 -# Desc: children of struct_declarations.long_array.1 -mi_gdb_test "-var-list-children struct_declarations.long_array.1" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.1" - -# Test: c_variable-4.28 -# Desc: number of children of struct_declarations.long_array.1 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.1" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.1" - -# Test: c_variable-4.29 -# Desc: children of struct_declarations.long_array.2 -mi_gdb_test "-var-list-children struct_declarations.long_array.2" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.2" - -# Test: c_variable-4.30 -# Desc: number of children of struct_declarations.long_array.2 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.2" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.2" - -# Test: c_variable-4.31 -# Desc: children of struct_declarations.long_array.3 -mi_gdb_test "-var-list-children struct_declarations.long_array.3" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.3" - -# Test: c_variable-4.32 -# Desc: number of children of struct_declarations.long_array.3 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.3" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.3" - -# Test: c_variable-4.33 -# Desc: children of struct_declarations.long_array.4 -mi_gdb_test "-var-list-children struct_declarations.long_array.4" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.4" - -# Test: c_variable-4.34 -# Desc: number of children of struct_declarations.long_array.4 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.4" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.4" - -# Test: c_variable-4.35 -# Desc: children of struct_declarations.long_array.5 -mi_gdb_test "-var-list-children struct_declarations.long_array.5" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.5" - -# Test: c_variable-4.36 -# Desc: number of children of struct_declarations.long_array.5 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.5" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.5" - -# Test: c_variable-4.37 -# Desc: children of struct_declarations.long_array.6 -mi_gdb_test "-var-list-children struct_declarations.long_array.6" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.6" - -# Test: c_variable-4.38 -# Desc: number of children of struct_declarations.long_array.6 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.6" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.6" - -# Test: c_variable-4.39 -# Desc: children of struct_declarations.long_array.7 -mi_gdb_test "-var-list-children struct_declarations.long_array.7" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.7" - -# Test: c_variable-4.40 -# Desc: number of children of struct_declarations.long_array.7 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.7" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.7" - -# Test: c_variable-4.41 -# Desc: children of struct_declarations.long_array.8 -mi_gdb_test "-var-list-children struct_declarations.long_array.8" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.8" - -# Test: c_variable-4.42 -# Desc: number of children of struct_declarations.long_array.8 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.8" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.8" - - -# Test: c_variable-4.43 -# Desc: children of struct_declarations.long_array.9 -mi_gdb_test "-var-list-children struct_declarations.long_array.9" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.9" - -# Test: c_variable-4.44 -# Desc: number of children of struct_declarations.long_array.9 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.9" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.9" - -# Test: c_variable-4.45 -# Desc: children of struct_declarations.u1.a -mi_gdb_test "-var-list-children struct_declarations.u1.a" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.a" - -# Test: c_variable-4.46 -# Desc: number of children of struct_declarations.u1.a -mi_gdb_test "-var-info-num-children struct_declarations.u1.a" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.a" - -# Test: c_variable-4.47 -# Desc: children of struct_declarations.u1.b -mi_gdb_test "-var-list-children struct_declarations.u1.b" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.u1.b.\\*b\",exp=\"\\*b\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.u1.b" - -# Test: c_variable-4.48 -# Desc: number of children of struct_declarations.u1.b -mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.u1.b" - -# Test: c_variable-4.49 -# Desc: children of struct_declarations.u1.c -mi_gdb_test "-var-list-children struct_declarations.u1.c" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.c" - -# Test: c_variable-4.50 -# Desc: number of children of struct_declarations.u1.c -mi_gdb_test "-var-info-num-children struct_declarations.u1.c" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.c" - -# Test: c_variable-4.51 -# Desc: children of struct_declarations.u1.d -mi_gdb_test "-var-list-children struct_declarations.u1.d" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.d" - - -# Test: c_variable-4.52 -# Desc: number of children of struct_declarations.u1.d -mi_gdb_test "-var-info-num-children struct_declarations.u1.d" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.d" - - -# Test: c_variable-4.53 -# Desc: children of struct_declarations.s2.u2 -mi_gdb_test "-var-list-children struct_declarations.s2.u2" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1\",exp=\"u1s1\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2.u2.f\",exp=\"f\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.u2.u1s2\",exp=\"u1s2\",numchild=\"2\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of struct_declarations.s2.u2" - -# Test: c_variable-4.54 -# Desc: number of children of struct_declarations.s2.u2 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2" \ - "\\^done,numchild=\"3\"" \ - "get number of children of struct_declarations.s2.u2" - -# Test: c_variable-4.55 -# Desc: children of struct_declarations.s2.g -mi_gdb_test "-var-list-children struct_declarations.s2.g" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.g" - -# Test: c_variable-4.56 -# Desc: number of children of struct_declarations.s2.g -mi_gdb_test "-var-info-num-children struct_declarations.s2.g" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.g" - - -# Test: c_variable-4.57 -# Desc: children of struct_declarations.s2.h -mi_gdb_test "-var-list-children struct_declarations.s2.h" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.h" - -# Test: c_variable-4.58 -# Desc: number of children of struct_declarations.s2.h -mi_gdb_test "-var-info-num-children struct_declarations.s2.h" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.h" - - -# Test: c_variable-4.59 -# Desc: children of struct_declarations.s2.i -mi_gdb_test "-var-list-children struct_declarations.s2.i" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.s2.i.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of struct_declarations.s2.i" - -# Test: c_variable-4.60 -# Desc: number of children of struct_declarations.s2.i -mi_gdb_test "-var-info-num-children struct_declarations.s2.i" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.s2.i" - -# Test: c_variable-4.61 -# Desc: children of struct_declarations.s2.u2.u1s1 -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1.d\",exp=\"d\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e\",exp=\"e\",numchild=\"10\",type=\"char \\\[10\\\]\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.func\",exp=\"func\",numchild=\"0\",type=\"int \\*\\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.foo\",exp=\"foo\",numchild=\"0\",type=\"efoo\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s1" - -# Test: c_variable-4.62 -# Desc: number of children of struct_declarations.s2.u2.u1s1 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.s2.u2.u1s1" - -# Test: c_variable-4.63 -# Desc: children of struct_declarations.s2.u2.f -mi_gdb_test "-var-list-children struct_declarations.s2.u2.f" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.f" - -# Test: c_variable-4.64 -# Desc: number of children of struct_declarations.s2.u2.f -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.f" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.f" - -# Test: c_variable-4.65 -# Desc: children of struct_declarations.s2.u2.u1s2 -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s2.array_ptr\",exp=\"array_ptr\",numchild=\"2\",type=\"char \\\[2\\\]\"\},child=\{name=\"struct_declarations.s2.u2.u1s2.func\",exp=\"func\",numchild=\"0\",type=\"int \\(\\*\\)\\((int, char \\*)?\\)\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s2" - -# Test: c_variable-4.66 -# Desc: number of children of struct_declarations.s2.u2.u1s2 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2" \ - "\\^done,numchild=\"2\"" \ - "get number of children of struct_declarations.s2.u2.u1s2" - -# Test: c_variable-4.67 -# Desc: children of struct_declarations.s2.u2.u1s1.d -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.d" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.d" - -# Test: c_variable-4.68 -# Desc: number of children of struct_declarations.s2.u2.u1s1.d -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.d" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.d" - -# Test: c_variable-4.69 -# Desc: children of struct_declarations.s2.u2.u1s1.e -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.e" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1.e.0\",exp=\"0\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.1\",exp=\"1\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.2\",exp=\"2\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.s2.u2.u1s1.e.3\",exp=\"3\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.4\",exp=\"4\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.5\",exp=\"5\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.6\",exp=\"6\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.7\",exp=\"7\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.8\",exp=\"8\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.9\",exp=\"9\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s1.e" - -# Test: c_variable-4.70 -# Desc: number of children of struct_declarations.s2.u2.u1s1.e -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.e" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.e" - - -# Test: c_variable-4.71 -# Desc: children of struct_declarations.s2.u2.u1s1.func -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.func" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.func" - -# Test: c_variable-4.72 -# Desc: number of children of struct_declarations.s2.u2.u1s1.func -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.func" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.func" - - -# Test: c_variable-4.73 -# Desc: children of struct_declarations.s2.u2.u1s1.foo -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.foo" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.foo" - -# Test: c_variable-4.74 -# Desc: number of children of struct_declarations.s2.u2.u1s1.foo -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.foo" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.foo" - - -# Test: c_variable-4.75 -# Desc: children of struct_declarations.s2.u2.u1s2.array_ptr -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2.array_ptr" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s2.array_ptr.0\",exp=\"0\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.s2.u2.u1s2.array_ptr.1\",exp=\"1\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s2.array_ptr" - -# Test: c_variable-4.76 -# Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.array_ptr" \ - "\\^done,numchild=\"2\"" \ - "get number of children of struct_declarations.s2.u2.u1s2.array_ptr" - -# Test: c_variable-4.77 -# Desc: children of struct_declarations.s2.u2.u1s2.func -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2.func" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s2.func" - -# Test: c_variable-4.78 -# Desc: number of children of struct_declarations.s2.u2.u1s2.func -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.func" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s2.func" - -# Test: c_variable-4.79 -# Desc: children of struct_declarations.int_ptr_ptr.*int_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",exp=\"\\*\\*int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of struct_declarations.int_ptr_ptr.*int_ptr_ptr" -#} {**int_ptr_ptr} - -# Test: c_variable-4.80 -# Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr" - - -# Step to "struct_declarations.integer = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"192\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - - -# Test: c_variable-4.81 -# Desc: create local variable "weird" -mi_gdb_test "-var-create weird * weird" \ - "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \ - "create local variable weird" - -# Test: c_variable-4.82 -# Desc: children of weird -mi_gdb_test "-var-list-children weird" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of weird" - -# Test: c_variable-4.83 -# Desc: number of children of weird -mi_gdb_test "-var-info-num-children weird" \ - "\\^done,numchild=\"11\"" \ - "get number of children of weird" - - -# Test: c_variable-4.84 -# Desc: children of weird->long_array -mi_gdb_test "-var-list-children weird.long_array" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of weird.long_array" -#gdbtk_test c_variable-4.84 {children of weird->long_array} { -# get_children weird.long_array -#} {0 1 2 3 4 5 6 7 8 9} - -# Test: c_variable-4.85 -# Desc: number of children of weird.long_array -mi_gdb_test "-var-info-num-children weird.long_array" \ - "\\^done,numchild=\"10\"" \ - "get number of children of weird.long_array" - -# Test: c_variable-4.86 -# Desc: children of weird.int_ptr_ptr -mi_gdb_test "-var-list-children weird.int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird.int_ptr_ptr.\\*int_ptr_ptr\",exp=\"\\*int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of weird.int_ptr_ptr" -#gdbtk_test c_variable-4.86 {children of weird->int_ptr_ptr} { -# get_children weird.int_ptr_ptr -#} {*int_ptr_ptr} - -# Test: c_variable-4.87 -# Desc: number of children of weird.int_ptr_ptr -mi_gdb_test "-var-info-num-children weird.int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird.int_ptr_ptr" - -# Test: c_variable-4.88 -# Desc: children of *weird->int_ptr_ptr -mi_gdb_test "-var-list-children weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",exp=\"\\*\\*int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of weird.int_ptr_ptr.*int_ptr_ptr" -#gdbtk_test c_variable-4.88 {children of *weird->int_ptr_ptr} { -# get_children weird.int_ptr_ptr.*int_ptr_ptr -#} {**int_ptr_ptr} - -# Test: c_variable-4.89 -# Desc: number of children *weird->int_ptr_ptr -mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird.int_ptr_ptr.*int_ptr_ptr" - -# Test: c_variable-4.90 -# Desc: create weird->int_ptr_ptr -mi_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \ - "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"" \ - "create local variable weird->int_ptr_ptr" - -# Test: c_variable-4.91 -# Desc: children of weird->int_ptr_ptr -mi_gdb_test "-var-list-children weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",exp=\"\\*weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of weird->int_ptr_ptr" - - -# Test: c_variable-4.92 -# Desc: number of children of (weird->int_ptr_ptr) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird->int_ptr_ptr" - -# Test: c_variable-4.93 -# Desc: children of *(weird->int_ptr_ptr) -mi_gdb_test "-var-list-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",exp=\"\\*\\*weird->int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr" - -# Test: c_variable-4.94 -# Desc: number of children of *(weird->int_ptr_ptr) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr" - -# Test: c_variable-4.95 -# Desc: children of *(*(weird->int_ptr_ptr)) -mi_gdb_test "-var-list-children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" - -# Test: c_variable-4.96 -# Desc: number of children of *(*(weird->int_ptr_ptr)) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" - -# Test: c_variable-4.97 -# Desc: is weird editable -mi_gdb_test "-var-show-attributes weird" \ - "\\^done,attr=\"editable\"" \ - "is weird editable" - -# Test: c_variable-4.98 -# Desc: is weird->int_ptr_ptr editable -mi_gdb_test "-var-show-attributes weird->int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird->int_ptr_ptr editable" - -# Test: c_variable-4.99 -# Desc: is *(weird->int_ptr_ptr) editable -mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird.int_ptr_ptr.*int_ptr_ptr editable" - -# Test: c_variable-4.100 -# Desc: is *(*(weird->int_ptr_ptr)) editable -mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable" - -# Test: c_variable-4.101 -# Desc: is weird->u1 editable -mi_gdb_test "-var-show-attributes weird.u1" \ - "\\^done,attr=\"noneditable\"" \ - "is weird.u1 editable" - -# Test: c_variable-4.102 -# Desc: is weird->s2 editable -mi_gdb_test "-var-show-attributes weird.s2" \ - "\\^done,attr=\"noneditable\"" \ - "is weird.s2 editable" - -# Test: c_variable-4.103 -# Desc: is struct_declarations.u1.a editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.a" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.a editable" - -# Test: c_variable-4.104 -# Desc: is struct_declarations.u1.b editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.b" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.b editable" - -# Test: c_variable-4.105 -# Desc: is struct_declarations.u1.c editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.c" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.c editable" - -# Test: c_variable-4.106 -# Desc: is struct_declarations.long_array editable -mi_gdb_test "-var-show-attributes struct_declarations.long_array" \ - "\\^done,attr=\"noneditable\"" \ - "is struct_declarations.long_array editable" - -# Test: c_variable-4.107 -# Desc: is struct_declarations.long_array[0] editable -mi_gdb_test "-var-show-attributes struct_declarations.long_array.0" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.long_array.0 editable" - -# Test: c_variable-4.108 -# Desc: is struct_declarations editable -mi_gdb_test "-var-show-attributes struct_declarations" \ - "\\^done,attr=\"noneditable\"" \ - "is struct_declarations editable" - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"24\"" \ - "delete var weird" - -##### ##### -# # -# children and update tests # -# # -##### ##### - -# Test: c_variable-5.1 -# Desc: check that nothing changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars. None changed" - -# Step over "struct_declarations.integer = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"193\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.2 -# Desc: check that integer changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.integer\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.integer" - -# Step over: -# weird->char_ptr = "hello"; -# bar = 2121; -# foo = &bar; - -send_gdb "-exec-step 3\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"196\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.3 -# Desc: check that char_ptr changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.char_ptr" - -# Step over "struct_declarations.int_ptr_ptr = &foo;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"197\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.4 -# Desc: check that int_ptr_ptr and children changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars int_ptr_ptr and children changed" - -# Step over "weird->long_array[0] = 1234;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"198\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.5 -# Desc: check that long_array[0] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.0\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.0 changed" - -# Step over "struct_declarations.long_array[1] = 2345;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"199\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.6 -# Desc: check that long_array[1] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.1\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.1 changed" - -# Step over "weird->long_array[2] = 3456;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"200\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.7 -# Desc: check that long_array[2] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.2\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.2 changed" - -# Step over: -# struct_declarations.long_array[3] = 4567; -# weird->long_array[4] = 5678; -# struct_declarations.long_array[5] = 6789; -# weird->long_array[6] = 7890; -# struct_declarations.long_array[7] = 8901; -# weird->long_array[8] = 9012; -# struct_declarations.long_array[9] = 1234; -send_gdb "-exec-step 7\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"208\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.8 -# Desc: check that long_array[3-9] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.3-9 changed" - - -# Step over "weird->func_ptr = nothing;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"211\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.9 -# Desc: check that func_ptr changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.func_ptr changed" - -# Delete all variables -mi_gdb_test "-var-delete struct_declarations" \ - "\\^done,ndeleted=\"65\"" \ - "delete var struct_declarations" - -mi_gdb_test "-var-delete weird->int_ptr_ptr" \ - "\\^done,ndeleted=\"3\"" \ - "delete var weird->int_ptr_ptr" - -# Step over all lines: -# ... -# psnp = &snp0; -send_gdb "-exec-step 43\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"254\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.10 -# Desc: create psnp->char_ptr -mi_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \ - "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"" \ - "create local variable psnp->char_ptr" - -# Test: c_variable-5.11 -# Desc: children of psnp->char_ptr -mi_gdb_test "-var-list-children psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr\",exp=\"\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\"\}\}" \ - "get children of psnp->char_ptr" - -# Test: c_variable-5.12 -# Desc: number of children of psnp->char_ptr -mi_gdb_test "-var-info-num-children psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr" - -# Test: c_variable-5.13 -# Desc: children of *(psnp->char_ptr) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",exp=\"\\*\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr" - -# Test: c_variable-5.14 -# Desc: number of children of *(psnp->char_ptr) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr" - -# Test: c_variable-5.15 -# Desc: children of *(*(psnp->char_ptr)) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.15B -# Desc: children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*\\*psnp->char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.16 -# Desc: number of children of *(*(psnp->char_ptr)) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.17 -# Desc: children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*\\*psnp->char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" - -# Test: c_variable-5.18 -# Desc: number of children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" - -# Test: c_variable-5.17B -# Desc: children of *(*(*(*(psnp->char_ptr)))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" - -# Test: c_variable-5.18B -# Desc: number of children of *(*(*(*(psnp->char_ptr)))) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" - - -# Test: c_variable-5.19 -# Desc: create psnp->long_ptr -mi_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \ - "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"" \ - "create local variable psnp->long_ptr" - -# Test: c_variable-5.20 -# Desc: children of psnp->long_ptr -mi_gdb_test "-var-list-children psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr\",exp=\"\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\"\}\}" \ - "get children of psnp->long_ptr" - -# Test: c_variable-5.21 -# Desc: number of children of psnp->long_ptr -mi_gdb_test "-var-info-num-children psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr" - -# Test: c_variable-5.22 -# Desc: children of *(psnp->long_ptr) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",exp=\"\\*\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr" - - -# Test: c_variable-5.23 -# Desc: number of children of *(psnp->long_ptr) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr" - -# Test: c_variable-5.24 -# Desc: children of *(*(psnp->long_ptr)) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",exp=\"\\*\\*\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" - -# Test: c_variable-5.25 -# Desc: number of children of *(*(psnp->long_ptr)) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" - -# Test: c_variable-5.26 -# Desc: children of *(*(*(psnp->long_ptr))) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",exp=\"\\*\\*\\*\\*psnp->long_ptr\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" - -# Test: c_variable-5.27 -# Desc: number of children of *(*(*(psnp->long_ptr))) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" - -# Test: c_variable-5.28 -# Desc: children of *(*(*(*(psnp->long_ptr)))) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" - -# Test: c_variable-5.29 -# Desc: number of children of *(*(*(*(psnp->long_ptr)))) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" - -# Test: c_variable-5.30 -# Desc: create psnp->ptrs -mi_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \ - "\\^done,name=\"psnp->ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \ - "create local variable psnp->ptrs" - -# Test: c_variable-5.31 -# Desc: children of psnp->ptrs -mi_gdb_test "-var-list-children psnp->ptrs" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"psnp->ptrs.0\",exp=\"0\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.1\",exp=\"1\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.2\",exp=\"2\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs" - -# Test: c_variable-5.32 -# Desc: number of children of psnp->ptrs -mi_gdb_test "-var-info-num-children psnp->ptrs" \ - "\\^done,numchild=\"3\"" \ - "get number of children of psnp->ptrs" - -# Test: c_variable-5.33 -# Desc: children of psnp->ptrs[0] -mi_gdb_test "-var-list-children psnp->ptrs.0" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0" - -# Test: c_variable-5.34 -# Desc: number of children of psnp->ptrs[0] -mi_gdb_test "-var-info-num-children psnp->ptrs.0" \ - "\\^done,numchild=\"4\"" \ - "get number of children of psnp->ptrs.0" - -# Test: c_variable-5.35 -# Desc: children of psnp->ptrs[0]->next -mi_gdb_test "-var-list-children psnp->ptrs.0.next" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next" - -#} {char_ptr long_ptr ptrs next} - -# Test: c_variable-5.36 -# Desc: number of children of psnp->ptrs[0]->next -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \ - "\\^done,numchild=\"4\"" \ - "get number of children of psnp->ptrs.0.next" - - -# Test: c_variable-5.37 -# Desc: children of psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",exp=\"\\*char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr" - -#gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} { -# get_children psnp->ptrs.0.next.char_ptr -#} {*char_ptr} - -# Test: c_variable-5.38 -# Desc: number of children of psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr" - -# Test: c_variable-5.39 -# Desc: children of *psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",exp=\"\\*\\*char_ptr\",numchild=\"1\",type=\"char \\*\\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr" - -# Test: c_variable-5.40 -# Desc: number of children of *psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr" - -# Test: c_variable-5.41 -# Desc: children of **psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.41B -# Desc: children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.42 -# Desc: number of children of **psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.43 -# Desc: children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.44 -# Desc: number of children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.43B -# Desc: children of ****psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.44B -# Desc: number of children of ****psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.45 -# Desc: children of psnp->ptrs[0]->next->next -mi_gdb_test "-var-list-children psnp->ptrs.0.next.next" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.next.next.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.next.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next.next.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.next" - -# Test: c_variable-5.46 -# Desc: children of psnp->ptrs[0]->next->next->ptrs -mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"psnp->ptrs.0.next.next.ptrs.0\",exp=\"0\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs.1\",exp=\"1\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs.2\",exp=\"2\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.next.ptrs" - -# Step over "snp0.char_ptr = &b3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"255\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.47 -# Desc: check that psnp->char_ptr (and [0].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->char_ptr (and 0.char_ptr) changed" - -# Step over "snp1.char_ptr = &c3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"256\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - - -# Test: c_variable-5.48 -# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->char_ptr (and 1.char_ptr) changed" - - -# Step over "snp2.char_ptr = &a3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"257\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - - -# Test: c_variable-5.49 -# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.next.char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed" - - -# Step over "snp0.long_ptr = &y3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"258\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - -# Test: c_variable-5.50 -# Desc: check that psnp->long_ptr (and [0].long_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->long_ptr (and 0.long_ptr) changed" - - -# Step over "snp1.long_ptr = &x3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"259\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - - -# Test: c_variable-5.51 -# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed -# Why does this have a FIXME? -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "FIXME\\^done,changelist=\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->long_ptr (and 1.long_ptr) changed" -clear_xfail *-*-* - -# This command produces this error message: -# &"warning: varobj_list: assertion failed - mycount <> 0\n" -# - -# Step over "snp2.long_ptr = &z3;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_children_tests" - } - timeout { - fail "step at do_children_tests (timeout)" - } -} - - -# Test: c_variable-5.52 -# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed" - - - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-var-cmd.exp b/gdb/testsuite/gdb.mi/mi0-var-cmd.exp deleted file mode 100644 index d28186c8c6d..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-var-cmd.exp +++ /dev/null @@ -1,523 +0,0 @@ -# Copyright (C) 1999, 2000, 2002 Cygnus Solutions -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -##### ##### -# # -# Variable Creation tests # -# # -##### ##### - -# Test: c_variable-1.1 -# Desc: Create global variable - -mi_gdb_test "111-var-create global_simple * global_simple" \ - "111\\^done,name=\"global_simple\",numchild=\"6\",type=\"simpleton\"" \ - "create global variable" - -# Test: c_variable-1.2 -# Desc: Create non-existent variable - -mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create non-existent variable" - -# Test: c_variable-1.3 -# Desc: Create out of scope variable - -mi_gdb_test "113-var-create argc * argc" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create out of scope variable" - -mi_gdb_test "200-break-insert do_locals_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_locals_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run todo_locals_tests (2)"} - timeout {fail "run to do_locals_tests (timeout 2)"} -} - -# Test: c_variable-1.4 -# Desc: create local variables - -mi_gdb_test "-var-create linteger * linteger" \ - "\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \ - "create local variable linteger" - -mi_gdb_test "-var-create lpinteger * lpinteger" \ - "\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \ - "create local variable lpinteger" - -mi_gdb_test "-var-create lcharacter * lcharacter" \ - "\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \ - "create local variablelcharacter " - -mi_gdb_test "-var-create lpcharacter * lpcharacter" \ - "\\^done,name=\"lpcharacter\",numchild=\"1\",type=\"char \\*\"" \ - "create local variable lpcharacter" - -mi_gdb_test "-var-create llong * llong" \ - "\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \ - "create local variable llong" - -mi_gdb_test "-var-create lplong * lplong" \ - "\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \ - "create local variable lplong" - -mi_gdb_test "-var-create lfloat * lfloat" \ - "\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \ - "create local variable lfloat" - -mi_gdb_test "-var-create lpfloat * lpfloat" \ - "\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \ - "create local variable lpfloat" - -mi_gdb_test "-var-create ldouble * ldouble" \ - "\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \ - "create local variable ldouble" - -mi_gdb_test "-var-create lpdouble * lpdouble" \ - "\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \ - "create local variable lpdouble" - -mi_gdb_test "-var-create lsimple * lsimple" \ - "\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \ - "create local variable lsimple" - -mi_gdb_test "-var-create lpsimple * lpsimple" \ - "\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \ - "create local variable lpsimple" - -mi_gdb_test "-var-create func * func" \ - "\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"" \ - "create local variable func" - -# Test: c_variable-1.5 -# Desc: create lsimple.character -mi_gdb_test "-var-create lsimple.character * lsimple.character" \ - "\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \ - "create lsimple.character" - -# Test: c_variable-1.6 -# Desc: create lpsimple->integer -mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \ - "\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \ - "create lsimple->integer" - -# Test: c_variable-1.7 -# Desc: ceate lsimple.integer -mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \ - "\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \ - "create lsimple->integer" - - -# Test: c_variable-1.9 -# Desc: create type name -# Type names (like int, long, etc..) are all proper expressions to gdb. -# make sure variable code does not allow users to create variables, though. -mi_gdb_test "-var-create int * int" \ - "&\"Attempt to use a type name as an expression.mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create int" - - -##### ##### -# # -# Value changed tests # -# # -##### ##### - -# Test: c_variable-2.1 -# Desc: check whether values changed at do_block_tests -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars" - -# Step over "linteger = 1234;" -mi0_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test" - -# Test: c_variable-2.2 -# Desc: check whether only linteger changed values -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: linteger changed" - -# Step over "lpinteger = &linteger;" -mi0_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)" - -# Test: c_variable-2.3 -# Desc: check whether only lpinteger changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lpinteger changed" - -# Step over "lcharacter = 'a';" -mi0_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)" - -# Test: c_variable-2.4 -# Desc: check whether only lcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lcharacter changed" - -# Step over "lpcharacter = &lcharacter;" -mi0_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)" - -# Test: c_variable-2.5 -# Desc: check whether only lpcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lpcharacter changed" - - -# Step over: -# llong = 2121L; -# lplong = &llong; -# lfloat = 2.1; -# lpfloat = &lfloat; -# ldouble = 2.718281828459045; -# lpdouble = &ldouble; -# lsimple.integer = 1234; -# lsimple.unsigned_integer = 255; -# lsimple.character = 'a'; - -mi0_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "119" "" "step at do_locals_tests (5)" - -# Test: c_variable-2.6 -# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, -# lsimple.unsigned_character lsimple.integer lsimple.character changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\",name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\",name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",name=\"lplong\",in_scope=\"true\",type_changed=\"false\",name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: many changed" - -# Step over: -# lsimple.signed_character = 21; -# lsimple.char_ptr = &lcharacter; -# lpsimple = &lsimple; -# func = nothing; - -mi0_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "125" "" "step at do_locals_tests (6)" - -# Test: c_variable-2.7 -# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"func\",in_scope=\"true\",type_changed=\"false\",name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: func and lpsimple changed" - -# Step over -# linteger = 4321; -# lcharacter = 'b'; -# llong = 1212L; -# lfloat = 1.2; -# ldouble = 5.498548281828172; -# lsimple.integer = 255; -# lsimple.unsigned_integer = 4321; -# lsimple.character = 'b'; - -mi0_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "133" "" "step at do_locals_tests (7)" - -# Test: c_variable-2.8 -# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, -# lpsimple.integer lsimple.character changed -# Note: this test also checks that lpsimple->integer and lsimple.integer have -# changed (they are the same) -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",name=\"llong\",in_scope=\"true\",type_changed=\"false\",name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: func and lpsimple changed" - - -### -# -# Test assignment to variables. More tests on assignment are in other files. -# -### -mi_gdb_test "-var-assign global_simple 0" \ - "&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \ - "assign to global_simple" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger" - -mi_gdb_test "-var-evaluate-expression linteger" \ - "\\^done,value=\"3333\"" \ - "eval linteger" - -mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-evaluate-expression lpinteger" \ - "\\^done,value=\"$hex\"" \ - "eval lpinteger" - -# reset the values to the original ones so that the rest of the file doesn't suffer. - -mi_gdb_test "-var-assign linteger 4321" \ - "\\^done,value=\"4321\"" \ - "assign to linteger" - -mi_gdb_test "-var-assign lpinteger &linteger" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-assign lcharacter 'z'" \ - "\\^done,value=\"122 'z'\"" \ - "assign to lcharacter" - -mi_gdb_test "-var-evaluate-expression lcharacter" \ - "\\^done,value=\"122 'z'\"" \ - "eval lcharacter" - -mi_gdb_test "-var-assign llong 1313L" \ - "\\^done,value=\"1313\"" \ - "assign to llong" -mi_gdb_test "-var-evaluate-expression llong" \ - "\\^done,value=\"1313\"" \ - "eval llong" -mi_gdb_test "-var-assign llong 1212L" \ - "\\^done,value=\"1212\"" \ - "assign to llong" - -mi_gdb_test "-var-assign lplong &llong+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" -mi_gdb_test "-var-evaluate-expression lplong" \ - "\\^done,value=\"$hex\"" \ - "eval lplong" -mi_gdb_test "-var-assign lplong &llong" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" - -mi_gdb_test "-var-assign lfloat 3.4567" \ - "\\^done,value=\"3.45.*\"" \ - "assign to lfloat" -mi_gdb_test "-var-evaluate-expression lfloat" \ - "\\^done,value=\"3.45.*\"" \ - "eval lfloat" -mi_gdb_test "-var-assign lfloat 1.2345" \ - "\\^done,value=\"1.23.*\"" \ - "assign to lfloat" - -mi_gdb_test "-var-assign lpfloat &lfloat+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lpfloat" - -mi_gdb_test "-var-assign ldouble 5.333318284590435" \ - "\\^done,value=\"5.333318284590435\"" \ - "assign to ldouble" - -mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex <do_block_tests>\"" \ - "assign to func" - -mi_gdb_test "-var-assign lsimple.character 'd'" \ - "\\^done,value=\"100 'd'\"" \ - "assign to lsimple.character" - -mi_gdb_test "-var-assign lsimple->integer 222" \ - "\\^done,value=\"222\"" \ - "assign to lsimple->integer" - -mi_gdb_test "-var-assign lsimple.integer 333" \ - "\\^done,value=\"333\"" \ - "assign to lsimple.integer" - -###### -# End of assign tests -##### - -mi_gdb_test "-break-insert subroutine1" \ - "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \ - "break-insert subroutine1" -mi0_continue_to "2" "subroutine1" \ - "\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \ - "var-cmd.c" "146" "continue to subroutine1" - -# Test: c_variable-2.10 -# Desc: create variable for locals i,l in subroutine1 -mi_gdb_test "-var-create i * i" \ - "\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \ - "create i" - -mi_gdb_test "-var-create l * l" \ - "\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \ - "create l" - -# Test: c_variable-2.11 -# Desc: create do_locals_tests local in subroutine1 -mi_gdb_test "-var-create linteger * linteger" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create linteger" - -mi0_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "147" "step at subroutine1" - -# Test: c_variable-2.12 -# Desc: change global_simple.integer -# Note: This also tests whether we are reporting changes in structs properly. -# gdb normally would say that global_simple has changed, but we -# special case that, since it is not what a human expects to -# see. - -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \ - "update all vars: changed FIXME" -clear_xfail *-*-* - -mi0_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "148" "step at subroutine1 (2)" - -# Test: c_variable-2.13 -# Desc: change subroutine1 local i -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: i changed" - -mi0_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "149" "step at subroutine1 (3)" - -# Test: c_variable-2.14 -# Desc: change do_locals_tests local llong -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: llong changed" - -mi0_next_to "do_locals_tests" "" "var-cmd.c" "136" "next out of subroutine1" - -# Test: c_variable-2.15 -# Desc: check for out of scope subroutine1 locals -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"l\",in_scope=\"false\",name=\"i\",in_scope=\"false\"\}" \ - "update all vars: all now out of scope" - -# Done with locals/globals tests. Erase all variables -#delete_all_variables -mi_gdb_test "-var-delete global_simple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var" - -mi_gdb_test "-var-delete linteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var linteger" - -mi_gdb_test "-var-delete lpinteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpinteger" - -mi_gdb_test "-var-delete lcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lcharacter" - -mi_gdb_test "-var-delete lpcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpcharacter" - -mi_gdb_test "-var-delete llong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var llong" - -mi_gdb_test "-var-delete lplong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lplong" - -mi_gdb_test "-var-delete lfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lfloat" - -mi_gdb_test "-var-delete lpfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpfloat" - -mi_gdb_test "-var-delete ldouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var ldouble" - -mi_gdb_test "-var-delete lpdouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpdouble" - -mi_gdb_test "-var-delete lsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple" - -mi_gdb_test "-var-delete lpsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpsimple" - -mi_gdb_test "-var-delete func" \ - "\\^done,ndeleted=\"1\"" \ - "delete var func" - -mi_gdb_test "-var-delete lsimple.character" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.character" - -mi_gdb_test "-var-delete lsimple->integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple->integer" - -mi_gdb_test "-var-delete lsimple.integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.integer" - -mi_gdb_test "-var-delete i" \ - "\\^done,ndeleted=\"1\"" \ - "delete var i" - -mi_gdb_test "-var-delete l" \ - "\\^done,ndeleted=\"1\"" \ - "delete var l" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-var-display.exp b/gdb/testsuite/gdb.mi/mi0-var-display.exp deleted file mode 100644 index a0330ef788d..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-var-display.exp +++ /dev/null @@ -1,627 +0,0 @@ -# Copyright (C) 1999 2000 Cygnus Solutions -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_gdb_test "200-break-insert 260" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"260\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_children_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"} - timeout {fail "run to do_children_tests (timeout 2)"} -} - -##### ##### -# # -# Display tests # -# # -##### ##### - -# Test: c_variable-6.1 -# Desc: create variable bar -mi_gdb_test "-var-create bar * bar" \ - "\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \ - "create local variable bar" - -# Test: c_variable-6.2 -# Desc: type of variable bar -mi_gdb_test "-var-info-type bar" \ - "\\^done,type=\"int\"" \ - "info type variable bar" - -# Test: c_variable-6.3 -# Desc: format of variable bar -mi_gdb_test "-var-show-format bar" \ - "\\^done,format=\"natural\"" \ - "show format variable bar" - -# Test: c_variable-6.4 -# Desc: value of variable bar -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"2121\"" \ - "eval variable bar" - -# Test: c_variable-6.5 -# Desc: change format of bar to hex -mi_gdb_test "-var-set-format bar hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable bar" - -# Test: c_variable-6.6 -# Desc: value of bar with new format -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"0x849\"" \ - "eval variable bar with new format" - -# Test: c_variable-6.7 -# Desc: change value of bar -mi_gdb_test "-var-assign bar 3" \ - "\\^done,value=\"0x3\"" \ - "assing to variable bar" - -mi_gdb_test "-var-set-format bar decimal" \ - "\\^done,format=\"decimal\"" \ - "set format variable bar" - -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"3\"" \ - "eval variable bar with new value" - -mi_gdb_test "-var-delete bar" \ - "\\^done,ndeleted=\"1\"" \ - "delete var bar" - -# Test: c_variable-6.11 -# Desc: create variable foo -mi_gdb_test "-var-create foo * foo" \ - "\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \ - "create local variable foo" - -# Test: c_variable-6.12 -# Desc: type of variable foo -mi_gdb_test "-var-info-type foo" \ - "\\^done,type=\"int \\*\"" \ - "info type variable foo" - -# Test: c_variable-6.13 -# Desc: format of variable foo -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"natural\"" \ - "show format variable foo" - -# Test: c_variable-6.14 -# Desc: value of variable foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"$hex\"" \ - "eval variable foo" - -# Test: c_variable-6.15 -# Desc: change format of var to octal -mi_gdb_test "-var-set-format foo octal" \ - "\\^done,format=\"octal\"" \ - "set format variable foo" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"octal\"" \ - "show format variable foo" - -# Test: c_variable-6.16 -# Desc: value of foo with new format -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"\[0-7\]+\"" \ - "eval variable foo" - -# Test: c_variable-6.17 -# Desc: change value of foo -mi_gdb_test "-var-assign foo 3" \ - "\\^done,value=\"03\"" \ - "assing to variable foo" - -mi_gdb_test "-var-set-format foo decimal" \ - "\\^done,format=\"decimal\"" \ - "set format variable foo" - -# Test: c_variable-6.18 -# Desc: check new value of foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"3\"" \ - "eval variable foo" - -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -# Test: c_variable-6.21 -# Desc: create variable weird and children -mi_gdb_test "-var-create weird * weird" \ - "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \ - "create local variable weird" - -mi_gdb_test "-var-list-children weird" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\(\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\(\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\(\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children local variable weird" - - -# Test: c_variable-6.23 -# Desc: change format of weird.func_ptr and weird.func_ptr_ptr -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr_ptr" - -# Test: c_variable-6.24 -# Desc: format of weird and children -mi_gdb_test "-var-set-format weird natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird" - -mi_gdb_test "-var-set-format weird.integer natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.integer" - -mi_gdb_test "-var-set-format weird.character natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.character" - -mi_gdb_test "-var-set-format weird.char_ptr natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.char_ptr" - -mi_gdb_test "-var-set-format weird.long_int natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.long_int" - -mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.int_ptr_ptr" - -mi_gdb_test "-var-set-format weird.long_array natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.long_array" - -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr_struct" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-set-format weird.u1 natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.u1" - -mi_gdb_test "-var-set-format weird.s2 natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.s2" - -# Test: c_variable-6.25 -# Desc: value of weird and children -#gdbtk_test c_variable-6.25 {value of weird and children} { -# set values {} -# foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { -# lappend values [value $v $f] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.26 -# Desc: change format of weird and children to octal -#gdbtk_test c_variable-6.26 {change format of weird and children to octal} { -# set formats {} -# foreach v [lsort [array names var]] { -# $var($v) format octal -# lappend formats [$var($v) format] -# } - -# set formats -#} {octal octal octal octal octal octal octal octal octal octal octal octal} - -# Test: c_variable-6.27 -# Desc: value of weird and children with new format -#gdbtk_test c_variable-6.27 {value of foo with new format} { -# set values {} -# foreach v [lsort [array names var]] { -# lappend values [value $v o] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.30 -# Desc: create more children of weird -#gdbtk_test c_variable-6.30 {create more children of weird} { -# foreach v [array names var] { -# get_children $v -# } - -# # Do it twice to get more children -# foreach v [array names var] { -# get_children $v -# } - -# lsort [array names var] -#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d} - -# Test: c_variable-6.31 -# Desc: check that all children of weird change -# Ok, obviously things like weird.s2 and weird.u1 will not change! -#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} { -# $var(weird) value 0x2121 -# check_update -#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}} - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"12\"" \ - "delete var weird" - - -##### ##### -# # -# Special Display Tests # -# # -##### ##### - -# Stop in "do_special_tests" -mi_gdb_test "200-break-insert do_special_tests" \ - "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"282\",times=\"0\"\}" \ - "break-insert operation" - -send_gdb "-exec-continue\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\{\},file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" { - pass "continue to do_special_tests" - } - timeout { - fail "continue to do_special_tests (timeout)" - } -} - -# Test: c_variable-7.10 -# Desc: create union u -mi_gdb_test "-var-create u * u" \ - "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \ - "create local variable u" - -# Test: c_variable-7.11 -# Desc: value of u -mi_gdb_test "-var-evaluate-expression u" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable u" - -# Test: c_variable-7.12 -# Desc: type of u -mi_gdb_test "-var-info-type u" \ - "\\^done,type=\"union named_union\"" \ - "info type variable u" - -# Test: c_variable-7.13 -# Desc: is u editable -mi_gdb_test "-var-show-attributes u" \ - "\\^done,attr=\"noneditable\"" \ - "is u editable" - -# Test: c_variable-7.14 -# Desc: number of children of u -mi_gdb_test "-var-info-num-children u" \ - "\\^done,numchild=\"2\"" \ - "get number of children of u" - -# Test: c_variable-7.15 -# Desc: children of u -mi_gdb_test "-var-list-children u" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"u.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"u.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of u" - -# Test: c_variable-7.20 -# Desc: create anonu -mi_gdb_test "-var-create anonu * anonu" \ - "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \ - "create local variable anonu" - -# Test: c_variable-7.21 -# Desc: value of anonu -mi_gdb_test "-var-evaluate-expression anonu" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anonu" - -# Test: c_variable-7.22 -# Desc: type of anonu -mi_gdb_test "-var-info-type anonu" \ - "\\^done,type=\"union \{\\.\\.\\.\}\"" \ - "info type variable anonu" - -# Test: c_variable-7.23 -# Desc: is anonu editable -mi_gdb_test "-var-show-attributes anonu" \ - "\\^done,attr=\"noneditable\"" \ - "is anonu editable" - -# Test: c_variable-7.24 -# Desc: number of children of anonu -mi_gdb_test "-var-info-num-children anonu" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anonu" - -# Test: c_variable-7.25 -# Desc: children of anonu -mi_gdb_test "-var-list-children anonu" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"anonu.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anonu.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anonu.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of anonu" - -# Test: c_variable-7.30 -# Desc: create struct s -mi_gdb_test "-var-create s * s" \ - "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \ - "create local variable s" - - -# Test: c_variable-7.31 -# Desc: value of s -mi_gdb_test "-var-evaluate-expression s" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable s" - -# Test: c_variable-7.32 -# Desc: type of s -mi_gdb_test "-var-info-type s" \ - "\\^done,type=\"struct _simple_struct\"" \ - "info type variable s" - -# Test: c_variable-7.33 -# Desc: is s editable -mi_gdb_test "-var-show-attributes s" \ - "\\^done,attr=\"noneditable\"" \ - "is s editable" - -# Test: c_variable-7.34 -# Desc: number of children of s -mi_gdb_test "-var-info-num-children s" \ - "\\^done,numchild=\"6\"" \ - "get number of children of s" - -# Test: c_variable-7.35 -# Desc: children of s -mi_gdb_test "-var-list-children s" \ - "\\^done,numchild=\"6\",children=\{child=\{name=\"s.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"s.unsigned_integer\",exp=\"unsigned_integer\",numchild=\"0\",type=\"unsigned int\"\},child=\{name=\"s.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"s.signed_character\",exp=\"signed_character\",numchild=\"0\",type=\"signed char\"\},child=\{name=\"s.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"s.array_of_10\",exp=\"array_of_10\",numchild=\"10\",type=\"int \\\[10\\\]\"\}\}" \ - "get children of s" -#} {integer unsigned_integer character signed_character char_ptr array_of_10} - -# Test: c_variable-7.40 -# Desc: create anons -mi_gdb_test "-var-create anons * anons" \ - "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \ - "create local variable anons" - -# Test: c_variable-7.41 -# Desc: value of anons -mi_gdb_test "-var-evaluate-expression anons" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anons" - -# Test: c_variable-7.42 -# Desc: type of anons -mi_gdb_test "-var-info-type anons" \ - "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ - "info type variable anons" - -# Test: c_variable-7.43 -# Desc: is anons editable -mi_gdb_test "-var-show-attributes anons" \ - "\\^done,attr=\"noneditable\"" \ - "is anons editable" - -# Test: c_variable-7.44 -# Desc: number of children of anons -mi_gdb_test "-var-info-num-children anons" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anons" - -# Test: c_variable-7.45 -# Desc: children of anons -mi_gdb_test "-var-list-children anons" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"anons.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anons.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anons.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of anons" - - -# Test: c_variable-7.50 -# Desc: create enum e -mi_gdb_test "-var-create e * e" \ - "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \ - "create local variable e" - -setup_xfail "*-*-*" -# Test: c_variable-7.51 -# Desc: value of e -mi_gdb_test "-var-evaluate-expression e" \ - "\\^done,value=\"FIXME\"" \ - "eval variable e" -clear_xfail "*-*-*" - -# Test: c_variable-7.52 -# Desc: type of e -mi_gdb_test "-var-info-type e" \ - "\\^done,type=\"enum foo\"" \ - "info type variable e" - -# Test: c_variable-7.53 -# Desc: is e editable -mi_gdb_test "-var-show-attributes e" \ - "\\^done,attr=\"editable\"" \ - "is e editable" - -# Test: c_variable-7.54 -# Desc: number of children of e -mi_gdb_test "-var-info-num-children e" \ - "\\^done,numchild=\"0\"" \ - "get number of children of e" - -# Test: c_variable-7.55 -# Desc: children of e -mi_gdb_test "-var-list-children e" \ - "\\^done,numchild=\"0\"" \ - "get children of e" - -# Test: c_variable-7.60 -# Desc: create anone -mi_gdb_test "-var-create anone * anone" \ - "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \ - "create local variable anone" - -setup_xfail "*-*-*" -# Test: c_variable-7.61 -# Desc: value of anone -mi_gdb_test "-var-evaluate-expression anone" \ - "\\^done,value=\"A\"" \ - "eval variable anone" -clear_xfail "*-*-*" - - -# Test: c_variable-7.70 -# Desc: create anone -mi_gdb_test "-var-create anone * anone" \ - "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \ - "create duplicate local variable anone" - - -# Test: c_variable-7.72 -# Desc: type of anone -mi_gdb_test "-var-info-type anone" \ - "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ - "info type variable anone" - - -# Test: c_variable-7.73 -# Desc: is anone editable -mi_gdb_test "-var-show-attributes anone" \ - "\\^done,attr=\"editable\"" \ - "is anone editable" - -# Test: c_variable-7.74 -# Desc: number of children of anone -mi_gdb_test "-var-info-num-children anone" \ - "\\^done,numchild=\"0\"" \ - "get number of children of anone" - -# Test: c_variable-7.75 -# Desc: children of anone -mi_gdb_test "-var-list-children anone" \ - "\\^done,numchild=\"0\"" \ - "get children of anone" - - -# Record fp - -send_gdb "p/x \$fp\n" -gdb_expect { - -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { - pass "print FP register" - set fp $expect_out(1,string) - } -# -re ".*" { fail "print FP register"} - timeout { fail "print FP register (timeout)"} -} - -mi_gdb_test "200-break-insert incr_a" \ - "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"85\",times=\"0\"\}" \ - "break-insert operation" -send_gdb "-exec-continue\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\{\{name=\"a\",value=\"2\.*\"\}\},file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" { - pass "continue to incr_a" - } - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\{\{name=\"a\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" { - fail "continue to incr_a (compiler debug info incorrect)" - } - -re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" { - fail "continue to incr_a (unknown output)" - } - timeout { - fail "continue to incr_a (timeout)" - } -} - -# Test: c_variable-7.81 -# Desc: Create variables in different scopes -mi_gdb_test "-var-create a1 * a" \ - "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \ - "create local variable a1" - -mi_gdb_test "-var-create a2 $fp a" \ - "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \ - "create variable a2 in different scope" - -#gdbtk_test c_variable-7.81 {create variables in different scopes} { -# set a1 [gdb_variable create -expr a] -# set a2 [gdb_variable create -expr a -frame $fp] - -# set vals {} -# lappend vals [$a1 value] -# lappend vals [$a2 value] -# set vals -#} {2 1} - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi0-watch.exp b/gdb/testsuite/gdb.mi/mi0-watch.exp deleted file mode 100644 index 8932cd9754c..00000000000 --- a/gdb/testsuite/gdb.mi/mi0-watch.exp +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi0" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_watchpoint_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert a watchpoint and list - # Tests: - # -break-watch C - # -break-list - - mi_gdb_test "111-break-watch C" \ - "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \ - "break-watch operation" - - mi_gdb_test "222-break-list" \ - "222\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\}" \ - "list of watchpoints" - -} - -# UNUSED at the time -proc test_awatch_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert an access watchpoint and list it - # Tests: - # -break-watch -a A - # -break-list - - mi_gdb_test "333-break-watch -a A" \ - "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \ - "break-watch -a operation" - - mi_gdb_test "444-break-list" \ - "444\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \ - "list of watchpoints awatch" - - mi_gdb_test "777-break-delete 3" \ - "777\\^done" \ - "delete access watchpoint" -} - -# UNUSED at the time -proc test_rwatch_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert a read watchpoint and list it. - # Tests: - # -break-insert -r B - # -break-list - - mi_gdb_test "200-break-watch -r C" \ - "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert -r operation" - - mi_gdb_test "300-break-list" \ - "300\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete 4" \ - "177\\^done" \ - "delete read watchpoint" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - - mi_gdb_test "300-break-insert callee4" \ - "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "insert breakpoint at callee4" - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \ - { pass "run to callee4" } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} - } -} - -proc test_watchpoint_triggering {} { - global mi_gdb_prompt - global hex - - # Continue execution until the watchpoint is reached, continue again, - # to see the watchpoint go out of scope. - # Does: - # -exec-continue (Here wp triggers) - # -exec-continue (Here wp goes out of scope) - - send_gdb "222-exec-continue\n" - gdb_expect { - -re "222\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "watchpoint trigger" - } - -re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"} - timeout {fail "watchpoint trigger (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (1)"} - timeout {fail "watchpoint trigger (timeout 1)"} - } - - send_gdb "223-exec-continue\n" - gdb_expect { - -re "223\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\{.*\},file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" { - pass "wp out of scope" - } - -re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"} - timeout {fail "wp out of scope (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "wp out of scope (1)"} - timeout {fail "wp out of scope (timeout 1)"} - } -} - -test_running_the_program -test_watchpoint_creation_and_listing -#test_rwatch_creation_and_listing -#test_awatch_creation_and_listing -test_watchpoint_triggering - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-simplerun.exp b/gdb/testsuite/gdb.mi/mi1-simplerun.exp index ecb13651da7..bef690532f0 100644 --- a/gdb/testsuite/gdb.mi/mi1-simplerun.exp +++ b/gdb/testsuite/gdb.mi/mi1-simplerun.exp @@ -140,7 +140,7 @@ proc test_controlled_execution {} { # FIXME: A string argument is not printed right; should be fixed and # we should look for the right thing here. - mi_run_to "exec-step 3" "end-stepping-range" "callee4" "" \ + mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \ "basics.c" "8" "" "step to callee4" # FIXME: A string argument is not printed right; should be fixed and diff --git a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp b/gdb/testsuite/gdb.mi/mi1-var-cmd.exp index 2938c7a0aac..566d6141d93 100644 --- a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi1-var-cmd.exp @@ -227,7 +227,7 @@ mi_gdb_test "-var-update *" \ # lsimple.unsigned_integer = 255; # lsimple.character = 'a'; -mi_run_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ +mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ "var-cmd.c" "119" "" "step at do_locals_tests (5)" # Test: c_variable-2.6 @@ -243,7 +243,7 @@ mi_gdb_test "-var-update *" \ # lpsimple = &lsimple; # func = nothing; -mi_run_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ +mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ "var-cmd.c" "125" "" "step at do_locals_tests (6)" # Test: c_variable-2.7 @@ -262,7 +262,7 @@ mi_gdb_test "-var-update *" \ # lsimple.unsigned_integer = 4321; # lsimple.character = 'b'; -mi_run_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ +mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ "var-cmd.c" "133" "" "step at do_locals_tests (7)" # Test: c_variable-2.8 diff --git a/gdb/testsuite/gdb.threads/killed.c b/gdb/testsuite/gdb.threads/killed.c new file mode 100644 index 00000000000..6cb3928a346 --- /dev/null +++ b/gdb/testsuite/gdb.threads/killed.c @@ -0,0 +1,24 @@ +#include <sys/types.h> +#include <signal.h> +#include <pthread.h> +#include <stdio.h> + +int pid; + +void * +child_func (void *dummy) +{ + kill (pid, SIGKILL); + exit (1); +} + +int +main () +{ + pthread_t child; + + pid = getpid (); + pthread_create (&child, 0, child_func, 0); + for (;;) + sleep (10000); +} diff --git a/gdb/testsuite/gdb.threads/killed.exp b/gdb/testsuite/gdb.threads/killed.exp new file mode 100644 index 00000000000..21e03aab5ec --- /dev/null +++ b/gdb/testsuite/gdb.threads/killed.exp @@ -0,0 +1,97 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@gnu.org + +# This is a regression test for gdb/568 in the sources.redhat.com +# GNATS database. As of early June 2002, GDB could get sort of wedged +# debugging the program `killed.c': +# +# $ $D6/gdb/gdb -nw killed +# GNU gdb 2002-06-11-cvs +# Copyright 2002 Free Software Foundation, Inc. +# GDB is free software, covered by the GNU General Public License, and you are +# welcome to change it and/or distribute copies of it under certain conditions. +# Type "show copying" to see the conditions. +# There is absolutely no warranty for GDB. Type "show warranty" for details. +# This GDB was configured as "i686-pc-linux-gnu"... +# (gdb) run +# Starting program: /home/jimb/foo/play/killed +# [New Thread 1024 (LWP 6487)] +# [New Thread 2049 (LWP 6488)] +# [New Thread 1026 (LWP 6489)] +# Cannot find user-level thread for LWP 6487: generic error +# (gdb) quit +# The program is running. Exit anyway? (y or n) y +# Cannot find thread 2049: generic error +# (gdb) kill +# Kill the program being debugged? (y or n) y +# Cannot find thread 2049: generic error +# (gdb) The program is running. Exit anyway? (y or n) y +# Cannot find thread 2049: generic error +# (gdb) +# [7]+ Stopped $D6/gdb/gdb -nw killed +# $ kill %7 +# +# [7]+ Stopped $D6/gdb/gdb -nw killed +# $ kill -9 %7 +# +# [7]+ Stopped $D6/gdb/gdb -nw killed +# $ +# [7]+ Killed $D6/gdb/gdb -nw killed +# $ + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "killed" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}/${subdir}"]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "run" "" "run program to completion" + +# Try to quit. +send_gdb "quit\n" +gdb_expect { + -re "The program is running. Exit anyway\\? \\(y or n\\) $" { + send_gdb "y\n" + exp_continue + } + eof { + pass "GDB exits after multi-threaded program exits messily" + } + -re "Cannot find thread ${decimal}: generic error\[\r\n\]*$gdb_prompt $" { + # setup_kfail "gdb/568" + fail "GDB exits after multi-threaded program exits messily (not a regression; gdb/568)" + } + timeout { + fail "GDB exits after multi-threaded program exits messily (timeout)" + } +} diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f4ddc63214d..aae73657a5f 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1665,7 +1665,7 @@ proc gdb_continue_to_end {mssg} { # Don't bother to check the output of the program, that may be # extremely tough for some remote systems. gdb_test "continue"\ - "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|)Program exited normally\\..*"\ + "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Program exited normally\\.).*"\ "continue until exit at $mssg" } } @@ -1685,6 +1685,10 @@ proc rerun_to_main {} { } else { send_gdb "run\n" gdb_expect { + -re "The program .* has been started already.*y or n. $" { + send_gdb "y\n" + exp_continue + } -re "Starting program.*$gdb_prompt $"\ {pass "rerun to main" ; return 0} -re "$gdb_prompt $"\ diff --git a/gdb/testsuite/lib/insight-support.exp b/gdb/testsuite/lib/insight-support.exp index 42d14a9a27a..cbdf163c85f 100644 --- a/gdb/testsuite/lib/insight-support.exp +++ b/gdb/testsuite/lib/insight-support.exp @@ -54,7 +54,15 @@ proc gdbtk_start {test} { gdb_stop_suppressing_tests; - verbose "Starting $GDB -nx -q --tclcommand=$test" + # Need to convert ::GDB to use (-)?insight... + if {[regsub {gdb$} $GDB insight newGDB]} { + set INSIGHT $newGDB + } else { + perror "Cannot find Insight executable" + exit 1 + } + + verbose "Starting $INSIGHT -nx -q --tclcommand=$test" set real_test [which $test] if {$real_test == 0} { @@ -63,8 +71,8 @@ proc gdbtk_start {test} { } if {![is_remote host]} { - if { [which $GDB] == 0 } { - perror "$GDB does not exist." + if { [which $INSIGHT] == 0 } { + perror "$INSIGHT does not exist." exit 1 } } @@ -91,9 +99,9 @@ proc gdbtk_start {test} { set env(GDBTK_VERBOSE) 1 set env(GDBTK_LOGFILE) [to_tcl_path [file join $objdir gdb.log]] - set err [catch {exec $GDB -nx -q --tclcommand=$test} res] + set err [catch {exec $INSIGHT -nx -q --tclcommand=$test} res] if { $err } { - perror "Execing $GDB failed: $res" + perror "Execing $INSIGHT failed: $res" append res "\nERROR gdb-crash" } return $res diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index a8ccd953441..a517c168a81 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -633,8 +633,12 @@ proc mi_run_to_main { } { mi_runto main } + # Just like gdb's "runto" proc, it will run the target to a given -# function. +# function. The big difference here between mi_runto and mi_execute_to +# is that mi_execute_to must have the inferior running already. This +# proc will (like gdb's runto) (re)start the inferior, too. +# # FUNC is the linespec of the place to stop (it inserts a breakpoint here). # It returns: # -1 if test suppressed, failed, timedout @@ -648,20 +652,10 @@ proc mi_runto {func} { global mi_gdb_prompt expect_out global hex decimal - global MIFLAGS set test "mi runto $func" - set version 2 - scan $MIFLAGS "\-i=mi%d" version - if {$version < 2} { - # MI0 or MI1 - set bp_result "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" - } else { - # MI2+ - set bp_result "=breakpoint-create,number=\"\[0-9\]\"\r\n200\\^done" - } mi_gdb_test "200-break-insert $func" \ - $bp_result \ + "\(=breakpoint-create,number=\"\[0-9\]+\")\r\n200\\^done" \ "breakpoint at $func" if {![regexp {number="[0-9]+"} $expect_out(buffer) str] @@ -687,7 +681,7 @@ proc mi_runto {func} { # Next to the next statement -# For return values, see mi_run_to_helper +# For return values, see mi_execute_to_helper proc mi_next { test } { return [mi_next_to {.*} {.*} {.*} {.*} $test] @@ -695,7 +689,7 @@ proc mi_next { test } { # Step to the next statement -# For return values, see mi_run_to_helper +# For return values, see mi_execute_to_helper proc mi_step { test } { return [mi_step_to {.*} {.*} {.*} {.*} $test] @@ -707,7 +701,7 @@ proc mi_step { test } { # Can not match -re ".*\r\n${mi_gdb_prompt}", because of false positives # after the first prompt is printed. -proc mi_run_to_helper { cmd reason func args file line extra test } { +proc mi_execute_to_helper { cmd reason func args file line extra test } { global suppress_flag if { $suppress_flag } { return -1 @@ -736,56 +730,56 @@ proc mi_run_to_helper { cmd reason func args file line extra test } { } } -proc mi_run_to { cmd reason func args file line extra test } { - mi_run_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \ +proc mi_execute_to { cmd reason func args file line extra test } { + mi_execute_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \ "$file" "$line" "$extra" "$test" } proc mi_next_to { func args file line test } { - mi_run_to "exec-next" "end-stepping-range" "$func" "$args" \ + mi_execute_to "exec-next" "end-stepping-range" "$func" "$args" \ "$file" "$line" "" "$test" } proc mi_step_to { func args file line test } { - mi_run_to "exec-step" "end-stepping-range" "$func" "$args" \ + mi_execute_to "exec-step" "end-stepping-range" "$func" "$args" \ "$file" "$line" "" "$test" } proc mi_finish_to { func args file line result ret test } { - mi_run_to "exec-finish" "function-finished" "$func" "$args" \ + mi_execute_to "exec-finish" "function-finished" "$func" "$args" \ "$file" "$line" \ ",gdb-result-var=\"$result\",return-value=\"$ret\"" \ "$test" } proc mi_continue_to { bkptno func args file line test } { - mi_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \ + mi_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \ "$func" "$args" "$file" "$line" "" "$test" } -proc mi0_run_to { cmd reason func args file line extra test } { - mi_run_to_helper "$cmd" "$reason" "$func" "\{$args\}" \ +proc mi0_execute_to { cmd reason func args file line extra test } { + mi_execute_to_helper "$cmd" "$reason" "$func" "\{$args\}" \ "$file" "$line" "$extra" "$test" } proc mi0_next_to { func args file line test } { - mi0_run_to "exec-next" "end-stepping-range" "$func" "$args" \ + mi0_execute_to "exec-next" "end-stepping-range" "$func" "$args" \ "$file" "$line" "" "$test" } proc mi0_step_to { func args file line test } { - mi0_run_to "exec-step" "end-stepping-range" "$func" "$args" \ + mi0_execute_to "exec-step" "end-stepping-range" "$func" "$args" \ "$file" "$line" "" "$test" } proc mi0_finish_to { func args file line result ret test } { - mi0_run_to "exec-finish" "function-finished" "$func" "$args" \ + mi0_execute_to "exec-finish" "function-finished" "$func" "$args" \ "$file" "$line" \ ",gdb-result-var=\"$result\",return-value=\"$ret\"" \ "$test" } proc mi0_continue_to { bkptno func args file line test } { - mi0_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \ + mi0_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \ "$func" "$args" "$file" "$line" "" "$test" } diff --git a/gdb/thread.c b/gdb/thread.c index 4fac1331495..f24b1e72953 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -265,7 +265,7 @@ do_captured_list_thread_ids (struct ui_out *uiout, prune_threads (); target_find_new_threads (); - ui_out_list_begin (uiout, "thread-ids"); + ui_out_tuple_begin (uiout, "thread-ids"); for (tp = thread_list; tp; tp = tp->next) { @@ -273,7 +273,7 @@ do_captured_list_thread_ids (struct ui_out *uiout, ui_out_field_int (uiout, "thread-id", tp->num); } - ui_out_list_end (uiout); + ui_out_tuple_end (uiout); ui_out_field_int (uiout, "number-of-threads", num); return GDB_RC_OK; } diff --git a/gdb/top.c b/gdb/top.c index 4d3b7719cb0..9201e39f399 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -83,7 +83,7 @@ int inhibit_gdbinit = 0; /* If nonzero, and GDB has been configured to be able to use windows, attempt to open them upon startup. */ -int use_windows = 1; +int use_windows = 0; extern char lang_frame_mismatch_warn[]; /* language.c */ @@ -1958,6 +1958,7 @@ init_main (void) get_gdb_completer_word_break_characters (); rl_completer_quote_characters = get_gdb_completer_quote_characters (); rl_readline_name = "gdb"; + rl_terminal_name = getenv ("TERM"); /* The name for this defun comes from Bash, where it originated. 15 is Control-o, the same binding this function has in Bash. */ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 976f9259cdd..2d12f31d57b 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2071,10 +2071,12 @@ trace_find_tracepoint_command (char *args, int from_tty) if (target_is_remote ()) { if (args == 0 || *args == 0) - if (tracepoint_number == -1) - error ("No current tracepoint -- please supply an argument."); - else - tdp = tracepoint_number; /* default is current TDP */ + { + if (tracepoint_number == -1) + error ("No current tracepoint -- please supply an argument."); + else + tdp = tracepoint_number; /* default is current TDP */ + } else tdp = parse_and_eval_long (args); diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 0e19a122e12..e2bc95fe455 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,182 @@ +2002-09-29 Elena Zannoni <ezannoni@redhat.com> + + * tui.c (tui_show_source): Don't access current_source_symtab, use + accessor function instead. Include source.h and symtab.h + * tuiDisassem.c (tuiShowDisassemAndUpdateSource, + tuiVerticalDisassemScroll): Use accessor functions for current + source line and symtab. Include source.h. + * tuiLayout.c (_extractDisplayStartAddr): Use accessor functions + for current source line and symtab. Include source.h. + * tuiWin.c (_makeVisibleWithNewHeight): Ditto. + * tuiSourceWin.c (tuiUpdateSourceWindowAsIs, + tuiHorizontalSourceScroll): Ditto. + * tuiSource.c (tuiVerticalSourceScroll): Ditto. + +2002-09-13 Stephane Carrez <stcarrez@nerim.fr> + + * tui.c (tui_rl_switch_mode): Remove unecessary TUI switch printfs. + (tui_initialize_readline): Allow to use space to leave SingleKey + to enter one gdb command. + (tui_enable): Restore the TUI keymap when we are back to TUI. + (tui_disable): Restore normal keymap when leaving TUI. + * tuiIO.c (tui_redisplay_readline): Restore the SingleKey mode + when the buffer becomes empty and we are in tui_one_command_mode. + +2002-09-13 Stephane Carrez <stcarrez@nerim.fr> + + * tuiIO.c (tui_setup_io): rl_already_prompted must be cleared + when leaving TUI mode so that gdb prompt is displayed. + +2002-09-13 Stephane Carrez <stcarrez@nerim.fr> + + * tuiStack.c (tui_make_status_line): Make sure the local buffer + is large enough to hold the complete line. + +2002-09-10 Stephane Carrez <stcarrez@nerim.fr> + + * tui-hooks.c (tui_event_loop): New function. + (tui_command_loop): New function to override gdb loop and make sure + uiout is set according to TUI mode. + (tui_command_loop): Install the specific TUI command hook. + * tuiIO.c (tui_initialize_io): Initialize tui_old_uiout. + (tui_uiout, tui_old_uiout): Make public. + * tuiIO.h (tui_uiout, tui_old_uiout): Declare. + +2002-09-04 Stephane Carrez <stcarrez@nerim.fr> + + * tuiIO.c (tui_putc): New function to print one character. + (printable_part): New function from readline/complete.c. + (PUTX): New macro, likewise. + (print_filename): New function, likewise. + (get_y_or_n): New function, likewise and adapted for TUI. + (tui_rl_display_match_list): New function from readline/complete.c + and writes on TUI command window. + (tui_setup_io): Install or remove the readline hook + rl_completion_display_matches_hook so that completion is written + directly in TUI command window instead of in the TUI pipe. + (tui_initialize_io): Use #ifdef TUI_USE_PIPE_FOR_READLINE for the + TUI redirection pipe. + (tui_getc): Likewise for call to tui_readline_output. + (tui_readline_output): Likewise for function. + * tui.c (tui_rl_startup_hook): Always take care of gdb prompt. + +2002-09-02 Stephane Carrez <stcarrez@nerim.fr> + + * tuiWin.c (_newHeightOk): Fix compilation warnings. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * tuiWin.c (_tuiAllWindowsInfo): Don't crash if the window + is not displayed. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * tui-out.c (tui_out_new): Clear start_of_line. + * tuiSource.c (tuiVerticalSourceScroll): Use print_source_lines + to update the current source line. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * tui-hooks.c (tui_detach_hook): New hook to know when a process dies. + (tui_install_hooks): Install it. + (tui_remove_hooks): Remove it. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * tuiData.h (FILE_PREFIX): Don't define. + (blankStr, locationStr, breakStr): Don't declare. + (breakLocationStr, nullStr, historyLimit, setHistoryLimitTo): Likewise. + (displayableWinContentOf, displayableWinContentAt): Likewise. + (winElementHeight, winByName, freeAllWindows): Likewise. + + * tuiData.c (blankStr, locationStr, breakStr): Remove. + (breakLocationStr, nullStr, historyLimit, setHistoryLimitTo): Remove. + (displayableWinContentOf, displayableWinContentAt): Remove. + (winElementHeight, winByName, freeAllWindows): Remove. + +2002-09-01 Stephane Carrez <stcarrez@nerim.fr> + + * tuiStack.c (tui_make_status_line): New function to create the + status line. + (tuiShowLocatorContent): Use it instead of displayableWinContentAt. + * tuiData.h (PROC_PREFIX): Use "In:" to reduce length of prefix. + (PC_PREFIX): Use upper case. + (SINGLE_KEY, MIN_LINE_WIDTH, MIN_PROC_WIDTH): Define. + (MAX_TARGET_WIDTH, MAX_PID_WIDTH): Define. + +2002-08-31 Stephane Carrez <stcarrez@nerim.fr> + + * tuiSourceWin.h (tuiUpdateAllExecInfos): Don't declare. + (tuiClearAllExecInfosContent): Likewise. + (tuiEraseAllExecInfosContent): Ditto. + (tuiUpdateSourceWindowsFromLocator): Ditto. + * tuiSourceWin.c (tuiUpdateAllExecInfos): Remove. + * tui.h (tui_vCheckDataValues): Don't declare. + (tui_vStartNewLines, tui_vAllSetHasBreakAt): Likewise. + (tui_vUpdateLocatorFilename, tui_vUpdateSourceWindowsWithAddr): Ditto. + (tui_vShowFrameInfo): Ditto. + +2002-08-31 Stephane Carrez <stcarrez@nerim.fr> + + * tui.c (tui_commands): Table of single key commands. + (tui_rl_command_key): New function to execute gdb command. + (tui_rl_command_mode): New function to temporarily leave SingleKey. + (tui_rl_next_keymap): New function to enter/leave the SingleKey mode. + (tui_rl_startup_hook): New function to avoid prompt display by + readline functions. + (tui_set_key_mode): New function to set the key mode and install + the readline keymap. + (tui_initialize_readline): Create TUI SingleKey readline map. + (tui_enable): Install rl_startup_hook. + (tui_disable): Remove it. + * tui.h (enum tui_key_mode): Declare. + (tui_set_key_mode, tui_current_key_mode): Declare. + * tuiIO.c (tui_redisplay_readline): Don't display the prompt in + SingleKey mode. + * tuiIO.h (tui_redisplay_readline): Declare. + +2002-08-31 Stephane Carrez <stcarrez@nerim.fr> + + * tuiSourceWin.c (tuiSetIsExecPointAt): Redraw the previous and + current line. + +2002-08-31 Stephane Carrez <stcarrez@nerim.fr> + + * tuiSource.c (tuiSetSourceContent): Remove old breakpoint code. + (_hasBreak): Remove. + (tuiShowSource): Fix comment indentation. + (tuiSourceIsDisplayed): Likewise. + (tuiVerticalSourceScroll): Likewise. + +2002-08-30 Stephane Carrez <stcarrez@nerim.fr> + + * tuiSourceWin.h (tui_update_all_breakpoint_info): Declare. + (tui_update_breakpoint_info): Declare. + (tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove. + + * tuiSourceWin.c (tuiUpdateSourceWindowAsIs): Update breakpoint + information using tui_update_breakpoint_info. + (tui_update_all_breakpoint_info): New function to refresh all + execution windows. + (tui_update_breakpoint_info): New function to recompute the status + of exec info window from breakpoints. + (tuiSetHasBreakAt, tuiAllSetHasBreakAt): Remove. + (tuiSetExecInfoContent): Use the exec info flags computed by + tui_update_breakpoint_info to display a short status about breakpoints. + + * tuiData.h (TuiExecInfoContent): New for exec info string. + (TuiWhichElement): Use it. + (TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT): New defines. + (TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): New defines. + (TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS): Likewise. + (TUI_EXECINFO_SIZE): Likewise. + * tuiData.c (initContentElement): Clear exec info string. + + * tui-hooks.c (get_breakpoint): Remove. + (tui_event_create_breakpoint): Call tui_update_all_breakpoint_info. + (tui_event_delete_breakpoint): Likewise. + (tui_event_modify_breakpoint): Likewise. + 2002-08-29 Stephane Carrez <stcarrez@nerim.fr> * tui.c (tuiGetLowDisassemblyAddress): Moved from here. diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index d6051942a23..3beca39c782 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -46,9 +46,13 @@ #include "target.h" #include "gdbcore.h" #include "event-loop.h" +#include "event-top.h" #include "frame.h" #include "breakpoint.h" #include "gdb-events.h" +#include "ui-out.h" +#include "top.h" +#include <readline/readline.h> #include <unistd.h> #include <fcntl.h> @@ -66,6 +70,8 @@ int tui_target_has_run = 0; static void (* tui_target_new_objfile_chain) (struct objfile*); extern void (*selected_frame_level_changed_hook) (int); +static void tui_event_loop (void); +static void tui_command_loop (void); static void tui_new_objfile_hook (struct objfile* objfile) @@ -167,44 +173,12 @@ tui_register_changed_hook (int regno) } } -extern struct breakpoint *breakpoint_chain; - -/* Find a breakpoint given its number. Returns null if not found. */ -static struct breakpoint * -get_breakpoint (int number) -{ - struct breakpoint *bp; - - for (bp = breakpoint_chain; bp; bp = bp->next) - { - if (bp->number == number) - return bp; - } - return 0; -} - /* Breakpoint creation hook. Update the screen to show the new breakpoint. */ static void tui_event_create_breakpoint (int number) { - struct breakpoint *bp; - - bp = get_breakpoint (number); - if (bp) - { - switch (bp->type) - { - case bp_breakpoint: - case bp_hardware_breakpoint: - tuiAllSetHasBreakAt (bp, 1); - tuiUpdateAllExecInfos (); - break; - - default: - break; - } - } + tui_update_all_breakpoint_info (); } /* Breakpoint deletion hook. @@ -212,35 +186,13 @@ tui_event_create_breakpoint (int number) static void tui_event_delete_breakpoint (int number) { - struct breakpoint *bp; - struct breakpoint *b; - int clearIt; - - bp = get_breakpoint (number); - if (bp == 0) - return; - - /* Before turning off the visuals for the bp, check to see that - there are no other bps at the same address. */ - clearIt = 0; - for (b = breakpoint_chain; b; b = b->next) - { - clearIt = (b == bp || b->address != bp->address); - if (!clearIt) - break; - } - - if (clearIt) - { - tuiAllSetHasBreakAt (bp, 0); - tuiUpdateAllExecInfos (); - } + tui_update_all_breakpoint_info (); } static void tui_event_modify_breakpoint (int number) { - ; + tui_update_all_breakpoint_info (); } static void @@ -331,6 +283,15 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line, tuiShowFrameInfo (selected_frame); } +/* Called when the target process died or is detached. + Update the status line. */ +static void +tui_detach_hook (void) +{ + tuiShowFrameInfo (0); + tui_display_main (); +} + /* Install the TUI specific hooks. */ void tui_install_hooks (void) @@ -346,6 +307,7 @@ tui_install_hooks (void) registers_changed_hook = tui_registers_changed_hook; register_changed_hook = tui_register_changed_hook; + detach_hook = tui_detach_hook; } /* Remove the TUI specific hooks. */ @@ -358,6 +320,7 @@ tui_remove_hooks (void) query_hook = 0; registers_changed_hook = 0; register_changed_hook = 0; + detach_hook = 0; /* Restore the previous event hooks. */ set_gdb_event_hooks (tui_old_event_hooks); @@ -372,6 +335,86 @@ tui_exit (void) tui_disable (); } +/* Initialize all the necessary variables, start the event loop, + register readline, and stdin, start the loop. */ +static void +tui_command_loop (void) +{ + int length; + char *a_prompt; + char *gdb_prompt = get_prompt (); + + /* If we are using readline, set things up and display the first + prompt, otherwise just print the prompt. */ + if (async_command_editing_p) + { + /* Tell readline what the prompt to display is and what function it + will need to call after a whole line is read. This also displays + the first prompt. */ + length = strlen (PREFIX (0)) + strlen (gdb_prompt) + strlen (SUFFIX (0)) + 1; + a_prompt = (char *) xmalloc (length); + strcpy (a_prompt, PREFIX (0)); + strcat (a_prompt, gdb_prompt); + strcat (a_prompt, SUFFIX (0)); + rl_callback_handler_install (a_prompt, input_handler); + } + else + display_gdb_prompt (0); + + /* Now it's time to start the event loop. */ + tui_event_loop (); +} + +/* Start up the event loop. This is the entry point to the event loop + from the command loop. */ + +static void +tui_event_loop (void) +{ + /* Loop until there is nothing to do. This is the entry point to the + event loop engine. gdb_do_one_event, called via catch_errors() + will process one event for each invocation. It blocks waits for + an event and then processes it. >0 when an event is processed, 0 + when catch_errors() caught an error and <0 when there are no + longer any event sources registered. */ + while (1) + { + int result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL); + if (result < 0) + break; + + /* Update gdb output according to TUI mode. Since catch_errors + preserves the uiout from changing, this must be done at top + level of event loop. */ + if (tui_active) + uiout = tui_out; + else + uiout = tui_old_uiout; + + if (result == 0) + { + /* FIXME: this should really be a call to a hook that is + interface specific, because interfaces can display the + prompt in their own way. */ + display_gdb_prompt (0); + /* This call looks bizarre, but it is required. If the user + entered a command that caused an error, + after_char_processing_hook won't be called from + rl_callback_read_char_wrapper. Using a cleanup there + won't work, since we want this function to be called + after a new prompt is printed. */ + if (after_char_processing_hook) + (*after_char_processing_hook) (); + /* Maybe better to set a flag to be checked somewhere as to + whether display the prompt or not. */ + } + } + + /* We are done with the event loop. There are no more event sources + to listen to. So we exit GDB. */ + return; +} + /* Initialize the tui by installing several gdb hooks, initializing the tui IO and preparing the readline with the kind binding. */ static void @@ -389,6 +432,9 @@ tui_init_hook (char *argv0) tui_initialize_io (); tui_initialize_readline (); + /* Tell gdb to use the tui_command_loop as the main loop. */ + command_loop_hook = tui_command_loop; + /* Decide in which mode to start using GDB (based on -tui). */ if (tui_version) { diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index a8cc58ba5ca..71ce5e00aa4 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -398,7 +398,7 @@ tui_out_new (struct ui_file *stream) data->stream = stream; data->suppress_output = 0; data->line = -1; - data->start_of_line = 1; + data->start_of_line = 0; return ui_out_new (&tui_ui_out_impl, data, flags); } diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index ab2c201fba6..a7c16bcbe0c 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -67,12 +67,40 @@ #include "frame.h" #include "breakpoint.h" #include "inferior.h" +#include "symtab.h" +#include "source.h" /* Tells whether the TUI is active or not. */ int tui_active = 0; static int tui_finish_init = 1; -/* Switch the output mode between TUI/standard gdb. */ +enum tui_key_mode tui_current_key_mode = tui_command_mode; + +struct tui_char_command +{ + unsigned char key; + const char* cmd; +}; + +/* Key mapping to gdb commands when the TUI is using the single key mode. */ +static const struct tui_char_command tui_commands[] = { + { 'c', "continue" }, + { 'd', "down" }, + { 'f', "finish" }, + { 'n', "next" }, + { 'r', "run" }, + { 's', "step" }, + { 'u', "up" }, + { 'v', "info locals" }, + { 'w', "where" }, + { 0, 0 }, +}; + +static Keymap tui_keymap; +static Keymap tui_readline_standard_keymap; + +/* TUI readline command. + Switch the output mode between TUI/standard gdb. */ static int tui_rl_switch_mode (void) { @@ -80,14 +108,11 @@ tui_rl_switch_mode (void) { tui_disable (); rl_prep_terminal (0); - - printf_filtered ("Left the TUI mode\n"); } else { rl_deprep_terminal (); tui_enable (); - printf_filtered ("Entered the TUI mode\n"); } /* Clear the readline in case switching occurred in middle of something. */ @@ -193,19 +218,126 @@ tui_rl_delete_other_windows (void) return 0; } +/* TUI readline command. + Execute the gdb command bound to the specified key. */ +static int +tui_rl_command_key (int count, int key) +{ + int i; + + reinitialize_more_filter (); + for (i = 0; tui_commands[i].cmd; i++) + { + if (tui_commands[i].key == key) + { + /* Must save the command because it can be modified + by execute_command. */ + char* cmd = alloca (strlen (tui_commands[i].cmd) + 1); + strcpy (cmd, tui_commands[i].cmd); + execute_command (cmd, TRUE); + return 0; + } + } + return 0; +} + +/* TUI readline command. + Temporarily leave the TUI SingleKey mode to allow editing + a gdb command with the normal readline. Once the command + is executed, the TUI SingleKey mode is installed back. */ +static int +tui_rl_command_mode (int count, int key) +{ + tui_set_key_mode (tui_one_command_mode); + return rl_insert (count, key); +} + +/* TUI readline command. + Switch between TUI SingleKey mode and gdb readline editing. */ +static int +tui_rl_next_keymap (void) +{ + tui_set_key_mode (tui_current_key_mode == tui_command_mode + ? tui_single_key_mode : tui_command_mode); + return 0; +} + +/* Readline hook to redisplay ourself the gdb prompt. + In the SingleKey mode, the prompt is not printed so that + the command window is cleaner. It will be displayed if + we temporarily leave the SingleKey mode. */ +static int +tui_rl_startup_hook () +{ + rl_already_prompted = 1; + if (tui_current_key_mode != tui_command_mode) + tui_set_key_mode (tui_single_key_mode); + tui_redisplay_readline (); + return 0; +} + +/* Change the TUI key mode by installing the appropriate readline keymap. */ +void +tui_set_key_mode (enum tui_key_mode mode) +{ + tui_current_key_mode = mode; + rl_set_keymap (mode == tui_single_key_mode + ? tui_keymap : tui_readline_standard_keymap); + tuiShowLocatorContent (); +} + /* Initialize readline and configure the keymap for the switching key shortcut. */ void tui_initialize_readline () { + int i; + Keymap tui_ctlx_keymap; + rl_initialize (); rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1); + rl_add_defun ("gdb-command", tui_rl_command_key, -1); + rl_add_defun ("next-keymap", tui_rl_next_keymap, -1); + + tui_keymap = rl_make_bare_keymap (); + tui_ctlx_keymap = rl_make_bare_keymap (); + tui_readline_standard_keymap = rl_get_keymap (); + + for (i = 0; tui_commands[i].cmd; i++) + rl_bind_key_in_map (tui_commands[i].key, tui_rl_command_key, tui_keymap); + + rl_generic_bind (ISKMAP, "\\C-x", (char*) tui_ctlx_keymap, tui_keymap); + + /* Bind all other keys to tui_rl_command_mode so that we switch + temporarily from SingleKey mode and can enter a gdb command. */ + for (i = ' '; i < 0x7f; i++) + { + int j; + + for (j = 0; tui_commands[j].cmd; j++) + if (tui_commands[j].key == i) + break; + + if (tui_commands[j].cmd) + continue; + + rl_bind_key_in_map (i, tui_rl_command_mode, tui_keymap); + } + rl_bind_key_in_map ('a', tui_rl_switch_mode, emacs_ctlx_keymap); + rl_bind_key_in_map ('a', tui_rl_switch_mode, tui_ctlx_keymap); rl_bind_key_in_map ('A', tui_rl_switch_mode, emacs_ctlx_keymap); + rl_bind_key_in_map ('A', tui_rl_switch_mode, tui_ctlx_keymap); rl_bind_key_in_map (CTRL ('A'), tui_rl_switch_mode, emacs_ctlx_keymap); + rl_bind_key_in_map (CTRL ('A'), tui_rl_switch_mode, tui_ctlx_keymap); rl_bind_key_in_map ('1', tui_rl_delete_other_windows, emacs_ctlx_keymap); + rl_bind_key_in_map ('1', tui_rl_delete_other_windows, tui_ctlx_keymap); rl_bind_key_in_map ('2', tui_rl_change_windows, emacs_ctlx_keymap); + rl_bind_key_in_map ('2', tui_rl_change_windows, tui_ctlx_keymap); + rl_bind_key_in_map ('q', tui_rl_next_keymap, tui_keymap); + rl_bind_key_in_map ('s', tui_rl_next_keymap, emacs_ctlx_keymap); + rl_bind_key_in_map ('s', tui_rl_next_keymap, tui_ctlx_keymap); } /* Enter in the tui mode (curses). @@ -255,6 +387,7 @@ tui_enable (void) /* Install the TUI specific hooks. */ tui_install_hooks (); + rl_startup_hook = tui_rl_startup_hook; tui_update_variables (); @@ -265,6 +398,8 @@ tui_enable (void) if (selected_frame) tuiShowFrameInfo (selected_frame); + /* Restore TUI keymap. */ + tui_set_key_mode (tui_current_key_mode); refresh (); /* Update gdb's knowledge of its terminal. */ @@ -282,8 +417,13 @@ tui_disable (void) if (!tui_active) return; + /* Restore initial readline keymap. */ + rl_set_keymap (tui_readline_standard_keymap); + /* Remove TUI hooks. */ tui_remove_hooks (); + rl_startup_hook = 0; + rl_already_prompted = 0; /* Leave curses and restore previous gdb terminal setting. */ endwin (); @@ -405,10 +545,11 @@ _tuiReset (void) void tui_show_source (const char *file, int line) { + struct symtab_and_line cursal = get_current_source_symtab_and_line (); /* make sure that the source window is displayed */ tuiAddWinToLayout (SRC_WIN); - tuiUpdateSourceWindowsWithLine (current_source_symtab, line); + tuiUpdateSourceWindowsWithLine (cursal.symtab, line); tuiUpdateLocatorFilename (file); } diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 9cc538d1568..ed66a4ff052 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -102,6 +102,23 @@ extern void tui_enable (void); /* Leave the tui mode. */ extern void tui_disable (void); +enum tui_key_mode +{ + /* Plain command mode to enter gdb commands. */ + tui_command_mode, + + /* SingleKey mode with some keys bound to gdb commands. */ + tui_single_key_mode, + + /* Read/edit one command and return to SingleKey after it's processed. */ + tui_one_command_mode +}; + +extern enum tui_key_mode tui_current_key_mode; + +/* Change the TUI key mode by installing the appropriate readline keymap. */ +extern void tui_set_key_mode (enum tui_key_mode mode); + extern void tui_initialize_io (void); extern void tui_initialize_readline (void); @@ -115,21 +132,10 @@ extern void tui_show_source (const char *file, int line); extern struct ui_out *tui_out_new (struct ui_file *stream); -/* tuiDataWin.c */ -extern void tui_vCheckDataValues (va_list); - -/* tuiIO.c */ -extern void tui_vStartNewLines (va_list); - /* tuiLayout.c */ extern TuiStatus tui_set_layout (const char *); /* tuiSourceWin.c */ extern void tuiUpdateAllExecInfos (void); -extern void tui_vAllSetHasBreakAt (va_list); -extern void tui_vUpdateSourceWindowsWithAddr (va_list); -/* tuiStack.c */ -extern void tui_vShowFrameInfo (va_list); -extern void tui_vUpdateLocatorFilename (va_list); #endif /* TUI_H */ diff --git a/gdb/tui/tuiData.c b/gdb/tui/tuiData.c index 45508e061b8..225583ea70c 100644 --- a/gdb/tui/tuiData.c +++ b/gdb/tui/tuiData.c @@ -40,6 +40,7 @@ #endif #include "defs.h" +#include "symtab.h" #include "tui.h" #include "tuiData.h" #include "tuiGeneralWin.h" @@ -50,24 +51,10 @@ TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS]; /*************************** -** Private Definitions -****************************/ -#define FILE_WIDTH 30 -#define PROC_WIDTH 40 -#define LINE_WIDTH 4 -#define PC_WIDTH 8 - -/*************************** ** Private data ****************************/ -static char *_tuiNullStr = TUI_NULL_STR; -static char *_tuiBlankStr = " "; -static char *_tuiLocationStr = " >"; -static char *_tuiBreakStr = " * "; -static char *_tuiBreakLocationStr = " *>"; static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT; static int _termHeight, _termWidth; -static int _historyLimit = DEFAULT_HISTORY_COUNT; static TuiGenWinInfo _locator; static TuiGenWinInfo _execInfo[2]; static TuiWinInfoPtr _srcWinList[2]; @@ -286,61 +273,6 @@ clearWinDetail (TuiWinInfoPtr winInfo) /* - ** blankStr() - ** Accessor for the blank string. - */ -char * -blankStr (void) -{ - return _tuiBlankStr; -} /* blankStr */ - - -/* - ** locationStr() - ** Accessor for the location string. - */ -char * -locationStr (void) -{ - return _tuiLocationStr; -} /* locationStr */ - - -/* - ** breakStr() - ** Accessor for the break string. - */ -char * -breakStr (void) -{ - return _tuiBreakStr; -} /* breakStr */ - - -/* - ** breakLocationStr() - ** Accessor for the breakLocation string. - */ -char * -breakLocationStr (void) -{ - return _tuiBreakLocationStr; -} /* breakLocationStr */ - - -/* - ** nullStr() - ** Accessor for the null string. - */ -char * -nullStr (void) -{ - return _tuiNullStr; -} /* nullStr */ - - -/* ** sourceExecInfoPtr(). ** Accessor for the source execution info ptr. */ @@ -375,29 +307,6 @@ locatorWinInfoPtr (void) /* - ** historyLimit(). - ** Accessor for the history limit - */ -int -historyLimit (void) -{ - return _historyLimit; -} /* historyLimit */ - - -/* - ** setHistoryLimitTo(). - ** Mutator for the history limit - */ -void -setHistoryLimitTo (int h) -{ - _historyLimit = h; - - return; -} /* setHistoryLimitTo */ - -/* ** termHeight(). ** Accessor for the termHeight */ @@ -549,189 +458,7 @@ tuiPrevWin (TuiWinInfoPtr curWin) } return prev; -} /* tuiPrevWin */ - - -/* - ** displayableWinContentOf(). - ** Answer a the content at the location indicated by index. Note - ** that if this is a locator window, the string returned should be - ** freed after use. - */ -char * -displayableWinContentOf (TuiGenWinInfoPtr winInfo, TuiWinElementPtr elementPtr) -{ - - char *string = nullStr (); - - if (elementPtr != (TuiWinElementPtr) NULL || winInfo->type == LOCATOR_WIN) - { - /* - ** Now convert the line to a displayable string - */ - switch (winInfo->type) - { - case SRC_WIN: - case DISASSEM_WIN: - string = elementPtr->whichElement.source.line; - break; - case CMD_WIN: - string = elementPtr->whichElement.command.line; - break; - case LOCATOR_WIN: - if ((string = (char *) xmalloc ( - (termWidth () + 1) * sizeof (char))) == (char *) NULL) - string = nullStr (); - else - { - char lineNo[50], pc[50], buf[50], *fname, *pname; - register int strSize = termWidth (), i, procWidth, fileWidth; - - /* - ** First determine the amount of file/proc name width - ** we have available - */ - i = strSize - (PC_WIDTH + LINE_WIDTH - + 25 /* pc and line labels */ - + strlen (FILE_PREFIX) + 1 /* file label */ - + 15 /* procedure label */ ); - if (i >= FILE_WIDTH + PROC_WIDTH) - { - fileWidth = FILE_WIDTH; - procWidth = PROC_WIDTH; - } - else - { - fileWidth = i / 2; - procWidth = i - fileWidth; - } - - /* Now convert elements to string form */ - if (elementPtr != (TuiWinElementPtr) NULL && - *elementPtr->whichElement.locator.fileName != (char) 0 && - srcWin->generic.isVisible) - fname = elementPtr->whichElement.locator.fileName; - else - fname = "??"; - if (elementPtr != (TuiWinElementPtr) NULL && - *elementPtr->whichElement.locator.procName != (char) 0) - pname = elementPtr->whichElement.locator.procName; - else - pname = "??"; - if (elementPtr != (TuiWinElementPtr) NULL && - elementPtr->whichElement.locator.lineNo > 0) - sprintf (lineNo, "%d", - elementPtr->whichElement.locator.lineNo); - else - strcpy (lineNo, "??"); - if (elementPtr != (TuiWinElementPtr) NULL && - elementPtr->whichElement.locator.addr != 0) - sprintf (pc, "0x%lx", - (long) elementPtr->whichElement.locator.addr); - else - strcpy (pc, "??"); - /* - ** Now create the locator line from the string version - ** of the elements. We could use sprintf() here but - ** that wouldn't ensure that we don't overrun the size - ** of the allocated buffer. strcat_to_buf() will. - */ - *string = (char) 0; - /* Filename */ - strcat_to_buf (string, strSize, " "); - strcat_to_buf (string, strSize, FILE_PREFIX); - if (strlen (fname) > fileWidth) - { - strncpy (buf, fname, fileWidth - 1); - buf[fileWidth - 1] = '*'; - buf[fileWidth] = (char) 0; - } - else - strcpy (buf, fname); - strcat_to_buf (string, strSize, buf); - /* procedure/class name */ - sprintf (buf, "%15s", PROC_PREFIX); - strcat_to_buf (string, strSize, buf); - if (strlen (pname) > procWidth) - { - strncpy (buf, pname, procWidth - 1); - buf[procWidth - 1] = '*'; - buf[procWidth] = (char) 0; - } - else - strcpy (buf, pname); - strcat_to_buf (string, strSize, buf); - sprintf (buf, "%10s", LINE_PREFIX); - strcat_to_buf (string, strSize, buf); - strcat_to_buf (string, strSize, lineNo); - sprintf (buf, "%10s", PC_PREFIX); - strcat_to_buf (string, strSize, buf); - strcat_to_buf (string, strSize, pc); - for (i = strlen (string); i < strSize; i++) - string[i] = ' '; - string[strSize] = (char) 0; - } - break; - case EXEC_INFO_WIN: - string = elementPtr->whichElement.simpleString; - break; - default: - break; - } - } - return string; -} /* displayableWinContentOf */ - - -/* - ** winContentAt(). - ** Answer a the content at the location indicated by index - */ -char * -displayableWinContentAt (TuiGenWinInfoPtr winInfo, int index) -{ - return (displayableWinContentOf (winInfo, (TuiWinElementPtr) winInfo->content[index])); -} /* winContentAt */ - - -/* - ** winElementHeight(). - ** Answer the height of the element in lines - */ -int -winElementHeight (TuiGenWinInfoPtr winInfo, TuiWinElementPtr element) -{ - int h; - - if (winInfo->type == DATA_WIN) -/* FOR NOW SAY IT IS ONLY ONE LINE HIGH */ - h = 1; - else - h = 1; - - return h; -} /* winElementHeight */ - - -/* - ** winByName(). - ** Answer the window represented by name - */ -TuiWinInfoPtr -winByName (char *name) -{ - TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL; - int i = 0; - - while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo)) - { - if (strcmp (name, winName (&(winList[i]->generic))) == 0) - winInfo = winList[i]; - i++; - } - - return winInfo; -} /* winByName */ +} /* @@ -888,7 +615,8 @@ initContentElement (TuiWinElementPtr element, TuiWinType type) element->whichElement.locator.addr = 0; break; case EXEC_INFO_WIN: - element->whichElement.simpleString = blankStr (); + memset(element->whichElement.simpleString, ' ', + sizeof(element->whichElement.simpleString)); break; default: break; @@ -1204,22 +932,6 @@ freeWinContent (TuiGenWinInfoPtr winInfo) } /* freeWinContent */ -/* - ** freeAllWindows(). - */ -void -freeAllWindows (void) -{ - TuiWinType type = SRC_WIN; - - for (; type < MAX_MAJOR_WINDOWS; type++) - if (m_winPtrNotNull (winList[type]) && - winList[type]->generic.type != UNDEFINED_WIN) - freeWindow (winList[type]); - return; -} /* freeAllWindows */ - - void tuiDelDataWindows (TuiWinContent content, int contentSize) { diff --git a/gdb/tui/tuiData.h b/gdb/tui/tuiData.h index 36d7853f736..8a4eb9f8908 100644 --- a/gdb/tui/tuiData.h +++ b/gdb/tui/tuiData.h @@ -71,10 +71,17 @@ TuiGenWinInfo, *TuiGenWinInfoPtr; #define MIN_WIN_HEIGHT 3 #define MIN_CMD_WIN_HEIGHT 3 -#define FILE_PREFIX "File: " -#define PROC_PREFIX "Procedure: " +/* Strings to display in the TUI status line. */ +#define PROC_PREFIX "In: " #define LINE_PREFIX "Line: " -#define PC_PREFIX "pc: " +#define PC_PREFIX "PC: " +#define SINGLE_KEY "(SingleKey)" + +/* Minimum/Maximum length of some fields displayed in the TUI status line. */ +#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line numbers. */ +#define MIN_PROC_WIDTH 12 +#define MAX_TARGET_WIDTH 10 +#define MAX_PID_WIDTH 14 #define TUI_FLOAT_REGS_NAME "$FREGS" #define TUI_FLOAT_REGS_NAME_LOWER "$fregs" @@ -200,6 +207,20 @@ typedef struct _TuiLocatorElement } TuiLocatorElement, *TuiLocatorElementPtr; +/* Flags to tell what kind of breakpoint is at current line. */ +#define TUI_BP_ENABLED 0x01 +#define TUI_BP_DISABLED 0x02 +#define TUI_BP_HIT 0x04 +#define TUI_BP_CONDITIONAL 0x08 +#define TUI_BP_HARDWARE 0x10 + +/* Position of breakpoint markers in the exec info string. */ +#define TUI_BP_HIT_POS 0 +#define TUI_BP_BREAK_POS 1 +#define TUI_EXEC_POS 2 +#define TUI_EXECINFO_SIZE 4 + +typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE]; /* An content element in a window */ typedef union @@ -209,7 +230,7 @@ typedef union TuiDataElement data; /* elements of dataWindow */ TuiCommandElement command; /* command elements */ TuiLocatorElement locator; /* locator elements */ - char *simpleString; /* simple char based elements */ + TuiExecInfoContent simpleString; /* simple char based elements */ } TuiWhichElement, *TuiWhichElementPtr; @@ -325,35 +346,23 @@ extern TuiWinContent allocContent (int, TuiWinType); extern int addContentElements (TuiGenWinInfoPtr, int); extern void initContentElement (TuiWinElementPtr, TuiWinType); extern void freeWindow (TuiWinInfoPtr); -extern void freeAllWindows (void); extern void freeWinContent (TuiGenWinInfoPtr); extern void freeDataContent (TuiWinContent, int); extern void freeAllSourceWinsContent (void); extern void tuiDelWindow (TuiWinInfoPtr); extern void tuiDelDataWindows (TuiWinContent, int); -extern TuiWinInfoPtr winByName (char *); extern TuiWinInfoPtr partialWinByName (char *); extern char *winName (TuiGenWinInfoPtr); -extern char *displayableWinContentOf (TuiGenWinInfoPtr, TuiWinElementPtr); -extern char *displayableWinContentAt (TuiGenWinInfoPtr, int); -extern int winElementHeight (TuiGenWinInfoPtr, TuiWinElementPtr); extern TuiLayoutType currentLayout (void); extern void setCurrentLayoutTo (TuiLayoutType); extern int termHeight (void); extern void setTermHeightTo (int); extern int termWidth (void); extern void setTermWidthTo (int); -extern int historyLimit (void); -extern void setHistoryLimit (int); extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int); extern TuiGenWinInfoPtr locatorWinInfoPtr (void); extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void); extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void); -extern char *nullStr (void); -extern char *blankStr (void); -extern char *locationStr (void); -extern char *breakStr (void); -extern char *breakLocationStr (void); extern TuiListPtr sourceWindows (void); extern void clearSourceWindows (void); extern void clearSourceWindowsDetail (void); diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index 50a6d0ef9f7..f79cc12ab66 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -44,6 +44,7 @@ #include "breakpoint.h" #include "frame.h" #include "value.h" +#include "source.h" #include "tui.h" #include "tuiData.h" @@ -337,7 +338,7 @@ tuiShowDisassemAndUpdateSource (CORE_ADDR startAddr) tuiUpdateSourceWindow (srcWin, sal.symtab, val, TRUE); if (sal.symtab) { - current_source_symtab = sal.symtab; + set_current_source_symtab_and_line (&sal); tuiUpdateLocatorFilename (sal.symtab->filename); } else @@ -415,12 +416,13 @@ tuiVerticalDisassemScroll (TuiScrollDirection scrollDirection, struct symtab *s; TuiLineOrAddress val; int maxLines, dir; + struct symtab_and_line cursal = get_current_source_symtab_and_line (); content = (TuiWinContent) disassemWin->generic.content; - if (current_source_symtab == (struct symtab *) NULL) + if (cursal.symtab == (struct symtab *) NULL) s = find_pc_symtab (selected_frame->pc); else - s = current_source_symtab; + s = cursal.symtab; /* account for hilite */ maxLines = disassemWin->generic.height - 2; diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c index fe389af28fe..f70df8f4748 100644 --- a/gdb/tui/tuiIO.c +++ b/gdb/tui/tuiIO.c @@ -44,6 +44,7 @@ #include "terminal.h" #include "target.h" #include "event-loop.h" +#include "event-top.h" #include "command.h" #include "top.h" #include "readline/readline.h" @@ -79,24 +80,34 @@ is as if TUI is not used. Readline also uses its original getc() function with stdin. - Note: the current readline is not clean in its management of the output. - Even if we install a redisplay handler, it sometimes writes on a stdout - file. It is important to redirect every output produced by readline, - otherwise the curses window will be garbled. This is implemented with - a pipe that TUI reads and readline writes to. A gdb input handler + Note SCz/2001-07-21: the current readline is not clean in its management of + the output. Even if we install a redisplay handler, it sometimes writes on + a stdout file. It is important to redirect every output produced by + readline, otherwise the curses window will be garbled. This is implemented + with a pipe that TUI reads and readline writes to. A gdb input handler is created so that reading the pipe is handled automatically. This will probably not work on non-Unix platforms. The best fix is - to make readline clean enougth so that is never write on stdout. */ + to make readline clean enougth so that is never write on stdout. + + Note SCz/2002-09-01: we now use more readline hooks and it seems that + with them we don't need the pipe anymore (verified by creating the pipe + and closing its end so that write causes a SIGPIPE). The old pipe code + is still there and can be conditionally removed by + #undef TUI_USE_PIPE_FOR_READLINE. */ + +/* For gdb 5.3, prefer to continue the pipe hack as a backup wheel. */ +#define TUI_USE_PIPE_FOR_READLINE +/*#undef TUI_USE_PIPE_FOR_READLINE*/ /* TUI output files. */ static struct ui_file *tui_stdout; static struct ui_file *tui_stderr; -static struct ui_out *tui_out; +struct ui_out *tui_out; /* GDB output files in non-curses mode. */ static struct ui_file *tui_old_stdout; static struct ui_file *tui_old_stderr; -static struct ui_out *tui_old_uiout; +struct ui_out *tui_old_uiout; /* Readline previous hooks. */ static Function *tui_old_rl_getc_function; @@ -109,10 +120,21 @@ static int tui_old_readline_echoing_p; Should be removed when readline is clean. */ static FILE *tui_rl_outstream; static FILE *tui_old_rl_outstream; +#ifdef TUI_USE_PIPE_FOR_READLINE static int tui_readline_pipe[2]; +#endif static unsigned int _tuiHandleResizeDuringIO (unsigned int); +static void +tui_putc (char c) +{ + char buf[2]; + + buf[0] = c; + buf[1] = 0; + tui_puts (buf); +} /* Print the string in the curses command window. */ void @@ -151,7 +173,7 @@ tui_puts (const char *string) /* Readline callback. Redisplay the command line with its prompt after readline has changed the edited text. */ -static void +void tui_redisplay_readline (void) { int prev_col; @@ -163,8 +185,16 @@ tui_redisplay_readline (void) WINDOW *w; char *prompt; int start_line; - - prompt = get_prompt (); + + /* Detect when we temporarily left SingleKey and now the readline + edit buffer is empty, automatically restore the SingleKey mode. */ + if (tui_current_key_mode == tui_one_command_mode && rl_end == 0) + tui_set_key_mode (tui_single_key_mode); + + if (tui_current_key_mode == tui_single_key_mode) + prompt = ""; + else + prompt = get_prompt (); c_pos = -1; c_line = -1; @@ -239,6 +269,7 @@ tui_deprep_terminal (void) { } +#ifdef TUI_USE_PIPE_FOR_READLINE /* Read readline output pipe and feed the command window with it. Should be removed when readline is clean. */ static void @@ -254,6 +285,193 @@ tui_readline_output (int code, gdb_client_data data) tui_puts (buf); } } +#endif + +/* Return the portion of PATHNAME that should be output when listing + possible completions. If we are hacking filename completion, we + are only interested in the basename, the portion following the + final slash. Otherwise, we return what we were passed. + + Comes from readline/complete.c */ +static char * +printable_part (pathname) + char *pathname; +{ + char *temp; + + temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL; +#if defined (__MSDOS__) + if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':') + temp = pathname + 1; +#endif + return (temp ? ++temp : pathname); +} + +/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we + are using it, check for and output a single character for `special' + filenames. Return the number of characters we output. */ + +#define PUTX(c) \ + do { \ + if (CTRL_CHAR (c)) \ + { \ + tui_puts ("^"); \ + tui_putc (UNCTRL (c)); \ + printed_len += 2; \ + } \ + else if (c == RUBOUT) \ + { \ + tui_puts ("^?"); \ + printed_len += 2; \ + } \ + else \ + { \ + tui_putc (c); \ + printed_len++; \ + } \ + } while (0) + +static int +print_filename (to_print, full_pathname) + char *to_print, *full_pathname; +{ + int printed_len = 0; + char *s; + + for (s = to_print; *s; s++) + { + PUTX (*s); + } + return printed_len; +} + +/* The user must press "y" or "n". Non-zero return means "y" pressed. + Comes from readline/complete.c */ +static int +get_y_or_n () +{ + extern int _rl_abort_internal (); + int c; + + for (;;) + { + c = rl_read_key (); + if (c == 'y' || c == 'Y' || c == ' ') + return (1); + if (c == 'n' || c == 'N' || c == RUBOUT) + return (0); + if (c == ABORT_CHAR) + _rl_abort_internal (); + beep (); + } +} + +/* A convenience function for displaying a list of strings in + columnar format on readline's output stream. MATCHES is the list + of strings, in argv format, LEN is the number of strings in MATCHES, + and MAX is the length of the longest string in MATCHES. + + Comes from readline/complete.c and modified to write in + the TUI command window using tui_putc/tui_puts. */ +static void +tui_rl_display_match_list (matches, len, max) + char **matches; + int len, max; +{ + typedef int QSFUNC (const void *, const void *); + extern int _rl_qsort_string_compare (const void*, const void*); + extern int _rl_print_completions_horizontally; + + int count, limit, printed_len; + int i, j, k, l; + char *temp; + + /* Screen dimension correspond to the TUI command window. */ + int screenwidth = cmdWin->generic.width; + + /* If there are many items, then ask the user if she really wants to + see them all. */ + if (len >= rl_completion_query_items) + { + char msg[256]; + + sprintf (msg, "\nDisplay all %d possibilities? (y or n)", len); + tui_puts (msg); + if (get_y_or_n () == 0) + { + tui_puts ("\n"); + return; + } + } + + /* How many items of MAX length can we fit in the screen window? */ + max += 2; + limit = screenwidth / max; + if (limit != 1 && (limit * max == screenwidth)) + limit--; + + /* Avoid a possible floating exception. If max > screenwidth, + limit will be 0 and a divide-by-zero fault will result. */ + if (limit == 0) + limit = 1; + + /* How many iterations of the printing loop? */ + count = (len + (limit - 1)) / limit; + + /* Watch out for special case. If LEN is less than LIMIT, then + just do the inner printing loop. + 0 < len <= limit implies count = 1. */ + + /* Sort the items if they are not already sorted. */ + if (rl_ignore_completion_duplicates == 0) + qsort (matches + 1, len, sizeof (char *), + (QSFUNC *)_rl_qsort_string_compare); + + tui_putc ('\n'); + + if (_rl_print_completions_horizontally == 0) + { + /* Print the sorted items, up-and-down alphabetically, like ls. */ + for (i = 1; i <= count; i++) + { + for (j = 0, l = i; j < limit; j++) + { + if (l > len || matches[l] == 0) + break; + else + { + temp = printable_part (matches[l]); + printed_len = print_filename (temp, matches[l]); + + if (j + 1 < limit) + for (k = 0; k < max - printed_len; k++) + tui_putc (' '); + } + l += count; + } + tui_putc ('\n'); + } + } + else + { + /* Print the sorted items, across alphabetically, like ls -x. */ + for (i = 1; matches[i]; i++) + { + temp = printable_part (matches[i]); + printed_len = print_filename (temp, matches[i]); + /* Have we reached the end of this line? */ + if (matches[i+1]) + { + if (i && (limit > 1) && (i % limit) == 0) + tui_putc ('\n'); + else + for (k = 0; k < max - printed_len; k++) + tui_putc (' '); + } + } + tui_putc ('\n'); + } +} /* Setup the IO for curses or non-curses mode. - In non-curses mode, readline and gdb use the standard input and @@ -284,6 +502,8 @@ tui_setup_io (int mode) readline_echoing_p = 0; rl_outstream = tui_rl_outstream; rl_prompt = 0; + rl_completion_display_matches_hook = tui_rl_display_match_list; + rl_already_prompted = 0; /* Keep track of previous gdb output. */ tui_old_stdout = gdb_stdout; @@ -315,7 +535,9 @@ tui_setup_io (int mode) rl_prep_term_function = tui_old_rl_prep_terminal; rl_getc_function = tui_old_rl_getc_function; rl_outstream = tui_old_rl_outstream; + rl_completion_display_matches_hook = 0; readline_echoing_p = tui_old_readline_echoing_p; + rl_already_prompted = 0; /* Save tty for SIGCONT. */ savetty (); @@ -361,8 +583,9 @@ tui_initialize_io () /* Create the default UI. It is not created because we installed a init_ui_hook. */ - uiout = cli_out_new (gdb_stdout); + tui_old_uiout = uiout = cli_out_new (gdb_stdout); +#ifdef TUI_USE_PIPE_FOR_READLINE /* Temporary solution for readline writing to stdout: redirect readline output in a pipe, read that pipe and output the content in the curses command window. */ @@ -386,8 +609,10 @@ tui_initialize_io () (void) fcntl (tui_readline_pipe[0], F_SETFL, O_NDELAY); #endif #endif - add_file_handler (tui_readline_pipe[0], tui_readline_output, 0); +#else + tui_rl_outstream = stdout; +#endif } /* Get a character from the command window. This is called from the readline @@ -400,9 +625,11 @@ tui_getc (FILE *fp) w = cmdWin->generic.handle; +#ifdef TUI_USE_PIPE_FOR_READLINE /* Flush readline output. */ tui_readline_output (GDB_READABLE, 0); - +#endif + ch = wgetch (w); ch = _tuiHandleResizeDuringIO (ch); diff --git a/gdb/tui/tuiIO.h b/gdb/tui/tuiIO.h index 2ad92ce81f1..40970b6b7e2 100644 --- a/gdb/tui/tuiIO.h +++ b/gdb/tui/tuiIO.h @@ -1,5 +1,5 @@ /* TUI support I/O functions. - Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -36,6 +36,13 @@ extern void tui_initialize_io (void); /* Get a character from the command window. */ extern int tui_getc (FILE*); +/* Readline callback. + Redisplay the command line with its prompt after readline has + changed the edited text. */ +extern void tui_redisplay_readline (void); + +extern struct ui_out *tui_out; +extern struct ui_out *tui_old_uiout; #define m_tuiStartNewLine tuiStartNewLines(1) #define m_isStartSequence(ch) (ch == 27) diff --git a/gdb/tui/tuiLayout.c b/gdb/tui/tuiLayout.c index c3eae72c3c5..cddbd14342f 100644 --- a/gdb/tui/tuiLayout.c +++ b/gdb/tui/tuiLayout.c @@ -43,6 +43,7 @@ #include "command.h" #include "symtab.h" #include "frame.h" +#include "source.h" #include <ctype.h> #include "tui.h" @@ -546,12 +547,13 @@ _extractDisplayStartAddr (void) TuiLayoutType curLayout = currentLayout (); CORE_ADDR addr; CORE_ADDR pc; + struct symtab_and_line cursal = get_current_source_symtab_and_line (); switch (curLayout) { case SRC_COMMAND: case SRC_DATA_COMMAND: - find_line_pc (current_source_symtab, + find_line_pc (cursal.symtab, srcWin->detail.sourceInfo.startLineOrAddr.lineNo, &pc); addr = pc; diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c index f844b3639d2..f682786ce9e 100644 --- a/gdb/tui/tuiSource.c +++ b/gdb/tui/tuiSource.c @@ -54,17 +54,7 @@ #include "tuiSource.h" -/***************************************** -** STATIC LOCAL FUNCTIONS FORWARD DECLS ** -******************************************/ - -static struct breakpoint *_hasBreak (char *, int); - - -/* - ** tuiSetSourceContent(). - ** Function to display source in the source window. - */ +/* Function to display source in the source window. */ TuiStatus tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) { @@ -79,10 +69,8 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS) { lineWidth = srcWin->generic.width - 1; - /* - ** Take hilite (window border) into account, when calculating - ** the number of lines - */ + /* Take hilite (window border) into account, when calculating + the number of lines */ nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo; desc = open_source_file (s); if (desc < 0) @@ -141,7 +129,6 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) { TuiWinElementPtr element = (TuiWinElementPtr) srcWin->generic.content[curLine]; - struct breakpoint *bp; /* get the first character in the line */ c = fgetc (stream); @@ -163,10 +150,8 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) } srcLine[curLen] = (char) 0; - /* - ** Set whether element is the execution point and - ** whether there is a break point on it. - */ + /* Set whether element is the execution point and + whether there is a break point on it. */ element->whichElement.source.lineOrAddr.lineNo = curLineNo; element->whichElement.source.isExecPoint = @@ -175,11 +160,6 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) s->filename) == 0 && curLineNo == ((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo); - bp = _hasBreak (s->filename, curLineNo); - element->whichElement.source.hasBreak = - (bp != (struct breakpoint *) NULL && - (!element->whichElement.source.isExecPoint || - (bp->disposition != disp_del || bp->hit_count <= 0))); if (c != EOF) { i = strlen (srcLine) - 1; @@ -199,13 +179,11 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) srcLine[i] = '?'; } else - { /* - ** Store the charcter in the line - ** buffer. If it is a tab, then - ** translate to the correct number of - ** chars so we don't overwrite our - ** buffer. - */ + { /* Store the charcter in the line + buffer. If it is a tab, then + translate to the correct number of + chars so we don't overwrite our + buffer. */ if (c == '\t') { int j, maxTabLen = tuiDefaultTabLen (); @@ -224,10 +202,8 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) srcLine[i + 1] = 0; } else - { /* - ** if we have not reached EOL, then eat - ** chars until we do - */ + { /* If we have not reached EOL, then eat + chars until we do */ while (c != EOF && c != '\n' && c != '\r') c = fgetc (stream); } @@ -257,7 +233,7 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) } } return ret; -} /* tuiSetSourceContent */ +} /* elz: this function sets the contents of the source window to empty @@ -328,44 +304,30 @@ tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string) curr_line++; } /* end while */ - -} /*tuiSetSourceContentNil */ +} - - -/* - ** tuiShowSource(). - ** Function to display source in the source window. This function - ** initializes the horizontal scroll to 0. - */ +/* Function to display source in the source window. This function + initializes the horizontal scroll to 0. */ void tuiShowSource (struct symtab *s, TuiLineOrAddress line, int noerror) { srcWin->detail.sourceInfo.horizontalOffset = 0; tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror); - - return; -} /* tuiShowSource */ +} -/* - ** tuiSourceIsDisplayed(). - ** Answer whether the source is currently displayed in the source window. - */ +/* Answer whether the source is currently displayed in the source window. */ int tuiSourceIsDisplayed (char *fname) { return (srcWin->generic.contentInUse && (strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())-> content[0])->whichElement.locator.fileName, fname) == 0)); -} /* tuiSourceIsDisplayed */ +} -/* - ** tuiVerticalSourceScroll(). - ** Scroll the source forward or backward vertically - */ +/* Scroll the source forward or backward vertically. */ void tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, int numToScroll) @@ -375,11 +337,12 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, TuiLineOrAddress l; struct symtab *s; TuiWinContent content = (TuiWinContent) srcWin->generic.content; + struct symtab_and_line cursal = get_current_source_symtab_and_line (); - if (current_source_symtab == (struct symtab *) NULL) + if (cursal.symtab == (struct symtab *) NULL) s = find_pc_symtab (selected_frame->pc); else - s = current_source_symtab; + s = cursal.symtab; if (scrollDirection == FORWARD_SCROLL) { @@ -397,39 +360,7 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, if (l.lineNo <= 0) l.lineNo = 1; } - if (identify_source_line (s, l.lineNo, 0, -1) == 1) - tuiUpdateSourceWindowAsIs (srcWin, s, l, FALSE); - } - - return; -} /* tuiVerticalSourceScroll */ - -/***************************************** -** STATIC LOCAL FUNCTIONS ** -******************************************/ - -/* - ** _hasBreak(). - ** Answer whether there is a break point at the input line in - ** the source file indicated - */ -static struct breakpoint * -_hasBreak (char *sourceFileName, int lineNo) -{ - struct breakpoint *bpWithBreak = (struct breakpoint *) NULL; - struct breakpoint *bp; - extern struct breakpoint *breakpoint_chain; - - - for (bp = breakpoint_chain; - (bp != (struct breakpoint *) NULL && - bpWithBreak == (struct breakpoint *) NULL); - bp = bp->next) - if (bp->source_file - && (strcmp (sourceFileName, bp->source_file) == 0) - && (lineNo == bp->line_number)) - bpWithBreak = bp; - - return bpWithBreak; -} /* _hasBreak */ + print_source_lines (s, l.lineNo, l.lineNo + 1, 0); + } +} diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c index b2ce594dbe3..c0c786836a3 100644 --- a/gdb/tui/tuiSourceWin.c +++ b/gdb/tui/tuiSourceWin.c @@ -45,6 +45,7 @@ #include "frame.h" #include "breakpoint.h" #include "value.h" +#include "source.h" #include "tui.h" #include "tuiData.h" @@ -120,14 +121,17 @@ tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s, } else { - tuiEraseSourceContent (winInfo, NO_EMPTY_SOURCE_PROMPT); + tui_update_breakpoint_info (winInfo, 0); tuiShowSourceContent (winInfo); tuiUpdateExecInfo (winInfo); if (winInfo->generic.type == SRC_WIN) { - current_source_line = lineOrAddr.lineNo + + struct symtab_and_line sal; + + sal.line = lineOrAddr.lineNo + (winInfo->generic.contentSize - 2); - current_source_symtab = s; + sal.symtab = s; + set_current_source_symtab_and_line (&sal); /* ** If the focus was in the asm win, put it in the src ** win if we don't have a split layout @@ -348,11 +352,12 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, { int offset; struct symtab *s; + struct symtab_and_line cursal = get_current_source_symtab_and_line (); - if (current_source_symtab == (struct symtab *) NULL) + if (cursal.symtab == (struct symtab *) NULL) s = find_pc_symtab (selected_frame->pc); else - s = current_source_symtab; + s = cursal.symtab; if (direction == LEFT_SCROLL) offset = winInfo->detail.sourceInfo.horizontalOffset + numToScroll; @@ -375,90 +380,114 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, } /* tuiHorizontalSourceScroll */ -/* - ** tuiSetHasExecPointAt(). - ** Set or clear the hasBreak flag in the line whose line is lineNo. - */ +/* Set or clear the hasBreak flag in the line whose line is lineNo. */ void tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo) { + int changed = 0; int i; TuiWinContent content = (TuiWinContent) winInfo->generic.content; i = 0; while (i < winInfo->generic.contentSize) { + int newState; + if (content[i]->whichElement.source.lineOrAddr.addr == l.addr) - content[i]->whichElement.source.isExecPoint = TRUE; + newState = TRUE; else - content[i]->whichElement.source.isExecPoint = FALSE; + newState = FALSE; + if (newState != content[i]->whichElement.source.isExecPoint) + { + changed++; + content[i]->whichElement.source.isExecPoint = newState; + tui_show_source_line (winInfo, i + 1); + } i++; } + if (changed) + tuiRefreshWin (&winInfo->generic); +} - return; -} /* tuiSetIsExecPointAt */ - -/* - ** tuiSetHasBreakAt(). - ** Set or clear the hasBreak flag in the line whose line is lineNo. - */ +/* Update the execution windows to show the active breakpoints. + This is called whenever a breakpoint is inserted, removed or + has its state changed. */ void -tuiSetHasBreakAt (struct breakpoint *bp, TuiWinInfoPtr winInfo, int hasBreak) +tui_update_all_breakpoint_info () { + TuiList* list = sourceWindows (); int i; - TuiWinContent content = (TuiWinContent) winInfo->generic.content; - i = 0; - while (i < winInfo->generic.contentSize) + for (i = 0; i < list->count; i++) { - int gotIt; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - - if (winInfo == srcWin) - { - TuiSourceInfoPtr src = &winInfo->detail.sourceInfo; + TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i]; - gotIt = (src->filename != (char *) NULL && - bp->source_file != NULL && - (strcmp (bp->source_file, src->filename) == 0) && - content[i]->whichElement.source.lineOrAddr.lineNo == - bp->line_number); - } - else - gotIt = (content[i]->whichElement.source.lineOrAddr.addr - == bp->address); - if (gotIt) - { - content[i]->whichElement.source.hasBreak = hasBreak; - break; - } - i++; + if (tui_update_breakpoint_info (win, FALSE)) + { + tuiUpdateExecInfo (win); + } } - - return; -} /* tuiSetHasBreakAt */ +} -/* - ** tuiAllSetHasBreakAt(). - ** Set or clear the hasBreak flag in all displayed source windows. - */ -void -tuiAllSetHasBreakAt (struct breakpoint *bp, int hasBreak) +/* Scan the source window and the breakpoints to update the + hasBreak information for each line. + Returns 1 if something changed and the execution window + must be refreshed. */ +int +tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only) { int i; + int need_refresh = 0; + TuiSourceInfoPtr src = &win->detail.sourceInfo; - for (i = 0; i < (sourceWindows ())->count; i++) - tuiSetHasBreakAt (bp, - (TuiWinInfoPtr) (sourceWindows ())->list[i], hasBreak); - - return; -} /* tuiAllSetHasBreakAt */ - + for (i = 0; i < win->generic.contentSize; i++) + { + struct breakpoint *bp; + extern struct breakpoint *breakpoint_chain; + int mode; + TuiSourceElement* line; + + line = &((TuiWinElementPtr) win->generic.content[i])->whichElement.source; + if (current_only && !line->isExecPoint) + continue; + + /* Scan each breakpoint to see if the current line has something to + do with it. Identify enable/disabled breakpoints as well as + those that we already hit. */ + mode = 0; + for (bp = breakpoint_chain; + bp != (struct breakpoint *) NULL; + bp = bp->next) + { + if ((win == srcWin + && bp->source_file + && (strcmp (src->filename, bp->source_file) == 0) + && bp->line_number == line->lineOrAddr.lineNo) + || (win == disassemWin + && bp->address == line->lineOrAddr.addr)) + { + if (bp->enable_state == bp_disabled) + mode |= TUI_BP_DISABLED; + else + mode |= TUI_BP_ENABLED; + if (bp->hit_count) + mode |= TUI_BP_HIT; + if (bp->cond) + mode |= TUI_BP_CONDITIONAL; + if (bp->type == bp_hardware_breakpoint) + mode |= TUI_BP_HARDWARE; + } + } + if (line->hasBreak != mode) + { + line->hasBreak = mode; + need_refresh = 1; + } + } + return need_refresh; +} -/********************************* -** EXECUTION INFO FUNCTIONS ** -*********************************/ /* ** tuiSetExecInfoContent(). @@ -483,56 +512,37 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo) { int i; + tui_update_breakpoint_info (winInfo, 1); for (i = 0; i < winInfo->generic.contentSize; i++) { TuiWinElementPtr element; TuiWinElementPtr srcElement; + int mode; element = (TuiWinElementPtr) execInfoPtr->content[i]; srcElement = (TuiWinElementPtr) winInfo->generic.content[i]; - /* - ** First check to see if we have a breakpoint that is - ** temporary. If so, and this is our current execution point, - ** then clear the break indicator. - */ - if (srcElement->whichElement.source.hasBreak && - srcElement->whichElement.source.isExecPoint) - { - struct breakpoint *bp; - int found = FALSE; - extern struct breakpoint *breakpoint_chain; - - for (bp = breakpoint_chain; - (bp != (struct breakpoint *) NULL && !found); - bp = bp->next) - { - found = - (winInfo == srcWin && - bp->line_number == - srcElement->whichElement.source.lineOrAddr.lineNo) || - (winInfo == disassemWin && - bp->address == (CORE_ADDR) - srcElement->whichElement.source.lineOrAddr.addr); - if (found) - srcElement->whichElement.source.hasBreak = - (bp->disposition != disp_del || bp->hit_count <= 0); - } - if (!found) - srcElement->whichElement.source.hasBreak = FALSE; - } - /* - ** Now update the exec info content based upon the state - ** of each line as indicated by the source content. - */ - if (srcElement->whichElement.source.hasBreak && - srcElement->whichElement.source.isExecPoint) - element->whichElement.simpleString = breakLocationStr (); - else if (srcElement->whichElement.source.hasBreak) - element->whichElement.simpleString = breakStr (); - else if (srcElement->whichElement.source.isExecPoint) - element->whichElement.simpleString = locationStr (); - else - element->whichElement.simpleString = blankStr (); + + memset(element->whichElement.simpleString, ' ', + sizeof(element->whichElement.simpleString)); + element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0; + + /* Now update the exec info content based upon the state + of each line as indicated by the source content. */ + mode = srcElement->whichElement.source.hasBreak; + if (mode & TUI_BP_HIT) + element->whichElement.simpleString[TUI_BP_HIT_POS] = + (mode & TUI_BP_HARDWARE) ? 'H' : 'B'; + else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED)) + element->whichElement.simpleString[TUI_BP_HIT_POS] = + (mode & TUI_BP_HARDWARE) ? 'h' : 'b'; + + if (mode & TUI_BP_ENABLED) + element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+'; + else if (mode & TUI_BP_DISABLED) + element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-'; + + if (srcElement->whichElement.source.isExecPoint) + element->whichElement.simpleString[TUI_EXEC_POS] = '>'; } execInfoPtr->contentSize = winInfo->generic.contentSize; } @@ -541,7 +551,7 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo) } return ret; -} /* tuiSetExecInfoContent */ +} /* @@ -605,21 +615,6 @@ tuiUpdateExecInfo (TuiWinInfoPtr winInfo) tuiShowExecInfoContent (winInfo); } /* tuiUpdateExecInfo */ - - /* - ** tuiUpdateAllExecInfos() - */ -void -tuiUpdateAllExecInfos (void) -{ - int i; - - for (i = 0; i < (sourceWindows ())->count; i++) - tuiUpdateExecInfo ((TuiWinInfoPtr) (sourceWindows ())->list[i]); - - return; -} /* tuiUpdateAllExecInfos */ - TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr winInfo) { diff --git a/gdb/tui/tuiSourceWin.h b/gdb/tui/tuiSourceWin.h index 803cb900f96..cb00449ed2d 100644 --- a/gdb/tui/tuiSourceWin.h +++ b/gdb/tui/tuiSourceWin.h @@ -22,6 +22,17 @@ #ifndef _TUI_SOURCEWIN_H #define _TUI_SOURCEWIN_H +/* Update the execution windows to show the active breakpoints. + This is called whenever a breakpoint is inserted, removed or + has its state changed. */ +extern void tui_update_all_breakpoint_info (void); + +/* Scan the source window and the breakpoints to update the + hasBreak information for each line. + Returns 1 if something changed and the execution window + must be refreshed. */ +extern int tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only); + /* Function to display the "main" routine. */ extern void tui_display_main (void); extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress, @@ -30,7 +41,6 @@ extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, TuiLineOr int); extern void tuiUpdateSourceWindowsWithAddr (CORE_ADDR); extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int); -extern void tuiUpdateSourceWindowsFromLocator (void); extern void tuiClearSourceContent (TuiWinInfoPtr, int); extern void tuiEraseSourceContent (TuiWinInfoPtr, int); extern void tuiSetSourceContentNil (TuiWinInfoPtr, char *); @@ -40,15 +50,10 @@ extern void tuiHorizontalSourceScroll (TuiWinInfoPtr, TuiScrollDirection, extern TuiStatus tuiSetExecInfoContent (TuiWinInfoPtr); extern void tuiShowExecInfoContent (TuiWinInfoPtr); extern void tuiEraseExecInfoContent (TuiWinInfoPtr); -extern void tuiEraseAllExecInfosContent (void); extern void tuiClearExecInfoContent (TuiWinInfoPtr); -extern void tuiClearAllExecInfosContent (void); extern void tuiUpdateExecInfo (TuiWinInfoPtr); -extern void tuiUpdateAllExecInfos (void); extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr); -extern void tuiSetHasBreakAt (struct breakpoint *, TuiWinInfoPtr, int); -extern void tuiAllSetHasBreakAt (struct breakpoint *, int); extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr); extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int); extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int); diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c index d3f040484c0..1d3856daa5c 100644 --- a/gdb/tui/tuiStack.c +++ b/gdb/tui/tuiStack.c @@ -44,6 +44,8 @@ #include "breakpoint.h" #include "frame.h" #include "command.h" +#include "inferior.h" +#include "target.h" #include "top.h" #include "tui.h" @@ -70,6 +72,157 @@ static void tui_set_locator_info (const char *filename, const char *procname, static void tui_update_command (char *, int); +/* Create the status line to display as much information as we + can on this single line: target name, process number, current + function, current line, current PC, SingleKey mode. */ +static char* +tui_make_status_line (TuiLocatorElement* loc) +{ + char* string; + char line_buf[50], *pname; + char* buf; + int status_size; + int i, proc_width; + const char* pid_name; + const char* pc_buf; + int target_width; + int pid_width; + int line_width; + int pc_width; + struct ui_file *pc_out; + + if (ptid_equal (inferior_ptid, null_ptid)) + pid_name = "No process"; + else + pid_name = target_pid_to_str (inferior_ptid); + + target_width = strlen (target_shortname); + if (target_width > MAX_TARGET_WIDTH) + target_width = MAX_TARGET_WIDTH; + + pid_width = strlen (pid_name); + if (pid_width > MAX_PID_WIDTH) + pid_width = MAX_PID_WIDTH; + + status_size = termWidth (); + string = (char *) xmalloc (status_size + 1); + buf = (char*) alloca (status_size + 1); + + /* Translate line number and obtain its size. */ + if (loc->lineNo > 0) + sprintf (line_buf, "%d", loc->lineNo); + else + strcpy (line_buf, "??"); + line_width = strlen (line_buf); + if (line_width < MIN_LINE_WIDTH) + line_width = MIN_LINE_WIDTH; + + /* Translate PC address. */ + pc_out = tui_sfileopen (128); + print_address_numeric (loc->addr, 1, pc_out); + pc_buf = tui_file_get_strbuf (pc_out); + pc_width = strlen (pc_buf); + + /* First determine the amount of proc name width we have available. + The +1 are for a space separator between fields. + The -1 are to take into account the \0 counted by sizeof. */ + proc_width = (status_size + - (target_width + 1) + - (pid_width + 1) + - (sizeof (PROC_PREFIX) - 1 + 1) + - (sizeof (LINE_PREFIX) - 1 + line_width + 1) + - (sizeof (PC_PREFIX) - 1 + pc_width + 1) + - (tui_current_key_mode == tui_single_key_mode + ? (sizeof (SINGLE_KEY) - 1 + 1) + : 0)); + + /* If there is no room to print the function name, try by removing + some fields. */ + if (proc_width < MIN_PROC_WIDTH) + { + proc_width += target_width + 1; + target_width = 0; + if (proc_width < MIN_PROC_WIDTH) + { + proc_width += pid_width + 1; + pid_width = 0; + if (proc_width <= MIN_PROC_WIDTH) + { + proc_width += pc_width + sizeof (PC_PREFIX) - 1 + 1; + pc_width = 0; + if (proc_width < 0) + { + proc_width += line_width + sizeof (LINE_PREFIX) - 1 + 1; + line_width = 0; + if (proc_width < 0) + proc_width = 0; + } + } + } + } + + /* Now convert elements to string form */ + pname = loc->procName; + + /* Now create the locator line from the string version + of the elements. We could use sprintf() here but + that wouldn't ensure that we don't overrun the size + of the allocated buffer. strcat_to_buf() will. */ + *string = (char) 0; + + if (target_width > 0) + { + sprintf (buf, "%*.*s ", + -target_width, target_width, target_shortname); + strcat_to_buf (string, status_size, buf); + } + if (pid_width > 0) + { + sprintf (buf, "%*.*s ", + -pid_width, pid_width, pid_name); + strcat_to_buf (string, status_size, buf); + } + + /* Show whether we are in SingleKey mode. */ + if (tui_current_key_mode == tui_single_key_mode) + { + strcat_to_buf (string, status_size, SINGLE_KEY); + strcat_to_buf (string, status_size, " "); + } + + /* procedure/class name */ + if (proc_width > 0) + { + if (strlen (pname) > proc_width) + sprintf (buf, "%s%*.*s* ", PROC_PREFIX, + 1 - proc_width, proc_width - 1, pname); + else + sprintf (buf, "%s%*.*s ", PROC_PREFIX, + -proc_width, proc_width, pname); + strcat_to_buf (string, status_size, buf); + } + + if (line_width > 0) + { + sprintf (buf, "%s%*.*s ", LINE_PREFIX, + -line_width, line_width, line_buf); + strcat_to_buf (string, status_size, buf); + } + if (pc_width > 0) + { + strcat_to_buf (string, status_size, PC_PREFIX); + strcat_to_buf (string, status_size, pc_buf); + } + + + for (i = strlen (string); i < status_size; i++) + string[i] = ' '; + string[status_size] = (char) 0; + + ui_file_delete (pc_out); + return string; +} + /* Get a printable name for the function at the address. The symbol name is demangled if demangling is turned on. Returns a pointer to a static area holding the result. */ @@ -114,24 +267,23 @@ tuiShowLocatorContent (void) if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL) { - string = displayableWinContentAt (locator, 0); - if (string != (char *) NULL) - { - wmove (locator->handle, 0, 0); - wstandout (locator->handle); - waddstr (locator->handle, string); - wclrtoeol (locator->handle); - wstandend (locator->handle); - tuiRefreshWin (locator); - wmove (locator->handle, 0, 0); - if (string != nullStr ()) - tuiFree (string); - locator->contentInUse = TRUE; - } + TuiWinElementPtr element; + + element = (TuiWinElementPtr) locator->content[0]; + + string = tui_make_status_line (&element->whichElement.locator); + wmove (locator->handle, 0, 0); + wstandout (locator->handle); + waddstr (locator->handle, string); + wclrtoeol (locator->handle); + wstandend (locator->handle); + tuiRefreshWin (locator); + wmove (locator->handle, 0, 0); + xfree (string); + locator->contentInUse = TRUE; } +} - return; -} /* tuiShowLocatorContent */ /* Set the filename portion of the locator. */ static void diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index 82c3d4951f4..38283b59da1 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -53,6 +53,7 @@ #include "frame.h" #include "cli/cli-cmds.h" #include "top.h" +#include "source.h" #include "tui.h" #include "tuiData.h" @@ -928,7 +929,7 @@ _tuiAllWindowsInfo (char *arg, int fromTTY) TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) - if (winList[type]->generic.isVisible) + if (winList[type] && winList[type]->generic.isVisible) { if (winWithFocus == winList[type]) printf_filtered (" %s\t(%d lines) <has focus>\n", @@ -1364,6 +1365,8 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) if (winInfo->generic.content != (OpaquePtr) NULL) { TuiLineOrAddress lineOrAddr; + struct symtab_and_line cursal + = get_current_source_symtab_and_line (); if (winInfo->generic.type == SRC_WIN) lineOrAddr.lineNo = @@ -1373,19 +1376,20 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) winInfo->detail.sourceInfo.startLineOrAddr.addr; freeWinContent (&winInfo->generic); tuiUpdateSourceWindow (winInfo, - current_source_symtab, lineOrAddr, TRUE); + cursal.symtab, lineOrAddr, TRUE); } else if (selected_frame != (struct frame_info *) NULL) { TuiLineOrAddress line; - extern int current_source_line; + struct symtab_and_line cursal = get_current_source_symtab_and_line (); + s = find_pc_symtab (selected_frame->pc); if (winInfo->generic.type == SRC_WIN) - line.lineNo = current_source_line; + line.lineNo = cursal.line; else { - find_line_pc (s, current_source_line, &line.addr); + find_line_pc (s, cursal.line, &line.addr); } tuiUpdateSourceWindow (winInfo, s, line, TRUE); } @@ -1446,7 +1450,7 @@ _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight) } else { - int curTotalHeight, totalHeight, minHeight; + int curTotalHeight, totalHeight, minHeight = 0; TuiWinInfoPtr firstWin, secondWin; if (curLayout == SRC_DISASSEM_COMMAND) @@ -1465,7 +1469,7 @@ _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight) ** line that the first and second windows share, and add one ** for the locator. */ - curTotalHeight = + totalHeight = curTotalHeight = (firstWin->generic.height + secondWin->generic.height - 1) + cmdWin->generic.height + 1 /*locator */ ; if (primaryWinInfo == cmdWin) diff --git a/gdb/utils.c b/gdb/utils.c index 0c46f794e16..9aab625f63c 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -60,6 +60,7 @@ #include "demangle.h" #include "expression.h" #include "language.h" +#include "charset.h" #include "annotate.h" #include "filenames.h" @@ -674,19 +675,34 @@ error_init (void) gdb_lasterr = mem_fileopen (); } -/* Print a message reporting an internal error. Ask the user if they - want to continue, dump core, or just exit. */ +/* Print a message reporting an internal error/warning. Ask the user + if they want to continue, dump core, or just exit. Return + something to indicate a quit. */ -NORETURN void -internal_verror (const char *file, int line, - const char *fmt, va_list ap) +struct internal_problem +{ + const char *name; + /* FIXME: cagney/2002-08-15: There should be ``maint set/show'' + commands available for controlling these variables. */ + enum auto_boolean should_quit; + enum auto_boolean should_dump_core; +}; + +/* Report a problem, internal to GDB, to the user. Once the problem + has been reported, and assuming GDB didn't quit, the caller can + either allow execution to resume or throw an error. */ + +static void +internal_vproblem (struct internal_problem *problem, +const char *file, int line, + const char *fmt, va_list ap) { - static char msg[] = "Internal GDB error: recursive internal error.\n"; - static int dejavu = 0; + static char msg[] = "Recursive internal problem.\n"; + static int dejavu; int quit_p; int dump_core_p; - /* don't allow infinite error recursion. */ + /* Don't allow infinite error/warning recursion. */ switch (dejavu) { case 0: @@ -702,23 +718,58 @@ internal_verror (const char *file, int line, exit (1); } - /* Try to get the message out */ + /* Try to get the message out and at the start of a new line. */ target_terminal_ours (); - fprintf_unfiltered (gdb_stderr, "%s:%d: gdb-internal-error: ", file, line); + begin_line (); + + /* The error/warning message. Format using a style similar to a + compiler error message. */ + fprintf_unfiltered (gdb_stderr, "%s:%d: %s: ", file, line, problem->name); vfprintf_unfiltered (gdb_stderr, fmt, ap); fputs_unfiltered ("\n", gdb_stderr); - /* Default (yes/batch case) is to quit GDB. When in batch mode this - lessens the likelhood of GDB going into an infinate loop. */ - quit_p = query ("\ -An internal GDB error was detected. This may make further\n\ -debugging unreliable. Quit this debugging session? "); + /* Provide more details so that the user knows that they are living + on the edge. */ + fprintf_unfiltered (gdb_stderr, "\ +A problem internal to GDB has been detected. Further\n\ +debugging may prove unreliable.\n"); - /* Default (yes/batch case) is to dump core. This leaves a GDB - dropping so that it is easier to see that something went wrong to - GDB. */ - dump_core_p = query ("\ -Create a core file containing the current state of GDB? "); + switch (problem->should_quit) + { + case AUTO_BOOLEAN_AUTO: + /* Default (yes/batch case) is to quit GDB. When in batch mode + this lessens the likelhood of GDB going into an infinate + loop. */ + quit_p = query ("Quit this debugging session? "); + break; + case AUTO_BOOLEAN_TRUE: + quit_p = 1; + break; + case AUTO_BOOLEAN_FALSE: + quit_p = 0; + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); + } + + switch (problem->should_dump_core) + { + case AUTO_BOOLEAN_AUTO: + /* Default (yes/batch case) is to dump core. This leaves a GDB + `dropping' so that it is easier to see that something went + wrong in GDB. */ + dump_core_p = query ("Create a core file of GDB? "); + break; + break; + case AUTO_BOOLEAN_TRUE: + dump_core_p = 1; + break; + case AUTO_BOOLEAN_FALSE: + dump_core_p = 0; + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); + } if (quit_p) { @@ -737,6 +788,17 @@ Create a core file containing the current state of GDB? "); } dejavu = 0; +} + +static struct internal_problem internal_error_problem = { + "internal-error", AUTO_BOOLEAN_AUTO, AUTO_BOOLEAN_AUTO +}; + +NORETURN void +internal_verror (const char *file, int line, + const char *fmt, va_list ap) +{ + internal_vproblem (&internal_error_problem, file, line, fmt, ap); throw_exception (RETURN_ERROR); } @@ -745,11 +807,30 @@ internal_error (const char *file, int line, const char *string, ...) { va_list ap; va_start (ap, string); - internal_verror (file, line, string, ap); va_end (ap); } +static struct internal_problem internal_warning_problem = { + "internal-error", AUTO_BOOLEAN_AUTO, AUTO_BOOLEAN_AUTO +}; + +void +internal_vwarning (const char *file, int line, + const char *fmt, va_list ap) +{ + internal_vproblem (&internal_warning_problem, file, line, fmt, ap); +} + +void +internal_warning (const char *file, int line, const char *string, ...) +{ + va_list ap; + va_start (ap, string); + internal_vwarning (file, line, string, ap); + va_end (ap); +} + /* The strerror() function can return NULL for errno values that are out of range. Provide a "safe" version that always returns a printable string. */ @@ -1282,6 +1363,23 @@ query (const char *ctlstr,...) } +/* Print an error message saying that we couldn't make sense of a + \^mumble sequence in a string or character constant. START and END + indicate a substring of some larger string that contains the + erroneous backslash sequence, missing the initial backslash. */ +static NORETURN int +no_control_char_error (const char *start, const char *end) +{ + int len = end - start; + char *copy = alloca (end - start + 1); + + memcpy (copy, start, len); + copy[len] = '\0'; + + error ("There is no control character `\\%s' in the `%s' character set.", + copy, target_charset ()); +} + /* Parse a C escape sequence. STRING_PTR points to a variable containing a pointer to the string to parse. That pointer should point to the character after the \. That pointer @@ -1300,37 +1398,55 @@ query (const char *ctlstr,...) int parse_escape (char **string_ptr) { + int target_char; register int c = *(*string_ptr)++; - switch (c) + if (c_parse_backslash (c, &target_char)) + return target_char; + else switch (c) { - case 'a': - return 007; /* Bell (alert) char */ - case 'b': - return '\b'; - case 'e': /* Escape character */ - return 033; - case 'f': - return '\f'; - case 'n': - return '\n'; - case 'r': - return '\r'; - case 't': - return '\t'; - case 'v': - return '\v'; case '\n': return -2; case 0: (*string_ptr)--; return 0; case '^': - c = *(*string_ptr)++; - if (c == '\\') - c = parse_escape (string_ptr); - if (c == '?') - return 0177; - return (c & 0200) | (c & 037); + { + /* Remember where this escape sequence started, for reporting + errors. */ + char *sequence_start_pos = *string_ptr - 1; + + c = *(*string_ptr)++; + + if (c == '?') + { + /* XXXCHARSET: What is `delete' in the host character set? */ + c = 0177; + + if (! host_char_to_target (c, &target_char)) + error ("There is no character corresponding to `Delete' " + "in the target character set `%s'.", + host_charset ()); + + return target_char; + } + else if (c == '\\') + target_char = parse_escape (string_ptr); + else + { + if (! host_char_to_target (c, &target_char)) + no_control_char_error (sequence_start_pos, *string_ptr); + } + + /* Now target_char is something like `c', and we want to find + its control-character equivalent. */ + if (! target_char_to_control_char (target_char, &target_char)) + no_control_char_error (sequence_start_pos, *string_ptr); + + return target_char; + } + + /* XXXCHARSET: we need to use isdigit and value-of-digit + methods of the host character set here. */ case '0': case '1': @@ -1359,7 +1475,12 @@ parse_escape (char **string_ptr) return i; } default: - return c; + if (! host_char_to_target (c, &target_char)) + error ("The escape sequence `\%c' is equivalent to plain `%c', which" + " has no equivalent\n" + "in the `%s' character set.", + c, c, target_charset ()); + return target_char; } } diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 3752dced66b..6aea8866413 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -173,10 +173,6 @@ v850_processor_type_table[] = } , { - v850e_reg_names, bfd_mach_v850ea - } - , - { NULL, 0 } }; @@ -805,7 +801,7 @@ v850_find_callers_reg (struct frame_info *fi, int regnum) { for (; fi; fi = fi->next) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); + return deprecated_read_register_dummy (fi->pc, fi->frame, regnum); else if (fi->saved_regs[regnum] != 0) return read_memory_unsigned_integer (fi->saved_regs[regnum], v850_register_raw_size (regnum)); @@ -1014,7 +1010,7 @@ CORE_ADDR v850_frame_saved_pc (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); + return deprecated_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); else return v850_find_callers_reg (fi, E_RP_REGNUM); } diff --git a/gdb/valops.c b/gdb/valops.c index bfd8f32d6a3..eb0e4e89da0 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -95,7 +95,7 @@ int unwind_on_signal_p = 0; /* Find the address of function name NAME in the inferior. */ struct value * -find_function_in_inferior (char *name) +find_function_in_inferior (const char *name) { register struct symbol *sym; sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL); @@ -138,7 +138,7 @@ struct value * value_allocate_space_in_inferior (int len) { struct value *blocklen; - struct value *val = find_function_in_inferior ("malloc"); + struct value *val = find_function_in_inferior (NAME_OF_MALLOC); blocklen = value_from_longest (builtin_type_int, (LONGEST) len); val = call_function_by_hand (val, 1, &blocklen); @@ -1353,7 +1353,55 @@ hand_function_call (struct value *function, int nargs, struct value **args) they are saved on the stack in the inferior. */ PUSH_DUMMY_FRAME; - old_sp = sp = read_sp (); + old_sp = read_sp (); + + /* Ensure that the initial SP is correctly aligned. */ + if (gdbarch_frame_align_p (current_gdbarch)) + { + /* NOTE: cagney/2002-09-18: + + On a RISC architecture, a void parameterless generic dummy + frame (i.e., no parameters, no result) typically does not + need to push anything the stack and hence can leave SP and + FP. Similarly, a framelss (possibly leaf) function does not + push anything on the stack and, hence, that too can leave FP + and SP unchanged. As a consequence, a sequence of void + parameterless generic dummy frame calls to frameless + functions will create a sequence of effectively identical + frames (SP, FP and TOS and PC the same). This, not + suprisingly, results in what appears to be a stack in an + infinite loop --- when GDB tries to find a generic dummy + frame on the internal dummy frame stack, it will always find + the first one. + + To avoid this problem, the code below always grows the stack. + That way, two dummy frames can never be identical. It does + burn a few bytes of stack but that is a small price to pay + :-). */ + sp = gdbarch_frame_align (current_gdbarch, old_sp); + if (sp == old_sp) + { + if (INNER_THAN (1, 2)) + /* Stack grows down. */ + sp = gdbarch_frame_align (current_gdbarch, old_sp - 1); + else + /* Stack grows up. */ + sp = gdbarch_frame_align (current_gdbarch, old_sp + 1); + } + gdb_assert ((INNER_THAN (1, 2) && sp <= old_sp) + || (INNER_THAN (2, 1) && sp >= old_sp)); + } + else + /* FIXME: cagney/2002-09-18: Hey, you loose! Who knows how badly + aligned the SP is! Further, per comment above, if the generic + dummy frame ends up empty (because nothing is pushed) GDB won't + be able to correctly perform back traces. If a target is + having trouble with backtraces, first thing to do is add + FRAME_ALIGN() to its architecture vector. After that, try + adding SAVE_DUMMY_FRAME_TOS() and modifying FRAME_CHAIN so that + when the next outer frame is a generic dummy, it returns the + current frame's base. */ + sp = old_sp; if (INNER_THAN (1, 2)) { @@ -1368,6 +1416,11 @@ hand_function_call (struct value *function, int nargs, struct value **args) sp += sizeof_dummy1; } + /* NOTE: cagney/2002-09-10: Don't bother re-adjusting the stack + after allocating space for the call dummy. A target can specify + a SIZEOF_DUMMY1 (via SIZEOF_CALL_DUMMY_WORDS) such that all local + alignment requirements are met. */ + funaddr = find_function_addr (function, &value_type); CHECK_TYPEDEF (value_type); @@ -1564,7 +1617,8 @@ You must use a pointer to function type variable. Command ignored.", arg_name); /* Reserve space for the return structure to be written on the - stack, if necessary */ + stack, if necessary. Make certain that the value is correctly + aligned. */ if (struct_return) { @@ -1576,15 +1630,23 @@ You must use a pointer to function type variable. Command ignored.", arg_name); len = STACK_ALIGN (len); if (INNER_THAN (1, 2)) { - /* stack grows downward */ + /* Stack grows downward. Align STRUCT_ADDR and SP after + making space for the return value. */ sp -= len; + if (gdbarch_frame_align_p (current_gdbarch)) + sp = gdbarch_frame_align (current_gdbarch, sp); struct_addr = sp; } else { - /* stack grows upward */ + /* Stack grows upward. Align the frame, allocate space, and + then again, re-align the frame??? */ + if (gdbarch_frame_align_p (current_gdbarch)) + sp = gdbarch_frame_align (current_gdbarch, sp); struct_addr = sp; sp += len; + if (gdbarch_frame_align_p (current_gdbarch)) + sp = gdbarch_frame_align (current_gdbarch, sp); } } @@ -1780,14 +1842,13 @@ the function call).", name); do_cleanups (inf_status_cleanup); /* Figure out the value returned by the function. */ -/* elz: I defined this new macro for the hppa architecture only. - this gives us a way to get the value returned by the function from the stack, - at the same address we told the function to put it. - We cannot assume on the pa that r28 still contains the address of the returned - structure. Usually this will be overwritten by the callee. - I don't know about other architectures, so I defined this macro - */ - + /* elz: I defined this new macro for the hppa architecture only. + this gives us a way to get the value returned by the function + from the stack, at the same address we told the function to put + it. We cannot assume on the pa that r28 still contains the + address of the returned structure. Usually this will be + overwritten by the callee. I don't know about other + architectures, so I defined this macro */ #ifdef VALUE_RETURNED_FROM_STACK if (struct_return) { @@ -1795,12 +1856,26 @@ the function call).", name); return VALUE_RETURNED_FROM_STACK (value_type, struct_addr); } #endif - - { - struct value *retval = value_being_returned (value_type, retbuf, struct_return); - do_cleanups (retbuf_cleanup); - return retval; - } + /* NOTE: cagney/2002-09-10: Only when the stack has been correctly + aligned (using frame_align()) do we can trust STRUCT_ADDR and + fetch the return value direct from the stack. This lack of + trust comes about because legacy targets have a nasty habit of + silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR. + For such targets, just hope that value_being_returned() can + find the adjusted value. */ + if (struct_return && gdbarch_frame_align_p (current_gdbarch)) + { + struct value *retval = value_at (value_type, struct_addr, NULL); + do_cleanups (retbuf_cleanup); + return retval; + } + else + { + struct value *retval = value_being_returned (value_type, retbuf, + struct_return); + do_cleanups (retbuf_cleanup); + return retval; + } } } @@ -2304,12 +2379,11 @@ search_struct_method (char *name, struct value **arg1p, struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); name_matched = 1; + check_stub_method_group (type, i); if (j > 0 && args == 0) error ("cannot resolve overloaded method `%s': no arguments supplied", name); else if (j == 0 && args == 0) { - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (type, i, j); v = value_fn_field (arg1p, f, j, type, offset); if (v != NULL) return v; @@ -2317,8 +2391,6 @@ search_struct_method (char *name, struct value **arg1p, else while (j >= 0) { - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (type, i, j); if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j), TYPE_VARARGS (TYPE_FN_FIELD_TYPE (f, j)), TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, j)), @@ -2557,20 +2629,15 @@ find_method_list (struct value **argp, char *method, int offset, char *fn_field_name = TYPE_FN_FIELDLIST_NAME (type, i); if (fn_field_name && (strcmp_iw (fn_field_name, method) == 0)) { - /* Resolve any stub methods. */ int len = TYPE_FN_FIELDLIST_LENGTH (type, i); struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); - int j; *num_fns = len; *basetype = type; *boffset = offset; - for (j = 0; j < len; j++) - { - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (type, i, j); - } + /* Resolve any stub methods. */ + check_stub_method_group (type, i); return f; } @@ -3096,6 +3163,8 @@ value_struct_elt_for_reference (struct type *domain, int offset, int j = TYPE_FN_FIELDLIST_LENGTH (t, i); struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i); + check_stub_method_group (t, i); + if (intype == 0 && j > 1) error ("non-unique member `%s' requires type instantiation", name); if (intype) @@ -3109,8 +3178,6 @@ value_struct_elt_for_reference (struct type *domain, int offset, else j = 0; - if (TYPE_FN_FIELD_STUB (f, j)) - check_stub_method (t, i, j); if (TYPE_FN_FIELD_VIRTUAL_P (f, j)) { return value_from_longest diff --git a/gdb/value.h b/gdb/value.h index 448c222df21..efabecb8806 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -558,7 +558,7 @@ extern struct value *value_literal_complex (struct value *, struct value *, extern void find_rt_vbase_offset (struct type *, struct type *, char *, int, int *, int *); -extern struct value *find_function_in_inferior (char *); +extern struct value *find_function_in_inferior (const char *); extern struct value *value_allocate_space_in_inferior (int); diff --git a/gdb/values.c b/gdb/values.c index a0c9794bced..c943f28fa46 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -800,25 +800,19 @@ unpack_pointer (struct type *type, char *valaddr) struct value * value_static_field (struct type *type, int fieldno) { - CORE_ADDR addr; - asection *sect; + struct value *retval; + if (TYPE_FIELD_STATIC_HAS_ADDR (type, fieldno)) { - addr = TYPE_FIELD_STATIC_PHYSADDR (type, fieldno); - sect = NULL; + retval = value_at (TYPE_FIELD_TYPE (type, fieldno), + TYPE_FIELD_STATIC_PHYSADDR (type, fieldno), + NULL); } else { char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno); struct symbol *sym = lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL); - /* In some cases (involving uninitalized, unreferenced static - const integral members), g++ -gdwarf-2 can emit debugging - information giving rise to symbols whose SYMBOL_CLASS is - LOC_UNRESOLVED. In that case, do a minimal symbol lookup. - If it returns a useful value, then the symbol was defined - elsewhere, so we use that information. Otherwise, return - NULL. */ - if (sym == NULL || SYMBOL_CLASS (sym) == LOC_UNRESOLVED) + if (sym == NULL) { /* With some compilers, e.g. HP aCC, static data members are reported as non-debuggable symbols */ @@ -827,27 +821,25 @@ value_static_field (struct type *type, int fieldno) return NULL; else { - addr = SYMBOL_VALUE_ADDRESS (msym); - sect = SYMBOL_BFD_SECTION (msym); + retval = value_at (TYPE_FIELD_TYPE (type, fieldno), + SYMBOL_VALUE_ADDRESS (msym), + SYMBOL_BFD_SECTION (msym)); } } else { - /* Anything static that isn't a constant, has an address */ - if (SYMBOL_CLASS (sym) != LOC_CONST) - { - addr = SYMBOL_VALUE_ADDRESS (sym); - sect = SYMBOL_BFD_SECTION (sym); - } - /* However, static const's do not, the value is already known. */ - else - { - return value_from_longest (TYPE_FIELD_TYPE (type, fieldno), SYMBOL_VALUE (sym)); - } + /* SYM should never have a SYMBOL_CLASS which will require + read_var_value to use the FRAME parameter. */ + if (symbol_read_needs_frame (sym)) + warning ("static field's value depends on the current " + "frame - bad debug info?"); + retval = read_var_value (sym, NULL); } - SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), addr); + if (retval && VALUE_LVAL (retval) == lval_memory) + SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), + VALUE_ADDRESS (retval)); } - return value_at (TYPE_FIELD_TYPE (type, fieldno), addr, sect); + return retval; } /* Change the enclosing type of a value object VAL to NEW_ENCL_TYPE. diff --git a/gdb/varobj.c b/gdb/varobj.c index 4ae046aad4e..16ba528afe6 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1345,7 +1345,10 @@ make_cleanup_free_variable (struct varobj *var) /* This returns the type of the variable. This skips past typedefs and returns the real type of the variable. It also dereferences - pointers and references. */ + pointers and references. + + NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file + except within get_target_type and get_type. */ static struct type * get_type (struct varobj *var) { @@ -1374,7 +1377,10 @@ get_type_deref (struct varobj *var) } /* This returns the target type (or NULL) of TYPE, also skipping - past typedefs, just like get_type (). */ + past typedefs, just like get_type (). + + NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file + except within get_target_type and get_type. */ static struct type * get_target_type (struct type *type) { @@ -1959,7 +1965,7 @@ c_type_of_child (struct varobj *parent, int index) switch (TYPE_CODE (parent->type)) { case TYPE_CODE_ARRAY: - type = TYPE_TARGET_TYPE (parent->type); + type = get_target_type (parent->type); break; case TYPE_CODE_STRUCT: @@ -1968,7 +1974,7 @@ c_type_of_child (struct varobj *parent, int index) break; case TYPE_CODE_PTR: - switch (TYPE_CODE (TYPE_TARGET_TYPE (parent->type))) + switch (TYPE_CODE (get_target_type (parent->type))) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: @@ -1976,7 +1982,7 @@ c_type_of_child (struct varobj *parent, int index) break; default: - type = TYPE_TARGET_TYPE (parent->type); + type = get_target_type (parent->type); break; } break; diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 709ef383c83..2f517edb379 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -28,6 +28,7 @@ #include "frame.h" #include "value.h" #include "arch-utils.h" +#include "gdb_string.h" #include "vax-tdep.h" diff --git a/gdb/version.in b/gdb/version.in index 3a2a9df4d8d..5bd79e9203d 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2002-08-29-cvs +2002-09-30-cvs diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 781a84126cb..e2a85e138dc 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -1461,6 +1461,8 @@ child_create_inferior (char *exec_file, char *allargs, char **env) char *toexec; char shell[MAX_PATH + 1]; /* Path to shell */ const char *sh; + int tty; + int ostdin, ostdout, ostderr; if (!exec_file) error ("No executable specified, use `target exec'.\n"); @@ -1573,6 +1575,27 @@ child_create_inferior (char *exec_file, char *allargs, char **env) *temp = 0; } + if (!inferior_io_terminal) + tty = ostdin = ostdout = ostderr = -1; + else + { + tty = open (inferior_io_terminal, O_RDWR | O_NOCTTY); + if (tty < 0) + { + print_sys_errmsg (inferior_io_terminal, errno); + ostdin = ostdout = ostderr = -1; + } + else + { + ostdin = dup (0); + ostdout = dup (1); + ostderr = dup (2); + dup2 (tty, 0); + dup2 (tty, 1); + dup2 (tty, 2); + } + } + ret = CreateProcess (0, args, /* command line */ NULL, /* Security */ @@ -1583,6 +1606,17 @@ child_create_inferior (char *exec_file, char *allargs, char **env) NULL, /* current directory */ &si, &pi); + if (tty >= 0) + { + close (tty); + dup2 (ostdin, 0); + dup2 (ostdout, 1); + dup2 (ostderr, 2); + close (ostdin); + close (ostdout); + close (ostderr); + } + if (!ret) error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ()); diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index 7749b415114..7e6417b1cc9 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -26,6 +26,7 @@ #include "gdbcore.h" #include "regcache.h" #include "gdb_assert.h" +#include "gdb_string.h" #include "x86-64-tdep.h" #include <sys/ptrace.h> @@ -42,7 +43,7 @@ static int x86_64_regmap[] = { RSI, RDI, RBP, RSP, R8, R9, R10, R11, R12, R13, R14, R15, - RIP, EFLAGS, + RIP, EFLAGS, CS, SS, DS, ES, FS, GS }; diff --git a/gdb/x86-64-linux-tdep.c b/gdb/x86-64-linux-tdep.c index 171ec9c4975..ac41daa8849 100644 --- a/gdb/x86-64-linux-tdep.c +++ b/gdb/x86-64-linux-tdep.c @@ -24,6 +24,7 @@ #include "defs.h" #include "inferior.h" #include "gdbcore.h" +#include "gdb_string.h" #include "regcache.h" #include "x86-64-tdep.h" #include "dwarf2cfi.h" diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index a47f5e7e5af..dbc5611cb0d 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -1144,7 +1144,7 @@ _initialize_x86_64_tdep (void) } tm_print_insn = gdb_print_insn_x86_64; - tm_print_insn_info.mach = bfd_lookup_arch (bfd_arch_i386, 3)->mach; + tm_print_insn_info.mach = bfd_mach_x86_64; /* Add the variable that controls the disassembly flavour. */ { diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index d3583139c63..b08808563f2 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -758,7 +758,8 @@ xstormy16_frame_saved_pc (struct frame_info *fi) if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) { - saved_pc = generic_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); + saved_pc = deprecated_read_register_dummy (fi->pc, fi->frame, + E_PC_REGNUM); } else { diff --git a/include/ChangeLog b/include/ChangeLog index e018f1ec506..257e381931f 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,30 @@ +2002-09-26 Jakub Jelinek <jakub@redhat.com> + + * elf/x86-64.h: Add TLS relocs. + +2002-09-26 Andrew Cagney <ac131313@redhat.com> + + * regs/: Delete directory. + +2002-09-19 Alexandre Oliva <aoliva@redhat.com> + + * libiberty.h (asprintf, vasprintf): Don't declare them if the + corresponding HAVE_DECL_ macro is 1. + +2002-09-19 Jakub Jelinek <jakub@redhat.com> + + * elf/i386.h (R_386_TLS_TPOFF, R_386_TLS_IE, R_386_TLS_GOTIE): + Define. + +2002-09-19 Nathan Tallent <eraxxon@alumni.rice.edu> + + * dis-asm.h: Remove (errant) trailing semicolon (;) from the + extern "C" { } declaration. + +2002-09-04 Nick Clifton <nickc@redhat.com> + + * dis-asm.h (print_ppc_disassembler_options): Prototype. + 2002-08-28 Michael Hayes <m.hayes@elec.canterbury.ac.nz> * coff/internal.h: Add new relocation types. diff --git a/include/dis-asm.h b/include/dis-asm.h index 0109068f3f8..993b3ad29f6 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -243,6 +243,7 @@ extern int print_insn_frv PARAMS ((bfd_vma, disassemble_info *)); extern disassembler_ftype arc_get_disassembler PARAMS ((void *)); extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *)); +extern void print_ppc_disassembler_options PARAMS ((FILE *)); extern void print_arm_disassembler_options PARAMS ((FILE *)); extern void parse_arm_disassembler_option PARAMS ((char *)); extern int get_arm_regname_num_options PARAMS ((void)); @@ -317,7 +318,7 @@ extern int generic_symbol_at_address (INFO).insn_info_valid = 0 #ifdef __cplusplus -}; +} #endif #endif /* ! defined (DIS_ASM_H) */ diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 0ffa6ab9d31..254b2c425b1 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,18 @@ +2002-09-30 Gavin Romig-Koch <gavin@redhat.com> + Ken Raeburn <raeburn@cygnus.com> + Aldy Hernandez <aldyh@redhat.com> + Eric Christopher <echristo@redhat.com> + Richard Sandiford <rsandifo@redhat.com> + + * mips.h (E_MIPS_MACH_4120, E_MIPS_MACH_5400, E_MIPS_MACH_5500): New. + +2002-09-12 Roland McGrath <roland@redhat.com> + + * dwarf2.h: Updates from GCC version of thie file: + (enum dwarf_location_atom): DW_OP_calli -> DW_OP_call_ref. + Add DW_OP_GNU_push_tls_address. + (DW_OP_lo_user): Change to 0xe0. + 2002-08-28 Catherine Moore <clm@redhat.com> * elf/v850.h (R_V850_LONGCALL, R_V850_ALIGN, diff --git a/include/elf/dwarf2.h b/include/elf/dwarf2.h index 0e78310c69f..6463b5a9082 100644 --- a/include/elf/dwarf2.h +++ b/include/elf/dwarf2.h @@ -10,22 +10,22 @@ Derived from the DWARF 1 implementation written by Ron Guilmette (rfg@netcom.com), November 1990. -This file is part of GCC. + 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. + 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. -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. + 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, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + 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, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ /* This file is derived from the DWARF specification (a public document) Revision 2.0.0 (July 27, 1993) developed by the UNIX International @@ -488,10 +488,12 @@ enum dwarf_location_atom DW_OP_push_object_address = 0x97, DW_OP_call2 = 0x98, DW_OP_call4 = 0x99, - DW_OP_calli = 0x9a + DW_OP_call_ref = 0x9a, + /* GNU extensions. */ + DW_OP_GNU_push_tls_address = 0xe0 }; -#define DW_OP_lo_user 0x80 /* Implementation-defined range start. */ +#define DW_OP_lo_user 0xe0 /* Implementation-defined range start. */ #define DW_OP_hi_user 0xff /* Implementation-defined range end. */ /* Type encodings. */ @@ -679,7 +681,6 @@ enum dwarf_source_language DW_LANG_Mips_Assembler = 0x8001 }; - #define DW_LANG_lo_user 0x8000 /* Implementation-defined range start. */ #define DW_LANG_hi_user 0xffff /* Implementation-defined range start. */ diff --git a/include/elf/i386.h b/include/elf/i386.h index c6e9709a1fe..95941196c7e 100644 --- a/include/elf/i386.h +++ b/include/elf/i386.h @@ -36,7 +36,10 @@ START_RELOC_NUMBERS (elf_i386_reloc_type) RELOC_NUMBER (R_386_GOTPC, 10) /* 32 bit PC relative offset to GOT */ RELOC_NUMBER (R_386_32PLT, 11) /* Used by Sun */ FAKE_RELOC (FIRST_INVALID_RELOC, 12) - FAKE_RELOC (LAST_INVALID_RELOC, 16) + FAKE_RELOC (LAST_INVALID_RELOC, 13) + RELOC_NUMBER (R_386_TLS_TPOFF,14) + RELOC_NUMBER (R_386_TLS_IE, 15) + RELOC_NUMBER (R_386_TLS_GOTIE,16) RELOC_NUMBER (R_386_TLS_LE, 17) RELOC_NUMBER (R_386_TLS_GD, 18) RELOC_NUMBER (R_386_TLS_LDM, 19) diff --git a/include/elf/mips.h b/include/elf/mips.h index 3b6fe99eccf..81451ab55cd 100644 --- a/include/elf/mips.h +++ b/include/elf/mips.h @@ -175,8 +175,11 @@ END_RELOC_NUMBERS (R_MIPS_maxext) #define E_MIPS_MACH_4010 0x00820000 #define E_MIPS_MACH_4100 0x00830000 #define E_MIPS_MACH_4650 0x00850000 +#define E_MIPS_MACH_4120 0x00870000 #define E_MIPS_MACH_4111 0x00880000 #define E_MIPS_MACH_SB1 0x008a0000 +#define E_MIPS_MACH_5400 0x00910000 +#define E_MIPS_MACH_5500 0x00980000 /* Processor specific section indices. These sections do not actually exist. Symbols with a st_shndx field corresponding to one of these diff --git a/include/elf/x86-64.h b/include/elf/x86-64.h index 74febc2d5db..7e9100dba4a 100644 --- a/include/elf/x86-64.h +++ b/include/elf/x86-64.h @@ -1,5 +1,5 @@ /* x86_64 ELF support for BFD. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2002 Free Software Foundation, Inc. Contributed by Jan Hubicka <jh@suse.cz> This file is part of BFD, the Binary File Descriptor library. @@ -25,22 +25,30 @@ START_RELOC_NUMBERS (elf_x86_64_reloc_type) RELOC_NUMBER (R_X86_64_NONE, 0) /* No reloc */ - RELOC_NUMBER (R_X86_64_64, 1) /* Direct 64 bit */ + RELOC_NUMBER (R_X86_64_64, 1) /* Direct 64 bit */ RELOC_NUMBER (R_X86_64_PC32, 2) /* PC relative 32 bit signed */ RELOC_NUMBER (R_X86_64_GOT32, 3) /* 32 bit GOT entry */ RELOC_NUMBER (R_X86_64_PLT32, 4) /* 32 bit PLT address */ RELOC_NUMBER (R_X86_64_COPY, 5) /* Copy symbol at runtime */ RELOC_NUMBER (R_X86_64_GLOB_DAT, 6) /* Create GOT entry */ - RELOC_NUMBER (R_X86_64_JUMP_SLOT, 7) /* Create PLT entry */ + RELOC_NUMBER (R_X86_64_JUMP_SLOT,7) /* Create PLT entry */ RELOC_NUMBER (R_X86_64_RELATIVE, 8) /* Adjust by program base */ RELOC_NUMBER (R_X86_64_GOTPCREL, 9) /* 32 bit signed pc relative offset to GOT */ - RELOC_NUMBER (R_X86_64_32, 10) /* Direct 32 bit zero extended */ - RELOC_NUMBER (R_X86_64_32S, 11) /* Direct 32 bit sign extended */ - RELOC_NUMBER (R_X86_64_16, 12) /* Direct 16 bit zero extended */ + RELOC_NUMBER (R_X86_64_32, 10) /* Direct 32 bit zero extended */ + RELOC_NUMBER (R_X86_64_32S, 11) /* Direct 32 bit sign extended */ + RELOC_NUMBER (R_X86_64_16, 12) /* Direct 16 bit zero extended */ RELOC_NUMBER (R_X86_64_PC16, 13) /* 16 bit sign extended pc relative*/ - RELOC_NUMBER (R_X86_64_8, 14) /* Direct 8 bit sign extended */ - RELOC_NUMBER (R_X86_64_PC8, 15) /* 8 bit sign extended pc relative*/ + RELOC_NUMBER (R_X86_64_8, 14) /* Direct 8 bit sign extended */ + RELOC_NUMBER (R_X86_64_PC8, 15) /* 8 bit sign extended pc relative*/ + RELOC_NUMBER (R_X86_64_DTPMOD64, 16) /* ID of module containing symbol */ + RELOC_NUMBER (R_X86_64_DTPOFF64, 17) /* Offset in TLS block */ + RELOC_NUMBER (R_X86_64_TPOFF64, 18) /* Offset in initial TLS block */ + RELOC_NUMBER (R_X86_64_TLSGD, 19) /* PC relative offset to GD GOT block */ + RELOC_NUMBER (R_X86_64_TLSLD, 20) /* PC relative offset to LD GOT block */ + RELOC_NUMBER (R_X86_64_DTPOFF32, 21) /* Offset in TLS block */ + RELOC_NUMBER (R_X86_64_GOTTPOFF, 22) /* PC relative offset to IE GOT entry */ + RELOC_NUMBER (R_X86_64_TPOFF32, 23) /* Offset in initial TLS block */ RELOC_NUMBER (R_X86_64_GNU_VTINHERIT, 250) /* GNU C++ hack */ RELOC_NUMBER (R_X86_64_GNU_VTENTRY, 251) /* GNU C++ hack */ END_RELOC_NUMBERS (R_X86_64_max) diff --git a/include/libiberty.h b/include/libiberty.h index 0463301832e..983fd96e5ae 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -264,16 +264,20 @@ extern int pexecute PARAMS ((const char *, char * const *, const char *, extern int pwait PARAMS ((int, int *, int)); +#if !HAVE_DECL_ASPRINTF /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ extern int asprintf PARAMS ((char **, const char *, ...)) ATTRIBUTE_PRINTF_2; +#endif +#if !HAVE_DECL_VASPRINTF /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ extern int vasprintf PARAMS ((char **, const char *, va_list)) ATTRIBUTE_PRINTF(2,0); +#endif #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index b950eefc368..ab908ec92c3 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,17 @@ +2002-09-30 Gavin Romig-Koch <gavin@redhat.com> + Ken Raeburn <raeburn@cygnus.com> + Aldy Hernandez <aldyh@redhat.com> + Eric Christopher <echristo@redhat.com> + Richard Sandiford <rsandifo@redhat.com> + + * mips.h: Update comment for new opcodes. + (OP_MASK_VECBYTE, OP_SH_VECBYTE): New. + (OP_MASK_VECALIGN, OP_SH_VECALIGN): New. + (INSN_4111, INSN_4120, INSN_5400, INSN_5500): New. + (CPU_VR4120, CPU_VR5400, CPU_VR5500): New. + (OPCODE_IS_MEMBER): Handle the new CPU_* values and INSN_* flags. + Don't match CPU_R4111 with INSN_4100. + 2002-08-19 Elena Zannoni <ezannoni@redhat.com> From matthew green <mrg@redhat.com> diff --git a/include/opcode/mips.h b/include/opcode/mips.h index 1a39640ca82..3849fdce68b 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -137,6 +137,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * #define OP_MASK_ALN 0x7 #define OP_SH_VSEL 21 #define OP_MASK_VSEL 0x1f +#define OP_MASK_VECBYTE 0x7 /* Selector field is really 4 bits, + but 0x8-0xf don't select bytes. */ +#define OP_SH_VECBYTE 22 +#define OP_MASK_VECALIGN 0x7 /* Vector byte-align (alni.ob) op. */ +#define OP_SH_VECALIGN 21 /* Values in the 'VSEL' field. */ #define MDMX_FMTSEL_IMM_QH 0x1d @@ -189,6 +194,7 @@ struct mips_opcode "i" 16 bit unsigned immediate (OP_*_IMMEDIATE) "j" 16 bit signed immediate (OP_*_DELTA) "k" 5 bit cache opcode in target register position (OP_*_CACHE) + Also used for immediate operands in vr5400 vector insns. "o" 16 bit signed offset (OP_*_DELTA) "p" 16 bit PC relative branch target address (OP_*_DELTA) "q" 10 bit extra breakpoint code (OP_*_CODE2) @@ -221,6 +227,9 @@ struct mips_opcode "G" 5 bit destination register (OP_*_RD) "H" 3 bit sel field for (d)mtc* and (d)mfc* (OP_*_SEL) "P" 5 bit performance-monitor register (OP_*_PERFREG) + "e" 5 bit vector register byte specifier (OP_*_VECBYTE) + "%" 3 bit immediate vr5400 vector alignment operand (OP_*_VECALIGN) + see also "k" above Macro instructions: "A" General 32 bit expression @@ -241,11 +250,12 @@ struct mips_opcode Other: "()" parens surrounding optional value "," separates operands + "[]" brackets around index for vector-op scalar operand specifier (vr5400) Characters used so far, for quick reference when adding more: - "<>()," + "%[]<>()," "ABCDEFGHIJLMNOPQRSTUVWXYZ" - "abcdfhijklopqrstuvwxz" + "abcdefhijklopqrstuvwxz" */ /* These are the bits which may be set in the pinfo field of an @@ -362,6 +372,14 @@ struct mips_opcode #define INSN_10000 0x00100000 /* Broadcom SB-1 instruction. */ #define INSN_SB1 0x00200000 +/* NEC VR4111/VR4181 instruction. */ +#define INSN_4111 0x00400000 +/* NEC VR4120 instruction. */ +#define INSN_4120 0x00800000 +/* NEC VR5400 instruction. */ +#define INSN_5400 0x01000000 +/* NEC VR5500 instruction. */ +#define INSN_5500 0x02000000 /* MIPS ISA defines, use instead of hardcoding ISA level. */ @@ -383,11 +401,14 @@ struct mips_opcode #define CPU_R4010 4010 #define CPU_VR4100 4100 #define CPU_R4111 4111 +#define CPU_VR4120 4120 #define CPU_R4300 4300 #define CPU_R4400 4400 #define CPU_R4600 4600 #define CPU_R4650 4650 #define CPU_R5000 5000 +#define CPU_VR5400 5400 +#define CPU_VR5500 5500 #define CPU_R6000 6000 #define CPU_R8000 8000 #define CPU_R10000 10000 @@ -407,12 +428,15 @@ struct mips_opcode (((insn)->membership & isa) != 0 \ || (cpu == CPU_R4650 && ((insn)->membership & INSN_4650) != 0) \ || (cpu == CPU_R4010 && ((insn)->membership & INSN_4010) != 0) \ - || ((cpu == CPU_VR4100 || cpu == CPU_R4111) \ - && ((insn)->membership & INSN_4100) != 0) \ + || (cpu == CPU_VR4100 && ((insn)->membership & INSN_4100) != 0) \ || (cpu == CPU_R3900 && ((insn)->membership & INSN_3900) != 0) \ || ((cpu == CPU_R10000 || cpu == CPU_R12000) \ && ((insn)->membership & INSN_10000) != 0) \ || (cpu == CPU_SB1 && ((insn)->membership & INSN_SB1) != 0) \ + || (cpu == CPU_R4111 && ((insn)->membership & INSN_4111) != 0) \ + || (cpu == CPU_VR4120 && ((insn)->membership & INSN_4120) != 0) \ + || (cpu == CPU_VR5400 && ((insn)->membership & INSN_5400) != 0) \ + || (cpu == CPU_VR5500 && ((insn)->membership & INSN_5500) != 0) \ || 0) /* Please keep this term for easier source merging. */ /* This is a list of macro expanded instructions. diff --git a/include/regs/ChangeLog b/include/regs/ChangeLog deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/regs/ChangeLog +++ /dev/null diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 828f76f8a8a..bde129cda84 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,46 @@ +2002-09-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (all): Fix multilib parallel build. + +2002-09-19 John David Anglin <dave@hiuly1.hia.nrc.ca> + + * cp-demangle.c (demangling_new): Cast 0 to enum. + (demangle_char): Cast return of strdup to char *. + (is_gnu_v3_mangled_ctor): Cast 0 to enum. + (is_gnu_v3_mangled_dtor): Likewise. + * cplus-dem.c (grow_vect): Cast return of xrealloc to void *. + (work_stuff_copy_to_from): Cast return of xmalloc to char **. + * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t. + * md5.c (md5_process_bytes): Cast results back to const void *. + (md5_process_block): Add cast to const md5_uint32 *. + * regex.c (re_compile_fastmap): Cast enum to UCHAR_T. + * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to + unsigned short. + * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc + to void *. + * vasprintf.c (int_vasprintf): Cast return of malloc to char *. + +2002-09-19 Nick Clifton <nickc@redhat.com> + + * README: Update email addresses for bugs and patches. + +2002-09-10 Mike Stump <mrs@apple.com> + + * splay-tree.c (splay_tree_successor): Fix comments. + +2002-09-11 Zack Weinberg <zack@codesourcery.com> + + * cplus-dem.c: Code under #ifdef MAIN moved to gcc/cp/cxxfilt.c. + * testsuite/Makefile.in: Adjust for test-demangle. + * testsuite/regress-demangle: Deleted. + * testsuite/test-demangle.c: New file. + * testsuite/demangle-expected: Change \$ to $ throughout, now that + this file is not being read by a shell script. + +2002-09-05 Roger Sayle <roger@eyesopen.com> + + * regex.c: Only use "#pragma alloca" on AIX when not using gcc. + 2002-08-07 DJ Delorie <dj@redhat.com> * regex.c (re_error_msgid): Just use a simple array of strings. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 5a25987d58b..e0bb15a7519 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -105,7 +105,7 @@ SUBDIRS = testsuite # FIXME: add @BUILD_INFO@ once we're sure it works for everyone. all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir - @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all + @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all .PHONY: check installcheck check: check-subdir diff --git a/libiberty/README b/libiberty/README index 9f5226a6b1d..e8e9b338350 100644 --- a/libiberty/README +++ b/libiberty/README @@ -15,7 +15,8 @@ The library must be configured from the top source directory. Don't try to run configure in this directory. Follow the configuration instructions in ../README. -Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu". Thank you. +Please report bugs to "gcc-bugs@gcc.gnu.org" and send fixes to +"gcc-patches@gcc.gnu.org". Thank you. ADDING A NEW FILE ================= diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index eece533e070..9adf5fd0503 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -835,8 +835,8 @@ demangling_new (name, style) return NULL; } dm->style = style; - dm->is_constructor = 0; - dm->is_destructor = 0; + dm->is_constructor = (enum gnu_v3_ctor_kinds) 0; + dm->is_destructor = (enum gnu_v3_dtor_kinds) 0; return dm; } @@ -974,7 +974,7 @@ demangle_char (dm, c) else { if (error_message == NULL) - error_message = strdup ("Expected ?"); + error_message = (char *) strdup ("Expected ?"); error_message[9] = c; return error_message; } @@ -3974,7 +3974,7 @@ is_gnu_v3_mangled_ctor (name) return result; } else - return 0; + return (enum gnu_v3_ctor_kinds) 0; } @@ -3996,7 +3996,7 @@ is_gnu_v3_mangled_dtor (name) return result; } else - return 0; + return (enum gnu_v3_dtor_kinds) 0; } #endif /* IN_GLIBCPP_V3 */ diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 995757c62de..4c4778375b0 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -946,7 +946,7 @@ grow_vect (old_vect, size, min_size, element_size) *size *= 2; if (*size < min_size) *size = min_size; - *old_vect = xrealloc (*old_vect, *size * element_size); + *old_vect = (void *) xrealloc (*old_vect, *size * element_size); } } @@ -1206,7 +1206,7 @@ work_stuff_copy_to_from (to, from) if (from->ntmpl_args) to->tmpl_argvec - = xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); + = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); for (i = 0; i < from->ntmpl_args; i++) { @@ -4878,337 +4878,3 @@ string_append_template_idx (s, idx) sprintf(buf, "T%d", idx); string_append (s, buf); } - -/* To generate a standalone demangler program for testing purposes, - just compile and link this file with -DMAIN and libiberty.a. When - run, it demangles each command line arg, or each stdin string, and - prints the result on stdout. */ - -#ifdef MAIN - -#include "getopt.h" - -static const char *program_name; -static const char *program_version = VERSION; -static int flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE; - -static void demangle_it PARAMS ((char *)); -static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN; -static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN; -static void print_demangler_list PARAMS ((FILE *)); - -static void -demangle_it (mangled_name) - char *mangled_name; -{ - char *result; - - /* For command line args, also try to demangle type encodings. */ - result = cplus_demangle (mangled_name, flags | DMGL_TYPES); - if (result == NULL) - { - printf ("%s\n", mangled_name); - } - else - { - printf ("%s\n", result); - free (result); - } -} - -static void -print_demangler_list (stream) - FILE *stream; -{ - const struct demangler_engine *demangler; - - fprintf (stream, "{%s", libiberty_demanglers->demangling_style_name); - - for (demangler = libiberty_demanglers + 1; - demangler->demangling_style != unknown_demangling; - ++demangler) - fprintf (stream, ",%s", demangler->demangling_style_name); - - fprintf (stream, "}"); -} - -static void -usage (stream, status) - FILE *stream; - int status; -{ - fprintf (stream, "\ -Usage: %s [-_] [-n] [--strip-underscores] [--no-strip-underscores] \n", - program_name); - - fprintf (stream, "\ - [-s "); - print_demangler_list (stream); - fprintf (stream, "]\n"); - - fprintf (stream, "\ - [--format "); - print_demangler_list (stream); - fprintf (stream, "]\n"); - - fprintf (stream, "\ - [--help] [--version] [arg...]\n"); - exit (status); -} - -#define MBUF_SIZE 32767 -char mbuffer[MBUF_SIZE]; - -/* Defined in the automatically-generated underscore.c. */ -extern int prepends_underscore; - -int strip_underscore = 0; - -static const struct option long_options[] = { - {"strip-underscores", no_argument, 0, '_'}, - {"format", required_argument, 0, 's'}, - {"help", no_argument, 0, 'h'}, - {"no-strip-underscores", no_argument, 0, 'n'}, - {"version", no_argument, 0, 'v'}, - {0, no_argument, 0, 0} -}; - -/* More 'friendly' abort that prints the line and file. - config.h can #define abort fancy_abort if you like that sort of thing. */ - -void -fancy_abort () -{ - fatal ("Internal gcc abort."); -} - - -static const char * -standard_symbol_characters PARAMS ((void)); - -static const char * -hp_symbol_characters PARAMS ((void)); - -static const char * -gnu_v3_symbol_characters PARAMS ((void)); - -/* Return the string of non-alnum characters that may occur - as a valid symbol component, in the standard assembler symbol - syntax. */ - -static const char * -standard_symbol_characters () -{ - return "_$."; -} - - -/* Return the string of non-alnum characters that may occur - as a valid symbol name component in an HP object file. - - Note that, since HP's compiler generates object code straight from - C++ source, without going through an assembler, its mangled - identifiers can use all sorts of characters that no assembler would - tolerate, so the alphabet this function creates is a little odd. - Here are some sample mangled identifiers offered by HP: - - typeid*__XT24AddressIndExpClassMember_ - [Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv - __ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv - - This still seems really weird to me, since nowhere else in this - file is there anything to recognize curly brackets, parens, etc. - I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me - this is right, but I still strongly suspect that there's a - misunderstanding here. - - If we decide it's better for c++filt to use HP's assembler syntax - to scrape identifiers out of its input, here's the definition of - the symbol name syntax from the HP assembler manual: - - Symbols are composed of uppercase and lowercase letters, decimal - digits, dollar symbol, period (.), ampersand (&), pound sign(#) and - underscore (_). A symbol can begin with a letter, digit underscore or - dollar sign. If a symbol begins with a digit, it must contain a - non-digit character. - - So have fun. */ -static const char * -hp_symbol_characters () -{ - return "_$.<>#,*&[]:(){}"; -} - - -/* Return the string of non-alnum characters that may occur - as a valid symbol component in the GNU C++ V3 ABI mangling - scheme. */ - -static const char * -gnu_v3_symbol_characters () -{ - return "_$."; -} - - -extern int main PARAMS ((int, char **)); - -int -main (argc, argv) - int argc; - char **argv; -{ - char *result; - int c; - const char *valid_symbols; - enum demangling_styles style = auto_demangling; - - program_name = argv[0]; - - strip_underscore = prepends_underscore; - - while ((c = getopt_long (argc, argv, "_ns:", long_options, (int *) 0)) != EOF) - { - switch (c) - { - case '?': - usage (stderr, 1); - break; - case 'h': - usage (stdout, 0); - case 'n': - strip_underscore = 0; - break; - case 'v': - printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version); - return (0); - case '_': - strip_underscore = 1; - break; - case 's': - { - style = cplus_demangle_name_to_style (optarg); - if (style == unknown_demangling) - { - fprintf (stderr, "%s: unknown demangling style `%s'\n", - program_name, optarg); - return (1); - } - else - cplus_demangle_set_style (style); - } - break; - } - } - - if (optind < argc) - { - for ( ; optind < argc; optind++) - { - demangle_it (argv[optind]); - } - } - else - { - switch (current_demangling_style) - { - case gnu_demangling: - case lucid_demangling: - case arm_demangling: - case java_demangling: - case edg_demangling: - case gnat_demangling: - case auto_demangling: - valid_symbols = standard_symbol_characters (); - break; - case hp_demangling: - valid_symbols = hp_symbol_characters (); - break; - case gnu_v3_demangling: - valid_symbols = gnu_v3_symbol_characters (); - break; - default: - /* Folks should explicitly indicate the appropriate alphabet for - each demangling. Providing a default would allow the - question to go unconsidered. */ - abort (); - } - - for (;;) - { - int i = 0; - c = getchar (); - /* Try to read a label. */ - while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c))) - { - if (i >= MBUF_SIZE-1) - break; - mbuffer[i++] = c; - c = getchar (); - } - if (i > 0) - { - int skip_first = 0; - - if (mbuffer[0] == '.' || mbuffer[0] == '$') - ++skip_first; - if (strip_underscore && mbuffer[skip_first] == '_') - ++skip_first; - - if (skip_first > i) - skip_first = i; - - mbuffer[i] = 0; - flags |= (int) style; - result = cplus_demangle (mbuffer + skip_first, flags); - if (result) - { - if (mbuffer[0] == '.') - putc ('.', stdout); - fputs (result, stdout); - free (result); - } - else - fputs (mbuffer, stdout); - - fflush (stdout); - } - if (c == EOF) - break; - putchar (c); - fflush (stdout); - } - } - - return (0); -} - -static void -fatal (str) - const char *str; -{ - fprintf (stderr, "%s: %s\n", program_name, str); - exit (1); -} - -PTR -xmalloc (size) - size_t size; -{ - register PTR value = (PTR) malloc (size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; -} - -PTR -xrealloc (ptr, size) - PTR ptr; - size_t size; -{ - register PTR value = (PTR) realloc (ptr, size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; -} -#endif /* main */ diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c index 0ba9b8d6b0a..36062d451a2 100644 --- a/libiberty/fibheap.c +++ b/libiberty/fibheap.c @@ -66,7 +66,7 @@ fibnode_new () { fibnode_t node; - node = xcalloc (1, sizeof *node); + node = (fibnode_t) xcalloc (1, sizeof *node); node->left = node; node->right = node; diff --git a/libiberty/md5.c b/libiberty/md5.c index 9450586961f..2e829fb3ee1 100644 --- a/libiberty/md5.c +++ b/libiberty/md5.c @@ -229,7 +229,7 @@ md5_process_bytes (buffer, len, ctx) ctx->buflen = (left_over + add) & 63; } - buffer = (const char *) buffer + add; + buffer = (const void *) ((const char *) buffer + add); len -= add; } @@ -237,7 +237,7 @@ md5_process_bytes (buffer, len, ctx) if (len > 64) { md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); + buffer = (const void *) ((const char *) buffer + (len & ~63)); len &= 63; } @@ -269,7 +269,7 @@ md5_process_block (buffer, len, ctx) struct md5_ctx *ctx; { md5_uint32 correct_words[16]; - const md5_uint32 *words = buffer; + const md5_uint32 *words = (const md5_uint32 *) buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; diff --git a/libiberty/regex.c b/libiberty/regex.c index a83cda05527..f9d9a4e26dc 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -25,7 +25,7 @@ routines with an "x" prefix so they do not collide with the native regex routines or with other components regex routines. */ /* AIX requires this to be the first thing in the file. */ -#if defined _AIX && !defined REGEX_MALLOC +#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC #pragma alloca #endif @@ -4648,7 +4648,7 @@ PREFIX(re_compile_fastmap) (bufp) while (1) { - if (p == pend || *p == succeed) + if (p == pend || *p == (UCHAR_T) succeed) { /* We have reached the (effective) end of pattern. */ if (!FAIL_STACK_EMPTY ()) diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c index 0c2be3ed795..3bac84bf68a 100644 --- a/libiberty/safe-ctype.c +++ b/libiberty/safe-ctype.c @@ -48,20 +48,20 @@ Boston, MA 02111-1307, USA. */ #define xd _sch_isxdigit /* Masks. */ -#define L lo|is |pr /* lower case letter */ -#define XL lo|is|xd|pr /* lowercase hex digit */ -#define U up|is |pr /* upper case letter */ -#define XU up|is|xd|pr /* uppercase hex digit */ -#define D di |xd|pr /* decimal digit */ -#define P pn |pr /* punctuation */ -#define _ pn|is |pr /* underscore */ - -#define C cn /* control character */ -#define Z nv |cn /* NUL */ -#define M nv|sp |cn /* cursor movement: \f \v */ -#define V vs|sp |cn /* vertical space: \r \n */ -#define T nv|sp|bl|cn /* tab */ -#define S nv|sp|bl|pr /* space */ +#define L (const unsigned short) (lo|is |pr) /* lower case letter */ +#define XL (const unsigned short) (lo|is|xd|pr) /* lowercase hex digit */ +#define U (const unsigned short) (up|is |pr) /* upper case letter */ +#define XU (const unsigned short) (up|is|xd|pr) /* uppercase hex digit */ +#define D (const unsigned short) (di |xd|pr) /* decimal digit */ +#define P (const unsigned short) (pn |pr) /* punctuation */ +#define _ (const unsigned short) (pn|is |pr) /* underscore */ + +#define C (const unsigned short) ( cn) /* control character */ +#define Z (const unsigned short) (nv |cn) /* NUL */ +#define M (const unsigned short) (nv|sp |cn) /* cursor movement: \f \v */ +#define V (const unsigned short) (vs|sp |cn) /* vertical space: \r \n */ +#define T (const unsigned short) (nv|sp|bl|cn) /* tab */ +#define S (const unsigned short) (nv|sp|bl|pr) /* space */ /* Are we ASCII? */ #if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \ diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index 7999447bc11..6f90fde05fb 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -234,7 +234,7 @@ splay_tree_xmalloc_allocate (size, data) int size; void *data ATTRIBUTE_UNUSED; { - return xmalloc (size); + return (void *) xmalloc (size); } static void @@ -482,7 +482,7 @@ splay_tree_predecessor (sp, key) } /* Return the immediate successor KEY, or NULL if there is no - predecessor. KEY need not be present in the tree. */ + successor. KEY need not be present in the tree. */ splay_tree_node splay_tree_successor (sp, key) @@ -492,7 +492,7 @@ splay_tree_successor (sp, key) int comparison; splay_tree_node node; - /* If the tree is empty, there is certainly no predecessor. */ + /* If the tree is empty, there is certainly no successor. */ if (!sp->root) return NULL; diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 9d4ddd0ef1e..515dcd56b7e 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1999 +# Copyright (C) 1999, 2002 # Free Software Foundation # # This file is part of the libiberty library. @@ -45,31 +45,25 @@ all: check: @CHECK@ # Run some tests of the demangler. -check-cplus-dem: test-filter $(srcdir)/demangle-expected - $(SHELL) $(srcdir)/regress-demangle $(srcdir)/demangle-expected +check-cplus-dem: test-demangle $(srcdir)/demangle-expected + ./test-demangle < $(srcdir)/demangle-expected -# Note that we just hard-code prepends_underscore to 0. This doesn't -# matter since any particular test can override the default if need -# be. TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES) -test-filter: $(srcdir)/../cplus-dem.c - echo 'int prepends_underscore = 0;' > test-us.c - $(TEST_COMPILE) -o test-filter -DMAIN -DVERSION='"none"' @DEFS@ \ - $(srcdir)/../cplus-dem.c test-us.c -L.. -liberty - +test-demangle: $(srcdir)/test-demangle.c + $(TEST_COMPILE) -o test-demangle \ + $(srcdir)/test-demangle.c ../libiberty.a # Standard (either GNU or Cygnus) rules we don't use. info install-info clean-info dvi install etags tags installcheck: # The standard clean rules. mostlyclean: - rm -f test-us.c test-filter + rm -f test-demangle clean: mostlyclean distclean: clean rm -f Makefile maintainer-clean realclean: distclean - Makefile: $(srcdir)/Makefile.in ../config.status CONFIG_FILES=testsuite/Makefile CONFIG_HEADERS= \ cd .. && $(SHELL) ./config.status diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index ecdd732c370..c0483188239 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -127,31 +127,31 @@ VOrder__9ivTSolverUiRP12ivInteractorT2 ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&) # --format=gnu -_10PageButton\$__both +_10PageButton$__both PageButton::__both # --format=gnu -_3RNG\$singleMantissa +_3RNG$singleMantissa RNG::singleMantissa # --format=gnu -_5IComp\$_release +_5IComp$_release IComp::_release # --format=gnu -_\$_10BitmapComp +_$_10BitmapComp BitmapComp::~BitmapComp(void) # --format=gnu -_\$_9__io_defs +_$_9__io_defs __io_defs::~__io_defs(void) # --format=gnu -_\$_Q23foo3bar +_$_Q23foo3bar foo::bar::~bar(void) # --format=gnu -_\$_Q33foo3bar4bell +_$_Q33foo3bar4bell foo::bar::bell::~bell(void) # --format=gnu @@ -435,11 +435,11 @@ _vt.foo.bar foo::bar virtual table # --format=gnu -_vt\$foo +_vt$foo foo virtual table # --format=gnu -_vt\$foo\$bar +_vt$foo$bar foo::bar virtual table # --format=gnu @@ -647,11 +647,11 @@ zero__8osMemoryPvUi osMemory::zero(void *, unsigned int) # --format=gnu -_2T4\$N +_2T4$N T4::N # --format=gnu -_Q22T42t1\$N +_Q22T42t1$N T4::t1::N # --format=gnu @@ -727,11 +727,11 @@ __t6vector1Zii vector<int>::vector(int) # --format=gnu -_\$_t6vector1Zdi +_$_t6vector1Zdi vector<double>::~vector(int) # --format=gnu -_\$_t6vector1Zii +_$_t6vector1Zii vector<int>::~vector(int) # --format=gnu @@ -827,11 +827,11 @@ next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix List<VHDLEntity>::next(List<VHDLEntity>::Pix &) const # --format=gnu -_GLOBAL_\$D\$set +_GLOBAL_$D$set global destructors keyed to set # --format=gnu -_GLOBAL_\$I\$set +_GLOBAL_$I$set global constructors keyed to set # --format=gnu @@ -875,7 +875,7 @@ __t8BDDHookV1ZPcRCPc BDDHookV<char *>::BDDHookV(char *const &) # --format=gnu -_vt\$t8BDDHookV1ZPc +_vt$t8BDDHookV1ZPc BDDHookV<char *> virtual table # --format=gnu @@ -2564,7 +2564,7 @@ _27_GLOBAL_.N.__12burst_app_ct.app_instance {anonymous}::app_instance # --format=gnu -_26_GLOBAL_\$N\$_tmp_n.iilg4Gya\$app_instance +_26_GLOBAL_$N$_tmp_n.iilg4Gya$app_instance {anonymous}::app_instance # --format=java diff --git a/libiberty/testsuite/regress-demangle b/libiberty/testsuite/regress-demangle deleted file mode 100755 index 303dda54e0c..00000000000 --- a/libiberty/testsuite/regress-demangle +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh - -# Run a regression test for the demangler. -# Usage: regress-demangle TEST-FILE - -failures=0 -count=0 -sed -e '/^#/ d' "$1" | ( - while read type; do - read mangled - read demangled - - x="`./test-filter $type $mangled`" - count=`expr $count + 1` - if test "x$x" != "x$demangled"; then - failures=`expr $failures + 1` - echo "FAIL: $type $mangled" - echo " result: $x" - echo " expected: $demangled" - fi - done - - if test $failures -eq 0; then - echo "All $count tests passed" - else - echo "$failures of $count tests failed" - fi - - test $failures -eq 0 -) diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c new file mode 100644 index 00000000000..82f263e88af --- /dev/null +++ b/libiberty/testsuite/test-demangle.c @@ -0,0 +1,175 @@ +/* Demangler test program, + Copyright (C) 2002 Free Software Foundation, Inc. + Written by Zack Weinberg <zack@codesourcery.com + + This file is part of GNU libiberty. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "ansidecl.h" +#include <stdio.h> +#include "libiberty.h" +#include "demangle.h" + +struct line +{ + size_t alloced; + char *data; +}; + +static unsigned int lineno; + +/* Safely read a single line of arbitrary length from standard input. */ + +#define LINELEN 80 + +static void +getline(buf) + struct line *buf; +{ + char *data = buf->data; + size_t alloc = buf->alloced; + size_t count = 0; + int c; + + if (data == 0) + { + data = xmalloc (LINELEN); + alloc = LINELEN; + } + + /* Skip comment lines. */ + while ((c = getchar()) == '#') + { + while ((c = getchar()) != EOF && c != '\n'); + lineno++; + } + + /* c is the first character on the line, and it's not a comment + line: copy this line into the buffer and return. */ + while (c != EOF && c != '\n') + { + if (count >= alloc) + { + alloc *= 2; + data = xrealloc (data, alloc); + } + data[count++] = c; + c = getchar(); + } + lineno++; + data[count] = '\0'; + + buf->data = data; + buf->alloced = alloc; +} + +/* The tester operates on a data file consisting of triples of lines: + format switch + input to be demangled + expected output + + The format switch is expected to be either the empty string, a + line of the form --format=<name>, or just <name> by itself. */ + +#define FORMATS "--format=" +#define FORMATL (sizeof FORMATS - 1) + +int +main(argc, argv) + int argc; + char **argv; +{ + enum demangling_styles style; + struct line format; + struct line input; + struct line expect; + char *fstyle; + char *result; + int failures = 0; + int tests = 0; + + if (argc > 1) + { + fprintf (stderr, "usage: %s < test-set\n", argv[0]); + return 2; + } + + format.data = 0; + input.data = 0; + expect.data = 0; + + for (;;) + { + getline (&format); + if (feof (stdin)) + break; + + getline (&input); + getline (&expect); + + tests++; + + fstyle = format.data; + if (!strncmp (fstyle, FORMATS, FORMATL)) + fstyle += FORMATL; + + if (fstyle[0] == '\0') + style = auto_demangling; + else + style = cplus_demangle_name_to_style (fstyle); + + if (style == unknown_demangling) + { + printf ("FAIL at line %d: unknown demangling style %s\n", + lineno, fstyle); + failures++; + continue; + } + + cplus_demangle_set_style (style); + + result = cplus_demangle (input.data, + DMGL_PARAMS|DMGL_ANSI|DMGL_VERBOSE|DMGL_TYPES); + + if (result + ? strcmp (result, expect.data) + : strcmp (input.data, expect.data)) + { + printf ("\ +FAIL at line %d, style %s:\n\ +in: %s\n\ +out: %s\n\ +exp: %s\n", + lineno, fstyle, + input.data, + result, + expect.data); + failures++; + } + free (result); + } + + free (format.data); + free (input.data); + free (expect.data); + + printf ("%s: %d tests, %d failures\n", argv[0], tests, failures); + return failures ? 1 : 0; +} diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c index d438225fc1e..aa20e5bff00 100644 --- a/libiberty/vasprintf.c +++ b/libiberty/vasprintf.c @@ -138,7 +138,7 @@ int_vasprintf (result, format, args) #ifdef TEST global_total_width = total_width; #endif - *result = malloc (total_width); + *result = (char *) malloc (total_width); if (*result != NULL) return vsprintf (*result, format, *args); else diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 7fd83af1707..6128a7d1cfa 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,109 @@ +2002-09-30 Gavin Romig-Koch <gavin@redhat.com> + Ken Raeburn <raeburn@cygnus.com> + Aldy Hernandez <aldyh@redhat.com> + Eric Christopher <echristo@redhat.com> + Richard Sandiford <rsandifo@redhat.com> + + * mips-dis.c (print_insn_arg): Handle '[', ']', 'e' and '%'. + (mips_isa_type): Handle bfd_mach_mips4120, bfd_mach_mips5400 + and bfd_mach_mips5500. + * mips-opc.c (V1): Include INSN_4111 and INSN_4120. + (N411, N412, N5, N54, N55): New convenience defines. + (mips_builtin_opcodes): Add vr4120, vr5400 and vr5500 opcodes. + Change dmadd16 and madd16 from V1 to N411. + +2002-09-26 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> + + * mips-dis.c (print_insn_mips): Always allow disassembly of + 32-bit jalx opcode. + +2002-09-24 Nick Clifton <nickc@redhat.com> + + * po/de.po: Updated German translation. + +2002-09-21 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * po/POTFILES.in: Regenerate. + +2002-09-20 Nick Clifton <nickc@redhat.com> + + * ppc-opc.c (CRFD, CRFS): Add PPC_OPERAND_CR flag so that cr + register names are accepted. + +2002-09-17 Svein E. Seldal <Svein.Seldal@solidas.com> + + * tic4x-dis.c: Add function declarations and ATTRIBUTE_UNUSED. + Convert functions to K&R format. + +2002-09-13 Nick Clifton <nickc@redhat.com> + + * ppc-opc.c (MFDEC2): Include Book-E. + (PPCCHLK64): New opcode mask. + (evsubw, evsubiw, evmr, evnot, isellt, iselgt, iseleq, mfpid, + mfcsrr0, mfcsrr1, mfdear, mfesr, mfivpr, mfusprg0, mftbl, + mftbu, mfpir, mfdbsr, mfdbcr0, mfdbcr1, mfdbcr2, mfiac1, + mfiac2, mfiac3, mfiac4, mfdac1, mfdac2, mfdvc1, mfdvc2, mftsr, + mftcr, mfivor0, mfivor1, mfivor2, mfivor3, mfivor4, mfivor5, + mfivor6, mfivor7, mfivor8, mfivor9, mfivor10, mfivor11, + mfivor12, mfivor13, mfivor14, mfivor15, mfbbear, mfmcsrr0, + mfmcsrr1, mfmcsr, mtpid, mtdecar, mtcsrr0, mtcsrr1, mtdear, + mtesr, mtivpr, mtusprg0, mtsprg4, mtsprg5, mtsprg6, mtsprg7, + mtdbsr, mtdbcr0, mtdbcr1, mtdbcr2, mtiac1, mtiac2, mtiac3, + mtiac4, mtdac1, mtdac2, mtdvc1, mtdvc2, mttsr, mttcr, mtivor0, + mtivor1, mtivor2, mtivor3, mtivor4, mtivor5, mtivor6, mtivor7, + mtivor8, mtivor9, mtivor10, mtivor11, mtivor12, mtivor13, + mtivor14, mtivor15, mtbbear, mtmcsrr0, mtmcsrr1, mtmcsr): New + Book-E instructions. + (evfsneg): Fix opcode value. + (dcbtstlse, dcbtlse, icblce, dcblce, icbtsle): Use PPCCHLK64 + mask. + (mcrxr64, tlbivaxe, tlbsxe, tlbsxe.): Restrict to 64-bit + Book-E. + (extsw): Restrict to 64-bit PPC instruction sets. + (extsw.): Does not exist in 64-bit Book-E. + (powerpc_macro): Remove mftbl, mftbu and mftb Book-E macros as + they are no longer needed. + +2002-09-12 Gary Hade <garyhade@us.ibm.com> + + * ppc-dis.c (powerpc_dialect): Add missing PPC_OPCODE_CLASSIC. + +2002-09-11 Nick Clifton <nickc@redhat.com> + + * po/da.po: Updated Danish translation file. + +2002-09-04 Nick Clifton <nickc@redhat.com> + + * ppc-opc.c (extsw, extsw.): Do not allow for the BookE32. + +2002-09-04 Nick Clifton <nickc@redhat.com> + + * disassemble.c (disassembler_usage): Add invocation of + print_ppc_disassembler_options. + * ppc-dis.c (print_ppc_disassembler_options): New function. + +2002-09-04 Nick Clifton <nickc@redhat.com> + + * ppc-opc.c: The BookE implementations of the TLBWE and TLBRE + instructions do not take any arguments. + +2002-09-02 Nick Clifton <nickc@redhat.com> + + * v850-opc.c: Remove redundant references to V850EA architecture. + +2002-09-02 Alan Modra <amodra@bigpond.net.au> + + * arc-opc.c: Include bfd.h. + (arc_get_opcode_mach): Subtract off base bfd_mach value. + +2002-08-30 Alan Modra <amodra@bigpond.net.au> + + * v850-dis.c (disassemble): Remove bfd_mach_v850ea case. + + * mips-dis.c (_print_insn_mips): Don't use hard-coded mach constants. + 2002-08-28 Svein E. Seldal <Svein.Seldal@solidas.com> * configure.in: Added bfd_tic4x_arch. @@ -18,9 +124,9 @@ * z8kgen.c (opt): Fix definition of "in rd,imm16" opcode. * z8k-opc.h: Regenerated with new z8kgen.c. -2002-08-19 Elena Zannoni <ezannoni@redhat.com> +2002-08-19 Elena Zannoni <ezannoni@redhat.com> - From matthew green <mrg@redhat.com> + From matthew green <mrg@redhat.com> * ppc-dis.c (powerpc_dialect): Support `-m500', `-m500x2' and `-mefs'. Turn off AltiVec for E500 and efs. @@ -53,7 +159,7 @@ (efsabs, efsnabs, efsneg, efsadd, efssub, efsmul, efsdiv, efscmpgt, efscmplt, efscmpeq, efststgt, efststlt, efststeq, efscfui, efsctuiz, efscfsi, efscfuf, efscfsf, - efsctui, efsctsi, efsctsiz, efsctuf, efsctsf, + efsctui, efsctsi, efsctsiz, efsctuf, efsctsf, evaddw, evaddiw, evsubfw, evsubifw, evabs, evneg, evextsb, evextsh, evrndw, evcntlzw, evcntlsw, brinc, evand, evandc, evor, evorc, evxor, eveqv, evnand, evnor, evrlw, evrlwi, evslw, evslwi, @@ -237,9 +343,9 @@ * mips-opc.c: Clean up a few whitespace issues, and sort a few entries understanding that 'x' follows 'w' in the alphabet. - + 2002-05-31 Chris G. Demetriou <cgd@broadcom.com> - Ed Satterthwaite <ehs@broadcom.com> + Ed Satterthwaite <ehs@broadcom.com> * mips-opc.c: Add support for SB-1 MDMX subset and extensions. @@ -250,11 +356,11 @@ * po/POTFILES.in: Regenerate. 2002-05-30 Chris G. Demetriou <cgd@broadcom.com> - Ed Satterthwaite <ehs@broadcom.com> + Ed Satterthwaite <ehs@broadcom.com> * mips-dis.c (print_insn_arg): Add support for 'O', 'Q', 'X', 'Y', and 'Z' formats, for MDMX. - (mips_isa_type): Add MDMX instructions to the ISA + (mips_isa_type): Add MDMX instructions to the ISA bit mask for bfd_mach_mipsisa64. * mips-opc.c: Add support for MDMX instructions. (MX): New definition. @@ -264,7 +370,7 @@ 2002-05-30 Diego Novillo <dnovillo@redhat.com> * d10v-opc.c (d10v_opcodes): `btsti' does not modify its - arguments. + arguments. 2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net> @@ -359,7 +465,7 @@ 2002-05-07 Graydon Hoare <graydon@redhat.com> - * cgen-dis.in: (print_insn_@arch@): Cache list of opened CPUs rather + * cgen-dis.in: (print_insn_@arch@): Cache list of opened CPUs rather than just most-recently-opened. 2002-05-01 Alan Modra <amodra@bigpond.net.au> @@ -444,7 +550,7 @@ 2002-03-16 Nick Clifton <nickc@cambridge.redhat.com> * Makefile.am: Tidy up sh64 rules. - * Makefile.in: Regenerate. + * Makefile.in: Regenerate. 2002-03-15 Chris G. Demetriou <cgd@broadcom.com> @@ -562,9 +668,9 @@ 2002-02-12 Graydon Hoare <graydon@redhat.com> * cgen-asm.in (parse_insn_normal): Change call from - @arch@_cgen_parse_operand to cd->parse_operand, to + @arch@_cgen_parse_operand to cd->parse_operand, to facilitate CGEN_ASM_INIT_HOOK doing useful work. - + 2002-02-11 Alexandre Oliva <aoliva@redhat.com> * sparc-dis.c (print_insn_sparc): Make sure 0xFFFFFFFF is not @@ -1053,7 +1159,7 @@ * cgen-asm.in: Include safe-ctype.h in preference to ctype.h. Fix formatting. Use ISSPACE instead of isspace and TOLOWER instead of tolower. - (@arch@_cgen_build_insn_regex): Remove duplication of syntax + (@arch@_cgen_build_insn_regex): Remove duplication of syntax string elements in constructed regular expression. * fr30-asm.c: Regenerate. * fr30-desc.c: Regenerate. @@ -1120,7 +1226,7 @@ * sh-opc.h: Fix encoding of least significant nibble of the DSP single data transfer instructions. - * sh-dis.c (print_insn_shx): Fix decoding of As opcode in DSP + * sh-dis.c (print_insn_shx): Fix decoding of As opcode in DSP instructions. 2001-10-08 Nick Clifton <nickc@cambridge.redhat.com> @@ -1129,30 +1235,30 @@ C files. * cgen-dis.in: The same. * cgen-ibld.in: The same. - * fr30-asm.c: Regenerate. - * fr30-desc.c: Regenerate. - * fr30-dis.c: Regenerate. - * fr30-ibld.c: Regenerate. - * fr30-opc.c: Regenerate. - * m32r-asm.c: Regenerate. - * m32r-desc.c: Regenerate. - * m32r-dis.c: Regenerate. - * m32r-ibld.c: Regenerate. - * m32r-opc.c: Regenerate. - * m32r-opinst.c Regenerate. - * openrisc-asm.c: Regenerate. - * openrisc-desc.c: Regenerate. - * openrisc-dis.c: Regenerate. - * openrisc-ibld.c: Regenerate. - * openrisc-opc.c: Regenerate. - * openrisc-opc.h: Regenerate. + * fr30-asm.c: Regenerate. + * fr30-desc.c: Regenerate. + * fr30-dis.c: Regenerate. + * fr30-ibld.c: Regenerate. + * fr30-opc.c: Regenerate. + * m32r-asm.c: Regenerate. + * m32r-desc.c: Regenerate. + * m32r-dis.c: Regenerate. + * m32r-ibld.c: Regenerate. + * m32r-opc.c: Regenerate. + * m32r-opinst.c Regenerate. + * openrisc-asm.c: Regenerate. + * openrisc-desc.c: Regenerate. + * openrisc-dis.c: Regenerate. + * openrisc-ibld.c: Regenerate. + * openrisc-opc.c: Regenerate. + * openrisc-opc.h: Regenerate. * Makefile.in: Regenerate. * po/POTFILES.in: Regenerate. * po/opcodes.pot: Regenerate. 2001-10-08 Aldy Hernandez <aldyh@redhat.com> - * arm-opc.h (arm_opcodes): Add cirrus insns. + * arm-opc.h (arm_opcodes): Add cirrus insns. * arm-dis.c (print_insn_arm): Add 'I' case. @@ -1169,9 +1275,9 @@ 2001-09-30 John Healy <jhealy@redhat.com> - * cgen-ibld.in (insert_1): Switched bfd_get_bits and bfd_set_bits - calls to cgen_get_insn_value and cgen_put_insn_value calls. - (extract_1): Switched bfd_get_bits call to cgen_get_insn_value call. + * cgen-ibld.in (insert_1): Switched bfd_get_bits and bfd_set_bits + calls to cgen_get_insn_value and cgen_put_insn_value calls. + (extract_1): Switched bfd_get_bits call to cgen_get_insn_value call. 2001-09-30 Hans-Peter Nilsson <hp@bitrange.com> @@ -1475,10 +1581,10 @@ 2001-07-12 Jeff Johnston <jjohnstn@redhat.com> - * cgen-asm.in: Include "xregex.h" always to enable the libiberty - regex support. - (@arch@_cgen_build_insn_regex): New routine from Graydon. - (@arch@_cgen_assemble_insn): Add Graydon's code to use regex + * cgen-asm.in: Include "xregex.h" always to enable the libiberty + regex support. + (@arch@_cgen_build_insn_regex): New routine from Graydon. + (@arch@_cgen_assemble_insn): Add Graydon's code to use regex to verify if it is worth parsing the insn as insn "x". Also update error message when insn is not a recognized format of the insn vs when the insn is completely unrecognized. @@ -1607,10 +1713,10 @@ 2001-06-06 Christian Groessler <cpg@aladdin.de> - * z8k-dis.c: Fix formatting. - (unpack_instr): Remove unused cases in switch statement. Add - safety abort() in default case. - (unparse_instr): Add safety abort() in default case. + * z8k-dis.c: Fix formatting. + (unpack_instr): Remove unused cases in switch statement. Add + safety abort() in default case. + (unparse_instr): Add safety abort() in default case. 2001-06-06 Peter Jakubek <pjak@snafu.de> @@ -1732,21 +1838,21 @@ 2001-04-27 Johan Rydberg <jrydberg@opencores.org> - * Makefile.am: Add OpenRISC target. - * Makefile.in: Regenerated. + * Makefile.am: Add OpenRISC target. + * Makefile.in: Regenerated. - * disassemble.c (disassembler): Recognize the OpenRISC disassembly. + * disassemble.c (disassembler): Recognize the OpenRISC disassembly. - * configure.in (bfd_openrisc_arch): Add target. - * configure: Regenerated. + * configure.in (bfd_openrisc_arch): Add target. + * configure: Regenerated. - * openrisc-asm.c: New file. - * openrisc-desc.c: Likewise. - * openrisc-desc.h: Likewise. - * openrisc-dis.c: Likewise. - * openrisc-ibld.c: Likewise. - * openrisc-opc.c: Likewise. - * openrisc-opc.h: Likewise. + * openrisc-asm.c: New file. + * openrisc-desc.c: Likewise. + * openrisc-desc.h: Likewise. + * openrisc-dis.c: Likewise. + * openrisc-ibld.c: Likewise. + * openrisc-opc.c: Likewise. + * openrisc-opc.h: Likewise. 2001-04-24 Christian Groessler <cpg@aladdin.de> @@ -1800,8 +1906,8 @@ 2001-03-20 Patrick Macdonald <patrickm@redhat.com> - * cgen-dis.in (print_insn_@arch@): Add support for target machine - determination via CGEN_COMPUTE_MACH. + * cgen-dis.in (print_insn_@arch@): Add support for target machine + determination via CGEN_COMPUTE_MACH. * fr30-desc.c: Regenerate. * fr30-dis.c: Regenerate. * fr30-opc.h: Regenerate. @@ -1835,8 +1941,8 @@ 2001-03-06 Nick Clifton <nickc@redhat.com> * arm-dis.c (print_insn_thumb): Compute destination address - of BLX(1) instruction by taking bit 1 from PC and not from bit - 0 of the offset. + of BLX(1) instruction by taking bit 1 from PC and not from bit + 0 of the offset. 2001-03-06 Igor Shevlyakov <igor@windriver.com> @@ -1899,11 +2005,11 @@ 2001-02-18 lars brinkhoff <lars@nocrew.org> - * Makefile.am: Add PDP-11 target. - * configure.in: Likewise. - * disassemble.c: Likewise. - * pdp11-dis.c: New file. - * pdp11-opc.c: New file. + * Makefile.am: Add PDP-11 target. + * configure.in: Likewise. + * disassemble.c: Likewise. + * pdp11-dis.c: New file. + * pdp11-opc.c: New file. 2001-02-14 Jim Wilson <wilson@redhat.com> @@ -1918,7 +2024,7 @@ 2001-02-11 Maciej W. Rozycki <macro@ds2.pg.gda.pl> - * mips-dis.c (print_insn_arg): Use top four bits of the address of + * mips-dis.c (print_insn_arg): Use top four bits of the address of the following instruction not of the jump itself for the jump target. (print_mips16_insn_arg): Likewise. @@ -2123,28 +2229,28 @@ 2000-12-03 Chris Demetriou cgd@sibyte.com - * mips-opc.c (mips_builtin_opcodes): Use the WR_HILO, RD_HILO, - MOD_HILO, and MOD_LO macros. + * mips-opc.c (mips_builtin_opcodes): Use the WR_HILO, RD_HILO, + MOD_HILO, and MOD_LO macros. - * mips-opc.c (M1, M2): Delete. - (mips_builtin_opcodes): Remove all uses of M1. + * mips-opc.c (M1, M2): Delete. + (mips_builtin_opcodes): Remove all uses of M1. - * mips-opc.c (mips_builtin_opcodes): Make the dmfc2 and dmtc2 - instructions take "G" format second operands and use the - correct flags. - There are mfc3 and mtc3 opcodes, so add dmfc3 and dmtc3 opcodes to + * mips-opc.c (mips_builtin_opcodes): Make the dmfc2 and dmtc2 + instructions take "G" format second operands and use the + correct flags. + There are mfc3 and mtc3 opcodes, so add dmfc3 and dmtc3 opcodes to match. - Delete "sel" code operands from mfc1 and mtc1. - Add MIPS64 opcode changes (dclo, dclz), and "sel" code variants + Delete "sel" code operands from mfc1 and mtc1. + Add MIPS64 opcode changes (dclo, dclz), and "sel" code variants for dm[ft]c[023]. 2000-12-03 Ed Satterthwaite ehs@sibyte.com and - Chris Demetriou cgd@sibyte.com + Chris Demetriou cgd@sibyte.com - * mips-opc.c (mips_builtin_opcodes): Finish additions - for MIPS32 support, and clean up existing entries for - aesthetics, consistency with the MIPS32 ISA, and - with consistency the rest of the table. + * mips-opc.c (mips_builtin_opcodes): Finish additions + for MIPS32 support, and clean up existing entries for + aesthetics, consistency with the MIPS32 ISA, and + with consistency the rest of the table. 2000-12-01 Nick Clifton <nickc@redhat.com> @@ -2153,32 +2259,32 @@ 2000-12-01 Chris Demetriou <cgd@sibyte.com> - mips-dis.c (print_insn_arg): Handle new 'U' and 'J' argument - specifiers. Update 'B' for new constant names, and remove - 'm'. - mips-opc.c (mips_builtin_opcodes): Place "pref" and "ssnop" - near the top of the array, so they are disassembled properly. - Enable "ssnop" for MIPS32. Add "break" variant with 20 bit - code for MIPS32. Update "clo" and "clz" to use 'U' operand - specifier. Add 'H' format specifier variants for "mfc1," - "mfc2," "mfc3," "mtc1," "mtc2," and "mtc3" for MIPS32. Update - MIPS32 "sdbbp" to use 'B' operand specifier. Add MIPS32 - "wait" variant which uses 'J' operand specifier. - - * mips-dis.c (set_mips_isa_type): Update to use - CPU_UNKNOWN and ISA_* constants. Add bfd_mach_mips32 case. - Replace bfd_mach_mips4K with bfd_mach_mips32_4k case. - * mips-opc.c (I32): New constant for instructions added in - MIPS32. - (P4): Delete. - (mips_builtin_opcodes) Replace all uses of P4 with I32. - - * mips-dis.c (set_mips_isa_type): Add cases for - bfd_mach_mips5 and bfd_mach_mips64. - * mips-opc.c (I64): New definitions. - - * mips-dis.c (set_mips_isa_type): Add case for - bfd_mach_mips_sb1. + mips-dis.c (print_insn_arg): Handle new 'U' and 'J' argument + specifiers. Update 'B' for new constant names, and remove + 'm'. + mips-opc.c (mips_builtin_opcodes): Place "pref" and "ssnop" + near the top of the array, so they are disassembled properly. + Enable "ssnop" for MIPS32. Add "break" variant with 20 bit + code for MIPS32. Update "clo" and "clz" to use 'U' operand + specifier. Add 'H' format specifier variants for "mfc1," + "mfc2," "mfc3," "mtc1," "mtc2," and "mtc3" for MIPS32. Update + MIPS32 "sdbbp" to use 'B' operand specifier. Add MIPS32 + "wait" variant which uses 'J' operand specifier. + + * mips-dis.c (set_mips_isa_type): Update to use + CPU_UNKNOWN and ISA_* constants. Add bfd_mach_mips32 case. + Replace bfd_mach_mips4K with bfd_mach_mips32_4k case. + * mips-opc.c (I32): New constant for instructions added in + MIPS32. + (P4): Delete. + (mips_builtin_opcodes) Replace all uses of P4 with I32. + + * mips-dis.c (set_mips_isa_type): Add cases for + bfd_mach_mips5 and bfd_mach_mips64. + * mips-opc.c (I64): New definitions. + + * mips-dis.c (set_mips_isa_type): Add case for + bfd_mach_mips_sb1. 2000-11-28 Hans-Peter Nilsson <hp@bitrange.com> @@ -2292,8 +2398,8 @@ 2000-09-07 Catherine Moore <clm@redhat.com> - * d30v-opc.c (d30v_format_tab): Use format Ra for - modinc and moddec. + * d30v-opc.c (d30v_format_tab): Use format Ra for + modinc and moddec. 2000-09-06 Alexandre Oliva <aoliva@redhat.com> diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index d2c21434f00..ed6e8134e32 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -477,7 +477,7 @@ arc-dis.lo: arc-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \ $(INCDIR)/elf/reloc-macros.h opintl.h arc-dis.h arc-ext.h arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/arc.h + $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h arc-ext.h $(INCDIR)/libiberty.h arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ @@ -723,8 +723,8 @@ sparc-opc.lo: sparc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/sparc.h tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic30.h -tic4x-dis.lo: tic4x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic4x.h +tic4x-dis.lo: tic4x-dis.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic4x.h tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic54x.h \ $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 634161834a3..c4742303ebf 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -449,7 +449,7 @@ acinclude.m4 aclocal.m4 config.in configure configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES) OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS) @@ -973,7 +973,7 @@ arc-dis.lo: arc-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \ $(INCDIR)/elf/reloc-macros.h opintl.h arc-dis.h arc-ext.h arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/arc.h + $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h arc-ext.h $(INCDIR)/libiberty.h arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ @@ -1219,8 +1219,8 @@ sparc-opc.lo: sparc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/sparc.h tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic30.h -tic4x-dis.lo: tic4x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic4x.h +tic4x-dis.lo: tic4x-dis.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic4x.h tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic54x.h \ $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c index b7afb86ac92..c2d9e1b7478 100644 --- a/opcodes/arc-opc.c +++ b/opcodes/arc-opc.c @@ -20,6 +20,7 @@ #include "sysdep.h" #include <stdio.h> #include "ansidecl.h" +#include "bfd.h" #include "opcode/arc.h" #define INSERT_FN(fn) \ @@ -513,7 +514,7 @@ arc_get_opcode_mach (bfd_mach, big_p) ARC_MACH_7, ARC_MACH_8 }; - return mach_type_map[bfd_mach] | (big_p ? ARC_MACH_BIG : 0); + return mach_type_map[bfd_mach - bfd_mach_arc_5] | (big_p ? ARC_MACH_BIG : 0); } /* Initialize any tables that need it. diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 4d78a73b403..4bd0d898c32 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -367,6 +367,9 @@ disassembler_usage (stream) #ifdef ARCH_arm print_arm_disassembler_options (stream); #endif +#ifdef ARCH_powerpc + print_ppc_disassembler_options (stream); +#endif return; } diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c index 9b35a472712..0a4280108da 100644 --- a/opcodes/mips-dis.c +++ b/opcodes/mips-dis.c @@ -110,6 +110,8 @@ print_insn_arg (d, l, pc, info) case ',': case '(': case ')': + case '[': + case ']': (*info->fprintf_func) (info->stream, "%c", *d); break; @@ -279,6 +281,16 @@ print_insn_arg (d, l, pc, info) (l >> OP_SH_PERFREG) & OP_MASK_PERFREG); break; + case 'e': + (*info->fprintf_func) (info->stream, "%d", + (l >> OP_SH_VECBYTE) & OP_MASK_VECBYTE); + break; + + case '%': + (*info->fprintf_func) (info->stream, "%d", + (l >> OP_SH_VECALIGN) & OP_MASK_VECALIGN); + break; + case 'H': (*info->fprintf_func) (info->stream, "%d", (l >> OP_SH_SEL) & OP_MASK_SEL); @@ -374,6 +386,10 @@ mips_isa_type (mach, isa, cputype) *cputype = CPU_R4111; *isa = ISA_MIPS3; break; + case bfd_mach_mips4120: + *cputype = CPU_VR4120; + *isa = ISA_MIPS3; + break; case bfd_mach_mips4300: *cputype = CPU_R4300; *isa = ISA_MIPS3; @@ -394,6 +410,14 @@ mips_isa_type (mach, isa, cputype) *cputype = CPU_R5000; *isa = ISA_MIPS4; break; + case bfd_mach_mips5400: + *cputype = CPU_VR5400; + *isa = ISA_MIPS4; + break; + case bfd_mach_mips5500: + *cputype = CPU_VR5500; + *isa = ISA_MIPS4; + break; case bfd_mach_mips6000: *cputype = CPU_R6000; *isa = ISA_MIPS2; @@ -526,7 +550,9 @@ print_insn_mips (memaddr, word, info) { register const char *d; - if (! OPCODE_IS_MEMBER (op, mips_isa, target_processor)) + /* We always allow to disassemble the jalx instruction. */ + if (! OPCODE_IS_MEMBER (op, mips_isa, target_processor) + && strcmp (op->name, "jalx")) continue; /* Figure out instruction type and branch delay information. */ @@ -595,7 +621,7 @@ _print_insn_mips (memaddr, info, endianness) #endif #if SYMTAB_AVAILABLE - if (info->mach == 16 + 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 diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c index 6e8adc5d192..7dae28a4f55 100644 --- a/opcodes/mips-opc.c +++ b/opcodes/mips-opc.c @@ -97,10 +97,15 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * #define P3 INSN_4650 #define L1 INSN_4010 -#define V1 INSN_4100 +#define V1 (INSN_4100 | INSN_4111 | INSN_4120) #define T3 INSN_3900 #define M1 INSN_10000 #define SB1 INSN_SB1 +#define N411 INSN_4111 +#define N412 INSN_4120 +#define N5 (INSN_5400 | INSN_5500) +#define N54 INSN_5400 +#define N55 INSN_5500 #define G1 (T3 \ ) @@ -133,7 +138,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"pref", "k,o(b)", 0xcc000000, 0xfc000000, RD_b, I4|I32|G3 }, {"prefx", "h,t(b)", 0x4c00000f, 0xfc0007ff, RD_b|RD_t, I4 }, {"nop", "", 0x00000000, 0xffffffff, 0, I1 }, -{"ssnop", "", 0x00000040, 0xffffffff, 0, I32 }, +{"ssnop", "", 0x00000040, 0xffffffff, 0, I32|N55 }, {"li", "t,j", 0x24000000, 0xffe00000, WR_t, I1 }, /* addiu */ {"li", "t,i", 0x34000000, 0xffe00000, WR_t, I1 }, /* ori */ {"li", "t,I", 0, (int) M_LI, INSN_MACRO, I1 }, @@ -154,6 +159,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"add.s", "D,V,T", 0x46000000, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 }, {"add.d", "D,V,T", 0x46200000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 }, {"add.ob", "X,Y,Q", 0x7800000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"add.ob", "D,S,T", 0x4ac0000b, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"add.ob", "D,S,T[e]", 0x4800000b, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"add.ob", "D,S,k", 0x4bc0000b, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"add.ps", "D,V,T", 0x46c00000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"add.qh", "X,Y,Q", 0x7820000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"adda.ob", "Y,Q", 0x78000037, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, @@ -166,6 +174,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"addu", "d,v,t", 0x00000021, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"addu", "t,r,I", 0, (int) M_ADDU_I, INSN_MACRO, I1 }, {"alni.ob", "X,Y,Z,O", 0x78000018, 0xff00003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"alni.ob", "D,S,T,%", 0x48000018, 0xff00003f, WR_D|RD_S|RD_T, N54 }, {"alni.qh", "X,Y,Z,O", 0x7800001a, 0xff00003f, WR_D|RD_S|RD_T|FP_D, MX }, {"alnv.ps", "D,V,T,s", 0x4c00001e, 0xfc00003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"alnv.ob", "X,Y,Z,s", 0x78000019, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, MX|SB1 }, @@ -173,6 +182,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"and", "d,v,t", 0x00000024, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"and", "t,r,I", 0, (int) M_AND_I, INSN_MACRO, I1 }, {"and.ob", "X,Y,Q", 0x7800000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"and.ob", "D,S,T", 0x4ac0000c, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"and.ob", "D,S,T[e]", 0x4800000c, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"and.ob", "D,S,k", 0x4bc0000c, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"and.qh", "X,Y,Q", 0x7820000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"andi", "t,r,i", 0x30000000, 0xfc000000, WR_t|RD_s, I1 }, /* b is at the top of the table. */ @@ -278,6 +290,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"c.eq.s", "S,T", 0x46000032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, {"c.eq.s", "M,S,T", 0x46000032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 }, {"c.eq.ob", "Y,Q", 0x78000001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 }, +{"c.eq.ob", "S,T", 0x4ac00001, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"c.eq.ob", "S,T[e]", 0x48000001, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"c.eq.ob", "S,k", 0x4bc00001, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"c.eq.ps", "S,T", 0x46c00032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.eq.ps", "M,S,T", 0x46c00032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.eq.qh", "Y,Q", 0x78200001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX }, @@ -340,6 +355,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"c.lt.s", "S,T", 0x4600003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, {"c.lt.s", "M,S,T", 0x4600003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 }, {"c.lt.ob", "Y,Q", 0x78000004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 }, +{"c.lt.ob", "S,T", 0x4ac00004, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"c.lt.ob", "S,T[e]", 0x48000004, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"c.lt.ob", "S,k", 0x4bc00004, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"c.lt.ps", "S,T", 0x46c0003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.lt.ps", "M,S,T", 0x46c0003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.lt.qh", "Y,Q", 0x78200004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX }, @@ -354,6 +372,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"c.le.s", "S,T", 0x4600003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, {"c.le.s", "M,S,T", 0x4600003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 }, {"c.le.ob", "Y,Q", 0x78000005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 }, +{"c.le.ob", "S,T", 0x4ac00005, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"c.le.ob", "S,T[e]", 0x48000005, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"c.le.ob", "S,k", 0x4bc00005, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"c.le.ps", "S,T", 0x46c0003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.le.ps", "M,S,T", 0x46c0003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.le.qh", "Y,Q", 0x78200005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX }, @@ -421,8 +442,8 @@ const struct mips_opcode mips_builtin_opcodes[] = {"cfc1", "t,S", 0x44400000, 0xffe007ff, LCD|WR_t|RD_C1|FP_S, I1 }, {"cfc2", "t,G", 0x48400000, 0xffe007ff, LCD|WR_t|RD_C2, I1 }, {"cfc3", "t,G", 0x4c400000, 0xffe007ff, LCD|WR_t|RD_C3, I1 }, -{"clo", "U,s", 0x70000021, 0xfc0007ff, WR_d|WR_t|RD_s, I32 }, -{"clz", "U,s", 0x70000020, 0xfc0007ff, WR_d|WR_t|RD_s, I32 }, +{"clo", "U,s", 0x70000021, 0xfc0007ff, WR_d|WR_t|RD_s, I32|N55 }, +{"clz", "U,s", 0x70000020, 0xfc0007ff, WR_d|WR_t|RD_s, I32|N55 }, {"ctc0", "t,G", 0x40c00000, 0xffe007ff, COD|RD_t|WR_CC, I1 }, {"ctc1", "t,G", 0x44c00000, 0xffe007ff, COD|RD_t|WR_CC|FP_S, I1 }, {"ctc1", "t,S", 0x44c00000, 0xffe007ff, COD|RD_t|WR_CC|FP_S, I1 }, @@ -450,8 +471,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"daddiu", "t,r,j", 0x64000000, 0xfc000000, WR_t|RD_s, I3 }, {"daddu", "d,v,t", 0x0000002d, 0xfc0007ff, WR_d|RD_s|RD_t, I3 }, {"daddu", "t,r,I", 0, (int) M_DADDU_I, INSN_MACRO, I3 }, -{"dclo", "U,s", 0x70000025, 0xfc0007ff, RD_s|WR_d|WR_t, I64 }, -{"dclz", "U,s", 0x70000024, 0xfc0007ff, RD_s|WR_d|WR_t, I64 }, +{"dbreak", "", 0x7000003f, 0xffffffff, 0, N5 }, +{"dclo", "U,s", 0x70000025, 0xfc0007ff, RD_s|WR_d|WR_t, I64|N55 }, +{"dclz", "U,s", 0x70000024, 0xfc0007ff, RD_s|WR_d|WR_t, I64|N55 }, /* dctr and dctw are used on the r5000. */ {"dctr", "o(b)", 0xbc050000, 0xfc1f0000, RD_b, I3 }, {"dctw", "o(b)", 0xbc090000, 0xfc1f0000, RD_b, I3 }, @@ -484,8 +506,15 @@ const struct mips_opcode mips_builtin_opcodes[] = {"dli", "t,j", 0x24000000, 0xffe00000, WR_t, I3 }, /* addiu */ {"dli", "t,i", 0x34000000, 0xffe00000, WR_t, I3 }, /* ori */ {"dli", "t,I", 0, (int) M_DLI, INSN_MACRO, I3 }, - -{"dmadd16", "s,t", 0x00000029, 0xfc00ffff, RD_s|RD_t|MOD_LO, V1 }, +{"dmacc", "d,s,t", 0x00000029, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmacchi", "d,s,t", 0x00000229, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmacchis", "d,s,t", 0x00000629, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmacchiu", "d,s,t", 0x00000269, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmacchius", "d,s,t", 0x00000669, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmaccs", "d,s,t", 0x00000429, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmaccu", "d,s,t", 0x00000069, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmaccus", "d,s,t", 0x00000469, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, N412 }, +{"dmadd16", "s,t", 0x00000029, 0xfc00ffff, RD_s|RD_t|MOD_LO, N411 }, {"dmfc0", "t,G", 0x40200000, 0xffe007ff, LCD|WR_t|RD_C0, I3 }, {"dmfc0", "t,G,H", 0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, I64 }, {"dmtc0", "t,G", 0x40a00000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC, I3 }, @@ -518,8 +547,14 @@ const struct mips_opcode mips_builtin_opcodes[] = {"dremu", "z,s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, I3 }, {"dremu", "d,v,t", 3, (int) M_DREMU_3, INSN_MACRO, I3 }, {"dremu", "d,v,I", 3, (int) M_DREMU_3I, INSN_MACRO, I3 }, +{"dret", "", 0x7000003e, 0xffffffff, 0, N5 }, {"drol", "d,v,t", 0, (int) M_DROL, INSN_MACRO, I3 }, {"drol", "d,v,I", 0, (int) M_DROL_I, INSN_MACRO, I3 }, +{"drorv", "d,t,s", 0x00000056, 0xfc0007ff, RD_t|RD_s|WR_d, N5 }, +{"dror32", "d,w,<", 0x0020003e, 0xffe0003f, WR_d|RD_t, N5 }, +{"dror", "d,w,s", 0x00000056, 0xfc0007ff, RD_t|RD_s|WR_d, N5 }, /* drorv */ +{"dror", "d,w,>", 0x0020003e, 0xffe0003f, WR_d|RD_t, N5 }, +{"dror", "d,w,<", 0x0020003a, 0xffe0003f, WR_d|RD_t, N5 }, {"dror", "d,v,t", 0, (int) M_DROR, INSN_MACRO, I3 }, {"dror", "d,v,I", 0, (int) M_DROR_I, INSN_MACRO, I3 }, {"dsllv", "d,t,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, I3 }, @@ -609,7 +644,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"lld", "t,o(b)", 0xd0000000, 0xfc000000, LDD|RD_b|WR_t, I3 }, {"lld", "t,A(b)", 0, (int) M_LLD_AB, INSN_MACRO, I3 }, {"lui", "t,u", 0x3c000000, 0xffe00000, WR_t, I1 }, -{"luxc1", "D,t(b)", 0x4c000005, 0xfc00f83f, LDD|WR_D|RD_t|RD_b, I5 }, +{"luxc1", "D,t(b)", 0x4c000005, 0xfc00f83f, LDD|WR_D|RD_t|RD_b, I5|N55 }, {"lw", "t,o(b)", 0x8c000000, 0xfc000000, LDD|RD_b|WR_t, I1 }, {"lw", "t,A(b)", 0, (int) M_LW_AB, INSN_MACRO, I1 }, {"lwc0", "E,o(b)", 0xc0000000, 0xfc000000, CLD|RD_b|WR_CC, I1 }, @@ -635,24 +670,39 @@ const struct mips_opcode mips_builtin_opcodes[] = {"lwu", "t,o(b)", 0x9c000000, 0xfc000000, LDD|RD_b|WR_t, I3 }, {"lwu", "t,A(b)", 0, (int) M_LWU_AB, INSN_MACRO, I3 }, {"lwxc1", "D,t(b)", 0x4c000000, 0xfc00f83f, LDD|WR_D|RD_t|RD_b, I4 }, +{"macc", "d,s,t", 0x00000028, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"macc", "d,s,t", 0x00000158, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"maccs", "d,s,t", 0x00000428, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"macchi", "d,s,t", 0x00000228, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"macchi", "d,s,t", 0x00000358, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"macchis", "d,s,t", 0x00000628, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"macchiu", "d,s,t", 0x00000268, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"macchiu", "d,s,t", 0x00000359, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"macchius","d,s,t", 0x00000668, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"maccu", "d,s,t", 0x00000068, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, +{"maccu", "d,s,t", 0x00000159, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"maccus", "d,s,t", 0x00000468, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N412 }, {"mad", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO, P3 }, {"madu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO, P3 }, {"madd.d", "D,R,S,T", 0x4c000021, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4 }, {"madd.s", "D,R,S,T", 0x4c000020, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4 }, {"madd.ps", "D,R,S,T", 0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5 }, {"madd", "s,t", 0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO, L1 }, -{"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32}, +{"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32|N55}, {"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, G1 }, {"madd", "d,s,t", 0x70000000, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 }, {"maddu", "s,t", 0x0000001d, 0xfc00ffff, RD_s|RD_t|WR_HILO, L1 }, -{"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32}, +{"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32|N55}, {"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, G1 }, {"maddu", "d,s,t", 0x70000001, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 }, -{"madd16", "s,t", 0x00000028, 0xfc00ffff, RD_s|RD_t|MOD_HILO, V1 }, +{"madd16", "s,t", 0x00000028, 0xfc00ffff, RD_s|RD_t|MOD_HILO, N411 }, {"max.ob", "X,Y,Q", 0x78000007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"max.ob", "D,S,T", 0x4ac00007, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"max.ob", "D,S,T[e]", 0x48000007, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"max.ob", "D,S,k", 0x4bc00007, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"max.qh", "X,Y,Q", 0x78200007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, -{"mfpc", "t,P", 0x4000c801, 0xffe0ffc1, LCD|WR_t|RD_C0, M1 }, -{"mfps", "t,P", 0x4000c800, 0xffe0ffc1, LCD|WR_t|RD_C0, M1 }, +{"mfpc", "t,P", 0x4000c801, 0xffe0ffc1, LCD|WR_t|RD_C0, M1|N5 }, +{"mfps", "t,P", 0x4000c800, 0xffe0ffc1, LCD|WR_t|RD_C0, M1|N5 }, {"mfc0", "t,G", 0x40000000, 0xffe007ff, LCD|WR_t|RD_C0, I1 }, {"mfc0", "t,G,H", 0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, I32 }, {"mfc1", "t,S", 0x44000000, 0xffe007ff, LCD|WR_t|RD_S|FP_S, I1 }, @@ -661,9 +711,13 @@ const struct mips_opcode mips_builtin_opcodes[] = {"mfc2", "t,G,H", 0x48000000, 0xffe007f8, LCD|WR_t|RD_C2, I32 }, {"mfc3", "t,G", 0x4c000000, 0xffe007ff, LCD|WR_t|RD_C3, I1 }, {"mfc3", "t,G,H", 0x4c000000, 0xffe007f8, LCD|WR_t|RD_C3, I32 }, +{"mfdr", "t,G", 0x7000003d, 0xffe007ff, LCD|WR_t|RD_C0, N5 }, {"mfhi", "d", 0x00000010, 0xffff07ff, WR_d|RD_HI, I1 }, {"mflo", "d", 0x00000012, 0xffff07ff, WR_d|RD_LO, I1 }, {"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"min.ob", "D,S,T", 0x4ac00006, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"min.ob", "D,S,T[e]", 0x48000006, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"min.ob", "D,S,k", 0x4bc00006, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"min.qh", "X,Y,Q", 0x78200006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"mov.d", "D,S", 0x46200006, 0xffff003f, WR_D|RD_S|FP_D, I1 }, {"mov.s", "D,S", 0x46000006, 0xffff003f, WR_D|RD_S|FP_S, I1 }, @@ -694,17 +748,21 @@ const struct mips_opcode mips_builtin_opcodes[] = {"movz.l", "X,Y,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 }, {"movz.s", "D,S,t", 0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, I4|I32 }, {"movz.ps", "D,S,t", 0x46c00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I5 }, +{"msac", "d,s,t", 0x000001d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"msacu", "d,s,t", 0x000001d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"msachi", "d,s,t", 0x000003d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"msachiu", "d,s,t", 0x000003d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, /* move is at the top of the table. */ {"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4 }, {"msub.s", "D,R,S,T", 0x4c000028, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4 }, {"msub.ps", "D,R,S,T", 0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5 }, {"msub", "s,t", 0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO, L1 }, -{"msub", "s,t", 0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32 }, +{"msub", "s,t", 0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32|N55 }, {"msubu", "s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, L1 }, -{"msubu", "s,t", 0x70000005, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32 }, -{"mtpc", "t,P", 0x4080c801, 0xffe0ffc1, COD|RD_t|WR_C0, M1 }, -{"mtps", "t,P", 0x4080c800, 0xffe0ffc1, COD|RD_t|WR_C0, M1 }, +{"msubu", "s,t", 0x70000005, 0xfc00ffff, RD_s|RD_t|MOD_HILO, I32|N55 }, +{"mtpc", "t,P", 0x4080c801, 0xffe0ffc1, COD|RD_t|WR_C0, M1|N5 }, +{"mtps", "t,P", 0x4080c800, 0xffe0ffc1, COD|RD_t|WR_C0, M1|N5 }, {"mtc0", "t,G", 0x40800000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC, I1 }, {"mtc0", "t,G,H", 0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC, I32 }, {"mtc1", "t,S", 0x44800000, 0xffe007ff, COD|RD_t|WR_S|FP_S, I1 }, @@ -713,33 +771,57 @@ const struct mips_opcode mips_builtin_opcodes[] = {"mtc2", "t,G,H", 0x48800000, 0xffe007f8, COD|RD_t|WR_C2|WR_CC, I32 }, {"mtc3", "t,G", 0x4c800000, 0xffe007ff, COD|RD_t|WR_C3|WR_CC, I1 }, {"mtc3", "t,G,H", 0x4c800000, 0xffe007f8, COD|RD_t|WR_C3|WR_CC, I32 }, +{"mtdr", "t,G", 0x7080003d, 0xffe007ff, COD|RD_t|WR_C0, N5 }, {"mthi", "s", 0x00000011, 0xfc1fffff, RD_s|WR_HI, I1 }, {"mtlo", "s", 0x00000013, 0xfc1fffff, RD_s|WR_LO, I1 }, {"mul.d", "D,V,T", 0x46200002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 }, {"mul.s", "D,V,T", 0x46000002, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 }, {"mul.ob", "X,Y,Q", 0x78000030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"mul.ob", "D,S,T", 0x4ac00030, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"mul.ob", "D,S,T[e]", 0x48000030, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"mul.ob", "D,S,k", 0x4bc00030, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"mul.ps", "D,V,T", 0x46c00002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"mul.qh", "X,Y,Q", 0x78200030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, -{"mul", "d,v,t", 0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, I32|P3 }, +{"mul", "d,v,t", 0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, I32|P3|N55}, +{"mul", "d,s,t", 0x00000058, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N54 }, {"mul", "d,v,t", 0, (int) M_MUL, INSN_MACRO, I1 }, {"mul", "d,v,I", 0, (int) M_MUL_I, INSN_MACRO, I1 }, {"mula.ob", "Y,Q", 0x78000033, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"mula.ob", "S,T", 0x4ac00033, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"mula.ob", "S,T[e]", 0x48000033, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"mula.ob", "S,k", 0x4bc00033, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"mula.qh", "Y,Q", 0x78200033, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, +{"mulhi", "d,s,t", 0x00000258, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"mulhiu", "d,s,t", 0x00000259, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, {"mull.ob", "Y,Q", 0x78000433, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"mull.ob", "S,T", 0x4ac00433, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"mull.ob", "S,T[e]", 0x48000433, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"mull.ob", "S,k", 0x4bc00433, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"mull.qh", "Y,Q", 0x78200433, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"mulo", "d,v,t", 0, (int) M_MULO, INSN_MACRO, I1 }, {"mulo", "d,v,I", 0, (int) M_MULO_I, INSN_MACRO, I1 }, {"mulou", "d,v,t", 0, (int) M_MULOU, INSN_MACRO, I1 }, {"mulou", "d,v,I", 0, (int) M_MULOU_I, INSN_MACRO, I1 }, {"mulr.ps", "D,S,T", 0x46c0001a, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D }, +{"muls", "d,s,t", 0x000000d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"mulsu", "d,s,t", 0x000000d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"mulshi", "d,s,t", 0x000002d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, +{"mulshiu", "d,s,t", 0x000002d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, {"muls.ob", "Y,Q", 0x78000032, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"muls.ob", "S,T", 0x4ac00032, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"muls.ob", "S,T[e]", 0x48000032, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"muls.ob", "S,k", 0x4bc00032, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"muls.qh", "Y,Q", 0x78200032, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"mulsl.ob", "Y,Q", 0x78000432, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"mulsl.ob", "S,T", 0x4ac00432, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, +{"mulsl.ob", "S,T[e]", 0x48000432, 0xfe2007ff, WR_CC|RD_S|RD_T, N54 }, +{"mulsl.ob", "S,k", 0x4bc00432, 0xffe007ff, WR_CC|RD_S|RD_T, N54 }, {"mulsl.qh", "Y,Q", 0x78200432, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"mult", "s,t", 0x00000018, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1 }, {"mult", "d,s,t", 0x00000018, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 }, {"multu", "s,t", 0x00000019, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1 }, {"multu", "d,s,t", 0x00000019, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 }, +{"mulu", "d,s,t", 0x00000059, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, N5 }, {"neg", "d,w", 0x00000022, 0xffe007ff, WR_d|RD_t, I1 }, /* sub 0 */ {"negu", "d,w", 0x00000023, 0xffe007ff, WR_d|RD_t, I1 }, /* subu 0 */ {"neg.d", "D,V", 0x46200007, 0xffff003f, WR_D|RD_S|FP_D, I1 }, @@ -755,19 +837,31 @@ const struct mips_opcode mips_builtin_opcodes[] = {"nor", "d,v,t", 0x00000027, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"nor", "t,r,I", 0, (int) M_NOR_I, INSN_MACRO, I1 }, {"nor.ob", "X,Y,Q", 0x7800000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"nor.ob", "D,S,T", 0x4ac0000f, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"nor.ob", "D,S,T[e]", 0x4800000f, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"nor.ob", "D,S,k", 0x4bc0000f, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"nor.qh", "X,Y,Q", 0x7820000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"not", "d,v", 0x00000027, 0xfc1f07ff, WR_d|RD_s|RD_t, I1 },/*nor d,s,0*/ {"or", "d,v,t", 0x00000025, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"or", "t,r,I", 0, (int) M_OR_I, INSN_MACRO, I1 }, {"or.ob", "X,Y,Q", 0x7800000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"or.ob", "D,S,T", 0x4ac0000e, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"or.ob", "D,S,T[e]", 0x4800000e, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"or.ob", "D,S,k", 0x4bc0000e, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"or.qh", "X,Y,Q", 0x7820000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"ori", "t,r,i", 0x34000000, 0xfc000000, WR_t|RD_s, I1 }, {"pabsdiff.ob", "X,Y,Q",0x78000009, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, SB1 }, {"pabsdiffc.ob", "Y,Q", 0x78000035, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, SB1 }, {"pavg.ob", "X,Y,Q", 0x78000008, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, SB1 }, {"pickf.ob", "X,Y,Q", 0x78000002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"pickf.ob", "D,S,T", 0x4ac00002, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"pickf.ob", "D,S,T[e]",0x48000002, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"pickf.ob", "D,S,k", 0x4bc00002, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"pickf.qh", "X,Y,Q", 0x78200002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"pickt.ob", "X,Y,Q", 0x78000003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"pickt.ob", "D,S,T", 0x4ac00003, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"pickt.ob", "D,S,T[e]",0x48000003, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"pickt.ob", "D,S,k", 0x4bc00003, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"pickt.qh", "X,Y,Q", 0x78200003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"pll.ps", "D,V,T", 0x46c0002c, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"plu.ps", "D,V,T", 0x46c0002d, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, @@ -775,10 +869,13 @@ const struct mips_opcode mips_builtin_opcodes[] = {"pul.ps", "D,V,T", 0x46c0002e, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"puu.ps", "D,V,T", 0x46c0002f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"rach.ob", "X", 0x7a00003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 }, +{"rach.ob", "D", 0x4a00003f, 0xfffff83f, WR_D, N54 }, {"rach.qh", "X", 0x7a20003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX }, {"racl.ob", "X", 0x7800003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 }, +{"racl.ob", "D", 0x4800003f, 0xfffff83f, WR_D, N54 }, {"racl.qh", "X", 0x7820003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX }, {"racm.ob", "X", 0x7900003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 }, +{"racm.ob", "D", 0x4900003f, 0xfffff83f, WR_D, N54 }, {"racm.qh", "X", 0x7920003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX }, {"recip.d", "D,S", 0x46200015, 0xffff003f, WR_D|RD_S|FP_D, I4 }, {"recip.ps","D,S", 0x46c00015, 0xffff003f, WR_D|RD_S|FP_D, SB1 }, @@ -804,6 +901,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"rneu.qh", "X,Q", 0x78200022, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, {"rol", "d,v,t", 0, (int) M_ROL, INSN_MACRO, I1 }, {"rol", "d,v,I", 0, (int) M_ROL_I, INSN_MACRO, I1 }, +{"rorv", "d,t,s", 0x00000046, 0xfc0007ff, RD_t|RD_s|WR_d, N5 }, +{"ror", "d,w,s", 0x00000046, 0xfc0007ff, RD_t|RD_s|WR_d, N5 }, /* rorv */ +{"ror", "d,w,<", 0x00200002, 0xffe0003f, WR_d|RD_t, N5 }, {"ror", "d,v,t", 0, (int) M_ROR, INSN_MACRO, I1 }, {"ror", "d,v,I", 0, (int) M_ROR_I, INSN_MACRO, I1 }, {"round.l.d", "D,S", 0x46200008, 0xffff003f, WR_D|RD_S|FP_D, I3 }, @@ -821,6 +921,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"rsqrt2.s", "D,S,T", 0x4600001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, M3D }, {"rzs.qh", "X,Q", 0x78200024, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, {"rzu.ob", "X,Q", 0x78000020, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 }, +{"rzu.ob", "D,k", 0x4bc00020, 0xffe0f83f, WR_D|RD_S|RD_T, N54 }, {"rzu.qh", "X,Q", 0x78200020, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, {"sb", "t,o(b)", 0xa0000000, 0xfc000000, SM|RD_t|RD_b, I1 }, {"sb", "t,A(b)", 0, (int) M_SB_AB, INSN_MACRO, I1 }, @@ -868,11 +969,15 @@ const struct mips_opcode mips_builtin_opcodes[] = {"sh", "t,A(b)", 0, (int) M_SH_AB, INSN_MACRO, I1 }, {"shfl.bfla.qh", "X,Y,Z", 0x7a20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, {"shfl.mixh.ob", "X,Y,Z", 0x7980001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"shfl.mixh.ob", "D,S,T", 0x4980001f, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"shfl.mixh.qh", "X,Y,Z", 0x7820001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, {"shfl.mixl.ob", "X,Y,Z", 0x79c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"shfl.mixl.ob", "D,S,T", 0x49c0001f, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"shfl.mixl.qh", "X,Y,Z", 0x78a0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, {"shfl.pach.ob", "X,Y,Z", 0x7900001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"shfl.pach.ob", "D,S,T", 0x4900001f, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"shfl.pach.qh", "X,Y,Z", 0x7920001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.pacl.ob", "D,S,T", 0x4940001f, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"shfl.repa.qh", "X,Y,Z", 0x7b20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, {"shfl.repb.qh", "X,Y,Z", 0x7ba0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, {"shfl.upsl.ob", "X,Y,Z", 0x78c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, @@ -884,6 +989,8 @@ const struct mips_opcode mips_builtin_opcodes[] = {"sll", "d,w,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* sllv */ {"sll", "d,w,<", 0x00000000, 0xffe0003f, WR_d|RD_t, I1 }, {"sll.ob", "X,Y,Q", 0x78000010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"sll.ob", "D,S,T[e]", 0x48000010, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"sll.ob", "D,S,k", 0x4bc00010, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"sll.qh", "X,Y,Q", 0x78200010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"slt", "d,v,t", 0x0000002a, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"slt", "d,v,I", 0, (int) M_SLT_I, INSN_MACRO, I1 }, @@ -904,6 +1011,8 @@ const struct mips_opcode mips_builtin_opcodes[] = {"srl", "d,w,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* srlv */ {"srl", "d,w,<", 0x00000002, 0xffe0003f, WR_d|RD_t, I1 }, {"srl.ob", "X,Y,Q", 0x78000012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"srl.ob", "D,S,T[e]", 0x48000012, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"srl.ob", "D,S,k", 0x4bc00012, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"srl.qh", "X,Y,Q", 0x78200012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, /* ssnop is at the start of the table. */ {"standby", "", 0x42000021, 0xffffffff, 0, V1 }, @@ -912,6 +1021,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"sub.d", "D,V,T", 0x46200001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 }, {"sub.s", "D,V,T", 0x46000001, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 }, {"sub.ob", "X,Y,Q", 0x7800000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"sub.ob", "D,S,T", 0x4ac0000a, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"sub.ob", "D,S,T[e]", 0x4800000a, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"sub.ob", "D,S,k", 0x4bc0000a, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"sub.ps", "D,V,T", 0x46c00001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"sub.qh", "X,Y,Q", 0x7820000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"suba.ob", "Y,Q", 0x78000036, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, @@ -921,7 +1033,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"subu", "d,v,t", 0x00000023, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"subu", "d,v,I", 0, (int) M_SUBU_I, INSN_MACRO, I1 }, {"suspend", "", 0x42000022, 0xffffffff, 0, V1 }, -{"suxc1", "S,t(b)", 0x4c00000d, 0xfc0007ff, SM|RD_S|RD_t|RD_b, I5 }, +{"suxc1", "S,t(b)", 0x4c00000d, 0xfc0007ff, SM|RD_S|RD_t|RD_b, I5|N55 }, {"sw", "t,o(b)", 0xac000000, 0xfc000000, SM|RD_t|RD_b, I1 }, {"sw", "t,A(b)", 0, (int) M_SW_AB, INSN_MACRO, I1 }, {"swc0", "E,o(b)", 0xe0000000, 0xfc000000, SM|RD_C0|RD_b, I1 }, @@ -1007,16 +1119,21 @@ const struct mips_opcode mips_builtin_opcodes[] = {"usw", "t,o(b)", 0, (int) M_USW, INSN_MACRO, I1 }, {"usw", "t,A(b)", 0, (int) M_USW_A, INSN_MACRO, I1 }, {"wach.ob", "Y", 0x7a00003e, 0xffff07ff, WR_MACC|RD_S|FP_D, MX|SB1 }, +{"wach.ob", "S", 0x4a00003e, 0xffff07ff, RD_S, N54 }, {"wach.qh", "Y", 0x7a20003e, 0xffff07ff, WR_MACC|RD_S|FP_D, MX }, {"wacl.ob", "Y,Z", 0x7800003e, 0xffe007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"wacl.ob", "S,T", 0x4800003e, 0xffe007ff, RD_S|RD_T, N54 }, {"wacl.qh", "Y,Z", 0x7820003e, 0xffe007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"wait", "", 0x42000020, 0xffffffff, TRAP, I3|I32 }, -{"wait", "J", 0x42000020, 0xfe00003f, TRAP, I32 }, +{"wait", "J", 0x42000020, 0xfe00003f, TRAP, I32|N55 }, {"waiti", "", 0x42000020, 0xffffffff, TRAP, L1 }, {"wb", "o(b)", 0xbc040000, 0xfc1f0000, SM|RD_b, L1 }, {"xor", "d,v,t", 0x00000026, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"xor", "t,r,I", 0, (int) M_XOR_I, INSN_MACRO, I1 }, {"xor.ob", "X,Y,Q", 0x7800000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"xor.ob", "D,S,T", 0x4ac0000d, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, +{"xor.ob", "D,S,T[e]", 0x4800000d, 0xfe20003f, WR_D|RD_S|RD_T, N54 }, +{"xor.ob", "D,S,k", 0x4bc0000d, 0xffe0003f, WR_D|RD_S|RD_T, N54 }, {"xor.qh", "X,Y,Q", 0x7820000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"xori", "t,r,i", 0x38000000, 0xfc000000, WR_t|RD_s, I1 }, diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in index 1f85d720f67..861e4104d52 100644 --- a/opcodes/po/POTFILES.in +++ b/opcodes/po/POTFILES.in @@ -113,6 +113,7 @@ sparc-dis.c sparc-opc.c sysdep.h tic30-dis.c +tic4x-dis.c tic54x-dis.c tic54x-opc.c tic80-dis.c diff --git a/opcodes/po/da.po b/opcodes/po/da.po index 674b5050833..36227adf2f7 100644 --- a/opcodes/po/da.po +++ b/opcodes/po/da.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: opcodes 2.12-pre020121\n" -"POT-Creation-Date: 2002-01-17 13:58+0000\n" -"PO-Revision-Date: 2002-02-12 19:35+0200\n" +"Project-Id-Version: opcodes 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2002-09-07 19:35+0200\n" "Last-Translator: Keld Simonsen <keld@dkuug.dk>\n" "Language-Team: Danish <dansk@klid.dk>\n" "MIME-Version: 1.0\n" @@ -26,21 +26,21 @@ msgstr "hopperådet ligger på skæv adresse" msgid "Illegal limm reference in last instruction!\n" msgstr "Ugyldig limm-reference i sidste instruktion!\n" -#: arm-dis.c:509 +#: arm-dis.c:507 msgid "<illegal precision>" msgstr "<ugyldig præcision>" -#: arm-dis.c:1019 +#: arm-dis.c:1010 #, c-format msgid "Unrecognised register name set: %s\n" msgstr "Ukendt registernavn er angivet: %s\n" -#: arm-dis.c:1026 +#: arm-dis.c:1017 #, c-format msgid "Unrecognised disassembler option: %s\n" msgstr "Ukendt disassembleralternativ: %s\n" -#: arm-dis.c:1198 +#: arm-dis.c:1191 msgid "" "\n" "The following ARM specific disassembler options are supported for use with\n" @@ -63,7 +63,8 @@ msgstr "Intern fejl i disassembleren" msgid "unknown constraint `%c'" msgstr "ukendt begrænsning \"%c\"" -#: cgen-asm.c:346 fr30-ibld.c:195 m32r-ibld.c:195 openrisc-ibld.c:195 +#: cgen-asm.c:346 fr30-ibld.c:195 frv-ibld.c:195 m32r-ibld.c:195 +#: openrisc-ibld.c:195 xstormy16-ibld.c:195 #, c-format msgid "operand out of range (%ld not between %ld and %ld)" msgstr "operanden er uden for intervallet (%ld er ikke mellem %ld og %ld)" @@ -89,106 +90,126 @@ msgstr "Ukendt fejl %d\n" msgid "Address 0x%x is out of bounds.\n" msgstr "Adressen 0x%x ligger uden for tilladte grænser.\n" -#: fr30-asm.c:324 m32r-asm.c:326 openrisc-asm.c:245 +#: fr30-asm.c:323 frv-asm.c:595 m32r-asm.c:325 openrisc-asm.c:244 +#: xstormy16-asm.c:231 #, c-format msgid "Unrecognized field %d while parsing.\n" msgstr "Ukendt felt %d ved tolkning.\n" -#: fr30-asm.c:374 m32r-asm.c:376 openrisc-asm.c:295 +#: fr30-asm.c:373 frv-asm.c:645 m32r-asm.c:375 openrisc-asm.c:294 +#: xstormy16-asm.c:281 msgid "missing mnemonic in syntax string" msgstr "Mangler mnemonic i syntaksstreng" #. We couldn't parse it. -#: fr30-asm.c:510 fr30-asm.c:514 fr30-asm.c:601 fr30-asm.c:703 m32r-asm.c:512 -#: m32r-asm.c:516 m32r-asm.c:603 m32r-asm.c:705 openrisc-asm.c:431 -#: openrisc-asm.c:435 openrisc-asm.c:522 openrisc-asm.c:624 +#: fr30-asm.c:509 fr30-asm.c:513 fr30-asm.c:600 fr30-asm.c:702 frv-asm.c:781 +#: frv-asm.c:785 frv-asm.c:872 frv-asm.c:974 m32r-asm.c:511 m32r-asm.c:515 +#: m32r-asm.c:602 m32r-asm.c:704 openrisc-asm.c:430 openrisc-asm.c:434 +#: openrisc-asm.c:521 openrisc-asm.c:623 xstormy16-asm.c:417 +#: xstormy16-asm.c:421 xstormy16-asm.c:508 xstormy16-asm.c:610 msgid "unrecognized instruction" msgstr "ukendt instruktion" -#: fr30-asm.c:557 m32r-asm.c:559 openrisc-asm.c:478 +#: fr30-asm.c:556 frv-asm.c:828 m32r-asm.c:558 openrisc-asm.c:477 +#: xstormy16-asm.c:464 #, c-format msgid "syntax error (expected char `%c', found `%c')" msgstr "syntaksfejl (tegnet \"%c\" forventedes, fandt \"%c\")" -#: fr30-asm.c:567 m32r-asm.c:569 openrisc-asm.c:488 +#: fr30-asm.c:566 frv-asm.c:838 m32r-asm.c:568 openrisc-asm.c:487 +#: xstormy16-asm.c:474 #, c-format msgid "syntax error (expected char `%c', found end of instruction)" msgstr "syntaksfejl (tegnet \"%c\" forventedes, fandt slut på instruktion)" -#: fr30-asm.c:595 m32r-asm.c:597 openrisc-asm.c:516 +#: fr30-asm.c:594 frv-asm.c:866 m32r-asm.c:596 openrisc-asm.c:515 +#: xstormy16-asm.c:502 msgid "junk at end of line" msgstr "snavs ved slutning på linjen" -#: fr30-asm.c:702 m32r-asm.c:704 openrisc-asm.c:623 +#: fr30-asm.c:701 frv-asm.c:973 m32r-asm.c:703 openrisc-asm.c:622 +#: xstormy16-asm.c:609 msgid "unrecognized form of instruction" msgstr "ukendt form af instruktion" -#: fr30-asm.c:714 m32r-asm.c:716 openrisc-asm.c:635 +#: fr30-asm.c:713 frv-asm.c:985 m32r-asm.c:715 openrisc-asm.c:634 +#: xstormy16-asm.c:621 #, c-format msgid "bad instruction `%.50s...'" msgstr "fejlagtig instruktion \"%.50s...\"" -#: fr30-asm.c:717 m32r-asm.c:719 openrisc-asm.c:638 +#: fr30-asm.c:716 frv-asm.c:988 m32r-asm.c:718 openrisc-asm.c:637 +#: xstormy16-asm.c:624 #, c-format msgid "bad instruction `%.50s'" msgstr "fejlagtig instruktion \"%.50s\"" #. Default text to print if an instruction isn't recognized. -#: fr30-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39 +#: fr30-dis.c:39 frv-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39 +#: xstormy16-dis.c:39 msgid "*unknown*" msgstr "*ukendt*" -#: fr30-dis.c:319 m32r-dis.c:250 openrisc-dis.c:137 +#: fr30-dis.c:318 frv-dis.c:360 m32r-dis.c:249 openrisc-dis.c:136 +#: xstormy16-dis.c:169 #, c-format msgid "Unrecognized field %d while printing insn.\n" msgstr "Ukendt felt %d ved udskrift af instruktion.\n" -#: fr30-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166 +#: fr30-ibld.c:166 frv-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166 +#: xstormy16-ibld.c:166 #, c-format msgid "operand out of range (%ld not between %ld and %lu)" msgstr "operanden er uden for intervallet (%ld er ikke mellem %ld og %lu)" -#: fr30-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179 +#: fr30-ibld.c:179 frv-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179 +#: xstormy16-ibld.c:179 #, c-format msgid "operand out of range (%lu not between 0 and %lu)" msgstr "operanden uden for intervallet (%lu ikke mellem 0 og %lu)" -#: fr30-ibld.c:731 m32r-ibld.c:660 openrisc-ibld.c:634 +#: fr30-ibld.c:730 frv-ibld.c:820 m32r-ibld.c:659 openrisc-ibld.c:633 +#: xstormy16-ibld.c:678 #, c-format msgid "Unrecognized field %d while building insn.\n" msgstr "Ukendt felt %d ved konstruktion af instruktion.\n" -#: fr30-ibld.c:939 m32r-ibld.c:794 openrisc-ibld.c:737 +#: fr30-ibld.c:937 frv-ibld.c:1103 m32r-ibld.c:792 openrisc-ibld.c:735 +#: xstormy16-ibld.c:826 #, c-format msgid "Unrecognized field %d while decoding insn.\n" msgstr "Ukendt felt %d ved afkodning af instruktion.\n" -#: fr30-ibld.c:1088 m32r-ibld.c:904 openrisc-ibld.c:817 +#: fr30-ibld.c:1086 frv-ibld.c:1348 m32r-ibld.c:902 openrisc-ibld.c:815 +#: xstormy16-ibld.c:939 #, c-format msgid "Unrecognized field %d while getting int operand.\n" msgstr "Ukendt felt %d ved hentning af heltalsoperand.\n" -#: fr30-ibld.c:1217 m32r-ibld.c:994 openrisc-ibld.c:877 +#: fr30-ibld.c:1215 frv-ibld.c:1573 m32r-ibld.c:992 openrisc-ibld.c:875 +#: xstormy16-ibld.c:1032 #, c-format msgid "Unrecognized field %d while getting vma operand.\n" msgstr "Ukendt felt %d ved hentning af vma-operand.\n" -#: fr30-ibld.c:1351 m32r-ibld.c:1092 openrisc-ibld.c:946 +#: fr30-ibld.c:1349 frv-ibld.c:1807 m32r-ibld.c:1090 openrisc-ibld.c:944 +#: xstormy16-ibld.c:1134 #, c-format msgid "Unrecognized field %d while setting int operand.\n" msgstr "Ukendt felt %d ved indstilling af heltalsoperand.\n" -#: fr30-ibld.c:1473 m32r-ibld.c:1178 openrisc-ibld.c:1003 +#: fr30-ibld.c:1471 frv-ibld.c:2029 m32r-ibld.c:1176 openrisc-ibld.c:1001 +#: xstormy16-ibld.c:1224 #, c-format msgid "Unrecognized field %d while setting vma operand.\n" msgstr "Ukendt felt %d ved indstilling af vma-operand.\n" -#: h8300-dis.c:384 +#: h8300-dis.c:385 #, c-format msgid "Hmmmm %x" msgstr "Hmmmm %x" -#: h8300-dis.c:395 +#: h8300-dis.c:396 #, c-format msgid "Don't understand %x \n" msgstr "Forstår ikke %x \n" @@ -238,12 +259,12 @@ msgstr "<funktionskode %d>" msgid "# <dis error: %08x>" msgstr "# <disassemblerfejl: %08x>" -#: mips-dis.c:290 +#: mips-dis.c:337 #, c-format msgid "# internal error, undefined modifier(%c)" msgstr "# intern fejl, ukendt modifikator(%c)" -#: mips-dis.c:1154 +#: mips-dis.c:1209 #, c-format msgid "# internal disassembler error, unrecognised modifier (%c)" msgstr "# intern disassembler-fejl, ukendt modifikator (%c)" @@ -277,62 +298,62 @@ msgstr "*ukendt operandstype: %d*" msgid "$<undefined>" msgstr "$<udefineret>" -#: ppc-opc.c:765 ppc-opc.c:798 +#: ppc-opc.c:777 ppc-opc.c:810 msgid "invalid conditional option" msgstr "ugyldigt betinget flag" -#: ppc-opc.c:800 +#: ppc-opc.c:812 msgid "attempt to set y bit when using + or - modifier" msgstr "forsøg på at sætte y-bitten når modifikatoren + eller - blev brugt" -#: ppc-opc.c:832 ppc-opc.c:884 +#: ppc-opc.c:844 ppc-opc.c:896 msgid "offset not a multiple of 4" msgstr "afsæt ikke et produkt af 4" -#: ppc-opc.c:857 +#: ppc-opc.c:869 msgid "offset not between -2048 and 2047" msgstr "afsæt ikke mellem -2048 og 2047" -#: ppc-opc.c:882 +#: ppc-opc.c:894 msgid "offset not between -8192 and 8191" msgstr "afsæt ikke mellem -8192 og 8191" -#: ppc-opc.c:910 +#: ppc-opc.c:922 msgid "ignoring least significant bits in branch offset" msgstr "ignorerer mindste betydende bit i afsæt for betinget hop" -#: ppc-opc.c:944 ppc-opc.c:981 +#: ppc-opc.c:956 ppc-opc.c:993 msgid "illegal bitmask" msgstr "ugyldig bitmaske" -#: ppc-opc.c:1054 +#: ppc-opc.c:1066 msgid "value out of range" msgstr "værdien er uden for intervallet" -#: ppc-opc.c:1130 +#: ppc-opc.c:1142 msgid "index register in load range" msgstr "indeksregistret er i indlæsningsintervallet" -#: ppc-opc.c:1146 +#: ppc-opc.c:1158 msgid "invalid register operand when updating" msgstr "ugyldig registeroperand ved opdatering" #. Mark as non-valid instruction -#: sparc-dis.c:749 +#: sparc-dis.c:750 msgid "unknown" msgstr "ukendt" -#: sparc-dis.c:824 +#: sparc-dis.c:825 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" msgstr "Intern fejl: dårlig sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" -#: sparc-dis.c:835 +#: sparc-dis.c:836 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" msgstr "Intern fejl: dårlig sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" -#: sparc-dis.c:884 +#: sparc-dis.c:885 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n" msgstr "Intern fejl: dårlig sparc-opcode.h: \"%s\" == \"%s\"\n" @@ -396,5 +417,33 @@ msgstr "umiddelbar værdi er ikke indenfor intervallet og ikke lige" msgid "immediate value must be even" msgstr "umiddelbar værdi skal være lige" +#: xstormy16-asm.c:74 +msgid "Bad register in preincrement" +msgstr "Forkert register i præinkrement" + +#: xstormy16-asm.c:79 +msgid "Bad register in postincrement" +msgstr "Forkert register i postinkrement" + +#: xstormy16-asm.c:81 +msgid "Bad register name" +msgstr "Forkert registernavn" + +#: xstormy16-asm.c:85 +msgid "Label conflicts with register name" +msgstr "Etikette konflikter med registernavn" + +#: xstormy16-asm.c:89 +msgid "Label conflicts with `Rx'" +msgstr "Etikette konflikter med 'Rx'" + +#: xstormy16-asm.c:91 +msgid "Bad immediate expression" +msgstr "Forkert umiddelbart udtryk" + +#: xstormy16-asm.c:120 +msgid "Small operand was not an immediate number" +msgstr "Lille operand var ikke et umiddelbart tal" + #~ msgid "unrecognized keyword/register name" #~ msgstr "ukendt navn på nøgleord/register" diff --git a/opcodes/po/de.po b/opcodes/po/de.po index 6039e3e0629..2914776e6ab 100644 --- a/opcodes/po/de.po +++ b/opcodes/po/de.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: opcodes 2.12-pre020121\n" -"POT-Creation-Date: 2002-01-17 13:58+0000\n" -"PO-Revision-Date: 2002-02-24 13:59+0100\n" +"Project-Id-Version: opcodes 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2002-09-24 07:13+0200\n" "Last-Translator: Martin v. Löwis <martin@v.loewis.de>\n" "Language-Team: German <de@li.org>\n" "MIME-Version: 1.0\n" @@ -25,21 +25,21 @@ msgstr "Sprunghinweis ist nicht ausgerichtet (unaligned)." msgid "Illegal limm reference in last instruction!\n" msgstr "Ungültige limm-Referenz in der letzten Anweisung!\n" -#: arm-dis.c:509 +#: arm-dis.c:507 msgid "<illegal precision>" msgstr "<ungültige Präzision>" -#: arm-dis.c:1019 +#: arm-dis.c:1010 #, c-format msgid "Unrecognised register name set: %s\n" msgstr "Unbekannte Registernamensmenge: %s\n" -#: arm-dis.c:1026 +#: arm-dis.c:1017 #, c-format msgid "Unrecognised disassembler option: %s\n" msgstr "Unbekannte Disassembler-Option: %s\n" -#: arm-dis.c:1198 +#: arm-dis.c:1191 msgid "" "\n" "The following ARM specific disassembler options are supported for use with\n" @@ -59,7 +59,8 @@ msgstr "Interner Disassemblerfehler." msgid "unknown constraint `%c'" msgstr "" -#: cgen-asm.c:346 fr30-ibld.c:195 m32r-ibld.c:195 openrisc-ibld.c:195 +#: cgen-asm.c:346 fr30-ibld.c:195 frv-ibld.c:195 m32r-ibld.c:195 +#: openrisc-ibld.c:195 xstormy16-ibld.c:195 #, c-format msgid "operand out of range (%ld not between %ld and %ld)" msgstr "" @@ -85,104 +86,126 @@ msgstr "Unbekannter Fehler %d\n" msgid "Address 0x%x is out of bounds.\n" msgstr "" -#: fr30-asm.c:324 m32r-asm.c:326 openrisc-asm.c:245 +#: fr30-asm.c:323 frv-asm.c:595 m32r-asm.c:325 openrisc-asm.c:244 +#: xstormy16-asm.c:231 #, c-format msgid "Unrecognized field %d while parsing.\n" msgstr "" -#: fr30-asm.c:374 m32r-asm.c:376 openrisc-asm.c:295 +#: fr30-asm.c:373 frv-asm.c:645 m32r-asm.c:375 openrisc-asm.c:294 +#: xstormy16-asm.c:281 msgid "missing mnemonic in syntax string" msgstr "" #. We couldn't parse it. -#: fr30-asm.c:510 fr30-asm.c:514 fr30-asm.c:601 fr30-asm.c:703 m32r-asm.c:512 m32r-asm.c:516 m32r-asm.c:603 m32r-asm.c:705 openrisc-asm.c:431 openrisc-asm.c:435 openrisc-asm.c:522 openrisc-asm.c:624 +#: fr30-asm.c:509 fr30-asm.c:513 fr30-asm.c:600 fr30-asm.c:702 frv-asm.c:781 +#: frv-asm.c:785 frv-asm.c:872 frv-asm.c:974 m32r-asm.c:511 m32r-asm.c:515 +#: m32r-asm.c:602 m32r-asm.c:704 openrisc-asm.c:430 openrisc-asm.c:434 +#: openrisc-asm.c:521 openrisc-asm.c:623 xstormy16-asm.c:417 +#: xstormy16-asm.c:421 xstormy16-asm.c:508 xstormy16-asm.c:610 msgid "unrecognized instruction" msgstr "" -#: fr30-asm.c:557 m32r-asm.c:559 openrisc-asm.c:478 +#: fr30-asm.c:556 frv-asm.c:828 m32r-asm.c:558 openrisc-asm.c:477 +#: xstormy16-asm.c:464 #, c-format msgid "syntax error (expected char `%c', found `%c')" msgstr "Syntaxfehler (erwartetes Zeichen »%c«, gefunden »%c«)" -#: fr30-asm.c:567 m32r-asm.c:569 openrisc-asm.c:488 +#: fr30-asm.c:566 frv-asm.c:838 m32r-asm.c:568 openrisc-asm.c:487 +#: xstormy16-asm.c:474 #, c-format msgid "syntax error (expected char `%c', found end of instruction)" msgstr "" -#: fr30-asm.c:595 m32r-asm.c:597 openrisc-asm.c:516 +#: fr30-asm.c:594 frv-asm.c:866 m32r-asm.c:596 openrisc-asm.c:515 +#: xstormy16-asm.c:502 msgid "junk at end of line" msgstr "" -#: fr30-asm.c:702 m32r-asm.c:704 openrisc-asm.c:623 +#: fr30-asm.c:701 frv-asm.c:973 m32r-asm.c:703 openrisc-asm.c:622 +#: xstormy16-asm.c:609 msgid "unrecognized form of instruction" msgstr "" -#: fr30-asm.c:714 m32r-asm.c:716 openrisc-asm.c:635 +#: fr30-asm.c:713 frv-asm.c:985 m32r-asm.c:715 openrisc-asm.c:634 +#: xstormy16-asm.c:621 #, c-format msgid "bad instruction `%.50s...'" msgstr "" -#: fr30-asm.c:717 m32r-asm.c:719 openrisc-asm.c:638 +#: fr30-asm.c:716 frv-asm.c:988 m32r-asm.c:718 openrisc-asm.c:637 +#: xstormy16-asm.c:624 #, c-format msgid "bad instruction `%.50s'" msgstr "" #. Default text to print if an instruction isn't recognized. -#: fr30-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39 +#: fr30-dis.c:39 frv-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39 +#: xstormy16-dis.c:39 msgid "*unknown*" msgstr "" -#: fr30-dis.c:319 m32r-dis.c:250 openrisc-dis.c:137 +#: fr30-dis.c:318 frv-dis.c:360 m32r-dis.c:249 openrisc-dis.c:136 +#: xstormy16-dis.c:169 #, c-format msgid "Unrecognized field %d while printing insn.\n" msgstr "" -#: fr30-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166 +#: fr30-ibld.c:166 frv-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166 +#: xstormy16-ibld.c:166 #, c-format msgid "operand out of range (%ld not between %ld and %lu)" msgstr "" -#: fr30-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179 +#: fr30-ibld.c:179 frv-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179 +#: xstormy16-ibld.c:179 #, c-format msgid "operand out of range (%lu not between 0 and %lu)" msgstr "" -#: fr30-ibld.c:731 m32r-ibld.c:660 openrisc-ibld.c:634 +#: fr30-ibld.c:730 frv-ibld.c:820 m32r-ibld.c:659 openrisc-ibld.c:633 +#: xstormy16-ibld.c:678 #, c-format msgid "Unrecognized field %d while building insn.\n" msgstr "" -#: fr30-ibld.c:939 m32r-ibld.c:794 openrisc-ibld.c:737 +#: fr30-ibld.c:937 frv-ibld.c:1103 m32r-ibld.c:792 openrisc-ibld.c:735 +#: xstormy16-ibld.c:826 #, c-format msgid "Unrecognized field %d while decoding insn.\n" msgstr "" -#: fr30-ibld.c:1088 m32r-ibld.c:904 openrisc-ibld.c:817 +#: fr30-ibld.c:1086 frv-ibld.c:1348 m32r-ibld.c:902 openrisc-ibld.c:815 +#: xstormy16-ibld.c:939 #, c-format msgid "Unrecognized field %d while getting int operand.\n" msgstr "" -#: fr30-ibld.c:1217 m32r-ibld.c:994 openrisc-ibld.c:877 +#: fr30-ibld.c:1215 frv-ibld.c:1573 m32r-ibld.c:992 openrisc-ibld.c:875 +#: xstormy16-ibld.c:1032 #, c-format msgid "Unrecognized field %d while getting vma operand.\n" msgstr "" -#: fr30-ibld.c:1351 m32r-ibld.c:1092 openrisc-ibld.c:946 +#: fr30-ibld.c:1349 frv-ibld.c:1807 m32r-ibld.c:1090 openrisc-ibld.c:944 +#: xstormy16-ibld.c:1134 #, c-format msgid "Unrecognized field %d while setting int operand.\n" msgstr "" -#: fr30-ibld.c:1473 m32r-ibld.c:1178 openrisc-ibld.c:1003 +#: fr30-ibld.c:1471 frv-ibld.c:2029 m32r-ibld.c:1176 openrisc-ibld.c:1001 +#: xstormy16-ibld.c:1224 #, c-format msgid "Unrecognized field %d while setting vma operand.\n" msgstr "" -#: h8300-dis.c:384 +#: h8300-dis.c:385 #, c-format msgid "Hmmmm %x" msgstr "" -#: h8300-dis.c:395 +#: h8300-dis.c:396 #, c-format msgid "Don't understand %x \n" msgstr "" @@ -232,12 +255,12 @@ msgstr "" msgid "# <dis error: %08x>" msgstr "" -#: mips-dis.c:290 +#: mips-dis.c:337 #, c-format msgid "# internal error, undefined modifier(%c)" msgstr "" -#: mips-dis.c:1154 +#: mips-dis.c:1209 #, c-format msgid "# internal disassembler error, unrecognised modifier (%c)" msgstr "" @@ -271,62 +294,62 @@ msgstr "" msgid "$<undefined>" msgstr "" -#: ppc-opc.c:765 ppc-opc.c:798 +#: ppc-opc.c:777 ppc-opc.c:810 msgid "invalid conditional option" msgstr "" -#: ppc-opc.c:800 +#: ppc-opc.c:812 msgid "attempt to set y bit when using + or - modifier" msgstr "" -#: ppc-opc.c:832 ppc-opc.c:884 +#: ppc-opc.c:844 ppc-opc.c:896 msgid "offset not a multiple of 4" msgstr "" -#: ppc-opc.c:857 +#: ppc-opc.c:869 msgid "offset not between -2048 and 2047" msgstr "" -#: ppc-opc.c:882 +#: ppc-opc.c:894 msgid "offset not between -8192 and 8191" msgstr "" -#: ppc-opc.c:910 +#: ppc-opc.c:922 msgid "ignoring least significant bits in branch offset" msgstr "" -#: ppc-opc.c:944 ppc-opc.c:981 +#: ppc-opc.c:956 ppc-opc.c:993 msgid "illegal bitmask" msgstr "" -#: ppc-opc.c:1054 +#: ppc-opc.c:1066 msgid "value out of range" msgstr "" -#: ppc-opc.c:1130 +#: ppc-opc.c:1142 msgid "index register in load range" msgstr "" -#: ppc-opc.c:1146 +#: ppc-opc.c:1158 msgid "invalid register operand when updating" msgstr "" #. Mark as non-valid instruction -#: sparc-dis.c:749 +#: sparc-dis.c:750 msgid "unknown" msgstr "" -#: sparc-dis.c:824 +#: sparc-dis.c:825 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" msgstr "" -#: sparc-dis.c:835 +#: sparc-dis.c:836 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" msgstr "" -#: sparc-dis.c:884 +#: sparc-dis.c:885 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n" msgstr "" @@ -389,3 +412,31 @@ msgstr "" #: v850-opc.c:375 msgid "immediate value must be even" msgstr "Der Direktoperand muss gerade sein." + +#: xstormy16-asm.c:74 +msgid "Bad register in preincrement" +msgstr "" + +#: xstormy16-asm.c:79 +msgid "Bad register in postincrement" +msgstr "" + +#: xstormy16-asm.c:81 +msgid "Bad register name" +msgstr "Falscher Registername." + +#: xstormy16-asm.c:85 +msgid "Label conflicts with register name" +msgstr "" + +#: xstormy16-asm.c:89 +msgid "Label conflicts with `Rx'" +msgstr "" + +#: xstormy16-asm.c:91 +msgid "Bad immediate expression" +msgstr "" + +#: xstormy16-asm.c:120 +msgid "Small operand was not an immediate number" +msgstr "" diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c index bd4dfaca6de..0c4cfe474a8 100644 --- a/opcodes/ppc-dis.c +++ b/opcodes/ppc-dis.c @@ -75,7 +75,8 @@ powerpc_dialect(info) dialect &= ~PPC_OPCODE_ALTIVEC; } else - dialect |= PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_COMMON; + dialect |= (PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_CLASSIC + | PPC_OPCODE_COMMON); if (info->disassembler_options && strcmp (info->disassembler_options, "power4") == 0) @@ -296,3 +297,18 @@ print_insn_powerpc (memaddr, info, bigendian, dialect) return 4; } + +void +print_ppc_disassembler_options (FILE * stream) +{ + fprintf (stream, "\n\ +The following PPC specific disassembler options are supported for use with\n\ +the -M switch:\n"); + + fprintf (stream, " booke|booke32|booke64 Disassemble the BookE instructions\n"); + fprintf (stream, " e500|e500x2 Disassemble the e500 instructions\n"); + fprintf (stream, " efs Disassemble the EFS instructions\n"); + fprintf (stream, " power4 Disassemble the Power4 instructions\n"); + fprintf (stream, " 32 Do not disassemble 64-bit instructions\n"); + fprintf (stream, " 64 Allow disassembly of 64-bit instructions\n"); +} diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c index 9ba4e25ee09..f6c9ce4df30 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c @@ -257,11 +257,11 @@ const struct powerpc_operand powerpc_operands[] = /* The CRFD field in an X form instruction. */ #define CRFD CRB + 1 - { 3, 23, 0, 0, 0 }, + { 3, 23, 0, 0, PPC_OPERAND_CR }, /* The CRFS field in an X form instruction. */ #define CRFS CRFD + 1 - { 3, 0, 0, 0, 0 }, + { 3, 0, 0, 0, PPC_OPERAND_CR }, /* The CT field in an X form instruction. */ #define CT CRFS + 1 @@ -1766,7 +1766,7 @@ extract_tbr (insn, dialect, invalid) #define M601 PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_ANY #define PWRCOM PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_COMMON | PPC_OPCODE_ANY #define MFDEC1 PPC_OPCODE_POWER -#define MFDEC2 PPC_OPCODE_PPC | PPC_OPCODE_601 +#define MFDEC2 PPC_OPCODE_PPC | PPC_OPCODE_601 | PPC_OPCODE_BOOKE #define BOOKE PPC_OPCODE_BOOKE #define BOOKE64 PPC_OPCODE_BOOKE64 #define CLASSIC PPC_OPCODE_CLASSIC @@ -1776,6 +1776,7 @@ extract_tbr (insn, dialect, invalid) #define PPCBRLK PPC_OPCODE_BRLOCK #define PPCPMR PPC_OPCODE_PMR #define PPCCHLK PPC_OPCODE_CACHELCK +#define PPCCHLK64 PPC_OPCODE_CACHELCK | PPC_OPCODE_BOOKE64 #define PPCRFMCI PPC_OPCODE_RFMCI /* The opcode table. @@ -2089,7 +2090,9 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "evaddw", VX(4, 512), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evaddiw", VX(4, 514), VX_MASK, PPCSPE, { RD, RB, UIMM } }, { "evsubfw", VX(4, 516), VX_MASK, PPCSPE, { RD, RA, RB } }, +{ "evsubw", VX(4, 516), VX_MASK, PPCSPE, { RD, RB, RA } }, { "evsubifw", VX(4, 518), VX_MASK, PPCSPE, { RD, UIMM, RB } }, +{ "evsubiw", VX(4, 518), VX_MASK, PPCSPE, { RD, RB, UIMM } }, { "evabs", VX(4, 520), VX_MASK, PPCSPE, { RD, RA } }, { "evneg", VX(4, 521), VX_MASK, PPCSPE, { RD, RA } }, { "evextsb", VX(4, 522), VX_MASK, PPCSPE, { RD, RA } }, @@ -2102,11 +2105,13 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "evand", VX(4, 529), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evandc", VX(4, 530), VX_MASK, PPCSPE, { RD, RA, RB } }, +{ "evmr", VX(4, 535), VX_MASK, PPCSPE, { RS, RA, BBA } }, { "evor", VX(4, 535), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evorc", VX(4, 539), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evxor", VX(4, 534), VX_MASK, PPCSPE, { RD, RA, RB } }, { "eveqv", VX(4, 537), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evnand", VX(4, 542), VX_MASK, PPCSPE, { RD, RA, RB } }, +{ "evnot", VX(4, 536), VX_MASK, PPCSPE, { RS, RA, BBA } }, { "evnor", VX(4, 536), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evrlw", VX(4, 552), VX_MASK, PPCSPE, { RD, RA, RB } }, @@ -2171,7 +2176,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "evfsabs", VX(4, 644), VX_MASK, PPCSPE, { RD, RA } }, { "evfsnabs", VX(4, 645), VX_MASK, PPCSPE, { RD, RA } }, -{ "evfsneg", VX(4, 656), VX_MASK, PPCSPE, { RD, RA } }, +{ "evfsneg", VX(4, 646), VX_MASK, PPCSPE, { RD, RA } }, { "evfsadd", VX(4, 640), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evfssub", VX(4, 641), VX_MASK, PPCSPE, { RD, RA, RB } }, { "evfsmul", VX(4, 648), VX_MASK, PPCSPE, { RD, RA, RB } }, @@ -3255,7 +3260,10 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mulhwu", XO(31,11,0,0), XO_MASK, PPC, { RT, RA, RB } }, { "mulhwu.", XO(31,11,0,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "isel", XISEL(31,15),XISEL_MASK, PPCISEL, { RT, RA, RB, CRB } }, +{ "isellt", X(31,15), X_MASK, PPCISEL, { RT, RA, RB } }, +{ "iselgt", X(31,47), X_MASK, PPCISEL, { RT, RA, RB } }, +{ "iseleq", X(31,79), X_MASK, PPCISEL, { RT, RA, RB } }, +{ "isel", XISEL(31,15), XISEL_MASK, PPCISEL, { RT, RA, RB, CRB } }, { "mfcr", X(31,19), XRARB_MASK, COM, { RT } }, @@ -3406,7 +3414,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "addeo.", XO(31,138,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, { "aeo.", XO(31,138,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "dcbtstlse",X(31,142),X_MASK, PPCCHLK, { CT, RA, RB }}, +{ "dcbtstlse",X(31,142),X_MASK, PPCCHLK64, { CT, RA, RB }}, { "mtcr", XFXM(31,144,0xff), XFXFXM_MASK|FXM_MASK, COM, { RS }}, { "mtcrf", X(31,144), XFXFXM_MASK, COM, { FXM, RS } }, @@ -3434,7 +3442,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "wrteei", X(31,163), XE_MASK, BOOKE, { E } }, { "dcbtls", X(31,166), X_MASK, PPCCHLK, { CT, RA, RB }}, -{ "dcbtlse", X(31,174), X_MASK, PPCCHLK, { CT, RA, RB }}, +{ "dcbtlse", X(31,174), X_MASK, PPCCHLK64, { CT, RA, RB }}, { "mtmsrd", X(31,178), XRLARB_MASK, PPC64, { RS, MTMSRD_L } }, @@ -3514,7 +3522,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mullwo.", XO(31,235,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, { "mulso.", XO(31,235,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, -{ "icblce", X(31,238), X_MASK, PPCCHLK, { CT, RA, RB }}, +{ "icblce", X(31,238), X_MASK, PPCCHLK64, { CT, RA, RB }}, { "mtsrin", X(31,242), XRA_MASK, PPC32, { RS, RB } }, { "mtsri", X(31,242), XRA_MASK, POWER32, { RS, RB } }, @@ -3577,19 +3585,19 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "lhzuxe", X(31,319), X_MASK, BOOKE64, { RT, RAL, RB } }, -{ "mfexisr", XSPR(31,323,64), XSPR_MASK, PPC403, { RT } }, -{ "mfexier", XSPR(31,323,66), XSPR_MASK, PPC403, { RT } }, -{ "mfbr0", XSPR(31,323,128), XSPR_MASK, PPC403, { RT } }, -{ "mfbr1", XSPR(31,323,129), XSPR_MASK, PPC403, { RT } }, -{ "mfbr2", XSPR(31,323,130), XSPR_MASK, PPC403, { RT } }, -{ "mfbr3", XSPR(31,323,131), XSPR_MASK, PPC403, { RT } }, -{ "mfbr4", XSPR(31,323,132), XSPR_MASK, PPC403, { RT } }, -{ "mfbr5", XSPR(31,323,133), XSPR_MASK, PPC403, { RT } }, -{ "mfbr6", XSPR(31,323,134), XSPR_MASK, PPC403, { RT } }, -{ "mfbr7", XSPR(31,323,135), XSPR_MASK, PPC403, { RT } }, -{ "mfbear", XSPR(31,323,144), XSPR_MASK, PPC403, { RT } }, -{ "mfbesr", XSPR(31,323,145), XSPR_MASK, PPC403, { RT } }, -{ "mfiocr", XSPR(31,323,160), XSPR_MASK, PPC403, { RT } }, +{ "mfexisr", XSPR(31,323,64), XSPR_MASK, PPC403, { RT } }, +{ "mfexier", XSPR(31,323,66), XSPR_MASK, PPC403, { RT } }, +{ "mfbr0", XSPR(31,323,128), XSPR_MASK, PPC403, { RT } }, +{ "mfbr1", XSPR(31,323,129), XSPR_MASK, PPC403, { RT } }, +{ "mfbr2", XSPR(31,323,130), XSPR_MASK, PPC403, { RT } }, +{ "mfbr3", XSPR(31,323,131), XSPR_MASK, PPC403, { RT } }, +{ "mfbr4", XSPR(31,323,132), XSPR_MASK, PPC403, { RT } }, +{ "mfbr5", XSPR(31,323,133), XSPR_MASK, PPC403, { RT } }, +{ "mfbr6", XSPR(31,323,134), XSPR_MASK, PPC403, { RT } }, +{ "mfbr7", XSPR(31,323,135), XSPR_MASK, PPC403, { RT } }, +{ "mfbear", XSPR(31,323,144), XSPR_MASK, PPC403, { RT } }, +{ "mfbesr", XSPR(31,323,145), XSPR_MASK, PPC403, { RT } }, +{ "mfiocr", XSPR(31,323,160), XSPR_MASK, PPC403, { RT } }, { "mfdmacr0", XSPR(31,323,192), XSPR_MASK, PPC403, { RT } }, { "mfdmact0", XSPR(31,323,193), XSPR_MASK, PPC403, { RT } }, { "mfdmada0", XSPR(31,323,194), XSPR_MASK, PPC403, { RT } }, @@ -3610,9 +3618,9 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mfdmada3", XSPR(31,323,218), XSPR_MASK, PPC403, { RT } }, { "mfdmasa3", XSPR(31,323,219), XSPR_MASK, PPC403, { RT } }, { "mfdmacc3", XSPR(31,323,220), XSPR_MASK, PPC403, { RT } }, -{ "mfdmasr", XSPR(31,323,224), XSPR_MASK, PPC403, { RT } }, -{ "mfdcr", X(31,323), X_MASK, PPC403, { RT, SPR } }, -{ "mfdcr", X(31,323), X_MASK, BOOKE, { RT, SPR } }, +{ "mfdmasr", XSPR(31,323,224), XSPR_MASK, PPC403, { RT } }, +{ "mfdcr", X(31,323), X_MASK, PPC403, { RT, SPR } }, +{ "mfdcr", X(31,323), X_MASK, BOOKE, { RT, SPR } }, { "div", XO(31,331,0,0), XO_MASK, M601, { RT, RA, RB } }, { "div.", XO(31,331,0,1), XO_MASK, M601, { RT, RA, RB } }, @@ -3621,94 +3629,137 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mfpmr", X(31,334), X_MASK, PPCPMR, { RT, PMRN }}, -{ "mfmq", XSPR(31,339,0), XSPR_MASK, M601, { RT } }, -{ "mfxer", XSPR(31,339,1), XSPR_MASK, COM, { RT } }, -{ "mfrtcu", XSPR(31,339,4), XSPR_MASK, COM, { RT } }, -{ "mfrtcl", XSPR(31,339,5), XSPR_MASK, COM, { RT } }, -{ "mfdec", XSPR(31,339,6), XSPR_MASK, MFDEC1, { RT } }, -{ "mflr", XSPR(31,339,8), XSPR_MASK, COM, { RT } }, -{ "mfctr", XSPR(31,339,9), XSPR_MASK, COM, { RT } }, -{ "mftid", XSPR(31,339,17), XSPR_MASK, POWER, { RT } }, -{ "mfdsisr", XSPR(31,339,18), XSPR_MASK, COM, { RT } }, -{ "mfdar", XSPR(31,339,19), XSPR_MASK, COM, { RT } }, -{ "mfdec", XSPR(31,339,22), XSPR_MASK, MFDEC2, { RT } }, -{ "mfsdr0", XSPR(31,339,24), XSPR_MASK, POWER, { RT } }, -{ "mfsdr1", XSPR(31,339,25), XSPR_MASK, COM, { RT } }, -{ "mfsrr0", XSPR(31,339,26), XSPR_MASK, COM, { RT } }, -{ "mfsrr1", XSPR(31,339,27), XSPR_MASK, COM, { RT } }, -{ "mfcmpa", XSPR(31,339,144), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpb", XSPR(31,339,145), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpc", XSPR(31,339,146), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpd", XSPR(31,339,147), XSPR_MASK, PPC860, { RT } }, -{ "mficr", XSPR(31,339,148), XSPR_MASK, PPC860, { RT } }, -{ "mfder", XSPR(31,339,149), XSPR_MASK, PPC860, { RT } }, -{ "mfcounta", XSPR(31,339,150), XSPR_MASK, PPC860, { RT } }, -{ "mfcountb", XSPR(31,339,151), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpe", XSPR(31,339,152), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpf", XSPR(31,339,153), XSPR_MASK, PPC860, { RT } }, -{ "mfcmpg", XSPR(31,339,154), XSPR_MASK, PPC860, { RT } }, -{ "mfcmph", XSPR(31,339,155), XSPR_MASK, PPC860, { RT } }, -{ "mflctrl1", XSPR(31,339,156), XSPR_MASK, PPC860, { RT } }, -{ "mflctrl2", XSPR(31,339,157), XSPR_MASK, PPC860, { RT } }, -{ "mfictrl", XSPR(31,339,158), XSPR_MASK, PPC860, { RT } }, -{ "mfbar", XSPR(31,339,159), XSPR_MASK, PPC860, { RT } }, -{ "mfvrsave", XSPR(31,339,256), XSPR_MASK, PPCVEC, { RT } }, -{ "mfsprg4", XSPR(31,339,260), XSPR_MASK, PPC405, { RT } }, -{ "mfsprg5", XSPR(31,339,261), XSPR_MASK, PPC405, { RT } }, -{ "mfsprg6", XSPR(31,339,262), XSPR_MASK, PPC405, { RT } }, -{ "mfsprg7", XSPR(31,339,263), XSPR_MASK, PPC405, { RT } }, -{ "mfsprg", XSPR(31,339,272), XSPRG_MASK, PPC, { RT, SPRG } }, -{ "mfsprg0", XSPR(31,339,272), XSPR_MASK, PPC, { RT } }, -{ "mfsprg1", XSPR(31,339,273), XSPR_MASK, PPC, { RT } }, -{ "mfsprg2", XSPR(31,339,274), XSPR_MASK, PPC, { RT } }, -{ "mfsprg3", XSPR(31,339,275), XSPR_MASK, PPC, { RT } }, -{ "mfasr", XSPR(31,339,280), XSPR_MASK, PPC64, { RT } }, -{ "mfear", XSPR(31,339,282), XSPR_MASK, PPC, { RT } }, -{ "mfpvr", XSPR(31,339,287), XSPR_MASK, PPC, { RT } }, -{ "mfspefscr",XSPR(31,339,512), XSPR_MASK, PPCSPE, { RT } }, -{ "mfibatu", XSPR(31,339,528), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfibatl", XSPR(31,339,529), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfdbatu", XSPR(31,339,536), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfdbatl", XSPR(31,339,537), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, -{ "mfic_cst", XSPR(31,339,560), XSPR_MASK, PPC860, { RT } }, -{ "mfic_adr", XSPR(31,339,561), XSPR_MASK, PPC860, { RT } }, -{ "mfic_dat", XSPR(31,339,562), XSPR_MASK, PPC860, { RT } }, -{ "mfdc_cst", XSPR(31,339,568), XSPR_MASK, PPC860, { RT } }, -{ "mfdc_adr", XSPR(31,339,569), XSPR_MASK, PPC860, { RT } }, -{ "mfdc_dat", XSPR(31,339,570), XSPR_MASK, PPC860, { RT } }, -{ "mfdpdr", XSPR(31,339,630), XSPR_MASK, PPC860, { RT } }, -{ "mfdpir", XSPR(31,339,631), XSPR_MASK, PPC860, { RT } }, -{ "mfimmr", XSPR(31,339,638), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_ctr", XSPR(31,339,784), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_ap", XSPR(31,339,786), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_epn", XSPR(31,339,787), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_twc", XSPR(31,339,789), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_rpn", XSPR(31,339,790), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_ctr", XSPR(31,339,792), XSPR_MASK, PPC860, { RT } }, -{ "mfm_casid",XSPR(31,339,793), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_ap", XSPR(31,339,794), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_epn", XSPR(31,339,795), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_twb", XSPR(31,339,796), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_twc", XSPR(31,339,797), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_rpn", XSPR(31,339,798), XSPR_MASK, PPC860, { RT } }, -{ "mfm_tw", XSPR(31,339,799), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_dbcam",XSPR(31,339,816), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_dbram0",XSPR(31,339,817), XSPR_MASK, PPC860, { RT } }, -{ "mfmi_dbram1",XSPR(31,339,818), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_dbcam", XSPR(31,339,824), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_dbram0",XSPR(31,339,825), XSPR_MASK, PPC860, { RT } }, -{ "mfmd_dbram1",XSPR(31,339,826), XSPR_MASK, PPC860, { RT } }, -{ "mfzpr", XSPR(31,339,944), XSPR_MASK, PPC403, { RT } }, -{ "mfpid", XSPR(31,339,945), XSPR_MASK, PPC403, { RT } }, -{ "mfccr0", XSPR(31,339,947), XSPR_MASK, PPC405, { RT } }, -{ "mficdbdr", XSPR(31,339,979), XSPR_MASK, PPC403, { RT } }, -{ "mfummcr0", XSPR(31,339,936), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc1", XSPR(31,339,937), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc2", XSPR(31,339,938), XSPR_MASK, PPC750, { RT } }, -{ "mfusia", XSPR(31,339,939), XSPR_MASK, PPC750, { RT } }, -{ "mfummcr1", XSPR(31,339,940), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc3", XSPR(31,339,941), XSPR_MASK, PPC750, { RT } }, -{ "mfupmc4", XSPR(31,339,942), XSPR_MASK, PPC750, { RT } }, +{ "mfmq", XSPR(31,339,0), XSPR_MASK, M601, { RT } }, +{ "mfxer", XSPR(31,339,1), XSPR_MASK, COM, { RT } }, +{ "mfrtcu", XSPR(31,339,4), XSPR_MASK, COM, { RT } }, +{ "mfrtcl", XSPR(31,339,5), XSPR_MASK, COM, { RT } }, +{ "mfdec", XSPR(31,339,6), XSPR_MASK, MFDEC1, { RT } }, +{ "mflr", XSPR(31,339,8), XSPR_MASK, COM, { RT } }, +{ "mfctr", XSPR(31,339,9), XSPR_MASK, COM, { RT } }, +{ "mftid", XSPR(31,339,17), XSPR_MASK, POWER, { RT } }, +{ "mfdsisr", XSPR(31,339,18), XSPR_MASK, COM, { RT } }, +{ "mfdar", XSPR(31,339,19), XSPR_MASK, COM, { RT } }, +{ "mfdec", XSPR(31,339,22), XSPR_MASK, MFDEC2, { RT } }, +{ "mfsdr0", XSPR(31,339,24), XSPR_MASK, POWER, { RT } }, +{ "mfsdr1", XSPR(31,339,25), XSPR_MASK, COM, { RT } }, +{ "mfsrr0", XSPR(31,339,26), XSPR_MASK, COM, { RT } }, +{ "mfsrr1", XSPR(31,339,27), XSPR_MASK, COM, { RT } }, +{ "mfpid", XSPR(31,339,48), XSPR_MASK, BOOKE, { RT } }, +{ "mfcsrr0", XSPR(31,339,58), XSPR_MASK, BOOKE, { RT } }, +{ "mfcsrr1", XSPR(31,339,59), XSPR_MASK, BOOKE, { RT } }, +{ "mfdear", XSPR(31,339,61), XSPR_MASK, BOOKE, { RT } }, +{ "mfesr", XSPR(31,339,62), XSPR_MASK, BOOKE, { RT } }, +{ "mfivpr", XSPR(31,339,63), XSPR_MASK, BOOKE, { RT } }, +{ "mfcmpa", XSPR(31,339,144), XSPR_MASK, PPC860, { RT } }, +{ "mfcmpb", XSPR(31,339,145), XSPR_MASK, PPC860, { RT } }, +{ "mfcmpc", XSPR(31,339,146), XSPR_MASK, PPC860, { RT } }, +{ "mfcmpd", XSPR(31,339,147), XSPR_MASK, PPC860, { RT } }, +{ "mficr", XSPR(31,339,148), XSPR_MASK, PPC860, { RT } }, +{ "mfder", XSPR(31,339,149), XSPR_MASK, PPC860, { RT } }, +{ "mfcounta", XSPR(31,339,150), XSPR_MASK, PPC860, { RT } }, +{ "mfcountb", XSPR(31,339,151), XSPR_MASK, PPC860, { RT } }, +{ "mfcmpe", XSPR(31,339,152), XSPR_MASK, PPC860, { RT } }, +{ "mfcmpf", XSPR(31,339,153), XSPR_MASK, PPC860, { RT } }, +{ "mfcmpg", XSPR(31,339,154), XSPR_MASK, PPC860, { RT } }, +{ "mfcmph", XSPR(31,339,155), XSPR_MASK, PPC860, { RT } }, +{ "mflctrl1", XSPR(31,339,156), XSPR_MASK, PPC860, { RT } }, +{ "mflctrl2", XSPR(31,339,157), XSPR_MASK, PPC860, { RT } }, +{ "mfictrl", XSPR(31,339,158), XSPR_MASK, PPC860, { RT } }, +{ "mfbar", XSPR(31,339,159), XSPR_MASK, PPC860, { RT } }, +{ "mfvrsave", XSPR(31,339,256), XSPR_MASK, PPCVEC, { RT } }, +{ "mfusprg0", XSPR(31,339,256), XSPR_MASK, BOOKE, { RT } }, +{ "mfsprg4", XSPR(31,339,260), XSPR_MASK, PPC405, { RT } }, +{ "mfsprg5", XSPR(31,339,261), XSPR_MASK, PPC405, { RT } }, +{ "mfsprg6", XSPR(31,339,262), XSPR_MASK, PPC405, { RT } }, +{ "mfsprg7", XSPR(31,339,263), XSPR_MASK, PPC405, { RT } }, +{ "mftbl", XSPR(31,339,268), XSPR_MASK, BOOKE, { RT } }, +{ "mftbu", XSPR(31,339,269), XSPR_MASK, BOOKE, { RT } }, +{ "mfsprg", XSPR(31,339,272), XSPRG_MASK, PPC, { RT, SPRG } }, +{ "mfsprg0", XSPR(31,339,272), XSPR_MASK, PPC, { RT } }, +{ "mfsprg1", XSPR(31,339,273), XSPR_MASK, PPC, { RT } }, +{ "mfsprg2", XSPR(31,339,274), XSPR_MASK, PPC, { RT } }, +{ "mfsprg3", XSPR(31,339,275), XSPR_MASK, PPC, { RT } }, +{ "mfasr", XSPR(31,339,280), XSPR_MASK, PPC64, { RT } }, +{ "mfear", XSPR(31,339,282), XSPR_MASK, PPC, { RT } }, +{ "mfpir", XSPR(31,339,286), XSPR_MASK, BOOKE, { RT } }, +{ "mfpvr", XSPR(31,339,287), XSPR_MASK, PPC, { RT } }, +{ "mfdbsr", XSPR(31,339,304), XSPR_MASK, BOOKE, { RT } }, +{ "mfdbcr0", XSPR(31,339,308), XSPR_MASK, BOOKE, { RT } }, +{ "mfdbcr1", XSPR(31,339,309), XSPR_MASK, BOOKE, { RT } }, +{ "mfdbcr2", XSPR(31,339,310), XSPR_MASK, BOOKE, { RT } }, +{ "mfiac1", XSPR(31,339,312), XSPR_MASK, BOOKE, { RT } }, +{ "mfiac2", XSPR(31,339,313), XSPR_MASK, BOOKE, { RT } }, +{ "mfiac3", XSPR(31,339,314), XSPR_MASK, BOOKE, { RT } }, +{ "mfiac4", XSPR(31,339,315), XSPR_MASK, BOOKE, { RT } }, +{ "mfdac1", XSPR(31,339,316), XSPR_MASK, BOOKE, { RT } }, +{ "mfdac2", XSPR(31,339,317), XSPR_MASK, BOOKE, { RT } }, +{ "mfdvc1", XSPR(31,339,318), XSPR_MASK, BOOKE, { RT } }, +{ "mfdvc2", XSPR(31,339,319), XSPR_MASK, BOOKE, { RT } }, +{ "mftsr", XSPR(31,339,336), XSPR_MASK, BOOKE, { RT } }, +{ "mftcr", XSPR(31,339,340), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor0", XSPR(31,339,400), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor1", XSPR(31,339,401), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor2", XSPR(31,339,402), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor3", XSPR(31,339,403), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor4", XSPR(31,339,404), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor5", XSPR(31,339,405), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor6", XSPR(31,339,406), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor7", XSPR(31,339,407), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor8", XSPR(31,339,408), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor9", XSPR(31,339,409), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor10", XSPR(31,339,410), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor11", XSPR(31,339,411), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor12", XSPR(31,339,412), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor13", XSPR(31,339,413), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor14", XSPR(31,339,414), XSPR_MASK, BOOKE, { RT } }, +{ "mfivor15", XSPR(31,339,415), XSPR_MASK, BOOKE, { RT } }, +{ "mfspefscr", XSPR(31,339,512), XSPR_MASK, PPCSPE, { RT } }, +{ "mfbbear", XSPR(31,339,513), XSPR_MASK, PPCBRLK, { RT } }, +{ "mfibatu", XSPR(31,339,528), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, +{ "mfibatl", XSPR(31,339,529), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, +{ "mfdbatu", XSPR(31,339,536), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, +{ "mfdbatl", XSPR(31,339,537), XSPRBAT_MASK, PPC, { RT, SPRBAT } }, +{ "mfic_cst", XSPR(31,339,560), XSPR_MASK, PPC860, { RT } }, +{ "mfic_adr", XSPR(31,339,561), XSPR_MASK, PPC860, { RT } }, +{ "mfic_dat", XSPR(31,339,562), XSPR_MASK, PPC860, { RT } }, +{ "mfdc_cst", XSPR(31,339,568), XSPR_MASK, PPC860, { RT } }, +{ "mfdc_adr", XSPR(31,339,569), XSPR_MASK, PPC860, { RT } }, +{ "mfdc_dat", XSPR(31,339,570), XSPR_MASK, PPC860, { RT } }, +{ "mfmcsrr0", XSPR(31,339,570), XSPR_MASK, PPCRFMCI, { RT } }, +{ "mfmcsrr1", XSPR(31,339,571), XSPR_MASK, PPCRFMCI, { RT } }, +{ "mfmcsr", XSPR(31,339,572), XSPR_MASK, PPCRFMCI, { RT } }, +{ "mfdpdr", XSPR(31,339,630), XSPR_MASK, PPC860, { RT } }, +{ "mfdpir", XSPR(31,339,631), XSPR_MASK, PPC860, { RT } }, +{ "mfimmr", XSPR(31,339,638), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_ctr", XSPR(31,339,784), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_ap", XSPR(31,339,786), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_epn", XSPR(31,339,787), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_twc", XSPR(31,339,789), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_rpn", XSPR(31,339,790), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_ctr", XSPR(31,339,792), XSPR_MASK, PPC860, { RT } }, +{ "mfm_casid", XSPR(31,339,793), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_ap", XSPR(31,339,794), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_epn", XSPR(31,339,795), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_twb", XSPR(31,339,796), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_twc", XSPR(31,339,797), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_rpn", XSPR(31,339,798), XSPR_MASK, PPC860, { RT } }, +{ "mfm_tw", XSPR(31,339,799), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_dbcam", XSPR(31,339,816), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_dbram0",XSPR(31,339,817), XSPR_MASK, PPC860, { RT } }, +{ "mfmi_dbram1",XSPR(31,339,818), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_dbcam", XSPR(31,339,824), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_dbram0",XSPR(31,339,825), XSPR_MASK, PPC860, { RT } }, +{ "mfmd_dbram1",XSPR(31,339,826), XSPR_MASK, PPC860, { RT } }, +{ "mfummcr0", XSPR(31,339,936), XSPR_MASK, PPC750, { RT } }, +{ "mfupmc1", XSPR(31,339,937), XSPR_MASK, PPC750, { RT } }, +{ "mfupmc2", XSPR(31,339,938), XSPR_MASK, PPC750, { RT } }, +{ "mfusia", XSPR(31,339,939), XSPR_MASK, PPC750, { RT } }, +{ "mfummcr1", XSPR(31,339,940), XSPR_MASK, PPC750, { RT } }, +{ "mfupmc3", XSPR(31,339,941), XSPR_MASK, PPC750, { RT } }, +{ "mfupmc4", XSPR(31,339,942), XSPR_MASK, PPC750, { RT } }, +{ "mfzpr", XSPR(31,339,944), XSPR_MASK, PPC403, { RT } }, +{ "mfpid", XSPR(31,339,945), XSPR_MASK, PPC403, { RT } }, +{ "mfccr0", XSPR(31,339,947), XSPR_MASK, PPC405, { RT } }, { "mfiac3", XSPR(31,339,948), XSPR_MASK, PPC405, { RT } }, { "mfiac4", XSPR(31,339,949), XSPR_MASK, PPC405, { RT } }, { "mfdvc1", XSPR(31,339,950), XSPR_MASK, PPC405, { RT } }, @@ -3725,35 +3776,36 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mfpmc3", XSPR(31,339,957), XSPR_MASK, PPC750, { RT } }, { "mfdbcr1", XSPR(31,339,957), XSPR_MASK, PPC405, { RT } }, { "mfpmc4", XSPR(31,339,958), XSPR_MASK, PPC750, { RT } }, -{ "mfesr", XSPR(31,339,980), XSPR_MASK, PPC403, { RT } }, -{ "mfdear", XSPR(31,339,981), XSPR_MASK, PPC403, { RT } }, -{ "mfevpr", XSPR(31,339,982), XSPR_MASK, PPC403, { RT } }, -{ "mfcdbcr", XSPR(31,339,983), XSPR_MASK, PPC403, { RT } }, -{ "mftsr", XSPR(31,339,984), XSPR_MASK, PPC403, { RT } }, -{ "mftcr", XSPR(31,339,986), XSPR_MASK, PPC403, { RT } }, -{ "mfpit", XSPR(31,339,987), XSPR_MASK, PPC403, { RT } }, -{ "mftbhi", XSPR(31,339,988), XSPR_MASK, PPC403, { RT } }, -{ "mftblo", XSPR(31,339,989), XSPR_MASK, PPC403, { RT } }, -{ "mfsrr2", XSPR(31,339,990), XSPR_MASK, PPC403, { RT } }, -{ "mfsrr3", XSPR(31,339,991), XSPR_MASK, PPC403, { RT } }, -{ "mfdbsr", XSPR(31,339,1008), XSPR_MASK, PPC403, { RT } }, -{ "mfdbcr0", XSPR(31,339,1010), XSPR_MASK, PPC405, { RT } }, -{ "mfiac1", XSPR(31,339,1012), XSPR_MASK, PPC403, { RT } }, -{ "mfiac2", XSPR(31,339,1013), XSPR_MASK, PPC403, { RT } }, -{ "mfdac1", XSPR(31,339,1014), XSPR_MASK, PPC403, { RT } }, -{ "mfdac2", XSPR(31,339,1015), XSPR_MASK, PPC403, { RT } }, -{ "mfdccr", XSPR(31,339,1018), XSPR_MASK, PPC403, { RT } }, -{ "mficcr", XSPR(31,339,1019), XSPR_MASK, PPC403, { RT } }, -{ "mfpbl1", XSPR(31,339,1020), XSPR_MASK, PPC403, { RT } }, -{ "mfpbu1", XSPR(31,339,1021), XSPR_MASK, PPC403, { RT } }, -{ "mfpbl2", XSPR(31,339,1022), XSPR_MASK, PPC403, { RT } }, -{ "mfpbu2", XSPR(31,339,1023), XSPR_MASK, PPC403, { RT } }, -{ "mfl2cr", XSPR(31,339,1017), XSPR_MASK, PPC750, { RT } }, -{ "mfictc", XSPR(31,339,1019), XSPR_MASK, PPC750, { RT } }, -{ "mfthrm1", XSPR(31,339,1020), XSPR_MASK, PPC750, { RT } }, -{ "mfthrm2", XSPR(31,339,1021), XSPR_MASK, PPC750, { RT } }, -{ "mfthrm3", XSPR(31,339,1022), XSPR_MASK, PPC750, { RT } }, -{ "mfspr", X(31,339), X_MASK, COM, { RT, SPR } }, +{ "mficdbdr", XSPR(31,339,979), XSPR_MASK, PPC403, { RT } }, +{ "mfesr", XSPR(31,339,980), XSPR_MASK, PPC403, { RT } }, +{ "mfdear", XSPR(31,339,981), XSPR_MASK, PPC403, { RT } }, +{ "mfevpr", XSPR(31,339,982), XSPR_MASK, PPC403, { RT } }, +{ "mfcdbcr", XSPR(31,339,983), XSPR_MASK, PPC403, { RT } }, +{ "mftsr", XSPR(31,339,984), XSPR_MASK, PPC403, { RT } }, +{ "mftcr", XSPR(31,339,986), XSPR_MASK, PPC403, { RT } }, +{ "mfpit", XSPR(31,339,987), XSPR_MASK, PPC403, { RT } }, +{ "mftbhi", XSPR(31,339,988), XSPR_MASK, PPC403, { RT } }, +{ "mftblo", XSPR(31,339,989), XSPR_MASK, PPC403, { RT } }, +{ "mfsrr2", XSPR(31,339,990), XSPR_MASK, PPC403, { RT } }, +{ "mfsrr3", XSPR(31,339,991), XSPR_MASK, PPC403, { RT } }, +{ "mfdbsr", XSPR(31,339,1008), XSPR_MASK, PPC403, { RT } }, +{ "mfdbcr0", XSPR(31,339,1010), XSPR_MASK, PPC405, { RT } }, +{ "mfiac1", XSPR(31,339,1012), XSPR_MASK, PPC403, { RT } }, +{ "mfiac2", XSPR(31,339,1013), XSPR_MASK, PPC403, { RT } }, +{ "mfdac1", XSPR(31,339,1014), XSPR_MASK, PPC403, { RT } }, +{ "mfdac2", XSPR(31,339,1015), XSPR_MASK, PPC403, { RT } }, +{ "mfl2cr", XSPR(31,339,1017), XSPR_MASK, PPC750, { RT } }, +{ "mfdccr", XSPR(31,339,1018), XSPR_MASK, PPC403, { RT } }, +{ "mficcr", XSPR(31,339,1019), XSPR_MASK, PPC403, { RT } }, +{ "mfictc", XSPR(31,339,1019), XSPR_MASK, PPC750, { RT } }, +{ "mfpbl1", XSPR(31,339,1020), XSPR_MASK, PPC403, { RT } }, +{ "mfthrm1", XSPR(31,339,1020), XSPR_MASK, PPC750, { RT } }, +{ "mfpbu1", XSPR(31,339,1021), XSPR_MASK, PPC403, { RT } }, +{ "mfthrm2", XSPR(31,339,1021), XSPR_MASK, PPC750, { RT } }, +{ "mfpbl2", XSPR(31,339,1022), XSPR_MASK, PPC403, { RT } }, +{ "mfthrm3", XSPR(31,339,1022), XSPR_MASK, PPC750, { RT } }, +{ "mfpbu2", XSPR(31,339,1023), XSPR_MASK, PPC403, { RT } }, +{ "mfspr", X(31,339), X_MASK, COM, { RT, SPR } }, { "lwax", X(31,341), X_MASK, PPC64, { RT, RA, RB } }, @@ -3783,6 +3835,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mftbl", XSPR(31,371,268), XSPR_MASK, CLASSIC, { RT } }, { "mftbu", XSPR(31,371,269), XSPR_MASK, CLASSIC, { RT } }, +{ "mftb", X(31,371), X_MASK, BOOKE, { RT, TBR } }, { "mftb", X(31,371), X_MASK, CLASSIC, { RT, TBR } }, { "lwaux", X(31,373), X_MASK, PPC64, { RT, RAL, RB } }, @@ -3801,7 +3854,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "adde64", XO(31,394,0,0), XO_MASK, BOOKE64, { RT, RA, RB } }, { "adde64o", XO(31,394,1,0), XO_MASK, BOOKE64, { RT, RA, RB } }, -{ "dcblce", X(31,398), X_MASK, PPCCHLK, { CT, RA, RB }}, +{ "dcblce", X(31,398), X_MASK, PPCCHLK64, { CT, RA, RB }}, { "slbmte", X(31,402), XRA_MASK, PPC64, { RS, RB } }, @@ -3836,19 +3889,19 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mr.", XRC(31,444,1), X_MASK, COM, { RA, RS, RBS } }, { "or.", XRC(31,444,1), X_MASK, COM, { RA, RS, RB } }, -{ "mtexisr", XSPR(31,451,64), XSPR_MASK, PPC403, { RT } }, -{ "mtexier", XSPR(31,451,66), XSPR_MASK, PPC403, { RT } }, -{ "mtbr0", XSPR(31,451,128), XSPR_MASK, PPC403, { RT } }, -{ "mtbr1", XSPR(31,451,129), XSPR_MASK, PPC403, { RT } }, -{ "mtbr2", XSPR(31,451,130), XSPR_MASK, PPC403, { RT } }, -{ "mtbr3", XSPR(31,451,131), XSPR_MASK, PPC403, { RT } }, -{ "mtbr4", XSPR(31,451,132), XSPR_MASK, PPC403, { RT } }, -{ "mtbr5", XSPR(31,451,133), XSPR_MASK, PPC403, { RT } }, -{ "mtbr6", XSPR(31,451,134), XSPR_MASK, PPC403, { RT } }, -{ "mtbr7", XSPR(31,451,135), XSPR_MASK, PPC403, { RT } }, -{ "mtbear", XSPR(31,451,144), XSPR_MASK, PPC403, { RT } }, -{ "mtbesr", XSPR(31,451,145), XSPR_MASK, PPC403, { RT } }, -{ "mtiocr", XSPR(31,451,160), XSPR_MASK, PPC403, { RT } }, +{ "mtexisr", XSPR(31,451,64), XSPR_MASK, PPC403, { RT } }, +{ "mtexier", XSPR(31,451,66), XSPR_MASK, PPC403, { RT } }, +{ "mtbr0", XSPR(31,451,128), XSPR_MASK, PPC403, { RT } }, +{ "mtbr1", XSPR(31,451,129), XSPR_MASK, PPC403, { RT } }, +{ "mtbr2", XSPR(31,451,130), XSPR_MASK, PPC403, { RT } }, +{ "mtbr3", XSPR(31,451,131), XSPR_MASK, PPC403, { RT } }, +{ "mtbr4", XSPR(31,451,132), XSPR_MASK, PPC403, { RT } }, +{ "mtbr5", XSPR(31,451,133), XSPR_MASK, PPC403, { RT } }, +{ "mtbr6", XSPR(31,451,134), XSPR_MASK, PPC403, { RT } }, +{ "mtbr7", XSPR(31,451,135), XSPR_MASK, PPC403, { RT } }, +{ "mtbear", XSPR(31,451,144), XSPR_MASK, PPC403, { RT } }, +{ "mtbesr", XSPR(31,451,145), XSPR_MASK, PPC403, { RT } }, +{ "mtiocr", XSPR(31,451,160), XSPR_MASK, PPC403, { RT } }, { "mtdmacr0", XSPR(31,451,192), XSPR_MASK, PPC403, { RT } }, { "mtdmact0", XSPR(31,451,193), XSPR_MASK, PPC403, { RT } }, { "mtdmada0", XSPR(31,451,194), XSPR_MASK, PPC403, { RT } }, @@ -3869,9 +3922,9 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mtdmada3", XSPR(31,451,218), XSPR_MASK, PPC403, { RT } }, { "mtdmasa3", XSPR(31,451,219), XSPR_MASK, PPC403, { RT } }, { "mtdmacc3", XSPR(31,451,220), XSPR_MASK, PPC403, { RT } }, -{ "mtdmasr", XSPR(31,451,224), XSPR_MASK, PPC403, { RT } }, -{ "mtdcr", X(31,451), X_MASK, PPC403, { SPR, RS } }, -{ "mtdcr", X(31,451), X_MASK, BOOKE, { SPR, RS } }, +{ "mtdmasr", XSPR(31,451,224), XSPR_MASK, PPC403, { RT } }, +{ "mtdcr", X(31,451), X_MASK, PPC403, { SPR, RS } }, +{ "mtdcr", X(31,451), X_MASK, BOOKE, { SPR, RS } }, { "subfze64",XO(31,456,0,0), XORB_MASK, BOOKE64, { RT, RA } }, { "subfze64o",XO(31,456,1,0), XORB_MASK, BOOKE64, { RT, RA } }, @@ -3889,111 +3942,157 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "divwuo", XO(31,459,1,0), XO_MASK, PPC, { RT, RA, RB } }, { "divwuo.", XO(31,459,1,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "mtmq", XSPR(31,467,0), XSPR_MASK, M601, { RS } }, -{ "mtxer", XSPR(31,467,1), XSPR_MASK, COM, { RS } }, -{ "mtlr", XSPR(31,467,8), XSPR_MASK, COM, { RS } }, -{ "mtctr", XSPR(31,467,9), XSPR_MASK, COM, { RS } }, -{ "mttid", XSPR(31,467,17), XSPR_MASK, POWER, { RS } }, -{ "mtdsisr", XSPR(31,467,18), XSPR_MASK, COM, { RS } }, -{ "mtdar", XSPR(31,467,19), XSPR_MASK, COM, { RS } }, -{ "mtrtcu", XSPR(31,467,20), XSPR_MASK, COM, { RS } }, -{ "mtrtcl", XSPR(31,467,21), XSPR_MASK, COM, { RS } }, -{ "mtdec", XSPR(31,467,22), XSPR_MASK, COM, { RS } }, -{ "mtsdr0", XSPR(31,467,24), XSPR_MASK, POWER, { RS } }, -{ "mtsdr1", XSPR(31,467,25), XSPR_MASK, COM, { RS } }, -{ "mtsrr0", XSPR(31,467,26), XSPR_MASK, COM, { RS } }, -{ "mtsrr1", XSPR(31,467,27), XSPR_MASK, COM, { RS } }, -{ "mtcmpa", XSPR(31,467,144), XSPR_MASK, PPC860, { RT } }, -{ "mtcmpb", XSPR(31,467,145), XSPR_MASK, PPC860, { RT } }, -{ "mtcmpc", XSPR(31,467,146), XSPR_MASK, PPC860, { RT } }, -{ "mtcmpd", XSPR(31,467,147), XSPR_MASK, PPC860, { RT } }, -{ "mticr", XSPR(31,467,148), XSPR_MASK, PPC860, { RT } }, -{ "mtder", XSPR(31,467,149), XSPR_MASK, PPC860, { RT } }, -{ "mtcounta", XSPR(31,467,150), XSPR_MASK, PPC860, { RT } }, -{ "mtcountb", XSPR(31,467,151), XSPR_MASK, PPC860, { RT } }, -{ "mtcmpe", XSPR(31,467,152), XSPR_MASK, PPC860, { RT } }, -{ "mtcmpf", XSPR(31,467,153), XSPR_MASK, PPC860, { RT } }, -{ "mtcmpg", XSPR(31,467,154), XSPR_MASK, PPC860, { RT } }, -{ "mtcmph", XSPR(31,467,155), XSPR_MASK, PPC860, { RT } }, -{ "mtlctrl1", XSPR(31,467,156), XSPR_MASK, PPC860, { RT } }, -{ "mtlctrl2", XSPR(31,467,157), XSPR_MASK, PPC860, { RT } }, -{ "mtictrl", XSPR(31,467,158), XSPR_MASK, PPC860, { RT } }, -{ "mtbar", XSPR(31,467,159), XSPR_MASK, PPC860, { RT } }, -{ "mtvrsave",XSPR(31,467,256), XSPR_MASK, PPCVEC, { RT } }, -{ "mtsprg", XSPR(31,467,272), XSPRG_MASK, PPC, { SPRG, RS } }, -{ "mtsprg0", XSPR(31,467,272), XSPR_MASK, PPC, { RT } }, -{ "mtsprg1", XSPR(31,467,273), XSPR_MASK, PPC, { RT } }, -{ "mtsprg2", XSPR(31,467,274), XSPR_MASK, PPC, { RT } }, -{ "mtsprg3", XSPR(31,467,275), XSPR_MASK, PPC, { RT } }, -{ "mtsprg4", XSPR(31,467,276), XSPR_MASK, PPC405, { RT } }, -{ "mtsprg5", XSPR(31,467,277), XSPR_MASK, PPC405, { RT } }, -{ "mtsprg6", XSPR(31,467,278), XSPR_MASK, PPC405, { RT } }, -{ "mtsprg7", XSPR(31,467,279), XSPR_MASK, PPC405, { RT } }, -{ "mtasr", XSPR(31,467,280), XSPR_MASK, PPC64, { RS } }, -{ "mtear", XSPR(31,467,282), XSPR_MASK, PPC, { RS } }, -{ "mttbl", XSPR(31,467,284), XSPR_MASK, PPC, { RS } }, -{ "mttbu", XSPR(31,467,285), XSPR_MASK, PPC, { RS } }, -{ "mtspefscr",XSPR(31,467,512),XSPR_MASK, PPCSPE, { RT } }, -{ "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, -{ "mtzpr", XSPR(31,467,944), XSPR_MASK, PPC403, { RT } }, -{ "mtpid", XSPR(31,467,945), XSPR_MASK, PPC403, { RT } }, -{ "mtccr0", XSPR(31,467,947), XSPR_MASK, PPC405, { RT } }, -{ "mtiac3", XSPR(31,467,948), XSPR_MASK, PPC405, { RT } }, -{ "mtiac4", XSPR(31,467,949), XSPR_MASK, PPC405, { RT } }, -{ "mtdvc1", XSPR(31,467,950), XSPR_MASK, PPC405, { RT } }, -{ "mtdvc2", XSPR(31,467,951), XSPR_MASK, PPC405, { RT } }, -{ "mtsgr", XSPR(31,467,953), XSPR_MASK, PPC403, { RT } }, -{ "mtdcwr", XSPR(31,467,954), XSPR_MASK, PPC403, { RT } }, -{ "mtsler", XSPR(31,467,955), XSPR_MASK, PPC405, { RT } }, -{ "mtsu0r", XSPR(31,467,956), XSPR_MASK, PPC405, { RT } }, -{ "mtdbcr1", XSPR(31,467,957), XSPR_MASK, PPC405, { RT } }, -{ "mticdbdr",XSPR(31,467,979), XSPR_MASK, PPC403, { RT } }, -{ "mtesr", XSPR(31,467,980), XSPR_MASK, PPC403, { RT } }, -{ "mtdear", XSPR(31,467,981), XSPR_MASK, PPC403, { RT } }, -{ "mtevpr", XSPR(31,467,982), XSPR_MASK, PPC403, { RT } }, -{ "mtcdbcr", XSPR(31,467,983), XSPR_MASK, PPC403, { RT } }, -{ "mttsr", XSPR(31,467,984), XSPR_MASK, PPC403, { RT } }, -{ "mttcr", XSPR(31,467,986), XSPR_MASK, PPC403, { RT } }, -{ "mtpit", XSPR(31,467,987), XSPR_MASK, PPC403, { RT } }, -{ "mttbhi", XSPR(31,467,988), XSPR_MASK, PPC403, { RT } }, -{ "mttblo", XSPR(31,467,989), XSPR_MASK, PPC403, { RT } }, -{ "mtsrr2", XSPR(31,467,990), XSPR_MASK, PPC403, { RT } }, -{ "mtsrr3", XSPR(31,467,991), XSPR_MASK, PPC403, { RT } }, -{ "mtdbsr", XSPR(31,467,1008), XSPR_MASK, PPC403, { RT } }, -{ "mtdbcr0", XSPR(31,467,1010), XSPR_MASK, PPC405, { RT } }, -{ "mtiac1", XSPR(31,467,1012), XSPR_MASK, PPC403, { RT } }, -{ "mtiac2", XSPR(31,467,1013), XSPR_MASK, PPC403, { RT } }, -{ "mtdac1", XSPR(31,467,1014), XSPR_MASK, PPC403, { RT } }, -{ "mtdac2", XSPR(31,467,1015), XSPR_MASK, PPC403, { RT } }, -{ "mtdccr", XSPR(31,467,1018), XSPR_MASK, PPC403, { RT } }, -{ "mticcr", XSPR(31,467,1019), XSPR_MASK, PPC403, { RT } }, -{ "mtpbl1", XSPR(31,467,1020), XSPR_MASK, PPC403, { RT } }, -{ "mtpbu1", XSPR(31,467,1021), XSPR_MASK, PPC403, { RT } }, -{ "mtpbl2", XSPR(31,467,1022), XSPR_MASK, PPC403, { RT } }, -{ "mtpbu2", XSPR(31,467,1023), XSPR_MASK, PPC403, { RT } }, -{ "mtummcr0", XSPR(31,467,936), XSPR_MASK, PPC750, { RT } }, -{ "mtupmc1", XSPR(31,467,937), XSPR_MASK, PPC750, { RT } }, -{ "mtupmc2", XSPR(31,467,938), XSPR_MASK, PPC750, { RT } }, -{ "mtusia", XSPR(31,467,939), XSPR_MASK, PPC750, { RT } }, -{ "mtummcr1", XSPR(31,467,940), XSPR_MASK, PPC750, { RT } }, -{ "mtupmc3", XSPR(31,467,941), XSPR_MASK, PPC750, { RT } }, -{ "mtupmc4", XSPR(31,467,942), XSPR_MASK, PPC750, { RT } }, -{ "mtmmcr0", XSPR(31,467,952), XSPR_MASK, PPC750, { RT } }, -{ "mtpmc1", XSPR(31,467,953), XSPR_MASK, PPC750, { RT } }, -{ "mtpmc2", XSPR(31,467,954), XSPR_MASK, PPC750, { RT } }, -{ "mtsia", XSPR(31,467,955), XSPR_MASK, PPC750, { RT } }, -{ "mtmmcr1", XSPR(31,467,956), XSPR_MASK, PPC750, { RT } }, -{ "mtpmc3", XSPR(31,467,957), XSPR_MASK, PPC750, { RT } }, -{ "mtpmc4", XSPR(31,467,958), XSPR_MASK, PPC750, { RT } }, -{ "mtl2cr", XSPR(31,467,1017), XSPR_MASK, PPC750, { RT } }, -{ "mtictc", XSPR(31,467,1019), XSPR_MASK, PPC750, { RT } }, -{ "mtthrm1", XSPR(31,467,1020), XSPR_MASK, PPC750, { RT } }, -{ "mtthrm2", XSPR(31,467,1021), XSPR_MASK, PPC750, { RT } }, -{ "mtthrm3", XSPR(31,467,1022), XSPR_MASK, PPC750, { RT } }, -{ "mtspr", X(31,467), X_MASK, COM, { SPR, RS } }, +{ "mtmq", XSPR(31,467,0), XSPR_MASK, M601, { RS } }, +{ "mtxer", XSPR(31,467,1), XSPR_MASK, COM, { RS } }, +{ "mtlr", XSPR(31,467,8), XSPR_MASK, COM, { RS } }, +{ "mtctr", XSPR(31,467,9), XSPR_MASK, COM, { RS } }, +{ "mttid", XSPR(31,467,17), XSPR_MASK, POWER, { RS } }, +{ "mtdsisr", XSPR(31,467,18), XSPR_MASK, COM, { RS } }, +{ "mtdar", XSPR(31,467,19), XSPR_MASK, COM, { RS } }, +{ "mtrtcu", XSPR(31,467,20), XSPR_MASK, COM, { RS } }, +{ "mtrtcl", XSPR(31,467,21), XSPR_MASK, COM, { RS } }, +{ "mtdec", XSPR(31,467,22), XSPR_MASK, COM, { RS } }, +{ "mtsdr0", XSPR(31,467,24), XSPR_MASK, POWER, { RS } }, +{ "mtsdr1", XSPR(31,467,25), XSPR_MASK, COM, { RS } }, +{ "mtsrr0", XSPR(31,467,26), XSPR_MASK, COM, { RS } }, +{ "mtsrr1", XSPR(31,467,27), XSPR_MASK, COM, { RS } }, +{ "mtpid", XSPR(31,467,48), XSPR_MASK, BOOKE, { RS } }, +{ "mtdecar", XSPR(31,467,54), XSPR_MASK, BOOKE, { RS } }, +{ "mtcsrr0", XSPR(31,467,58), XSPR_MASK, BOOKE, { RS } }, +{ "mtcsrr1", XSPR(31,467,59), XSPR_MASK, BOOKE, { RS } }, +{ "mtdear", XSPR(31,467,61), XSPR_MASK, BOOKE, { RS } }, +{ "mtesr", XSPR(31,467,62), XSPR_MASK, BOOKE, { RS } }, +{ "mtivpr", XSPR(31,467,63), XSPR_MASK, BOOKE, { RS } }, +{ "mtcmpa", XSPR(31,467,144), XSPR_MASK, PPC860, { RT } }, +{ "mtcmpb", XSPR(31,467,145), XSPR_MASK, PPC860, { RT } }, +{ "mtcmpc", XSPR(31,467,146), XSPR_MASK, PPC860, { RT } }, +{ "mtcmpd", XSPR(31,467,147), XSPR_MASK, PPC860, { RT } }, +{ "mticr", XSPR(31,467,148), XSPR_MASK, PPC860, { RT } }, +{ "mtder", XSPR(31,467,149), XSPR_MASK, PPC860, { RT } }, +{ "mtcounta", XSPR(31,467,150), XSPR_MASK, PPC860, { RT } }, +{ "mtcountb", XSPR(31,467,151), XSPR_MASK, PPC860, { RT } }, +{ "mtcmpe", XSPR(31,467,152), XSPR_MASK, PPC860, { RT } }, +{ "mtcmpf", XSPR(31,467,153), XSPR_MASK, PPC860, { RT } }, +{ "mtcmpg", XSPR(31,467,154), XSPR_MASK, PPC860, { RT } }, +{ "mtcmph", XSPR(31,467,155), XSPR_MASK, PPC860, { RT } }, +{ "mtlctrl1", XSPR(31,467,156), XSPR_MASK, PPC860, { RT } }, +{ "mtlctrl2", XSPR(31,467,157), XSPR_MASK, PPC860, { RT } }, +{ "mtictrl", XSPR(31,467,158), XSPR_MASK, PPC860, { RT } }, +{ "mtbar", XSPR(31,467,159), XSPR_MASK, PPC860, { RT } }, +{ "mtvrsave", XSPR(31,467,256), XSPR_MASK, PPCVEC, { RT } }, +{ "mtusprg0", XSPR(31,467,256), XSPR_MASK, BOOKE, { RS } }, +{ "mtsprg", XSPR(31,467,272), XSPRG_MASK,PPC, { SPRG, RS } }, +{ "mtsprg0", XSPR(31,467,272), XSPR_MASK, PPC, { RT } }, +{ "mtsprg1", XSPR(31,467,273), XSPR_MASK, PPC, { RT } }, +{ "mtsprg2", XSPR(31,467,274), XSPR_MASK, PPC, { RT } }, +{ "mtsprg3", XSPR(31,467,275), XSPR_MASK, PPC, { RT } }, +{ "mtsprg4", XSPR(31,467,276), XSPR_MASK, PPC405, { RT } }, +{ "mtsprg4", XSPR(31,467,276), XSPR_MASK, BOOKE, { RS } }, +{ "mtsprg5", XSPR(31,467,277), XSPR_MASK, PPC405, { RT } }, +{ "mtsprg5", XSPR(31,467,277), XSPR_MASK, BOOKE, { RS } }, +{ "mtsprg6", XSPR(31,467,278), XSPR_MASK, PPC405, { RT } }, +{ "mtsprg6", XSPR(31,467,278), XSPR_MASK, BOOKE, { RS } }, +{ "mtsprg7", XSPR(31,467,279), XSPR_MASK, PPC405, { RT } }, +{ "mtsprg7", XSPR(31,467,279), XSPR_MASK, BOOKE, { RS } }, +{ "mtasr", XSPR(31,467,280), XSPR_MASK, PPC64, { RS } }, +{ "mtear", XSPR(31,467,282), XSPR_MASK, PPC, { RS } }, +{ "mttbl", XSPR(31,467,284), XSPR_MASK, PPC, { RS } }, +{ "mttbu", XSPR(31,467,285), XSPR_MASK, PPC, { RS } }, +{ "mtdbsr", XSPR(31,467,304), XSPR_MASK, BOOKE, { RS } }, +{ "mtdbcr0", XSPR(31,467,308), XSPR_MASK, BOOKE, { RS } }, +{ "mtdbcr1", XSPR(31,467,309), XSPR_MASK, BOOKE, { RS } }, +{ "mtdbcr2", XSPR(31,467,310), XSPR_MASK, BOOKE, { RS } }, +{ "mtiac1", XSPR(31,467,312), XSPR_MASK, BOOKE, { RS } }, +{ "mtiac2", XSPR(31,467,313), XSPR_MASK, BOOKE, { RS } }, +{ "mtiac3", XSPR(31,467,314), XSPR_MASK, BOOKE, { RS } }, +{ "mtiac4", XSPR(31,467,315), XSPR_MASK, BOOKE, { RS } }, +{ "mtdac1", XSPR(31,467,316), XSPR_MASK, BOOKE, { RS } }, +{ "mtdac2", XSPR(31,467,317), XSPR_MASK, BOOKE, { RS } }, +{ "mtdvc1", XSPR(31,467,318), XSPR_MASK, BOOKE, { RS } }, +{ "mtdvc2", XSPR(31,467,319), XSPR_MASK, BOOKE, { RS } }, +{ "mttsr", XSPR(31,467,336), XSPR_MASK, BOOKE, { RS } }, +{ "mttcr", XSPR(31,467,340), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor0", XSPR(31,467,400), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor1", XSPR(31,467,401), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor2", XSPR(31,467,402), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor3", XSPR(31,467,403), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor4", XSPR(31,467,404), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor5", XSPR(31,467,405), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor6", XSPR(31,467,406), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor7", XSPR(31,467,407), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor8", XSPR(31,467,408), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor9", XSPR(31,467,409), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor10", XSPR(31,467,410), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor11", XSPR(31,467,411), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor12", XSPR(31,467,412), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor13", XSPR(31,467,413), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor14", XSPR(31,467,414), XSPR_MASK, BOOKE, { RS } }, +{ "mtivor15", XSPR(31,467,415), XSPR_MASK, BOOKE, { RS } }, +{ "mtspefscr", XSPR(31,467,512), XSPR_MASK, PPCSPE, { RT } }, +{ "mtbbear", XSPR(31,467,513), XSPR_MASK, PPCBRLK, { RS } }, +{ "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, +{ "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, +{ "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, +{ "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC, { SPRBAT, RS } }, +{ "mtmcsrr0", XSPR(31,467,570), XSPR_MASK, PPCRFMCI, { RS } }, +{ "mtmcsrr1", XSPR(31,467,571), XSPR_MASK, PPCRFMCI, { RS } }, +{ "mtmcsr", XSPR(31,467,572), XSPR_MASK, PPCRFMCI, { RS } }, +{ "mtummcr0", XSPR(31,467,936), XSPR_MASK, PPC750, { RT } }, +{ "mtupmc1", XSPR(31,467,937), XSPR_MASK, PPC750, { RT } }, +{ "mtupmc2", XSPR(31,467,938), XSPR_MASK, PPC750, { RT } }, +{ "mtusia", XSPR(31,467,939), XSPR_MASK, PPC750, { RT } }, +{ "mtummcr1", XSPR(31,467,940), XSPR_MASK, PPC750, { RT } }, +{ "mtupmc3", XSPR(31,467,941), XSPR_MASK, PPC750, { RT } }, +{ "mtupmc4", XSPR(31,467,942), XSPR_MASK, PPC750, { RT } }, +{ "mtzpr", XSPR(31,467,944), XSPR_MASK, PPC403, { RT } }, +{ "mtpid", XSPR(31,467,945), XSPR_MASK, PPC403, { RT } }, +{ "mtccr0", XSPR(31,467,947), XSPR_MASK, PPC405, { RT } }, +{ "mtiac3", XSPR(31,467,948), XSPR_MASK, PPC405, { RT } }, +{ "mtiac4", XSPR(31,467,949), XSPR_MASK, PPC405, { RT } }, +{ "mtdvc1", XSPR(31,467,950), XSPR_MASK, PPC405, { RT } }, +{ "mtdvc2", XSPR(31,467,951), XSPR_MASK, PPC405, { RT } }, +{ "mtmmcr0", XSPR(31,467,952), XSPR_MASK, PPC750, { RT } }, +{ "mtsgr", XSPR(31,467,953), XSPR_MASK, PPC403, { RT } }, +{ "mtpmc1", XSPR(31,467,953), XSPR_MASK, PPC750, { RT } }, +{ "mtdcwr", XSPR(31,467,954), XSPR_MASK, PPC403, { RT } }, +{ "mtpmc2", XSPR(31,467,954), XSPR_MASK, PPC750, { RT } }, +{ "mtsler", XSPR(31,467,955), XSPR_MASK, PPC405, { RT } }, +{ "mtsia", XSPR(31,467,955), XSPR_MASK, PPC750, { RT } }, +{ "mtsu0r", XSPR(31,467,956), XSPR_MASK, PPC405, { RT } }, +{ "mtmmcr1", XSPR(31,467,956), XSPR_MASK, PPC750, { RT } }, +{ "mtdbcr1", XSPR(31,467,957), XSPR_MASK, PPC405, { RT } }, +{ "mtpmc3", XSPR(31,467,957), XSPR_MASK, PPC750, { RT } }, +{ "mtpmc4", XSPR(31,467,958), XSPR_MASK, PPC750, { RT } }, +{ "mticdbdr", XSPR(31,467,979), XSPR_MASK, PPC403, { RT } }, +{ "mtesr", XSPR(31,467,980), XSPR_MASK, PPC403, { RT } }, +{ "mtdear", XSPR(31,467,981), XSPR_MASK, PPC403, { RT } }, +{ "mtevpr", XSPR(31,467,982), XSPR_MASK, PPC403, { RT } }, +{ "mtcdbcr", XSPR(31,467,983), XSPR_MASK, PPC403, { RT } }, +{ "mttsr", XSPR(31,467,984), XSPR_MASK, PPC403, { RT } }, +{ "mttcr", XSPR(31,467,986), XSPR_MASK, PPC403, { RT } }, +{ "mtpit", XSPR(31,467,987), XSPR_MASK, PPC403, { RT } }, +{ "mttbhi", XSPR(31,467,988), XSPR_MASK, PPC403, { RT } }, +{ "mttblo", XSPR(31,467,989), XSPR_MASK, PPC403, { RT } }, +{ "mtsrr2", XSPR(31,467,990), XSPR_MASK, PPC403, { RT } }, +{ "mtsrr3", XSPR(31,467,991), XSPR_MASK, PPC403, { RT } }, +{ "mtdbsr", XSPR(31,467,1008), XSPR_MASK, PPC403, { RT } }, +{ "mtdbcr0", XSPR(31,467,1010), XSPR_MASK, PPC405, { RT } }, +{ "mtiac1", XSPR(31,467,1012), XSPR_MASK, PPC403, { RT } }, +{ "mtiac2", XSPR(31,467,1013), XSPR_MASK, PPC403, { RT } }, +{ "mtdac1", XSPR(31,467,1014), XSPR_MASK, PPC403, { RT } }, +{ "mtdac2", XSPR(31,467,1015), XSPR_MASK, PPC403, { RT } }, +{ "mtl2cr", XSPR(31,467,1017), XSPR_MASK, PPC750, { RT } }, +{ "mtdccr", XSPR(31,467,1018), XSPR_MASK, PPC403, { RT } }, +{ "mticcr", XSPR(31,467,1019), XSPR_MASK, PPC403, { RT } }, +{ "mtictc", XSPR(31,467,1019), XSPR_MASK, PPC750, { RT } }, +{ "mtpbl1", XSPR(31,467,1020), XSPR_MASK, PPC403, { RT } }, +{ "mtthrm1", XSPR(31,467,1020), XSPR_MASK, PPC750, { RT } }, +{ "mtpbu1", XSPR(31,467,1021), XSPR_MASK, PPC403, { RT } }, +{ "mtthrm2", XSPR(31,467,1021), XSPR_MASK, PPC750, { RT } }, +{ "mtpbl2", XSPR(31,467,1022), XSPR_MASK, PPC403, { RT } }, +{ "mtthrm3", XSPR(31,467,1022), XSPR_MASK, PPC750, { RT } }, +{ "mtpbu2", XSPR(31,467,1023), XSPR_MASK, PPC403, { RT } }, +{ "mtspr", X(31,467), X_MASK, COM, { SPR, RS } }, { "dcbi", X(31,470), XRT_MASK, PPC, { RA, RB } }, @@ -4028,7 +4127,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "divwo", XO(31,491,1,0), XO_MASK, PPC, { RT, RA, RB } }, { "divwo.", XO(31,491,1,1), XO_MASK, PPC, { RT, RA, RB } }, -{ "icbtlse", X(31,494), X_MASK, PPCCHLK, { CT, RA, RB }}, +{ "icbtlse", X(31,494), X_MASK, PPCCHLK64, { CT, RA, RB }}, { "slbia", X(31,498), 0xffffffff, PPC64, { 0 } }, @@ -4039,7 +4138,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "mcrxr", X(31,512), XRARB_MASK|(3<<21), COM, { BF } }, { "bblels", X(31,518), X_MASK, PPCBRLK, { 0 }}, -{ "mcrxr64", X(31,544), XRARB_MASK|(3<<21), BOOKE, { BF } }, +{ "mcrxr64", X(31,544), XRARB_MASK|(3<<21), BOOKE64, { BF } }, { "clcs", X(31,531), XRB_MASK, M601, { RT, RA } }, @@ -4152,7 +4251,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "stfduxe", X(31,767), X_MASK, BOOKE64, { FRS, RAS, RB } }, { "tlbivax", X(31,786), XRT_MASK, BOOKE, { RA, RB } }, -{ "tlbivaxe",X(31,787), XRT_MASK, BOOKE, { RA, RB } }, +{ "tlbivaxe",X(31,787), XRT_MASK, BOOKE64, { RA, RB } }, { "lhbrx", X(31,790), X_MASK, COM, { RT, RA, RB } }, @@ -4189,8 +4288,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "tlbsx", XRC(31,914,0), X_MASK, BOOKE, { RA, RB } }, { "tlbsx.", XRC(31,914,1), X_MASK, BOOKE, { RA, RB } }, -{ "tlbsxe", XRC(31,915,0), X_MASK, BOOKE, { RA, RB } }, -{ "tlbsxe.", XRC(31,915,1), X_MASK, BOOKE, { RA, RB } }, +{ "tlbsxe", XRC(31,915,0), X_MASK, BOOKE64, { RA, RB } }, +{ "tlbsxe.", XRC(31,915,1), X_MASK, BOOKE64, { RA, RB } }, { "slbmfee", X(31,915), XRA_MASK, PPC64, { RT, RB } }, @@ -4211,7 +4310,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "stdxe", X(31,927), X_MASK, BOOKE64, { RS, RA, RB } }, -{ "tlbre", X(31,946), X_MASK, BOOKE, { RT, RA, WS } }, +{ "tlbre", X(31,946), X_MASK, BOOKE, { 0 } }, { "tlbrehi", XTLB(31,946,0), XTLB_MASK, PPC403, { RT, RA } }, { "tlbrelo", XTLB(31,946,1), XTLB_MASK, PPC403, { RT, RA } }, @@ -4226,20 +4325,20 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "iccci", X(31,966), XRT_MASK, PPC403, { RA, RB } }, +{ "tlbwe", X(31,978), X_MASK, BOOKE, { 0 } }, + { "tlbld", X(31,978), XRTRA_MASK, PPC, { RB } }, { "tlbwehi", XTLB(31,978,0), XTLB_MASK, PPC403, { RT, RA } }, { "tlbwelo", XTLB(31,978,1), XTLB_MASK, PPC403, { RT, RA } }, { "tlbwe", X(31,978), X_MASK, PPC403, { RS, RA, SH } }, -{ "tlbwe", X(31,978), X_MASK, BOOKE, { RT, RA, WS } }, - { "icbi", X(31,982), XRT_MASK, PPC, { RA, RB } }, { "stfiwx", X(31,983), X_MASK, PPC, { FRS, RA, RB } }, -{ "extsw", XRC(31,986,0), XRB_MASK, PPC, { RA, RS } }, -{ "extsw.", XRC(31,986,1), XRB_MASK, PPC, { RA, RS } }, +{ "extsw", XRC(31,986,0), XRB_MASK, PPC64 | BOOKE64,{ RA, RS } }, +{ "extsw.", XRC(31,986,1), XRB_MASK, PPC64, { RA, RS } }, { "icread", X(31,998), XRT_MASK, PPC403, { RA, RB } }, @@ -4557,10 +4656,6 @@ const struct powerpc_macro powerpc_macros[] = { { "clrrwi.", 3, PPCCOM, "rlwinm. %0,%1,0,0,31-(%2)" }, { "clrlslwi",4, PPCCOM, "rlwinm %0,%1,%3,(%2)-(%3),31-(%3)" }, { "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" }, - -{ "mftbl", 1, BOOKE, "mfspr %0,tbl" }, -{ "mftbu", 1, BOOKE, "mfspr %0,tbu" }, -{ "mftb", 2, BOOKE, "mfspr %0,%1" }, }; const int powerpc_num_macros = diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c index eff4ebb8ff1..9eda876622d 100644 --- a/opcodes/tic4x-dis.c +++ b/opcodes/tic4x-dis.c @@ -49,8 +49,41 @@ indirect_t; static int c4x_version = 0; static int c4x_dp = 0; +static int c4x_pc_offset + PARAMS ((unsigned int)); +static int c4x_print_char + PARAMS ((struct disassemble_info *, char)); +static int c4x_print_str + PARAMS ((struct disassemble_info *, char *)); +static int c4x_print_register + PARAMS ((struct disassemble_info *, unsigned long)); +static int c4x_print_addr + PARAMS ((struct disassemble_info *, unsigned long)); +static int c4x_print_relative + PARAMS ((struct disassemble_info *, unsigned long, long, unsigned long)); +void c4x_print_ftoa + PARAMS ((unsigned int, FILE *, fprintf_ftype)); +static int c4x_print_direct + PARAMS ((struct disassemble_info *, unsigned long)); +static int c4x_print_immed + PARAMS ((struct disassemble_info *, immed_t, unsigned long)); +static int c4x_print_cond + PARAMS ((struct disassemble_info *, unsigned int)); +static int c4x_print_indirect + PARAMS ((struct disassemble_info *, indirect_t, unsigned long)); +static int c4x_print_op + PARAMS ((struct disassemble_info *, unsigned long, c4x_inst_t *, unsigned long)); +static void c4x_hash_opcode + PARAMS ((c4x_inst_t **, const c4x_inst_t *)); +static int c4x_disassemble + PARAMS ((unsigned long, unsigned long, struct disassemble_info *)); +int print_insn_tic4x + PARAMS ((bfd_vma, struct disassemble_info *)); + + static int -c4x_pc_offset (unsigned int op) +c4x_pc_offset (op) + unsigned int op; { /* Determine the PC offset for a C[34]x instruction. This could be simplified using some boolean algebra @@ -107,7 +140,9 @@ c4x_pc_offset (unsigned int op) } static int -c4x_print_char (struct disassemble_info * info, char ch) +c4x_print_char (info, ch) + struct disassemble_info * info; + char ch; { if (info != NULL) (*info->fprintf_func) (info->stream, "%c", ch); @@ -115,7 +150,9 @@ c4x_print_char (struct disassemble_info * info, char ch) } static int -c4x_print_str (struct disassemble_info *info, char *str) +c4x_print_str (info, str) + struct disassemble_info *info; + char *str; { if (info != NULL) (*info->fprintf_func) (info->stream, "%s", str); @@ -123,8 +160,9 @@ c4x_print_str (struct disassemble_info *info, char *str) } static int -c4x_print_register (struct disassemble_info *info, - unsigned long regno) +c4x_print_register (info, regno) + struct disassemble_info *info; + unsigned long regno; { static c4x_register_t **registertable = NULL; unsigned int i; @@ -151,8 +189,9 @@ c4x_print_register (struct disassemble_info *info, } static int -c4x_print_addr (struct disassemble_info *info, - unsigned long addr) +c4x_print_addr (info, addr) + struct disassemble_info *info; + unsigned long addr; { if (info != NULL) (*info->print_address_func)(addr, info); @@ -160,17 +199,19 @@ c4x_print_addr (struct disassemble_info *info, } static int -c4x_print_relative (struct disassemble_info *info, - unsigned long pc, - long offset, - unsigned long opcode) +c4x_print_relative (info, pc, offset, opcode) + struct disassemble_info *info; + unsigned long pc; + long offset; + unsigned long opcode; { return c4x_print_addr (info, pc + offset + c4x_pc_offset (opcode)); } static int -c4x_print_direct (struct disassemble_info *info, - unsigned long arg) +c4x_print_direct (info, arg) + struct disassemble_info *info; + unsigned long arg; { if (info != NULL) { @@ -183,9 +224,10 @@ c4x_print_direct (struct disassemble_info *info, /* FIXME: make the floating point stuff not rely on host floating point arithmetic. */ void -c4x_print_ftoa (unsigned int val, - FILE *stream, - int (*pfunc)()) +c4x_print_ftoa (val, stream, pfunc) + unsigned int val; + FILE *stream; + fprintf_ftype pfunc; { int e; int s; @@ -208,9 +250,10 @@ c4x_print_ftoa (unsigned int val, } static int -c4x_print_immed (struct disassemble_info *info, - immed_t type, - unsigned long arg) +c4x_print_immed (info, type, arg) + struct disassemble_info *info; + immed_t type; + unsigned long arg; { int s; int f; @@ -266,8 +309,9 @@ c4x_print_immed (struct disassemble_info *info, } static int -c4x_print_cond (struct disassemble_info *info, - unsigned int cond) +c4x_print_cond (info, cond) + struct disassemble_info *info; + unsigned int cond; { static c4x_cond_t **condtable = NULL; unsigned int i; @@ -286,9 +330,10 @@ c4x_print_cond (struct disassemble_info *info, } static int -c4x_print_indirect (struct disassemble_info *info, - indirect_t type, - unsigned long arg) +c4x_print_indirect (info, type, arg) + struct disassemble_info *info; + indirect_t type; + unsigned long arg; { unsigned int aregno; unsigned int modn; @@ -349,9 +394,11 @@ c4x_print_indirect (struct disassemble_info *info, } static int -c4x_print_op (struct disassemble_info *info, - unsigned long instruction, - c4x_inst_t *p, unsigned long pc) +c4x_print_op (info, instruction, p, pc) + struct disassemble_info *info; + unsigned long instruction; + c4x_inst_t *p; + unsigned long pc; { int val; char *s; @@ -578,8 +625,9 @@ c4x_print_op (struct disassemble_info *info, } static void -c4x_hash_opcode (c4x_inst_t **optable, - const c4x_inst_t *inst) +c4x_hash_opcode (optable, inst) + c4x_inst_t **optable; + const c4x_inst_t *inst; { int j; int opcode = inst->opcode >> (32 - C4X_HASH_SIZE); @@ -609,9 +657,10 @@ c4x_hash_opcode (c4x_inst_t **optable, The function returns the length of this instruction in words. */ static int -c4x_disassemble (unsigned long pc, - unsigned long instruction, - struct disassemble_info *info) +c4x_disassemble (pc, instruction, info) + unsigned long pc; + unsigned long instruction; + struct disassemble_info *info; { static c4x_inst_t **optable = NULL; c4x_inst_t *p; diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c index e72b1e8d2e1..dbd43aac76e 100644 --- a/opcodes/v850-dis.c +++ b/opcodes/v850-dis.c @@ -77,10 +77,6 @@ disassemble (memaddr, info, insn) case bfd_mach_v850e: target_processor = PROCESSOR_V850E; break; - - case bfd_mach_v850ea: - target_processor = PROCESSOR_V850EA; - break; } /* Find the opcode. */ diff --git a/opcodes/v850-opc.c b/opcodes/v850-opc.c index 43ce2f15fc2..94969ac48f2 100644 --- a/opcodes/v850-opc.c +++ b/opcodes/v850-opc.c @@ -608,17 +608,13 @@ const struct v850_opcode v850_opcodes[] = { "jmp", one (0x0060), one (0xffe0), {R1}, 1, PROCESSOR_ALL }, /* load/store instructions */ -{ "sld.bu", one (0x0300), one (0x0780), {D7, EP, R2_NOTR0}, 1, PROCESSOR_V850EA }, { "sld.bu", one (0x0060), one (0x07f0), {D4, EP, R2_NOTR0}, 1, PROCESSOR_V850E }, -{ "sld.hu", one (0x0400), one (0x0780), {D8_7, EP, R2_NOTR0}, 1, PROCESSOR_V850EA }, { "sld.hu", one (0x0070), one (0x07f0), {D5_4, EP, R2_NOTR0}, 1, PROCESSOR_V850E }, -{ "sld.b", one (0x0060), one (0x07f0), {D4, EP, R2}, 1, PROCESSOR_V850EA }, { "sld.b", one (0x0300), one (0x0780), {D7, EP, R2}, 1, PROCESSOR_V850E }, { "sld.b", one (0x0300), one (0x0780), {D7, EP, R2}, 1, PROCESSOR_V850 }, -{ "sld.h", one (0x0070), one (0x07f0), {D5_4, EP, R2}, 1, PROCESSOR_V850EA }, { "sld.h", one (0x0400), one (0x0780), {D8_7, EP, R2}, 1, PROCESSOR_V850E }, { "sld.h", one (0x0400), one (0x0780), {D8_7, EP, R2}, 1, PROCESSOR_V850 }, { "sld.w", one (0x0500), one (0x0781), {D8_6, EP, R2}, 1, PROCESSOR_ALL }, @@ -626,10 +622,6 @@ const struct v850_opcode v850_opcodes[] = { "sst.h", one (0x0480), one (0x0780), {R2, D8_7, EP}, 2, PROCESSOR_ALL }, { "sst.w", one (0x0501), one (0x0781), {R2, D8_6, EP}, 2, PROCESSOR_ALL }, -{ "pushml", two (0x07e0, 0x0001), two (0xfff0, 0x0007), {LIST18_L}, 0, PROCESSOR_V850EA }, -{ "pushmh", two (0x07e0, 0x0003), two (0xfff0, 0x0007), {LIST18_H}, 0, PROCESSOR_V850EA }, -{ "popml", two (0x07f0, 0x0001), two (0xfff0, 0x0007), {LIST18_L}, 0, PROCESSOR_V850EA }, -{ "popmh", two (0x07f0, 0x0003), two (0xfff0, 0x0007), {LIST18_H}, 0, PROCESSOR_V850EA }, { "prepare", two (0x0780, 0x0003), two (0xffc0, 0x001f), {LIST12, IMM5, SP}, 0, PROCESSOR_NOT_V850 }, { "prepare", two (0x0780, 0x000b), two (0xffc0, 0x001f), {LIST12, IMM5, IMM16}, 0, PROCESSOR_NOT_V850 }, { "prepare", two (0x0780, 0x0013), two (0xffc0, 0x001f), {LIST12, IMM5, IMM16}, 0, PROCESSOR_NOT_V850 }, @@ -677,15 +669,6 @@ const struct v850_opcode v850_opcodes[] = { "divh", two (0x07e0, 0x0280), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, { "divh", OP (0x02), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "divhn", two (0x07e0, 0x0280), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "divhun", two (0x07e0, 0x0282), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "divn", two (0x07e0, 0x02c0), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "divun", two (0x07e0, 0x02c2), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivhn", two (0x07e0, 0x0180), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivhun", two (0x07e0, 0x0182), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivn", two (0x07e0, 0x01c0), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivun", two (0x07e0, 0x01c2), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, - { "nop", one (0x00), one (0xffff), {0}, 0, PROCESSOR_ALL }, { "mov", OP (0x10), OP_MASK, {I5, R2_NOTR0}, 0, PROCESSOR_ALL }, { "mov", one (0x0620), one (0xffe0), {IMM32, R1_NOTR0}, 0, PROCESSOR_NOT_V850 }, diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 9ce404ed6bd..a3973301715 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,9 @@ +2002-09-27 Andrew Cagney <ac131313@redhat.com> + + * wrapper.c (sim_open): Add support for -m<mem-size>. + (mem_size): Reduce to 2MB. + Fix PR gdb/433. + 2002-08-15 Nick Clifton <nickc@redhat.com> * armos.c (ARMul_OSHandleSWI): Catch and ignore SWIs of -1, they diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index c8361ba9fae..262e2e7edea 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -49,7 +49,7 @@ static SIM_OPEN_KIND sim_kind; static char *myname; /* Memory size in bytes. */ -static int mem_size = (1 << 23); +static int mem_size = (1 << 21); /* Non-zero to display start up banner, and maybe other things. */ static int verbosity; @@ -632,7 +632,7 @@ sim_open (kind, ptr, abfd, argv) { int i; - /* Scan for endian-ness switch. */ + /* Scan for endian-ness and memory-size switches. */ for (i = 0; (argv[i] != NULL) && (argv[i][0] != 0); i++) if (argv[i][0] == '-' && argv[i][1] == 'E') { @@ -667,6 +667,23 @@ sim_open (kind, ptr, abfd, argv) break; } } + else if (argv[i][0] == '-' && argv[i][1] == 'm') + { + if (argv[i][2] != '\0') + sim_size (atoi (&argv[i][2])); + else if (argv[i + 1] != NULL) + { + sim_size (atoi (argv[i + 1])); + i++; + } + else + { + sim_callback->printf_filtered (sim_callback, + "Missing argument to -m option\n"); + return NULL; + } + + } } return (SIM_DESC) 1; diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 4c2dfef8181..26d04311625 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,8 @@ +2002-09-27 Andrew Cagney <ac131313@redhat.com> + + * hw_disk.c (hw_disk_init_address): Set device type to "block", + not "disk". + 2002-06-22 Andrew Cagney <ac131313@redhat.com> * Makefile.in (INTL_SRC): Define. diff --git a/sim/ppc/hw_disk.c b/sim/ppc/hw_disk.c index 84086ff1d4a..0e9573bda6e 100644 --- a/sim/ppc/hw_disk.c +++ b/sim/ppc/hw_disk.c @@ -233,7 +233,7 @@ hw_disk_init_address(device *me) me); /* Tell the world we are a disk. */ - device_add_string_property(me, "device_type", "disk"); + device_add_string_property(me, "device_type", "block"); /* get the name of the file specifying the disk image */ disk->name_index = 0; diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog index c8b3aabdc4a..2053096ece5 100644 --- a/sim/v850/ChangeLog +++ b/sim/v850/ChangeLog @@ -1,3 +1,21 @@ +2002-09-27 Jim Wilson <wilson@redhat.com> + + * simops.c (OP_E6077E0): And op1 with 7 after reading register, not + before. + (BIT_CHANGE_OP): Likewise. + +2002-09-26 Jim Wilson <wilson@redhat.com> + + * simops (OP_10007E0): Don't subtract 4 from PC. + +2002-09-19 Nick Clifton <nickc@redhat.com> + + * interp.c (sim_open): Remove reference to v850ea. + (sim_create_inferior): Likewise. + * v850-dc: Likewise. + * v850.igen: Remove all references to v850ea, including v850ea + specific instructions. + 2002-08-29 Nick Clifton <nickc@redhat.com> From 2001-08-23 Catherine Moore <clm@redhat.com> diff --git a/sim/v850/interp.c b/sim/v850/interp.c index 0ce5e3aa905..85b17959343 100644 --- a/sim/v850/interp.c +++ b/sim/v850/interp.c @@ -280,12 +280,6 @@ sim_open (kind, cb, abfd, argv) STATE_CPU (sd, 0)->psw_mask = (PSW_NP | PSW_EP | PSW_ID | PSW_SAT | PSW_CY | PSW_OV | PSW_S | PSW_Z); break; - case bfd_mach_v850ea: - PSW |= PSW_US; - STATE_CPU (sd, 0)->psw_mask = (PSW_US - | PSW_NP | PSW_EP | PSW_ID | PSW_SAT - | PSW_CY | PSW_OV | PSW_S | PSW_Z); - break; } return sd; @@ -310,11 +304,6 @@ sim_create_inferior (sd, prog_bfd, argv, env) memset (&State, 0, sizeof (State)); if (prog_bfd != NULL) PC = bfd_get_start_address (prog_bfd); - /* For v850ea, set PSW[US] by default */ - if (STATE_ARCHITECTURE (sd) != NULL - && STATE_ARCHITECTURE (sd)->arch == bfd_arch_v850 - && STATE_ARCHITECTURE (sd)->mach == bfd_mach_v850ea) - PSW |= PSW_US; return SIM_RC_OK; } diff --git a/sim/v850/simops.c b/sim/v850/simops.c index d8a4d58ae11..04045234629 100644 --- a/sim/v850/simops.c +++ b/sim/v850/simops.c @@ -1880,7 +1880,7 @@ OP_10007E0 () ECR |= 0x40 + OP[0]; /* Flag that we are now doing exception processing. */ PSW |= PSW_EP | PSW_ID; - PC = ((OP[0] < 0x10) ? 0x40 : 0x50) - 4; + PC = (OP[0] < 0x10) ? 0x40 : 0x50; return 0; } @@ -1897,7 +1897,7 @@ OP_E607E0 (void) temp = load_mem (State.regs[ OP[0] ], 1); PSW &= ~PSW_Z; - if ((temp & (1 << State.regs[ OP[1] & 0x7 ])) == 0) + if ((temp & (1 << (State.regs[ OP[1] ] & 0x7))) == 0) PSW |= PSW_Z; trace_output (OP_BIT); @@ -1924,7 +1924,7 @@ OP_22207E0 (void) \ trace_input (name, OP_BIT_CHANGE, 0); \ \ - bit = 1 << State.regs[ OP[1] & 0x7 ]; \ + bit = 1 << (State.regs[ OP[1] ] & 0x7); \ temp = load_mem (State.regs[ OP[0] ], 1); \ \ PSW &= ~PSW_Z; \ diff --git a/sim/v850/v850-dc b/sim/v850/v850-dc index 997a3750f11..1d061ecc570 100644 --- a/sim/v850/v850-dc +++ b/sim/v850/v850-dc @@ -11,7 +11,6 @@ switch,combine : 4 : 0 : : : : 1 : V,VII : switch,combine : 4 : 0 : : : : 1 : V,XIII : v850e - switch,combine : 4 : 0 : : : : 1 : V,XIII : v850ea # for opcode 63, 127, 1087 et.al. @@ -23,7 +22,6 @@ # for opcode 40 et.al. switch,combine : 4 : 0 : : : : 0 : III,IV : - switch,combine : 4 : 0 : : : : 0 : III,IV,XIV : v850ea # for opcode 66 - divh/break diff --git a/sim/v850/v850.igen b/sim/v850/v850.igen index 34fa43f2648..0a4c08a30f0 100644 --- a/sim/v850/v850.igen +++ b/sim/v850/v850.igen @@ -13,11 +13,6 @@ :option:::multi-sim:true :model:::v850e:v850e: -:option:::multi-sim:true -:model:::v850ea:v850ea: - - - // Cache macros :cache:::unsigned:reg1:RRRRR:(RRRRR) @@ -161,7 +156,6 @@ ddddd,1011,ddd,cccc:III:::Bcond // BSH rrrrr,11111100000 + wwwww,01101000010:XII:::bsh *v850e -*v850ea "bsh r<reg2>, r<reg3>" { unsigned32 value; @@ -184,7 +178,6 @@ rrrrr,11111100000 + wwwww,01101000010:XII:::bsh // BSW rrrrr,11111100000 + wwwww,01101000000:XII:::bsw *v850e -*v850ea "bsw r<reg2>, r<reg3>" { #define WORDHASNULLBYTE(x) (((x) - 0x01010101) & ~(x)&0x80808080) @@ -210,7 +203,6 @@ rrrrr,11111100000 + wwwww,01101000000:XII:::bsw // CALLT 0000001000,iiiiii:II:::callt *v850e -*v850ea "callt <imm6>" { unsigned32 adr; @@ -233,7 +225,6 @@ rrrrr,11111100000 + wwwww,01101000000:XII:::bsw rrrrr,111111,RRRRR + 0000000011100100:IX:::clr1 *v850e -*v850ea "clr1 r<reg2>, [r<reg1>]" { COMPAT_2 (OP_E407E0 ()); @@ -243,7 +234,6 @@ rrrrr,111111,RRRRR + 0000000011100100:IX:::clr1 // CTRET 0000011111100000 + 0000000101000100:X:::ctret *v850e -*v850ea "ctret" { nia = (CTPC & ~1); @@ -254,7 +244,6 @@ rrrrr,111111,RRRRR + 0000000011100100:IX:::clr1 // CMOV rrrrr,111111,RRRRR + wwwww,011001,cccc,0:XI:::cmov *v850e -*v850ea "cmov %s<cccc>, r<reg1>, r<reg2>, r<reg3>" { int cond = condition_met (cccc); @@ -265,7 +254,6 @@ rrrrr,111111,RRRRR + wwwww,011001,cccc,0:XI:::cmov rrrrr,111111,iiiii + wwwww,011000,cccc,0:XII:::cmov *v850e -*v850ea "cmov %s<cccc>, <imm5>, r<reg2>, r<reg3>" { int cond = condition_met (cccc); @@ -303,7 +291,6 @@ rrrrr,010011,iiiii:II:::cmp // "dispose <imm5>, <list12>" 0000011001,iiiii,L + LLLLLLLLLLL,RRRRR:XIII:::dispose *v850e -*v850ea "dispose <imm5>, <list12>":RRRRR == 0 "dispose <imm5>, <list12>, [reg1]" { @@ -395,7 +382,6 @@ rrrrr,111111,RRRRR + wwwww,01011000010:XI:::divu // HSW rrrrr,11111100000 + wwwww,01101000100:XII:::hsw *v850e -*v850ea "hsw r<reg2>, r<reg3>" { unsigned32 value; @@ -470,7 +456,6 @@ rrrrr,111001,RRRRR + ddddddddddddddd,1:VII:::ld.w rrrrr!0,11110,b,RRRRR + ddddddddddddddd,1:VII:::ld.bu *v850e -*v850ea "ld.bu <disp16>[r<reg1>], r<reg2>" { COMPAT_2 (OP_10780 ()); @@ -478,7 +463,6 @@ rrrrr!0,11110,b,RRRRR + ddddddddddddddd,1:VII:::ld.bu rrrrr!0,111111,RRRRR + ddddddddddddddd,1:VII:::ld.hu *v850e -*v850ea "ld.hu <disp16>[r<reg1>], r<reg2>" { COMPAT_2 (OP_107E0 ()); @@ -519,7 +503,6 @@ rrrrr!0,010000,iiiii:II:::mov 00000110001,RRRRR + iiiiiiiiiiiiiiii + IIIIIIIIIIIIIIII:VI:::mov *v850e -*v850ea "mov <imm32>, r<reg1>" { SAVE_2; @@ -553,7 +536,6 @@ rrrrr!0,110010,RRRRR + iiiiiiiiiiiiiiii:VI:::movhi // MUL rrrrr,111111,RRRRR + wwwww,01000100000:XI:::mul *v850e -*v850ea "mul r<reg1>, r<reg2>, r<reg3>" { COMPAT_2 (OP_22007E0 ()); @@ -561,7 +543,6 @@ rrrrr,111111,RRRRR + wwwww,01000100000:XI:::mul rrrrr,111111,iiiii + wwwww,01001,IIII,00:XII:::mul *v850e -*v850ea "mul <imm9>, r<reg2>, r<reg3>" { COMPAT_2 (OP_24007E0 ()); @@ -595,7 +576,6 @@ rrrrr!0,110111,RRRRR + iiiiiiiiiiiiiiii:VI:::mulhi // MULU rrrrr,111111,RRRRR + wwwww,01000100010:XI:::mulu *v850e -*v850ea "mulu r<reg1>, r<reg2>, r<reg3>" { COMPAT_2 (OP_22207E0 ()); @@ -603,7 +583,6 @@ rrrrr,111111,RRRRR + wwwww,01000100010:XI:::mulu rrrrr,111111,iiiii + wwwww,01001,IIII,10:XII:::mulu *v850e -*v850ea "mulu <imm9>, r<reg2>, r<reg3>" { COMPAT_2 (OP_24207E0 ()); @@ -638,7 +617,6 @@ rrrrr,000001,RRRRR:I:::not rrrrr,111111,RRRRR + 0000000011100010:IX:::not1 *v850e -*v850ea "not1 r<reg2>, r<reg1>" { COMPAT_2 (OP_E207E0 ()); @@ -667,7 +645,6 @@ rrrrr,110100,RRRRR + iiiiiiiiiiiiiiii:VI:::ori // PREPARE 0000011110,iiiii,L + LLLLLLLLLLL,00001:XIII:::prepare *v850e -*v850ea "prepare <list12>, <imm5>" { int i; @@ -692,7 +669,6 @@ rrrrr,110100,RRRRR + iiiiiiiiiiiiiiii:VI:::ori 0000011110,iiiii,L + LLLLLLLLLLL,00011:XIII:::prepare00 *v850e -*v850ea "prepare <list12>, <imm5>, sp" { COMPAT_2 (OP_30780 ()); @@ -700,7 +676,6 @@ rrrrr,110100,RRRRR + iiiiiiiiiiiiiiii:VI:::ori 0000011110,iiiii,L + LLLLLLLLLLL,01011 + iiiiiiiiiiiiiiii:XIII:::prepare01 *v850e -*v850ea "prepare <list12>, <imm5>, <uimm16>" { COMPAT_2 (OP_B0780 ()); @@ -708,7 +683,6 @@ rrrrr,110100,RRRRR + iiiiiiiiiiiiiiii:VI:::ori 0000011110,iiiii,L + LLLLLLLLLLL,10011 + iiiiiiiiiiiiiiii:XIII:::prepare10 *v850e -*v850ea "prepare <list12>, <imm5>, <uimm16>" { COMPAT_2 (OP_130780 ()); @@ -716,7 +690,6 @@ rrrrr,110100,RRRRR + iiiiiiiiiiiiiiii:VI:::ori 0000011110,iiiii,L + LLLLLLLLLLL,11011 + iiiiiiiiiiiiiiii + dddddddddddddddd:XIII:::prepare11 *v850e -*v850ea "prepare <list12>, <imm5>, <uimm32>" { COMPAT_2 (OP_1B0780 ()); @@ -766,7 +739,6 @@ rrrrr,010101,iiiii:II:::sar // SASF rrrrr,1111110,cccc + 0000001000000000:IX:::sasf *v850e -*v850ea "sasf %s<cccc>, r<reg2>" { COMPAT_2 (OP_20007E0 ()); @@ -835,7 +807,6 @@ rrrrr,1111110,cccc + 0000000000000000:IX:::setf rrrrr,111111,RRRRR + 0000000011100000:IX:::set1 *v850e -*v850ea "set1 r<reg2>, [r<reg1>]" { COMPAT_2 (OP_E007E0 ()); @@ -923,7 +894,6 @@ rrrrr,1010,dddddd,0:IV:::sld.w rrrrr!0,0000110,dddd:IV:::sld.bu *v850e -*v850ea "sld.b <disp4>[ep], r<reg2>":(PSW & PSW_US) "sld.bu <disp4>[ep], r<reg2>" { @@ -944,7 +914,6 @@ rrrrr!0,0000110,dddd:IV:::sld.bu rrrrr!0,0000111,dddd:IV:::sld.hu *v850e -*v850ea "sld.h <disp5>[ep], r<reg2>":(PSW & PSW_US) "sld.hu <disp5>[ep], r<reg2>" { @@ -963,7 +932,6 @@ rrrrr!0,0000111,dddd:IV:::sld.hu } } - // SST rrrrr,0111,ddddddd:IV:::sst.b "sst.b r<reg2>, <disp7>[ep]" @@ -983,8 +951,6 @@ rrrrr,1010,dddddd,1:IV:::sst.w COMPAT_1 (OP_501 ()); } - - // ST rrrrr,111010,RRRRR + dddddddddddddddd:VII:::st.b "st.b r<reg2>, <disp16>[r<reg1>]" @@ -1004,8 +970,6 @@ rrrrr,111011,RRRRR + ddddddddddddddd,1:VII:::st.w COMPAT_2 (OP_10760 ()); } - - // STSR rrrrr,111111,regID + 0000000001000000:IX:::stsr "stsr s<regID>, r<reg2>" @@ -1015,8 +979,6 @@ rrrrr,111111,regID + 0000000001000000:IX:::stsr TRACE_ALU_RESULT (GR[reg2]); } - - // SUB rrrrr,001101,RRRRR:I:::sub "sub r<reg1>, r<reg2>" @@ -1024,8 +986,6 @@ rrrrr,001101,RRRRR:I:::sub COMPAT_1 (OP_1A0 ()); } - - // SUBR rrrrr,001100,RRRRR:I:::subr "subr r<reg1>, r<reg2>" @@ -1033,12 +993,9 @@ rrrrr,001100,RRRRR:I:::subr COMPAT_1 (OP_180 ()); } - - // SWITCH 00000000010,RRRRR:I:::switch *v850e -*v850ea "switch r<reg1>" { unsigned long adr; @@ -1049,11 +1006,9 @@ rrrrr,001100,RRRRR:I:::subr trace_output (OP_REG); } - // SXB 00000000101,RRRRR:I:::sxb *v850e -*v850ea "sxb r<reg1>" { TRACE_ALU_INPUT1 (GR[reg1]); @@ -1064,7 +1019,6 @@ rrrrr,001100,RRRRR:I:::subr // SXH 00000000111,RRRRR:I:::sxh *v850e -*v850ea "sxh r<reg1>" { TRACE_ALU_INPUT1 (GR[reg1]); @@ -1072,8 +1026,6 @@ rrrrr,001100,RRRRR:I:::subr TRACE_ALU_RESULT (GR[reg1]); } - - // TRAP 00000111111,iiiii + 0000000100000000:X:::trap "trap <vector>" @@ -1081,8 +1033,6 @@ rrrrr,001100,RRRRR:I:::subr COMPAT_2 (OP_10007E0 ()); } - - // TST rrrrr,001011,RRRRR:I:::tst "tst r<reg1>, r<reg2>" @@ -1090,8 +1040,6 @@ rrrrr,001011,RRRRR:I:::tst COMPAT_1 (OP_160 ()); } - - // TST1 11,bbb,111110,RRRRR + dddddddddddddddd:VIII:::tst1 "tst1 <bit3>, <disp16>[r<reg1>]" @@ -1101,14 +1049,11 @@ rrrrr,001011,RRRRR:I:::tst rrrrr,111111,RRRRR + 0000000011100110:IX:::tst1 *v850e -*v850ea "tst1 r<reg2>, [r<reg1>]" { COMPAT_2 (OP_E607E0 ()); } - - // XOR rrrrr,001001,RRRRR:I:::xor "xor r<reg1>, r<reg2>" @@ -1116,8 +1061,6 @@ rrrrr,001001,RRRRR:I:::xor COMPAT_1 (OP_120 ()); } - - // XORI rrrrr,110101,RRRRR + iiiiiiiiiiiiiiii:VI:::xori "xori <uimm16>, r<reg1>, r<reg2>" @@ -1125,12 +1068,9 @@ rrrrr,110101,RRRRR + iiiiiiiiiiiiiiii:VI:::xori COMPAT_2 (OP_6A0 ()); } - - // ZXB 00000000100,RRRRR:I:::zxb *v850e -*v850ea "zxb r<reg1>" { TRACE_ALU_INPUT1 (GR[reg1]); @@ -1141,7 +1081,6 @@ rrrrr,110101,RRRRR + iiiiiiiiiiiiiiii:VI:::xori // ZXH 00000000110,RRRRR:I:::zxh *v850e -*v850ea "zxh r<reg1>" { TRACE_ALU_INPUT1 (GR[reg1]); @@ -1149,7 +1088,6 @@ rrrrr,110101,RRRRR + iiiiiiiiiiiiiiii:VI:::xori TRACE_ALU_RESULT (GR[reg1]); } - // Right field must be zero so that it doesn't clash with DIVH // Left field must be non-zero so that it doesn't clash with SWITCH 11111,000010,00000:I:::break @@ -1157,262 +1095,8 @@ rrrrr,110101,RRRRR + iiiiiiiiiiiiiiii:VI:::xori sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP); } - // New breakpoint: 0x7E0 0x7E0 00000,111111,00000 + 00000,11111,100000:X:::ilgop { sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP); } - -// DIVHN -rrrrr,111111,RRRRR + wwwww,01010,iiii,00:XI:::divhn -*v850ea -"divhn <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - signed32 quotient; - signed32 remainder; - signed32 divide_by; - signed32 divide_this; - boolean overflow = false; - SAVE_2; - - trace_input ("divhn", OP_IMM_REG_REG_REG, 0); - - divide_by = EXTEND16 (State.regs[ reg1 ]); - divide_this = State.regs[ reg2 ]; - - divn (imm5, divide_by, divide_this, & quotient, & remainder, & overflow); - - State.regs[ reg2 ] = quotient; - State.regs[ reg3 ] = remainder; - - /* Set condition codes. */ - PSW &= ~(PSW_Z | PSW_S | PSW_OV); - - if (overflow) PSW |= PSW_OV; - if (quotient == 0) PSW |= PSW_Z; - if (quotient < 0) PSW |= PSW_S; - - trace_output (OP_IMM_REG_REG_REG); -} - - - -// DIVHUN -rrrrr,111111,RRRRR + wwwww,01010,iiii,10:XI:::divhun -*v850ea -"divhun <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - signed32 quotient; - signed32 remainder; - signed32 divide_by; - signed32 divide_this; - boolean overflow = false; - SAVE_2; - - trace_input ("divhun", OP_IMM_REG_REG_REG, 0); - - divide_by = State.regs[ reg1 ] & 0xffff; - divide_this = State.regs[ reg2 ]; - - divun (imm5, divide_by, divide_this, & quotient, & remainder, & overflow); - - State.regs[ reg2 ] = quotient; - State.regs[ reg3 ] = remainder; - - /* Set condition codes. */ - PSW &= ~(PSW_Z | PSW_S | PSW_OV); - - if (overflow) PSW |= PSW_OV; - if (quotient == 0) PSW |= PSW_Z; - if (quotient & 0x80000000) PSW |= PSW_S; - - trace_output (OP_IMM_REG_REG_REG); -} - - - -// DIVN -rrrrr,111111,RRRRR + wwwww,01011,iiii,00:XI:::divn -*v850ea -"divn <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - signed32 quotient; - signed32 remainder; - signed32 divide_by; - signed32 divide_this; - boolean overflow = false; - SAVE_2; - - trace_input ("divn", OP_IMM_REG_REG_REG, 0); - - divide_by = State.regs[ reg1 ]; - divide_this = State.regs[ reg2 ]; - - divn (imm5, divide_by, divide_this, & quotient, & remainder, & overflow); - - State.regs[ reg2 ] = quotient; - State.regs[ reg3 ] = remainder; - - /* Set condition codes. */ - PSW &= ~(PSW_Z | PSW_S | PSW_OV); - - if (overflow) PSW |= PSW_OV; - if (quotient == 0) PSW |= PSW_Z; - if (quotient < 0) PSW |= PSW_S; - - trace_output (OP_IMM_REG_REG_REG); -} - - - -// DIVUN -rrrrr,111111,RRRRR + wwwww,01011,iiii,10:XI:::divun -*v850ea -"divun <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - signed32 quotient; - signed32 remainder; - signed32 divide_by; - signed32 divide_this; - boolean overflow = false; - SAVE_2; - - trace_input ("divun", OP_IMM_REG_REG_REG, 0); - - divide_by = State.regs[ reg1 ]; - divide_this = State.regs[ reg2 ]; - - divun (imm5, divide_by, divide_this, & quotient, & remainder, & overflow); - - State.regs[ reg2 ] = quotient; - State.regs[ reg3 ] = remainder; - - /* Set condition codes. */ - PSW &= ~(PSW_Z | PSW_S | PSW_OV); - - if (overflow) PSW |= PSW_OV; - if (quotient == 0) PSW |= PSW_Z; - if (quotient & 0x80000000) PSW |= PSW_S; - - trace_output (OP_IMM_REG_REG_REG); -} - - - -// SDIVHN -rrrrr,111111,RRRRR + wwwww,00110,iiii,00:XI:::sdivhn -*v850ea -"sdivhn <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - COMPAT_2 (OP_18007E0 ()); -} - - - -// SDIVHUN -rrrrr,111111,RRRRR + wwwww,00110,iiii,10:XI:::sdivhun -*v850ea -"sdivhun <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - COMPAT_2 (OP_18207E0 ()); -} - - - -// SDIVN -rrrrr,111111,RRRRR + wwwww,00111,iiii,00:XI:::sdivn -*v850ea -"sdivn <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - COMPAT_2 (OP_1C007E0 ()); -} - - - -// SDIVUN -rrrrr,111111,RRRRR + wwwww,00111,iiii,10:XI:::sdivun -*v850ea -"sdivun <imm5>, r<reg1>, r<reg2>, r<reg3>" -{ - COMPAT_2 (OP_1C207E0 ()); -} - - - -// PUSHML -000001111110,LLLL + LLLLLLLLLLLL,S,001:XIV:::pushml -*v850ea -"pushml <list18>" -{ - int i; - SAVE_2; - - trace_input ("pushml", OP_PUSHPOP3, 0); - - /* Store the registers with lower number registers being placed at - higher addresses. */ - - for (i = 0; i < 15; i++) - if ((OP[3] & (1 << type3_regs[ i ]))) - { - SP -= 4; - store_mem (SP & ~ 3, 4, State.regs[ i + 1 ]); - } - - if (OP[3] & (1 << 3)) - { - SP -= 4; - - store_mem (SP & ~ 3, 4, PSW); - } - - if (OP[3] & (1 << 19)) - { - SP -= 8; - - if ((PSW & PSW_NP) && ((PSW & PSW_EP) == 0)) - { - store_mem ((SP + 4) & ~ 3, 4, FEPC); - store_mem ( SP & ~ 3, 4, FEPSW); - } - else - { - store_mem ((SP + 4) & ~ 3, 4, EIPC); - store_mem ( SP & ~ 3, 4, EIPSW); - } - } - - trace_output (OP_PUSHPOP2); -} - - - -// PUSHHML -000001111110,LLLL + LLLLLLLLLLLL,S,011:XIV:::pushmh -*v850ea -"pushhml <list18>" -{ - COMPAT_2 (OP_307E0 ()); -} - - - -// POPML -000001111111,LLLL + LLLLLLLLLLLL,S,001:XIV:::popml -*v850ea -"popml <list18>" -{ - COMPAT_2 (OP_107F0 ()); -} - - - -// POPMH -000001111111,LLLL + LLLLLLLLLLLL,S,011:XIV:::popmh -*v850ea -"popmh <list18>" -{ - COMPAT_2 (OP_307F0 ()); -} - |