From 0540f4547886519cdcf972d171961c0b6a33e02e Mon Sep 17 00:00:00 2001 From: nobody <> Date: Wed, 15 May 2002 21:19:22 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'cagney_regbuf-20020515-branch'. Sprout from jimb-macro-020506-branch 2002-05-06 21:00:22 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'jimb-' Cherrypick from master 2002-05-15 21:19:21 UTC Jim Blandy 'Add macro structures to GDB's symbol tables. Nobody puts anything': Makefile.in bfd/elf-m10200.c bfd/elf-m10300.c bfd/elf32-arm.h bfd/elf32-fr30.c bfd/elf32-hppa.c bfd/elf32-i370.c bfd/elf32-i386.c bfd/elf32-i860.c bfd/elf32-m32r.c bfd/elf32-m68k.c bfd/elf32-mcore.c bfd/elf32-openrisc.c bfd/elf32-ppc.c bfd/elf32-s390.c bfd/elf32-xstormy16.c bfd/elf64-ppc.c bfd/elf64-s390.c bfd/elf64-x86-64.c bfd/elfxx-ia64.c bfd/libxcoff.h gdb/ChangeLog gdb/MAINTAINERS gdb/Makefile.in gdb/NEWS gdb/TODO gdb/alphabsd-nat.c gdb/alphabsd-tdep.c gdb/alphabsd-tdep.h gdb/alphanbsd-tdep.c gdb/arch-utils.c gdb/arch-utils.h gdb/arm-linux-tdep.c gdb/arm-tdep.c gdb/arm-tdep.h gdb/ax-gdb.c gdb/buildsym.c gdb/buildsym.h gdb/builtin-regs.c gdb/c-typeprint.c gdb/config/alpha/fbsd.mt gdb/config/alpha/nbsd.mh gdb/config/alpha/nbsd.mt gdb/config/arm/nm-nbsd.h gdb/config/djgpp/fnchange.lst gdb/config/i386/fbsd.mh gdb/config/i386/go32.mh gdb/config/i386/i386gnu.mh gdb/config/i386/i386sol2.mh gdb/config/i386/i386v42mp.mh gdb/config/i386/linux.mh gdb/config/i386/nbsd.mh gdb/config/i386/nbsd.mt gdb/config/i386/nbsdelf.mh gdb/config/i386/nbsdelf.mt gdb/config/i386/obsd.mh gdb/config/i386/tm-nbsd.h gdb/config/i386/x86-64linux.mh gdb/config/m68k/nbsd.mh gdb/config/m88k/tm-m88k.h gdb/config/ns32k/nbsd.mh gdb/config/powerpc/nbsd.mh gdb/config/sh/nbsd.mh gdb/config/sh/nbsd.mt gdb/config/sh/nm-nbsd.h gdb/config/sh/tm-nbsd.h gdb/config/sh/tm-sh.h gdb/config/sparc/nbsd.mh gdb/config/sparc/nbsdelf.mh gdb/configure gdb/configure.host gdb/configure.in gdb/configure.tgt gdb/d10v-tdep.c gdb/dbxread.c gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/doc/stabs.texinfo gdb/dstread.c gdb/dwarf2cfi.c gdb/dwarf2read.c gdb/event-loop.c gdb/expprint.c gdb/findvar.c gdb/frame.c gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/gdbserver/mem-break.c gdb/gdbtypes.c gdb/gdbtypes.h gdb/gnu-v3-abi.c gdb/go32-nat.c gdb/gregset.h gdb/hpread.c gdb/i386-linux-nat.c gdb/i386-tdep.c gdb/i386-tdep.h gdb/i386bsd-nat.c gdb/i386gnu-nat.c gdb/i386nbsd-tdep.c gdb/i386v4-nat.c gdb/i387-tdep.c gdb/i387-tdep.h gdb/ia64-tdep.c gdb/jv-valprint.c gdb/language.c gdb/language.h gdb/linespec.c gdb/m88k-tdep.c gdb/macroexp.c gdb/macroexp.h gdb/macrotab.c gdb/macrotab.h gdb/mdebugread.c gdb/memattr.c gdb/mips-tdep.c gdb/nbsd-tdep.c gdb/nbsd-tdep.h gdb/objfiles.c gdb/objfiles.h gdb/p-lang.c gdb/printcmd.c gdb/regcache.c gdb/remote-rdi.c gdb/remote-rdp.c gdb/remote.c gdb/rs6000-tdep.c gdb/ser-tcp.c gdb/sh-tdep.c gdb/shnbsd-nat.c gdb/shnbsd-tdep.c gdb/shnbsd-tdep.h gdb/signals/signals.c gdb/solib-sunos.c gdb/solib-svr4.c gdb/solib.c gdb/solib.h gdb/stabsread.c gdb/symfile.c gdb/symmisc.c gdb/symtab.c gdb/symtab.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.asm/asm-source.exp gdb/testsuite/gdb.asm/v850.inc gdb/testsuite/gdb.base/a2-run.exp gdb/testsuite/gdb.base/break.exp gdb/testsuite/gdb.base/default.exp gdb/testsuite/gdb.base/ending-run.exp gdb/testsuite/gdb.base/long_long.exp gdb/testsuite/gdb.base/maint.exp gdb/testsuite/gdb.base/printcmds.exp gdb/testsuite/gdb.c++/annota2.exp gdb/testsuite/gdb.c++/method.exp gdb/testsuite/gdb.mi/mi-var-child.exp gdb/testsuite/gdb.mi/mi0-var-child.exp gdb/testsuite/lib/gdb.exp gdb/tracepoint.c gdb/valops.c gdb/value.h gdb/values.c gdb/version.in gdb/x86-64-linux-nat.c gdb/x86-64-tdep.c include/elf/ChangeLog include/elf/common.h include/gdb/ChangeLog include/gdb/signals.h include/gdb/sim-sh.h libiberty/configure libiberty/configure.in libiberty/getruntime.c libiberty/waitpid.c opcodes/cgen-dis.in opcodes/ppc-opc.c opcodes/vax-dis.c sim/arm/ChangeLog sim/arm/armos.c Cherrypick from master 2002-05-11 00:00:05 UTC Alan Modra 'daily update': ChangeLog bfd/ChangeLog bfd/coff-rs6000.c bfd/coff64-rs6000.c bfd/elf-bfd.h bfd/elflink.h bfd/elfxx-target.h bfd/version.h libiberty/ChangeLog opcodes/ChangeLog Delete: gdb/alphanbsd-nat.c gdb/config/avr/avr.mt gdb/i386nbsd-nat.c gdb/i387-nat.c gdb/i387-nat.h --- ChangeLog | 8 + Makefile.in | 4 +- bfd/ChangeLog | 78 +- bfd/coff-rs6000.c | 26 +- bfd/coff64-rs6000.c | 116 +- bfd/elf-bfd.h | 5 + bfd/elf-m10200.c | 26 +- bfd/elf-m10300.c | 24 +- bfd/elf32-arm.h | 14 +- bfd/elf32-fr30.c | 27 +- bfd/elf32-hppa.c | 14 +- bfd/elf32-i370.c | 32 +- bfd/elf32-i386.c | 110 +- bfd/elf32-i860.c | 28 +- bfd/elf32-m32r.c | 20 +- bfd/elf32-m68k.c | 24 +- bfd/elf32-mcore.c | 33 +- bfd/elf32-openrisc.c | 25 +- bfd/elf32-ppc.c | 81 +- bfd/elf32-s390.c | 27 +- bfd/elf32-xstormy16.c | 26 +- bfd/elf64-ppc.c | 35 +- bfd/elf64-s390.c | 27 +- bfd/elf64-x86-64.c | 27 +- bfd/elflink.h | 19 +- bfd/elfxx-ia64.c | 24 +- bfd/elfxx-target.h | 5 + bfd/libxcoff.h | 10 + bfd/version.h | 2 +- gdb/ChangeLog | 807 +++++++++- gdb/MAINTAINERS | 3 +- gdb/Makefile.in | 149 +- gdb/NEWS | 1 + gdb/TODO | 4 - gdb/alphabsd-nat.c | 94 +- gdb/alphabsd-tdep.c | 102 ++ gdb/alphabsd-tdep.h | 33 + gdb/alphanbsd-nat.c | 136 -- gdb/alphanbsd-tdep.c | 123 +- gdb/arch-utils.c | 34 +- gdb/arch-utils.h | 18 +- gdb/arm-linux-tdep.c | 8 +- gdb/arm-tdep.c | 282 ++-- gdb/arm-tdep.h | 4 + gdb/ax-gdb.c | 52 +- gdb/buildsym.c | 14 +- gdb/buildsym.h | 4 + gdb/builtin-regs.c | 2 +- gdb/c-typeprint.c | 12 +- gdb/config/alpha/fbsd.mt | 2 +- gdb/config/alpha/nbsd.mh | 2 +- gdb/config/alpha/nbsd.mt | 3 +- gdb/config/arm/nm-nbsd.h | 8 +- gdb/config/avr/avr.mt | 12 - gdb/config/djgpp/fnchange.lst | 2 + gdb/config/i386/fbsd.mh | 2 +- gdb/config/i386/go32.mh | 2 +- gdb/config/i386/i386gnu.mh | 2 +- gdb/config/i386/i386sol2.mh | 2 +- gdb/config/i386/i386v42mp.mh | 2 +- gdb/config/i386/linux.mh | 2 +- gdb/config/i386/nbsd.mh | 10 +- gdb/config/i386/nbsd.mt | 2 +- gdb/config/i386/nbsdelf.mh | 3 +- gdb/config/i386/nbsdelf.mt | 2 +- gdb/config/i386/obsd.mh | 2 +- gdb/config/i386/tm-nbsd.h | 4 +- gdb/config/i386/x86-64linux.mh | 2 +- gdb/config/m68k/nbsd.mh | 3 +- gdb/config/m88k/tm-m88k.h | 18 +- gdb/config/ns32k/nbsd.mh | 3 +- gdb/config/powerpc/nbsd.mh | 3 +- gdb/config/sh/nbsd.mh | 4 + gdb/config/sh/nbsd.mt | 6 + gdb/config/sh/nm-nbsd.h | 28 + gdb/config/sh/tm-nbsd.h | 28 + gdb/config/sh/tm-sh.h | 47 +- gdb/config/sparc/nbsd.mh | 3 +- gdb/config/sparc/nbsdelf.mh | 3 +- gdb/configure | 804 +++++----- gdb/configure.host | 3 + gdb/configure.in | 3 +- gdb/configure.tgt | 6 +- gdb/d10v-tdep.c | 6 +- gdb/dbxread.c | 19 +- gdb/doc/ChangeLog | 29 + gdb/doc/gdb.texinfo | 20 +- gdb/doc/gdbint.texinfo | 145 +- gdb/doc/stabs.texinfo | 6 + gdb/dstread.c | 19 +- gdb/dwarf2cfi.c | 41 +- gdb/dwarf2read.c | 9 +- gdb/event-loop.c | 73 +- gdb/expprint.c | 2 +- gdb/findvar.c | 15 +- gdb/frame.c | 11 +- gdb/gdbarch.c | 204 ++- gdb/gdbarch.h | 79 +- gdb/gdbarch.sh | 64 +- gdb/gdbserver/mem-break.c | 2 +- gdb/gdbtypes.c | 348 ++-- gdb/gdbtypes.h | 481 +++--- gdb/gnu-v3-abi.c | 15 +- gdb/go32-nat.c | 2 +- gdb/gregset.h | 2 +- gdb/hpread.c | 54 +- gdb/i386-linux-nat.c | 2 +- gdb/i386-tdep.c | 282 +++- gdb/i386-tdep.h | 24 +- gdb/i386bsd-nat.c | 2 +- gdb/i386gnu-nat.c | 2 +- gdb/i386nbsd-nat.c | 132 -- gdb/i386nbsd-tdep.c | 127 +- gdb/i386v4-nat.c | 2 +- gdb/i387-nat.c | 351 ---- gdb/i387-nat.h | 56 - gdb/i387-tdep.c | 318 +++- gdb/i387-tdep.h | 56 + gdb/ia64-tdep.c | 20 + gdb/jv-valprint.c | 15 +- gdb/language.c | 53 +- gdb/language.h | 8 +- gdb/linespec.c | 31 +- gdb/m88k-tdep.c | 31 +- gdb/macroexp.c | 1169 ++++++++++++++ gdb/macroexp.h | 90 ++ gdb/macrotab.c | 862 ++++++++++ gdb/macrotab.h | 295 ++++ gdb/mdebugread.c | 4 +- gdb/memattr.c | 11 +- gdb/mips-tdep.c | 76 +- gdb/nbsd-tdep.c | 98 ++ gdb/nbsd-tdep.h | 28 + gdb/objfiles.c | 8 + gdb/objfiles.h | 1 + gdb/p-lang.c | 4 +- gdb/printcmd.c | 19 - gdb/regcache.c | 10 +- gdb/remote-rdi.c | 48 +- gdb/remote-rdp.c | 13 +- gdb/remote.c | 28 +- gdb/rs6000-tdep.c | 2 +- gdb/ser-tcp.c | 54 +- gdb/sh-tdep.c | 2734 +++++++++++++++++++++++++++++++- gdb/shnbsd-nat.c | 76 + gdb/shnbsd-tdep.c | 180 +++ gdb/shnbsd-tdep.h | 28 + gdb/signals/signals.c | 16 +- gdb/solib-sunos.c | 2 + gdb/solib-svr4.c | 4 +- gdb/solib.c | 10 +- gdb/solib.h | 5 + gdb/stabsread.c | 22 +- gdb/symfile.c | 31 + gdb/symmisc.c | 2 + gdb/symtab.c | 10 +- gdb/symtab.h | 5 + gdb/testsuite/ChangeLog | 71 + gdb/testsuite/gdb.asm/asm-source.exp | 4 + gdb/testsuite/gdb.asm/v850.inc | 41 + gdb/testsuite/gdb.base/a2-run.exp | 3 + gdb/testsuite/gdb.base/break.exp | 15 +- gdb/testsuite/gdb.base/default.exp | 10 +- gdb/testsuite/gdb.base/ending-run.exp | 46 +- gdb/testsuite/gdb.base/long_long.exp | 27 +- gdb/testsuite/gdb.base/maint.exp | 2 +- gdb/testsuite/gdb.base/printcmds.exp | 6 +- gdb/testsuite/gdb.c++/annota2.exp | 2 + gdb/testsuite/gdb.c++/method.exp | 15 +- gdb/testsuite/gdb.mi/mi-var-child.exp | 6 +- gdb/testsuite/gdb.mi/mi0-var-child.exp | 6 +- gdb/testsuite/lib/gdb.exp | 54 +- gdb/tracepoint.c | 8 +- gdb/valops.c | 102 +- gdb/value.h | 5 +- gdb/values.c | 89 -- gdb/version.in | 2 +- gdb/x86-64-linux-nat.c | 8 +- gdb/x86-64-tdep.c | 22 +- include/elf/ChangeLog | 9 + include/elf/common.h | 15 + include/gdb/ChangeLog | 10 + include/gdb/signals.h | 24 +- include/gdb/sim-sh.h | 54 + libiberty/ChangeLog | 13 + libiberty/configure | 333 ++-- libiberty/configure.in | 9 + libiberty/getruntime.c | 6 +- libiberty/waitpid.c | 10 +- opcodes/ChangeLog | 14 + opcodes/cgen-dis.in | 35 +- opcodes/ppc-opc.c | 2 + opcodes/vax-dis.c | 42 +- sim/arm/ChangeLog | 5 + sim/arm/armos.c | 139 +- 195 files changed, 10845 insertions(+), 3329 deletions(-) create mode 100644 gdb/alphabsd-tdep.c create mode 100644 gdb/alphabsd-tdep.h delete mode 100644 gdb/alphanbsd-nat.c delete mode 100644 gdb/config/avr/avr.mt create mode 100644 gdb/config/sh/nbsd.mh create mode 100644 gdb/config/sh/nbsd.mt create mode 100644 gdb/config/sh/nm-nbsd.h create mode 100644 gdb/config/sh/tm-nbsd.h delete mode 100644 gdb/i386nbsd-nat.c delete mode 100644 gdb/i387-nat.c delete mode 100644 gdb/i387-nat.h create mode 100644 gdb/i387-tdep.h create mode 100644 gdb/macroexp.c create mode 100644 gdb/macroexp.h create mode 100644 gdb/macrotab.c create mode 100644 gdb/macrotab.h create mode 100644 gdb/nbsd-tdep.c create mode 100644 gdb/nbsd-tdep.h create mode 100644 gdb/shnbsd-nat.c create mode 100644 gdb/shnbsd-tdep.c create mode 100644 gdb/shnbsd-tdep.h create mode 100644 gdb/testsuite/gdb.asm/v850.inc create mode 100644 include/gdb/sim-sh.h diff --git a/ChangeLog b/ChangeLog index 3a200af..1f91490 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-05-07 Jeff Johnston + + * COPYING.LIBGLOSS: New file. + +2002-05-07 Federico G. Schwindt + + * Makefile.in: Honour DESTDIR. + 2002-05-05 Alexandre Oliva * configure.in (noconfigdirs): Don't disable libgcj on diff --git a/Makefile.in b/Makefile.in index 70bf102..12a69d3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1826,8 +1826,8 @@ install-sid: install-tcl install-tk ### other supporting targets MAKEDIRS= \ - $(prefix) \ - $(exec_prefix) + $(DESTDIR)$(prefix) \ + $(DESTDIR)$(exec_prefix) .PHONY: installdirs installdirs: mkinstalldirs $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1f0e6d0..a837ebe 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,79 @@ +2002-05-10 Tom Rix + + * coff64-rs6000.c (xcoff64_reloc_type_br): New function for + xcoff64_ppc_relocate_section. + * coff-rs6000.c : Extern common xcoff_reloc_type functions. + * libxcoff.h: Common xcoff_reloc_type function declaration. + +2002-05-10 Alan Modra + + * elf32-i386.c (elf_i386_relocate_section): Remove overflow checks + addend in 2002-05-09 commit. + + * elf32-hppa.c (elf32_hppa_size_stubs): Revert part of 2002-05-04, + don't look for stubs on all undefined syms. + +2002-05-09 Alan Modra + + * elf64-ppc.c (RA_REGISTER_MASK, RA_REGISTER_SHIFT): Delete. + (ppc64_elf_howto_raw ): Not pc_relative or + pcrel_offset. + + * elf32-i386.c (elf_howto_table): Comments. + (elf_i386_relocate_section): Handle more relocs for relocatable + linking and against SEC_MERGE sections. + +2002-05-08 Alan Modra + + * elf32-ppc.c (ppc_elf_create_got): New function. + (ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before + _bfd_elf_create_dynamic_sections. Correct .plt flags. + (ppc_elf_check_relocs): Use ppc_elf_create_got in place of + _bfd_elf_create_got_section. + +2002-05-07 Alan Modra + + * elf-bfd.h (struct elf_backend_data): Add rela_normal. + * elfxx-target.h (elf_backend_rela_normal): Define. + (elfNN_bed): Init rela_normal. + * elflink.h (elf_link_input_bfd ): Handle adjustment + for section symbols here if rela_normal. Simplify abs section test. + * elf-m10200.c (mn10200_elf_relocate_section): If relocatable, + return immediately. Remove code handling relocatable linking. + * elf-m10300.c (mn10300_elf_relocate_section): Likewise. + * elf32-fr30.c (fr30_elf_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-i860.c (elf32_i860_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mcore.c (mcore_elf_relocate_section): Likewise. + * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-s390.c (elf_s390_relocate_section): Likewise. + * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL. + * elf32-m32r.c (m32r_elf_relocate_section): Likewise. + * elf-m10200.c (elf_backend_rela_normal): Define. + * elf-m10300.c (elf_backend_rela_normal): Define. + * elf32-fr30.c (elf_backend_rela_normal): Define. + * elf32-i370.c (elf_backend_rela_normal): Define. + * elf32-i860.c (elf_backend_rela_normal): Define. + * elf32-m68k.c (elf_backend_rela_normal): Define. + * elf32-mcore.c (elf_backend_rela_normal): Define. + * elf32-openrisc.c (elf_backend_rela_normal): Define. + * elf32-ppc.c (elf_backend_rela_normal): Define. + * elf32-s390.c (elf_backend_rela_normal): Define. + * elf32-xstormy16.c (elf_backend_rela_normal): Define. + * elf64-ppc.c (elf_backend_rela_normal): Define. + * elf64-s390.c (elf_backend_rela_normal): Define. + * elf64-x86-64.c (elf_backend_rela_normal): Define. + * elfxx-ia64.c (elf_backend_rela_normal): Define. + * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL. + * elf32-m32r.c (elf_backend_rela_normal): Likewise. + 2002-05-06 Nick Clifton * elf32-arm.h (elf32_arm_final_link_relocate): Convert @@ -60,7 +136,7 @@ (elf32_hppa_size_stubs): Adjust for split out functions. Look for stubs on undefined syms too. (elf32_hppa_set_gp): Use bfd_link_hash* instead of elf_link_hash*. - Only access htab elf fields when we have and elf hash table. + Only access htab elf fields when we have an elf hash table. * elf32-hppa.h (elf32_hppa_setup_section_lists): Declare. (elf32_hppa_next_input_section): Declare. diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index b1db78f..10ef5df 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -155,15 +155,7 @@ static boolean do_copy PARAMS((bfd *, bfd *)); static boolean do_shared_object_padding PARAMS ((bfd *, bfd *, ufile_ptr *, int)); /* Relocation functions */ -static boolean xcoff_reloc_type_noop PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_fail PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_pos PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_neg PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_rel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_toc PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_ba PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); static boolean xcoff_reloc_type_br PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -static boolean xcoff_reloc_type_crel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); static boolean xcoff_complain_overflow_dont_func PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS)); @@ -2726,7 +2718,7 @@ xcoff_swap_ldrel_out (abfd, src, d) } -static boolean +boolean xcoff_reloc_type_noop (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd ATTRIBUTE_UNUSED; @@ -2743,7 +2735,7 @@ xcoff_reloc_type_noop (input_bfd, input_section, output_bfd, rel, sym, howto, return true; } -static boolean +boolean xcoff_reloc_type_fail (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd; @@ -2764,7 +2756,7 @@ xcoff_reloc_type_fail (input_bfd, input_section, output_bfd, rel, sym, howto, return false; } -static boolean +boolean xcoff_reloc_type_pos (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd ATTRIBUTE_UNUSED; @@ -2782,7 +2774,7 @@ xcoff_reloc_type_pos (input_bfd, input_section, output_bfd, rel, sym, howto, return true; } -static boolean +boolean xcoff_reloc_type_neg (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd ATTRIBUTE_UNUSED; @@ -2800,7 +2792,7 @@ xcoff_reloc_type_neg (input_bfd, input_section, output_bfd, rel, sym, howto, return true; } -static boolean +boolean xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd ATTRIBUTE_UNUSED; @@ -2824,7 +2816,8 @@ xcoff_reloc_type_rel (input_bfd, input_section, output_bfd, rel, sym, howto, input_section->output_offset); return true; } -static boolean + +boolean xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd; @@ -2866,7 +2859,8 @@ xcoff_reloc_type_toc (input_bfd, input_section, output_bfd, rel, sym, howto, (sym->n_value - xcoff_data (input_bfd)->toc)); return true; } -static boolean + +boolean xcoff_reloc_type_ba (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd ATTRIBUTE_UNUSED; @@ -2967,7 +2961,7 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, return true; } -static boolean +boolean xcoff_reloc_type_crel (input_bfd, input_section, output_bfd, rel, sym, howto, val, addend, relocation, contents) bfd *input_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index b1bc2f5..931a914 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -152,6 +152,42 @@ static boolean xcoff64_generate_rtinit PARAMS ((bfd *, const char *, const char *, boolean)); static boolean xcoff64_bad_format_hook PARAMS ((bfd *, PTR )); +/* Relocation functions */ +static boolean xcoff64_reloc_type_br PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); + +boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION]) + (XCOFF_RELOC_FUNCTION_ARGS) = +{ + xcoff_reloc_type_pos, /* R_POS (0x00) */ + xcoff_reloc_type_neg, /* R_NEG (0x01) */ + xcoff_reloc_type_rel, /* R_REL (0x02) */ + xcoff_reloc_type_toc, /* R_TOC (0x03) */ + xcoff_reloc_type_fail, /* R_RTB (0x04) */ + xcoff_reloc_type_toc, /* R_GL (0x05) */ + xcoff_reloc_type_toc, /* R_TCL (0x06) */ + xcoff_reloc_type_fail, /* (0x07) */ + xcoff_reloc_type_ba, /* R_BA (0x08) */ + xcoff_reloc_type_fail, /* (0x09) */ + xcoff64_reloc_type_br, /* R_BR (0x0a) */ + xcoff_reloc_type_fail, /* (0x0b) */ + xcoff_reloc_type_pos, /* R_RL (0x0c) */ + xcoff_reloc_type_pos, /* R_RLA (0x0d) */ + xcoff_reloc_type_fail, /* (0x0e) */ + xcoff_reloc_type_noop, /* R_REF (0x0f) */ + xcoff_reloc_type_fail, /* (0x10) */ + xcoff_reloc_type_fail, /* (0x11) */ + xcoff_reloc_type_toc, /* R_TRL (0x12) */ + xcoff_reloc_type_toc, /* R_TRLA (0x13) */ + xcoff_reloc_type_fail, /* R_RRTBI (0x14) */ + xcoff_reloc_type_fail, /* R_RRTBA (0x15) */ + xcoff_reloc_type_ba, /* R_CAI (0x16) */ + xcoff_reloc_type_crel, /* R_CREL (0x17) */ + xcoff_reloc_type_ba, /* R_RBA (0x18) */ + xcoff_reloc_type_ba, /* R_RBAC (0x19) */ + xcoff64_reloc_type_br, /* R_RBR (0x1a) */ + xcoff_reloc_type_ba, /* R_RBRC (0x1b) */ +}; + /* coffcode.h needs these to be defined. */ /* Internalcoff.h and coffcode.h modify themselves based on these flags. */ #define XCOFF64 @@ -1030,6 +1066,84 @@ xcoff64_write_object_contents (abfd) return true; } +static boolean +xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, + val, addend, relocation, contents) + bfd *input_bfd; + asection *input_section; + bfd *output_bfd ATTRIBUTE_UNUSED; + struct internal_reloc *rel; + struct internal_syment *sym ATTRIBUTE_UNUSED; + struct reloc_howto_struct *howto; + bfd_vma val; + bfd_vma addend; + bfd_vma *relocation; + bfd_byte *contents; +{ + struct xcoff_link_hash_entry *h; + + if (0 > rel->r_symndx) + return false; + + h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx]; + + /* If we see an R_BR or R_RBR reloc which is jumping to global + linkage code, and it is followed by an appropriate cror nop + instruction, we replace the cror with ld r2,40(r1). This + restores the TOC after the glink code. Contrariwise, if the + call is followed by a ld r2,40(r1), but the call is not + going to global linkage code, we can replace the load with a + cror. */ + if (NULL != h + && bfd_link_hash_defined == h->root.type + && (rel->r_vaddr - input_section->vma + 8 <= + input_section->_cooked_size)) + { + bfd_byte *pnext; + unsigned long next; + + pnext = contents + (rel->r_vaddr - input_section->vma) + 4; + next = bfd_get_32 (input_bfd, pnext); + + /* The _ptrgl function is magic. It is used by the AIX compiler to call + a function through a pointer. */ + if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0) + { + if (next == 0x4def7b82 /* cror 15,15,15 */ + || next == 0x4ffffb82 /* cror 31,31,31 */ + || next == 0x60000000) /* ori r0,r0,0 */ + bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */ + } + else + { + if (next == 0xe8410028) /* ld r2,40(r1) */ + bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */ + } + } + else if (NULL != h && bfd_link_hash_undefined == h->root.type) + { + /* Normally, this relocation is against a defined symbol. In the + case where this is a partial link and the output section offset + is greater than 2^25, the linker will return an invalid error + message that the relocation has been truncated. Yes it has been + truncated but no it not important. For this case, disable the + overflow checking. */ + howto->complain_on_overflow = complain_overflow_dont; + } + + howto->pc_relative = true; + howto->src_mask &= ~3; + howto->dst_mask = howto->src_mask; + + /* A PC relative reloc includes the section address. */ + addend += input_section->vma; + + *relocation = val + addend; + *relocation -= (input_section->output_section->vma + + input_section->output_offset); + return true; +} + /* This is the relocation function for the PowerPC64. See xcoff_ppc_relocation_section for more information. */ @@ -1146,7 +1260,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, } if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION - || (false == xcoff_calculate_relocation[rel->r_type] + || (false == xcoff64_calculate_relocation[rel->r_type] (input_bfd, input_section, output_bfd, rel, sym, &howto, val, addend, &relocation, contents))) return false; diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index ef219e4..5959077 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -804,6 +804,11 @@ struct elf_backend_data section. */ unsigned default_use_rela_p : 1; + /* Set if RELA relocations for a relocatable link can be handled by + generic code. Backends that set this flag need do nothing in the + backend relocate_section routine for relocatable linking. */ + unsigned rela_normal : 1; + /* True if addresses "naturally" sign extend. This is used when swapping in from Elf32 when BFD64. */ unsigned sign_extend_vma : 1; diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index e514934..4e8de60 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -1,5 +1,5 @@ /* Matsushita 10200 specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -347,6 +347,9 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, struct elf_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; + if (info->relocateable) + return true; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -367,26 +370,6 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_type = ELF32_R_TYPE (rel->r_info); howto = elf_mn10200_howto_table + r_type; - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -1572,6 +1555,7 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, #define ELF_MACHINE_ALT1 EM_CYGNUS_MN10200 #define ELF_MAXPAGESIZE 0x1000 +#define elf_backend_rela_normal 1 #define elf_info_to_howto mn10200_info_to_howto #define elf_info_to_howto_rel 0 #define elf_backend_relocate_section mn10200_elf_relocate_section diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index ce68a16..40b4ad6 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -553,6 +553,9 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, struct elf32_mn10300_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; + if (info->relocateable) + return true; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = (struct elf32_mn10300_link_hash_entry **) (elf_sym_hashes (input_bfd)); @@ -579,26 +582,6 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_MN10300_GNU_VTENTRY) continue; - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -3101,6 +3084,7 @@ _bfd_mn10300_elf_merge_private_bfd_data (ibfd, obfd) #define elf_info_to_howto mn10300_info_to_howto #define elf_info_to_howto_rel 0 #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define elf_backend_check_relocs mn10300_elf_check_relocs #define elf_backend_gc_mark_hook mn10300_elf_gc_mark_hook #define elf_backend_relocate_section mn10300_elf_relocate_section diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 51c51a4..91ea63b 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -1830,6 +1830,11 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela * relend; const char * name; +#ifndef USE_REL + if (info->relocateable) + return true; +#endif + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1862,6 +1867,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, #endif howto = bfd_reloc.howto; +#ifdef USE_REL if (info->relocateable) { /* This is a relocateable link. We don't have to change @@ -1874,19 +1880,16 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) { sec = local_sections[r_symndx]; -#ifdef USE_REL arm_add_to_rel (input_bfd, contents + rel->r_offset, howto, (bfd_signed_vma) (sec->output_offset + sym->st_value)); -#else - rel->r_addend += (sec->output_offset + sym->st_value); -#endif } } continue; } +#endif /* This is a final link. */ h = NULL; @@ -3637,6 +3640,9 @@ elf32_arm_reloc_type_class (rela) #define elf_backend_plt_readonly 1 #define elf_backend_want_got_plt 1 #define elf_backend_want_plt_sym 0 +#ifndef USE_REL +#define elf_backend_rela_normal 1 +#endif #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_ENTRY_SIZE diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 8e31d67..e1bc741 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -1,5 +1,5 @@ /* FR30-specific support for 32-bit ELF. - Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -517,6 +517,9 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela * rel; Elf_Internal_Rela * relend; + if (info->relocateable) + return true; + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -541,27 +544,6 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections [r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ howto = fr30_elf_howto_table + ELF32_R_TYPE (rel->r_info); h = NULL; sym = NULL; @@ -806,6 +788,7 @@ fr30_elf_check_relocs (abfd, info, sec, relocs) #define elf_backend_check_relocs fr30_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup fr30_reloc_type_lookup diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index f0fd549..4dc7e9b 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -3128,9 +3128,19 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size, + sym_sec->output_section->vma); } else if (hash->elf.root.type == bfd_link_hash_undefweak) - ; + { + if (! info->shared) + continue; + } else if (hash->elf.root.type == bfd_link_hash_undefined) - ; + { + if (! (info->shared + && !info->no_undefined + && (ELF_ST_VISIBILITY (hash->elf.other) + == STV_DEFAULT) + && hash->elf.type != STT_PARISC_MILLI)) + continue; + } else { bfd_set_error (bfd_error_bad_value); diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 07d5f9d..fc82b47 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1277,6 +1277,9 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma *local_got_offsets; boolean ret = true; + if (info->relocateable) + return true; + #ifdef DEBUG fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", bfd_archive_filename (input_bfd), @@ -1320,34 +1323,6 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, howto = i370_elf_howto_table[(int)r_type]; r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; - } - } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, - (int)r_type, - r_symndx, - (long)offset, - (long)addend); -#endif - continue; - } - - /* This is a final link. */ if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -1661,6 +1636,7 @@ i370_elf_post_process_headers (abfd, link_info) #define elf_backend_plt_not_loaded 1 #define elf_backend_got_symbol_offset 4 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup #define bfd_elf32_bfd_set_private_flags i370_elf_set_private_flags diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 7165e84..760762d 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -154,7 +154,7 @@ static reloc_howto_type elf_howto_table[]= false, /* partial_inplace */ 0, /* src_mask */ 0, /* dst_mask */ - false), + false), /* pcrel_offset */ /* GNU extension to record C++ vtable member usage. */ HOWTO (R_386_GNU_VTENTRY, /* type */ @@ -169,7 +169,7 @@ static reloc_howto_type elf_howto_table[]= false, /* partial_inplace */ 0, /* src_mask */ 0, /* dst_mask */ - false) + false) /* pcrel_offset */ #define R_386_vt ((unsigned int) R_386_GNU_VTENTRY + 1 - R_386_vt_offset) @@ -1745,22 +1745,43 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (info->relocateable) { + bfd_vma val; + bfd_byte *where; + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - bfd_vma val; + if (r_symndx >= symtab_hdr->sh_info) + continue; - sec = local_sections[r_symndx]; - val = bfd_get_32 (input_bfd, contents + rel->r_offset); - val += sec->output_offset + sym->st_value; - bfd_put_32 (input_bfd, val, contents + rel->r_offset); - } + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + continue; + + sec = local_sections[r_symndx]; + val = sec->output_offset; + if (val == 0) + continue; + + where = contents + rel->r_offset; + switch (howto->size) + { + /* FIXME: overflow checks. */ + case 0: + val += bfd_get_8 (input_bfd, where); + bfd_put_8 (input_bfd, val, where); + break; + case 1: + val += bfd_get_16 (input_bfd, where); + bfd_put_16 (input_bfd, val, where); + break; + case 2: + val += bfd_get_32 (input_bfd, where); + bfd_put_32 (input_bfd, val, where); + break; + default: + abort (); } continue; } @@ -1782,24 +1803,62 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, { asection *msec; bfd_vma addend; + bfd_byte *where = contents + rel->r_offset; - if (howto->src_mask != 0xffffffff) + switch (howto->size) { - (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, howto->name); - return false; + case 0: + addend = bfd_get_8 (input_bfd, where); + if (howto->pc_relative) + { + addend = (addend ^ 0x80) - 0x80; + addend += 1; + } + break; + case 1: + addend = bfd_get_16 (input_bfd, where); + if (howto->pc_relative) + { + addend = (addend ^ 0x8000) - 0x8000; + addend += 2; + } + break; + case 2: + addend = bfd_get_32 (input_bfd, where); + if (howto->pc_relative) + { + addend = (addend ^ 0x80000000) - 0x80000000; + addend += 4; + } + break; + default: + abort (); } - addend = bfd_get_32 (input_bfd, contents + rel->r_offset); msec = sec; - addend = - _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - - relocation; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend -= relocation; addend += msec->output_section->vma + msec->output_offset; - bfd_put_32 (input_bfd, addend, contents + rel->r_offset); + + switch (howto->size) + { + case 0: + /* FIXME: overflow checks. */ + if (howto->pc_relative) + addend -= 1; + bfd_put_8 (input_bfd, addend, where); + break; + case 1: + if (howto->pc_relative) + addend -= 2; + bfd_put_16 (input_bfd, addend, where); + break; + case 2: + if (howto->pc_relative) + addend -= 4; + bfd_put_32 (input_bfd, addend, where); + break; + } } } else @@ -2102,7 +2161,6 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (r == bfd_reloc_overflow) { - if (! ((*info->callbacks->reloc_overflow) (info, name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset))) diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index 7b5d052..82c7190 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -1,5 +1,6 @@ /* Intel i860 specific support for 32-bit ELF. - Copyright 1993, 1995, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1993, 1995, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. Full i860 support contributed by Jason Eckhardt . @@ -878,6 +879,9 @@ elf32_i860_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela * rel; Elf_Internal_Rela * relend; + if (info->relocateable) + return true; + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -904,27 +908,6 @@ elf32_i860_relocate_section (output_bfd, info, input_bfd, input_section, r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections [r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info)); h = NULL; sym = NULL; @@ -1097,6 +1080,7 @@ elf32_i860_is_local_label_name (abfd, name) #define ELF_MACHINE_CODE EM_860 #define ELF_MAXPAGESIZE 4096 +#define elf_backend_rela_normal 1 #define elf_info_to_howto_rel NULL #define elf_info_to_howto elf32_i860_info_to_howto_rela #define elf_backend_relocate_section elf32_i860_relocate_section diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index b3b6220..e8015a9 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -981,6 +981,11 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Assume success. */ boolean ret = true; +#ifndef USE_REL + if (info->relocateable) + return true; +#endif + rel = relocs; relend = relocs + input_section->reloc_count; for (; rel < relend; rel++) @@ -1020,6 +1025,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, howto = m32r_elf_howto_table + r_type; r_symndx = ELF32_R_SYM (rel->r_info); +#ifdef USE_REL if (info->relocateable) { /* This is a relocateable link. We don't have to change @@ -1045,16 +1051,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, sec = local_sections[r_symndx]; addend += sec->output_offset + sym->st_value; -#ifndef USE_REL - /* This can't be done for USE_REL because it doesn't mean anything - and elf_link_input_bfd asserts this stays zero. */ - rel->r_addend = addend; -#endif -#ifndef USE_REL - /* Addends are stored with relocs. We're done. */ - continue; -#else /* USE_REL */ /* If partial_inplace, we need to store any additional addend back in the section. */ if (! howto->partial_inplace) @@ -1088,9 +1085,9 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, r = _bfd_relocate_contents (howto, input_bfd, addend, contents + offset); } -#endif /* USE_REL */ } else +#endif /* USE_REL */ { bfd_vma relocation; @@ -2161,6 +2158,9 @@ m32r_elf_check_relocs (abfd, info, sec, relocs) #define elf_backend_check_relocs m32r_elf_check_relocs #define elf_backend_can_gc_sections 1 +#ifndef USE_REL +#define elf_backend_rela_normal 1 +#endif #if 0 /* not yet */ /* relax support */ #define bfd_elf32_bfd_relax_section m32r_elf_relax_section diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 9267e47..7d5b016 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1308,6 +1308,9 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1340,26 +1343,6 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2325,5 +2308,6 @@ elf32_m68k_reloc_type_class (rela) #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 +#define elf_backend_rela_normal 1 #include "elf32-target.h" diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index a0784f6..38e9c13 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -1,5 +1,6 @@ /* Motorola MCore specific support for 32-bit ELF - Copyright 1994, 1995, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1994, 1995, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -414,6 +415,9 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, (info->relocateable) ? " (relocatable)" : ""); #endif + if (info->relocateable) + return true; + if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ mcore_elf_howto_init (); @@ -447,32 +451,6 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, howto = mcore_elf_howto_table [(int) r_type]; r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; - } - } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, (int) r_type, r_symndx, (long) offset, (long) addend); -#endif - continue; - } - - /* This is a final link. */ - /* Complain about known relocation that are not yet supported. */ if (howto->special_function == mcore_elf_unsupported_reloc) { @@ -726,5 +704,6 @@ mcore_elf_check_relocs (abfd, info, sec, relocs) #define elf_backend_check_relocs mcore_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #include "elf32-target.h" diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c index 5f60366..34d4d9f 100644 --- a/bfd/elf32-openrisc.c +++ b/bfd/elf32-openrisc.c @@ -1,5 +1,5 @@ /* OpenRISC-specific support for 32-bit ELF. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. Contributed by Johan Rydberg, jrydberg@opencores.org This file is part of BFD, the Binary File Descriptor library. @@ -338,6 +338,9 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -361,25 +364,6 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_OPENRISC_GNU_VTENTRY) continue; - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - continue; - } - if ((unsigned int) r_type > (sizeof openrisc_elf_howto_table / sizeof (reloc_howto_type))) abort (); @@ -645,6 +629,7 @@ openrisc_elf_final_write_processing (abfd, linker) #define elf_backend_check_relocs openrisc_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup openrisc_reloc_type_lookup diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index f68d914..31d9e0c 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1,5 +1,5 @@ /* PowerPC-specific support for 32-bit ELF - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -49,6 +49,8 @@ static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); static int ppc_elf_additional_program_headers PARAMS ((bfd *)); static boolean ppc_elf_modify_segment_map PARAMS ((bfd *)); +static asection *ppc_elf_create_got + PARAMS ((bfd *, struct bfd_link_info *)); static boolean ppc_elf_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); @@ -1632,6 +1634,30 @@ ppc_elf_modify_segment_map (abfd) return true; } +/* The powerpc .got has a blrl instruction in it. Mark it executable. */ + +static asection * +ppc_elf_create_got (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + register asection *s; + flagword flags; + + if (!_bfd_elf_create_got_section (abfd, info)) + return NULL; + + s = bfd_get_section_by_name (abfd, ".got"); + if (s == NULL) + abort (); + + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + if (!bfd_set_section_flags (abfd, s, flags)) + return NULL; + return s; +} + /* We have to create .dynsbss and .rela.sbss here so that they get mapped to output sections (just like _bfd_elf_create_dynamic_sections has to create .dynbss and .rela.bss). */ @@ -1644,6 +1670,9 @@ ppc_elf_create_dynamic_sections (abfd, info) register asection *s; flagword flags; + if (!ppc_elf_create_got (abfd, info)) + return false; + if (!_bfd_elf_create_dynamic_sections (abfd, info)) return false; @@ -1663,7 +1692,13 @@ ppc_elf_create_dynamic_sections (abfd, info) || ! bfd_set_section_alignment (abfd, s, 2)) return false; } - return true; + + s = bfd_get_section_by_name (abfd, ".plt"); + if (s == NULL) + abort (); + + flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED; + return bfd_set_section_flags (abfd, s, flags); } /* Adjust a symbol defined by a dynamic object and referenced by a @@ -2119,10 +2154,9 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) { if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) + sgot = ppc_elf_create_got (dynobj, info); + if (sgot == NULL) return false; - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); } } @@ -2139,10 +2173,9 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) { if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) + sgot = ppc_elf_create_got (dynobj, info); + if (sgot == NULL) return false; - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); } if (srelgot == NULL @@ -2896,6 +2929,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, (info->relocateable) ? " (relocatable)" : ""); #endif + if (info->relocateable) + return true; + if (!ppc_elf_howto_table[R_PPC_ADDR32]) /* Initialize howto table if needed. */ ppc_elf_howto_init (); @@ -2940,34 +2976,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, howto = ppc_elf_howto_table[(int) r_type]; r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; - } - } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, - (int) r_type, - r_symndx, - (long) offset, - (long) addend); -#endif - continue; - } - - /* This is a final link. */ if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -3781,6 +3789,7 @@ ppc_elf_grok_psinfo (abfd, note) #define elf_backend_can_refcount 1 #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data #define bfd_elf32_bfd_relax_section ppc_elf_relax_section diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 8c6f546..5032a5c 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1632,6 +1632,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + htab = elf_s390_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1661,30 +1664,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, bfd_set_error (bfd_error_bad_value); return false; } - howto = elf_howto_table + r_type; + howto = elf_howto_table + r_type; r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2467,6 +2449,7 @@ elf_s390_grok_prstatus (abfd, note) #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define elf_info_to_howto elf_s390_info_to_howto diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 484acdd..d6b8dd3 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -790,6 +790,9 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd *dynobj; asection *splt; + if (info->relocateable) + return true; + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -818,28 +821,6 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, continue; r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections [r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ howto = xstormy16_elf_howto_table + ELF32_R_TYPE (rel->r_info); h = NULL; sym = NULL; @@ -1108,6 +1089,7 @@ xstormy16_elf_gc_sweep_hook (abfd, info, sec, relocs) xstormy16_elf_finish_dynamic_sections #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup xstormy16_reloc_type_lookup #define bfd_elf32_bfd_relax_section xstormy16_elf_relax_section diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 6cff281..5ae3aef 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -63,12 +63,6 @@ static boolean ppc64_elf_section_from_shdr PARAMS ((bfd *, Elf64_Internal_Shdr *, char *)); -/* Mask to set RA in memory instructions. */ -#define RA_REGISTER_MASK 0x001f0000 - -/* Value to shift register by to insert RA. */ -#define RA_REGISTER_SHIFT 16 - /* The name of the dynamic interpreter. This is put in the .interp section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" @@ -482,7 +476,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { 0, /* rightshift */ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */ 64, /* bitsize */ - true, /* pc_relative */ + false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ @@ -490,7 +484,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { false, /* partial_inplace */ 0, /* src_mask */ 0xffffffffffffffff, /* dst_mask */ - true), /* pcrel_offset */ + false), /* pcrel_offset */ /* Like R_PPC64_ADDR32, but may be unaligned. */ HOWTO (R_PPC64_UADDR32, /* type */ @@ -5051,6 +5045,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ boolean is_power4 = false; + if (info->relocateable) + return true; + /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) ppc_howto_init (); @@ -5085,27 +5082,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info); r_symndx = ELF64_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocatable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - continue; - } - - /* This is a final link. */ - offset = rel->r_offset; addend = rel->r_addend; r = bfd_reloc_other; @@ -6053,6 +6029,7 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info) #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 +#define elf_backend_rela_normal 1 #define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup #define bfd_elf64_bfd_set_private_flags ppc64_elf_set_private_flags diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index c4c3c1d..ceb5efa 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1587,6 +1587,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + htab = elf_s390_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1616,30 +1619,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, bfd_set_error (bfd_error_bad_value); return false; } - howto = elf_howto_table + r_type; + howto = elf_howto_table + r_type; r_symndx = ELF64_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2384,6 +2366,7 @@ const struct elf_size_info s390_elf64_size_info = #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 24 #define elf_backend_plt_header_size PLT_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define elf_info_to_howto elf_s390_info_to_howto diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 5d77e7b..30cc29a 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1494,6 +1494,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + htab = elf64_x86_64_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1524,30 +1527,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, bfd_set_error (bfd_error_bad_value); return false; } - howto = x86_64_elf_howto_table + r_type; + howto = x86_64_elf_howto_table + r_type; r_symndx = ELF64_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2230,6 +2212,7 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info) #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size (GOT_ENTRY_SIZE*3) #define elf_backend_plt_header_size PLT_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define elf_info_to_howto elf64_x86_64_info_to_howto diff --git a/bfd/elflink.h b/bfd/elflink.h index 37b2150..bfe6374 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -6754,6 +6754,12 @@ elf_link_input_bfd (finfo, input_bfd) void (*reloc_emitter) PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); + boolean rela_normal; + + input_rel_hdr = &elf_section_data (o)->rel_hdr; + rela_normal = (bed->rela_normal + && (input_rel_hdr->sh_entsize + == sizeof (Elf_External_Rela))); /* Adjust the reloc addresses and symbol indices. */ @@ -6827,10 +6833,9 @@ elf_link_input_bfd (finfo, input_bfd) processor specific section. If we have discarded a section, the output_section will be the absolute section. */ - if (sec != NULL - && (bfd_is_abs_section (sec) - || (sec->output_section != NULL - && bfd_is_abs_section (sec->output_section)))) + if (bfd_is_abs_section (sec) + || (sec != NULL + && bfd_is_abs_section (sec->output_section))) r_symndx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -6842,6 +6847,11 @@ elf_link_input_bfd (finfo, input_bfd) r_symndx = sec->output_section->target_index; BFD_ASSERT (r_symndx != 0); } + + /* Adjust the addend according to where the + section winds up in the output section. */ + if (rela_normal) + irela->r_addend += sec->output_offset; } else { @@ -6900,7 +6910,6 @@ elf_link_input_bfd (finfo, input_bfd) else reloc_emitter = elf_link_output_relocs; - input_rel_hdr = &elf_section_data (o)->rel_hdr; (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); input_rel_hdr = elf_section_data (o)->rel_hdr2; diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index aadb963..f92ab6a 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -3502,6 +3502,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, elf_section_data(input_section->output_section) ->this_hdr.sh_flags |= flags; + return true; } gp_val = _bfd_get_gp_value (output_bfd); @@ -3534,29 +3535,9 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, ret_val = false; continue; } + howto = lookup_howto (r_type); r_symndx = ELFNN_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sym_sec = local_sections[r_symndx]; - rel->r_addend += sym_sec->output_offset; - } - } - continue; - } - - /* This is a final link. */ - h = NULL; sym = NULL; sym_sec = NULL; @@ -4561,6 +4542,7 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval) #define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect #define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol #define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class +#define elf_backend_rela_normal 1 #include "elfNN-target.h" diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index c1c106f..7d391d4 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -400,6 +400,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define elf_backend_default_use_rela_p !USE_REL #endif +#ifndef elf_backend_rela_normal +#define elf_backend_rela_normal 0 +#endif + #ifndef ELF_MACHINE_ALT1 #define ELF_MACHINE_ALT1 0 #endif @@ -482,6 +486,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_may_use_rel_p, elf_backend_may_use_rela_p, elf_backend_default_use_rela_p, + elf_backend_rela_normal, elf_backend_sign_extend_vma, elf_backend_want_got_plt, elf_backend_plt_readonly, diff --git a/bfd/libxcoff.h b/bfd/libxcoff.h index 5e16fb2..7463eef 100644 --- a/bfd/libxcoff.h +++ b/bfd/libxcoff.h @@ -222,4 +222,14 @@ extern boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION]) extern boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW]) (XCOFF_COMPLAIN_FUNCTION_ARGS); +/* Relocation functions */ +boolean xcoff_reloc_type_noop PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_fail PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_pos PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_neg PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_rel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_toc PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_ba PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +boolean xcoff_reloc_type_crel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); + #endif /* LIBXCOFF_H */ diff --git a/bfd/version.h b/bfd/version.h index 952767f..6ab3d30 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1 +1 @@ -#define BFD_VERSION_DATE 20020506 +#define BFD_VERSION_DATE 20020511 diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 93a2353..106373c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,766 @@ +2002-05-15 Jim Blandy + + Add macro structures to GDB's symbol tables. Nobody puts anything + in them yet. + * symtab.h (struct symtab): New member: `macro_table'. + * buildsym.h (pending_macros): New global variable. + * buildsym.c: #include "macrotab.h". + (buildsym_init): Initialize `pending_macros'. + (end_symtab): If we found macro information while reading a CU's + debugging info, do build a symtab structure for it. Make the + symtab point to the macro information, and clear the + `pending_macros' pointer which held it while we were reading the + debug info. + (really_free_pendings): Free any pending macro table. + * objfiles.h (struct objfile): New member: `macro_cache'. + * objfiles.c (allocate_objfile): Set allocate and free functions + for the macro cache's objstack. + (free_objfile): Empty the macro cache's obstack. + * symfile.c (reread_symbols): Empty the macro cache's obstack, and + set new allocate and free functions for it. + * solib-sunos.c (allocate_rt_common_objfile): Set allocate and + free functions for the macro cache's objstack. (Why is this + function building its own objfile?) + * symmisc.c (print_objfile_statistics): Print statistics on the + macro bcache. + * Makefile.in: Note that buildsym.o depends on macrotab.h. + +2002-05-15 Richard Earnshaw + + * config/arm/nm-nbsd.h: Use <> for include of config/nm-nbsd.h. + (REGISTER_U_ADDR): Delete definition. + (arm_register_u_addr): Delete declaration. + +2002-05-15 Richard Earnshaw + + * arm-linux-tdep.c (ARM_LINUX_JB_PC): Renamed from JB_PC. + (ARM_LINUX_JB_ELEMENT_SIZE): Likewise. + +2002-05-14 Daniel Jacobowitz + + * gdbserver/mem-break.c (reinsert_breakpoint_by_bp): Correct typo + stop_at -> stop_pc. + +2002-05-14 Andrew Cagney + + * regcache.c (register_valid): Revise comments refering to "Not + available" and "unavailable". + * frame.c (frame_register_read): Ditto. + * findvar.c (value_of_register): Ditto. + +2002-05-15 Andrew Cagney + + * Makefile.in (remote_sim_h): Replace remote-sim_h. + (remote-sim.o): Update dependencies. + (d10v-tdep.o): Specify dependencies. + (sim_d10v_h): Define. + +2002-05-14 Jim Blandy + + * macroexp.c (init_buffer, gather_arguments, expand): Use NULL, not 0. + * macrotab.c (macro_lookup_inclusion, find_definition, + new_macro_table): Same. + + * macroexp.c (currently_rescanning, expand): Use `strcmp () == 0', + not `! strcmp ()'. This is a dubious improvement. + * macrotab.c (macro_lookup_inclusion, find_definition): Same. + + * macrotab.c (macro_lookup_inclusion): Initialize `best_depth', + although it's not necessary, to avoid a warning. + +2002-05-14 Daniel Jacobowitz + + * gdbtypes.h: Update accessor macros to use TYPE_MAIN_TYPE. + (TYPE_CONST, TYPE_VOLATILE, TYPE_CODE_SPACE, TYPE_DATA_SPACE): Use + TYPE_INSTANCE_FLAGS. + (struct main_type): New. + (struct type): Move most members to struct main_type. Change + cv_type and as_type to new type_chain member. Add instance_flags. + (TYPE_MAIN_TYPE, TYPE_CHAIN, TYPE_INSTANCE_FLAGS): New macros. + (TYPE_CV_TYPE, TYPE_AS_TYPE): Remove. + (finish_cv_type): Remove prototype. + * gdbtypes.c (alloc_type): Update comment. Allocate TYPE_MAIN_TYPE. + Set TYPE_CHAIN. + (alloc_type_instance): New function. + (smash_type): New function. + (make_pointer_type, make_reference_type, make_function_type) + (smash_to_member_type, smash_to_method_type): Call smash_type. + (make_qualified_type): New function. + (make_type_with_address_space): Call make_qualified_type. + (make_cv_type): Likewise. + (finish_cv_type): Remove unnecessary function. + (replace_type): Update comment. Copy TYPE_MAIN_TYPE. + (recursive_dump_type): Dump TYPE_CHAIN and TYPE_INSTANCE_FLAGS; + remove TYPE_CV_TYPE and TYPE_AS_TYPE. + * c-typeprint.c (c_type_print_modifier): Use TYPE_INSTANCE_FLAGS. + * dwarf2read.c (read_structure_scope): Don't call finish_cv_type. + * hpread.c (hpread_read_struct_type): Likewise. + * stabsread.c (read_struct_type): Likewise. + +2002-05-14 Elena Zannoni + + * configure.tgt: Add a catch all sh* target, for cases like + sh[2,3,4]-elf and sh-hms. + +2002-05-14 Keith Seitz + + * event-loop.c (create_file_handler): Don't do anything but + update data when we are given a fd which we are already + monitoring. + +2002-05-14 Michal Ludvig + + * dwarf2cfi.c (context_cpy): Copy registers correctly. + (update_context): Use __func__ in warnings. + +2002-05-14 Daniel Jacobowitz + + * ser-tcp.c: Include . Rename tcp_open + and tcp_close to net_open and net_close. + (net_open): Accept "udp:" and "tcp:" specifications. Connect + using UDP if requested. Don't try to disable Nagle on UDP + sockets. + * remote.c (remote_serial_open): New function. Warn about UDP. + (remote_open_1, remote_async_open_1, remote_cisco_open): Call it. + +2002-05-13 Elena Zannoni + + * MAINTAINERS: List sh-elf as buildable with ,-Werror. + +2002-05-13 Elena Zannoni + + * configure.tgt: Remove sh-hms target. + * MAINTAINERS: Don't list sh-hms as a separate target. + +2002-05-13 Jim Blandy + + Add first preprocessor macro-expansion files. + * macroexp.c, macroexp.h, macrotab.c, macrotab.h: New files. + * Makefile.in (SFILES): Add macrotab.c, macroexp.c. + (splay_tree_h, macroexp_h, macrotab_h): New variable. + (HFILES_NO_SRCDIR): Add macrotab.h, macroexp.h. + (COMMON_OBS): Add macrotab.o, macroexp.o. + (macroexp.o, macrotab.o): New rules. + +2002-05-13 Andrew Cagney + + * config/m88k/tm-m88k.h: Update copyright. + (m88k_target_write_pc): Declare + (TARGET_WRITE_PC): Redefine using m88k_target_write_pc. + (M88K_NNPC_REGNUM): Rename NNPC_REGNUM. + (SHIFT_INST_REGS): Update definition. + * m88k-tdep.c (m88k_target_write_pc): New function. Implement + using old definition of TARGET_WRITE_PC. + * regcache.c (generic_target_write_pc): Delete code handling + NNPC_REGNUM. + * gdbarch.sh (NNPC_REGNUM): Delete. + * gdbarch.h, gdbarch.c: Regenerate. + +2002-05-13 Richard Earnshaw + + * builtin-regs.c (value_of_builtin_reg): Correctly calculate the + builtin reg number. + +2002-05-13 Daniel Jacobowitz + + * ax-gdb.c (gen_sign_extend, gen_fetch, gen_usual_unary) + (gen_cast, gen_scale, gen_add, gen_sub, gen_binop, gen_deref) + (gen_address_of, gen_struct_ref, gen_repeat): Use type + access macros. + * c-typeprint.c (cp_type_print_method_args): Likewise. + (c_type_print_args): Likewise. + * d10v-tdep.c (d10v_push_arguments): Likewise. + (d10v_extract_return_value): Likewise. + * expprint.c (print_subexp): Likewise. + * gdbtypes.c (lookup_primitive_typename): Likewise. + (lookup_template_type, add_mangled_type, print_arg_types): Likewise. + * gdbtypes.h (TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB) + (TYPE_TARGET_STUB, TYPE_STATIC, TYPE_CONST, TYPE_VOLATILE) + (TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_CODE_SPACE, TYPE_VARARGS) + (TYPE_VECTOR): Likewise. + * hpread.c (hpread_read_struct_type) + (fix_static_member_physnames, fixup_class_method_type) + (hpread_type_lookup): Likewise. + * mdebugread.c (parse_symbol, parse_type): Likewise. + * p-lang.c (is_pascal_string_type): Likewise. + * valops.c (hand_function_call): Likewise. + * x86-64-tdep.c (classify_argument): Likewise. + + * hpread.c (hpread_read_function_type) + (hpread_read_doc_function_type): Call replace_type. + * dstread.c (create_new_type): Delete. + (decode_dst_structure, process_dst_function): Call alloc_type. + Use type access macros. + +2002-05-12 Mark Kettenis + + * i387-tdep.c (i387_supply_fxsave): Skip the SSE registers if + the're not supported by the current architecture. + (i387_fill_fxsave): Likewise. + +2002-05-12 Fred Fish + + * symfile.c (default_symfile_offsets): Arrange for uninitialized + sect_index_xxx members to index the first slot in section_offsets + if all of the section_offsets are zero. + +2002-05-12 Mark Kettenis + + * configure.tgt (sparc-*openbsd): Remove entry accidentially + checked in with last change. + +2002-05-12 Mark Kettenis + + * configure.tgt (i[3456]86-*-unixware*, i[3456]86-*-unixware2*): + Remove targets. These are canonicalized to i386-*-sysv4.2uw by + config.sub. + +2002-05-12 Daniel Jacobowitz + + * Makefile.in: Update dependencies. + +2002-05-11 Andrew Cagney + + * language.c (local_hex_string_custom): Simplify. Do not depend + on PRINTF_HAS_LONG_LONG or CC_HAS_LONG_LONG. + + * memattr.c (mem_info_command): Replace calls to + longest_local_hex_string and longest_local_hex_string_custom. + * buildsym.c (make_blockvector): Ditto. + * solib.c (info_sharedlibrary_command): Ditto. + * tracepoint.c (tracepoints_info): Ditto. + * symtab.c (print_msymbol_info): Ditto. + + * language.c (local_hex_string): Delete. + (local_hex_string_custom): Delete. + (longest_local_hex_string): Rename to local_hex_string. + (longest_local_hex_string_custom): Rename to + local_hex_string_custom. + * language.h (local_hex_string): Change parameter type to LONGEST. + (local_hex_string_custom): Ditto. + (longest_local_hex_string): Delete declaration. + (longest_local_hex_string_custom): Ditto. + + * solib.c: Update copyright. + * memattr.c: Update copyright. + +2002-05-11 Andrew Cagney + + * arch-utils.h (legacy_register_to_value): Declare. + (legacy_value_to_register): Declare. + (legacy_convert_register_p): Declare. + * arch-utils.c (legacy_register_to_value): New function. + (legacy_value_to_register): New function. + (legacy_convert_register_p): New function. + + * gdbarch.sh (REGISTER_TO_VALUE): Define. + (VALUE_TO_REGISTER): Define. + (CONVERT_REGISTER_P): Define. + * gdbarch.h, gdbarch.c: Regenerate. + + * valops.c (value_assign): Use CONVERT_REGISTER_P and + VALUE_TO_REGISTER. + * findvar.c (value_from_register): Use REGISTER_TO_VALUE and + CONVERT_REGISTER_P. + +2005-05-11 Daniel Jacobowitz + Peter Schauer + + * Makefile.in: Update dependencies for valops.c. + * valops.c: Include "gdb_assert.h". + (typecmp): Skip THIS parameter to methods. + (find_method_list): Remove static_memfuncp argument, + update callers. Check for stub methods. + (find_value_oload_method_list): Don't set *static_memfuncp. + (find_overload_match): Don't check for stub methods. Assert + that methods are not stubbed. Handle static methods. + (value_find_oload_method_list): Remove static_memfuncp argument. + * gdbtypes.c (check_stub_method): Do not add THIS pointer + to the argument list for static stub methods. + * value.h (value_find_oload_method_list): Update prototype. + +2002-05-11 Andrew Cagney + + * arch-utils.h (generic_register_size): Declare. + (generic_register_raw_size, generic_register_virtual_size): Delete + declarations. + * arch-utils.c (generic_register_raw_size): Delete. + (generic_register_size): New function. + (generic_register_virtual_size): Delete. + + * gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Make + default generic_register_size. + * gdbarch.h, gdbarch.c: Re-generate. + + * d10v-tdep.c (d10v_gdbarch_init): Use generic_register_size for + register_virtual_size. + * x86-64-tdep.c (x86_64_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + +2002-05-11 Andrew Cagney + + * gdbarch.sh (gdbarch_data): Add gdbarch parameter. + * gdbarch.h, gdbarch.c: Regenerate. + * gnu-v3-abi.c: Update copyright. + (vtable_address_point_offset): Update. + (gnuv3_rtti_type): Update. + (gnuv3_baseclass_offset): Update. + * solib-svr4.c (svr4_fetch_link_map_offsets): Update. + (init_fetch_link_map_offsets): Update. + * remote.c (get_remote_state): Update. + +2002-05-11 Daniel Jacobowitz + + * TODO: Remove value_headof/value_from_vtable_info comment. + * printcmd.c (print_command_1): Don't call value_from_vtable_info. + * values.c (value_headof, value_from_vtable_info): Delete. + * value.h (value_from_vtable_info): Delete prototype. + +2002-05-11 Andrew Cagney + + * Makefile.in: Replace gdb_assert.h with $(gdb_assert_h), + gdb_string.h with $(gdb_string_h) and gdb_regex.h with + $(gdb_regex_h). + (gdb_assert_h): Define. + (gdb_wait_h): Define. + (gdb_regex_h): Define. + +2002-05-11 Daniel Jacobowitz + + From Peter Schauer : + * linespec.c (find_methods): Handle GCC 3.x template constructors. + +2002-05-11 Jason Thorpe + + * nbsd-tdep.c: Fix comment. + +2002-05-11 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Add nbsd-tdep.c. + (alphanbsd-tdep.o): Add nbsd-tdep.h to dependency list. + (nbsd-tdep.o): New dependency list. + * alphanbsd-tdep.c: Don't include solib-svr4.h. Include + nbsd-tdep.h. + (alphanbsd_solib_svr4_fetch_link_map_offsets): Remove. + (alphanbsd_init_abi): Use nbsd_lp64_solib_svr4_fetch_link_map_offsets. + * nbsd-tdep.c: New file. + * nbsd-tdep.h: New file. + * shnbsd-tdep.c: Don't include solib-svr4.h. Include + nbsd-tdep.h. + (shnbsd_solib_svr4_fetch_link_map_offsets): Remove. + (shnbsd_init_abi): Use nbsd_ilp32_solib_svr4_fetch_link_map_offsets. + * config/alpha/nbsd.mt (TDEPFILES): Add nbsd-tdep.o. + * config/sh/nbsd.mt (TDEPFILES): Ditto. + +2002-05-11 Jason Thorpe + + * config/alpha/nbsd.mh (NATDEPFILES): Remove corelow.o. + * config/alpha/nbsd.mt (TDEPFILES): Add corelow.o. + * config/i386/nbsd.mh (NATDEPFILES): Remove corelow.o. + * config/i386/nbsd.mt (TDEPFILES): Add corelow.o. + * config/i386/nbsdelf.mh (NATDEPFILES): Remove corelow.o. + * config/i386/nbsdelf.mt (TDEPFILES): Add corelow.o. + +2002-05-11 Jason Thorpe + + * config/i386/nbsd.mh (NATDEPFILES): Use line continuations. + * config/i386/nbsdelf.mh (NATDEPFILES): Likewise. + * config/m68k/nbsd.mh (NATDEPFILES): Likewise. + * config/ns32k/nbsd.mh (NATDEPFILES): Likewise. + * config/powerpc/nbsd.mh (NATDEPFILES): Likewise. + * config/sparc/nbsd.mh (NATDEPFILES): Likewise. + * config/sparc/nbsdelf.mh (NATDEPFILES): Likewise. + +2002-05-11 Jason Thorpe + + * i386nbsd-nat.c: Delete file. Move fetch_core_registers and + fetch_elfcore_registers to... + * i386nbsd-tdep.c: ...here. + (i386nbsd_use_struct_convention): Rename to... + (i386nbsd_aout_use_struct_convention): ...this. + (i386nbsd_supply_reg): New function. + (i386nbsd_fill_reg): New function. + (fetch_core_registers): Use i386nbsd_supply_reg. + (fetch_elfcore_registers): Likewise. + (_initialize_i386nbsd_tdep): New function. + * config/i386/nbsd.mh (NATDEPFILES): Remove i386nbsd-nat.o. + * config/i386/nbsdelf.mh (NATDEPFILES): Likewise. + * config/i386/nbsdelf.mt (TDEPFILES): Add i386nbsd-tdep.o. + * config/i386/tm-nbsd.h (i386nbsd_use_struct_convention): Rename to... + (i386nbsd_aout_use_struct_convention): ...this. + +2002-05-11 Jason Thorpe + + * shnbsd-nat.c (fetch_inferior_registers): Use shnbsd_supply_reg. + (store_inferior_registers): Use shnbsd_fill_reg. + * shnbsd-tdep.c (sh_nbsd_supply_registers, + sh_nbsd_supply_register): Collapse into... + (shnbsd_supply_reg): ...this. + (sh_nbsd_fill_registers, sh_nbsd_fill_register): Collapse into... + (shnbsd_fill_reg): ...this. + (sh_nbsd_solib_svr4_fetch_link_map_offsets): Rename to... + (shnbsd_solib_svr4_fetch_link_map_offsets): ...this. + (fetch_core_registers): Use shnbsd_supply_reg. + (fetch_elfcore_registers): Use shnbsd_supply_reg. + (sh_nbsd_core_fns): Rename to... + (shnbsd_core_fns): ...this. + (sh_nbsd_elfcore_fns): Rename to... + (shnbsd_elfcore_fns): ...this. + (sh_nbsd_init_abi): Rename to... + (shnbsd_init_abi): ...this. + (_initialize_sh_nbsd_tdep): Rename to... + (_initialize_shnbsd_tdep): ...this. + * shnbsd-tdep.h (sh_nbsd_supply_registers, + sh_nbsd_supply_register, sh_nbsd_fill_registers, + sh_nbsd_fill_register): Remove prototypes. + (shnbsd_supply_reg, shnbsd_fill_reg): Add prototypes. + +2002-05-11 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Remove i387-nat.c. + (i387-nat.o): Delete dependency list. + (go32-nat.o): Change i387-nat.h to i387-tdep.h. + (x86-64-linux-nat.o): Likewise. + * i387-nat.c: Delete file, moving contents to... + * i387-tdep.c: ...here. + * i387-nat.h: Rename... + * i387-tdep.h: ...to this. + * go32-nat.c: Include i387-tdep.h instead of i387-nat.h. + * i386-linux-nat.c: Likewise. + * i386bsd-nat.c: Likewise. + * i386gnu-nat.c: Likewise. + * i386nbsd-nat.c: Likewise. + * i386v4-nat.c: Likewise. + * x86-64-linux-nat.c: Likewise. + * config/i386/fbsd.mh (NATDEPFILES): Remove i387-nat.o. + * config/i386/go32.mh (NATDEPFILES): Likewise. + * config/i386/i386gnu.mh (NATDEPFILES): Likewise. + * config/i386/i386sol2.mh (NATDEPFILES): Likewise. + * config/i386/i386v42mp.mh (NATDEPFILES): Likewise. + * config/i386/linux.mh (NATDEPFILES): Likewise. + * config/i386/nbsd.mh (NATDEPFILES): Likewise. + * config/i386/nbsdelf.mh (NATDEPFILES): Likewise. + * config/i386/obsd.mh (NATDEPFILES): Likewise. + * config/i386/x86-64linux.mh (NATDEPFILES): Likewise. + +2002-05-11 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Remove alphanbsd-nat.c. + (alphanbsd-nat.o): Remove dependency list. + (alphanbsd-tdep.o): Add $(regcache_h) to dependency list. + * alphanbsd-nat.c: Delete. Contents moved to... + * alphanbsd-tdep.c: ...here. + (_initialize_alphanbsd_tdep): Register core functions. + * config/alpha/nbsd.mh (NATDEPFILES): Remove alphanbsd-nat.o. + +2002-05-11 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Add alphabsd-tdep.c. + (alphabsd-nat.o): Depend on alphabsd-tdep.h. + (alphanbsd-nat.o): Likewise. + (alphabsd-tdep.o): New dependency list. + * alphabsd-nat.c (supply_gregset): Use alphabsd_supply_reg. + (fill_gregset): Use alphabsd_fill_reg. + (supply_fpregset): Use alphabsd_supply_fpreg. + (fill_fpregset): Use alphabsd_fill_fpreg. + (fetch_inferior_registers): Use struct reg and struct fpreg + rather than gregset_t and fpregset_t. Use alphabsd_supply_reg + and alphabsd_supply_fpreg. + (store_inferior_registers): Use struct reg and struct fpreg + rather than gregset_t and fpregset_t. Use alphabsd_fill_reg + and alphabsd_fill_fpreg. + * alphabsd-tdep.c: New file. + * alphabsd-tdep.h: New file. + * alphanbsd-nat.c (fetch_core_registers): Use alphabsd_supply_fpreg. + (fetch_elfcore_registers): Use alphabsd_supply_reg and + alphabsd_supply_fpreg. + * config/alpha/fbsd.mt (TDEPFILES): Add alphabsd-tdep.o. + * config/alpha/nbsd.mt (TDEPFILES): Likewise. + +2002-05-11 Eric Christopher + + * mips-tdep.c (mips_double_register_type): Fix thinko. + (mips_single_register_type): Ditto. + * MAINTAINERS: Add self. + +2002-05-11 Mark Kettenis + + * i387-nat.c (i387_supply_register, i387_fill_fsave, + i387_supply_fxsave, i387_fill_fxsave): Rewrite in order to do the + right thing on architectures with different endianness and/or + integer sizes. + +2002-05-10 Jason Thorpe + + From Christian Limpach + * configure.in: Change sed expression which comments out + NATDEPFILES to also comment out continuation lines. + * configure: Regenerate. + +2002-05-10 Elena Zannoni + + * sh-tdep.c: Clean up code erroneously reintroduced by previous + big patch. + +2002-05-10 Elena Zannoni + + * sh-tdep.c: Include correct file. + +2002-05-10 Elena Zannoni + + New support for sh64-elf (sh5) target. + + * configure.tgt: For sh64-elf target, default to sh-elf. + + * config/sh/tm-sh.h (enum sh-abi): Possible ABI's. + (struct gdbarch_tdep): Add new fields for new registers and ABI + info. + + * sh-tdep.c: Include elf-bfd.h, elf/sh.h, gdb/sim-sh.h. + (NUM_PSEUDO_REGS_SH_MEDIA, NUM_PSEUDO_REGS_SH_COMPACT, + MSYMBOL_IS_SPECIAL, IS_ISA32_ADDR, MAKE_ISA32_ADDR, + UNMAKE_ISA32_ADDR, IS_PTABSL_R18, IS_STS_R0, IS_STS_PR, + IS_MOV_TO_R15, IS_MOV_R14, IS_STQ_R18_R14, IS_STQ_R18_R15, + IS_STL_R18_R15, IS_STQ_R14_R15, IS_STL_R14_R15, IS_ADDIL_SP_MEDIA, + IS_ADDI_SP_MEDIA, IS_ADDL_SP_FP_MEDIA, IS_ADD_SP_FP_MEDIA, + IS_MOV_SP_FP_MEDIA, IS_MOV_R0, IS_MOVL_R0, IS_ADD_SP_R0, + IS_MOV_R14_R0, IS_MEDIA_IND_ARG_MOV, IS_MEDIA_ARG_MOV, + IS_MEDIA_MOV_TO_R14, IS_COMPACT_IND_ARG_MOV, IS_COMPACT_ARG_MOV, + IS_COMPACT_MOV_TO_R14, IS_JSR_R0, IS_NOP): New macros. + (sh_sh64_register_name, sh64_elf_make_msymbol_special, + pc_is_isa32, sh_sh64_breakpoint_from_pc, look_for_args_moves, + sh64_skip_prologue_hard_way, sh64_use_struct_convention, + gdb_print_insn_sh64, translate_insn_rn, sh64_frame_chain, + sh64_get_saved_pr, fpp_reg_base_num, is_media_pseudo, + sh64_get_gdb_regnum, sh64_media_reg_base_num, + sh64_compact_reg_base_num, translate_rn_to_arch_reg_num, + sign_extend, sh64_nofp_frame_init_saved_regs, + sh64_init_extra_frame_info, sh64_get_saved_register, + sh64_extract_struct_value_address, sh64_pop_frame, + sh64_push_arguments, sh64_extract_return_value, + sh64_store_return_value, sh64_show_media_regs, + sh64_show_compact_regs, sh64_show_regs, sh_sh64_register_byte, + sh_sh64_register_raw_size, sh_sh64_register_virtual_size, + sh_sh64_register_virtual_type, + sh_sh64_register_convert_to_virtual, + sh_sh64_register_convert_to_raw, sh64_pseudo_register_read, + sh64_register_read, sh64_pseudo_register_write, + sh64_register_write, do_fv_c_register_info, do_dr_c_register_info, + do_r_c_register_info, do_fpp_register_info, do_cr_c_register_info, + sh64_do_pseudo_register, sh_compact_do_registers_info, + sh64_do_registers_info, sh_gdbarch_init): New functions. + +2002-05-10 Elena Zannoni + + * sh-tdep.c (sh_breakpoint_from_pc): Add 'const' to return type. + +2002-05-10 Daniel Jacobowitz + + * linespec.c (decode_line_1): Check for a double quote after + a filename correctly. + +2002-05-10 Jim Blandy + + Properly track the size of the current objfile's .debug_line section. + * dwarf2read.c (struct dwarf2_pinfo): New member: dwarf_line_size. + (DWARF_LINE_SIZE): New macro. + (dwarf2_build_psymtabs_hard): Record the line section's size in + the partial symbol table. + (psymtab_to_symtab_1): Restore dwarf_line_size from the partial + symbol table. + +2002-05-10 Petr Sorfa + + * ia64-tdep.c: Handle breakpoints on L instruction type + in MLX instruction bundle by moving the breakpoint to + the third slot (X instruction type) as L holds only data. + +2002-05-10 Kevin Buettner + + * dbxread.c (discarding_local_symbols_complaint): New complaint. + (process_one_symbol): Complain about discarding local symbols + due to a misplaced N_LBRAC entry. + +2002-05-09 Elena Zannoni + + From Daniel Berlin + * linespec.c (find_toplevel_char): '<' and '>' also increase and + decrease the depth we are at, in the case of templates. + +2002-05-09 Daniel Jacobowitz + + * mips-tdep.c (mips_float_register_type): New function. + (mips_double_register_type): New function. + (mips_print_register): Use them. + (do_fp_register_row): Likewise. + +2002-05-09 Daniel Jacobowitz + + * signals/signals.c (signals): Remove conditional compilation around + Mach-specific signals. Move them to after TARGET_SIGNAL_DEFAULT. + (target_signal_from_name): Loop until TARGET_SIGNAL_LAST. + +2002-05-09 Michael Snyder + + * remote-rdp.c (remote_rdp_can_run): Remove. + +2002-05-09 Tom Tromey + + * jv-valprint.c (java_val_print): Handle `char' as a special case + of TYPE_CODE_INT. + +2002-05-09 Michael Snyder + + * arm-tdep.c (arm_scan_prologue): Accept strb r(0123),[r11,#-nn], + strh r(0123),[r11,#-nn], str r(0123),[r11,#-nn], as well as + strb r(0123),[sp,#nn], strh r(0123),[sp,#nn] and + str r(0123),[sp,#nn]. + (arm_skip_prologue): Ditto. Also make disassembly + order-independent by placing it in a loop. + +2002-05-06 Michael Snyder + + * stabsread.c (read_type): Add recognition for new attribute: + "@V;" means that an array type is actually a vector. + This is analogous to the vector flag that's been added to dwarf2. + +2002-05-09 Mark Kettenis + + * i386-tdep.h (i386_abi): New enum. + (struct gdbarch_tdep): Replace os_ident member with abi. + (i386_gdbarch_register_os_abi): New prototype. + * i386-tdep.c (i386_abi_names): New array. + (process_note_abi_tag_sections): Removed. + (process_note_sections): New function. + (i386_elf_abi_from_note, i386_elf_abi): New functions. + (struct i386_abi_handler): New struct. + (i386_abi_handler_list): New variable. + (i386_gdbarch_register_os_abi): New function. + (i386_gdbarch_init): Adapt for the changes given above. + +2002-05-08 Daniel Jacobowitz + + * gregset.h: Say "GNU/Linux". + +2002-05-08 Elena Zannoni + + * gdbtypes.c : Add new builtin type for 64 bit vectors. + (build_gdbtypes): Build builtin_type_v2_float. + (_initialize_gdbtypes): Register new builtin type. + +2002-05-08 Andrew Cagney + + * gdbarch.sh (init_gdbarch_swap): Do not clear the swap section. + (clear_gdbarch_swap): New function. + (initialize_non_multiarch): Call. + (gdbarch_update_p): Before calling init(), swap out and clear the + existing architecture. + * gdbarch.c: Regenerate. + +2002-05-08 Jason Thorpe + + * config/djgpp/fnchange.lst: Add alphanbsd-nat.c and + alphanbsd-tdep.c. + +2002-05-08 Jason Thorpe + + * sh-nbsd-nat.c: Rename to... + * shnbsd-nat.c: ...this. + * sh-nbsd-tdep.c: Rename to... + * shnbsd-tdep.c: ...this. + * sh-nbsd-tdep.h: Rename to... + * shnbsd-tdep.h: ...this. + * config/sh/nbsd.mh: Use shnbsd-nat.o. + * config/sh/nbsd.mt: Use shnbsd-tdep.o. + +2002-05-08 Richard Earnshaw + + * remote-rdi.c (_initializie_remote_rdi): Use ANSI-style string + concatenation for command help messages. + +2002-05-08 Jason Thorpe + + * NEWS: Note new sh*-*-netbsdelf* configuration. + * configure.host: Set gdb_host_cpu to sh for all sh*. + (sh*-*-netbsdelf*): New host. + * configure.tgt: Set gdb_target_cpu to sh for all sh*. + (sh*-*-netbsdelf*): New target. + * sh-nbsd-nat.c: New file. + * sh-nbsd-tdep.c: New file. + * sh-nbsd-tdep.h: New file. + * config/sh/nbsd.mh: New file. + * config/sh/nbsd.mt: New file. + * config/sh/nm-nbsd.h: New file. + * config/sh/tm-nbsd.h: New file. + +2002-05-08 Jason Thorpe + + * sh-tdep.c (sh_osabi_names): Declare. + (process_note_abi_tag_sections): New function. + (get_elfosabi): Ditto. + (sh_gdbarch_register_os_abi): Ditto. + (sh_dump_tdep): Ditto. + _initialize_sh_tdep): Use gdbarch_register to register + sh_gdbarch_init and sh_dump_tdep. + * config/sh/tm-sh.h (sh_osabi): Declare. + (gdbarch_tdep): Add sh_osabi and osabi_name members. + +2002-05-07 Andrew Cagney + + * arm-tdep.c (arm_skip_prologue): Handle generic dummy frames. + (thumb_scan_prologue): Ditto. + (arm_find_callers_reg): Ditto. + (arm_frame_chain): Ditto. + (arm_init_extra_frame_info): Ditto. + (arm_frame_saved_pc): Ditto. + (arm_pop_frame): Ditto. + (arm_push_return_address): New function. + (arm_gdbarch_init): Initialize use_generic_dummy_frames, + call_dummy_location, call_dummy_breakpoint_offset_p, + call_dummy_breakpoint_offset, call_dummy_p, + call_dummy_stack_adjust_p, call_dummy_words, + sizeof_call_dummy_words, call_dummy_start_offset, + call_dummy_length, fix_call_dummy, pc_in_call_dummy, + call_dummy_address, push_return_address and push_dummy_frame for + generic dummy frames. + +2002-05-07 Jason Thorpe + + * sh-tdep.c (sh_nofp_frame_init_saved_regs): Fix error in + size computation for alloca. + (sh_fp_frame_init_saved_regs): Likewise. + +2002-05-07 Richard Earnshaw + + * arm-tdep.h (ARM_MAX_REGISTER_RAW_SIZE): Define. + (ARM_MAX_REGISTER_VIRTUAL_SIZE): Define. + * arm-tdep.c (arm_store_return_value): Use them. + Use FP_REGISTER_RAW_SIZE when setting the FPA return value. + * remote-rdp.c (remote_rdp_fetch_register): Use + ARM_MAX_REGISTER_RAW_SIZE. + (remote_rdp_store_register): Likewise. + +2002-05-07 Michal Ludvig + + * dwarf2cfi.c: Code cleanup, removed unused variables, + added default labels to switch {} statements. + * x86-64-tdep.c: Ditto. + * x86-64-linux-nat.c: Ditto. + +2002-05-07 Jason Thorpe + + * solib.h: Protect against multiple inclusion. + 2002-05-06 Jim Blandy + Add first preprocessor macro-expansion files. + * macroexp.c, macroexp.h, macrotab.c, macrotab.h: New files. + * Makefile.in (SFILES): Add macrotab.c, macroexp.c. + (splay_tree_h, macroexp_h, macrotab_h): New variable. + (HFILES_NO_SRCDIR): Add macrotab.h, macroexp.h. + (COMMON_OBS): Add macrotab.o, macroexp.o. + (macroexp.o, macrotab.o): New rules. + Separate the job of reading the line number info statement program header (...expialidocious) out into its own function. * dwarf2read.c (struct line_head, struct filenames, struct @@ -229,12 +990,12 @@ * p-lang.h (is_pascal_string_type): Declaration changed, new sixth argument of type char ** added. - * p-lang.c (is_pascal_string_type): Implementation + * p-lang.c (is_pascal_string_type): Implementation changed. Args length_pos, length_size, string_pos, char_size can now be NULL. New argument arrayname set to the field name of the char array. Return value set to char array field index plus one. - * p-valprint.c (pascal_val_print): Adapt to new declaration of + * p-valprint.c (pascal_val_print): Adapt to new declaration of is_pascal_string_type function. 2002-05-02 Andrew Cagney @@ -300,7 +1061,7 @@ * x86-64-linux-nat.c (fill_gregset): Explicit cast to avoid warning. * x86-64-tdep.c (i386_gdbarch_init): Ditto. (x86_64_register_info_table): Added comments with register numbers. - + 2002-04-29 Elena Zannoni * rs6000-tdep.c (rs6000_extract_return_value, @@ -313,7 +1074,7 @@ vectors. (ppc_sysv_abi_push_arguments): Handle vector parameters. * ppc-tdep.h (ppc_sysv_abi_broken_use_struct_convention): Export. - + 2002-04-24 Pierre Muller * hpread.c (hpread_psymtab_to_symtab_1, @@ -323,7 +1084,7 @@ 2002-04-24 Pierre Muller * remote-array.c (printf_monitor, write_monitor, - array_insert_breakpoint, array_remove_breakpoint ): + array_insert_breakpoint, array_remove_breakpoint ): Replace fprintf (stderr,... with fprintf_unfiltered (gdb_stderr,.... * remote-es.c: Likewise. @@ -378,7 +1139,7 @@ 2002-04-26 Andrew Cagney - * stack.c (selected_frame_level): + * stack.c (selected_frame_level): (select_frame): Do not set selected_frame_level. * frame.h (selected_frame_level): Delete declaration. @@ -611,10 +1372,10 @@ 2002-04-24 Michael Snyder - * arm-tdep.c (arm_scan_prologue): Move "mov ip, sp" into the + * arm-tdep.c (arm_scan_prologue): Move "mov ip, sp" into the loop. Add handling for "str lr, [sp, #-4]!" and for saves of argument regs ("str r(0123), [r11, #-nn"]). - (arm_skip_prologue): Better handling for frameless functions. + (arm_skip_prologue): Better handling for frameless functions. Treat "mov ip, sp" as optional. Recognize "str lr, [sp, #-4]". (arm_skip_prologue): Recognize str r(0123), [r11, #-nn]. @@ -652,7 +1413,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney 2002-04-24 Michal Ludvig * gdbserver/linux-low.c (regsets_fetch_inferior_registers), - (regsets_store_inferior_registers): Removed cast to int from + (regsets_store_inferior_registers): Removed cast to int from ptrace() calls. * gdbserver/regcache.h: Added declaration of struct inferior_info. @@ -697,7 +1458,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney 2002-04-22 H.J. Lu (hjl@gnu.org) * c-exp.y (typebase): Support - + [long|long long|short] [signed|unsigned] [int|] and @@ -800,7 +1561,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney (supply_gregset): Likewise. 2002-04-22 J. Brobecker - + * symfile.h (get_section_index): Define. * symfile.c (get_section_index): New function. * mdebugread.c (SC_IS_SBSS): New macro. @@ -1001,7 +1762,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney * gdbarch.sh (gdbarch_update_p): Keep the list of architectures sorted in most most-recent-used order. Document. * gdbarch.h, gdbarch.c: Regenerate. - + 2002-04-20 Daniel Jacobowitz * gdbserver/inferiors.c (struct inferior_info): Add regcache_data. @@ -1086,7 +1847,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney * gdbarch.sh (BREAKPOINT_FROM_PC): Return a const buffer. * gdbarch.h, gdbarch.c: Regenerate. - + * defs.h (breakpoint_from_pc_fn): Delete type definition. * target.h (memory_breakpoint_from_pc): Update declaration. * config/mcore/tm-mcore.h (mcore_breakpoint_from_p): Ditto. @@ -1149,9 +1910,9 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney * gdbarch.sh (LANG): Set to ``c''. 2002-04-15 Andrew Cagney - + * PROBLEMS: Mention hppa2.0-hp-hpux10.20 compile problems. - + 2002-04-15 Andrew Cagney * bcache.c: Include and after "defs.h". @@ -1159,13 +1920,13 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney * hpread.c (hpread_get_lntt): Add declaration. Also fix PR gdb/391. - + 2002-04-14 Andrew Cagney * acinclude.m4 (AM_PROG_CC_STDC): Import from automake 1.6. * aclocal.m4, configure: Re-generate. Fix PR gdb/391. - + 2002-04-14 Elena Zannoni * mi/mi-cmd-disas.c (dump_insns): Use TARGET_PRINT_INSN @@ -1316,7 +2077,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney (PTRACE_XFER_TYPE): Moved here from config/i386/nm-x86-64.h. 2002-04-04 Jim Ingham - + * valarith.c (find_size_for_pointer_math): New function, either returns the size for a pointer's target, returns 1 for void *, or errors for incomplete types. @@ -1424,7 +2185,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney * parser-defs.h (num_std_regs, std_regs, struct std_regs): Delete declarations. Update copyright. Fix PR gdb/251. - + 2002-04-09 Daniel Jacobowitz * gdbserver/Makefile.in: Add stamp-h target. @@ -1709,7 +2470,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney whether breakpoints need to be removed from overlay load addr. Handle bp_hardware_breakpoint as well as bp_breakpoint. (bpstat_stop_status): Handle bp_hardware_breakpoint in overlays. - (create_overlay_event_breakpoint, enable_overlay_breakpoints, + (create_overlay_event_breakpoint, enable_overlay_breakpoints, disable_overlay_breakpoints): Update overlay_events_enabled. 2002-04-04 Daniel Jacobowitz @@ -1726,14 +2487,14 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney 2002-04-04 Michal Ludvig - * x86-64-linux-nat.c (child_xfer_memory): x86-64 ptrace() ABI + * x86-64-linux-nat.c (child_xfer_memory): x86-64 ptrace() ABI change sync with glibc. 2002-04-03 Jim Blandy * configure.in: Call AC_C_INLINE. * configure: Regenerated. - + 2002-04-01 Daniel Jacobowitz * rs6000-tdep.c: Change #include of "bfd/libcoff.h" @@ -1759,7 +2520,7 @@ Wed Apr 24 14:22:21 2002 Andrew Cagney 2002-03-26 Michael Snyder Andrew Cagney - * cli/cli-dump.c: New file. Dump memory to file, + * cli/cli-dump.c: New file. Dump memory to file, restore file to memory. * cli/cli-dump.h: New file. * Makefile.in: Add rules, dependencies for cli-dump.o. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index fbfaa8b..0a4236c 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -154,7 +154,7 @@ maintainer works with the native maintainer when resolving API issues. s390 --target=s390-linux ,-Werror (contact DJ Barrow djbarrow@de.ibm.com) - sh --target=sh-hms,sh-elf -w + sh --target=sh-elf ,-Werror Elena Zannoni ezannoni@redhat.com sparc --target=sparc-elf,sparc64-elf ,-Werror @@ -397,6 +397,7 @@ Corinna Vinschen vinschen@redhat.com Keith Walker keith.walker@arm.com Michal Ludvig mludvig@suse.cz David S. Miller davem@redhat.com +Eric Christopher echristo@redhat.com diff --git a/gdb/Makefile.in b/gdb/Makefile.in index de30f43..e6d43ad 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -539,6 +539,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.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 \ printcmd.c remote.c remote-nrom.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 \ @@ -568,9 +569,11 @@ getopt_h = $(INCLUDE_DIR)/getopt.h floatformat_h = $(INCLUDE_DIR)/floatformat.h bfd_h = $(BFD_DIR)/bfd.h dis_asm_h = $(INCLUDE_DIR)/dis-asm.h -remote-sim_h = $(INCLUDE_DIR)/remote-sim.h +remote_sim_h = $(INCLUDE_DIR)/remote-sim.h demangle_h = $(INCLUDE_DIR)/demangle.h obstack_h = $(INCLUDE_DIR)/obstack.h +sim_d10v_h = $(INCLUDE_DIR)/sim-d10v.h +splay_tree_h = $(INCLUDE_DIR)/splay-tree.h readline_headers = \ $(READLINE_SRC)/chardefs.h \ @@ -620,9 +623,12 @@ event_top_h = event-top.h expression_h = expression.h $(doublest_h) $(symtab_h) frame_h = frame.h gdb_h = gdb.h +gdb_assert_h = gdb_assert.h gdb_events_h = gdb-events.h gdb_stabs_h = gdb-stabs.h gdb_string_h = gdb_string.h +gdb_wait_h = gdb_wait.h +gdb_regex_h = gdb_regex.h gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h) gdbcore_h = gdbcore.h $(bfd_h) gdbthread_h = gdbthread.h $(breakpoint_h) @@ -631,6 +637,8 @@ inf_loop_h = inf-loop.h inferior_h = inferior.h $(breakpoint_h) language_h = language.h linespec_h = linespec.h +macroexp_h = macroexp.h +macrotab_h = macrotab.h $(obstack_h) $(bcache_h) memattr_h = memattr.h monitor_h = monitor.h objfiles_h = objfiles.h @@ -669,6 +677,7 @@ HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h coff-solib.h defs.h \ gdb-stabs.h $(inferior_h) language.h minimon.h monitor.h \ objfiles.h parser-defs.h serial.h solib.h \ symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \ + macrotab.h macroexp.h \ c-lang.h ch-lang.h f-lang.h \ jv-lang.h \ m2-lang.h p-lang.h \ @@ -711,6 +720,7 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.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 \ + macrotab.o macroexp.o \ event-loop.o event-top.o inf-loop.o completer.o \ gdbarch.o arch-utils.o gdbtypes.o copying.o $(DEPFILES) \ memattr.o mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \ @@ -1178,9 +1188,9 @@ unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET : ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ 29k-share/udi/udi2go32.c \ a29k-tdep.c a68v-nat.c \ - alpha-nat.c alphabsd-nat.c alphanbsd-nat.c \ - alpha-tdep.c alpha-linux-tdep.c alphanbsd-tdep.c alpha-osf1-tdep.c \ - alphafbsd-tdep.c \ + alpha-nat.c alphabsd-nat.c \ + alpha-tdep.c alpha-linux-tdep.c alphabsd-tdep.c alphanbsd-tdep.c \ + alpha-osf1-tdep.c alphafbsd-tdep.c \ arm-linux-nat.c arm-linux-tdep.c arm-tdep.c \ armnbsd-nat.c armnbsd-tdep.c \ avr-tdep.c \ @@ -1192,7 +1202,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ i386-tdep.c i386b-nat.c i386mach-nat.c i386v-nat.c i386-linux-nat.c \ i386aix-nat.c i386m3-nat.c i386v4-nat.c i386ly-tdep.c \ i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c \ - i387-tdep.c i387-nat.c \ + i387-tdep.c \ i386-linux-tdep.c i386-nat.c \ i960-tdep.c \ ia64-linux-nat.c ia64-linux-tdep.c ia64-tdep.c \ @@ -1205,6 +1215,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ mips-linux-nat.c mips-linux-tdep.c \ mips-nat.c \ mips-tdep.c mipsm3-nat.c mipsv4-nat.c \ + nbsd-tdep.c \ nindy-share/Onindy.c nindy-share/nindy.c \ nindy-share/ttyflush.c nindy-tdep.c \ ns32k-tdep.c solib-osf.c \ @@ -1246,10 +1257,7 @@ alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \ $(regcache_h) alpha-tdep.h alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ - alpha-tdep.h - -alphanbsd-nat.o: alphanbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ - $(gdbcore_h) alpha-tdep.h + alpha-tdep.h alphabsd-tdep.h alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(symtab_h) $(dis_asm_h) $(gdb_string_h) $(linespec_h) \ @@ -1259,10 +1267,12 @@ alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(value_h) alpha-tdep.h alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) alpha-tdep.h +alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_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) $(value_h) \ - alpha-tdep.h +alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ + $(value_h) alpha-tdep.h alphabsd-tdep.h nbsd-tdep.h annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) $(gdbtypes_h) @@ -1297,7 +1307,10 @@ breakpoint.o: breakpoint.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(completer_h) $(gdb_h) buildsym.o: buildsym.c $(bfd_h) $(buildsym_h) $(complaints_h) $(defs_h) \ - $(objfiles_h) $(symfile_h) $(symtab_h) $(gdb_string_h) + $(objfiles_h) $(symfile_h) $(symtab_h) $(gdb_string_h) \ + $(obstack_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ + $(language_h) $(bcache_h) $(filenames_h) $(stabsread_h) \ + $(macrotab_h) builtin-regs.o: builtin-regs.c $(defs.h) $(builtin_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(value_h) $(frame_h) @@ -1313,7 +1326,7 @@ c-valprint.o: c-valprint.c $(defs_h) $(expression_h) $(gdbtypes_h) \ $(language_h) $(symtab_h) $(valprint_h) $(value_h) $(cp_abi_h) doublest.o: doublest.c $(defs_h) $(doublest_h) $(floatformat_h) $(gdbtypes_h) \ - gdb_assert.h gdb_string.h + $(gdb_assert_h) $(gdb_string_h) f-lang.o: f-lang.c f-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \ $(language_h) $(parser_defs_h) $(symtab_h) $(gdb_string_h) @@ -1381,6 +1394,11 @@ cp-valprint.o: cp-valprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \ dcache.o: dcache.c $(dcache_h) $(defs_h) $(gdbcmd_h) $(gdb_string_h) \ $(gdbcore_h) $(target_h) +d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(obstack_h) $(symtab_h) \ + $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \ + $(inferior_h) $(dis-asm_h) $(symfile_h) $(objfiles_h) $(language_h) \ + $(arch_utils_h) $(regcache_h) $(floatformat_h) $(sim_d10v_h) + dbxread.o: dbxread.c $(breakpoint_h) $(buildsym_h) $(command_h) \ $(complaints_h) $(defs_h) $(expression_h) $(gdb_stabs_h) $(gdbcore_h) \ $(gdbtypes_h) $(language_h) $(objfiles_h) \ @@ -1391,7 +1409,7 @@ delta68-nat.o: delta68-nat.c $(defs_h) demangle.o: demangle.c $(defs_h) $(gdbcmd_h) $(gdb_string_h) -dink32-rom.o: dink32-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \ +dink32-rom.o: dink32-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \ $(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h) \ $(symfile_h) $(regcache_h) @@ -1443,7 +1461,7 @@ frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \ regcache.o: regcache.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h) -fork-child.o: fork-child.c gdb_wait.h $(defs_h) $(gdbcore_h) \ +fork-child.o: fork-child.c $(gdb_wait_h) $(defs_h) $(gdbcore_h) \ $(inferior_h) $(target_h) $(terminal_h) $(gdbthread_h) $(gdb_string_h) install-gdbtk: @@ -1548,17 +1566,24 @@ tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(tracepoint_h) \ $(language_h) $(gdb_string_h) $(readline_headers) $(remote_h) \ $(linespec_h) $(regcache_h) $(completer_h) -gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h) +gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h) $(gdb_string_h) \ + $(symtab_h) $(frame_h) $(inferior_h) $(breakpoint_h) $(gdb_wait_h) \ + $(gdbcore_h) $(target_h) $(gdbthread_h) $(annotate_h) $(symfile_h) \ + $(value_h) $(symcat_h) $(floatformat_h) $(gdb_assert_h) \ + $(gdb_events_h) arch-utils.o: arch-utils.c $(defs_h) $(bfd_h) $(gdbcmd_h) \ - $(arch_utils_h) gdb_assert.h + $(arch_utils_h) $(gdb_assert_h) $(inferior_h) \ + $(gdb_string_h) $(symtab.h) $(frame_h) $(breakpoint_h) $(gdb_wait_h) \ + $(gdbcore_h) $(target_h) $(annotate_h) $(regcache_h) $(gdb_assert_h) \ + $(version_h) $(floatformat_h) gdbtypes.o: gdbtypes.c $(bfd_h) $(complaints_h) $(defs_h) $(expression_h) \ $(gdbtypes_h) $(language_h) $(objfiles_h) $(symfile_h) $(symtab_h) \ $(target_h) $(value_h) $(gdb_string_h) $(wrapper_h) $(cp_abi_h) -go32-nat.o: go32-nat.c $(defs_h) $(inferior_h) gdb_wait.h $(gdbcore_h) \ - $(command_h) $(floatformat_h) $(target_h) i387-nat.h $(regcache_h) +go32-nat.o: go32-nat.c $(defs_h) $(inferior_h) $(gdb_wait_h) $(gdbcore_h) \ + $(command_h) $(floatformat_h) $(target_h) i387-tdep.h $(regcache_h) gnu-nat.o: process_reply_S.h exc_request_S.h notify_S.h msg_reply_S.h \ exc_request_U.h msg_U.h gnu-nat.h @@ -1579,7 +1604,7 @@ hp300ux-nat.o: hp300ux-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) hpacc-abi.o: hpacc-abi.c $(defs_h) $(cp_abi_h) $(gdb_string_h) $(gdbtypes_h) \ $(value_h) $(gdbcore_h) -hppa-tdep.o: hppa-tdep.c gdb_wait.h $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ +hppa-tdep.o: hppa-tdep.c $(gdb_wait_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(objfiles_h) $(symfile_h) $(target_h) $(regcache_h) \ $(completer_h) @@ -1635,9 +1660,6 @@ i386v4-nat.o: i386v4-nat.c $(defs_h) $(regcache_h) i387-tdep.o: i387-tdep.c $(floatformat_h) $(defs_h) $(gdbcore_h) \ $(inferior_h) $(language_h) $(regcache_h) $(doublest_h) i386-tdep.h -i387-nat.o: i387-nat.c $(defs_h) $(inferior_h) $(value_h) $(regcache_h) \ - i387-nat.h - i960-tdep.o: i960-tdep.c $(floatformat_h) $(defs_h) $(expression_h) \ $(frame_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(gdbcore_h) \ $(regcache_h) @@ -1659,20 +1681,20 @@ inflow.o: inflow.c $(bfd_h) $(command_h) $(defs_h) $(inferior_h) \ $(target_h) $(terminal_h) $(gdbthread_h) $(gdb_string_h) infptrace.o: infptrace.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \ - $(gdb_string_h) gdb_wait.h $(command_h) $(regcache_h) + $(gdb_string_h) $(gdb_wait_h) $(command_h) $(regcache_h) -infrun.o: infrun.c gdb_wait.h $(defs_h) $(gdbcmd_h) $(cli_script_h) \ +infrun.o: infrun.c $(gdb_wait_h) $(defs_h) $(gdbcmd_h) $(cli_script_h) \ $(gdbcore_h) $(value_h) \ $(inferior_h) $(target_h) $(gdbthread_h) $(gdb_string_h) $(event_loop_h) \ $(event_top_h) $(regcache_h) -inftarg.o: inftarg.c gdb_wait.h $(defs_h) $(gdbcore_h) $(inferior_h) \ +inftarg.o: inftarg.c $(gdb_wait_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ $(target_h) $(terminal_h) $(command_h) irix4-nat.o: irix4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ $(symtab_h) $(symfile_h) $(objfiles_h) $(command_h) $(frame_h) \ - gdb_regex.h $(language_h) $(gdb_string_h) $(regcache_h) + $(gdb_regex_h) $(language_h) $(gdb_string_h) $(regcache_h) jv-lang.o: jv-lang.c $(bfd_h) $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(parser_defs_h) $(language_h) $(symfile_h) \ @@ -1710,7 +1732,7 @@ m2-valprint.o: m2-valprint.c $(defs_h) $(gdbtypes_h) $(symtab_h) \ $(valprint_h) m2-lang.h m3-nat.o: m3-nat.c $(defs_h) $(inferior_h) $(value_h) $(language_h) \ - $(target_h) gdb_wait.h $(gdbcmd_h) $(gdbcore_h) $(regcache_h) + $(target_h) $(gdb_wait_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) p-lang.o: p-lang.c p-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \ $(language_h) $(parser_defs_h) $(symtab_h) $(gdb_string_h) @@ -1723,7 +1745,7 @@ p-valprint.o: p-valprint.c p-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \ $(language_h) $(symtab_h) $(valprint_h) $(value_h) $(gdb_string_h) m68hc11-tdep.o: m68hc11-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \ - $(gdbcore_h) gdb_string.h + $(gdbcore_h) $(gdb_string_h) m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \ $(gdbcore_h) $(gdb_string_h) $(regcache_h) @@ -1740,7 +1762,7 @@ m88k-tdep.o: m88k-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) mac-nat.o: mac-nat.c $(defs_h) $(gdb_string_h) $(regcache_h) main.o: main.c $(top_h) $(defs_h) $(gdb_string_h) $(event_loop_h) \ - $(symfile_h) $(gdbcore_h) $(ui_out_h) + $(symfile_h) $(gdbcore_h) $(ui_out_h) $(inferior_h) maint.o: maint.c $(defs_h) $(gdbcmd_h) $(gdbtypes_h) $(symtab_h) \ $(language_h) $(expression_h) $(objfiles_h) $(symfile_h) \ @@ -1768,7 +1790,8 @@ os9kread.o: os9kread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \ $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) \ $(srcdir)/os9kread.c -mem-break.o: mem-break.c $(defs_h) +mem-break.o: mem-break.c $(defs_h) $(symtab_h) $(breakpoint_h) $(inferior_h) \ + $(target_h) memattr.o: memattr.c $(defs_h) $(command_h) $(gdbcmd_h) $(memattr_h) \ $(target_h) $(value_h) $(language_h) $(gdb_string_h) @@ -1796,18 +1819,20 @@ mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \ $(regcache_h) mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ - $(obstack_h) $(target_h) $(value_h) $(bfd_h) gdb_string.h \ + $(obstack_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \ $(gdbcore_h) $(symfile_h) $(regcache_h) $(arch-utils.h) monitor.o: monitor.c $(monitor_h) $(bfd_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(gdb_string_h) \ $(regcache_h) -Onindy.o: nindy-share/Onindy.c gdb_wait.h nindy-share/block_io.h \ +nbsd-tdep.o: nbsd-tdep.c $(defs_h) solib-svr4.h + +Onindy.o: nindy-share/Onindy.c $(gdb_wait_h) nindy-share/block_io.h \ nindy-share/env.h $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/nindy-share/Onindy.c -nindy.o: nindy-share/nindy.c gdb_wait.h nindy-share/block_io.h \ +nindy.o: nindy-share/nindy.c $(gdb_wait_h) nindy-share/block_io.h \ nindy-share/env.h $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/nindy-share/nindy.c @@ -1862,7 +1887,7 @@ ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdbcore_h) $(frame_h) \ ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(target_h) ppc-tdep.h $(regcache_h) $(value_h) -ppcbug-rom.o: ppcbug-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \ +ppcbug-rom.o: ppcbug-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \ $(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h) \ $(regcache_h) @@ -1890,11 +1915,11 @@ sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \ linux-proc.o: linux-proc.c $(defs_h) -thread-db.o: thread-db.c $(defs_h) gdb_assert.h gdb_proc_service.h \ +thread-db.o: thread-db.c $(defs_h) $(gdb_assert_h) gdb_proc_service.h \ gdb_thread_db.h $(bfd_h) $(gdbthread_h) $(inferior_h) $(symfile_h) \ $(objfiles_h) $(target_h) $(regcache_h) -lin-lwp.o: lin-lwp.c $(defs_h) gdb_assert.h gdb_wait.h $(gdbthread_h) \ +lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_wait_h) $(gdbthread_h) \ $(inferior_h) $(target_h) $(gdbcmd_h) $(regcache_h) proc-service.o: proc-service.c $(defs_h) $(inferior_h) gdb_proc_service.h \ @@ -1954,9 +1979,9 @@ remote-sds.o: remote-sds.c $(bfd_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(remote_utils_h) $(symfile_h) $(terminal_h) \ $(gdb_string_h) $(regcache_h) -remote-sim.o: remote-sim.c $(defs_h) $(gdbcore_h) \ - $(inferior_h) $(target_h) $(terminal_h) $(gdb_string_h) \ - $(INCLUDE_DIR)/callback.h $(regcache_h) +remote-sim.o: remote-sim.c $(defs_h) $(inferior_h) $(value_h) $(gdb_string_h) \ + $(terminal_h) $(target_h) $(gdbcore_h) $(INCLUDE_DIR)/callback.h \ + $(remote_sim_h) $(remote_utils_h) $(command_h) $(regcache_h) remote-st.o: remote-st.c $(defs_h) $(gdbcore_h) $(serial_h) \ $(target_h) $(gdb_string_h) $(regcache_h) @@ -1979,15 +2004,15 @@ ocd.o: ocd.c ocd.h $(gdbcore_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ remote-utils.o: remote-utils.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(remote_utils_h) $(gdb_string_h) $(regcache_h) -remote.o: remote.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \ +remote.o: remote.c $(bfd_h) $(gdb_wait_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(remote_utils_h) $(symfile_h) $(terminal_h) \ $(gdb_string_h) $(event_loop_h) $(event_top_h) $(remote_h) \ $(inf_loop_h) $(value_h) -remote-nrom.o: remote-nrom.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \ +remote-nrom.o: remote-nrom.c $(bfd_h) $(gdb_wait_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(remote_utils_h) $(symfile_h) $(terminal_h) -rom68k-rom.o: rom68k-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \ +rom68k-rom.o: rom68k-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \ $(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h) \ $(regcache_h) $(value_h) @@ -2028,18 +2053,18 @@ sh-tdep.o: sh-tdep.c $(bfd_h) $(dis_asm_h) \ $(gdbcmd_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(arch_utils_h) \ $(regcache_h) $(doublest_h) -sh3-rom.o: sh3-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \ +sh3-rom.o: sh3-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(arch_utils_h) \ $(regcache_h) signals.o: signals/signals.c $(defs_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $< -mon960-rom.o: mon960-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \ +mon960-rom.o: mon960-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \ $(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h) solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \ - $(objfiles_h) gdb_regex.h $(symfile_h) $(target_h) $(gdb_string_h) \ + $(objfiles_h) $(gdb_regex_h) $(symfile_h) $(target_h) $(gdb_string_h) \ $(solist_h) $(completer_h) solib-sunos.o: solib-sunos.c $(defs_h) $(symfile_h) $(objfiles_h) \ @@ -2051,9 +2076,9 @@ solib-svr4.o: solib-svr4.c $(defs_h) $(gdbcore_h) $(inferior_h) $(objfiles_h) \ solib-legacy.o: solib-legacy.c $(defs_h) $(gdbcore_h) solib-svr4.h source.o: source.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \ - $(gdbcore_h) $(language_h) $(objfiles_h) gdb_regex.h $(symfile_h) \ + $(gdbcore_h) $(language_h) $(objfiles_h) $(gdb_regex_h) $(symfile_h) \ $(symtab_h) $(gdb_string_h) $(source_h) $(completer_h) $(linespec_h) \ - $(ui_out_h) + $(ui_out_h) $(value_h) sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) @@ -2105,13 +2130,18 @@ symmisc.o: symmisc.c $(bfd_h) $(breakpoint_h) $(command_h) $(defs_h) \ symtab.o: symtab.c $(call_cmds_h) $(defs_h) $(expression_h) $(frame_h) \ $(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) $(language_h) $(objfiles_h) \ - gdb_regex.h $(symfile_h) $(symtab_h) $(target_h) $(value_h) \ + $(gdb_regex_h) $(symfile_h) $(symtab_h) $(target_h) $(value_h) \ $(gdb_string_h) $(linespec_h) $(cp_abi_h) linespec.o: linespec.c $(linespec_h) $(defs_h) $(frame_h) $(value_h) \ $(objfiles_h) $(symfile_h) $(completer_h) $(symtab_h) \ $(demangle_h) $(command_h) $(cp_abi_h) +macroexp.o: macroexp.c $(defs_h) $(macrotab_h) + +macrotab.o: macrotab.c $(defs_h) $(obstack_h) $(objfiles_h) $(symtab_h) \ + $(macrotab_h) $(splay_tree_h) gdb_assert.h $(bcache_h) + target.o: target.c $(bfd_h) $(defs_h) $(gdbcmd_h) $(inferior_h) \ $(objfiles_h) $(symfile_h) $(target_h) $(gdb_string_h) $(regcache_h) @@ -2135,14 +2165,14 @@ typeprint.o: typeprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \ utils.o: utils.c $(bfd_h) $(defs_h) $(expression_h) $(gdbcmd_h) \ $(language_h) $(target_h) $(terminal_h) $(readline_headers) \ - $(gdb_string_h) $(event_loop_h) $(event_top_h) + $(gdb_string_h) $(event_loop_h) $(event_top_h) $(inferior_h) valarith.o: valarith.c $(bfd_h) $(defs_h) $(expression_h) \ $(gdbtypes_h) $(language_h) $(symtab_h) $(target_h) $(value_h) \ $(gdb_string_h) $(doublest_h) valops.o: valops.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \ - $(gdb_string_h) $(regcache_h) $(cp_abi_h) + $(gdb_string_h) $(regcache_h) $(cp_abi_h) $(gdb_assert_h) valprint.o: valprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \ $(gdbcore_h) $(gdbtypes_h) $(language_h) $(symtab_h) $(target_h) \ @@ -2160,10 +2190,10 @@ x86-64-linux-tdep.o : x86-64-linux-tdep.c $(defs_h) $(inferior_h) \ x86-64-tdep.o : x86-64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) $(gdbcmd_h) \ $(arch_utils_h) $(regcache_h) $(symfile_h) x86-64-tdep.h i386-tdep.h \ - $(dwarf2cfi_h) gdb_assert.h + $(dwarf2cfi_h) $(gdb_assert_h) x86-64-linux-nat.o : x86-64-linux-nat.c $(defs_h) $(inferior_h) \ - $(gdbcore_h) $(regcache_h) i387-nat.h gdb_assert.h x86-64-tdep.h \ + $(gdbcore_h) $(regcache_h) i387-tdep.h $(gdb_assert_h) x86-64-tdep.h \ i386-tdep.h win32-nat.o: win32-nat.c $(gdbcmd_h) $(gdbcore_h) $(inferior_h) $(defs_h) \ @@ -2188,7 +2218,7 @@ xcoffread.o: xcoffread.c $(bfd_h) $(INCLUDE_DIR)/aout/stab.def \ $(symfile_h) $(symtab_h) $(gdb_string_h) xcoffsolib.o: xcoffsolib.c $(bfd_h) $(defs_h) $(xcoffsolib_h) $(inferior_h) \ - $(gdbcmd_h) $(symfile_h) $(frame_h) gdb_regex.h + $(gdbcmd_h) $(symfile_h) $(frame_h) $(gdb_regex_h) # FIXME: z8k-tdep.c calls _initialize_gdbtypes(). Since that isn't # declared -Wimplicit fails. It should be using the GDBARCH framework. @@ -2237,12 +2267,12 @@ wrapper.o: wrapper.c $(defs_h) $(frame_h) $(value_h) $(wrapper_h) cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(cli_cmds_h) $(cli_decode_h) \ $(cli_script_h) $(cli_setshow_h) $(top_h) $(completer_h) \ - $(defs_h) $(target_h) gdb_wait.h gdb_regex.h $(ui_out_h) + $(defs_h) $(target_h) $(gdb_wait_h) $(gdb_regex_h) $(ui_out_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c cli-decode.o: $(srcdir)/cli/cli-decode.c $(cli_decode_h) \ $(cli_cmds_h) $(defs_h) $(ui_out_h) \ - $(symtab_h) gdb_regex.h + $(symtab_h) $(gdb_regex_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-decode.c cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) $(command_h) \ @@ -2283,14 +2313,17 @@ mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(top_h) $(mi_cmds_h) \ $(ui_out_h) $(frame_h) $(value_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \ - $(ui_out_h) $(mi_getopt_h) $(gdb_h) + $(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \ + $(gdb_events_h) $(mi_getopt_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) $(mi_cmds_h) \ $(ui_out_h) $(value_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(top_h) $(mi_cmds_h) $(ui_out_h) \ $(mi_console_h) $(mi_getopt_h) $(event_loop_h) $(event_top_h) \ - $(mi_getopt_h) $(regcache_h) $(gdb_h) + $(mi_getopt_h) $(regcache_h) $(gdb_h) $(target_h) \ + $(inferior_h) $(gdb_string_h) $(gdbthread_h) $(mi_out_h) \ + $(gdbcore_h) $(value_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-main.c mi-out.o: $(srcdir)/mi/mi-out.c $(defs_h) $(mi_out_h) $(ui_out_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-out.c diff --git a/gdb/NEWS b/gdb/NEWS index b4076f7..7e84b2f 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -10,6 +10,7 @@ Atmel AVR avr*-*-* * New native configurations Alpha NetBSD alpha*-*-netbsd* +SH NetBSD sh*-*-netbsdelf* * OBSOLETE configurations and files diff --git a/gdb/TODO b/gdb/TODO index ea46e9b..f743ae7 100644 --- a/gdb/TODO +++ b/gdb/TODO @@ -247,10 +247,6 @@ New languages come onto the scene all the time. Re: Various C++ things -value_headof/value_from_vtable_info are worthless, and should be -removed. The one place in printcmd.c that uses it should use the RTTI -functions. - RTTI for g++ should be using the typeinfo functions rather than the vtables. The typeinfo functions are always at offset 4 from the beginning of the vtable, and are always right. The vtables will have diff --git a/gdb/alphabsd-nat.c b/gdb/alphabsd-nat.c index 92b0fc2..b26d3ea 100644 --- a/gdb/alphabsd-nat.c +++ b/gdb/alphabsd-nat.c @@ -23,6 +23,7 @@ #include "regcache.h" #include "alpha-tdep.h" +#include "alphabsd-tdep.h" #include #include @@ -36,96 +37,39 @@ typedef struct reg gregset_t; #endif -#ifndef HAVE_FPREGSET_T -typedef struct fpreg fpregset_t; -#endif +#ifndef HAVE_FPREGSET_T +typedef struct fpreg fpregset_t; +#endif #include "gregset.h" -/* Number of general-purpose registers. */ -#define NUM_GREGS 32 - -/* Number of floating point registers. */ -#define NUM_FPREGS 31 - - -/* Transfering the registers between GDB, inferiors and core files. */ - -/* Fill GDB's register array with the general-purpose register values - in *GREGSETP. */ +/* Provide *regset() wrappers around the generic Alpha BSD register + supply/fill routines. */ void supply_gregset (gregset_t *gregsetp) { - int i; - - for (i = 0; i < NUM_GREGS; i++) - { - if (CANNOT_FETCH_REGISTER (i)) - supply_register (i, NULL); - else - supply_register (i, (char *) &gregsetp->r_regs[i]); - } - - /* The PC travels in the R_ZERO slot. */ - supply_register (PC_REGNUM, (char *) &gregsetp->r_regs[R_ZERO]); + alphabsd_supply_reg ((char *) gregsetp, -1); } -/* Fill register REGNO (if it is a general-purpose register) in - *GREGSETPS with the value in GDB's register array. If REGNO is -1, - do this for all registers. */ - void fill_gregset (gregset_t *gregsetp, int regno) { - int i; - - for (i = 0; i < NUM_GREGS; i++) - if ((regno == -1 || regno == i) && ! CANNOT_STORE_REGISTER (i)) - regcache_collect (i, (char *) &gregsetp->r_regs[i]); - - /* The PC travels in the R_ZERO slot. */ - if (regno == -1 || regno == PC_REGNUM) - regcache_collect (PC_REGNUM, (char *) &gregsetp->r_regs[R_ZERO]); + alphabsd_fill_reg ((char *) gregsetp, regno); } -/* Fill GDB's register array with the floating-point register values - in *FPREGSETP. */ - void supply_fpregset (fpregset_t *fpregsetp) { - int i; - - for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++) - { - if (CANNOT_FETCH_REGISTER (i)) - supply_register (i, NULL); - else - supply_register (i, (char *) &fpregsetp->fpr_regs[i - FP0_REGNUM]); - } - - supply_register (ALPHA_FPCR_REGNUM, (char *) &fpregsetp->fpr_cr); + alphabsd_supply_fpreg ((char *) fpregsetp, -1); } -/* Fill register REGNO (if it is a floating-point register) in - *FPREGSETP with the value in GDB's register array. If REGNO is -1, - do this for all registers. */ - void fill_fpregset (fpregset_t *fpregsetp, int regno) { - int i; - - for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++) - if ((regno == -1 || regno == i) && ! CANNOT_STORE_REGISTER (i)) - regcache_collect (i, (char *) &fpregsetp->fpr_regs[i - FP0_REGNUM]); - - if (regno == -1 || regno == ALPHA_FPCR_REGNUM) - regcache_collect (ALPHA_FPCR_REGNUM, (char *) &fpregsetp->fpr_cr); + alphabsd_fill_fpreg ((char *) fpregsetp, regno); } - - + /* Determine if PT_GETREGS fetches this register. */ static int @@ -146,26 +90,26 @@ fetch_inferior_registers (int regno) if (regno == -1 || getregs_supplies (regno)) { - gregset_t gregs; + struct reg gregs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &gregs, 0) == -1) perror_with_name ("Couldn't get registers"); - supply_gregset (&gregs); + alphabsd_supply_reg ((char *) &gregs, regno); if (regno != -1) return; } if (regno == -1 || regno >= FP0_REGNUM) { - fpregset_t fpregs; + struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) perror_with_name ("Couldn't get floating point status"); - supply_fpregset (&fpregs); + alphabsd_supply_fpreg ((char *) &fpregs, regno); } /* Reset virtual frame pointer. */ @@ -181,12 +125,12 @@ store_inferior_registers (int regno) if (regno == -1 || getregs_supplies (regno)) { - gregset_t gregs; + struct reg gregs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &gregs, 0) == -1) perror_with_name ("Couldn't get registers"); - fill_gregset (&gregs, regno); + alphabsd_fill_reg ((char *) &gregs, regno); if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &gregs, 0) == -1) @@ -198,13 +142,13 @@ store_inferior_registers (int regno) if (regno == -1 || regno >= FP0_REGNUM) { - fpregset_t fpregs; + struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) perror_with_name ("Couldn't get floating point status"); - fill_fpregset (&fpregs, regno); + alphabsd_fill_fpreg ((char *) &fpregs, regno); if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) diff --git a/gdb/alphabsd-tdep.c b/gdb/alphabsd-tdep.c new file mode 100644 index 0000000..39a9b1a --- /dev/null +++ b/gdb/alphabsd-tdep.c @@ -0,0 +1,102 @@ +/* Common target dependent code for GDB on Alpha systems running BSD. + 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 "regcache.h" + +#include "alpha-tdep.h" +#include "alphabsd-tdep.h" + +/* Number of general-purpose registers. */ +#define NUM_GREGS 32 + +/* Number of floating-point registers. */ +#define NUM_FPREGS 31 + +/* Conviently, GDB uses the same register numbering as the + ptrace register structure used by BSD on Alpha. */ + +void +alphabsd_supply_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i < NUM_GREGS; i++) + { + if (i == regno || regno == -1) + { + if (CANNOT_FETCH_REGISTER (i)) + supply_register (i, NULL); + else + supply_register (i, regs + (i * 8)); + } + } + + /* The PC travels in the ZERO slot. */ + if (regno == PC_REGNUM || regno == -1) + supply_register (PC_REGNUM, regs + (31 * 8)); +} + +void +alphabsd_fill_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i < NUM_GREGS; i++) + if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) + regcache_collect (i, regs + (i * 8)); + + /* The PC travels in the ZERO slot. */ + if (regno == PC_REGNUM || regno == -1) + regcache_collect (PC_REGNUM, regs + (31 * 8)); +} + +void +alphabsd_supply_fpreg (char *fpregs, int regno) +{ + int i; + + for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++) + { + if (i == regno || regno == -1) + { + if (CANNOT_FETCH_REGISTER (i)) + supply_register (i, NULL); + else + supply_register (i, fpregs + ((i - FP0_REGNUM) * 8)); + } + } + + if (regno == ALPHA_FPCR_REGNUM || regno == -1) + supply_register (ALPHA_FPCR_REGNUM, fpregs + (32 * 8)); +} + +void +alphabsd_fill_fpreg (char *fpregs, int regno) +{ + int i; + + for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++) + if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) + regcache_collect (i, fpregs + ((i - FP0_REGNUM) * 8)); + + if (regno == ALPHA_FPCR_REGNUM || regno == -1) + regcache_collect (ALPHA_FPCR_REGNUM, fpregs + (32 * 8)); +} diff --git a/gdb/alphabsd-tdep.h b/gdb/alphabsd-tdep.h new file mode 100644 index 0000000..48d8798 --- /dev/null +++ b/gdb/alphabsd-tdep.h @@ -0,0 +1,33 @@ +/* Common target dependent code for GDB on Alpha systems running BSD. + 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 ALPHABSD_TDEP_H +#define ALPHABSD_TDEP_H + +void alphabsd_supply_reg (char *, int); +void alphabsd_fill_reg (char *, int); + +void alphabsd_supply_fpreg (char *, int); +void alphabsd_fill_fpreg (char *, int); + +#define SIZEOF_STRUCT_REG (32 * 8) +#define SIZEOF_STRUCT_FPREG (33 * 8) + +#endif /* ALPHABSD_TDEP_H */ diff --git a/gdb/alphanbsd-nat.c b/gdb/alphanbsd-nat.c deleted file mode 100644 index ed90de3..0000000 --- a/gdb/alphanbsd-nat.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Native-dependent code for Alpha NetBSD. - Copyright 2002 Free Software Foundation, Inc. - Contributed by Wasabi Systems, 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 -#include -#include -#include -#include "gdbcore.h" -#include "regcache.h" - -#include "alpha-tdep.h" - -#ifndef HAVE_GREGSET_T -typedef struct reg gregset_t; -#endif - -#ifndef HAVE_FPREGSET_T -typedef struct fpreg fpregset_t; -#endif - -#include "gregset.h" - -static void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) -{ - struct md_coredump *core_reg; - char *regs; - int regno; - - /* Table to map a gdb register number to a trapframe register index. */ - static const int regmap[] = - { - FRAME_V0, FRAME_T0, FRAME_T1, FRAME_T2, - FRAME_T3, FRAME_T4, FRAME_T5, FRAME_T6, - FRAME_T7, FRAME_S0, FRAME_S1, FRAME_S2, - FRAME_S3, FRAME_S4, FRAME_S5, FRAME_S6, - FRAME_A0, FRAME_A1, FRAME_A2, FRAME_A3, - FRAME_A4, FRAME_A5, FRAME_T8, FRAME_T9, - FRAME_T10, FRAME_T11, FRAME_RA, FRAME_T12, - FRAME_AT, FRAME_GP, FRAME_SP - }; - - /* We get everything from one section. */ - if (which != 0) - return; - - core_reg = (struct md_coredump *) core_reg_sect; - regs = (char *) &core_reg->md_tf; - - if (core_reg_size < sizeof (*core_reg)) - { - warning ("Wrong size register set in core file."); - return; - } - - /* Integer registers. */ - for (regno = 0; regno < ALPHA_ZERO_REGNUM; regno++) - supply_register (regno, regs + (regmap[regno] * 8)); - supply_register (ALPHA_ZERO_REGNUM, NULL); - supply_register (FP_REGNUM, NULL); - supply_register (PC_REGNUM, regs + (FRAME_PC * 8)); - - /* Floating point registers. */ - supply_fpregset (&core_reg->md_fpstate); -} - -static void -fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) -{ - switch (which) - { - case 0: /* Integer registers. */ - if (core_reg_size != sizeof (struct reg)) - warning ("Wrong size register set in core file."); - else - supply_gregset ((gregset_t *) core_reg_sect); - break; - - case 2: /* Floating point registers. */ - if (core_reg_size != sizeof (struct fpreg)) - warning ("Wrong size FP register set in core file."); - else - supply_fpregset ((fpregset_t *) core_reg_sect); - break; - - default: - /* Don't know what kind of register request this is; just ignore it. */ - break; - } -} - -static struct core_fns alphanbsd_core_fns = -{ - bfd_target_unknown_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ -}; - -static struct core_fns alphanbsd_elfcore_fns = -{ - bfd_target_elf_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_elfcore_registers, /* core_read_registers */ - NULL /* next */ -}; - -void -_initialize_alphanbsd_nat (void) -{ - add_core_fns (&alphanbsd_core_fns); - add_core_fns (&alphanbsd_elfcore_fns); -} diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index 33c3cd7..d10a3ca 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -21,52 +21,102 @@ #include "defs.h" #include "gdbcore.h" +#include "regcache.h" #include "value.h" -#include "solib-svr4.h" #include "alpha-tdep.h" +#include "alphabsd-tdep.h" +#include "nbsd-tdep.h" -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for NetBSD/alpha targets using the struct offsets - defined in (but without actual reference to that file). - - This makes it possible to access NetBSD/alpha shared libraries - from a GDB that was not built on a NetBSD/alpha host (for cross - debugging). */ - -static struct link_map_offsets * -alphanbsd_solib_svr4_fetch_link_map_offsets (void) +static void +fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) { - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = NULL; - - if (lmp == NULL) + char *regs, *fpregs; + int regno; + + /* Table to map a gdb register number to a trapframe register index. */ + static const int regmap[] = + { + 0, 1, 2, 3, + 4, 5, 6, 7, + 8, 9, 10, 11, + 12, 13, 14, 15, + 30, 31, 32, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, + 25, 29, 26 + }; +#define SIZEOF_TRAPFRAME (33 * 8) + + /* We get everything from one section. */ + if (which != 0) + return; + + regs = core_reg_sect; + fpregs = core_reg_sect + SIZEOF_TRAPFRAME; + + if (core_reg_size < (SIZEOF_TRAPFRAME + SIZEOF_STRUCT_FPREG)) { - lmp = &lmo; - - lmo.r_debug_size = 32; - - lmo.r_map_offset = 8; - lmo.r_map_size = 8; - - lmo.link_map_size = 40; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 8; + warning ("Wrong size register set in core file."); + return; + } - lmo.l_name_offset = 8; - lmo.l_name_size = 8; + /* Integer registers. */ + for (regno = 0; regno < ALPHA_ZERO_REGNUM; regno++) + supply_register (regno, regs + (regmap[regno] * 8)); + supply_register (ALPHA_ZERO_REGNUM, NULL); + supply_register (FP_REGNUM, NULL); + supply_register (PC_REGNUM, regs + (28 * 8)); - lmo.l_next_offset = 24; - lmo.l_next_size = 8; + /* Floating point registers. */ + alphabsd_supply_fpreg (fpregs, -1); +} - lmo.l_prev_offset = 32; - lmo.l_prev_size = 8; +static void +fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + switch (which) + { + case 0: /* Integer registers. */ + if (core_reg_size != SIZEOF_STRUCT_REG) + warning ("Wrong size register set in core file."); + else + alphabsd_supply_reg (core_reg_sect, -1); + break; + + case 2: /* Floating point registers. */ + if (core_reg_size != SIZEOF_STRUCT_FPREG) + warning ("Wrong size FP register set in core file."); + else + alphabsd_supply_fpreg (core_reg_sect, -1); + break; + + default: + /* Don't know what kind of register request this is; just ignore it. */ + break; } - - return lmp; } +static struct core_fns alphanbsd_core_fns = +{ + bfd_target_unknown_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + +static struct core_fns alphanbsd_elfcore_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_elfcore_registers, /* core_read_registers */ + NULL /* next */ +}; + /* Under NetBSD/alpha, 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 @@ -142,7 +192,7 @@ alphanbsd_init_abi (struct gdbarch_info info, set_gdbarch_software_single_step (gdbarch, alpha_software_single_step); set_solib_svr4_fetch_link_map_offsets (gdbarch, - alphanbsd_solib_svr4_fetch_link_map_offsets); + nbsd_lp64_solib_svr4_fetch_link_map_offsets); tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset; @@ -154,4 +204,7 @@ void _initialize_alphanbsd_tdep (void) { alpha_gdbarch_register_os_abi (ALPHA_ABI_NETBSD, alphanbsd_init_abi); + + add_core_fns (&alphanbsd_core_fns); + add_core_fns (&alphanbsd_elfcore_fns); } diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 154438a..bde89a8 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -401,21 +401,13 @@ legacy_virtual_frame_pointer (CORE_ADDR pc, *frame_offset = 0; } -/* Assume the world is flat. Every register is large enough to fit a - target integer. */ +/* Assume the world is sane, every register's virtual and real size + is identical. */ int -generic_register_raw_size (int regnum) +generic_register_size (int regnum) { gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS); - return TARGET_INT_BIT / HOST_CHAR_BIT; -} - -/* Assume the virtual size corresponds to the virtual type. */ - -int -generic_register_virtual_size (int regnum) -{ return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum)); } @@ -437,6 +429,26 @@ legacy_pc_in_sigtramp (CORE_ADDR pc, char *name) return IN_SIGTRAMP(pc, name); } +int +legacy_convert_register_p (int regnum) +{ + return REGISTER_CONVERTIBLE (regnum); +} + +void +legacy_register_to_value (int regnum, struct type *type, + char *from, char *to) +{ + REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to); +} + +void +legacy_value_to_register (struct type *type, int regnum, + char *from, char *to) +{ + REGISTER_CONVERT_TO_RAW (type, regnum, from, to); +} + /* Functions to manipulate the endianness of the target. */ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 7220062..594a832 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -149,17 +149,23 @@ extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc extern void default_print_float_info (void); -/* Assume all registers are the same size and a size identical to that - of the integer type. */ -extern int generic_register_raw_size (int regnum); +/* Assume that the world is sane, a registers raw and virtual size + both match its type. */ -/* Assume the virtual size of registers corresponds to the virtual type. */ - -extern int generic_register_virtual_size (int regnum); +extern int generic_register_size (int regnum); /* Prop up old targets that use various IN_SIGTRAMP() macros. */ extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name); +/* The orginal register_convert*() functions were overloaded. They + were used to both: convert between virtual and raw register formats + (something that is discouraged); and to convert a register to the + type of a corresponding variable. These legacy functions preserve + that overloaded behavour in existing targets. */ +extern int legacy_convert_register_p (int regnum); +extern void legacy_register_to_value (int regnum, struct type *type, char *from, char *to); +extern void legacy_value_to_register (struct type *type, int regnum, char *from, char *to); + /* Initialize a ``struct info''. Can't use memset(0) since some default values are not zero. */ extern void gdbarch_info_init (struct gdbarch_info *info); diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index af100a5..29f11ae 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -60,8 +60,8 @@ LONGEST arm_linux_call_dummy_words[] = }; /* Description of the longjmp buffer. */ -#define JB_ELEMENT_SIZE INT_REGISTER_RAW_SIZE -#define JB_PC 21 +#define ARM_LINUX_JB_ELEMENT_SIZE INT_REGISTER_RAW_SIZE +#define ARM_LINUX_JB_PC 21 /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, @@ -524,8 +524,8 @@ arm_linux_init_abi (struct gdbarch_info info, tdep->arm_breakpoint = arm_linux_arm_le_breakpoint; tdep->arm_breakpoint_size = sizeof (arm_linux_arm_le_breakpoint); - tdep->jb_pc = JB_PC; - tdep->jb_elt_size = JB_ELEMENT_SIZE; + tdep->jb_pc = ARM_LINUX_JB_PC; + tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE; set_gdbarch_call_dummy_words (gdbarch, arm_linux_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index fa0b365..646d5c6 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -417,10 +417,15 @@ arm_skip_prologue (CORE_ADDR pc) { unsigned long inst; CORE_ADDR skip_pc; - CORE_ADDR func_addr, func_end; + CORE_ADDR func_addr, func_end = 0; char *func_name; struct symtab_and_line sal; + /* If we're in a dummy frame, don't even try to skip the prologue. */ + if (USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (pc, 0, 0)) + return pc; + /* See what the symbol table says. */ if (find_pc_partial_function (pc, &func_name, &func_addr, &func_end)) @@ -444,74 +449,63 @@ arm_skip_prologue (CORE_ADDR pc) /* Can't find the prologue end in the symbol table, try it the hard way by disassembling the instructions. */ - skip_pc = pc; - inst = read_memory_integer (skip_pc, 4); - /* "mov ip, sp" is no longer a required part of the prologue. */ - if (inst == 0xe1a0c00d) /* mov ip, sp */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } - /* Some prologues begin with "str lr, [sp, #-4]!". */ - if (inst == 0xe52de004) /* str lr, [sp, #-4]! */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } + /* Like arm_scan_prologue, stop no later than pc + 64. */ + if (func_end == 0 || func_end > pc + 64) + func_end = pc + 64; - if ((inst & 0xfffffff0) == 0xe92d0000) /* stmfd sp!,{a1,a2,a3,a4} */ + for (skip_pc = pc; skip_pc < func_end; skip_pc += 4) { - skip_pc += 4; inst = read_memory_integer (skip_pc, 4); - } - if ((inst & 0xfffff800) == 0xe92dd800) /* stmfd sp!,{fp,ip,lr,pc} */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } + /* "mov ip, sp" is no longer a required part of the prologue. */ + if (inst == 0xe1a0c00d) /* mov ip, sp */ + continue; - /* Any insns after this point may float into the code, if it makes - for better instruction scheduling, so we skip them only if we - find them, but still consider the function to be frame-ful. */ + /* Some prologues begin with "str lr, [sp, #-4]!". */ + if (inst == 0xe52de004) /* str lr, [sp, #-4]! */ + continue; - /* We may have either one sfmfd instruction here, or several stfe - insns, depending on the version of floating point code we - support. */ - if ((inst & 0xffbf0fff) == 0xec2d0200) /* sfmfd fn, , [sp]! */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } - else - { - while ((inst & 0xffff8fff) == 0xed6d0103) /* stfe fn, [sp, #-12]! */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } - } + if ((inst & 0xfffffff0) == 0xe92d0000) /* stmfd sp!,{a1,a2,a3,a4} */ + continue; - if ((inst & 0xfffff000) == 0xe24cb000) /* sub fp, ip, #nn */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } + if ((inst & 0xfffff800) == 0xe92dd800) /* stmfd sp!,{fp,ip,lr,pc} */ + continue; - if ((inst & 0xfffff000) == 0xe24dd000) /* sub sp, sp, #nn */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); - } + /* Any insns after this point may float into the code, if it makes + for better instruction scheduling, so we skip them only if we + find them, but still consider the function to be frame-ful. */ - while ((inst & 0xffffcfc0) == 0xe50b0000) /* str r(0123), [r11, #-nn] */ - { - skip_pc += 4; - inst = read_memory_integer (skip_pc, 4); + /* We may have either one sfmfd instruction here, or several stfe + insns, depending on the version of floating point code we + support. */ + if ((inst & 0xffbf0fff) == 0xec2d0200) /* sfmfd fn, , [sp]! */ + continue; + + if ((inst & 0xffff8fff) == 0xed6d0103) /* stfe fn, [sp, #-12]! */ + continue; + + if ((inst & 0xfffff000) == 0xe24cb000) /* sub fp, ip, #nn */ + continue; + + if ((inst & 0xfffff000) == 0xe24dd000) /* sub sp, sp, #nn */ + continue; + + if ((inst & 0xffffc000) == 0xe54b0000 || /* strb r(0123),[r11,#-nn] */ + (inst & 0xffffc0f0) == 0xe14b00b0 || /* strh r(0123),[r11,#-nn] */ + (inst & 0xffffc000) == 0xe50b0000) /* str r(0123),[r11,#-nn] */ + continue; + + if ((inst & 0xffffc000) == 0xe5cd0000 || /* strb r(0123),[sp,#nn] */ + (inst & 0xffffc0f0) == 0xe1cd00b0 || /* strh r(0123),[sp,#nn] */ + (inst & 0xffffc000) == 0xe58d0000) /* str r(0123),[sp,#nn] */ + continue; + + /* Un-recognized instruction; stop scanning. */ + break; } - return skip_pc; + return skip_pc; /* End of prologue */ } /* *INDENT-OFF* */ @@ -553,6 +547,12 @@ thumb_scan_prologue (struct frame_info *fi) int findmask = 0; int i; + /* Don't try to scan dummy frames. */ + if (USE_GENERIC_DUMMY_FRAMES + && fi != NULL + && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) + return; + if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end)) { struct symtab_and_line sal = find_pc_line (prologue_start, 0); @@ -597,7 +597,7 @@ thumb_scan_prologue (struct frame_info *fi) whether to save LR (R14). */ mask = (insn & 0xff) | ((insn & 0x100) << 6); - /* Calculate offsets of saved R0-R7 and LR. */ + /* Calculate offsets of saved R0-R7 and LR. */ for (regno = ARM_LR_REGNUM; regno >= 0; regno--) if (mask & (1 << regno)) { @@ -611,7 +611,7 @@ thumb_scan_prologue (struct frame_info *fi) else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR sub sp, #simm */ { - if ((findmask & 1) == 0) /* before push? */ + if ((findmask & 1) == 0) /* before push? */ continue; else findmask |= 4; /* add/sub sp found */ @@ -857,7 +857,7 @@ arm_scan_prologue (struct frame_info *fi) Be careful, however, and if it doesn't look like a prologue, don't try to scan it. If, for instance, a frameless function begins with stmfd sp!, then we will tell ourselves there is - a frame, which will confuse stack traceback, as well ad"finish" + a frame, which will confuse stack traceback, as well as "finish" and other operations that rely on a knowledge of the stack traceback. @@ -870,7 +870,7 @@ arm_scan_prologue (struct frame_info *fi) [Note further: The "mov ip,sp" only seems to be missing in frameless functions at optimization level "-O2" or above, in which case it is often (but not always) replaced by - "str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */ + "str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */ sp_offset = fp_offset = 0; @@ -904,7 +904,16 @@ arm_scan_prologue (struct frame_info *fi) fi->saved_regs[regno] = sp_offset; } } - else if ((insn & 0xffffcfc0) == 0xe50b0000) /* str rx, [r11, -n] */ + else if ((insn & 0xffffc000) == 0xe54b0000 || /* strb rx,[r11,#-n] */ + (insn & 0xffffc0f0) == 0xe14b00b0 || /* strh rx,[r11,#-n] */ + (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */ + { + /* No need to add this to saved_regs -- it's just an arg reg. */ + continue; + } + else if ((insn & 0xffffc000) == 0xe5cd0000 || /* strb rx,[sp,#n] */ + (insn & 0xffffc0f0) == 0xe1cd00b0 || /* strh rx,[sp,#n] */ + (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; @@ -960,7 +969,7 @@ arm_scan_prologue (struct frame_info *fi) } else if ((insn & 0xf0000000) != 0xe0000000) break; /* Condition not true, exit early */ - else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */ + else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */ break; /* Don't scan past a block load */ else /* The optimizer might shove anything into the prologue, @@ -990,16 +999,27 @@ arm_scan_prologue (struct frame_info *fi) static CORE_ADDR arm_find_callers_reg (struct frame_info *fi, int regnum) { + /* NOTE: cagney/2002-05-03: This function really shouldn't be + needed. Instead the (still being written) register unwind + function could be called directly. */ for (; fi; fi = fi->next) - -#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */ - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); - else -#endif - if (fi->saved_regs[regnum] != 0) - return read_memory_integer (fi->saved_regs[regnum], - REGISTER_RAW_SIZE (regnum)); + { + if (USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) + { + return generic_read_register_dummy (fi->pc, fi->frame, regnum); + } + else if (fi->saved_regs[regnum] != 0) + { + /* NOTE: cagney/2002-05-03: This would normally need to + handle ARM_SP_REGNUM as a special case as, according to + the frame.h comments, saved_regs[SP_REGNUM] contains the + SP value not its address. It appears that the ARM isn't + doing this though. */ + return read_memory_integer (fi->saved_regs[regnum], + REGISTER_RAW_SIZE (regnum)); + } + } return read_register (regnum); } /* Function: frame_chain Given a GDB frame, determine the address of @@ -1011,34 +1031,19 @@ arm_find_callers_reg (struct frame_info *fi, int regnum) static CORE_ADDR arm_frame_chain (struct frame_info *fi) { -#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */ - CORE_ADDR fn_start, callers_pc, fp; - - /* Is this a dummy frame? */ - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return fi->frame; /* dummy frame same as caller's frame */ - - /* Is caller-of-this a dummy frame? */ - callers_pc = FRAME_SAVED_PC (fi); /* find out who called us: */ - fp = arm_find_callers_reg (fi, ARM_FP_REGNUM); - if (PC_IN_CALL_DUMMY (callers_pc, fp, fp)) - return fp; /* dummy frame's frame may bear no relation to ours */ - - if (find_pc_partial_function (fi->pc, 0, &fn_start, 0)) - if (fn_start == entry_point_address ()) - return 0; /* in _start fn, don't chain further */ -#endif - CORE_ADDR caller_pc, fn_start; + CORE_ADDR caller_pc; int framereg = fi->extra_info->framereg; + if (USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (fi->pc, 0, 0)) + /* A generic call dummy's frame is the same as caller's. */ + return fi->frame; + if (fi->pc < LOWEST_PC) return 0; /* If the caller is the startup code, we're at the end of the chain. */ caller_pc = FRAME_SAVED_PC (fi); - if (find_pc_partial_function (caller_pc, 0, &fn_start, 0)) - if (fn_start == entry_point_address ()) - return 0; /* If the caller is Thumb and the caller is ARM, or vice versa, the frame register of the caller is different from ours. @@ -1109,24 +1114,16 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) memset (fi->saved_regs, '\000', sizeof fi->saved_regs); -#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */ - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - { - /* 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, - ARM_SP_REGNUM); - fi->extra_info->framesize = 0; - fi->extra_info->frameoffset = 0; - return; - } - else -#endif - /* Compute stack pointer for this frame. We use this value for both the sigtramp and call dummy cases. */ if (!fi->next) sp = read_sp(); + else if (USE_GENERIC_DUMMY_FRAMES + && 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); else sp = (fi->next->frame - fi->next->extra_info->frameoffset + fi->next->extra_info->framesize); @@ -1188,6 +1185,11 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (!fi->next) /* This is the innermost frame? */ fi->frame = read_register (fi->extra_info->framereg); + else if (USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (fi->next->pc, 0, 0)) + /* Next inner most frame is a dummy, just grab its frame. + Dummy frames always have the same FP as their caller. */ + fi->frame = fi->next->frame; else if (fi->extra_info->framereg == ARM_FP_REGNUM || fi->extra_info->framereg == THUMB_FP_REGNUM) { @@ -1224,11 +1226,11 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) static CORE_ADDR arm_frame_saved_pc (struct frame_info *fi) { -#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */ - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) + /* 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); - else -#endif + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset, fi->frame)) { @@ -1270,6 +1272,16 @@ arm_frame_init_saved_regs (struct frame_info *fip) arm_init_extra_frame_info (0, fip); } +/* Set the return address for a generic dummy frame. ARM uses the + entry point. */ + +static CORE_ADDR +arm_push_return_address (CORE_ADDR pc, CORE_ADDR sp) +{ + write_register (ARM_LR_REGNUM, CALL_DUMMY_ADDRESS ()); + return sp; +} + /* Push an empty stack frame, to record the current PC, etc. */ static void @@ -1524,6 +1536,14 @@ arm_pop_frame (void) CORE_ADDR old_SP = (frame->frame - frame->extra_info->frameoffset + frame->extra_info->framesize); + if (USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + { + generic_pop_dummy_frame (); + flush_cached_frames (); + return; + } + for (regnum = 0; regnum < NUM_REGS; regnum++) if (frame->saved_regs[regnum] != 0) write_register (regnum, @@ -2050,7 +2070,7 @@ arm_get_next_pc (CORE_ADDR pc) static void arm_software_single_step (enum target_signal sig, int insert_bpt) { - static int next_pc; /* State between setting and unsetting. */ + static int next_pc; /* State between setting and unsetting. */ static char break_mem[BREAKPOINT_MAX]; /* Temporary storage for mem@bpt */ if (insert_bpt) @@ -2336,7 +2356,7 @@ arm_store_return_value (struct type *type, char *valbuf) if (TYPE_CODE (type) == TYPE_CODE_FLT) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - char buf[MAX_REGISTER_RAW_SIZE]; + char buf[ARM_MAX_REGISTER_RAW_SIZE]; switch (tdep->fp_model) { @@ -2344,7 +2364,7 @@ arm_store_return_value (struct type *type, char *valbuf) convert_to_extended (valbuf, buf); write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf, - MAX_REGISTER_RAW_SIZE); + FP_REGISTER_RAW_SIZE); break; case ARM_FLOAT_SOFT: @@ -2893,6 +2913,11 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->lowest_pc = 0x20; tdep->jb_pc = -1; /* Longjump support not enabled by default. */ +#if OLD_STYLE_ARM_DUMMY_FRAMES + /* NOTE: cagney/2002-05-07: Enable the below to restore the old ARM + specific (non-generic) dummy frame code. Might be useful if + there appears to be a problem with the generic dummy frame + mechanism that replaced it. */ set_gdbarch_use_generic_dummy_frames (gdbarch, 0); /* Call dummy code. */ @@ -2912,6 +2937,27 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fix_call_dummy (gdbarch, arm_fix_call_dummy); set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack); +#else + set_gdbarch_use_generic_dummy_frames (gdbarch, 1); + set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); + + set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); + + set_gdbarch_call_dummy_p (gdbarch, 1); + set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); + + set_gdbarch_call_dummy_words (gdbarch, arm_call_dummy_words); + set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); + set_gdbarch_call_dummy_start_offset (gdbarch, 0); + set_gdbarch_call_dummy_length (gdbarch, 0); + + set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); + set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy); + + set_gdbarch_call_dummy_address (gdbarch, entry_point_address); + set_gdbarch_push_return_address (gdbarch, arm_push_return_address); +#endif set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); set_gdbarch_push_arguments (gdbarch, arm_push_arguments); @@ -2931,7 +2977,15 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs); +#if OLD_STYLE_ARM_DUMMY_FRAMES + /* NOTE: cagney/2002-05-07: Enable the below to restore the old ARM + specific (non-generic) dummy frame code. Might be useful if + there appears to be a problem with the generic dummy frame + mechanism that replaced it. */ set_gdbarch_push_dummy_frame (gdbarch, arm_push_dummy_frame); +#else + set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); +#endif set_gdbarch_pop_frame (gdbarch, arm_pop_frame); /* Address manipulation. */ diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index 0fad4fd..e7c5651 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -45,6 +45,10 @@ enum gdb_regnum { ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM }; +/* Used in target-specific code when we need to know the size of the + largest type of register we need to handle. */ +#define ARM_MAX_REGISTER_RAW_SIZE 12 +#define ARM_MAX_REGISTER_VIRTUAL_SIZE 8 /* Size of integer registers. */ #define INT_REGISTER_RAW_SIZE 4 diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index aa9f92a..368b9df 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -353,7 +353,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type) { /* Do we need to sign-extend this? */ if (!TYPE_UNSIGNED (type)) - ax_ext (ax, type->length * TARGET_CHAR_BIT); + ax_ext (ax, TYPE_LENGTH (type) * TARGET_CHAR_BIT); } @@ -363,7 +363,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type) static void gen_extend (struct agent_expr *ax, struct type *type) { - int bits = type->length * TARGET_CHAR_BIT; + int bits = TYPE_LENGTH (type) * TARGET_CHAR_BIT; /* I just had to. */ ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, bits)); } @@ -381,7 +381,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) ax_trace_quick (ax, TYPE_LENGTH (type)); } - switch (type->code) + switch (TYPE_CODE (type)) { case TYPE_CODE_PTR: case TYPE_CODE_ENUM: @@ -389,7 +389,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) case TYPE_CODE_CHAR: /* It's a scalar value, so we know how to dereference it. How many bytes long is it? */ - switch (type->length) + switch (TYPE_LENGTH (type)) { case 8 / TARGET_CHAR_BIT: ax_simple (ax, aop_ref8); @@ -699,7 +699,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value) the stack. Should we tweak the type? */ /* Some types require special handling. */ - switch (value->type->code) + switch (TYPE_CODE (value->type)) { /* Functions get converted to a pointer to the function. */ case TYPE_CODE_FUNC: @@ -874,7 +874,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type) /* Dereference typedefs. */ type = check_typedef (type); - switch (type->code) + switch (TYPE_CODE (type)) { case TYPE_CODE_PTR: /* It's implementation-defined, and I'll bet this is what GCC @@ -925,9 +925,9 @@ gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type) { struct type *element = TYPE_TARGET_TYPE (type); - if (element->length != 1) + if (TYPE_LENGTH (element) != 1) { - ax_const_l (ax, element->length); + ax_const_l (ax, TYPE_LENGTH (element)); ax_simple (ax, op); } } @@ -943,8 +943,8 @@ gen_add (struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2, char *name) { /* Is it INT+PTR? */ - if (value1->type->code == TYPE_CODE_INT - && value2->type->code == TYPE_CODE_PTR) + if (TYPE_CODE (value1->type) == TYPE_CODE_INT + && TYPE_CODE (value2->type) == TYPE_CODE_PTR) { /* Swap the values and proceed normally. */ ax_simple (ax, aop_swap); @@ -955,8 +955,8 @@ gen_add (struct agent_expr *ax, struct axs_value *value, } /* Is it PTR+INT? */ - else if (value1->type->code == TYPE_CODE_PTR - && value2->type->code == TYPE_CODE_INT) + else if (TYPE_CODE (value1->type) == TYPE_CODE_PTR + && TYPE_CODE (value2->type) == TYPE_CODE_INT) { gen_scale (ax, aop_mul, value1->type); ax_simple (ax, aop_add); @@ -966,8 +966,8 @@ gen_add (struct agent_expr *ax, struct axs_value *value, /* Must be number + number; the usual binary conversions will have brought them both to the same width. */ - else if (value1->type->code == TYPE_CODE_INT - && value2->type->code == TYPE_CODE_INT) + else if (TYPE_CODE (value1->type) == TYPE_CODE_INT + && TYPE_CODE (value2->type) == TYPE_CODE_INT) { ax_simple (ax, aop_add); gen_extend (ax, value1->type); /* Catch overflow. */ @@ -989,10 +989,10 @@ static void gen_sub (struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2) { - if (value1->type->code == TYPE_CODE_PTR) + if (TYPE_CODE (value1->type) == TYPE_CODE_PTR) { /* Is it PTR - INT? */ - if (value2->type->code == TYPE_CODE_INT) + if (TYPE_CODE (value2->type) == TYPE_CODE_INT) { gen_scale (ax, aop_mul, value1->type); ax_simple (ax, aop_sub); @@ -1003,7 +1003,7 @@ gen_sub (struct agent_expr *ax, struct axs_value *value, /* Is it PTR - PTR? Strictly speaking, the types ought to match, but this is what the normal GDB expression evaluator tests for. */ - else if (value2->type->code == TYPE_CODE_PTR + else if (TYPE_CODE (value2->type) == TYPE_CODE_PTR && (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type)) == TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type)))) { @@ -1018,8 +1018,8 @@ an integer nor a pointer of the same type."); } /* Must be number + number. */ - else if (value1->type->code == TYPE_CODE_INT - && value2->type->code == TYPE_CODE_INT) + else if (TYPE_CODE (value1->type) == TYPE_CODE_INT + && TYPE_CODE (value2->type) == TYPE_CODE_INT) { ax_simple (ax, aop_sub); gen_extend (ax, value1->type); /* Catch overflow. */ @@ -1044,8 +1044,8 @@ gen_binop (struct agent_expr *ax, struct axs_value *value, enum agent_op op_unsigned, int may_carry, char *name) { /* We only handle INT op INT. */ - if ((value1->type->code != TYPE_CODE_INT) - || (value2->type->code != TYPE_CODE_INT)) + if ((TYPE_CODE (value1->type) != TYPE_CODE_INT) + || (TYPE_CODE (value2->type) != TYPE_CODE_INT)) error ("Illegal combination of types in %s.", name); ax_simple (ax, @@ -1092,7 +1092,7 @@ gen_deref (struct agent_expr *ax, struct axs_value *value) { /* The caller should check the type, because several operators use this, and we don't know what error message to generate. */ - if (value->type->code != TYPE_CODE_PTR) + if (TYPE_CODE (value->type) != TYPE_CODE_PTR) internal_error (__FILE__, __LINE__, "gen_deref: expected a pointer"); @@ -1102,7 +1102,7 @@ gen_deref (struct agent_expr *ax, struct axs_value *value) T" to "T", and mark the value as an lvalue in memory. Leave it to the consumer to actually dereference it. */ value->type = check_typedef (TYPE_TARGET_TYPE (value->type)); - value->kind = ((value->type->code == TYPE_CODE_FUNC) + value->kind = ((TYPE_CODE (value->type) == TYPE_CODE_FUNC) ? axs_rvalue : axs_lvalue_memory); } @@ -1114,7 +1114,7 @@ gen_address_of (struct agent_expr *ax, struct axs_value *value) /* Special case for taking the address of a function. The ANSI standard describes this as a special case, too, so this arrangement is not without motivation. */ - if (value->type->code == TYPE_CODE_FUNC) + if (TYPE_CODE (value->type) == TYPE_CODE_FUNC) /* The value's already an rvalue on the stack, so we just need to change the type. */ value->type = lookup_pointer_type (value->type); @@ -1346,7 +1346,7 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value, char *field, /* Follow pointers until we reach a non-pointer. These aren't the C semantics, but they're what the normal GDB evaluator does, so we should at least be consistent. */ - while (value->type->code == TYPE_CODE_PTR) + while (TYPE_CODE (value->type) == TYPE_CODE_PTR) { gen_usual_unary (ax, value); gen_deref (ax, value); @@ -1410,7 +1410,7 @@ gen_repeat (union exp_element **pc, struct agent_expr *ax, if (!v) error ("Right operand of `@' must be a constant, in agent expressions."); - if (v->type->code != TYPE_CODE_INT) + if (TYPE_CODE (v->type) != TYPE_CODE_INT) error ("Right operand of `@' must be an integer."); length = value_as_long (v); if (length <= 0) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 0e4f9b8..5078935 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -36,9 +36,10 @@ #include "complaints.h" #include "gdb_string.h" #include "expression.h" /* For "enum exp_opcode" used by... */ -#include "language.h" /* For "longest_local_hex_string_custom" */ +#include "language.h" /* For "local_hex_string" */ #include "bcache.h" #include "filenames.h" /* For DOSish file names */ +#include "macrotab.h" /* Ask buildsym.h to define the vars it normally declares `extern'. */ #define EXTERN /**/ @@ -192,6 +193,9 @@ really_free_pendings (PTR dummy) xfree ((void *) next); } global_symbols = NULL; + + if (pending_macros) + free_macro_table (pending_macros); } /* This function is called to discard any pending blocks. */ @@ -509,7 +513,7 @@ make_blockvector (struct objfile *objfile) = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)); complain (&blockvector_complaint, - longest_local_hex_string ((LONGEST) start)); + local_hex_string ((LONGEST) start)); } } } @@ -883,7 +887,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) if (pending_blocks == NULL && file_symbols == NULL && global_symbols == NULL - && have_line_numbers == 0) + && have_line_numbers == 0 + && pending_macros == NULL) { /* Ignore symtabs that have no functions with real debugging info. */ @@ -944,6 +949,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) /* Fill in its components. */ symtab->blockvector = blockvector; + symtab->macro_table = pending_macros; if (subfile->line_vector) { /* Reallocate the line table on the symbol obstack */ @@ -1022,6 +1028,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) last_source_file = NULL; current_subfile = NULL; + pending_macros = NULL; return symtab; } @@ -1112,6 +1119,7 @@ buildsym_init (void) file_symbols = NULL; global_symbols = NULL; pending_blocks = NULL; + pending_macros = NULL; } /* Initialize anything that needs initializing when a completely new diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 40a339d..d023aa3 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -296,6 +296,10 @@ extern void record_debugformat (char *format); extern void merge_symbol_lists (struct pending **srclist, struct pending **targetlist); +/* The macro table for the compilation unit whose symbols we're + currently reading. All the symtabs for this CU will point to this. */ +EXTERN struct macro_table *pending_macros; + #undef EXTERN #endif /* defined (BUILDSYM_H) */ diff --git a/gdb/builtin-regs.c b/gdb/builtin-regs.c index f9a6781..8c488e3 100644 --- a/gdb/builtin-regs.c +++ b/gdb/builtin-regs.c @@ -71,7 +71,7 @@ builtin_reg_map_name_to_regnum (const char *name, int len) struct value * value_of_builtin_reg (int regnum, struct frame_info *frame) { - int reg = regnum - NUM_REGS + NUM_PSEUDO_REGS; + int reg = regnum - (NUM_REGS + NUM_PSEUDO_REGS); gdb_assert (reg >= 0 && reg < nr_builtin_regs); return builtin_regs[reg].value (frame); } diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 0c460e9..430d567 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -158,7 +158,7 @@ cp_type_print_method_args (struct type **args, char *prefix, char *varstring, fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI); fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI); fputs_filtered ("(", stream); - if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID) + if (args && args[!staticp] && TYPE_CODE (args[!staticp]) != TYPE_CODE_VOID) { i = !staticp; /* skip the class variable */ while (1) @@ -169,7 +169,7 @@ cp_type_print_method_args (struct type **args, char *prefix, char *varstring, fprintf_filtered (stream, " ..."); break; } - else if (args[i]->code != TYPE_CODE_VOID) + else if (TYPE_CODE (args[i]) != TYPE_CODE_VOID) { fprintf_filtered (stream, ", "); } @@ -316,7 +316,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream, did_print_modifier = 1; } - address_space_id = address_space_int_to_name (TYPE_FLAGS (type)); + address_space_id = address_space_int_to_name (TYPE_INSTANCE_FLAGS (type)); if (address_space_id) { if (did_print_modifier || need_pre_space) @@ -346,7 +346,7 @@ c_type_print_args (struct type *type, struct ui_file *stream) { fprintf_filtered (stream, "..."); } - else if ((args[1]->code == TYPE_CODE_VOID) && + else if ((TYPE_CODE (args[1]) == TYPE_CODE_VOID) && (current_language->la_language == language_cplus)) { fprintf_filtered (stream, "void"); @@ -354,7 +354,7 @@ c_type_print_args (struct type *type, struct ui_file *stream) else { for (i = 1; - args[i] != NULL && args[i]->code != TYPE_CODE_VOID; + args[i] != NULL && TYPE_CODE (args[i]) != TYPE_CODE_VOID; i++) { c_print_type (args[i], "", stream, -1, 0); @@ -362,7 +362,7 @@ c_type_print_args (struct type *type, struct ui_file *stream) { fprintf_filtered (stream, "..."); } - else if (args[i + 1]->code != TYPE_CODE_VOID) + else if (TYPE_CODE (args[i + 1]) != TYPE_CODE_VOID) { fprintf_filtered (stream, ","); wrap_here (" "); diff --git a/gdb/config/alpha/fbsd.mt b/gdb/config/alpha/fbsd.mt index 48e54fa..4b4ecbf 100644 --- a/gdb/config/alpha/fbsd.mt +++ b/gdb/config/alpha/fbsd.mt @@ -1,3 +1,3 @@ # Target: FreeBSD/Alpha -TDEPFILES= alpha-tdep.o alphafbsd-tdep.o +TDEPFILES= alpha-tdep.o alphabsd-tdep.o alphafbsd-tdep.o TM_FILE= tm-fbsd.h diff --git a/gdb/config/alpha/nbsd.mh b/gdb/config/alpha/nbsd.mh index 4d7664b..52754a3 100644 --- a/gdb/config/alpha/nbsd.mh +++ b/gdb/config/alpha/nbsd.mh @@ -1,4 +1,4 @@ # Host: Alpha running NetBSD NAT_CLIBS= -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o alphabsd-nat.o alphanbsd-nat.o +NATDEPFILES= infptrace.o inftarg.o fork-child.o alphabsd-nat.o NAT_FILE= nm-nbsd.h diff --git a/gdb/config/alpha/nbsd.mt b/gdb/config/alpha/nbsd.mt index f3a2ff1..7fd9c50 100644 --- a/gdb/config/alpha/nbsd.mt +++ b/gdb/config/alpha/nbsd.mt @@ -1,3 +1,4 @@ # Target: Alpha running NetBSD -TDEPFILES= alpha-tdep.o alphanbsd-tdep.o solib.o solib-svr4.o +TDEPFILES= alpha-tdep.o alphabsd-tdep.o alphanbsd-tdep.o corelow.o \ + nbsd-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h diff --git a/gdb/config/arm/nm-nbsd.h b/gdb/config/arm/nm-nbsd.h index 431a695..435c5e7 100644 --- a/gdb/config/arm/nm-nbsd.h +++ b/gdb/config/arm/nm-nbsd.h @@ -22,12 +22,6 @@ #define NM_NBSD_H /* Get generic NetBSD native definitions. */ -#include "nm-nbsd.h" - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = arm_register_u_addr ((blockend),(regno)); - -extern int -arm_register_u_addr (int, int); +#include #endif /* NM_NBSD_H */ diff --git a/gdb/config/avr/avr.mt b/gdb/config/avr/avr.mt deleted file mode 100644 index 0354a42..0000000 --- a/gdb/config/avr/avr.mt +++ /dev/null @@ -1,12 +0,0 @@ -# Target: AVR -TDEPFILES= avr-tdep.o - -# -# There is no simulator provided with gdb (yet). -# -# See for the simulator -# used during development of avr support for gdb. -# -# Simulator: AVR -#SIM_OBS = remote-sim.o -#SIM = ../sim/avr/libsim.a diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 6374acc..eb5052f 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -52,6 +52,8 @@ @V@/gdb/ChangeLog-2000 @V@/gdb/ChangeLog.000 @V@/gdb/ChangeLog-2001 @V@/gdb/ChangeLog.001 @V@/gdb/ChangeLog-3.x @V@/gdb/ChangeLog.3-x +@V@/gdb/alphanbsd-nat.c @V@/gdb/alphnb-nat.c +@V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c @V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c @V@/gdb/arm-linux-tdep.c @V@/gdb/armlin-tdep.c @V@/gdb/armnbsd-nat.c @V@/gdb/armnbd-nat.c diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh index 4509b9c..08d9e7d 100644 --- a/gdb/config/i386/fbsd.mh +++ b/gdb/config/i386/fbsd.mh @@ -4,4 +4,4 @@ XM_FILE= xm-i386.h NAT_FILE= nm-fbsd.h # NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make. -NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-aout.o core-regset.o i386-nat.o i387-nat.o i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-aout.o core-regset.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o diff --git a/gdb/config/i386/go32.mh b/gdb/config/i386/go32.mh index 3d3bdfd..94a7a9d 100644 --- a/gdb/config/i386/go32.mh +++ b/gdb/config/i386/go32.mh @@ -7,7 +7,7 @@ MMALLOC_CFLAGS= XM_FILE= xm-go32.h NAT_FILE= nm-go32.h -NATDEPFILES= go32-nat.o i386-nat.o i387-nat.o +NATDEPFILES= go32-nat.o i386-nat.o TERMCAP= HOST_IPC= diff --git a/gdb/config/i386/i386gnu.mh b/gdb/config/i386/i386gnu.mh index 13feba5..da444a5 100644 --- a/gdb/config/i386/i386gnu.mh +++ b/gdb/config/i386/i386gnu.mh @@ -1,5 +1,5 @@ # Host: Intel 386 running the GNU Hurd -NATDEPFILES= i386gnu-nat.o i387-nat.o gnu-nat.o corelow.o core-regset.o \ +NATDEPFILES= i386gnu-nat.o gnu-nat.o corelow.o core-regset.o \ fork-child.o solib.o solib-svr4.o solib-legacy.o \ notify_S.o process_reply_S.o msg_reply_S.o \ msg_U.o exc_request_U.o exc_request_S.o diff --git a/gdb/config/i386/i386sol2.mh b/gdb/config/i386/i386sol2.mh index ab7f474..ec93f4a 100644 --- a/gdb/config/i386/i386sol2.mh +++ b/gdb/config/i386/i386sol2.mh @@ -4,5 +4,5 @@ XM_FILE= xm-i386v4.h XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-i386sol2.h -NATDEPFILES= core-regset.o fork-child.o i386v4-nat.o i387-nat.o corelow.o \ +NATDEPFILES= core-regset.o fork-child.o i386v4-nat.o corelow.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o diff --git a/gdb/config/i386/i386v42mp.mh b/gdb/config/i386/i386v42mp.mh index 6479be3..4aac5d9 100644 --- a/gdb/config/i386/i386v42mp.mh +++ b/gdb/config/i386/i386v42mp.mh @@ -14,7 +14,7 @@ NAT_FILE= nm-i386v42mp.h # continuation character (backslash) to extend a commented line. As a # consequence, make considers subsequent tab-indented lines to be # some sort of error. -NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o i387-nat.o \ +NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o \ gcore.o solib.o solib-svr4.o solib-legacy.o procfs.o proc-api.o \ proc-events.o proc-flags.o proc-why.o uw-thread.o diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh index cc645e9..494ccf1 100644 --- a/gdb/config/i386/linux.mh +++ b/gdb/config/i386/linux.mh @@ -4,7 +4,7 @@ XM_FILE= xm-i386.h NAT_FILE= nm-linux.h NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \ - core-aout.o i386-nat.o i386-linux-nat.o i387-nat.o \ + core-aout.o i386-nat.o i386-linux-nat.o \ proc-service.o thread-db.o lin-lwp.o linux-proc.o gcore.o # The dynamically loaded libthread_db needs access to symbols in the diff --git a/gdb/config/i386/nbsd.mh b/gdb/config/i386/nbsd.mh index 66f4561..bf957b5 100644 --- a/gdb/config/i386/nbsd.mh +++ b/gdb/config/i386/nbsd.mh @@ -1,12 +1,6 @@ # Host: Intel 386 running NetBSD - -# NATDEPFILES must remain entirely on one line for *BSD. When -# building a cross debugger, configure will cause this line to be -# commented out in the Makefile. BSD make doesn't permit the use of a -# continuation character (backslash) to extend a commented line. As a -# consequence, BSD make considers subsequent tab-indented lines to be -# "unassociated shell commands". -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i387-nat.o i386bsd-nat.o i386nbsd-nat.o solib.o solib-sunos.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ + solib.o solib-sunos.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/i386/nbsd.mt b/gdb/config/i386/nbsd.mt index b8fc668..fc80608 100644 --- a/gdb/config/i386/nbsd.mt +++ b/gdb/config/i386/nbsd.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running NetBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o +TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o TM_FILE= tm-nbsd.h diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh index f25a406..d0cbe78 100644 --- a/gdb/config/i386/nbsdelf.mh +++ b/gdb/config/i386/nbsdelf.mh @@ -1,4 +1,5 @@ # Host: Intel 386 running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i387-nat.o i386bsd-nat.o i386nbsd-nat.o solib.o solib-svr4.o solib-legacy.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ + solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsdelf.h diff --git a/gdb/config/i386/nbsdelf.mt b/gdb/config/i386/nbsdelf.mt index 1bccd32..e5cdc25 100644 --- a/gdb/config/i386/nbsdelf.mt +++ b/gdb/config/i386/nbsdelf.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running NetBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o +TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o TM_FILE= tm-nbsdelf.h diff --git a/gdb/config/i386/obsd.mh b/gdb/config/i386/obsd.mh index 2bfd732..d9593ce 100644 --- a/gdb/config/i386/obsd.mh +++ b/gdb/config/i386/obsd.mh @@ -4,4 +4,4 @@ XM_FILE= xm-i386.h NAT_FILE= nm-obsd.h # NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make. -NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-sunos.o corelow.o core-aout.o i386-nat.o i387-nat.o i386bsd-nat.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-sunos.o corelow.o core-aout.o i386-nat.o i386bsd-nat.o diff --git a/gdb/config/i386/tm-nbsd.h b/gdb/config/i386/tm-nbsd.h index ff67a5e..8f1295e 100644 --- a/gdb/config/i386/tm-nbsd.h +++ b/gdb/config/i386/tm-nbsd.h @@ -27,9 +27,9 @@ #include "i386/tm-i386.h" #include "config/tm-nbsd.h" -extern use_struct_convention_fn i386nbsd_use_struct_convention; +extern use_struct_convention_fn i386nbsd_aout_use_struct_convention; #define USE_STRUCT_CONVENTION(gcc_p, type) \ - i386nbsd_use_struct_convention(gcc_p, type) + i386nbsd_aout_use_struct_convention(gcc_p, type) #define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ diff --git a/gdb/config/i386/x86-64linux.mh b/gdb/config/i386/x86-64linux.mh index a0a192c..bc79f3f 100644 --- a/gdb/config/i386/x86-64linux.mh +++ b/gdb/config/i386/x86-64linux.mh @@ -5,7 +5,7 @@ XM_FILE= xm-i386.h NAT_FILE= nm-x86-64.h NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \ core-aout.o i386-nat.o x86-64-linux-nat.o \ - i387-nat.o proc-service.o thread-db.o lin-lwp.o \ + proc-service.o thread-db.o lin-lwp.o \ linux-proc.o gcore.o LOADLIBES = -ldl -rdynamic diff --git a/gdb/config/m68k/nbsd.mh b/gdb/config/m68k/nbsd.mh index 6774ea2..30c800a 100644 --- a/gdb/config/m68k/nbsd.mh +++ b/gdb/config/m68k/nbsd.mh @@ -1,4 +1,5 @@ # Host: Motorola m68k running NetBSD -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o solib.o solib-sunos.o +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o \ + solib.o solib-sunos.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h index 4df0822..7405c12 100644 --- a/gdb/config/m88k/tm-m88k.h +++ b/gdb/config/m88k/tm-m88k.h @@ -1,7 +1,7 @@ /* Target machine description for generic Motorola 88000, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1996, 1998, - 1999, 2000 - Free Software Foundation, Inc. + + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1996, + 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -266,7 +266,8 @@ extern CORE_ADDR m88k_addr_bits_remove (CORE_ADDR); #define PC_REGNUM SXIP_REGNUM /* Program Counter */ #define NPC_REGNUM SNIP_REGNUM /* Next Program Counter */ -#define NNPC_REGNUM SFIP_REGNUM /* Next Next Program Counter */ +#define M88K_NNPC_REGNUM SFIP_REGNUM /* Next Next Program Counter */ + #define PSR_REGNUM 32 /* Processor Status Register */ #define FPSR_REGNUM 33 /* Floating Point Status Register */ @@ -330,7 +331,7 @@ if (!target_is_m88110) \ CORE_ADDR npc = read_register (NPC_REGNUM); \ if (pc != npc) \ { \ - write_register (NNPC_REGNUM, npc); \ + write_register (M88K_NNPC_REGNUM, npc); \ write_register (NPC_REGNUM, pc); \ } \ } @@ -582,8 +583,5 @@ extern void m88k_push_dummy_frame (); -- Kevin Buettner */ -#define TARGET_WRITE_PC(val, pid) { \ - write_register_pid(SXIP_REGNUM, (long) val, pid); \ - write_register_pid(SNIP_REGNUM, (long) val | 2, pid); \ - write_register_pid(SFIP_REGNUM, ((long) val | 2) + 4, pid); \ -} +extern void m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid); +#define TARGET_WRITE_PC(VAL, PID) m88k_target_write_pc (VAL, PID) diff --git a/gdb/config/ns32k/nbsd.mh b/gdb/config/ns32k/nbsd.mh index 665d4e3..e39c657 100644 --- a/gdb/config/ns32k/nbsd.mh +++ b/gdb/config/ns32k/nbsd.mh @@ -1,4 +1,5 @@ # Host: PC532 running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o solib.o solib-sunos.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o \ + solib.o solib-sunos.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh index dcb0f7a..a6de76d 100644 --- a/gdb/config/powerpc/nbsd.mh +++ b/gdb/config/powerpc/nbsd.mh @@ -1,3 +1,4 @@ # Host: PowerPC, running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o solib.o solib-svr4.o solib-legacy.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o \ + solib.o solib-svr4.o solib-legacy.o NAT_FILE= nm-nbsd.h diff --git a/gdb/config/sh/nbsd.mh b/gdb/config/sh/nbsd.mh new file mode 100644 index 0000000..dd677b6 --- /dev/null +++ b/gdb/config/sh/nbsd.mh @@ -0,0 +1,4 @@ +# Host: SuperH running NetBSD +NAT_CLIBS= +NATDEPFILES= infptrace.o inftarg.o fork-child.o shnbsd-nat.o +NAT_FILE= nm-nbsd.h diff --git a/gdb/config/sh/nbsd.mt b/gdb/config/sh/nbsd.mt new file mode 100644 index 0000000..62d0c5c --- /dev/null +++ b/gdb/config/sh/nbsd.mt @@ -0,0 +1,6 @@ +# Target: SuperH running NetBSD +TDEPFILES= sh-tdep.o shnbsd-tdep.o corelow.o nbsd-tdep.o solib.o solib-svr4.o +TM_FILE= tm-nbsd.h + +SIM_OBS = remote-sim.o +SIM = ../sim/sh/libsim.a diff --git a/gdb/config/sh/nm-nbsd.h b/gdb/config/sh/nm-nbsd.h new file mode 100644 index 0000000..eb38d6b --- /dev/null +++ b/gdb/config/sh/nm-nbsd.h @@ -0,0 +1,28 @@ +/* Native-dependent definitions for SuperH running NetBSD, for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 NM_NBSD_H +#define NM_NBSD_H + +/* Get generic NetBSD native definitions. */ +#include "config/nm-nbsd.h" + +#endif /* NM_NBSD_H */ diff --git a/gdb/config/sh/tm-nbsd.h b/gdb/config/sh/tm-nbsd.h new file mode 100644 index 0000000..37dfe34 --- /dev/null +++ b/gdb/config/sh/tm-nbsd.h @@ -0,0 +1,28 @@ +/* Target-dependent definitions for SuperH running NetBSD, for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef TM_NBSD_H +#define TM_NBSD_H + +#include "sh/tm-sh.h" +#include "solib.h" + +#endif /* TM_NBSD_H */ diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 1690ecf..bae87b8 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -1,5 +1,5 @@ /* Target-specific definition for a Hitachi Super-H. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -25,6 +25,24 @@ /* Information that is dependent on the processor variant. */ +/* ABI variants that we know about. If you add to this enum, please + update the table of names in sh-tdep.c. */ +enum sh_osabi +{ + SH_OSABI_UNKNOWN = 0, + SH_OSABI_LINUX, + SH_OSABI_NETBSD_ELF, + + SH_OSABI_INVALID /* Keep this last. */ +}; + +enum sh_abi + { + SH_ABI_UNKNOWN, + SH_ABI_32, + SH_ABI_64 + }; + struct gdbarch_tdep { int PR_REGNUM; @@ -52,10 +70,36 @@ struct gdbarch_tdep int DR_LAST_REGNUM; /* sh4 */ int FV0_REGNUM; /* sh4 */ int FV_LAST_REGNUM; /* sh4 */ + /* FPP stands for Floating Point Pair, to avoid confusion with + GDB's FP0_REGNUM, which is the number of the first Floating + point register. Unfortunately on the sh5, the floating point + registers are called FR, and the floating point pairs are called FP. */ + int TR7_REGNUM; /* sh5-media*/ + int FPP0_REGNUM; /* sh5-media*/ + int FPP_LAST_REGNUM; /* sh5-media*/ + int R0_C_REGNUM; /* sh5-compact*/ + int R_LAST_C_REGNUM; /* sh5-compact*/ + int PC_C_REGNUM; /* sh5-compact*/ + int GBR_C_REGNUM; /* sh5-compact*/ + int MACH_C_REGNUM; /* sh5-compact*/ + int MACL_C_REGNUM; /* sh5-compact*/ + int PR_C_REGNUM; /* sh5-compact*/ + int T_C_REGNUM; /* sh5-compact*/ + int FPSCR_C_REGNUM; /* sh5-compact*/ + int FPUL_C_REGNUM; /* sh5-compact*/ + int FP0_C_REGNUM; /* sh5-compact*/ + int FP_LAST_C_REGNUM; /* sh5-compact*/ + int DR0_C_REGNUM; /* sh5-compact*/ + int DR_LAST_C_REGNUM; /* sh5-compact*/ + int FV0_C_REGNUM; /* sh5-compact*/ + int FV_LAST_C_REGNUM; /* sh5-compact*/ int ARG0_REGNUM; int ARGLAST_REGNUM; int FLOAT_ARGLAST_REGNUM; int RETURN_REGNUM; + enum sh_osabi sh_osabi; /* OS/ABI of the inferior */ + const char *osabi_name; /* Name of the above */ + enum sh_abi sh_abi; }; /* Registers common to all the SH variants. */ @@ -81,4 +125,3 @@ enum #define LITTLE_REMOTE_BREAKPOINT { 0x20, 0xc3 } /* Used in remote.c */ /*#define NOP {0x20, 0x0b}*/ /* Who uses this???*/ - diff --git a/gdb/config/sparc/nbsd.mh b/gdb/config/sparc/nbsd.mh index 7e68541..bf64592 100644 --- a/gdb/config/sparc/nbsd.mh +++ b/gdb/config/sparc/nbsd.mh @@ -1,5 +1,6 @@ # Host: Sun 4 or Sparcstation, running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-sunos.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \ + solib.o solib-sunos.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h HOST_IPC=-DBSD_IPC diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh index 7c5a123..f2599fd 100644 --- a/gdb/config/sparc/nbsdelf.mh +++ b/gdb/config/sparc/nbsdelf.mh @@ -1,5 +1,6 @@ # Host: Sun 4 or Sparcstation, running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o solib-legacy.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \ + solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsdelf.h HOST_IPC=-DBSD_IPC diff --git a/gdb/configure b/gdb/configure index e192e4c..d8493a9 100755 --- a/gdb/configure +++ b/gdb/configure @@ -79,7 +79,6 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= -sitefile= srcdir= target=NONE verbose= @@ -194,7 +193,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 +363,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 +528,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 +574,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:578: 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 +600,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:604: 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 +630,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:634: 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 +681,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:685: 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 +713,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:717: 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 +724,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 739 "configure" +#line 728 "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:733: \"$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 +755,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:759: 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:764: 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 +769,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:773: \"$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 +788,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:792: 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 +820,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:824: 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 +835,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < 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:845: \"$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 +852,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < 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:862: \"$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 +869,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < 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:879: \"$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 +900,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:904: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:939: checking for POSIXized ISC" >&5 +echo "configure:928: 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 +948,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:952: 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 +965,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 < #include @@ -1013,7 +1002,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:1006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else @@ -1084,7 +1073,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:1077: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1105,7 +1094,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:1098: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1123,7 +1112,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:1116: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1148,7 +1137,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:1141: 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 +1166,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:1170: 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 +1194,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:1198: 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 < #include @@ -1218,7 +1207,7 @@ else #include 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:1211: \"$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 +1224,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 @@ -1253,7 +1242,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 @@ -1274,7 +1263,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1285,7 +1274,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:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1309,12 +1298,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1313: checking for working const" >&5 +echo "configure:1302: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1384,21 +1373,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1388: checking for inline" >&5 +echo "configure:1377: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1424,12 +1413,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1428: checking for off_t" >&5 +echo "configure:1417: 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 < #if STDC_HEADERS @@ -1457,12 +1446,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1461: checking for size_t" >&5 +echo "configure:1450: 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 < #if STDC_HEADERS @@ -1492,19 +1481,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:1485: 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 < 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:1497: \"$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 +1514,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1529: checking for alloca" >&5 +echo "configure:1518: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1551: \"$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 +1579,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:1583: 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 <&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:1613: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1641: \"$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 +1664,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:1668: 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 +1672,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1695: \"$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 @@ -1727,17 +1716,17 @@ for ac_hdr in unistd.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:1720: 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 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:1730: \"$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 +1755,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:1759: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1787: \"$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 +1808,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1823: checking for working mmap" >&5 +echo "configure:1812: 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 +1816,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1960: \"$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 +1984,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:1988: 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 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:1998: \"$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 +2024,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:2028: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2056: \"$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 +2081,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:2085: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2113: \"$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 +2143,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:2147: 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 < 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:2159: \"$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 +2176,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:2180: 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 +2196,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:2200: 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 +2215,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:2219: 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 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:2229: \"$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 +2242,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:2246: 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 < 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:2258: \"$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 +2270,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:2274: 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 +2278,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2293: \"$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 +2305,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:2309: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2321: \"$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 +2345,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:2349: 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 +2379,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:2383: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2411: \"$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 +2434,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:2438: 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 +2470,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:2474: 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 +2502,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -2553,7 +2542,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:2546: 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 +2576,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:2580: 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 +2612,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:2616: 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 +2702,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:2706: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -2741,17 +2730,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:2734: 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 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:2744: \"$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* @@ -2874,7 +2863,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:2878: checking for $ac_word" >&5 +echo "configure:2867: 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 @@ -2915,7 +2904,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:2919: checking for a BSD compatible install" >&5 +echo "configure:2908: 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 @@ -2976,7 +2965,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:2980: checking for $ac_word" >&5 +echo "configure:2969: 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 @@ -3008,7 +2997,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:3012: checking for $ac_word" >&5 +echo "configure:3001: 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 @@ -3040,7 +3029,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:3044: checking for $ac_word" >&5 +echo "configure:3033: 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 @@ -3075,7 +3064,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:3079: checking for $ac_word" >&5 +echo "configure:3068: 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 @@ -3107,7 +3096,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:3111: checking for $ac_word" >&5 +echo "configure:3100: 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 @@ -3141,7 +3130,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:3145: checking for $ac_word" >&5 +echo "configure:3134: 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 @@ -3175,7 +3164,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:3179: checking for $ac_word" >&5 +echo "configure:3168: 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 @@ -3226,12 +3215,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:3230: checking return type of signal handlers" >&5 +echo "configure:3219: 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 < #include @@ -3248,7 +3237,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3241: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3268,12 +3257,12 @@ EOF echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3272: checking for ANSI C header files" >&5 +echo "configure:3261: 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 < #include @@ -3281,7 +3270,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3274: \"$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* @@ -3298,7 +3287,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 @@ -3316,7 +3305,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 @@ -3337,7 +3326,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3348,7 +3337,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3392,17 +3381,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:3396: checking for $ac_hdr" >&5 +echo "configure:3385: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3395: \"$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* @@ -3429,12 +3418,12 @@ fi done echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:3433: checking whether stat file-mode macros are broken" >&5 +echo "configure:3422: 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 < #include @@ -3486,12 +3475,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3490: checking for working const" >&5 +echo "configure:3479: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3561,21 +3550,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3565: checking for inline" >&5 +echo "configure:3554: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3605,12 +3594,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:3609: checking for $ac_func" >&5 +echo "configure:3598: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3626: \"$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 @@ -3660,19 +3649,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:3664: checking for working alloca.h" >&5 +echo "configure:3653: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3665: \"$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 @@ -3693,12 +3682,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3697: checking for alloca" >&5 +echo "configure:3686: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3719: \"$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 @@ -3758,12 +3747,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3762: checking whether alloca needs Cray hooks" >&5 +echo "configure:3751: 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 <&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:3792: checking for $ac_func" >&5 +echo "configure:3781: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3809: \"$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 @@ -3843,7 +3832,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3847: checking stack direction for C alloca" >&5 +echo "configure:3836: 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 @@ -3851,7 +3840,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3863: \"$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 @@ -3892,12 +3881,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3896: checking for pid_t" >&5 +echo "configure:3885: 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 < #if STDC_HEADERS @@ -3926,17 +3915,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:3930: checking for vfork.h" >&5 +echo "configure:3919: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3929: \"$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* @@ -3961,18 +3950,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:3965: checking for working vfork" >&5 +echo "configure:3954: 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:3971: checking for vfork" >&5 +echo "configure:3960: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3988: \"$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 @@ -4017,7 +4006,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -4112,7 +4101,7 @@ main() { } } EOF -if { (eval echo configure:4116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4105: \"$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 @@ -4136,7 +4125,7 @@ fi if test "$cross_compiling" = no; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:4140: checking whether setpgrp takes no argument" >&5 +echo "configure:4129: 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 @@ -4144,7 +4133,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4157: \"$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 @@ -4189,12 +4178,12 @@ fi else echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:4193: checking whether setpgrp takes no argument" >&5 +echo "configure:4182: 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 < @@ -4208,7 +4197,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_func_setpgrp_void=no else @@ -4232,12 +4221,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:4236: checking for sigsetjmp" >&5 +echo "configure:4225: 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 < @@ -4246,7 +4235,7 @@ int main() { sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); ; return 0; } EOF -if { (eval echo configure:4250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_func_sigsetjmp=yes else @@ -4269,19 +4258,19 @@ fi # See if 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:4273: checking for r_fs in struct reg" >&5 +echo "configure:4262: 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 < int main() { struct reg r; r.r_fs; ; return 0; } EOF -if { (eval echo configure:4285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_fs=yes else @@ -4301,19 +4290,19 @@ EOF fi echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6 -echo "configure:4305: checking for r_gs in struct reg" >&5 +echo "configure:4294: 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 < int main() { struct reg r; r.r_gs; ; return 0; } EOF -if { (eval echo configure:4317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_gs=yes else @@ -4335,19 +4324,19 @@ fi # See if provides the PTRACE_GETREGS request. echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:4339: checking for PTRACE_GETREGS" >&5 +echo "configure:4328: 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 < int main() { PTRACE_GETREGS; ; return 0; } EOF -if { (eval echo configure:4351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getregs=yes else @@ -4369,19 +4358,19 @@ fi # See if provides the PTRACE_GETFPXREGS request. echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:4373: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:4362: 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 < int main() { PTRACE_GETFPXREGS; ; return 0; } EOF -if { (eval echo configure:4385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4374: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getfpxregs=yes else @@ -4403,12 +4392,12 @@ fi # See if provides the PT_GETDBREGS request. echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6 -echo "configure:4407: checking for PT_GETDBREGS" >&5 +echo "configure:4396: 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 < #include @@ -4416,7 +4405,7 @@ int main() { PT_GETDBREGS; ; return 0; } EOF -if { (eval echo configure:4420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getdbregs=yes else @@ -4438,12 +4427,12 @@ fi # See if provides the PT_GETXMMREGS request. echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6 -echo "configure:4442: checking for PT_GETXMMREGS" >&5 +echo "configure:4431: 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 < #include @@ -4451,7 +4440,7 @@ int main() { PT_GETXMMREGS; ; return 0; } EOF -if { (eval echo configure:4455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getxmmregs=yes else @@ -4473,7 +4462,7 @@ fi echo $ac_n "checking for socketpair in -lsocket""... $ac_c" 1>&6 -echo "configure:4477: checking for socketpair in -lsocket" >&5 +echo "configure:4466: 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 @@ -4481,7 +4470,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4485: \"$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 @@ -4522,12 +4511,12 @@ fi for ac_func in socketpair do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4526: checking for $ac_func" >&5 +echo "configure:4515: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4543: \"$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 @@ -4577,12 +4566,12 @@ done echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4581: checking whether malloc must be declared" >&5 +echo "configure:4570: 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 < @@ -4603,7 +4592,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4624,12 +4613,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4628: checking whether realloc must be declared" >&5 +echo "configure:4617: 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 < @@ -4650,7 +4639,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4671,12 +4660,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4675: checking whether free must be declared" >&5 +echo "configure:4664: 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 < @@ -4697,7 +4686,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -4718,12 +4707,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:4722: checking whether strerror must be declared" >&5 +echo "configure:4711: 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 < @@ -4744,7 +4733,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:4748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -4765,12 +4754,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:4769: checking whether strdup must be declared" >&5 +echo "configure:4758: 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 < @@ -4791,7 +4780,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:4795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -4812,12 +4801,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4816: checking whether strstr must be declared" >&5 +echo "configure:4805: 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 < @@ -4838,7 +4827,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4859,12 +4848,12 @@ EOF fi echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:4863: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:4852: 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 < @@ -4885,7 +4874,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:4889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_canonicalize_file_name=no else @@ -4911,9 +4900,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:4915: checking for HPUX save_state structure" >&5 +echo "configure:4904: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext < EOF @@ -4928,7 +4917,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -4998,12 +4987,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:5002: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:4991: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5034,12 +5023,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:5038: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:5027: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -5070,12 +5059,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:5074: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:5063: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5077: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -5106,12 +5095,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:5110: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:5099: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -5142,12 +5131,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:5146: checking for prgregset_t in sys/procfs.h" >&5 +echo "configure:5135: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset_t=yes else @@ -5178,12 +5167,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:5182: checking for prfpregset_t in sys/procfs.h" >&5 +echo "configure:5171: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset_t=yes else @@ -5214,12 +5203,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:5218: checking for prgregset32_t in sys/procfs.h" >&5 +echo "configure:5207: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset32_t=yes else @@ -5250,12 +5239,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:5254: checking for prfpregset32_t in sys/procfs.h" >&5 +echo "configure:5243: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5257: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset32_t=yes else @@ -5286,12 +5275,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:5290: checking for lwpid_t in sys/procfs.h" >&5 +echo "configure:5279: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpid_t=yes else @@ -5322,12 +5311,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:5326: checking for psaddr_t in sys/procfs.h" >&5 +echo "configure:5315: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5329: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psaddr_t=yes else @@ -5358,12 +5347,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:5362: checking for prsysent_t in sys/procfs.h" >&5 +echo "configure:5351: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prsysent_t=yes else @@ -5394,12 +5383,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:5398: checking for pr_sigset_t in sys/procfs.h" >&5 +echo "configure:5387: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigset_t=yes else @@ -5430,12 +5419,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:5434: checking for pr_sigaction64_t in sys/procfs.h" >&5 +echo "configure:5423: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes else @@ -5466,12 +5455,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:5470: checking for pr_siginfo64_t in sys/procfs.h" >&5 +echo "configure:5459: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes else @@ -5507,7 +5496,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:5511: checking whether prfpregset_t type is broken" >&5 +echo "configure:5500: 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 @@ -5515,7 +5504,7 @@ else gdb_cv_prfpregset_t_broken=yes else cat > conftest.$ac_ext < int main () @@ -5525,7 +5514,7 @@ else return 0; } EOF -if { (eval echo configure:5529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5518: \"$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 @@ -5550,12 +5539,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5554: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:5543: 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 < #include @@ -5568,7 +5557,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -5592,19 +5581,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:5596: checking for member l_addr in struct link_map" >&5 +echo "configure:5585: 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 < int main() { struct link_map lm; (void) lm.l_addr; ; return 0; } EOF -if { (eval echo configure:5608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_l_members=yes else @@ -5626,12 +5615,12 @@ EOF echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:5630: checking for member lm_addr in struct link_map" >&5 +echo "configure:5619: 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 < #include @@ -5639,7 +5628,7 @@ int main() { struct link_map lm; (void) lm.lm_addr; ; return 0; } EOF -if { (eval echo configure:5643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_lm_members=yes else @@ -5661,12 +5650,12 @@ EOF echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6 -echo "configure:5665: checking for member som_addr in struct so_map" >&5 +echo "configure:5654: 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 < #ifdef HAVE_NLIST_H @@ -5677,7 +5666,7 @@ int main() { struct so_map lm; (void) lm.som_addr; ; return 0; } EOF -if { (eval echo configure:5681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_so_map_with_som_members=yes else @@ -5699,12 +5688,12 @@ EOF echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6 -echo "configure:5703: checking for struct link_map32 in sys/link.h" >&5 +echo "configure:5692: 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 < @@ -5712,7 +5701,7 @@ int main() { struct link_map32 l; ; return 0; } EOF -if { (eval echo configure:5716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map32=yes else @@ -5738,7 +5727,7 @@ EOF fi echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:5742: checking for main in -lm" >&5 +echo "configure:5731: 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 @@ -5746,14 +5735,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5746: \"$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 @@ -5782,7 +5771,7 @@ fi echo $ac_n "checking for wctype in -lc""... $ac_c" 1>&6 -echo "configure:5786: checking for wctype in -lc" >&5 +echo "configure:5775: 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 @@ -5790,7 +5779,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5794: \"$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 @@ -5820,7 +5809,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:5824: checking for wctype in -lw" >&5 +echo "configure:5813: 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 @@ -5828,7 +5817,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5832: \"$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 @@ -5871,12 +5860,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:5875: checking for long long support in compiler" >&5 +echo "configure:5864: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -5908,7 +5897,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:5912: checking for long long support in printf" >&5 +echo "configure:5901: 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 @@ -5916,7 +5905,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5923: \"$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 @@ -5954,19 +5943,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:5958: checking for long double support in compiler" >&5 +echo "configure:5947: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -5988,7 +5977,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:5992: checking for long double support in printf" >&5 +echo "configure:5981: 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 @@ -5996,7 +5985,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5999: \"$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 @@ -6030,7 +6019,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:6034: checking for long double support in scanf" >&5 +echo "configure:6023: 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 @@ -6038,7 +6027,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext < 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:6052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6041: \"$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 @@ -6074,17 +6063,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6078: checking for $ac_hdr" >&5 +echo "configure:6067: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6077: \"$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* @@ -6113,12 +6102,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6117: checking for $ac_func" >&5 +echo "configure:6106: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6134: \"$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 @@ -6166,7 +6155,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6170: checking for working mmap" >&5 +echo "configure:6159: 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 @@ -6174,7 +6163,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6307: \"$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 @@ -6340,7 +6329,7 @@ fi case ${host_os} in aix*) echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6 -echo "configure:6344: checking for -bbigtoc option" >&5 +echo "configure:6333: checking for -bbigtoc option" >&5 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6354,14 +6343,14 @@ else LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -6384,7 +6373,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:6388: checking for HPUX/OSF thread support" >&5 +echo "configure:6377: 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 @@ -6403,7 +6392,7 @@ EOF ;; solaris*) echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:6407: checking for Solaris thread debugging library" >&5 +echo "configure:6396: 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 @@ -6413,7 +6402,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:6417: checking for dlopen in -ldl" >&5 +echo "configure:6406: 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 @@ -6421,7 +6410,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6425: \"$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 @@ -6464,17 +6453,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:6468: checking for the ld -export-dynamic flag" >&5 +echo "configure:6457: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -6493,13 +6482,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in # at one point. echo $ac_n "checking if is old""... $ac_c" 1>&6 -echo "configure:6497: checking if is old" >&5 +echo "configure:6486: checking if 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 < @@ -6510,7 +6499,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -6729,7 +6718,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:6733: checking compiler warning flags" >&5 +echo "configure:6722: 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 @@ -6739,14 +6728,14 @@ echo "configure:6733: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -6806,12 +6795,12 @@ fi if test $want_included_regex = false; then echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6810: checking for GNU regex" >&5 +echo "configure:6799: 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 < #include @@ -6823,7 +6812,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6852,12 +6841,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:6856: checking for cygwin" >&5 +echo "configure:6845: 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 <&6 -echo "configure:6899: checking for tgetent in -lncurses" >&5 +echo "configure:6888: 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 @@ -6903,7 +6892,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6907: \"$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 @@ -6933,7 +6922,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:6937: checking for tgetent in -lHcurses" >&5 +echo "configure:6926: 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 @@ -6941,7 +6930,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6945: \"$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 @@ -6971,7 +6960,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:6975: checking for tgetent in -ltermlib" >&5 +echo "configure:6964: 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 @@ -6979,7 +6968,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6983: \"$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 @@ -7009,7 +6998,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:7013: checking for tgetent in -ltermcap" >&5 +echo "configure:7002: 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 @@ -7017,7 +7006,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7021: \"$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 @@ -7047,7 +7036,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:7051: checking for tgetent in -lcurses" >&5 +echo "configure:7040: 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 @@ -7055,7 +7044,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7059: \"$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 @@ -7085,7 +7074,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:7089: checking for tgetent in -lterminfo" >&5 +echo "configure:7078: 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 @@ -7093,7 +7082,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7097: \"$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 @@ -7269,7 +7258,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:7273: checking for Tcl configuration" >&5 +echo "configure:7262: 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 @@ -7377,7 +7366,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:7381: checking for Tk configuration" >&5 +echo "configure:7370: 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 @@ -7486,7 +7475,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:7490: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:7479: 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" @@ -7552,17 +7541,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:7556: checking for tclInt.h" >&5 +echo "configure:7545: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7555: \"$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* @@ -7622,7 +7611,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:7626: checking for Tk private headers" >&5 +echo "configure:7615: 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" @@ -7688,17 +7677,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:7692: checking for tk.h" >&5 +echo "configure:7681: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7691: \"$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* @@ -7744,7 +7733,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7748: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:7737: 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 @@ -7767,7 +7756,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7771: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:7760: 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 @@ -7790,7 +7779,7 @@ fi echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7794: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:7783: 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 @@ -7842,7 +7831,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:7846: checking for Itcl configuration" >&5 +echo "configure:7835: 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 @@ -7945,7 +7934,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:7949: checking for Itk configuration" >&5 +echo "configure:7938: 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 @@ -8048,7 +8037,7 @@ if test "${with_tixconfig+set}" = set; then fi echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6 -echo "configure:8052: checking for Tix configuration" >&5 +echo "configure:8041: 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 @@ -8191,7 +8180,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:8195: checking for X" >&5 +echo "configure:8184: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -8253,12 +8242,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8251: \"$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* @@ -8327,14 +8316,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8327: \"$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. @@ -8627,7 +8616,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:8631: checking whether gdbserver is supported on this host" >&5 +echo "configure:8620: checking whether gdbserver is supported on this host" >&5 if test x"${build_gdbserver}" = xyes ; then configdirs="${configdirs} gdbserver" SUBDIRS="${SUBDIRS} gdbserver" @@ -8689,7 +8678,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:8693: checking whether ln -s works" >&5 +echo "configure:8682: 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 @@ -8713,12 +8702,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:8717: checking for Cygwin environment" >&5 +echo "configure:8706: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -8746,19 +8735,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:8750: checking for mingw32 environment" >&5 +echo "configure:8739: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -8777,7 +8766,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:8781: checking for executable suffix" >&5 +echo "configure:8770: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8787,10 +8776,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:8791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:8780: \"$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 @@ -9354,7 +9343,8 @@ cat >> $CONFIG_STATUS <<\EOF if test "${nativefile}" = ""; then < Makefile \ - sed -e '/^NATDEPFILES[ ]*=[ ]*/s//# NATDEPFILES=/' \ + sed -e '/^NATDEPFILES[ ]*=.*\\$/,/[^\\]$/s/^/# /' \ + -e '/^NATDEPFILES[ ]*=/s/^/# /' \ | sed -e '/^\(NATDEPFILES[ ]*[+]=[ ]*\)/s//# \1/' \ > Makefile.tem mv -f Makefile.tem Makefile diff --git a/gdb/configure.host b/gdb/configure.host index 0c26ac0..511ea76 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -20,6 +20,7 @@ mips*) gdb_host_cpu=mips ;; powerpc*) gdb_host_cpu=powerpc ;; sparcv9 | sparc64) gdb_host_cpu=sparc ;; s390*) gdb_host_cpu=s390 ;; +sh*) gdb_host_cpu=sh ;; x86_64*) gdb_host_cpu=i386 ;; *) gdb_host_cpu=$host_cpu ;; @@ -136,6 +137,8 @@ rs6000-*-*) gdb_host=rs6000 ;; s390*-*-*) gdb_host=s390 ;; +sh*-*-netbsdelf*) gdb_host=nbsd ;; + sparc-*-linux*) gdb_host=linux ;; sparc-*-lynxos*) gdb_host=sparclynx ;; sparc-*-netbsdelf*) gdb_host=nbsdelf ;; diff --git a/gdb/configure.in b/gdb/configure.in index 19976dd..8d30459 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -1366,7 +1366,8 @@ dnl provided by makefile fragments. dnl if test "${nativefile}" = ""; then < Makefile \ - sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \ + sed -e '/^NATDEPFILES[[ ]]*=.*\\$/,/[[^\\]]$/s/^/# /' \ + -e '/^NATDEPFILES[[ ]]*=/s/^/# /' \ | sed -e '/^\(NATDEPFILES[[ ]]*[[+]]=[[ ]]*\)/s//# \1/' \ > Makefile.tem mv -f Makefile.tem Makefile diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 9b35547..322312c 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -25,6 +25,7 @@ powerpc*) gdb_target_cpu=powerpc ;; sparc*) gdb_target_cpu=sparc ;; thumb*) gdb_target_cpu=arm ;; s390*) gdb_target_cpu=s390 ;; +sh*) gdb_target_cpu=sh ;; strongarm*) gdb_target_cpu=arm ;; xscale*) gdb_target_cpu=arm ;; v850*) gdb_target_cpu=v850 ;; @@ -102,8 +103,6 @@ i[3456]86-*-solaris*) gdb_target=i386sol2 ;; i[3456]86-*-sysv4.2*) gdb_target=i386v42mp ;; i[3456]86-*-sysv4*) gdb_target=i386v4 ;; i[3456]86-*-sysv5*) gdb_target=i386v42mp ;; -i[3456]86-*-unixware2*) gdb_target=i386v42mp ;; -i[3456]86-*-unixware*) gdb_target=i386v4 ;; i[3456]86-*-sco3.2v4*) gdb_target=i386sco4 ;; i[3456]86-*-sco3.2v5*) gdb_target=i386sco5 ;; i[3456]86-*-sco*) gdb_target=i386v ;; @@ -246,12 +245,13 @@ s390x-*-*) gdb_target=s390x ;; sh*-*-pe) gdb_target=wince ;; -sh-*-hms) gdb_target=embed ;; sh-*-coff*) gdb_target=embed ;; sh-*-elf*) gdb_target=embed ;; sh-*-linux*) gdb_target=linux build_gdbserver=yes ;; +sh*-*-netbsdelf*) gdb_target=nbsd ;; +sh*) gdb_target=embed ;; sparc-*-aout*) gdb_target=sparc-em ;; sparc-*-coff*) gdb_target=sparc-em ;; diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 2060c93..58600fb 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1037,7 +1037,7 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, struct type *type = check_typedef (VALUE_TYPE (arg)); char *contents = VALUE_CONTENTS (arg); int len = TYPE_LENGTH (type); - /* printf ("push: type=%d len=%d\n", type->code, len); */ + /* printf ("push: type=%d len=%d\n", TYPE_CODE (type), len); */ { int aligned_regnum = (regnum + 1) & ~1; if (len <= 2 && regnum <= ARGN_REGNUM) @@ -1091,7 +1091,7 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES], char *valbuf) { int len; - /* printf("RET: TYPE=%d len=%d r%d=0x%x\n",type->code, TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */ + /* printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */ { len = TYPE_LENGTH (type); if (len == 1) @@ -1486,7 +1486,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_byte (gdbarch, d10v_register_byte); set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size); set_gdbarch_max_register_raw_size (gdbarch, 8); - set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size); + set_gdbarch_register_virtual_size (gdbarch, generic_register_size); set_gdbarch_max_register_virtual_size (gdbarch, 8); set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 9b2b73b..430e3f5 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -203,6 +203,9 @@ struct complaint repeated_header_complaint = struct complaint unclaimed_bincl_complaint = {"N_BINCL %s not in entries for any file, at symtab pos %d", 0, 0}; + +struct complaint discarding_local_symbols_complaint = +{"misplaced N_LBRAC entry; discarding local symbols which have no enclosing block", 0, 0}; /* find_text_range --- find start and end of loadable code sections @@ -2881,7 +2884,21 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, /* Can only use new->locals as local symbols here if we're in gcc or on a machine that puts them before the lbrack. */ if (!VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) - local_symbols = new->locals; + { + if (local_symbols != NULL) + { + /* GCC development snapshots from March to December of + 2000 would output N_LSYM entries after N_LBRAC + entries. As a consequence, these symbols are simply + discarded. Complain if this is the case. Note that + there are some compilers which legitimately put local + symbols within an LBRAC/RBRAC block; this complaint + might also help sort out problems in which + VARIABLES_INSIDE_BLOCK is incorrectly defined. */ + complain (&discarding_local_symbols_complaint); + } + local_symbols = new->locals; + } if (context_stack_depth > !VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index a431b1e..bb46be3 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,32 @@ +2002-05-14 Daniel Jacobowitz + + * gdb.texinfo (Debug Session): Document new `udp:' and `tcp:' + options for `target remote'. + +2002-05-13 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Delete + documentation on NNPC_REGNUM. + +2002-05-11 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Document + REGISTER_TO_VALUE and VALUE_TO_REGISTER and CONVERT_REGISTER_P. + (Target Architecture Definition): Revise section `Using Different + Register and Memory Data Representations'. Add section `Raw and + Virtual Register Representations'. + +2002-05-11 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Mention + defaults for REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE. + (Target Architecture Definition): Mention same. Add references to + web pages. + +2002-05-08 Michael Snyder + + * stabs.texinfo (Attributes): Document new "vector" attribute. + 2002-05-04 Andrew Cagney * gdbint.texinfo (Releasing GDB): Revise `Create a Release'. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f37e288..1080b8b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -10475,7 +10475,7 @@ of its pure text. Establish communication using the @code{target remote} command. Its argument specifies how to communicate with the target machine---either via a devicename attached to a direct serial line, or a -TCP port (usually to a terminal server which in turn has a serial line +TCP or UDP port (usually to a terminal server which in turn has a serial line to the target). For example, to use a serial line connected to the device named @file{/dev/ttyb}: @@ -10485,7 +10485,8 @@ target remote /dev/ttyb @cindex TCP port, @code{target remote} To use a TCP connection, use an argument of the form -@code{@var{host}:port}. For example, to connect to port 2828 on a +@code{@var{host}:@var{port}} or @code{tcp:@var{host}:@var{port}}. +For example, to connect to port 2828 on a terminal server named @code{manyfarms}: @smallexample @@ -10503,6 +10504,21 @@ target remote :1234 @noindent Note that the colon is still required here. + +@cindex UDP port, @code{target remote} +To use a UDP connection, use an argument of the form +@code{udp:@var{host}:@var{port}}. For example, to connect to UDP port 2828 +on a terminal server named @code{manyfarms}: + +@smallexample +target remote udp:manyfarms:2828 +@end smallexample + +When using a UDP connection for remote debugging, you should keep in mind +that the `U' stands for ``Unreliable''. UDP can silently drop packets on +busy or unreliable networks, which will cause havoc with your debugging +session. + @end enumerate Now you can use all the usual commands to examine and change data and to diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 3387cdb..55442d4 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -2487,17 +2487,19 @@ C@t{++} reference type. @end deftypefn -@section Using Different Register and Memory Data Representations -@cindex raw representation -@cindex virtual representation -@cindex representations, raw and virtual -@cindex register data formats, converting -@cindex @code{struct value}, converting register contents to - -@emph{Maintainer's note: The way GDB manipulates registers is undergoing -significant change. Many of the macros and functions refered to in the -sections below are likely to be made obsolete. See the file @file{TODO} -for more up-to-date information.} +@section Raw and Virtual Register Representations +@cindex raw register representation +@cindex virtual register representation +@cindex representations, raw and virtual registers + +@emph{Maintainer note: This section is pretty much obsolete. The +functionality described here has largely been replaced by +pseudo-registers and the mechanisms described in @ref{Target +Architecture Definition, , Using Different Register and Memory Data +Representations}. See also @uref{http://www.gnu.org/software/gdb/bugs/, +Bug Tracking Database} and +@uref{http://sources.redhat.com/gdb/current/ari/, ARI Index} for more +up-to-date information.} Some architectures use one representation for a value when it lives in a register, but use a different representation when it lives in memory. @@ -2505,6 +2507,10 @@ In @value{GDBN}'s terminology, the @dfn{raw} representation is the one used in the target registers, and the @dfn{virtual} representation is the one used in memory, and within @value{GDBN} @code{struct value} objects. +@emph{Maintainer note: Notice that the same mechanism is being used to +both convert a register to a @code{struct value} and alternative +register forms.} + For almost all data types on almost all architectures, the virtual and raw representations are identical, and no special handling is needed. However, they do occasionally differ. For example: @@ -2589,6 +2595,85 @@ their @var{reg} and @var{type} arguments in different orders. @end deftypefn +@section Using Different Register and Memory Data Representations +@cindex register representation +@cindex memory representation +@cindex representations, register and memory +@cindex register data formats, converting +@cindex @code{struct value}, converting register contents to + +@emph{Maintainer's note: The way GDB manipulates registers is undergoing +significant change. Many of the macros and functions refered to in this +section are likely to be subject to further revision. See +@uref{http://sources.redhat.com/gdb/current/ari/, A.R. Index} and +@uref{http://www.gnu.org/software/gdb/bugs, Bug Tracking Database} for +further information. cagney/2002-05-06.} + +Some architectures can represent a data object in a register using a +form that is different to the objects more normal memory representation. +For example: + +@itemize @bullet + +@item +The Alpha architecture can represent 32 bit integer values in +floating-point registers. + +@item +The x86 architecture supports 80-bit floating-point registers. The +@code{long double} data type occupies 96 bits in memory but only 80 bits +when stored in a register. + +@end itemize + +In general, the register representation of a data type is determined by +the architecture, or @value{GDBN}'s interface to the architecture, while +the memory representation is determined by the Application Binary +Interface. + +For almost all data types on almost all architectures, the two +representations are identical, and no special handling is needed. +However, they do occasionally differ. Your architecture may define the +following macros to request conversions between the register and memory +representations of a data type: + +@deftypefn {Target Macro} int CONVERT_REGISTER_P (int @var{reg}) +Return non-zero if the representation of a data value stored in this +register may be different to the representation of that same data value +when stored in memory. + +When non-zero, the macros @code{REGISTER_TO_VALUE} and +@code{VALUE_TO_REGISTER} are used to perform any necessary conversion. +@end deftypefn + +@deftypefn {Target Macro} void REGISTER_TO_VALUE (int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to}) +Convert the value of register number @var{reg} to a data object of type +@var{type}. The buffer at @var{from} holds the register's value in raw +format; the converted value should be placed in the buffer at @var{to}. + +Note that @code{REGISTER_TO_VALUE} and @code{VALUE_TO_REGISTER} take +their @var{reg} and @var{type} arguments in different orders. + +You should only use @code{REGISTER_TO_VALUE} with registers for which +the @code{CONVERT_REGISTER_P} macro returns a non-zero value. +@end deftypefn + +@deftypefn {Target Macro} void VALUE_TO_REGISTER (struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to}) +Convert a data value of type @var{type} to register number @var{reg}' +raw format. + +Note that @code{REGISTER_TO_VALUE} and @code{VALUE_TO_REGISTER} take +their @var{reg} and @var{type} arguments in different orders. + +You should only use @code{VALUE_TO_REGISTER} with registers for which +the @code{CONVERT_REGISTER_P} macro returns a non-zero value. +@end deftypefn + +@deftypefn {Target Macro} void REGISTER_CONVERT_TO_TYPE (int @var{regnum}, struct type *@var{type}, char *@var{buf}) +See @file{mips-tdep.c}. It does not do what you want. +@end deftypefn + + @section Frame Interpretation @section Inferior Call Setup @@ -2834,6 +2919,12 @@ otherwise, we should leave it alone. The function @code{default_coerce_float_to_double} provides this behavior; it is the default value, for compatibility with older configurations. +@item int CONVERT_REGISTER_P(@var{regnum}) +@findex CONVERT_REGISTER_P +Return non-zero if register @var{regnum} can represent data values in a +non-standard form. +@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. + @item CPLUS_MARKER @findex CPLUS_MARKERz Define this to expand into the character that G@t{++} uses to distinguish @@ -3171,34 +3262,43 @@ address the pointer refers to. @item REGISTER_CONVERTIBLE (@var{reg}) @findex REGISTER_CONVERTIBLE Return non-zero if @var{reg} uses different raw and virtual formats. +@xref{Target Architecture Definition, , Raw and Virtual Register Representations}. + +@item REGISTER_TO_VALUE(@var{regnum}, @var{type}, @var{from}, @var{to}) +@findex REGISTER_TO_VALUE +Convert the raw contents of register @var{regnum} into a value of type +@var{type}. @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. @item REGISTER_RAW_SIZE (@var{reg}) @findex REGISTER_RAW_SIZE -Return the raw size of @var{reg}. -@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. +Return the raw size of @var{reg}; defaults to the size of the register's +virtual type. +@xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @item REGISTER_VIRTUAL_SIZE (@var{reg}) @findex REGISTER_VIRTUAL_SIZE +Return the virtual size of @var{reg}; defaults to the size of the +register's virtual type. Return the virtual size of @var{reg}. -@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. +@xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @item REGISTER_VIRTUAL_TYPE (@var{reg}) @findex REGISTER_VIRTUAL_TYPE Return the virtual type of @var{reg}. -@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. +@xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @item REGISTER_CONVERT_TO_VIRTUAL(@var{reg}, @var{type}, @var{from}, @var{to}) @findex REGISTER_CONVERT_TO_VIRTUAL Convert the value of register @var{reg} from its raw form to its virtual form. -@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. +@xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @item REGISTER_CONVERT_TO_RAW(@var{type}, @var{reg}, @var{from}, @var{to}) @findex REGISTER_CONVERT_TO_RAW Convert the value of register @var{reg} from its virtual form to its raw form. -@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. +@xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @item RETURN_VALUE_ON_STACK(@var{type}) @findex RETURN_VALUE_ON_STACK @@ -3317,11 +3417,6 @@ This should only need to be defined if @code{TARGET_READ_PC} and @findex NPC_REGNUM The number of the ``next program counter'' register, if defined. -@item NNPC_REGNUM -@findex NNPC_REGNUM -The number of the ``next next program counter'' register, if defined. -Currently, this is only defined for the Motorola 88K. - @item PARM_BOUNDARY @findex PARM_BOUNDARY If non-zero, round arguments to a boundary of this many bits before @@ -3580,6 +3675,12 @@ being considered is known to have been compiled by GCC; this is helpful for systems where GCC is known to use different calling convention than other compilers. +@item VALUE_TO_REGISTER(@var{type}, @var{regnum}, @var{from}, @var{to}) +@findex VALUE_TO_REGISTER +Convert a value of type @var{type} into the raw contents of register +@var{regnum}'s. +@xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. + @item VARIABLES_INSIDE_BLOCK (@var{desc}, @var{gcc_p}) @findex VARIABLES_INSIDE_BLOCK For dbx-style debugging information, if the compiler puts variable diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo index 6ffac7b..52b88b4 100644 --- a/gdb/doc/stabs.texinfo +++ b/gdb/doc/stabs.texinfo @@ -287,6 +287,12 @@ Indicate that this type is a string instead of an array of characters, or a bitstring instead of a set. It doesn't change the layout of the data being represented, but does enable the debugger to know which type it is. + +@item V +Indicate that this type is a vector instead of an array. The only +major difference between vectors and arrays is that vectors are +passed by value instead of by reference (vector coprocessor extension). + @end table All of this can make the string field quite long. All versions of GDB, diff --git a/gdb/dstread.c b/gdb/dstread.c index c3a73f0..abcce09 100644 --- a/gdb/dstread.c +++ b/gdb/dstread.c @@ -705,17 +705,6 @@ dst_sym_addr (dst_sect_ref_t *ref) + ref->sect_offset; } -static struct type * -create_new_type (struct objfile *objfile) -{ - struct type *type; - - type = (struct type *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct type)); - memset (type, 0, sizeof (struct type)); - return type; -} - static struct symbol * create_new_symbol (struct objfile *objfile, char *name) { @@ -865,7 +854,7 @@ decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code, xfree (name); return type; } - type = create_new_type (objfile); + type = alloc_type (objfile); TYPE_NAME (type) = obstack_copy0 (&objfile->symbol_obstack, name, strlen (name)); xfree (name); @@ -1306,10 +1295,10 @@ process_dst_function (struct objfile *objfile, dst_rec_ptr_t entry, char *name, if (!type->function_type) { - ftype = create_new_type (objfile); + ftype = alloc_type (objfile); type->function_type = ftype; - ftype->target_type = type; - ftype->code = TYPE_CODE_FUNC; + TYPE_TARGET_TYPE (ftype) = type; + TYPE_CODE (ftype) = TYPE_CODE_FUNC; } SYMBOL_TYPE (sym) = type->function_type; diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c index ffbeb5d..0cc342f 100644 --- a/gdb/dwarf2cfi.c +++ b/gdb/dwarf2cfi.c @@ -222,8 +222,6 @@ static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p, static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read); static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read, int dwarf64); -static ULONGEST read_address (bfd *abfd, char **p); - static int is_cie (ULONGEST cie_id, int dwarf64); static int compare_fde_unit (const void *a, const void *b); @@ -280,7 +278,7 @@ static struct context * context_alloc () { struct context *context; - struct context_reg *reg; + int regs_size = sizeof (struct context_reg) * NUM_REGS; context = (struct context *) obstack_alloc (&unwind_tmp_obstack, @@ -297,7 +295,7 @@ static struct frame_state * frame_state_alloc () { struct frame_state *fs; - struct frame_state_reg *reg; + int regs_size = sizeof (struct frame_state_reg) * NUM_REGS; fs = (struct frame_state *) obstack_alloc (&unwind_tmp_obstack, @@ -319,13 +317,26 @@ unwind_tmp_obstack_free () static void context_cpy (struct context *dst, struct context *src) { - struct context_reg *reg = dst->reg; int regs_size = sizeof (struct context_reg) * NUM_REGS; - + struct context_reg *dreg; + + /* Structure dst contains a pointer to an array of + * registers of a given frame as well as src does. This + * array was already allocated before dst was passed to + * context_cpy but the pointer to it was overriden by + * '*dst = *src' and the array was lost. This led to the + * situation, that we've had a copy of src placed in dst, + * but both of them pointed to the same regs array and + * thus we've sometimes blindly rewritten it. Now we save + * the pointer before copying src to dst, return it back + * after that and copy the registers into their new place + * finally. --- mludvig@suse.cz */ + dreg = dst->reg; *dst = *src; + dst->reg = dreg; + memcpy (dst->reg, src->reg, regs_size); } - static unsigned int read_1u (bfd *abfd, char **p) @@ -586,7 +597,6 @@ execute_cfa_program ( struct objfile *objfile, char *insn_ptr, char *insn_end, unsigned char insn = *insn_ptr++; ULONGEST reg, uoffset; LONGEST offset; - int bytes_read; if (insn & DW_CFA_advance_loc) fs->pc += (insn & 0x3f) * fs->code_align; @@ -788,7 +798,6 @@ frame_state_for (struct context *context, struct frame_state *fs) { struct fde_unit *fde; struct cie_unit *cie; - unsigned char *aug, *insn, *end; context->args_size = 0; context->lsda = 0; @@ -1109,6 +1118,8 @@ execute_stack_op (struct objfile *objfile, case DW_OP_plus_uconst: result += read_uleb128 (objfile->obfd, &op_ptr); break; + default: + break; } break; @@ -1186,6 +1197,8 @@ execute_stack_op (struct objfile *objfile, case DW_OP_ne: result = (LONGEST) first != (LONGEST) second; break; + default: /* This label is here just to avoid warning. */ + break; } } break; @@ -1255,6 +1268,8 @@ update_context (struct context *context, struct frame_state *fs, int chain) exp + len, context, 0); break; } + default: + break; } context->cfa = cfa; @@ -1300,7 +1315,7 @@ update_context (struct context *context, struct frame_state *fs, int chain) orig_context->reg[fs->regs.reg[i].loc.reg].loc.addr; default: internal_error (__FILE__, __LINE__, - "cfi_update_context: unknown register rule"); + "%s: unknown register rule", __func__); } break; case REG_SAVED_EXP: @@ -1318,8 +1333,7 @@ update_context (struct context *context, struct frame_state *fs, int chain) break; default: internal_error (__FILE__, __LINE__, - "cfi_update_context: unknown register rule"); - + "%s: unknown register rule", __func__); } get_reg ((char *) &context->ra, context, fs->retaddr_column); unwind_tmp_obstack_free (); @@ -1346,7 +1360,7 @@ compare_fde_unit (const void *a, const void *b) } /* Build the cie_chunks and fde_chunks tables from informations - in .debug.frame section. */ + in .debug_frame section. */ void dwarf2_build_frame_info (struct objfile *objfile) { @@ -1577,6 +1591,7 @@ cfi_frame_chain (struct frame_info *fi) cfa = context->cfa; unwind_tmp_obstack_free (); + return cfa; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 5c06e9a..2793817 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -432,6 +432,10 @@ struct dwarf2_pinfo char *dwarf_line_buffer; + /* Size of dwarf_line_buffer, in bytes. */ + + unsigned int dwarf_line_size; + /* Pointer to start of dwarf string buffer for the objfile. */ char *dwarf_str_buffer; @@ -447,6 +451,7 @@ struct dwarf2_pinfo #define DWARF_ABBREV_BUFFER(p) (PST_PRIVATE(p)->dwarf_abbrev_buffer) #define DWARF_ABBREV_SIZE(p) (PST_PRIVATE(p)->dwarf_abbrev_size) #define DWARF_LINE_BUFFER(p) (PST_PRIVATE(p)->dwarf_line_buffer) +#define DWARF_LINE_SIZE(p) (PST_PRIVATE(p)->dwarf_line_size) #define DWARF_STR_BUFFER(p) (PST_PRIVATE(p)->dwarf_str_buffer) #define DWARF_STR_SIZE(p) (PST_PRIVATE(p)->dwarf_str_size) @@ -1166,6 +1171,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) DWARF_ABBREV_BUFFER (pst) = dwarf_abbrev_buffer; DWARF_ABBREV_SIZE (pst) = dwarf_abbrev_size; DWARF_LINE_BUFFER (pst) = dwarf_line_buffer; + DWARF_LINE_SIZE (pst) = dwarf_line_size; DWARF_STR_BUFFER (pst) = dwarf_str_buffer; DWARF_STR_SIZE (pst) = dwarf_str_size; baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -1467,6 +1473,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) dwarf_abbrev_buffer = DWARF_ABBREV_BUFFER (pst); dwarf_abbrev_size = DWARF_ABBREV_SIZE (pst); dwarf_line_buffer = DWARF_LINE_BUFFER (pst); + dwarf_line_size = DWARF_LINE_SIZE (pst); dwarf_str_buffer = DWARF_STR_BUFFER (pst); dwarf_str_size = DWARF_STR_SIZE (pst); baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile)); @@ -2479,8 +2486,6 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, /* No children, must be stub. */ TYPE_FLAGS (type) |= TYPE_FLAG_STUB; } - - finish_cv_type (die->type); } /* Given a pointer to a die which begins an enumeration, process all diff --git a/gdb/event-loop.c b/gdb/event-loop.c index ea74419..4e42d7e 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -494,51 +494,52 @@ create_file_handler (int fd, int mask, handler_func * proc, gdb_client_data clie file_ptr->ready_mask = 0; file_ptr->next_file = gdb_notifier.first_file_handler; gdb_notifier.first_file_handler = file_ptr; - } - file_ptr->proc = proc; - file_ptr->client_data = client_data; - file_ptr->mask = mask; - if (use_poll) - { + if (use_poll) + { #ifdef HAVE_POLL - gdb_notifier.num_fds++; - if (gdb_notifier.poll_fds) - gdb_notifier.poll_fds = - (struct pollfd *) xrealloc (gdb_notifier.poll_fds, - (gdb_notifier.num_fds - * sizeof (struct pollfd))); - else - gdb_notifier.poll_fds = - (struct pollfd *) xmalloc (sizeof (struct pollfd)); - (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd; - (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask; - (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0; + gdb_notifier.num_fds++; + if (gdb_notifier.poll_fds) + gdb_notifier.poll_fds = + (struct pollfd *) xrealloc (gdb_notifier.poll_fds, + (gdb_notifier.num_fds + * sizeof (struct pollfd))); + else + gdb_notifier.poll_fds = + (struct pollfd *) xmalloc (sizeof (struct pollfd)); + (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd; + (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask; + (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0; #else - internal_error (__FILE__, __LINE__, - "use_poll without HAVE_POLL"); + internal_error (__FILE__, __LINE__, + "use_poll without HAVE_POLL"); #endif /* HAVE_POLL */ - } - else - { - if (mask & GDB_READABLE) - FD_SET (fd, &gdb_notifier.check_masks[0]); + } else - FD_CLR (fd, &gdb_notifier.check_masks[0]); + { + if (mask & GDB_READABLE) + FD_SET (fd, &gdb_notifier.check_masks[0]); + else + FD_CLR (fd, &gdb_notifier.check_masks[0]); - if (mask & GDB_WRITABLE) - FD_SET (fd, &gdb_notifier.check_masks[1]); - else - FD_CLR (fd, &gdb_notifier.check_masks[1]); + if (mask & GDB_WRITABLE) + FD_SET (fd, &gdb_notifier.check_masks[1]); + else + FD_CLR (fd, &gdb_notifier.check_masks[1]); - if (mask & GDB_EXCEPTION) - FD_SET (fd, &gdb_notifier.check_masks[2]); - else - FD_CLR (fd, &gdb_notifier.check_masks[2]); + if (mask & GDB_EXCEPTION) + FD_SET (fd, &gdb_notifier.check_masks[2]); + else + FD_CLR (fd, &gdb_notifier.check_masks[2]); - if (gdb_notifier.num_fds <= fd) - gdb_notifier.num_fds = fd + 1; + if (gdb_notifier.num_fds <= fd) + gdb_notifier.num_fds = fd + 1; + } } + + file_ptr->proc = proc; + file_ptr->client_data = client_data; + file_ptr->mask = mask; } /* Remove the file descriptor FD from the list of monitored fd's: diff --git a/gdb/expprint.c b/gdb/expprint.c index cb61711..09e7db6 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -334,7 +334,7 @@ print_subexp (register struct expression *exp, register int *pos, (*pos) += 2; if ((int) prec > (int) PREC_PREFIX) fputs_filtered ("(", stream); - if (exp->elts[pc + 1].type->code == TYPE_CODE_FUNC && + if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC && exp->elts[pc + 3].opcode == OP_LONG) { /* We have a minimal symbol fn, probably. It's encoded diff --git a/gdb/findvar.c b/gdb/findvar.c index 0f116ed..831ae4b 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -308,6 +308,13 @@ value_of_register (int regnum, struct frame_info *frame) get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval); + /* FIXME: cagney/2002-05-15: This test is just bogus. + + It indicates that the target failed to supply a value for a + register because it was "not available" at this time. Problem + is, the target still has the register and so get saved_register() + may be returning a value saved on the stack. */ + if (register_cached (regnum) < 0) return NULL; /* register value not available */ @@ -813,12 +820,12 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) VALUE_LVAL (v) = lval; VALUE_ADDRESS (v) = addr; - /* Convert raw data to virtual format if necessary. */ + /* Convert the raw register to the corresponding data value's memory + format, if necessary. */ - if (REGISTER_CONVERTIBLE (regnum)) + if (CONVERT_REGISTER_P (regnum)) { - REGISTER_CONVERT_TO_VIRTUAL (regnum, type, - raw_buffer, VALUE_CONTENTS_RAW (v)); + REGISTER_TO_VALUE (regnum, type, raw_buffer, VALUE_CONTENTS_RAW (v)); } else { diff --git a/gdb/frame.c b/gdb/frame.c index 2753150..24cd907 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -157,10 +157,13 @@ frame_register_read (struct frame_info *frame, int regnum, void *myaddr) get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame, regnum, (enum lval_type *) NULL); - /* FIXME: cagney/2002-04-10: This test is just bogus. It is no - indication of the validity of the register. The value could - easily be found (on the stack) even though the corresponding - register isn't available. */ + /* FIXME: cagney/2002-05-15: This test, is just bogus. + + It indicates that the target failed to supply a value for a + register because it was "not available" at this time. Problem + is, the target still has the register and so get saved_register() + may be returning a value saved on the stack. */ + if (register_cached (regnum) < 0) return 0; /* register value not available */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index ce4540d..6990953 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -71,6 +71,7 @@ static void alloc_gdbarch_data (struct gdbarch *); static void init_gdbarch_data (struct gdbarch *); static void free_gdbarch_data (struct gdbarch *); static void init_gdbarch_swap (struct gdbarch *); +static void clear_gdbarch_swap (struct gdbarch *); static void swapout_gdbarch_swap (struct gdbarch *); static void swapin_gdbarch_swap (struct gdbarch *); @@ -154,7 +155,6 @@ struct gdbarch int ps_regnum; int fp0_regnum; int npc_regnum; - int nnpc_regnum; gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum; gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum; gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum; @@ -199,6 +199,9 @@ struct gdbarch gdbarch_register_convertible_ftype *register_convertible; gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; gdbarch_register_convert_to_raw_ftype *register_convert_to_raw; + gdbarch_convert_register_p_ftype *convert_register_p; + gdbarch_register_to_value_ftype *register_to_value; + gdbarch_value_to_register_ftype *value_to_register; gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register; gdbarch_store_pseudo_register_ftype *store_pseudo_register; gdbarch_pointer_to_address_ftype *pointer_to_address; @@ -310,10 +313,9 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + generic_register_size, 0, - generic_register_raw_size, - 0, - generic_register_virtual_size, + generic_register_size, 0, 0, 0, @@ -398,6 +400,9 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, + 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -414,6 +419,9 @@ void initialize_non_multiarch () { alloc_gdbarch_data (&startup_gdbarch); + /* Ensure that all swap areas are zeroed so that they again think + they are starting from scratch. */ + clear_gdbarch_swap (&startup_gdbarch); init_gdbarch_swap (&startup_gdbarch); init_gdbarch_data (&startup_gdbarch); } @@ -466,7 +474,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->ps_regnum = -1; current_gdbarch->fp0_regnum = -1; current_gdbarch->npc_regnum = -1; - current_gdbarch->nnpc_regnum = -1; current_gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum; @@ -475,7 +482,9 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->register_name = legacy_register_name; current_gdbarch->register_size = -1; current_gdbarch->register_bytes = -1; + current_gdbarch->register_raw_size = generic_register_size; current_gdbarch->max_register_raw_size = -1; + current_gdbarch->register_virtual_size = generic_register_size; current_gdbarch->max_register_virtual_size = -1; current_gdbarch->do_registers_info = do_registers_info; current_gdbarch->print_float_info = default_print_float_info; @@ -495,6 +504,9 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->init_frame_pc = init_frame_pc_default; current_gdbarch->coerce_float_to_double = default_coerce_float_to_double; current_gdbarch->register_convertible = generic_register_convertible_not; + current_gdbarch->convert_register_p = legacy_convert_register_p; + current_gdbarch->register_to_value = legacy_register_to_value; + current_gdbarch->value_to_register = legacy_value_to_register; current_gdbarch->pointer_to_address = unsigned_pointer_to_address; current_gdbarch->address_to_pointer = unsigned_address_to_pointer; current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not; @@ -595,7 +607,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of ps_regnum, invalid_p == 0 */ /* Skip verify of fp0_regnum, invalid_p == 0 */ /* Skip verify of npc_regnum, invalid_p == 0 */ - /* Skip verify of nnpc_regnum, invalid_p == 0 */ /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */ /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */ /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */ @@ -611,15 +622,11 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->register_byte == 0)) fprintf_unfiltered (log, "\n\tregister_byte"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->register_raw_size == 0)) - fprintf_unfiltered (log, "\n\tregister_raw_size"); + /* Skip verify of register_raw_size, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->max_register_raw_size == -1)) fprintf_unfiltered (log, "\n\tmax_register_raw_size"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->register_virtual_size == 0)) - fprintf_unfiltered (log, "\n\tregister_virtual_size"); + /* Skip verify of register_virtual_size, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->max_register_virtual_size == -1)) fprintf_unfiltered (log, "\n\tmax_register_virtual_size"); @@ -680,6 +687,9 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ + /* Skip verify of convert_register_p, invalid_p == 0 */ + /* Skip verify of register_to_value, invalid_p == 0 */ + /* Skip verify of value_to_register, invalid_p == 0 */ /* Skip verify of fetch_pseudo_register, has predicate */ /* Skip verify of store_pseudo_register, has predicate */ /* Skip verify of pointer_to_address, invalid_p == 0 */ @@ -1009,6 +1019,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->convert_from_func_ptr_addr /*CONVERT_FROM_FUNC_PTR_ADDR ()*/); #endif +#ifdef CONVERT_REGISTER_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "CONVERT_REGISTER_P(regnum)", + XSTRING (CONVERT_REGISTER_P (regnum))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: CONVERT_REGISTER_P = 0x%08lx\n", + (long) current_gdbarch->convert_register_p + /*CONVERT_REGISTER_P ()*/); +#endif #ifdef DECR_PC_AFTER_BREAK fprintf_unfiltered (file, "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n", @@ -1414,14 +1435,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->memory_remove_breakpoint /*MEMORY_REMOVE_BREAKPOINT ()*/); #endif -#ifdef NNPC_REGNUM - fprintf_unfiltered (file, - "gdbarch_dump: NNPC_REGNUM # %s\n", - XSTRING (NNPC_REGNUM)); - fprintf_unfiltered (file, - "gdbarch_dump: NNPC_REGNUM = %d\n", - NNPC_REGNUM); -#endif #ifdef NPC_REGNUM fprintf_unfiltered (file, "gdbarch_dump: NPC_REGNUM # %s\n", @@ -1699,6 +1712,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: REGISTER_SIZE = %d\n", REGISTER_SIZE); #endif +#ifdef REGISTER_TO_VALUE +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "REGISTER_TO_VALUE(regnum, type, from, to)", + XSTRING (REGISTER_TO_VALUE (regnum, type, from, to))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: REGISTER_TO_VALUE = 0x%08lx\n", + (long) current_gdbarch->register_to_value + /*REGISTER_TO_VALUE ()*/); +#endif #ifdef REGISTER_VIRTUAL_SIZE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2154,6 +2181,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->use_struct_convention /*USE_STRUCT_CONVENTION ()*/); #endif +#ifdef VALUE_TO_REGISTER +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "VALUE_TO_REGISTER(type, regnum, from, to)", + XSTRING (VALUE_TO_REGISTER (type, regnum, from, to))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: VALUE_TO_REGISTER = 0x%08lx\n", + (long) current_gdbarch->value_to_register + /*VALUE_TO_REGISTER ()*/); +#endif if (current_gdbarch->dump_tdep != NULL) current_gdbarch->dump_tdep (current_gdbarch, file); } @@ -2681,23 +2722,6 @@ set_gdbarch_npc_regnum (struct gdbarch *gdbarch, } int -gdbarch_nnpc_regnum (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - /* Skip verify of nnpc_regnum, invalid_p == 0 */ - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_nnpc_regnum called\n"); - return gdbarch->nnpc_regnum; -} - -void -set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch, - int nnpc_regnum) -{ - gdbarch->nnpc_regnum = nnpc_regnum; -} - -int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr) { gdb_assert (gdbarch != NULL); @@ -3538,6 +3562,63 @@ set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, } int +gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->convert_register_p == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_convert_register_p invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n"); + return gdbarch->convert_register_p (regnum); +} + +void +set_gdbarch_convert_register_p (struct gdbarch *gdbarch, + gdbarch_convert_register_p_ftype convert_register_p) +{ + gdbarch->convert_register_p = convert_register_p; +} + +void +gdbarch_register_to_value (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->register_to_value == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_register_to_value invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_to_value called\n"); + gdbarch->register_to_value (regnum, type, from, to); +} + +void +set_gdbarch_register_to_value (struct gdbarch *gdbarch, + gdbarch_register_to_value_ftype register_to_value) +{ + gdbarch->register_to_value = register_to_value; +} + +void +gdbarch_value_to_register (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->value_to_register == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_value_to_register invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_value_to_register called\n"); + gdbarch->value_to_register (type, regnum, from, to); +} + +void +set_gdbarch_value_to_register (struct gdbarch *gdbarch, + gdbarch_value_to_register_ftype value_to_register) +{ + gdbarch->value_to_register = value_to_register; +} + +int gdbarch_fetch_pseudo_register_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -4799,10 +4880,10 @@ set_gdbarch_data (struct gdbarch *gdbarch, data-pointer. */ void * -gdbarch_data (struct gdbarch_data *data) +gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) { - gdb_assert (data->index < current_gdbarch->nr_data); - return current_gdbarch->data[data->index]; + gdb_assert (data->index < gdbarch->nr_data); + return gdbarch->data[data->index]; } @@ -4851,6 +4932,17 @@ register_gdbarch_swap (void *data, (*rego)->sizeof_data = sizeof_data; } +static void +clear_gdbarch_swap (struct gdbarch *gdbarch) +{ + struct gdbarch_swap *curr; + for (curr = gdbarch->swap; + curr != NULL; + curr = curr->next) + { + memset (curr->source->data, 0, curr->source->sizeof_data); + } +} static void init_gdbarch_swap (struct gdbarch *gdbarch) @@ -4867,7 +4959,6 @@ init_gdbarch_swap (struct gdbarch *gdbarch) (*curr)->source = rego; (*curr)->swap = xmalloc (rego->sizeof_data); (*curr)->next = NULL; - memset (rego->data, 0, rego->sizeof_data); curr = &(*curr)->next; } if (rego->init != NULL) @@ -5033,6 +5124,7 @@ int gdbarch_update_p (struct gdbarch_info info) { struct gdbarch *new_gdbarch; + struct gdbarch *old_gdbarch; struct gdbarch_registration *rego; /* Fill in missing parts of the INFO struct using a number of @@ -5101,30 +5193,48 @@ gdbarch_update_p (struct gdbarch_info info) return 0; } + /* Swap the data belonging to the old target out setting the + installed data to zero. This stops the ->init() function trying + to refer to the previous architecture's global data structures. */ + swapout_gdbarch_swap (current_gdbarch); + clear_gdbarch_swap (current_gdbarch); + + /* Save the previously selected architecture, setting the global to + NULL. This stops ->init() trying to use the previous + architecture's configuration. The previous architecture may not + even be of the same architecture family. The most recent + architecture of the same family is found at the head of the + rego->arches list. */ + old_gdbarch = current_gdbarch; + current_gdbarch = NULL; + /* Ask the target for a replacement architecture. */ new_gdbarch = rego->init (info, rego->arches); - /* Did the target like it? No. Reject the change. */ + /* Did the target like it? No. Reject the change and revert to the + old architecture. */ if (new_gdbarch == NULL) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n"); + swapin_gdbarch_swap (old_gdbarch); + current_gdbarch = old_gdbarch; return 0; } - /* Did the architecture change? No. Do nothing. */ - if (current_gdbarch == new_gdbarch) + /* Did the architecture change? No. Oops, put the old architecture + back. */ + if (old_gdbarch == new_gdbarch) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n", (long) new_gdbarch, new_gdbarch->bfd_arch_info->printable_name); + swapin_gdbarch_swap (old_gdbarch); + current_gdbarch = old_gdbarch; return 1; } - /* Swap all data belonging to the old target out */ - swapout_gdbarch_swap (current_gdbarch); - /* Is this a pre-existing architecture? Yes. Move it to the front of the list of architectures (keeping the list sorted Most Recently Used) and then copy it in. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 0e334cf..9f45459 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -558,22 +558,6 @@ extern void set_gdbarch_npc_regnum (struct gdbarch *gdbarch, int npc_regnum); #endif #endif -/* Default (value) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (NNPC_REGNUM) -#define NNPC_REGNUM (-1) -#endif - -extern int gdbarch_nnpc_regnum (struct gdbarch *gdbarch); -extern void set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch, int nnpc_regnum); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (NNPC_REGNUM) -#error "Non multi-arch definition of NNPC_REGNUM" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NNPC_REGNUM) -#define NNPC_REGNUM (gdbarch_nnpc_regnum (current_gdbarch)) -#endif -#endif - /* Convert stab register number (from `r' declaration) to a gdb REGNUM. */ /* Default (function) for non- multi-arch platforms. */ @@ -720,6 +704,11 @@ extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register #endif #endif +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE) +#define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr)) +#endif + typedef int (gdbarch_register_raw_size_ftype) (int reg_nr); extern int gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr); extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_register_raw_size_ftype *register_raw_size); @@ -743,6 +732,11 @@ extern void set_gdbarch_max_register_raw_size (struct gdbarch *gdbarch, int max_ #endif #endif +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE) +#define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr)) +#endif + typedef int (gdbarch_register_virtual_size_ftype) (int reg_nr); extern int gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr); extern void set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, gdbarch_register_virtual_size_ftype *register_virtual_size); @@ -1257,6 +1251,57 @@ extern void set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarc #endif #endif +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (CONVERT_REGISTER_P) +#define CONVERT_REGISTER_P(regnum) (legacy_convert_register_p (regnum)) +#endif + +typedef int (gdbarch_convert_register_p_ftype) (int regnum); +extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum); +extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p); +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CONVERT_REGISTER_P) +#error "Non multi-arch definition of CONVERT_REGISTER_P" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CONVERT_REGISTER_P) +#define CONVERT_REGISTER_P(regnum) (gdbarch_convert_register_p (current_gdbarch, regnum)) +#endif +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_TO_VALUE) +#define REGISTER_TO_VALUE(regnum, type, from, to) (legacy_register_to_value (regnum, type, from, to)) +#endif + +typedef void (gdbarch_register_to_value_ftype) (int regnum, struct type *type, char *from, char *to); +extern void gdbarch_register_to_value (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to); +extern void set_gdbarch_register_to_value (struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value); +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_TO_VALUE) +#error "Non multi-arch definition of REGISTER_TO_VALUE" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_TO_VALUE) +#define REGISTER_TO_VALUE(regnum, type, from, to) (gdbarch_register_to_value (current_gdbarch, regnum, type, from, to)) +#endif +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (VALUE_TO_REGISTER) +#define VALUE_TO_REGISTER(type, regnum, from, to) (legacy_value_to_register (type, regnum, from, to)) +#endif + +typedef void (gdbarch_value_to_register_ftype) (struct type *type, int regnum, char *from, char *to); +extern void gdbarch_value_to_register (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to); +extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register); +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (VALUE_TO_REGISTER) +#error "Non multi-arch definition of VALUE_TO_REGISTER" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (VALUE_TO_REGISTER) +#define VALUE_TO_REGISTER(type, regnum, from, to) (gdbarch_value_to_register (current_gdbarch, type, regnum, from, to)) +#endif +#endif + /* This function is called when the value of a pseudo-register needs to be updated. Typically it will be defined on a per-architecture basis. */ @@ -2575,7 +2620,7 @@ extern void set_gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data, void *pointer); -extern void *gdbarch_data (struct gdbarch_data*); +extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); /* Register per-architecture memory region. diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 1dd2990..ebcb423 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -447,7 +447,6 @@ v:2:PC_REGNUM:int:pc_regnum::::-1:-1::0 v:2:PS_REGNUM:int:ps_regnum::::-1:-1::0 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0 v:2:NPC_REGNUM:int:npc_regnum::::0:-1::0 -v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1::0 # Convert stab register number (from \`r\' declaration) to a gdb REGNUM. f:2:STAB_REG_TO_REGNUM:int:stab_reg_to_regnum:int stab_regnr:stab_regnr:::no_op_reg_to_regnum::0 # Provide a default mapping from a ecoff register number to a gdb REGNUM. @@ -463,9 +462,9 @@ f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name::0 v:2:REGISTER_SIZE:int:register_size::::0:-1 v:2:REGISTER_BYTES:int:register_bytes::::0:-1 f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0 -f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0 +f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1 -f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_virtual_size:0 +f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0 f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0 @@ -514,6 +513,10 @@ f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::0 +# +f:1:CONVERT_REGISTER_P:int:convert_register_p:int regnum:regnum::0:legacy_convert_register_p::0 +f:1:REGISTER_TO_VALUE:void:register_to_value:int regnum, struct type *type, char *from, char *to:regnum, type, from, to::0:legacy_register_to_value::0 +f:1:VALUE_TO_REGISTER:void:value_to_register:struct type *type, int regnum, char *from, char *to:type, regnum, from, to::0:legacy_value_to_register::0 # This function is called when the value of a pseudo-register needs to # be updated. Typically it will be defined on a per-architecture # basis. @@ -1108,7 +1111,7 @@ extern void set_gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data, void *pointer); -extern void *gdbarch_data (struct gdbarch_data*); +extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); /* Register per-architecture memory region. @@ -1249,6 +1252,7 @@ static void alloc_gdbarch_data (struct gdbarch *); static void init_gdbarch_data (struct gdbarch *); static void free_gdbarch_data (struct gdbarch *); static void init_gdbarch_swap (struct gdbarch *); +static void clear_gdbarch_swap (struct gdbarch *); static void swapout_gdbarch_swap (struct gdbarch *); static void swapin_gdbarch_swap (struct gdbarch *); @@ -1373,6 +1377,9 @@ void initialize_non_multiarch () { alloc_gdbarch_data (&startup_gdbarch); + /* Ensure that all swap areas are zeroed so that they again think + they are starting from scratch. */ + clear_gdbarch_swap (&startup_gdbarch); init_gdbarch_swap (&startup_gdbarch); init_gdbarch_data (&startup_gdbarch); } @@ -1849,10 +1856,10 @@ set_gdbarch_data (struct gdbarch *gdbarch, data-pointer. */ void * -gdbarch_data (struct gdbarch_data *data) +gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) { - gdb_assert (data->index < current_gdbarch->nr_data); - return current_gdbarch->data[data->index]; + gdb_assert (data->index < gdbarch->nr_data); + return gdbarch->data[data->index]; } @@ -1901,6 +1908,17 @@ register_gdbarch_swap (void *data, (*rego)->sizeof_data = sizeof_data; } +static void +clear_gdbarch_swap (struct gdbarch *gdbarch) +{ + struct gdbarch_swap *curr; + for (curr = gdbarch->swap; + curr != NULL; + curr = curr->next) + { + memset (curr->source->data, 0, curr->source->sizeof_data); + } +} static void init_gdbarch_swap (struct gdbarch *gdbarch) @@ -1917,7 +1935,6 @@ init_gdbarch_swap (struct gdbarch *gdbarch) (*curr)->source = rego; (*curr)->swap = xmalloc (rego->sizeof_data); (*curr)->next = NULL; - memset (rego->data, 0, rego->sizeof_data); curr = &(*curr)->next; } if (rego->init != NULL) @@ -2083,6 +2100,7 @@ int gdbarch_update_p (struct gdbarch_info info) { struct gdbarch *new_gdbarch; + struct gdbarch *old_gdbarch; struct gdbarch_registration *rego; /* Fill in missing parts of the INFO struct using a number of @@ -2151,30 +2169,48 @@ gdbarch_update_p (struct gdbarch_info info) return 0; } + /* Swap the data belonging to the old target out setting the + installed data to zero. This stops the ->init() function trying + to refer to the previous architecture's global data structures. */ + swapout_gdbarch_swap (current_gdbarch); + clear_gdbarch_swap (current_gdbarch); + + /* Save the previously selected architecture, setting the global to + NULL. This stops ->init() trying to use the previous + architecture's configuration. The previous architecture may not + even be of the same architecture family. The most recent + architecture of the same family is found at the head of the + rego->arches list. */ + old_gdbarch = current_gdbarch; + current_gdbarch = NULL; + /* Ask the target for a replacement architecture. */ new_gdbarch = rego->init (info, rego->arches); - /* Did the target like it? No. Reject the change. */ + /* Did the target like it? No. Reject the change and revert to the + old architecture. */ if (new_gdbarch == NULL) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\\n"); + swapin_gdbarch_swap (old_gdbarch); + current_gdbarch = old_gdbarch; return 0; } - /* Did the architecture change? No. Do nothing. */ - if (current_gdbarch == new_gdbarch) + /* Did the architecture change? No. Oops, put the old architecture + back. */ + if (old_gdbarch == new_gdbarch) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\\n", (long) new_gdbarch, new_gdbarch->bfd_arch_info->printable_name); + swapin_gdbarch_swap (old_gdbarch); + current_gdbarch = old_gdbarch; return 1; } - /* Swap all data belonging to the old target out */ - swapout_gdbarch_swap (current_gdbarch); - /* Is this a pre-existing architecture? Yes. Move it to the front of the list of architectures (keeping the list sorted Most Recently Used) and then copy it in. */ diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index 91addf6..6edc883 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -140,7 +140,7 @@ reinsert_breakpoint_by_bp (CORE_ADDR stop_pc, CORE_ADDR stop_at) set_breakpoint_at (stop_at, reinsert_breakpoint_handler); - orig_bp = find_breakpoint_at (stop_at); + orig_bp = find_breakpoint_at (stop_pc); if (orig_bp == NULL) error ("Could not find original breakpoint in list."); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index ccff12f..e8ba96d 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -78,6 +78,7 @@ struct type *builtin_type_v4_int32; struct type *builtin_type_v8_int16; struct type *builtin_type_v16_int8; /* 64 bit long vector types */ +struct type *builtin_type_v2_float; struct type *builtin_type_v2_int32; struct type *builtin_type_v4_int16; struct type *builtin_type_v8_int8; @@ -134,7 +135,8 @@ static void virtual_base_list_aux (struct type *dclass); /* Alloc a new type structure and fill it with some defaults. If OBJFILE is non-NULL, then allocate the space for the type structure - in that objfile's type_obstack. */ + in that objfile's type_obstack. Otherwise allocate the new type structure + by xmalloc () (for permanent types). */ struct type * alloc_type (struct objfile *objfile) @@ -145,27 +147,73 @@ alloc_type (struct objfile *objfile) if (objfile == NULL) { - type = (struct type *) xmalloc (sizeof (struct type)); + type = xmalloc (sizeof (struct type)); + memset (type, 0, sizeof (struct type)); + TYPE_MAIN_TYPE (type) = xmalloc (sizeof (struct main_type)); } else { - type = (struct type *) obstack_alloc (&objfile->type_obstack, - sizeof (struct type)); + type = obstack_alloc (&objfile->type_obstack, + sizeof (struct type)); + memset (type, 0, sizeof (struct type)); + TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->type_obstack, + sizeof (struct main_type)); OBJSTAT (objfile, n_types++); } - memset ((char *) type, 0, sizeof (struct type)); + memset (TYPE_MAIN_TYPE (type), 0, sizeof (struct main_type)); /* Initialize the fields that might not be zero. */ TYPE_CODE (type) = TYPE_CODE_UNDEF; TYPE_OBJFILE (type) = objfile; TYPE_VPTR_FIELDNO (type) = -1; - TYPE_CV_TYPE (type) = type; /* chain back to itself */ - TYPE_AS_TYPE (type) = type; /* ditto */ + TYPE_CHAIN (type) = type; /* Chain back to itself. */ return (type); } +/* Alloc a new type instance structure, fill it with some defaults, + and point it at OLDTYPE. Allocate the new type instance from the + same place as OLDTYPE. */ + +static struct type * +alloc_type_instance (struct type *oldtype) +{ + struct type *type; + + /* Allocate the structure. */ + + if (TYPE_OBJFILE (oldtype) == NULL) + { + type = xmalloc (sizeof (struct type)); + memset (type, 0, sizeof (struct type)); + } + else + { + type = obstack_alloc (&TYPE_OBJFILE (oldtype)->type_obstack, + sizeof (struct type)); + memset (type, 0, sizeof (struct type)); + } + TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype); + + TYPE_CHAIN (type) = type; /* Chain back to itself for now. */ + + return (type); +} + +/* Clear all remnants of the previous type at TYPE, in preparation for + replacing it with something else. */ +static void +smash_type (struct type *type) +{ + memset (TYPE_MAIN_TYPE (type), 0, sizeof (struct main_type)); + + /* For now, delete the rings. */ + TYPE_CHAIN (type) = type; + + /* For now, leave the pointer/reference types alone. */ +} + /* Lookup a pointer to a type TYPE. TYPEPTR, if nonzero, points to a pointer to memory where the pointer type should be stored. If *TYPEPTR is zero, update it to point to the pointer type we return. @@ -201,7 +249,7 @@ make_pointer_type (struct type *type, struct type **typeptr) { ntype = *typeptr; objfile = TYPE_OBJFILE (ntype); - memset ((char *) ntype, 0, sizeof (struct type)); + smash_type (ntype); TYPE_OBJFILE (ntype) = objfile; } @@ -268,7 +316,7 @@ make_reference_type (struct type *type, struct type **typeptr) { ntype = *typeptr; objfile = TYPE_OBJFILE (ntype); - memset ((char *) ntype, 0, sizeof (struct type)); + smash_type (ntype); TYPE_OBJFILE (ntype) = objfile; } @@ -317,7 +365,7 @@ make_function_type (struct type *type, struct type **typeptr) { ntype = *typeptr; objfile = TYPE_OBJFILE (ntype); - memset ((char *) ntype, 0, sizeof (struct type)); + smash_type (ntype); TYPE_OBJFILE (ntype) = objfile; } @@ -367,45 +415,63 @@ address_space_int_to_name (int space_flag) return NULL; } -/* Make an address-space-delimited variant of a type -- a type that - is identical to the one supplied except that it has an address - space attribute attached to it (such as "code" or "data"). - - This is for Harvard architectures. */ +/* Create a new type with instance flags NEW_FLAGS, based on TYPE. + If STORAGE is non-NULL, create the new type instance there. */ struct type * -make_type_with_address_space (struct type *type, int space_flag) +make_qualified_type (struct type *type, int new_flags, + struct type *storage) { struct type *ntype; ntype = type; do { - if ((ntype->flags & space_flag) != 0) + if (TYPE_INSTANCE_FLAGS (ntype) == new_flags) return ntype; - ntype = TYPE_AS_TYPE (ntype); + ntype = TYPE_CHAIN (ntype); } while (ntype != type); - /* Create a new, duplicate type. */ - ntype = alloc_type (TYPE_OBJFILE (type)); - /* Copy original type. */ - memcpy ((char *) ntype, (char *) type, sizeof (struct type)); + /* Create a new type instance. */ + if (storage == NULL) + ntype = alloc_type_instance (type); + else + { + ntype = storage; + TYPE_MAIN_TYPE (ntype) = TYPE_MAIN_TYPE (type); + TYPE_CHAIN (ntype) = ntype; + } /* Pointers or references to the original type are not relevant to - the new type; but if the original type is a pointer, the new type - points to the same thing (so TYPE_TARGET_TYPE remains unchanged). */ + the new type. */ TYPE_POINTER_TYPE (ntype) = (struct type *) 0; TYPE_REFERENCE_TYPE (ntype) = (struct type *) 0; - TYPE_CV_TYPE (ntype) = ntype; - /* Chain the new address-space-specific type to the old type. */ - ntype->as_type = type->as_type; - type->as_type = ntype; + /* Chain the new qualified type to the old type. */ + TYPE_CHAIN (ntype) = TYPE_CHAIN (type); + TYPE_CHAIN (type) = ntype; + + /* Now set the instance flags and return the new type. */ + TYPE_INSTANCE_FLAGS (ntype) = new_flags; - /* Now set the address-space flag, and return the new type. */ - ntype->flags |= space_flag; return ntype; } +/* Make an address-space-delimited variant of a type -- a type that + is identical to the one supplied except that it has an address + space attribute attached to it (such as "code" or "data"). + + This is for Harvard architectures. */ + +struct type * +make_type_with_address_space (struct type *type, int space_flag) +{ + struct type *ntype; + int new_flags = ((TYPE_INSTANCE_FLAGS (type) + & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE)) + | space_flag); + + return make_qualified_type (type, new_flags, NULL); +} /* Make a "c-v" variant of a type -- a type that is identical to the one supplied except that it may have const or volatile attributes @@ -424,142 +490,60 @@ make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr) register struct type *tmp_type = type; /* tmp type */ struct objfile *objfile; - ntype = TYPE_CV_TYPE (type); - - while (ntype != type) - { - if ((TYPE_CONST (ntype) == cnst) && - (TYPE_VOLATILE (ntype) == voltl)) - { - if (typeptr == 0) - return ntype; - else if (*typeptr == 0) - { - *typeptr = ntype; /* Tracking alloc, and we have new type. */ - return ntype; - } - } - tmp_type = ntype; - ntype = TYPE_CV_TYPE (ntype); - } - - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { - ntype = alloc_type (TYPE_OBJFILE (type)); - if (typeptr) - *typeptr = ntype; - } - else - /* We have storage, but need to reset it. */ - { - ntype = *typeptr; - objfile = TYPE_OBJFILE (ntype); - /* memset ((char *) ntype, 0, sizeof (struct type)); */ - TYPE_OBJFILE (ntype) = objfile; - } - - /* Copy original type */ - memcpy ((char *) ntype, (char *) type, sizeof (struct type)); - /* But zero out fields that shouldn't be copied */ - TYPE_POINTER_TYPE (ntype) = (struct type *) 0; /* Need new pointer kind */ - TYPE_REFERENCE_TYPE (ntype) = (struct type *) 0; /* Need new referene kind */ - TYPE_AS_TYPE (ntype) = ntype; /* Need new address-space kind. */ - /* Note: TYPE_TARGET_TYPE can be left as is */ + int new_flags = (TYPE_INSTANCE_FLAGS (type) + & ~(TYPE_FLAG_CONST | TYPE_FLAG_VOLATILE)); - /* Set flags appropriately */ if (cnst) - TYPE_FLAGS (ntype) |= TYPE_FLAG_CONST; - else - TYPE_FLAGS (ntype) &= ~TYPE_FLAG_CONST; + new_flags |= TYPE_FLAG_CONST; if (voltl) - TYPE_FLAGS (ntype) |= TYPE_FLAG_VOLATILE; - else - TYPE_FLAGS (ntype) &= ~TYPE_FLAG_VOLATILE; - - /* Fix the chain of cv variants */ - TYPE_CV_TYPE (ntype) = type; - TYPE_CV_TYPE (tmp_type) = ntype; + new_flags |= TYPE_FLAG_VOLATILE; - return ntype; -} - -/* When reading in a class type, we may have created references to - cv-qualified versions of the type (in method arguments, for - instance). Update everything on the cv ring from the primary - type TYPE. - - The only reason we do not need to do the same thing for address - spaces is that type readers do not create address space qualified - types. */ -void -finish_cv_type (struct type *type) -{ - struct type *ntype, *cv_type, *ptr_type, *ref_type; - int cv_flags; - - gdb_assert (!TYPE_CONST (type) && !TYPE_VOLATILE (type)); - - ntype = type; - while ((ntype = TYPE_CV_TYPE (ntype)) != type) + if (typeptr && *typeptr != NULL) { - /* Save cv_flags. */ - cv_flags = TYPE_FLAGS (ntype) & (TYPE_FLAG_VOLATILE | TYPE_FLAG_CONST); - - /* If any reference or pointer types were created, save them too. */ - ptr_type = TYPE_POINTER_TYPE (ntype); - ref_type = TYPE_REFERENCE_TYPE (ntype); + /* Objfile is per-core-type. This const-qualified type had best + belong to the same objfile as the type it is qualifying, unless + we are overwriting a stub type, in which case the safest thing + to do is to copy the core type into the new objfile. */ - /* Don't disturb the CV chain. */ - cv_type = TYPE_CV_TYPE (ntype); - - /* Verify that we haven't added any address-space qualified types, - for the future. */ - gdb_assert (ntype == TYPE_AS_TYPE (ntype)); - - /* Copy original type */ - memcpy ((char *) ntype, (char *) type, sizeof (struct type)); + gdb_assert (TYPE_OBJFILE (*typeptr) == TYPE_OBJFILE (type) + || TYPE_STUB (*typeptr)); + if (TYPE_OBJFILE (*typeptr) != TYPE_OBJFILE (type)) + { + TYPE_MAIN_TYPE (*typeptr) + = TYPE_ALLOC (*typeptr, sizeof (struct main_type)); + *TYPE_MAIN_TYPE (*typeptr) + = *TYPE_MAIN_TYPE (type); + } + } + + ntype = make_qualified_type (type, new_flags, typeptr ? *typeptr : NULL); - /* Restore everything. */ - TYPE_POINTER_TYPE (ntype) = ptr_type; - TYPE_REFERENCE_TYPE (ntype) = ref_type; - TYPE_CV_TYPE (ntype) = cv_type; - TYPE_FLAGS (ntype) = TYPE_FLAGS (ntype) | cv_flags; + if (typeptr != NULL) + *typeptr = ntype; - TYPE_AS_TYPE (ntype) = ntype; - } + return ntype; } -/* Replace the contents of ntype with the type *type. +/* Replace the contents of ntype with the type *type. This changes the + contents, rather than the pointer for TYPE_MAIN_TYPE (ntype); thus + the changes are propogated to all types in the TYPE_CHAIN. In order to build recursive types, it's inevitable that we'll need to update types in place --- but this sort of indiscriminate smashing is ugly, and needs to be replaced with something more - controlled. For example, Daniel Jacobowitz has suggested moving - the fields common to a set of c/v variants into their own object, - which the variants would share. - - This function does not handle the replacement type being - cv-qualified; it could be easily fixed to, but it would be better - to just change the whole approach. */ + controlled. TYPE_MAIN_TYPE is a step in this direction; it's not + clear if more steps are needed. */ void replace_type (struct type *ntype, struct type *type) { struct type *cv_chain, *as_chain, *ptr, *ref; - cv_chain = TYPE_CV_TYPE (ntype); - as_chain = TYPE_AS_TYPE (ntype); - ptr = TYPE_POINTER_TYPE (ntype); - ref = TYPE_REFERENCE_TYPE (ntype); - - *ntype = *type; + *TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type); - TYPE_POINTER_TYPE (ntype) = ptr; - TYPE_REFERENCE_TYPE (ntype) = ref; - TYPE_CV_TYPE (ntype) = cv_chain; - TYPE_AS_TYPE (ntype) = as_chain; - - finish_cv_type (ntype); + /* Assert that the two types have equivalent instance qualifiers. + This should be true for at least all of our debug readers. */ + gdb_assert (TYPE_INSTANCE_FLAGS (ntype) == TYPE_INSTANCE_FLAGS (type)); } /* Implement direct support for MEMBER_TYPE in GNU C++. @@ -878,7 +862,7 @@ smash_to_member_type (struct type *type, struct type *domain, objfile = TYPE_OBJFILE (type); - memset ((char *) type, 0, sizeof (struct type)); + smash_type (type); TYPE_OBJFILE (type) = objfile; TYPE_TARGET_TYPE (type) = to_type; TYPE_DOMAIN_TYPE (type) = domain; @@ -901,7 +885,7 @@ smash_to_method_type (struct type *type, struct type *domain, objfile = TYPE_OBJFILE (type); - memset ((char *) type, 0, sizeof (struct type)); + smash_type (type); TYPE_OBJFILE (type) = objfile; TYPE_TARGET_TYPE (type) = to_type; TYPE_DOMAIN_TYPE (type) = domain; @@ -935,7 +919,7 @@ lookup_primitive_typename (char *name) for (p = current_language->la_builtin_type_vector; *p != NULL; p++) { - if (STREQ ((**p)->name, name)) + if (STREQ (TYPE_NAME (**p), name)) { return (**p); } @@ -1080,10 +1064,10 @@ struct type * lookup_template_type (char *name, struct type *type, struct block *block) { struct symbol *sym; - char *nam = (char *) alloca (strlen (name) + strlen (type->name) + 4); + char *nam = (char *) alloca (strlen (name) + strlen (TYPE_NAME (type)) + 4); strcpy (nam, name); strcat (nam, "<"); - strcat (nam, type->name); + strcat (nam, TYPE_NAME (type)); strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */ sym = lookup_symbol (nam, block, VAR_NAMESPACE, 0, (struct symtab **) NULL); @@ -1510,8 +1494,8 @@ add_mangled_type (struct extra *pextras, struct type *t) complain (&msg, tcode); } } - if (t->target_type) - add_mangled_type (pextras, t->target_type); + if (TYPE_TARGET_TYPE (t)) + add_mangled_type (pextras, TYPE_TARGET_TYPE (t)); } #if 0 @@ -1648,9 +1632,16 @@ check_stub_method (struct type *type, int method_id, int signature_id) argtypes = (struct type **) TYPE_ALLOC (type, (argcount + 2) * sizeof (struct type *)); p = argtypetext; - /* FIXME: This is wrong for static member functions. */ - argtypes[0] = lookup_pointer_type (type); - argcount = 1; + + /* Add THIS pointer for non-static methods. */ + f = TYPE_FN_FIELDLIST1 (type, method_id); + if (TYPE_FN_FIELD_STATIC_P (f, signature_id)) + argcount = 0; + else + { + argtypes[0] = lookup_pointer_type (type); + argcount = 1; + } if (*p != ')') /* () means no args, skip while */ { @@ -1693,8 +1684,6 @@ check_stub_method (struct type *type, int method_id, int signature_id) xfree (demangled_name); - f = TYPE_FN_FIELDLIST1 (type, method_id); - TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name; /* Now update the old "stub" type into a real type. */ @@ -2707,7 +2696,7 @@ print_arg_types (struct type **args, int spaces) while (*args != NULL) { recursive_dump_type (*args, spaces + 2); - if ((*args++)->code == TYPE_CODE_VOID) + if (TYPE_CODE (*args++) == TYPE_CODE_VOID) { break; } @@ -3005,12 +2994,27 @@ recursive_dump_type (struct type *type, int spaces) printfi_filtered (spaces, "reference_type "); gdb_print_host_address (TYPE_REFERENCE_TYPE (type), gdb_stdout); printf_filtered ("\n"); - printfi_filtered (spaces, "cv_type "); - gdb_print_host_address (TYPE_CV_TYPE (type), gdb_stdout); - printf_filtered ("\n"); - printfi_filtered (spaces, "as_type "); - gdb_print_host_address (TYPE_AS_TYPE (type), gdb_stdout); + printfi_filtered (spaces, "type_chain "); + gdb_print_host_address (TYPE_CHAIN (type), gdb_stdout); printf_filtered ("\n"); + printfi_filtered (spaces, "instance_flags 0x%x", TYPE_INSTANCE_FLAGS (type)); + if (TYPE_CONST (type)) + { + puts_filtered (" TYPE_FLAG_CONST"); + } + if (TYPE_VOLATILE (type)) + { + puts_filtered (" TYPE_FLAG_VOLATILE"); + } + if (TYPE_CODE_SPACE (type)) + { + puts_filtered (" TYPE_FLAG_CODE_SPACE"); + } + if (TYPE_DATA_SPACE (type)) + { + puts_filtered (" TYPE_FLAG_DATA_SPACE"); + } + puts_filtered ("\n"); printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type)); if (TYPE_UNSIGNED (type)) { @@ -3032,14 +3036,6 @@ recursive_dump_type (struct type *type, int spaces) { puts_filtered (" TYPE_FLAG_STATIC"); } - if (TYPE_CONST (type)) - { - puts_filtered (" TYPE_FLAG_CONST"); - } - if (TYPE_VOLATILE (type)) - { - puts_filtered (" TYPE_FLAG_VOLATILE"); - } if (TYPE_PROTOTYPED (type)) { puts_filtered (" TYPE_FLAG_PROTOTYPED"); @@ -3048,14 +3044,6 @@ recursive_dump_type (struct type *type, int spaces) { puts_filtered (" TYPE_FLAG_INCOMPLETE"); } - if (TYPE_CODE_SPACE (type)) - { - puts_filtered (" TYPE_FLAG_CODE_SPACE"); - } - if (TYPE_DATA_SPACE (type)) - { - puts_filtered (" TYPE_FLAG_DATA_SPACE"); - } if (TYPE_VARARGS (type)) { puts_filtered (" TYPE_FLAG_VARARGS"); @@ -3317,6 +3305,7 @@ build_gdbtypes (void) builtin_type_v8_int16 = init_vector_type (builtin_type_int16, 8); builtin_type_v16_int8 = init_vector_type (builtin_type_int8, 16); /* 64 bit vectors. */ + builtin_type_v2_float = init_vector_type (builtin_type_float, 2); builtin_type_v2_int32 = init_vector_type (builtin_type_int32, 2); builtin_type_v4_int16 = init_vector_type (builtin_type_int16, 4); builtin_type_v8_int8 = init_vector_type (builtin_type_int8, 8); @@ -3415,6 +3404,7 @@ _initialize_gdbtypes (void) register_gdbarch_swap (&builtin_type_v4_int32, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v8_int16, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v16_int8, sizeof (struct type *), NULL); + register_gdbarch_swap (&builtin_type_v2_float, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v2_int32, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v8_int8, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4_int16, sizeof (struct type *), NULL); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 0411aaa..87b529e 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -148,21 +148,21 @@ enum type_code type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */ #define TYPE_FLAG_UNSIGNED (1 << 0) -#define TYPE_UNSIGNED(t) ((t)->flags & TYPE_FLAG_UNSIGNED) +#define TYPE_UNSIGNED(t) (TYPE_FLAGS (t) & TYPE_FLAG_UNSIGNED) /* No sign for this type. In C++, "char", "signed char", and "unsigned char" are distinct types; so we need an extra flag to indicate the absence of a sign! */ #define TYPE_FLAG_NOSIGN (1 << 1) -#define TYPE_NOSIGN(t) ((t)->flags & TYPE_FLAG_NOSIGN) +#define TYPE_NOSIGN(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOSIGN) /* This appears in a type's flags word if it is a stub type (e.g., if someone referenced a type that wasn't defined in a source file via (struct sir_not_appearing_in_this_film *)). */ #define TYPE_FLAG_STUB (1 << 2) -#define TYPE_STUB(t) ((t)->flags & TYPE_FLAG_STUB) +#define TYPE_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB) /* The target type of this type is a stub type, and this type needs to be updated if it gets un-stubbed in check_typedef. @@ -171,7 +171,7 @@ enum type_code Also, set for TYPE_CODE_TYPEDEF. */ #define TYPE_FLAG_TARGET_STUB (1 << 3) -#define TYPE_TARGET_STUB(t) ((t)->flags & TYPE_FLAG_TARGET_STUB) +#define TYPE_TARGET_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_TARGET_STUB) /* Static type. If this is set, the corresponding type had * a static modifier. @@ -180,21 +180,21 @@ enum type_code */ #define TYPE_FLAG_STATIC (1 << 4) -#define TYPE_STATIC(t) ((t)->flags & TYPE_FLAG_STATIC) +#define TYPE_STATIC(t) (TYPE_FLAGS (t) & TYPE_FLAG_STATIC) /* Constant type. If this is set, the corresponding type has a * const modifier. */ #define TYPE_FLAG_CONST (1 << 5) -#define TYPE_CONST(t) ((t)->flags & TYPE_FLAG_CONST) +#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CONST) /* Volatile type. If this is set, the corresponding type has a * volatile modifier. */ #define TYPE_FLAG_VOLATILE (1 << 6) -#define TYPE_VOLATILE(t) ((t)->flags & TYPE_FLAG_VOLATILE) +#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE) /* This is a function type which appears to have a prototype. We need this @@ -202,7 +202,7 @@ enum type_code or to just do the standard conversions. This is used with a short field. */ #define TYPE_FLAG_PROTOTYPED (1 << 7) -#define TYPE_PROTOTYPED(t) ((t)->flags & TYPE_FLAG_PROTOTYPED) +#define TYPE_PROTOTYPED(t) (TYPE_FLAGS (t) & TYPE_FLAG_PROTOTYPED) /* This flag is used to indicate that processing for this type is incomplete. @@ -213,7 +213,7 @@ enum type_code the method can be assigned correct types.) */ #define TYPE_FLAG_INCOMPLETE (1 << 8) -#define TYPE_INCOMPLETE(t) ((t)->flags & TYPE_FLAG_INCOMPLETE) +#define TYPE_INCOMPLETE(t) (TYPE_FLAGS (t) & TYPE_FLAG_INCOMPLETE) /* Instruction-space delimited type. This is for Harvard architectures which have separate instruction and data address spaces (and perhaps @@ -235,10 +235,10 @@ enum type_code is instruction space, and for data objects is data memory. */ #define TYPE_FLAG_CODE_SPACE (1 << 9) -#define TYPE_CODE_SPACE(t) ((t)->flags & TYPE_FLAG_CODE_SPACE) +#define TYPE_CODE_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CODE_SPACE) #define TYPE_FLAG_DATA_SPACE (1 << 10) -#define TYPE_DATA_SPACE(t) ((t)->flags & TYPE_FLAG_DATA_SPACE) +#define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE) /* FIXME: Kludge to mark a varargs function type for C++ member function argument processing. Currently only used in dwarf2read.c, @@ -246,246 +246,248 @@ enum type_code another flag. */ #define TYPE_FLAG_VARARGS (1 << 11) -#define TYPE_VARARGS(t) ((t)->flags & TYPE_FLAG_VARARGS) +#define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS) /* Identify a vector type. Gcc is handling this by adding an extra attribute to the array type. We slurp that in as a new flag of a type. This is used only in dwarf2read.c. */ #define TYPE_FLAG_VECTOR (1 << 12) -#define TYPE_VECTOR(t) ((t)->flags & TYPE_FLAG_VECTOR) - - -struct type +#define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR) + +struct main_type +{ + /* Code for kind of type */ + + enum type_code code; + + /* Name of this type, or NULL if none. + + This is used for printing only, except by poorly designed C++ code. + For looking up a name, look for a symbol in the VAR_NAMESPACE. */ + + char *name; + + /* Tag name for this type, or NULL if none. This means that the + name of the type consists of a keyword followed by the tag name. + Which keyword is determined by the type code ("struct" for + TYPE_CODE_STRUCT, etc.). As far as I know C/C++ are the only languages + with this feature. + + This is used for printing only, except by poorly designed C++ code. + For looking up a name, look for a symbol in the STRUCT_NAMESPACE. + One more legitimate use is that if TYPE_FLAG_STUB is set, this is + the name to use to look for definitions in other files. */ + + char *tag_name; + + /* Length of storage for a value of this type. This is what + sizeof(type) would return; use it for address arithmetic, + memory reads and writes, etc. This size includes padding. For + example, an i386 extended-precision floating point value really + only occupies ten bytes, but most ABI's declare its size to be + 12 bytes, to preserve alignment. A `struct type' representing + such a floating-point type would have a `length' value of 12, + even though the last two bytes are unused. + + There's a bit of a host/target mess here, if you're concerned + about machines whose bytes aren't eight bits long, or who don't + have byte-addressed memory. Various places pass this to memcpy + and such, meaning it must be in units of host bytes. Various + other places expect they can calculate addresses by adding it + and such, meaning it must be in units of target bytes. For + some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8 + and TARGET_CHAR_BIT will be (say) 32, this is a problem. + + One fix would be to make this field in bits (requiring that it + always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) --- + the other choice would be to make it consistently in units of + HOST_CHAR_BIT. However, this would still fail to address + machines based on a ternary or decimal representation. */ + + unsigned length; + + /* FIXME, these should probably be restricted to a Fortran-specific + field in some fashion. */ +#define BOUND_CANNOT_BE_DETERMINED 5 +#define BOUND_BY_REF_ON_STACK 4 +#define BOUND_BY_VALUE_ON_STACK 3 +#define BOUND_BY_REF_IN_REG 2 +#define BOUND_BY_VALUE_IN_REG 1 +#define BOUND_SIMPLE 0 + int upper_bound_type; + int lower_bound_type; + + /* Every type is now associated with a particular objfile, and the + type is allocated on the type_obstack for that objfile. One problem + however, is that there are times when gdb allocates new types while + it is not in the process of reading symbols from a particular objfile. + Fortunately, these happen when the type being created is a derived + type of an existing type, such as in lookup_pointer_type(). So + we can just allocate the new type using the same objfile as the + existing type, but to do this we need a backpointer to the objfile + from the existing type. Yes this is somewhat ugly, but without + major overhaul of the internal type system, it can't be avoided + for now. */ + + struct objfile *objfile; + + /* For a pointer type, describes the type of object pointed to. + For an array type, describes the type of the elements. + For a function or method type, describes the type of the return value. + For a range type, describes the type of the full range. + For a complex type, describes the type of each coordinate. + Unused otherwise. */ + + struct type *target_type; + + /* Flags about this type. */ + + int flags; + + /* Number of fields described for this type */ + + short nfields; + + /* For structure and union types, a description of each field. + For set and pascal array types, there is one "field", + whose type is the domain type of the set or array. + For range types, there are two "fields", + the minimum and maximum values (both inclusive). + For enum types, each possible value is described by one "field". + For a function type, a "field" for each parameter type. + For C++ classes, there is one field for each base class (if it is + a derived class) plus one field for each class data member. Member + functions are recorded elsewhere. + + Using a pointer to a separate array of fields + allows all types to have the same size, which is useful + because we can allocate the space for a type before + we know what to put in it. */ + + struct field { + union field_location + { + /* Position of this field, counting in bits from start of + containing structure. + For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB. + For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB. + For a range bound or enum value, this is the value itself. */ - /* Code for kind of type */ + int bitpos; - enum type_code code; + /* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr + is the location (in the target) of the static field. + Otherwise, physname is the mangled label of the static field. */ - /* Name of this type, or NULL if none. + CORE_ADDR physaddr; + char *physname; - This is used for printing only, except by poorly designed C++ code. - For looking up a name, look for a symbol in the VAR_NAMESPACE. */ + /* For a function type, this is 1 if the argument is marked + artificial. Artificial arguments should not be shown to the + user. */ + int artificial; + } + loc; - char *name; + /* Size of this field, in bits, or zero if not packed. + For an unpacked field, the field's type's length + says how many bytes the field occupies. + A value of -1 or -2 indicates a static field; -1 means the location + is specified by the label loc.physname; -2 means that loc.physaddr + specifies the actual address. */ - /* Tag name for this type, or NULL if none. This means that the - name of the type consists of a keyword followed by the tag name. - Which keyword is determined by the type code ("struct" for - TYPE_CODE_STRUCT, etc.). As far as I know C/C++ are the only languages - with this feature. - - This is used for printing only, except by poorly designed C++ code. - For looking up a name, look for a symbol in the STRUCT_NAMESPACE. - One more legitimate use is that if TYPE_FLAG_STUB is set, this is - the name to use to look for definitions in other files. */ - - char *tag_name; - - /* Length of storage for a value of this type. This is what - sizeof(type) would return; use it for address arithmetic, - memory reads and writes, etc. This size includes padding. For - example, an i386 extended-precision floating point value really - only occupies ten bytes, but most ABI's declare its size to be - 12 bytes, to preserve alignment. A `struct type' representing - such a floating-point type would have a `length' value of 12, - even though the last two bytes are unused. - - There's a bit of a host/target mess here, if you're concerned - about machines whose bytes aren't eight bits long, or who don't - have byte-addressed memory. Various places pass this to memcpy - and such, meaning it must be in units of host bytes. Various - other places expect they can calculate addresses by adding it - and such, meaning it must be in units of target bytes. For - some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8 - and TARGET_CHAR_BIT will be (say) 32, this is a problem. - - One fix would be to make this field in bits (requiring that it - always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) --- - the other choice would be to make it consistently in units of - HOST_CHAR_BIT. However, this would still fail to address - machines based on a ternary or decimal representation. */ - unsigned length; - - /* FIXME, these should probably be restricted to a Fortran-specific - field in some fashion. */ -#define BOUND_CANNOT_BE_DETERMINED 5 -#define BOUND_BY_REF_ON_STACK 4 -#define BOUND_BY_VALUE_ON_STACK 3 -#define BOUND_BY_REF_IN_REG 2 -#define BOUND_BY_VALUE_IN_REG 1 -#define BOUND_SIMPLE 0 - int upper_bound_type; - int lower_bound_type; - - /* Every type is now associated with a particular objfile, and the - type is allocated on the type_obstack for that objfile. One problem - however, is that there are times when gdb allocates new types while - it is not in the process of reading symbols from a particular objfile. - Fortunately, these happen when the type being created is a derived - type of an existing type, such as in lookup_pointer_type(). So - we can just allocate the new type using the same objfile as the - existing type, but to do this we need a backpointer to the objfile - from the existing type. Yes this is somewhat ugly, but without - major overhaul of the internal type system, it can't be avoided - for now. */ - - struct objfile *objfile; - - /* For a pointer type, describes the type of object pointed to. - For an array type, describes the type of the elements. - For a function or method type, describes the type of the return value. - For a range type, describes the type of the full range. - For a complex type, describes the type of each coordinate. - Unused otherwise. */ - - struct type *target_type; - - /* Type that is a pointer to this type. - NULL if no such pointer-to type is known yet. - The debugger may add the address of such a type - if it has to construct one later. */ - - struct type *pointer_type; - - /* C++: also need a reference type. */ - - struct type *reference_type; - - /* C-v variant chain. This points to a type that - differs from this one only in a const or volatile - attribute (or both). The various c-v variants - are chained together in a ring. */ - struct type *cv_type; - - /* Address-space delimited variant chain. This points to a type - that differs from this one only in an address-space qualifier - attribute. The otherwise-identical address-space delimited - types are chained together in a ring. */ - struct type *as_type; - - /* Flags about this type. */ - - int flags; - - /* Number of fields described for this type */ - - short nfields; - - /* For structure and union types, a description of each field. - For set and pascal array types, there is one "field", - whose type is the domain type of the set or array. - For range types, there are two "fields", - the minimum and maximum values (both inclusive). - For enum types, each possible value is described by one "field". - For a function type, a "field" for each parameter type. - For C++ classes, there is one field for each base class (if it is - a derived class) plus one field for each class data member. Member - functions are recorded elsewhere. - - Using a pointer to a separate array of fields - allows all types to have the same size, which is useful - because we can allocate the space for a type before - we know what to put in it. */ - - struct field - { - union field_location - { - /* Position of this field, counting in bits from start of - containing structure. - For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB. - For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB. - For a range bound or enum value, this is the value itself. */ + int bitsize; - int bitpos; + /* In a struct or union type, type of this field. + In a function type, type of this argument. + In an array type, the domain-type of the array. */ - /* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr - is the location (in the target) of the static field. - Otherwise, physname is the mangled label of the static field. */ + struct type *type; - CORE_ADDR physaddr; - char *physname; + /* Name of field, value or argument. + NULL for range bounds and array domains. */ - /* For a function type, this is 1 if the argument is marked - artificial. Artificial arguments should not be shown to the - user. */ - int artificial; - } - loc; + char *name; - /* Size of this field, in bits, or zero if not packed. - For an unpacked field, the field's type's length - says how many bytes the field occupies. - A value of -1 or -2 indicates a static field; -1 means the location - is specified by the label loc.physname; -2 means that loc.physaddr - specifies the actual address. */ + } *fields; - int bitsize; + /* For types with virtual functions (TYPE_CODE_STRUCT), VPTR_BASETYPE + is the base class which defined the virtual function table pointer. - /* In a struct or union type, type of this field. - In a function type, type of this argument. - In an array type, the domain-type of the array. */ + For types that are pointer to member types (TYPE_CODE_MEMBER), + VPTR_BASETYPE is the type that this pointer is a member of. - struct type *type; + For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate + type that contains the method. - /* Name of field, value or argument. - NULL for range bounds and array domains. */ + Unused otherwise. */ - char *name; + struct type *vptr_basetype; - } - *fields; + /* Field number of the virtual function table pointer in + VPTR_BASETYPE. If -1, we were unable to find the virtual + function table pointer in initial symbol reading, and + fill_in_vptr_fieldno should be called to find it if possible. - /* For types with virtual functions (TYPE_CODE_STRUCT), VPTR_BASETYPE - is the base class which defined the virtual function table pointer. + Unused if this type does not have virtual functions. */ - For types that are pointer to member types (TYPE_CODE_MEMBER), - VPTR_BASETYPE is the type that this pointer is a member of. + int vptr_fieldno; - For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate - type that contains the method. + /* Slot to point to additional language-specific fields of this type. */ - Unused otherwise. */ + union type_specific + { + /* ARG_TYPES is for TYPE_CODE_METHOD. + Contains the type of each argument, ending with a void type + after the last argument for normal member functions or a NULL + pointer after the last argument for functions with variable + arguments. */ - struct type *vptr_basetype; + struct type **arg_types; - /* Field number of the virtual function table pointer in - VPTR_BASETYPE. If -1, we were unable to find the virtual - function table pointer in initial symbol reading, and - fill_in_vptr_fieldno should be called to find it if possible. + /* CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to point to + cplus_struct_default, a default static instance of a struct + cplus_struct_type. */ - Unused if this type does not have virtual functions. */ + struct cplus_struct_type *cplus_stuff; - int vptr_fieldno; + /* FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to the + floatformat object that describes the floating-point value + that resides within the type. */ - /* Slot to point to additional language-specific fields of this type. */ + const struct floatformat *floatformat; + } type_specific; +}; - union type_specific - { +/* A ``struct type'' describes a particular instance of a type, with + some particular qualification. */ +struct type +{ + /* Type that is a pointer to this type. + NULL if no such pointer-to type is known yet. + The debugger may add the address of such a type + if it has to construct one later. */ - /* ARG_TYPES is for TYPE_CODE_METHOD. - Contains the type of each argument, ending with a void type - after the last argument for normal member functions or a NULL - pointer after the last argument for functions with variable - arguments. */ + struct type *pointer_type; - struct type **arg_types; + /* C++: also need a reference type. */ - /* CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to point to - cplus_struct_default, a default static instance of a struct - cplus_struct_type. */ + struct type *reference_type; - struct cplus_struct_type *cplus_stuff; + /* Variant chain. This points to a type that differs from this one only + in qualifiers. Currently, the possible qualifiers are const, volatile, + code-space, and data-space. The variants are linked in a circular + ring and share MAIN_TYPE. */ + struct type *chain; - /* FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to the - floatformat object that describes the floating-point value - that resides within the type. */ + /* Flags specific to this instance of the type, indicating where + on the ring we are. */ + int instance_flags; - const struct floatformat *floatformat; - } - type_specific; - }; + /* Core type, shared by a group of qualified types. */ + struct main_type *main_type; +}; #define NULL_TYPE ((struct type *) 0) @@ -738,25 +740,26 @@ extern void allocate_cplus_struct_type (struct type *); #define HAVE_CPLUS_STRUCT(type) \ (TYPE_CPLUS_SPECIFIC(type) != &cplus_struct_default) -#define TYPE_NAME(thistype) (thistype)->name -#define TYPE_TAG_NAME(type) ((type)->tag_name) -#define TYPE_TARGET_TYPE(thistype) (thistype)->target_type +#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags +#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type +#define TYPE_NAME(thistype) TYPE_MAIN_TYPE(thistype)->name +#define TYPE_TAG_NAME(type) TYPE_MAIN_TYPE(type)->tag_name +#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type -#define TYPE_CV_TYPE(thistype) (thistype)->cv_type -#define TYPE_AS_TYPE(thistype) (thistype)->as_type +#define TYPE_CHAIN(thistype) (thistype)->chain /* Note that if thistype is a TYPEDEF type, you have to call check_typedef. But check_typedef does set the TYPE_LENGTH of the TYPEDEF type, so you only have to call check_typedef once. Since allocate_value calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ -#define TYPE_LENGTH(thistype) (thistype)->length -#define TYPE_OBJFILE(thistype) (thistype)->objfile -#define TYPE_FLAGS(thistype) (thistype)->flags +#define TYPE_LENGTH(thistype) TYPE_MAIN_TYPE(thistype)->length +#define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile +#define TYPE_FLAGS(thistype) TYPE_MAIN_TYPE(thistype)->flags /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real type, you need to do TYPE_CODE (check_type (this_type)). */ -#define TYPE_CODE(thistype) (thistype)->code -#define TYPE_NFIELDS(thistype) (thistype)->nfields -#define TYPE_FIELDS(thistype) (thistype)->fields +#define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code +#define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields +#define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->fields #define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args #define TYPE_INSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->instantiations @@ -766,8 +769,10 @@ extern void allocate_cplus_struct_type (struct type *); /* Moto-specific stuff for FORTRAN arrays */ -#define TYPE_ARRAY_UPPER_BOUND_TYPE(thistype) (thistype)->upper_bound_type -#define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) (thistype)->lower_bound_type +#define TYPE_ARRAY_UPPER_BOUND_TYPE(thistype) \ + TYPE_MAIN_TYPE(thistype)->upper_bound_type +#define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) \ + TYPE_MAIN_TYPE(thistype)->lower_bound_type #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1)) @@ -777,22 +782,22 @@ extern void allocate_cplus_struct_type (struct type *); /* C++ */ -#define TYPE_VPTR_BASETYPE(thistype) (thistype)->vptr_basetype -#define TYPE_DOMAIN_TYPE(thistype) (thistype)->vptr_basetype -#define TYPE_VPTR_FIELDNO(thistype) (thistype)->vptr_fieldno +#define TYPE_VPTR_BASETYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype +#define TYPE_DOMAIN_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype +#define TYPE_VPTR_FIELDNO(thistype) TYPE_MAIN_TYPE(thistype)->vptr_fieldno #define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields #define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields #define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total #define TYPE_NTEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ntemplate_args #define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations #define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type -#define TYPE_TYPE_SPECIFIC(thistype) (thistype)->type_specific -#define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types -#define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff -#define TYPE_FLOATFORMAT(thistype) (thistype)->type_specific.floatformat -#define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type +#define TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific +#define TYPE_ARG_TYPES(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.arg_types +#define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff +#define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat +#define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses -#define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name +#define TYPE_BASECLASS_NAME(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].name #define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index) #define BASETYPE_VIA_PUBLIC(thistype, index) \ ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index))) @@ -812,7 +817,7 @@ extern void allocate_cplus_struct_type (struct type *); ((thisfld).bitsize = -1, FIELD_PHYSNAME(thisfld) = (name)) #define SET_FIELD_PHYSADDR(thisfld, name) \ ((thisfld).bitsize = -2, FIELD_PHYSADDR(thisfld) = (name)) -#define TYPE_FIELD(thistype, n) (thistype)->fields[n] +#define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->fields[n] #define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n)) @@ -851,8 +856,8 @@ extern void allocate_cplus_struct_type (struct type *); (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \ : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))) -#define TYPE_FIELD_STATIC(thistype, n) ((thistype)->fields[n].bitsize < 0) -#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) ((thistype)->fields[n].bitsize == -2) +#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize < 0) +#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize == -2) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n)) @@ -1077,8 +1082,6 @@ extern struct type *make_reference_type (struct type *, struct type **); extern struct type *make_cv_type (int, int, struct type *, struct type **); -extern void finish_cv_type (struct type *); - extern void replace_type (struct type *, struct type *); extern int address_space_name_to_int (char *); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 720364b..e86af89 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1,6 +1,7 @@ /* Abstraction of GNU v3 abi. Contributed by Jim Blandy - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -174,7 +175,8 @@ build_gdb_vtable_type (struct gdbarch *arch) static int vtable_address_point_offset () { - struct type *vtable_type = gdbarch_data (vtable_type_gdbarch_data); + struct type *vtable_type = gdbarch_data (current_gdbarch, + vtable_type_gdbarch_data); return (TYPE_FIELD_BITPOS (vtable_type, vtable_field_virtual_functions) / TARGET_CHAR_BIT); @@ -185,7 +187,8 @@ static struct type * gnuv3_rtti_type (struct value *value, int *full_p, int *top_p, int *using_enc_p) { - struct type *vtable_type = gdbarch_data (vtable_type_gdbarch_data); + struct type *vtable_type = gdbarch_data (current_gdbarch, + vtable_type_gdbarch_data); struct type *value_type = check_typedef (VALUE_TYPE (value)); CORE_ADDR vtable_address; struct value *vtable; @@ -293,7 +296,8 @@ gnuv3_virtual_fn_field (struct value **value_p, struct fn_field *f, int j, struct type *type, int offset) { - struct type *vtable_type = gdbarch_data (vtable_type_gdbarch_data); + struct type *vtable_type = gdbarch_data (current_gdbarch, + vtable_type_gdbarch_data); struct value *value = *value_p; struct type *value_type = check_typedef (VALUE_TYPE (value)); struct type *vfn_base; @@ -368,7 +372,8 @@ int gnuv3_baseclass_offset (struct type *type, int index, char *valaddr, CORE_ADDR address) { - struct type *vtable_type = gdbarch_data (vtable_type_gdbarch_data); + struct type *vtable_type = gdbarch_data (current_gdbarch, + vtable_type_gdbarch_data); struct type *basetype = TYPE_BASECLASS (type, index); struct value *full_object, *vbase_object, *orig_object; struct value *vtable, *orig_typeinfo, *orig_base_info; diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 7b64b17..a16b1b3 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -29,7 +29,7 @@ #include "gdbcmd.h" #include "floatformat.h" #include "buildsym.h" -#include "i387-nat.h" +#include "i387-tdep.h" #include "i386-tdep.h" #include "value.h" #include "regcache.h" diff --git a/gdb/gregset.h b/gdb/gregset.h index cb27517..0ec80a1 100644 --- a/gdb/gregset.h +++ b/gdb/gregset.h @@ -53,7 +53,7 @@ extern void fill_gregset (gdb_gregset_t *gregs, int regno); extern void fill_fpregset (gdb_fpregset_t *fpregs, int regno); #ifdef FILL_FPXREGSET -/* Linux/i386: Copy register values between GDB's internal register cache +/* GNU/Linux i386: Copy register values between GDB's internal register cache and the i386 extended floating point registers. */ #ifndef GDB_FPXREGSET_T diff --git a/gdb/hpread.c b/gdb/hpread.c index ca153f9..45a00a6 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -3230,7 +3230,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, else /* expect DNTT_TYPE_FUNC_TEMPLATE */ type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc_template.retval, objfile)); - memcpy ((char *) type, (char *) type1, sizeof (struct type)); + replace_type (type, type1); /* Mark it -- in the middle of processing */ TYPE_FLAGS (type) |= TYPE_FLAG_INCOMPLETE; @@ -3407,7 +3407,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC) type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval, objfile)); - memcpy ((char *) type, (char *) type1, sizeof (struct type)); + replace_type (type, type1); /* Mark it -- in the middle of processing */ TYPE_FLAGS (type) |= TYPE_FLAG_INCOMPLETE; @@ -3968,23 +3968,28 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, fn_p->field.fn_fields[ix].type = memtype; /* The argument list */ - fn_p->field.fn_fields[ix].type->type_specific.arg_types = - (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (memtype->nfields + 1)); - for (i = 0; i < memtype->nfields; i++) - fn_p->field.fn_fields[ix].type->type_specific.arg_types[i] = memtype->fields[i].type; + TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types + = (struct type **) obstack_alloc (&objfile->type_obstack, + (sizeof (struct type *) + * (TYPE_NFIELDS (memtype) + + 1))); + for (i = 0; i < TYPE_NFIELDS (memtype); i++) + TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type) + .arg_types[i] = TYPE_FIELDS (memtype)[i].type; /* void termination */ - fn_p->field.fn_fields[ix].type->type_specific.arg_types[memtype->nfields] = builtin_type_void; + TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type) + .arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void; /* pai: It's not clear why this args field has to be set. Perhaps * it should be eliminated entirely. */ fn_p->field.fn_fields[ix].args = (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (memtype->nfields + 1)); - for (i = 0; i < memtype->nfields; i++) - fn_p->field.fn_fields[ix].args[i] = memtype->fields[i].type; + sizeof (struct type *) * (TYPE_NFIELDS (memtype) + 1)); + for (i = 0; i < TYPE_NFIELDS (memtype); i++) + fn_p->field.fn_fields[ix].args[i] + = TYPE_FIELDS (memtype)[i].type; /* null-terminated, unlike arg_types above e */ - fn_p->field.fn_fields[ix].args[memtype->nfields] = NULL; + fn_p->field.fn_fields[ix].args[TYPE_NFIELDS (memtype)] = NULL; } /* For virtual functions, fill in the voffset field with the * virtual table offset. (This is just copied over from the @@ -4398,9 +4403,6 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Clear the global saying what template we are in the middle of processing */ current_template = NULL; - /* Fix up any cv-qualified versions of this type. */ - finish_cv_type (type); - return type; } @@ -4428,7 +4430,7 @@ fix_static_member_physnames (struct type *type, char *class_name, if (TYPE_FIELD_STATIC_PHYSNAME (type, i)) return; /* physnames are already set */ - SET_FIELD_PHYSNAME (type->fields[i], + SET_FIELD_PHYSNAME (TYPE_FIELDS (type)[i], obstack_alloc (&objfile->type_obstack, strlen (class_name) + strlen (TYPE_FIELD_NAME (type, i)) + 3)); strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name); @@ -4465,23 +4467,23 @@ fixup_class_method_type (struct type *class, struct type *method, /* Set the method type */ TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method; /* The argument list */ - (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j))->type_specific.arg_types + TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types = (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (method->nfields + 1)); - for (k = 0; k < method->nfields; k++) - (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j))->type_specific.arg_types[k] = method->fields[k].type; + sizeof (struct type *) * (TYPE_NFIELDS (method) + 1)); + for (k = 0; k < TYPE_NFIELDS (method); k++) + TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type; /* void termination */ - (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j))->type_specific.arg_types[method->nfields] = builtin_type_void; + TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void; /* pai: It's not clear why this args field has to be set. Perhaps * it should be eliminated entirely. */ (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args = (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (method->nfields + 1)); - for (k = 0; k < method->nfields; k++) - (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[k] = method->fields[k].type; + sizeof (struct type *) * (TYPE_NFIELDS (method) + 1)); + for (k = 0; k < TYPE_NFIELDS (method); k++) + (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[k] = TYPE_FIELDS (method)[k].type; /* null-terminated, unlike arg_types above */ - (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[method->nfields] = NULL; + (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[TYPE_NFIELDS (method)] = NULL; /* Break out of both loops -- only one method to fix up in a class */ goto finish; @@ -4850,7 +4852,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) } /* Build the correct name. */ - structtype->name + TYPE_NAME (structtype) = (char *) obstack_alloc (&objfile->type_obstack, strlen (prefix) + strlen (suffix) + 1); TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index a0d19e7..e20e894 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -57,7 +57,7 @@ #include "gregset.h" /* Prototypes for i387_supply_fsave etc. */ -#include "i387-nat.h" +#include "i387-tdep.h" /* Defines for XMM0_REGNUM etc. */ #include "i386-tdep.h" diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 4e3a15f..ddc461e 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1215,52 +1215,195 @@ gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info) } +/* This table matches the indices assigned to enum i386_abi. Keep + them in sync. */ +static const char * const i386_abi_names[] = +{ + "", + "SVR4", + "NetBSD", + "GNU/Linux", + "GNU/Hurd", + "Solaris", + "FreeBSD", + NULL +}; + + +#define ABI_TAG_OS_GNU_LINUX I386_ABI_LINUX +#define ABI_TAG_OS_GNU_HURD I386_ABI_HURD +#define ABI_TAG_OS_GNU_SOLARIS I386_ABI_INVALID +#define ABI_TAG_OS_FREEBSD I386_ABI_FREEBSD +#define ABI_TAG_OS_NETBSD I386_ABI_NETBSD + static void -process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) +process_note_sections (bfd *abfd, asection *sect, void *obj) { - int *os_ident_ptr = obj; + int *abi = obj; const char *name; - unsigned int sect_size; + unsigned int sectsize; name = bfd_get_section_name (abfd, sect); - sect_size = bfd_section_size (abfd, sect); - if (strcmp (name, ".note.ABI-tag") == 0 && sect_size > 0) + sectsize = bfd_section_size (abfd, sect); + + if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) { unsigned int name_length, data_length, note_type; - char *note = alloca (sect_size); + char *note; + + /* If the section is larger than this, it's probably not what we + are looking for. */ + if (sectsize > 128) + sectsize = 128; + + note = alloca (sectsize); bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sect_size); + (file_ptr) 0, (bfd_size_type) sectsize); name_length = bfd_h_get_32 (abfd, note); data_length = bfd_h_get_32 (abfd, note + 4); note_type = bfd_h_get_32 (abfd, note + 8); - if (name_length == 4 && data_length == 16 && note_type == 1 - && strcmp (note + 12, "GNU") == 0) - { - int os_number = bfd_h_get_32 (abfd, note + 16); - - /* The case numbers are from abi-tags in glibc. */ - switch (os_number) - { - case 0: - *os_ident_ptr = ELFOSABI_LINUX; - break; - case 1: - *os_ident_ptr = ELFOSABI_HURD; - break; - case 2: - *os_ident_ptr = ELFOSABI_SOLARIS; - break; - default: - internal_error (__FILE__, __LINE__, - "process_note_abi_sections: " - "unknown OS number %d", os_number); - break; - } - } + if (name_length == 4 && data_length == 16 + && note_type == NT_GNU_ABI_TAG + && strcmp (note + 12, "GNU") == 0) + { + int abi_tag_os = bfd_h_get_32 (abfd, note + 16); + + /* The case numbers are from abi-tags in glibc. */ + switch (abi_tag_os) + { + case GNU_ABI_TAG_LINUX: + *abi = ABI_TAG_OS_GNU_LINUX; + break; + + case GNU_ABI_TAG_HURD: + *abi = ABI_TAG_OS_GNU_HURD; + break; + + case GNU_ABI_TAG_SOLARIS: + *abi = ABI_TAG_OS_GNU_SOLARIS; + break; + + default: + internal_error + (__FILE__, __LINE__, + "process_note_abi_sections: unknown ABI OS tag %d", + abi_tag_os); + break; + } + } + else if (name_length == 8 && data_length == 4 + && note_type == NT_FREEBSD_ABI_TAG + && strcmp (note + 12, "FreeBSD") == 0) + *abi = ABI_TAG_OS_FREEBSD; } + /* NetBSD uses a similar trick. */ + else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0) + { + unsigned int name_length, desc_length, note_type; + char *note; + + /* If the section is larger than this, it's probably not what we are + looking for. */ + if (sectsize > 128) + sectsize = 128; + + note = alloca (sectsize); + + bfd_get_section_contents (abfd, sect, note, + (file_ptr) 0, (bfd_size_type) sectsize); + + name_length = bfd_h_get_32 (abfd, note); + desc_length = bfd_h_get_32 (abfd, note + 4); + note_type = bfd_h_get_32 (abfd, note + 8); + + if (name_length == 7 && desc_length == 4 + && note_type == NT_NETBSD_IDENT + && strcmp (note + 12, "NetBSD") == 0) + *abi = ABI_TAG_OS_NETBSD; + } +} + +static int +i386_elf_abi_from_note (bfd *abfd) +{ + enum i386_abi abi = I386_ABI_UNKNOWN; + + bfd_map_over_sections (abfd, process_note_sections, &abi); + + return abi; +} + +static enum i386_abi +i386_elf_abi (bfd *abfd) +{ + int elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; + + /* The fact that the EI_OSABI byte is set to ELFOSABI_NONE doesn't + necessarily mean that this is a System V ELF binary. To further + distinguish between binaries for differens operating systems, + check for vendor-specific note elements. */ + if (elfosabi == ELFOSABI_NONE) + { + enum i386_abi abi = i386_elf_abi_from_note (abfd); + + if (abi != I386_ABI_UNKNOWN) + return abi; + + /* FreeBSD folks are naughty; they stored the string "FreeBSD" + in the padding of the e_ident field of the ELF header. */ + if (strcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD") == 0) + return I386_ABI_FREEBSD; + } + + switch (elfosabi) + { + case ELFOSABI_NONE: + return I386_ABI_SVR4; + case ELFOSABI_FREEBSD: + return I386_ABI_FREEBSD; + } + + return I386_ABI_UNKNOWN; +} + +struct i386_abi_handler +{ + struct i386_abi_handler *next; + enum i386_abi abi; + void (*init_abi)(struct gdbarch_info, struct gdbarch *); +}; + +struct i386_abi_handler *i386_abi_handler_list = NULL; + +void +i386_gdbarch_register_os_abi (enum i386_abi abi, + void (*init_abi)(struct gdbarch_info, + struct gdbarch *)) +{ + struct i386_abi_handler **handler_p; + + for (handler_p = &i386_abi_handler_list; *handler_p != NULL; + handler_p = &(*handler_p)->next) + { + if ((*handler_p)->abi == abi) + { + internal_error + (__FILE__, __LINE__, + "i386_gdbarch_register_abi: A handler for this ABI variant " + "(%d) has already been registered", (int) abi); + /* If user wants to continue, override previous definition. */ + (*handler_p)->init_abi = init_abi; + return; + } + } + (*handler_p) + = (struct i386_abi_handler *) xmalloc (sizeof (struct i386_abi_handler)); + (*handler_p)->next = NULL; + (*handler_p)->abi = abi; + (*handler_p)->init_abi = init_abi; } struct gdbarch * @@ -1268,42 +1411,31 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch_tdep *tdep; struct gdbarch *gdbarch; - int os_ident; + enum i386_abi abi = I386_ABI_UNKNOWN; + struct i386_abi_handler *abi_handler; - if (info.abfd != NULL - && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour) + if (info.abfd != NULL) { - os_ident = elf_elfheader (info.abfd)->e_ident[EI_OSABI]; - - /* If os_ident is 0, it is not necessarily the case that we're - on a SYSV system. (ELFOSABI_NONE is defined to be 0.) - GNU/Linux uses a note section to record OS/ABI info, but - leaves e_ident[EI_OSABI] zero. So we have to check for note - sections too. */ - if (os_ident == ELFOSABI_NONE) - bfd_map_over_sections (info.abfd, - process_note_abi_tag_sections, - &os_ident); - - /* If that didn't help us, revert to some non-standard checks. */ - if (os_ident == ELFOSABI_NONE) + switch (bfd_get_flavour (info.abfd)) { - /* FreeBSD folks are naughty; they stored the string - "FreeBSD" in the padding of the e_ident field of the ELF - header. */ - if (strcmp (&elf_elfheader (info.abfd)->e_ident[8], "FreeBSD") == 0) - os_ident = ELFOSABI_FREEBSD; - } + case bfd_target_elf_flavour: + abi= i386_elf_abi (info.abfd); + break; + + default: + /* Not sure what to do here, leave the ABI as unknown. */ + break; + } } - else - os_ident = -1; + /* Find a candidate among extant architectures. */ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL; arches = gdbarch_list_lookup_by_info (arches->next, &info)) { + /* Make sure the ABI selection matches. */ tdep = gdbarch_tdep (arches->gdbarch); - if (tdep && tdep->os_ident == os_ident) + if (tdep && tdep->abi == abi) return arches->gdbarch; } @@ -1311,7 +1443,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); - tdep->os_ident = os_ident; + tdep->abi = abi; /* FIXME: kettenis/2001-11-24: Although not all IA-32 processors have the SSE registers, it's easier to set the default to 8. */ @@ -1338,6 +1470,40 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tm-ptx.h, tm-symmetry.h currently override this. Sigh. */ set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SSE_REGS); + /* Hook in ABI-specific overrides, if they have been registered. */ + if (abi == I386_ABI_UNKNOWN) + { + /* Don't complain about not knowing the ABI variant if we don't + have an inferior. */ + if (info.abfd) + fprintf_filtered + (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. " + "Attempting to continue with the default i386 settings"); + } + else + { + for (abi_handler = i386_abi_handler_list; abi_handler != NULL; + abi_handler = abi_handler->next) + if (abi_handler->abi == abi) + break; + + if (abi_handler) + abi_handler->init_abi (info, gdbarch); + else + { + /* We assume that if GDB_MULTI_ARCH is less than + GDB_MULTI_ARCH_TM that an ABI variant can be supported by + overriding definitions in this file. */ + if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + fprintf_filtered + (gdb_stderr, + "A handler for the ABI variant \"%s\" is not built into this " + "configuration of GDB. " + "Attempting to continue with the default i386 settings", + i386_abi_names[abi]); + } + } + return gdbarch; } diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index a990adf..0bdbb05 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -40,11 +40,27 @@ differs and is determined by the num_xmm_regs member of `struct gdbarch_tdep'. */ +/* ABI variants that we know about. */ +enum i386_abi +{ + I386_ABI_UNKNOWN = 0, + + /* ELF */ + I386_ABI_SVR4, /* This is the default. */ + I386_ABI_NETBSD, + I386_ABI_LINUX, + I386_ABI_HURD, + I386_ABI_SOLARIS, + I386_ABI_FREEBSD, + + I386_ABI_INVALID = -1 +}; + /* i386 architecture specific information. */ struct gdbarch_tdep { - /* OS/ABI. */ - int os_ident; + /* ABI. */ + enum i386_abi abi; /* Number of SSE registers. */ int num_xmm_regs; @@ -113,4 +129,8 @@ struct gdbarch_tdep #define IS_FPU_CTRL_REGNUM(n) FPC_REGNUM_P (n) #define IS_SSE_REGNUM(n) SSE_REGNUM_P (n) +void i386_gdbarch_register_os_abi (enum i386_abi, + void (*init_abi)(struct gdbarch_info, + struct gdbarch *)); + #endif /* i386-tdep.h */ diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c index 5d35830..ad5a301 100644 --- a/gdb/i386bsd-nat.c +++ b/gdb/i386bsd-nat.c @@ -148,7 +148,7 @@ fill_gregset (gregset_t *gregsetp, int regno) regcache_collect (i, REG_ADDR (gregsetp, i)); } -#include "i387-nat.h" +#include "i387-tdep.h" /* Fill GDB's register array with the floating-point register values in *FPREGSETP. */ diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c index e82fe0d..329ef2f 100644 --- a/gdb/i386gnu-nat.c +++ b/gdb/i386gnu-nat.c @@ -36,7 +36,7 @@ #include "i386-tdep.h" #include "gnu-nat.h" -#include "i387-nat.h" +#include "i387-tdep.h" #ifdef HAVE_SYS_PROCFS_H # include diff --git a/gdb/i386nbsd-nat.c b/gdb/i386nbsd-nat.c deleted file mode 100644 index 32a3d78..0000000 --- a/gdb/i386nbsd-nat.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Native-dependent code for NetBSD/i386, for GDB. - Copyright 1988, 1989, 1991, 1992, 1994, 1996, 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 -#include -#include -#include -#include "inferior.h" -#include "gdbcore.h" -#include "regcache.h" - -#ifndef HAVE_GREGSET_T -typedef struct reg gregset_t; -#endif - -#ifndef HAVE_FPREGSET_T -typedef struct fpreg fpregset_t; -#endif - -#include "gregset.h" - -/* Prototypes for i387_supply_fsave etc. */ -#include "i387-nat.h" - -struct md_core -{ - struct reg intreg; - char freg[108]; -}; - -static void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) -{ - struct md_core *core_reg = (struct md_core *) core_reg_sect; - - /* We get everything from one section. */ - if (which != 0) - return; - - /* Integer registers. */ - supply_gregset (&core_reg->intreg); - - /* Floating point registers. */ - i387_supply_fsave (core_reg->freg); -} - -static void -fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) -{ - gregset_t gregset; - - switch (which) - { - case 0: /* Integer registers. */ - if (core_reg_size != sizeof (struct reg)) - warning ("Wrong size register set in core file."); - else - { - memcpy (&gregset, core_reg_sect, sizeof (gregset)); - supply_gregset (&gregset); - } - break; - - case 2: /* Floating point registers. */ - if (core_reg_size != 108) - warning ("Wrong size FP register set in core file."); - else - i387_supply_fsave (core_reg_sect); - break; - - case 3: /* "Extended" floating point registers. This is gdb-speak - for SSE/SSE2. */ - if (core_reg_size != 512) - warning ("Wrong size XMM register set in core file."); - else - i387_supply_fxsave (core_reg_sect); - break; - - default: - /* Don't know what kind of register request this is; just ignore it. */ - break; - } -} - -/* Register that we are able to handle i386nbsd core file formats. - FIXME: is this really bfd_target_unknown_flavour? */ - -static struct core_fns i386nbsd_core_fns = -{ - bfd_target_unknown_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ -}; - -static struct core_fns i386nbsd_elfcore_fns = -{ - bfd_target_elf_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_elfcore_registers, /* core_read_registers */ - NULL /* next */ -}; - -void -_initialize_i386nbsd_nat (void) -{ - add_core_fns (&i386nbsd_core_fns); - add_core_fns (&i386nbsd_elfcore_fns); -} diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 7174d4d..02ba77c 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for NetBSD/i386, for GDB. - Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001 + Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -21,12 +21,135 @@ #include "defs.h" #include "gdbtypes.h" +#include "gdbcore.h" +#include "regcache.h" +#include "i387-tdep.h" + +/* Map a GDB register number to an offset in the reg structure. */ +static int regmap[] = +{ + ( 0 * 4), /* %eax */ + ( 1 * 4), /* %ecx */ + ( 2 * 4), /* %edx */ + ( 3 * 4), /* %ebx */ + ( 4 * 4), /* %esp */ + ( 5 * 4), /* %epb */ + ( 6 * 4), /* %esi */ + ( 7 * 4), /* %edi */ + ( 8 * 4), /* %eip */ + ( 9 * 4), /* %eflags */ + (10 * 4), /* %cs */ + (11 * 4), /* %ss */ + (12 * 4), /* %ds */ + (13 * 4), /* %es */ + (14 * 4), /* %fs */ + (15 * 4), /* %gs */ +}; + +#define SIZEOF_STRUCT_REG (16 * 4) + +static void +i386nbsd_supply_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i <= 15; i++) + if (regno == i || regno == -1) + supply_register (i, regs + regmap[i]); +} + +static void +fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + char *regs, *fsave; + + /* We get everything from one section. */ + if (which != 0) + return; + + if (core_reg_size < (SIZEOF_STRUCT_REG + 108)) + { + warning ("Wrong size register set in core file."); + return; + } + + regs = core_reg_sect; + fsave = core_reg_sect + SIZEOF_STRUCT_REG; + + /* Integer registers. */ + i386nbsd_supply_reg (regs, -1); + + /* Floating point registers. */ + i387_supply_fsave (fsave); +} + +static void +fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + switch (which) + { + case 0: /* Integer registers. */ + if (core_reg_size != SIZEOF_STRUCT_REG) + warning ("Wrong size register set in core file."); + else + i386nbsd_supply_reg (core_reg_sect, -1); + break; + + case 2: /* Floating point registers. */ + if (core_reg_size != 108) + warning ("Wrong size FP register set in core file."); + else + i387_supply_fsave (core_reg_sect); + break; + + case 3: /* "Extended" floating point registers. This is gdb-speak + for SSE/SSE2. */ + if (core_reg_size != 512) + warning ("Wrong size XMM register set in core file."); + else + i387_supply_fxsave (core_reg_sect); + break; + + default: + /* Don't know what kind of register request this is; just ignore it. */ + break; + } +} + +static struct core_fns i386nbsd_core_fns = +{ + bfd_target_unknown_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + +static struct core_fns i386nbsd_elfcore_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_elfcore_registers, /* core_read_registers */ + NULL /* next */ +}; + +/* FIXME: should be multi-arch'd */ int -i386nbsd_use_struct_convention (int gcc_p, struct type *type) +i386nbsd_aout_use_struct_convention (int gcc_p, struct type *type) { return !(TYPE_LENGTH (type) == 1 || TYPE_LENGTH (type) == 2 || TYPE_LENGTH (type) == 4 || TYPE_LENGTH (type) == 8); } + +void +_initialize_i386nbsd_tdep (void) +{ + add_core_fns (&i386nbsd_core_fns); + add_core_fns (&i386nbsd_elfcore_fns); +} diff --git a/gdb/i386v4-nat.c b/gdb/i386v4-nat.c index 33dbde8..c67f1fb 100644 --- a/gdb/i386v4-nat.c +++ b/gdb/i386v4-nat.c @@ -27,7 +27,7 @@ #ifdef HAVE_SYS_REG_H #include #endif -#include "i387-nat.h" +#include "i387-tdep.h" #ifdef HAVE_SYS_PROCFS_H diff --git a/gdb/i387-nat.c b/gdb/i387-nat.c deleted file mode 100644 index 163dcfd..0000000 --- a/gdb/i387-nat.c +++ /dev/null @@ -1,351 +0,0 @@ -/* Native-dependent code for the i387. - Copyright 2000, 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 "inferior.h" -#include "value.h" -#include "regcache.h" - -#include "i387-nat.h" -#include "i386-tdep.h" - -/* FIXME: kettenis/2000-05-21: Right now more than a few i386 targets - define their own routines to manage the floating-point registers in - GDB's register array. Most (if not all) of these targets use the - format used by the "fsave" instruction in their communication with - the OS. They should all be converted to use the routines below. */ - -/* At fsave_offset[REGNUM] you'll find the offset to the location in - the data structure used by the "fsave" instruction where GDB - register REGNUM is stored. */ - -static int fsave_offset[] = -{ - 28 + 0 * FPU_REG_RAW_SIZE, /* FP0_REGNUM through ... */ - 28 + 1 * FPU_REG_RAW_SIZE, - 28 + 2 * FPU_REG_RAW_SIZE, - 28 + 3 * FPU_REG_RAW_SIZE, - 28 + 4 * FPU_REG_RAW_SIZE, - 28 + 5 * FPU_REG_RAW_SIZE, - 28 + 6 * FPU_REG_RAW_SIZE, - 28 + 7 * FPU_REG_RAW_SIZE, /* ... FP7_REGNUM. */ - 0, /* FCTRL_REGNUM (16 bits). */ - 4, /* FSTAT_REGNUM (16 bits). */ - 8, /* FTAG_REGNUM (16 bits). */ - 16, /* FISEG_REGNUM (16 bits). */ - 12, /* FIOFF_REGNUM. */ - 24, /* FOSEG_REGNUM. */ - 20, /* FOOFF_REGNUM. */ - 18 /* FOP_REGNUM (bottom 11 bits). */ -}; - -#define FSAVE_ADDR(fsave, regnum) (fsave + fsave_offset[regnum - FP0_REGNUM]) - - -/* Fill register REGNUM in GDB's register array with the appropriate - value from *FSAVE. This function masks off any of the reserved - bits in *FSAVE. */ - -void -i387_supply_register (int regnum, char *fsave) -{ - /* Most of the FPU control registers occupy only 16 bits in - the fsave area. Give those a special treatment. */ - if (regnum >= FPC_REGNUM - && regnum != FIOFF_REGNUM && regnum != FOOFF_REGNUM) - { - unsigned int val = *(unsigned short *) (FSAVE_ADDR (fsave, regnum)); - - if (regnum == FOP_REGNUM) - { - val &= ((1 << 11) - 1); - supply_register (regnum, (char *) &val); - } - else - supply_register (regnum, (char *) &val); - } - else - supply_register (regnum, FSAVE_ADDR (fsave, regnum)); -} - -/* Fill GDB's register array with the floating-point register values - in *FSAVE. This function masks off any of the reserved - bits in *FSAVE. */ - -void -i387_supply_fsave (char *fsave) -{ - int i; - - for (i = FP0_REGNUM; i < XMM0_REGNUM; i++) - i387_supply_register (i, fsave); -} - -/* Fill register REGNUM (if it is a floating-point register) in *FSAVE - with the value in GDB's register array. If REGNUM is -1, do this - for all registers. This function doesn't touch any of the reserved - bits in *FSAVE. */ - -void -i387_fill_fsave (char *fsave, int regnum) -{ - int i; - - for (i = FP0_REGNUM; i < XMM0_REGNUM; i++) - if (regnum == -1 || regnum == i) - { - /* Most of the FPU control registers occupy only 16 bits in - the fsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM - && i != FIOFF_REGNUM && i != FOOFF_REGNUM) - { - char buf[4]; - - regcache_collect (i, buf); - - if (i == FOP_REGNUM) - { - unsigned short oldval, newval; - - /* The opcode occupies only 11 bits. */ - oldval = (*(unsigned short *) (FSAVE_ADDR (fsave, i))); - newval = *(unsigned short *) buf; - newval &= ((1 << 11) - 1); - newval |= oldval & ~((1 << 11) - 1); - memcpy (FSAVE_ADDR (fsave, i), &newval, 2); - } - else - memcpy (FSAVE_ADDR (fsave, i), buf, 2); - } - else - regcache_collect (i, FSAVE_ADDR (fsave, i)); - } -} - - -/* At fxsave_offset[REGNUM] you'll find the offset to the location in - the data structure used by the "fxsave" instruction where GDB - register REGNUM is stored. */ - -static int fxsave_offset[] = -{ - 32, /* FP0_REGNUM through ... */ - 48, - 64, - 80, - 96, - 112, - 128, - 144, /* ... FP7_REGNUM (80 bits each). */ - 0, /* FCTRL_REGNUM (16 bits). */ - 2, /* FSTAT_REGNUM (16 bits). */ - 4, /* FTAG_REGNUM (16 bits). */ - 12, /* FISEG_REGNUM (16 bits). */ - 8, /* FIOFF_REGNUM. */ - 20, /* FOSEG_REGNUM (16 bits). */ - 16, /* FOOFF_REGNUM. */ - 6, /* FOP_REGNUM (bottom 11 bits). */ - 160, /* XMM0_REGNUM through ... */ - 176, - 192, - 208, - 224, - 240, - 256, - 272, /* ... XMM7_REGNUM (128 bits each). */ - 24, /* MXCSR_REGNUM. */ -}; - -#define FXSAVE_ADDR(fxsave, regnum) \ - (fxsave + fxsave_offset[regnum - FP0_REGNUM]) - -static int i387_tag (unsigned char *raw); - - -/* Fill GDB's register array with the floating-point and SSE register - values in *FXSAVE. This function masks off any of the reserved - bits in *FXSAVE. */ - -void -i387_supply_fxsave (char *fxsave) -{ - int i; - - for (i = FP0_REGNUM; i <= MXCSR_REGNUM; i++) - { - /* Most of the FPU control registers occupy only 16 bits in - the fxsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM && i < XMM0_REGNUM - && i != FIOFF_REGNUM && i != FOOFF_REGNUM) - { - unsigned long val = *(unsigned short *) (FXSAVE_ADDR (fxsave, i)); - - if (i == FOP_REGNUM) - { - val &= ((1 << 11) - 1); - supply_register (i, (char *) &val); - } - else if (i== FTAG_REGNUM) - { - /* The fxsave area contains a simplified version of the - tag word. We have to look at the actual 80-bit FP - data to recreate the traditional i387 tag word. */ - - unsigned long ftag = 0; - unsigned long fstat; - int fpreg; - int top; - - fstat = *(unsigned short *) (FXSAVE_ADDR (fxsave, FSTAT_REGNUM)); - top = ((fstat >> 11) & 0x7); - - for (fpreg = 7; fpreg >= 0; fpreg--) - { - int tag; - - if (val & (1 << fpreg)) - { - int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM; - tag = i387_tag (FXSAVE_ADDR (fxsave, regnum)); - } - else - tag = 3; /* Empty */ - - ftag |= tag << (2 * fpreg); - } - supply_register (i, (char *) &ftag); - } - else - supply_register (i, (char *) &val); - } - else - supply_register (i, FXSAVE_ADDR (fxsave, i)); - } -} - -/* Fill register REGNUM (if it is a floating-point or SSE register) in - *FXSAVE with the value in GDB's register array. If REGNUM is -1, do - this for all registers. This function doesn't touch any of the - reserved bits in *FXSAVE. */ - -void -i387_fill_fxsave (char *fxsave, int regnum) -{ - int i; - - for (i = FP0_REGNUM; i <= MXCSR_REGNUM; i++) - if (regnum == -1 || regnum == i) - { - /* Most of the FPU control registers occupy only 16 bits in - the fxsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM && i < XMM0_REGNUM - && i != FIOFF_REGNUM && i != FDOFF_REGNUM) - { - char buf[4]; - - regcache_collect (i, buf); - - if (i == FOP_REGNUM) - { - unsigned short oldval, newval; - - /* The opcode occupies only 11 bits. */ - oldval = (*(unsigned short *) (FXSAVE_ADDR (fxsave, i))); - newval = *(unsigned short *) buf; - newval &= ((1 << 11) - 1); - newval |= oldval & ~((1 << 11) - 1); - memcpy (FXSAVE_ADDR (fxsave, i), &newval, 2); - } - else if (i == FTAG_REGNUM) - { - /* Converting back is much easier. */ - - unsigned short val = 0; - unsigned short ftag; - int fpreg; - - ftag = *(unsigned short *) buf; - - for (fpreg = 7; fpreg >= 0; fpreg--) - { - int tag = (ftag >> (fpreg * 2)) & 3; - - if (tag != 3) - val |= (1 << fpreg); - } - - memcpy (FXSAVE_ADDR (fxsave, i), &val, 2); - } - else - memcpy (FXSAVE_ADDR (fxsave, i), buf, 2); - } - else - regcache_collect (i, FXSAVE_ADDR (fxsave, i)); - } -} - -/* Recreate the FTW (tag word) valid bits from the 80-bit FP data in - *RAW. */ - -static int -i387_tag (unsigned char *raw) -{ - int integer; - unsigned int exponent; - unsigned long fraction[2]; - - integer = raw[7] & 0x80; - exponent = (((raw[9] & 0x7f) << 8) | raw[8]); - fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]); - fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) - | (raw[5] << 8) | raw[4]); - - if (exponent == 0x7fff) - { - /* Special. */ - return (2); - } - else if (exponent == 0x0000) - { - if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer) - { - /* Zero. */ - return (1); - } - else - { - /* Special. */ - return (2); - } - } - else - { - if (integer) - { - /* Valid. */ - return (0); - } - else - { - /* Special. */ - return (2); - } - } -} diff --git a/gdb/i387-nat.h b/gdb/i387-nat.h deleted file mode 100644 index 1637e9b..0000000 --- a/gdb/i387-nat.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Native-dependent code for the i387. - Copyright 2000, 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 I387_NAT_H -#define I387_NAT_H - -/* Fill register REGNUM in GDB's register array with the appropriate - value from *FSAVE. This function masks off any of the reserved - bits in *FSAVE. */ - -extern void i387_supply_register (int regnum, char *fsave); - -/* Fill GDB's register array with the floating-point register values - in *FSAVE. This function masks off any of the reserved - bits in *FSAVE. */ - -extern void i387_supply_fsave (char *fsave); - -/* Fill register REGNUM (if it is a floating-point register) in *FSAVE - with the value in GDB's register array. If REGNUM is -1, do this - for all registers. This function doesn't touch any of the reserved - bits in *FSAVE. */ - -extern void i387_fill_fsave (char *fsave, int regnum); - -/* Fill GDB's register array with the floating-point and SSE register - values in *FXSAVE. This function masks off any of the reserved - bits in *FXSAVE. */ - -extern void i387_supply_fxsave (char *fxsave); - -/* Fill register REGNUM (if it is a floating-point or SSE register) in - *FXSAVE with the value in GDB's register array. If REGNUM is -1, do - this for all registers. This function doesn't touch any of the - reserved bits in *FXSAVE. */ - -extern void i387_fill_fxsave (char *fxsave, int regnum); - -#endif /* i387-nat.h */ diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 2a6f77c..59b60d7 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -1,6 +1,6 @@ /* Intel 387 floating point stuff. - Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1998, 1999, 2000, + 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -388,3 +388,317 @@ i387_float_info (void) printf_filtered ("Opcode: %s\n", local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04")); } + +/* FIXME: kettenis/2000-05-21: Right now more than a few i386 targets + define their own routines to manage the floating-point registers in + GDB's register array. Most (if not all) of these targets use the + format used by the "fsave" instruction in their communication with + the OS. They should all be converted to use the routines below. */ + +/* At fsave_offset[REGNUM] you'll find the offset to the location in + the data structure used by the "fsave" instruction where GDB + register REGNUM is stored. */ + +static int fsave_offset[] = +{ + 28 + 0 * FPU_REG_RAW_SIZE, /* FP0_REGNUM through ... */ + 28 + 1 * FPU_REG_RAW_SIZE, + 28 + 2 * FPU_REG_RAW_SIZE, + 28 + 3 * FPU_REG_RAW_SIZE, + 28 + 4 * FPU_REG_RAW_SIZE, + 28 + 5 * FPU_REG_RAW_SIZE, + 28 + 6 * FPU_REG_RAW_SIZE, + 28 + 7 * FPU_REG_RAW_SIZE, /* ... FP7_REGNUM. */ + 0, /* FCTRL_REGNUM (16 bits). */ + 4, /* FSTAT_REGNUM (16 bits). */ + 8, /* FTAG_REGNUM (16 bits). */ + 16, /* FISEG_REGNUM (16 bits). */ + 12, /* FIOFF_REGNUM. */ + 24, /* FOSEG_REGNUM. */ + 20, /* FOOFF_REGNUM. */ + 18 /* FOP_REGNUM (bottom 11 bits). */ +}; + +#define FSAVE_ADDR(fsave, regnum) (fsave + fsave_offset[regnum - FP0_REGNUM]) + + +/* Fill register REGNUM in GDB's register array with the appropriate + value from *FSAVE. This function masks off any of the reserved + bits in *FSAVE. */ + +void +i387_supply_register (int regnum, char *fsave) +{ + /* Most of the FPU control registers occupy only 16 bits in + the fsave area. Give those a special treatment. */ + if (regnum >= FPC_REGNUM + && regnum != FIOFF_REGNUM && regnum != FOOFF_REGNUM) + { + unsigned char val[4]; + + memcpy (val, FSAVE_ADDR (fsave, regnum), 2); + val[2] = val[3] = 0; + if (regnum == FOP_REGNUM) + val[1] &= ((1 << 3) - 1); + supply_register (regnum, val); + } + else + supply_register (regnum, FSAVE_ADDR (fsave, regnum)); +} + +/* Fill GDB's register array with the floating-point register values + in *FSAVE. This function masks off any of the reserved + bits in *FSAVE. */ + +void +i387_supply_fsave (char *fsave) +{ + int i; + + for (i = FP0_REGNUM; i < XMM0_REGNUM; i++) + i387_supply_register (i, fsave); +} + +/* Fill register REGNUM (if it is a floating-point register) in *FSAVE + with the value in GDB's register array. If REGNUM is -1, do this + for all registers. This function doesn't touch any of the reserved + bits in *FSAVE. */ + +void +i387_fill_fsave (char *fsave, int regnum) +{ + int i; + + for (i = FP0_REGNUM; i < XMM0_REGNUM; i++) + if (regnum == -1 || regnum == i) + { + /* Most of the FPU control registers occupy only 16 bits in + the fsave area. Give those a special treatment. */ + if (i >= FPC_REGNUM + && i != FIOFF_REGNUM && i != FOOFF_REGNUM) + { + unsigned char buf[4]; + + regcache_collect (i, buf); + + if (i == FOP_REGNUM) + { + /* The opcode occupies only 11 bits. Make sure we + don't touch the other bits. */ + buf[1] &= ((1 << 3) - 1); + buf[1] |= ((FSAVE_ADDR (fsave, i))[1] & ~((1 << 3) - 1)); + } + memcpy (FSAVE_ADDR (fsave, i), buf, 2); + } + else + regcache_collect (i, FSAVE_ADDR (fsave, i)); + } +} + + +/* At fxsave_offset[REGNUM] you'll find the offset to the location in + the data structure used by the "fxsave" instruction where GDB + register REGNUM is stored. */ + +static int fxsave_offset[] = +{ + 32, /* FP0_REGNUM through ... */ + 48, + 64, + 80, + 96, + 112, + 128, + 144, /* ... FP7_REGNUM (80 bits each). */ + 0, /* FCTRL_REGNUM (16 bits). */ + 2, /* FSTAT_REGNUM (16 bits). */ + 4, /* FTAG_REGNUM (16 bits). */ + 12, /* FISEG_REGNUM (16 bits). */ + 8, /* FIOFF_REGNUM. */ + 20, /* FOSEG_REGNUM (16 bits). */ + 16, /* FOOFF_REGNUM. */ + 6, /* FOP_REGNUM (bottom 11 bits). */ + 160, /* XMM0_REGNUM through ... */ + 176, + 192, + 208, + 224, + 240, + 256, + 272, /* ... XMM7_REGNUM (128 bits each). */ + 24, /* MXCSR_REGNUM. */ +}; + +#define FXSAVE_ADDR(fxsave, regnum) \ + (fxsave + fxsave_offset[regnum - FP0_REGNUM]) + +static int i387_tag (unsigned char *raw); + + +/* Fill GDB's register array with the floating-point and SSE register + values in *FXSAVE. This function masks off any of the reserved + bits in *FXSAVE. */ + +void +i387_supply_fxsave (char *fxsave) +{ + int i, last_regnum = MXCSR_REGNUM; + + if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0) + last_regnum = FOP_REGNUM; + + for (i = FP0_REGNUM; i <= last_regnum; i++) + { + /* Most of the FPU control registers occupy only 16 bits in + the fxsave area. Give those a special treatment. */ + if (i >= FPC_REGNUM && i < XMM0_REGNUM + && i != FIOFF_REGNUM && i != FOOFF_REGNUM) + { + unsigned char val[4]; + + memcpy (val, FXSAVE_ADDR (fxsave, i), 2); + val[2] = val[3] = 0; + if (i == FOP_REGNUM) + val[1] &= ((1 << 3) - 1); + else if (i== FTAG_REGNUM) + { + /* The fxsave area contains a simplified version of the + tag word. We have to look at the actual 80-bit FP + data to recreate the traditional i387 tag word. */ + + unsigned long ftag = 0; + int fpreg; + int top; + + top = (((FXSAVE_ADDR (fxsave, FSTAT_REGNUM))[1] >> 3) & 0x7); + + for (fpreg = 7; fpreg >= 0; fpreg--) + { + int tag; + + if (val[0] & (1 << fpreg)) + { + int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM; + tag = i387_tag (FXSAVE_ADDR (fxsave, regnum)); + } + else + tag = 3; /* Empty */ + + ftag |= tag << (2 * fpreg); + } + val[0] = ftag & 0xff; + val[1] = (ftag >> 8) & 0xff; + } + supply_register (i, val); + } + else + supply_register (i, FXSAVE_ADDR (fxsave, i)); + } +} + +/* Fill register REGNUM (if it is a floating-point or SSE register) in + *FXSAVE with the value in GDB's register array. If REGNUM is -1, do + this for all registers. This function doesn't touch any of the + reserved bits in *FXSAVE. */ + +void +i387_fill_fxsave (char *fxsave, int regnum) +{ + int i, last_regnum = MXCSR_REGNUM; + + if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0) + last_regnum = FOP_REGNUM; + + for (i = FP0_REGNUM; i <= last_regnum; i++) + if (regnum == -1 || regnum == i) + { + /* Most of the FPU control registers occupy only 16 bits in + the fxsave area. Give those a special treatment. */ + if (i >= FPC_REGNUM && i < XMM0_REGNUM + && i != FIOFF_REGNUM && i != FDOFF_REGNUM) + { + unsigned char buf[4]; + + regcache_collect (i, buf); + + if (i == FOP_REGNUM) + { + /* The opcode occupies only 11 bits. Make sure we + don't touch the other bits. */ + buf[1] &= ((1 << 3) - 1); + buf[1] |= ((FXSAVE_ADDR (fxsave, i))[1] & ~((1 << 3) - 1)); + } + else if (i == FTAG_REGNUM) + { + /* Converting back is much easier. */ + + unsigned short ftag; + int fpreg; + + ftag = (buf[1] << 8) | buf[0]; + buf[0] = 0; + buf[1] = 0; + + for (fpreg = 7; fpreg >= 0; fpreg--) + { + int tag = (ftag >> (fpreg * 2)) & 3; + + if (tag != 3) + buf[0] |= (1 << fpreg); + } + } + memcpy (FXSAVE_ADDR (fxsave, i), buf, 2); + } + else + regcache_collect (i, FXSAVE_ADDR (fxsave, i)); + } +} + +/* Recreate the FTW (tag word) valid bits from the 80-bit FP data in + *RAW. */ + +static int +i387_tag (unsigned char *raw) +{ + int integer; + unsigned int exponent; + unsigned long fraction[2]; + + integer = raw[7] & 0x80; + exponent = (((raw[9] & 0x7f) << 8) | raw[8]); + fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]); + fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) + | (raw[5] << 8) | raw[4]); + + if (exponent == 0x7fff) + { + /* Special. */ + return (2); + } + else if (exponent == 0x0000) + { + if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer) + { + /* Zero. */ + return (1); + } + else + { + /* Special. */ + return (2); + } + } + else + { + if (integer) + { + /* Valid. */ + return (0); + } + else + { + /* Special. */ + return (2); + } + } +} diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h new file mode 100644 index 0000000..5bfd06e --- /dev/null +++ b/gdb/i387-tdep.h @@ -0,0 +1,56 @@ +/* Target-dependent code for the i387. + Copyright 2000, 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 I387_TDEP_H +#define I387_TDEP_H + +/* Fill register REGNUM in GDB's register array with the appropriate + value from *FSAVE. This function masks off any of the reserved + bits in *FSAVE. */ + +extern void i387_supply_register (int regnum, char *fsave); + +/* Fill GDB's register array with the floating-point register values + in *FSAVE. This function masks off any of the reserved + bits in *FSAVE. */ + +extern void i387_supply_fsave (char *fsave); + +/* Fill register REGNUM (if it is a floating-point register) in *FSAVE + with the value in GDB's register array. If REGNUM is -1, do this + for all registers. This function doesn't touch any of the reserved + bits in *FSAVE. */ + +extern void i387_fill_fsave (char *fsave, int regnum); + +/* Fill GDB's register array with the floating-point and SSE register + values in *FXSAVE. This function masks off any of the reserved + bits in *FXSAVE. */ + +extern void i387_supply_fxsave (char *fxsave); + +/* Fill register REGNUM (if it is a floating-point or SSE register) in + *FXSAVE with the value in GDB's register array. If REGNUM is -1, do + this for all registers. This function doesn't touch any of the + reserved bits in *FXSAVE. */ + +extern void i387_fill_fxsave (char *fxsave, int regnum); + +#endif /* i387-tdep.h */ diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 4b14152..ab7e467 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -564,6 +564,7 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache) int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER; long long instr; int val; + int template; if (slotnum > 2) error("Can't insert breakpoint for slot numbers greater than 2."); @@ -571,6 +572,15 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache) addr &= ~0x0f; val = target_read_memory (addr, bundle, BUNDLE_LEN); + + /* Check for L type instruction in 2nd slot, if present then + bump up the slot number to the 3rd slot */ + template = extract_bit_field (bundle, 0, 5); + if (slotnum == 1 && template_encoding_table[template][1] == L) + { + slotnum = 2; + } + instr = slotN_contents (bundle, slotnum); memcpy(contents_cache, &instr, sizeof(instr)); replace_slotN_contents (bundle, BREAKPOINT, slotnum); @@ -587,10 +597,20 @@ ia64_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache) int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER; long long instr; int val; + int template; addr &= ~0x0f; val = target_read_memory (addr, bundle, BUNDLE_LEN); + + /* Check for L type instruction in 2nd slot, if present then + bump up the slot number to the 3rd slot */ + template = extract_bit_field (bundle, 0, 5); + if (slotnum == 1 && template_encoding_table[template][1] == L) + { + slotnum = 2; + } + memcpy (&instr, contents_cache, sizeof instr); replace_slotN_contents (bundle, instr, slotnum); if (val == 0) diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 73fff27..f0fd0f5 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -497,18 +497,17 @@ java_val_print (struct type *type, char *valaddr, int embedded_offset, return i; case TYPE_CODE_CHAR: - format = format ? format : output_format; - if (format) - print_scalar_formatted (valaddr, type, format, 0, stream); - else - LA_PRINT_CHAR ((int) unpack_long (type, valaddr), stream); - break; - case TYPE_CODE_INT: - /* Can't just call c_val_print because that print bytes as C chars. */ + /* Can't just call c_val_print because that prints bytes as C + chars. */ format = format ? format : output_format; if (format) print_scalar_formatted (valaddr, type, format, 0, stream); + else if (TYPE_CODE (type) == TYPE_CODE_CHAR + || (TYPE_CODE (type) == TYPE_CODE_INT + && TYPE_LENGTH (type) == 2 + && strcmp (TYPE_NAME (type), "char") == 0)) + LA_PRINT_CHAR ((int) unpack_long (type, valaddr), stream); else val_print_type_code_int (type, valaddr, stream); break; diff --git a/gdb/language.c b/gdb/language.c index 0b37a6f..1bfba98 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -595,34 +595,12 @@ local_hex_format_custom (char *pre) return form; } -/* Converts a number to hexadecimal and stores it in a static +/* Converts a LONGEST to custom hexadecimal and stores it in a static string. Returns a pointer to this string. */ char * -local_hex_string (unsigned long num) +local_hex_string (LONGEST num) { - static char res[50]; - - sprintf (res, local_hex_format (), num); - return res; -} - -/* Converts a LONGEST number to hexadecimal and stores it in a static - string. Returns a pointer to this string. */ -char * -longest_local_hex_string (LONGEST num) -{ - return longest_local_hex_string_custom (num, "l"); -} - -/* Converts a number to custom hexadecimal and stores it in a static - string. Returns a pointer to this string. */ -char * -local_hex_string_custom (unsigned long num, char *pre) -{ - static char res[50]; - - sprintf (res, local_hex_format_custom (pre), num); - return res; + return local_hex_string_custom (num, "l"); } /* Converts a LONGEST number to custom hexadecimal and stores it in a static @@ -630,12 +608,11 @@ local_hex_string_custom (unsigned long num, char *pre) should end with "l", e.g. "08l" as with calls to local_hex_string_custom */ char * -longest_local_hex_string_custom (LONGEST num, char *width) +local_hex_string_custom (LONGEST num, char *width) { #define RESULT_BUF_LEN 50 static char res2[RESULT_BUF_LEN]; char format[RESULT_BUF_LEN]; -#if !defined (PRINTF_HAS_LONG_LONG) int field_width; int num_len; int num_pad_chars; @@ -643,24 +620,7 @@ longest_local_hex_string_custom (LONGEST num, char *width) int pad_on_left; char *parse_ptr; char temp_nbr_buf[RESULT_BUF_LEN]; -#endif -#ifndef CC_HAS_LONG_LONG - /* If there is no long long, then LONGEST should be just long and we - can use local_hex_string_custom - */ - return local_hex_string_custom ((unsigned long) num, width); -#elif defined (PRINTF_HAS_LONG_LONG) - /* Just use printf. */ - strcpy (format, local_hex_format_prefix ()); /* 0x */ - strcat (format, "%"); - strcat (format, width); /* e.g. "08l" */ - strcat (format, "l"); /* need "ll" for long long */ - strcat (format, local_hex_format_specifier ()); /* "x" */ - strcat (format, local_hex_format_suffix ()); /* "" */ - sprintf (res2, format, num); - return res2; -#else /* !defined (PRINTF_HAS_LONG_LONG) */ /* Use phex_nz to print the number into a string, then build the result string from local_hex_format_prefix, padding and the hex representation as indicated by "width". */ @@ -687,7 +647,7 @@ longest_local_hex_string_custom (LONGEST num, char *width) if (strlen (local_hex_format_prefix ()) + num_len + num_pad_chars >= RESULT_BUF_LEN) /* paranoia */ internal_error (__FILE__, __LINE__, - "longest_local_hex_string_custom: insufficient space to store result"); + "local_hex_string_custom: insufficient space to store result"); strcpy (res2, local_hex_format_prefix ()); if (pad_on_left) @@ -708,9 +668,8 @@ longest_local_hex_string_custom (LONGEST num, char *width) } } return res2; -#endif -} /* longest_local_hex_string_custom */ +} /* local_hex_string_custom */ /* Returns the appropriate printf format for octal numbers. */ diff --git a/gdb/language.h b/gdb/language.h index 88375db..301fefd 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -395,13 +395,9 @@ extern char *longest_raw_hex_string (LONGEST); (language-specific) formats. Result is static and is overwritten by the next call. Takes printf options like "08l" or "l". */ -extern char *local_hex_string (unsigned long); /* language.c */ +extern char *local_hex_string (LONGEST); /* language.c */ -extern char *longest_local_hex_string (LONGEST); /* language.c */ - -extern char *local_hex_string_custom (unsigned long, char *); /* language.c */ - -extern char *longest_local_hex_string_custom (LONGEST, char *); /* language.c */ +extern char *local_hex_string_custom (LONGEST, char *); /* language.c */ /* Type predicates */ diff --git a/gdb/linespec.c b/gdb/linespec.c index cbfafcf..8e51021 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -130,6 +130,7 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr) (struct symtab **) NULL))) { int method_counter; + int name_len = strlen (name); CHECK_TYPEDEF (t); @@ -202,7 +203,9 @@ find_methods (struct type *t, char *name, struct symbol **sym_arr) */ } } - else if (strcmp_iw (class_name, name) == 0) + else if (strncmp (class_name, name, name_len) == 0 + && (class_name[name_len] == '\0' + || class_name[name_len] == '<')) { /* For GCC 3.x and stabs, constructors and destructors have names like __base_ctor and __complete_dtor. Check the physname for now @@ -298,7 +301,9 @@ build_canonical_line_spec (struct symtab_and_line *sal, char *symname, /* Find an instance of the character C in the string S that is outside of all parenthesis pairs, single-quoted strings, and double-quoted - strings. */ + strings. Also, ignore the char within a template name, like a ',' + within foo. */ + static char * find_toplevel_char (char *s, char c) { @@ -321,9 +326,9 @@ find_toplevel_char (char *s, char c) return scan; else if (*scan == '"' || *scan == '\'') quoted = *scan; - else if (*scan == '(') + else if (*scan == '(' || *scan == '<') depth++; - else if (*scan == ')' && depth > 0) + else if ((*scan == ')' || *scan == '>') && depth > 0) depth--; } @@ -929,20 +934,12 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, if ((*p == '"') && is_quote_enclosed) --p; copy = (char *) alloca (p - *argptr + 1); - if ((**argptr == '"') && is_quote_enclosed) - { - memcpy (copy, *argptr + 1, p - *argptr - 1); - /* It may have the ending quote right after the file name */ - if (copy[p - *argptr - 2] == '"') - copy[p - *argptr - 2] = 0; - else - copy[p - *argptr - 1] = 0; - } + memcpy (copy, *argptr, p - *argptr); + /* It may have the ending quote right after the file name */ + if (is_quote_enclosed && copy[p - *argptr - 1] == '"') + copy[p - *argptr - 1] = 0; else - { - memcpy (copy, *argptr, p - *argptr); - copy[p - *argptr] = 0; - } + copy[p - *argptr] = 0; /* Find that file's data. */ s = lookup_symtab (copy); diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index 86ca098..3c96d37 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -1,6 +1,7 @@ /* Target-machine dependent code for Motorola 88000 series, for GDB. - Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, - 2001 Free Software Foundation, Inc. + + Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, + 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -39,6 +40,32 @@ void frame_find_saved_regs (); int target_is_m88110 = 0; +void +m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid) +{ + /* According to the MC88100 RISC Microprocessor User's Manual, + section 6.4.3.1.2: + + ... can be made to return to a particular instruction by placing + a valid instruction address in the SNIP and the next sequential + instruction address in the SFIP (with V bits set and E bits + clear). The rte resumes execution at the instruction pointed to + by the SNIP, then the SFIP. + + The E bit is the least significant bit (bit 0). The V (valid) + bit is bit 1. This is why we logical or 2 into the values we are + writing below. It turns out that SXIP plays no role when + returning from an exception so nothing special has to be done + with it. We could even (presumably) give it a totally bogus + value. + + -- Kevin Buettner */ + + write_register_pid (SXIP_REGNUM, pc, ptid); + write_register_pid (SNIP_REGNUM, (pc | 2), ptid); + write_register_pid (SFIP_REGNUM, (pc | 2) + 4, ptid); +} + /* The type of a register. */ struct type * m88k_register_type (int regnum) diff --git a/gdb/macroexp.c b/gdb/macroexp.c new file mode 100644 index 0000000..061c63a --- /dev/null +++ b/gdb/macroexp.c @@ -0,0 +1,1169 @@ +/* C preprocessor macro expansion for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Red Hat, 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 "obstack.h" +#include "bcache.h" +#include "macrotab.h" +#include "macroexp.h" +#include "gdb_assert.h" + + + +/* A resizeable, substringable string type. */ + + +/* A string type that we can resize, quickly append to, and use to + refer to substrings of other strings. */ +struct macro_buffer +{ + /* An array of characters. The first LEN bytes are the real text, + but there are SIZE bytes allocated to the array. If SIZE is + zero, then this doesn't point to a malloc'ed block. If SHARED is + non-zero, then this buffer is actually a pointer into some larger + string, and we shouldn't append characters to it, etc. Because + of sharing, we can't assume in general that the text is + null-terminated. */ + char *text; + + /* The number of characters in the string. */ + int len; + + /* The number of characters allocated to the string. If SHARED is + non-zero, this is meaningless; in this case, we set it to zero so + that any "do we have room to append something?" tests will fail, + so we don't always have to check SHARED before using this field. */ + int size; + + /* Zero if TEXT can be safely realloc'ed (i.e., it's its own malloc + block). Non-zero if TEXT is actually pointing into the middle of + some other block, and we shouldn't reallocate it. */ + int shared; + + /* For detecting token splicing. + + This is the index in TEXT of the first character of the token + that abuts the end of TEXT. If TEXT contains no tokens, then we + set this equal to LEN. If TEXT ends in whitespace, then there is + no token abutting the end of TEXT (it's just whitespace), and + again, we set this equal to LEN. We set this to -1 if we don't + know the nature of TEXT. */ + int last_token; + + /* If this buffer is holding the result from get_token, then this + is non-zero if it is an identifier token, zero otherwise. */ + int is_identifier; +}; + + +/* Set the macro buffer *B to the empty string, guessing that its + final contents will fit in N bytes. (It'll get resized if it + doesn't, so the guess doesn't have to be right.) Allocate the + initial storage with xmalloc. */ +static void +init_buffer (struct macro_buffer *b, int n) +{ + /* Small value for initial testing. */ + n = 1; + + b->size = n; + if (n > 0) + b->text = (char *) xmalloc (n); + else + b->text = NULL; + b->len = 0; + b->shared = 0; + b->last_token = -1; +} + + +/* Set the macro buffer *BUF to refer to the LEN bytes at ADDR, as a + shared substring. */ +static void +init_shared_buffer (struct macro_buffer *buf, char *addr, int len) +{ + buf->text = addr; + buf->len = len; + buf->shared = 1; + buf->size = 0; + buf->last_token = -1; +} + + +/* Free the text of the buffer B. Raise an error if B is shared. */ +static void +free_buffer (struct macro_buffer *b) +{ + gdb_assert (! b->shared); + if (b->size) + xfree (b->text); +} + + +/* A cleanup function for macro buffers. */ +static void +cleanup_macro_buffer (void *untyped_buf) +{ + free_buffer ((struct macro_buffer *) untyped_buf); +} + + +/* Resize the buffer B to be at least N bytes long. Raise an error if + B shouldn't be resized. */ +static void +resize_buffer (struct macro_buffer *b, int n) +{ + /* We shouldn't be trying to resize shared strings. */ + gdb_assert (! b->shared); + + if (b->size == 0) + b->size = n; + else + while (b->size <= n) + b->size *= 2; + + b->text = xrealloc (b->text, b->size); +} + + +/* Append the character C to the buffer B. */ +static inline void +appendc (struct macro_buffer *b, int c) +{ + int new_len = b->len + 1; + + if (new_len > b->size) + resize_buffer (b, new_len); + + b->text[b->len] = c; + b->len = new_len; +} + + +/* Append the LEN bytes at ADDR to the buffer B. */ +static inline void +appendmem (struct macro_buffer *b, char *addr, int len) +{ + int new_len = b->len + len; + + if (new_len > b->size) + resize_buffer (b, new_len); + + memcpy (b->text + b->len, addr, len); + b->len = new_len; +} + + + +/* Recognizing preprocessor tokens. */ + + +static int +is_whitespace (int c) +{ + return (c == ' ' + || c == '\t' + || c == '\n' + || c == '\v' + || c == '\f'); +} + + +static int +is_digit (int c) +{ + return ('0' <= c && c <= '9'); +} + + +static int +is_identifier_nondigit (int c) +{ + return (c == '_' + || ('a' <= c && c <= 'z') + || ('A' <= c && c <= 'Z')); +} + + +static void +set_token (struct macro_buffer *tok, char *start, char *end) +{ + init_shared_buffer (tok, start, end - start); + tok->last_token = 0; + + /* Presumed; get_identifier may overwrite this. */ + tok->is_identifier = 0; +} + + +static int +get_comment (struct macro_buffer *tok, char *p, char *end) +{ + if (p + 2 > end) + return 0; + else if (p[0] == '/' + && p[1] == '*') + { + char *tok_start = p; + + p += 2; + + for (; p < end; p++) + if (p + 2 <= end + && p[0] == '*' + && p[1] == '/') + { + p += 2; + set_token (tok, tok_start, p); + return 1; + } + + error ("Unterminated comment in macro expansion."); + } + else if (p[0] == '/' + && p[1] == '/') + { + char *tok_start = p; + + p += 2; + for (; p < end; p++) + if (*p == '\n') + break; + + set_token (tok, tok_start, p); + return 1; + } + else + return 0; +} + + +static int +get_identifier (struct macro_buffer *tok, char *p, char *end) +{ + if (p < end + && is_identifier_nondigit (*p)) + { + char *tok_start = p; + + while (p < end + && (is_identifier_nondigit (*p) + || is_digit (*p))) + p++; + + set_token (tok, tok_start, p); + tok->is_identifier = 1; + return 1; + } + else + return 0; +} + + +static int +get_pp_number (struct macro_buffer *tok, char *p, char *end) +{ + if (p < end + && (is_digit (*p) + || *p == '.')) + { + char *tok_start = p; + + while (p < end) + { + if (is_digit (*p) + || is_identifier_nondigit (*p) + || *p == '.') + p++; + else if (p + 2 <= end + && strchr ("eEpP.", *p) + && (p[1] == '+' || p[1] == '-')) + p += 2; + else + break; + } + + set_token (tok, tok_start, p); + return 1; + } + else + return 0; +} + + + +/* If the text starting at P going up to (but not including) END + starts with a character constant, set *TOK to point to that + character constant, and return 1. Otherwise, return zero. + Signal an error if it contains a malformed or incomplete character + constant. */ +static int +get_character_constant (struct macro_buffer *tok, char *p, char *end) +{ + /* ISO/IEC 9899:1999 (E) Section 6.4.4.4 paragraph 1 + But of course, what really matters is that we handle it the same + way GDB's C/C++ lexer does. So we call parse_escape in utils.c + to handle escape sequences. */ + if ((p + 1 <= end && *p == '\'') + || (p + 2 <= end && p[0] == 'L' && p[1] == '\'')) + { + char *tok_start = p; + char *body_start; + + if (*p == '\'') + p++; + else if (*p == 'L') + p += 2; + else + gdb_assert (0); + + body_start = p; + for (;;) + { + if (p >= end) + error ("Unmatched single quote."); + else if (*p == '\'') + { + if (p == body_start) + error ("A character constant must contain at least one " + "character."); + p++; + break; + } + else if (*p == '\\') + { + p++; + parse_escape (&p); + } + else + p++; + } + + set_token (tok, tok_start, p); + return 1; + } + else + return 0; +} + + +/* If the text starting at P going up to (but not including) END + starts with a string literal, set *TOK to point to that string + literal, and return 1. Otherwise, return zero. Signal an error if + it contains a malformed or incomplete string literal. */ +static int +get_string_literal (struct macro_buffer *tok, char *p, char *end) +{ + if ((p + 1 <= end + && *p == '\"') + || (p + 2 <= end + && p[0] == 'L' + && p[1] == '\"')) + { + char *tok_start = p; + + if (*p == '\"') + p++; + else if (*p == 'L') + p += 2; + else + gdb_assert (0); + + for (;;) + { + if (p >= end) + error ("Unterminated string in expression."); + else if (*p == '\"') + { + p++; + break; + } + else if (*p == '\n') + error ("Newline characters may not appear in string " + "constants."); + else if (*p == '\\') + { + p++; + parse_escape (&p); + } + else + p++; + } + + set_token (tok, tok_start, p); + return 1; + } + else + return 0; +} + + +static int +get_punctuator (struct macro_buffer *tok, char *p, char *end) +{ + /* Here, speed is much less important than correctness and clarity. */ + + /* ISO/IEC 9899:1999 (E) Section 6.4.6 Paragraph 1 */ + static const char * const punctuators[] = { + "[", "]", "(", ")", "{", "}", ".", "->", + "++", "--", "&", "*", "+", "-", "~", "!", + "/", "%", "<<", ">>", "<", ">", "<=", ">=", "==", "!=", + "^", "|", "&&", "||", + "?", ":", ";", "...", + "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", "&=", "^=", "|=", + ",", "#", "##", + "<:", ":>", "<%", "%>", "%:", "%:%:", + 0 + }; + + int i; + + if (p + 1 <= end) + { + for (i = 0; punctuators[i]; i++) + { + const char *punctuator = punctuators[i]; + + if (p[0] == punctuator[0]) + { + int len = strlen (punctuator); + + if (p + len <= end + && ! memcmp (p, punctuator, len)) + { + set_token (tok, p, p + len); + return 1; + } + } + } + } + + return 0; +} + + +/* Peel the next preprocessor token off of SRC, and put it in TOK. + Mutate TOK to refer to the first token in SRC, and mutate SRC to + refer to the text after that token. SRC must be a shared buffer; + the resulting TOK will be shared, pointing into the same string SRC + does. Initialize TOK's last_token field. Return non-zero if we + succeed, or 0 if we didn't find any more tokens in SRC. */ +static int +get_token (struct macro_buffer *tok, + struct macro_buffer *src) +{ + char *p = src->text; + char *end = p + src->len; + + gdb_assert (src->shared); + + /* From the ISO C standard, ISO/IEC 9899:1999 (E), section 6.4: + + preprocessing-token: + header-name + identifier + pp-number + character-constant + string-literal + punctuator + each non-white-space character that cannot be one of the above + + We don't have to deal with header-name tokens, since those can + only occur after a #include, which we will never see. */ + + while (p < end) + if (is_whitespace (*p)) + p++; + else if (get_comment (tok, p, end)) + p += tok->len; + else if (get_pp_number (tok, p, end) + || get_character_constant (tok, p, end) + || get_string_literal (tok, p, end) + /* Note: the grammar in the standard seems to be + ambiguous: L'x' can be either a wide character + constant, or an identifier followed by a normal + character constant. By trying `get_identifier' after + we try get_character_constant and get_string_literal, + we give the wide character syntax precedence. Now, + since GDB doesn't handle wide character constants + anyway, is this the right thing to do? */ + || get_identifier (tok, p, end) + || get_punctuator (tok, p, end)) + { + /* How many characters did we consume, including whitespace? */ + int consumed = p - src->text + tok->len; + src->text += consumed; + src->len -= consumed; + return 1; + } + else + { + /* We have found a "non-whitespace character that cannot be + one of the above." Make a token out of it. */ + int consumed; + + set_token (tok, p, p + 1); + consumed = p - src->text + tok->len; + src->text += consumed; + src->len -= consumed; + return 1; + } + + return 0; +} + + + +/* Appending token strings, with and without splicing */ + + +/* Append the macro buffer SRC to the end of DEST, and ensure that + doing so doesn't splice the token at the end of SRC with the token + at the beginning of DEST. SRC and DEST must have their last_token + fields set. Upon return, DEST's last_token field is set correctly. + + For example: + + If DEST is "(" and SRC is "y", then we can return with + DEST set to "(y" --- we've simply appended the two buffers. + + However, if DEST is "x" and SRC is "y", then we must not return + with DEST set to "xy" --- that would splice the two tokens "x" and + "y" together to make a single token "xy". However, it would be + fine to return with DEST set to "x y". Similarly, "<" and "<" must + yield "< <", not "<<", etc. */ +static void +append_tokens_without_splicing (struct macro_buffer *dest, + struct macro_buffer *src) +{ + int original_dest_len = dest->len; + struct macro_buffer dest_tail, new_token; + + gdb_assert (src->last_token != -1); + gdb_assert (dest->last_token != -1); + + /* First, just try appending the two, and call get_token to see if + we got a splice. */ + appendmem (dest, src->text, src->len); + + /* If DEST originally had no token abutting its end, then we can't + have spliced anything, so we're done. */ + if (dest->last_token == original_dest_len) + { + dest->last_token = original_dest_len + src->last_token; + return; + } + + /* Set DEST_TAIL to point to the last token in DEST, followed by + all the stuff we just appended. */ + init_shared_buffer (&dest_tail, + dest->text + dest->last_token, + dest->len - dest->last_token); + + /* Re-parse DEST's last token. We know that DEST used to contain + at least one token, so if it doesn't contain any after the + append, then we must have spliced "/" and "*" or "/" and "/" to + make a comment start. (Just for the record, I got this right + the first time. This is not a bug fix.) */ + if (get_token (&new_token, &dest_tail) + && (new_token.text + new_token.len + == dest->text + original_dest_len)) + { + /* No splice, so we're done. */ + dest->last_token = original_dest_len + src->last_token; + return; + } + + /* Okay, a simple append caused a splice. Let's chop dest back to + its original length and try again, but separate the texts with a + space. */ + dest->len = original_dest_len; + appendc (dest, ' '); + appendmem (dest, src->text, src->len); + + init_shared_buffer (&dest_tail, + dest->text + dest->last_token, + dest->len - dest->last_token); + + /* Try to re-parse DEST's last token, as above. */ + if (get_token (&new_token, &dest_tail) + && (new_token.text + new_token.len + == dest->text + original_dest_len)) + { + /* No splice, so we're done. */ + dest->last_token = original_dest_len + 1 + src->last_token; + return; + } + + /* As far as I know, there's no case where inserting a space isn't + enough to prevent a splice. */ + internal_error (__FILE__, __LINE__, + "unable to avoid splicing tokens during macro expansion"); +} + + + +/* Expanding macros! */ + + +/* A singly-linked list of the names of the macros we are currently + expanding --- for detecting expansion loops. */ +struct macro_name_list { + const char *name; + struct macro_name_list *next; +}; + + +/* Return non-zero if we are currently expanding the macro named NAME, + according to LIST; otherwise, return zero. + + You know, it would be possible to get rid of all the NO_LOOP + arguments to these functions by simply generating a new lookup + function and baton which refuses to find the definition for a + particular macro, and otherwise delegates the decision to another + function/baton pair. But that makes the linked list of excluded + macros chained through untyped baton pointers, which will make it + harder to debug. :( */ +static int +currently_rescanning (struct macro_name_list *list, const char *name) +{ + for (; list; list = list->next) + if (strcmp (name, list->name) == 0) + return 1; + + return 0; +} + + +/* Gather the arguments to a macro expansion. + + NAME is the name of the macro being invoked. (It's only used for + printing error messages.) + + Assume that SRC is the text of the macro invocation immediately + following the macro name. For example, if we're processing the + text foo(bar, baz), then NAME would be foo and SRC will be (bar, + baz). + + If SRC doesn't start with an open paren ( token at all, return + zero, leave SRC unchanged, and don't set *ARGC_P to anything. + + If SRC doesn't contain a properly terminated argument list, then + raise an error. + + Otherwise, return a pointer to the first element of an array of + macro buffers referring to the argument texts, and set *ARGC_P to + the number of arguments we found --- the number of elements in the + array. The macro buffers share their text with SRC, and their + last_token fields are initialized. The array is allocated with + xmalloc, and the caller is responsible for freeing it. + + NOTE WELL: if SRC starts with a open paren ( token followed + immediately by a close paren ) token (e.g., the invocation looks + like "foo()"), we treat that as one argument, which happens to be + the empty list of tokens. The caller should keep in mind that such + a sequence of tokens is a valid way to invoke one-parameter + function-like macros, but also a valid way to invoke zero-parameter + function-like macros. Eeew. + + Consume the tokens from SRC; after this call, SRC contains the text + following the invocation. */ + +static struct macro_buffer * +gather_arguments (const char *name, struct macro_buffer *src, int *argc_p) +{ + struct macro_buffer tok; + int args_len, args_size; + struct macro_buffer *args = NULL; + struct cleanup *back_to = make_cleanup (free_current_contents, &args); + + /* Does SRC start with an opening paren token? Read from a copy of + SRC, so SRC itself is unaffected if we don't find an opening + paren. */ + { + struct macro_buffer temp; + init_shared_buffer (&temp, src->text, src->len); + + if (! get_token (&tok, &temp) + || tok.len != 1 + || tok.text[0] != '(') + { + discard_cleanups (back_to); + return 0; + } + } + + /* Consume SRC's opening paren. */ + get_token (&tok, src); + + args_len = 0; + args_size = 1; /* small for initial testing */ + args = (struct macro_buffer *) xmalloc (sizeof (*args) * args_size); + + for (;;) + { + struct macro_buffer *arg; + int depth; + + /* Make sure we have room for the next argument. */ + if (args_len >= args_size) + { + args_size *= 2; + args = xrealloc (args, sizeof (*args) * args_size); + } + + /* Initialize the next argument. */ + arg = &args[args_len++]; + set_token (arg, src->text, src->text); + + /* Gather the argument's tokens. */ + depth = 0; + for (;;) + { + char *start = src->text; + + if (! get_token (&tok, src)) + error ("Malformed argument list for macro `%s'.", name); + + /* Is tok an opening paren? */ + if (tok.len == 1 && tok.text[0] == '(') + depth++; + + /* Is tok is a closing paren? */ + else if (tok.len == 1 && tok.text[0] == ')') + { + /* If it's a closing paren at the top level, then that's + the end of the argument list. */ + if (depth == 0) + { + discard_cleanups (back_to); + *argc_p = args_len; + return args; + } + + depth--; + } + + /* If tok is a comma at top level, then that's the end of + the current argument. */ + else if (tok.len == 1 && tok.text[0] == ',' && depth == 0) + break; + + /* Extend the current argument to enclose this token. If + this is the current argument's first token, leave out any + leading whitespace, just for aesthetics. */ + if (arg->len == 0) + { + arg->text = tok.text; + arg->len = tok.len; + arg->last_token = 0; + } + else + { + arg->len = (tok.text + tok.len) - arg->text; + arg->last_token = tok.text - arg->text; + } + } + } +} + + +/* The `expand' and `substitute_args' functions both invoke `scan' + recursively, so we need a forward declaration somewhere. */ +static void scan (struct macro_buffer *dest, + struct macro_buffer *src, + struct macro_name_list *no_loop, + macro_lookup_ftype *lookup_func, + void *lookup_baton); + + +/* Given the macro definition DEF, being invoked with the actual + arguments given by ARGC and ARGV, substitute the arguments into the + replacement list, and store the result in DEST. + + If it is necessary to expand macro invocations in one of the + arguments, use LOOKUP_FUNC and LOOKUP_BATON to find the macro + definitions, and don't expand invocations of the macros listed in + NO_LOOP. */ +static void +substitute_args (struct macro_buffer *dest, + struct macro_definition *def, + int argc, struct macro_buffer *argv, + struct macro_name_list *no_loop, + macro_lookup_ftype *lookup_func, + void *lookup_baton) +{ + /* A macro buffer for the macro's replacement list. */ + struct macro_buffer replacement_list; + + init_shared_buffer (&replacement_list, (char *) def->replacement, + strlen (def->replacement)); + + gdb_assert (dest->len == 0); + dest->last_token = 0; + + for (;;) + { + struct macro_buffer tok; + char *original_rl_start = replacement_list.text; + int substituted = 0; + + /* Find the next token in the replacement list. */ + if (! get_token (&tok, &replacement_list)) + break; + + /* Just for aesthetics. If we skipped some whitespace, copy + that to DEST. */ + if (tok.text > original_rl_start) + { + appendmem (dest, original_rl_start, tok.text - original_rl_start); + dest->last_token = dest->len; + } + + /* Is this token the stringification operator? */ + if (tok.len == 1 + && tok.text[0] == '#') + error ("Stringification is not implemented yet."); + + /* Is this token the splicing operator? */ + if (tok.len == 2 + && tok.text[0] == '#' + && tok.text[1] == '#') + error ("Token splicing is not implemented yet."); + + /* Is this token an identifier? */ + if (tok.is_identifier) + { + int i; + + /* Is it the magic varargs parameter? */ + if (tok.len == 11 + && ! memcmp (tok.text, "__VA_ARGS__", 11)) + error ("Variable-arity macros not implemented yet."); + + /* Is it one of the parameters? */ + for (i = 0; i < def->argc; i++) + if (tok.len == strlen (def->argv[i]) + && ! memcmp (tok.text, def->argv[i], tok.len)) + { + struct macro_buffer arg_src; + + /* Expand any macro invocations in the argument text, + and append the result to dest. Remember that scan + mutates its source, so we need to scan a new buffer + referring to the argument's text, not the argument + itself. */ + init_shared_buffer (&arg_src, argv[i].text, argv[i].len); + scan (dest, &arg_src, no_loop, lookup_func, lookup_baton); + substituted = 1; + break; + } + } + + /* If it wasn't a parameter, then just copy it across. */ + if (! substituted) + append_tokens_without_splicing (dest, &tok); + } +} + + +/* Expand a call to a macro named ID, whose definition is DEF. Append + its expansion to DEST. SRC is the input text following the ID + token. We are currently rescanning the expansions of the macros + named in NO_LOOP; don't re-expand them. Use LOOKUP_FUNC and + LOOKUP_BATON to find definitions for any nested macro references. + + Return 1 if we decided to expand it, zero otherwise. (If it's a + function-like macro name that isn't followed by an argument list, + we don't expand it.) If we return zero, leave SRC unchanged. */ +static int +expand (const char *id, + struct macro_definition *def, + struct macro_buffer *dest, + struct macro_buffer *src, + struct macro_name_list *no_loop, + macro_lookup_ftype *lookup_func, + void *lookup_baton) +{ + struct macro_name_list new_no_loop; + + /* Create a new node to be added to the front of the no-expand list. + This list is appropriate for re-scanning replacement lists, but + it is *not* appropriate for scanning macro arguments; invocations + of the macro whose arguments we are gathering *do* get expanded + there. */ + new_no_loop.name = id; + new_no_loop.next = no_loop; + + /* What kind of macro are we expanding? */ + if (def->kind == macro_object_like) + { + struct macro_buffer replacement_list; + + init_shared_buffer (&replacement_list, (char *) def->replacement, + strlen (def->replacement)); + + scan (dest, &replacement_list, &new_no_loop, lookup_func, lookup_baton); + return 1; + } + else if (def->kind == macro_function_like) + { + struct cleanup *back_to = make_cleanup (null_cleanup, 0); + int argc; + struct macro_buffer *argv = NULL; + struct macro_buffer substituted; + struct macro_buffer substituted_src; + + if (def->argc >= 1 + && strcmp (def->argv[def->argc - 1], "...") == 0) + error ("Varargs macros not implemented yet."); + + make_cleanup (free_current_contents, &argv); + argv = gather_arguments (id, src, &argc); + + /* If we couldn't find any argument list, then we don't expand + this macro. */ + if (! argv) + { + do_cleanups (back_to); + return 0; + } + + /* Check that we're passing an acceptable number of arguments for + this macro. */ + if (argc != def->argc) + { + /* Remember that a sequence of tokens like "foo()" is a + valid invocation of a macro expecting either zero or one + arguments. */ + if (! (argc == 1 + && argv[0].len == 0 + && def->argc == 0)) + error ("Wrong number of arguments to macro `%s' " + "(expected %d, got %d).", + id, def->argc, argc); + } + + /* Note that we don't expand macro invocations in the arguments + yet --- we let subst_args take care of that. Parameters that + appear as operands of the stringifying operator "#" or the + splicing operator "##" don't get macro references expanded, + so we can't really tell whether it's appropriate to macro- + expand an argument until we see how it's being used. */ + init_buffer (&substituted, 0); + make_cleanup (cleanup_macro_buffer, &substituted); + substitute_args (&substituted, def, argc, argv, no_loop, + lookup_func, lookup_baton); + + /* Now `substituted' is the macro's replacement list, with all + argument values substituted into it properly. Re-scan it for + macro references, but don't expand invocations of this macro. + + We create a new buffer, `substituted_src', which points into + `substituted', and scan that. We can't scan `substituted' + itself, since the tokenization process moves the buffer's + text pointer around, and we still need to be able to find + `substituted's original text buffer after scanning it so we + can free it. */ + init_shared_buffer (&substituted_src, substituted.text, substituted.len); + scan (dest, &substituted_src, &new_no_loop, lookup_func, lookup_baton); + + do_cleanups (back_to); + + return 1; + } + else + internal_error (__FILE__, __LINE__, "bad macro definition kind"); +} + + +/* If the single token in SRC_FIRST followed by the tokens in SRC_REST + constitute a macro invokation not forbidden in NO_LOOP, append its + expansion to DEST and return non-zero. Otherwise, return zero, and + leave DEST unchanged. + + SRC_FIRST and SRC_REST must be shared buffers; DEST must not be one. + SRC_FIRST must be a string built by get_token. */ +static int +maybe_expand (struct macro_buffer *dest, + struct macro_buffer *src_first, + struct macro_buffer *src_rest, + struct macro_name_list *no_loop, + macro_lookup_ftype *lookup_func, + void *lookup_baton) +{ + gdb_assert (src_first->shared); + gdb_assert (src_rest->shared); + gdb_assert (! dest->shared); + + /* Is this token an identifier? */ + if (src_first->is_identifier) + { + /* Make a null-terminated copy of it, since that's what our + lookup function expects. */ + char *id = xmalloc (src_first->len + 1); + struct cleanup *back_to = make_cleanup (xfree, id); + memcpy (id, src_first->text, src_first->len); + id[src_first->len] = 0; + + /* If we're currently re-scanning the result of expanding + this macro, don't expand it again. */ + if (! currently_rescanning (no_loop, id)) + { + /* Does this identifier have a macro definition in scope? */ + struct macro_definition *def = lookup_func (id, lookup_baton); + + if (def && expand (id, def, dest, src_rest, no_loop, + lookup_func, lookup_baton)) + { + do_cleanups (back_to); + return 1; + } + } + + do_cleanups (back_to); + } + + return 0; +} + + +/* Expand macro references in SRC, appending the results to DEST. + Assume we are re-scanning the result of expanding the macros named + in NO_LOOP, and don't try to re-expand references to them. + + SRC must be a shared buffer; DEST must not be one. */ +static void +scan (struct macro_buffer *dest, + struct macro_buffer *src, + struct macro_name_list *no_loop, + macro_lookup_ftype *lookup_func, + void *lookup_baton) +{ + gdb_assert (src->shared); + gdb_assert (! dest->shared); + + for (;;) + { + struct macro_buffer tok; + char *original_src_start = src->text; + + /* Find the next token in SRC. */ + if (! get_token (&tok, src)) + break; + + /* Just for aesthetics. If we skipped some whitespace, copy + that to DEST. */ + if (tok.text > original_src_start) + { + appendmem (dest, original_src_start, tok.text - original_src_start); + dest->last_token = dest->len; + } + + if (! maybe_expand (dest, &tok, src, no_loop, lookup_func, lookup_baton)) + /* We didn't end up expanding tok as a macro reference, so + simply append it to dest. */ + append_tokens_without_splicing (dest, &tok); + } + + /* Just for aesthetics. If there was any trailing whitespace in + src, copy it to dest. */ + if (src->len) + { + appendmem (dest, src->text, src->len); + dest->last_token = dest->len; + } +} + + +char * +macro_expand (const char *source, + macro_lookup_ftype *lookup_func, + void *lookup_func_baton) +{ + struct macro_buffer src, dest; + struct cleanup *back_to; + + init_shared_buffer (&src, (char *) source, strlen (source)); + + init_buffer (&dest, 0); + dest.last_token = 0; + back_to = make_cleanup (cleanup_macro_buffer, &dest); + + scan (&dest, &src, 0, lookup_func, lookup_func_baton); + + appendc (&dest, '\0'); + + discard_cleanups (back_to); + return dest.text; +} + + +char * +macro_expand_once (const char *source, + macro_lookup_ftype *lookup_func, + void *lookup_func_baton) +{ + error ("Expand-once not implemented yet."); +} + + +char * +macro_expand_next (char **lexptr, + macro_lookup_ftype *lookup_func, + void *lookup_baton) +{ + struct macro_buffer src, dest, tok; + struct cleanup *back_to; + + /* Set up SRC to refer to the input text, pointed to by *lexptr. */ + init_shared_buffer (&src, *lexptr, strlen (*lexptr)); + + /* Set up DEST to receive the expansion, if there is one. */ + init_buffer (&dest, 0); + dest.last_token = 0; + back_to = make_cleanup (cleanup_macro_buffer, &dest); + + /* Get the text's first preprocessing token. */ + if (! get_token (&tok, &src)) + { + do_cleanups (back_to); + return 0; + } + + /* If it's a macro invocation, expand it. */ + if (maybe_expand (&dest, &tok, &src, 0, lookup_func, lookup_baton)) + { + /* It was a macro invocation! Package up the expansion as a + null-terminated string and return it. Set *lexptr to the + start of the next token in the input. */ + appendc (&dest, '\0'); + discard_cleanups (back_to); + *lexptr = src.text; + return dest.text; + } + else + { + /* It wasn't a macro invocation. */ + do_cleanups (back_to); + return 0; + } +} diff --git a/gdb/macroexp.h b/gdb/macroexp.h new file mode 100644 index 0000000..57269fa --- /dev/null +++ b/gdb/macroexp.h @@ -0,0 +1,90 @@ +/* Interface to C preprocessor macro expansion for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Red Hat, 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 MACROEXP_H +#define MACROEXP_H + +/* A function for looking up preprocessor macro definitions. Return + the preprocessor definition of NAME in scope according to BATON, or + zero if NAME is not defined as a preprocessor macro. + + The caller must not free or modify the definition returned. It is + probably unwise for the caller to hold pointers to it for very + long; it probably lives in some objfile's obstacks. */ +typedef struct macro_definition *(macro_lookup_ftype) (const char *name, + void *baton); + + +/* Expand any preprocessor macros in SOURCE, and return the expanded + text. Use LOOKUP_FUNC and LOOKUP_FUNC_BATON to find identifiers' + preprocessor definitions. SOURCE is a null-terminated string. The + result is a null-terminated string, allocated using xmalloc; it is + the caller's responsibility to free it. */ +char *macro_expand (const char *source, + macro_lookup_ftype *lookup_func, + void *lookup_func_baton); + + +/* Expand all preprocessor macro references that appear explicitly in + SOURCE, but do not expand any new macro references introduced by + that first level of expansion. Use LOOKUP_FUNC and + LOOKUP_FUNC_BATON to find identifiers' preprocessor definitions. + SOURCE is a null-terminated string. The result is a + null-terminated string, allocated using xmalloc; it is the caller's + responsibility to free it. */ +char *macro_expand_once (const char *source, + macro_lookup_ftype *lookup_func, + void *lookup_func_baton); + + +/* If the null-terminated string pointed to by *LEXPTR begins with a + macro invocation, return the result of expanding that invocation as + a null-terminated string, and set *LEXPTR to the next character + after the invocation. The result is completely expanded; it + contains no further macro invocations. + + Otherwise, if *LEXPTR does not start with a macro invocation, + return zero, and leave *LEXPTR unchanged. + + Use LOOKUP_FUNC and LOOKUP_BATON to find macro definitions. + + If this function returns a string, the caller is responsible for + freeing it, using xfree. + + We need this expand-one-token-at-a-time interface in order to + accomodate GDB's C expression parser, which may not consume the + entire string. When the user enters a command like + + (gdb) break *func+20 if x == 5 + + the parser is expected to consume `func+20', and then stop when it + sees the "if". But of course, "if" appearing in a character string + or as part of a larger identifier doesn't count. So you pretty + much have to do tokenization to find the end of the string that + needs to be macro-expanded. Our C/C++ tokenizer isn't really + designed to be called by anything but the yacc parser engine. */ +char *macro_expand_next (char **lexptr, + macro_lookup_ftype *lookup_func, + void *lookup_baton); + + +#endif /* MACROEXP_H */ diff --git a/gdb/macrotab.c b/gdb/macrotab.c new file mode 100644 index 0000000..d979a91 --- /dev/null +++ b/gdb/macrotab.c @@ -0,0 +1,862 @@ +/* C preprocessor macro tables for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Red Hat, 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 "obstack.h" +#include "splay-tree.h" +#include "symtab.h" +#include "symfile.h" +#include "objfiles.h" +#include "macrotab.h" +#include "gdb_assert.h" +#include "bcache.h" +#include "complaints.h" + + +/* The macro table structure. */ + +struct macro_table +{ + /* The obstack this table's data should be allocated in, or zero if + we should use xmalloc. */ + struct obstack *obstack; + + /* The bcache we should use to hold macro names, argument names, and + definitions, or zero if we should use xmalloc. */ + struct bcache *bcache; + + /* The main source file for this compilation unit --- the one whose + name was given to the compiler. This is the root of the + #inclusion tree; everything else is #included from here. */ + struct macro_source_file *main_source; + + /* The table of macro definitions. This is a splay tree (an ordered + binary tree that stays balanced, effectively), sorted by macro + name. Where a macro gets defined more than once (presumably with + an #undefinition in between), we sort the definitions by the + order they would appear in the preprocessor's output. That is, + if `a.c' #includes `m.h' and then #includes `n.h', and both + header files #define X (with an #undef somewhere in between), + then the definition from `m.h' appears in our splay tree before + the one from `n.h'. + + The splay tree's keys are `struct macro_key' pointers; + the values are `struct macro_definition' pointers. + + The splay tree, its nodes, and the keys and values are allocated + in obstack, if it's non-zero, or with xmalloc otherwise. The + macro names, argument names, argument name arrays, and definition + strings are all allocated in bcache, if non-zero, or with xmalloc + otherwise. */ + splay_tree definitions; +}; + + + +/* Allocation and freeing functions. */ + +/* Allocate SIZE bytes of memory appropriately for the macro table T. + This just checks whether T has an obstack, or whether its pieces + should be allocated with xmalloc. */ +static void * +macro_alloc (int size, struct macro_table *t) +{ + if (t->obstack) + return obstack_alloc (t->obstack, size); + else + return xmalloc (size); +} + + +static void +macro_free (void *object, struct macro_table *t) +{ + gdb_assert (! t->obstack); + xfree (object); +} + + +/* If the macro table T has a bcache, then cache the LEN bytes at ADDR + there, and return the cached copy. Otherwise, just xmalloc a copy + of the bytes, and return a pointer to that. */ +static const void * +macro_bcache (struct macro_table *t, const void *addr, int len) +{ + if (t->bcache) + return bcache (addr, len, t->bcache); + else + { + void *copy = xmalloc (len); + memcpy (copy, addr, len); + return copy; + } +} + + +/* If the macro table T has a bcache, cache the null-terminated string + S there, and return a pointer to the cached copy. Otherwise, + xmalloc a copy and return that. */ +static const char * +macro_bcache_str (struct macro_table *t, const char *s) +{ + return (char *) macro_bcache (t, s, strlen (s) + 1); +} + + +/* Free a possibly bcached object OBJ. That is, if the macro table T + has a bcache, it's an error; otherwise, xfree OBJ. */ +void +macro_bcache_free (struct macro_table *t, void *obj) +{ + gdb_assert (! t->bcache); + xfree (obj); +} + + + +/* Macro tree keys, w/their comparison, allocation, and freeing functions. */ + +/* A key in the splay tree. */ +struct macro_key +{ + /* The table we're in. We only need this in order to free it, since + the splay tree library's key and value freeing functions require + that the key or value contain all the information needed to free + themselves. */ + struct macro_table *table; + + /* The name of the macro. This is in the table's bcache, if it has + one. */ + const char *name; + + /* The source file and line number where the definition's scope + begins. This is also the line of the definition itself. */ + struct macro_source_file *start_file; + int start_line; + + /* The first source file and line after the definition's scope. + (That is, the scope does not include this endpoint.) If end_file + is zero, then the definition extends to the end of the + compilation unit. */ + struct macro_source_file *end_file; + int end_line; +}; + + +/* Return the #inclusion depth of the source file FILE. This is the + number of #inclusions it took to reach this file. For the main + source file, the #inclusion depth is zero; for a file it #includes + directly, the depth would be one; and so on. */ +static int +inclusion_depth (struct macro_source_file *file) +{ + int depth; + + for (depth = 0; file->included_by; depth++) + file = file->included_by; + + return depth; +} + + +/* Compare two source locations (from the same compilation unit). + This is part of the comparison function for the tree of + definitions. + + LINE1 and LINE2 are line numbers in the source files FILE1 and + FILE2. Return a value: + - less than zero if {LINE,FILE}1 comes before {LINE,FILE}2, + - greater than zero if {LINE,FILE}1 comes after {LINE,FILE}2, or + - zero if they are equal. + + When the two locations are in different source files --- perhaps + one is in a header, while another is in the main source file --- we + order them by where they would appear in the fully pre-processed + sources, where all the #included files have been substituted into + their places. */ +static int +compare_locations (struct macro_source_file *file1, int line1, + struct macro_source_file *file2, int line2) +{ + /* We want to treat positions in an #included file as coming *after* + the line containing the #include, but *before* the line after the + include. As we walk up the #inclusion tree toward the main + source file, we update fileX and lineX as we go; includedX + indicates whether the original position was from the #included + file. */ + int included1 = 0; + int included2 = 0; + + /* If a file is zero, that means "end of compilation unit." Handle + that specially. */ + if (! file1) + { + if (! file2) + return 0; + else + return 1; + } + else if (! file2) + return -1; + + /* If the two files are not the same, find their common ancestor in + the #inclusion tree. */ + if (file1 != file2) + { + /* If one file is deeper than the other, walk up the #inclusion + chain until the two files are at least at the same *depth*. + Then, walk up both files in synchrony until they're the same + file. That file is the common ancestor. */ + int depth1 = inclusion_depth (file1); + int depth2 = inclusion_depth (file2); + + /* Only one of these while loops will ever execute in any given + case. */ + while (depth1 > depth2) + { + line1 = file1->included_at_line; + file1 = file1->included_by; + included1 = 1; + depth1--; + } + while (depth2 > depth1) + { + line2 = file2->included_at_line; + file2 = file2->included_by; + included2 = 1; + depth2--; + } + + /* Now both file1 and file2 are at the same depth. Walk toward + the root of the tree until we find where the branches meet. */ + while (file1 != file2) + { + line1 = file1->included_at_line; + file1 = file1->included_by; + /* At this point, we know that the case the includedX flags + are trying to deal with won't come up, but we'll just + maintain them anyway. */ + included1 = 1; + + line2 = file2->included_at_line; + file2 = file2->included_by; + included2 = 1; + + /* Sanity check. If file1 and file2 are really from the + same compilation unit, then they should both be part of + the same tree, and this shouldn't happen. */ + gdb_assert (file1 && file2); + } + } + + /* Now we've got two line numbers in the same file. */ + if (line1 == line2) + { + /* They can't both be from #included files. Then we shouldn't + have walked up this far. */ + gdb_assert (! included1 || ! included2); + + /* Any #included position comes after a non-#included position + with the same line number in the #including file. */ + if (included1) + return 1; + else if (included2) + return -1; + else + return 0; + } + else + return line1 - line2; +} + + +/* Compare a macro key KEY against NAME, the source file FILE, and + line number LINE. + + Sort definitions by name; for two definitions with the same name, + place the one whose definition comes earlier before the one whose + definition comes later. + + Return -1, 0, or 1 if key comes before, is identical to, or comes + after NAME, FILE, and LINE. */ +static int +key_compare (struct macro_key *key, + const char *name, struct macro_source_file *file, int line) +{ + int names = strcmp (key->name, name); + if (names) + return names; + + return compare_locations (key->start_file, key->start_line, + file, line); +} + + +/* The macro tree comparison function, typed for the splay tree + library's happiness. */ +static int +macro_tree_compare (splay_tree_key untyped_key1, + splay_tree_key untyped_key2) +{ + struct macro_key *key1 = (struct macro_key *) untyped_key1; + struct macro_key *key2 = (struct macro_key *) untyped_key2; + + return key_compare (key1, key2->name, key2->start_file, key2->start_line); +} + + +/* Construct a new macro key node for a macro in table T whose name is + NAME, and whose scope starts at LINE in FILE; register the name in + the bcache. */ +static struct macro_key * +new_macro_key (struct macro_table *t, + const char *name, + struct macro_source_file *file, + int line) +{ + struct macro_key *k = macro_alloc (sizeof (*k), t); + + memset (k, 0, sizeof (*k)); + k->table = t; + k->name = macro_bcache_str (t, name); + k->start_file = file; + k->start_line = line; + k->end_file = 0; + + return k; +} + + +static void +macro_tree_delete_key (void *untyped_key) +{ + struct macro_key *key = (struct macro_key *) untyped_key; + + macro_bcache_free (key->table, (char *) key->name); + macro_free (key, key->table); +} + + + +/* Building and querying the tree of #included files. */ + + +/* Allocate and initialize a new source file structure. */ +static struct macro_source_file * +new_source_file (struct macro_table *t, + const char *filename) +{ + /* Get space for the source file structure itself. */ + struct macro_source_file *f = macro_alloc (sizeof (*f), t); + + memset (f, 0, sizeof (*f)); + f->table = t; + f->filename = macro_bcache_str (t, filename); + f->includes = 0; + + return f; +} + + +/* Free a source file, and all the source files it #included. */ +static void +free_macro_source_file (struct macro_source_file *src) +{ + struct macro_source_file *child, *next_child; + + /* Free this file's children. */ + for (child = src->includes; child; child = next_child) + { + next_child = child->next_included; + free_macro_source_file (child); + } + + macro_bcache_free (src->table, (char *) src->filename); + macro_free (src, src->table); +} + + +struct macro_source_file * +macro_set_main (struct macro_table *t, + const char *filename) +{ + /* You can't change a table's main source file. What would that do + to the tree? */ + gdb_assert (! t->main_source); + + t->main_source = new_source_file (t, filename); + + return t->main_source; +} + + +struct macro_source_file * +macro_main (struct macro_table *t) +{ + gdb_assert (t->main_source); + + return t->main_source; +} + + +struct macro_source_file * +macro_include (struct macro_source_file *source, + int line, + const char *included) +{ + struct macro_source_file *new; + struct macro_source_file **link; + + /* Find the right position in SOURCE's `includes' list for the new + file. Scan until we find the first file we shouldn't follow --- + which is therefore the file we should directly precede --- or + reach the end of the list. */ + for (link = &source->includes; + *link && line < (*link)->included_at_line; + link = &(*link)->next_included) + ; + + /* Did we find another file already #included at the same line as + the new one? */ + if (*link && line == (*link)->included_at_line) + { + /* This means the compiler is emitting bogus debug info. (GCC + circa March 2002 did this.) It also means that the splay + tree ordering function, macro_tree_compare, will abort, + because it can't tell which #inclusion came first. But GDB + should tolerate bad debug info. So: + + First, squawk. */ + static struct complaint bogus_inclusion_line = { + "both `%s' and `%s' allegedly #included at %s:%d", 0, 0 + }; + + complain (&bogus_inclusion_line, + included, (*link)->filename, source->filename, line); + + /* Now, choose a new, unoccupied line number for this + #inclusion, after the alleged #inclusion line. */ + while (*link && line == (*link)->included_at_line) + { + /* This line number is taken, so try the next line. */ + line++; + link = &(*link)->next_included; + } + } + + /* At this point, we know that LINE is an unused line number, and + *LINK points to the entry an #inclusion at that line should + precede. */ + new = new_source_file (source->table, included); + new->included_by = source; + new->included_at_line = line; + new->next_included = *link; + *link = new; + + return new; +} + + +struct macro_source_file * +macro_lookup_inclusion (struct macro_source_file *source, const char *name) +{ + /* Is SOURCE itself named NAME? */ + if (strcmp (name, source->filename) == 0) + return source; + + /* The filename in the source structure is probably a full path, but + NAME could be just the final component of the name. */ + { + int name_len = strlen (name); + int src_name_len = strlen (source->filename); + + /* We do mean < here, and not <=; if the lengths are the same, + then the strcmp above should have triggered, and we need to + check for a slash here. */ + if (name_len < src_name_len + && source->filename[src_name_len - name_len - 1] == '/' + && strcmp (name, source->filename + src_name_len - name_len) == 0) + return source; + } + + /* It's not us. Try all our children, and return the lowest. */ + { + struct macro_source_file *child; + struct macro_source_file *best = NULL; + int best_depth = 0; + + for (child = source->includes; child; child = child->next_included) + { + struct macro_source_file *result + = macro_lookup_inclusion (child, name); + + if (result) + { + int result_depth = inclusion_depth (result); + + if (! best || result_depth < best_depth) + { + best = result; + best_depth = result_depth; + } + } + } + + return best; + } +} + + + +/* Registering and looking up macro definitions. */ + + +/* Construct a definition for a macro in table T. Cache all strings, + and the macro_definition structure itself, in T's bcache. */ +static struct macro_definition * +new_macro_definition (struct macro_table *t, + enum macro_kind kind, + int argc, const char **argv, + const char *replacement) +{ + struct macro_definition *d = macro_alloc (sizeof (*d), t); + + memset (d, 0, sizeof (*d)); + d->table = t; + d->kind = kind; + d->replacement = macro_bcache_str (t, replacement); + + if (kind == macro_function_like) + { + int i; + const char **cached_argv; + int cached_argv_size = argc * sizeof (*cached_argv); + + /* Bcache all the arguments. */ + cached_argv = alloca (cached_argv_size); + for (i = 0; i < argc; i++) + cached_argv[i] = macro_bcache_str (t, argv[i]); + + /* Now bcache the array of argument pointers itself. */ + d->argv = macro_bcache (t, cached_argv, cached_argv_size); + d->argc = argc; + } + + /* We don't bcache the entire definition structure because it's got + a pointer to the macro table in it; since each compilation unit + has its own macro table, you'd only get bcache hits for identical + definitions within a compilation unit, which seems unlikely. + + "So, why do macro definitions have pointers to their macro tables + at all?" Well, when the splay tree library wants to free a + node's value, it calls the value freeing function with nothing + but the value itself. It makes the (apparently reasonable) + assumption that the value carries enough information to free + itself. But not all macro tables have bcaches, so not all macro + definitions would be bcached. There's no way to tell whether a + given definition is bcached without knowing which table the + definition belongs to. ... blah. The thing's only sixteen + bytes anyway, and we can still bcache the name, args, and + definition, so we just don't bother bcaching the definition + structure itself. */ + return d; +} + + +/* Free a macro definition. */ +static void +macro_tree_delete_value (void *untyped_definition) +{ + struct macro_definition *d = (struct macro_definition *) untyped_definition; + struct macro_table *t = d->table; + + if (d->kind == macro_function_like) + { + int i; + + for (i = 0; i < d->argc; i++) + macro_bcache_free (t, (char *) d->argv[i]); + macro_bcache_free (t, (char **) d->argv); + } + + macro_bcache_free (t, (char *) d->replacement); + macro_free (d, t); +} + + +/* Find the splay tree node for the definition of NAME at LINE in + SOURCE, or zero if there is none. */ +static splay_tree_node +find_definition (const char *name, + struct macro_source_file *file, + int line) +{ + struct macro_table *t = file->table; + splay_tree_node n; + + /* Construct a macro_key object, just for the query. */ + struct macro_key query; + + query.name = name; + query.start_file = file; + query.start_line = line; + query.end_file = NULL; + + n = splay_tree_lookup (t->definitions, (splay_tree_key) &query); + if (! n) + { + /* It's okay for us to do two queries like this: the real work + of the searching is done when we splay, and splaying the tree + a second time at the same key is a constant time operation. + If this still bugs you, you could always just extend the + splay tree library with a predecessor-or-equal operation, and + use that. */ + splay_tree_node pred = splay_tree_predecessor (t->definitions, + (splay_tree_key) &query); + + if (pred) + { + /* Make sure this predecessor actually has the right name. + We just want to search within a given name's definitions. */ + struct macro_key *found = (struct macro_key *) pred->key; + + if (strcmp (found->name, name) == 0) + n = pred; + } + } + + if (n) + { + struct macro_key *found = (struct macro_key *) n->key; + + /* Okay, so this definition has the right name, and its scope + begins before the given source location. But does its scope + end after the given source location? */ + if (compare_locations (file, line, found->end_file, found->end_line) < 0) + return n; + else + return 0; + } + else + return 0; +} + + +/* If NAME already has a definition in scope at LINE in FILE, and + return the key. Otherwise, return zero. */ +static struct macro_key * +check_for_redefinition (struct macro_source_file *source, int line, + const char *name) +{ + splay_tree_node n = find_definition (name, source, line); + + /* This isn't really right. There's nothing wrong with redefining a + macro if the new replacement list is the same as the old one. */ + if (n) + { + struct macro_key *found_key = (struct macro_key *) n->key; + static struct complaint macro_redefined = { + "macro `%s' redefined at %s:%d;" + "original definition at %s:%d", 0, 0 + }; + complain (¯o_redefined, name, + source->filename, line, + found_key->start_file->filename, + found_key->start_line); + return found_key; + } + else + return 0; +} + + +void +macro_define_object (struct macro_source_file *source, int line, + const char *name, const char *replacement) +{ + struct macro_table *t = source->table; + struct macro_key *k; + struct macro_definition *d; + + k = check_for_redefinition (source, line, name); + + /* If we're redefining a symbol, and the existing key would be + identical to our new key, then the splay_tree_insert function + will try to delete the old definition. When the definition is + living on an obstack, this isn't a happy thing. + + Since this only happens in the presence of questionable debug + info, we just ignore all definitions after the first. The only + case I know of where this arises is in GCC's output for + predefined macros, and all the definitions are the same in that + case. */ + if (k && ! key_compare (k, name, source, line)) + return; + + k = new_macro_key (t, name, source, line); + d = new_macro_definition (t, macro_object_like, 0, 0, replacement); + splay_tree_insert (t->definitions, (splay_tree_key) k, (splay_tree_value) d); +} + + +void +macro_define_function (struct macro_source_file *source, int line, + const char *name, int argc, const char **argv, + const char *replacement) +{ + struct macro_table *t = source->table; + struct macro_key *k; + struct macro_definition *d; + + k = check_for_redefinition (source, line, name); + + /* See comments about duplicate keys in macro_define_object. */ + if (k && ! key_compare (k, name, source, line)) + return; + + /* We should also check here that all the argument names in ARGV are + distinct. */ + + k = new_macro_key (t, name, source, line); + d = new_macro_definition (t, macro_function_like, argc, argv, replacement); + splay_tree_insert (t->definitions, (splay_tree_key) k, (splay_tree_value) d); +} + + +void +macro_undef (struct macro_source_file *source, int line, + const char *name) +{ + splay_tree_node n = find_definition (name, source, line); + + if (n) + { + /* This function is the only place a macro's end-of-scope + location gets set to anything other than "end of the + compilation unit" (i.e., end_file is zero). So if this macro + already has its end-of-scope set, then we're probably seeing + a second #undefinition for the same #definition. */ + struct macro_key *key = (struct macro_key *) n->key; + + if (key->end_file) + { + static struct complaint double_undef = { + "macro '%s' is #undefined twice, at %s:%d and %s:%d", + 0, 0 + }; + complain (&double_undef, name, source->filename, line, + key->end_file->filename, key->end_line); + } + + /* Whatever the case, wipe out the old ending point, and + make this the ending point. */ + key->end_file = source; + key->end_line = line; + } + else + { + /* According to the ISO C standard, an #undef for a symbol that + has no macro definition in scope is ignored. So we should + ignore it too. */ +#if 0 + static struct complaint no_macro_to_undefine = { + "no definition for macro `%s' in scope to #undef at %s:%d", + 0, 0 + }; + complain (&no_macro_to_undefine, name, source->filename, line); +#endif + } +} + + +struct macro_definition * +macro_lookup_definition (struct macro_source_file *source, + int line, const char *name) +{ + splay_tree_node n = find_definition (name, source, line); + + if (n) + return (struct macro_definition *) n->value; + else + return 0; +} + + +struct macro_source_file * +macro_definition_location (struct macro_source_file *source, + int line, + const char *name, + int *definition_line) +{ + splay_tree_node n = find_definition (name, source, line); + + if (n) + { + struct macro_key *key = (struct macro_key *) n->key; + *definition_line = key->start_line; + return key->start_file; + } + else + return 0; +} + + + +/* Creating and freeing macro tables. */ + + +struct macro_table * +new_macro_table (struct obstack *obstack, + struct bcache *b) +{ + struct macro_table *t; + + /* First, get storage for the `struct macro_table' itself. */ + if (obstack) + t = obstack_alloc (obstack, sizeof (*t)); + else + t = xmalloc (sizeof (*t)); + + memset (t, 0, sizeof (*t)); + t->obstack = obstack; + t->bcache = b; + t->main_source = NULL; + t->definitions = (splay_tree_new_with_allocator + (macro_tree_compare, + ((splay_tree_delete_key_fn) macro_tree_delete_key), + ((splay_tree_delete_value_fn) macro_tree_delete_value), + ((splay_tree_allocate_fn) macro_alloc), + ((splay_tree_deallocate_fn) macro_free), + t)); + + return t; +} + + +void +free_macro_table (struct macro_table *table) +{ + /* Free the source file tree. */ + free_macro_source_file (table->main_source); + + /* Free the table of macro definitions. */ + splay_tree_delete (table->definitions); +} diff --git a/gdb/macrotab.h b/gdb/macrotab.h new file mode 100644 index 0000000..cbc6d1b --- /dev/null +++ b/gdb/macrotab.h @@ -0,0 +1,295 @@ +/* Interface to C preprocessor macro tables for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Red Hat, 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 MACROTAB_H +#define MACROTAB_H + +#include "obstack.h" +#include "bcache.h" + +/* How do we represent a source location? I mean, how should we + represent them within GDB; the user wants to use all sorts of + ambiguous abbreviations, like "break 32" and "break foo.c:32" + ("foo.c" may have been #included into several compilation units), + but what do we disambiguate those things to? + + - Answer 1: "Filename and line number." (Or column number, if + you're picky.) That's not quite good enough. For example, the + same source file can be #included into several different + compilation units --- which #inclusion do you mean? + + - Answer 2: "Compilation unit, filename, and line number." This is + a pretty good answer; GDB's `struct symtab_and_line' basically + embodies this representation. But it's still ambiguous; what if a + given compilation unit #includes the same file twice --- how can I + set a breakpoint on line 12 of the fifth #inclusion of "foo.c"? + + - Answer 3: "Compilation unit, chain of #inclusions, and line + number." This is analogous to the way GCC reports errors in + #include files: + + $ gcc -c base.c + In file included from header2.h:8, + from header1.h:3, + from base.c:5: + header3.h:1: parse error before ')' token + $ + + GCC tells you exactly what path of #inclusions led you to the + problem. It gives you complete information, in a way that the + following would not: + + $ gcc -c base.c + header3.h:1: parse error before ')' token + $ + + Converting all of GDB to use this is a big task, and I'm not really + suggesting it should be a priority. But this module's whole + purpose is to maintain structures describing the macro expansion + process, so I think it's appropriate for us to take a little care + to do that in a complete fashion. + + In this interface, the first line of a file is numbered 1, not 0. + This is the same convention the rest of GDB uses. */ + + +/* A table of all the macro definitions for a given compilation unit. */ +struct macro_table; + + +/* A source file that participated in a compilation unit --- either a + main file, or an #included file. If a file is #included more than + once, the presence of the `included_from' and `included_at_line' + members means that we need to make one instance of this structure + for each #inclusion. Taken as a group, these structures form a + tree mapping the #inclusions that contributed to the compilation + unit, with the main source file as its root. + + It's worth noting that libcpp has a simpler way of representing all + this, which we should consider switching to. It might even be + suitable for ordinary non-macro line number info. + + Suppose you take your main source file, and after each line + containing an #include directive you insert the text of the + #included file. The result is a big file that pretty much + corresponds to the full text the compiler's going to see. There's + a one-to-one correspondence between lines in the big file and + per-inclusion lines in the source files. (Obviously, #include + directives that are #if'd out don't count. And you'll need to + append a newline to any file that doesn't end in one, to avoid + splicing the last #included line with the next line of the + #including file.) + + Libcpp calls line numbers in this big imaginary file "logical line + numbers", and has a data structure called a "line map" that can map + logical line numbers onto actual source filenames and line numbers, + and also tell you the chain of #inclusions responsible for any + particular logical line number. Basically, this means you can pass + around a single line number and some kind of "compilation unit" + object and you get nice, unambiguous source code locations that + distinguish between multiple #inclusions of the same file, etc. + + Pretty neat, huh? */ + +struct macro_source_file +{ + + /* The macro table for the compilation unit this source location is + a part of. */ + struct macro_table *table; + + /* A source file --- possibly a header file. */ + const char *filename; + + /* The location we were #included from, or zero if we are the + compilation unit's main source file. */ + struct macro_source_file *included_by; + + /* If `included_from' is non-zero, the line number in that source + file at which we were included. */ + int included_at_line; + + /* Head of a linked list of the source files #included by this file; + our children in the #inclusion tree. This list is sorted by its + elements' `included_at_line' values, which are unique. (The + macro splay tree's ordering function needs this property.) */ + struct macro_source_file *includes; + + /* The next file #included by our `included_from' file; our sibling + in the #inclusion tree. */ + struct macro_source_file *next_included; +}; + + +/* Create a new, empty macro table. Allocate it in OBSTACK, or use + xmalloc if OBSTACK is zero. Use BCACHE to store all macro names, + arguments, definitions, and anything else that might be the same + amongst compilation units in an executable file; if BCACHE is zero, + don't cache these things. + + Note that, if either OBSTACK or BCACHE are non-zero, then you + should only ever add information the macro table --- you should + never remove things from it. You'll get an error if you try. At + the moment, since we only provide obstacks and bcaches for macro + tables for symtabs, this restriction makes a nice sanity check. + Obstacks and bcaches are pretty much grow-only structures anyway. + However, if we find that it's occasionally useful to delete things + even from the symtab's tables, and the storage leak isn't a + problem, this restriction could be lifted. */ +struct macro_table *new_macro_table (struct obstack *obstack, + struct bcache *bcache); + + +/* Free TABLE, and any macro definitions, source file structures, + etc. it owns. This will raise an internal error if TABLE was + allocated on an obstack, or if it uses a bcache. */ +void free_macro_table (struct macro_table *table); + + +/* Set FILENAME as the main source file of TABLE. Return a source + file structure describing that file; if we record the #definition + of macros, or the #inclusion of other files into FILENAME, we'll + use that source file structure to indicate the context. + + The "main source file" is the one that was given to the compiler; + all other source files that contributed to the compilation unit are + #included, directly or indirectly, from this one. + + The macro table makes its own copy of FILENAME; the caller is + responsible for freeing FILENAME when it is no longer needed. */ +struct macro_source_file *macro_set_main (struct macro_table *table, + const char *filename); + + +/* Return the main source file of the macro table TABLE. */ +struct macro_source_file *macro_main (struct macro_table *table); + + +/* Record a #inclusion. + Record in SOURCE's macro table that, at line number LINE in SOURCE, + we #included the file INCLUDED. Return a source file structure we + can use for symbols #defined or files #included into that. If we've + already created a source file structure for this #inclusion, return + the same structure we created last time. + + The first line of the source file has a line number of 1, not 0. + + The macro table makes its own copy of INCLUDED; the caller is + responsible for freeing INCLUDED when it is no longer needed. */ +struct macro_source_file *macro_include (struct macro_source_file *source, + int line, + const char *included); + + +/* Find any source file structure for a file named NAME, either + included into SOURCE, or SOURCE itself. Return zero if we have + none. NAME is only the final portion of the filename, not the full + path. e.g., `stdio.h', not `/usr/include/stdio.h'. If NAME + appears more than once in the inclusion tree, return the + least-nested inclusion --- the one closest to the main source file. */ +struct macro_source_file *(macro_lookup_inclusion + (struct macro_source_file *source, + const char *name)); + + +/* Record an object-like #definition (i.e., one with no parameter list). + Record in SOURCE's macro table that, at line number LINE in SOURCE, + we #defined a preprocessor symbol named NAME, whose replacement + string is REPLACEMENT. This function makes copies of NAME and + REPLACEMENT; the caller is responsible for freeing them. */ +void macro_define_object (struct macro_source_file *source, int line, + const char *name, const char *replacement); + + +/* Record an function-like #definition (i.e., one with a parameter list). + + Record in SOURCE's macro table that, at line number LINE in SOURCE, + we #defined a preprocessor symbol named NAME, with ARGC arguments + whose names are given in ARGV, whose replacement string is REPLACEMENT. If + the macro takes a variable number of arguments, then ARGC should be + one greater than the number of named arguments, and ARGV[ARGC-1] + should be the string "...". This function makes its own copies of + NAME, ARGV, and REPLACEMENT; the caller is responsible for freeing + them. */ +void macro_define_function (struct macro_source_file *source, int line, + const char *name, int argc, const char **argv, + const char *replacement); + + +/* Record an #undefinition. + Record in SOURCE's macro table that, at line number LINE in SOURCE, + we removed the definition for the preprocessor symbol named NAME. */ +void macro_undef (struct macro_source_file *source, int line, + const char *name); + + +/* Different kinds of macro definitions. */ +enum macro_kind +{ + macro_object_like, + macro_function_like +}; + + +/* A preprocessor symbol definition. */ +struct macro_definition +{ + /* The table this definition lives in. */ + struct macro_table *table; + + /* What kind of macro it is. */ + enum macro_kind kind; + + /* If `kind' is `macro_function_like', the number of arguments it + takes, and their names. The names, and the array of pointers to + them, are in the table's bcache, if it has one. */ + int argc; + const char * const *argv; + + /* The replacement string (body) of the macro. This is in the + table's bcache, if it has one. */ + const char *replacement; +}; + + +/* Return a pointer to the macro definition for NAME in scope at line + number LINE of SOURCE. If LINE is -1, return the definition in + effect at the end of the file. The macro table owns the structure; + the caller need not free it. Return zero if NAME is not #defined + at that point. */ +struct macro_definition *(macro_lookup_definition + (struct macro_source_file *source, + int line, const char *name)); + + +/* Return the source location of the definition for NAME in scope at + line number LINE of SOURCE. Set *DEFINITION_LINE to the line + number of the definition, and return a source file structure for + the file. Return zero if NAME has no definition in scope at that + point, and leave *DEFINITION_LINE unchanged. */ +struct macro_source_file *(macro_definition_location + (struct macro_source_file *source, + int line, + const char *name, + int *definition_line)); + + +#endif /* MACROTAB_H */ diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index c974c9e..14d2c0f 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -832,7 +832,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, else { t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name); - if (STREQ (name, "malloc") && t->code == TYPE_CODE_VOID) + if (STREQ (name, "malloc") && TYPE_CODE (t) == TYPE_CODE_VOID) { /* I don't know why, but, at least under Alpha GNU/Linux, when linking against a malloc without debugging @@ -1604,7 +1604,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, dereference them. */ while (TYPE_CODE (tp) == TYPE_CODE_PTR || TYPE_CODE (tp) == TYPE_CODE_ARRAY) - tp = tp->target_type; + tp = TYPE_TARGET_TYPE (tp); /* Make sure that TYPE_CODE(tp) has an expected type code. Any type may be returned from cross_ref if file indirect entries diff --git a/gdb/memattr.c b/gdb/memattr.c index 7387e8d..8c46d7e 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -1,5 +1,6 @@ /* Memory attributes support, for GDB. - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -238,16 +239,16 @@ mem_info_command (char *args, int from_tty) m->number, m->enabled_p ? 'y' : 'n'); if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom ((unsigned long) m->lo, "08l"); + tmp = local_hex_string_custom ((unsigned long) m->lo, "08l"); else - tmp = longest_local_hex_string_custom ((unsigned long) m->lo, "016l"); + tmp = local_hex_string_custom ((unsigned long) m->lo, "016l"); printf_filtered ("%s ", tmp); if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom ((unsigned long) m->hi, "08l"); + tmp = local_hex_string_custom ((unsigned long) m->hi, "08l"); else - tmp = longest_local_hex_string_custom ((unsigned long) m->hi, "016l"); + tmp = local_hex_string_custom ((unsigned long) m->hi, "016l"); printf_filtered ("%s ", tmp); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 3cee42e..16ebaca 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -199,7 +199,7 @@ mips2_fp_compat (void) if ((read_register (PS_REGNUM) & ST0_FR) == 0) return 1; #endif - + return 0; } @@ -289,6 +289,9 @@ static CORE_ADDR after_prologue (CORE_ADDR pc, static void mips_read_fp_register_single (int regno, char *rare_buffer); static void mips_read_fp_register_double (int regno, char *rare_buffer); +static struct type *mips_float_register_type (void); +static struct type *mips_double_register_type (void); + /* This value is the model of MIPS in use. It is derived from the value of the PrID register. */ @@ -522,7 +525,7 @@ mips_mask_address_p (void) internal_error (__FILE__, __LINE__, "mips_mask_address_p: bad switch"); return -1; - } + } } static void @@ -544,7 +547,7 @@ show_mask_address (char *cmd, int from_tty) internal_error (__FILE__, __LINE__, "show_mask_address: bad switch"); break; - } + } } /* Should call_function allocate stack space for a struct return? */ @@ -2135,7 +2138,7 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci) we basically have to look at symbol information for the function that we stopped in, which tells us *which* register (if any) is the base of the frame pointer, and what offset from that register - the frame itself is at. + the frame itself is at. This presents a problem when trying to examine a stack in memory (that isn't executing at the moment), using the "frame" command. We @@ -2179,7 +2182,7 @@ static int mips_type_needs_double_align (struct type *type) { enum type_code typecode = TYPE_CODE (type); - + if (typecode == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8) return 1; else if (typecode == TYPE_CODE_STRUCT) @@ -2190,7 +2193,7 @@ mips_type_needs_double_align (struct type *type) } else if (typecode == TYPE_CODE_UNION) { - int i, n; + int i, n; n = TYPE_NFIELDS (type); for (i = 0; i < n; i++) @@ -2437,7 +2440,7 @@ mips_push_arguments (int nargs, fprintf_unfiltered (gdb_stdlog, " longword_offset=0x%lx", (long) longword_offset); } - + addr = sp + stack_offset + longword_offset; if (mips_debug) @@ -2462,7 +2465,7 @@ mips_push_arguments (int nargs, { LONGEST regval = extract_unsigned_integer (val, partial_len); - /* A non-floating-point argument being passed in a + /* A non-floating-point argument being passed in a general register. If a struct or union, and if the remaining length is smaller than the register size, we have to adjust the register value on @@ -2594,7 +2597,7 @@ mips_push_dummy_frame (void) * procedure calls. Dest_Reg (see tm-mips.h) must also be saved. * In addition, we must save the PC, PUSH_FP_REGNUM, MMLO/-HI * and FP Control/Status registers. - * + * * * Dummy frame layout: * (high memory) @@ -2738,6 +2741,24 @@ mips_pop_frame (void) regs could be 32 bits wide in one frame and 64 on the frame above and below). */ +static struct type * +mips_float_register_type (void) +{ + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + return builtin_type_ieee_single_big; + else + return builtin_type_ieee_single_little; +} + +static struct type * +mips_double_register_type (void) +{ + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + return builtin_type_ieee_double_big; + else + return builtin_type_ieee_double_little; +} + /* Copy a 32-bit single-precision value from the current frame into rare_buffer. */ @@ -2798,7 +2819,7 @@ mips_read_fp_register_double (int regno, char *rare_buffer) mips_read_fp_register_single (regno, rare_buffer + 4); mips_read_fp_register_single (regno + 1, rare_buffer); } - else + else { mips_read_fp_register_single (regno, rare_buffer); mips_read_fp_register_single (regno + 1, rare_buffer + 4); @@ -2831,7 +2852,7 @@ mips_print_register (int regnum, int all) mips_read_fp_register_double (regnum, dbuffer); printf_filtered ("(d%d: ", regnum - FP0_REGNUM); - val_print (builtin_type_double, dbuffer, 0, 0, + val_print (mips_double_register_type (), dbuffer, 0, 0, gdb_stdout, 0, 1, 0, Val_pretty_default); printf_filtered ("); "); } @@ -2855,10 +2876,10 @@ mips_print_register (int regnum, int all) int offset = 4 * (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG); printf_filtered (" (float) "); - val_print (builtin_type_float, raw_buffer + offset, 0, 0, + val_print (mips_float_register_type (), raw_buffer + offset, 0, 0, gdb_stdout, 0, 1, 0, Val_pretty_default); printf_filtered (", (double) "); - val_print (builtin_type_double, raw_buffer, 0, 0, + val_print (mips_double_register_type (), raw_buffer, 0, 0, gdb_stdout, 0, 1, 0, Val_pretty_default); } else @@ -2873,14 +2894,14 @@ mips_print_register (int regnum, int all) offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); else offset = 0; - + print_scalar_formatted (raw_buffer + offset, REGISTER_VIRTUAL_TYPE (regnum), 'x', 0, gdb_stdout); } } -/* Replacement for generic do_registers_info. +/* Replacement for generic do_registers_info. Print regs in pretty columns. */ static int @@ -2897,14 +2918,14 @@ do_fp_register_row (int regnum) /* 4-byte registers: we can fit two registers per row. */ /* Also print every pair of 4-byte regs as an 8-byte double. */ mips_read_fp_register_single (regnum, raw_buffer); - flt1 = unpack_double (builtin_type_float, raw_buffer, &inv1); + flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1); mips_read_fp_register_single (regnum + 1, raw_buffer); - flt2 = unpack_double (builtin_type_float, raw_buffer, &inv2); + flt2 = unpack_double (mips_float_register_type (), raw_buffer, &inv2); mips_read_fp_register_double (regnum, raw_buffer); - doub = unpack_double (builtin_type_double, raw_buffer, &inv3); - + doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3); + printf_filtered (" %-5s", REGISTER_NAME (regnum)); if (inv1) printf_filtered (": "); @@ -2931,11 +2952,11 @@ do_fp_register_row (int regnum) { /* Eight byte registers: print each one as float AND as double. */ mips_read_fp_register_single (regnum, raw_buffer); - flt1 = unpack_double (builtin_type_double, raw_buffer, &inv1); + flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1); mips_read_fp_register_double (regnum, raw_buffer); - doub = unpack_double (builtin_type_double, raw_buffer, &inv3); - + doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3); + printf_filtered (" %-5s: ", REGISTER_NAME (regnum)); if (inv1) printf_filtered (""); @@ -3676,10 +3697,10 @@ gdb_print_insn_mips (bfd_vma memaddr, disassemble_info *info) it's definitely a 16-bit function. Otherwise, we have to just guess that if the address passed in is odd, it's 16-bits. */ if (proc_desc) - info->mach = pc_is_mips16 (PROC_LOW_ADDR (proc_desc)) ? + info->mach = pc_is_mips16 (PROC_LOW_ADDR (proc_desc)) ? bfd_mach_mips16 : TM_PRINT_INSN_MACH; else - info->mach = pc_is_mips16 (memaddr) ? + info->mach = pc_is_mips16 (memaddr) ? bfd_mach_mips16 : TM_PRINT_INSN_MACH; /* Round down the instruction address to the appropriate boundary. */ @@ -4072,7 +4093,7 @@ mips_stab_reg_to_regnum (int num) { if (num < 32) return num; - else + else return num + FP0_REGNUM - 38; } @@ -4236,7 +4257,7 @@ mips_gdbarch_init (struct gdbarch_info info, tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1; tdep->mips_regs_have_home_p = 1; tdep->gdb_target_is_mips64 = 1; - tdep->default_mask_address_p = 0; + tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); set_gdbarch_long_long_bit (gdbarch, 64); @@ -4318,7 +4339,7 @@ mips_gdbarch_init (struct gdbarch_info info, flag in object files because to do so would make it impossible to link with libraries compiled without "-gp32". This is unnecessarily restrictive. - + We could solve this problem by adding "-gp32" multilibs to gcc, but to set this flag before gcc is built with such multilibs will break too many systems.'' @@ -4958,4 +4979,3 @@ that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\ When non-zero, mips specific debugging is enabled.", &setdebuglist), &showdebuglist); } - diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c new file mode 100644 index 0000000..71e229d --- /dev/null +++ b/gdb/nbsd-tdep.c @@ -0,0 +1,98 @@ +/* Common target-dependent code for NetBSD systems. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 "solib-svr4.h" + +/* Fetch (and possibly build) an appropriate link_map_offsets + structure for NetBSD targets using the struct offsets defined + in (but without actual reference to that file). + + This makes it possible to access NetBSD shared libraries from a + GDB that was not built on the same platform (for cross debugging). + + We provide versions for ILP32 and LP64 NetBSD targets here. */ + +struct link_map_offsets * +nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = NULL; + + if (lmp == NULL) + { + lmp = &lmo; + + lmo.r_debug_size = 16; + + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 20; + + lmo.l_addr_offset = 0; + lmo.l_addr_size = 4; + + lmo.l_name_offset = 4; + lmo.l_name_size = 4; + + lmo.l_next_offset = 12; + lmo.l_next_size = 4; + + lmo.l_prev_offset = 16; + lmo.l_prev_size = 4; + } + + return lmp; +} + +struct link_map_offsets * +nbsd_lp64_solib_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = NULL; + + if (lmp == NULL) + { + lmp = &lmo; + + lmo.r_debug_size = 32; + + lmo.r_map_offset = 8; + lmo.r_map_size = 8; + + lmo.link_map_size = 40; + + lmo.l_addr_offset = 0; + lmo.l_addr_size = 8; + + lmo.l_name_offset = 8; + lmo.l_name_size = 8; + + lmo.l_next_offset = 24; + lmo.l_next_size = 8; + + lmo.l_prev_offset = 32; + lmo.l_prev_size = 8; + } + + return lmp; +} diff --git a/gdb/nbsd-tdep.h b/gdb/nbsd-tdep.h new file mode 100644 index 0000000..ca40965 --- /dev/null +++ b/gdb/nbsd-tdep.h @@ -0,0 +1,28 @@ +/* Common target-dependent definitions for NetBSD systems. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 NBSD_TDEP_H +#define NBSD_TDEP_H + +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); + +#endif /* NBSD_TDEP_H */ diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e2a6f85..32bda87 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -190,6 +190,8 @@ allocate_objfile (bfd *abfd, int flags) /* Update pointers to functions to *our* copies */ obstack_chunkfun (&objfile->psymbol_cache.cache, xmmalloc); obstack_freefun (&objfile->psymbol_cache.cache, xmfree); + obstack_chunkfun (&objfile->macro_cache.cache, xmmalloc); + obstack_freefun (&objfile->macro_cache.cache, xmfree); obstack_chunkfun (&objfile->psymbol_obstack, xmmalloc); obstack_freefun (&objfile->psymbol_obstack, xmfree); obstack_chunkfun (&objfile->symbol_obstack, xmmalloc); @@ -220,6 +222,9 @@ allocate_objfile (bfd *abfd, int flags) obstack_specify_allocation_with_arg (&objfile->psymbol_cache.cache, 0, 0, xmmalloc, xmfree, objfile->md); + obstack_specify_allocation_with_arg (&objfile->macro_cache.cache, + 0, 0, xmmalloc, xmfree, + objfile->md); obstack_specify_allocation_with_arg (&objfile->psymbol_obstack, 0, 0, xmmalloc, xmfree, objfile->md); @@ -266,6 +271,8 @@ allocate_objfile (bfd *abfd, int flags) objfile->md = NULL; obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, xmalloc, xfree); + obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, + xmalloc, xfree); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, @@ -477,6 +484,7 @@ free_objfile (struct objfile *objfile) xmfree (objfile->md, objfile->static_psymbols.list); /* Free the obstacks for non-reusable objfiles */ free_bcache (&objfile->psymbol_cache); + free_bcache (&objfile->macro_cache); obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->type_obstack, 0); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 992ae71..ed4e6b7 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -277,6 +277,7 @@ struct objfile will not change. */ struct bcache psymbol_cache; /* Byte cache for partial syms */ + struct bcache macro_cache; /* Byte cache for macros */ /* Vectors of all partial symbols read in from file. The actual data is stored in the psymbol_obstack. */ diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 4796da5..8e13b6e 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -58,7 +58,7 @@ is_pascal_string_type (struct type *type,int *length_pos, if (length_pos) *length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT; if (length_size) - *length_size = TYPE_FIELD_TYPE (type, 0)->length; + *length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)); if (string_pos) *string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT; if (char_size) @@ -76,7 +76,7 @@ is_pascal_string_type (struct type *type,int *length_pos, if (length_pos) *length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT; if (length_size) - *length_size = TYPE_FIELD_TYPE (type, 1)->length; + *length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 1)); if (string_pos) *string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT; /* FIXME: how can I detect wide chars in GPC ?? */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b74f558..de306f0 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -923,25 +923,6 @@ print_command_1 (char *exp, int inspect, int voidprint) old_chain = make_cleanup (free_current_contents, &expr); cleanup = 1; val = evaluate_expression (expr); - - /* C++: figure out what type we actually want to print it as. */ - type = VALUE_TYPE (val); - - if (objectprint - && (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT - || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_UNION)) - { - struct value *v; - - v = value_from_vtable_info (val, TYPE_TARGET_TYPE (type)); - if (v != 0) - { - val = v; - type = VALUE_TYPE (val); - } - } } else val = access_value_history (0); diff --git a/gdb/regcache.c b/gdb/regcache.c index 8c1a0aa..11ed8c4 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -45,7 +45,13 @@ char *registers; /* REGISTER_VALID is 0 if the register needs to be fetched, 1 if it has been fetched, and -1 if the register value was not available. - "Not available" means don't try to fetch it again. */ + + "Not available" indicates that the target is not not able to supply + the register at this state. The register may become available at a + later time (after the next resume). This often occures when GDB is + manipulating a target that contains only a snapshot of the entire + system being debugged - some of the registers in such a system may + not have been saved. */ signed char *register_valid; @@ -654,8 +660,6 @@ generic_target_write_pc (CORE_ADDR pc, ptid_t ptid) write_register_pid (PC_REGNUM, pc, ptid); if (NPC_REGNUM >= 0) write_register_pid (NPC_REGNUM, pc + 4, ptid); - if (NNPC_REGNUM >= 0) - write_register_pid (NNPC_REGNUM, pc + 8, ptid); #else internal_error (__FILE__, __LINE__, "generic_target_write_pc"); diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index 695a302..5243f9b 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -1023,39 +1023,41 @@ _initialize_remote_rdi (void) c = add_cmd ("rdilogfile", class_maintenance, rdilogfile_command, - "Set filename for ADP packet log.\n\ -This file is used to log Angel Debugger Protocol packets.\n\ -With a single argument, sets the logfile name to that value.\n\ -Without an argument, shows the current logfile name.\n\ -See also: rdilogenable\n", - &maintenancelist); + "Set filename for ADP packet log.\n" + "This file is used to log Angel Debugger Protocol packets.\n" + "With a single argument, sets the logfile name to that value.\n" + "Without an argument, shows the current logfile name.\n" + "See also: rdilogenable\n", + &maintenancelist); set_cmd_completer (c, filename_completer); add_cmd ("rdilogenable", class_maintenance, rdilogenable_command, - "Set enable logging of ADP packets.\n\ -This will log ADP packets exchanged between gdb and the\n\ -rdi target device.\n\ -An argument of 1,t,true,y,yes will enable.\n\ -An argument of 0,f,false,n,no will disabled.\n\ -Withough an argument, it will display current state.\n", + "Set enable logging of ADP packets.\n" + "This will log ADP packets exchanged between gdb and the\n" + "rdi target device.\n" + "An argument of 1, t, true, y or yes will enable.\n" + "An argument of 0, f, false, n or no will disabled.\n" + "Withough an argument, it will display current state.\n", &maintenancelist); add_show_from_set - (add_set_boolean_cmd ("rdiromatzero", no_class, &rom_at_zero, - "Set target has ROM at addr 0.\n\ -A true value disables vector catching, false enables vector catching.\n\ -This is evaluated at the time the 'target rdi' command is executed\n", - &setlist), + (add_set_boolean_cmd + ("rdiromatzero", no_class, &rom_at_zero, + "Set target has ROM at addr 0.\n" + "A true value disables vector catching, false enables vector catching.\n" + "This is evaluated at the time the 'target rdi' command is executed\n", + &setlist), &showlist); add_show_from_set - (add_set_boolean_cmd ("rdiheartbeat", no_class, &rdi_heartbeat, - "Set enable for ADP heartbeat packets.\n\ -I don't know why you would want this. If you enable them,\n\ -it will confuse ARM and EPI JTAG interface boxes as well\n\ -as the Angel Monitor.\n", - &setlist), + (add_set_boolean_cmd + ("rdiheartbeat", no_class, &rdi_heartbeat, + "Set enable for ADP heartbeat packets.\n" + "I don't know why you would want this. If you enable them,\n" + "it will confuse ARM and EPI JTAG interface boxes as well\n" + "as the Angel Monitor.\n", + &setlist), &showlist); } diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index f6ccf1e..280e79c 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -612,7 +612,7 @@ remote_rdp_fetch_register (int regno) } else { - char buf[MAX_REGISTER_RAW_SIZE]; + char buf[ARM_MAX_REGISTER_RAW_SIZE]; if (regno < 15) rdp_fetch_one_register (1 << regno, buf); else if (regno == ARM_PC_REGNUM) @@ -642,7 +642,7 @@ remote_rdp_store_register (int regno) } else { - char tmp[MAX_REGISTER_RAW_SIZE]; + char tmp[ARM_MAX_REGISTER_RAW_SIZE]; read_register_gen (regno, tmp); if (regno < 15) rdp_store_one_register (1 << regno, tmp); @@ -1363,13 +1363,6 @@ remote_rdp_create_inferior (char *exec_file, char *allargs, char **env) proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0); } -/* Accept any stray run/attach commands */ -static int -remote_rdp_can_run (void) -{ - return 1; -} - /* Attach doesn't need to do anything */ static void remote_rdp_attach (char *args, int from_tty) @@ -1431,7 +1424,7 @@ init_remote_rdp_ops (void) remote_rdp_ops.to_reported_exec_events_per_exec_call = NULL; remote_rdp_ops.to_has_exited = NULL; remote_rdp_ops.to_mourn_inferior = generic_mourn_inferior; - remote_rdp_ops.to_can_run = remote_rdp_can_run; + remote_rdp_ops.to_can_run = NULL; remote_rdp_ops.to_notice_signals = 0; remote_rdp_ops.to_thread_alive = 0; remote_rdp_ops.to_stop = 0; diff --git a/gdb/remote.c b/gdb/remote.c index a773680..c3f40fe 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -256,7 +256,7 @@ static struct gdbarch_data *remote_gdbarch_data_handle; static struct remote_state * get_remote_state () { - return gdbarch_data (remote_gdbarch_data_handle); + return gdbarch_data (current_gdbarch, remote_gdbarch_data_handle); } static void * @@ -2222,6 +2222,26 @@ remote_check_symbols (struct objfile *objfile) } } +static struct serial * +remote_serial_open (char *name) +{ + static int udp_warning = 0; + + /* FIXME: Parsing NAME here is a hack. But we want to warn here instead + of in ser-tcp.c, because it is the remote protocol assuming that the + serial connection is reliable and not the serial connection promising + to be. */ + if (!udp_warning && strncmp (name, "udp:", 4) == 0) + { + warning ("The remote protocol may be unreliable over UDP."); + warning ("Some events may be lost, rendering further debugging " + "impossible."); + udp_warning = 1; + } + + return serial_open (name); +} + static void remote_open_1 (char *name, int from_tty, struct target_ops *target, int extended_p) @@ -2239,7 +2259,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, unpush_target (target); - remote_desc = serial_open (name); + remote_desc = remote_serial_open (name); if (!remote_desc) perror_with_name (name); @@ -2337,7 +2357,7 @@ remote_async_open_1 (char *name, int from_tty, struct target_ops *target, unpush_target (target); - remote_desc = serial_open (name); + remote_desc = remote_serial_open (name); if (!remote_desc) perror_with_name (name); @@ -5463,7 +5483,7 @@ remote_cisco_open (char *name, int from_tty) unpush_target (&remote_cisco_ops); - remote_desc = serial_open (name); + remote_desc = remote_serial_open (name); if (!remote_desc) perror_with_name (name); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 74285a3..ee7e9c3 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2663,7 +2663,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_byte (gdbarch, rs6000_register_byte); set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size); set_gdbarch_max_register_raw_size (gdbarch, 16); - set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size); + set_gdbarch_register_virtual_size (gdbarch, generic_register_size); set_gdbarch_max_register_virtual_size (gdbarch, 16); set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type); set_gdbarch_do_registers_info (gdbarch, rs6000_do_registers_info); diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 6dc8284..cef6269 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -38,12 +38,13 @@ #include #include #include +#include #include #include "gdb_string.h" -static int tcp_open (struct serial *scb, const char *name); -static void tcp_close (struct serial *scb); +static int net_open (struct serial *scb, const char *name); +static void net_close (struct serial *scb); extern int (*ui_loop_hook) (int); void _initialize_ser_tcp (void); @@ -55,17 +56,27 @@ void _initialize_ser_tcp (void); /* Open a tcp socket */ static int -tcp_open (struct serial *scb, const char *name) +net_open (struct serial *scb, const char *name) { char *port_str, hostname[100]; int n, port, tmp; + int use_udp; struct hostent *hostent; struct sockaddr_in sockaddr; + use_udp = 0; + if (strncmp (name, "udp:", 4) == 0) + { + use_udp = 1; + name = name + 4; + } + else if (strncmp (name, "tcp:", 4) == 0) + name = name + 4; + port_str = strchr (name, ':'); if (!port_str) - error ("tcp_open: No colon in host name!"); /* Shouldn't ever happen */ + error ("net_open: No colon in host name!"); /* Shouldn't ever happen */ tmp = min (port_str - name, (int) sizeof hostname - 1); strncpy (hostname, name, tmp); /* Don't want colon */ @@ -84,7 +95,11 @@ tcp_open (struct serial *scb, const char *name) return -1; } - scb->fd = socket (PF_INET, SOCK_STREAM, 0); + if (use_udp) + scb->fd = socket (PF_INET, SOCK_DGRAM, 0); + else + scb->fd = socket (PF_INET, SOCK_STREAM, 0); + if (scb->fd < 0) return -1; @@ -102,7 +117,7 @@ tcp_open (struct serial *scb, const char *name) if (n < 0 && errno != EINPROGRESS) { - tcp_close (scb); + net_close (scb); return -1; } @@ -124,7 +139,7 @@ tcp_open (struct serial *scb, const char *name) if (ui_loop_hook (0)) { errno = EINTR; - tcp_close (scb); + net_close (scb); return -1; } } @@ -142,7 +157,7 @@ tcp_open (struct serial *scb, const char *name) { if (polls > TIMEOUT * POLL_INTERVAL) errno = ETIMEDOUT; - tcp_close (scb); + net_close (scb); return -1; } } @@ -156,20 +171,23 @@ tcp_open (struct serial *scb, const char *name) { if (err) errno = err; - tcp_close (scb); + net_close (scb); return -1; } } - + /* turn off nonblocking */ tmp = 0; ioctl (scb->fd, FIONBIO, &tmp); - /* Disable Nagle algorithm. Needed in some cases. */ - tmp = 1; - setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, - (char *)&tmp, sizeof (tmp)); - + if (use_udp == 0) + { + /* Disable Nagle algorithm. Needed in some cases. */ + tmp = 1; + setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, + (char *)&tmp, sizeof (tmp)); + } + /* If we don't do this, then GDB simply exits when the remote side dies. */ signal (SIGPIPE, SIG_IGN); @@ -178,7 +196,7 @@ tcp_open (struct serial *scb, const char *name) } static void -tcp_close (struct serial *scb) +net_close (struct serial *scb) { if (scb->fd < 0) return; @@ -194,8 +212,8 @@ _initialize_ser_tcp (void) memset (ops, sizeof (struct serial_ops), 0); ops->name = "tcp"; ops->next = 0; - ops->open = tcp_open; - ops->close = tcp_close; + ops->open = net_open; + ops->close = net_close; ops->readchar = ser_unix_readchar; ops->write = ser_unix_write; ops->flush_output = ser_unix_nop_flush_output; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 996e611..b768692 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -41,8 +41,14 @@ #include "regcache.h" #include "doublest.h" +#include "elf-bfd.h" #include "solib-svr4.h" +/* sh64 flags */ +#include "elf/sh.h" +/* registers numbers shared with the simulator */ +#include "gdb/sim-sh.h" + void (*sh_show_regs) (void); CORE_ADDR (*skip_prologue_hard_way) (CORE_ADDR); void (*do_pseudo_register) (int); @@ -228,7 +234,84 @@ sh_sh4_register_name (int reg_nr) return register_names[reg_nr]; } -static unsigned char * +static char * +sh_sh64_register_name (int reg_nr) +{ + static char *register_names[] = + { + /* SH MEDIA MODE (ISA 32) */ + /* general registers (64-bit) 0-63 */ + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", + "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", + "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", + "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", + "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", + + /* pc (64-bit) 64 */ + "pc", + + /* status reg., saved status reg., saved pc reg. (64-bit) 65-67 */ + "sr", "ssr", "spc", + + /* target registers (64-bit) 68-75*/ + "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", + + /* floating point state control register (32-bit) 76 */ + "fpscr", + + /* single precision floating point registers (32-bit) 77-140*/ + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", + "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", + "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31", + "fr32", "fr33", "fr34", "fr35", "fr36", "fr37", "fr38", "fr39", + "fr40", "fr41", "fr42", "fr43", "fr44", "fr45", "fr46", "fr47", + "fr48", "fr49", "fr50", "fr51", "fr52", "fr53", "fr54", "fr55", + "fr56", "fr57", "fr58", "fr59", "fr60", "fr61", "fr62", "fr63", + + /* double precision registers (pseudo) 141-172 */ + "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14", + "dr16", "dr18", "dr20", "dr22", "dr24", "dr26", "dr28", "dr30", + "dr32", "dr34", "dr36", "dr38", "dr40", "dr42", "dr44", "dr46", + "dr48", "dr50", "dr52", "dr54", "dr56", "dr58", "dr60", "dr62", + + /* floating point pairs (pseudo) 173-204*/ + "fp0", "fp2", "fp4", "fp6", "fp8", "fp10", "fp12", "fp14", + "fp16", "fp18", "fp20", "fp22", "fp24", "fp26", "fp28", "fp30", + "fp32", "fp34", "fp36", "fp38", "fp40", "fp42", "fp44", "fp46", + "fp48", "fp50", "fp52", "fp54", "fp56", "fp58", "fp60", "fp62", + + /* floating point vectors (4 floating point regs) (pseudo) 205-220*/ + "fv0", "fv4", "fv8", "fv12", "fv16", "fv20", "fv24", "fv28", + "fv32", "fv36", "fv40", "fv44", "fv48", "fv52", "fv56", "fv60", + + /* SH COMPACT MODE (ISA 16) (all pseudo) 221-272*/ + "r0_c", "r1_c", "r2_c", "r3_c", "r4_c", "r5_c", "r6_c", "r7_c", + "r8_c", "r9_c", "r10_c", "r11_c", "r12_c", "r13_c", "r14_c", "r15_c", + "pc_c", + "gbr_c", "mach_c", "macl_c", "pr_c", "t_c", + "fpscr_c", "fpul_c", + "fr0_c", "fr1_c", "fr2_c", "fr3_c", "fr4_c", "fr5_c", "fr6_c", "fr7_c", + "fr8_c", "fr9_c", "fr10_c", "fr11_c", "fr12_c", "fr13_c", "fr14_c", "fr15_c", + "dr0_c", "dr2_c", "dr4_c", "dr6_c", "dr8_c", "dr10_c", "dr12_c", "dr14_c", + "fv0_c", "fv4_c", "fv8_c", "fv12_c", + /* FIXME!!!! XF0 XF15, XD0 XD14 ?????*/ + }; + + if (reg_nr < 0) + return NULL; + if (reg_nr >= (sizeof (register_names) / sizeof (*register_names))) + return NULL; + return register_names[reg_nr]; +} + +#define NUM_PSEUDO_REGS_SH_MEDIA 80 +#define NUM_PSEUDO_REGS_SH_COMPACT 51 + +static const unsigned char * sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { /* 0xc3c3 is trapa #c3, and it works in big and little endian modes */ @@ -238,6 +321,109 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) return breakpoint; } +/* Macros and functions for setting and testing a bit in a minimal + symbol that marks it as 32-bit function. The MSB of the minimal + symbol's "info" field is used for this purpose. This field is + already being used to store the symbol size, so the assumption is + that the symbol size cannot exceed 2^31. + + ELF_MAKE_MSYMBOL_SPECIAL + tests whether an ELF symbol is "special", i.e. refers + to a 32-bit function, and sets a "special" bit in a + minimal symbol to mark it as a 32-bit function + MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol + MSYMBOL_SIZE returns the size of the minimal symbol, i.e. + the "info" field with the "special" bit masked out */ + +#define MSYMBOL_IS_SPECIAL(msym) \ + (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) + +void +sh64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) +{ + if (msym == NULL) + return; + + if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_SH5_ISA32) + { + MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) | 0x80000000); + SYMBOL_VALUE_ADDRESS (msym) |= 1; + } +} + +/* ISA32 (shmedia) function addresses are odd (bit 0 is set). Here + are some macros to test, set, or clear bit 0 of addresses. */ +#define IS_ISA32_ADDR(addr) ((addr) & 1) +#define MAKE_ISA32_ADDR(addr) ((addr) | 1) +#define UNMAKE_ISA32_ADDR(addr) ((addr) & ~1) + +static int +pc_is_isa32 (bfd_vma memaddr) +{ + struct minimal_symbol *sym; + + /* If bit 0 of the address is set, assume this is a + ISA32 (shmedia) address. */ + if (IS_ISA32_ADDR (memaddr)) + return 1; + + /* A flag indicating that this is a ISA32 function is stored by elfread.c in + the high bit of the info field. Use this to decide if the function is + ISA16 or ISA32. */ + sym = lookup_minimal_symbol_by_pc (memaddr); + if (sym) + return MSYMBOL_IS_SPECIAL (sym); + else + return 0; +} + +static const unsigned char * +sh_sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) +{ + /* The BRK instruction for shmedia is + 01101111 11110101 11111111 11110000 + which translates in big endian mode to 0x6f, 0xf5, 0xff, 0xf0 + and in little endian mode to 0xf0, 0xff, 0xf5, 0x6f */ + + /* The BRK instruction for shcompact is + 00000000 00111011 + which translates in big endian mode to 0x0, 0x3b + and in little endian mode to 0x3b, 0x0*/ + + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + { + if (pc_is_isa32 (*pcptr)) + { + static unsigned char big_breakpoint_media[] = {0x6f, 0xf5, 0xff, 0xf0}; + *pcptr = UNMAKE_ISA32_ADDR (*pcptr); + *lenptr = sizeof (big_breakpoint_media); + return big_breakpoint_media; + } + else + { + static unsigned char big_breakpoint_compact[] = {0x0, 0x3b}; + *lenptr = sizeof (big_breakpoint_compact); + return big_breakpoint_compact; + } + } + else + { + if (pc_is_isa32 (*pcptr)) + { + static unsigned char little_breakpoint_media[] = {0xf0, 0xff, 0xf5, 0x6f}; + *pcptr = UNMAKE_ISA32_ADDR (*pcptr); + *lenptr = sizeof (little_breakpoint_media); + return little_breakpoint_media; + } + else + { + static unsigned char little_breakpoint_compact[] = {0x3b, 0x0}; + *lenptr = sizeof (little_breakpoint_compact); + return little_breakpoint_compact; + } + } +} + /* Prologue looks like [mov.l ,@-r15]... [sts.l pr,@-r15] @@ -262,6 +448,123 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) */ +/* PTABS/L Rn, TRa 0110101111110001nnnnnnl00aaa0000 + with l=1 and n = 18 0110101111110001010010100aaa0000 */ +#define IS_PTABSL_R18(x) (((x) & 0xffffff8f) == 0x6bf14a00) + +/* STS.L PR,@-r0 0100000000100010 + r0-4-->r0, PR-->(r0) */ +#define IS_STS_R0(x) ((x) == 0x4022) + +/* STS PR, Rm 0000mmmm00101010 + PR-->Rm */ +#define IS_STS_PR(x) (((x) & 0xf0ff) == 0x2a) + +/* MOV.L Rm,@(disp,r15) 00011111mmmmdddd + Rm-->(dispx4+r15) */ +#define IS_MOV_TO_R15(x) (((x) & 0xff00) == 0x1f00) + +/* MOV.L R14,@(disp,r15) 000111111110dddd + R14-->(dispx4+r15) */ +#define IS_MOV_R14(x) (((x) & 0xfff0) == 0x1fe0) + +/* ST.Q R14, disp, R18 101011001110dddddddddd0100100000 + R18-->(dispx8+R14) */ +#define IS_STQ_R18_R14(x) (((x) & 0xfff003ff) == 0xace00120) + +/* ST.Q R15, disp, R18 101011001111dddddddddd0100100000 + R18-->(dispx8+R15) */ +#define IS_STQ_R18_R15(x) (((x) & 0xfff003ff) == 0xacf00120) + +/* ST.L R15, disp, R18 101010001111dddddddddd0100100000 + R18-->(dispx4+R15) */ +#define IS_STL_R18_R15(x) (((x) & 0xfff003ff) == 0xa8f00120) + +/* ST.Q R15, disp, R14 1010 1100 1111 dddd dddd dd00 1110 0000 + R14-->(dispx8+R15) */ +#define IS_STQ_R14_R15(x) (((x) & 0xfff003ff) == 0xacf000e0) + +/* ST.L R15, disp, R14 1010 1000 1111 dddd dddd dd00 1110 0000 + R14-->(dispx4+R15) */ +#define IS_STL_R14_R15(x) (((x) & 0xfff003ff) == 0xa8f000e0) + +/* ADDI.L R15,imm,R15 1101 0100 1111 ssss ssss ss00 1111 0000 + R15 + imm --> R15 */ +#define IS_ADDIL_SP_MEDIA(x) (((x) & 0xfff003ff) == 0xd4f000f0) + +/* ADDI R15,imm,R15 1101 0000 1111 ssss ssss ss00 1111 0000 + R15 + imm --> R15 */ +#define IS_ADDI_SP_MEDIA(x) (((x) & 0xfff003ff) == 0xd0f000f0) + +/* ADD.L R15,R63,R14 0000 0000 1111 1000 1111 1100 1110 0000 + R15 + R63 --> R14 */ +#define IS_ADDL_SP_FP_MEDIA(x) ((x) == 0x00f8fce0) + +/* ADD R15,R63,R14 0000 0000 1111 1001 1111 1100 1110 0000 + R15 + R63 --> R14 */ +#define IS_ADD_SP_FP_MEDIA(x) ((x) == 0x00f9fce0) + +#define IS_MOV_SP_FP_MEDIA(x) (IS_ADDL_SP_FP_MEDIA(x) || IS_ADD_SP_FP_MEDIA(x)) + +/* MOV #imm, R0 1110 0000 ssss ssss + #imm-->R0 */ +#define IS_MOV_R0(x) (((x) & 0xff00) == 0xe000) + +/* MOV.L @(disp,PC), R0 1101 0000 iiii iiii */ +#define IS_MOVL_R0(x) (((x) & 0xff00) == 0xd000) + +/* ADD r15,r0 0011 0000 1111 1100 + r15+r0-->r0 */ +#define IS_ADD_SP_R0(x) ((x) == 0x30fc) + +/* MOV.L R14 @-R0 0010 0000 1110 0110 + R14-->(R0-4), R0-4-->R0 */ +#define IS_MOV_R14_R0(x) ((x) == 0x20e6) + +/* ADD Rm,R63,Rn Rm+R63-->Rn 0000 00mm mmmm 1001 1111 11nn nnnn 0000 + where Rm is one of r2-r9 which are the argument registers. */ +/* FIXME: Recognize the float and double register moves too! */ +#define IS_MEDIA_IND_ARG_MOV(x) \ +((((x) & 0xfc0ffc0f) == 0x0009fc00) && (((x) & 0x03f00000) >= 0x00200000 && ((x) & 0x03f00000) <= 0x00900000)) + +/* ST.Q Rn,0,Rm Rm-->Rn+0 1010 11nn nnnn 0000 0000 00mm mmmm 0000 + or ST.L Rn,0,Rm Rm-->Rn+0 1010 10nn nnnn 0000 0000 00mm mmmm 0000 + where Rm is one of r2-r9 which are the argument registers. */ +#define IS_MEDIA_ARG_MOV(x) \ +(((((x) & 0xfc0ffc0f) == 0xac000000) || (((x) & 0xfc0ffc0f) == 0xa8000000)) \ + && (((x) & 0x000003f0) >= 0x00000020 && ((x) & 0x000003f0) <= 0x00000090)) + +/* ST.B R14,0,Rn Rn-->(R14+0) 1010 0000 1110 0000 0000 00nn nnnn 0000*/ +/* ST.W R14,0,Rn Rn-->(R14+0) 1010 0100 1110 0000 0000 00nn nnnn 0000*/ +/* ST.L R14,0,Rn Rn-->(R14+0) 1010 1000 1110 0000 0000 00nn nnnn 0000*/ +/* FST.S R14,0,FRn Rn-->(R14+0) 1011 0100 1110 0000 0000 00nn nnnn 0000*/ +/* FST.D R14,0,DRn Rn-->(R14+0) 1011 1100 1110 0000 0000 00nn nnnn 0000*/ +#define IS_MEDIA_MOV_TO_R14(x) \ +((((x) & 0xfffffc0f) == 0xa0e00000) \ +|| (((x) & 0xfffffc0f) == 0xa4e00000) \ +|| (((x) & 0xfffffc0f) == 0xa8e00000) \ +|| (((x) & 0xfffffc0f) == 0xb4e00000) \ +|| (((x) & 0xfffffc0f) == 0xbce00000)) + +/* MOV Rm, Rn Rm-->Rn 0110 nnnn mmmm 0011 + where Rm is r2-r9 */ +#define IS_COMPACT_IND_ARG_MOV(x) \ +((((x) & 0xf00f) == 0x6003) && (((x) & 0x00f0) >= 0x0020) && (((x) & 0x00f0) <= 0x0090)) + +/* compact direct arg move! + MOV.L Rn, @r14 0010 1110 mmmm 0010 */ +#define IS_COMPACT_ARG_MOV(x) \ +(((((x) & 0xff0f) == 0x2e02) && (((x) & 0x00f0) >= 0x0020) && ((x) & 0x00f0) <= 0x0090)) + +/* MOV.B Rm, @R14 0010 1110 mmmm 0000 + MOV.W Rm, @R14 0010 1110 mmmm 0001 */ +#define IS_COMPACT_MOV_TO_R14(x) \ +((((x) & 0xff0f) == 0x2e00) || (((x) & 0xff0f) == 0x2e01)) + +#define IS_JSR_R0(x) ((x) == 0x400b) +#define IS_NOP(x) ((x) == 0x0009) + + /* STS.L PR,@-r15 0100111100100010 r15-4-->r15, PR-->(r15) */ #define IS_STS(x) ((x) == 0x4f22) @@ -374,6 +677,178 @@ sh_skip_prologue_hard_way (CORE_ADDR start_pc) return start_pc; } +static CORE_ADDR +look_for_args_moves (CORE_ADDR start_pc, int media_mode) +{ + CORE_ADDR here, end; + int w; + int insn_size = (media_mode ? 4 : 2); + + for (here = start_pc, end = start_pc + (insn_size * 28); here < end;) + { + if (media_mode) + { + w = read_memory_integer (UNMAKE_ISA32_ADDR (here), insn_size); + here += insn_size; + if (IS_MEDIA_IND_ARG_MOV (w)) + { + /* This must be followed by a store to r14, so the argument + is where the debug info says it is. This can happen after + the SP has been saved, unfortunately. */ + + int next_insn = read_memory_integer (UNMAKE_ISA32_ADDR (here), + insn_size); + here += insn_size; + if (IS_MEDIA_MOV_TO_R14 (next_insn)) + start_pc = here; + } + else if (IS_MEDIA_ARG_MOV (w)) + { + /* These instructions store directly the argument in r14. */ + start_pc = here; + } + else + break; + } + else + { + w = read_memory_integer (here, insn_size); + w = w & 0xffff; + here += insn_size; + if (IS_COMPACT_IND_ARG_MOV (w)) + { + /* This must be followed by a store to r14, so the argument + is where the debug info says it is. This can happen after + the SP has been saved, unfortunately. */ + + int next_insn = 0xffff & read_memory_integer (here, insn_size); + here += insn_size; + if (IS_COMPACT_MOV_TO_R14 (next_insn)) + start_pc = here; + } + else if (IS_COMPACT_ARG_MOV (w)) + { + /* These instructions store directly the argument in r14. */ + start_pc = here; + } + else if (IS_MOVL_R0 (w)) + { + /* There is a function that gcc calls to get the arguments + passed correctly to the function. Only after this + function call the arguments will be found at the place + where they are supposed to be. This happens in case the + argument has to be stored into a 64-bit register (for + instance doubles, long longs). SHcompact doesn't have + access to the full 64-bits, so we store the register in + stack slot and store the address of the stack slot in + the register, then do a call through a wrapper that + loads the memory value into the register. A SHcompact + callee calls an argument decoder + (GCC_shcompact_incoming_args) that stores the 64-bit + value in a stack slot and stores the address of the + stack slot in the register. GCC thinks the argument is + just passed by transparent reference, but this is only + true after the argument decoder is called. Such a call + needs to be considered part of the prologue. */ + + /* This must be followed by a JSR @r0 instruction and by + a NOP instruction. After these, the prologue is over! */ + + int next_insn = 0xffff & read_memory_integer (here, insn_size); + here += insn_size; + if (IS_JSR_R0 (next_insn)) + { + next_insn = 0xffff & read_memory_integer (here, insn_size); + here += insn_size; + + if (IS_NOP (next_insn)) + start_pc = here; + } + } + else + break; + } + } + + return start_pc; +} + +static CORE_ADDR +sh64_skip_prologue_hard_way (CORE_ADDR start_pc) +{ + CORE_ADDR here, end; + int updated_fp = 0; + int insn_size = 4; + int media_mode = 1; + + if (!start_pc) + return 0; + + if (pc_is_isa32 (start_pc) == 0) + { + insn_size = 2; + media_mode = 0; + } + + for (here = start_pc, end = start_pc + (insn_size * 28); here < end;) + { + + if (media_mode) + { + int w = read_memory_integer (UNMAKE_ISA32_ADDR (here), insn_size); + here += insn_size; + if (IS_STQ_R18_R14 (w) || IS_STQ_R18_R15 (w) || IS_STQ_R14_R15 (w) + || IS_STL_R14_R15 (w) || IS_STL_R18_R15 (w) + || IS_ADDIL_SP_MEDIA (w) || IS_ADDI_SP_MEDIA (w) || IS_PTABSL_R18 (w)) + { + start_pc = here; + } + else if (IS_MOV_SP_FP (w) || IS_MOV_SP_FP_MEDIA(w)) + { + start_pc = here; + updated_fp = 1; + } + else + if (updated_fp) + { + /* Don't bail out yet, we may have arguments stored in + registers here, according to the debug info, so that + gdb can print the frames correctly. */ + start_pc = look_for_args_moves (here - insn_size, media_mode); + break; + } + } + else + { + int w = 0xffff & read_memory_integer (here, insn_size); + here += insn_size; + + if (IS_STS_R0 (w) || IS_STS_PR (w) + || IS_MOV_TO_R15 (w) || IS_MOV_R14 (w) + || IS_MOV_R0 (w) || IS_ADD_SP_R0 (w) || IS_MOV_R14_R0 (w)) + { + start_pc = here; + } + else if (IS_MOV_SP_FP (w)) + { + start_pc = here; + updated_fp = 1; + } + else + if (updated_fp) + { + /* Don't bail out yet, we may have arguments stored in + registers here, according to the debug info, so that + gdb can print the frames correctly. */ + start_pc = look_for_args_moves (here - insn_size, media_mode); + break; + } + } + } + + return start_pc; +} + static CORE_ADDR sh_skip_prologue (CORE_ADDR pc) { @@ -411,6 +886,12 @@ sh_use_struct_convention (int gcc_p, struct type *type) return (TYPE_LENGTH (type) > 1); } +static int +sh64_use_struct_convention (int gcc_p, struct type *type) +{ + return (TYPE_LENGTH (type) > 8); +} + /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. @@ -431,6 +912,25 @@ gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info) return print_insn_shl (memaddr, info); } +/* Disassemble an instruction. */ +static int +gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info) +{ + if (pc_is_isa32 (memaddr)) + { + /* Round down the instruction address to the appropriate boundary + before disassembling it. */ + return print_insn_sh64x_media (UNMAKE_ISA32_ADDR (memaddr), info); + } + else + { + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + return print_insn_sh (memaddr, info); + else + return print_insn_shl (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. @@ -448,6 +948,52 @@ sh_frame_chain (struct frame_info *frame) return 0; } +/* Given a register number RN as it appears in an assembly + instruction, find the corresponding register number in the GDB + scheme. */ +static int +translate_insn_rn (int rn, int media_mode) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + /* FIXME: this assumes that the number rn is for a not pseudo + register only. */ + if (media_mode) + return rn; + else + { + /* These registers don't have a corresponding compact one. */ + /* FIXME: This is probably not enough. */ +#if 0 + if ((rn >= 16 && rn <= 63) || (rn >= 93 && rn <= 140)) + return rn; +#endif + if (rn >= 0 && rn <= tdep->R0_C_REGNUM) + return tdep->R0_C_REGNUM + rn; + else + return rn; + } +} + +static CORE_ADDR +sh64_frame_chain (struct frame_info *frame) +{ + if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + return frame->frame; /* dummy frame same as caller's frame */ + if (frame->pc && !inside_entry_file (frame->pc)) + { + int media_mode = pc_is_isa32 (frame->pc); + int size; + if (gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) + size = 4; + else + size = REGISTER_RAW_SIZE (translate_insn_rn (FP_REGNUM, media_mode)); + return read_memory_integer (FRAME_FP (frame) + frame->extra_info->f_offset, size); + } + else + return 0; +} + /* Find REGNUM on the stack. Otherwise, it's in an active register. One thing we might want to do here is to check REGNUM against the clobber mask, and somehow flag it as invalid if it isn't saved on the stack somewhere. This @@ -473,6 +1019,36 @@ sh_find_callers_reg (struct frame_info *fi, int regnum) return read_register (regnum); } +static CORE_ADDR +sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) +{ + int media_mode = 0; + + for (; fi; fi = fi->next) + 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); + else + { + FRAME_INIT_SAVED_REGS (fi); + if (!fi->pc) + return 0; + + media_mode = pc_is_isa32 (fi->pc); + + if (fi->saved_regs[pr_regnum] != 0) + { + int gdb_reg_num = translate_insn_rn (pr_regnum, media_mode); + int size = ((gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) + ? 4 + : REGISTER_RAW_SIZE (gdb_reg_num)); + return read_memory_integer (fi->saved_regs[pr_regnum], size); + } + } + return read_register (pr_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 @@ -481,7 +1057,7 @@ sh_find_callers_reg (struct frame_info *fi, int regnum) static void sh_nofp_frame_init_saved_regs (struct frame_info *fi) { - int *where = (int *) alloca (NUM_REGS + NUM_PSEUDO_REGS); + int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof(int)); int rn; int have_fp = 0; int depth; @@ -620,17 +1196,214 @@ dr_reg_base_num (int dr_regnum) return fp_regnum; } +/* For pairs of floating point registers */ +static int +fpp_reg_base_num (int fpp_regnum) +{ + int fp_regnum; + + fp_regnum = FP0_REGNUM + + (fpp_regnum - gdbarch_tdep (current_gdbarch)->FPP0_REGNUM) * 2; + return fp_regnum; +} + +static int +is_media_pseudo (int rn) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + return (rn >= tdep->DR0_REGNUM + && rn <= tdep->FV_LAST_REGNUM); +} + +int +sh64_get_gdb_regnum (int gcc_regnum, CORE_ADDR pc) +{ + return translate_insn_rn (gcc_regnum, pc_is_isa32 (pc)); +} + +static int +sh64_media_reg_base_num (int reg_nr) +{ + int base_regnum = -1; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->DR_LAST_REGNUM) + base_regnum = dr_reg_base_num (reg_nr); + + else if (reg_nr >= tdep->FPP0_REGNUM + && reg_nr <= tdep->FPP_LAST_REGNUM) + base_regnum = fpp_reg_base_num (reg_nr); + + else if (reg_nr >= tdep->FV0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + base_regnum = fv_reg_base_num (reg_nr); + + return base_regnum; +} + +/* *INDENT-OFF* */ +/* + SH COMPACT MODE (ISA 16) (all pseudo) 221-272 + GDB_REGNUM BASE_REGNUM + r0_c 221 0 + r1_c 222 1 + r2_c 223 2 + r3_c 224 3 + r4_c 225 4 + r5_c 226 5 + r6_c 227 6 + r7_c 228 7 + r8_c 229 8 + r9_c 230 9 + r10_c 231 10 + r11_c 232 11 + r12_c 233 12 + r13_c 234 13 + r14_c 235 14 + r15_c 236 15 + + pc_c 237 64 + gbr_c 238 16 + mach_c 239 17 + macl_c 240 17 + pr_c 241 18 + t_c 242 19 + fpscr_c 243 76 + fpul_c 244 109 + + fr0_c 245 77 + fr1_c 246 78 + fr2_c 247 79 + fr3_c 248 80 + fr4_c 249 81 + fr5_c 250 82 + fr6_c 251 83 + fr7_c 252 84 + fr8_c 253 85 + fr9_c 254 86 + fr10_c 255 87 + fr11_c 256 88 + fr12_c 257 89 + fr13_c 258 90 + fr14_c 259 91 + fr15_c 260 92 + + dr0_c 261 77 + dr2_c 262 79 + dr4_c 263 81 + dr6_c 264 83 + dr8_c 265 85 + dr10_c 266 87 + dr12_c 267 89 + dr14_c 268 91 + + fv0_c 269 77 + fv4_c 270 81 + fv8_c 271 85 + fv12_c 272 91 +*/ +/* *INDENT-ON* */ +static int +sh64_compact_reg_base_num (int reg_nr) +{ + int base_regnum = -1; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + /* general register N maps to general register N */ + if (reg_nr >= tdep->R0_C_REGNUM + && reg_nr <= tdep->R_LAST_C_REGNUM) + base_regnum = reg_nr - tdep->R0_C_REGNUM; + + /* floating point register N maps to floating point register N */ + else if (reg_nr >= tdep->FP0_C_REGNUM + && reg_nr <= tdep->FP_LAST_C_REGNUM) + base_regnum = reg_nr - tdep->FP0_C_REGNUM + FP0_REGNUM; + + /* double prec register N maps to base regnum for double prec register N */ + else if (reg_nr >= tdep->DR0_C_REGNUM + && reg_nr <= tdep->DR_LAST_C_REGNUM) + base_regnum = dr_reg_base_num (tdep->DR0_REGNUM + + reg_nr - tdep->DR0_C_REGNUM); + + /* vector N maps to base regnum for vector register N */ + else if (reg_nr >= tdep->FV0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM) + base_regnum = fv_reg_base_num (tdep->FV0_REGNUM + + reg_nr - tdep->FV0_C_REGNUM); + + else if (reg_nr == tdep->PC_C_REGNUM) + base_regnum = PC_REGNUM; + + else if (reg_nr == tdep->GBR_C_REGNUM) + base_regnum = 16; + + else if (reg_nr == tdep->MACH_C_REGNUM + || reg_nr == tdep->MACL_C_REGNUM) + base_regnum = 17; + + else if (reg_nr == tdep->PR_C_REGNUM) + base_regnum = 18; + + else if (reg_nr == tdep->T_C_REGNUM) + base_regnum = 19; + + else if (reg_nr == tdep->FPSCR_C_REGNUM) + base_regnum = tdep->FPSCR_REGNUM; /*???? this register is a mess. */ + + else if (reg_nr == tdep->FPUL_C_REGNUM) + base_regnum = FP0_REGNUM + 32; + + return base_regnum; +} + +/* Given a register number RN (according to the gdb scheme) , return + its corresponding architectural register. In media mode, only a + subset of the registers is pseudo registers. For compact mode, all + the registers are pseudo. */ +static int +translate_rn_to_arch_reg_num (int rn, int media_mode) +{ + + if (media_mode) + { + if (!is_media_pseudo (rn)) + return rn; + else + return sh64_media_reg_base_num (rn); + } + else + /* All compact registers are pseudo. */ + return sh64_compact_reg_base_num (rn); +} + +static int +sign_extend (int value, int bits) +{ + value = value & ((1 << bits) - 1); + return (value & (1 << (bits - 1)) + ? value | (~((1 << bits) - 1)) + : value); +} + static void -sh_fp_frame_init_saved_regs (struct frame_info *fi) +sh64_nofp_frame_init_saved_regs (struct frame_info *fi) { - int *where = (int *) alloca (NUM_REGS + NUM_PSEUDO_REGS); + int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof (int)); int rn; int have_fp = 0; + int fp_regnum; + int sp_regnum; int depth; int pc; int opc; int insn; - int r3_val = 0; + int r0_val = 0; + int media_mode = 0; + int insn_size; + int gdb_register_number; + int register_number; char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame); struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); @@ -667,14 +1440,215 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) return; } - for (opc = pc + (2 * 28); pc < opc; pc += 2) + if (pc_is_isa32 (pc)) { - insn = read_memory_integer (pc, 2); - /* See where the registers will be saved to */ - if (IS_PUSH (insn)) - { - rn = GET_PUSHED_REG (insn); - where[rn] = depth; + media_mode = 1; + insn_size = 4; + } + else + { + media_mode = 0; + insn_size = 2; + } + + /* The frame pointer register is general register 14 in shmedia and + shcompact modes. In sh compact it is a pseudo register. Same goes + for the stack pointer register, which is register 15. */ + fp_regnum = translate_insn_rn (FP_REGNUM, media_mode); + sp_regnum = translate_insn_rn (SP_REGNUM, media_mode); + + for (opc = pc + (insn_size * 28); pc < opc; pc += insn_size) + { + insn = read_memory_integer (media_mode ? UNMAKE_ISA32_ADDR (pc) : pc, + insn_size); + + if (media_mode == 0) + { + if (IS_STS_PR (insn)) + { + int next_insn = read_memory_integer (pc + insn_size, insn_size); + if (IS_MOV_TO_R15 (next_insn)) + { + int reg_nr = tdep->PR_C_REGNUM; + + where[reg_nr] = depth - ((((next_insn & 0xf) ^ 0x8) - 0x8) << 2); + fi->extra_info->leaf_function = 0; + pc += insn_size; + } + } + else if (IS_MOV_R14 (insn)) + { + where[fp_regnum] = depth - ((((insn & 0xf) ^ 0x8) - 0x8) << 2); + } + + else if (IS_MOV_R0 (insn)) + { + /* Put in R0 the offset from SP at which to store some + registers. We are interested in this value, because it + will tell us where the given registers are stored within + the frame. */ + r0_val = ((insn & 0xff) ^ 0x80) - 0x80; + } + else if (IS_ADD_SP_R0 (insn)) + { + /* This instruction still prepares r0, but we don't care. + We already have the offset in r0_val. */ + } + else if (IS_STS_R0 (insn)) + { + /* Store PR at r0_val-4 from SP. Decrement r0 by 4*/ + int reg_nr = tdep->PR_C_REGNUM; + where[reg_nr] = depth - (r0_val - 4); + r0_val -= 4; + fi->extra_info->leaf_function = 0; + } + else if (IS_MOV_R14_R0 (insn)) + { + /* Store R14 at r0_val-4 from SP. Decrement r0 by 4 */ + where[fp_regnum] = depth - (r0_val - 4); + r0_val -= 4; + } + + else if (IS_ADD_SP (insn)) + { + depth -= ((insn & 0xff) ^ 0x80) - 0x80; + } + else if (IS_MOV_SP_FP (insn)) + break; + } + else + { + if (IS_ADDIL_SP_MEDIA (insn) + || IS_ADDI_SP_MEDIA (insn)) + { + depth -= sign_extend ((((insn & 0xffc00) ^ 0x80000) - 0x80000) >> 10, 9); + } + + else if (IS_STQ_R18_R15 (insn)) + { + where[tdep->PR_REGNUM] = + depth - (sign_extend ((insn & 0xffc00) >> 10, 9) << 3); + fi->extra_info->leaf_function = 0; + } + + else if (IS_STL_R18_R15 (insn)) + { + where[tdep->PR_REGNUM] = + depth - (sign_extend ((insn & 0xffc00) >> 10, 9) << 2); + fi->extra_info->leaf_function = 0; + } + + else if (IS_STQ_R14_R15 (insn)) + { + where[fp_regnum] = depth - (sign_extend ((insn & 0xffc00) >> 10, 9) << 3); + } + + else if (IS_STL_R14_R15 (insn)) + { + where[fp_regnum] = depth - (sign_extend ((insn & 0xffc00) >> 10, 9) << 2); + } + + else if (IS_MOV_SP_FP_MEDIA (insn)) + break; + } + } + + /* Now we know how deep things are, we can work out their addresses. */ + for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) + { + register_number = translate_rn_to_arch_reg_num (rn, media_mode); + + if (where[rn] >= 0) + { + if (rn == fp_regnum) + have_fp = 1; + + /* Watch out! saved_regs is only for the real registers, and + doesn't include space for the pseudo registers. */ + fi->saved_regs[register_number]= fi->frame - where[rn] + depth; + + } + else + fi->saved_regs[register_number] = 0; + } + + if (have_fp) + { + /* SP_REGNUM is 15. For shmedia 15 is the real register. For + shcompact 15 is the arch register corresponding to the pseudo + register r15 which still is the SP register. */ + /* The place on the stack where fp is stored contains the sp of + the caller. */ + /* Again, saved_registers contains only space for the real registers, + so we store in FP_REGNUM position. */ + int size; + if (tdep->sh_abi == SH_ABI_32) + size = 4; + else + size = REGISTER_RAW_SIZE (fp_regnum); + fi->saved_regs[sp_regnum] = read_memory_integer (fi->saved_regs[fp_regnum], size); + } + else + fi->saved_regs[sp_regnum] = fi->frame; + + fi->extra_info->f_offset = depth - where[fp_regnum]; +} + +static void +sh_fp_frame_init_saved_regs (struct frame_info *fi) +{ + int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof (int)); + int rn; + int have_fp = 0; + int depth; + int pc; + int opc; + int insn; + int r3_val = 0; + char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (fi->saved_regs == NULL) + frame_saved_regs_zalloc (fi); + else + memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); + + if (dummy_regs) + { + /* DANGER! This is ONLY going to work if the char buffer format of + the saved registers is byte-for-byte identical to the + CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */ + memcpy (fi->saved_regs, dummy_regs, sizeof (fi->saved_regs)); + return; + } + + fi->extra_info->leaf_function = 1; + fi->extra_info->f_offset = 0; + + for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) + where[rn] = -1; + + depth = 0; + + /* Loop around examining the prologue insns until we find something + that does not appear to be part of the prologue. But give up + after 20 of them, since we're getting silly then. */ + + pc = get_pc_function_start (fi->pc); + if (!pc) + { + fi->pc = 0; + return; + } + + for (opc = pc + (2 * 28); pc < opc; pc += 2) + { + insn = read_memory_integer (pc, 2); + /* See where the registers will be saved to */ + if (IS_PUSH (insn)) + { + rn = GET_PUSHED_REG (insn); + where[rn] = depth; depth += 4; } else if (IS_STS (insn)) @@ -785,6 +1759,137 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) } } +static void +sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) +{ + int media_mode = pc_is_isa32 (fi->pc); + + fi->extra_info = (struct frame_extra_info *) + frame_obstack_alloc (sizeof (struct frame_extra_info)); + + if (fi->next) + fi->pc = FRAME_SAVED_PC (fi->next); + + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) + { + /* 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->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4); + fi->extra_info->leaf_function = 0; + return; + } + else + { + FRAME_INIT_SAVED_REGS (fi); + fi->extra_info->return_pc = + sh64_get_saved_pr (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM); + } +} + +void +sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, + struct frame_info *frame, int regnum, + enum lval_type *lval) +{ + int media_mode; + int live_regnum = regnum; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (!target_has_registers) + error ("No registers."); + + /* Normal systems don't optimize out things with register numbers. */ + if (optimized != NULL) + *optimized = 0; + + if (addrp) /* default assumption: not found in memory */ + *addrp = 0; + + if (raw_buffer) + memset (raw_buffer, 0, sizeof (raw_buffer)); + + /* We must do this here, before the following while loop changes + frame, and makes it NULL. If this is a media register number, + but we are in compact mode, it will become the corresponding + compact pseudo register. If there is no corresponding compact + pseudo-register what do we do?*/ + media_mode = pc_is_isa32 (frame->pc); + live_regnum = translate_insn_rn (regnum, media_mode); + + /* Note: since the current frame's registers could only have been + saved by frames INTERIOR TO the current frame, we skip examining + the current frame itself: otherwise, we would be getting the + previous frame's registers which were saved by the current frame. */ + + while (frame && ((frame = frame->next) != NULL)) + { + if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + { + if (lval) /* found it in a CALL_DUMMY frame */ + *lval = not_lval; + if (raw_buffer) + memcpy (raw_buffer, + generic_find_dummy_frame (frame->pc, frame->frame) + + REGISTER_BYTE (regnum), + REGISTER_RAW_SIZE (regnum)); + return; + } + + FRAME_INIT_SAVED_REGS (frame); + if (frame->saved_regs != NULL + && frame->saved_regs[regnum] != 0) + { + if (lval) /* found it saved on the stack */ + *lval = lval_memory; + if (regnum == SP_REGNUM) + { + if (raw_buffer) /* SP register treated specially */ + store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), + frame->saved_regs[regnum]); + } + else + { /* any other register */ + + if (addrp) + *addrp = frame->saved_regs[regnum]; + if (raw_buffer) + { + int size; + if (tdep->sh_abi == SH_ABI_32 + && (live_regnum == FP_REGNUM + || live_regnum == tdep->PR_REGNUM)) + size = 4; + else + size = REGISTER_RAW_SIZE (live_regnum); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + read_memory (frame->saved_regs[regnum], raw_buffer, size); + else + read_memory (frame->saved_regs[regnum], + raw_buffer + + REGISTER_RAW_SIZE (live_regnum) + - size, + size); + } + } + return; + } + } + + /* If we get thru the loop to this point, it means the register was + not saved in any frame. Return the actual live-register value. */ + + if (lval) /* found it in a live register */ + *lval = lval_register; + if (addrp) + *addrp = REGISTER_BYTE (live_regnum); + if (raw_buffer) + read_register_gen (live_regnum, raw_buffer); +} + /* 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). */ @@ -795,6 +1900,13 @@ sh_extract_struct_value_address (char *regbuf) } static CORE_ADDR +sh64_extract_struct_value_address (char *regbuf) +{ + return (extract_address ((regbuf + REGISTER_BYTE (STRUCT_RETURN_REGNUM)), + REGISTER_RAW_SIZE (STRUCT_RETURN_REGNUM))); +} + +static CORE_ADDR sh_frame_saved_pc (struct frame_info *frame) { return ((frame)->extra_info->return_pc); @@ -828,6 +1940,47 @@ sh_pop_frame (void) flush_cached_frames (); } +/* Used in the 'return' command. */ +static void +sh64_pop_frame (void) +{ + register struct frame_info *frame = get_current_frame (); + register CORE_ADDR fp; + register int regnum; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + int media_mode = pc_is_isa32 (frame->pc); + + if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + generic_pop_dummy_frame (); + else + { + fp = FRAME_FP (frame); + FRAME_INIT_SAVED_REGS (frame); + + /* Copy regs from where they were saved in the frame */ + for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) + if (frame->saved_regs[regnum]) + { + int size; + if (tdep->sh_abi == SH_ABI_32 + && (regnum == FP_REGNUM + || regnum == tdep->PR_REGNUM)) + size = 4; + else + size = REGISTER_RAW_SIZE (translate_insn_rn (regnum, + media_mode)); + write_register (regnum, + read_memory_integer (frame->saved_regs[regnum], + size)); + } + + write_register (PC_REGNUM, frame->extra_info->return_pc); + write_register (SP_REGNUM, fp + 8); + } + flush_cached_frames (); +} + /* Function: push_arguments Setup the function arguments for calling a function in the inferior. @@ -951,6 +2104,193 @@ sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp, return sp; } +/* R2-R9 for integer types and integer equivalent (char, pointers) and + non-scalar (struct, union) elements (even if the elements are + floats). + FR0-FR11 for single precision floating point (float) + DR0-DR10 for double precision floating point (double) + + If a float is argument number 3 (for instance) and arguments number + 1,2, and 4 are integer, the mapping will be: + arg1 -->R2, arg2 --> R3, arg3 -->FR0, arg4 --> R5. I.e. R4 is not used. + + If a float is argument number 10 (for instance) and arguments number + 1 through 10 are integer, the mapping will be: + arg1->R2, arg2->R3, arg3->R4, arg4->R5, arg5->R6, arg6->R7, arg7->R8, + arg8->R9, arg9->(0,SP)stack(8-byte aligned), arg10->FR0, arg11->stack(16,SP). + I.e. there is hole in the stack. + + Different rules apply for variable arguments functions, and for functions + for which the prototype is not known. */ + +static CORE_ADDR +sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) +{ + int stack_offset, stack_alloc; + int int_argreg; + int float_argreg; + int double_argreg; + int float_arg_index = 0; + int double_arg_index = 0; + int argnum; + struct type *type; + CORE_ADDR regval; + char *val; + char valbuf[8]; + char valbuf_tmp[8]; + int len; + int argreg_size; + int fp_args[12]; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + memset (fp_args, 0, sizeof (fp_args)); + + /* first force sp to a 8-byte alignment */ + sp = sp & ~7; + + /* The "struct return pointer" pseudo-argument has its own dedicated + register */ + + if (struct_return) + write_register (STRUCT_RETURN_REGNUM, struct_addr); + + /* 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])) + 7) & ~7); + sp -= stack_alloc; /* make room on stack for args */ + + /* Now load as many as possible of the first arguments into + registers, and push the rest onto the stack. There are 64 bytes + in eight registers available. Loop thru args from first to last. */ + + int_argreg = tdep->ARG0_REGNUM; + float_argreg = FP0_REGNUM; + double_argreg = tdep->DR0_REGNUM; + + for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++) + { + type = VALUE_TYPE (args[argnum]); + len = TYPE_LENGTH (type); + memset (valbuf, 0, sizeof (valbuf)); + + if (TYPE_CODE (type) != TYPE_CODE_FLT) + { + argreg_size = REGISTER_RAW_SIZE (int_argreg); + + if (len < argreg_size) + { + /* value gets right-justified in the register or stack word */ + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + memcpy (valbuf + argreg_size - len, + (char *) VALUE_CONTENTS (args[argnum]), len); + else + memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len); + + val = valbuf; + } + else + val = (char *) VALUE_CONTENTS (args[argnum]); + + while (len > 0) + { + if (int_argreg > tdep->ARGLAST_REGNUM) + { + /* must go on the stack */ + write_memory (sp + stack_offset, val, argreg_size); + stack_offset += 8;/*argreg_size;*/ + } + /* NOTE WELL!!!!! This is not an "else if" clause!!! + That's because some *&^%$ things get passed on the stack + AND in the registers! */ + if (int_argreg <= tdep->ARGLAST_REGNUM) + { + /* there's room in a register */ + regval = extract_address (val, argreg_size); + write_register (int_argreg, regval); + } + /* Store the value 8 bytes at a time. This means that + things larger than 8 bytes may go partly in registers + and partly on the stack. FIXME: argreg is incremented + before we use its size. */ + len -= argreg_size; + val += argreg_size; + int_argreg++; + } + } + else + { + val = (char *) VALUE_CONTENTS (args[argnum]); + if (len == 4) + { + /* Where is it going to be stored? */ + while (fp_args[float_arg_index]) + float_arg_index ++; + + /* Now float_argreg points to the register where it + should be stored. Are we still within the allowed + register set? */ + if (float_arg_index <= tdep->FLOAT_ARGLAST_REGNUM) + { + /* Goes in FR0...FR11 */ + write_register_gen (FP0_REGNUM + float_arg_index, val); + fp_args[float_arg_index] = 1; + /* Skip the corresponding general argument register. */ + int_argreg ++; + } + else + ; + /* Store it as the integers, 8 bytes at the time, if + necessary spilling on the stack. */ + + } + else if (len == 8) + { + /* Where is it going to be stored? */ + while (fp_args[double_arg_index]) + double_arg_index += 2; + /* Now double_argreg points to the register + where it should be stored. + Are we still within the allowed register set? */ + if (double_arg_index < tdep->FLOAT_ARGLAST_REGNUM) + { + /* Goes in DR0...DR10 */ + /* The numbering of the DRi registers is consecutive, + i.e. includes odd numbers. */ + int double_register_offset = double_arg_index / 2; + int regnum = tdep->DR0_REGNUM + + double_register_offset; +#if 0 + if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + { + memset (valbuf_tmp, 0, sizeof (valbuf_tmp)); + REGISTER_CONVERT_TO_VIRTUAL (regnum, + type, val, valbuf_tmp); + val = valbuf_tmp; + } +#endif + /* Note: must use write_register_gen here instead + of regcache_write, because regcache_write works + only for real registers, not pseudo. + write_register_gen will call the gdbarch + function to do register writes, and that will + properly know how to deal with pseudoregs. */ + write_register_gen (regnum, val); + fp_args[double_arg_index] = 1; + fp_args[double_arg_index + 1] = 1; + /* Skip the corresponding general argument register. */ + int_argreg ++; + } + else + ; + /* Store it as the integers, 8 bytes at the time, if + necessary spilling on the stack. */ + } + } + } + return sp; +} + /* Function: push_return_address (pc) Set up the return address for the inferior function call. Needed for targets where we don't actually execute a JSR/BSR instruction */ @@ -958,7 +2298,8 @@ sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp, static CORE_ADDR sh_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { - write_register (gdbarch_tdep (current_gdbarch)->PR_REGNUM, CALL_DUMMY_ADDRESS ()); + write_register (gdbarch_tdep (current_gdbarch)->PR_REGNUM, + CALL_DUMMY_ADDRESS ()); return sp; } @@ -1067,6 +2408,59 @@ sh3e_sh4_extract_return_value (struct type *type, char *regbuf, char *valbuf) error ("bad size for return value"); } +static void +sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) +{ + int offset; + int return_register; + int len = TYPE_LENGTH (type); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (TYPE_CODE (type) == TYPE_CODE_FLT) + { + if (len == 4) + { + /* Return value stored in FP0_REGNUM */ + return_register = FP0_REGNUM; + offset = REGISTER_BYTE (return_register); + memcpy (valbuf, (char *) regbuf + offset, len); + } + else if (len == 8) + { + /* return value stored in DR0_REGNUM */ + DOUBLEST val; + + return_register = tdep->DR0_REGNUM; + offset = REGISTER_BYTE (return_register); + + if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, + (char *) regbuf + offset, &val); + else + floatformat_to_doublest (&floatformat_ieee_double_big, + (char *) regbuf + offset, &val); + store_floating (valbuf, len, val); + } + } + else + { + if (len <= 8) + { + /* Result is in register 2. If smaller than 8 bytes, it is padded + at the most significant end. */ + return_register = tdep->RETURN_REGNUM; + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + offset = REGISTER_BYTE (return_register) + + REGISTER_RAW_SIZE (return_register) - len; + else + offset = REGISTER_BYTE (return_register); + memcpy (valbuf, (char *) regbuf + offset, len); + } + else + error ("bad size for return value"); + } +} + /* Write into appropriate registers a function return value of type TYPE, given in virtual format. If the architecture is sh4 or sh3e, store a function's return value @@ -1102,6 +2496,47 @@ sh3e_sh4_store_return_value (struct type *type, char *valbuf) sh_default_store_return_value (type, valbuf); } +static void +sh64_store_return_value (struct type *type, char *valbuf) +{ + char buf[64]; /* more than enough... */ + int len = TYPE_LENGTH (type); + + if (TYPE_CODE (type) == TYPE_CODE_FLT) + { + if (len == 4) + { + /* Return value stored in FP0_REGNUM */ + write_register_gen (FP0_REGNUM, valbuf); + } + if (len == 8) + { + /* return value stored in DR0_REGNUM */ + /* FIXME: Implement */ + } + } + else + { + int return_register = gdbarch_tdep (current_gdbarch)->RETURN_REGNUM; + int offset = 0; + + if (len <= REGISTER_RAW_SIZE (return_register)) + { + /* Pad with zeros. */ + memset (buf, 0, REGISTER_RAW_SIZE (return_register)); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + offset = 0; /*REGISTER_RAW_SIZE (return_register) - len;*/ + else + offset = REGISTER_RAW_SIZE (return_register) - len; + + memcpy (buf + offset, valbuf, len); + write_register_gen (return_register, buf); + } + else + write_register_gen (return_register, valbuf); + } +} + /* Print the registers in a form similar to the E7000 */ static void @@ -1421,6 +2856,98 @@ sh_dsp_show_regs (void) (long) read_register (tdep->RE_REGNUM)); } +static void +sh64_show_media_regs (void) +{ + int i; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + printf_filtered ("PC=%s SR=%016llx \n", + paddr (read_register (PC_REGNUM)), + (long long) read_register (tdep->SR_REGNUM)); + + printf_filtered ("SSR=%016llx SPC=%016llx \n", + (long long) read_register (tdep->SSR_REGNUM), + (long long) read_register (tdep->SPC_REGNUM)); + printf_filtered ("FPSCR=%016lx\n ", + (long) read_register (tdep->FPSCR_REGNUM)); + + for (i = 0; i < 64; i = i + 4) + printf_filtered ("\nR%d-R%d %016llx %016llx %016llx %016llx\n", + i, i + 3, + (long long) read_register (i + 0), + (long long) read_register (i + 1), + (long long) read_register (i + 2), + (long long) read_register (i + 3)); + + printf_filtered ("\n"); + + for (i = 0; i < 64; i = i + 8) + printf_filtered ("FR%d-FR%d %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + i, i + 7, + (long) read_register (FP0_REGNUM + i + 0), + (long) read_register (FP0_REGNUM + i + 1), + (long) read_register (FP0_REGNUM + i + 2), + (long) read_register (FP0_REGNUM + i + 3), + (long) read_register (FP0_REGNUM + i + 4), + (long) read_register (FP0_REGNUM + i + 5), + (long) read_register (FP0_REGNUM + i + 6), + (long) read_register (FP0_REGNUM + i + 7)); +} + +static void +sh64_show_compact_regs (void) +{ + int i; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + printf_filtered ("PC=%s \n", + paddr (read_register (tdep->PC_C_REGNUM))); + + printf_filtered ("GBR=%08lx MACH=%08lx MACL=%08lx PR=%08lx T=%08lx\n", + (long) read_register (tdep->GBR_C_REGNUM), + (long) read_register (tdep->MACH_C_REGNUM), + (long) read_register (tdep->MACL_C_REGNUM), + (long) read_register (tdep->PR_C_REGNUM), + (long) read_register (tdep->T_C_REGNUM)); + printf_filtered ("FPSCR=%08lx FPUL=%08lx\n", + (long) read_register (tdep->FPSCR_REGNUM), + (long) read_register (tdep->FPUL_REGNUM)); + + for (i = 0; i < 16; i = i + 4) + printf_filtered ("\nR%d-R%d %08lx %08lx %08lx %08lx\n", + i, i + 3, + (long) read_register (i + 0), + (long) read_register (i + 1), + (long) read_register (i + 2), + (long) read_register (i + 3)); + + printf_filtered ("\n"); + + for (i = 0; i < 16; i = i + 8) + printf_filtered ("FR%d-FR%d %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + i, i + 7, + (long) read_register (FP0_REGNUM + i + 0), + (long) read_register (FP0_REGNUM + i + 1), + (long) read_register (FP0_REGNUM + i + 2), + (long) read_register (FP0_REGNUM + i + 3), + (long) read_register (FP0_REGNUM + i + 4), + (long) read_register (FP0_REGNUM + i + 5), + (long) read_register (FP0_REGNUM + i + 6), + (long) read_register (FP0_REGNUM + i + 7)); +} + +/*FIXME!!! This only shows the registers for shmedia, excluding the + pseudo registers. */ +static void +sh64_show_regs (void) +{ + if (pc_is_isa32 (selected_frame->pc)) + sh64_show_media_regs (); + else + sh64_show_compact_regs (); +} + void sh_show_regs_command (char *args, int from_tty) { if (sh_show_regs) @@ -1450,6 +2977,161 @@ sh_sh4_register_byte (int reg_nr) return (reg_nr * 4); } +/* *INDENT-OFF* */ +/* + SH MEDIA MODE (ISA 32) + general registers (64-bit) 0-63 +0 r0, r1, r2, r3, r4, r5, r6, r7, +64 r8, r9, r10, r11, r12, r13, r14, r15, +128 r16, r17, r18, r19, r20, r21, r22, r23, +192 r24, r25, r26, r27, r28, r29, r30, r31, +256 r32, r33, r34, r35, r36, r37, r38, r39, +320 r40, r41, r42, r43, r44, r45, r46, r47, +384 r48, r49, r50, r51, r52, r53, r54, r55, +448 r56, r57, r58, r59, r60, r61, r62, r63, + + pc (64-bit) 64 +512 pc, + + status reg., saved status reg., saved pc reg. (64-bit) 65-67 +520 sr, ssr, spc, + + target registers (64-bit) 68-75 +544 tr0, tr1, tr2, tr3, tr4, tr5, tr6, tr7, + + floating point state control register (32-bit) 76 +608 fpscr, + + single precision floating point registers (32-bit) 77-140 +612 fr0, fr1, fr2, fr3, fr4, fr5, fr6, fr7, +644 fr8, fr9, fr10, fr11, fr12, fr13, fr14, fr15, +676 fr16, fr17, fr18, fr19, fr20, fr21, fr22, fr23, +708 fr24, fr25, fr26, fr27, fr28, fr29, fr30, fr31, +740 fr32, fr33, fr34, fr35, fr36, fr37, fr38, fr39, +772 fr40, fr41, fr42, fr43, fr44, fr45, fr46, fr47, +804 fr48, fr49, fr50, fr51, fr52, fr53, fr54, fr55, +836 fr56, fr57, fr58, fr59, fr60, fr61, fr62, fr63, + +TOTAL SPACE FOR REGISTERS: 868 bytes + +From here on they are all pseudo registers: no memory allocated. +REGISTER_BYTE returns the register byte for the base register. + + double precision registers (pseudo) 141-172 + dr0, dr2, dr4, dr6, dr8, dr10, dr12, dr14, + dr16, dr18, dr20, dr22, dr24, dr26, dr28, dr30, + dr32, dr34, dr36, dr38, dr40, dr42, dr44, dr46, + dr48, dr50, dr52, dr54, dr56, dr58, dr60, dr62, + + floating point pairs (pseudo) 173-204 + fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14, + fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30, + fp32, fp34, fp36, fp38, fp40, fp42, fp44, fp46, + fp48, fp50, fp52, fp54, fp56, fp58, fp60, fp62, + + floating point vectors (4 floating point regs) (pseudo) 205-220 + fv0, fv4, fv8, fv12, fv16, fv20, fv24, fv28, + fv32, fv36, fv40, fv44, fv48, fv52, fv56, fv60, + + SH COMPACT MODE (ISA 16) (all pseudo) 221-272 + r0_c, r1_c, r2_c, r3_c, r4_c, r5_c, r6_c, r7_c, + r8_c, r9_c, r10_c, r11_c, r12_c, r13_c, r14_c, r15_c, + pc_c, + gbr_c, mach_c, macl_c, pr_c, t_c, + fpscr_c, fpul_c, + fr0_c, fr1_c, fr2_c, fr3_c, fr4_c, fr5_c, fr6_c, fr7_c, + fr8_c, fr9_c, fr10_c, fr11_c, fr12_c, fr13_c, fr14_c, fr15_c + dr0_c, dr2_c, dr4_c, dr6_c, dr8_c, dr10_c, dr12_c, dr14_c + fv0_c, fv4_c, fv8_c, fv12_c +*/ +/* *INDENT-ON* */ +static int +sh_sh64_register_byte (int reg_nr) +{ + int base_regnum = -1; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + /* If it is a pseudo register, get the number of the first floating + point register that is part of it. */ + if (reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->DR_LAST_REGNUM) + base_regnum = dr_reg_base_num (reg_nr); + + else if (reg_nr >= tdep->FPP0_REGNUM + && reg_nr <= tdep->FPP_LAST_REGNUM) + base_regnum = fpp_reg_base_num (reg_nr); + + else if (reg_nr >= tdep->FV0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + base_regnum = fv_reg_base_num (reg_nr); + + /* sh compact pseudo register. FPSCR is a pathological case, need to + treat it as special. */ + else if ((reg_nr >= tdep->R0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM) + && reg_nr != tdep->FPSCR_C_REGNUM) + base_regnum = sh64_compact_reg_base_num (reg_nr); + + /* Now return the offset in bytes within the register cache. */ + /* sh media pseudo register, i.e. any of DR, FFP, FV registers. */ + if (reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + return (base_regnum - FP0_REGNUM + 1) * 4 + + (tdep->TR7_REGNUM + 1) * 8; + + /* sh compact pseudo register: general register */ + if ((reg_nr >= tdep->R0_C_REGNUM + && reg_nr <= tdep->R_LAST_C_REGNUM)) + return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + ? base_regnum * 8 + 4 + : base_regnum * 8); + + /* sh compact pseudo register: */ + if (reg_nr == tdep->PC_C_REGNUM + || reg_nr == tdep->GBR_C_REGNUM + || reg_nr == tdep->MACL_C_REGNUM + || reg_nr == tdep->PR_C_REGNUM) + return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + ? base_regnum * 8 + 4 + : base_regnum * 8); + + if (reg_nr == tdep->MACH_C_REGNUM) + return base_regnum * 8; + + if (reg_nr == tdep->T_C_REGNUM) + return base_regnum * 8; /* FIXME??? how do we get bit 0? Do we have to? */ + + /* sh compact pseudo register: floating point register */ + else if (reg_nr >=tdep->FP0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM) + return (base_regnum - FP0_REGNUM) * 4 + + (tdep->TR7_REGNUM + 1) * 8 + 4; + + else if (reg_nr == tdep->FPSCR_C_REGNUM) + /* This is complicated, for now return the beginning of the + architectural FPSCR register. */ + return (tdep->TR7_REGNUM + 1) * 8; + + else if (reg_nr == tdep->FPUL_C_REGNUM) + return ((base_regnum - FP0_REGNUM) * 4 + + (tdep->TR7_REGNUM + 1) * 8 + 4); + + /* It is not a pseudo register. */ + /* It is a 64 bit register. */ + else if (reg_nr <= tdep->TR7_REGNUM) + return reg_nr * 8; + + /* It is a 32 bit register. */ + else + if (reg_nr == tdep->FPSCR_REGNUM) + return (tdep->FPSCR_REGNUM * 8); + + /* It is floating point 32-bit register */ + else + return ((tdep->TR7_REGNUM + 1) * 8 + + (reg_nr - FP0_REGNUM + 1) * 4); +} + /* Number of bytes of storage in the actual machine representation for register REG_NR. */ static int @@ -1473,6 +3155,30 @@ sh_sh4_register_raw_size (int reg_nr) return 4; } +static int +sh_sh64_register_raw_size (int reg_nr) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if ((reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->DR_LAST_REGNUM) + || (reg_nr >= tdep->FPP0_REGNUM + && reg_nr <= tdep->FPP_LAST_REGNUM) + || (reg_nr >= tdep->DR0_C_REGNUM + && reg_nr <= tdep->DR_LAST_C_REGNUM) + || (reg_nr <= tdep->TR7_REGNUM)) + return 8; + + else if ((reg_nr >= tdep->FV0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + || (reg_nr >= tdep->FV0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM)) + return 16; + + else /* this covers also the 32-bit SH compact registers. */ + return 4; +} + /* Number of bytes of storage in the program's representation for register N. */ static int @@ -1481,6 +3187,17 @@ sh_register_virtual_size (int reg_nr) return 4; } +/* ??????? FIXME */ +static int +sh_sh64_register_virtual_size (int reg_nr) +{ + if (reg_nr >= FP0_REGNUM + && reg_nr <= gdbarch_tdep (current_gdbarch)->FP_LAST_REGNUM) + return 4; + else + return 8; +} + /* Return the GDB type object for the "standard" data type of data in register N. */ static struct type * @@ -1525,6 +3242,38 @@ sh_sh4_register_virtual_type (int reg_nr) } static struct type * +sh_sh64_register_virtual_type (int reg_nr) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if ((reg_nr >= FP0_REGNUM + && reg_nr <= tdep->FP_LAST_REGNUM) + || (reg_nr >= tdep->FP0_C_REGNUM + && reg_nr <= tdep->FP_LAST_C_REGNUM)) + return builtin_type_float; + else if ((reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->DR_LAST_REGNUM) + || (reg_nr >= tdep->DR0_C_REGNUM + && reg_nr <= tdep->DR_LAST_C_REGNUM)) + return builtin_type_double; + else if (reg_nr >= tdep->FPP0_REGNUM + && reg_nr <= tdep->FPP_LAST_REGNUM) + return sh_sh4_build_float_register_type (1); + else if ((reg_nr >= tdep->FV0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + ||(reg_nr >= tdep->FV0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM)) + return sh_sh4_build_float_register_type (3); + else if (reg_nr == tdep->FPSCR_REGNUM) + return builtin_type_int; + else if (reg_nr >= tdep->R0_C_REGNUM + && reg_nr < tdep->FP0_C_REGNUM) + return builtin_type_int; + else + return builtin_type_long_long; +} + +static struct type * sh_default_register_virtual_type (int reg_nr) { return builtin_type_int; @@ -1573,6 +3322,32 @@ sh_sh4_register_convert_to_virtual (int regnum, struct type *type, error ("sh_register_convert_to_virtual called with non DR register number"); } +void +sh_sh64_register_convert_to_virtual (int regnum, struct type *type, + char *from, char *to) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) + { + /* It is a no-op. */ + memcpy (to, from, REGISTER_RAW_SIZE (regnum)); + return; + } + + if ((regnum >= tdep->DR0_REGNUM + && regnum <= tdep->DR_LAST_REGNUM) + || (regnum >= tdep->DR0_C_REGNUM + && regnum <= tdep->DR_LAST_C_REGNUM)) + { + DOUBLEST val; + floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val); + store_floating(to, TYPE_LENGTH(type), val); + } + else + error("sh_register_convert_to_virtual called with non DR register number"); +} + static void sh_sh4_register_convert_to_raw (struct type *type, int regnum, char *from, char *to) @@ -1586,59 +3361,303 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum, floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); } else - error("sh_register_convert_to_raw called with non DR register number"); + error("sh_register_convert_to_raw called with non DR register number"); +} + +void +sh_sh64_register_convert_to_raw (struct type *type, int regnum, + char *from, char *to) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) + { + /* It is a no-op. */ + memcpy (to, from, REGISTER_RAW_SIZE (regnum)); + return; + } + + if ((regnum >= tdep->DR0_REGNUM + && regnum <= tdep->DR_LAST_REGNUM) + || (regnum >= tdep->DR0_C_REGNUM + && regnum <= tdep->DR_LAST_C_REGNUM)) + { + DOUBLEST val = extract_floating (from, TYPE_LENGTH(type)); + floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); + } + else + error("sh_register_convert_to_raw called with non DR register number"); +} + +void +sh_pseudo_register_read (int reg_nr, char *buffer) +{ + int base_regnum, portion; + char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->DR_LAST_REGNUM) + { + base_regnum = dr_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + /* Read the real regs for which this one is an alias. */ + for (portion = 0; portion < 2; portion++) + regcache_read (base_regnum + portion, + temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion); + /* We must pay attention to the endiannes. */ + sh_sh4_register_convert_to_virtual (reg_nr, + REGISTER_VIRTUAL_TYPE (reg_nr), + temp_buffer, buffer); + } + else if (reg_nr >= tdep->FV0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + { + base_regnum = fv_reg_base_num (reg_nr); + + /* Read the real regs for which this one is an alias. */ + for (portion = 0; portion < 4; portion++) + regcache_read (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } +} + +static void +sh4_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer) +{ + if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) + /* It is a regular register. */ + regcache_read (reg_nr, buffer); + else + /* It is a pseudo register and we need to construct its value */ + sh_pseudo_register_read (reg_nr, buffer); +} + +static void +sh64_pseudo_register_read (int reg_nr, char *buffer) +{ + int base_regnum; + int portion; + int offset = 0; + char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (reg_nr >= tdep->DR0_REGNUM + && reg_nr <= tdep->DR_LAST_REGNUM) + { + base_regnum = dr_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + /* DR regs are double precision registers obtained by + concatenating 2 single precision floating point registers. */ + for (portion = 0; portion < 2; portion++) + regcache_read (base_regnum + portion, + temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion); + + /* We must pay attention to the endiannes. */ + sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), + temp_buffer, buffer); + + } + + else if (reg_nr >= tdep->FPP0_REGNUM + && reg_nr <= tdep->FPP_LAST_REGNUM) + { + base_regnum = fpp_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + /* FPP regs are pairs of single precision registers obtained by + concatenating 2 single precision floating point registers. */ + for (portion = 0; portion < 2; portion++) + regcache_read (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } + + else if (reg_nr >= tdep->FV0_REGNUM + && reg_nr <= tdep->FV_LAST_REGNUM) + { + base_regnum = fv_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + /* FV regs are vectors of single precision registers obtained by + concatenating 4 single precision floating point registers. */ + for (portion = 0; portion < 4; portion++) + regcache_read (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } + + /* sh compact pseudo registers. 1-to-1 with a shmedia register */ + else if (reg_nr >= tdep->R0_C_REGNUM + && reg_nr <= tdep->T_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + regcache_read (base_regnum, temp_buffer); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + offset = 4; + memcpy (buffer, temp_buffer + offset, 4); /* get LOWER 32 bits only????*/ + } + + else if (reg_nr >= tdep->FP0_C_REGNUM + && reg_nr <= tdep->FP_LAST_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + /* Floating point registers map 1-1 to the media fp regs, + they have the same size and endienness. */ + regcache_read (base_regnum, buffer); + } + + else if (reg_nr >= tdep->DR0_C_REGNUM + && reg_nr <= tdep->DR_LAST_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + + /* DR_C regs are double precision registers obtained by + concatenating 2 single precision floating point registers. */ + for (portion = 0; portion < 2; portion++) + regcache_read (base_regnum + portion, + temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion); + + /* We must pay attention to the endiannes. */ + sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), + temp_buffer, buffer); + } + + else if (reg_nr >= tdep->FV0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + + /* Build the value in the provided buffer. */ + /* FV_C regs are vectors of single precision registers obtained by + concatenating 4 single precision floating point registers. */ + for (portion = 0; portion < 4; portion++) + regcache_read (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } + + else if (reg_nr == tdep->FPSCR_C_REGNUM) + { + int fpscr_base_regnum; + int sr_base_regnum; + unsigned int fpscr_value; + unsigned int sr_value; + unsigned int fpscr_c_value; + unsigned int fpscr_c_part1_value; + unsigned int fpscr_c_part2_value; + + fpscr_base_regnum = tdep->FPSCR_REGNUM; + sr_base_regnum = tdep->SR_REGNUM; + + /* Build the value in the provided buffer. */ + /* FPSCR_C is a very weird register that contains sparse bits + from the FPSCR and the SR architectural registers. + Specifically: */ + /* *INDENT-OFF* */ + /* + FPSRC_C bit + 0 Bit 0 of FPSCR + 1 reserved + 2-17 Bit 2-18 of FPSCR + 18-20 Bits 12,13,14 of SR + 21-31 reserved + */ + /* *INDENT-ON* */ + /* Get FPSCR into a local buffer */ + regcache_read (fpscr_base_regnum, temp_buffer); + /* Get value as an int. */ + fpscr_value = extract_unsigned_integer (temp_buffer, 4); + /* Get SR into a local buffer */ + regcache_read (sr_base_regnum, temp_buffer); + /* Get value as an int. */ + sr_value = extract_unsigned_integer (temp_buffer, 4); + /* Build the new value. */ + fpscr_c_part1_value = fpscr_value & 0x3fffd; + fpscr_c_part2_value = (sr_value & 0x7000) << 6; + fpscr_c_value = fpscr_c_part1_value | fpscr_c_part2_value; + /* Store that in out buffer!!! */ + store_unsigned_integer (buffer, 4, fpscr_c_value); + /* FIXME There is surely an endianness gotcha here. */ + } + + else if (reg_nr == tdep->FPUL_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + + /* FPUL_C register is floating point register 32, + same size, same endianness. */ + regcache_read (base_regnum, buffer); + } +} + +static void +sh64_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer) +{ + + if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) + /* It is a regular register. */ + regcache_read (reg_nr, buffer); + else + /* It is a pseudo register and we need to construct its value */ + sh64_pseudo_register_read (reg_nr, buffer); } void -sh_pseudo_register_read (int reg_nr, char *buffer) +sh_pseudo_register_write (int reg_nr, char *buffer) { int base_regnum, portion; char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (reg_nr >= tdep->DR0_REGNUM + if (reg_nr >= tdep->DR0_REGNUM && reg_nr <= tdep->DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ - /* Read the real regs for which this one is an alias. */ - for (portion = 0; portion < 2; portion++) - regcache_read (base_regnum + portion, - temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion); /* We must pay attention to the endiannes. */ - sh_sh4_register_convert_to_virtual (reg_nr, - REGISTER_VIRTUAL_TYPE (reg_nr), - temp_buffer, buffer); + sh_sh4_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, + buffer, temp_buffer); + + /* Write the real regs for which this one is an alias. */ + for (portion = 0; portion < 2; portion++) + regcache_write (base_regnum + portion, + temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } - else if (reg_nr >= tdep->FV0_REGNUM + else if (reg_nr >= tdep->FV0_REGNUM && reg_nr <= tdep->FV_LAST_REGNUM) { base_regnum = fv_reg_base_num (reg_nr); - /* Read the real regs for which this one is an alias. */ + /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 4; portion++) - regcache_read (base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_write (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } } static void -sh4_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer) +sh4_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer) { if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) /* It is a regular register. */ - regcache_read (reg_nr, buffer); + regcache_write (reg_nr, buffer); else /* It is a pseudo register and we need to construct its value */ - sh_pseudo_register_read (reg_nr, buffer); + sh_pseudo_register_write (reg_nr, buffer); } void -sh_pseudo_register_write (int reg_nr, char *buffer) +sh64_pseudo_register_write (int reg_nr, char *buffer) { int base_regnum, portion; + int offset; char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); @@ -1646,16 +3665,28 @@ sh_pseudo_register_write (int reg_nr, char *buffer) && reg_nr <= tdep->DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); - /* We must pay attention to the endiannes. */ - sh_sh4_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, - buffer, temp_buffer); + sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, + buffer, temp_buffer); + /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) regcache_write (base_regnum + portion, temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } + + else if (reg_nr >= tdep->FPP0_REGNUM + && reg_nr <= tdep->FPP_LAST_REGNUM) + { + base_regnum = fpp_reg_base_num (reg_nr); + + /* Write the real regs for which this one is an alias. */ + for (portion = 0; portion < 2; portion++) + regcache_write (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } + else if (reg_nr >= tdep->FV0_REGNUM && reg_nr <= tdep->FV_LAST_REGNUM) { @@ -1666,17 +3697,132 @@ sh_pseudo_register_write (int reg_nr, char *buffer) regcache_write (base_regnum + portion, buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } + + /* sh compact general pseudo registers. 1-to-1 with a shmedia + register but only 4 bytes of it. */ + else if (reg_nr >= tdep->R0_C_REGNUM + && reg_nr <= tdep->T_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + /* reg_nr is 32 bit here, and base_regnum is 64 bits. */ + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + offset = 4; + else + offset = 0; + /* Let's read the value of the base register into a temporary + buffer, so that overwriting the last four bytes with the new + value of the pseudo will leave the upper 4 bytes unchanged. */ + regcache_read (base_regnum, temp_buffer); + /* Write as an 8 byte quantity */ + memcpy (temp_buffer + offset, buffer, 4); + regcache_write (base_regnum, temp_buffer); + } + + /* sh floating point compact pseudo registers. 1-to-1 with a shmedia + registers. Both are 4 bytes. */ + else if (reg_nr >= tdep->FP0_C_REGNUM + && reg_nr <= tdep->FP_LAST_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + regcache_write (base_regnum, buffer); + } + + else if (reg_nr >= tdep->DR0_C_REGNUM + && reg_nr <= tdep->DR_LAST_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + for (portion = 0; portion < 2; portion++) + { + /* We must pay attention to the endiannes. */ + sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, + buffer, temp_buffer); + + regcache_write (base_regnum + portion, + temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } + } + + else if (reg_nr >= tdep->FV0_C_REGNUM + && reg_nr <= tdep->FV_LAST_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + + for (portion = 0; portion < 4; portion++) + { + regcache_write (base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + } + } + + else if (reg_nr == tdep->FPSCR_C_REGNUM) + { + int fpscr_base_regnum; + int sr_base_regnum; + unsigned int fpscr_value; + unsigned int sr_value; + unsigned int old_fpscr_value; + unsigned int old_sr_value; + unsigned int fpscr_c_value; + unsigned int fpscr_mask; + unsigned int sr_mask; + + fpscr_base_regnum = tdep->FPSCR_REGNUM; + sr_base_regnum = tdep->SR_REGNUM; + + /* FPSCR_C is a very weird register that contains sparse bits + from the FPSCR and the SR architectural registers. + Specifically: */ + /* *INDENT-OFF* */ + /* + FPSRC_C bit + 0 Bit 0 of FPSCR + 1 reserved + 2-17 Bit 2-18 of FPSCR + 18-20 Bits 12,13,14 of SR + 21-31 reserved + */ + /* *INDENT-ON* */ + /* Get value as an int. */ + fpscr_c_value = extract_unsigned_integer (buffer, 4); + + /* Build the new values. */ + fpscr_mask = 0x0003fffd; + sr_mask = 0x001c0000; + + fpscr_value = fpscr_c_value & fpscr_mask; + sr_value = (fpscr_value & sr_mask) >> 6; + + regcache_read (fpscr_base_regnum, temp_buffer); + old_fpscr_value = extract_unsigned_integer (temp_buffer, 4); + old_fpscr_value &= 0xfffc0002; + fpscr_value |= old_fpscr_value; + store_unsigned_integer (temp_buffer, 4, fpscr_value); + regcache_write (fpscr_base_regnum, temp_buffer); + + regcache_read (sr_base_regnum, temp_buffer); + old_sr_value = extract_unsigned_integer (temp_buffer, 4); + old_sr_value &= 0xffff8fff; + sr_value |= old_sr_value; + store_unsigned_integer (temp_buffer, 4, sr_value); + regcache_write (sr_base_regnum, temp_buffer); + } + + else if (reg_nr == tdep->FPUL_C_REGNUM) + { + base_regnum = sh64_compact_reg_base_num (reg_nr); + regcache_write (base_regnum, buffer); + } } static void -sh4_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer) +sh64_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer) { if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) /* It is a regular register. */ regcache_write (reg_nr, buffer); else /* It is a pseudo register and we need to construct its value */ - sh_pseudo_register_write (reg_nr, buffer); + sh64_pseudo_register_write (reg_nr, buffer); } /* Floating point vector of 4 float registers. */ @@ -1692,6 +3838,32 @@ do_fv_register_info (int fv_regnum) (int) read_register (first_fp_reg_num + 3)); } +/* Floating point vector of 4 float registers, compact mode. */ +static void +do_fv_c_register_info (int fv_regnum) +{ + int first_fp_reg_num = sh64_compact_reg_base_num (fv_regnum); + printf_filtered ("fv%d_c\t0x%08x\t0x%08x\t0x%08x\t0x%08x\n", + fv_regnum - gdbarch_tdep (current_gdbarch)->FV0_C_REGNUM, + (int) read_register (first_fp_reg_num), + (int) read_register (first_fp_reg_num + 1), + (int) read_register (first_fp_reg_num + 2), + (int) read_register (first_fp_reg_num + 3)); +} + +/* Pairs of single regs. The DR are instead double precision + registers. */ +static void +do_fpp_register_info (int fpp_regnum) +{ + int first_fp_reg_num = fpp_reg_base_num (fpp_regnum); + + printf_filtered ("fpp%d\t0x%08x\t0x%08x\n", + fpp_regnum - gdbarch_tdep (current_gdbarch)->FPP0_REGNUM, + (int) read_register (first_fp_reg_num), + (int) read_register (first_fp_reg_num + 1)); +} + /* Double precision registers. */ static void do_dr_register_info (int dr_regnum) @@ -1704,6 +3876,56 @@ do_dr_register_info (int dr_regnum) (int) read_register (first_fp_reg_num + 1)); } +/* Double precision registers, compact mode. */ +static void +do_dr_c_register_info (int dr_regnum) +{ + int first_fp_reg_num = sh64_compact_reg_base_num (dr_regnum); + + printf_filtered ("dr%d_c\t0x%08x%08x\n", + dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_C_REGNUM, + (int) read_register (first_fp_reg_num), + (int) read_register (first_fp_reg_num +1)); +} + +/* General register in compact mode. */ +static void +do_r_c_register_info (int r_c_regnum) +{ + int regnum = sh64_compact_reg_base_num (r_c_regnum); + + printf_filtered ("r%d_c\t0x%08x\n", + r_c_regnum - gdbarch_tdep (current_gdbarch)->R0_C_REGNUM, + /*FIXME!!!*/ (int) read_register (regnum)); +} + +/* FIXME:!! THIS SHOULD TAKE CARE OF GETTING THE RIGHT PORTION OF THE + shmedia REGISTERS. */ +/* Control registers, compact mode. */ +static void +do_cr_c_register_info (int cr_c_regnum) +{ + switch (cr_c_regnum) + { + case 237: printf_filtered ("pc_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 238: printf_filtered ("gbr_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 239: printf_filtered ("mach_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 240: printf_filtered ("macl_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 241: printf_filtered ("pr_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 242: printf_filtered ("t_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 243: printf_filtered ("fpscr_c\t0x%08x\n", (int) read_register (cr_c_regnum)); + break; + case 244: printf_filtered ("fpul_c\t0x%08x\n", (int)read_register (cr_c_regnum)); + break; + } +} + static void sh_do_pseudo_register (int regnum) { @@ -1761,6 +3983,51 @@ sh_do_fp_register (int regnum) } static void +sh64_do_pseudo_register (int regnum) +{ + /* All the sh64-compact mode registers are pseudo registers. */ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (regnum < NUM_REGS + || regnum >= NUM_REGS + NUM_PSEUDO_REGS_SH_MEDIA + NUM_PSEUDO_REGS_SH_COMPACT) + internal_error (__FILE__, __LINE__, + "Invalid pseudo register number %d\n", regnum); + + else if ((regnum >= tdep->DR0_REGNUM + && regnum <= tdep->DR_LAST_REGNUM)) + do_dr_register_info (regnum); + + else if ((regnum >= tdep->DR0_C_REGNUM + && regnum <= tdep->DR_LAST_C_REGNUM)) + do_dr_c_register_info (regnum); + + else if ((regnum >= tdep->FV0_REGNUM + && regnum <= tdep->FV_LAST_REGNUM)) + do_fv_register_info (regnum); + + else if ((regnum >= tdep->FV0_C_REGNUM + && regnum <= tdep->FV_LAST_C_REGNUM)) + do_fv_c_register_info (regnum); + + else if (regnum >= tdep->FPP0_REGNUM + && regnum <= tdep->FPP_LAST_REGNUM) + do_fpp_register_info (regnum); + + else if (regnum >= tdep->R0_C_REGNUM + && regnum <= tdep->R_LAST_C_REGNUM) + do_r_c_register_info (regnum); /* FIXME, this function will not print the right format */ + + else if (regnum >= tdep->FP0_C_REGNUM + && regnum <= tdep->FP_LAST_C_REGNUM) + sh_do_fp_register (regnum); /* this should work also for pseudoregs */ + + else if (regnum >= tdep->PC_C_REGNUM + && regnum <= tdep->FPUL_C_REGNUM) + do_cr_c_register_info (regnum); + +} + +static void sh_do_register (int regnum) { char raw_buffer[MAX_REGISTER_RAW_SIZE]; @@ -1851,6 +4118,41 @@ sh_do_registers_info (int regnum, int fpregs) } } +void +sh_compact_do_registers_info (int regnum, int fpregs) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + if (regnum != -1) /* do one specified register */ + { + if (*(REGISTER_NAME (regnum)) == '\0') + error ("Not a valid register for the current processor type"); + + if (regnum >= 0 && regnum < tdep->R0_C_REGNUM) + error ("Not a valid register for the current processor mode."); + + sh_print_register (regnum); + } + else + /* do all compact registers */ + { + regnum = tdep->R0_C_REGNUM; + while (regnum < NUM_REGS + NUM_PSEUDO_REGS) + { + do_pseudo_register (regnum); + regnum++; + } + } +} + +void +sh64_do_registers_info (int regnum, int fpregs) +{ + if (pc_is_isa32 (selected_frame->pc)) + sh_do_registers_info (regnum, fpregs); + else + sh_compact_do_registers_info (regnum, fpregs); +} + #ifdef SVR4_SHARED_LIBS /* Fetch (and possibly build) an appropriate link_map_offsets structure @@ -1895,6 +4197,176 @@ sh_linux_svr4_fetch_link_map_offsets (void) } #endif /* SVR4_SHARED_LIBS */ + +/* This table matches the indices assigned to enum sh_osabi. Keep + them in sync. */ +static const char * const sh_osabi_names[] = +{ + "", + "GNU/Linux", + "NetBSD ELF", + NULL +}; + +static void +process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) +{ + enum sh_osabi *os_ident_ptr = obj; + const char *name; + unsigned int sectsize; + + name = bfd_get_section_name (abfd, sect); + sectsize = bfd_section_size (abfd, sect); + + if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) + { + unsigned int name_length, data_length, note_type; + char *note; + + /* If the section is larger than this, it's probably not what we are + looking for. */ + if (sectsize > 128) + sectsize = 128; + + note = alloca (sectsize); + + bfd_get_section_contents (abfd, sect, note, + (file_ptr) 0, (bfd_size_type) sectsize); + + name_length = bfd_h_get_32 (abfd, note); + data_length = bfd_h_get_32 (abfd, note + 4); + note_type = bfd_h_get_32 (abfd, note + 8); + + if (name_length == 4 && data_length == 16 && note_type == NT_GNU_ABI_TAG + && strcmp (note + 12, "GNU") == 0) + { + int os_number = bfd_h_get_32 (abfd, note + 16); + + /* The case numbers are from abi-tags in glibc. */ + switch (os_number) + { + case GNU_ABI_TAG_LINUX: + *os_ident_ptr = SH_OSABI_LINUX; + break; + + case GNU_ABI_TAG_HURD: + internal_error + (__FILE__, __LINE__, + "process_note_abi_sections: Hurd objects not supported"); + break; + + case GNU_ABI_TAG_SOLARIS: + internal_error + (__FILE__, __LINE__, + "process_note_abi_sections: Solaris objects not supported"); + break; + + default: + internal_error + (__FILE__, __LINE__, + "process_note_abi_sections: unknown OS number %d", + os_number); + } + } + } + /* NetBSD uses a similar trick. */ + else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0) + { + unsigned int name_length, desc_length, note_type; + char *note; + + /* If the section is larger than this, it's probably not what we are + looking for. */ + if (sectsize > 128) + sectsize = 128; + + note = alloca (sectsize); + + bfd_get_section_contents (abfd, sect, note, + (file_ptr) 0, (bfd_size_type) sectsize); + + name_length = bfd_h_get_32 (abfd, note); + desc_length = bfd_h_get_32 (abfd, note + 4); + note_type = bfd_h_get_32 (abfd, note + 8); + + if (name_length == 7 && desc_length == 4 && note_type == NT_NETBSD_IDENT + && strcmp (note + 12, "NetBSD") == 0) + /* XXX Should we check the version here? + Probably not necessary yet. */ + *os_ident_ptr = SH_OSABI_NETBSD_ELF; + } +} + +static int +get_elfosabi (bfd *abfd) +{ + int elfosabi; + enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN; + + elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; + + switch (elfosabi) + { + case ELFOSABI_NONE: + /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate + that we're on a SYSV system. However, some systems use note sections + to record OS/ABI info, but leave e_ident[EI_OSABI] zero. So we + have to check the note sections too. */ + bfd_map_over_sections (abfd, + process_note_abi_tag_sections, + &sh_osabi); + break; + + case ELFOSABI_NETBSD: + sh_osabi = SH_OSABI_NETBSD_ELF; + break; + + case ELFOSABI_LINUX: + sh_osabi = SH_OSABI_LINUX; + break; + } + + return (sh_osabi); +} + +struct sh_osabi_handler +{ + struct sh_osabi_handler *next; + enum sh_osabi abi; + void (*init_osabi)(struct gdbarch_info, struct gdbarch *); +}; + +struct sh_osabi_handler *sh_osabi_handler_list = NULL; + +void +sh_gdbarch_register_os_abi (enum sh_osabi abi, + void (*init_osabi)(struct gdbarch_info, + struct gdbarch *)) +{ + struct sh_osabi_handler **handler_p; + + for (handler_p = &sh_osabi_handler_list; *handler_p != NULL; + handler_p = &(*handler_p)->next) + { + if ((*handler_p)->abi == abi) + { + internal_error + (__FILE__, __LINE__, + "sh_gdbarch_register_os_abi: A handler for this ABI variant " + "(%d) has already been registered", (int) abi); + /* If user wants to continue, override previous definition. */ + (*handler_p)->init_osabi = init_osabi; + return; + } + } + + (*handler_p) + = (struct sh_osabi_handler *) xmalloc (sizeof (struct sh_osabi_handler)); + (*handler_p)->next = NULL; + (*handler_p)->abi = abi; + (*handler_p)->init_osabi = init_osabi; +} + static gdbarch_init_ftype sh_gdbarch_init; static struct gdbarch * @@ -1906,17 +4378,51 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch_register_name_ftype *sh_register_name; gdbarch_store_return_value_ftype *sh_store_return_value; gdbarch_register_virtual_type_ftype *sh_register_virtual_type; + enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN; + struct sh_osabi_handler *osabi_handler; + + /* Try to determine the ABI of the object we are loading. */ + + if (info.abfd != NULL) + { + switch (bfd_get_flavour (info.abfd)) + { + case bfd_target_elf_flavour: + sh_osabi = get_elfosabi (info.abfd); + break; + + default: + /* Just leave it as "unkown". */ + break; + } + } /* Find a candidate among the list of pre-declared architectures. */ - arches = gdbarch_list_lookup_by_info (arches, &info); - if (arches != NULL) - return arches->gdbarch; + for (arches = gdbarch_list_lookup_by_info (arches, &info); + arches != NULL; + arches = gdbarch_list_lookup_by_info (arches->next, &info)) + { + /* Make sure the ABI selection matches. */ + tdep = gdbarch_tdep (arches->gdbarch); + if (tdep && tdep->sh_osabi == sh_osabi) + return arches->gdbarch; + } /* None found, create a new architecture from the information provided. */ tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); + tdep->sh_osabi = sh_osabi; + if (sh_osabi < SH_OSABI_INVALID) + tdep->osabi_name = sh_osabi_names[sh_osabi]; + else + { + internal_error (__FILE__, __LINE__, "Invalid setting of sh_osabi %d", + (int) sh_osabi); + tdep->osabi_name = ""; + } + /* Initialize the register numbers that are not common to all the variants to -1, if necessary thse will be overwritten in the case statement below. */ @@ -1950,6 +4456,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->RETURN_REGNUM = 0; tdep->FLOAT_ARGLAST_REGNUM = -1; + tdep->sh_abi = SH_ABI_UNKNOWN; + set_gdbarch_fp0_regnum (gdbarch, -1); set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_max_register_raw_size (gdbarch, 4); @@ -2104,6 +4612,105 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->FV0_REGNUM = 67; tdep->FV_LAST_REGNUM = 70; break; + case bfd_mach_sh5: + tdep->PR_REGNUM = 18; + tdep->SR_REGNUM = 65; + tdep->FPSCR_REGNUM = SIM_SH64_FPCSR_REGNUM; + tdep->FP_LAST_REGNUM = SIM_SH64_FR0_REGNUM + SIM_SH64_NR_FP_REGS - 1; + tdep->SSR_REGNUM = SIM_SH64_SSR_REGNUM; + tdep->SPC_REGNUM = SIM_SH64_SPC_REGNUM; + tdep->TR7_REGNUM = SIM_SH64_TR0_REGNUM + 7; + tdep->FPP0_REGNUM = 173; + tdep->FPP_LAST_REGNUM = 204; + tdep->DR0_REGNUM = 141; + tdep->DR_LAST_REGNUM = 172; + tdep->FV0_REGNUM = 205; + tdep->FV_LAST_REGNUM = 220; + tdep->R0_C_REGNUM = 221; + tdep->R_LAST_C_REGNUM = 236; + tdep->PC_C_REGNUM = 237; + tdep->GBR_C_REGNUM = 238; + tdep->MACH_C_REGNUM = 239; + tdep->MACL_C_REGNUM = 240; + tdep->PR_C_REGNUM = 241; + tdep->T_C_REGNUM = 242; + tdep->FPSCR_C_REGNUM = 243; + tdep->FPUL_C_REGNUM = 244; + tdep->FP0_C_REGNUM = 245; + tdep->FP_LAST_C_REGNUM = 260; + tdep->DR0_C_REGNUM = 261; + tdep->DR_LAST_C_REGNUM = 268; + tdep->FV0_C_REGNUM = 269; + tdep->FV_LAST_C_REGNUM = 272; + tdep->ARG0_REGNUM = 2; + tdep->ARGLAST_REGNUM = 9; + tdep->RETURN_REGNUM = 2; + tdep->FLOAT_ARGLAST_REGNUM = 11; + + set_gdbarch_num_pseudo_regs (gdbarch, NUM_PSEUDO_REGS_SH_MEDIA + NUM_PSEUDO_REGS_SH_COMPACT); + set_gdbarch_fp0_regnum (gdbarch, SIM_SH64_FR0_REGNUM); + set_gdbarch_pc_regnum (gdbarch, 64); + + /* Determine the ABI */ + if (bfd_get_arch_size (info.abfd) == 64) + { + /* If the ABI is the 64-bit one, it can only be sh-media. */ + tdep->sh_abi = SH_ABI_64; + set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT); + set_gdbarch_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); + } + else + { + /* If the ABI is the 32-bit one it could be either media or + compact. */ + tdep->sh_abi = SH_ABI_32; + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); + } + + /* the number of real registers is the same whether we are in + ISA16(compact) or ISA32(media). */ + set_gdbarch_num_regs (gdbarch, SIM_SH64_NR_REGS); + set_gdbarch_register_size (gdbarch, 8); /*????*/ + set_gdbarch_register_bytes (gdbarch, + ((SIM_SH64_NR_FP_REGS + 1) * 4) + + (SIM_SH64_NR_REGS - SIM_SH64_NR_FP_REGS -1) * 8); + + sh_register_name = sh_sh64_register_name; + sh_show_regs = sh64_show_regs; + sh_register_virtual_type = sh_sh64_register_virtual_type; + sh_store_return_value = sh64_store_return_value; + skip_prologue_hard_way = sh64_skip_prologue_hard_way; + do_pseudo_register = sh64_do_pseudo_register; + set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64); + set_gdbarch_register_raw_size (gdbarch, sh_sh64_register_raw_size); + set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size); + set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte); + /* This seems awfully wrong!*/ + /*set_gdbarch_max_register_raw_size (gdbarch, 8);*/ + /* should include the size of the pseudo regs. */ + set_gdbarch_max_register_raw_size (gdbarch, 4 * 4); + /* Or should that go in the virtual_size? */ + /*set_gdbarch_max_register_virtual_size (gdbarch, 8);*/ + set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4); + set_gdbarch_register_read (gdbarch, sh64_register_read); + set_gdbarch_register_write (gdbarch, sh64_register_write); + + set_gdbarch_do_registers_info (gdbarch, sh64_do_registers_info); + set_gdbarch_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs); + set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc); + set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info); + set_gdbarch_frame_chain (gdbarch, sh64_frame_chain); + set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register); + set_gdbarch_extract_return_value (gdbarch, sh64_extract_return_value); + set_gdbarch_push_arguments (gdbarch, sh64_push_arguments); + /*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/ + set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); + set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention); + set_gdbarch_pop_frame (gdbarch, sh64_pop_frame); + set_gdbarch_elf_make_msymbol_special (gdbarch, + sh64_elf_make_msymbol_special); + break; default: sh_register_name = sh_generic_register_name; sh_show_regs = sh_generic_show_regs; @@ -2167,15 +4774,58 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_believe_pcc_promotion (gdbarch, 1); + /* Hook in ABI-specific overrides, if they have been registered. If + the ABI is unknown, this is probably an embedded target, so we + should not warn about this situation. */ + if (sh_osabi != SH_OSABI_UNKNOWN) + { + for (osabi_handler = sh_osabi_handler_list; osabi_handler != NULL; + osabi_handler = osabi_handler->next) + if (osabi_handler->abi == sh_osabi) + break; + + if (osabi_handler) + osabi_handler->init_osabi (info, gdbarch); + else + { + /* We assume that if GDB_MULTI_ARCH is less than + GDB_MULTI_ARCH_TM that an ABI variant can be supported by + overriding definitions in this file. */ + if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + fprintf_filtered + (gdb_stderr, + "A handler for the ABI variant \"%s\" is not built into this " + "configuration of GDB. " + "Attempting to continue with the default SuperH settings", + sh_osabi_names[sh_osabi]); + } + } + return gdbarch; } +static void +sh_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (tdep == NULL) + return; + + if (tdep->osabi_name != NULL) + fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n", tdep->osabi_name); + else + internal_error (__FILE__, __LINE__, + "sh_dump_tdep: illegal setting of tdep->sh_osabi (%d)", + (int) tdep->sh_osabi); +} + void _initialize_sh_tdep (void) { struct cmd_list_element *c; - register_gdbarch_init (bfd_arch_sh, sh_gdbarch_init); + gdbarch_register (bfd_arch_sh, sh_gdbarch_init, sh_dump_tdep); add_com ("regs", class_vars, sh_show_regs_command, "Print all registers"); } diff --git a/gdb/shnbsd-nat.c b/gdb/shnbsd-nat.c new file mode 100644 index 0000000..e1b56e6 --- /dev/null +++ b/gdb/shnbsd-nat.c @@ -0,0 +1,76 @@ +/* Native-dependent code for SuperH running NetBSD, for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 +#include +#include + +#include "defs.h" +#include "inferior.h" + +#include "shnbsd-tdep.h" + +/* Determine if PT_GETREGS fetches this register. */ +#define GETREGS_SUPPLIES(regno) \ + (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \ +|| (regno) == PC_REGNUM || (regno) == PR_REGNUM \ +|| (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \ +|| (regno) == SR_REGNUM) + +void +fetch_inferior_registers (int regno) +{ + if (regno == -1 || GETREGS_SUPPLIES (regno)) + { + struct reg inferior_registers; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &inferior_registers, 0) == -1) + perror_with_name ("Couldn't get registers"); + + shnbsd_supply_reg ((char *) &inferior_registers, regno); + + if (regno != -1) + return; + } +} + +void +store_inferior_registers (int regno) +{ + if (regno == -1 || GETREGS_SUPPLIES (regno)) + { + struct reg inferior_registers; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &inferior_registers, 0) == -1) + perror_with_name ("Couldn't get registers"); + + shnbsd_fill_reg ((char *) &inferior_registers, regno); + + if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &inferior_registers, 0) == -1) + perror_with_name ("Couldn't set registers"); + + if (regno != -1) + return; + } +} diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c new file mode 100644 index 0000000..5f9903d --- /dev/null +++ b/gdb/shnbsd-tdep.c @@ -0,0 +1,180 @@ +/* Target-dependent code for SuperH running NetBSD, for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 "gdbcore.h" +#include "regcache.h" +#include "value.h" + +#include "nbsd-tdep.h" +#include "shnbsd-tdep.h" + +/* Convert an r0-r15 register number into an offset into a ptrace + register structure. */ +static const int regmap[] = +{ + (20 * 4), /* r0 */ + (19 * 4), /* r1 */ + (18 * 4), /* r2 */ + (17 * 4), /* r3 */ + (16 * 4), /* r4 */ + (15 * 4), /* r5 */ + (14 * 4), /* r6 */ + (13 * 4), /* r7 */ + (12 * 4), /* r8 */ + (11 * 4), /* r9 */ + (10 * 4), /* r10 */ + ( 9 * 4), /* r11 */ + ( 8 * 4), /* r12 */ + ( 7 * 4), /* r13 */ + ( 6 * 4), /* r14 */ + ( 5 * 4), /* r15 */ +}; + +#define SIZEOF_STRUCT_REG (21 * 4) + +void +shnbsd_supply_reg (char *regs, int regno) +{ + int i; + + if (regno == PC_REGNUM || regno == -1) + supply_register (PC_REGNUM, regs + (0 * 4)); + + if (regno == SR_REGNUM || regno == -1) + supply_register (SR_REGNUM, regs + (1 * 4)); + + if (regno == PR_REGNUM || regno == -1) + supply_register (PR_REGNUM, regs + (2 * 4)); + + if (regno == MACH_REGNUM || regno == -1) + supply_register (MACH_REGNUM, regs + (3 * 4)); + + if (regno == MACL_REGNUM || regno == -1) + supply_register (MACL_REGNUM, regs + (4 * 4)); + + if ((regno >= R0_REGNUM && regno <= (R0_REGNUM + 15)) || regno == -1) + { + for (i = R0_REGNUM; i <= (R0_REGNUM + 15); i++) + if (regno == i || regno == -1) + supply_register (i, regs + regmap[i - R0_REGNUM]); + } +} + +void +shnbsd_fill_reg (char *regs, int regno) +{ + int i; + + if (regno == PC_REGNUM || regno == -1) + regcache_collect (PC_REGNUM, regs + (0 * 4)); + + if (regno == SR_REGNUM || regno == -1) + regcache_collect (SR_REGNUM, regs + (1 * 4)); + + if (regno == PR_REGNUM || regno == -1) + regcache_collect (PR_REGNUM, regs + (2 * 4)); + + if (regno == MACH_REGNUM || regno == -1) + regcache_collect (MACH_REGNUM, regs + (3 * 4)); + + if (regno == MACL_REGNUM || regno == -1) + regcache_collect (MACL_REGNUM, regs + (4 * 4)); + + if ((regno >= R0_REGNUM && regno <= (R0_REGNUM + 15)) || regno == -1) + { + for (i = R0_REGNUM; i <= (R0_REGNUM + 15); i++) + if (regno == i || regno == -1) + regcache_collect (i, regs + regmap[i - R0_REGNUM]); + } +} + +static void +fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, + int which, CORE_ADDR ignore) +{ + /* We get everything from the .reg section. */ + if (which != 0) + return; + + if (core_reg_size < SIZEOF_STRUCT_REG) + { + warning ("Wrong size register set in core file."); + return; + } + + /* Integer registers. */ + shnbsd_supply_reg (core_reg_sect, -1); +} + +static void +fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, + int which, CORE_ADDR ignore) +{ + switch (which) + { + case 0: /* Integer registers. */ + if (core_reg_size != SIZEOF_STRUCT_REG) + warning ("Wrong size register set in core file."); + else + shnbsd_supply_reg (core_reg_sect, -1); + break; + + default: + /* Don't know what kind of register request this is; just ignore it. */ + break; + } +} + +static struct core_fns shnbsd_core_fns = +{ + bfd_target_unknown_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + +static struct core_fns shnbsd_elfcore_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_elfcore_registers, /* core_read_registers */ + NULL /* next */ +}; + +static void +shnbsd_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) +{ + set_solib_svr4_fetch_link_map_offsets (gdbarch, + nbsd_ilp32_solib_svr4_fetch_link_map_offsets); +} + +void +_initialize_shnbsd_tdep (void) +{ + add_core_fns (&shnbsd_core_fns); + add_core_fns (&shnbsd_elfcore_fns); + + sh_gdbarch_register_os_abi (SH_OSABI_NETBSD_ELF, shnbsd_init_abi); +} diff --git a/gdb/shnbsd-tdep.h b/gdb/shnbsd-tdep.h new file mode 100644 index 0000000..7364756 --- /dev/null +++ b/gdb/shnbsd-tdep.h @@ -0,0 +1,28 @@ +/* Target-dependent definitions for SuperH running NetBSD, for GDB. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 SH_NBSD_TDEP_H +#define SH_NBSD_TDEP_H + +void shnbsd_supply_reg (char *, int); +void shnbsd_fill_reg (char *, int); + +#endif /* SH_NBSD_TDEP_H */ diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index 774d70a..643e450 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -180,7 +180,11 @@ static struct { {"SIG126", "Real-time event 126"}, {"SIG127", "Real-time event 127"}, -#if defined(MACH) || defined(__MACH__) + {"SIGINFO", "Information request"}, + + {NULL, "Unknown signal"}, + {NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"}, + /* Mach exceptions */ {"EXC_BAD_ACCESS", "Could not access memory"}, {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"}, @@ -188,11 +192,6 @@ static struct { {"EXC_EMULATION", "Emulation instruction"}, {"EXC_SOFTWARE", "Software generated exception"}, {"EXC_BREAKPOINT", "Breakpoint"}, -#endif - {"SIGINFO", "Information request"}, - - {NULL, "Unknown signal"}, - {NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"}, /* Last entry, used to check whether the table is the right size. */ {NULL, "TARGET_SIGNAL_MAGIC"} @@ -237,9 +236,10 @@ target_signal_from_name (char *name) /* This ugly cast brought to you by the native VAX compiler. */ for (sig = TARGET_SIGNAL_HUP; - signals[sig].name != NULL; + sig < TARGET_SIGNAL_LAST; sig = (enum target_signal) ((int) sig + 1)) - if (strcmp (name, signals[sig].name) == 0) + if (signals[sig].name != NULL + && strcmp (name, signals[sig].name) == 0) return sig; return TARGET_SIGNAL_UNKNOWN; } diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index 0f81d05..374ec25 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -137,6 +137,8 @@ allocate_rt_common_objfile (void) objfile->md = NULL; obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, xmalloc, xfree); + obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, + xmalloc, xfree); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 1a7ffbf..2d71097 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1293,7 +1293,7 @@ static struct link_map_offsets * svr4_fetch_link_map_offsets (void) { struct link_map_offsets *(*flmo)(void) = - gdbarch_data (fetch_link_map_offsets_gdbarch_data); + gdbarch_data (current_gdbarch, fetch_link_map_offsets_gdbarch_data); if (flmo == NULL) { @@ -1330,7 +1330,7 @@ static void * init_fetch_link_map_offsets (struct gdbarch *gdbarch) { struct link_map_offsets *(*flmo) = - gdbarch_data (fetch_link_map_offsets_gdbarch_data); + gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data); if (flmo == NULL) return legacy_fetch_link_map_offsets; diff --git a/gdb/solib.c b/gdb/solib.c index 0c7eaba..d4876c1 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1,7 +1,7 @@ /* Handle shared libraries for GDB, the GNU Debugger. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -652,13 +652,13 @@ info_sharedlibrary_command (char *ignore, int from_tty) printf_unfiltered ("%-*s", addr_width, so->textsection != NULL - ? longest_local_hex_string_custom ( + ? local_hex_string_custom ( (LONGEST) so->textsection->addr, addr_fmt) : ""); printf_unfiltered ("%-*s", addr_width, so->textsection != NULL - ? longest_local_hex_string_custom ( + ? local_hex_string_custom ( (LONGEST) so->textsection->endaddr, addr_fmt) : ""); diff --git a/gdb/solib.h b/gdb/solib.h index 76f287b..04be72d 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef SOLIB_H +#define SOLIB_H + /* Forward decl's for prototypes */ struct target_ops; @@ -197,3 +200,5 @@ extern int in_solib_dynsym_resolve_code (CORE_ADDR); /* solib.c */ /* Discard symbols that were auto-loaded from shared libraries. */ extern void no_shared_libraries (char *ignored, int from_tty); + +#endif /* SOLIB_H */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 7065b7b..56b7849 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1904,6 +1904,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, break; case 't': + /* Typedef */ SYMBOL_TYPE (sym) = read_type (&p, objfile); /* For a nameless type, we don't want a create a symbol, thus we @@ -2359,6 +2360,9 @@ read_type (register char **pp, struct objfile *objfile) /* Used to distinguish string and bitstring from char-array and set. */ int is_string = 0; + /* Used to distinguish vector from array. */ + int is_vector = 0; + /* Read type number if present. The type number may be omitted. for instance in a two-dimensional array declared with type "ar1;1;10;ar1;1;10;4". */ @@ -2574,7 +2578,7 @@ again: forward-referenced), and we must change it to a pointer, function, reference, or whatever, *in-place*. */ - case '*': + case '*': /* Pointer to another type */ type1 = read_type (pp, objfile); type = make_pointer_type (type1, dbx_lookup_type (typenums)); break; @@ -2732,16 +2736,22 @@ again: switch (*attr) { - case 's': + case 's': /* Size attribute */ type_size = atoi (attr + 1); if (type_size <= 0) type_size = -1; break; - case 'S': + case 'S': /* String attribute */ + /* FIXME: check to see if following type is array? */ is_string = 1; break; + case 'V': /* Vector attribute */ + /* FIXME: check to see if following type is array? */ + is_vector = 1; + break; + default: /* Ignore unrecognized type attributes, so future compilers can invent new ones. */ @@ -2844,9 +2854,11 @@ again: type = read_array_type (pp, type, objfile); if (is_string) TYPE_CODE (type) = TYPE_CODE_STRING; + if (is_vector) + TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; break; - case 'S': + case 'S': /* Set or bitstring type */ type1 = read_type (pp, objfile); type = create_set_type ((struct type *) NULL, type1); if (is_string) @@ -4290,8 +4302,6 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code, type = error_type (pp, objfile); } - /* Fix up any cv-qualified versions of this type. */ - finish_cv_type (type); do_cleanups (back_to); return (type); } diff --git a/gdb/symfile.c b/gdb/symfile.c index 7c7141d..d087b1f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -539,6 +539,34 @@ default_symfile_offsets (struct objfile *objfile, if (sect) objfile->sect_index_rodata = sect->index; + /* This is where things get really weird... We MUST have valid + indices for the various sect_index_* members or gdb will abort. + So if for example, there is no ".text" section, we have to + accomodate that. Except when explicitly adding symbol files at + some address, section_offsets contains nothing but zeros, so it + doesn't matter which slot in section_offsets the individual + sect_index_* members index into. So if they are all zero, it is + safe to just point all the currently uninitialized indices to the + first slot. */ + + for (i = 0; i < objfile->num_sections; i++) + { + if (ANOFFSET (objfile->section_offsets, i) != 0) + { + break; + } + } + if (i == objfile->num_sections) + { + if (objfile->sect_index_text == -1) + objfile->sect_index_text = 0; + if (objfile->sect_index_data == -1) + objfile->sect_index_data = 0; + if (objfile->sect_index_bss == -1) + objfile->sect_index_bss = 0; + if (objfile->sect_index_rodata == -1) + objfile->sect_index_rodata = 0; + } } /* Process a symbol file, as either the main file or as a dynamically @@ -1713,6 +1741,7 @@ reread_symbols (void) /* Free the obstacks for non-reusable objfiles */ free_bcache (&objfile->psymbol_cache); + free_bcache (&objfile->macro_cache); obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->type_obstack, 0); @@ -1738,6 +1767,8 @@ reread_symbols (void) it is empty. */ obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, xmalloc, xfree); + obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, + xmalloc, xfree); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 2f1bb72..39b10a6 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -197,6 +197,8 @@ print_objfile_statistics (void) obstack_memory_used (&objfile->psymbol_obstack)); printf_filtered (" Total memory used for psymbol cache: %d\n", obstack_memory_used (&objfile->psymbol_cache.cache)); + printf_filtered (" Total memory used for macro cache: %d\n", + obstack_memory_used (&objfile->macro_cache.cache)); printf_filtered (" Total memory used for symbol obstack: %d\n", obstack_memory_used (&objfile->symbol_obstack)); printf_filtered (" Total memory used for type obstack: %d\n", diff --git a/gdb/symtab.c b/gdb/symtab.c index 3a42867..3d687be 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2961,12 +2961,12 @@ print_msymbol_info (struct minimal_symbol *msymbol) char *tmp; if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol) - & (CORE_ADDR) 0xffffffff, - "08l"); + tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol) + & (CORE_ADDR) 0xffffffff, + "08l"); else - tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol), - "016l"); + tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol), + "016l"); printf_filtered ("%s %s\n", tmp, SYMBOL_SOURCE_NAME (msymbol)); } diff --git a/gdb/symtab.h b/gdb/symtab.h index 231364e..bb22d0d 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -824,6 +824,11 @@ struct symtab 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; + /* Name of this source file. */ char *filename; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6c35655..2705785 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,74 @@ +2002-05-14 Elena Zannoni + + * gdb.arch/altivec-abi.c: New file. + * gdb.arch/altivec-abi.exp: New file. + * gdb.arch/altivec-regs.c: New file. + * gdb.arch/altivec-regs.exp: New file. + +2002-05-14 Daniel Jacobowitz + + * gdb.base/maint.exp (maint print type): Update for new type + structure. + +2002-05-14 Elena Zannoni + + * gdb.arch: New directory. + * gdb.arch/configure.in: New file. + * gdb.arch/configure: New file. + * gdb.arch/Makefile.in: New file. + +2002-05-13 Corinna Vinschen + + * gdb.asm/asm-source.exp: Add v850 as supported target. + * gdb.asm/v850.inc: New file. + +2002-05-13 Daniel Jacobowitz + + * gdb.c++/annota2.exp (annotate-quit): Add comment. + +2002-05-12 Daniel Jacobowitz + + * gdb.base/break.exp: Check 'break "marker2"'. + +2002-05-10 Michael Snyder + + * gdb.base/long_long.exp: Fix typo. + +2002-05-10 Jim Blandy + + * gdb.base/printcmds.exp: Don't xfail the ptype command. This is + a bug. + + * gdb.base/printcmds.exp (test_integer_literals_rejected): + Recognize more detailed error message produced by the macro + expander's lexical analyzer. + * lib/gdb.exp (test_print_reject): Same. + +2002-05-09 Mark Kettenis + + * gdb.c++/method.exp: Fix typo. + +2002-05-08 Michael Snyder + + * gdb.mi/mi-var-child.exp: Accept (void) as well as (). + * gdb.mi/mi0-var-child.exp: Accept (void) as well as (). + * gdb.base/default.exp: Merge clauses for arm, strongarm, xscale. + * gdb.base/long_long.exp: Merge clauses for arm and xscale. + Add iftarget clause for strongarm. + +2002-05-06 Michael Snyder + + * lib/gdb.exp (gdb_test): Add case to allow for status wrapper. + (gdb_continue_to_end): Accept output from status wrapper. + * gdb.base/ending-run.exp: Add case for output from status wrapper. + Clean up fail messages to match pass messages. + + Enable the "needs_status_wrapper" testsuite feature. + * lib/gdb.exp (gdb_wrapper_init): New procedure. + (gdb_compile): Conditionally call gdb_wrapper_init. + * gdb.base/a2-run.exp: Recognize output from status wrapper. + * gdb.c++/method.exp: Recognize output from status wrapper. + 2002-05-06 Ben Elliston From Graydon Hoare diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 298ba2e..f6ce1c7 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -67,6 +67,10 @@ if [istarget "xstormy16-*-*"] then { set asm-arch xstormy16 set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}" } +if [istarget "v850-*-*"] then { + set asm-arch v850 + set gdb_wrapper_initialized 1 +} if { "${asm-arch}" == "" } { gdb_suppress_entire_file "Assembly source test -- not implemented for this target." } diff --git a/gdb/testsuite/gdb.asm/v850.inc b/gdb/testsuite/gdb.asm/v850.inc new file mode 100644 index 0000000..8797791 --- /dev/null +++ b/gdb/testsuite/gdb.asm/v850.inc @@ -0,0 +1,41 @@ + comment "subroutine prologue" + .macro gdbasm_enter + add -8,sp + st.w r31,4[sp] + st.w r29,0[sp] + mov sp,r29 + .endm + + comment "subroutine epilogue" + .macro gdbasm_leave + mov r29,sp + ld.w 0[sp],r29 + ld.w 4[sp],r31 + add 8,sp + jmp [r31] + .endm + + .macro gdbasm_call subr + jarl \subr,r31 + .endm + + .macro gdbasm_several_nops + nop + nop + nop + nop + .endm + + comment "exit (0)" + .macro gdbasm_exit0 + halt + .endm + + comment "crt0 startup" + .macro gdbasm_startup + movea 255,r0,r20 + mov r0, r21 + ori 65535, r0, r21 + movhi 32, r0, sp + .endm + diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp index f822f24..fbc7044 100644 --- a/gdb/testsuite/gdb.base/a2-run.exp +++ b/gdb/testsuite/gdb.base/a2-run.exp @@ -80,6 +80,9 @@ if [istarget "*-*-vxworks*"] then { -re ".*usage: factorial .*Program exited with code 01.*$gdb_prompt $" { pass "run \"$testfile\" with no args" } + -re ".*usage: factorial .* EXIT code 1.*Program exited normally.*$gdb_prompt $" { + pass "run \"$testfile\" with no args (exit wrapper)" + } -re ".*$gdb_prompt $" { fail "run \"$testfile\" with no args" verbose "expect_out is $expect_out(buffer)" 2 diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 166f097..e3aa922 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -1,5 +1,5 @@ # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000 +# 2000, 2002 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -84,6 +84,13 @@ gdb_test "break main" \ "breakpoint function" # +# test break at quoted function +# +gdb_test "break \"marker2\"" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint quoted function" + +# # test break at function in file # gdb_test "break $srcfile:factorial" \ @@ -150,6 +157,7 @@ if {$hp_aCC_compiler} { gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:4\[49\].* \[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:96.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* @@ -209,6 +217,11 @@ for {set i 6} {$i >= 1} {incr i -1} { } # +# Run until the breakpoint set at a quoted function +# +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile:4\[49\].*" \ + "run until quoted breakpoint" +# # run until the file:function breakpoint at a line number in a file # gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:85.*85\[\t \]+argc = \\(argc == 12345\\);.*" \ diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 09b65a9..ea8ba50 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -320,13 +320,9 @@ gdb_test "info frame" "No stack.|No selected frame." "info frame" #test info files gdb_test "info files" "" "info files" #test info float -if [istarget "arm*-*-*"] then { - gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" -} elseif [istarget "xscale*-*-*"] then { - gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" -} elseif [istarget "thumb*-*-*"] then { - gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" -} elseif [istarget "strongarm*-*-*"] then { +if { [istarget "arm*-*-*"] || \ + [istarget "xscale*-*-*"] || \ + [istarget "strongarm*-*-*"] } then { gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" } elseif [istarget "i\[3456\]86-*-*"] then { gdb_test "info float" "R7:.*Status Word:.*Opcode:.*" "info float" diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index df6a708..656601e 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -74,9 +74,15 @@ if [target_info exists use_gdb_stub] { gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" gdb_expect { - -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { fail "clear bp" } - -re ".*3.*main.*31.*$gdb_prompt $" { pass "cleared bp at line before routine" } - -re ".*$gdb_prompt $" { fail "info b" } + -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { + fail "cleared bp at line before routine" + } + -re ".*3.*main.*31.*$gdb_prompt $" { + pass "cleared bp at line before routine" + } + -re ".*$gdb_prompt $" { + fail "cleared bp at line before routine (info b)" + } } # Test some other "clear" combinations @@ -115,13 +121,13 @@ gdb_expect { send_gdb "i b\n" gdb_expect { -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { - fail "didn't clear bps" + fail "all set to continue (didn't clear bps)" } -re ".*3.*main.*31.*$gdb_prompt $" { pass "all set to continue" } -re ".*$gdb_prompt $" { - fail "missing bp at end" + fail "all set to continue (missing bp at end)" } } @@ -152,7 +158,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { -re ".*Unable to find return pc for this frame.*$gdb_prompt $" { - fail "Old bug came back!" + fail "step out of main (Old bug came back!)" gdb_test "n" ".*" "" } -re ".*in.*start.*$gdb_prompt $" { @@ -172,7 +178,7 @@ gdb_expect { } -re ".*in .nope ().*$gdb_prompt $" { # This is what happens on Solaris currently -sts 1999-08-25 - pass "step out of main on Solaris" + pass "step out of main (on Solaris)" } -re ".*in _int_reset ().*$gdb_prompt $" { # This is what happens on Sanyo XStormy16 @@ -184,13 +190,18 @@ gdb_expect { } -re ".*in ..change.mode ().*$gdb_prompt $" { # This is what happens on ARM in thumb mode -fn 2000-02-01 - pass "step out of main on ARM thumb" + pass "step out of main (on ARM thumb)" } -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { pass "step out of main" } - -re ".*$gdb_prompt $" { fail "step at end 2" } - timeout { fail "hang or timeout on step at end 2" } + -re ".*in __wrap_main ().*$gdb_prompt $" { + pass "step out of main (status wrapper)" + } + -re ".*$gdb_prompt $" { fail "step out of main (at end 2)" } + timeout { + fail "step out of main (hang or timeout on step at end 2)" + } } } -re ".*Unable to find return pc for this frame.*$gdb_prompt $" { @@ -201,7 +212,7 @@ gdb_expect { pass "step out of main" } -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { - pass "step out of main 2" + pass "step out of main (2)" } -re ".*Program exited normally.*$gdb_prompt $" { # This is what happens on Linux i86 (and I would expect others) @@ -209,13 +220,13 @@ gdb_expect { pass "step out of main" } -re ".*in.*currently asm.*$gdb_prompt $" { - pass "step out of main into assembler" + pass "step out of main (into assembler)" } -re ".*Program received signal SIGTRAP.*$gdb_prompt $" { pass "Cygmon stopped in ending trap." } - -re ".*$gdb_prompt $" { fail "step at end 1" } - timeout { fail "hang or timeout on step at end 1" } + -re ".*$gdb_prompt $" { fail "step out of main (at end 1)" } + timeout { fail "step out of main (hang or timeout on step at end 1)" } } if {![target_info exists use_cygmon] || ![target_info use_cygmon]} { @@ -229,6 +240,9 @@ if {![target_info exists use_cygmon] || ![target_info use_cygmon]} { # exit" message. pass "step to end of run" } + -re "Single.*EXIT code 0.*Program exited normally.*$gdb_prompt $" { + pass "step to end of run (status wrapper)" + } -re ".*Single.*Program exited.*$gdb_prompt $" { pass "step to end of run" } @@ -259,10 +273,10 @@ if {![target_info exists use_cygmon] || ![target_info use_cygmon]} { pass "No core dumped on quit" } else { if [ regexp "No such file or directory" $exec_output] { - pass "ls: core: No core dumped on quit" + pass "ls: core (No core dumped on quit)" } else { remote_exec build "rm -f core" - fail "Core dumped on quit" + fail "ls: core (Core dumped on quit)" } } } diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index 016b0e6..7084a8d 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -152,23 +152,16 @@ if { $sizeof_double == 8 } { # but a hybrid. They are in little endian format with the two words # swapped in big endian format. - if [ istarget "arm*-*-*" ] then { - -# assume the long long represents a floating point double in ARM format - gdb_test "p/f oct" ".*2.1386676354387559e\\+265.*" - - } elseif [ istarget "xscale*-*-*" ] then { - -# assume the long long represents a floating point double in ARM format - gdb_test "p/f oct" ".*2.1386676354387559e\\+265.*" - - } else { - -# assume the long long represents a floating point double in little -# endian format - gdb_test "p/f oct" ".*-5.9822653797615723e-120.*" - - } + if { [istarget "arm*-*-*"] || \ + [istarget "xscale*-*-*"] || \ + [istarget "strongarm*-*-*"] } then { + # assume the long long represents a floating point double in ARM format + gdb_test "p/f oct" ".*2.1386676354387559e\\+265.*" + } else { + # assume the long long represents a floating point double in little + # endian format + gdb_test "p/f oct" ".*-5.9822653797615723e-120.*" + } } else { diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 44ae25d..ac2e9f8 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -345,7 +345,7 @@ set timeout $old_timeout send_gdb "maint print type argc\n" gdb_expect { - -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ncv_type $hex\r\nas_type $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\ + -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\ { pass "maint print type" } -re ".*$gdb_prompt $" { fail "maint print type" } timeout { fail "(timeout) maint print type" } diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 6c4213e..7062fc5 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -98,8 +98,8 @@ proc test_integer_literals_rejected {} { global gdb_prompt test_print_reject "p 0x" - gdb_test "p ''" "Empty character constant\\." - gdb_test "p '''" "Empty character constant\\." + gdb_test "p ''" "(Empty character constant\\.|A character constant must contain at least one character\\.)" + gdb_test "p '''" "(Empty character constant\\.|A character constant must contain at least one character\\.)" test_print_reject "p '\\'" # Note that this turns into "p '\\\'" at gdb's input. @@ -627,7 +627,7 @@ proc test_print_string_constants {} { gdb_test "p *\"foo\"" " = 102 'f'" gdb_test "ptype *\"foo\"" " = char" gdb_test "p &*\"foo\"" " = \"foo\"" - setup_xfail "*-*-*" + # setup_kfail "gdb/538" gdb_test "ptype &*\"foo\"" "type = char \\*" gdb_test "p (char *)\"foo\"" " = \"foo\"" } diff --git a/gdb/testsuite/gdb.c++/annota2.exp b/gdb/testsuite/gdb.c++/annota2.exp index a134709..51c1116 100644 --- a/gdb/testsuite/gdb.c++/annota2.exp +++ b/gdb/testsuite/gdb.c++/annota2.exp @@ -208,6 +208,8 @@ gdb_expect { # test: # annotate-quit # +# This test sometimes fails, but not reproducibly. See gdb/544. +# send_gdb "\003" gdb_expect { -re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \ diff --git a/gdb/testsuite/gdb.c++/method.exp b/gdb/testsuite/gdb.c++/method.exp index 8deafa8..a085b14 100644 --- a/gdb/testsuite/gdb.c++/method.exp +++ b/gdb/testsuite/gdb.c++/method.exp @@ -180,6 +180,15 @@ gdb_expect { timeout { fail "(timeout) ptype A" } } -gdb_test "cont" \ - "Continuing.\r\n\r\nProgram exited normally." \ - "finish program" +send_gdb "cont\n" +gdb_expect { + -re "Continuing.\r\n\r\nProgram exited normally.*$gdb_prompt $" { + pass "finish program" + } + -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" { + pass "finish program (exit wrapper)" + } + -re ".*$gdb_prompt $" { fail "finish program" } + default:{ fail "finish program (timeout)" } +} + diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index bc38176..ba3ad16 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -74,7 +74,7 @@ mi_gdb_test "-var-create struct_declarations * 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 \\(\\*\\)\\(\\)\"\},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 \{\\.\\.\\.\}\"\}\}" \ + "\\^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} { @@ -444,7 +444,7 @@ mi_gdb_test "-var-info-num-children 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 \\*\\(\\*\\)\\(\\)\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.foo\",exp=\"foo\",numchild=\"0\",type=\"efoo\"\}\}" \ + "\\^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 @@ -587,7 +587,7 @@ mi_gdb_test "-var-create weird * 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 \\(\\*\\)\\(\\)\"\},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 \{\\.\\.\\.\}\"\}\}" \ + "\\^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 diff --git a/gdb/testsuite/gdb.mi/mi0-var-child.exp b/gdb/testsuite/gdb.mi/mi0-var-child.exp index f2b26ea..bd74622 100644 --- a/gdb/testsuite/gdb.mi/mi0-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi0-var-child.exp @@ -74,7 +74,7 @@ mi_gdb_test "-var-create struct_declarations * 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 \\(\\*\\)\\(\\)\"\},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 \{\\.\\.\\.\}\"\}\}" \ + "\\^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} { @@ -444,7 +444,7 @@ mi_gdb_test "-var-info-num-children 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 \\*\\(\\*\\)\\(\\)\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.foo\",exp=\"foo\",numchild=\"0\",type=\"efoo\"\}\}" \ + "\\^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 @@ -587,7 +587,7 @@ mi_gdb_test "-var-create weird * 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 \\(\\*\\)\\(\\)\"\},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 \{\\.\\.\\.\}\"\}\}" \ + "\\^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 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e476599..c41ed72 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -521,6 +521,15 @@ proc gdb_test { args } { fail "$errmsg" return -1 } + -re "EXIT code \[0-9\r\n\]+Program exited normally.*$gdb_prompt $" { + if ![string match "" $message] then { + set errmsg "$message: the program exited" + } else { + set errmsg "$command: the program exited" + } + fail "$errmsg" + return -1 + } -re "The program is not being run.*$gdb_prompt $" { if ![string match "" $message] then { set errmsg "$message: the program is no longer running" @@ -618,6 +627,14 @@ proc test_print_reject { args } { pass "reject $sendthis" return 1 } + -re "Unmatched single quote.*$gdb_prompt $" { + pass "reject $sendthis" + return 1 + } + -re "A character constant must contain at least one character.*$gdb_prompt $" { + pass "reject $sendthis" + return 1 + } -re "$expectthis.*$gdb_prompt $" { pass "reject $sendthis" return 1 @@ -1092,8 +1109,34 @@ proc gdb_preprocess {source dest args} { return $result; } +set gdb_wrapper_initialized 0 + +proc gdb_wrapper_init { args } { + global gdb_wrapper_initialized; + global gdb_wrapper_file; + global gdb_wrapper_flags; + + if { $gdb_wrapper_initialized == 1 } { return; } + + if {[target_info exists needs_status_wrapper] && \ + [target_info needs_status_wrapper] != "0" && \ + ![info exists gdb_wrapper_file]} { + set result [build_wrapper "testglue.o"]; + if { $result != "" } { + set gdb_wrapper_file [lindex $result 0]; + set gdb_wrapper_flags [lindex $result 1]; + } else { + warning "Status wrapper failed to build." + } + } + set gdb_wrapper_initialized 1 +} + proc gdb_compile {source dest type options} { global GDB_TESTCASE_OPTIONS; + global gdb_wrapper_file; + global gdb_wrapper_flags; + global gdb_wrapper_initialized; if [target_info exists gdb_stub] { set options2 { "additional_flags=-Dusestubs" } @@ -1111,6 +1154,15 @@ proc gdb_compile {source dest type options} { verbose "options are $options" verbose "source is $source $dest $type $options" + if { $gdb_wrapper_initialized == 0 } { gdb_wrapper_init } + + if {[target_info exists needs_status_wrapper] && \ + [target_info needs_status_wrapper] != "0" && \ + [info exists gdb_wrapper_file]} { + lappend options "libs=${gdb_wrapper_file}" + lappend options "ldflags=${gdb_wrapper_flags}" + } + set result [target_compile $source $dest $type $options]; regsub "\[\r\n\]*$" "$result" "" result; regsub "^\[\r\n\]*" "$result" "" result; @@ -1570,7 +1622,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\]+Program exited normally\\..*"\ + "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|)Program exited normally\\..*"\ "continue until exit at $mssg" } } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index dd5adb0..19f2906 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -502,11 +502,11 @@ tracepoints_info (char *tpnum_exp, int from_tty) char *tmp; if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom (t->address - & (CORE_ADDR) 0xffffffff, - "08l"); + tmp = local_hex_string_custom (t->address + & (CORE_ADDR) 0xffffffff, + "08l"); else - tmp = longest_local_hex_string_custom (t->address, "016l"); + tmp = local_hex_string_custom (t->address, "016l"); printf_filtered ("%s ", tmp); } diff --git a/gdb/valops.c b/gdb/valops.c index 146f1a6..798e31f 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -36,6 +36,7 @@ #include #include "gdb_string.h" +#include "gdb_assert.h" /* Flag indicating HP compilers were used; needed to correctly handle some value operations with HP aCC code/runtime. */ @@ -66,7 +67,7 @@ static CORE_ADDR allocate_space_in_inferior (int); static struct value *cast_into_complex (struct type *, struct value *); static struct fn_field *find_method_list (struct value ** argp, char *method, - int offset, int *static_memfuncp, + int offset, struct type *type, int *num_fns, struct type **basetype, int *boffset); @@ -562,11 +563,10 @@ value_assign (struct value *toval, struct value *fromval) if (VALUE_REGNO (toval) >= 0) { int regno = VALUE_REGNO (toval); - if (REGISTER_CONVERTIBLE (regno)) + if (CONVERT_REGISTER_P (regno)) { struct type *fromtype = check_typedef (VALUE_TYPE (fromval)); - REGISTER_CONVERT_TO_RAW (fromtype, regno, - VALUE_CONTENTS (fromval), raw_buffer); + VALUE_TO_REGISTER (fromtype, regno, VALUE_CONTENTS (fromval), raw_buffer); use_buffer = REGISTER_RAW_SIZE (regno); } } @@ -1488,7 +1488,7 @@ hand_function_call (struct value *function, int nargs, struct value **args) if (param_type) /* if this parameter is a pointer to function */ if (TYPE_CODE (param_type) == TYPE_CODE_PTR) - if (TYPE_CODE (param_type->target_type) == TYPE_CODE_FUNC) + if (TYPE_CODE (TYPE_TARGET_TYPE (param_type)) == TYPE_CODE_FUNC) /* elz: FIXME here should go the test about the compiler used to compile the target. We want to issue the error message only if the compiler used was HP's aCC. @@ -1963,10 +1963,13 @@ typecmp (int staticp, struct type *t1[], struct value *t2[]) return t2[1] != 0; if (t1 == 0) return 1; - if (TYPE_CODE (t1[0]) == TYPE_CODE_VOID) - return 0; if (t1[!staticp] == 0) return 0; + if (TYPE_CODE (t1[0]) == TYPE_CODE_VOID) + return 0; + /* Skip ``this'' argument if applicable. T2 will always include THIS. */ + if (staticp) + t2++; for (i = !staticp; t1[i] && TYPE_CODE (t1[i]) != TYPE_CODE_VOID; i++) { struct type *tt1, *tt2; @@ -2520,7 +2523,7 @@ value_struct_elt (struct value **argp, struct value **args, static struct fn_field * find_method_list (struct value **argp, char *method, int offset, - int *static_memfuncp, struct type *type, int *num_fns, + struct type *type, int *num_fns, struct type **basetype, int *boffset) { int i; @@ -2536,10 +2539,22 @@ 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)) { - *num_fns = TYPE_FN_FIELDLIST_LENGTH (type, i); + /* 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; - return TYPE_FN_FIELDLIST1 (type, i); + + for (j = 0; j < len; j++) + { + if (TYPE_FN_FIELD_STUB (f, j)) + check_stub_method (type, i, j); + } + + return f; } } @@ -2579,7 +2594,8 @@ find_method_list (struct value **argp, char *method, int offset, base_offset = TYPE_BASECLASS_BITPOS (type, i) / 8; } f = find_method_list (argp, method, base_offset + offset, - static_memfuncp, TYPE_BASECLASS (type, i), num_fns, basetype, boffset); + TYPE_BASECLASS (type, i), num_fns, basetype, + boffset); if (f) return f; } @@ -2597,8 +2613,8 @@ find_method_list (struct value **argp, char *method, int offset, struct fn_field * value_find_oload_method_list (struct value **argp, char *method, int offset, - int *static_memfuncp, int *num_fns, - struct type **basetype, int *boffset) + int *num_fns, struct type **basetype, + int *boffset) { struct type *t; @@ -2621,12 +2637,7 @@ value_find_oload_method_list (struct value **argp, char *method, int offset, && TYPE_CODE (t) != TYPE_CODE_UNION) error ("Attempt to extract a component of a value that is not a struct or union"); - /* Assume it's not static, unless we see that it is. */ - if (static_memfuncp) - *static_memfuncp = 0; - - return find_method_list (argp, method, 0, static_memfuncp, t, num_fns, basetype, boffset); - + return find_method_list (argp, method, 0, t, num_fns, basetype, boffset); } /* Given an array of argument types (ARGTYPES) (which includes an @@ -2685,6 +2696,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, int boffset; register int jj; register int ix; + int static_offset; char *obj_type_name = NULL; char *func_name = NULL; @@ -2692,9 +2704,6 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, /* Get the list of overloaded methods or functions */ if (method) { - int i; - int len; - struct type *domain; obj_type_name = TYPE_NAME (VALUE_TYPE (obj)); /* Hack: evaluate_subexp_standard often passes in a pointer value rather than the object itself, so try again */ @@ -2703,7 +2712,6 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, obj_type_name = TYPE_NAME (TYPE_TARGET_TYPE (VALUE_TYPE (obj))); fns_ptr = value_find_oload_method_list (&temp, name, 0, - staticp, &num_fns, &basetype, &boffset); if (!fns_ptr || !num_fns) @@ -2711,26 +2719,10 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, obj_type_name, (obj_type_name && *obj_type_name) ? "::" : "", name); - domain = TYPE_DOMAIN_TYPE (fns_ptr[0].type); - len = TYPE_NFN_FIELDS (domain); - /* NOTE: dan/2000-03-10: This stuff is for STABS, which won't - give us the info we need directly in the types. We have to - use the method stub conversion to get it. Be aware that this - is by no means perfect, and if you use STABS, please move to - DWARF-2, or something like it, because trying to improve - overloading using STABS is really a waste of time. */ - for (i = 0; i < len; i++) - { - int j; - struct fn_field *f = TYPE_FN_FIELDLIST1 (domain, i); - int len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i); - - for (j = 0; j < len2; j++) - { - if (TYPE_FN_FIELD_STUB (f, j) && (!strcmp_iw (TYPE_FN_FIELDLIST_NAME (domain,i),name))) - check_stub_method (domain, i, j); - } - } + /* If we are dealing with stub method types, they should have + been resolved by find_method_list via value_find_oload_method_list + above. */ + gdb_assert (TYPE_DOMAIN_TYPE (fns_ptr[0].type) != NULL); } else { @@ -2757,10 +2749,11 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, /* Consider each candidate in turn */ for (ix = 0; ix < num_fns; ix++) { + static_offset = 0; if (method) { - /* For static member functions, we won't have a this pointer, but nothing - else seems to handle them right now, so we just pretend ourselves */ + if (TYPE_FN_FIELD_STATIC_P (fns_ptr, ix)) + static_offset = 1; nparms=0; if (TYPE_FN_FIELD_ARGS(fns_ptr,ix)) @@ -2782,8 +2775,10 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj]) : TYPE_FIELD_TYPE (SYMBOL_TYPE (oload_syms[ix]), jj)); - /* Compare parameter types to supplied argument types */ - bv = rank_function (parm_types, nparms, arg_types, nargs); + /* Compare parameter types to supplied argument types. Skip THIS for + static methods. */ + bv = rank_function (parm_types, nparms, arg_types + static_offset, + nargs - static_offset); if (!oload_champ_bv) { @@ -2821,7 +2816,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, fprintf_filtered (gdb_stderr,"Overloaded method instance %s, # of parms %d\n", fns_ptr[ix].physname, nparms); else fprintf_filtered (gdb_stderr,"Overloaded function instance %s # of parms %d\n", SYMBOL_DEMANGLED_NAME (oload_syms[ix]), nparms); - for (jj = 0; jj < nargs; jj++) + for (jj = 0; jj < nargs - static_offset; jj++) fprintf_filtered (gdb_stderr,"...Badness @ %d : %d\n", jj, bv->rank[jj]); fprintf_filtered (gdb_stderr,"Overload resolution champion is %d, ambiguous? %d\n", oload_champ, oload_ambiguous); } @@ -2844,8 +2839,11 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, } #endif - /* Check how bad the best match is */ - for (ix = 1; ix <= nargs; ix++) + /* Check how bad the best match is. */ + static_offset = 0; + if (method && TYPE_FN_FIELD_STATIC_P (fns_ptr, oload_champ)) + static_offset = 1; + for (ix = 1; ix <= nargs - static_offset; ix++) { if (oload_champ_bv->rank[ix] >= 100) oload_incompatible = 1; /* truly mismatched types */ @@ -2878,6 +2876,10 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, if (method) { + if (staticp && TYPE_FN_FIELD_STATIC_P (fns_ptr, oload_champ)) + *staticp = 1; + else if (staticp) + *staticp = 0; if (TYPE_FN_FIELD_VIRTUAL_P (fns_ptr, oload_champ)) *valp = value_virtual_fn_field (&temp, fns_ptr, oload_champ, basetype, boffset); else diff --git a/gdb/value.h b/gdb/value.h index 62dc490..a0eb990 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -375,7 +375,7 @@ extern struct value *value_struct_elt_for_reference (struct type *domain, extern struct value *value_static_field (struct type *type, int fieldno); extern struct fn_field *value_find_oload_method_list (struct value **, char *, - int, int *, int *, + int, int *, struct type **, int *); extern int find_overload_match (struct type **arg_types, int nargs, @@ -405,9 +405,6 @@ extern struct value *value_repeat (struct value *arg1, int count); extern struct value *value_subscript (struct value *array, struct value *idx); -extern struct value *value_from_vtable_info (struct value *arg, - struct type *type); - extern struct value *value_being_returned (struct type *valtype, char *retbuf, int struct_return); diff --git a/gdb/values.c b/gdb/values.c index 9445d9c..225dd21 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -41,8 +41,6 @@ void _initialize_values (void); /* Prototypes for local functions. */ -static struct value *value_headof (struct value *, struct type *, struct type *); - static void show_values (char *, int); static void show_convenience (char *, int); @@ -1020,93 +1018,6 @@ value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *ty return v; } -/* ARG is a pointer to an object we know to be at least - a DTYPE. BTYPE is the most derived basetype that has - already been searched (and need not be searched again). - After looking at the vtables between BTYPE and DTYPE, - return the most derived type we find. The caller must - be satisfied when the return value == DTYPE. - - FIXME-tiemann: should work with dossier entries as well. - NOTICE - djb: I see no good reason at all to keep this function now that - we have RTTI support. It's used in literally one place, and it's - hard to keep this function up to date when it's purpose is served - by value_rtti_type efficiently. - Consider it gone for 5.1. */ - -static struct value * -value_headof (struct value *in_arg, struct type *btype, struct type *dtype) -{ - /* First collect the vtables we must look at for this object. */ - struct value *arg; - struct value *vtbl; - struct symbol *sym; - char *demangled_name; - struct minimal_symbol *msymbol; - - btype = TYPE_VPTR_BASETYPE (dtype); - CHECK_TYPEDEF (btype); - arg = in_arg; - if (btype != dtype) - arg = value_cast (lookup_pointer_type (btype), arg); - if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF) - { - /* - * Copy the value, but change the type from (T&) to (T*). - * We keep the same location information, which is efficient, - * and allows &(&X) to get the location containing the reference. - */ - arg = value_copy (arg); - VALUE_TYPE (arg) = lookup_pointer_type (TYPE_TARGET_TYPE (VALUE_TYPE (arg))); - } - if (VALUE_ADDRESS(value_field (value_ind(arg), TYPE_VPTR_FIELDNO (btype)))==0) - return arg; - - vtbl = value_ind (value_field (value_ind (arg), TYPE_VPTR_FIELDNO (btype))); - /* Turn vtable into typeinfo function */ - VALUE_OFFSET(vtbl)+=4; - - msymbol = lookup_minimal_symbol_by_pc ( value_as_address(value_ind(vtbl)) ); - if (msymbol == NULL - || (demangled_name = SYMBOL_NAME (msymbol)) == NULL) - { - /* If we expected to find a vtable, but did not, let the user - know that we aren't happy, but don't throw an error. - FIXME: there has to be a better way to do this. */ - struct type *error_type = (struct type *) xmalloc (sizeof (struct type)); - memcpy (error_type, VALUE_TYPE (in_arg), sizeof (struct type)); - TYPE_NAME (error_type) = savestring ("suspicious *", sizeof ("suspicious *")); - VALUE_TYPE (in_arg) = error_type; - return in_arg; - } - demangled_name = cplus_demangle(demangled_name,DMGL_ANSI); - *(strchr (demangled_name, ' ')) = '\0'; - - sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0); - if (sym == NULL) - error ("could not find type declaration for `%s'", demangled_name); - - arg = in_arg; - VALUE_TYPE (arg) = lookup_pointer_type (SYMBOL_TYPE (sym)); - return arg; -} - -/* ARG is a pointer object of type TYPE. If TYPE has virtual - function tables, probe ARG's tables (including the vtables - of its baseclasses) to figure out the most derived type that ARG - could actually be a pointer to. */ - -struct value * -value_from_vtable_info (struct value *arg, struct type *type) -{ - /* Take care of preliminaries. */ - if (TYPE_VPTR_FIELDNO (type) < 0) - fill_in_vptr_fieldno (type); - if (TYPE_VPTR_FIELDNO (type) < 0) - return 0; - - return value_headof (arg, 0, type); -} /* Unpack a field FIELDNO of the specified TYPE, from the anonymous object at VALADDR. diff --git a/gdb/version.in b/gdb/version.in index 63bac33..beaddec 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2002-05-06-cvs +2002-05-15-cvs diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index fd9246c..f57a5f2 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -25,7 +25,7 @@ #include "inferior.h" #include "gdbcore.h" #include "regcache.h" -#include "i387-nat.h" +#include "i387-tdep.h" #include "gdb_assert.h" #include "x86-64-tdep.h" @@ -406,12 +406,6 @@ static struct core_fns linux_elf_core_fns = { #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) #endif -/* Record the value of the debug control register. */ -static long debug_control_mirror; - -/* Record which address associates with which register. */ -static CORE_ADDR address_lookup[DR_LASTADDR - DR_FIRSTADDR + 1]; - /* Return the address of register REGNUM. BLOCKEND is the value of u.u_ar0, which should point to the registers. */ CORE_ADDR diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 50b0227..94f57a5 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -195,7 +195,7 @@ x86_64_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { char buf[12]; - DOUBLEST d; + /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) { @@ -372,18 +372,18 @@ classify_argument (struct type *type, case TYPE_CODE_STRUCT: { int j; - for (j = 0; j < type->nfields; ++j) + for (j = 0; j < TYPE_NFIELDS (type); ++j) { - int num = classify_argument (type->fields[j].type, + int num = classify_argument (TYPE_FIELDS (type)[j].type, subclasses, - (type->fields[j].loc.bitpos + (TYPE_FIELDS (type)[j].loc.bitpos + bit_offset) % 256); if (!num) return 0; for (i = 0; i < num; i++) { int pos = - (type->fields[j].loc.bitpos + bit_offset) / 8 / 8; + (TYPE_FIELDS (type)[j].loc.bitpos + bit_offset) / 8 / 8; classes[i + pos] = merge_classes (subclasses[i], classes[i + pos]); } @@ -394,7 +394,7 @@ classify_argument (struct type *type, { int num; - num = classify_argument (type->target_type, + num = classify_argument (TYPE_TARGET_TYPE (type), subclasses, bit_offset); if (!num) return 0; @@ -413,10 +413,10 @@ classify_argument (struct type *type, { int j; { - for (j = 0; j < type->nfields; ++j) + for (j = 0; j < TYPE_NFIELDS (type); ++j) { int num; - num = classify_argument (type->fields[j].type, + num = classify_argument (TYPE_FIELDS (type)[j].type, subclasses, bit_offset); if (!num) return 0; @@ -426,6 +426,8 @@ classify_argument (struct type *type, } } break; + default: + break; } /* Final merger cleanup. */ for (i = 0; i < words; i++) @@ -488,6 +490,8 @@ classify_argument (struct type *type, } case TYPE_CODE_VOID: return 0; + default: /* Avoid warning. */ + break; } internal_error (__FILE__, __LINE__, "classify_argument: unknown argument type"); @@ -998,7 +1002,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) for (i = 0, sum = 0; i < X86_64_NUM_REGS; i++) sum += x86_64_register_info_table[i].size; set_gdbarch_register_bytes (gdbarch, sum); - set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size); + set_gdbarch_register_virtual_size (gdbarch, generic_register_size); set_gdbarch_max_register_virtual_size (gdbarch, 16); set_gdbarch_register_virtual_type (gdbarch, x86_64_register_virtual_type); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index c225793..fe3823b 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,12 @@ +2002-05-08 Jason Thorpe + + * common.h (NT_GNU_ABI_TAG): Define. + (GNU_ABI_TAG_LINUX): Define. + (GNU_ABI_TAG_HURD): Define. + (GNU_ABI_TAG_SOLARIS): Define. + (NT_NETBSD_IDENT): Define. + (NT_FREEBSD_ABI_TAG): Define. + 2002-04-24 Elena Zannoni * dwarf2.h: Add DW_AT_GNU_vector. diff --git a/include/elf/common.h b/include/elf/common.h index d6e45fc..f8b0832 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -358,6 +358,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NT_VERSION 1 /* Contains a version string. */ #define NT_ARCH 2 /* Contains an architecture string. */ +/* Values for GNU .note.ABI-tag notes. Note name is "GNU". */ + +#define NT_GNU_ABI_TAG 1 +#define GNU_ABI_TAG_LINUX 0 +#define GNU_ABI_TAG_HURD 1 +#define GNU_ABI_TAG_SOLARIS 2 + +/* Values for NetBSD .note.netbsd.ident notes. Note name is "NetBSD". */ + +#define NT_NETBSD_IDENT 1 + +/* Values for FreeBSD .note.ABI-tag notes. Note name is "FreeBSD". */ + +#define NT_FREEBSD_ABI_TAG 1 + /* These three macros disassemble and assemble a symbol table st_info field, which contains the symbol binding and symbol type. The STB_ and STT_ defines identify the binding and type. */ diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index 5d83a64..96a4a05 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-05-10 Elena Zannoni + + * sim-sh.h: New file, for sh gdb<->sim interface. + +2002-05-09 Daniel Jacobowitz + + * signals.h: Update comments. + (enum target_signal): Remove conditional compilation around + Mach-specific signals. Move them to after TARGET_SIGNAL_DEFAULT. + 2002-03-10 Daniel Jacobowitz * signals.h: New file, from gdb/defs.h. diff --git a/include/gdb/signals.h b/include/gdb/signals.h index 1710750..b6f5d48 100644 --- a/include/gdb/signals.h +++ b/include/gdb/signals.h @@ -32,7 +32,8 @@ Since these numbers have actually made it out into other software (stubs, etc.), you mustn't disturb the assigned numbering. If you need to add new signals here, add them to the end of the explicitly - numbered signals. + numbered signals, at the comment marker. Add them unconditionally, + not within any #if or #ifdef. This is based strongly on Unix/POSIX signals for several reasons: (1) This set of signals represents a widely-accepted attempt to @@ -208,15 +209,6 @@ enum target_signal TARGET_SIGNAL_REALTIME_126, TARGET_SIGNAL_REALTIME_127, -#if defined(MACH) || defined(__MACH__) - /* Mach exceptions */ - TARGET_EXC_BAD_ACCESS, - TARGET_EXC_BAD_INSTRUCTION, - TARGET_EXC_ARITHMETIC, - TARGET_EXC_EMULATION, - TARGET_EXC_SOFTWARE, - TARGET_EXC_BREAKPOINT, -#endif TARGET_SIGNAL_INFO, /* Some signal we don't know about. */ @@ -226,6 +218,18 @@ enum target_signal (for passing to proceed and so on). */ TARGET_SIGNAL_DEFAULT, + /* Mach exceptions. In versions of GDB before 5.2, these were just before + TARGET_SIGNAL_INFO if you were compiling on a Mach host (and missing + otherwise). */ + TARGET_EXC_BAD_ACCESS, + TARGET_EXC_BAD_INSTRUCTION, + TARGET_EXC_ARITHMETIC, + TARGET_EXC_EMULATION, + TARGET_EXC_SOFTWARE, + TARGET_EXC_BREAKPOINT, + + /* If you are adding a new signal, add it just above this comment. */ + /* Last and unused enum value, for sizing arrays, etc. */ TARGET_SIGNAL_LAST }; diff --git a/include/gdb/sim-sh.h b/include/gdb/sim-sh.h new file mode 100644 index 0000000..3c736be --- /dev/null +++ b/include/gdb/sim-sh.h @@ -0,0 +1,54 @@ +/* This file defines the interface between the sh simulator and gdb. + Copyright (C) 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. */ + +#if !defined (SIM_SH_H) +#define SIM_SH_H + +#ifdef __cplusplus +extern "C" { // } +#endif + +/* The simulator makes use of the following register information. */ + +enum + { + SIM_SH64_R0_REGNUM = 0, + SIM_SH64_SP_REGNUM = 15, + SIM_SH64_PC_REGNUM = 64, + SIM_SH64_SR_REGNUM = 65, + SIM_SH64_SSR_REGNUM = 66, + SIM_SH64_SPC_REGNUM = 67, + SIM_SH64_TR0_REGNUM = 68, + SIM_SH64_FPCSR_REGNUM = 76, + SIM_SH64_FR0_REGNUM = 77 + }; + +enum + { + SIM_SH64_NR_REGS = 141, /* total number of architectural registers */ + SIM_SH64_NR_R_REGS = 64, /* number of general registers */ + SIM_SH64_NR_TR_REGS = 8, /* number of target registers */ + SIM_SH64_NR_FP_REGS = 64 /* number of floating point registers */ + }; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 63efe6e..7024c37 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,16 @@ +2002-05-08 Alexandre Oliva + + * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at + script entry, and set LD to it when configuring multilibs. + * configure: Rebuilt. + +2002-05-07 Mark Mitchell + + * configure.in (AC_TYPE_PID_T): Use it. + * configure: Regenerated. + * getruntime.c: Include . + * waitpid.c: Likewise. Use pid_t, not int, as the type of "pid". + 2002-04-09 Richard Henderson * hashtab.c (higher_prime_number): Use 7 as minimum. diff --git a/libiberty/configure b/libiberty/configure index cbbec35..fc89885 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -42,6 +42,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -156,6 +157,7 @@ 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 @@ -326,6 +328,11 @@ 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=*) @@ -491,12 +498,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -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" +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 fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -536,6 +547,12 @@ fi +# This works around the fact that libtool configuration may change LD +# for this particular configuration, but some shells, instead of +# keeping the changes in LD private, export them just because LD is +# exported. We don't use libtool yet, but some day we might, so... +ORIGINAL_LD_FOR_MULTILIBS=$LD + # Check whether --with-target-subdir or --without-target-subdir was given. if test "${with_target_subdir+set}" = set; then withval="$with_target_subdir" @@ -599,7 +616,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:603: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:620: 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" @@ -624,7 +641,7 @@ fi # Extract the first word of "makeinfo", so it can be a program name with args. set dummy makeinfo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:628: checking for $ac_word" >&5 +echo "configure:645: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -670,7 +687,7 @@ fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:674: checking for $ac_word" >&5 +echo "configure:691: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -710,7 +727,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:714: checking host system type" >&5 +echo "configure:731: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -733,7 +750,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:737: checking build system type" >&5 +echo "configure:754: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -759,7 +776,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:763: checking for $ac_word" >&5 +echo "configure:780: 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 @@ -791,7 +808,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:795: checking for $ac_word" >&5 +echo "configure:812: 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 @@ -823,7 +840,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:827: checking for $ac_word" >&5 +echo "configure:844: 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 @@ -860,7 +877,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:864: checking for $ac_word" >&5 +echo "configure:881: 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 @@ -890,7 +907,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:894: checking for $ac_word" >&5 +echo "configure:911: 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 @@ -939,7 +956,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:943: checking whether we are using GNU C" >&5 +echo "configure:960: 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 @@ -948,7 +965,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:952: \"$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:969: \"$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 @@ -964,7 +981,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:968: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:985: 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 @@ -995,7 +1012,7 @@ fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:999: checking for POSIXized ISC" >&5 +echo "configure:1016: 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 @@ -1016,12 +1033,12 @@ else fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1020: checking for working const" >&5 +echo "configure:1037: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1091: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1091,21 +1108,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1095: checking for inline" >&5 +echo "configure:1112: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1148,7 +1165,7 @@ esac # 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:1152: checking for a BSD compatible install" >&5 +echo "configure:1169: 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 @@ -1209,7 +1226,7 @@ host_makefile_frag=${frag} # able to link anything, it had better be able to at least compile # something. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1213: checking how to run the C preprocessor" >&5 +echo "configure:1230: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1224,13 +1241,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1251: \"$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 : @@ -1241,13 +1258,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1268: \"$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 : @@ -1258,13 +1275,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1285: \"$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 : @@ -1292,17 +1309,17 @@ for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1296: checking for $ac_hdr" >&5 +echo "configure:1313: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1323: \"$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* @@ -1329,12 +1346,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1333: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1350: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1350,7 +1367,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1371,12 +1388,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1375: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1392: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1385,7 +1402,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1406: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1407,19 +1424,19 @@ fi echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6 -echo "configure:1411: checking whether errno must be declared" >&5 +echo "configure:1428: checking whether errno must be declared" >&5 if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int x = errno; ; return 0; } EOF -if { (eval echo configure:1423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_declare_errno=no else @@ -1441,12 +1458,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1445: checking for ANSI C header files" >&5 +echo "configure:1462: 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 < #include @@ -1454,7 +1471,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1475: \"$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* @@ -1471,7 +1488,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 @@ -1489,7 +1506,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 @@ -1510,7 +1527,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1521,7 +1538,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1545,12 +1562,12 @@ EOF fi echo $ac_n "checking for uintptr_t""... $ac_c" 1>&6 -echo "configure:1549: checking for uintptr_t" >&5 +echo "configure:1566: checking for uintptr_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1586,6 +1603,40 @@ EOF fi +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1608: 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 < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + + # This is the list of functions which libiberty will provide if they # are not available on the host. @@ -1643,12 +1694,12 @@ if test "x" = "y"; then for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1647: checking for $ac_func" >&5 +echo "configure:1698: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1726: \"$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 @@ -1698,12 +1749,12 @@ done for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1702: checking for $ac_func" >&5 +echo "configure:1753: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1781: \"$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 @@ -1753,12 +1804,12 @@ done for ac_func in memmove memset putenv random rename rindex sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1757: checking for $ac_func" >&5 +echo "configure:1808: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1836: \"$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 @@ -1808,12 +1859,12 @@ done for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1812: checking for $ac_func" >&5 +echo "configure:1863: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1891: \"$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 @@ -1863,12 +1914,12 @@ done for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1867: checking for $ac_func" >&5 +echo "configure:1918: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1946: \"$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 @@ -1918,12 +1969,12 @@ done for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1922: checking for $ac_func" >&5 +echo "configure:1973: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2001: \"$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 @@ -1973,12 +2024,12 @@ done for ac_func in sysconf times sbrk gettimeofday ffs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1977: checking for $ac_func" >&5 +echo "configure:2028: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2056: \"$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 @@ -2231,7 +2282,7 @@ if test -z "${setobjs}"; then # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2235: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2286: 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. @@ -2242,12 +2293,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2246 "configure" +#line 2297 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2302: \"$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 @@ -2273,19 +2324,19 @@ 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:2277: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2328: 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 for ac_func in $funcs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2284: checking for $ac_func" >&5 +echo "configure:2335: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2363: \"$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 @@ -2335,12 +2386,12 @@ done echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2339: checking whether alloca needs Cray hooks" >&5 +echo "configure:2390: 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 <&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:2369: checking for $ac_func" >&5 +echo "configure:2420: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2448: \"$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 @@ -2419,7 +2470,7 @@ fi fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2423: checking stack direction for C alloca" >&5 +echo "configure:2474: 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 @@ -2427,7 +2478,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2501: \"$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 @@ -2466,52 +2517,19 @@ cat >> confdefs.h <&6 -echo "configure:2471: 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 < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_pid_t=yes -else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF -#define pid_t int -EOF - -fi - -ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` + ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2505: checking for vfork.h" >&5 +echo "configure:2523: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2533: \"$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* @@ -2536,18 +2554,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2540: checking for working vfork" >&5 +echo "configure:2558: 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:2546: checking for vfork" >&5 +echo "configure:2564: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2592: \"$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 @@ -2592,7 +2610,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -2687,7 +2705,7 @@ main() { } } EOF -if { (eval echo configure:2691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2709: \"$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 @@ -2719,12 +2737,12 @@ fi for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2723: checking for $ac_func" >&5 +echo "configure:2741: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2769: \"$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 @@ -2777,12 +2795,12 @@ done for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2781: checking for $ac_func" >&5 +echo "configure:2799: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2827: \"$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 @@ -2833,19 +2851,19 @@ done for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:2837: checking for $v" >&5 +echo "configure:2855: checking for $v" >&5 if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "libiberty_cv_var_$v=yes" else @@ -2871,12 +2889,12 @@ EOF for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2875: checking for $ac_func" >&5 +echo "configure:2893: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2921: \"$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 @@ -2929,17 +2947,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2933: checking for $ac_hdr" >&5 +echo "configure:2951: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2961: \"$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* @@ -2968,12 +2986,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2972: checking for $ac_func" >&5 +echo "configure:2990: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3018: \"$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 @@ -3021,7 +3039,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3025: checking for working mmap" >&5 +echo "configure:3043: 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 @@ -3029,7 +3047,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3191: \"$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 @@ -3193,7 +3211,7 @@ fi echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:3197: checking for working strncmp" >&5 +echo "configure:3215: checking for working strncmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3201,7 +3219,7 @@ else ac_cv_func_strncmp_works=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strncmp_works=yes else @@ -3685,6 +3703,7 @@ if test -n "$CONFIG_FILES"; then if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then # FIXME: We shouldn't need to set ac_file ac_file=Makefile + LD="${ORIGINAL_LD_FOR_MULTILIBS}" . ${libiberty_topdir}/config-ml.in fi fi diff --git a/libiberty/configure.in b/libiberty/configure.in index 0de0f8a..f6d92bc 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -3,6 +3,12 @@ dnl Process this file with autoconf to produce a configure script AC_PREREQ(2.13) AC_INIT(pexecute.c) +# This works around the fact that libtool configuration may change LD +# for this particular configuration, but some shells, instead of +# keeping the changes in LD private, export them just because LD is +# exported. We don't use libtool yet, but some day we might, so... +ORIGINAL_LD_FOR_MULTILIBS=$LD + dnl We use these options to decide which functions to include. AC_ARG_WITH(target-subdir, [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) @@ -138,6 +144,8 @@ then AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) fi +AC_TYPE_PID_T + # This is the list of functions which libiberty will provide if they # are not available on the host. @@ -425,6 +433,7 @@ if test -n "$CONFIG_FILES"; then if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then # FIXME: We shouldn't need to set ac_file ac_file=Makefile + LD="${ORIGINAL_LD_FOR_MULTILIBS}" . ${libiberty_topdir}/config-ml.in fi fi], diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c index 9301deb..3f7dc0d 100644 --- a/libiberty/getruntime.c +++ b/libiberty/getruntime.c @@ -1,5 +1,5 @@ /* Return time used so far, in microseconds. - Copyright (C) 1994, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -22,6 +22,10 @@ Boston, MA 02111-1307, USA. */ #include "ansidecl.h" #include "libiberty.h" +/* On some systems (such as WindISS), you must include + to get the definition of "time_t" before you include . */ +#include + /* There are several ways to get elapsed execution time; unfortunately no single way is available for all host systems, nor are there reliable ways to find out which way is correct for a given host. */ diff --git a/libiberty/waitpid.c b/libiberty/waitpid.c index 703b8a6..6e31f25 100644 --- a/libiberty/waitpid.c +++ b/libiberty/waitpid.c @@ -13,13 +13,19 @@ does the return value. The third argument is unused in @libib{}. #ifdef HAVE_CONFIG_H #include "config.h" #endif + +/* On some systems (such as WindISS), you must include + to get the definition of "pid_t" before you include . */ +#include + #ifdef HAVE_SYS_WAIT_H #include #endif -int +pid_t waitpid (pid, stat_loc, options) - int pid, *stat_loc, options; + pid_t pid; + int *stat_loc, options; { for (;;) { diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 80f094c..9db7dec 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,17 @@ +2002-04-28 Jason Thorpe + + * vax-dis.c (print_insn_arg): Pass the insn info to print_insn_mode. + (print_insn_mode): Print some basic info about floating point values. + +2002-05-09 Anton Blanchard + + * ppc-opc.c: Add "tlbiel" for POWER4. + +2002-05-07 Graydon Hoare + + * cgen-dis.in: (print_insn_@arch@): Cache list of opened CPUs rather + than just most-recently-opened. + 2002-05-01 Alan Modra * ppc-opc.c: Add "tlbsx." and "tlbsxe." for booke. diff --git a/opcodes/cgen-dis.in b/opcodes/cgen-dis.in index c78723e..7c59340 100644 --- a/opcodes/cgen-dis.in +++ b/opcodes/cgen-dis.in @@ -351,11 +351,21 @@ default_print_insn (cd, pc, info) Print one instruction from PC on INFO->STREAM. Return the size of the instruction (in bytes). */ +typedef struct cpu_desc_list { + struct cpu_desc_list *next; + int isa; + int mach; + int endian; + CGEN_CPU_DESC cd; +} cpu_desc_list; + int print_insn_@arch@ (pc, info) bfd_vma pc; disassemble_info *info; { + static cpu_desc_list *cd_list = 0; + cpu_desc_list *cl = 0; static CGEN_CPU_DESC cd = 0; static int prev_isa; static int prev_mach; @@ -389,15 +399,24 @@ print_insn_@arch@ (pc, info) isa = info->insn_sets; #endif - /* If we've switched cpu's, close the current table and open a new one. */ + /* If we've switched cpu's, try to find a handle we've used before */ if (cd && (isa != prev_isa || mach != prev_mach || endian != prev_endian)) { - @arch@_cgen_cpu_close (cd); cd = 0; - } + for (cl = cd_list; cl; cl = cl->next) + { + if (cl->isa == isa && + cl->mach == mach && + cl->endian == endian) + { + cd = cl->cd; + break; + } + } + } /* If we haven't initialized yet, initialize the opcode table. */ if (! cd) @@ -418,6 +437,16 @@ print_insn_@arch@ (pc, info) CGEN_CPU_OPEN_END); if (!cd) abort (); + + /* save this away for future reference */ + cl = xmalloc (sizeof (struct cpu_desc_list)); + cl->cd = cd; + cl->isa = isa; + cl->mach = mach; + cl->endian = endian; + cl->next = cd_list; + cd_list = cl; + @arch@_cgen_init_dis (cd); } diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c index 1e49597..70167f7 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c @@ -3065,6 +3065,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "addo.", XO(31,266,1,1), XO_MASK, PPCCOM, { RT, RA, RB } }, { "caxo.", XO(31,266,1,1), XO_MASK, PWRCOM, { RT, RA, RB } }, +{ "tlbiel", X(31,274), XRTRA_MASK, POWER4, { RB } }, + { "mfapidi", X(31,275), X_MASK, BOOKE, { RT, RA } }, { "lscbx", XRC(31,277,0), X_MASK, M601, { RT, RA, RB } }, diff --git a/opcodes/vax-dis.c b/opcodes/vax-dis.c index db39bfa..a97d4cd 100644 --- a/opcodes/vax-dis.c +++ b/opcodes/vax-dis.c @@ -1,5 +1,5 @@ /* Print VAX instructions. - Copyright 1995, 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright 1995, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Pauline Middelink This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *)); static int print_insn_arg PARAMS ((const char *, unsigned char *, bfd_vma, disassemble_info *)); static int print_insn_mode - PARAMS ((int, unsigned char *, bfd_vma, disassemble_info *)); + PARAMS ((const char *, int, unsigned char *, bfd_vma, disassemble_info *)); static char *reg_names[] = @@ -223,11 +223,12 @@ print_insn_arg (d, p0, addr, info) return p - p0; } - return print_insn_mode (arg_len, p0, addr, info); + return print_insn_mode (d, arg_len, p0, addr, info); } static int -print_insn_mode (size, p0, addr, info) +print_insn_mode (d, size, p0, addr, info) + const char *d; int size; unsigned char *p0; bfd_vma addr; /* PC for this arg to be relative to */ @@ -245,10 +246,13 @@ print_insn_mode (size, p0, addr, info) case 0x10: case 0x20: case 0x30: /* literal mode $number */ - (*info->fprintf_func) (info->stream, "$0x%x", mode); + if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h') + (*info->fprintf_func) (info->stream, "$0x%x [%c-float]", mode, d[1]); + else + (*info->fprintf_func) (info->stream, "$0x%x", mode); break; case 0x40: /* index: base-addr[Rn] */ - p += print_insn_mode (size, p0 + 1, addr + 1, info); + p += print_insn_mode (d, size, p0 + 1, addr + 1, info); (*info->fprintf_func) (info->stream, "[%s]", reg_names[reg]); break; case 0x50: /* register: Rn */ @@ -267,8 +271,30 @@ print_insn_mode (size, p0, addr, info) FETCH_DATA (info, p + size); (*info->fprintf_func) (info->stream, "$0x"); - for (i = 0; i < size; i++) - (*info->fprintf_func) (info->stream, "%02x", p[size - i - 1]); + if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h') + { + int float_word; + + float_word = p[0] | (p[1] << 8); + if ((d[1] == 'd' || d[1] == 'f') + && (float_word & 0xff80) == 0x8000) + { + (*info->fprintf_func) (info->stream, "[invalid %c-float]", + d[1]); + } + else + { + for (i = 0; i < size; i++) + (*info->fprintf_func) (info->stream, "%02x", + p[size - i - 1]); + (*info->fprintf_func) (info->stream, " [%c-float]", d[1]); + } + } + else + { + for (i = 0; i < size; i++) + (*info->fprintf_func) (info->stream, "%02x", p[size - i - 1]); + } p += size; } else diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 04c7e28..e10ef89 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,8 @@ +2002-05-09 Nick Clifton + + * armos.c (ARMul_OSHandleSWI): Support the RedBoot SWI in ARM + mode and some of its system calls. + 2002-03-17 Anthony Green * wrapper.c (mem_size): Increase the default target memory to 8MB. diff --git a/sim/arm/armos.c b/sim/arm/armos.c index 3b0db22..d833665 100644 --- a/sim/arm/armos.c +++ b/sim/arm/armos.c @@ -48,7 +48,7 @@ #endif #ifdef HAVE_UNISTD_H -#include /* For SEEK_SET etc */ +#include /* For SEEK_SET etc. */ #endif #ifdef __riscos @@ -86,13 +86,12 @@ extern int _fisatty (FILE *); #include "callback.h" extern host_callback *sim_callback; -extern unsigned ARMul_OSInit (ARMul_State * state); -extern void ARMul_OSExit (ARMul_State * state); -extern unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number); -extern unsigned ARMul_OSException (ARMul_State * state, ARMword vector, - ARMword pc); -extern ARMword ARMul_OSLastErrorP (ARMul_State * state); -extern ARMword ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr); +extern unsigned ARMul_OSInit (ARMul_State *); +extern void ARMul_OSExit (ARMul_State *); +extern unsigned ARMul_OSHandleSWI (ARMul_State *, ARMword); +extern unsigned ARMul_OSException (ARMul_State *, ARMword, ARMword); +extern ARMword ARMul_OSLastErrorP (ARMul_State *); +extern ARMword ARMul_Debug (ARMul_State *, ARMword, ARMword); #define BUFFERSIZE 4096 #ifndef FOPEN_MAX @@ -164,15 +163,16 @@ ARMul_OSInit (ARMul_State * state) OSptr = (struct OSblock *) state->OSptr; OSptr->ErrorP = 0; - state->Reg[13] = ADDRSUPERSTACK; /* set up a stack for the current mode */ - ARMul_SetReg (state, SVC32MODE, 13, ADDRSUPERSTACK); /* and for supervisor mode */ - ARMul_SetReg (state, ABORT32MODE, 13, ADDRSUPERSTACK); /* and for abort 32 mode */ - ARMul_SetReg (state, UNDEF32MODE, 13, ADDRSUPERSTACK); /* and for undef 32 mode */ - ARMul_SetReg (state, SYSTEMMODE, 13, ADDRSUPERSTACK); /* and for system mode */ - instr = 0xe59ff000 | (ADDRSOFTVECTORS - 8); /* load pc from soft vector */ + state->Reg[13] = ADDRSUPERSTACK; /* Set up a stack for the current mode... */ + ARMul_SetReg (state, SVC32MODE, 13, ADDRSUPERSTACK);/* ...and for supervisor mode... */ + ARMul_SetReg (state, ABORT32MODE, 13, ADDRSUPERSTACK);/* ...and for abort 32 mode... */ + ARMul_SetReg (state, UNDEF32MODE, 13, ADDRSUPERSTACK);/* ...and for undef 32 mode... */ + ARMul_SetReg (state, SYSTEMMODE, 13, ADDRSUPERSTACK);/* ...and for system mode. */ + instr = 0xe59ff000 | (ADDRSOFTVECTORS - 8); /* Load pc from soft vector */ for (i = ARMul_ResetV; i <= ARMFIQV; i += 4) - ARMul_WriteWord (state, i, instr); /* write hardware vectors */ + /* Write hardware vectors. */ + ARMul_WriteWord (state, i, instr); SWI_vector_installed = 0; @@ -196,16 +196,19 @@ ARMul_OSInit (ARMul_State * state) /* #ifndef ASIM */ - /* install fpe */ - for (i = 0; i < fpesize; i += 4) /* copy the code */ + /* Install FPE. */ + for (i = 0; i < fpesize; i += 4) + /* Copy the code. */ ARMul_WriteWord (state, FPESTART + i, fpecode[i >> 2]); for (i = FPESTART + fpesize;; i -= 4) - { /* reverse the error strings */ + { + /* Reverse the error strings. */ if ((j = ARMul_ReadWord (state, i)) == 0xffffffff) break; if (state->bigendSig && j < 0x80000000) - { /* it's part of the string so swap it */ + { + /* It's part of the string so swap it. */ j = ((j >> 0x18) & 0x000000ff) | ((j >> 0x08) & 0x0000ff00) | ((j << 0x08) & 0x00ff0000) | ((j << 0x18) & 0xff000000); @@ -213,8 +216,10 @@ ARMul_OSInit (ARMul_State * state) } } - ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, 4)); /* copy old illegal instr vector */ - ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4))); /* install new vector */ + /* Copy old illegal instr vector. */ + ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, 4)); + /* Install new vector. */ + ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4))); ARMul_ConsolePrint (state, ", FPE"); /* #endif ASIM */ @@ -321,8 +326,10 @@ SWIread (ARMul_State * state, ARMword f, ARMword ptr, ARMword len) if (local == NULL) { - sim_callback->printf_filtered (sim_callback, "sim: Unable to read 0x%ulx bytes - out of memory\n", - len); + sim_callback->printf_filtered + (sim_callback, + "sim: Unable to read 0x%ulx bytes - out of memory\n", + len); return; } @@ -346,8 +353,10 @@ SWIwrite (ARMul_State * state, ARMword f, ARMword ptr, ARMword len) if (local == NULL) { - sim_callback->printf_filtered (sim_callback, "sim: Unable to write 0x%lx bytes - out of memory\n", - (long) len); + sim_callback->printf_filtered + (sim_callback, + "sim: Unable to write 0x%lx bytes - out of memory\n", + (long) len); return; } @@ -580,10 +589,10 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) else temp = ADDRUSERSTACK; - ARMul_WriteWord (state, addr, 0); /* Heap base */ - ARMul_WriteWord (state, addr + 4, temp); /* Heap limit */ - ARMul_WriteWord (state, addr + 8, temp); /* Stack base */ - ARMul_WriteWord (state, addr + 12, temp); /* Stack limit */ + ARMul_WriteWord (state, addr, 0); /* Heap base. */ + ARMul_WriteWord (state, addr + 4, temp); /* Heap limit. */ + ARMul_WriteWord (state, addr + 8, temp); /* Stack base. */ + ARMul_WriteWord (state, addr + 12, temp); /* Stack limit. */ break; case AngelSWI_Reason_ReportException: @@ -635,6 +644,73 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) /* These are used by the FPE code. */ break; + case 0x180001: /* RedBoot's Syscall SWI in ARM mode. */ + switch (state->Reg[0]) + { + /* These numbers are defined in libgloss/syscall.h + but the simulator should not be dependend upon + libgloss being installed. */ + case 1: /* Exit. */ + state->Emulate = FALSE; + return TRUE; + + case 2: /* Open. */ + SWIopen (state, state->Reg[1], state->Reg[2]); + return TRUE; + + case 3: /* Close. */ + state->Reg[0] = sim_callback->close (sim_callback, state->Reg[1]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + return TRUE; + + case 4: /* Read. */ + SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]); + return TRUE; + + case 5: /* Write. */ + SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]); + return TRUE; + + case 6: /* Lseek. */ + state->Reg[0] = sim_callback->lseek (sim_callback, + state->Reg[1], + state->Reg[2], + state->Reg[3]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + return TRUE; + + case 17: /* Utime. */ + state->Reg[0] = (ARMword) sim_callback->time (sim_callback, + (long *) state->Reg[1]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + return TRUE; + + case 7: /* Unlink. */ + case 8: /* Getpid. */ + case 9: /* Kill. */ + case 10: /* Fstat. */ + case 11: /* Sbrk. */ + case 12: /* Argvlen. */ + case 13: /* Argv. */ + case 14: /* ChDir. */ + case 15: /* Stat. */ + case 16: /* Chmod. */ + case 18: /* Time. */ + sim_callback->printf_filtered + (sim_callback, + "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n", + state->Reg[0]); + return FALSE; + + default: + sim_callback->printf_filtered + (sim_callback, + "sim: unknown RedBoot syscall '%d' encountered - ignoring\n", + state->Reg[0]); + return FALSE; + } + return TRUE; + default: /* If there is a SWI vector installed use it. */ if (state->is_XScale && saved_number != -1) @@ -661,7 +737,10 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) } else { - sim_callback->printf_filtered (sim_callback, "sim: unknown SWI encountered - %x - ignoring\n", number); + sim_callback->printf_filtered + (sim_callback, + "sim: unknown SWI encountered - %x - ignoring\n", + number); return FALSE; } } -- cgit v1.1