From 11308f70b39a78aae01eb7b0fbe5e23e9a8313ee Mon Sep 17 00:00:00 2001 From: nobody <> Date: Jun 13 2003 21:56:28 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'jimb- ppc64-linux-20030613-branch'. Sprout from cagney_convert-20030606-branch 2003-06-06 10:04:21 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from master 2003-06-13 21:56:27 UTC Jim Blandy '* solib-svr4.c (solib_break_names): Recognize the 64-bit PowerPC': COPYING.LIBGLOSS ChangeLog Makefile.in Makefile.tpl bfd/ChangeLog bfd/Makefile.am bfd/Makefile.in bfd/archures.c bfd/bfd-in2.h bfd/config.bfd bfd/configure bfd/configure.in bfd/cpu-h8300.c bfd/ecoff.c bfd/elf32-h8300.c bfd/elf32-mips.c bfd/elf64-mips.c bfd/elf64-ppc.c bfd/elf64-ppc.h bfd/elfn32-mips.c bfd/elfxx-mips.c bfd/elfxx-mips.h bfd/opncls.c bfd/po/Make-in bfd/po/SRC-POTFILES.in bfd/section.c bfd/version.h config.guess config.sub configure configure.in cpu/ChangeLog cpu/frv.cpu cpu/iq10.cpu cpu/iq2000.cpu cpu/iq2000.opc cpu/iq2000m.cpu gdb/ChangeLog gdb/Makefile.in gdb/abug-rom.c gdb/acinclude.m4 gdb/aclocal.m4 gdb/ada-lang.c gdb/alpha-tdep.c gdb/arch-utils.c gdb/arch-utils.h gdb/arm-linux-tdep.c gdb/arm-tdep.c gdb/avr-tdep.c gdb/block.h gdb/breakpoint.c gdb/buildsym.c gdb/charset.c gdb/cli/cli-cmds.c gdb/cli/cli-decode.c gdb/cli/cli-dump.c gdb/cli/cli-interp.c gdb/cli/cli-script.c gdb/coffread.c gdb/config.in gdb/config/arm/tm-linux.h gdb/config/h8300/tm-h8300.h gdb/config/m68k/tm-delta68.h gdb/config/m68k/tm-m68klynx.h gdb/config/m68k/tm-sun3.h gdb/config/pa/tm-hppa.h gdb/config/pa/tm-hppa64.h gdb/config/powerpc/nm-ppc64-linux.h gdb/config/powerpc/ppc64-linux.mh gdb/config/powerpc/tm-linux.h gdb/config/sh/tm-sh.h gdb/config/sparc/tm-sparc.h gdb/config/vax/tm-vax.h gdb/configure gdb/configure.host gdb/configure.in gdb/configure.tgt gdb/cp-abi.c gdb/cp-namespace.c gdb/cp-support.c gdb/cp-support.h gdb/cpu32bug-rom.c gdb/cris-tdep.c gdb/d10v-tdep.c gdb/dbug-rom.c gdb/dbxread.c gdb/defs.h gdb/dictionary.c gdb/dictionary.h gdb/dink32-rom.c gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/doublest.c gdb/dummy-frame.c gdb/dwarf2-frame.c gdb/dwarf2expr.h gdb/dwarf2read.c gdb/dwarfread.c gdb/elfread.c gdb/findvar.c gdb/frame-base.c gdb/frame-unwind.c gdb/frame.c gdb/frame.h gdb/frv-tdep.c gdb/gdb-stabs.h gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/gdbserver/ChangeLog gdb/gdbserver/configure.srv gdb/gdbtypes.c gdb/gnu-v2-abi.c gdb/gnu-v3-abi.c gdb/h8300-tdep.c gdb/hpacc-abi.c gdb/hppa-tdep.c gdb/hpread.c gdb/i386-interix-tdep.c gdb/i386-tdep.c gdb/ia64-tdep.c gdb/infcall.c gdb/infcmd.c gdb/inferior.h gdb/interps.c gdb/interps.h gdb/jv-exp.y gdb/jv-lang.c gdb/linespec.c gdb/m68hc11-tdep.c gdb/m68k-tdep.c gdb/m68klinux-tdep.c gdb/macrocmd.c gdb/macrotab.c gdb/main.c gdb/maint.c gdb/mcore-tdep.c gdb/mdebugread.c gdb/memattr.c gdb/mi/ChangeLog gdb/mi/mi-cmd-stack.c gdb/mi/mi-interp.c gdb/mi/mi-main.c gdb/mi/mi-parse.c gdb/mips-tdep.c gdb/mips-tdep.h gdb/mn10300-tdep.c gdb/monitor.c gdb/nlm/configure gdb/nlm/configure.in gdb/ns32k-tdep.c gdb/ns32knbsd-tdep.c gdb/objc-exp.y gdb/objc-lang.c gdb/objc-lang.h gdb/objfiles.c gdb/ocd.c gdb/osabi.c gdb/p-exp.y gdb/p-valprint.c gdb/pa64solib.c gdb/ppc-bdm.c gdb/ppc-linux-nat.c gdb/ppc-linux-tdep.c gdb/ppcbug-rom.c gdb/printcmd.c gdb/regcache.c gdb/reggroups.c gdb/remote-e7000.c gdb/remote-est.c gdb/remote-fileio.c gdb/remote-fileio.h gdb/remote-hms.c gdb/remote-mips.c gdb/remote-rdi.c gdb/remote-rdp.c gdb/remote.c gdb/remote.h gdb/rom68k-rom.c gdb/rs6000-nat.c gdb/rs6000-tdep.c gdb/s390-tdep.c gdb/sentinel-frame.c gdb/ser-e7kpc.c gdb/sh-tdep.c gdb/sh3-rom.c gdb/signals/signals.c gdb/solib-legacy.c gdb/solib-svr4.c gdb/solib.c gdb/somread.c gdb/sparc-tdep.c gdb/stack.c gdb/stack.h gdb/std-regs.c gdb/symfile.c gdb/symfile.h gdb/symmisc.c gdb/symtab.c gdb/symtab.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/attach.exp gdb/testsuite/gdb.base/fileio.c gdb/testsuite/gdb.base/fileio.exp gdb/testsuite/gdb.base/float.exp gdb/testsuite/gdb.base/gdb_history gdb/testsuite/gdb.base/readline.exp gdb/testsuite/gdb.base/shreloc.c gdb/testsuite/gdb.base/shreloc.exp gdb/testsuite/gdb.base/shreloc1.c gdb/testsuite/gdb.base/shreloc2.c gdb/testsuite/gdb.base/signals.exp gdb/testsuite/gdb.c++/Makefile.in gdb/testsuite/gdb.c++/ambiguous.cc gdb/testsuite/gdb.c++/ambiguous.exp gdb/testsuite/gdb.c++/annota2.cc gdb/testsuite/gdb.c++/annota2.exp gdb/testsuite/gdb.c++/anon-union.cc gdb/testsuite/gdb.c++/anon-union.exp gdb/testsuite/gdb.c++/casts.cc gdb/testsuite/gdb.c++/casts.exp gdb/testsuite/gdb.c++/classes.exp gdb/testsuite/gdb.c++/cplusfuncs.cc gdb/testsuite/gdb.c++/cplusfuncs.exp gdb/testsuite/gdb.c++/ctti.exp gdb/testsuite/gdb.c++/cttiadd.cc gdb/testsuite/gdb.c++/cttiadd1.cc gdb/testsuite/gdb.c++/cttiadd2.cc gdb/testsuite/gdb.c++/cttiadd3.cc gdb/testsuite/gdb.c++/demangle.exp gdb/testsuite/gdb.c++/derivation.cc gdb/testsuite/gdb.c++/derivation.exp gdb/testsuite/gdb.c++/hang.H gdb/testsuite/gdb.c++/hang.exp gdb/testsuite/gdb.c++/hang1.C gdb/testsuite/gdb.c++/hang2.C gdb/testsuite/gdb.c++/hang3.C gdb/testsuite/gdb.c++/inherit.exp gdb/testsuite/gdb.c++/local.cc gdb/testsuite/gdb.c++/local.exp gdb/testsuite/gdb.c++/m-data.cc gdb/testsuite/gdb.c++/m-data.exp gdb/testsuite/gdb.c++/m-static.cc gdb/testsuite/gdb.c++/m-static.exp gdb/testsuite/gdb.c++/m-static.h gdb/testsuite/gdb.c++/m-static1.cc gdb/testsuite/gdb.c++/maint.exp gdb/testsuite/gdb.c++/member-ptr.cc gdb/testsuite/gdb.c++/member-ptr.exp gdb/testsuite/gdb.c++/method.cc gdb/testsuite/gdb.c++/method.exp gdb/testsuite/gdb.c++/misc.cc gdb/testsuite/gdb.c++/misc.exp gdb/testsuite/gdb.c++/namespace.cc gdb/testsuite/gdb.c++/namespace.exp gdb/testsuite/gdb.c++/namespace1.cc gdb/testsuite/gdb.c++/overload.cc gdb/testsuite/gdb.c++/overload.exp gdb/testsuite/gdb.c++/ovldbreak.cc gdb/testsuite/gdb.c++/ovldbreak.exp gdb/testsuite/gdb.c++/pr-1023.cc gdb/testsuite/gdb.c++/pr-1023.exp gdb/testsuite/gdb.c++/pr-574.cc gdb/testsuite/gdb.c++/pr-574.exp gdb/testsuite/gdb.c++/printmethod.cc gdb/testsuite/gdb.c++/printmethod.exp gdb/testsuite/gdb.c++/psmang.exp gdb/testsuite/gdb.c++/psmang1.cc gdb/testsuite/gdb.c++/psmang2.cc gdb/testsuite/gdb.c++/ref-types.cc gdb/testsuite/gdb.c++/ref-types.exp gdb/testsuite/gdb.c++/rtti.exp gdb/testsuite/gdb.c++/rtti.h gdb/testsuite/gdb.c++/rtti1.cc gdb/testsuite/gdb.c++/rtti2.cc gdb/testsuite/gdb.c++/templates.cc gdb/testsuite/gdb.c++/templates.exp gdb/testsuite/gdb.c++/try_catch.cc gdb/testsuite/gdb.c++/try_catch.exp gdb/testsuite/gdb.c++/userdef.cc gdb/testsuite/gdb.c++/userdef.exp gdb/testsuite/gdb.c++/virtfunc.cc gdb/testsuite/gdb.c++/virtfunc.exp gdb/testsuite/gdb.objc/Makefile.in gdb/testsuite/gdb.objc/basicclass.exp gdb/testsuite/gdb.objc/basicclass.m gdb/top.c gdb/top.h gdb/tracepoint.c gdb/trad-frame.c gdb/trad-frame.h gdb/tui/ChangeLog gdb/tui/tui-hooks.c gdb/tui/tuiDisassem.c gdb/tui/tuiSource.c gdb/tui/tuiSourceWin.c gdb/tui/tuiStack.c gdb/tui/tuiWin.c gdb/typeprint.c gdb/ui-file.c gdb/ui-file.h gdb/ui-out.c gdb/v850-tdep.c gdb/valops.c gdb/vax-tdep.c gdb/version.in gdb/win32-nat.c gdb/wince.c gdb/x86-64-tdep.c gdb/xcoffread.c gdb/xstormy16-tdep.c include/elf/ChangeLog include/elf/common.h include/elf/h8.h include/gdb/ChangeLog include/gdb/fileio.h include/opcode/ChangeLog include/opcode/h8300.h include/opcode/ppc.h libiberty/ChangeLog libiberty/config.in libiberty/configure libiberty/configure.in libiberty/physmem.c opcodes/ChangeLog opcodes/Makefile.am opcodes/Makefile.in opcodes/cgen-asm.in opcodes/fr30-asm.c opcodes/fr30-desc.c opcodes/fr30-desc.h opcodes/frv-asm.c opcodes/frv-desc.c opcodes/frv-desc.h opcodes/h8300-dis.c opcodes/ip2k-asm.c opcodes/ip2k-desc.c opcodes/ip2k-desc.h opcodes/iq2000-asm.c opcodes/iq2000-desc.c opcodes/iq2000-desc.h opcodes/m32r-asm.c opcodes/m32r-desc.c opcodes/m32r-desc.h opcodes/m32r-opc.c opcodes/openrisc-asm.c opcodes/openrisc-desc.c opcodes/openrisc-desc.h opcodes/po/Make-in opcodes/po/POTFILES.in opcodes/ppc-opc.c opcodes/xstormy16-asm.c opcodes/xstormy16-desc.c opcodes/xstormy16-desc.h Cherrypick from master 2003-03-19 06:21:14 UTC Kevin Buettner 'Print correct register names for MIPS targets using n32/n64 ABIs.': gdb/config/mips/bigmips.mt gdb/config/mips/bigmips64.mt gdb/config/mips/decstation.mt gdb/config/mips/littlemips.mt gdb/config/mips/tm-bigmips.h gdb/config/mips/tm-bigmips64.h gdb/config/mips/tm-embed64.h gdb/config/mips/tm-embedl.h gdb/config/mips/tm-embedl64.h gdb/config/mips/tm-tx39l.h gdb/config/mips/tm-vr4100.h gdb/config/mips/tm-vr4300.h gdb/config/mips/tm-vr4300el.h gdb/config/mips/tm-vr4xxx.h gdb/config/mips/tm-vr4xxxel.h gdb/config/mips/tm-vr5000.h gdb/config/mips/tm-vr5000el.h gdb/config/mips/vr4100.mt gdb/config/mips/vr4300.mt gdb/config/mips/vr4300el.mt gdb/config/mips/vr4xxx.mt gdb/config/mips/vr4xxxel.mt gdb/config/mips/vr5000.mt gdb/config/mips/vr5000el.mt Cherrypick from jimb-ppc64-linux-20030528-branch 2003-05-29 23:06:59 UTC Jim Blandy 'gdb/ChangeLog:': gdb/gdbserver/linux-ppc64-low.c gdb/regformats/reg-ppc64.dat Delete: sim/testsuite/sim/sh64/ChangeLog sim/testsuite/sim/sh64/compact.exp sim/testsuite/sim/sh64/compact/ChangeLog sim/testsuite/sim/sh64/compact/add.cgs sim/testsuite/sim/sh64/compact/addc.cgs sim/testsuite/sim/sh64/compact/addi.cgs sim/testsuite/sim/sh64/compact/addv.cgs sim/testsuite/sim/sh64/compact/and.cgs sim/testsuite/sim/sh64/compact/andb.cgs sim/testsuite/sim/sh64/compact/andi.cgs sim/testsuite/sim/sh64/compact/bf.cgs sim/testsuite/sim/sh64/compact/bfs.cgs sim/testsuite/sim/sh64/compact/bra.cgs sim/testsuite/sim/sh64/compact/braf.cgs sim/testsuite/sim/sh64/compact/brk.cgs sim/testsuite/sim/sh64/compact/bsr.cgs sim/testsuite/sim/sh64/compact/bsrf.cgs sim/testsuite/sim/sh64/compact/bt.cgs sim/testsuite/sim/sh64/compact/bts.cgs sim/testsuite/sim/sh64/compact/clrmac.cgs sim/testsuite/sim/sh64/compact/clrs.cgs sim/testsuite/sim/sh64/compact/clrt.cgs sim/testsuite/sim/sh64/compact/cmpeq.cgs sim/testsuite/sim/sh64/compact/cmpeqi.cgs sim/testsuite/sim/sh64/compact/cmpge.cgs sim/testsuite/sim/sh64/compact/cmpgt.cgs sim/testsuite/sim/sh64/compact/cmphi.cgs sim/testsuite/sim/sh64/compact/cmphs.cgs sim/testsuite/sim/sh64/compact/cmppl.cgs sim/testsuite/sim/sh64/compact/cmppz.cgs sim/testsuite/sim/sh64/compact/cmpstr.cgs sim/testsuite/sim/sh64/compact/div0s.cgs sim/testsuite/sim/sh64/compact/div0u.cgs sim/testsuite/sim/sh64/compact/div1.cgs sim/testsuite/sim/sh64/compact/dmulsl.cgs sim/testsuite/sim/sh64/compact/dmulul.cgs sim/testsuite/sim/sh64/compact/dt.cgs sim/testsuite/sim/sh64/compact/extsb.cgs sim/testsuite/sim/sh64/compact/extsw.cgs sim/testsuite/sim/sh64/compact/extub.cgs sim/testsuite/sim/sh64/compact/extuw.cgs sim/testsuite/sim/sh64/compact/fabs.cgs sim/testsuite/sim/sh64/compact/fadd.cgs sim/testsuite/sim/sh64/compact/fcmpeq.cgs sim/testsuite/sim/sh64/compact/fcmpgt.cgs sim/testsuite/sim/sh64/compact/fcnvds.cgs sim/testsuite/sim/sh64/compact/fcnvsd.cgs sim/testsuite/sim/sh64/compact/fdiv.cgs sim/testsuite/sim/sh64/compact/fipr.cgs sim/testsuite/sim/sh64/compact/fldi0.cgs sim/testsuite/sim/sh64/compact/fldi1.cgs sim/testsuite/sim/sh64/compact/flds.cgs sim/testsuite/sim/sh64/compact/float.cgs sim/testsuite/sim/sh64/compact/fmac.cgs sim/testsuite/sim/sh64/compact/fmov.cgs sim/testsuite/sim/sh64/compact/fmul.cgs sim/testsuite/sim/sh64/compact/fneg.cgs sim/testsuite/sim/sh64/compact/frchg.cgs sim/testsuite/sim/sh64/compact/fschg.cgs sim/testsuite/sim/sh64/compact/fsqrt.cgs sim/testsuite/sim/sh64/compact/fsts.cgs sim/testsuite/sim/sh64/compact/fsub.cgs sim/testsuite/sim/sh64/compact/ftrc.cgs sim/testsuite/sim/sh64/compact/ftrv.cgs sim/testsuite/sim/sh64/compact/jmp.cgs sim/testsuite/sim/sh64/compact/jsr.cgs sim/testsuite/sim/sh64/compact/ldc-gbr.cgs sim/testsuite/sim/sh64/compact/ldcl-gbr.cgs sim/testsuite/sim/sh64/compact/lds-fpscr.cgs sim/testsuite/sim/sh64/compact/lds-fpul.cgs sim/testsuite/sim/sh64/compact/lds-mach.cgs sim/testsuite/sim/sh64/compact/lds-macl.cgs sim/testsuite/sim/sh64/compact/lds-pr.cgs sim/testsuite/sim/sh64/compact/ldsl-fpscr.cgs sim/testsuite/sim/sh64/compact/ldsl-fpul.cgs sim/testsuite/sim/sh64/compact/ldsl-mach.cgs sim/testsuite/sim/sh64/compact/ldsl-macl.cgs sim/testsuite/sim/sh64/compact/ldsl-pr.cgs sim/testsuite/sim/sh64/compact/macl.cgs sim/testsuite/sim/sh64/compact/macw.cgs sim/testsuite/sim/sh64/compact/mov.cgs sim/testsuite/sim/sh64/compact/mova.cgs sim/testsuite/sim/sh64/compact/movb1.cgs sim/testsuite/sim/sh64/compact/movb10.cgs sim/testsuite/sim/sh64/compact/movb2.cgs sim/testsuite/sim/sh64/compact/movb3.cgs sim/testsuite/sim/sh64/compact/movb4.cgs sim/testsuite/sim/sh64/compact/movb5.cgs sim/testsuite/sim/sh64/compact/movb6.cgs sim/testsuite/sim/sh64/compact/movb7.cgs sim/testsuite/sim/sh64/compact/movb8.cgs sim/testsuite/sim/sh64/compact/movb9.cgs sim/testsuite/sim/sh64/compact/movcal.cgs sim/testsuite/sim/sh64/compact/movi.cgs sim/testsuite/sim/sh64/compact/movl1.cgs sim/testsuite/sim/sh64/compact/movl10.cgs sim/testsuite/sim/sh64/compact/movl11.cgs sim/testsuite/sim/sh64/compact/movl2.cgs sim/testsuite/sim/sh64/compact/movl3.cgs sim/testsuite/sim/sh64/compact/movl4.cgs sim/testsuite/sim/sh64/compact/movl5.cgs sim/testsuite/sim/sh64/compact/movl6.cgs sim/testsuite/sim/sh64/compact/movl7.cgs sim/testsuite/sim/sh64/compact/movl8.cgs sim/testsuite/sim/sh64/compact/movl9.cgs sim/testsuite/sim/sh64/compact/movt.cgs sim/testsuite/sim/sh64/compact/movw1.cgs sim/testsuite/sim/sh64/compact/movw10.cgs sim/testsuite/sim/sh64/compact/movw11.cgs sim/testsuite/sim/sh64/compact/movw2.cgs sim/testsuite/sim/sh64/compact/movw3.cgs sim/testsuite/sim/sh64/compact/movw4.cgs sim/testsuite/sim/sh64/compact/movw5.cgs sim/testsuite/sim/sh64/compact/movw6.cgs sim/testsuite/sim/sh64/compact/movw7.cgs sim/testsuite/sim/sh64/compact/movw8.cgs sim/testsuite/sim/sh64/compact/movw9.cgs sim/testsuite/sim/sh64/compact/mull.cgs sim/testsuite/sim/sh64/compact/mulsw.cgs sim/testsuite/sim/sh64/compact/muluw.cgs sim/testsuite/sim/sh64/compact/neg.cgs sim/testsuite/sim/sh64/compact/negc.cgs sim/testsuite/sim/sh64/compact/nop.cgs sim/testsuite/sim/sh64/compact/not.cgs sim/testsuite/sim/sh64/compact/ocbi.cgs sim/testsuite/sim/sh64/compact/ocbp.cgs sim/testsuite/sim/sh64/compact/ocbwb.cgs sim/testsuite/sim/sh64/compact/or.cgs sim/testsuite/sim/sh64/compact/orb.cgs sim/testsuite/sim/sh64/compact/ori.cgs sim/testsuite/sim/sh64/compact/pref.cgs sim/testsuite/sim/sh64/compact/rotcl.cgs sim/testsuite/sim/sh64/compact/rotcr.cgs sim/testsuite/sim/sh64/compact/rotl.cgs sim/testsuite/sim/sh64/compact/rotr.cgs sim/testsuite/sim/sh64/compact/rts.cgs sim/testsuite/sim/sh64/compact/sets.cgs sim/testsuite/sim/sh64/compact/sett.cgs sim/testsuite/sim/sh64/compact/shad.cgs sim/testsuite/sim/sh64/compact/shal.cgs sim/testsuite/sim/sh64/compact/shar.cgs sim/testsuite/sim/sh64/compact/shld.cgs sim/testsuite/sim/sh64/compact/shll.cgs sim/testsuite/sim/sh64/compact/shll16.cgs sim/testsuite/sim/sh64/compact/shll2.cgs sim/testsuite/sim/sh64/compact/shll8.cgs sim/testsuite/sim/sh64/compact/shlr.cgs sim/testsuite/sim/sh64/compact/shlr16.cgs sim/testsuite/sim/sh64/compact/shlr2.cgs sim/testsuite/sim/sh64/compact/shlr8.cgs sim/testsuite/sim/sh64/compact/stc-gbr.cgs sim/testsuite/sim/sh64/compact/stcl-gbr.cgs sim/testsuite/sim/sh64/compact/sts-fpscr.cgs sim/testsuite/sim/sh64/compact/sts-fpul.cgs sim/testsuite/sim/sh64/compact/sts-mach.cgs sim/testsuite/sim/sh64/compact/sts-macl.cgs sim/testsuite/sim/sh64/compact/sts-pr.cgs sim/testsuite/sim/sh64/compact/stsl-fpscr.cgs sim/testsuite/sim/sh64/compact/stsl-fpul.cgs sim/testsuite/sim/sh64/compact/stsl-mach.cgs sim/testsuite/sim/sh64/compact/stsl-macl.cgs sim/testsuite/sim/sh64/compact/stsl-pr.cgs sim/testsuite/sim/sh64/compact/sub.cgs sim/testsuite/sim/sh64/compact/subc.cgs sim/testsuite/sim/sh64/compact/subv.cgs sim/testsuite/sim/sh64/compact/swapb.cgs sim/testsuite/sim/sh64/compact/swapw.cgs sim/testsuite/sim/sh64/compact/tasb.cgs sim/testsuite/sim/sh64/compact/testutils.inc sim/testsuite/sim/sh64/compact/trapa.cgs sim/testsuite/sim/sh64/compact/tst.cgs sim/testsuite/sim/sh64/compact/tstb.cgs sim/testsuite/sim/sh64/compact/tsti.cgs sim/testsuite/sim/sh64/compact/xor.cgs sim/testsuite/sim/sh64/compact/xorb.cgs sim/testsuite/sim/sh64/compact/xori.cgs sim/testsuite/sim/sh64/compact/xtrct.cgs sim/testsuite/sim/sh64/interwork.exp sim/testsuite/sim/sh64/media.exp sim/testsuite/sim/sh64/media/ChangeLog sim/testsuite/sim/sh64/media/add.cgs sim/testsuite/sim/sh64/media/addi.cgs sim/testsuite/sim/sh64/media/addil.cgs sim/testsuite/sim/sh64/media/addl.cgs sim/testsuite/sim/sh64/media/addzl.cgs sim/testsuite/sim/sh64/media/alloco.cgs sim/testsuite/sim/sh64/media/and.cgs sim/testsuite/sim/sh64/media/andc.cgs sim/testsuite/sim/sh64/media/andi.cgs sim/testsuite/sim/sh64/media/beq.cgs sim/testsuite/sim/sh64/media/beqi.cgs sim/testsuite/sim/sh64/media/bge.cgs sim/testsuite/sim/sh64/media/bgeu.cgs sim/testsuite/sim/sh64/media/bgt.cgs sim/testsuite/sim/sh64/media/bgtu.cgs sim/testsuite/sim/sh64/media/blink.cgs sim/testsuite/sim/sh64/media/bne.cgs sim/testsuite/sim/sh64/media/bnei.cgs sim/testsuite/sim/sh64/media/brk.cgs sim/testsuite/sim/sh64/media/byterev.cgs sim/testsuite/sim/sh64/media/cmpeq.cgs sim/testsuite/sim/sh64/media/cmpgt.cgs sim/testsuite/sim/sh64/media/cmpgtu.cgs sim/testsuite/sim/sh64/media/cmveq.cgs sim/testsuite/sim/sh64/media/cmvne.cgs sim/testsuite/sim/sh64/media/fabsd.cgs sim/testsuite/sim/sh64/media/fabss.cgs sim/testsuite/sim/sh64/media/faddd.cgs sim/testsuite/sim/sh64/media/fadds.cgs sim/testsuite/sim/sh64/media/fcmpeqd.cgs sim/testsuite/sim/sh64/media/fcmpeqs.cgs sim/testsuite/sim/sh64/media/fcmpged.cgs sim/testsuite/sim/sh64/media/fcmpges.cgs sim/testsuite/sim/sh64/media/fcmpgtd.cgs sim/testsuite/sim/sh64/media/fcmpgts.cgs sim/testsuite/sim/sh64/media/fcmpund.cgs sim/testsuite/sim/sh64/media/fcmpuns.cgs sim/testsuite/sim/sh64/media/fcnvds.cgs sim/testsuite/sim/sh64/media/fcnvsd.cgs sim/testsuite/sim/sh64/media/fdivd.cgs sim/testsuite/sim/sh64/media/fdivs.cgs sim/testsuite/sim/sh64/media/fgetscr.cgs sim/testsuite/sim/sh64/media/fiprs.cgs sim/testsuite/sim/sh64/media/fldd.cgs sim/testsuite/sim/sh64/media/fldp.cgs sim/testsuite/sim/sh64/media/flds.cgs sim/testsuite/sim/sh64/media/fldxd.cgs sim/testsuite/sim/sh64/media/fldxp.cgs sim/testsuite/sim/sh64/media/fldxs.cgs sim/testsuite/sim/sh64/media/floatld.cgs sim/testsuite/sim/sh64/media/floatls.cgs sim/testsuite/sim/sh64/media/floatqd.cgs sim/testsuite/sim/sh64/media/floatqs.cgs sim/testsuite/sim/sh64/media/fmacs.cgs sim/testsuite/sim/sh64/media/fmovd.cgs sim/testsuite/sim/sh64/media/fmovdq.cgs sim/testsuite/sim/sh64/media/fmovls.cgs sim/testsuite/sim/sh64/media/fmovqd.cgs sim/testsuite/sim/sh64/media/fmovs.cgs sim/testsuite/sim/sh64/media/fmovsl.cgs sim/testsuite/sim/sh64/media/fmuld.cgs sim/testsuite/sim/sh64/media/fmuls.cgs sim/testsuite/sim/sh64/media/fnegd.cgs sim/testsuite/sim/sh64/media/fnegs.cgs sim/testsuite/sim/sh64/media/fputscr.cgs sim/testsuite/sim/sh64/media/fsqrtd.cgs sim/testsuite/sim/sh64/media/fsqrts.cgs sim/testsuite/sim/sh64/media/fstd.cgs sim/testsuite/sim/sh64/media/fstp.cgs sim/testsuite/sim/sh64/media/fsts.cgs sim/testsuite/sim/sh64/media/fstxd.cgs sim/testsuite/sim/sh64/media/fstxp.cgs sim/testsuite/sim/sh64/media/fstxs.cgs sim/testsuite/sim/sh64/media/fsubd.cgs sim/testsuite/sim/sh64/media/fsubs.cgs sim/testsuite/sim/sh64/media/ftrcdl.cgs sim/testsuite/sim/sh64/media/ftrcdq.cgs sim/testsuite/sim/sh64/media/ftrcsl.cgs sim/testsuite/sim/sh64/media/ftrcsq.cgs sim/testsuite/sim/sh64/media/ftrvs.cgs sim/testsuite/sim/sh64/media/getcfg.cgs sim/testsuite/sim/sh64/media/getcon.cgs sim/testsuite/sim/sh64/media/gettr.cgs sim/testsuite/sim/sh64/media/icbi.cgs sim/testsuite/sim/sh64/media/ldb.cgs sim/testsuite/sim/sh64/media/ldhil.cgs sim/testsuite/sim/sh64/media/ldhiq.cgs sim/testsuite/sim/sh64/media/ldl.cgs sim/testsuite/sim/sh64/media/ldlol.cgs sim/testsuite/sim/sh64/media/ldloq.cgs sim/testsuite/sim/sh64/media/ldq.cgs sim/testsuite/sim/sh64/media/ldub.cgs sim/testsuite/sim/sh64/media/lduw.cgs sim/testsuite/sim/sh64/media/ldw.cgs sim/testsuite/sim/sh64/media/ldxb.cgs sim/testsuite/sim/sh64/media/ldxl.cgs sim/testsuite/sim/sh64/media/ldxq.cgs sim/testsuite/sim/sh64/media/ldxub.cgs sim/testsuite/sim/sh64/media/ldxuw.cgs sim/testsuite/sim/sh64/media/ldxw.cgs sim/testsuite/sim/sh64/media/mabsl.cgs sim/testsuite/sim/sh64/media/mabsw.cgs sim/testsuite/sim/sh64/media/maddl.cgs sim/testsuite/sim/sh64/media/maddsl.cgs sim/testsuite/sim/sh64/media/maddsub.cgs sim/testsuite/sim/sh64/media/maddsw.cgs sim/testsuite/sim/sh64/media/maddw.cgs sim/testsuite/sim/sh64/media/mcmpeqb.cgs sim/testsuite/sim/sh64/media/mcmpeql.cgs sim/testsuite/sim/sh64/media/mcmpeqw.cgs sim/testsuite/sim/sh64/media/mcmpgtl.cgs sim/testsuite/sim/sh64/media/mcmpgtub.cgs sim/testsuite/sim/sh64/media/mcmpgtw.cgs sim/testsuite/sim/sh64/media/mcmv.cgs sim/testsuite/sim/sh64/media/mcnvslw.cgs sim/testsuite/sim/sh64/media/mcnvswb.cgs sim/testsuite/sim/sh64/media/mcnvswub.cgs sim/testsuite/sim/sh64/media/mextr1.cgs sim/testsuite/sim/sh64/media/mextr2.cgs sim/testsuite/sim/sh64/media/mextr3.cgs sim/testsuite/sim/sh64/media/mextr4.cgs sim/testsuite/sim/sh64/media/mextr5.cgs sim/testsuite/sim/sh64/media/mextr6.cgs sim/testsuite/sim/sh64/media/mextr7.cgs sim/testsuite/sim/sh64/media/mmacfxwl.cgs sim/testsuite/sim/sh64/media/mmacnfx-wl.cgs sim/testsuite/sim/sh64/media/mmulfxl.cgs sim/testsuite/sim/sh64/media/mmulfxrpw.cgs sim/testsuite/sim/sh64/media/mmulfxw.cgs sim/testsuite/sim/sh64/media/mmulhiwl.cgs sim/testsuite/sim/sh64/media/mmull.cgs sim/testsuite/sim/sh64/media/mmullowl.cgs sim/testsuite/sim/sh64/media/mmulsumwq.cgs sim/testsuite/sim/sh64/media/mmulw.cgs sim/testsuite/sim/sh64/media/movi.cgs sim/testsuite/sim/sh64/media/mpermw.cgs sim/testsuite/sim/sh64/media/msadubq.cgs sim/testsuite/sim/sh64/media/mshaldsl.cgs sim/testsuite/sim/sh64/media/mshaldsw.cgs sim/testsuite/sim/sh64/media/mshardl.cgs sim/testsuite/sim/sh64/media/mshardsq.cgs sim/testsuite/sim/sh64/media/mshardw.cgs sim/testsuite/sim/sh64/media/mshfhib.cgs sim/testsuite/sim/sh64/media/mshfhil.cgs sim/testsuite/sim/sh64/media/mshfhiw.cgs sim/testsuite/sim/sh64/media/mshflob.cgs sim/testsuite/sim/sh64/media/mshflol.cgs sim/testsuite/sim/sh64/media/mshflow.cgs sim/testsuite/sim/sh64/media/mshlldl.cgs sim/testsuite/sim/sh64/media/mshlldw.cgs sim/testsuite/sim/sh64/media/mshlrdl.cgs sim/testsuite/sim/sh64/media/mshlrdw.cgs sim/testsuite/sim/sh64/media/msubl.cgs sim/testsuite/sim/sh64/media/msubsl.cgs sim/testsuite/sim/sh64/media/msubsub.cgs sim/testsuite/sim/sh64/media/msubsw.cgs sim/testsuite/sim/sh64/media/msubw.cgs sim/testsuite/sim/sh64/media/mulsl.cgs sim/testsuite/sim/sh64/media/mulul.cgs sim/testsuite/sim/sh64/media/nop.cgs sim/testsuite/sim/sh64/media/nsb.cgs sim/testsuite/sim/sh64/media/ocbi.cgs sim/testsuite/sim/sh64/media/ocbp.cgs sim/testsuite/sim/sh64/media/ocbwb.cgs sim/testsuite/sim/sh64/media/or.cgs sim/testsuite/sim/sh64/media/ori.cgs sim/testsuite/sim/sh64/media/prefi.cgs sim/testsuite/sim/sh64/media/pta.cgs sim/testsuite/sim/sh64/media/ptabs.cgs sim/testsuite/sim/sh64/media/ptb.cgs sim/testsuite/sim/sh64/media/ptrel.cgs sim/testsuite/sim/sh64/media/putcfg.cgs sim/testsuite/sim/sh64/media/putcon.cgs sim/testsuite/sim/sh64/media/rte.cgs sim/testsuite/sim/sh64/media/shard.cgs sim/testsuite/sim/sh64/media/shardl.cgs sim/testsuite/sim/sh64/media/shari.cgs sim/testsuite/sim/sh64/media/sharil.cgs sim/testsuite/sim/sh64/media/shlld.cgs sim/testsuite/sim/sh64/media/shlldl.cgs sim/testsuite/sim/sh64/media/shlli.cgs sim/testsuite/sim/sh64/media/shllil.cgs sim/testsuite/sim/sh64/media/shlrd.cgs sim/testsuite/sim/sh64/media/shlrdl.cgs sim/testsuite/sim/sh64/media/shlri.cgs sim/testsuite/sim/sh64/media/shlril.cgs sim/testsuite/sim/sh64/media/shori.cgs sim/testsuite/sim/sh64/media/sleep.cgs sim/testsuite/sim/sh64/media/stb.cgs sim/testsuite/sim/sh64/media/sthil.cgs sim/testsuite/sim/sh64/media/sthiq.cgs sim/testsuite/sim/sh64/media/stl.cgs sim/testsuite/sim/sh64/media/stlol.cgs sim/testsuite/sim/sh64/media/stloq.cgs sim/testsuite/sim/sh64/media/stq.cgs sim/testsuite/sim/sh64/media/stw.cgs sim/testsuite/sim/sh64/media/stxb.cgs sim/testsuite/sim/sh64/media/stxl.cgs sim/testsuite/sim/sh64/media/stxq.cgs sim/testsuite/sim/sh64/media/stxw.cgs sim/testsuite/sim/sh64/media/sub.cgs sim/testsuite/sim/sh64/media/subl.cgs sim/testsuite/sim/sh64/media/swapq.cgs sim/testsuite/sim/sh64/media/synci.cgs sim/testsuite/sim/sh64/media/synco.cgs sim/testsuite/sim/sh64/media/testutils.inc sim/testsuite/sim/sh64/media/trapa.cgs sim/testsuite/sim/sh64/media/xor.cgs sim/testsuite/sim/sh64/media/xori.cgs sim/testsuite/sim/sh64/misc/fr-dr.s --- diff --git a/COPYING.LIBGLOSS b/COPYING.LIBGLOSS new file mode 100644 index 0000000..741bc2f --- /dev/null +++ b/COPYING.LIBGLOSS @@ -0,0 +1,297 @@ +The libgloss subdirectory is a collection of software from several sources. +Each have their own copyrights embedded in each file that they concern. + +(1) University of California, Berkeley + +[1a] + +Copyright (c) 1990 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms are permitted +provided that the above copyright notice and this paragraph are +duplicated in all such forms and that any documentation, +and other materials related to such distribution and use +acknowledge that the software was developed +by the University of California, Berkeley. The name of the +University may not be used to endorse or promote products derived +from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +[1b] + +Copyright (c) 1991, 2000 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +[1c] + +Copyright (c) 1991, 1998, 2001 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. [rescinded 22 July 1999] +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +------------------------------------------------------------- + Please note that in some of the above alternate licenses, there is a + statement regarding that acknowledgement must be made in any + advertising materials for products using the code. This restriction + no longer applies due to the following license change: + + ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + + In some cases the defunct clause has been removed in modified newlib code and + in some cases, the clause has been left as-is. +------------------------------------------------------------- + +(2) DJ Delorie + +Copyright (C) 1993 DJ Delorie +All rights reserved. + +Redistribution and use in source and binary forms is permitted +provided that the above copyright notice and following paragraph are +duplicated in all such forms. + +This file is distributed WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +(3) GPL (fr30 directory only) + +Copyright (C) 1998 Free Software Foundation, Inc. +Contributed by Cygnus Solutions. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +(4) Advanced Micro Devices + +Copyright 1989, 1990 Advanced Micro Devices, Inc. + +This software is the property of Advanced Micro Devices, Inc (AMD) which +specifically grants the user the right to modify, use and distribute this +software provided this notice is not removed or altered. All other rights +are reserved by AMD. + +AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS +SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL +DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR +USE OF THIS SOFTWARE. + +So that all may benefit from your experience, please report any problems +or suggestions about this software to the 29K Technical Support Center at +800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or +0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. + +Advanced Micro Devices, Inc. +29K Support Products +Mail Stop 573 +5900 E. Ben White Blvd. +Austin, TX 78741 +800-292-9263 + +(5) Array Technology Corporation and MIPS (mips/lsi33k-stub.h) + +COPYRIGHT (C) 1991, 1992 ARRAY TECHNOLOGY CORPORATION + All Rights Reserved + +This software is confidential information which is proprietary to and +a trade secret of ARRAY Technology Corporation. Use, duplication, or +disclosure is subject to the terms of a separate license agreement. + +Copyright 1985 by MIPS Computer Systems, Inc. + +(6) University of Utah and the Computer Systems Laboratory (CSL) + [applies only to hppa*-*-pro* targets] + +Copyright (c) 1990,1994 The University of Utah and +the Computer Systems Laboratory (CSL). All rights reserved. + +Permission to use, copy, modify and distribute this software is hereby +granted provided that (1) source code retains these copyright, permission, +and disclaimer notices, and (2) redistributions including binaries +reproduce the notices in supporting documentation, and (3) all advertising +materials mentioning features or use of this software display the following +acknowledgement: ``This product includes software developed by the +Computer Systems Laboratory at the University of Utah.'' + +THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS +IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF +ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + +CSL requests users of this software to return to csl-dist@cs.utah.edu any +improvements that they make and grant CSL redistribution rights. + +(7) Sun Microsystems + +Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + +(8) Hewlett Packard + +(c) Copyright 1986 HEWLETT-PACKARD COMPANY + +To anyone who acknowledges that this file is provided "AS IS" +without any express or implied warranty: + permission to use, copy, modify, and distribute this file +for any purpose is hereby granted without fee, provided that +the above copyright notice and this notice appears in all +copies, and that the name of Hewlett-Packard Company not be +used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +Hewlett-Packard Company makes no representations about the +suitability of this software for any purpose. + +(9) Hans-Peter Nilsson + +Copyright (C) 2001 Hans-Peter Nilsson + +Permission to use, copy, modify, and distribute this software is +freely granted, provided that the above copyright notice, this notice +and the following disclaimer are preserved with no changes. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +(10) No Copyright + +THIS SOFTWARE IS NOT COPYRIGHTED + +(11) Cygnus Support / Cygnus Solutions + +Copyright (c) 1995, 1996, 1997, 1998, 1999 Cygnus Support + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +--------------------------------------------------------------- + Please note that the copyright above may be used with the name + Cygnus Solutions instead of Cygnus Support. Both names should + be considered interchangeable. These copyrights are now owned + by Red Hat Incorporated. +--------------------------------------------------------------- + +(12) Red Hat Incorporated + +Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +(13) Default copyright + +Unless otherwise stated in each remaining libgloss file, the remaining +files in the libgloss subdirectory are governed by the following copyright. + +Copyright (c) 1994, 1997, 2001, 2002 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ChangeLog b/ChangeLog index f781e7a..c882a50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2003-06-12 Thiemo Seufer + + * MAINTAINERS: Add myself as MIPS co-maintainer. + +2003-06-12 H.J. Lu + + * config.guess: Update to 2003-06-06 version. + * config.sub: Update to 2003-06-06 version. + +2003-06-11 Rainer Orth + + * configure.in: Don't pass --with-stabs for mips*-sgi-irix6*o32. + * configure. Regenerate. + +2003-06-10 Nathanael Nerode + + * configure.in: Disable serial configure by default. + * configure: Regenerate. + * Makefile.tpl: Abolish .NOTPARALLEL. + * Makefile.in: Regenerate. + + * Makefile.tpl: Replace {build,host,target}_canonical by + {build,host,target}. + * Makefile.in: Regenerate. + + * Makefile.tpl: Fix stupid pasto. + * Makefile.in: Regenerate. + +2003-06-09 Nathanael Nerode + + * Makefile.tpl: Remove bogus conditional. + * Makefile.in: Regenerate. + 2003-06-03 Nathanael Nerode * Makefile.tpl: Make 'recursive targets' using autogen rather diff --git a/Makefile.in b/Makefile.in index fb09797..82f67cf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,20 +26,11 @@ VPATH=@srcdir@ build_alias=@build_alias@ -build_cpu=@build_cpu@ -build_vendor=@build_vendor@ -build_os=@build_os@ -build_canonical=@build_cpu@-@build_vendor@-@build_os@ +build=@build@ host_alias=@host_alias@ -host_cpu=@host_cpu@ -host_vendor=@host_vendor@ -host_os=@host_os@ -host_canonical=@host_cpu@-@host_vendor@-@host_os@ +host=@host@ target_alias=@target_alias@ -target_cpu=@target_cpu@ -target_vendor=@target_vendor@ -target_os=@target_os@ -target_canonical=@target_cpu@-@target_vendor@-@target_os@ +target=@target@ program_transform_name = @program_transform_name@ @@ -263,7 +254,7 @@ USUAL_AR_FOR_TARGET = ` \ if [ -f $$r/binutils/ar ] ; then \ echo $$r/binutils/ar ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(AR); \ else \ echo ar | sed '$(program_transform_name)' ; \ @@ -277,7 +268,7 @@ USUAL_AS_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=as ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(AS); \ else \ echo as | sed '$(program_transform_name)' ; \ @@ -310,7 +301,7 @@ USUAL_DLLTOOL_FOR_TARGET = ` \ if [ -f $$r/binutils/dlltool ] ; then \ echo $$r/binutils/dlltool ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(DLLTOOL); \ else \ echo dlltool | sed '$(program_transform_name)' ; \ @@ -326,7 +317,7 @@ USUAL_LD_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=ld ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(LD); \ else \ echo ld | sed '$(program_transform_name)' ; \ @@ -342,7 +333,7 @@ USUAL_NM_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=nm ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(NM); \ else \ echo nm | sed '$(program_transform_name)' ; \ @@ -354,7 +345,7 @@ USUAL_RANLIB_FOR_TARGET = ` \ if [ -f $$r/binutils/ranlib ] ; then \ echo $$r/binutils/ranlib ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ if [ x'$(RANLIB)' != x ]; then \ echo $(RANLIB); \ else \ @@ -370,7 +361,7 @@ USUAL_WINDRES_FOR_TARGET = ` \ if [ -f $$r/binutils/windres ] ; then \ echo $$r/binutils/windres ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(WINDRES); \ else \ echo windres | sed '$(program_transform_name)' ; \ @@ -11707,7 +11698,7 @@ mostlyclean-target-libobjc: maybe-mostlyclean-target-libtermcap: # libtermcap doesn't support mostlyclean. -mostlyclean-libtermcap: +mostlyclean-target-libtermcap: .PHONY: maybe-mostlyclean-target-winsup mostlyclean-target-winsup @@ -13474,7 +13465,7 @@ clean-target-libobjc: maybe-clean-target-libtermcap: # libtermcap doesn't support clean. -clean-libtermcap: +clean-target-libtermcap: .PHONY: maybe-clean-target-winsup clean-target-winsup @@ -15241,7 +15232,7 @@ distclean-target-libobjc: maybe-distclean-target-libtermcap: # libtermcap doesn't support distclean. -distclean-libtermcap: +distclean-target-libtermcap: .PHONY: maybe-distclean-target-winsup distclean-target-winsup @@ -17008,7 +16999,7 @@ maintainer-clean-target-libobjc: maybe-maintainer-clean-target-libtermcap: # libtermcap doesn't support maintainer-clean. -maintainer-clean-libtermcap: +maintainer-clean-target-libtermcap: .PHONY: maybe-maintainer-clean-target-winsup maintainer-clean-target-winsup @@ -17302,7 +17293,7 @@ clean-target-libgcc: .PHONY: check do-check check: - $(MAKE) do-check NOTPARALLEL=parallel-ok + $(MAKE) do-check # Only include modules actually being configured and built. do-check: maybe-check-gcc \ @@ -17705,18 +17696,16 @@ configure-ash: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in ash; \ cd ash || exit 1; \ case $(srcdir) in \ @@ -17773,18 +17762,16 @@ configure-autoconf: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in autoconf; \ cd autoconf || exit 1; \ case $(srcdir) in \ @@ -17841,18 +17828,16 @@ configure-automake: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in automake; \ cd automake || exit 1; \ case $(srcdir) in \ @@ -17909,18 +17894,16 @@ configure-bash: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in bash; \ cd bash || exit 1; \ case $(srcdir) in \ @@ -17977,18 +17960,16 @@ configure-bfd: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in bfd; \ cd bfd || exit 1; \ case $(srcdir) in \ @@ -18045,18 +18026,16 @@ configure-opcodes: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in opcodes; \ cd opcodes || exit 1; \ case $(srcdir) in \ @@ -18113,18 +18092,16 @@ configure-binutils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in binutils; \ cd binutils || exit 1; \ case $(srcdir) in \ @@ -18181,18 +18158,16 @@ configure-bison: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in bison; \ cd bison || exit 1; \ case $(srcdir) in \ @@ -18223,7 +18198,7 @@ maybe-check-bison: # This module is only tested in a native toolchain. check-bison: - @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD}`; export r; \ s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ @@ -18252,18 +18227,16 @@ configure-byacc: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in byacc; \ cd byacc || exit 1; \ case $(srcdir) in \ @@ -18294,7 +18267,7 @@ maybe-check-byacc: # This module is only tested in a native toolchain. check-byacc: - @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD}`; export r; \ s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ @@ -18323,18 +18296,16 @@ configure-bzip2: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in bzip2; \ cd bzip2 || exit 1; \ case $(srcdir) in \ @@ -18391,18 +18362,16 @@ configure-dejagnu: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in dejagnu; \ cd dejagnu || exit 1; \ case $(srcdir) in \ @@ -18459,18 +18428,16 @@ configure-diff: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in diff; \ cd diff || exit 1; \ case $(srcdir) in \ @@ -18527,18 +18494,16 @@ configure-dosutils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in dosutils; \ cd dosutils || exit 1; \ case $(srcdir) in \ @@ -18591,18 +18556,16 @@ configure-etc: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in etc; \ cd etc || exit 1; \ case $(srcdir) in \ @@ -18659,18 +18622,16 @@ configure-fastjar: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in fastjar; \ cd fastjar || exit 1; \ case $(srcdir) in \ @@ -18701,7 +18662,7 @@ maybe-check-fastjar: # This module is only tested in a native toolchain. check-fastjar: - @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD}`; export r; \ s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ @@ -18730,18 +18691,16 @@ configure-fileutils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in fileutils; \ cd fileutils || exit 1; \ case $(srcdir) in \ @@ -18798,18 +18757,16 @@ configure-findutils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in findutils; \ cd findutils || exit 1; \ case $(srcdir) in \ @@ -18866,18 +18823,16 @@ configure-find: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in find; \ cd find || exit 1; \ case $(srcdir) in \ @@ -18934,18 +18889,16 @@ configure-flex: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in flex; \ cd flex || exit 1; \ case $(srcdir) in \ @@ -18976,7 +18929,7 @@ maybe-check-flex: # This module is only tested in a native toolchain. check-flex: - @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD}`; export r; \ s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ @@ -19005,18 +18958,16 @@ configure-gas: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gas; \ cd gas || exit 1; \ case $(srcdir) in \ @@ -19073,18 +19024,16 @@ configure-gawk: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gawk; \ cd gawk || exit 1; \ case $(srcdir) in \ @@ -19141,18 +19090,16 @@ configure-gettext: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gettext; \ cd gettext || exit 1; \ case $(srcdir) in \ @@ -19209,18 +19156,16 @@ configure-gnuserv: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gnuserv; \ cd gnuserv || exit 1; \ case $(srcdir) in \ @@ -19277,18 +19222,16 @@ configure-gprof: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gprof; \ cd gprof || exit 1; \ case $(srcdir) in \ @@ -19345,18 +19288,16 @@ configure-gzip: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gzip; \ cd gzip || exit 1; \ case $(srcdir) in \ @@ -19413,18 +19354,16 @@ configure-hello: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in hello; \ cd hello || exit 1; \ case $(srcdir) in \ @@ -19481,18 +19420,16 @@ configure-indent: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in indent; \ cd indent || exit 1; \ case $(srcdir) in \ @@ -19549,18 +19486,16 @@ configure-intl: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in intl; \ cd intl || exit 1; \ case $(srcdir) in \ @@ -19617,18 +19552,16 @@ configure-tcl: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in tcl; \ cd tcl || exit 1; \ case $(srcdir) in \ @@ -19685,18 +19618,16 @@ configure-itcl: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in itcl; \ cd itcl || exit 1; \ case $(srcdir) in \ @@ -19753,18 +19684,16 @@ configure-ld: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in ld; \ cd ld || exit 1; \ case $(srcdir) in \ @@ -19821,18 +19750,16 @@ configure-libgui: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in libgui; \ cd libgui || exit 1; \ case $(srcdir) in \ @@ -19889,18 +19816,16 @@ configure-libiberty: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in libiberty; \ cd libiberty || exit 1; \ case $(srcdir) in \ @@ -19957,18 +19882,16 @@ configure-libtool: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in libtool; \ cd libtool || exit 1; \ case $(srcdir) in \ @@ -20025,18 +19948,16 @@ configure-m4: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in m4; \ cd m4 || exit 1; \ case $(srcdir) in \ @@ -20093,18 +20014,16 @@ configure-make: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in make; \ cd make || exit 1; \ case $(srcdir) in \ @@ -20161,18 +20080,16 @@ configure-mmalloc: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in mmalloc; \ cd mmalloc || exit 1; \ case $(srcdir) in \ @@ -20225,18 +20142,16 @@ configure-patch: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in patch; \ cd patch || exit 1; \ case $(srcdir) in \ @@ -20293,18 +20208,16 @@ configure-perl: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in perl; \ cd perl || exit 1; \ case $(srcdir) in \ @@ -20361,18 +20274,16 @@ configure-prms: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in prms; \ cd prms || exit 1; \ case $(srcdir) in \ @@ -20429,18 +20340,16 @@ configure-rcs: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in rcs; \ cd rcs || exit 1; \ case $(srcdir) in \ @@ -20497,18 +20406,16 @@ configure-readline: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in readline; \ cd readline || exit 1; \ case $(srcdir) in \ @@ -20565,18 +20472,16 @@ configure-release: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in release; \ cd release || exit 1; \ case $(srcdir) in \ @@ -20625,18 +20530,16 @@ configure-recode: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in recode; \ cd recode || exit 1; \ case $(srcdir) in \ @@ -20693,18 +20596,16 @@ configure-sed: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in sed; \ cd sed || exit 1; \ case $(srcdir) in \ @@ -20761,18 +20662,16 @@ configure-send-pr: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in send-pr; \ cd send-pr || exit 1; \ case $(srcdir) in \ @@ -20829,18 +20728,16 @@ configure-shellutils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in shellutils; \ cd shellutils || exit 1; \ case $(srcdir) in \ @@ -20897,18 +20794,16 @@ configure-sid: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in sid; \ cd sid || exit 1; \ case $(srcdir) in \ @@ -20965,18 +20860,16 @@ configure-sim: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in sim; \ cd sim || exit 1; \ case $(srcdir) in \ @@ -21033,18 +20926,16 @@ configure-tar: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in tar; \ cd tar || exit 1; \ case $(srcdir) in \ @@ -21101,18 +20992,16 @@ configure-texinfo: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in texinfo; \ cd texinfo || exit 1; \ case $(srcdir) in \ @@ -21165,18 +21054,16 @@ configure-textutils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in textutils; \ cd textutils || exit 1; \ case $(srcdir) in \ @@ -21233,18 +21120,16 @@ configure-time: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in time; \ cd time || exit 1; \ case $(srcdir) in \ @@ -21301,18 +21186,16 @@ configure-uudecode: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in uudecode; \ cd uudecode || exit 1; \ case $(srcdir) in \ @@ -21369,18 +21252,16 @@ configure-wdiff: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in wdiff; \ cd wdiff || exit 1; \ case $(srcdir) in \ @@ -21437,18 +21318,16 @@ configure-zip: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in zip; \ cd zip || exit 1; \ case $(srcdir) in \ @@ -21479,7 +21358,7 @@ maybe-check-zip: # This module is only tested in a native toolchain. check-zip: - @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD}`; export r; \ s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ @@ -21508,18 +21387,16 @@ configure-zlib: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in zlib; \ cd zlib || exit 1; \ case $(srcdir) in \ @@ -21568,18 +21445,16 @@ configure-gdb: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gdb; \ cd gdb || exit 1; \ case $(srcdir) in \ @@ -21636,18 +21511,16 @@ configure-expect: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in expect; \ cd expect || exit 1; \ case $(srcdir) in \ @@ -21704,18 +21577,16 @@ configure-guile: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in guile; \ cd guile || exit 1; \ case $(srcdir) in \ @@ -21772,18 +21643,16 @@ configure-tk: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in tk; \ cd tk || exit 1; \ case $(srcdir) in \ @@ -21840,18 +21709,16 @@ configure-tix: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in tix; \ cd tix || exit 1; \ case $(srcdir) in \ @@ -21908,18 +21775,16 @@ configure-libtermcap: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in libtermcap; \ cd libtermcap || exit 1; \ case $(srcdir) in \ @@ -21972,18 +21837,16 @@ configure-utils: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in utils; \ cd utils || exit 1; \ case $(srcdir) in \ @@ -23686,18 +23549,16 @@ configure-gcc: CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gcc; \ cd gcc || exit 1; \ case $(srcdir) in \ @@ -23776,6 +23637,23 @@ $(GCC_STRAP_TARGETS): all-bootstrap configure-gcc echo "Building runtime libraries"; \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all +profiledbootstrap: all-bootstrap configure-gcc + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ + $(SET_LIB_PATH) \ + echo "Bootstrapping the compiler"; \ + cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}` ; export s; \ + $(SET_LIB_PATH) \ + echo "Building runtime libraries and training compiler"; \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ + $(SET_LIB_PATH) \ + echo "Building feedback based compiler"; \ + cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build + .PHONY: cross cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld @r=`${PWD}`; export r; \ @@ -23815,7 +23693,7 @@ check-gcc-c++: .PHONY: check-c++ check-c++: - $(MAKE) check-target-libstdc++-v3 check-gcc-c++ NOTPARALLEL=parallel-ok + $(MAKE) check-target-libstdc++-v3 check-gcc-c++ .PHONY: install-gcc maybe-install-gcc maybe-install-gcc: @@ -24012,12 +23890,6 @@ $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4 # Special directives to GNU Make # ------------------------------ -# Tell GNU make 3.79 not to run the top level in parallel. This -# prevents contention for $builddir/$target/config.cache, as well -# as minimizing scatter in file system caches. -NOTPARALLEL = .NOTPARALLEL -$(NOTPARALLEL): - # Don't pass command-line variables to submakes. .NOEXPORT: MAKEOVERRIDES= diff --git a/Makefile.tpl b/Makefile.tpl index e55c89c..d660e3a 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -29,20 +29,11 @@ in VPATH=@srcdir@ build_alias=@build_alias@ -build_cpu=@build_cpu@ -build_vendor=@build_vendor@ -build_os=@build_os@ -build_canonical=@build_cpu@-@build_vendor@-@build_os@ +build=@build@ host_alias=@host_alias@ -host_cpu=@host_cpu@ -host_vendor=@host_vendor@ -host_os=@host_os@ -host_canonical=@host_cpu@-@host_vendor@-@host_os@ +host=@host@ target_alias=@target_alias@ -target_cpu=@target_cpu@ -target_vendor=@target_vendor@ -target_os=@target_os@ -target_canonical=@target_cpu@-@target_vendor@-@target_os@ +target=@target@ program_transform_name = @program_transform_name@ @@ -266,7 +257,7 @@ USUAL_AR_FOR_TARGET = ` \ if [ -f $$r/binutils/ar ] ; then \ echo $$r/binutils/ar ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(AR); \ else \ echo ar | sed '$(program_transform_name)' ; \ @@ -280,7 +271,7 @@ USUAL_AS_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=as ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(AS); \ else \ echo as | sed '$(program_transform_name)' ; \ @@ -313,7 +304,7 @@ USUAL_DLLTOOL_FOR_TARGET = ` \ if [ -f $$r/binutils/dlltool ] ; then \ echo $$r/binutils/dlltool ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(DLLTOOL); \ else \ echo dlltool | sed '$(program_transform_name)' ; \ @@ -329,7 +320,7 @@ USUAL_LD_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=ld ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(LD); \ else \ echo ld | sed '$(program_transform_name)' ; \ @@ -345,7 +336,7 @@ USUAL_NM_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=nm ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(NM); \ else \ echo nm | sed '$(program_transform_name)' ; \ @@ -357,7 +348,7 @@ USUAL_RANLIB_FOR_TARGET = ` \ if [ -f $$r/binutils/ranlib ] ; then \ echo $$r/binutils/ranlib ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ if [ x'$(RANLIB)' != x ]; then \ echo $(RANLIB); \ else \ @@ -373,7 +364,7 @@ USUAL_WINDRES_FOR_TARGET = ` \ if [ -f $$r/binutils/windres ] ; then \ echo $$r/binutils/windres ; \ else \ - if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ '$(host)' = '$(target)' ] ; then \ echo $(WINDRES); \ else \ echo windres | sed '$(program_transform_name)' ; \ @@ -657,7 +648,7 @@ maybe-[+make_target+]-[+module+]: maybe-[+make_target+]-target-[+module+]: [+ IF (match-value? = "missing" (get "make_target") ) +] # [+module+] doesn't support [+make_target+]. -[+make_target+]-[+module+]: +[+make_target+]-target-[+module+]: [+ ELSE +] [+make_target+]-target-[+module+]: [+ FOR depend +]\ @@ -740,7 +731,7 @@ clean-target-libgcc: .PHONY: check do-check check: - $(MAKE) do-check NOTPARALLEL=parallel-ok + $(MAKE) do-check # Only include modules actually being configured and built. do-check: maybe-check-gcc [+ @@ -934,18 +925,16 @@ configure-[+module+]: CFLAGS="$(CFLAGS)"; export CFLAGS; \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in [+module+]; \ cd [+module+] || exit 1; \ case $(srcdir) in \ @@ -981,7 +970,7 @@ check-[+module+]: [+ ELIF no_check_cross +] # This module is only tested in a native toolchain. check-[+module+]: - @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD}`; export r; \ s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ @@ -1165,18 +1154,16 @@ configure-gcc: CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ - if [ z$(build_canonical) != z$(host_canoncial) ] ; then \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - fi; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ echo Configuring in gcc; \ cd gcc || exit 1; \ case $(srcdir) in \ @@ -1255,6 +1242,23 @@ $(GCC_STRAP_TARGETS): all-bootstrap configure-gcc echo "Building runtime libraries"; \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all +profiledbootstrap: all-bootstrap configure-gcc + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ + $(SET_LIB_PATH) \ + echo "Bootstrapping the compiler"; \ + cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}` ; export s; \ + $(SET_LIB_PATH) \ + echo "Building runtime libraries and training compiler"; \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ + $(SET_LIB_PATH) \ + echo "Building feedback based compiler"; \ + cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build + .PHONY: cross cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld @r=`${PWD}`; export r; \ @@ -1294,7 +1298,7 @@ check-gcc-c++: .PHONY: check-c++ check-c++: - $(MAKE) check-target-libstdc++-v3 check-gcc-c++ NOTPARALLEL=parallel-ok + $(MAKE) check-target-libstdc++-v3 check-gcc-c++ .PHONY: install-gcc maybe-install-gcc maybe-install-gcc: @@ -1491,12 +1495,6 @@ $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4 # Special directives to GNU Make # ------------------------------ -# Tell GNU make 3.79 not to run the top level in parallel. This -# prevents contention for $builddir/$target/config.cache, as well -# as minimizing scatter in file system caches. -NOTPARALLEL = .NOTPARALLEL -$(NOTPARALLEL): - # Don't pass command-line variables to submakes. .NOEXPORT: MAKEOVERRIDES= diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e5fe8d6..487f23c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,164 @@ +2003-06-13 Robert Millan + + * config.bfd: Add i386-netbsd-gnu target. + +2003-06-12 Nick Clifton + + * opncls.c (calc_crc32): Rename to + bfd_calc_gnu_debuglink_crc32 and export. + (GNU_DEBUGLINK): Define and use to replace occurrences of + hard-coded ".gnu_debuglink" in the code. + (get_debug_link_info): Prevent aborts by replacing call to + xmalloc with a call to malloc. + (find_separate_debug_file): Prevent aborts by replacing calls + to xmalloc and xstrdup with calls to malloc and strdup. + (bfd_add_gnu_debuglink): New function. Add a .gnu_debuglink + section to a bfd. + * bfd-in2.h: Regenerate. + +2003-06-12 Federico G. Schwindt + + * config.bfd (i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]): + New target (was i[3-7]86-*-openbsd* before). + (i[3-7]86-*-openbsd*): Change to use bfd_elf32_i386_vec. + (vax-*-openbsd*): New target. + +2003-06-11 Thiemo Seufer + + * elfxx-mips.c (MIPS_ELF_OPTIONS_SECTION_NAME): Use .MIPS.options + for n32, too. + (MIPS_ELF_STUB_SECTION_NAME): Use .MIPS.stubs for n32, too. + (mips_elf_rel_dyn_section): Use appropriate section alignment. + (mips_elf_create_got_section): Likewise. + (_bfd_mips_elf_create_dynamic_sections): Likewise. + +2003-06-11 Thiemo Seufer + + * elf32-mips.c (mips_elf_generic_reloc): New Function. + (elf_mips_howto_table_rel): Use it. + (gprel32_with_gp): Move prototype. + (mips_elf_hi16_reloc): Check for ! BSF_LOCAL instead of zero addend. + Use mips_elf_generic_reloc. + (mips_elf_got16_reloc): Check for ! BSF_LOCAL instead of zero addend. + Code cleanup. + (_bfd_mips_elf32_gprel16_reloc): Check for ! BSF_LOCAL instead of + zero addend. + (mips_elf_gprel32_reloc): Likewise. Use the same GP assignment logic + as in the other *_gprel*_reloc functions. + (gprel32_with_gp): Handle partial_inplace properly. + (mips32_64bit_reloc): Use mips_elf_generic_reloc. + (mips16_gprel_reloc): Check for ! BSF_LOCAL instead of zero addend. + Do addend handling directly instead of calling + _bfd_mips_elf_gprel16_with_gp. Handle partial_inplace properly. + * elf64-mips.c (mips_elf64_hi16_reloc): Check for ! BSF_LOCAL instead + of zero addend. Handle partial_inplace properly. + (mips_elf64_got16_reloc): Check for ! BSF_LOCAL instead of zero + addend. + (mips_elf64_gprel16_reloc): Likewise. + (mips_elf64_literal_reloc): Likewise. + (mips_elf64_gprel32_reloc): Likewise. Use the same GP assignment + logic as in the other *_gprel*_reloc functions. Handle + partial_inplace properly. + (mips_elf64_shift6_reloc): Check for ! BSF_LOCAL instead of zero + addend. Handle partial_inplace properly. + (mips16_gprel_reloc): Likewise. Do addend handling directly instead + of calling _bfd_mips_elf_gprel16_with_gp. + * elfn32-mips.c (mips_elf_got16_reloc): Check for BSF_LOCAL. + (mips_elf_gprel32_reloc): Check for ! BSF_LOCAL instead + of zero addend. + (mips_elf_shift6_reloc): Handle partial_inplace properly. + (mips16_gprel_reloc): Likewise. Do addend handling directly instead + of calling _bfd_mips_elf_gprel16_with_gp. + * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Handle + partial_inplace properly. Fix wrong addend handling. Fix overflow + check. + (_bfd_mips_elf_sign_extend): Renamed from mips_elf_sign_extend and + exported. + (mips_elf_calculate_relocation): Use _bfd_mips_elf_sign_extend. + (_bfd_mips_elf_relocate_section): Likewise. + (mips_elf_create_dynamic_relocation): Update sec_info_type access. + * elfxx-mips.h (_bfd_mips_relax_section): Fix prototype declaration. + (_bfd_mips_elf_sign_extend): New prototype. + +2003-06-11 Federico G. Schwindt + + * config.bfd (sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1]): + New target (was sparc-*-openbsd* before). + (sparc-*-openbsd*): Change to use bfd_elf32_sparc_vec. + + * configure.in (vax-*-openbsd*): Set COREFILE to netbsd-core.lo. + * configure: Regenerate. + +2003-06-11 H.J. Lu + + * po/Make-in (DESTDIR): New. + (install-data-yes): Support $(DESTDIR). + (uninstall): Likewise. + +2003-06-11 Alan Modra + + * Makefile.am (config.status): Depend on version.h. + Run "make dep-am". + * Makefile.in: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + +2003-06-10 Alan Modra + Gary Hade + + * elf64-ppc.c (ppc64_elf_relocate_section <*_DS>): Special case lq. + +2003-06-10 Richard Sandiford + + * archures.c (bfd_mach_h8300sxn): New architecture. + * bfd-in2.h: Regenerate. + * cpu-h8300.c (h8300_scan): Check for 'sxn'. + (h8300sxn_info_struct): New. + (h8300sx_info_struct): Link to it. + * elf32-h8300.c (elf32_h8_mach): Add h8300sxn case. + (elf32_h8_final_write_processing): Likewise. + +2003-06-08 Alan Modra + + * elf64-ppc.c: Move TARGET_LITTLE_SYM and other macros used by + elfxx-target.h so that we can use elf_backend_got_header_size. + (ELF_MACHINE_ALT1, ELF_MACHINE_ALT2): Delete. + (GLINK_CALL_STUB_SIZE): Modify. Define new glink call stub and + associated macros. + (ppc64_elf_howto_raw ): Correct + dst_mask. + (enum ppc_stub_type): Add ppc_stub_long_branch_r2off and + ppc_stub_plt_branch_r2off. + (struct ppc_stub_hash_entry): Reorganize. + (struct ppc_link_hash_table): Add no_multi_toc, multi_toc_needed, + toc_curr, toc_off and emit_stub_syms. + (ppc64_elf_link_hash_table_create): Init them. + (ppc_stub_name): Correct string size. + (ppc64_elf_check_relocs): Set has_gp_reloc on GOT and TOC relocs. + (ppc64_elf_size_dynamic_sections): Set no_multi_toc if GOT entries + used. + (ppc_type_of_stub): Tweak root.type test. + (build_plt_stub): Remove glink code. Adjust for insn macro changes. + (ppc_size_one_stub): Handle ppc_stub_long_branch_r2off and + ppc_stub_plt_branch_r2off. + (ppc_build_one_stub): Likewise. Fix var shadowing. Correct addis,addi + range test. Use toc_off to calculte r2 values. Handle emit_stub_syms. + (ppc64_elf_setup_section_lists): Remove htab creator flavour test. + Initialize elf_gp and toc_curr. + (ppc64_elf_next_toc_section, ppc64_elf_reinit_toc): New functions. + (ppc64_elf_next_input_section): Set toc_off. + (group_sections): Ensure groups have the same TOC. + (ppc64_elf_size_stubs): Check whether we need a TOC adjusting stub. + (ppc64_elf_build_stubs): Add emit_stub_syms param, and stash in htab. + Build new glink stub. + (ppc64_elf_relocate_section): Handle multiple TOCs. Fix comments. + (ppc64_elf_finish_dynamic_sections): Adjust DT_PPC64_GLINK. + * elf64-ppc.h (ppc64_elf_build_stubs): Update prototype. + (ppc64_elf_next_toc_section, ppc64_elf_reinit_toc): Declare. + * section.c (struct sec): Rename flag12 to has_gp_reloc. + (STD_SECTION): Update. + * ecoff.c (bfd_debug_section): Update comment. + * bfd-in2.h: Regenerate. + 2003-06-05 Daniel Jacobowitz * elfcode.h (elf_slurp_reloc_table_from_section): Don't dereference @@ -64,12 +225,12 @@ * elf32-v850.c (v850_elf_howto_t): Rename R_V850_32to R_V850_ABS32. Add entry for R_V850_REL32. - (v850_elf_reloc_map): Likewise. - (v850_elf_check_relocs): Likewise. - (v850_elf_perform_relocation): Likewise. - (v850_elf_final_link_relocate): Likewise. Include computation + (v850_elf_reloc_map): Likewise. + (v850_elf_check_relocs): Likewise. + (v850_elf_perform_relocation): Likewise. + (v850_elf_final_link_relocate): Likewise. Include computation to make R_V850_REl32 pc-relative. - + 2003-06-03 Kaz Kojima * elf32-sh.c (sh_elf_size_dynamic_sections): Create .interp section @@ -323,8 +484,8 @@ (allocate_dynrelocs): For undef weak syms with non-default visibility, a) don't allocate plt entries, b) don't allocate .got relocs, c) discard dyn rel space - (sh_elf_relocate_section): d) don't generate .got relocs, e) - don't generate dynamic relocs. + (sh_elf_relocate_section): d) don't generate .got relocs, e) + don't generate dynamic relocs. (sh_elf_copy_indirect_symbol): Don't copy ELF_LINK_NON_GOT_REF for weakdefs when symbol already adjusted. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index cc34455..6240f35 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -862,8 +862,9 @@ CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) -# We want to rerun configure if config.bfd or configure.host change. -config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host +# We want to rerun configure if config.bfd, configure.host or version.h change. +config.status: $(srcdir)/configure $(srcdir)/config.bfd \ + $(srcdir)/configure.host $(srcdir)/version.h $(SHELL) ./config.status --recheck # What appears below is generated by a hacked mkdep using gcc -MM. @@ -918,7 +919,7 @@ archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h -cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h +cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h @@ -1207,17 +1208,19 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf32-target.h elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ - elf32-target.h elf32-m68hc1x.h + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/m68hc11.h elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h @@ -1301,9 +1304,11 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ elf32-target.h -elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-config.h elf32-target.h elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ @@ -1413,8 +1418,8 @@ pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h -pef.lo: pef.c pef.h pef-traceback.h $(INCDIR)/filenames.h \ - $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ + $(INCDIR)/filenames.h $(INCDIR)/libiberty.h pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 2eb2f08..aca9371 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -809,7 +809,7 @@ configure.in version.h DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -1395,8 +1395,9 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES) $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h touch stmp-lcoff-h -# We want to rerun configure if config.bfd or configure.host change. -config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host +# We want to rerun configure if config.bfd, configure.host or version.h change. +config.status: $(srcdir)/configure $(srcdir)/config.bfd \ + $(srcdir)/configure.host $(srcdir)/version.h $(SHELL) ./config.status --recheck # What appears below is generated by a hacked mkdep using gcc -MM. @@ -1451,7 +1452,7 @@ archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h -cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h +cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h @@ -1740,17 +1741,19 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf32-target.h elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ - elf32-target.h elf32-m68hc1x.h + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/m68hc11.h elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h @@ -1834,9 +1837,11 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ elf32-target.h -elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-config.h elf32-target.h elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ @@ -1946,8 +1951,8 @@ pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h -pef.lo: pef.c pef.h pef-traceback.h $(INCDIR)/filenames.h \ - $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ + $(INCDIR)/filenames.h $(INCDIR)/libiberty.h pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ diff --git a/bfd/archures.c b/bfd/archures.c index 250892c..6132f15 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -170,6 +170,7 @@ DESCRIPTION .#define bfd_mach_h8300hn 4 .#define bfd_mach_h8300sn 5 .#define bfd_mach_h8300sx 6 +.#define bfd_mach_h8300sxn 7 . bfd_arch_pdp11, {* DEC PDP-11 *} . bfd_arch_powerpc, {* PowerPC *} .#define bfd_mach_ppc 32 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index b0af69e..072812e 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -905,9 +905,15 @@ bfd_make_writable PARAMS ((bfd *abfd)); bfd_boolean bfd_make_readable PARAMS ((bfd *abfd)); +unsigned long +bfd_calc_gnu_debuglink_crc32 PARAMS ((unsigned long crc, const unsigned char *buf, bfd_size_type len)); + char * bfd_follow_gnu_debuglink PARAMS ((bfd *abfd, const char *dir)); +bfd_boolean +bfd_add_gnu_debuglink PARAMS ((bfd * abfd, const char * filename)); + /* Extracted from libbfd.c. */ /* Byte swapping macros for user section data. */ @@ -1308,8 +1314,10 @@ typedef struct sec /* Nonzero if this section needs the relax finalize pass. */ unsigned int need_finalize_relax:1; + /* Nonzero if this section has a gp reloc. */ + unsigned int has_gp_reloc:1; + /* Usused bits. */ - unsigned int flag12:1; unsigned int flag13:1; unsigned int flag14:1; unsigned int flag15:1; @@ -1652,6 +1660,7 @@ enum bfd_architecture #define bfd_mach_h8300hn 4 #define bfd_mach_h8300sn 5 #define bfd_mach_h8300sx 6 +#define bfd_mach_h8300sxn 7 bfd_arch_pdp11, /* DEC PDP-11 */ bfd_arch_powerpc, /* PowerPC */ #define bfd_mach_ppc 32 diff --git a/bfd/config.bfd b/bfd/config.bfd index 65ae177..90b52cc 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -446,7 +446,7 @@ case "${targ}" in targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;; esac ;; - i[3-7]86-*-netbsdelf*) + i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386netbsd_vec ;; @@ -454,11 +454,16 @@ case "${targ}" in targ_defvec=i386pe_vec targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec" ;; - i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | i[3-7]86-*-openbsd*) + i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \ + i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3]) targ_defvec=i386netbsd_vec targ_selvecs="bfd_elf32_i386_vec i386bsd_vec" targ_underscore=yes ;; + i[3-7]86-*-openbsd*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs=i386netbsd_vec + ;; i[3-7]86-*-netware*) targ_defvec=bfd_elf32_i386_vec targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec" @@ -946,7 +951,6 @@ case "${targ}" in targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" ;; - powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*) targ_defvec=bfd_powerpcle_pe_vec targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec" @@ -1038,7 +1042,6 @@ case "${targ}" in targ_defvec=bfd_elf32_shnbsd_vec targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" ;; - shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*) targ_defvec=bfd_elf32_shl_vec targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec" @@ -1108,10 +1111,14 @@ case "${targ}" in targ_selvecs=bfd_elf32_sparc_vec targ_underscore=yes ;; - sparc-*-openbsd*) + sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1]) targ_defvec=sparcnetbsd_vec targ_underscore=yes ;; + sparc-*-openbsd*) + targ_defvec=bfd_elf32_sparc_vec + targ_selvecs=sparcnetbsd_vec + ;; sparc-*-elf* | sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs=sunos_big_vec @@ -1172,7 +1179,6 @@ case "${targ}" in targ_underscore=yes ;; - v850-*-*) targ_defvec=bfd_elf32_v850_vec ;; @@ -1199,6 +1205,11 @@ case "${targ}" in targ_underscore=yes ;; + vax-*-openbsd*) + targ_defvec=vaxnetbsd_vec + targ_underscore=yes + ;; + vax*-*-*vms*) targ_defvec=vms_vax_vec ;; diff --git a/bfd/configure b/bfd/configure index df2d7ff..3b37998 100755 --- a/bfd/configure +++ b/bfd/configure @@ -5298,7 +5298,9 @@ rm -f conftest* COREFILE=trad-core.lo TRAD_HEADER='"hosts/tahoe.h"' ;; - vax-*-netbsd*) COREFILE=netbsd-core.lo ;; + vax-*-netbsd* | vax-*-openbsd*) + COREFILE=netbsd-core.lo + ;; vax-*-ultrix2*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' @@ -5334,17 +5336,17 @@ rm -f conftest* do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5338: checking for $ac_hdr" >&5 +echo "configure:5340: 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:5348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5350: \"$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* @@ -5372,12 +5374,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5376: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5378: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_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:5392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5408,12 +5410,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5412: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5414: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_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:5428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5444,12 +5446,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5448: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5450: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+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:5464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5480,12 +5482,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5484: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5486: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+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:5500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5516,12 +5518,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5520: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5522: 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:5536: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5552,12 +5554,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5556: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5558: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_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:5572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5588,12 +5590,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5592: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5594: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_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:5608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5624,12 +5626,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5628: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5630: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_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:5644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5660,12 +5662,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5664: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5666: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_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:5680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5696,12 +5698,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5700: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5702: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_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:5716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5732,12 +5734,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5736: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5738: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_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:5752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5768,12 +5770,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5772: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5774: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_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:5788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5804,12 +5806,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5808: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5810: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_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:5824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5840,12 +5842,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5844: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5846: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+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:5860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5876,12 +5878,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5880: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5882: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+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:5896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -5912,12 +5914,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5916: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5918: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_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:5932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6396,10 +6398,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6400: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6402: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <&6 -echo "configure:6449: checking for $ac_hdr" >&5 +echo "configure:6451: 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:6459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6461: \"$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* @@ -6484,12 +6486,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6488: checking for $ac_func" >&5 +echo "configure:6490: 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:6518: \"$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 @@ -6537,7 +6539,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6541: checking for working mmap" >&5 +echo "configure:6543: 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 @@ -6545,7 +6547,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:6691: \"$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 @@ -6710,12 +6712,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6714: checking for $ac_func" >&5 +echo "configure:6716: 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:6744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index b708145..379b3ac 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -359,7 +359,9 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/tahoe.h"' ;; - vax-*-netbsd*) COREFILE=netbsd-core.lo ;; + vax-*-netbsd* | vax-*-openbsd*) + COREFILE=netbsd-core.lo + ;; vax-*-ultrix2*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index f61e757..e1c77bf 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -82,7 +82,13 @@ h8300_scan (info, string) return (info->mach == bfd_mach_h8300sn); if (*string == 'x' || *string == 'X') - return (info->mach == bfd_mach_h8300sx); + { + string++; + if (*string == 'n' || *string == 'N') + return (info->mach == bfd_mach_h8300sxn); + + return (info->mach == bfd_mach_h8300sx); + } return (info->mach == bfd_mach_h8300s); } @@ -106,6 +112,22 @@ compatible (in, out) return in; } +static const bfd_arch_info_type h8300sxn_info_struct = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_h8300, + bfd_mach_h8300sxn, + "h8300sxn", /* arch_name */ + "h8300sxn", /* printable name */ + 1, + FALSE, /* the default machine */ + compatible, + h8300_scan, + 0 +}; + static const bfd_arch_info_type h8300sx_info_struct = { 32, /* 32 bits in a word */ @@ -119,7 +141,7 @@ static const bfd_arch_info_type h8300sx_info_struct = FALSE, /* the default machine */ compatible, h8300_scan, - 0 + &h8300sxn_info_struct }; static const bfd_arch_info_type h8300sn_info_struct = diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 1ba7d56..4d9b3d4 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -81,8 +81,10 @@ static asection bfd_debug_section = "*DEBUG*", 0, 0, NULL, 0, 0, 0, /* linker_mark, linker_has_input, gc_mark, segment_mark, */ 0, 0, 0, 0, - /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12, */ - 0, 0, 0, 0, 0, + /* sec_info_type, use_rela_p, has_tls_reloc, */ + 0, 0, 0, + /* need_finalize_relax, has_gp_reloc, */ + 0, 0, /* flag13, flag14, flag15, flag16, flag20, flag24, */ 0, 0, 0, 0, 0, 0, /* vma, lma, _cooked_size, _raw_size, */ diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index f272dc8..e4929fb 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -582,6 +582,9 @@ elf32_h8_mach (flags) case E_H8_MACH_H8300SX: return bfd_mach_h8300sx; + + case E_H8_MACH_H8300SXN: + return bfd_mach_h8300sxn; } } @@ -622,6 +625,10 @@ elf32_h8_final_write_processing (abfd, linker) case bfd_mach_h8300sx: val = E_H8_MACH_H8300SX; break; + + case bfd_mach_h8300sxn: + val = E_H8_MACH_H8300SXN; + break; } elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH); diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 3b47246..67688c9 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -47,12 +47,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ECOFF_SIGNED_32 #include "ecoffswap.h" +static bfd_reloc_status_type mips_elf_generic_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type mips_elf_hi16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type mips_elf_lo16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type mips_elf_got16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type gprel32_with_gp + PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, + bfd_vma)); static bfd_reloc_status_type mips_elf_gprel32_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type mips32_64bit_reloc @@ -116,7 +121,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_NONE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -131,7 +136,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -146,7 +151,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -161,7 +166,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -179,7 +184,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = /* This needs complex overflow detection, because the upper four bits must match the PC + 4. */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ TRUE, /* partial_inplace */ 0x03ffffff, /* src_mask */ @@ -269,7 +274,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -284,7 +289,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -320,7 +325,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ TRUE, /* partial_inplace */ 0x000007c0, /* src_mask */ @@ -337,7 +342,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 6, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT6", /* name */ TRUE, /* partial_inplace */ 0x000007c4, /* src_mask */ @@ -367,7 +372,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -382,7 +387,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -397,7 +402,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -412,7 +417,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -427,7 +432,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -442,7 +447,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -462,7 +467,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHER", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -477,7 +482,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHEST", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -492,7 +497,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -507,7 +512,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ TRUE, /* partial_inplace */ 0x0000ffff, /* src_mask */ @@ -522,7 +527,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -543,7 +548,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0x00000000, /* src_mask */ @@ -645,7 +650,7 @@ static reloc_howto_type elf_mips_gnu_rel16_s2 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_GNU_REL16_S2", /* name */ TRUE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -661,7 +666,7 @@ static reloc_howto_type elf_mips_gnu_pcrel64 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC64", /* name */ TRUE, /* partial_inplace */ MINUS_ONE, /* src_mask */ @@ -677,7 +682,7 @@ static reloc_howto_type elf_mips_gnu_pcrel32 = TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + mips_elf_generic_reloc, /* special_function */ "R_MIPS_PC32", /* name */ TRUE, /* partial_inplace */ 0xffffffff, /* src_mask */ @@ -716,6 +721,33 @@ static reloc_howto_type elf_mips_gnu_vtentry_howto = 0, /* dst_mask */ FALSE); /* pcrel_offset */ +/* We use this instead of bfd_elf_generic_reloc because the latter + gets the handling of zero addends wrong. */ +static bfd_reloc_status_type +mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (symbol->flags & BSF_LOCAL) != 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Just go on, nothing to see here. */ + return bfd_reloc_continue; +} + /* Do a R_MIPS_HI16 relocation. This has to be done in combination with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to the HI16. Here we just save the information we need; we do the @@ -761,7 +793,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -923,8 +955,8 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, } /* Now do the LO16 reloc in the usual way. */ - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); + return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); } /* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset @@ -956,20 +988,14 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; } - /* If we're relocating, and this is a local symbol, we can handle it - just like HI16. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) != 0) - return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - - abort (); + return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); } /* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a @@ -1087,13 +1113,11 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_reloc_status_type ret; bfd_vma gp; - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1120,10 +1144,6 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must become the offset from the gp register. */ -static bfd_reloc_status_type gprel32_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); - static bfd_reloc_status_type mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) @@ -1139,13 +1159,11 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_reloc_status_type ret; bfd_vma gp; - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { *error_message = (char *) _("32bits gp relative relocation occurs for an external symbol"); @@ -1153,21 +1171,18 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != (bfd *) NULL) - { - relocateable = TRUE; - gp = _bfd_get_gp_value (output_bfd); - } + relocateable = TRUE; else { relocateable = FALSE; output_bfd = symbol->section->output_section->owner; - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; } + ret = mips_elf_final_gp (output_bfd, symbol, relocateable, + error_message, &gp); + if (ret != bfd_reloc_ok) + return ret; + return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, gp); } @@ -1184,7 +1199,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, bfd_vma gp; { bfd_vma relocation; - unsigned long val; + bfd_vma val; if (bfd_is_com_section (symbol->section)) relocation = 0; @@ -1197,10 +1212,11 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - /* Set val to the offset into the section or symbol. */ - val += reloc_entry->addend; + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) + val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); /* Adjust val for the final section location and GP value. If we are producing relocateable output, we don't want to do this for @@ -1209,7 +1225,10 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address); + if (reloc_entry->howto->partial_inplace) + bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); + else + reloc_entry->addend = val; if (relocateable) reloc_entry->address += input_section->output_offset; @@ -1237,8 +1256,8 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, unsigned long val; bfd_size_type addr; - r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); + r = mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); if (r != bfd_reloc_continue) return r; @@ -1315,16 +1334,16 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_boolean relocateable; bfd_reloc_status_type ret; bfd_vma gp; - unsigned short extend, insn; - unsigned long final; + unsigned short extend = 0; + unsigned short insn = 0; + bfd_signed_vma val; + bfd_vma relocation; - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1346,33 +1365,55 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Pick up the mips16 extend instruction and the real instruction. */ - extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); - - /* Stuff the current addend back as a 32 bit value, do the usual - relocation, and then clean up. */ - bfd_put_32 (abfd, - (bfd_vma) (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), - (bfd_byte *) data + reloc_entry->address); - - ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, data, gp); - - final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (final & 0x1f)), - (bfd_byte *) data + reloc_entry->address + 2); + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; - return ret; + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + + /* Set val to the offset into the section or symbol. */ + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) + { + /* Pick up the mips16 extend instruction and the real instruction. */ + extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); + insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); + val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); + } + + _bfd_mips_elf_sign_extend(val, 16); + + /* Adjust val for the final section location and GP value. If we + are producing relocateable output, we don't want to do this for + an external symbol. */ + if (! relocateable + || (symbol->flags & BSF_SECTION_SYM) != 0) + val += relocation - gp; + + if (reloc_entry->howto->partial_inplace) + { + bfd_put_16 (abfd, + (bfd_vma) ((extend & 0xf800) + | ((val >> 11) & 0x1f) + | (val & 0x7e0)), + (bfd_byte *) data + reloc_entry->address); + bfd_put_16 (abfd, + (bfd_vma) ((insn & 0xffe0) + | (val & 0x1f)), + (bfd_byte *) data + reloc_entry->address + 2); + } + else + reloc_entry->addend = val; + + if (relocateable) + reloc_entry->address += input_section->output_offset; + else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) + return bfd_reloc_overflow; + + return bfd_reloc_ok; } /* A mapping from BFD reloc types to MIPS ELF reloc types. */ diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index a43b3da..baf030a 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1447,15 +1447,17 @@ mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, want to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; } - if (((reloc_entry->addend & 0xffff) + 0x8000) & ~0xffff) - reloc_entry->addend += 0x8000; + if (reloc_entry->howto->partial_inplace) + { + if (((reloc_entry->addend & 0xffff) + 0x8000) & ~0xffff) + reloc_entry->addend += 0x8000; + } return bfd_reloc_continue; } @@ -1488,7 +1490,8 @@ mips_elf64_got16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is a local symbol, we can handle it just like an R_MIPS_HI16. */ if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) != 0) + && ((symbol->flags & BSF_SECTION_SYM) != 0 + || (symbol->flags & BSF_LOCAL) == 0)) return mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); @@ -1610,14 +1613,11 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_reloc_status_type ret; bfd_vma gp; - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1662,8 +1662,7 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, want to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1706,15 +1705,13 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_reloc_status_type ret; bfd_vma gp; bfd_vma relocation; - unsigned long val; + bfd_vma val; - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { *error_message = (char *) _("32bits gp relative relocation occurs for an external symbol"); @@ -1722,21 +1719,18 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != (bfd *) NULL) - { - relocateable = TRUE; - gp = _bfd_get_gp_value (output_bfd); - } + relocateable = TRUE; else { relocateable = FALSE; output_bfd = symbol->section->output_section->owner; - - ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; } + ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, + error_message, &gp); + if (ret != bfd_reloc_ok) + return ret; + if (bfd_is_com_section (symbol->section)) relocation = 0; else @@ -1748,16 +1742,11 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - if (reloc_entry->howto->src_mask == 0) - { - /* This case arises with the 64-bit MIPS ELF ABI. */ - val = 0; - } - else - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - /* Set val to the offset into the section or symbol. */ - val += reloc_entry->addend; + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) + val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); /* Adjust val for the final section location and GP value. If we are producing relocateable output, we don't want to do this for @@ -1766,7 +1755,10 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); + if (reloc_entry->howto->partial_inplace) + bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); + else + reloc_entry->addend = val; if (relocateable) reloc_entry->address += input_section->output_offset; @@ -1792,15 +1784,17 @@ mips_elf64_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, want to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; } - reloc_entry->addend = (reloc_entry->addend & 0x00007c0) - | (reloc_entry->addend & 0x00000800) >> 9; + if (reloc_entry->howto->partial_inplace) + { + reloc_entry->addend = ((reloc_entry->addend & 0x00007c0) + | (reloc_entry->addend & 0x00000800) >> 9); + } return bfd_reloc_continue; } @@ -1857,16 +1851,16 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_boolean relocateable; bfd_reloc_status_type ret; bfd_vma gp; - unsigned short extend, insn; - unsigned long final; + unsigned short extend = 0; + unsigned short insn = 0; + bfd_signed_vma val; + bfd_vma relocation; /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ + addend, we don't want to change anything. */ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1888,33 +1882,55 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Pick up the mips16 extend instruction and the real instruction. */ - extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); - - /* Stuff the current addend back as a 32 bit value, do the usual - relocation, and then clean up. */ - bfd_put_32 (abfd, - (bfd_vma) (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), - (bfd_byte *) data + reloc_entry->address); - - ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, data, gp); - - final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (final & 0x1f)), - (bfd_byte *) data + reloc_entry->address + 2); + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; - return ret; + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + + /* Set val to the offset into the section or symbol. */ + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) + { + /* Pick up the mips16 extend instruction and the real instruction. */ + extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); + insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); + val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); + } + + _bfd_mips_elf_sign_extend(val, 16); + + /* Adjust val for the final section location and GP value. If we + are producing relocateable output, we don't want to do this for + an external symbol. */ + if (! relocateable + || (symbol->flags & BSF_SECTION_SYM) != 0) + val += relocation - gp; + + if (reloc_entry->howto->partial_inplace) + { + bfd_put_16 (abfd, + (bfd_vma) ((extend & 0xf800) + | ((val >> 11) & 0x1f) + | (val & 0x7e0)), + (bfd_byte *) data + reloc_entry->address); + bfd_put_16 (abfd, + (bfd_vma) ((insn & 0xffe0) + | (val & 0x1f)), + (bfd_byte *) data + reloc_entry->address + 2); + } + else + reloc_entry->addend = val; + + if (relocateable) + reloc_entry->address += input_section->output_offset; + else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) + return bfd_reloc_overflow; + + return bfd_reloc_ok; } /* A mapping from BFD reloc types to MIPS ELF reloc types. */ diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 98af624..bc47809 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -60,6 +60,47 @@ static bfd_boolean ppc64_elf_new_section_hook PARAMS ((bfd *, asection *)); +#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec +#define TARGET_LITTLE_NAME "elf64-powerpcle" +#define TARGET_BIG_SYM bfd_elf64_powerpc_vec +#define TARGET_BIG_NAME "elf64-powerpc" +#define ELF_ARCH bfd_arch_powerpc +#define ELF_MACHINE_CODE EM_PPC64 +#define ELF_MAXPAGESIZE 0x10000 +#define elf_info_to_howto ppc64_elf_info_to_howto + +#define elf_backend_want_got_sym 0 +#define elf_backend_want_plt_sym 0 +#define elf_backend_plt_alignment 3 +#define elf_backend_plt_not_loaded 1 +#define elf_backend_got_symbol_offset 0 +#define elf_backend_got_header_size 8 +#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_merge_private_bfd_data ppc64_elf_merge_private_bfd_data +#define bfd_elf64_new_section_hook ppc64_elf_new_section_hook +#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create +#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free + +#define elf_backend_object_p ppc64_elf_object_p +#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections +#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol +#define elf_backend_check_relocs ppc64_elf_check_relocs +#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook +#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol +#define elf_backend_hide_symbol ppc64_elf_hide_symbol +#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust +#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections +#define elf_backend_relocate_section ppc64_elf_relocate_section +#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol +#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class +#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections + /* The name of the dynamic interpreter. This is put in the .interp section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" @@ -77,7 +118,10 @@ static bfd_boolean ppc64_elf_new_section_hook #define TP_OFFSET 0x7000 #define DTP_OFFSET 0x8000 -/* .plt call stub instructions. */ +/* .plt call stub instructions. The normal stub is like this, but + sometimes the .plt entry crosses a 64k boundary and we need to + insert an addis to adjust r12. */ +#define PLT_CALL_STUB_SIZE (7*4) #define ADDIS_R12_R2 0x3d820000 /* addis %r12,%r2,xxx@ha */ #define STD_R2_40R1 0xf8410028 /* std %r2,40(%r1) */ #define LD_R11_0R12 0xe96c0000 /* ld %r11,xxx+0@l(%r12) */ @@ -86,19 +130,31 @@ static bfd_boolean ppc64_elf_new_section_hook /* ld %r11,xxx+16@l(%r12) */ #define BCTR 0x4e800420 /* bctr */ -/* The normal stub is this size. */ -#define PLT_CALL_STUB_SIZE (7*4) - -/* But sometimes the .plt entry crosses a 64k boundary, and we need - to adjust the high word with this insn. */ -#define ADDIS_R12_R12_1 0x3d8c0001 /* addis %r12,%r12,1 */ - -/* The .glink fixup call stub is the same as the .plt call stub, but - the first instruction restores r2, and the std is omitted. */ -#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */ -/* Always allow this much space. */ -#define GLINK_CALL_STUB_SIZE (8*4) +#define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */ +#define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */ + +#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */ + +/* glink call stub instructions. We enter with the index in R0, and the + address of glink entry in CTR. From that, we can calculate PLT0. */ +#define GLINK_CALL_STUB_SIZE (16*4) +#define MFCTR_R12 0x7d8902a6 /* mfctr %r12 */ +#define SLDI_R11_R0_3 0x780b1f24 /* sldi %r11,%r0,3 */ +#define ADDIC_R2_R0_32K 0x34408000 /* addic. %r2,%r0,-32768 */ +#define SUB_R12_R12_R11 0x7d8b6050 /* sub %r12,%r12,%r11 */ +#define SRADI_R2_R2_63 0x7c42fe76 /* sradi %r2,%r2,63 */ +#define SLDI_R11_R0_2 0x780b1764 /* sldi %r11,%r0,2 */ +#define AND_R2_R2_R11 0x7c425838 /* and %r2,%r2,%r11 */ + /* sub %r12,%r12,%r11 */ +#define ADD_R12_R12_R2 0x7d8c1214 /* add %r12,%r12,%r2 */ +#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,xxx@ha */ + /* ld %r11,xxx@l(%r12) */ +#define ADDI_R12_R12 0x398c0000 /* addi %r12,%r12,xxx@l */ + /* ld %r2,8(%r12) */ + /* mtctr %r11 */ + /* ld %r11,16(%r12) */ + /* bctr */ /* Pad with this. */ #define NOP 0x60000000 @@ -1718,7 +1774,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { "R_PPC64_GOT_TPREL16_DS", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0xffff, /* dst_mask */ + 0xfffc, /* dst_mask */ FALSE), /* pcrel_offset */ /* Like GOT_TPREL16_DS, but no overflow. */ @@ -1733,7 +1789,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { "R_PPC64_GOT_TPREL16_LO_DS", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0xffff, /* dst_mask */ + 0xfffc, /* dst_mask */ FALSE), /* pcrel_offset */ /* Like GOT_TPREL16_LO_DS, but next higher group of 16 bits. */ @@ -2574,12 +2630,31 @@ struct plt_entry . mtctr %r11 . ld %r11,xxx+16@toc@l(%r12) . bctr + + ppc_stub_long_branch and ppc_stub_plt_branch may also have additional + code to adjust the value and save r2 to support multiple toc sections. + A ppc_stub_long_branch with an r2 offset looks like: + . std %r2,40(%r1) + . addis %r2,%r2,off@ha + . addi %r2,%r2,off@l + . b dest + + A ppc_stub_plt_branch with an r2 offset looks like: + . std %r2,40(%r1) + . addis %r12,%r2,xxx@toc@ha + . ld %r11,xxx@toc@l(%r12) + . addis %r2,%r2,off@ha + . addi %r2,%r2,off@l + . mtctr %r11 + . bctr */ enum ppc_stub_type { ppc_stub_none, ppc_stub_long_branch, + ppc_stub_long_branch_r2off, ppc_stub_plt_branch, + ppc_stub_plt_branch_r2off, ppc_stub_plt_call }; @@ -2588,6 +2663,8 @@ struct ppc_stub_hash_entry { /* Base hash table entry structure. */ struct bfd_hash_entry root; + enum ppc_stub_type stub_type; + /* The stub section. */ asection *stub_sec; @@ -2599,8 +2676,6 @@ struct ppc_stub_hash_entry { bfd_vma target_value; asection *target_section; - enum ppc_stub_type stub_type; - /* The symbol table entry, if any, that this was derived from. */ struct ppc_link_hash_entry *h; @@ -2687,8 +2762,17 @@ struct ppc_link_hash_table asection *link_sec; /* The stub section. */ asection *stub_sec; + /* Along with elf_gp, specifies the TOC pointer used in this group. */ + bfd_vma toc_off; } *stub_group; + /* Support for multiple toc sections. */ + unsigned int no_multi_toc; + unsigned int multi_toc_needed; + + /* Temp used when calculating TOC pointers. */ + bfd_vma toc_curr; + /* Assorted information used by ppc64_elf_size_stubs. */ int top_index; asection **input_list; @@ -2717,6 +2801,9 @@ struct ppc_link_hash_table bfd_vma offset; } tlsld_got; + /* Set if we should emit symbols for stubs. */ + unsigned int emit_stub_syms; + /* Set on error. */ unsigned int stub_error; @@ -2799,7 +2886,7 @@ static enum ppc_stub_type ppc_type_of_stub PARAMS ((asection *, const Elf_Internal_Rela *, struct ppc_link_hash_entry **, bfd_vma)); static bfd_byte *build_plt_stub - PARAMS ((bfd *, bfd_byte *, int, int)); + PARAMS ((bfd *, bfd_byte *, int)); static bfd_boolean ppc_build_one_stub PARAMS ((struct bfd_hash_entry *, PTR)); static bfd_boolean ppc_size_one_stub @@ -2854,11 +2941,11 @@ stub_hash_newfunc (entry, table, string) /* Initialize the local fields. */ eh = (struct ppc_stub_hash_entry *) entry; + eh->stub_type = ppc_stub_none; eh->stub_sec = NULL; eh->stub_offset = 0; eh->target_value = 0; eh->target_section = NULL; - eh->stub_type = ppc_stub_none; eh->h = NULL; eh->id_sec = NULL; } @@ -2964,6 +3051,9 @@ ppc64_elf_link_hash_table_create (abfd) htab->add_stub_section = NULL; htab->layout_sections_again = NULL; htab->stub_group = NULL; + htab->no_multi_toc = 0; + htab->multi_toc_needed = 0; + htab->toc_curr = 0; htab->sgot = NULL; htab->srelgot = NULL; htab->splt = NULL; @@ -2977,6 +3067,7 @@ ppc64_elf_link_hash_table_create (abfd) htab->tls_sec = NULL; htab->tls_get_addr = NULL; htab->tlsld_got.refcount = 0; + htab->emit_stub_syms = 0; htab->stub_error = 0; htab->has_14bit_branch = 0; htab->have_undefweak = 0; @@ -3038,7 +3129,7 @@ ppc_stub_name (input_section, sym_sec, h, rel) } else { - len = 8 + 1 + 8 + 1 + 8 + 1 + 16 + 1; + len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1; stub_name = bfd_malloc (len); if (stub_name != NULL) { @@ -3622,6 +3713,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs) case R_PPC64_GOT16_LO: case R_PPC64_GOT16_LO_DS: /* This symbol requires a global offset table entry. */ + sec->has_gp_reloc = 1; if (htab->sgot == NULL && !create_got_section (htab->elf.dynobj, info)) return FALSE; @@ -3690,12 +3782,6 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs) case R_PPC64_SECTOFF_HA: case R_PPC64_SECTOFF_DS: case R_PPC64_SECTOFF_LO_DS: - case R_PPC64_TOC16: - case R_PPC64_TOC16_LO: - case R_PPC64_TOC16_HI: - case R_PPC64_TOC16_HA: - case R_PPC64_TOC16_DS: - case R_PPC64_TOC16_LO_DS: case R_PPC64_DTPREL16: case R_PPC64_DTPREL16_LO: case R_PPC64_DTPREL16_HI: @@ -3708,6 +3794,16 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs) case R_PPC64_DTPREL16_HIGHESTA: break; + /* Nor do these. */ + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TOC16_HI: + case R_PPC64_TOC16_HA: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: + sec->has_gp_reloc = 1; + break; + /* This relocation describes the C++ object vtable hierarchy. Reconstruct it for later use during GC. */ case R_PPC64_GNU_VTINHERIT: @@ -4772,7 +4868,7 @@ get_sym_h (hp, symp, symsecp, tls_maskp, locsymsp, r_symndx, ibfd) /* Returns TLS_MASKP for the given REL symbol. Function return is 0 on error, 2 on a toc GD type suitable for optimization, 3 on a toc LD - type suitable for optimization, and 1 otherwise. */ + type suitable for optimization, and 1 otherwise. */ static int get_tls_mask (tls_maskp, locsymsp, rel, ibfd) @@ -5867,8 +5963,16 @@ ppc64_elf_size_dynamic_sections (output_bfd, info) if (s == htab->sbrlt || s == htab->srelbrlt) /* These haven't been allocated yet; don't strip. */ continue; + else if (s == htab->sgot) + { + /* Automatic multiple tocs aren't possible if we are using the + GOT. The GOT is accessed via r2, so we can't adjust r2. + FIXME: There's no reason why we couldn't lay out multiple + GOTs too. */ + if (s->_raw_size > elf_backend_got_header_size) + htab->no_multi_toc = 1; + } else if (s == htab->splt - || s == htab->sgot || s == htab->sglink) { /* Strip this section if we don't need it; see the @@ -6014,8 +6118,8 @@ ppc_type_of_stub (input_sec, rel, hash, destination) } } - if (h->elf.root.type == bfd_link_hash_undefweak - || h->elf.root.type == bfd_link_hash_undefined) + if (h->elf.root.type != bfd_link_hash_defined + && h->elf.root.type != bfd_link_hash_defweak) return ppc_stub_none; } @@ -6043,28 +6147,24 @@ ppc_type_of_stub (input_sec, rel, hash, destination) /* Build a .plt call stub. */ static bfd_byte * -build_plt_stub (obfd, p, offset, glink) +build_plt_stub (obfd, p, offset) bfd *obfd; bfd_byte *p; int offset; - int glink; { #define PPC_LO(v) ((v) & 0xffff) #define PPC_HI(v) (((v) >> 16) & 0xffff) #define PPC_HA(v) PPC_HI ((v) + 0x8000) - if (glink) - bfd_put_32 (obfd, LD_R2_40R1, p), p += 4; bfd_put_32 (obfd, ADDIS_R12_R2 | PPC_HA (offset), p), p += 4; - if (!glink) - bfd_put_32 (obfd, STD_R2_40R1, p), p += 4; + bfd_put_32 (obfd, STD_R2_40R1, p), p += 4; bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4; if (PPC_HA (offset + 8) != PPC_HA (offset)) - bfd_put_32 (obfd, ADDIS_R12_R12_1, p), p += 4; + bfd_put_32 (obfd, ADDIS_R12_R12 | 1, p), p += 4; offset += 8; bfd_put_32 (obfd, LD_R2_0R12 | PPC_LO (offset), p), p += 4; if (PPC_HA (offset + 8) != PPC_HA (offset)) - bfd_put_32 (obfd, ADDIS_R12_R12_1, p), p += 4; + bfd_put_32 (obfd, ADDIS_R12_R12 | 1, p), p += 4; offset += 8; bfd_put_32 (obfd, MTCTR_R11, p), p += 4; bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4; @@ -6101,11 +6201,28 @@ ppc_build_one_stub (gen_entry, in_arg) stub_entry->stub_offset = stub_sec->_cooked_size; loc = stub_sec->contents + stub_entry->stub_offset; + if (htab->emit_stub_syms) + { + struct elf_link_hash_entry *h; + h = elf_link_hash_lookup (&htab->elf, stub_entry->root.string, + TRUE, FALSE, FALSE); + if (h == NULL) + return FALSE; + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = stub_entry->stub_sec; + h->root.u.def.value = stub_entry->stub_offset; + h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_DEF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_FORCED_LOCAL); + } + stub_bfd = stub_sec->owner; switch (stub_entry->stub_type) { case ppc_stub_long_branch: + case ppc_stub_long_branch_r2off: /* Branches are relative. This is where we are going to. */ off = (stub_entry->target_value + stub_entry->target_section->output_offset @@ -6116,13 +6233,30 @@ ppc_build_one_stub (gen_entry, in_arg) + stub_sec->output_offset + stub_sec->output_section->vma); - BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26)); - + if (stub_entry->stub_type != ppc_stub_long_branch_r2off) + size = 4; + else + { + bfd_vma r2off; + + r2off = (htab->stub_group[stub_entry->target_section->id].toc_off + - htab->stub_group[stub_entry->id_sec->id].toc_off); + bfd_put_32 (stub_bfd, (bfd_vma) STD_R2_40R1, loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R2_R2 | PPC_HA (r2off), loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) ADDI_R2_R2 | PPC_LO (r2off), loc); + loc += 4; + off -= 12; + size = 16; + } bfd_put_32 (stub_bfd, (bfd_vma) B_DOT | (off & 0x3fffffc), loc); - size = 4; + + BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26)); break; case ppc_stub_plt_branch: + case ppc_stub_plt_branch_r2off: br_entry = ppc_branch_hash_lookup (&htab->branch_hash_table, stub_entry->root.string + 9, FALSE, FALSE); @@ -6145,7 +6279,7 @@ ppc_build_one_stub (gen_entry, in_arg) { /* Create a reloc for the branch lookup table entry. */ Elf_Internal_Rela rela; - bfd_byte *loc; + bfd_byte *rl; rela.r_offset = (br_entry->offset + htab->sbrlt->output_offset @@ -6153,18 +6287,18 @@ ppc_build_one_stub (gen_entry, in_arg) rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); rela.r_addend = off; - loc = htab->srelbrlt->contents; - loc += htab->srelbrlt->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (htab->srelbrlt->owner, &rela, loc); + rl = htab->srelbrlt->contents; + rl += htab->srelbrlt->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (htab->srelbrlt->owner, &rela, rl); } off = (br_entry->offset + htab->sbrlt->output_offset + htab->sbrlt->output_section->vma - elf_gp (htab->sbrlt->output_section->owner) - - TOC_BASE_OFF); + - htab->stub_group[stub_entry->id_sec->id].toc_off); - if (off + 0x80000000 > 0xffffffff || (off & 7) != 0) + if (off + 0x80008000 > 0xffffffff || (off & 7) != 0) { (*_bfd_error_handler) (_("linkage table error against `%s'"), @@ -6175,11 +6309,34 @@ ppc_build_one_stub (gen_entry, in_arg) } indx = off; - bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R12_R2 | PPC_HA (indx), loc); - bfd_put_32 (stub_bfd, (bfd_vma) LD_R11_0R12 | PPC_LO (indx), loc + 4); - bfd_put_32 (stub_bfd, (bfd_vma) MTCTR_R11, loc + 8); - bfd_put_32 (stub_bfd, (bfd_vma) BCTR, loc + 12); - size = 16; + if (stub_entry->stub_type != ppc_stub_plt_branch_r2off) + { + bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R12_R2 | PPC_HA (indx), loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) LD_R11_0R12 | PPC_LO (indx), loc); + size = 16; + } + else + { + bfd_vma r2off; + + r2off = (htab->stub_group[stub_entry->target_section->id].toc_off + - htab->stub_group[stub_entry->id_sec->id].toc_off); + bfd_put_32 (stub_bfd, (bfd_vma) STD_R2_40R1, loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R12_R2 | PPC_HA (indx), loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) LD_R11_0R12 | PPC_LO (indx), loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) ADDIS_R2_R2 | PPC_HA (r2off), loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) ADDI_R2_R2 | PPC_LO (r2off), loc); + size = 28; + } + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) MTCTR_R11, loc); + loc += 4; + bfd_put_32 (stub_bfd, (bfd_vma) BCTR, loc); break; case ppc_stub_plt_call: @@ -6212,9 +6369,9 @@ ppc_build_one_stub (gen_entry, in_arg) off += (htab->splt->output_offset + htab->splt->output_section->vma - elf_gp (htab->splt->output_section->owner) - - TOC_BASE_OFF); + - htab->stub_group[stub_entry->id_sec->id].toc_off); - if (off + 0x80000000 > 0xffffffff || (off & 7) != 0) + if (off + 0x80008000 > 0xffffffff || (off & 7) != 0) { (*_bfd_error_handler) (_("linkage table error against `%s'"), @@ -6224,7 +6381,7 @@ ppc_build_one_stub (gen_entry, in_arg) return FALSE; } - p = build_plt_stub (stub_bfd, loc, (int) off, 0); + p = build_plt_stub (stub_bfd, loc, (int) off); size = p - loc; break; @@ -6270,18 +6427,16 @@ ppc_size_one_stub (gen_entry, in_arg) off += (htab->splt->output_offset + htab->splt->output_section->vma - elf_gp (htab->splt->output_section->owner) - - TOC_BASE_OFF); + - htab->stub_group[stub_entry->id_sec->id].toc_off); - size = 28; + size = PLT_CALL_STUB_SIZE; if (PPC_HA ((int) off + 16) != PPC_HA ((int) off)) size += 4; } else { - /* ppc_stub_long_branch or ppc_stub_plt_branch. */ - stub_entry->stub_type = ppc_stub_long_branch; - size = 4; - + /* ppc_stub_long_branch or ppc_stub_plt_branch, or their r2off + variants. */ off = (stub_entry->target_value + stub_entry->target_section->output_offset + stub_entry->target_section->output_section->vma); @@ -6289,6 +6444,19 @@ ppc_size_one_stub (gen_entry, in_arg) + stub_entry->stub_sec->output_offset + stub_entry->stub_sec->output_section->vma); + /* Reset the stub type from the plt variant in case we now + can reach with a shorter stub. */ + if (stub_entry->stub_type >= ppc_stub_plt_branch) + stub_entry->stub_type += ppc_stub_long_branch - ppc_stub_plt_branch; + + size = 4; + if (stub_entry->stub_type == ppc_stub_long_branch_r2off) + { + off -= 12; + size = 16; + } + + /* If the branch offset if too big, use a ppc_stub_plt_branch. */ if (off + (1 << 25) >= (bfd_vma) (1 << 26)) { struct ppc_branch_hash_entry *br_entry; @@ -6310,8 +6478,11 @@ ppc_size_one_stub (gen_entry, in_arg) br_entry->offset = htab->sbrlt->_raw_size; htab->sbrlt->_raw_size += 8; } - stub_entry->stub_type = ppc_stub_plt_branch; + + stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch; size = 16; + if (stub_entry->stub_type != ppc_stub_plt_branch) + size = 28; } } @@ -6335,8 +6506,7 @@ ppc64_elf_setup_section_lists (output_bfd, info) bfd_size_type amt; struct ppc_link_hash_table *htab = ppc_hash_table (info); - if (htab->elf.root.creator->flavour != bfd_target_elf_flavour - || htab->sbrlt == NULL) + if (htab->sbrlt == NULL) return 0; /* Find the top input section id. */ @@ -6358,6 +6528,8 @@ ppc64_elf_setup_section_lists (output_bfd, info) if (htab->stub_group == NULL) return -1; + elf_gp (output_bfd) = htab->toc_curr = ppc64_elf_toc (output_bfd); + /* We can't use output_bfd->section_count here to find the top output section index as some sections may have been removed, and _bfd_strip_section_from_output doesn't renumber the indices. */ @@ -6394,6 +6566,59 @@ ppc64_elf_setup_section_lists (output_bfd, info) return 1; } +/* The linker repeatedly calls this function for each toc input + section. Group input bfds such that the toc within a group + is less than 64k in size. Will break with cute linker scripts + that play games with dot in the output toc section. */ + +void +ppc64_elf_next_toc_section (info, isec) + struct bfd_link_info *info; + asection *isec; +{ + struct ppc_link_hash_table *htab = ppc_hash_table (info); + + if (!htab->no_multi_toc) + { + bfd_vma addr = isec->output_offset + isec->output_section->vma; + bfd_vma off = addr - htab->toc_curr; + if (off + isec->_raw_size > 0x10000) + { + htab->toc_curr = addr; + htab->multi_toc_needed = 1; + } + elf_gp (isec->owner) = (htab->toc_curr + - elf_gp (isec->output_section->owner) + + TOC_BASE_OFF); + } +} + +/* Called after the last call to the above function. */ + +void +ppc64_elf_reinit_toc (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + struct ppc_link_hash_table *htab = ppc_hash_table (info); + bfd *ibfd; + bfd_vma curr; + + /* toc_curr tracks the TOC offset used for code sections below in + ppc64_elf_next_input_section. Start off at 0x8000. */ + htab->toc_curr = curr = TOC_BASE_OFF; + + /* Set the TOC base in all input bfds. Some may not have a TOC + section and thus not be set in ppc64_elf_next_toc_section. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + if (elf_gp (ibfd) == 0) + elf_gp (ibfd) = curr; + else + curr = elf_gp (ibfd); + } +} + /* The linker repeatedly calls this function for each input section, in the order that input sections are linked into output sections. Build lists of input sections to determine groupings between which @@ -6419,6 +6644,17 @@ ppc64_elf_next_input_section (info, isec) *list = isec; } } + + /* If a code section has a function that uses the TOC then we need + to use the right TOC (obviously). Also, make sure that .opd gets + the correct TOC value. */ + if (isec->has_gp_reloc || (isec->flags & SEC_CODE) == 0) + htab->toc_curr = elf_gp (isec->owner); + + /* Functions that don't use the TOC can belong in any TOC group. + Use the last TOC base. This happens to make _init and _fini + pasting work. */ + htab->stub_group[isec->id].toc_off = htab->toc_curr; } /* See whether we can group stub sections together. Grouping stub @@ -6446,6 +6682,7 @@ group_sections (htab, stub_group_size, stubs_always_before_branch) asection *prev; bfd_size_type total; bfd_boolean big_sec; + bfd_vma curr_toc; curr = tail; if (tail->_cooked_size) @@ -6453,10 +6690,12 @@ group_sections (htab, stub_group_size, stubs_always_before_branch) else total = tail->_raw_size; big_sec = total >= stub_group_size; + curr_toc = htab->stub_group[tail->id].toc_off; while ((prev = PREV_SEC (curr)) != NULL && ((total += curr->output_offset - prev->output_offset) - < stub_group_size)) + < stub_group_size) + && htab->stub_group[prev->id].toc_off == curr_toc) curr = prev; /* OK, the size from the start of CURR to the end is less @@ -6487,7 +6726,8 @@ group_sections (htab, stub_group_size, stubs_always_before_branch) total = 0; while (prev != NULL && ((total += tail->output_offset - prev->output_offset) - < stub_group_size)) + < stub_group_size) + && htab->stub_group[prev->id].toc_off == curr_toc) { tail = prev; prev = PREV_SEC (tail); @@ -6676,6 +6916,22 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size, /* Determine what (if any) linker stub is needed. */ stub_type = ppc_type_of_stub (section, irela, &hash, destination); + + if (stub_type != ppc_stub_plt_call) + { + /* Check whether we need a TOC adjusting stub. + Since the linker pastes together pieces from + different object files when creating the + _init and _fini functions, it may be that a + call to what looks like a local sym is in + fact a call needing a TOC adjustment. */ + if (sym_sec != NULL + && sym_sec->output_section != NULL + && (htab->stub_group[sym_sec->id].toc_off + != htab->stub_group[section->id].toc_off)) + stub_type = ppc_stub_long_branch_r2off; + } + if (stub_type == ppc_stub_none) continue; @@ -6728,9 +6984,9 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size, return FALSE; } + stub_entry->stub_type = stub_type; stub_entry->target_value = sym_value; stub_entry->target_section = sym_sec; - stub_entry->stub_type = stub_type; stub_entry->h = hash; stub_entry->addend = irela->r_addend; stub_changed = TRUE; @@ -6842,14 +7098,15 @@ ppc64_elf_toc (obfd) hash table. This function is called via gldelf64ppc_finish. */ bfd_boolean -ppc64_elf_build_stubs (info) +ppc64_elf_build_stubs (emit_stub_syms, info) + bfd_boolean emit_stub_syms; struct bfd_link_info *info; { struct ppc_link_hash_table *htab = ppc_hash_table (info); asection *stub_sec; - bfd_vma plt_r2; bfd_byte *p; + htab->emit_stub_syms = emit_stub_syms; for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; stub_sec = stub_sec->next) @@ -6870,20 +7127,55 @@ ppc64_elf_build_stubs (info) if (htab->splt != NULL) { unsigned int indx; + bfd_vma plt0; /* Build the .glink plt call stub. */ - plt_r2 = (htab->splt->output_offset - + htab->splt->output_section->vma - - elf_gp (htab->splt->output_section->owner) - - TOC_BASE_OFF); - p = htab->sglink->contents; - p = build_plt_stub (htab->sglink->owner, p, (int) plt_r2, 1); - while (p < htab->sglink->contents + GLINK_CALL_STUB_SIZE) + plt0 = (htab->splt->output_section->vma + + htab->splt->output_offset + - (htab->sglink->output_section->vma + + htab->sglink->output_offset + + GLINK_CALL_STUB_SIZE)); + if (plt0 + 0x80008000 > 0xffffffff) { - bfd_put_32 (htab->sglink->owner, NOP, p); - p += 4; + (*_bfd_error_handler) (_(".glink and .plt too far apart")); + bfd_set_error (bfd_error_bad_value); + return FALSE; } + p = htab->sglink->contents; + bfd_put_32 (htab->sglink->owner, MFCTR_R12, p); + p += 4; + bfd_put_32 (htab->sglink->owner, SLDI_R11_R0_3, p); + p += 4; + bfd_put_32 (htab->sglink->owner, ADDIC_R2_R0_32K, p); + p += 4; + bfd_put_32 (htab->sglink->owner, SUB_R12_R12_R11, p); + p += 4; + bfd_put_32 (htab->sglink->owner, SRADI_R2_R2_63, p); + p += 4; + bfd_put_32 (htab->sglink->owner, SLDI_R11_R0_2, p); + p += 4; + bfd_put_32 (htab->sglink->owner, AND_R2_R2_R11, p); + p += 4; + bfd_put_32 (htab->sglink->owner, SUB_R12_R12_R11, p); + p += 4; + bfd_put_32 (htab->sglink->owner, ADD_R12_R12_R2, p); + p += 4; + bfd_put_32 (htab->sglink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p); + p += 4; + bfd_put_32 (htab->sglink->owner, LD_R11_0R12 | PPC_LO (plt0), p); + p += 4; + bfd_put_32 (htab->sglink->owner, ADDI_R12_R12 | PPC_LO (plt0), p); + p += 4; + bfd_put_32 (htab->sglink->owner, LD_R2_0R12 | 8, p); + p += 4; + bfd_put_32 (htab->sglink->owner, MTCTR_R11, p); + p += 4; + bfd_put_32 (htab->sglink->owner, LD_R11_0R12 | 16, p); + p += 4; + bfd_put_32 (htab->sglink->owner, BCTR, p); + p += 4; + /* Build the .glink lazy link call stubs. */ indx = 0; while (p < htab->sglink->contents + htab->sglink->_raw_size) @@ -7023,7 +7315,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma relocation; bfd_boolean unresolved_reloc; bfd_boolean warned; - long insn; + long insn, mask; struct ppc_stub_hash_entry *stub_entry; bfd_vma max_br_offset; bfd_vma from; @@ -7039,8 +7331,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type == R_PPC64_TOC) { - /* Relocation value is TOC base. Symbol is ignored. */ - relocation = TOCstart + TOC_BASE_OFF; + /* Relocation value is TOC base. */ + relocation = TOCstart + htab->stub_group[input_section->id].toc_off; } else if (r_symndx < symtab_hdr->sh_info) { @@ -7360,7 +7652,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (tls_gd == 0) { /* We changed the symbol on an LD reloc. Start over - in order to get h, sym, sec etc. right. */ + in order to get h, sym, sec etc. right. */ rel--; continue; } @@ -7453,16 +7745,24 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, break; case R_PPC64_REL24: - /* A REL24 branching to a linkage function is followed by a - nop. We replace the nop with a ld in order to restore - the TOC base pointer. Only calls to shared objects need - to alter the TOC base. These are recognized by their - need for a PLT entry. */ - if (h != NULL - && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL - && fdh->plt.plist != NULL + /* Calls to functions with a different TOC, such as calls to + shared objects, need to alter the TOC pointer. This is + done using a linkage stub. A REL24 branching to these + linkage stubs needs to be followed by a nop, as the nop + will be replaced with an instruction to restore the TOC + base pointer. */ + if (((h != NULL + && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL + && fdh->plt.plist != NULL) + || ((fdh = h, sec) != NULL + && sec->output_section != NULL + && (htab->stub_group[sec->id].toc_off + != htab->stub_group[input_section->id].toc_off))) && (stub_entry = ppc_get_stub_entry (input_section, sec, fdh, - rel, htab)) != NULL) + rel, htab)) != NULL + && (stub_entry->stub_type == ppc_stub_plt_call + || stub_entry->stub_type == ppc_stub_plt_branch_r2off + || stub_entry->stub_type == ppc_stub_long_branch_r2off)) { bfd_boolean can_plt_call = 0; @@ -7480,11 +7780,42 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (!can_plt_call) { - /* If this is a plain branch rather than a branch - and link, don't require a nop. */ - insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - if ((insn & 1) == 0) - can_plt_call = 1; + if (stub_entry->stub_type == ppc_stub_plt_call) + { + /* If this is a plain branch rather than a branch + and link, don't require a nop. */ + insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + if ((insn & 1) == 0) + can_plt_call = 1; + } + else + { + if (strcmp (input_section->output_section->name, + ".init") == 0 + || strcmp (input_section->output_section->name, + ".fini") == 0) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): automatic multiple TOCs " + "not supported using your crt files; " + "recompile with -mminimal-toc or upgrade gcc"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset); + else + (*_bfd_error_handler) + (_("%s(%s+0x%lx): sibling call optimization to `%s' " + "does not allow automatic multiple TOCs; " + "recompile with -mminimal-toc or " + "-fno-optimize-sibling-calls, " + "or make `%s' extern"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset, + sym_name, + sym_name); + bfd_set_error (bfd_error_bad_value); + ret = FALSE; + } } if (can_plt_call) @@ -7492,7 +7823,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, relocation = (stub_entry->stub_offset + stub_entry->stub_sec->output_offset + stub_entry->stub_sec->output_section->vma); - unresolved_reloc = FALSE; + if (stub_entry->stub_type == ppc_stub_plt_call) + unresolved_reloc = FALSE; } } @@ -7690,8 +8022,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); } - /* Init the .got section contents if we're not - emitting a reloc. */ + /* Init the .got section contents here if we're not + emitting a reloc. A reloc will also init the + section contents via _bfd_final_link_relocate. */ else { relocation += rel->r_addend; @@ -7768,7 +8101,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC64_TOC16_DS: case R_PPC64_TOC16_LO_DS: case R_PPC64_TOC16_HA: - addend -= TOCstart + TOC_BASE_OFF; + addend -= TOCstart + htab->stub_group[input_section->id].toc_off; break; /* Relocate against the beginning of the section. */ @@ -7921,7 +8254,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, or this is an opd section reloc which must point at a local function. */ outrel.r_addend += relocation; - /* ??? why? */ + /* We need to relocate .opd contents for ld.so, and + it doesn't hurt to relocate in other cases. */ relocate = TRUE; if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC) { @@ -8072,12 +8406,23 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC64_TPREL16_LO_DS: case R_PPC64_DTPREL16_DS: case R_PPC64_DTPREL16_LO_DS: - if (((relocation + addend) & 3) != 0) + insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3)); + mask = 3; + /* If this reloc is against an lq insn, then the value must be + a multiple of 16. This is somewhat of a hack, but the + "correct" way to do this by defining _DQ forms of all the + _DS relocs bloats all reloc switches in this file. It + doesn't seem to make much sense to use any of these relocs + in data, so testing the insn should be safe. */ + if ((insn & (0x3f << 26)) == (56 << 26)) + mask = 15; + if (((relocation + addend) & mask) != 0) { (*_bfd_error_handler) - (_("%s: error: relocation %s not a multiple of 4"), + (_("%s: error: relocation %s not a multiple of %d"), bfd_archive_filename (input_bfd), - ppc64_elf_howto_table[(int) r_type]->name); + ppc64_elf_howto_table[(int) r_type]->name, + mask + 1); bfd_set_error (bfd_error_bad_value); ret = FALSE; continue; @@ -8094,12 +8439,17 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, max_br_offset = 1 << 25; branch_check: - /* If the branch is out of reach, then redirect the - call to the local stub for this function. */ + /* If the branch is out of reach or the TOC register needs + adjusting, then redirect the call to the local stub for + this function. */ from = (rel->r_offset + input_section->output_offset + input_section->output_section->vma); - if (relocation + addend - from + max_br_offset >= 2 * max_br_offset + if ((relocation + addend - from + max_br_offset >= 2 * max_br_offset + || (sec != NULL + && sec->output_section != NULL + && (htab->stub_group[sec->id].toc_off + != htab->stub_group[input_section->id].toc_off))) && (stub_entry = ppc_get_stub_entry (input_section, sec, h, rel, htab)) != NULL) { @@ -8322,6 +8672,11 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info) case DT_PPC64_GLINK: s = htab->sglink; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + /* We stupidly defined DT_PPC64_GLINK to be the start + of glink rather than the first entry point, which is + what ld.so needs, and now have a bigger stub to + support automatic multiple TOCs. */ + dyn.d_un.d_ptr += GLINK_CALL_STUB_SIZE - 32; break; case DT_PPC64_OPD: @@ -8400,53 +8755,4 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info) return TRUE; } -#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec -#define TARGET_LITTLE_NAME "elf64-powerpcle" -#define TARGET_BIG_SYM bfd_elf64_powerpc_vec -#define TARGET_BIG_NAME "elf64-powerpc" -#define ELF_ARCH bfd_arch_powerpc -#define ELF_MACHINE_CODE EM_PPC64 -#define ELF_MAXPAGESIZE 0x10000 -#define elf_info_to_howto ppc64_elf_info_to_howto - -#ifdef EM_CYGNUS_POWERPC -#define ELF_MACHINE_ALT1 EM_CYGNUS_POWERPC -#endif - -#ifdef EM_PPC_OLD -#define ELF_MACHINE_ALT2 EM_PPC_OLD -#endif - -#define elf_backend_want_got_sym 0 -#define elf_backend_want_plt_sym 0 -#define elf_backend_plt_alignment 3 -#define elf_backend_plt_not_loaded 1 -#define elf_backend_got_symbol_offset 0 -#define elf_backend_got_header_size 8 -#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_merge_private_bfd_data ppc64_elf_merge_private_bfd_data -#define bfd_elf64_new_section_hook ppc64_elf_new_section_hook -#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create -#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free - -#define elf_backend_object_p ppc64_elf_object_p -#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections -#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol -#define elf_backend_check_relocs ppc64_elf_check_relocs -#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook -#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol -#define elf_backend_hide_symbol ppc64_elf_hide_symbol -#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust -#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections -#define elf_backend_relocate_section ppc64_elf_relocate_section -#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol -#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class -#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections - #include "elf64-target.h" diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h index 4b80cc5..1968c4e 100644 --- a/bfd/elf64-ppc.h +++ b/bfd/elf64-ppc.h @@ -29,10 +29,14 @@ bfd_vma ppc64_elf_toc PARAMS ((bfd *)); int ppc64_elf_setup_section_lists PARAMS ((bfd *, struct bfd_link_info *)); +void ppc64_elf_next_toc_section + PARAMS ((struct bfd_link_info *, asection *)); +void ppc64_elf_reinit_toc + PARAMS ((bfd *, struct bfd_link_info *)); void ppc64_elf_next_input_section PARAMS ((struct bfd_link_info *, asection *)); bfd_boolean ppc64_elf_size_stubs PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, asection *(*) (const char *, asection *), void (*) (void))); bfd_boolean ppc64_elf_build_stubs - PARAMS ((struct bfd_link_info *)); + PARAMS ((bfd_boolean, struct bfd_link_info *)); diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 2e49948..1741e35 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -1453,9 +1453,10 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, char **error_message; { /* If we're relocating, and this is a local symbol, we can handle it - just like HI16. */ + just like an R_MIPS_HI16. */ if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) != 0) + && ((symbol->flags & BSF_SECTION_SYM) != 0 + || (symbol->flags & BSF_LOCAL) == 0)) return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); @@ -1654,12 +1655,10 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - /* R_MIPS_GPREL32 relocations are defined for local symbols only. - We will only have an addend if this is a newly created reloc, - not read from an ELF file. */ + /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) + && (symbol->flags & BSF_LOCAL) != 0) { *error_message = (char *) _("32bits gp relative relocation occurs for an external symbol"); @@ -1750,8 +1749,11 @@ mips_elf_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, { GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - reloc_entry->addend = (reloc_entry->addend & 0x00007c0) - | (reloc_entry->addend & 0x00000800) >> 9; + if (reloc_entry->howto->partial_inplace) + { + reloc_entry->addend = ((reloc_entry->addend & 0x00007c0) + | (reloc_entry->addend & 0x00000800) >> 9); + } SET_RELOC_ADDEND (reloc_entry) @@ -1801,8 +1803,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_boolean relocateable; bfd_reloc_status_type ret; bfd_vma gp; - unsigned short extend, insn; - unsigned long final; + unsigned short extend = 0; + unsigned short insn = 0; + bfd_signed_vma val; + bfd_vma relocation; GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) @@ -1822,33 +1826,55 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Pick up the mips16 extend instruction and the real instruction. */ - extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); - - /* Stuff the current addend back as a 32 bit value, do the usual - relocation, and then clean up. */ - bfd_put_32 (abfd, - (bfd_vma) (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), - (bfd_byte *) data + reloc_entry->address); - - ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, data, gp); - - final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (final & 0x1f)), - (bfd_byte *) data + reloc_entry->address + 2); + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; - return ret; + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + + /* Set val to the offset into the section or symbol. */ + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) + { + /* Pick up the mips16 extend instruction and the real instruction. */ + extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); + insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); + val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); + } + + _bfd_mips_elf_sign_extend(val, 16); + + /* Adjust val for the final section location and GP value. If we + are producing relocateable output, we don't want to do this for + an external symbol. */ + if (! relocateable + || (symbol->flags & BSF_SECTION_SYM) != 0) + val += relocation - gp; + + if (reloc_entry->howto->partial_inplace) + { + bfd_put_16 (abfd, + (bfd_vma) ((extend & 0xf800) + | ((val >> 11) & 0x1f) + | (val & 0x7e0)), + (bfd_byte *) data + reloc_entry->address); + bfd_put_16 (abfd, + (bfd_vma) ((insn & 0xffe0) + | (val & 0x1f)), + (bfd_byte *) data + reloc_entry->address + 2); + } + else + reloc_entry->addend = val; + + if (relocateable) + reloc_entry->address += input_section->output_offset; + else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) + return bfd_reloc_overflow; + + return bfd_reloc_ok; } #undef GET_RELOC_ADDEND diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index e390bed..dbbfb31 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -434,7 +434,6 @@ static const Elf_Internal_Rela *mips_elf_next_relocation const Elf_Internal_Rela *)); static bfd_boolean mips_elf_local_relocation_p PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean)); -static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int)); static bfd_boolean mips_elf_overflow_p PARAMS ((bfd_vma, int)); static bfd_vma mips_elf_high PARAMS ((bfd_vma)); static bfd_vma mips_elf_higher PARAMS ((bfd_vma)); @@ -517,11 +516,11 @@ static bfd *reldyn_sorting_bfd; /* The name of the options section. */ #define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \ - (ABI_64_P (abfd) ? ".MIPS.options" : ".options") + (NEWABI_P (abfd) ? ".MIPS.options" : ".options") /* The name of the stub section. */ #define MIPS_ELF_STUB_SECTION_NAME(abfd) \ - (ABI_64_P (abfd) ? ".MIPS.stubs" : ".stub") + (NEWABI_P (abfd) ? ".MIPS.stubs" : ".stub") /* The size of an external REL relocation. */ #define MIPS_ELF_REL_SIZE(abfd) \ @@ -1091,8 +1090,8 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, bfd_vma gp; { bfd_vma relocation; - unsigned long insn; - unsigned long val; + unsigned long insn = 0; + bfd_signed_vma val; if (bfd_is_com_section (symbol->section)) relocation = 0; @@ -1105,21 +1104,17 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - /* Set val to the offset into the section or symbol. */ - if (reloc_entry->howto->src_mask == 0) - { - /* This case occurs with the 64-bit MIPS ELF ABI. */ - val = reloc_entry->addend; - } - else + val = reloc_entry->addend; + + if (reloc_entry->howto->partial_inplace) { - val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff; - if (val & 0x8000) - val -= 0x10000; + insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + val += insn & 0xffff; } + _bfd_mips_elf_sign_extend(val, 16); + /* Adjust val for the final section location and GP value. If we are producing relocateable output, we don't want to do this for an external symbol. */ @@ -1127,13 +1122,18 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - insn = (insn & ~0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + if (reloc_entry->howto->partial_inplace) + { + insn = (insn & ~0xffff) | (val & 0xffff); + bfd_put_32 (abfd, (bfd_vma) insn, + (bfd_byte *) data + reloc_entry->address); + } + else + reloc_entry->addend = val; if (relocateable) reloc_entry->address += input_section->output_offset; - - else if ((long) val >= 0x8000 || (long) val < -0x8000) + else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) return bfd_reloc_overflow; return bfd_reloc_ok; @@ -1663,7 +1663,7 @@ mips_elf_rel_dyn_section (dynobj, create_p) | SEC_LINKER_CREATED | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, sreloc, - 4)) + MIPS_ELF_LOG_FILE_ALIGN (dynobj))) return NULL; } return sreloc; @@ -2741,8 +2741,8 @@ mips_elf_local_relocation_p (input_bfd, relocation, local_sections, /* Sign-extend VALUE, which has the indicated number of BITS. */ -static bfd_vma -mips_elf_sign_extend (value, bits) +bfd_vma +_bfd_mips_elf_sign_extend (value, bits) bfd_vma value; int bits; { @@ -2873,7 +2873,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) s = bfd_make_section (abfd, ".got"); if (s == NULL || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 4)) + || ! bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd))) return FALSE; /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the @@ -3305,7 +3305,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, return bfd_reloc_continue; case R_MIPS_16: - value = symbol + mips_elf_sign_extend (addend, 16); + value = symbol + _bfd_mips_elf_sign_extend (addend, 16); overflowed_p = mips_elf_overflow_p (value, 16); break; @@ -3356,7 +3356,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_GNU_REL16_S2: - value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; + value = symbol + _bfd_mips_elf_sign_extend (addend << 2, 18) - p; overflowed_p = mips_elf_overflow_p (value, 18); value = (value >> 2) & howto->dst_mask; break; @@ -3381,7 +3381,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, if (local_p) value = (((addend << 2) | ((p + 4) & 0xf0000000)) + symbol) >> 2; else - value = (mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2; + value = (_bfd_mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2; value &= howto->dst_mask; break; @@ -3441,7 +3441,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, instruction. If the addend was separate, leave it alone, otherwise we may lose significant bits. */ if (howto->partial_inplace) - addend = mips_elf_sign_extend (addend, 16); + addend = _bfd_mips_elf_sign_extend (addend, 16); value = symbol + addend - gp; /* If the symbol was local, any earlier relocatable links will have adjusted its addend with the gp offset, so compensate @@ -3490,7 +3490,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_PC16: - value = mips_elf_sign_extend (addend, 16) + symbol - p; + value = _bfd_mips_elf_sign_extend (addend, 16) + symbol - p; overflowed_p = mips_elf_overflow_p (value, 16); break; @@ -3853,7 +3853,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, /* We begin by assuming that the offset for the dynamic relocation is the same as for the original relocation. We'll adjust this later to reflect the correct output offsets. */ - if (elf_section_data (input_section)->sec_info_type != ELF_INFO_TYPE_STABS) + if (input_section->sec_info_type != ELF_INFO_TYPE_STABS) { outrel[1].r_offset = rel[1].r_offset; outrel[2].r_offset = rel[2].r_offset; @@ -4974,19 +4974,19 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) /* Change alignments of some sections. */ s = bfd_get_section_by_name (abfd, ".hash"); if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); + bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_section_by_name (abfd, ".dynsym"); if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); + bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_section_by_name (abfd, ".dynstr"); if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); + bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_section_by_name (abfd, ".reginfo"); if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); + bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); + bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); } if (!info->shared) @@ -6353,7 +6353,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, input_bfd, contents); l &= lo16_howto->src_mask; l <<= lo16_howto->rightshift; - l = mips_elf_sign_extend (l, 16); + l = _bfd_mips_elf_sign_extend (l, 16); addend <<= 16; diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 3064c39..088dd6a 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -108,6 +108,7 @@ extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); extern unsigned long _bfd_elf_mips_mach PARAMS ((flagword)); -extern bfd_boolean _bfd_mips_relax_section (bfd *, asection *, - struct bfd_link_info *, - bfd_boolean *); +extern bfd_boolean _bfd_mips_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); +extern bfd_vma _bfd_mips_elf_sign_extend + PARAMS ((bfd_vma, int)); diff --git a/bfd/opncls.c b/bfd/opncls.c index 4771979..b6b4097 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -716,28 +716,32 @@ bfd_release (abfd, block) without debug symbols). */ -static unsigned long calc_crc32 PARAMS ((unsigned long, const unsigned char *, size_t)); static char * get_debug_link_info PARAMS ((bfd *, unsigned long *)); static bfd_boolean separate_debug_file_exists PARAMS ((const char *, const unsigned long)); static char * find_separate_debug_file PARAMS ((bfd *, const char *)); +#define GNU_DEBUGLINK ".gnu_debuglink" /* -INTERNAL_FUNCTION - calc_crc32 +FUNCTION + bfd_calc_gnu_debuglink_crc32 SYNOPSIS - unsigned long calc_crc32 (unsigned long crc, const unsigned char *buf, size_t len); + unsigned long bfd_calc_gnu_debuglink_crc32 (unsigned long crc, const unsigned char *buf, bfd_size_type len); DESCRIPTION - Advance the CRC32 given by @var{crc} through @var{len} - bytes of @var{buf}. Return the updated CRC32 value. + Computes a CRC value as used in the .gnu_debuglink section. + Advances the previously computed @var{crc} value by computing + and adding in the crc32 for @var{len} bytes of @var{buf}. + +RETURNS + Return the updated CRC32 value. */ -static unsigned long -calc_crc32 (crc, buf, len) +unsigned long +bfd_calc_gnu_debuglink_crc32 (crc, buf, len) unsigned long crc; const unsigned char *buf; - size_t len; + bfd_size_type len; { static const unsigned long crc32_table[256] = { @@ -808,7 +812,7 @@ INTERNAL_FUNCTION get_debug_link_info SYNOPSIS - char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out) + char * get_debug_link_info (bfd * abfd, unsigned long * crc32_out) DESCRIPTION fetch the filename and CRC32 value for any separate debuginfo @@ -818,8 +822,8 @@ DESCRIPTION static char * get_debug_link_info (abfd, crc32_out) - bfd *abfd; - unsigned long *crc32_out; + bfd * abfd; + unsigned long * crc32_out; { asection * sect; bfd_size_type debuglink_size; @@ -831,14 +835,17 @@ get_debug_link_info (abfd, crc32_out) BFD_ASSERT (abfd); BFD_ASSERT (crc32_out); - sect = bfd_get_section_by_name (abfd, ".gnu_debuglink"); + sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK); if (sect == NULL) return NULL; debuglink_size = bfd_section_size (abfd, sect); - contents = xmalloc (debuglink_size); + contents = malloc (debuglink_size); + if (contents == NULL) + return NULL; + ret = bfd_get_section_contents (abfd, sect, contents, (file_ptr)0, debuglink_size); if (! ret) @@ -877,7 +884,7 @@ separate_debug_file_exists (name, crc) static char buffer [8 * 1024]; unsigned long file_crc = 0; int fd; - int count; + bfd_size_type count; BFD_ASSERT (name); @@ -886,7 +893,7 @@ separate_debug_file_exists (name, crc) return FALSE; while ((count = read (fd, buffer, sizeof (buffer))) > 0) - file_crc = calc_crc32 (file_crc, buffer, count); + file_crc = bfd_calc_gnu_debuglink_crc32 (file_crc, buffer, count); close (fd); @@ -930,16 +937,21 @@ find_separate_debug_file (abfd, debug_file_directory) return NULL; basename = get_debug_link_info (abfd, & crc32); - if (basename == NULL) return NULL; + if (strlen (basename) < 1) { free (basename); return NULL; } - dir = xstrdup (abfd->filename); + dir = strdup (abfd->filename); + if (dir == NULL) + { + free (basename); + return NULL; + } BFD_ASSERT (strlen (dir) != 0); /* Strip off filename part. */ @@ -950,11 +962,17 @@ find_separate_debug_file (abfd, debug_file_directory) dir[i + 1] = '\0'; BFD_ASSERT (dir[i] == '/' || dir[0] == '\0') - debugfile = xmalloc (strlen (debug_file_directory) + 1 - + strlen (dir) - + strlen (".debug/") - + strlen (basename) - + 1); + debugfile = malloc (strlen (debug_file_directory) + 1 + + strlen (dir) + + strlen (".debug/") + + strlen (basename) + + 1); + if (debugfile == NULL) + { + free (basename); + free (dir); + return NULL; + } /* First try in the same directory as the original file: */ strcpy (debugfile, dir); @@ -1037,3 +1055,114 @@ bfd_follow_gnu_debuglink (abfd, dir) #endif return find_separate_debug_file (abfd, dir); } + +/* +FUNCTION + bfd_add_gnu_debuglink + +SYNOPSIS + bfd_boolean bfd_add_gnu_debuglink (bfd * abfd, const char * filename); + +DESCRIPTION + + Takes a @var{BFD} and adds a .gnu_debuglink section containing a link + to the specified @var{filename}. The filename should be relative to + the current directory. + +RETURNS + <> is returned if all is ok. Otherwise <> is returned + and bfd_error is set. +*/ + +bfd_boolean +bfd_add_gnu_debuglink (abfd, filename) + bfd *abfd; + const char * filename; +{ + asection * sect; + bfd_size_type debuglink_size; + unsigned long crc32; + char * contents; + bfd_size_type crc_offset; + FILE * handle; + static char buffer[8 * 1024]; + size_t count; + + if (abfd == NULL || filename == NULL) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + /* Make sure that we can read the file. + XXX - Should we attempt to locate the debug info file using the same + algorithm as gdb ? At the moment, since we are creating the + .gnu_debuglink section, we insist upon the user providing us with a + correct-for-section-creation-time path, but this need not conform to + the gdb location algorithm. */ + handle = fopen (filename, FOPEN_RB); + if (handle == NULL) + { + bfd_set_error (bfd_error_system_call); + return FALSE; + } + + crc32 = 0; + while ((count = fread (buffer, 1, sizeof buffer, handle)) > 0) + crc32 = bfd_calc_gnu_debuglink_crc32 (crc32, buffer, count); + fclose (handle); + + /* Strip off any path components in filename, + now that we no longer need them. */ + filename = lbasename (filename); + + sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK); + if (sect) + { + /* Section already exists. */ + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + sect = bfd_make_section (abfd, GNU_DEBUGLINK); + if (sect == NULL) + return FALSE; + + if (! bfd_set_section_flags (abfd, sect, + SEC_HAS_CONTENTS | SEC_DEBUGGING)) + /* XXX Should we delete the section from the bfd ? */ + return FALSE; + + + debuglink_size = strlen (filename) + 1; + debuglink_size += 3; + debuglink_size &= ~3; + debuglink_size += 4; + + if (! bfd_set_section_size (abfd, sect, debuglink_size)) + /* XXX Should we delete the section from the bfd ? */ + return FALSE; + + contents = malloc (debuglink_size); + if (contents == NULL) + { + /* XXX Should we delete the section from the bfd ? */ + bfd_set_error (bfd_error_no_memory); + return FALSE; + } + + strcpy (contents, filename); + crc_offset = debuglink_size - 4; + + bfd_put_32 (abfd, crc32, (bfd_byte *) (contents + crc_offset)); + + if (! bfd_set_section_contents (abfd, sect, contents, + (file_ptr)0, debuglink_size)) + { + /* XXX Should we delete the section from the bfd ? */ + free (contents); + return FALSE; + } + + return TRUE; +} diff --git a/bfd/po/Make-in b/bfd/po/Make-in index a288585..1608b2d 100644 --- a/bfd/po/Make-in +++ b/bfd/po/Make-in @@ -24,6 +24,8 @@ gnulocaledir = $(prefix)/share/locale gettextsrcdir = $(prefix)/share/gettext/po subdir = po +DESTDIR = + INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = @MKINSTALLDIRS@ @@ -124,9 +126,9 @@ install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $(datadir); \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ else \ - $(top_srcdir)/mkinstalldirs $(datadir); \ + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ fi @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ @@ -136,7 +138,7 @@ install-data-yes: all *) destdir=$(localedir);; \ esac; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - dir=$$destdir/$$lang/LC_MESSAGES; \ + dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ if test -r $(MKINSTALLDIRS); then \ $(MKINSTALLDIRS) $$dir; \ else \ @@ -166,12 +168,12 @@ install-data-yes: all done if test "$(PACKAGE)" = "gettext"; then \ if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $(gettextsrcdir); \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ else \ - $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ fi; \ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ - $(gettextsrcdir)/Makefile.in.in; \ + $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ else \ : ; \ fi @@ -184,12 +186,12 @@ uninstall: for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ done - rm -f $(gettextsrcdir)/po-Makefile.in.in + rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in check: all diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 898aa26..bbd8dda 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -1,19 +1,19 @@ aix386-core.c aix5ppc-core.c -aout0.c -aout32.c -aout64.c aout-adobe.c aout-arm.c aout-cris.c -aoutf1.h aout-ns32k.c aout-sparcle.c aout-target.h aout-tic30.c +aout0.c +aout32.c +aout64.c +aoutf1.h aoutx.h -archive64.c archive.c +archive64.c archures.c armnetbsd.c bfd.c @@ -26,21 +26,17 @@ cf-i386lynx.c cf-m68klynx.c cf-sparclynx.c cisco-core.c -coff64-rs6000.c coff-a29k.c coff-alpha.c coff-apollo.c coff-arm.c coff-aux.c -coffcode.h -coffgen.c coff-go32.c coff-h8300.c coff-h8500.c coff-i386.c coff-i860.c coff-i960.c -cofflink.c coff-m68k.c coff-m88k.c coff-mips.c @@ -50,7 +46,6 @@ coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c -coffswap.h coff-tic30.c coff-tic4x.c coff-tic54x.c @@ -59,6 +54,11 @@ coff-u68k.c coff-w65.c coff-we32k.c coff-z8k.c +coff64-rs6000.c +coffcode.h +coffgen.c +cofflink.c +coffswap.h corefile.c cpu-a29k.c cpu-alpha.c @@ -121,10 +121,16 @@ ecofflink.c ecoffswap.h efi-app-ia32.c efi-app-ia64.c +elf-bfd.h +elf-eh-frame.c +elf-hppa.h +elf-m10200.c +elf-m10300.c +elf-strtab.c +elf.c elf32-arc.c elf32-arm.h elf32-avr.c -elf32.c elf32-cris.c elf32-d10v.c elf32-d30v.c @@ -155,16 +161,16 @@ elf32-or32.c elf32-pj.c elf32-ppc.c elf32-s390.c -elf32-sh64.c -elf32-sh64-com.c elf32-sh.c +elf32-sh64-com.c +elf32-sh64.c elf32-sparc.c elf32-v850.c elf32-vax.c elf32-xstormy16.c elf32-xtensa.c +elf32.c elf64-alpha.c -elf64.c elf64-gen.c elf64-hppa.c elf64-hppa.h @@ -175,20 +181,14 @@ elf64-s390.c elf64-sh64.c elf64-sparc.c elf64-x86-64.c +elf64.c elfarm-nabi.c elfarm-oabi.c -elf-bfd.h -elf.c elfcode.h elfcore.h -elf-eh-frame.c -elf-hppa.h elflink.c elflink.h -elf-m10200.c -elf-m10300.c elfn32-mips.c -elf-strtab.c elfxx-mips.c epoc-pe-arm.c epoc-pei-arm.c @@ -239,16 +239,16 @@ mipsbsd.c mmo.c netbsd.h newsos3.c +nlm-target.h +nlm.c nlm32-alpha.c -nlm32.c nlm32-i386.c nlm32-ppc.c nlm32-sparc.c +nlm32.c nlm64.c -nlm.c nlmcode.h nlmswap.h -nlm-target.h ns32k.h ns32knetbsd.c oasys.c @@ -257,24 +257,24 @@ osf-core.c pc532-mach.c pdp11.c pe-arm.c +pe-i386.c +pe-mcore.c +pe-mips.c +pe-ppc.c +pe-sh.c +pef-traceback.h pef.c pef.h -pef-traceback.h -pe-i386.c pei-arm.c -peicode.h pei-i386.c pei-mcore.c pei-mips.c pei-ppc.c pei-sh.c -pe-mcore.c -pe-mips.c -pe-ppc.c -pe-sh.c +peicode.h ppcboot.c -reloc16.c reloc.c +reloc16.c riscix.c sco5-core.c section.c @@ -285,8 +285,8 @@ sparclinux.c sparclynx.c sparcnetbsd.c srec.c -stabs.c stab-syms.c +stabs.c sunos.c syms.c targets.c @@ -297,14 +297,14 @@ vaxbsd.c vaxnetbsd.c versados.c version.h -vms.c vms-gsd.c -vms.h vms-hdr.c vms-misc.c vms-tir.c -xcofflink.c +vms.c +vms.h xcoff-target.h +xcofflink.c xsym.c xsym.h xtensa-isa.c diff --git a/bfd/section.c b/bfd/section.c index 04f439e..6facfe2 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -399,8 +399,10 @@ CODE_FRAGMENT . {* Nonzero if this section needs the relax finalize pass. *} . unsigned int need_finalize_relax:1; . +. {* Nonzero if this section has a gp reloc. *} +. unsigned int has_gp_reloc:1; +. . {* Usused bits. *} -. unsigned int flag12:1; . unsigned int flag13:1; . unsigned int flag14:1; . unsigned int flag15:1; @@ -617,8 +619,11 @@ static const asymbol global_syms[] = /* linker_mark, linker_has_input, gc_mark, segment_mark, */ \ 0, 0, 1, 0, \ \ - /* sec_info_type, use_rela_p, has_tls_reloc, need_finalize_relax, flag12, */ \ - 0, 0, 0, 0, 0, \ + /* sec_info_type, use_rela_p, has_tls_reloc, */ \ + 0, 0, 0, \ + \ + /* need_finalize_relax, has_gp_reloc, */ \ + 0, 0, \ \ /* flag13, flag14, flag15, flag16, flag20, flag24, */ \ 0, 0, 0, 0, 0, 0, \ diff --git a/bfd/version.h b/bfd/version.h index 6b4a5f8..809db7a 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030606 +#define BFD_VERSION_DATE 20030613 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/config.guess b/config.guess index 6bdac8d..04c91cc 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-05-09' +timestamp='2003-06-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -106,6 +106,7 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; @@ -320,6 +321,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; @@ -767,8 +771,8 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks @@ -797,6 +801,9 @@ EOF arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; diff --git a/config.sub b/config.sub index fe4f1ed..97e405b 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-05-09' +timestamp='2003-06-06' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -771,18 +771,24 @@ case $basic_machine in pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; @@ -1131,7 +1137,7 @@ case $os in | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix*) + | -powermax* | -dnix* | -nx6 | -nx7) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) diff --git a/configure b/configure index 6ee8dc0..22f8673 100755 --- a/configure +++ b/configure @@ -12,10 +12,10 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --disable-serial-[{host,target,build}-]configure - Don't force sequential configuration of + --enable-serial-[{host,target,build}-]configure + Force sequential configuration of sub-packages for the host, target or build - machine, or of any sub-packages at all" + machine, or all sub-packages" ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" @@ -1916,10 +1916,6 @@ fi # Default to using --with-stabs for certain targets. if test x${with_stabs} = x ; then case "${target}" in - mips*-*-irix6*o32) - with_stabs=yes; - extra_host_args="${extra_host_args} --with-stabs" - ;; mips*-*-irix6*) ;; mips*-*-* | alpha*-*-osf*) @@ -2390,13 +2386,20 @@ if test "${enable_serial_configure+set}" = set; then fi +case ${enable_serial_configure} in + yes) + enable_serial_build_configure=yes + enable_serial_host_configure=yes + enable_serial_target_configure=yes + ;; +esac + # These force 'configure's to be done one at a time, to avoid problems # with contention over a shared config.cache. rm -f serdep.tmp echo '# serdep.tmp' > serdep.tmp olditem= -test "x${enable_serial_configure}" = xno || -test "x${enable_serial_build_configure}" = xno || +test "x${enable_serial_build_configure}" = xyes && for item in ${build_configdirs} ; do case ${olditem} in "") ;; @@ -2405,8 +2408,7 @@ for item in ${build_configdirs} ; do olditem=${item} done olditem= -test "x${enable_serial_configure}" = xno || -test "x${enable_serial_host_configure}" = xno || +test "x${enable_serial_host_configure}" = xyes && for item in ${configdirs} ; do case ${olditem} in "") ;; @@ -2415,8 +2417,7 @@ for item in ${configdirs} ; do olditem=${item} done olditem= -test "x${enable_serial_configure}" = xno || -test "x${enable_serial_target_configure}" = xno || +test "x${enable_serial_target_configure}" = xyes && for item in ${target_configdirs} ; do case ${olditem} in "") ;; @@ -2692,7 +2693,7 @@ test -n "$target_alias" && ncn_target_tool_prefix=$target_alias- # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args. set dummy ${ncn_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2696: checking for $ac_word" >&5 +echo "configure:2697: 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 @@ -2725,7 +2726,7 @@ if test -z "$ac_cv_prog_AR" ; then # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2729: checking for $ac_word" >&5 +echo "configure:2730: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2764,7 +2765,7 @@ fi # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args. set dummy ${ncn_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2768: checking for $ac_word" >&5 +echo "configure:2769: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2797,7 +2798,7 @@ if test -z "$ac_cv_prog_AS" ; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2801: checking for $ac_word" >&5 +echo "configure:2802: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2836,7 +2837,7 @@ fi # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ncn_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2840: checking for $ac_word" >&5 +echo "configure:2841: 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 @@ -2869,7 +2870,7 @@ if test -z "$ac_cv_prog_DLLTOOL" ; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2873: checking for $ac_word" >&5 +echo "configure:2874: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2908,7 +2909,7 @@ fi # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args. set dummy ${ncn_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2912: checking for $ac_word" >&5 +echo "configure:2913: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2941,7 +2942,7 @@ if test -z "$ac_cv_prog_LD" ; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2945: checking for $ac_word" >&5 +echo "configure:2946: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2980,7 +2981,7 @@ fi # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args. set dummy ${ncn_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2984: checking for $ac_word" >&5 +echo "configure:2985: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3013,7 +3014,7 @@ if test -z "$ac_cv_prog_NM" ; then # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3017: checking for $ac_word" >&5 +echo "configure:3018: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3052,7 +3053,7 @@ fi # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ncn_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3056: checking for $ac_word" >&5 +echo "configure:3057: 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 @@ -3085,7 +3086,7 @@ if test -z "$ac_cv_prog_RANLIB" ; 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:3089: checking for $ac_word" >&5 +echo "configure:3090: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3124,7 +3125,7 @@ fi # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args. set dummy ${ncn_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3128: checking for $ac_word" >&5 +echo "configure:3129: 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 @@ -3157,7 +3158,7 @@ if test -z "$ac_cv_prog_WINDRES" ; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3161: checking for $ac_word" >&5 +echo "configure:3162: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3196,7 +3197,7 @@ fi # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args. set dummy ${ncn_tool_prefix}objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3200: checking for $ac_word" >&5 +echo "configure:3201: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3229,7 +3230,7 @@ if test -z "$ac_cv_prog_OBJCOPY" ; then # Extract the first word of "objcopy", so it can be a program name with args. set dummy objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3233: checking for $ac_word" >&5 +echo "configure:3234: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3268,7 +3269,7 @@ fi # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args. set dummy ${ncn_tool_prefix}objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3272: checking for $ac_word" >&5 +echo "configure:3273: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3301,7 +3302,7 @@ if test -z "$ac_cv_prog_OBJDUMP" ; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3305: checking for $ac_word" >&5 +echo "configure:3306: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3349,7 +3350,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3353: checking for $ac_word" >&5 +echo "configure:3354: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3382,7 +3383,7 @@ if test -z "$ac_cv_prog_AR_FOR_TARGET" ; then # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3386: checking for $ac_word" >&5 +echo "configure:3387: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3421,7 +3422,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3425: checking for $ac_word" >&5 +echo "configure:3426: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3454,7 +3455,7 @@ if test -z "$ac_cv_prog_AS_FOR_TARGET" ; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3458: checking for $ac_word" >&5 +echo "configure:3459: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3493,7 +3494,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3497: checking for $ac_word" >&5 +echo "configure:3498: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3526,7 +3527,7 @@ if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" ; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3530: checking for $ac_word" >&5 +echo "configure:3531: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3565,7 +3566,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3569: checking for $ac_word" >&5 +echo "configure:3570: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3598,7 +3599,7 @@ if test -z "$ac_cv_prog_LD_FOR_TARGET" ; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3602: checking for $ac_word" >&5 +echo "configure:3603: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3637,7 +3638,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3641: checking for $ac_word" >&5 +echo "configure:3642: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3670,7 +3671,7 @@ if test -z "$ac_cv_prog_NM_FOR_TARGET" ; then # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3674: checking for $ac_word" >&5 +echo "configure:3675: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3709,7 +3710,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3713: checking for $ac_word" >&5 +echo "configure:3714: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3742,7 +3743,7 @@ if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" ; 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:3746: checking for $ac_word" >&5 +echo "configure:3747: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3781,7 +3782,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3785: checking for $ac_word" >&5 +echo "configure:3786: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3814,7 +3815,7 @@ if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" ; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3818: checking for $ac_word" >&5 +echo "configure:3819: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3881,7 +3882,7 @@ RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target} NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target} echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:3885: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:3886: 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" diff --git a/configure.in b/configure.in index ba9c3bf..646a1c9 100644 --- a/configure.in +++ b/configure.in @@ -1230,10 +1230,6 @@ fi # Default to using --with-stabs for certain targets. if test x${with_stabs} = x ; then case "${target}" in - mips*-*-irix6*o32) - with_stabs=yes; - extra_host_args="${extra_host_args} --with-stabs" - ;; mips*-*-irix6*) ;; mips*-*-* | alpha*-*-osf*) @@ -1698,18 +1694,25 @@ AC_SUBST_FILE(maybe_dependencies) # Create the serialization dependencies. This uses a temporary file. AC_ARG_ENABLE([serial-configure], -[ --disable-serial-[{host,target,build}-]configure - Don't force sequential configuration of +[ --enable-serial-[{host,target,build}-]configure + Force sequential configuration of sub-packages for the host, target or build - machine, or of any sub-packages at all]) + machine, or all sub-packages]) + +case ${enable_serial_configure} in + yes) + enable_serial_build_configure=yes + enable_serial_host_configure=yes + enable_serial_target_configure=yes + ;; +esac # These force 'configure's to be done one at a time, to avoid problems # with contention over a shared config.cache. rm -f serdep.tmp echo '# serdep.tmp' > serdep.tmp olditem= -test "x${enable_serial_configure}" = xno || -test "x${enable_serial_build_configure}" = xno || +test "x${enable_serial_build_configure}" = xyes && for item in ${build_configdirs} ; do case ${olditem} in "") ;; @@ -1718,8 +1721,7 @@ for item in ${build_configdirs} ; do olditem=${item} done olditem= -test "x${enable_serial_configure}" = xno || -test "x${enable_serial_host_configure}" = xno || +test "x${enable_serial_host_configure}" = xyes && for item in ${configdirs} ; do case ${olditem} in "") ;; @@ -1728,8 +1730,7 @@ for item in ${configdirs} ; do olditem=${item} done olditem= -test "x${enable_serial_configure}" = xno || -test "x${enable_serial_target_configure}" = xno || +test "x${enable_serial_target_configure}" = xyes && for item in ${target_configdirs} ; do case ${olditem} in "") ;; diff --git a/cpu/ChangeLog b/cpu/ChangeLog index b262a8e..ddf23b5 100644 --- a/cpu/ChangeLog +++ b/cpu/ChangeLog @@ -1,3 +1,17 @@ +2003-06-10 Doug Evans + + * frv.cpu: Add IDOC attribute. + +2003-06-06 Andrew Cagney + + Contributed by Red Hat. + * iq2000.cpu: New file. Written by Ben Elliston, Jeff Johnston, + Stan Cox, and Frank Ch. Eigler. + * iq2000.opc: New file. Written by Ben Elliston, Frank + Ch. Eigler, Chris Moller, Jeff Johnston, and Stan Cox. + * iq2000m.cpu: New file. Written by Jeff Johnston. + * iq10.cpu: New file. Written by Jeff Johnston. + 2003-06-05 Nick Clifton * frv.cpu (FRintieven): New operand. An even-numbered only diff --git a/cpu/frv.cpu b/cpu/frv.cpu index 9550850..efe3b98 100644 --- a/cpu/frv.cpu +++ b/cpu/frv.cpu @@ -1016,6 +1016,24 @@ (comment "placeholder attribute") (attrs META) ; do not define in any generated file for now ) + +; IDOC attribute for instruction documentation. + +(define-attr + (for insn) + (type enum) + (name IDOC) + (comment "insn kind for documentation") + (attrs META) + (values + (MEM - () "Memory") + (ALU - () "ALU") + (FPU - () "FPU") + (BR - () "Branch") + (PRIV - () "Priviledged") + (MISC - () "Miscellaneous") + ) +) ; Instruction fields. ; diff --git a/cpu/iq10.cpu b/cpu/iq10.cpu new file mode 100644 index 0000000..322f3cc --- /dev/null +++ b/cpu/iq10.cpu @@ -0,0 +1,1111 @@ +; IQ10-only CPU description. -*- Scheme -*- +; +; Copyright 2001, 2002 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Vitesse. +; +; This file is part of the GNU Binutils. +; +; This program is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +; Instructions. + +(dni andoui-q10 "iq10 and upper ones immediate" (MACH10 USES-RS USES-RT) + "andoui $rt,$rs,$hi16" + (+ OP10_ANDOUI rs rt hi16) + (set rt (and rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni andoui2-q10 "iq10 and upper ones immediate" (ALIAS NO-DIS MACH10 USES-RS USES-RT) + "andoui ${rt-rs},$hi16" + (+ OP10_ANDOUI rt-rs hi16) + (set rt-rs (and rt-rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni orui-q10 "or upper immediate" (MACH10 USES-RS USES-RT) + "orui $rt,$rs,$hi16" + (+ OP10_ORUI rs rt hi16) + (set rt (or rs (sll hi16 16))) + ()) + +(dni orui2-q10 "or upper immediate" (ALIAS NO-DIS MACH10 USES-RS USES-RT) + "orui ${rt-rs},$hi16" + (+ OP10_ORUI rt-rs hi16) + (set rt-rs (or rt-rs (sll hi16 16))) + ()) + +(dni mrgbq10 "merge bytes" (MACH10 USES-RD USES-RS USES-RT) + "mrgb $rd,$rs,$rt,$maskq10" + (+ OP_SPECIAL rs rt rd maskq10 FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd temp)) + ()) + +(dni mrgbq102 "merge bytes" (ALIAS NO-DIS MACH10 USES-RD USES-RS USES-RT) + "mrgb ${rd-rs},$rt,$maskq10" + (+ OP_SPECIAL rt rd-rs maskq10 FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rd-rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rd-rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rd-rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rd-rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd-rs temp)) + ()) + +; In the future, we'll want the j & jal to use the 21 bit target, with +; the upper five bits shifted up. For now, give 'em the 16 bit target. + +(dni jq10 "jump" (MACH10) + "j $jmptarg" + (+ OP_J (f-rs 0) (f-rt 0) jmptarg) +; "j $jmptargq10" +; (+ OP_J upper-5-jmptargq10 (f-rt 0) lower-16-jmptargq10) + (delay 1 (set pc jmptarg)) + ()) + +(dni jalq10 "jump and link" (MACH10 USES-RT) + "jal $rt,$jmptarg" + (+ OP_JAL (f-rs 0) rt jmptarg) +; "jal $rt,$jmptargq10" +; (+ OP_JAL upper-5-jmptargq10 rt lower-16-jmptargq10) + (delay 1 + (sequence () + (set rt (add pc 8)) + (set pc jmptarg))) + ()) + +(dni jalq10-2 "jump and link, implied r31" (MACH10 USES-RT) + "jal $jmptarg" + (+ OP_JAL (f-rs 0) (f-rt 31) jmptarg) + (delay 1 + (sequence () + (set rt (add pc 8)) + (set pc jmptarg))) + ()) + +; Branch instructions. + +(dni bbil "branch bit immediate likely" (MACH10 USES-RS) + "bbil $rs($bitnum),$offset" + (+ OP10_BBIL rs bitnum offset) + (if (bitset? rs bitnum) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bbinl "branch bit immediate negated likely" (MACH10 USES-RS) + "bbinl $rs($bitnum),$offset" + (+ OP10_BBINL rs bitnum offset) + (if (bitclear? rs bitnum) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bbvl "branch bit variable likely" (MACH10 USES-RS USES-RT) + "bbvl $rs,$rt,$offset" + (+ OP10_BBVL rs rt offset) + (if (bitset? rs (and rt #x1F)) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bbvnl "branch bit variable negated likely" (MACH10 USES-RS USES-RT) + "bbvnl $rs,$rt,$offset" + (+ OP10_BBVNL rs rt offset) + (if (bitclear? rs (and rt #x1F)) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bgtzal "branch if greater than zero and link" (MACH10 USES-RS USES-R31) + "bgtzal $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZAL offset) + (if (gt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni bgtzall + "branch if greater than zero and link likely" (MACH10 USES-RS USES-R31) + "bgtzall $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZALL offset) + (if (gt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni blezal "branch if less than or equal to zero and link" (MACH10 USES-RS USES-R31) + "blezal $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZAL offset) + (if (le rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni blezall + "branch if less than or equal to zero and link likely" (MACH10 USES-RS USES-R31) + "blezall $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZALL offset) + (if (le rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni bgtz-q10 "branch if greater than zero" (MACH10 USES-RS) + "bgtz $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZ offset) + (if (gt rs 0) + (delay 1 (set pc offset))) + ()) + +(dni bgtzl-q10 "branch if greater than zero likely" (MACH10 USES-RS) + "bgtzl $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZL offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + + +(dni blez-q10 "branch if less than or equal to zero" (MACH10 USES-RS) + "blez $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZ offset) + (if (le rs 0) + (delay 1 (set pc offset))) + ()) + +(dni blezl-q10 "branch if less than or equal to zero likely" (MACH10 USES-RS) + "blezl $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZL offset) + (if (le rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bmb-q10 "branch if matching byte-lane" (MACH10 USES-RS USES-RT) + "bmb $rs,$rt,$offset" + (+ OP10_BMB rs rt offset) + (sequence ((BI branch?)) + (set branch? 0) + (if (eq (and rs #xFF) (and rt #xFF)) + (set branch? 1)) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (set branch? 1)) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (set branch? 1)) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (set branch? 1)) + (if branch? + (delay 1 (set pc offset)))) + ()) + +(dni bmbl "branch if matching byte-lane likely" (MACH10 USES-RS USES-RT) + "bmbl $rs,$rt,$offset" + (+ OP10_BMBL rs rt offset) + (sequence ((BI branch?)) + (set branch? 0) + (if (eq (and rs #xFF) (and rt #xFF)) + (set branch? 1)) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (set branch? 1)) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (set branch? 1)) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (set branch? 1)) + (if branch? + (delay 1 (set pc offset)) + (skip 1))) + ()) + +(dni bri "branch if register invalid" (MACH10 USES-RS) + "bri $rs,$offset" + (+ OP_REGIMM rs FUNC_BRI offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni brv "branch if register invalid" (MACH10 USES-RS) + "brv $rs,$offset" + (+ OP_REGIMM rs FUNC_BRV offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +; debug instructions + +(dni bctx "branch if the current context == instruction[21]" (MACH10 USES-RS) + "bctx $rs,$offset" + (+ OP_REGIMM rs FUNC_BCTX offset) + (delay 1 (set pc offset)) + ()) + +(dni yield "unconditional yield to the other context" (MACH10) + "yield" + (+ OP_SPECIAL (f-rs 0) (f-rt 0) (f-rd 0) (f-shamt 0) FUNC10_YIELD) + (unimp yield) + ()) + +; Special instructions. + +(dni crc32 "CRC, 32 bit input" (MACH10 USES-RD USES-RS USES-RT) + "crc32 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_CRC32) + (unimp crc32) + ()) + +(dni crc32b "CRC, 8 bit input" (MACH10 USES-RD USES-RS USES-RT) + "crc32b $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_CRC32B) + (unimp crc32b) + ()) + +(dni cnt1s "Count ones" (MACH10 USES-RD USES-RS) + "cnt1s $rd,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC10_CNT1S) + (unimp crcp) + ()) + + +; Special Instructions + +(dni avail "Mark Header Buffer Available" (MACH10 USES-RD) + "avail $rd" + (+ OP_COP3 (f-rs 0) (f-rt 0) rd (f-shamt 0) FUNC10_AVAIL) + (unimp avail) + ()) + +(dni free "Mark Header Buffer Free" (MACH10 USES-RS USES-RD) + "free $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_FREE) + (unimp free) + ()) + +(dni tstod "Test Header Buffer Order Dependency" (MACH10 USES-RS USES-RD) + "tstod $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_TSTOD) + (unimp tstod) + ()) + +(dni cmphdr "Get a Complete Header" (MACH10 USES-RD) + "cmphdr $rd" + (+ OP_COP3 (f-rs 0) (f-rt 0) rd (f-shamt 0) FUNC10_CMPHDR) + (unimp cmphdr) + ()) + +(dni mcid "Allocate a Multicast ID" (MACH10 USES-RD USES-RT) + "mcid $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_MCID) + (unimp mcid) + ()) + +(dni dba "Allocate a Data Buffer Pointer" (MACH10 USES-RD) + "dba $rd" + (+ OP_COP3 (f-rs 0) (f-rt 0) rd (f-shamt 0) FUNC10_DBA) + (unimp dba) + ()) + +(dni dbd "Deallocate a Data Buffer Pointer" (MACH10 USES-RS USES-RT USES-RD) + "dbd $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_DBD) + (unimp dbd) + ()) + +(dni dpwt "DSTN_PORT Write" (MACH10 USES-RS USES-RD) + "dpwt $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_DPWT) + (unimp dpwt) + ()) + +; Architectural and coprocessor instructions. + +(dni chkhdrq10 "" (MACH10 USES-RS USES-RD) + "chkhdr $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_CHKHDR) + (unimp chkhdr) + ()) + +; Coprocessor DMA Instructions (IQ10) + +(dni rba "Read Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD) + "rba $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_RBA) + (unimp rba) + ()) + +(dni rbal "Read Bytes Absolute and Lock" (MACH10 USES-RS USES-RT USES-RD) + "rbal $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_RBAL) + (unimp rbal) + ()) + +(dni rbar "Read Bytes Absolute and Release" (MACH10 USES-RS USES-RT USES-RD) + "rbar $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_RBAR) + (unimp rbar) + ()) + +(dni wba "Write Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD) + "wba $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_WBA) + (unimp wba) + ()) + +(dni wbau "Write Bytes Absolute and Unlock" (MACH10 USES-RS USES-RT USES-RD) + "wbau $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_WBAU) + (unimp wbau) + ()) + +(dni wbac "Write Bytes Absolute Cacheable" (MACH10 USES-RS USES-RT USES-RD) + "wbac $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_WBAC) + (unimp wbac) + ()) + +(dni rbi "Read Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT) + "rbi $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_RBI bytecount) + (unimp rbi) + ()) + +(dni rbil "Read Bytes Immediate and Lock" (MACH10 USES-RD USES-RS USES-RT) + "rbil $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_RBIL bytecount) + (unimp rbil) + ()) + +(dni rbir "Read Bytes Immediate and Release" (MACH10 USES-RD USES-RS USES-RT) + "rbir $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_RBIR bytecount) + (unimp rbir) + ()) + +(dni wbi "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT) + "wbi $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_WBI bytecount) + (unimp wbi) + ()) + +(dni wbic "Write Bytes Immediate Cacheable" (MACH10 USES-RD USES-RS USES-RT) + "wbic $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_WBIC bytecount) + (unimp wbic) + ()) + +(dni wbiu "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT) + "wbiu $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_WBIU bytecount) + (unimp wbiu) + ()) + +(dni pkrli "Packet Release Immediate" (MACH10 USES-RD USES-RS USES-RT) + "pkrli $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLI bytecount) + (unimp pkrli) + ()) + +(dni pkrlih "Packet Release Immediate and Hold" (MACH10 USES-RD USES-RS USES-RT) + "pkrlih $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLIH bytecount) + (unimp pkrlih) + ()) + +(dni pkrliu "Packet Release Immediate Unconditional" (MACH10 USES-RD USES-RS USES-RT) + "pkrliu $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLIU bytecount) + (unimp pkrliu) + ()) + +(dni pkrlic "Packet Release Immediate Continue" (MACH10 USES-RD USES-RS USES-RT) + "pkrlic $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLIC bytecount) + (unimp pkrlic) + ()) + +(dni pkrla "Packet Release Absolute" (MACH10 USES-RS USES-RT USES-RD) + "pkrla $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLA) + (unimp pkrla) + ()) + +(dni pkrlau "Packet Release Absolute Unconditional" (MACH10 USES-RS USES-RT USES-RD) + "pkrlau $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLAU) + (unimp pkrlau) + ()) + +(dni pkrlah "Packet Release Absolute and Hold" (MACH10 USES-RS USES-RT USES-RD) + "pkrlah $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLAH) + (unimp pkrlah) + ()) + +(dni pkrlac "Packet Release Absolute Continue" (MACH10 USES-RS USES-RT USES-RD) + "pkrlac $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLAC) + (unimp pkrlac) + ()) + +; Main Memory Access Instructions + +(dni lock "lock memory" (MACH10 USES-RD USES-RT) + "lock $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_LOCK) + (unimp lock) + ()) + +(dni unlk "unlock memory" (MACH10 USES-RT USES-RD) + "unlk $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_UNLK) + (unimp unlk) + ()) + +(dni swrd "Single Word Read" (MACH10 USES-RT USES-RD) + "swrd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_SWRD) + (unimp swrd) + ()) + +(dni swrdl "Single Word Read and Lock" (MACH10 USES-RT USES-RD) + "swrdl $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_SWRDL) + (unimp swrdl) + ()) + +(dni swwr "Single Word Write" (MACH10 USES-RS USES-RT USES-RD) + "swwr $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_SWWR) + (unimp swwr) + ()) + +(dni swwru "Single Word Write and Unlock" (MACH10 USES-RS USES-RT USES-RD) + "swwru $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_SWWRU) + (unimp swwru) + ()) + +(dni dwrd "Double Word Read" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "dwrd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_DWRD) + (unimp dwrd) + ()) + +(dni dwrdl "Double Word Read and Lock" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "dwrdl $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_DWRDL) + (unimp dwrdl) + ()) + +; CAM access instructions (IQ10) + +(dni cam36 "CAM Access in 36-bit Mode" (MACH10 USES-RT USES-RD) + "cam36 $rd,$rt,${cam-z},${cam-y}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM36 cam-z cam-y) + (unimp cam36) + ()) + +(dni cam72 "CAM Access in 72-bit Mode" (MACH10 USES-RT USES-RD) + "cam72 $rd,$rt,${cam-y},${cam-z}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM72 cam-z cam-y) + (unimp cam72) + ()) + +(dni cam144 "CAM Access in 144-bit Mode" (MACH10 USES-RT USES-RD) + "cam144 $rd,$rt,${cam-y},${cam-z}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM144 cam-z cam-y) + (unimp cam144) + ()) + +(dni cam288 "CAM Access in 288-bit Mode" (MACH10 USES-RT USES-RD) + "cam288 $rd,$rt,${cam-y},${cam-z}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM288 cam-z cam-y) + (unimp cam288) + ()) + +; Counter manager instructions (IQ10) + +(dni cm32and "Counter Manager And" (MACH10 USES-RS USES-RT USES-RD) + "cm32and $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32AND) + (unimp cm32and) + ()) + +(dni cm32andn "Counter Manager And With Inverse" (MACH10 USES-RS USES-RT USES-RD) + "cm32andn $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32ANDN) + (unimp cm32andn) + ()) + +(dni cm32or "Counter Manager Or" (MACH10 USES-RS USES-RT USES-RD) + "cm32or $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32OR) + (unimp cm32or) + ()) + +(dni cm32ra "Counter Manager 32-bit Rolling Add" (MACH10 USES-RS USES-RT USES-RD) + "cm32ra $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 2) FUNC10_CM32RA) + (unimp cm32ra) + ()) + +(dni cm32rd "Counter Manager 32-bit Rolling Decrement" (MACH10 USES-RT USES-RD) + "cm32rd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32RD) + (unimp cm32rd) + ()) + +(dni cm32ri "Counter Manager 32-bit Rolling Increment" (MACH10 USES-RT USES-RD) + "cm32ri $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32RI) + (unimp cm32ri) + ()) + +(dni cm32rs "Counter Manager 32-bit Rolling Subtract" (MACH10 USES-RS USES-RT USES-RD) + "cm32rs $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 2) FUNC10_CM32RS) + (unimp cm32rs) + ()) + +(dni cm32sa "Counter Manager 32-bit Saturating Add" (MACH10 USES-RS USES-RT USES-RD) + "cm32sa $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SA) + (unimp cm32sa) + ()) + +(dni cm32sd "Counter Manager 32-bit Saturating Decrement" (MACH10 USES-RT USES-RD) + "cm32sd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SD) + (unimp cm32sd) + ()) + +(dni cm32si "Counter Manager 32-bit Saturating Increment" (MACH10 USES-RT USES-RD) + "cm32si $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SI) + (unimp cm32si) + ()) + +(dni cm32ss "Counter Manager 32-bit Saturating Subtract" (MACH10 USES-RS USES-RT USES-RD) + "cm32ss $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SS) + (unimp cm32ss) + ()) + +(dni cm32xor "Counter Manager Xor" (MACH10 USES-RS USES-RT USES-RD) + "cm32xor $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32XOR) + (unimp cm32xor) + ()) + +(dni cm64clr "Counter Manager Clear" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64clr $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64CLR) + (unimp cm64clr) + ()) + +(dni cm64ra "Counter Manager 64-bit Rolling Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64ra $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RA) + (unimp cm64ra) + ()) + +(dni cm64rd "Counter Manager 64-bit Rolling Decrement" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64rd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RD) + (unimp cm64rd) + ()) + +(dni cm64ri "Counter Manager 32-bit Rolling Increment" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64ri $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RI) + (unimp cm64ri) + ()) + +(dni cm64ria2 "Counter Manager 32/32 Rolling Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64ria2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RIA2) + (unimp cm64ria2) + ()) + +(dni cm64rs "Counter Manager 64-bit Rolling Subtract" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64rs $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RS) + (unimp cm64rs) + ()) + +(dni cm64sa "Counter Manager 64-bit Saturating Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64sa $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SA) + (unimp cm64sa) + ()) + +(dni cm64sd "Counter Manager 64-bit Saturating Decrement" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64sd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SD) + (unimp cm64sd) + ()) + +(dni cm64si "Counter Manager 64-bit Saturating Increment" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64si $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SI) + (unimp cm64si) + ()) + +(dni cm64sia2 "Counter Manager 32/32 Saturating Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64sia2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SIA2) + (unimp cm64sia2) + ()) + +(dni cm64ss "Counter Manager 64-bit Saturating Subtract" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64ss $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SS) + (unimp cm64ss) + ()) + +(dni cm128ria2 "Counter Manager 128-bit 64/64 Rolling Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128ria2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128RIA2) + (unimp cm128ria2) + ()) + +(dni cm128ria3 "Counter Manager 128-bit 32/32/64 Rolling Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128ria3 $rd,$rs,$rt,${cm-3z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128RIA3 cm-3z) + (unimp cm128ria3) + ()) + +(dni cm128ria4 "Counter Manager 128-bit 32/32/32/32 Rolling Inc/Add" (MACH10 USES-RS USES-RT USES-RD) + "cm128ria4 $rd,$rs,$rt,${cm-4z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128RIA4 cm-4z) + (unimp cm128ria4) + ()) + +(dni cm128sia2 "Counter Manager 128-bit 64/64 Saturating Inc/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128sia2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128SIA2) + (unimp cm128sia2) + ()) + +(dni cm128sia3 "Counter Manager 128-bit 32/32/64 Saturating Inc/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128sia3 $rd,$rs,$rt,${cm-3z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128SIA3 cm-3z) + (unimp cm128sia3) + ()) + +(dni cm128sia4 "Counter Manager 128-bit 32/32/32/32 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD) + "cm128sia4 $rd,$rs,$rt,${cm-4z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128SIA4 cm-4z) + (unimp cm128sia4) + ()) + +(dni cm128vsa "Counter Manager Continuous State Dual Leaky Token Bucket Policing" (MACH10 USES-RS USES-RT USES-RD) + "cm128vsa $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128VSA) + (unimp cm128vsa) + ()) + +; Coprocessor Data Movement Instructions + +; Note that we don't set the USES-RD or USES-RT attributes for many of the following +; instructions, as it's the COP register that's being specified. + +; ??? Is YIELD-INSN the right attribute for IQ10? The IQ2000 used the attribute to warn about +; yielding instructions in a delay slot, but that's not relevant in IQ10. What *is* relevant +; (and unique to IQ10) is instructions that yield if the destination register is accessed +; before the value is there, causing a yield. + +(dni cfc "copy from coprocessor control register" (MACH10 LOAD-DELAY USES-RD YIELD-INSN) + "cfc $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_CFC) + (unimp cfc) + ()) + +(dni ctc "copy to coprocessor control register" (MACH10 USES-RS) + "ctc $rs,$rt" + (+ OP_COP3 rs rt (f-rd 0) (f-shamt 0) FUNC10_CTC) + (unimp ctc) + ()) + +; Macros + +(dnmi m-avail "Mark Header Buffer Available" (MACH10 NO-DIS) + "avail" + (emit avail (f-rd 0)) +) + +(dnmi m-cam36 "CAM Access in 36-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam36 $rd,$rt,${cam-z}" + (emit cam36 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cam72 "CAM Access in 72-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam72 $rd,$rt,${cam-z}" + (emit cam72 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cam144 "CAM Access in 144-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam144 $rd,$rt,${cam-z}" + (emit cam144 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cam288 "CAM Access in 288-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam288 $rd,$rt,${cam-z}" + (emit cam288 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cm32read "Counter Manager 32-bit Rolling Add R0" (MACH10 USES-RT USES-RD NO-DIS) + "cm32read $rd,$rt" + (emit cm32ra rd (f-rs 0) rt) +) + +(dnmi m-cm64read "Counter Manager 64-bit Rolling Add R0" (MACH10 USES-RT USES-RD NO-DIS) + "cm64read $rd,$rt" + (emit cm64ra rd (f-rs 0) rt) +) + +(dnmi m-cm32mlog "Counter Manager 32-bit or R0" (MACH10 USES-RS USES-RT NO-DIS) + "cm32mlog $rs,$rt" + (emit cm32or (f-rd 0) rs rt) +) + +(dnmi m-cm32and "Counter Manager And" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32and $rs,$rt" + (emit cm32and (f-rd 0) rs rt) +) + +(dnmi m-cm32andn "Counter Manager And With Inverse" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32andn $rs,$rt" + (emit cm32andn (f-rd 0) rs rt) +) + +(dnmi m-cm32or "Counter Manager Or" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32or $rs,$rt" + (emit cm32or (f-rd 0) rs rt) +) + +(dnmi m-cm32ra "Counter Manager 32-bit Rolling Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32ra $rs,$rt" + (emit cm32ra (f-rd 0) rs rt) +) + +(dnmi m-cm32rd "Counter Manager 32-bit Rolling Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm32rd $rt" + (emit cm32rd (f-rd 0) rt) +) + +(dnmi m-cm32ri "Counter Manager 32-bit Rolling Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm32ri $rt" + (emit cm32ri (f-rd 0) rt) +) + +(dnmi m-cm32rs "Counter Manager 32-bit Rolling Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32rs $rs,$rt" + (emit cm32rs (f-rd 0) rs rt) +) + +(dnmi m-cm32sa "Counter Manager 32-bit Saturating Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32sa $rs,$rt" + (emit cm32sa (f-rd 0) rs rt) +) + +(dnmi m-cm32sd "Counter Manager 32-bit Saturating Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm32sd $rt" + (emit cm32sd (f-rd 0) rt) +) + +(dnmi m-cm32si "Counter Manager 32-bit Saturating Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm32si $rt" + (emit cm32si (f-rd 0) rt) +) + +(dnmi m-cm32ss "Counter Manager 32-bit Saturating Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32ss $rs,$rt" + (emit cm32ss (f-rd 0) rs rt) +) + +(dnmi m-cm32xor "Counter Manager Xor" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32xor $rs,$rt" + (emit cm32xor (f-rd 0) rs rt) +) + +(dnmi m-cm64clr "Counter Manager Clear" (MACH10 USES-RT USES-RD NO-DIS) + "cm64clr $rt" + (emit cm64clr (f-rd 0) rt) +) + +(dnmi m-cm64ra "Counter Manager 64-bit Rolling Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64ra $rs,$rt" + (emit cm64ra (f-rd 0) rs rt) +) + +(dnmi m-cm64rd "Counter Manager 64-bit Rolling Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm64rd $rt" + (emit cm64rd (f-rd 0) rt) +) + +(dnmi m-cm64ri "Counter Manager 32-bit Rolling Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm64ri $rt" + (emit cm64ri (f-rd 0) rt) +) + +(dnmi m-cm64ria2 "Counter Manager 32/32 Rolling Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64ria2 $rs,$rt" + (emit cm64ria2 (f-rd 0) rs rt) +) + +(dnmi m-cm64rs "Counter Manager 64-bit Rolling Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64rs $rs,$rt" + (emit cm64rs (f-rd 0) rs rt) +) + +(dnmi m-cm64sa "Counter Manager 64-bit Saturating Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64sa $rs,$rt" + (emit cm64sa (f-rd 0) rs rt) +) + +(dnmi m-cm64sd "Counter Manager 64-bit Saturating Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm64sd $rt" + (emit cm64sd (f-rd 0) rt) +) + +(dnmi m-cm64si "Counter Manager 64-bit Saturating Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm64si $rt" + (emit cm64si (f-rd 0) rt) +) + +(dnmi m-cm64sia2 "Counter Manager 32/32 Saturating Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64sia2 $rs,$rt" + (emit cm64sia2 (f-rd 0) rs rt) +) + +(dnmi m-cm64ss "Counter Manager 64-bit Saturating Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64ss $rs,$rt" + (emit cm64ss (f-rd 0) rs rt) +) + +(dnmi m-cm128ria2 "Counter Manager 128-bit 64/64 Rolling Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128ria2 $rs,$rt" + (emit cm128ria2 (f-rd 0) rs rt) +) + +(dnmi m-cm128ria3 "Counter Manager 128-bit 32/32/64 Rolling Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128ria3 $rs,$rt,${cm-3z}" + (emit cm128ria3 (f-rd 0) rs rt cm-3z) +) + +(dnmi m-cm128ria4 "Counter Manager 128-bit 32/32/32/32 Rolling Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128ria4 $rs,$rt,${cm-4z}" + (emit cm128ria4 (f-rd 0) rs rt cm-4z) +) + +(dnmi m-cm128sia2 "Counter Manager 128-bit 64/64 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128sia2 $rs,$rt" + (emit cm128sia2 (f-rd 0) rs rt) +) + +(dnmi m-cm128sia3 "Counter Manager 128-bit 32/32/64 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128sia3 $rs,$rt,${cm-3z}" + (emit cm128sia3 (f-rd 0) rs rt cm-3z) +) + +(dnmi m-cm128sia4 "Counter Manager 128-bit 32/32/32/32 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128sia4 $rs,$rt,${cm-4z}" + (emit cm128sia4 (f-rd 0) rs rt cm-4z) +) + +(dnmi m-cmphdr "Get a Complete Header" (MACH10 NO-DIS) + "cmphdr" + (emit cmphdr (f-rd 0)) +) + +(dnmi m-dbd "Deallocate a Data Buffer Pointer" (MACH10 USES-RD USES-RT NO-DIS) + "dbd $rd,$rt" + (emit dbd rd (f-rs 0) rt) +) + +(dnmi m2-dbd "Deallocate a Data Buffer Pointer" (MACH10 USES-RT NO-DIS) + "dbd $rt" + (emit dbd (f-rd 0) (f-rs 0) rt) +) + +(dnmi m-dpwt "DSTN_PORT Write" (MACH10 USES-RS NO-DIS) + "dpwt $rs" + (emit dpwt (f-rd 0) rs) +) + +(dnmi m-free "" (MACH10 USES-RS USES-RD NO-DIS) + "free $rs" + (emit free (f-rd 0) rs) +) + +;(dnmi m-jal "jump and link, implied r31" (MACH10 USES-RT NO-DIS) +; "jal $jmptarg" +; (emit jal (f-rt 31) jmptarg) +;) + +(dnmi m-lock "lock memory" (MACH10 USES-RT NO-DIS) + "lock $rt" + (emit lock (f-rd 0) rt) +) + +(dnmi m-pkrla "Packet Release Absolute" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrla $rs,$rt" + (emit pkrla (f-rd 0) rs rt) +) + +(dnmi m-pkrlac "Packet Release Absolute Continue" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrlac $rs,$rt" + (emit pkrlac (f-rd 0) rs rt) +) + +(dnmi m-pkrlah "Packet Release Absolute and Hold" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrlah $rs,$rt" + (emit pkrlah (f-rd 0) rs rt) +) + +(dnmi m-pkrlau "Packet Release Absolute Unconditional" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrlau $rs,$rt" + (emit pkrlau (f-rd 0) rs rt) +) + +(dnmi m-pkrli "Packet Release Immediate" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "pkrli $rs,$rt,$bytecount" + (emit pkrli (f-rd 0) rs rt bytecount) +) + +(dnmi m-pkrlic "Packet Release Immediate Continue" (MACH10 USES-RS USES-RT NO-DIS) + "pkrlic $rs,$rt,$bytecount" + (emit pkrlic (f-rd 0) rs rt bytecount) +) + +(dnmi m-pkrlih "Packet Release Immediate and Hold" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "pkrlih $rs,$rt,$bytecount" + (emit pkrlih (f-rd 0) rs rt bytecount) +) + +(dnmi m-pkrliu "Packet Release Immediate Unconditional" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "pkrliu $rs,$rt,$bytecount" + (emit pkrliu (f-rd 0) rs rt bytecount) +) + +(dnmi m-rba "Read Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "rba $rs,$rt" + (emit rba (f-rd 0) rs rt) +) + +(dnmi m-rbal "Read Bytes Absolute and Lock" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "rbal $rs,$rt" + (emit rbal (f-rd 0) rs rt) +) + +(dnmi m-rbar "Read Bytes Absolute and Release" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "rbar $rs,$rt" + (emit rbar (f-rd 0) rs rt) +) + +(dnmi m-rbi "Read Bytes Immediate" (MACH10 USES-RS USES-RT NO-DIS) + "rbi $rs,$rt,$bytecount" + (emit rbi (f-rd 0) rs rt bytecount) +) + +(dnmi m-rbil "Read Bytes Immediate and Lock" (MACH10 USES-RS USES-RT NO-DIS) + "rbil $rs,$rt,$bytecount" + (emit rbil (f-rd 0) rs rt bytecount) +) + +(dnmi m-rbir "Read Bytes Immediate and Release" (MACH10 USES-RS USES-RT NO-DIS) + "rbir $rs,$rt,$bytecount" + (emit rbir (f-rd 0) rs rt bytecount) +) + +(dnmi m-swwr "Single Word Write" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "swwr $rs,$rt" + (emit swwr (f-rd 0) rs rt) +) + +(dnmi m-swwru "Single Word Write and Unlock" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "swwru $rs,$rt" + (emit swwru (f-rd 0) rs rt) +) + +(dnmi m-tstod "Test Header Buffer Order Dependency" (MACH10 USES-RS USES-RD NO-DIS) + "tstod $rs" + (emit tstod (f-rd 0) rs) +) + +(dnmi m-unlk "" (MACH10 USES-RT USES-RD NO-DIS) + "unlk $rt" + (emit unlk (f-rd 0) rt) +) + +(dnmi m-wba "Write Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "wba $rs,$rt" + (emit wba (f-rd 0) rs rt) +) + +(dnmi m-wbac "Write Bytes Absolute Cacheable" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "wbac $rs,$rt" + (emit wbac (f-rd 0) rs rt) +) + +(dnmi m-wbau "Write Bytes Absolute and Unlock" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "wbau $rs,$rt" + (emit wbau (f-rd 0) rs rt) +) + +(dnmi m-wbi "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "wbi $rs,$rt,$bytecount" + (emit wbi (f-rd 0) rs rt bytecount) +) + +(dnmi m-wbic "Write Bytes Immediate Cacheable" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "wbic $rs,$rt,$bytecount" + (emit wbic (f-rd 0) rs rt bytecount) +) + +(dnmi m-wbiu "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "wbiu $rs,$rt,$bytecount" + (emit wbiu (f-rd 0) rs rt bytecount) +) + diff --git a/cpu/iq2000.cpu b/cpu/iq2000.cpu new file mode 100644 index 0000000..2a34859 --- /dev/null +++ b/cpu/iq2000.cpu @@ -0,0 +1,1199 @@ +; IQ2000/IQ10 Common CPU description. -*- Scheme -*- +; +; Copyright 2000, 2001, 2002 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Vitesse. +; +; This file is part of the GNU Binutils. +; +; This program is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +(include "simplify.inc") + +(define-arch + (name iq2000) + (comment "IQ2000 architecture") + (insn-lsb0? #t) + (machs iq2000 iq10) + (isas iq2000) +) + +(define-isa + (name iq2000) + (comment "Basic IQ2000 instruction set") + (default-insn-word-bitsize 32) + (default-insn-bitsize 32) + (base-insn-bitsize 32) + (decode-assist (31 30 29 28 27 26)) +) + +(define-cpu + (name iq2000bf) + (comment "IQ2000 family") + (endian big) + (word-bitsize 32) + (file-transform "") +) + +(define-cpu + (name iq10bf) + (comment "IQ10 coprocessor family") + (endian big) + (word-bitsize 32) + (file-transform "") + +) + +(define-mach + (name iq2000) + (comment "IQ2000 packet processing engine") + (cpu iq2000bf) + (isas iq2000) +) + +(define-mach + (name iq10) + (comment "IQ10 coprocessor") + (cpu iq10bf) + (isas iq2000) +) + +(define-model + (name iq2000) + (comment "IQ2000 microprocessor") + (mach iq2000) + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () () () ()) +) + +(define-model + (name iq10) + (comment "IQ10 coprocessor") + (mach iq10) + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () () () ()) +) + +; Macros to simplify MACH attribute specification. + +(define-pmacro MACH2000 (MACH iq2000)) +(define-pmacro MACH10 (MACH iq10)) + + +; Hardware elements. + +(define-hardware + (name h-pc) + (comment "program counter") + (attrs PC PROFILE (ISA iq2000)) + (type pc) + (get () (c-call USI "get_h_pc")) + (set (newval) (c-call VOID "set_h_pc" newval)) +) +; FIXME: it would be nice if the hardwired zero in R0 could be +; specified as a virtual hardware element, with one less register in +; the register file proper. + +(define-keyword + (name gr-names) + (print-name h-gr) + (values (r0 0) (%0 0) (r1 1) (%1 1) (r2 2) (%2 2) (r3 3) (%3 3) + (r4 4) (%4 4) (r5 5) (%5 5) (r6 6) (%6 6) (r7 7) (%7 7) + (r8 8) (%8 8) (r9 9) (%9 9) (r10 10) (%10 10) (r11 11) (%11 11) + (r12 12) (%12 12) (r13 13) (%13 13) (r14 14) (%14 14) (r15 15) (%15 15) + (r16 16) (%16 16) (r17 17) (%17 17) (r18 18) (%18 18) (r19 19) (%19 19) + (r20 20) (%20 20) (r21 21) (%21 21) (r22 22) (%22 22) (r23 23) (%23 23) + (r24 24) (%24 24) (r25 25) (%25 25) (r26 26) (%26 26) (r27 27) (%27 27) + (r28 28) (%28 28) (r29 29) (%29 29) (r30 30) (%30 30) (r31 31) (%31 31)) +) + +(define-hardware + (name h-gr) + (comment "General purpose registers") +; (attrs (ISA iq2000) CACHE-ADDR) + (type register SI (32)) + (indices extern-keyword gr-names) + (get (idx) + (cond SI + ((eq idx 0) (const 0)) + (else (raw-reg h-gr idx)))) + (set (idx newval) + (cond VOID + ((eq idx 0) (nop)) + (else (set (raw-reg h-gr idx) newval)))) +) + + +; Instruction fields. + +(dnf f-opcode "opcode field" () 31 6) +(dnf f-rs "register field Rs" () 25 5) +(dnf f-rt "register field Rt" () 20 5) +(dnf f-rd "register field Rd" () 15 5) +(dnf f-shamt "shift amount field" () 10 5) +(dnf f-cp-op "coprocessor op field" () 10 3) +(dnf f-cp-op-10 "coprocessor op field for CAM" () 10 5) +(dnf f-cp-grp "coprocessor group field" () 7 2) +(dnf f-func "function field" () 5 6) +(dnf f-imm "immediate field" () 15 16) + +(define-multi-ifield + (name f-rd-rs) + (comment "register Rd implied from Rs") + (attrs) + (mode UINT) + (subfields f-rd f-rs) + (insert (sequence () + (set (ifield f-rd) (ifield f-rd-rs)) + (set (ifield f-rs) (ifield f-rd-rs)) + )) + (extract (sequence () + (set (ifield f-rd-rs) (ifield f-rs)) + )) +) + +(define-multi-ifield + (name f-rd-rt) + (comment "register Rd implied from Rt") + (attrs) + (mode UINT) + (subfields f-rd f-rt) + (insert (sequence () + (set (ifield f-rd) (ifield f-rd-rt)) + (set (ifield f-rt) (ifield f-rd-rt)) + )) + (extract (sequence () + (set (ifield f-rd-rt) (ifield f-rt)) + )) +) + +(define-multi-ifield + (name f-rt-rs) + (comment "register Rt implied from Rs") + (attrs) + (mode UINT) + (subfields f-rt f-rs) + (insert (sequence () + (set (ifield f-rt) (ifield f-rt-rs)) + (set (ifield f-rs) (ifield f-rt-rs)) + )) + (extract (sequence () + (set (ifield f-rd-rs) (ifield f-rs)) + )) +) + +(df f-jtarg "jump target field" (ABS-ADDR) 15 16 UINT + ((value pc) (srl USI (and USI value #x03FFFF) 2)) + ((value pc) (or USI (and USI pc #xF0000000) (sll USI value 2)))) + +(df f-jtargq10 "iq10 jump target field" (ABS-ADDR) 20 21 UINT + ((value pc) (srl SI (and SI value #x7FFFFF) 2)) + ((value pc) (or SI (and SI pc #xF0000000) (sll SI value 2)))) + +(df f-offset "pc offset field" (PCREL-ADDR) 15 16 INT + ; Actually, this is relative to the address of the delay slot. + ((value pc) (sra SI (sub SI value pc) 2)) + ((value pc) (add SI (sll SI value 2) (add pc 4)))) + +; Instruction fields that scarcely appear in instructions. + +(dnf f-count "count field" () 15 7) +(dnf f-bytecount "byte count field" () 7 8) +(dnf f-index "index field" () 8 9) +(dnf f-mask "mask field" () 9 4) +(dnf f-maskq10 "iq10 mask field" () 10 5) +(dnf f-maskl "mask left field" () 4 5) +(dnf f-excode "execcode field" () 25 20) +(dnf f-rsrvd "reserved field" () 25 10) +(dnf f-10-11 "bits 10:0" () 10 11) +(dnf f-24-19 "bits 24:6" () 24 19) +(dnf f-5 "bit 5" () 5 1) +(dnf f-10 "bit 10" () 10 1) +(dnf f-25 "bit 25" () 25 1) +(dnf f-cam-z "cam global mask z" () 5 3) +(dnf f-cam-y "cam operation y" () 2 3) +(dnf f-cm-3func "CM 3 bit fn field" () 5 3) +(dnf f-cm-4func "CM 4 bit fn field" () 5 4) +(dnf f-cm-3z "CM 3Z field" () 1 2) +(dnf f-cm-4z "CM 4Z field" () 2 3) + + +; Enumerations. + +(define-normal-insn-enum + opcodes "primary opcodes" () OP_ f-opcode + (("SPECIAL" 0) ("REGIMM" 1) ("J" 2) ("JAL" 3) ("BEQ" 4) ("BNE" 5) ("BLEZ" 6) ("BGTZ" 7) + ("ADDI" 8) ("ADDIU" 9) ("SLTI" 10) ("SLTIU" 11) ("ANDI" 12) ("ORI" 13) ("XORI" 14) ("LUI" 15) + ("COP0" 16) ("COP1" 17) ("COP2" 18) ("COP3" 19) ("BEQL" 20) ("BNEL" 21) ("BLEZL" 22) ("BGTZL" 23) + ("BMB0" 24) ("BMB1" 25) ("BMB2" 26) ("BMB3" 27) ("BBI" 28) ("BBV" 29) ("BBIN" 30) ("BBVN" 31) + ("LB" 32) ("LH" 33) ("LW" 35) ("LBU" 36) ("LHU" 37) ("RAM" 39) + ("SB" 40) ("SH" 41) ("SW" 43) ("ANDOI" 44) ("BMB" 45) ("ORUI" 47) + ("LDW" 48) + ("SDW" 56) ("ANDOUI" 63)) +) + +(define-normal-insn-enum + q10_opcodes "iq10-only primary opcodes" () OP10_ f-opcode + (("BMB" 6) ("ORUI" 15) ("BMBL" 22) ("ANDOUI" 47) ("BBIL" 60) ("BBVL" 61) ("BBINL" 62) ("BBVNL" 63)) +) + +(define-normal-insn-enum + regimm-functions "branch sub-opcodes" () FUNC_ f-rt + (("BLTZ" 0) ("BGEZ" 1) ("BLTZL" 2) ("BGEZL" 3) ("BLEZ" 4) ("BGTZ" 5) ("BLEZL" 6) ("BGTZL" 7) + ("BRI" 8) ("BRV" 9) ("BCTX" 12) + ("BLTZAL" 16) ("BGEZAL" 17) ("BLTZALL" 18) ("BGEZALL" 19) ("BLEZAL" 20) ("BGTZAL" 21) ("BLEZALL" 22) ("BGTZALL" 23)) +) + +(define-normal-insn-enum + functions "function sub-opcodes" () FUNC_ f-func + (("SLL" 0) ("SLMV" 1) ("SRL" 2) ("SRA" 3) ("SLLV" 4) ("SRMV" 5) ("SRLV" 6) ("SRAV" 7) + ("JR" 8) ("JALR" 9) ("JCR" 10) ("SYSCALL" 12) ("BREAK" 13) ("SLEEP" 14) + ("ADD" 32) ("ADDU" 33) ("SUB" 34) ("SUBU" 35) ("AND" 36) ("OR" 37) ("XOR" 38) ("NOR" 39) + ("ADO16" 41) ("SLT" 42) ("SLTU" 43) ("MRGB" 45)) +) + +; iq10 special function sub-opcodes +(define-normal-insn-enum + q10s_functions "iq10-only special function sub-opcodes" () FUNC10_ f-func + (("YIELD" 14) ("CNT1S" 46)) +) + +; coprocessor opcodes in concert with f-cp-grp +(define-normal-insn-enum + cop_functions "iq10 function sub-opcodes" () FUNC10_ f-func + (("CFC" 0) ("LOCK" 1) ("CTC" 2) ("UNLK" 3) ("SWRD" 4) ("SWRDL" 5) ("SWWR" 6) ("SWWRU" 7) + ("RBA" 8) ("RBAL" 9) ("RBAR" 10) ("DWRD" 12) ("DWRDL" 13) + ("WBA" 16) ("WBAU" 17) ("WBAC" 18) ("CRC32" 20) ("CRC32B" 21) + ("MCID" 32) ("DBD" 33) ("DBA" 34) ("DPWT" 35) ("AVAIL" 36) ("FREE" 37) ("CHKHDR" 38) ("TSTOD" 39) + ("PKRLA" 40) ("PKRLAU" 41) ("PKRLAH" 42) ("PKRLAC" 43) ("CMPHDR" 44) + + ("CM64RS" 0) ("CM64RD" 1) ("CM64RI" 4) ("CM64CLR" 5) + ("CM64SS" 8) ("CM64SD" 9) ("CM64SI" 12) + ("CM64RA" 16) ("CM64RIA2" 20) ("CM128RIA2" 21) + ("CM64SA" 24) ("CM64SIA2" 28) ("CM128SIA2" 29) + ("CM32RS" 32) ("CM32RD" 33) ("CM32XOR" 34) ("CM32ANDN" 35) ("CM32RI" 36) ("CM128VSA" 38) + ("CM32SS" 40) ("CM32SD" 41) ("CM32OR" 42) ("CM32AND" 43) ("CM32SI" 44) + ("CM32RA" 48) + ("CM32SA" 56) ) +) + +; coprocessor opcodes in concert with f-cp-grp +(define-normal-insn-enum + cop_cm128_4functions "iq10 function sub-opcodes" () FUNC10_ f-cm-4func + (("CM128RIA3" 4) ("CM128SIA3" 6)) +) + +(define-normal-insn-enum + cop_cm128_3functions "iq10 function sub-opcodes" () FUNC10_ f-cm-3func + (("CM128RIA4" 6) ("CM128SIA4" 7)) +) + +(define-normal-insn-enum + cop2_functions "iq10 coprocessor sub-opcodes" () FUNC10_ f-cp-op + (("PKRLI" 0) ("PKRLIU" 1) ("PKRLIH" 2) ("PKRLIC" 3) ("RBIR" 1) ("RBI" 2) ("RBIL" 3) ("WBIC" 5) ("WBI" 6) ("WBIU" 7)) +) + +(define-normal-insn-enum + cop3_cam_functions "iq10 coprocessor cam sub-opcodes" () FUNC10_ f-cp-op-10 + (("CAM36" 16) ("CAM72" 17) ("CAM144" 18) ("CAM288" 19)) +) + + +; Attributes. + +(define-attr + (for insn) + (type boolean) + (name YIELD-INSN) + (comment "insn generates a context yield") +) + +(define-attr + (for insn) + (type boolean) + (name LOAD-DELAY) + (comment "insn has a load delay") +) + +(define-attr + (for insn) + (type boolean) + (name EVEN-REG-NUM) + (comment "insn requires an even numbered register in rt(2000) or rd(10)") +) + +(define-attr + (for insn) + (type boolean) + (name UNSUPPORTED) + (comment "insn is unsupported") +) + +(define-pmacro (define-reg-use-attr regfield) + (define-attr + (for insn) + (type boolean) + (name (.sym USES- (.upcase regfield))) + (comment ("insn accesses register operand " regfield)))) + +(define-reg-use-attr rd) +(define-reg-use-attr rs) +(define-reg-use-attr rt) +(define-reg-use-attr r31) + + +; Operands. + +(dnop rs "register Rs" () h-gr f-rs) +(dnop rt "register Rt" () h-gr f-rt) +(dnop rd "register Rd" () h-gr f-rd) +(dnop rd-rs "register Rd from Rs" () h-gr f-rd-rs) +(dnop rd-rt "register Rd from Rt" () h-gr f-rd-rt) +(dnop rt-rs "register Rt from Rs" () h-gr f-rt-rs) +(dnop shamt "shift amount" () h-uint f-shamt) +(define-operand (name imm) (comment "immediate") (attrs) + (type h-uint) (index f-imm) (handlers (parse "imm"))) +(dnop offset "pc-relative offset" () h-iaddr f-offset) +(dnop baseoff "base register offset" () h-iaddr f-imm) +(dnop jmptarg "jump target" () h-iaddr f-jtarg) +(dnop mask "mask" () h-uint f-mask) +(dnop maskq10 "iq10 mask" () h-uint f-maskq10) +(dnop maskl "mask left" () h-uint f-maskl) +(dnop count "count" () h-uint f-count) +(dnop index "index" () h-uint f-index) +(dnop execode "execcode" () h-uint f-excode) +(dnop bytecount "byte count" () h-uint f-bytecount) +(dnop cam-y "cam global opn y" () h-uint f-cam-y) +(dnop cam-z "cam global mask z" () h-uint f-cam-z) +(dnop cm-3func "CM 3 bit fn field" () h-uint f-cm-3func) +(dnop cm-4func "CM 4 bit fn field" () h-uint f-cm-4func) +(dnop cm-3z "CM 3 bit Z field" () h-uint f-cm-3z) +(dnop cm-4z "CM 4 bit Z field" () h-uint f-cm-4z) + +; Aliases for the rs and rt operands. This just makes the load/store +; insns easier to compare with the instruction set documentation. + +(dnop base "base register" () h-gr f-rs) +(dnop maskr "mask right" () h-uint f-rs) +(dnop bitnum "bit number" () h-uint f-rt) + +; For high(foo). +(define-operand + (name hi16) + (comment "high 16 bit immediate") + (attrs) + (type h-uint) + (index f-imm) + (handlers (parse "hi16")) +) + +; For low(foo). +(define-operand + (name lo16) + (comment "16 bit signed immediate, for low") + (attrs) + (type h-uint) + (index f-imm) + (handlers (parse "lo16")) +) + +; For negated imm. +(define-operand + (name mlo16) + (comment "negated 16 bit signed immediate") + (attrs) + (type h-uint) + (index f-imm) + (handlers (parse "mlo16")) +) + +; For iq10 jmps +; In the future, we'll want the j & jal to use the 21 bit target, with +; the upper five bits shifted up. For now, don't use this. +(define-operand + (name jmptargq10) + (comment "iq10 21-bit jump offset") + (attrs) + (type h-iaddr) + (index f-jtargq10) + (handlers (parse "jtargq10")) +) + + +; Instructions. + +; A pmacro for use in semantic bodies of unimplemented insns. +(define-pmacro (unimp mnemonic) (nop)) + +(define-pmacro (bitset? value bit-num) + (and value (sll 1 bit-num))) + +(define-pmacro (bitclear? value bit-num) + (not (bitset? value bit-num))) + +; Arithmetic/logic instructions. + +(dni add2 "add registers" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "add ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_ADD) + (set rd-rs (add rt rd-rs)) + ()) + +(dni add "add registers" (USES-RD USES-RS USES-RT) + "add $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADD) + (set rd (add rs rt)) + ()) + + +(dni addi2 "add immediate" (ALIAS NO-DIS USES-RS USES-RT) + "addi ${rt-rs},$lo16" + (+ OP_ADDI rt-rs lo16) + (set rt-rs (add rt-rs (ext SI (trunc HI lo16)))) + ()) + +(dni addi "add immediate" (USES-RS USES-RT) + "addi $rt,$rs,$lo16" + (+ OP_ADDI rs rt lo16) + (set rt (add rs (ext SI (trunc HI lo16)))) + ()) + +(dni addiu2 "add immediate unsigned" (ALIAS NO-DIS USES-RS USES-RT) + "addiu ${rt-rs},$lo16" + (+ OP_ADDIU rt-rs lo16) + (set rt-rs (add rt-rs (ext SI (trunc HI lo16)))) + ()) + +(dni addiu "add immediate unsigned" (USES-RS USES-RT) + "addiu $rt,$rs,$lo16" + (+ OP_ADDIU rs rt lo16) + (set rt (add rs (ext SI (trunc HI lo16)))) + ()) + +(dni addu2 "add unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "addu ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_ADDU) + (set rd-rs (add rd-rs rt)) + ()) + +(dni addu "add unsigned" (USES-RD USES-RS USES-RT) + "addu $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADDU) + (set rd (add rs rt)) + ()) + +(dni ado162 "add 16, ones complement" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "ado16 ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_ADO16) + (sequence ((HI high) (HI low)) + (set low (add HI (and HI rd-rs #xFFFF) (and HI rt #xFFFF))) + (set high (add HI (srl rd-rs 16) (srl rt 16))) + (set rd-rs (or SI (sll SI high 16) low))) + ()) + +(dni ado16 "add 16, ones complement" (USES-RD USES-RS USES-RT) + "ado16 $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADO16) + (sequence ((HI high) (HI low)) + (set low (add HI (and HI rs #xFFFF) (and HI rt #xFFFF))) + (set high (add HI (srl rs 16) (srl rt 16))) + (set rd (or SI (sll SI high 16) low))) + ()) + +(dni and2 "and register" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "and ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_AND) + (set rd-rs (and rd-rs rt)) + ()) + +(dni and "and register" (USES-RD USES-RS USES-RT) + "and $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_AND) + (set rd (and rs rt)) + ()) + +(dni andi2 "and immediate" (ALIAS NO-DIS USES-RS USES-RT) + "andi ${rt-rs},$lo16" + (+ OP_ANDI rt-rs lo16) + (set rt-rs (and rt-rs (zext SI lo16))) + ()) + +(dni andi "and immediate" (USES-RS USES-RT) + "andi $rt,$rs,$lo16" + (+ OP_ANDI rs rt lo16) + (set rt (and rs (zext SI lo16))) + ()) + +(dni andoi2 "and ones immediate" (ALIAS NO-DIS USES-RS USES-RT) + "andoi ${rt-rs},$lo16" + (+ OP_ANDOI rt-rs lo16) + (set rt-rs (and rt-rs (or #xFFFF0000 (ext SI (trunc HI lo16))))) + ()) + +(dni andoi "and ones immediate" (USES-RS USES-RT) + "andoi $rt,$rs,$lo16" + (+ OP_ANDOI rs rt lo16) + (set rt (and rs (or #xFFFF0000 (ext SI (trunc HI lo16))))) + ()) + +(dni nor2 "nor" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "nor ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_NOR) + (set rd-rs (inv (or rd-rs rt))) + ()) + +(dni nor "nor" (USES-RD USES-RS USES-RT) + "nor $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_NOR) + (set rd (inv (or rs rt))) + ()) + +(dni or2 "or" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "or ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_OR) + (set rd-rs (or rd-rs rt)) + ()) + +(dni or "or" (USES-RD USES-RS USES-RT) + "or $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_OR) + (set rd (or rs rt)) + ()) + +(dni ori2 "or immediate" (ALIAS NO-DIS USES-RS USES-RT) + "ori ${rt-rs},$lo16" + (+ OP_ORI rt-rs lo16) + (set rt-rs (or rt-rs (zext SI lo16))) + ()) + +(dni ori "or immediate" (USES-RS USES-RT) + "ori $rt,$rs,$lo16" + (+ OP_ORI rs rt lo16) + (set rt (or rs (zext SI lo16))) + ()) + +(dni ram "rotate and mask" (USES-RD USES-RT) + "ram $rd,$rt,$shamt,$maskl,$maskr" + (+ OP_RAM maskr rt rd shamt (f-5 0) maskl) + (sequence () + (set rd (ror rt shamt)) + (set rd (and rd (srl #xFFFFFFFF maskl))) + (set rd (and rd (sll #xFFFFFFFF maskr)))) + ()) + +(dni sll "shift left logical" (USES-RD USES-RT) + "sll $rd,$rt,$shamt" + (+ OP_SPECIAL (f-rs 0) rt rd shamt (f-func 0)) + (set rd (sll rt shamt)) + ()) + +(dni sllv2 "shift left logical variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "sllv ${rd-rt},$rs" + (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SLLV) + (set rd-rt (sll rd-rt (and rs #x1F))) + ()) + +(dni sllv "shift left logical variable" (USES-RD USES-RS USES-RT) + "sllv $rd,$rt,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLLV) + (set rd (sll rt (and rs #x1F))) + ()) + +(dni slmv2 "shift left and mask variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "slmv ${rd-rt},$rs,$shamt" + (+ OP_SPECIAL rs rd-rt shamt FUNC_SLMV) + (set rd-rt (and (sll rd-rt shamt) (srl #xFFFFFFFF rs))) + ()) + +(dni slmv "shift left and mask variable" (USES-RD USES-RS USES-RT) + "slmv $rd,$rt,$rs,$shamt" + (+ OP_SPECIAL rs rt rd shamt FUNC_SLMV) + (set rd (and (sll rt shamt) (srl #xFFFFFFFF rs))) + ()) + +(dni slt2 "set if less than" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "slt ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SLT) + (if (lt rd-rs rt) + (set rd-rs 1) + (set rd-rs 0)) + ()) + +(dni slt "set if less than" (USES-RD USES-RS USES-RT) + "slt $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLT) + (if (lt rs rt) + (set rd 1) + (set rd 0)) + ()) + +(dni slti2 "set if less than immediate" (ALIAS NO-DIS USES-RS USES-RT) + "slti ${rt-rs},$imm" + (+ OP_SLTI rt-rs imm) + (if (lt rt-rs (ext SI (trunc HI imm))) + (set rt-rs 1) + (set rt-rs 0)) + ()) + +(dni slti "set if less than immediate" (USES-RS USES-RT) + "slti $rt,$rs,$imm" + (+ OP_SLTI rs rt imm) + (if (lt rs (ext SI (trunc HI imm))) + (set rt 1) + (set rt 0)) + ()) + +(dni sltiu2 "set if less than immediate unsigned" (ALIAS NO-DIS USES-RS USES-RT) + "sltiu ${rt-rs},$imm" + (+ OP_SLTIU rt-rs imm) + (if (ltu rt-rs (ext SI (trunc HI imm))) + (set rt-rs 1) + (set rt-rs 0)) + ()) + +(dni sltiu "set if less than immediate unsigned" (USES-RS USES-RT) + "sltiu $rt,$rs,$imm" + (+ OP_SLTIU rs rt imm) + (if (ltu rs (ext SI (trunc HI imm))) + (set rt 1) + (set rt 0)) + ()) + +(dni sltu2 "set if less than unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "sltu ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_SLTU) + (if (ltu rd-rs rt) + (set rd-rs 1) + (set rd-rs 0)) + ()) + +(dni sltu "set if less than unsigned" (USES-RD USES-RS USES-RT) + "sltu $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLTU) + (if (ltu rs rt) + (set rd 1) + (set rd 0)) + ()) + +(dni sra2 "shift right arithmetic" (ALIAS NO-DIS USES-RD USES-RT) + "sra ${rd-rt},$shamt" + (+ OP_SPECIAL (f-rs 0) rd-rt shamt FUNC_SRA) + (set rd-rt (sra rd-rt shamt)) + ()) + +(dni sra "shift right arithmetic" (USES-RD USES-RT) + "sra $rd,$rt,$shamt" + (+ OP_SPECIAL (f-rs 0) rt rd shamt FUNC_SRA) + (set rd (sra rt shamt)) + ()) + +(dni srav2 "shift right arithmetic variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "srav ${rd-rt},$rs" + (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SRAV) + (set rd-rt (sra rd-rt (and rs #x1F))) + ()) + +(dni srav "shift right arithmetic variable" (USES-RD USES-RS USES-RT) + "srav $rd,$rt,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SRAV) + (set rd (sra rt (and rs #x1F))) + ()) + +(dni srl "shift right logical" (USES-RD USES-RT) + "srl $rd,$rt,$shamt" + (+ OP_SPECIAL (f-rs 0) rt rd shamt FUNC_SRL) + (set rd (srl rt shamt)) + ()) + +(dni srlv2 "shift right logical variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "srlv ${rd-rt},$rs" + (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SRLV) + (set rd-rt (srl rd-rt (and rs #x1F))) + ()) + +(dni srlv "shift right logical variable" (USES-RD USES-RS USES-RT) + "srlv $rd,$rt,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SRLV) + (set rd (srl rt (and rs #x1F))) + ()) + +(dni srmv2 "shift right and mask variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "srmv ${rd-rt},$rs,$shamt" + (+ OP_SPECIAL rs rd-rt shamt FUNC_SRMV) + (set rd-rt (and (srl rd-rt shamt) (sll #xFFFFFFFF rs))) + ()) + +(dni srmv "shift right and mask variable" (USES-RD USES-RS USES-RT) + "srmv $rd,$rt,$rs,$shamt" + (+ OP_SPECIAL rs rt rd shamt FUNC_SRMV) + (set rd (and (srl rt shamt) (sll #xFFFFFFFF rs))) + ()) + +(dni sub2 "subtract" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "sub ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SUB) + (set rd-rs (sub rd-rs rt)) + ()) + +(dni sub "subtract" (USES-RD USES-RS USES-RT) + "sub $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SUB) + (set rd (sub rs rt)) + ()) + +(dni subu2 "subtract unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "subu ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SUBU) + (set rd-rs (sub rd-rs rt)) + ()) + +(dni subu "subtract unsigned" (USES-RD USES-RS USES-RT) + "subu $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SUBU) + (set rd (sub rs rt)) + ()) + +(dni xor2 "exclusive or" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "xor ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_XOR) + (set rd-rs (xor rd-rs rt)) + ()) + +(dni xor "exclusive or" (USES-RD USES-RS USES-RT) + "xor $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_XOR) + (set rd (xor rs rt)) + ()) + +(dni xori2 "exclusive or immediate" (ALIAS NO-DIS USES-RS USES-RT) + "xori ${rt-rs},$lo16" + (+ OP_XORI rt-rs lo16) + (set rt-rs (xor rt-rs (zext SI lo16))) + ()) + +(dni xori "exclusive or immediate" (USES-RS USES-RT) + "xori $rt,$rs,$lo16" + (+ OP_XORI rs rt lo16) + (set rt (xor rs (zext SI lo16))) + ()) + + +; Branch instructions. + +(dni bbi "branch bit immediate" (USES-RS) + "bbi $rs($bitnum),$offset" + (+ OP_BBI rs bitnum offset) + (if (bitset? rs bitnum) + (delay 1 (set pc offset))) + ()) + +(dni bbin "branch bit immediate negated" (USES-RS) + "bbin $rs($bitnum),$offset" + (+ OP_BBIN rs bitnum offset) + (if (bitclear? rs bitnum) + (delay 1 (set pc offset))) + ()) + +(dni bbv "branch bit variable" (USES-RS USES-RT) + "bbv $rs,$rt,$offset" + (+ OP_BBV rs rt offset) + (if (bitset? rs (and rt #x1F)) + (delay 1 (set pc offset))) + ()) + +(dni bbvn "branch bit variable negated" (USES-RS USES-RT) + "bbvn $rs,$rt,$offset" + (+ OP_BBVN rs rt offset) + (if (bitclear? rs (and rt #x1F)) + (delay 1 (set pc offset))) + ()) + +(dni beq "branch if equal" (USES-RS USES-RT) + "beq $rs,$rt,$offset" + (+ OP_BEQ rs rt offset) + (if (eq rs rt) + (delay 1 (set pc offset))) + ()) + +(dni beql "branch if equal likely" (USES-RS USES-RT) + "beql $rs,$rt,$offset" + (+ OP_BEQL rs rt offset) + (if (eq rs rt) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bgez "branch if greater than or equal to zero" (USES-RS) + "bgez $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZ offset) + (if (ge rs 0) + (delay 1 (set pc offset))) + ()) + +(dni bgezal "branch if greater than or equal to zero and link" (USES-RS USES-R31) + "bgezal $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZAL offset) + (if (ge rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni bgezall + "branch if greater than equal to zero and link likely" (USES-RS USES-R31) + "bgezall $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZALL offset) + (if (ge rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni bgezl "branch if greater or equal to zero likely" (USES-RS) + "bgezl $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZL offset) + (if (ge rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bltz "branch if less than zero" (USES-RS) + "bltz $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZ offset) + (if (lt rs 0) + (delay 1 (set pc offset))) + ()) + +(dni bltzl "branch if less than zero likely" (USES-RS) + "bltzl $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZL offset) + (if (lt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bltzal "branch if less than zero and link" (USES-RS USES-R31) + "bltzal $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZAL offset) + (if (lt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni bltzall "branch if less than zero and link likely" (USES-RS USES-R31) + "bltzall $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZALL offset) + (if (lt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni bmb0 "branch if matching byte-lane 0" (USES-RS USES-RT) + "bmb0 $rs,$rt,$offset" + (+ OP_BMB0 rs rt offset) + (if (eq (and rs #xFF) (and rt #xFF)) + (delay 1 (set pc offset))) + ()) + +(dni bmb1 "branch if matching byte-lane 1" (USES-RS USES-RT) + "bmb1 $rs,$rt,$offset" + (+ OP_BMB1 rs rt offset) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (delay 1 (set pc offset))) + ()) + +(dni bmb2 "branch if matching byte-lane 2" (USES-RS USES-RT) + "bmb2 $rs,$rt,$offset" + (+ OP_BMB2 rs rt offset) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (delay 1 (set pc offset))) + ()) + +(dni bmb3 "branch if matching byte-lane 3" (USES-RS USES-RT) + "bmb3 $rs,$rt,$offset" + (+ OP_BMB3 rs rt offset) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (delay 1 (set pc offset))) + ()) + +(dni bne "branch if not equal" (USES-RS USES-RT) + "bne $rs,$rt,$offset" + (+ OP_BNE rs rt offset) + (if (ne rs rt) + (delay 1 (set pc offset))) + ()) + +(dni bnel "branch if not equal likely" (USES-RS USES-RT) + "bnel $rs,$rt,$offset" + (+ OP_BNEL rs rt offset) + (if (ne rs rt) + (delay 1 (set pc offset)) + (skip 1)) + ()) + + + + +; Jump instructions. +; Might as well jump! + +(dni jalr "jump and link register" (USES-RD USES-RS) + "jalr $rd,$rs" + (+ OP_SPECIAL rs (f-rt 0) rd (f-shamt 0) FUNC_JALR) + (delay 1 + (sequence () + (set rd (add pc 8)) + (set pc rs))) + ()) + +(dni jr "jump register" (USES-RS) + "jr $rs" + (+ OP_SPECIAL rs (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_JR) + (delay 1 (set pc rs)) + ()) + + +; Load instructions. + +(dni lb "load byte" (LOAD-DELAY USES-RS USES-RT) + "lb $rt,$lo16($base)" + (+ OP_LB base rt lo16) + (set rt (ext WI (mem QI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (SI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set word (srl word (sll (and addr 2) 3))) +; (set rt (ext SI word))) + ()) + +(dni lbu "load byte unsigned" (LOAD-DELAY USES-RS USES-RT) + "lbu $rt,$lo16($base)" + (+ OP_LBU base rt lo16) + (set rt (zext WI (mem QI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (SI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set rt (srl word (sll (and addr 2) 3)))) + ()) + +(dni lh "load half word" (LOAD-DELAY USES-RS USES-RT) + "lh $rt,$lo16($base)" + (+ OP_LH base rt lo16) + (set rt (ext WI (mem HI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (HI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set word (srl word (sll (and addr 1) 4))) +; (set rt (ext SI word))) + ()) + +(dni lhu "load half word unsigned" (LOAD-DELAY USES-RS USES-RT) + "lhu $rt,$lo16($base)" + (+ OP_LHU base rt lo16) + (set rt (zext WI (mem HI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (SI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set rt (srl word (sll (and addr 1) 4)))) + ()) + +(dni lui "load upper immediate" (USES-RT) + "lui $rt,$hi16" + (+ OP_LUI (f-rs 0) rt hi16) + (set rt (sll hi16 16)) + ()) + +(dni lw "load word" (LOAD-DELAY USES-RS USES-RT) + "lw $rt,$lo16($base)" + (+ OP_LW base rt lo16) + (set rt (mem SI (add base (ext SI (trunc HI lo16))))) + ()) + + +; Store instructions. + +(dni sb "store byte" (USES-RS USES-RT) + "sb $rt,$lo16($base)" + (+ OP_SB base rt lo16) + (set (mem QI (add base (ext SI (trunc HI lo16)))) (and QI rt #xFF)) + ()) + +(dni sh "store half word" (USES-RS USES-RT) + "sh $rt,$lo16($base)" + (+ OP_SH base rt lo16) + (set (mem HI (add base (ext SI (trunc HI lo16)))) (and HI rt #xFFFF)) + ()) + +(dni sw "store word" (USES-RS USES-RT) + "sw $rt,$lo16($base)" + (+ OP_SW base rt lo16) + (set (mem SI (add base (ext SI (trunc HI lo16)))) rt) + ()) + + +; Special instructions for simulation/debugging +(dni break "breakpoint" () + "break" + (+ OP_SPECIAL (f-rs 0) (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_BREAK) + (c-call VOID "do_break" pc) + ()) + +(dni syscall "system call" (YIELD-INSN) + "syscall" + (+ OP_SPECIAL execode (f-func 12)) + (c-call VOID "do_syscall") + ()) + +; Macro instructions, common to iq10 & iq2000 + +(dnmi nop "nop" () + "nop" + (emit sll (rd 0) (rt 0) (shamt 0)) +) + +(dnmi li "load immediate" (USES-RS NO-DIS) + "li $rs,$imm" + (emit ori (rt 0) rs imm) +) + +(dnmi move "move" (USES-RD USES-RT NO-DIS) + "move $rd,$rt" + (emit or rd (rs 0) rt) +) + +(dnmi lb-base-0 "load byte - implied base 0" (USES-RT NO-DIS) + "lb $rt,$lo16" + (emit lb rt lo16 (base 0)) +) + +(dnmi lbu-base-0 "load byte unsigned - implied base 0" (USES-RT NO-DIS) + "lbu $rt,$lo16" + (emit lbu rt lo16 (base 0)) +) + +(dnmi lh-base-0 "load half - implied base 0" (USES-RT NO-DIS) + "lh $rt,$lo16" + (emit lh rt lo16 (base 0)) +) + +(dnmi lw-base-0 "load word - implied base 0" (USES-RT NO-DIS) + "lw $rt,$lo16" + (emit lw rt lo16 (base 0)) +) + +(dnmi m-add "add immediate" (USES-RS USES-RT NO-DIS) + "add $rt,$rs,$lo16" + (emit addi rt rs lo16)) + +(dnmi m-addu "add immediate unsigned" (USES-RS USES-RT NO-DIS) + "addu $rt,$rs,$lo16" + (emit addiu rt rs lo16) +) + +(dnmi m-and "and immediate" (USES-RS USES-RT NO-DIS) + "and $rt,$rs,$lo16" + (emit andi rt rs lo16) +) + +(dnmi m-j "jump register" (USES-RS NO-DIS) + "j $rs" + (emit jr rs) +) + +(dnmi m-or "or immediate" (USES-RS USES-RT NO-DIS) + "or $rt,$rs,$lo16" + (emit ori rt rs lo16) +) + +(dnmi m-sll "shift left logical" (USES-RD USES-RT USES-RS NO-DIS) + "sll $rd,$rt,$rs" + (emit sllv rd rt rs) +) + +(dnmi m-slt "slt immediate" (USES-RS USES-RT NO-DIS) + "slt $rt,$rs,$imm" + (emit slti rt rs imm) +) + +(dnmi m-sltu "sltu immediate" (USES-RS USES-RT NO-DIS) + "sltu $rt,$rs,$imm" + (emit sltiu rt rs imm) +) + +(dnmi m-sra "shift right arithmetic" (USES-RD USES-RT USES-RS NO-DIS) + "sra $rd,$rt,$rs" + (emit srav rd rt rs) +) + +(dnmi m-srl "shift right logical" (USES-RD USES-RT USES-RS NO-DIS) + "srl $rd,$rt,$rs" + (emit srlv rd rt rs) +) + +(dnmi not "not" (USES-RD USES-RT NO-DIS) + "not $rd,$rt" + (emit nor rd (rs 0) rt) +) + +(dnmi subi "sub immediate" (USES-RS USES-RT NO-DIS) + "subi $rt,$rs,$mlo16" + (emit addiu rt rs mlo16) +) + +(dnmi m-sub "subtract immediate" (USES-RS USES-RT NO-DIS) + "sub $rt,$rs,$mlo16" + (emit addiu rt rs mlo16) +) + +(dnmi m-subu "subtract unsigned" (USES-RS USES-RT NO-DIS) + "subu $rt,$rs,$mlo16" + (emit addiu rt rs mlo16) +) + +(dnmi sb-base-0 "store byte - implied base 0" (USES-RT NO-DIS) + "sb $rt,$lo16" + (emit sb rt lo16 (base 0)) +) + +(dnmi sh-base-0 "store half - implied base 0" (USES-RT NO-DIS) + "sh $rt,$lo16" + (emit sh rt lo16 (base 0)) +) + +(dnmi sw-base-0 "store word - implied base 0" (USES-RT NO-DIS) + "sw $rt,$lo16" + (emit sw rt lo16 (base 0)) +) + +(dnmi m-xor "xor immediate" (USES-RS USES-RT NO-DIS) + "xor $rt,$rs,$lo16" + (emit xori rt rs lo16) +) + + +(if (keep-mach? (iq2000)) +(include "iq2000m.cpu")) + +(if (keep-mach? (iq10)) +(include "iq10.cpu")) + + + diff --git a/cpu/iq2000.opc b/cpu/iq2000.opc new file mode 100644 index 0000000..06600ec --- /dev/null +++ b/cpu/iq2000.opc @@ -0,0 +1,324 @@ +/* IQ2000 opcode support. -*- C -*- + + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + + Contributed by Red Hat Inc; developed under contract from Fujitsu. + + This file is part of the GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +/* This file is an addendum to iq2000.cpu. Heavy use of C code isn't + appropriate in .cpu files, so it resides here. This especially applies + to assembly/disassembly where parsing/printing can be quite involved. + Such things aren't really part of the specification of the cpu, per se, + so .cpu files provide the general framework and .opc files handle the + nitty-gritty details as necessary. + + Each section is delimited with start and end markers. + + -opc.h additions use: "-- opc.h" + -opc.c additions use: "-- opc.c" + -asm.c additions use: "-- asm.c" + -dis.c additions use: "-- dis.c" + -ibd.h additions use: "-- ibd.h" +*/ + +/* -- opc.h */ + +/* Allows reason codes to be output when assembler errors occur. */ +#define CGEN_VERBOSE_ASSEMBLER_ERRORS + +/* Override disassembly hashing - there are variable bits in the top + byte of these instructions. */ +#define CGEN_DIS_HASH_SIZE 8 +#define CGEN_DIS_HASH(buf,value) (((* (unsigned char*) (buf)) >> 6) % CGEN_DIS_HASH_SIZE) + +/* following activates check beyond hashing since some iq2000 and iq10 + instructions have same mnemonics but different functionality. */ +#define CGEN_VALIDATE_INSN_SUPPORTED + +extern int iq2000_cgen_insn_supported (CGEN_CPU_DESC cd, CGEN_INSN *insn); + +/* -- asm.c */ +static const char * parse_mimm PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_imm PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_lo16 PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); + +/* Special check to ensure that instruction exists for given machine */ +int +iq2000_cgen_insn_supported (cd, insn) + CGEN_CPU_DESC cd; + CGEN_INSN *insn; +{ + int machs = cd->machs; + + return ((CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH) & machs) != 0); +} + +static int iq2000_cgen_isa_register (strp) + const char **strp; +{ + int len; + int ch1, ch2; + if (**strp == 'r' || **strp == 'R') + { + len = strlen (*strp); + if (len == 2) + { + ch1 = (*strp)[1]; + if ('0' <= ch1 && ch1 <= '9') + return 1; + } + else if (len == 3) + { + ch1 = (*strp)[1]; + ch2 = (*strp)[2]; + if (('1' <= ch1 && ch1 <= '2') && ('0' <= ch2 && ch2 <= '9')) + return 1; + if ('3' == ch1 && (ch2 == '0' || ch2 == '1')) + return 1; + } + } + if (**strp == '%' && tolower((*strp)[1]) != 'l' && tolower((*strp)[1]) != 'h') + return 1; + return 0; +} + +/* Handle negated literal. */ + +static const char * +parse_mimm (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + const char *errmsg; + long value; + + /* Verify this isn't a register */ + if (iq2000_cgen_isa_register (strp)) + errmsg = _("immediate value cannot be register"); + else + { + long value; + + errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); + if (errmsg == NULL) + { + long x = (-value) & 0xFFFF0000; + if (x != 0 && x != 0xFFFF0000) + errmsg = _("immediate value out of range"); + else + *valuep = (-value & 0xFFFF); + } + } + return errmsg; +} + +/* Handle signed/unsigned literal. */ + +static const char * +parse_imm (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + const char *errmsg; + long value; + + if (iq2000_cgen_isa_register (strp)) + errmsg = _("immediate value cannot be register"); + else + { + long value; + + errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); + if (errmsg == NULL) + { + long x = value & 0xFFFF0000; + if (x != 0 && x != 0xFFFF0000) + errmsg = _("immediate value out of range"); + else + *valuep = (value & 0xFFFF); + } + } + return errmsg; +} + +/* Handle iq10 21-bit jmp offset. */ + +static const char * +parse_jtargq10 (cd, strp, opindex, reloc, type_addr, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + int reloc; + enum cgen_parse_operand_result *type_addr; + unsigned long *valuep; +{ + const char *errmsg; + bfd_vma value; + enum cgen_parse_operand_result result_type = CGEN_PARSE_OPERAND_RESULT_NUMBER; + + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_IQ2000_OFFSET_21, + &result_type, &value); + if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + { + /* check value is within 23-bits (remembering that 2-bit shift right will occur) */ + if (value > 0x7fffff) + return _("21-bit offset out of range"); + } + *valuep = (value & 0x7FFFFF); + return errmsg; +} + +/* Handle high(). */ + +static const char * +parse_hi16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + if (strncasecmp (*strp, "%hi(", 4) == 0) + { + enum cgen_parse_operand_result result_type; + bfd_vma value; + const char *errmsg; + + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + { + /* if value has top-bit of %lo on, then it will + sign-propagate and so we compensate by adding + 1 to the resultant %hi value */ + if (value & 0x8000) + value += 0x10000; + value >>= 16; + } + *valuep = value; + + return errmsg; + } + + /* we add %uhi in case a user just wants the high 16-bits or is using + an insn like ori for %lo which does not sign-propagate */ + if (strncasecmp (*strp, "%uhi(", 5) == 0) + { + enum cgen_parse_operand_result result_type; + bfd_vma value; + const char *errmsg; + + *strp += 5; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_IQ2000_UHI16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + { + value >>= 16; + } + *valuep = value; + + return errmsg; + } + + return parse_imm (cd, strp, opindex, valuep); +} + +/* Handle %lo in a signed context. + The signedness of the value doesn't matter to %lo(), but this also + handles the case where %lo() isn't present. */ + +static const char * +parse_lo16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + if (strncasecmp (*strp, "%lo(", 4) == 0) + { + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + + return parse_imm (cd, strp, opindex, valuep); +} + +/* Handle %lo in a negated signed context. + The signedness of the value doesn't matter to %lo(), but this also + handles the case where %lo() isn't present. */ + +static const char * +parse_mlo16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + if (strncasecmp (*strp, "%lo(", 4) == 0) + { + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value = (-value) & 0xffff; + *valuep = value; + return errmsg; + } + + return parse_mimm (cd, strp, opindex, valuep); +} + +/* -- */ diff --git a/cpu/iq2000m.cpu b/cpu/iq2000m.cpu new file mode 100644 index 0000000..a3a41d9 --- /dev/null +++ b/cpu/iq2000m.cpu @@ -0,0 +1,630 @@ +; IQ2000-only CPU description. -*- Scheme -*- +; +; Copyright 2000, 2001, 2002 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Vitesse. +; +; This file is part of the GNU Binutils. +; +; This program is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation; either version 2 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +(dni andoui "and upper ones immediate" (MACH2000 USES-RS USES-RT) + "andoui $rt,$rs,$hi16" + (+ OP_ANDOUI rs rt hi16) + (set rt (and rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni andoui2 "and upper ones immediate" (ALIAS NO-DIS MACH2000 USES-RS USES-RT) + "andoui ${rt-rs},$hi16" + (+ OP_ANDOUI rt-rs hi16) + (set rt-rs (and rt-rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni orui2 "or upper immediate" (ALIAS NO-DIS MACH2000 USES-RS USES-RT) + "orui ${rt-rs},$hi16" + (+ OP_ORUI rt-rs hi16) + (set rt-rs (or rt-rs (sll hi16 16))) + ()) + +(dni orui "or upper immediate" (MACH2000 USES-RS USES-RT) + "orui $rt,$rs,$hi16" + (+ OP_ORUI rs rt hi16) + (set rt (or rs (sll hi16 16))) + ()) + +(dni bgtz "branch if greater than zero" (MACH2000 USES-RS) + "bgtz $rs,$offset" + (+ OP_BGTZ rs (f-rt 0) offset) + (if (gt rs 0) + (delay 1 (set pc offset))) + ()) + + +(dni bgtzl "branch if greater than zero likely" (MACH2000 USES-RS) + "bgtzl $rs,$offset" + (+ OP_BGTZL rs (f-rt 0) offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni blez "branch if less than or equal to zero" (MACH2000 USES-RS) + "blez $rs,$offset" + (+ OP_BLEZ rs (f-rt 0) offset) + (if (le rs 0) + (delay 1 (set pc offset))) + ()) + +(dni blezl "branch if less than or equal to zero likely" (MACH2000 USES-RS) + "blezl $rs,$offset" + (+ OP_BLEZL rs (f-rt 0) offset) + (if (le rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + + +(dni mrgb "merge bytes" (MACH2000 USES-RD USES-RS USES-RT) + "mrgb $rd,$rs,$rt,$mask" + (+ OP_SPECIAL rs rt rd (f-10 0) mask FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd temp)) + ()) + +(dni mrgb2 "merge bytes" (ALIAS NO-DIS MACH2000 USES-RD USES-RS USES-RT) + "mrgb ${rd-rs},$rt,$mask" + (+ OP_SPECIAL rt rd-rs (f-10 0) mask FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rd-rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rd-rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rd-rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rd-rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd-rs temp)) + ()) + +; NOTE: None of these instructions' semantics are specified, so they +; will not work in a simulator. +; +; Architectural and coprocessor instructions. +; BREAK and SYSCALL are implemented with escape hatches to the C +; code. These are used by the test suite to indicate pass/failures. + +(dni bctxt "branch and switch context" (MACH2000 DELAY-SLOT COND-CTI USES-RS) + "bctxt $rs,$offset" + (+ OP_REGIMM rs (f-rt 6) offset) + (unimp bctxt) + ()) + +(dni bc0f "branch if copro 0 condition false" (MACH2000 DELAY-SLOT COND-CTI) + "bc0f $offset" + (+ OP_COP0 (f-rs 8) (f-rt 0) offset) + (unimp bc0f) + ()) + +(dni bc0fl "branch if copro 0 condition false likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc0fl $offset" + (+ OP_COP0 (f-rs 8) (f-rt 2) offset) + (unimp bc0fl) + ()) + +(dni bc3f "branch if copro 3 condition false" (MACH2000 DELAY-SLOT COND-CTI) + "bc3f $offset" + (+ OP_COP3 (f-rs 8) (f-rt 0) offset) + (unimp bc3f) + ()) + +(dni bc3fl "branch if copro 3 condition false likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc3fl $offset" + (+ OP_COP3 (f-rs 8) (f-rt 2) offset) + (unimp bc3fl) + ()) + +(dni bc0t "branch if copro 0 condition true" (MACH2000 DELAY-SLOT COND-CTI) + "bc0t $offset" + (+ OP_COP0 (f-rs 8) (f-rt 1) offset) + (unimp bc0t) + ()) + +(dni bc0tl "branch if copro 0 condition true likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc0tl $offset" + (+ OP_COP0 (f-rs 8) (f-rt 3) offset) + (unimp bc0tl) + ()) + +(dni bc3t "branch if copro 3 condition true" (MACH2000 DELAY-SLOT COND-CTI) + "bc3t $offset" + (+ OP_COP3 (f-rs 8) (f-rt 1) offset) + (unimp bc3t) + ()) + +(dni bc3tl "branch if copro 3 condition true likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc3tl $offset" + (+ OP_COP3 (f-rs 8) (f-rt 3) offset) + (unimp bc3tl) + ()) + +; Note that we don't set the USES-RD or USES-RT attributes for many of the following +; instructions, as it's the COP register that's being specified. + +(dni cfc0 "control from coprocessor 0" (MACH2000 LOAD-DELAY USES-RT) + "cfc0 $rt,$rd" + (+ OP_COP0 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc0) + ()) + +(dni cfc1 "control from coprocessor 1" (MACH2000 LOAD-DELAY USES-RT) + "cfc1 $rt,$rd" + (+ OP_COP1 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc1) + ()) + +(dni cfc2 "control from coprocessor 2" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "cfc2 $rt,$rd" + (+ OP_COP2 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc2) + ()) + +(dni cfc3 "control from coprocessor 3" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "cfc3 $rt,$rd" + (+ OP_COP3 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc3) + ()) + +; COPz instructions are an instruction form, not real instructions +; with associated assembly mnemonics. Therefore, they are omitted +; from the ISA description. + +(dni chkhdr "check header" (MACH2000 LOAD-DELAY USES-RD YIELD-INSN) + "chkhdr $rd,$rt" + (+ OP_COP3 (f-rs 9) rt rd (f-shamt 0) (f-func 0)) + (unimp chkhdr) + ()) + +(dni ctc0 "control to coprocessor 0" (MACH2000 USES-RT) + "ctc0 $rt,$rd" + (+ OP_COP0 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc0) + ()) + +(dni ctc1 "control to coprocessor 1" (MACH2000 USES-RT) + "ctc1 $rt,$rd" + (+ OP_COP1 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc1) + ()) + +(dni ctc2 "control to coprocessor 2" (MACH2000 USES-RT) + "ctc2 $rt,$rd" + (+ OP_COP2 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc2) + ()) + +(dni ctc3 "control to coprocessor 3" (MACH2000 USES-RT) + "ctc3 $rt,$rd" + (+ OP_COP3 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc3) + ()) + +(dni jcr "jump context register" (MACH2000 DELAY-SLOT UNCOND-CTI USES-RS) + "jcr $rs" + (+ OP_SPECIAL rs (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_JCR) + (unimp jcr) + ()) + +(dni luc32 "lookup chain 32 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc32 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 3)) + (unimp luc32) + ()) + +(dni luc32l "lookup chain 32 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc32l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 7)) + (unimp luc32l) + ()) + +(dni luc64 "lookup chain 64 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc64 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 11)) + (unimp luc64) + ()) + +(dni luc64l "lookup chain 64 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc64l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 15)) + (unimp luc64l) + ()) + +(dni luk "lookup key" (MACH2000 USES-RD USES-RT) + "luk $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 8)) + (unimp luk) + ()) + +(dni lulck "lookup lock" (MACH2000 USES-RT YIELD-INSN) + "lulck $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 4)) + (unimp lulck) + ()) + +(dni lum32 "lookup match 32 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum32 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 2)) + (unimp lum32) + ()) + +(dni lum32l "lookup match 32 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum32l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 6)) + (unimp lum32l) + ()) + +(dni lum64 "lookup match 64 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum64 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 10)) + (unimp lum64) + ()) + +(dni lum64l "lookup match 64 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum64l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 14)) + (unimp lum64l) + ()) + +(dni lur "lookup read" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lur $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 1)) + (unimp lur) + ()) + +(dni lurl "lookup read and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lurl $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 5)) + (unimp lurl) + ()) + +(dni luulck "lookup unlock" (MACH2000 USES-RT YIELD-INSN) + "luulck $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 0)) + (unimp luulck) + ()) + +(dni mfc0 "move from coprocessor 0" (MACH2000 LOAD-DELAY USES-RT) + "mfc0 $rt,$rd" + (+ OP_COP0 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc0) + ()) + +(dni mfc1 "move from coprocessor 1" (MACH2000 LOAD-DELAY USES-RT) + "mfc1 $rt,$rd" + (+ OP_COP1 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc1) + ()) + +(dni mfc2 "move from coprocessor 2" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "mfc2 $rt,$rd" + (+ OP_COP2 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc2) + ()) + +(dni mfc3 "move from coprocessor 3" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "mfc3 $rt,$rd" + (+ OP_COP3 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc3) + ()) + +(dni mtc0 "move to coprocessor 0" (MACH2000 USES-RT) + "mtc0 $rt,$rd" + (+ OP_COP0 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc0) + ()) + +(dni mtc1 "move to coprocessor 1" (MACH2000 USES-RT) + "mtc1 $rt,$rd" + (+ OP_COP1 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc1) + ()) + +(dni mtc2 "move to coprocessor 2" (MACH2000 USES-RT) + "mtc2 $rt,$rd" + (+ OP_COP2 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc2) + ()) + +(dni mtc3 "move to coprocessor 3" (MACH2000 USES-RT) + "mtc3 $rt,$rd" + (+ OP_COP3 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc3) + ()) + +(dni pkrl "pkrl" (MACH2000 USES-RD USES-RT YIELD-INSN) + "pkrl $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 7)) + (unimp pkrl) + ()) + +(dni pkrlr1 "pkrlr1" (MACH2000 USES-RT YIELD-INSN) + "pkrlr1 $rt,$count" + (+ OP_COP3 (f-rs 29) rt count) + (unimp pkrlr1) + ()) + +(dni pkrlr30 "pkrlr30" (MACH2000 USES-RT YIELD-INSN) + "pkrlr30 $rt,$count" + (+ OP_COP3 (f-rs 31) rt count) + (unimp pkrlr30) + ()) + +(dni rb "dma read bytes" (MACH2000 USES-RD USES-RT YIELD-INSN) + "rb $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 4)) + (unimp rb) + ()) + +(dni rbr1 "dma read bytes using r1" (MACH2000 USES-RT YIELD-INSN) + "rbr1 $rt,$count" + (+ OP_COP3 (f-rs 24) rt count) + (unimp rbr1) + ()) + +(dni rbr30 "dma read bytes using r30" (MACH2000 USES-RT YIELD-INSN) + "rbr30 $rt,$count" + (+ OP_COP3 (f-rs 26) rt count) + (unimp rbr30) + ()) + +(dni rfe "restore from exception" (MACH2000) + "rfe" + (+ OP_COP0 (f-25 1) (f-24-19 0) (f-func 16)) + (unimp rfe) + ()) + +(dni rx "dma read word64s" (MACH2000 USES-RD USES-RT YIELD-INSN) + "rx $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 6)) + (unimp rx) + ()) + +(dni rxr1 "dma read word64s using r1" (MACH2000 USES-RT YIELD-INSN) + "rxr1 $rt,$count" + (+ OP_COP3 (f-rs 28) rt count) + (unimp rxr1) + ()) + +(dni rxr30 "dma read word 64s using r30" (MACH2000 USES-RT YIELD-INSN) + "rxr30 $rt,$count" + (+ OP_COP3 (f-rs 30) rt count) + (unimp rxr30) + ()) + +(dni sleep "sleep" (MACH2000 YIELD-INSN) + "sleep" + (+ OP_SPECIAL execode FUNC_SLEEP) + (unimp sleep) + ()) + +(dni srrd "sram read" (MACH2000 USES-RT YIELD-INSN) + "srrd $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 16)) + (unimp srrd) + ()) + +(dni srrdl "sram read and lock" (MACH2000 USES-RT YIELD-INSN) + "srrdl $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 20)) + (unimp srrdl) + ()) + +(dni srulck "sram unlock" (MACH2000 USES-RT YIELD-INSN) + "srulck $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 22)) + (unimp srulck) + ()) + +(dni srwr "sram write" (MACH2000 USES-RD USES-RT YIELD-INSN) + "srwr $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 17)) + (unimp srwr) + ()) + +(dni srwru "sram write and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "srwru $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 21)) + (unimp srwru) + ()) + +(dni trapqfl "yield if dma queue full" (MACH2000 YIELD-INSN) + "trapqfl" + (+ OP_COP3 (f-rs 1) (f-rt 0) (f-rd 0) (f-shamt 0) (f-func 8)) + (unimp trapqfl) + ()) + +(dni trapqne "yield if dma queue not empty" (MACH2000 YIELD-INSN) + "trapqne" + (+ OP_COP3 (f-rs 1) (f-rt 0) (f-rd 0) (f-shamt 0) (f-func 9)) + (unimp trapqne) + ()) + +(dni traprel "traprel" (MACH2000 USES-RT YIELD-INSN) + "traprel $rt" + (+ OP_COP3 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 10)) + (unimp traprel) + ()) + +(dni wb "dma write bytes" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wb $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 0)) + (unimp wb) + ()) + +(dni wbu "dma write bytes and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wbu $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 1)) + (unimp wbu) + ()) + +(dni wbr1 "dma write bytes using r1" (MACH2000 USES-RT YIELD-INSN) + "wbr1 $rt,$count" + (+ OP_COP3 (f-rs 16) rt count) + (unimp wbr1) + ()) + +(dni wbr1u "dma write bytes using r1 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wbr1u $rt,$count" + (+ OP_COP3 (f-rs 17) rt count) + (unimp wbr1u) + ()) + +(dni wbr30 "dma write bytes using r30" (MACH2000 USES-RT YIELD-INSN) + "wbr30 $rt,$count" + (+ OP_COP3 (f-rs 18) rt count) + (unimp wbr30) + ()) + +(dni wbr30u "dma write bytes using r30 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wbr30u $rt,$count" + (+ OP_COP3 (f-rs 19) rt count) + (unimp wbr30u) + ()) + +(dni wx "dma write word64s" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wx $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 2)) + (unimp wx) + ()) + +(dni wxu "dma write word64s and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wxu $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 3)) + (unimp wxu) + ()) + +(dni wxr1 "dma write word64s using r1" (MACH2000 USES-RT YIELD-INSN) + "wxr1 $rt,$count" + (+ OP_COP3 (f-rs 20) rt count) + (unimp wxr1) + ()) + +(dni wxr1u "dma write word64s using r1 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wxr1u $rt,$count" + (+ OP_COP3 (f-rs 21) rt count) + (unimp wxr1u) + ()) + +(dni wxr30 "dma write word64s using r30" (MACH2000 USES-RT YIELD-INSN) + "wxr30 $rt,$count" + (+ OP_COP3 (f-rs 22) rt count) + (unimp wxr30) + ()) + +(dni wxr30u "dma write word64s using r30 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wxr30u $rt,$count" + (+ OP_COP3 (f-rs 23) rt count) + (unimp wxr30u) + ()) + + +; Load/Store instructions. + +(dni ldw "load double word" (MACH2000 EVEN-REG-NUM LOAD-DELAY USES-RT) + "ldw $rt,$lo16($base)" + (+ OP_LDW base rt lo16) + (sequence ((SI addr)) + (set addr (and (add base lo16) (inv 3))) + (set (reg h-gr (add (ifield f-rt) 1)) (mem SI addr)) + (set rt (mem SI (add addr 4)))) + ()) + +(dni sdw "store double word" (MACH2000 EVEN-REG-NUM USES-RT) + "sdw $rt,$lo16($base)" + (+ OP_SDW base rt lo16) + (sequence ((SI addr)) + (set addr (and (add base lo16) (inv 3))) + (set (mem SI (add addr 4)) rt) + (set (mem SI addr) (reg h-gr (add (ifield f-rt) 1)))) + ()) + + +; Jump instructions + +(dni j "jump" (MACH2000) + "j $jmptarg" + (+ OP_J (f-rsrvd 0) jmptarg) + (delay 1 (set pc jmptarg)) + ()) + +(dni jal "jump and link" (MACH2000 USES-R31) + "jal $jmptarg" + (+ OP_JAL (f-rsrvd 0) jmptarg) + (delay 1 + (sequence () + (set (reg h-gr 31) (add pc 8)) + (set pc jmptarg))) + ()) + +(dni bmb "branch if matching byte-lane" (MACH2000 USES-RS USES-RT) + "bmb $rs,$rt,$offset" + (+ OP_BMB rs rt offset) + (sequence ((BI branch?)) + (set branch? 0) + (if (eq (and rs #xFF) (and rt #xFF)) + (set branch? 1)) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (set branch? 1)) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (set branch? 1)) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (set branch? 1)) + (if branch? + (delay 1 (set pc offset)))) + ()) + + +; Macros + +(dnmi ldw-base-0 "load double word - implied base 0" (MACH2000 EVEN-REG-NUM LOAD-DELAY USES-RT USES-RS NO-DIS) + "ldw $rt,$lo16" + (emit ldw rt lo16 (base 0)) +) + +(dnmi sdw-base-0 "store double word - implied base 0" (MACH2000 EVEN-REG-NUM USES-RT NO-DIS) + "sdw $rt,$lo16" + (emit sdw rt lo16 (base 0)) +) + + + + + + diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 30c3a86..5237edf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,887 @@ +2003-06-13 Jim Blandy + + * solib-svr4.c (solib_break_names): Recognize the 64-bit PowerPC + Linux entry point symbols for _dl_debug_state, too. + +2003-06-13 Andrew Cagney + + * infcall.c (call_function_by_hand): When UNWIND_DUMMY_ID is + available, do not use the FP register, and always save the TOS. + * dummy-frame.c (dummy_frame_this_id): Do not assert + SAVE_DUMMY_FRAME_TOS. + * i386-tdep.c (i386_save_dummy_frame_tos): Delete function. + (i386_gdbarch_init): Do not set save_dummy_frame_tos. + (i386_push_dummy_call): Add 8 to the returned SP. + * frame.c (legacy_frame_p): Do not require SAVE_DUMMY_FRAME_TOS. + * d10v-tdep.c (d10v_unwind_dummy_id): Use d10v_unwind_sp. + (d10v_gdbarch_init): Do not set save_dummy_frame_tos. + * x86-64-tdep.c (x86_64_save_dummy_frame_tos): Delete function. + (x86_64_push_dummy_call): Return "sp + 16". + (x86_64_init_abi): Do not set save_dummy_frame_tos. + * alpha-tdep.c (alpha_gdbarch_init): Do not set + save_dummy_frame_tos. + +2003-06-13 Jim Blandy + + * frv-tdep.c (frv_use_struct_convention): Delete static + declaration for function deleted in my change of 2003-06-12. + +2003-06-13 Theodore A. Roth + + * avr-tdep.c (avr_address_to_pointer): Shift code addrs right 1 bit. + (avr_pointer_to_address): Shift code addrs left 1 bit. + (avr_convert_from_func_ptr_addr): Delete function since operation is + better handled by avr_address_to_pointer and avr_pointer_to_address. + (avr_gdbarch_init): Don't set convert_from_func_ptr_add method. + +2003-06-13 Mark Kettenis + + From Kelley Cook : + * configure.host: Accept i[34567]86 variants. + * configure.tgt: Likewise. + * nlm/configure.in: Likewise. + * nlm/configure: Regenerated. + +2003-06-13 Richard Earnshaw + + * arm-tdep.c (solib-svr4.h): Dont' include it. + (arm_linux_svr4_fetch_link_map_offsets): Move to ... + * arm-linux-tdep.c: ... here. Make static. + (arm_linux_init_abi): Register it. + (solib-svr4.h): Include it. + * Makefile.in: Update dependencies. + * config/arm/tm-linux.h (SVR4_FETCH_LINK_MAP_OFFSETS): Delete. + (arm_linux_svr4_fetch_link_map_offsets): Delete declaration. + +2003-06-13 Corinna Vinschen + + * h8300-tdep.c: Add definitions E_RET0_REGNUM and E_RET1_REGNUM to + indicate registers used for return values. + (struct frame_extra_info): Drop args_pointer and locals_pointer. + (h8300_examine_prologue): Remove initializing dropped frame_extra_info + members. + (h8300_init_extra_frame_info): Ditto. + (h8300_frame_locals_address): Removed. + (h8300_frame_args_address): Removed. + (h8300_extract_return_value): Use new regcache structure. Only care + for 16 bit CPUs. + (h8300h_extract_return_value): Same function for 32 bit CPUs. + (h8300_store_return_value): Use new regcache structure. Only care + for 16 bit CPUs. + (h8300h_store_return_value): Same function for 32 bit CPUs. + (h8300_store_struct_return): Removed. + (h8300_extract_struct_value_address): Use new regcache structure. + (h8300h_extract_struct_value_address): Removed. + (h8300_push_dummy_code): New function. + (h8300_gdbarch_init): Slightly rearranged to stress deprecated calls. + Remove call_dummy_words. Call set_gdbarch_extract_return_value and + set_gdbarch_store_return_value architecture dependent. + Call set_gdbarch_push_dummy_code and + set_gdbarch_extract_struct_value_address. + Remove calls to set_gdbarch_frame_args_address, + set_gdbarch_frame_locals_address, + set_gdbarch_deprecated_store_struct_return, + set_gdbarch_deprecated_extract_return_value, + set_gdbarch_deprecated_extract_struct_value_address, + set_gdbarch_deprecated_call_dummy_words and + set_gdbarch_deprecated_sizeof_call_dummy_words. + +2003-06-13 Corinna Vinschen + + * h8300-tdep.c (h8300_register_byte): Remove. + (h8300h_register_byte): Remove. + (h8300_register_virtual_type): Remove. Substitute by... + (h8300_register_type): New function. + (h8300_extract_struct_value_address): Drop usage of h8300_register_byte. + (h8300h_extract_struct_value_address): Ditto. + (h8300_gdbarch_init): Drop calls to + set_gdbarch_deprecated_register_byte and + set_gdbarch_deprecated_register_virtual_type. + Add call to set_gdbarch_register_type. + +2003-06-13 Andrew Cagney + + * gdbarch.sh: Update comments on registers. + (deprecated_register_byte): Rename register_byte. + (deprecated_register_raw_size): Rename register_raw_size. + (deprecated_register_virtual_size): Rename register_virtual_size. + (deprecated_register_virtual_type): Rename register_virtual_type. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ns32k-tdep.c: Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + +2003-06-13 Andrew Cagney + + * mips-tdep.c (mips_gdbarch_init): Replace remaining instances of + mips_o32_use_struct_convention with always_use_struct_convention. + +2003-06-12 David Carlton + + * cp-namespace.c (cp_set_block_scope): Comment out + processing_has_namespace_info branch. + +2003-06-12 Jim Blandy + + Recognize and skip 64-bit PowerPC Linux linkage functions. + * ppc-linux-tdep.c (insn_d, insn_ds, insn_xfx, read_insn, struct + insn_pattern, insns_match_pattern, d_field, ds_field): New + functions, macros, and types for working with PPC instructions. + (ppc64_standard_linkage, PPC64_STANDARD_LINKAGE_LEN, + ppc64_in_solib_call_trampoline, ppc64_standard_linkage_target, + ppc64_skip_trampoline_code): New functions, variables, and macros + for recognizing and skipping linkage functions. + (ppc_linux_init_abi): Use ppc64_in_solib_call_trampoline and + ppc64_skip_trampoline_code for the 64-bit PowerPC Linux ABI. + + * ppc-linux-nat.c (ppc_register_u_addr): Correctly compute u-area + register offsets for both the 32- and 64-bit interfaces. + + Actually finish the job started by my change of 2003-05-29. + * config/powerpc/tm-linux.h (SKIP_TRAMPOLINE_CODE): Remove the + other #definition of this. + (ppc_linux_skip_trampoline_code): Remove declaration. + * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Make this + static. + (ppc_linux_init_abi): Register it as the skip_trampoline_code + method for GDBARCH. + + * config/powerpc/nm-ppc64-linux.h (PTRACE_XFER_TYPE): This is + 'long' on ppc64-*-linux*. + + * ppc-linux-nat.c (ppc_register_u_addr, fill_gregset): If PT_MQ + isn't #defined, assume the register doesn't exist: act as if + tdep->ppc_mq_regnum were -1. + + * configure.host, configure.tgt: Add entries for + powerpc64-*-linux, selecting powerpc/ppc64-linux.mh and + powerpc/linux.mt. + * config/powerpc/ppc64-linux.mh, config/powerpc/nm-ppc64-linux.mh: + New files. + + * arch-utils.c (always_use_struct_convention): New function. + * arch-utils.h (always_use_struct_convention): New prototype. + * alpha-tdep.c (alpha_use_struct_convention): Delete. + (alpha_gdbarch_init): Register always_use_struct_convention, + instead of alpha_use_struct_convention. + * cris-tdep.c (cris_use_struct_convention): Delete. + (cris_gdbarch_init): Register always_use_struct_convention, + instead of cris_use_struct_convention. + * frv-tdep.c (frv_use_struct_convention): Delete. + (frv_gdbarch_init): Register always_use_struct_convention, + instead of frv_use_struct_convention. + * h8300-tdep.c (h8300_use_struct_convention): Delete. + (h8300_gdbarch_init): Register always_use_struct_convention, + instead of h8300_use_struct_convention. + * mips-tdep.c (mips_o32_use_struct_convention): Delete. + (mips_o32_gdbarch_init): Register always_use_struct_convention, + instead of mips_o32_use_struct_convention. + +2003-06-12 Andrew Cagney + + * wince.c: Include "mips-tdep.h". + * mips-tdep.h (mips_next_pc): Declare. + * mcore-tdep.c: Make more local functions static. + * Makefile.in (wince.o): Update dependencies. + +2003-06-12 David Carlton + + * symtab.c (lookup_symbol_aux_minsyms): Replace + DEPRECATED_SYMBOL_NAME by SYMBOL_LINKAGE_NAME. + (find_pc_sect_line, search_symbols, rbreak_command): Ditto. + (COMPLETION_LIST_ADD_SYMBOL): Rewrite in terms of + SYMBOL_NATURAL_NAME. + +2003-06-12 Andreas Schwab + + * Makefile.in (tuiDisassem.o): Update dependencies. + +2003-06-12 David Carlton + + * symtab.h: Delete declaration of make_symbol_overload_list. + Add declaration of lookup_partial_symbol. + * symtab.c (remove_params): Move to cp-support.c. + (overload_list_add_symbol, make_symbol_overload_list) + (sym_return_val_size, sym_return_val_index): Ditto. + (lookup_partial_symbol): Make extern. + * cp-support.h: Add declaration of make_symbol_overload_list. + * cp-support.c: Include dictionary.h, objfiles.h, frame.h, + symtab.h, and block.h. + (remove_params): Move here from symtab.c. + (overload_list_add_symbol, make_symbol_overload_list) + (sym_return_val_size, sym_return_val_index): Ditto. + * valops.c: Include cp-support.h. + * Makefile.in (cp-support.o): Depend on dictionary_h, objfiles_h, + frame_h, and block_h. + (valops.o): Depend on cp_support_h. + +2003-06-12 Corinna Vinschen + + * h8300-tdep.c: Add H8SX registers. Drop E_NUM_REGS entirely, + substitute by NUM_REGS throughout. + (h8300_register_name): Only care for H8/300 and H8/300H registers. + (h8300s_register_name): New function for H8S registers. + (h8300sx_register_name): Ditto for H8SX registers. + (h8300_print_register): Revise register printing, avoid depending + on 32 bit long. + (h8300_register_byte): Only care for H8/300 registers. + (h8300h_register_byte): New function for any other architecture. + (h8300_register_raw_size): Remove. + (h8300_register_virtual_type): Revise to return actually useful + type. + (h8300_extract_struct_value_address): Only care for H8/300 registers. + (h8300h_extract_struct_value_address): New function for any other + architecture. + (h8300_gdbarch_init): Add h8300sxn. Call set_gdbarch_num_regs, + set_gdbarch_register_name, set_gdbarch_register_byte, + set_gdbarch_ptr_bit and set_gdbarch_addr_bit architecture dependent. + Remove calls to set_gdbarch_deprecated_register_size, + set_gdbarch_deprecated_register_bytes, set_gdbarch_register_raw_size, + set_gdbarch_deprecated_max_register_raw_size, + set_gdbarch_register_virtual_size and + set_gdbarch_deprecated_max_register_virtual_size entirely. + Call set_gdbarch_long_long_bit, set_gdbarch_double_bit and + set_gdbarch_long_double_bit. + +2003-06-11 Jeff Johnston + + * doublest.c (convert_doublest_to_floatformat): When dealing + with the implied integer bit, only alter mant_bits if we are + processing a full 32 bits of mantissa. + +2003-06-11 David Carlton + + * dictionary.h: New. + * dictionary.c: New. + * block.h: Add opaque declaration for struct dictionary. + (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', + 'sym' members. + (BLOCK_DICT): New macro. + Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, + BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, + BLOCK_SHOULD_SORT. + (ALL_BLOCK_SYMBOLS): Update definition. + * Makefile.in (SFILES): Add dictionary.c. + (dictionary_h): New. + (COMMON_OBS): Add dictionary.o. + (dictionary.o): New. + (ada-lang.o): Depend on dictionary_h. + (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) + (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) + (mi-cmd-stack.o): Ditto. + (gdbtk-cmds.o): Update dependencies. + (gdbtk-stack.o): Ditto. + * ada-lang.c: Include dictionary.h. + (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. + (fill_in_ada_prototype, debug_print_block): Ditto. + (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace + explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable + 'is_sorted'. + * mdebugread.c: Include dictionary.h. + (struct parse_stack): Delete 'maxsyms' member. + (parse_symbol): Update calls to new_block. Delete calls to + shrink_block. Use dictionary methods. + (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. + Update calls to new_symtab. Don't maintain maxsyms data. + (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. + (add_symbol): Just call dict_add_symbol. + (new_symtab): Delete 'maxsyms' argument. + (new_symtab): Update calls to new_block. + (new_block): Delete 'maxsyms' argument; add 'function' argument. + (shrink_block): Delete function. + (fixup_sigtramp): Update call to new_block. Add symbol via + dict_add_symbol. + * jv-lang.c: Include dictionary.h. + (get_java_class_symtab): Set the BLOCK_DICT of the blocks + appropriately. Set class_symtab->free_func. Make sure the + blockvector is big enough to hold two blocks. + (add_class_symtab_symbol): Use dictionary methods. + (free_class_block): New function. + (type_from_class): Replace explicit iteration by + ALL_BLOCK_SYMBOLS. + * symtab.h (struct symtab): Replace 'free_ptr' method by + 'free_func'. + * dwarf2read.c (psymtab_to_symtab_1): Delete call to + sort_symtab_syms. + * dwarfread.c (psymtab_to_symtab_1): Delete call to + sort_symtab_syms. + * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. + Include dictionary.h. + (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. + * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to + sort_symtab_syms. + * objfiles.c: Include dictionary.h. + (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. + * buildsym.c: Include dictionary.h. + (finish_block): Use dictionary methods. + (end_symtab): Set free_func to NULL, not free_ptr. + * tracepoint.c: Include dictionary.h. + (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. + (scope_info): Ditto. + * stack.c: Include dictionary.h. + (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. + (print_block_frame_labels, print_frame_arg_vars) + (print_frame_args): Ditto. + * symmisc.c (free_symtab_block): Use dictionary methods. + (dump_symtab): Ditto. + (free_symtab): Replace use of 'free_ptr' by 'free_func'. + Include dictionary.h. + * symfile.h: Delete declarations of sort_block_syms, + sort_symtab_syms. + * symfile.c (sort_block_syms): Delete. + (sort_symtab_syms): Delete. + * symtab.c: Include dictionary.h. + (lookup_block_symbol): Use dictionary iterators. + (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. + (search_symbols, make_symbol_completion_list): Ditto. + (make_symbol_overload_list): Ditto. + * valops.c (value_of_local): Use dict_empty. + Include dictionary.h. + +2003-06-11 J. Brobecker + + * win32-nat.c (solib_symbols_add): Fix a small compilation error. + +2003-06-11 David Carlton + + * block.h (BLOCK_SHOULD_SORT): Delete. + * symtab.c (lookup_block_symbol): Don't worry about sorted linear + blocks. + * ada-lang.c (ada_add_block_symbols): Ditto. + * symfile.c (sort_block_syms): Delete. + (sort_symtab_syms): Ditto. + * symfile.h: Delete sort_symtabs_syms and sort_block_syms + declarations. + * coffread.c (coff_symfile_read): Don't call sort_symtab_syms. + * dbxread.c (dbx_psymtab_to_symtab_1): Ditto. + * dwarf2read.c (psymtab_to_symtab_1): Ditto. + * dwarfread.c (psymtab_to_symtab_1): Ditto. + * hpread.c (hpread_psymtab_to_symtab_1): Ditto. + * mdebugread.c (psymtab_to_symtab_1): Ditto. + * xcoffread.c (xcoff_psymtab_to_symtab_1): Ditto. + +2003-06-11 Jeff Johnston + + * ia64-tdep.c (ia64_gdbarch_init): Set number of long double + bits to 128. + +2003-06-11 Andrew Cagney + + * gdbarch.sh (DEPRECATED_REGISTER_CONVERTIBLE): Deprecate + REGISTER_CONVERTIBLE. + (DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL): Same. + (DEPRECATED_REGISTER_CONVERT_TO_RAW): Same, make "from" constant. + * gdbarch.h, gdbarch.c: Re-generate. + * arch-utils.h (deprecated_register_convertible_not): Rename + generic_register_convertible_not. + * arch-utils.c (deprecated_register_convertible_not): Rename + generic_register_convertible. + (legacy_convert_register_p, legacy_register_to_value): Update. + * sh-tdep.c (sh64_push_arguments): Update. + * m68klinux-tdep.c (m68k_linux_extract_return_value): Update. + * config/m68k/tm-delta68.h (DEPRECATED_EXTRACT_RETURN_VALUE): Update. + * m68klinux-tdep.c (m68k_linux_store_return_value): Update. + * config/m68k/tm-delta68.h (DEPRECATED_STORE_RETURN_VALUE): Update. + * arch-utils.c (legacy_value_to_register): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + (rs6000_register_convert_to_raw): Make parameter "from" const. + * mips-tdep.c (mips_gdbarch_init): Update. + (mips_register_convert_to_raw): Make parameter"virt_buf" const. + * infcmd.c (default_print_registers_info): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + (ia64_register_convert_to_raw): Make parameter "from" const. + * i386-tdep.c (i386_gdbarch_init): Update. + (i386_register_convert_to_raw): Update. + +2003-06-11 Andrew Cagney + + * remote-fileio.c: Include "remote-fileio.h". + * Makefile.in (remote-fileio.o): Update dependencies. + (remote_fileio_h): Fix typo. + +2003-06-11 Andrew Cagney + + * xstormy16-tdep.c (xstormy16_push_return_address): Make static. + (xstormy16_save_dummy_frame_tos): Make static. + (_initialize_xstormy16_tdep): Add declaration. + * vax-tdep.c (_initialize_vax_tdep): Add declaration. + * v850-tdep.c: Make local functions static. + (_initialize_v850_tdep): Add declaration. + * sparc-tdep.c: Make local functions static. + (_initialize_sparc_tdep): Add declaration. + * sh-tdep.c: Make local functions static. + (_initialize_sh_tdep): Add declaration. + * sh3-rom.c (_initialize_sh3_rom): Add declaration. + * s390-tdep.c: Make local functions static. + (_initialize_s390_tdep): Add declaration. + * dbxread.c (find_stab_function_addr): Make static. + * ppc-bdm.c (_initialize_bdm_ppc): Add declaration. + * ocd.c (_initialize_remote_ocd): Add declaration. + * dink32-rom.c (_initialize_dink32_rom): Add declaration. + * ppcbug-rom.c (_initialize_ppcbug_rom): Add declaration. + * ns32k-tdep.c (_initialize_ns32k_tdep): Add declaration. + * ns32knbsd-tdep.c (_initialize_ns32knbsd_tdep): Add declaration. + * mips-tdep.c (_initialize_mips_tdep): Add declaration. + * remote-array.c (_initialize_array): Add declaration. + (_initialize_remote_monitors): Add declaration. + * remote-mips.c: Make local functions static. + (_initialize_remote_mips): Add declaration. + * mcore-tdep.c: Make all local functions static. + (_initialize_mcore_tdep): Add declaration. + * dbug-rom.c (_initialize_dbug_rom): Add declaration. + * abug-rom.c (_initialize_abug_rom): Add declaration. + * rom68k-rom.c (_initialize_rom68k): Add declaration. + * cpu32bug-rom.c (_initialize_cpu32bug_rom): Add declaration. + * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. + * remote-est.c (_initialize_est): Add declaration. + * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. + (m68hc11_call_dummy_address): Make static. + * ia64-tdep.c: Make local functions static. + (_initialize_ia64_tdep): Add declaration. + * solib-legacy.c (_initialize_svr4_lm): Add declaration. + * monitor.c (monitor_wait_filter): Make static. + (_initialize_remote_monitors): Add declaration. + * remote-hms.c (_initialize_remote_hms): Add declaration. + * remote-e7000.c (fetch_regs_from_dump): Make static. + (expect_n): Make static. + (_initialize_remote_e7000): Add declaration. + * ser-e7kpc.c: Always include "defs.h". + (_initialize_ser_e7000pc): Add declaration. + * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. + * cris-tdep.c: Make all but one function static. + (_initialize_cris_tdep): Add declaration. + * solib-svr4.c (_initialize_svr4_solib): Add declaration. + * solib.c (update_solib_list): Make static. + (_initialize_solib): Add declaration. + * avr-tdep.c (avr_breakpoint_from_pc): Make static. + (_initialize_avr_tdep): Add declaration. + * remote-rdi.c (voiddummy): Make static. + (_initialize_remote_rdi): Add declaration. + * arm-tdep.c (_initialize_arm_tdep): Add declaration. + * remote-rdp.c (send_rdp): Make static. + (_initialize_remote_rdp): Add declaration. + * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. + +2003-06-11 Corinna Vinschen + + * remote-fileio.c: Make ari happy. + +2003-06-10 J. Brobecker + + * rs6000-nat.c (child_xfer_memory): Compute the right address when + fetching the trailing bytes of the buffer we are about to write. + +2003-06-10 Andrew Cagney + + * remote-fileio.h (REMOTE_FILEIO_H): Replace FILEIO_H. + * Makefile.in (remote-fileio.o): Update dependencies. + * remote-fileio.c: Include "gdb_wait.h" and "gdb_stat.h". Do not + include , or conditional on USG. + (remote_fio_jmp_buf): Delete global variable. + +2003-06-10 Corinna Vinschen + Martin M. Hunt + + * Makefile.in (REMOTE_OBS): Add remote-fileio.o + (SFILES): Add remote-fileio.c. + Add dependencies for building remote-fileio.o. Add remote-fileio.h to + dependencies for building remote.o. + * remote-fileio.c: New file implementing the remote File-I/O protocol. + * remote-fileio.h: New header file defining remote File-I/O interface. + * remote.c (remote_write_bytes, remote_read_bytes): Remove + static storage class. + (remote_wait, remote_async_wait): Call remote_fileio_request() on + 'F' packet. + (_initialize_remote): Call initialize_remote_fileio(). + * remote.h: Declare remote_write_bytes() and remote_read_bytes(). + * defs.h: Declare gdb_stdin, gdb_stdtargerr and gdb_stdtargin. + * main.c: New ui_file gdb_stdin, gdb_stdtargerr and gdb_stdtargin. + (captured_main): Initialize new ui_files. + * ui-file.c: Add read and fgets input functions. + (ui_file_new): set ui_file_fputs and ui_file_read to null functions. + (null_file_read): New function. + (ui_file_read): New function. + (set_ui_file_read): New function. + (stdio_file_read): New function. + * ui-file.h: New type ui_file_read_ftype. + (set_ui_file_read): Declare. + (ui_file_read): Declare. + +2003-06-09 Andrew Cagney + + * frame.h (deprecated_unwind_get_saved_register): Rename + generic_unwind_get_saved_register, update comments. + * mips-tdep.c (mips_get_saved_register): Update. + * frame.c (deprecated_unwind_get_saved_register): Update. + +2003-06-09 Andrew Cagney + + * vax-tdep.c (vax_frame_locals_address): Delete function. + (vax_gdbarch_init): Do not set frame_locals_address. + * m68hc11-tdep.c (m68hc11_frame_locals_address): Delete function. + (m68hc11_gdbarch_init): Do not set frame_locals_address. + * s390-tdep.c (s390_frame_args_address): Delete function. + (s390_gdbarch_init): Do not set frame_args_address or + frame_locals_address. + * ns32k-tdep.c (ns32k_frame_locals_address): Delete. + (ns32k_gdbarch_init): Do not set frame_locals_address. + * hppa-tdep.c (hppa_frame_args_address): Delete function. + (hppa_frame_locals_address): Delete function. + (hppa_gdbarch_init): Do not set frame_args_address, or + frame_locals_address. + * arm-tdep.c (arm_frame_args_address): Delete. + (arm_frame_locals_address): Delete. + (arm_gdbarch_init): Do not set frame_args_address, or + frame_locals_address. + +2003-06-09 Andrew Cagney + + * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate. + * gdbarch.h, gdbarch.c: Re-generate. + * arch-utils.h (frame_num_args_unknown): Delete both declarations. + * arch-utils.c (frame_num_args_unknown): Delete function. + * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P. + (frame_info): Use FRAME_NUM_ARGS_P. + * arm-tdep.c (arm_frame_num_args): Delete function. + (arm_gdbarch_init): Do not set frame_num_args. + * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete. + * hppa-tdep.c (hppa_frame_num_args): Delete function. + (hppa_gdbarch_init): Do not set frame_num_args. + * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set + frame_num_args to default frame_num_args_unknown. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * mips-tdep.c (mips_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * alpha-tdep.c (alpha_gdbarch_init): Ditto. + +2003-06-09 Andrew Cagney + + * printcmd.c (print_frame_nameless_args): Moved to "stack.c". + (print_frame_args): Moved to "stack.c". + * stack.c: Include "gdb_assert.h". + (print_frame_nameless_args): Moved from "printcmd.c", made static. + (print_frame_args): Moved from "printcmd.c". + * frame.h (print_frame_args): Delete declaration. + * Makefile.in (stack.o): Update dependencies. + +2003-06-08 Andrew Cagney + + * frame.c (get_prev_frame): Remove reference to + frame_args_address_correct in comments. + * frame-base.c (default_frame_args_address): Delete code + conditional on FRAME_ARGS_ADDRESS_CORRECT. + * vax-tdep.c (vax_frame_args_address_correct): Delete. + (vax_frame_args_address): Merge in vax_frame_args_address_correct. + * config/vax/tm-vax.h (FRAME_ARGS_ADDRESS_CORRECT): Delete + (vax_frame_args_address_correct): Delete declaration. + +2003-06-08 Andrew Cagney + + * gdbarch.sh (UNWIND_SP): Add. + * gdbarch.h, gdbarch.c: Re-generate. + * frame.c (frame_sp_unwind): New function. + (get_frame_sp): New function. + * frame.h (get_frame_sp, frame_sp_unwind): Declare. + * regcache.c (read_sp): Rewrite, try each of TARGET_READ_SP, + gdbarch_unwind_sp and SP_REGNUM when looking for the SP register + value. + * d10v-tdep.c (d10v_unwind_sp): Replace d10v_read_sp. + (d10v_gdbarch_init): Set unwind_sp instead of read_sp. + +2003-06-08 Andrew Cagney + + Deprecate BIG_REMOTE_BREAKPOINT, LITTLE_REMOTE_BREAKPOINT and + REMOTE_BREAKPOINT. + * remote.c: Update. + * config/sh/tm-sh.h (DEPRECATED_BIG_REMOTE_BREAKPOINT): Update. + (DEPRECATED_LITTLE_REMOTE_BREAKPOINT): Update. + * config/m68k/tm-sun3.h: Update. + * config/m68k/tm-m68klynx.h: Update. + * config/h8300/tm-h8300.h (DEPRECATED_REMOTE_BREAKPOINT): Update. + + * trad-frame.h (struct trad_frame_saved_reg): Rename "struct + trad_frame". Update comments. + * d10v-tdep.c (struct d10v_unwind_cache): Update. + * trad-frame.c (trad_frame_alloc_saved_regs): Update. + (trad_frame_register_value, trad_frame_prev_register): Update. + +2003-06-08 Andrew Cagney + + * acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen + from GCC's acinclude.m4. + * configure.in: Check for getopt's delcaration. + * aclocal.m4, config.in, configure: Re-generate. + * main.c (error_init): Delete declaration. + * defs.h (error_init): Declare. + * rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static. + (rs6000_convert_from_func_ptr_addr): Make static. + (_initialize_rs6000_tdep): Add declaration. + * cli/cli-cmds.c (dont_repeat): Delete declaration. + (show_commands, set_verbose, show_history): Delete declaration. + * top.h (set_verbose): Add declaration. + (show_history, set_history, show_commands): Add declaration. + (do_restore_instream_cleanup): Add declaration. + * objc-lang.c (specialcmp): Make static. + (print_object_command): Make static. + (find_objc_msgsend): Make static. + (find_objc_msgcall_submethod_helper): Make static. + (find_objc_msgcall_submethod): Make static. + (_initialize_objc_language): Add declaration. + (find_implementation_from_class): Make static. + (find_implementation): Make static. + * objc-exp.y (yylex): Delete lookup_struct_typedef declaration. + * objc-lang.h (lookup_struct_typedef): Add declaration. + * cli/cli-interp.c (_initialize_cli_interp): Add declaration. + * cli/cli-script.c (clear_hook_in_cleanup): Make static. + (do_restore_user_call_depth): Make static. + (do_restore_instream_cleanup): Delete declaration. + (dont_repeat): Delete declaration. + * cli/cli-decode.c (add_abbrev_cmd): Delete function. + * cli/cli-dump.c (_initialize_cli_dump): Add declaration. + * reggroups.c (_initialize_reggroup): Add declaration. + * cp-support.c (_initialize_cp_support): Add declaration. + * cp-abi.c (_initialize_cp_abi): Add declaration. + * hpacc-abi.c (_initialize_hpacc_abi): Add declaration. + * gnu-v3-abi.c (gnuv3_baseclass_offset): Make static. + (_initialize_gnu_v3_abi): Add declaration. + * gnu-v2-abi.c (gnuv2_value_rtti_type): Make static. + (_initialize_gnu_v2_abi): Add declaration. + * frame-base.c (_initialize_frame_base): Add declaration. + * doublest.c (floatformat_from_length): Make static. + * frame-unwind.c (_initialize_frame_unwind): Add declaration. + * frame.c (create_sentinel_frame): Make static. + (_initialize_frame): Add declaration. + * top.c (do_catch_errors): Make static. + (gdb_rl_operate_and_get_next_completion): Make static. + * typeprint.c: Include "typeprint.h". + * sentinel-frame.c (sentinel_frame_prev_register): Make static. + (sentinel_frame_this_id): Make static. + * p-valprint.c (_initialize_pascal_valprint): Add declaration. + * ui-out.c (make_cleanup_ui_out_begin_end): Delete function. + * dwarf2-frame.c (dwarf2_frame_cache): Make static. + * p-exp.y (push_current_type, pop_current_type): ISO C declaration. + * dwarf2expr.h (dwarf_expr_context): ISO C declaration. + * maint.c (maintenance_print_architecture): Make static. + * signals/signals.c (_initialize_signals): Add declaration. + * std-regs.c (_initialize_frame_reg): Add declaration. + * jv-exp.y (push_variable): ISO C definition. + (push_qualified_expression_name): Ditto. + * memattr.c (_initialize_mem): Add declaration. + * remote.c (remote_check_watch_resources): Make static. + (remote_stopped_by_watchpoint): Make static. + (remote_stopped_data_address): Make static. + * d10v-tdep.c (nr_dmap_regs): Make static. + (a0_regnum): Make static. + (d10v_frame_unwind_cache): Make static. + (d10v_frame_p): Make static. + * osabi.c (show_osabi): Make static. + (_initialize_gdb_osabi): Add extern declaration. + * gdbtypes.c (make_qualified_type): Make static. + (safe_parse_type): Make static. + * macrocmd.c (_initialize_macrocmd): Add extern declaration. + * macrotab.c (macro_bcache_free): Make static. + * interps.c (interp_set_quiet): Make static. + (interpreter_exec_cmd): Make static. + * stack.h (select_frame_command): New file. + * stack.c: Include "stack.h". + (select_frame_command_wrapper): Delete function. + (select_frame_command): Make global. + * infcall.c: Include "infcall.h". + * linespec.c: Include "linespec.h". + * symfile.c (sections_overlap): Make static. + * cp-support.h (cp_initialize_namespace): ISO C declaration. + * charset.c (_initialize_charset): Add missing prototype. + * regcache.c (init_legacy_regcache_descr): Make static. + (do_regcache_xfree): Make static. + (regcache_xfer_part): Make static. + (_initialize_regcache): Add missing prototype. + * breakpoint.c (parse_breakpoint_sals): Make static. + (breakpoint_sals_to_pc): Make static. + * interps.h (clear_interpreter_hooks): ISO C declaration. + * Makefile.in (stack_h): Define. + (stack.o, typeprint.o, mi-main.o): Update dependencies. + (mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies. + +2003-06-08 Andrew Cagney + + * Makefile.in (d10v-tdep.o): Update dependencies. + (SFILES): Add trad-frame.c. + (trad_frame_h): Define. + (COMMON_OBS): Add trad-frame.o. + (trad-frame.o): Specify dependencies. + * d10v-tdep.c: Include "trad-frame.h". + (saved_regs_unwinder): Delete function. + (d10v_frame_prev_register): Use trad_frame_prev_register. + (struct d10v_unwind_cache): Change type of "saved_regs" to "struct + trad_frame", delete "regs" and "prev_sp". + (prologue_find_regs): Use trad-frame. + * trad-frame.h, trad-frame.c: New files. + +2003-06-08 Mark Kettenis + + * dwarf2cfi.c, dwarf2cfi.h: Remove. + +2003-06-07 Adam Fedor + + * gdb/objc-lang.c (FETCH_ARGUMENT): Remove macro. + (OBJC_FETCH_POINTER_ARGUMENT): Shorthand macro for + using FETCH_POINTER_ARGUMENT with Objective-C method arguments. + (find_implementation, resolve_msgsend, resolve_msgsend_stret, + resolve_msgsend_super, resolve_msgsend_super_stret): + Use it. + +2003-06-07 Andrew Cagney + + * symfile.h: Re-indent, clean up comments. + +2003-06-07 Andrew Cagney + + * inferior.h (deprecated_write_sp): Replace + generic_target_write_sp. + * regcache.c (deprecated_write_sp): Replace + generic_target_write_sp. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * config/pa/tm-hppa.h (DEPRECATED_DUMMY_WRITE_SP): Update. + +2003-06-07 Andrew Cagney + + * dwarf2-frame.c (dwarf2_frame_cache): Add comments on PC_REGNUM. + Assert that PC_REGNUM is valid. + (dwarf2_frame_prev_register): Add comments on SP_REGNUM. + +2003-06-07 Andrew Cagney + + * gdbarch.sh (TARGET_READ_SP): Add predicate, delete default. + * gdbarch.h, gdbarch.c: Regenerate. + * mn10300-tdep.c: Include "gdb_assert.h". + (mn10300_read_fp): New function. + (mn10300_gdbarch_init): Set deprecated_target_read_fp to + mn10300_read_fp. Do not set read_sp to generic_target_read_sp. + * ia64-tdep.c: Include "gdb_assert.h". + (ia64_read_fp): New function. + (ia64_gdbarch_init): Set deprecated_target_read_fp to + ia64_read_sp. Do not set read_sp to generic_target_read_sp. + * regcache.c (generic_target_read_sp): Delete function. + (read_sp): Try TARGET_READ_SP and SP_REGNUM for the SP register. + * inferior.h (generic_target_read_sp): Delete declaration. + * frv-tdep.c (frv_gdbarch_init): Do not set read_sp to + generic_target_read_sp. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto + * sh-tdep.c (sh_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * Makefile.in (mn10300-tdep.o, ia64-tdep.o): Update dependencies. + +2003-06-07 Andrew Cagney + + * gdbarch.sh: Comment each field of startup_gdbarch. + * gdbarch.h, gdbarch.c: Re-generate. + +2003-06-07 Andrew Cagney + + * gdbarch.sh (TARGET_READ_PC): Add predicate, remove default. + * gdbarch.h, gdbarch.c: Re-generate. + * regcache.c: Update comments on read_pc et.al. + (generic_target_read_pc): Delete function. + (read_pc_pid): Try TARGET_READ_PC and PC_REGNUM for a PC register. + * inferior.h (generic_target_read_pc): Delete declaration. + * frv-tdep.c (frv_gdbarch_init): Do not set read_pc to + generic_target_read_pc. + * sparc-tdep.c (sparc_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + +2003-06-07 Andrew Cagney + + * elfread.c (elf_symtab_read): Replace "special_local_sym_p" and + "index" with "special_local_sect". Use strcmp instead of STREQ. + Append period to coments. + +2003-06-06 Mark Mitchell + + * elfread.c (elf_symtab_read): Avoid use of SECT_OFF_MAX. + (elfstab_offset_sections): Likewise. + * gdb-stabs.h (stab_section_info): Likewise. + * i386-interix-tdep.c (pei_adjust_objfile_offsets): Likewise. + * objfiles.c (objfile_relocate): Likewise. + * pa64solib.c (pa64_solib_add_solib_objfile): Likewise. + * remote.c (get_offsets): Likewise. + (remote_cisco_objfile_relocate): Likewise. + * somread.c (som_symfile_offsets): Likewise. + * symfile.c (alloc_section_addr_info): New function. + (build_section_addr_info_from_section_tab): Use it. + (free_section_addr_info): Adjust. + (default_symfile_offsets): Avoid use of SECT_OFF_MAX. + (syms_from_objfile): Allocate local_addr dynamically. + (symbol_file_add_with_addrs_or_offsets): Allocate orig_addrs + dynamically. + (add_symbol_file_command): Allocate sect_opts dynamically. + (reread_symbols): Avoid use of SECT_OFF_MAX. + * symfile.h (section_addr_info): Do not use MAX_SECTIONS. + (alloc_section_addr_info): Declare it. + * symtab.h (SIZEOF_SECTION_OFFSETS): Remove. + * win32-nat.c (solib_symbols_add): Allocate section_addrs + dynamically. + * xcoffread.c (xcoff_symfile_offsets): Avoid use of SECT_OFF_MAX. + +2003-06-06 Andrew Cagney + + * d10v-tdep.c (struct d10v_unwind_cache): Delete "return_pc". + (d10v_frame_unwind_cache): Do not set "return_pc". + +2003-06-06 Michael Snyder + + * h8300-tdep.c: Make tidy (long lines). + 2003-06-06 Michal Ludvig * x86-64-tdep.c (x86_64_fill_fxsave): Pass correct regnums @@ -202,13 +1086,6 @@ 2003-06-02 Andrew Cagney - * alpha-tdep.c (alpha_gdbarch_init): Set convert_register_p, - register_to_value, and value_to_register, instead of - register_convertible, register_convert_to_raw, and - register_convert_to_virtual. - * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. - * ia64-tdep.c (ia64_gdbarch_init): Ditto. - * i386-tdep.c (i386_gdbarch_init): Ditto. * sparc-tdep.c (sparc_print_registers): Delete call to REGISTER_CONVERTIBLE. (sparc_gdbarch_init): Do not set register_convertible. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 823fa46..6a34d2f 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -400,7 +400,7 @@ SER_HARDWIRE = @SER_HARDWIRE@ # The `remote' debugging target is supported for most architectures, # but not all (e.g. 960) -REMOTE_OBS = remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o +REMOTE_OBS = remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o remote-fileio.o # This is remote-sim.o if a simulator is to be linked in. SIM_OBS = @@ -513,7 +513,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ charset.c cli-out.c coffread.c coff-pe-read.c \ complaints.c completer.c corefile.c \ cp-abi.c cp-support.c cp-namespace.c cp-valprint.c \ - dbxread.c demangle.c disasm.c doublest.c dummy-frame.c \ + dbxread.c demangle.c dictionary.c disasm.c doublest.c dummy-frame.c \ dwarfread.c dwarf2expr.c dwarf2loc.c dwarf2read.c dwarf2-frame.c \ elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \ f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \ @@ -535,12 +535,14 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ objc-exp.y objc-lang.c \ objfiles.c osabi.c observer.c \ p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \ - regcache.c reggroups.c remote.c \ + regcache.c reggroups.c remote.c remote-fileio.c \ scm-exp.c scm-lang.c scm-valprint.c \ sentinel-frame.c \ serial.c ser-unix.c source.c \ stabsread.c stack.c std-regs.c symfile.c symmisc.c symtab.c \ - target.c thread.c top.c tracepoint.c typeprint.c \ + target.c thread.c top.c tracepoint.c \ + trad-frame.c \ + typeprint.c \ tui/tui.c tui/tui.h tui/tuiCommand.c tui/tuiCommand.h \ tui/tuiData.c tui/tuiData.h tui/tuiDataWin.c tui/tuiDataWin.h \ tui/tuiDisassem.c tui/tuiDisassem.h tui/tuiGeneralWin.c \ @@ -631,6 +633,7 @@ dcache_h = dcache.h defs_h = defs.h $(config_h) $(gdb_locale_h) $(gdb_signals_h) $(ansidecl_h) \ $(libiberty_h) $(progress_h) $(bfd_h) $(tui_h) $(ui_file_h) $(xm_h) \ $(nm_h) $(tm_h) $(fopen_same_h) $(gdbarch_h) $(arch_utils_h) +dictionary_h = dictionary.h disasm_h = disasm.h doublest_h = doublest.h $(floatformat_h) dst_h = dst.h @@ -708,6 +711,7 @@ regcache_h = regcache.h reggroups_h = reggroups.h remote_utils_h = remote-utils.h $(target_h) remote_h = remote.h +remote_fileio_h = remote-fileio.h scm_lang_h = scm-lang.h $(scm_tags_h) scm_tags_h = scm-tags.h sentinel_frame_h = sentinel-frame.h @@ -724,11 +728,13 @@ source_h = source.h sparcnbsd_tdep_h = sparcnbsd-tdep.h srec_h = srec.h stabsread_h = stabsread.h +stack_h = stack.h symfile_h = symfile.h symtab_h = symtab.h target_h = target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h) terminal_h = terminal.h top_h = top.h +trad_frame_h = trad-frame.h infttrace_h = infttrace.h tracepoint_h = tracepoint.h typeprint_h = typeprint.h @@ -838,7 +844,7 @@ TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR) COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ charset.o disasm.o dummy-frame.o \ source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \ - block.o symtab.o symfile.o symmisc.o linespec.o \ + block.o symtab.o symfile.o symmisc.o linespec.o dictionary.o \ infcall.o \ infcmd.o infrun.o \ expprint.o environ.o stack.o thread.o \ @@ -871,7 +877,8 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ frame-base.o \ gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o \ cp-namespace.o \ - reggroups.o + reggroups.o \ + trad-frame.o OBS = $(COMMON_OBS) $(ANNOTATE_OBS) @@ -1495,7 +1502,7 @@ ada-lang.o: ada-lang.c $(gdb_string_h) $(demangle_h) $(defs_h) $(symtab_h) \ $(gdbtypes_h) $(gdbcmd_h) $(expression_h) $(parser_defs_h) \ $(language_h) $(c_lang_h) $(inferior_h) $(symfile_h) $(objfiles_h) \ $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(ui_out_h) $(block_h) \ - $(infcall_h) + $(infcall_h) $(dictionary_h) ada-tasks.o: ada-tasks.c $(defs_h) $(command_h) $(value_h) $(language_h) \ $(inferior_h) $(symtab_h) $(target_h) $(gdbcore_h) $(gregset_h) \ $(ada_lang_h) @@ -1545,10 +1552,10 @@ arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ $(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \ $(doublest_h) $(arm_tdep_h) $(symtab_h) $(symfile_h) $(objfiles_h) \ - $(osabi_h) + $(solib_svr4_h) $(osabi_h) arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \ $(gdbcore_h) $(symfile_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) \ - $(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) $(osabi_h) \ + $(doublest_h) $(value_h) $(arch_utils_h) $(osabi_h) \ $(arm_tdep_h) $(sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \ $(elf_arm_h) $(gdb_assert_h) armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \ @@ -1580,7 +1587,7 @@ buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \ $(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \ $(bcache_h) $(filenames_h) $(macrotab_h) $(demangle_h) $(buildsym_h) \ - $(stabsread_h) $(block_h) $(cp_support_h) + $(stabsread_h) $(block_h) $(cp_support_h) $(dictionary_h) builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(gdb_assert_h) c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ @@ -1604,7 +1611,8 @@ coffread.o: coffread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(demangle_h) \ $(breakpoint_h) $(bfd_h) $(gdb_obstack_h) $(gdb_string_h) \ $(coff_internal_h) $(libcoff_h) $(symfile_h) $(objfiles_h) \ $(buildsym_h) $(gdb_stabs_h) $(stabsread_h) $(complaints_h) \ - $(target_h) $(gdb_assert_h) $(block_h) $(coff_pe_read_h) + $(target_h) $(gdb_assert_h) $(block_h) $(dictionary_h) \ + $(coff_pe_read_h) coff-pe-read.o: coff-pe-read.c $(bfd_h) $(defs_h) $(symtab_h) \ $(gdbtypes_h) $(symfile_h) $(objfiles_h) $(coff_pe_read_h) complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdb_assert_h) \ @@ -1629,7 +1637,8 @@ cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) \ cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \ $(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h) cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \ - $(demangle_h) $(gdb_assert_h) $(gdbcmd_h) + $(demangle_h) $(gdb_assert_h) $(gdbcmd_h) $(dictionary_h) \ + $(objfiles_h) $(frame_h) $(block_h) cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(command_h) $(gdbcmd_h) \ $(demangle_h) $(annotate_h) $(gdb_string_h) $(c_lang_h) $(target_h) \ @@ -1643,9 +1652,9 @@ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \ d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(frame_base_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) \ - $(remote_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \ - $(gdb_assert_h) $(disasm_h) + $(objfiles_h) $(language_h) $(arch_utils_h) $(regcache_h) $(remote_h) \ + $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) $(disasm_h) \ + $(trad_frame_h) $(gdb_assert_h) dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(regcache_h) $(m68k_tdep_h) dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \ @@ -1658,6 +1667,8 @@ dcache.o: dcache.c $(defs_h) $(dcache_h) $(gdbcmd_h) $(gdb_string_h) \ delta68-nat.o: delta68-nat.c $(defs_h) demangle.o: demangle.c $(defs_h) $(command_h) $(gdbcmd_h) $(demangle_h) \ $(gdb_string_h) +dictionary.o: dictionary.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \ + $(buildsym_h) $(gdb_assert_h) $(dictionary_h) dink32-rom.o: dink32-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(symfile_h) $(inferior_h) $(regcache_h) disasm.o: disasm.c $(defs_h) $(gdb_string_h) $(target_h) $(value_h) \ @@ -1844,7 +1855,7 @@ ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \ ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(arch_utils_h) ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(floatformat_h) $(regcache_h) $(doublest_h) \ - $(value_h) $(objfiles_h) $(elf_common_h) $(elf_bfd_h) + $(value_h) $(gdb_assert_h) $(objfiles_h) $(elf_common_h) $(elf_bfd_h) inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \ $(event_top_h) $(inf_loop_h) $(remote_h) infcall.o: infcall.c $(defs_h) $(breakpoint_h) $(target_h) $(regcache_h) \ @@ -1880,7 +1891,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \ - $(jv_lang_h) $(gdbcore_h) $(block_h) $(demangle_h) + $(jv_lang_h) $(gdbcore_h) $(block_h) $(demangle_h) $(dictionary_h) jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \ $(c_lang_h) $(cp_abi_h) @@ -1896,8 +1907,8 @@ language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \ $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ - $(symfile_h) $(objfiles_h) $(demangle_h) $(value_h) $(completer_h) \ - $(cp_abi_h) $(source_h) $(parser_defs_h) $(block_h) $(objc_lang_h) + $(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \ + $(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) $(objc_lang_h) linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \ $(cli_decode_h) $(gdb_string_h) @@ -1961,7 +1972,7 @@ mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \ mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(symfile_h) $(objfiles_h) $(gdb_obstack_h) $(buildsym_h) \ $(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \ - $(block_h) \ + $(block_h) $(dictionary_h) \ $(coff_sym_h) $(coff_symconst_h) $(gdb_stat_h) $(gdb_string_h) \ $(bfd_h) $(coff_ecoff_h) $(libaout_h) $(aout_aout64_h) \ $(aout_stab_gnu_h) $(expression_h) $(language_h) @@ -1998,9 +2009,9 @@ mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ mn10200-tdep.o: mn10200-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) \ $(symfile_h) $(regcache_h) -mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ - $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) \ - $(symfile_h) $(regcache_h) $(arch_utils_h) +mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ + $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) $(symfile_h) \ + $(regcache_h) $(arch_utils_h) $(gdb_assert_h) monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \ $(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) $(inferior_h) \ $(gdb_regex_h) $(srec_h) $(regcache_h) @@ -2022,7 +2033,7 @@ objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \ $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) \ - $(block_h) + $(block_h) $(dictionary_h) observer.o: observer.c $(observer_h) $(defs_h) ocd.o: ocd.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ $(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) \ @@ -2148,7 +2159,10 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \ $(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) $(gdb_stabs_h) \ $(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) $(gdb_assert_h) \ $(event_loop_h) $(event_top_h) $(inf_loop_h) $(serial_h) \ - $(gdbcore_h) $(solib_h) + $(gdbcore_h) $(solib_h) $(remote-fileio_h) +remote-fileio.o: remote-fileio.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) \ + $(remote_h) $(gdb_fileio_h) $(gdb_wait_h) $(gdb_stat_h) \ + $(remote_fileio_h) rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h) rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ @@ -2259,8 +2273,9 @@ stabsread.o: stabsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(gdb_obstack_h) \ $(doublest_h) $(stabsread_h) $(cp_abi_h) $(cp_support_h) stack.o: stack.c $(defs_h) $(gdb_string_h) $(value_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(language_h) $(frame_h) $(gdbcmd_h) \ - $(gdbcore_h) $(target_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \ - $(annotate_h) $(ui_out_h) $(source_h) $(block_h) + $(gdbcore_h) $(target_h) $(source_h) $(breakpoint_h) $(demangle_h) \ + $(inferior_h) $(annotate_h) $(ui_out_h) $(block_h) $(stack_h) \ + $(gdb_assert_h) $(dictionary_h) standalone.o: standalone.c $(gdb_stat_h) $(defs_h) $(symtab_h) $(frame_h) \ $(inferior_h) $(gdb_wait_h) std-regs.o: std-regs.c $(defs_h) $(builtin_regs_h) $(frame_h) $(gdbtypes_h) \ @@ -2281,13 +2296,13 @@ symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \ $(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \ $(gdb_obstack_h) $(language_h) $(bcache_h) $(gdb_string_h) \ - $(readline_h) $(block_h) $(gdb_regex_h) + $(readline_h) $(block_h) $(gdb_regex_h) $(dictionary_h) symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \ $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \ $(language_h) $(demangle_h) $(inferior_h) $(linespec_h) \ $(filenames_h) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \ - $(cp_abi_h) $(source_h) $(block_h) $(objc_lang_h) + $(cp_abi_h) $(source_h) $(block_h) $(objc_lang_h) $(dictionary_h) target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \ $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \ $(gdb_wait_h) $(dcache_h) $(regcache_h) @@ -2308,10 +2323,12 @@ tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \ $(expression_h) $(gdbcmd_h) $(value_h) $(target_h) $(language_h) \ $(gdb_string_h) $(inferior_h) $(tracepoint_h) $(remote_h) \ $(linespec_h) $(regcache_h) $(completer_h) $(gdb_events_h) \ - $(block_h) $(ax_h) $(ax_gdb_h) $(readline_h) + $(block_h) $(ax_h) $(ax_gdb_h) $(readline_h) $(dictionary_h) +trad-frame.o: trad-frame.c $(defs_h) $(frame_h) $(trad_frame_h) $(regcache_h) typeprint.o: typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(command_h) \ - $(gdbcmd_h) $(target_h) $(language_h) $(cp_abi_h) $(gdb_string_h) + $(gdbcmd_h) $(target_h) $(language_h) $(cp_abi_h) $(typeprint_h) \ + $(gdb_string_h) ui-file.o: ui-file.c $(defs_h) $(ui_file_h) $(gdb_string_h) ui-out.o: ui-out.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \ $(ui_out_h) $(gdb_assert_h) @@ -2333,7 +2350,7 @@ valarith.o: valarith.c $(defs_h) $(value_h) $(symtab_h) $(gdbtypes_h) \ valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \ $(inferior_h) $(gdbcore_h) $(target_h) $(demangle_h) $(language_h) \ $(gdbcmd_h) $(regcache_h) $(cp_abi_h) $(gdb_string_h) \ - $(gdb_assert_h) $(block_h) + $(gdb_assert_h) $(block_h) $(dictionary_h) $(cp_support_h) valprint.o: valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(language_h) \ $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h) @@ -2354,9 +2371,8 @@ win32-nat.o: win32-nat.c $(defs_h) $(tm_h) $(frame_h) $(inferior_h) \ $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) wince-stub.o: wince-stub.c $(wince_stub_h) wince.o: wince.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcore_h) \ - $(command_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \ - $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(wince_stub_h) \ - $(regcache_h) + $(command_h) $(buildsym_h) $(symfile_h) $(objfiles_h) $(gdb_string_h) \ + $(gdbthread_h) $(gdbcmd_h) $(wince_stub_h) $(regcache_h) $(mips_tdep_h) wrapper.o: wrapper.c $(defs_h) $(value_h) $(wrapper_h) x86-64-linux-nat.o: x86-64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(gregset_h) \ @@ -2502,9 +2518,10 @@ gdbtk-bp.o: $(srcdir)/gdbtk/generic/gdbtk-bp.c \ gdbtk-cmds.o: $(srcdir)/gdbtk/generic/gdbtk-cmds.c \ $(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-cmds.h \ - $(defs_h) $(symtab_h) $(inferior_h) \ - $(command_h) $(bfd_h) $(top_h) $(symfile_h) $(objfiles_h) $(target_h) \ - $(gdb_string_h) $(tracepoint_h) $(source_h) $(regcache_h) + $(defs_h) $(inferior_h) $(source_h) $(symfile_h) $(objfiles_h) \ + $(gdbcore_h) $(demangle_h) $(linespec_h) $(tui_file_h) $(top_h) \ + $(annotate_h) $(block_h) $(dictionary_h) $(gdb_string_h) \ + $(dis_asm_h) $(gdbcmd_h) $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \ $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \ $(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-cmds.c \ @@ -2545,8 +2562,8 @@ gdbtk-register.o: $(srcdir)/gdbtk/generic/gdbtk-register.c \ gdbtk-stack.o: $(srcdir)/gdbtk/generic/gdbtk-stack.c \ $(srcdir)/gdbtk/generic/gdbtk.h $(srcdir)/gdbtk/generic/gdbtk-cmds.h \ $(srcdir)/gdbtk/generic/gdbtk-wrapper.h \ - $(defs_h) $(frame_h) $(value_h) $(target_h) $(breakpoint_h) \ - $(linespec_h) + $(defs_h) $(target_h) $(breakpoint_h) $(linespec_h) \ + $(block_h) $(dictionary_h) $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \ $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) \ $(GDBTK_CFLAGS) $(srcdir)/gdbtk/generic/gdbtk-stack.c \ @@ -2587,7 +2604,8 @@ mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c $(defs_h) $(inferior_h) $(value_h) \ $(environ_h) $(command_h) $(ui_out_h) $(top_h) $(gdb_string_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-env.c mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \ - $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h) + $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h) $(stack_h) \ + $(dictionary_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \ $(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h) @@ -2685,7 +2703,7 @@ tuiDataWin.o: $(srcdir)/tui/tuiDataWin.c $(config_h) $(defs_h) $(tui_h) \ tuiDisassem.o: $(srcdir)/tui/tuiDisassem.c $(config_h) $(defs_h) $(symtab_h) \ $(breakpoint_h) $(frame_h) $(value_h) $(tui_h) $(tuiData_h) \ $(tuiWin_h) $(tuiLayout_h) $(tuiSourceWin_h) $(tuiStack_h) \ - $(tui_file_h) + $(tui_file_h) $(disasm_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tuiDisassem.c tuiGeneralWin.o: $(srcdir)/tui/tuiGeneralWin.c $(config_h) $(defs_h) \ $(tui_h) $(tuiData_h) $(tuiGeneralWin_h) $(tuiWin_h) diff --git a/gdb/abug-rom.c b/gdb/abug-rom.c index d3a9c2e..543f702 100644 --- a/gdb/abug-rom.c +++ b/gdb/abug-rom.c @@ -164,6 +164,8 @@ abug_open (char *args, int from_tty) monitor_open (args, &abug_cmds, from_tty); } +extern initialize_file_ftype _initialize_abug_rom; /* -Wmissing-prototypes */ + void _initialize_abug_rom (void) { diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index d3c00ae..a85ce02 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -943,3 +943,56 @@ AC_DEFUN([AC_DEFINE_DIR], [ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) ]) +dnl See whether we need a declaration for a function. +dnl The result is highly dependent on the INCLUDES passed in, so make sure +dnl to use a different cache variable name in this macro if it is invoked +dnl in a different context somewhere else. +dnl gcc_AC_CHECK_DECL(SYMBOL, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]]) +AC_DEFUN(gcc_AC_CHECK_DECL, +[AC_MSG_CHECKING([whether $1 is declared]) +AC_CACHE_VAL(gcc_cv_have_decl_$1, +[AC_TRY_COMPILE([$4], +[#ifndef $1 +char *(*pfn) = (char *(*)) $1 ; +#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")]) +if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then + AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3]) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl Arrange to define HAVE_DECL_ to 0 or 1 as appropriate. +dnl gcc_AC_CHECK_DECLS(SYMBOLS, +dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]]) +AC_DEFUN(gcc_AC_CHECK_DECLS, +[for ac_func in $1 +do +changequote(, )dnl + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +changequote([, ])dnl +gcc_AC_CHECK_DECL($ac_func, + [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2], + [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3], +dnl It is possible that the include files passed in here are local headers +dnl which supply a backup declaration for the relevant prototype based on +dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test +dnl will always return success. E.g. see libiberty.h's handling of +dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to +dnl 1 so that any local headers used do not provide their own prototype +dnl during this test. +#undef $ac_tr_decl +#define $ac_tr_decl 1 + $4 +) +done +dnl Automatically generate config.h entries via autoheader. +if test x = y ; then + patsubst(translit([$1], [a-z], [A-Z]), [\w+], + [AC_DEFINE([HAVE_DECL_\&], 1, + [Define to 1 if we found this declaration otherwise define to 0.])])dnl +fi +]) + diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 index 51e94f2..40399a6 100644 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -951,6 +951,59 @@ AC_DEFUN([AC_DEFINE_DIR], [ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) ]) +dnl See whether we need a declaration for a function. +dnl The result is highly dependent on the INCLUDES passed in, so make sure +dnl to use a different cache variable name in this macro if it is invoked +dnl in a different context somewhere else. +dnl gcc_AC_CHECK_DECL(SYMBOL, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]]) +AC_DEFUN(gcc_AC_CHECK_DECL, +[AC_MSG_CHECKING([whether $1 is declared]) +AC_CACHE_VAL(gcc_cv_have_decl_$1, +[AC_TRY_COMPILE([$4], +[#ifndef $1 +char *(*pfn) = (char *(*)) $1 ; +#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")]) +if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then + AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3]) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl Arrange to define HAVE_DECL_ to 0 or 1 as appropriate. +dnl gcc_AC_CHECK_DECLS(SYMBOLS, +dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]]) +AC_DEFUN(gcc_AC_CHECK_DECLS, +[for ac_func in $1 +do +changequote(, )dnl + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +changequote([, ])dnl +gcc_AC_CHECK_DECL($ac_func, + [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2], + [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3], +dnl It is possible that the include files passed in here are local headers +dnl which supply a backup declaration for the relevant prototype based on +dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test +dnl will always return success. E.g. see libiberty.h's handling of +dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to +dnl 1 so that any local headers used do not provide their own prototype +dnl during this test. +#undef $ac_tr_decl +#define $ac_tr_decl 1 + $4 +) +done +dnl Automatically generate config.h entries via autoheader. +if test x = y ; then + patsubst(translit([$1], [a-z], [A-Z]), [\w+], + [AC_DEFINE([HAVE_DECL_\&], 1, + [Define to 1 if we found this declaration otherwise define to 0.])])dnl +fi +]) + # Add --enable-maintainer-mode option to configure. # From Jim Meyering diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c403af2..eaa5281 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -40,6 +40,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ui-out.h" #include "block.h" #include "infcall.h" +#include "dictionary.h" struct cleanup *unresolved_names; @@ -3433,7 +3434,8 @@ symtab_for_sym (struct symbol *sym) struct objfile *objfile; struct block *b; struct symbol *tmp_sym; - int i, j; + struct dict_iterator iter; + int j; ALL_SYMTABS (objfile, s) { @@ -3447,10 +3449,10 @@ symtab_for_sym (struct symbol *sym) case LOC_BLOCK: case LOC_CONST_BYTES: b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, tmp_sym) if (sym == tmp_sym) + ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym) return s; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, tmp_sym) if (sym == tmp_sym) + ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym) return s; break; default: @@ -3474,7 +3476,7 @@ symtab_for_sym (struct symbol *sym) j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1) { b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), j); - ALL_BLOCK_SYMBOLS (b, i, tmp_sym) if (sym == tmp_sym) + ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym) return s; } break; @@ -3947,13 +3949,12 @@ ada_add_block_symbols (struct block *block, const char *name, domain_enum domain, struct objfile *objfile, int wild) { - int i; + struct dict_iterator iter; int name_len = strlen (name); /* A matching argument symbol, if any. */ struct symbol *arg_sym; /* Set true when we find a matching non-argument symbol */ int found_sym; - int is_sorted = BLOCK_SHOULD_SORT (block); struct symbol *sym; arg_sym = NULL; @@ -3961,7 +3962,7 @@ ada_add_block_symbols (struct block *block, const char *name, if (wild) { struct symbol *sym; - ALL_BLOCK_SYMBOLS (block, i, sym) + ALL_BLOCK_SYMBOLS (block, iter, sym) { if (SYMBOL_DOMAIN (sym) == domain && wild_match (name, name_len, DEPRECATED_SYMBOL_NAME (sym))) @@ -3990,45 +3991,14 @@ ada_add_block_symbols (struct block *block, const char *name, } else { - if (is_sorted) - { - int U; - i = 0; - U = BLOCK_NSYMS (block) - 1; - while (U - i > 4) - { - int M = (U + i) >> 1; - struct symbol *sym = BLOCK_SYM (block, M); - if (DEPRECATED_SYMBOL_NAME (sym)[0] < name[0]) - i = M + 1; - else if (DEPRECATED_SYMBOL_NAME (sym)[0] > name[0]) - U = M - 1; - else if (strcmp (DEPRECATED_SYMBOL_NAME (sym), name) < 0) - i = M + 1; - else - U = M; - } - } - else - i = 0; - - for (; i < BLOCK_BUCKETS (block); i += 1) - for (sym = BLOCK_BUCKET (block, i); sym != NULL; sym = sym->hash_next) + ALL_BLOCK_SYMBOLS (block, iter, sym) { if (SYMBOL_DOMAIN (sym) == domain) { int cmp = strncmp (name, DEPRECATED_SYMBOL_NAME (sym), name_len); - if (cmp < 0) - { - if (is_sorted) - { - i = BLOCK_BUCKETS (block); - break; - } - } - else if (cmp == 0 - && is_name_suffix (DEPRECATED_SYMBOL_NAME (sym) + name_len)) + if (cmp == 0 + && is_name_suffix (DEPRECATED_SYMBOL_NAME (sym) + name_len)) { switch (SYMBOL_CLASS (sym)) { @@ -4065,30 +4035,8 @@ ada_add_block_symbols (struct block *block, const char *name, { arg_sym = NULL; found_sym = 0; - if (is_sorted) - { - int U; - i = 0; - U = BLOCK_NSYMS (block) - 1; - while (U - i > 4) - { - int M = (U + i) >> 1; - struct symbol *sym = BLOCK_SYM (block, M); - if (DEPRECATED_SYMBOL_NAME (sym)[0] < '_') - i = M + 1; - else if (DEPRECATED_SYMBOL_NAME (sym)[0] > '_') - U = M - 1; - else if (strcmp (DEPRECATED_SYMBOL_NAME (sym), "_ada_") < 0) - i = M + 1; - else - U = M; - } - } - else - i = 0; - for (; i < BLOCK_BUCKETS (block); i += 1) - for (sym = BLOCK_BUCKET (block, i); sym != NULL; sym = sym->hash_next) + ALL_BLOCK_SYMBOLS (block, iter, sym) { struct symbol *sym = BLOCK_SYM (block, i); @@ -4104,16 +4052,8 @@ ada_add_block_symbols (struct block *block, const char *name, cmp = strncmp (name, DEPRECATED_SYMBOL_NAME (sym) + 5, name_len); } - if (cmp < 0) - { - if (is_sorted) - { - i = BLOCK_BUCKETS (block); - break; - } - } - else if (cmp == 0 - && is_name_suffix (DEPRECATED_SYMBOL_NAME (sym) + name_len + 5)) + if (cmp == 0 + && is_name_suffix (DEPRECATED_SYMBOL_NAME (sym) + name_len + 5)) { switch (SYMBOL_CLASS (sym)) { @@ -4160,7 +4100,7 @@ fill_in_ada_prototype (struct symbol *func) { struct block *b; int nargs, nsyms; - int i; + struct dict_iterator iter; struct type *ftype; struct type *rtype; size_t max_fields; @@ -4186,7 +4126,7 @@ fill_in_ada_prototype (struct symbol *func) max_fields = 8; TYPE_FIELDS (ftype) = (struct field *) xmalloc (sizeof (struct field) * max_fields); - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { GROW_VECT (TYPE_FIELDS (ftype), max_fields, nargs + 1); @@ -4759,8 +4699,8 @@ debug_print_lines (struct linetable *lt) static void debug_print_block (struct block *b) { - int i; - struct symbol *i; + struct dict_iterator iter; + struct symbol *sym; fprintf (stderr, "Block: %p; [0x%lx, 0x%lx]", b, BLOCK_START (b), BLOCK_END (b)); @@ -4769,10 +4709,8 @@ debug_print_block (struct block *b) fprintf (stderr, "\n"); fprintf (stderr, "\t Superblock: %p\n", BLOCK_SUPERBLOCK (b)); fprintf (stderr, "\t Symbols:"); - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { - if (i > 0 && i % 4 == 0) - fprintf (stderr, "\n\t\t "); fprintf (stderr, " %s", DEPRECATED_SYMBOL_NAME (sym)); } fprintf (stderr, "\n"); diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index f88725c..d523577 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -579,13 +579,6 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache, } } -static int -alpha_use_struct_convention (int gcc_p, struct type *type) -{ - /* Structures are returned by ref in extra arg0. */ - return 1; -} - static const unsigned char * alpha_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) @@ -1516,9 +1509,9 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fp0_regnum (gdbarch, ALPHA_FP0_REGNUM); set_gdbarch_register_name (gdbarch, alpha_register_name); - set_gdbarch_register_byte (gdbarch, alpha_register_byte); - set_gdbarch_register_raw_size (gdbarch, alpha_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, alpha_register_virtual_size); + set_gdbarch_deprecated_register_byte (gdbarch, alpha_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, alpha_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, alpha_register_virtual_size); set_gdbarch_register_type (gdbarch, alpha_register_type); set_gdbarch_cannot_fetch_register (gdbarch, alpha_cannot_fetch_register); @@ -1537,11 +1530,10 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, print_insn_alpha); /* Call info. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention); + set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value); set_gdbarch_store_return_value (gdbarch, alpha_store_return_value); set_gdbarch_extract_struct_value_address (gdbarch, @@ -1552,7 +1544,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Methods for saving / extracting a dummy frame's ID. */ set_gdbarch_unwind_dummy_id (gdbarch, alpha_unwind_dummy_id); - set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); /* Return the unwound PC value. */ set_gdbarch_unwind_pc (gdbarch, alpha_unwind_pc); @@ -1591,6 +1582,8 @@ alpha_dwarf2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info); } +extern initialize_file_ftype _initialize_alpha_tdep; /* -Wmissing-prototypes */ + void _initialize_alpha_tdep (void) { diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 48f7f7e..9fa9cea 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -73,6 +73,13 @@ legacy_store_return_value (struct type *type, struct regcache *regcache, int +always_use_struct_convention (int gcc_p, struct type *value_type) +{ + return 1; +} + + +int legacy_register_sim_regno (int regnum) { /* Only makes sense to supply raw registers. */ @@ -232,14 +239,7 @@ default_double_format (struct gdbarch *gdbarch) /* Misc helper functions for targets. */ int -frame_num_args_unknown (struct frame_info *fi) -{ - return -1; -} - - -int -generic_register_convertible_not (int num) +deprecated_register_convertible_not (int num) { return 0; } @@ -442,21 +442,21 @@ legacy_pc_in_sigtramp (CORE_ADDR pc, char *name) int legacy_convert_register_p (int regnum) { - return REGISTER_CONVERTIBLE (regnum); + return DEPRECATED_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); + DEPRECATED_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); + DEPRECATED_REGISTER_CONVERT_TO_RAW (type, regnum, from, to); } @@ -882,7 +882,7 @@ gdbarch_info_init (struct gdbarch_info *info) /* */ -extern initialize_file_ftype _initialize_gdbarch_utils; +extern initialize_file_ftype _initialize_gdbarch_utils; /* -Wmissing-prototypes */ void _initialize_gdbarch_utils (void) diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 27f219b..8fce252 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -32,14 +32,10 @@ struct gdbarch_info; extern int gdbarch_debug; /* Fallback for register convertible. */ -extern gdbarch_register_convertible_ftype generic_register_convertible_not; +extern gdbarch_deprecated_register_convertible_ftype deprecated_register_convertible_not; extern CORE_ADDR generic_cannot_extract_struct_value_address (char *dummy); -/* Helper function for targets that don't know how my arguments are - being passed */ -extern gdbarch_frame_num_args_ftype frame_num_args_unknown; - /* Implementation of extract return value that grubs around in the register cache. */ extern gdbarch_extract_return_value_ftype legacy_extract_return_value; @@ -47,6 +43,10 @@ extern gdbarch_extract_return_value_ftype legacy_extract_return_value; /* Implementation of store return value that grubs the register cache. */ extern gdbarch_store_return_value_ftype legacy_store_return_value; +/* To return any structure or union type by value, store it at the + address passed as an invisible first argument to the function. */ +extern gdbarch_use_struct_convention_ftype always_use_struct_convention; + /* Frameless functions not identifable. */ extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not; @@ -81,11 +81,6 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); extern const struct floatformat *default_float_format (struct gdbarch *gdbarch); extern const struct floatformat *default_double_format (struct gdbarch *gdbarch); -/* Helper function for targets that don't know how my arguments are - being passed */ -extern int frame_num_args_unknown (struct frame_info *fi); - - /* The following DEPRECATED interfaces are for pre- multi-arch legacy targets. */ diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 8a4bdf6..5ea3ef2 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -27,6 +27,7 @@ #include "frame.h" #include "regcache.h" #include "doublest.h" +#include "solib-svr4.h" #include "osabi.h" #include "arm-tdep.h" @@ -376,6 +377,49 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p) } +/* Fetch, and possibly build, an appropriate link_map_offsets structure + for ARM linux targets using the struct offsets defined in . + Note, however, that link.h is not actually referred to in this file. + Instead, the relevant structs offsets were obtained from examining + link.h. (We can't refer to link.h from this file because the host + system won't necessarily have it, or if it does, the structs which + it defines will refer to the host system, not the target). */ + +static struct link_map_offsets * +arm_linux_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = 0; + + if (lmp == 0) + { + lmp = &lmo; + + lmo.r_debug_size = 8; /* Actual size is 20, but this is all we + need. */ + + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 20; /* Actual size is 552, but this is all we + need. */ + + 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; +} + static CORE_ADDR skip_hurd_resolver (CORE_ADDR pc) { @@ -530,6 +574,9 @@ arm_linux_init_abi (struct gdbarch_info info, tdep->jb_pc = ARM_LINUX_JB_PC; tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE; + set_solib_svr4_fetch_link_map_offsets + (gdbarch, arm_linux_svr4_fetch_link_map_offsets); + set_gdbarch_deprecated_call_dummy_words (gdbarch, arm_linux_call_dummy_words); set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (arm_linux_call_dummy_words)); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 4aaf151..3f2f13c 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -33,7 +33,6 @@ #include "doublest.h" #include "value.h" #include "arch-utils.h" -#include "solib-svr4.h" #include "osabi.h" #include "arm-tdep.h" @@ -306,28 +305,6 @@ arm_frameless_function_invocation (struct frame_info *fi) return frameless; } -/* The address of the arguments in the frame. */ -static CORE_ADDR -arm_frame_args_address (struct frame_info *fi) -{ - return get_frame_base (fi); -} - -/* The address of the local variables in the frame. */ -static CORE_ADDR -arm_frame_locals_address (struct frame_info *fi) -{ - return get_frame_base (fi); -} - -/* The number of arguments being passed in the frame. */ -static int -arm_frame_num_args (struct frame_info *fi) -{ - /* We have no way of knowing. */ - return -1; -} - /* A typical Thumb prologue looks like this: push {r7, lr} add sp, sp, #-28 @@ -2690,49 +2667,6 @@ arm_othernames (char *names, int n) set_disassembly_style (); } -/* Fetch, and possibly build, an appropriate link_map_offsets structure - for ARM linux targets using the struct offsets defined in . - Note, however, that link.h is not actually referred to in this file. - Instead, the relevant structs offsets were obtained from examining - link.h. (We can't refer to link.h from this file because the host - system won't necessarily have it, or if it does, the structs which - it defines will refer to the host system, not the target). */ - -struct link_map_offsets * -arm_linux_svr4_fetch_link_map_offsets (void) -{ - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = 0; - - if (lmp == 0) - { - lmp = &lmo; - - lmo.r_debug_size = 8; /* Actual size is 20, but this is all we - need. */ - - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; /* Actual size is 552, but this is all we - need. */ - - 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; -} - /* Test whether the coff symbol specific value corresponds to a Thumb function. */ @@ -2944,9 +2878,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, arm_frameless_function_invocation); set_gdbarch_deprecated_frame_saved_pc (gdbarch, arm_frame_saved_pc); - set_gdbarch_frame_args_address (gdbarch, arm_frame_args_address); - set_gdbarch_frame_locals_address (gdbarch, arm_frame_locals_address); - set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs); set_gdbarch_deprecated_pop_frame (gdbarch, arm_pop_frame); @@ -2976,17 +2907,17 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_fp_regnum (gdbarch, ARM_FP_REGNUM); /* ??? */ set_gdbarch_sp_regnum (gdbarch, ARM_SP_REGNUM); set_gdbarch_pc_regnum (gdbarch, ARM_PC_REGNUM); - set_gdbarch_register_byte (gdbarch, arm_register_byte); + set_gdbarch_deprecated_register_byte (gdbarch, arm_register_byte); set_gdbarch_deprecated_register_bytes (gdbarch, (NUM_GREGS * INT_REGISTER_RAW_SIZE + NUM_FREGS * FP_REGISTER_RAW_SIZE + NUM_SREGS * STATUS_REGISTER_SIZE)); set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SREGS); - set_gdbarch_register_raw_size (gdbarch, arm_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, arm_register_virtual_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, arm_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, arm_register_virtual_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, FP_REGISTER_RAW_SIZE); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE); - set_gdbarch_register_virtual_type (gdbarch, arm_register_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, arm_register_type); /* Internal <-> external register number maps. */ set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno); @@ -3079,6 +3010,8 @@ arm_init_abi_apcs (struct gdbarch_info info, /* Place-holder. */ } +extern initialize_file_ftype _initialize_arm_tdep; /* -Wmissing-prototypes */ + void _initialize_arm_tdep (void) { diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 792f3fa..df1ffdd 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -311,7 +311,7 @@ avr_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr) || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) { store_unsigned_integer (buf, TYPE_LENGTH (type), - avr_convert_iaddr_to_raw (addr)); + avr_convert_iaddr_to_raw (addr >> 1)); } else { @@ -338,7 +338,7 @@ avr_pointer_to_address (struct type *type, const void *buf) if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) - return avr_make_iaddr (addr); + return avr_make_iaddr (addr << 1); else return avr_make_saddr (addr); } @@ -411,15 +411,6 @@ avr_remote_translate_xfer_address (struct gdbarch *gdbarch, *targ_len = nr_bytes; } -/* Function pointers obtained from the target are half of what gdb expects so - multiply by 2. */ - -static CORE_ADDR -avr_convert_from_func_ptr_addr (CORE_ADDR addr) -{ - return addr * 2; -} - /* avr_scan_prologue is also used as the deprecated_frame_init_saved_regs(). @@ -1095,7 +1086,7 @@ avr_push_arguments (int nargs, struct value **args, CORE_ADDR sp, it as a NOP. Thus, it should be ok. Since the avr is currently a remote only target, this shouldn't be a problem (I hope). TRoth/2003-05-14 */ -const unsigned char * +static const unsigned char * avr_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr) { static unsigned char avr_break_insn [] = { 0x98, 0x95 }; @@ -1172,12 +1163,12 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, avr_register_name); set_gdbarch_deprecated_register_size (gdbarch, 1); set_gdbarch_deprecated_register_bytes (gdbarch, AVR_NUM_REG_BYTES); - set_gdbarch_register_byte (gdbarch, avr_register_byte); - set_gdbarch_register_raw_size (gdbarch, avr_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, avr_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, avr_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); - set_gdbarch_register_virtual_size (gdbarch, avr_register_virtual_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, avr_register_virtual_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4); - set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, avr_register_virtual_type); set_gdbarch_print_insn (gdbarch, print_insn_avr); @@ -1213,10 +1204,6 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_address (gdbarch, avr_frame_address); set_gdbarch_frame_locals_address (gdbarch, avr_frame_address); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, avr_saved_pc_after_call); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - - set_gdbarch_convert_from_func_ptr_addr (gdbarch, - avr_convert_from_func_ptr_addr); return gdbarch; } @@ -1311,6 +1298,8 @@ avr_io_reg_read_command (char *args, int from_tty) } } +extern initialize_file_ftype _initialize_avr_tdep; /* -Wmissing-prototypes */ + void _initialize_avr_tdep (void) { diff --git a/gdb/block.h b/gdb/block.h index 8334a3b..aa69a89 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -29,6 +29,7 @@ struct symtab; struct block_namespace_info; struct using_direct; struct obstack; +struct dictionary; /* All of the name-scope contours of the program are represented by `struct block' objects. @@ -77,6 +78,10 @@ struct block struct block *superblock; + /* This is used to store the symbols in the block. */ + + struct dictionary *dict; + /* Used for language-specific info. */ union @@ -104,34 +109,6 @@ struct block of this flag is undefined. */ unsigned char gcc_compile_flag; - - /* The symbols for this block are either in a simple linear list or - in a simple hashtable. Blocks which correspond to a function - (which have a list of symbols corresponding to arguments) use - a linear list, as do some older symbol readers (currently only - mdebugread and dstread). Other blocks are hashed. - - The hashtable uses the same hash function as the minsym hashtables, - found in minsyms.c:minsym_hash_iw. Symbols are hashed based on - their demangled name if appropriate, and on their name otherwise. - The hash function ignores space, and stops at the beginning of the - argument list if any. - - The table is laid out in NSYMS/5 buckets and symbols are chained via - their hash_next field. */ - - /* If this is really a hashtable of the symbols, this flag is 1. */ - - unsigned char hashtable; - - /* Number of local symbols. */ - - int nsyms; - - /* The symbols. If some of them are arguments, then they must be - in the order in which we would like to print them. */ - - struct symbol *sym[1]; }; #define BLOCK_START(bl) (bl)->startaddr @@ -139,36 +116,15 @@ struct block #define BLOCK_FUNCTION(bl) (bl)->function #define BLOCK_SUPERBLOCK(bl) (bl)->superblock #define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag +#define BLOCK_DICT(bl) (bl)->dict #define BLOCK_NAMESPACE(bl) (bl)->language_specific.cplus_specific.namespace -#define BLOCK_HASHTABLE(bl) (bl)->hashtable - -/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only. */ -#define BLOCK_NSYMS(bl) (bl)->nsyms -#define BLOCK_SYM(bl, n) (bl)->sym[n] - -/* For blocks with a hashtable, but these are valid for non-hashed blocks as - well - each symbol will appear to be one bucket by itself. */ -#define BLOCK_BUCKETS(bl) (bl)->nsyms -#define BLOCK_BUCKET(bl, n) (bl)->sym[n] - -/* Macro used to set the size of a hashtable for N symbols. */ -#define BLOCK_HASHTABLE_SIZE(n) ((n)/5 + 1) - -/* Macro to loop through all symbols in a block BL, in no particular order. - i counts which bucket we are in, and sym points to the current symbol. */ - -#define ALL_BLOCK_SYMBOLS(bl, i, sym) \ - for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++) \ - for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym); \ - (sym) = (sym)->hash_next) -/* Nonzero if symbols of block BL should be sorted alphabetically. - Don't sort a block which corresponds to a function. If we did the - sorting would have to preserve the order of the symbols for the - arguments. Also don't sort any block that we chose to hash. */ +/* Macro to loop through all symbols in a block BL, in no particular + order. ITER helps keep track of the iteration, and should be a + struct dict_iterator. SYM points to the current symbol. */ -#define BLOCK_SHOULD_SORT(bl) (! BLOCK_HASHTABLE (bl) \ - && BLOCK_FUNCTION (bl) == NULL) +#define ALL_BLOCK_SYMBOLS(block, iter, sym) \ + ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym) struct blockvector { diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a92ae8c..0739efd 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4607,7 +4607,7 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, addresses found. ADDR_STRING contains a vector of (canonical) address strings. ARG points to the end of the SAL. */ -void +static void parse_breakpoint_sals (char **address, struct symtabs_and_lines *sals, char ***addr_string) @@ -4674,7 +4674,7 @@ parse_breakpoint_sals (char **address, /* Convert each SAL into a real PC. Verify that the PC can be inserted as a breakpoint. If it can't throw an error. */ -void +static void breakpoint_sals_to_pc (struct symtabs_and_lines *sals, char *address) { diff --git a/gdb/buildsym.c b/gdb/buildsym.c index d3c9ddf..f0d75ce 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -45,6 +45,7 @@ #include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */ #include "block.h" #include "cp-support.h" +#include "dictionary.h" /* Ask buildsym.h to define the vars it normally declares `extern'. */ #define EXTERN @@ -229,62 +230,22 @@ finish_block (struct symbol *symbol, struct pending **listhead, register struct block *block; register struct pending_block *pblock; struct pending_block *opblock; - register int i; - register int j; - - /* Count the length of the list of symbols. */ - for (next = *listhead, i = 0; - next; - i += next->nsyms, next = next->next) - { - /* EMPTY */ ; - } - - /* Copy the symbols into the block. */ + /* Initialize the block's dictionary. */ if (symbol) { block = (struct block *) - obstack_alloc (&objfile->symbol_obstack, - (sizeof (struct block) + - ((i - 1) * sizeof (struct symbol *)))); - BLOCK_NSYMS (block) = i; - for (next = *listhead; next; next = next->next) - for (j = next->nsyms - 1; j >= 0; j--) - { - BLOCK_SYM (block, --i) = next->symbol[j]; - } + obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); + BLOCK_DICT (block) = dict_create_linear (&objfile->symbol_obstack, + *listhead); } else { - int htab_size = BLOCK_HASHTABLE_SIZE (i); - block = (struct block *) - obstack_alloc (&objfile->symbol_obstack, - (sizeof (struct block) + - ((htab_size - 1) * sizeof (struct symbol *)))); - for (j = 0; j < htab_size; j++) - { - BLOCK_BUCKET (block, j) = 0; - } - BLOCK_BUCKETS (block) = htab_size; - for (next = *listhead; next; next = next->next) - { - for (j = next->nsyms - 1; j >= 0; j--) - { - struct symbol *sym; - unsigned int hash_index; - const char *name = SYMBOL_DEMANGLED_NAME (next->symbol[j]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (next->symbol[j]); - hash_index = msymbol_hash_iw (name); - hash_index = hash_index % BLOCK_BUCKETS (block); - sym = BLOCK_BUCKET (block, hash_index); - BLOCK_BUCKET (block, hash_index) = next->symbol[j]; - next->symbol[j]->hash_next = sym; - } - } + obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); + BLOCK_DICT (block) = dict_create_hashed (&objfile->symbol_obstack, + *listhead); } BLOCK_START (block) = start; @@ -300,9 +261,9 @@ finish_block (struct symbol *symbol, struct pending **listhead, if (symbol) { struct type *ftype = SYMBOL_TYPE (symbol); + struct dict_iterator iter; SYMBOL_BLOCK_VALUE (symbol) = block; BLOCK_FUNCTION (block) = symbol; - BLOCK_HASHTABLE (block) = 0; if (TYPE_NFIELDS (ftype) <= 0) { @@ -311,7 +272,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, parameter symbols. */ int nparams = 0, iparams; struct symbol *sym; - ALL_BLOCK_SYMBOLS (block, i, sym) + ALL_BLOCK_SYMBOLS (block, iter, sym) { switch (SYMBOL_CLASS (sym)) { @@ -348,9 +309,12 @@ finish_block (struct symbol *symbol, struct pending **listhead, TYPE_FIELDS (ftype) = (struct field *) TYPE_ALLOC (ftype, nparams * sizeof (struct field)); - for (i = iparams = 0; iparams < nparams; i++) + iparams = 0; + ALL_BLOCK_SYMBOLS (block, iter, sym) { - sym = BLOCK_SYM (block, i); + if (iparams == nparams) + break; + switch (SYMBOL_CLASS (sym)) { case LOC_ARG: @@ -394,7 +358,6 @@ finish_block (struct symbol *symbol, struct pending **listhead, else { BLOCK_FUNCTION (block) = NULL; - BLOCK_HASHTABLE (block) = 1; } /* Now "free" the links of the list, and empty the list. */ @@ -476,6 +439,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, record_pending_block (objfile, block, opblock); } + /* Record BLOCK on the list of all blocks in the file. Put it after OPBLOCK, or at the beginning if opblock is NULL. This puts the block in the list after all its subblocks. @@ -1031,7 +995,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) symtab->dirname = NULL; } symtab->free_code = free_linetable; - symtab->free_ptr = NULL; + symtab->free_func = NULL; /* Use whatever language we have been using for this subfile, not the one that was deduced in allocate_symtab diff --git a/gdb/charset.c b/gdb/charset.c index 0062e28..c311447 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -1163,6 +1163,7 @@ target_char_to_host (int target_char, int *host_char) /* The charset.c module initialization function. */ +extern initialize_file_ftype _initialize_charset; /* -Wmissing-prototype */ void _initialize_charset (void) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 108329a..999ae72 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -48,18 +48,6 @@ #define GDBINIT_FILENAME ".gdbinit" #endif -/* From gdb/top.c */ - -extern void dont_repeat (void); - -extern void set_verbose (char *, int, struct cmd_list_element *); - -extern void show_history (char *, int); - -extern void set_history (char *, int); - -extern void show_commands (char *, int); - /* Prototypes for local command functions */ static void complete_command (char *, int); diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 2a6d196..be516c9 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -183,20 +183,6 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int), return c; } -/* Same as above, except that the abbrev_flag is set. */ -/* Note: Doesn't seem to be used anywhere currently. */ - -struct cmd_list_element * -add_abbrev_cmd (char *name, enum command_class class, void (*fun) (char *, int), - char *doc, struct cmd_list_element **list) -{ - register struct cmd_list_element *c - = add_cmd (name, class, fun, doc, list); - - c->abbrev_flag = 1; - return c; -} - /* Deprecates a command CMD. REPLACEMENT is the name of the command which should be used in place of this command, or NULL if no such command exists. diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 6bd40e0..7b88975 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -698,6 +698,8 @@ binary_append_command (char *cmd, int from_tty) help_list (binary_append_cmdlist, "append binary ", -1, gdb_stdout); } +extern initialize_file_ftype _initialize_cli_dump; /* -Wmissing-prototypes */ + void _initialize_cli_dump (void) { diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index e2116e7..45679f0 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -118,6 +118,8 @@ safe_execute_command (struct ui_out *uiout, char *command, int from_tty) /* standard gdb initialization hook */ +extern initialize_file_ftype _initialize_cli_interp; /* -Wmissing-prototypes */ + void _initialize_cli_interp (void) { diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index d68c365..0f789bb 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -34,12 +34,6 @@ #include "cli/cli-decode.h" #include "cli/cli-script.h" -/* From gdb/top.c */ - -extern void dont_repeat (void); - -extern void do_restore_instream_cleanup (void *stream); - /* Prototypes for local functions */ static struct cleanup * @@ -216,7 +210,7 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd, /* Handle pre-post hooks. */ -void +static void clear_hook_in_cleanup (void *data) { struct cmd_list_element *c = data; @@ -248,7 +242,7 @@ execute_cmd_post_hook (struct cmd_list_element *c) } /* Execute the command in CMD. */ -void +static void do_restore_user_call_depth (void * call_depth) { int * depth = call_depth; diff --git a/gdb/coffread.c b/gdb/coffread.c index 81def0a..152ec33 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -45,6 +45,7 @@ #include "target.h" #include "gdb_assert.h" #include "block.h" +#include "dictionary.h" #include "coff-pe-read.h" @@ -605,15 +606,6 @@ coff_symfile_read (struct objfile *objfile, int mainline) coff_symtab_read ((long) symtab_offset, num_symbols, objfile); - /* Sort symbols alphabetically within each block. */ - - { - struct symtab *s; - - for (s = objfile->symtabs; s != NULL; s = s->next) - sort_symtab_syms (s); - } - /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ @@ -1423,12 +1415,12 @@ static void patch_opaque_types (struct symtab *s) { register struct block *b; - register int i; + struct dict_iterator iter; register struct symbol *real_sym; /* Go through the per-file symbols only */ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, real_sym) + ALL_BLOCK_SYMBOLS (b, iter, real_sym) { /* Find completed typedefs to use to fix opaque ones. Remove syms from the chain when their types are stored, diff --git a/gdb/config.in b/gdb/config.in index 9fddbef..787afb2 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -441,6 +441,9 @@ Solaris 2.[78] when using GCC. */ #undef _MSE_INT_H +/* Define to 1 if we found this declaration otherwise define to 0. */ +#undef HAVE_DECL_GETOPT + /* Define if sigsetjmp is available. */ #undef HAVE_SIGSETJMP diff --git a/gdb/config/arm/tm-linux.h b/gdb/config/arm/tm-linux.h index bbf566d..51b9d70 100644 --- a/gdb/config/arm/tm-linux.h +++ b/gdb/config/arm/tm-linux.h @@ -30,10 +30,6 @@ #include "config/tm-linux.h" -/* Use target-specific function to define link map offsets. */ -extern struct link_map_offsets *arm_linux_svr4_fetch_link_map_offsets (void); -#define SVR4_FETCH_LINK_MAP_OFFSETS() arm_linux_svr4_fetch_link_map_offsets () - /* Offset to saved PC in sigcontext structure, from */ #define SIGCONTEXT_PC_OFFSET (sizeof(unsigned long) * 18) diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index 736e0f8..e560c64 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -32,7 +32,7 @@ extern int h8300sxmode; #define GDB_TARGET_IS_H8300 /* Needed for remote.c */ -#define REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */ +#define DEPRECATED_REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */ /* Needed for remote-hms.c */ #define CCR_REGNUM 8 /* Needed for remote-e7000.c */ diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index 03172b0..014fc63 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -49,7 +49,7 @@ struct frame_info; #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ - REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \ + DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \ ®BUF[REGISTER_BYTE (FP0_REGNUM)], \ VALBUF); \ else \ @@ -69,7 +69,7 @@ struct frame_info; if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ { \ char raw_buf[REGISTER_RAW_SIZE (FP0_REGNUM)]; \ - REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buf); \ + DEPRECATED_REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buf); \ deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \ raw_buf, REGISTER_RAW_SIZE (FP0_REGNUM)); \ } \ diff --git a/gdb/config/m68k/tm-m68klynx.h b/gdb/config/m68k/tm-m68klynx.h index ed1f6f0..71ed690 100644 --- a/gdb/config/m68k/tm-m68klynx.h +++ b/gdb/config/m68k/tm-m68klynx.h @@ -34,6 +34,6 @@ #include "m68k/tm-m68k.h" /* Disable dumbshit alternate breakpoint mechanism needed by 68k stub. */ -#undef REMOTE_BREAKPOINT +#undef DEPRECATED_REMOTE_BREAKPOINT #endif /* TM_M68KLYNX_H */ diff --git a/gdb/config/m68k/tm-sun3.h b/gdb/config/m68k/tm-sun3.h index 6e978cf..f721dcf 100644 --- a/gdb/config/m68k/tm-sun3.h +++ b/gdb/config/m68k/tm-sun3.h @@ -46,7 +46,7 @@ #include "m68k/tm-m68k.h" /* Disable alternate breakpoint mechanism needed by 68k stub. */ -#undef REMOTE_BREAKPOINT +#undef DEPRECATED_REMOTE_BREAKPOINT /* Offsets (in target ints) into jmp_buf. Not defined by Sun, but at least documented in a comment in ! */ diff --git a/gdb/config/mips/bigmips.mt b/gdb/config/mips/bigmips.mt new file mode 100644 index 0000000..38f03f2 --- /dev/null +++ b/gdb/config/mips/bigmips.mt @@ -0,0 +1,3 @@ +# Target: Big-endian MIPS machine such as Sony News +TDEPFILES= mips-tdep.o +TM_FILE= tm-bigmips.h diff --git a/gdb/config/mips/bigmips64.mt b/gdb/config/mips/bigmips64.mt new file mode 100644 index 0000000..fcb7b21 --- /dev/null +++ b/gdb/config/mips/bigmips64.mt @@ -0,0 +1,3 @@ +# Target: Big-endian MIPS machine such as Sony News +TDEPFILES= mips-tdep.o +TM_FILE= tm-bigmips64.h diff --git a/gdb/config/mips/decstation.mt b/gdb/config/mips/decstation.mt new file mode 100644 index 0000000..1984722 --- /dev/null +++ b/gdb/config/mips/decstation.mt @@ -0,0 +1,3 @@ +# Target: Little-endian MIPS machine such as DECstation. +TDEPFILES= mips-tdep.o +TM_FILE= tm-mips.h diff --git a/gdb/config/mips/littlemips.mt b/gdb/config/mips/littlemips.mt new file mode 100644 index 0000000..1984722 --- /dev/null +++ b/gdb/config/mips/littlemips.mt @@ -0,0 +1,3 @@ +# Target: Little-endian MIPS machine such as DECstation. +TDEPFILES= mips-tdep.o +TM_FILE= tm-mips.h diff --git a/gdb/config/mips/tm-bigmips.h b/gdb/config/mips/tm-bigmips.h new file mode 100644 index 0000000..7a5a6b8 --- /dev/null +++ b/gdb/config/mips/tm-bigmips.h @@ -0,0 +1,20 @@ +/* Copyright 1990, 1994, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips.h" diff --git a/gdb/config/mips/tm-bigmips64.h b/gdb/config/mips/tm-bigmips64.h new file mode 100644 index 0000000..9f171ee --- /dev/null +++ b/gdb/config/mips/tm-bigmips64.h @@ -0,0 +1,22 @@ +/* Target machine parameters for MIPS r4000 + Copyright 1994, 2000 Free Software Foundation, Inc. + Contributed by Ian Lance Taylor (ian@cygnus.com) + + 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 "mips/tm-mips64.h" diff --git a/gdb/config/mips/tm-embed64.h b/gdb/config/mips/tm-embed64.h new file mode 100644 index 0000000..630b8e0 --- /dev/null +++ b/gdb/config/mips/tm-embed64.h @@ -0,0 +1,20 @@ +/* Copyright 1993, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-bigmips64.h" diff --git a/gdb/config/mips/tm-embedl.h b/gdb/config/mips/tm-embedl.h new file mode 100644 index 0000000..d53f5c8 --- /dev/null +++ b/gdb/config/mips/tm-embedl.h @@ -0,0 +1,20 @@ +/* Copyright 1993, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips.h" diff --git a/gdb/config/mips/tm-embedl64.h b/gdb/config/mips/tm-embedl64.h new file mode 100644 index 0000000..c76c612 --- /dev/null +++ b/gdb/config/mips/tm-embedl64.h @@ -0,0 +1,20 @@ +/* Copyright 1993, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips64.h" diff --git a/gdb/config/mips/tm-tx39l.h b/gdb/config/mips/tm-tx39l.h new file mode 100644 index 0000000..81f3b6d --- /dev/null +++ b/gdb/config/mips/tm-tx39l.h @@ -0,0 +1,32 @@ +/* Copyright 1993, 1997, 1999, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips.h" + +#undef MIPS_REGISTER_NAMES +#define MIPS_REGISTER_NAMES \ + { "sr", "lo", "hi", "bad", "cause","pc", \ + "", "", "", "", "", "", "", "", \ + "", "", "", "", "", "", "", "", \ + "", "", "", "", "", "", "", "", \ + "", "", "", "", "", "", "", "", \ + "", "", "", "", \ + "", "", "", "", "", "", "", "", \ + "", "", "config", "cache", "debug", "depc", "epc", "" \ + } diff --git a/gdb/config/mips/tm-vr4100.h b/gdb/config/mips/tm-vr4100.h new file mode 100644 index 0000000..9c4472b --- /dev/null +++ b/gdb/config/mips/tm-vr4100.h @@ -0,0 +1,20 @@ +/* Copyright 1998, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-bigmips64.h" diff --git a/gdb/config/mips/tm-vr4300.h b/gdb/config/mips/tm-vr4300.h new file mode 100644 index 0000000..728c731 --- /dev/null +++ b/gdb/config/mips/tm-vr4300.h @@ -0,0 +1,20 @@ +/* Copyright 1993, 1995, 1996, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-bigmips64.h" diff --git a/gdb/config/mips/tm-vr4300el.h b/gdb/config/mips/tm-vr4300el.h new file mode 100644 index 0000000..e7e5680 --- /dev/null +++ b/gdb/config/mips/tm-vr4300el.h @@ -0,0 +1,20 @@ +/* Copyright 1993, 1995, 1996, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips64.h" diff --git a/gdb/config/mips/tm-vr4xxx.h b/gdb/config/mips/tm-vr4xxx.h new file mode 100644 index 0000000..9c4472b --- /dev/null +++ b/gdb/config/mips/tm-vr4xxx.h @@ -0,0 +1,20 @@ +/* Copyright 1998, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-bigmips64.h" diff --git a/gdb/config/mips/tm-vr4xxxel.h b/gdb/config/mips/tm-vr4xxxel.h new file mode 100644 index 0000000..7f2e4cd --- /dev/null +++ b/gdb/config/mips/tm-vr4xxxel.h @@ -0,0 +1,20 @@ +/* Copyright 1998, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips64.h" diff --git a/gdb/config/mips/tm-vr5000.h b/gdb/config/mips/tm-vr5000.h new file mode 100644 index 0000000..0d68345 --- /dev/null +++ b/gdb/config/mips/tm-vr5000.h @@ -0,0 +1,20 @@ +/* Copyright 1996, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-bigmips64.h" diff --git a/gdb/config/mips/tm-vr5000el.h b/gdb/config/mips/tm-vr5000el.h new file mode 100644 index 0000000..7fae087 --- /dev/null +++ b/gdb/config/mips/tm-vr5000el.h @@ -0,0 +1,20 @@ +/* Copyright 1996, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "mips/tm-mips64.h" diff --git a/gdb/config/mips/vr4100.mt b/gdb/config/mips/vr4100.mt new file mode 100644 index 0000000..c5ae4f9 --- /dev/null +++ b/gdb/config/mips/vr4100.mt @@ -0,0 +1,5 @@ +# Target: Big-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr4100.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/vr4300.mt b/gdb/config/mips/vr4300.mt new file mode 100644 index 0000000..22cb25e --- /dev/null +++ b/gdb/config/mips/vr4300.mt @@ -0,0 +1,5 @@ +# Target: Big-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr4300.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/vr4300el.mt b/gdb/config/mips/vr4300el.mt new file mode 100644 index 0000000..cff7241 --- /dev/null +++ b/gdb/config/mips/vr4300el.mt @@ -0,0 +1,5 @@ +# Target: Little-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr4300el.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/vr4xxx.mt b/gdb/config/mips/vr4xxx.mt new file mode 100644 index 0000000..4c79ec7 --- /dev/null +++ b/gdb/config/mips/vr4xxx.mt @@ -0,0 +1,5 @@ +# Target: Big-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr4xxx.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/vr4xxxel.mt b/gdb/config/mips/vr4xxxel.mt new file mode 100644 index 0000000..5124dd7 --- /dev/null +++ b/gdb/config/mips/vr4xxxel.mt @@ -0,0 +1,5 @@ +# Target: Big-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr4xxxel.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/vr5000.mt b/gdb/config/mips/vr5000.mt new file mode 100644 index 0000000..7a4a915 --- /dev/null +++ b/gdb/config/mips/vr5000.mt @@ -0,0 +1,5 @@ +# Target: Big-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr5000.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/vr5000el.mt b/gdb/config/mips/vr5000el.mt new file mode 100644 index 0000000..99687ed --- /dev/null +++ b/gdb/config/mips/vr5000el.mt @@ -0,0 +1,5 @@ +# Target: Little-endian SIM monitor board. +TDEPFILES= mips-tdep.o remote-mips.o +TM_FILE= tm-vr5000el.h +SIM_OBS = remote-sim.o +SIM = ../sim/mips/libsim.a diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index afc87fa..1ec91d4 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -25,7 +25,7 @@ #include "regcache.h" /* Wonder if this is correct? Should be using push_dummy_call(). */ -#define DEPRECATED_DUMMY_WRITE_SP(SP) generic_target_write_sp (SP) +#define DEPRECATED_DUMMY_WRITE_SP(SP) deprecated_write_sp (SP) #ifndef GDB_MULTI_ARCH #define GDB_MULTI_ARCH 1 diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index a3cc4be..a8d414e 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -292,11 +292,6 @@ extern CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); #endif #if !GDB_MULTI_ARCH -extern int hppa_frame_num_args (struct frame_info *frame); -#define FRAME_NUM_ARGS(fi) hppa_frame_num_args (fi) -#endif - -#if !GDB_MULTI_ARCH #define FRAME_ARGS_SKIP 0 #endif diff --git a/gdb/config/powerpc/nm-ppc64-linux.h b/gdb/config/powerpc/nm-ppc64-linux.h new file mode 100644 index 0000000..5d1c7b6 --- /dev/null +++ b/gdb/config/powerpc/nm-ppc64-linux.h @@ -0,0 +1,27 @@ +/* IBM PowerPC64 native-dependent macros for GDB, the GNU debugger. + Copyright 2003 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef NM_PPC64_LINUX_H + +#include "config/powerpc/nm-linux.h" + +#define PTRACE_ARG3_TYPE void * +#define PTRACE_XFER_TYPE long + +#endif /* NM_PPC64_LINUX_H */ diff --git a/gdb/config/powerpc/ppc64-linux.mh b/gdb/config/powerpc/ppc64-linux.mh new file mode 100644 index 0000000..c7a69ea --- /dev/null +++ b/gdb/config/powerpc/ppc64-linux.mh @@ -0,0 +1,19 @@ +# Host: PowerPC64, running Linux + +XM_FILE= xm-linux.h +XM_CLIBS= + +NAT_FILE= nm-ppc64-linux.h +NATDEPFILES= infptrace.o inftarg.o fork-child.o linux-proc.o \ + ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o \ + gcore.o + +# The PowerPC has severe limitations on TOC size, and uses them even +# for non-PIC code. GDB overflows those tables when compiling with +# -mfull-toc (the default), so we need to ask GCC to use as few TOC +# entries as possible. +MH_CFLAGS= -mminimal-toc + +# The dynamically loaded libthread_db needs access to symbols in the +# gdb executable. +LOADLIBES= -ldl -rdynamic diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h index eba57c0..34d95ca 100644 --- a/gdb/config/powerpc/tm-linux.h +++ b/gdb/config/powerpc/tm-linux.h @@ -48,10 +48,6 @@ extern int at_subroutine_call_instruction_target(); in symfile.c) */ #undef IBM6000_TARGET -extern CORE_ADDR ppc_linux_skip_trampoline_code (CORE_ADDR pc); -#undef SKIP_TRAMPOLINE_CODE -#define SKIP_TRAMPOLINE_CODE(pc) ppc_linux_skip_trampoline_code (pc) - extern int ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name); #undef IN_SIGTRAMP #define IN_SIGTRAMP(pc,func_name) ppc_linux_in_sigtramp (pc,func_name) diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 6ae6085..dfd96c1 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -27,7 +27,7 @@ #define REGISTER_TYPE long /* used in standalone.c */ -#define BIG_REMOTE_BREAKPOINT { 0xc3, 0x20 } /* Used in remote.c */ -#define LITTLE_REMOTE_BREAKPOINT { 0x20, 0xc3 } /* Used in remote.c */ +#define DEPRECATED_BIG_REMOTE_BREAKPOINT { 0xc3, 0x20 } /* Used in remote.c */ +#define DEPRECATED_LITTLE_REMOTE_BREAKPOINT { 0x20, 0xc3 } /* Used in remote.c */ /*#define NOP {0x20, 0x0b}*/ /* Who uses this???*/ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 16f94db..4f8acaf 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -448,10 +448,6 @@ extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *); /* Set VAL to the number of args passed to frame described by FI. Can set VAL to -1, meaning no way to tell. */ -/* We can't tell how many args there are - now that the C compiler delays popping them. */ -#define FRAME_NUM_ARGS(FI) (-1) - /* Return number of bytes at start of arglist that are not really args. */ #define FRAME_ARGS_SKIP 68 diff --git a/gdb/config/vax/tm-vax.h b/gdb/config/vax/tm-vax.h index 22e60a0..f1ed146 100644 --- a/gdb/config/vax/tm-vax.h +++ b/gdb/config/vax/tm-vax.h @@ -24,8 +24,4 @@ #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL -/* XXXJRT not yet under gdbarch control */ -#define FRAME_ARGS_ADDRESS_CORRECT(fi) vax_frame_args_address_correct ((fi)) -extern CORE_ADDR vax_frame_args_address_correct (struct frame_info *); - #endif /* TM_VAX_H */ diff --git a/gdb/configure b/gdb/configure index 11699a2..e27294c 100755 --- a/gdb/configure +++ b/gdb/configure @@ -5304,17 +5304,74 @@ fi done +# ------------------------- # +# Checks for declarations. # +# ------------------------- # + +for ac_func in getopt +do + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 +echo "configure:5316: checking whether $ac_func is declared" >&5 +if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "gcc_cv_have_decl_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "gcc_cv_have_decl_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 ; cat >> confdefs.h <&6 ; cat >> confdefs.h <> confdefs.h <<\EOF +#define HAVE_DECL_GETOPT 1 +EOF +fi + + # ------------------ # # Checks for types. # # ------------------ # echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5313: checking return type of signal handlers" >&5 +echo "configure:5370: 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 @@ -5331,7 +5388,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5355,12 +5412,12 @@ EOF # ------------------------------------- # echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5359: checking for working const" >&5 +echo "configure:5416: 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:5470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5430,21 +5487,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:5434: checking for inline" >&5 +echo "configure:5491: 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:5505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -5477,19 +5534,19 @@ esac # 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:5481: checking for working alloca.h" >&5 +echo "configure:5538: 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:5493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5550: \"$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 @@ -5510,12 +5567,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5514: checking for alloca" >&5 +echo "configure:5571: 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:5604: \"$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 @@ -5575,12 +5632,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5579: checking whether alloca needs Cray hooks" >&5 +echo "configure:5636: 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:5609: checking for $ac_func" >&5 +echo "configure:5666: 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:5694: \"$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 @@ -5660,7 +5717,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5664: checking stack direction for C alloca" >&5 +echo "configure:5721: 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 @@ -5668,7 +5725,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:5748: \"$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 @@ -5712,17 +5769,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:5716: checking for $ac_hdr" >&5 +echo "configure:5773: 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:5726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5783: \"$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* @@ -5751,12 +5808,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5755: checking for $ac_func" >&5 +echo "configure:5812: 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:5840: \"$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 @@ -5804,7 +5861,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:5808: checking for working mmap" >&5 +echo "configure:5865: 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 @@ -5812,7 +5869,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:6013: \"$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 @@ -5975,12 +6032,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:5979: checking for pid_t" >&5 +echo "configure:6036: 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 @@ -6009,17 +6066,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:6013: checking for vfork.h" >&5 +echo "configure:6070: 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:6023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6080: \"$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* @@ -6044,18 +6101,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:6048: checking for working vfork" >&5 +echo "configure:6105: 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:6054: checking for vfork" >&5 +echo "configure:6111: 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:6139: \"$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 @@ -6100,7 +6157,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -6195,7 +6252,7 @@ main() { } } EOF -if { (eval echo configure:6199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6256: \"$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 @@ -6220,12 +6277,12 @@ fi for ac_func in canonicalize_file_name realpath do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6224: checking for $ac_func" >&5 +echo "configure:6281: 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:6309: \"$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 @@ -6275,12 +6332,12 @@ done for ac_func in poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6279: checking for $ac_func" >&5 +echo "configure:6336: 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:6364: \"$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 @@ -6330,12 +6387,12 @@ done for ac_func in pread64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6334: checking for $ac_func" >&5 +echo "configure:6391: 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:6419: \"$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 @@ -6385,12 +6442,12 @@ done for ac_func in sbrk do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6389: checking for $ac_func" >&5 +echo "configure:6446: 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:6474: \"$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 @@ -6440,12 +6497,12 @@ done for ac_func in setpgid setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6444: checking for $ac_func" >&5 +echo "configure:6501: 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:6529: \"$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 @@ -6495,12 +6552,12 @@ done for ac_func in sigaction sigprocmask sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6499: checking for $ac_func" >&5 +echo "configure:6556: 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:6584: \"$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 @@ -6550,12 +6607,12 @@ done for ac_func in socketpair do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6554: checking for $ac_func" >&5 +echo "configure:6611: 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:6639: \"$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 @@ -6605,12 +6662,12 @@ done for ac_func in syscall do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6609: checking for $ac_func" >&5 +echo "configure:6666: 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:6694: \"$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 @@ -6660,7 +6717,7 @@ done if test "$cross_compiling" = no; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6664: checking whether setpgrp takes no argument" >&5 +echo "configure:6721: 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 @@ -6668,7 +6725,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:6749: \"$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 @@ -6713,12 +6770,12 @@ fi else echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6717: checking whether setpgrp takes no argument" >&5 +echo "configure:6774: 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 < @@ -6732,7 +6789,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_func_setpgrp_void=no else @@ -6756,12 +6813,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:6760: checking for sigsetjmp" >&5 +echo "configure:6817: 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 < @@ -6770,7 +6827,7 @@ int main() { sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); ; return 0; } EOF -if { (eval echo configure:6774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_func_sigsetjmp=yes else @@ -6796,12 +6853,12 @@ gdb_use_included_regex=yes # However, if the system regex is GNU regex, then default to *not* # using the included regex. echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6800: checking for GNU regex" >&5 +echo "configure:6857: 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 < int main() { @@ -6811,7 +6868,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:6815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6846,19 +6903,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:6850: checking for r_fs in struct reg" >&5 +echo "configure:6907: 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:6862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_fs=yes else @@ -6878,19 +6935,19 @@ EOF fi echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6 -echo "configure:6882: checking for r_gs in struct reg" >&5 +echo "configure:6939: 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:6894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_gs=yes else @@ -6912,19 +6969,19 @@ fi # See if provides the PTRACE_GETREGS request. echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:6916: checking for PTRACE_GETREGS" >&5 +echo "configure:6973: 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:6928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getregs=yes else @@ -6946,19 +7003,19 @@ fi # See if provides the PTRACE_GETFPXREGS request. echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:6950: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:7007: 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:6962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getfpxregs=yes else @@ -6980,12 +7037,12 @@ fi # See if provides the PT_GETDBREGS request. echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6 -echo "configure:6984: checking for PT_GETDBREGS" >&5 +echo "configure:7041: 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 @@ -6993,7 +7050,7 @@ int main() { PT_GETDBREGS; ; return 0; } EOF -if { (eval echo configure:6997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getdbregs=yes else @@ -7015,12 +7072,12 @@ fi # See if provides the PT_GETXMMREGS request. echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6 -echo "configure:7019: checking for PT_GETXMMREGS" >&5 +echo "configure:7076: 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 @@ -7028,7 +7085,7 @@ int main() { PT_GETXMMREGS; ; return 0; } EOF -if { (eval echo configure:7032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getxmmregs=yes else @@ -7051,19 +7108,19 @@ fi # See if stdint.h provides the uintptr_t type. # Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this. echo $ac_n "checking for uintptr_t in stdint.h""... $ac_c" 1>&6 -echo "configure:7055: checking for uintptr_t in stdint.h" >&5 +echo "configure:7112: checking for uintptr_t in stdint.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_uintptr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { uintptr_t foo = 0; ; return 0; } EOF -if { (eval echo configure:7067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_uintptr_t=yes else @@ -7085,12 +7142,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:7089: checking whether malloc must be declared" >&5 +echo "configure:7146: 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 < @@ -7111,7 +7168,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:7115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -7132,12 +7189,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:7136: checking whether realloc must be declared" >&5 +echo "configure:7193: 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 < @@ -7158,7 +7215,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:7162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -7179,12 +7236,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:7183: checking whether free must be declared" >&5 +echo "configure:7240: 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 < @@ -7205,7 +7262,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:7209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -7226,12 +7283,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:7230: checking whether strerror must be declared" >&5 +echo "configure:7287: 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 < @@ -7252,7 +7309,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:7256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -7273,12 +7330,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:7277: checking whether strdup must be declared" >&5 +echo "configure:7334: 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 < @@ -7299,7 +7356,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:7303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -7320,12 +7377,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:7324: checking whether strstr must be declared" >&5 +echo "configure:7381: 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 < @@ -7346,7 +7403,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:7350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -7367,12 +7424,12 @@ EOF fi echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:7371: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:7428: 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 < @@ -7393,7 +7450,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:7397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_canonicalize_file_name=no else @@ -7419,9 +7476,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:7423: checking for HPUX save_state structure" >&5 +echo "configure:7480: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext < EOF @@ -7436,7 +7493,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -7506,12 +7563,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:7510: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:7567: 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:7581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -7542,12 +7599,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:7546: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:7603: 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:7617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -7578,12 +7635,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:7582: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:7639: 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:7653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -7614,12 +7671,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:7618: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:7675: 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:7689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -7650,12 +7707,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:7654: checking for prgregset_t in sys/procfs.h" >&5 +echo "configure:7711: 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:7725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset_t=yes else @@ -7686,12 +7743,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:7690: checking for prfpregset_t in sys/procfs.h" >&5 +echo "configure:7747: 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:7761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset_t=yes else @@ -7722,12 +7779,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:7726: checking for prgregset32_t in sys/procfs.h" >&5 +echo "configure:7783: 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:7797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset32_t=yes else @@ -7758,12 +7815,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:7762: checking for prfpregset32_t in sys/procfs.h" >&5 +echo "configure:7819: 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:7833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset32_t=yes else @@ -7794,12 +7851,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:7798: checking for lwpid_t in sys/procfs.h" >&5 +echo "configure:7855: 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:7869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpid_t=yes else @@ -7830,12 +7887,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:7834: checking for psaddr_t in sys/procfs.h" >&5 +echo "configure:7891: 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:7905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psaddr_t=yes else @@ -7866,12 +7923,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:7870: checking for prsysent_t in sys/procfs.h" >&5 +echo "configure:7927: 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:7941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prsysent_t=yes else @@ -7902,12 +7959,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:7906: checking for pr_sigset_t in sys/procfs.h" >&5 +echo "configure:7963: 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:7977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigset_t=yes else @@ -7938,12 +7995,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:7942: checking for pr_sigaction64_t in sys/procfs.h" >&5 +echo "configure:7999: 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:8013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes else @@ -7974,12 +8031,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:7978: checking for pr_siginfo64_t in sys/procfs.h" >&5 +echo "configure:8035: 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:8049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes else @@ -8015,7 +8072,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:8019: checking whether prfpregset_t type is broken" >&5 +echo "configure:8076: 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 @@ -8023,7 +8080,7 @@ else gdb_cv_prfpregset_t_broken=yes else cat > conftest.$ac_ext < int main () @@ -8033,7 +8090,7 @@ else return 0; } EOF -if { (eval echo configure:8037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8094: \"$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 @@ -8058,12 +8115,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8062: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:8119: 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 @@ -8076,7 +8133,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -8100,19 +8157,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:8104: checking for member l_addr in struct link_map" >&5 +echo "configure:8161: 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:8116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_l_members=yes else @@ -8134,12 +8191,12 @@ EOF echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:8138: checking for member lm_addr in struct link_map" >&5 +echo "configure:8195: 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 @@ -8147,7 +8204,7 @@ int main() { struct link_map lm; (void) lm.lm_addr; ; return 0; } EOF -if { (eval echo configure:8151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_lm_members=yes else @@ -8169,12 +8226,12 @@ EOF echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6 -echo "configure:8173: checking for member som_addr in struct so_map" >&5 +echo "configure:8230: 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 @@ -8185,7 +8242,7 @@ int main() { struct so_map lm; (void) lm.som_addr; ; return 0; } EOF -if { (eval echo configure:8189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_so_map_with_som_members=yes else @@ -8207,12 +8264,12 @@ EOF echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6 -echo "configure:8211: checking for struct link_map32 in sys/link.h" >&5 +echo "configure:8268: 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 < @@ -8220,7 +8277,7 @@ int main() { struct link_map32 l; ; return 0; } EOF -if { (eval echo configure:8224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map32=yes else @@ -8247,12 +8304,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:8251: checking for long long support in compiler" >&5 +echo "configure:8308: 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:8323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -8284,7 +8341,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:8288: checking for long long support in printf" >&5 +echo "configure:8345: 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 @@ -8292,7 +8349,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:8367: \"$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 @@ -8330,19 +8387,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:8334: checking for long double support in compiler" >&5 +echo "configure:8391: 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:8403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -8364,7 +8421,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:8368: checking for long double support in printf" >&5 +echo "configure:8425: 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 @@ -8372,7 +8429,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:8443: \"$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 @@ -8406,7 +8463,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:8410: checking for long double support in scanf" >&5 +echo "configure:8467: 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 @@ -8414,7 +8471,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext < 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:8428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8485: \"$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 @@ -8449,7 +8506,7 @@ echo "$ac_t""$gdb_cv_scanf_has_long_double" 1>&6 case ${host_os} in aix*) echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6 -echo "configure:8453: checking for -bbigtoc option" >&5 +echo "configure:8510: checking for -bbigtoc option" >&5 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8463,14 +8520,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:8531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -8493,7 +8550,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:8497: checking for HPUX/OSF thread support" >&5 +echo "configure:8554: 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 @@ -8516,7 +8573,7 @@ EOF # because version 0 (present on Solaris 2.4 or earlier) doesn't have # the same API. echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:8520: checking for Solaris thread debugging library" >&5 +echo "configure:8577: 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 @@ -8526,7 +8583,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:8530: checking for dlopen in -ldl" >&5 +echo "configure:8587: 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 @@ -8534,7 +8591,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:8606: \"$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 @@ -8577,17 +8634,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:8581: checking for the ld -export-dynamic flag" >&5 +echo "configure:8638: 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:8648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -8606,13 +8663,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:8610: checking if is old" >&5 +echo "configure:8667: 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 < @@ -8623,7 +8680,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8684: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -8649,12 +8706,12 @@ EOF ;; aix*) echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6 -echo "configure:8653: checking for AiX thread debugging library" >&5 +echo "configure:8710: checking for AiX thread debugging library" >&5 if eval "test \"`echo '$''{'gdb_cv_have_aix_thread_debug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -8663,7 +8720,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:8667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_aix_thread_debug=yes else @@ -8688,19 +8745,19 @@ fi if test "x$ac_cv_header_thread_db_h" = "xyes"; then echo $ac_n "checking whether has TD_NOTALLOC""... $ac_c" 1>&6 -echo "configure:8692: checking whether has TD_NOTALLOC" >&5 +echo "configure:8749: checking whether has TD_NOTALLOC" >&5 if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int i = TD_NOTALLOC; ; return 0; } EOF -if { (eval echo configure:8704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_thread_db_h_has_td_notalloc=yes else @@ -8725,19 +8782,19 @@ fi if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then echo $ac_n "checking whether has __NR_tkill""... $ac_c" 1>&6 -echo "configure:8729: checking whether has __NR_tkill" >&5 +echo "configure:8786: checking whether has __NR_tkill" >&5 if eval "test \"`echo '$''{'gdb_cv_sys_syscall_h_has_tkill'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int i = __NR_tkill; ; return 0; } EOF -if { (eval echo configure:8741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_sys_syscall_h_has_tkill=yes else @@ -8848,7 +8905,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:8852: checking compiler warning flags" >&5 +echo "configure:8909: 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 @@ -8858,14 +8915,14 @@ echo "configure:8852: 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:8926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -8913,12 +8970,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:8917: checking for cygwin" >&5 +echo "configure:8974: 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:9000: checking for Tcl configuration" >&5 +echo "configure:9057: 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 @@ -9105,7 +9162,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:9109: checking for Tk configuration" >&5 +echo "configure:9166: 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 @@ -9214,7 +9271,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:9218: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:9275: 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" @@ -9280,17 +9337,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:9284: checking for tclInt.h" >&5 +echo "configure:9341: 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:9294: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9351: \"$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* @@ -9350,7 +9407,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:9354: checking for Tk private headers" >&5 +echo "configure:9411: 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" @@ -9416,17 +9473,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:9420: checking for tk.h" >&5 +echo "configure:9477: 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:9430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9487: \"$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* @@ -9472,7 +9529,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9476: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:9533: 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 @@ -9495,7 +9552,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9499: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:9556: 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 @@ -9550,7 +9607,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:9554: checking for Itcl configuration" >&5 +echo "configure:9611: 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 @@ -9653,7 +9710,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:9657: checking for Itk configuration" >&5 +echo "configure:9714: 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 @@ -9796,7 +9853,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:9800: checking for X" >&5 +echo "configure:9857: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -9858,12 +9915,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:9867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9924: \"$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* @@ -9932,14 +9989,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:10000: \"$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. @@ -10187,7 +10244,7 @@ fi # We only build gdbserver automatically if host and target are the same. if test "x$target" = "x$host"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:10191: checking whether gdbserver is supported on this host" >&5 +echo "configure:10248: checking whether gdbserver is supported on this host" >&5 if test "x$build_gdbserver" = xyes; then configdirs="$configdirs gdbserver" echo "$ac_t""yes" 1>&6 @@ -10251,12 +10308,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:10255: checking for Cygwin environment" >&5 +echo "configure:10312: 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:10328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -10284,19 +10341,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:10288: checking for mingw32 environment" >&5 +echo "configure:10345: 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:10357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -10315,7 +10372,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:10319: checking for executable suffix" >&5 +echo "configure:10376: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10325,7 +10382,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:10329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:10386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -10367,7 +10424,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:10371: checking for iconv" >&5 +echo "configure:10428: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10375,7 +10432,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext < #include @@ -10385,7 +10442,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -10397,7 +10454,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext < #include @@ -10407,7 +10464,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -10428,13 +10485,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:10432: checking for iconv declaration" >&5 +echo "configure:10489: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -10453,7 +10510,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else diff --git a/gdb/configure.host b/gdb/configure.host index 8f96b0a..0c88533 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -13,7 +13,7 @@ case "${host_cpu}" in alpha*) gdb_host_cpu=alpha ;; arm*) gdb_host_cpu=arm ;; hppa*) gdb_host_cpu=pa ;; -i[3456]86*) gdb_host_cpu=i386 ;; +i[34567]86*) gdb_host_cpu=i386 ;; m68*) gdb_host_cpu=m68k ;; mips*) gdb_host_cpu=mips ;; powerpc*) gdb_host_cpu=powerpc ;; @@ -48,34 +48,34 @@ hppa*-*-hpux11*) gdb_host=hpux11 ;; hppa*-*-hpux*) gdb_host=hppahpux ;; # OBSOLETE hppa*-*-osf*) gdb_host=hppaosf ;; -i[3456]86-ncr-*) gdb_host=ncr3000 ;; +i[34567]86-ncr-*) gdb_host=ncr3000 ;; # OBSOLETE i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix # OBSOLETE i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;; # OBSOLETE i[3456]86-sequent-sysv*) gdb_host=ptx ;; -i[3456]86-*-bsd*) gdb_host=i386bsd ;; -i[3456]86-*-dgux*) gdb_host=i386v4 ;; -i[3456]86-*-freebsd*) gdb_host=fbsd ;; -i[3456]86-*-netbsdelf*) gdb_host=nbsdelf ;; -i[3456]86-*-netbsdaout*) gdb_host=nbsdaout ;; -i[3456]86-*-netbsd*) gdb_host=nbsdaout ;; -i[3456]86-*-go32*) gdb_host=go32 ;; -i[3456]86-*-msdosdjgpp*) gdb_host=go32 ;; -i[3456]86-*-linux*) gdb_host=linux ;; -i[3456]86-*-lynxos*) gdb_host=i386lynx ;; -i[3456]86-*-gnu*) gdb_host=i386gnu ;; -i[3456]86-*-openbsd*) gdb_host=obsd ;; -i[3456]86-*-sco3.2v5*) gdb_host=i386sco5 ;; -i[3456]86-*-sco3.2v4*) gdb_host=i386sco4 ;; -i[3456]86-*-sco*) gdb_host=i386sco ;; -i[3456]86-*-solaris*) gdb_host=i386sol2 ;; -i[3456]86-*-sysv4.2*) gdb_host=i386v42mp ;; -i[3456]86-*-sysv4*) gdb_host=i386v4 ;; -i[3456]86-*-sysv5*) gdb_host=i386v42mp ;; -i[3456]86-*-unixware2*) gdb_host=i386v42mp ;; -i[3456]86-*-unixware*) gdb_host=i386v4 ;; -i[3456]86-*-sysv*) gdb_host=i386v ;; -i[3456]86-*-isc*) gdb_host=i386v ;; -i[3456]86-*-cygwin*) gdb_host=cygwin ;; +i[34567]86-*-bsd*) gdb_host=i386bsd ;; +i[34567]86-*-dgux*) gdb_host=i386v4 ;; +i[34567]86-*-freebsd*) gdb_host=fbsd ;; +i[34567]86-*-netbsdelf*) gdb_host=nbsdelf ;; +i[34567]86-*-netbsdaout*) gdb_host=nbsdaout ;; +i[34567]86-*-netbsd*) gdb_host=nbsdaout ;; +i[34567]86-*-go32*) gdb_host=go32 ;; +i[34567]86-*-msdosdjgpp*) gdb_host=go32 ;; +i[34567]86-*-linux*) gdb_host=linux ;; +i[34567]86-*-lynxos*) gdb_host=i386lynx ;; +i[34567]86-*-gnu*) gdb_host=i386gnu ;; +i[34567]86-*-openbsd*) gdb_host=obsd ;; +i[34567]86-*-sco3.2v5*) gdb_host=i386sco5 ;; +i[34567]86-*-sco3.2v4*) gdb_host=i386sco4 ;; +i[34567]86-*-sco*) gdb_host=i386sco ;; +i[34567]86-*-solaris*) gdb_host=i386sol2 ;; +i[34567]86-*-sysv4.2*) gdb_host=i386v42mp ;; +i[34567]86-*-sysv4*) gdb_host=i386v4 ;; +i[34567]86-*-sysv5*) gdb_host=i386v42mp ;; +i[34567]86-*-unixware2*) gdb_host=i386v42mp ;; +i[34567]86-*-unixware*) gdb_host=i386v4 ;; +i[34567]86-*-sysv*) gdb_host=i386v ;; +i[34567]86-*-isc*) gdb_host=i386v ;; +i[34567]86-*-cygwin*) gdb_host=cygwin ;; ia64-*-aix*) gdb_host=aix ;; ia64-*-linux*) gdb_host=linux ;; @@ -120,6 +120,8 @@ powerpc-*-aix*) gdb_host=aix432 ;; powerpc-*-linux*) gdb_host=linux ;; powerpc-*-netbsd*) gdb_host=nbsd ;; +powerpc64-*-linux*) gdb_host=ppc64-linux ;; + rs6000-*-lynxos*) gdb_host=rs6000lynx ;; rs6000-*-aix4*) gdb_host=aix4 ;; rs6000-*-*) gdb_host=rs6000 ;; diff --git a/gdb/configure.in b/gdb/configure.in index 2cf9f6c..38792e0 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -357,6 +357,12 @@ AC_CHECK_HEADERS(curses.h ncurses.h term.h) # unconditionally, so what's the point in checking these? AC_CHECK_HEADERS(ctype.h time.h) +# ------------------------- # +# Checks for declarations. # +# ------------------------- # + +gcc_AC_CHECK_DECLS(getopt) + # ------------------ # # Checks for types. # # ------------------ # diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 45991d6..21945c5 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -16,7 +16,7 @@ alpha*) gdb_target_cpu=alpha ;; arm*) gdb_target_cpu=arm ;; avr*) gdb_target_cpu=avr ;; hppa*) gdb_target_cpu=pa ;; -i[3456]86*) gdb_target_cpu=i386 ;; +i[34567]86*) gdb_target_cpu=i386 ;; m68hc11*|m6811*) gdb_target_cpu=m68hc11 ;; m68*) gdb_target_cpu=m68k ;; mips*) gdb_target_cpu=mips ;; @@ -85,27 +85,27 @@ hppa*-*-*) gdb_target=hppa ;; # OBSOLETE i[3456]86-sequent-bsd*) gdb_target=symmetry ;; # OBSOLETE i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;; # OBSOLETE i[3456]86-sequent-sysv*) gdb_target=ptx ;; -i[3456]86-ncr-*) gdb_target=ncr3000 ;; -i[3456]86-*-bsd*) gdb_target=i386bsd ;; -i[3456]86-*-netbsd*) gdb_target=nbsd ;; -i[3456]86-*-openbsd*) gdb_target=obsd ;; -i[3456]86-*-go32*) gdb_target=i386aout ;; -i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;; -i[3456]86-*-nto*) gdb_target=nto ;; -i[3456]86-*-lynxos*) gdb_target=i386lynx ;; -i[3456]86-*-solaris*) gdb_target=i386sol2 ;; -i[3456]86-*-sco*) gdb_target=i386v ;; -i[3456]86-*-sysv*) gdb_target=i386v ;; -i[3456]86-*-linux*) gdb_target=linux +i[34567]86-ncr-*) gdb_target=ncr3000 ;; +i[34567]86-*-bsd*) gdb_target=i386bsd ;; +i[34567]86-*-netbsd*) gdb_target=nbsd ;; +i[34567]86-*-openbsd*) gdb_target=obsd ;; +i[34567]86-*-go32*) gdb_target=i386aout ;; +i[34567]86-*-msdosdjgpp*) gdb_target=go32 ;; +i[34567]86-*-nto*) gdb_target=nto ;; +i[34567]86-*-lynxos*) gdb_target=i386lynx ;; +i[34567]86-*-solaris*) gdb_target=i386sol2 ;; +i[34567]86-*-sco*) gdb_target=i386v ;; +i[34567]86-*-sysv*) gdb_target=i386v ;; +i[34567]86-*-linux*) gdb_target=linux build_gdbserver=yes ;; -i[3456]86-*-isc*) gdb_target=i386v ;; -i[3456]86-*-gnu*) gdb_target=i386gnu ;; -i[3456]86-*-netware*) gdb_target=i386nw +i[34567]86-*-isc*) gdb_target=i386v ;; +i[34567]86-*-gnu*) gdb_target=i386gnu ;; +i[34567]86-*-netware*) gdb_target=i386nw configdirs="${configdirs} nlm" ;; -i[3456]86-*-cygwin*) gdb_target=cygwin ;; -i[3456]86-*-vxworks*) gdb_target=vxworks ;; -i[3456]86-*-*) gdb_target=embed ;; +i[34567]86-*-cygwin*) gdb_target=cygwin ;; +i[34567]86-*-vxworks*) gdb_target=vxworks ;; +i[34567]86-*-*) gdb_target=embed ;; ia64-*-aix*) gdb_target=aix ;; ia64-*-linux*) gdb_target=linux @@ -186,6 +186,7 @@ powerpc-*-aix*) gdb_target=aix ;; powerpc-*-linux*) gdb_target=linux build_gdbserver=yes ;; +powerpc64-*-linux*) gdb_target=linux ;; powerpc-*-vxworks*) gdb_target=vxworks ;; powerpc*-*-*) if test -f ../sim/ppc/Makefile; then gdb_target=ppc-sim diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c index 3aa9966..43361fc 100644 --- a/gdb/cp-abi.c +++ b/gdb/cp-abi.c @@ -234,6 +234,8 @@ show_cp_abi_cmd (char *args, int from_tty) ui_out_text (uiout, ").\n"); } +extern initialize_file_ftype _initialize_cp_abi; /* -Wmissing-prototypes */ + void _initialize_cp_abi (void) { diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index a4c7b8d..db0839f 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -38,6 +38,9 @@ unsigned char processing_has_namespace_info; contain the name of the current namespace. The string is temporary; copy it if you need it. */ +/* FIXME: carlton/2003-06-12: This isn't entirely reliable: currently, + we get mislead by DW_AT_specification. */ + const char *processing_current_namespace; /* List of using directives that are active in the current file. */ @@ -187,6 +190,12 @@ cp_set_block_scope (const struct symbol *symbol, if (SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL) { +#if 0 + /* FIXME: carlton/2003-06-12: As mentioned above, + 'processing_has_namespace_info' currently isn't entirely + reliable, so let's always use demangled names to get this + information for now. */ + if (processing_has_namespace_info) { block_set_scope @@ -196,6 +205,7 @@ cp_set_block_scope (const struct symbol *symbol, obstack); } else +#endif { /* Try to figure out the appropriate namespace from the demangled name. */ diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 14456f8..64b3f89 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -27,6 +27,21 @@ #include "demangle.h" #include "gdb_assert.h" #include "gdbcmd.h" +#include "dictionary.h" +#include "objfiles.h" +#include "frame.h" +#include "symtab.h" +#include "block.h" + +/* Functions/variables related to overload resolution. */ + +static int sym_return_val_size; +static int sym_return_val_index; +static struct symbol **sym_return_val; + +static char *remove_params (const char *demangled_name); + +static void overload_list_add_symbol (struct symbol *sym, char *oload_name); /* The list of "maint cplus" commands. */ @@ -324,6 +339,204 @@ cp_entire_prefix_len (const char *name) return previous_len; } +/* Overload resolution functions. */ + +static char * +remove_params (const char *demangled_name) +{ + const char *argp; + char *new_name; + int depth; + + if (demangled_name == NULL) + return NULL; + + /* First find the end of the arg list. */ + argp = strrchr (demangled_name, ')'); + if (argp == NULL) + return NULL; + + /* Back up to the beginning. */ + depth = 1; + + while (argp-- > demangled_name) + { + if (*argp == ')') + depth ++; + else if (*argp == '(') + { + depth --; + + if (depth == 0) + break; + } + } + if (depth != 0) + internal_error (__FILE__, __LINE__, + "bad demangled name %s\n", demangled_name); + while (argp[-1] == ' ' && argp > demangled_name) + argp --; + + new_name = xmalloc (argp - demangled_name + 1); + memcpy (new_name, demangled_name, argp - demangled_name); + new_name[argp - demangled_name] = '\0'; + return new_name; +} + +/* Test to see if the symbol specified by SYMNAME (which is already + demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN + characters. If so, add it to the current completion list. */ + +static void +overload_list_add_symbol (struct symbol *sym, char *oload_name) +{ + int newsize; + int i; + char *sym_name; + + /* If there is no type information, we can't do anything, so skip */ + if (SYMBOL_TYPE (sym) == NULL) + return; + + /* skip any symbols that we've already considered. */ + for (i = 0; i < sym_return_val_index; ++i) + if (!strcmp (DEPRECATED_SYMBOL_NAME (sym), DEPRECATED_SYMBOL_NAME (sym_return_val[i]))) + return; + + /* Get the demangled name without parameters */ + sym_name = remove_params (SYMBOL_DEMANGLED_NAME (sym)); + if (!sym_name) + return; + + /* skip symbols that cannot match */ + if (strcmp (sym_name, oload_name) != 0) + { + xfree (sym_name); + return; + } + + xfree (sym_name); + + /* We have a match for an overload instance, so add SYM to the current list + * of overload instances */ + if (sym_return_val_index + 3 > sym_return_val_size) + { + newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *); + sym_return_val = (struct symbol **) xrealloc ((char *) sym_return_val, newsize); + } + sym_return_val[sym_return_val_index++] = sym; + sym_return_val[sym_return_val_index] = NULL; +} + +/* Return a null-terminated list of pointers to function symbols that + * match name of the supplied symbol FSYM. + * This is used in finding all overloaded instances of a function name. + * This has been modified from make_symbol_completion_list. */ + + +struct symbol ** +make_symbol_overload_list (struct symbol *fsym) +{ + register struct symbol *sym; + register struct symtab *s; + register struct partial_symtab *ps; + register struct objfile *objfile; + register struct block *b, *surrounding_static_block = 0; + struct dict_iterator iter; + /* The name we are completing on. */ + char *oload_name = NULL; + /* Length of name. */ + int oload_name_len = 0; + + /* Look for the symbol we are supposed to complete on. */ + + oload_name = remove_params (SYMBOL_DEMANGLED_NAME (fsym)); + if (!oload_name) + { + sym_return_val_size = 1; + sym_return_val = (struct symbol **) xmalloc (2 * sizeof (struct symbol *)); + sym_return_val[0] = fsym; + sym_return_val[1] = NULL; + + return sym_return_val; + } + oload_name_len = strlen (oload_name); + + sym_return_val_size = 100; + sym_return_val_index = 0; + sym_return_val = (struct symbol **) xmalloc ((sym_return_val_size + 1) * sizeof (struct symbol *)); + sym_return_val[0] = NULL; + + /* Read in all partial symtabs containing a partial symbol named + OLOAD_NAME. */ + + ALL_PSYMTABS (objfile, ps) + { + struct partial_symbol **psym; + + /* If the psymtab's been read in we'll get it when we search + through the blockvector. */ + if (ps->readin) + continue; + + if ((lookup_partial_symbol (ps, oload_name, NULL, 1, VAR_DOMAIN) + != NULL) + || (lookup_partial_symbol (ps, oload_name, NULL, 0, VAR_DOMAIN) + != NULL)) + PSYMTAB_TO_SYMTAB (ps); + } + + /* Search upwards from currently selected frame (so that we can + complete on local vars. */ + + for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b)) + { + if (!BLOCK_SUPERBLOCK (b)) + { + surrounding_static_block = b; /* For elimination of dups */ + } + + /* Also catch fields of types defined in this places which match our + text string. Only complete on types visible from current context. */ + + ALL_BLOCK_SYMBOLS (b, iter, sym) + { + overload_list_add_symbol (sym, oload_name); + } + } + + /* Go through the symtabs and check the externs and statics for + symbols which match. */ + + ALL_SYMTABS (objfile, s) + { + QUIT; + b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); + ALL_BLOCK_SYMBOLS (b, iter, sym) + { + overload_list_add_symbol (sym, oload_name); + } + } + + ALL_SYMTABS (objfile, s) + { + QUIT; + b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); + /* Don't do this block twice. */ + if (b == surrounding_static_block) + continue; + ALL_BLOCK_SYMBOLS (b, iter, sym) + { + overload_list_add_symbol (sym, oload_name); + } + } + + xfree (oload_name); + + return (sym_return_val); +} + + /* Don't allow just "maintenance cplus". */ static void @@ -349,6 +562,8 @@ first_component_command (char *arg, int from_tty) printf_unfiltered ("%s\n", prefix); } +extern initialize_file_ftype _initialize_cp_support; /* -Wmissing-prototypes */ + void _initialize_cp_support (void) { diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 0b567dd..339981c 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -58,6 +58,7 @@ extern unsigned int cp_find_first_component (const char *name); extern unsigned int cp_entire_prefix_len (const char *name); +extern struct symbol **make_symbol_overload_list (struct symbol *); /* Functions/variables from cp-namespace.c. */ @@ -71,7 +72,7 @@ extern void cp_add_using_directive (const char *name, unsigned int outer_length, unsigned int inner_length); -extern void cp_initialize_namespace (); +extern void cp_initialize_namespace (void); extern void cp_finalize_namespace (struct block *static_block, struct obstack *obstack); diff --git a/gdb/cpu32bug-rom.c b/gdb/cpu32bug-rom.c index 4341789..03b3132 100644 --- a/gdb/cpu32bug-rom.c +++ b/gdb/cpu32bug-rom.c @@ -162,6 +162,8 @@ cpu32bug_open (char *args, int from_tty) monitor_open (args, &cpu32bug_cmds, from_tty); } +extern initialize_file_ftype _initialize_cpu32bug_rom; /* -Wmissing-prototypes */ + void _initialize_cpu32bug_rom (void) { diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 76a0250..0da68c0 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -464,7 +464,7 @@ static CORE_ADDR bfd_lookup_symbol (bfd *, const char *); the entire prologue is examined (0) or just enough instructions to determine that it is a prologue (1). */ -CORE_ADDR +static CORE_ADDR cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, int frameless_p) { @@ -712,7 +712,7 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, /* Advance pc beyond any function entry prologue instructions at pc to reach some "real" code. */ -CORE_ADDR +static CORE_ADDR cris_skip_prologue (CORE_ADDR pc) { return cris_skip_prologue_main (pc, 0); @@ -722,7 +722,7 @@ cris_skip_prologue (CORE_ADDR pc) has a frame. Its result is equal to its input pc if the function is frameless, unequal otherwise. */ -CORE_ADDR +static CORE_ADDR cris_skip_prologue_frameless_p (CORE_ADDR pc) { return cris_skip_prologue_main (pc, 1); @@ -731,7 +731,7 @@ cris_skip_prologue_frameless_p (CORE_ADDR pc) /* Given a PC value corresponding to the start of a function, return the PC of the first instruction after the function prologue. */ -CORE_ADDR +static CORE_ADDR cris_skip_prologue_main (CORE_ADDR pc, int frameless_p) { struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); @@ -763,7 +763,7 @@ cris_skip_prologue_main (CORE_ADDR pc, int frameless_p) adjusts pcptr (if necessary) to point to the actual memory location where the breakpoint should be inserted. */ -const unsigned char * +static const unsigned char * cris_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { static unsigned char break_insn[] = {0x38, 0xe9}; @@ -784,7 +784,7 @@ cris_saved_pc_after_call (struct frame_info *frame) /* Returns 1 if spec_reg is applicable to the current gdbarch's CRIS version, 0 otherwise. */ -int +static int cris_spec_reg_applicable (struct cris_spec_reg spec_reg) { int version = cris_version (); @@ -818,7 +818,7 @@ cris_spec_reg_applicable (struct cris_spec_reg spec_reg) /* Returns the register size in unit byte. Returns 0 for an unimplemented register, -1 for an invalid register. */ -int +static int cris_register_size (int regno) { int i; @@ -857,7 +857,7 @@ cris_register_size (int regno) /* Nonzero if regno should not be fetched from the target. This is the case for unimplemented (size 0) and non-existant registers. */ -int +static int cris_cannot_fetch_register (int regno) { return ((regno < 0 || regno >= NUM_REGS) @@ -867,7 +867,7 @@ cris_cannot_fetch_register (int regno) /* Nonzero if regno should not be written to the target, for various reasons. */ -int +static int cris_cannot_store_register (int regno) { /* There are three kinds of registers we refuse to write to. @@ -903,7 +903,7 @@ cris_cannot_store_register (int regno) in the saved register state. Returns -1 for an invalid or unimplemented register. */ -int +static int cris_register_offset (int regno) { int i; @@ -929,7 +929,7 @@ cris_register_offset (int regno) /* Return the GDB type (defined in gdbtypes.c) for the "standard" data type of data in register regno. */ -struct type * +static struct type * cris_register_virtual_type (int regno) { if (regno == SP_REGNUM || regno == PC_REGNUM @@ -966,7 +966,7 @@ cris_register_virtual_type (int regno) /* In the original CRIS ABI, R10 is used to store return values. */ -void +static void cris_abi_original_store_return_value (struct type *type, char *valbuf) { int len = TYPE_LENGTH (type); @@ -979,7 +979,7 @@ cris_abi_original_store_return_value (struct type *type, char *valbuf) /* In the CRIS ABI V2, R10 and R11 are used to store return values. */ -void +static void cris_abi_v2_store_return_value (struct type *type, char *valbuf) { int len = TYPE_LENGTH (type); @@ -997,7 +997,7 @@ cris_abi_v2_store_return_value (struct type *type, char *valbuf) /* Return the name of register regno as a string. Return NULL for an invalid or unimplemented register. */ -const char * +static const char * cris_register_name (int regno) { static char *cris_genreg_names[] = @@ -1039,7 +1039,7 @@ cris_register_name (int regno) } } -int +static int cris_register_bytes_ok (long bytes) { return (bytes == DEPRECATED_REGISTER_BYTES); @@ -1051,7 +1051,7 @@ cris_register_bytes_ok (long bytes) /* In the original CRIS ABI, R10 is used to return values. */ -void +static void cris_abi_original_extract_return_value (struct type *type, char *regbuf, char *valbuf) { @@ -1065,7 +1065,7 @@ cris_abi_original_extract_return_value (struct type *type, char *regbuf, /* In the CRIS ABI V2, R10 and R11 are used to store return values. */ -void +static void cris_abi_v2_extract_return_value (struct type *type, char *regbuf, char *valbuf) { @@ -1083,7 +1083,7 @@ cris_abi_v2_extract_return_value (struct type *type, char *regbuf, be stored. R9 is call-clobbered, which means we must save it here for later use. */ -void +static void cris_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) { write_register (STR_REGNUM, addr); @@ -1094,32 +1094,19 @@ cris_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) structure value. It's not there in the CRIS ABI, so we must do it another way. */ -CORE_ADDR +static CORE_ADDR cris_extract_struct_value_address (char *regbuf) { return struct_return_address; } -/* Returns 1 if a value of the given type being returned from a function - must have space allocated for it on the stack. gcc_p is true if the - function being considered is known to have been compiled by GCC. - In the CRIS ABI, structure return values are passed to the called - function by reference in register R9 to a caller-allocated area, so - this is always true. */ - -int -cris_use_struct_convention (int gcc_p, struct type *type) -{ - return 1; -} - /* Returns 1 if the given type will be passed by pointer rather than directly. */ /* In the original CRIS ABI, arguments shorter than or equal to 32 bits are passed by value. */ -int +static int cris_abi_original_reg_struct_has_addr (int gcc_p, struct type *type) { return (TYPE_LENGTH (type) > 4); @@ -1128,7 +1115,7 @@ cris_abi_original_reg_struct_has_addr (int gcc_p, struct type *type) /* In the CRIS ABI V2, arguments shorter than or equal to 64 bits are passed by value. */ -int +static int cris_abi_v2_reg_struct_has_addr (int gcc_p, struct type *type) { return (TYPE_LENGTH (type) > 8); @@ -1137,7 +1124,7 @@ cris_abi_v2_reg_struct_has_addr (int gcc_p, struct type *type) /* Returns 1 if the function invocation represented by fi does not have a stack frame associated with it. Otherwise return 0. */ -int +static int cris_frameless_function_invocation (struct frame_info *fi) { if ((get_frame_type (fi) == SIGTRAMP_FRAME)) @@ -1151,7 +1138,7 @@ cris_frameless_function_invocation (struct frame_info *fi) frame->saved_regs shall be allocated by DEPRECATED_FRAME_INIT_SAVED_REGS using frame_saved_regs_zalloc. */ -void +static void cris_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR ip; @@ -1198,7 +1185,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) When the call is from get_prev_frame_info, fromleaf is determined by cris_frameless_function_invocation. */ -void +static void cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) { if (get_next_frame (fi)) @@ -1252,7 +1239,7 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Return the content of the frame pointer in the present frame. In other words, determine the address of the calling function's frame. */ -CORE_ADDR +static CORE_ADDR cris_frame_chain (struct frame_info *fi) { if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), @@ -1273,7 +1260,7 @@ cris_frame_chain (struct frame_info *fi) /* Return the saved PC (which equals the return address) of this frame. */ -CORE_ADDR +static CORE_ADDR cris_frame_saved_pc (struct frame_info *fi) { return get_frame_extra_info (fi)->return_pc; @@ -1281,7 +1268,7 @@ cris_frame_saved_pc (struct frame_info *fi) /* Setup the function arguments for calling a function in the inferior. */ -CORE_ADDR +static CORE_ADDR cris_abi_original_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) @@ -1367,7 +1354,7 @@ cris_abi_original_push_arguments (int nargs, struct value **args, return sp; } -CORE_ADDR +static CORE_ADDR cris_abi_v2_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { @@ -1499,7 +1486,7 @@ cris_abi_v2_push_arguments (int nargs, struct value **args, CORE_ADDR sp, by the called function unless it is a leaf-function. Due to the BRP register the PC will change when continue is sent. */ -CORE_ADDR +static CORE_ADDR cris_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { write_register (SRP_REGNUM, CALL_DUMMY_ADDRESS ()); @@ -1510,7 +1497,7 @@ cris_push_return_address (CORE_ADDR pc, CORE_ADDR sp) was created. Discard the innermost frame from the stack and restore all saved registers. */ -void +static void cris_pop_frame (void) { register struct frame_info *fi = get_current_frame (); @@ -1772,7 +1759,7 @@ find_step_target (inst_env_type *inst_env) digs through the opcodes in order to find all possible targets. Either one ordinary target or two targets for branches may be found. */ -void +static void cris_software_single_step (enum target_signal ignore, int insert_breakpoints) { inst_env_type inst_env; @@ -1816,7 +1803,7 @@ cris_software_single_step (enum target_signal ignore, int insert_breakpoints) /* Calculates the prefix value for quick offset addressing mode. */ -void +static void quick_mode_bdap_prefix (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to be in a delay slot. You can't have a prefix to this @@ -1840,7 +1827,7 @@ quick_mode_bdap_prefix (unsigned short inst, inst_env_type *inst_env) from the size of the operation. The PC is always kept aligned on even word addresses. */ -void +static void process_autoincrement (int size, unsigned short inst, inst_env_type *inst_env) { if (size == INST_BYTE_SIZE) @@ -1871,12 +1858,13 @@ process_autoincrement (int size, unsigned short inst, inst_env_type *inst_env) /* Just a forward declaration. */ -unsigned long get_data_from_address (unsigned short *inst, CORE_ADDR address); +static unsigned long get_data_from_address (unsigned short *inst, + CORE_ADDR address); /* Calculates the prefix value for the general case of offset addressing mode. */ -void +static void bdap_prefix (unsigned short inst, inst_env_type *inst_env) { @@ -1912,7 +1900,7 @@ bdap_prefix (unsigned short inst, inst_env_type *inst_env) /* Calculates the prefix value for the index addressing mode. */ -void +static void biap_prefix (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to be in a delay slot. I can't see that it's possible to @@ -1947,7 +1935,7 @@ biap_prefix (unsigned short inst, inst_env_type *inst_env) /* Calculates the prefix value for the double indirect addressing mode. */ -void +static void dip_prefix (unsigned short inst, inst_env_type *inst_env) { @@ -1980,7 +1968,7 @@ dip_prefix (unsigned short inst, inst_env_type *inst_env) /* Finds the destination for a branch with 8-bits offset. */ -void +static void eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env) { @@ -2017,7 +2005,7 @@ eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env) /* Finds the destination for a branch with 16-bits offset. */ -void +static void sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env) { short offset; @@ -2048,7 +2036,7 @@ sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env) /* Handles the ABS instruction. */ -void +static void abs_op (unsigned short inst, inst_env_type *inst_env) { @@ -2090,7 +2078,7 @@ abs_op (unsigned short inst, inst_env_type *inst_env) /* Handles the ADDI instruction. */ -void +static void addi_op (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to have the PC as base register. And ADDI can't have @@ -2109,7 +2097,7 @@ addi_op (unsigned short inst, inst_env_type *inst_env) /* Handles the ASR instruction. */ -void +static void asr_op (unsigned short inst, inst_env_type *inst_env) { int shift_steps; @@ -2186,7 +2174,7 @@ asr_op (unsigned short inst, inst_env_type *inst_env) /* Handles the ASRQ instruction. */ -void +static void asrq_op (unsigned short inst, inst_env_type *inst_env) { @@ -2233,7 +2221,7 @@ asrq_op (unsigned short inst, inst_env_type *inst_env) /* Handles the AX, EI and SETF instruction. */ -void +static void ax_ei_setf_op (unsigned short inst, inst_env_type *inst_env) { if (inst_env->prefix_found) @@ -2259,7 +2247,7 @@ ax_ei_setf_op (unsigned short inst, inst_env_type *inst_env) register. Note that check_assign assumes that the caller has checked that there is a prefix to this instruction. The mode check depends on this. */ -void +static void check_assign (unsigned short inst, inst_env_type *inst_env) { /* Check if it's an assign addressing mode. */ @@ -2272,7 +2260,7 @@ check_assign (unsigned short inst, inst_env_type *inst_env) /* Handles the 2-operand BOUND instruction. */ -void +static void two_operand_bound_op (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to have the PC as the index operand. */ @@ -2305,7 +2293,7 @@ two_operand_bound_op (unsigned short inst, inst_env_type *inst_env) /* Handles the 3-operand BOUND instruction. */ -void +static void three_operand_bound_op (unsigned short inst, inst_env_type *inst_env) { /* It's an error if we haven't got a prefix. And it's also an error @@ -2323,7 +2311,7 @@ three_operand_bound_op (unsigned short inst, inst_env_type *inst_env) /* Clears the status flags in inst_env. */ -void +static void btst_nop_op (unsigned short inst, inst_env_type *inst_env) { /* It's an error if we have got a prefix. */ @@ -2341,7 +2329,7 @@ btst_nop_op (unsigned short inst, inst_env_type *inst_env) /* Clears the status flags in inst_env. */ -void +static void clearf_di_op (unsigned short inst, inst_env_type *inst_env) { /* It's an error if we have got a prefix. */ @@ -2359,7 +2347,7 @@ clearf_di_op (unsigned short inst, inst_env_type *inst_env) /* Handles the CLEAR instruction if it's in register mode. */ -void +static void reg_mode_clear_op (unsigned short inst, inst_env_type *inst_env) { /* Check if the target is the PC. */ @@ -2396,7 +2384,7 @@ reg_mode_clear_op (unsigned short inst, inst_env_type *inst_env) /* Handles the TEST instruction if it's in register mode. */ -void +static void reg_mode_test_op (unsigned short inst, inst_env_type *inst_env) { /* It's an error if we have got a prefix. */ @@ -2415,7 +2403,7 @@ reg_mode_test_op (unsigned short inst, inst_env_type *inst_env) /* Handles the CLEAR and TEST instruction if the instruction isn't in register mode. */ -void +static void none_reg_mode_clear_test_op (unsigned short inst, inst_env_type *inst_env) { /* Check if we are in a prefix mode. */ @@ -2440,7 +2428,7 @@ none_reg_mode_clear_test_op (unsigned short inst, inst_env_type *inst_env) /* Checks that the PC isn't the destination register or the instructions has a prefix. */ -void +static void dstep_logshift_mstep_neg_not_op (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to have the PC as the destination. The instruction can't @@ -2459,7 +2447,7 @@ dstep_logshift_mstep_neg_not_op (unsigned short inst, inst_env_type *inst_env) /* Checks that the instruction doesn't have a prefix. */ -void +static void break_op (unsigned short inst, inst_env_type *inst_env) { /* The instruction can't have a prefix. */ @@ -2478,7 +2466,7 @@ break_op (unsigned short inst, inst_env_type *inst_env) /* Checks that the PC isn't the destination register and that the instruction doesn't have a prefix. */ -void +static void scc_op (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to have the PC as the destination. The instruction can't @@ -2497,7 +2485,7 @@ scc_op (unsigned short inst, inst_env_type *inst_env) /* Handles the register mode JUMP instruction. */ -void +static void reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env) { /* It's invalid to do a JUMP in a delay slot. The mode is register, so @@ -2518,7 +2506,8 @@ reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env) /* Handles the JUMP instruction for all modes except register. */ -void none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env) +static void +none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env) { unsigned long newpc; CORE_ADDR address; @@ -2562,7 +2551,7 @@ void none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env) /* Handles moves to special registers (aka P-register) for all modes. */ -void +static void move_to_preg_op (unsigned short inst, inst_env_type *inst_env) { if (inst_env->prefix_found) @@ -2617,7 +2606,7 @@ move_to_preg_op (unsigned short inst, inst_env_type *inst_env) /* Handles moves from special registers (aka P-register) for all modes except register. */ -void +static void none_reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env) { if (inst_env->prefix_found) @@ -2672,7 +2661,7 @@ none_reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env) /* Handles moves from special registers (aka P-register) when the mode is register. */ -void +static void reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env) { /* Register mode move from special register can't have a prefix. */ @@ -2707,7 +2696,7 @@ reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env) /* Handles the MOVEM from memory to general register instruction. */ -void +static void move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env) { if (inst_env->prefix_found) @@ -2764,7 +2753,7 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env) /* Handles the MOVEM to memory from general register instruction. */ -void +static void move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env) { if (inst_env->prefix_found) @@ -2803,7 +2792,7 @@ move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env) /* Handles the pop instruction to a general register. POP is a assembler macro for MOVE.D [SP+], Rd. */ -void +static void reg_pop_op (unsigned short inst, inst_env_type *inst_env) { /* POP can't have a prefix. */ @@ -2831,7 +2820,7 @@ reg_pop_op (unsigned short inst, inst_env_type *inst_env) /* Handles moves from register to memory. */ -void +static void move_reg_to_mem_index_inc_op (unsigned short inst, inst_env_type *inst_env) { /* Check if we have a prefix. */ @@ -2860,7 +2849,7 @@ move_reg_to_mem_index_inc_op (unsigned short inst, inst_env_type *inst_env) /* Handles the intructions that's not yet implemented, by setting inst_env->invalid to true. */ -void +static void not_implemented_op (unsigned short inst, inst_env_type *inst_env) { inst_env->invalid = 1; @@ -2868,7 +2857,7 @@ not_implemented_op (unsigned short inst, inst_env_type *inst_env) /* Handles the XOR instruction. */ -void +static void xor_op (unsigned short inst, inst_env_type *inst_env) { /* XOR can't have a prefix. */ @@ -2897,7 +2886,7 @@ xor_op (unsigned short inst, inst_env_type *inst_env) /* Handles the MULS instruction. */ -void +static void muls_op (unsigned short inst, inst_env_type *inst_env) { /* MULS/U can't have a prefix. */ @@ -2921,7 +2910,7 @@ muls_op (unsigned short inst, inst_env_type *inst_env) /* Handles the MULU instruction. */ -void +static void mulu_op (unsigned short inst, inst_env_type *inst_env) { /* MULS/U can't have a prefix. */ @@ -2946,7 +2935,7 @@ mulu_op (unsigned short inst, inst_env_type *inst_env) /* Calculate the result of the instruction for ADD, SUB, CMP AND, OR and MOVE. The MOVE instruction is the move from source to register. */ -void +static void add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env, unsigned long source1, unsigned long source2) { @@ -3028,7 +3017,7 @@ add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env, is zero extend then the value is extended with zero. If instead the mode is signed extend the sign bit of the value is taken into consideration. */ -unsigned long +static unsigned long do_sign_or_zero_extend (unsigned long value, unsigned short *inst) { /* The size can be either byte or word, check which one it is. @@ -3066,7 +3055,7 @@ do_sign_or_zero_extend (unsigned long value, unsigned short *inst) /* Handles the register mode for the ADD, SUB, CMP, AND, OR and MOVE instruction. The MOVE instruction is the move from source to register. */ -void +static void reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst, inst_env_type *inst_env) { @@ -3111,7 +3100,7 @@ reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst, the size of the operation. If the instruction is a zero or signed extend instruction, the size field is changed in instruction. */ -unsigned long +static unsigned long get_data_from_address (unsigned short *inst, CORE_ADDR address) { int size = cris_get_size (*inst); @@ -3139,7 +3128,7 @@ get_data_from_address (unsigned short *inst, CORE_ADDR address) /* Handles the assign addresing mode for the ADD, SUB, CMP, AND, OR and MOVE instructions. The MOVE instruction is the move from source to register. */ -void +static void handle_prefix_assign_mode_for_aritm_op (unsigned short inst, inst_env_type *inst_env) { @@ -3168,7 +3157,7 @@ handle_prefix_assign_mode_for_aritm_op (unsigned short inst, OR instructions. Note that for this to work as expected, the calling function must have made sure that there is a prefix to this instruction. */ -void +static void three_operand_add_sub_cmp_and_or_op (unsigned short inst, inst_env_type *inst_env) { @@ -3196,7 +3185,7 @@ three_operand_add_sub_cmp_and_or_op (unsigned short inst, /* Handles the index addresing mode for the ADD, SUB, CMP, AND, OR and MOVE instructions. The MOVE instruction is the move from source to register. */ -void +static void handle_prefix_index_mode_for_aritm_op (unsigned short inst, inst_env_type *inst_env) { @@ -3224,7 +3213,7 @@ handle_prefix_index_mode_for_aritm_op (unsigned short inst, CMP, AND OR and MOVE instruction. The MOVE instruction is the move from source to register. */ -void +static void handle_inc_and_index_mode_for_aritm_op (unsigned short inst, inst_env_type *inst_env) { @@ -3274,7 +3263,7 @@ handle_inc_and_index_mode_for_aritm_op (unsigned short inst, /* Handles the two-operand addressing mode, all modes except register, for the ADD, SUB CMP, AND and OR instruction. */ -void +static void none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst, inst_env_type *inst_env) { @@ -3303,7 +3292,7 @@ none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst, /* Handles the quick addressing mode for the ADD and SUB instruction. */ -void +static void quick_mode_add_sub_op (unsigned short inst, inst_env_type *inst_env) { unsigned long operand1; @@ -3343,7 +3332,7 @@ quick_mode_add_sub_op (unsigned short inst, inst_env_type *inst_env) /* Handles the quick addressing mode for the CMP, AND and OR instruction. */ -void +static void quick_mode_and_cmp_move_or_op (unsigned short inst, inst_env_type *inst_env) { unsigned long operand1; @@ -3389,8 +3378,9 @@ quick_mode_and_cmp_move_or_op (unsigned short inst, inst_env_type *inst_env) /* Translate op_type to a function and call it. */ -static void cris_gdb_func (enum cris_op_type op_type, unsigned short inst, - inst_env_type *inst_env) +static void +cris_gdb_func (enum cris_op_type op_type, unsigned short inst, + inst_env_type *inst_env) { switch (op_type) { @@ -3562,7 +3552,7 @@ typedef elf_greg_t elf_gregset_t[35]; /* Unpack an elf_gregset_t into GDB's register cache. */ -void +static void supply_gregset (elf_gregset_t *gregsetp) { int i; @@ -3627,7 +3617,7 @@ static struct core_fns cris_elf_core_fns = See gdb/solib-svr4.h for an explanation of these fields. */ -struct link_map_offsets * +static struct link_map_offsets * cris_linux_svr4_fetch_link_map_offsets (void) { static struct link_map_offsets lmo; @@ -3855,6 +3845,8 @@ cris_fpless_backtrace (char *noargs, int from_tty) } } +extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-prototypes */ + void _initialize_cris_tdep (void) { @@ -4239,21 +4231,21 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Returns the register offset for the first byte of register regno's space in the saved register state. */ - set_gdbarch_register_byte (gdbarch, cris_register_offset); + set_gdbarch_deprecated_register_byte (gdbarch, cris_register_offset); /* The length of the registers in the actual machine representation. */ - set_gdbarch_register_raw_size (gdbarch, cris_register_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, cris_register_size); /* The largest value REGISTER_RAW_SIZE can have. */ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 32); /* The length of the registers in the program's representation. */ - set_gdbarch_register_virtual_size (gdbarch, cris_register_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, cris_register_size); /* The largest value REGISTER_VIRTUAL_SIZE can have. */ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 32); - set_gdbarch_register_virtual_type (gdbarch, cris_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, cris_register_virtual_type); /* Use generic dummy frames. */ @@ -4273,7 +4265,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, cris_extract_struct_value_address); - set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention); + set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, cris_init_extra_frame_info); @@ -4302,13 +4294,11 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_saved_pc (gdbarch, cris_frame_saved_pc); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, cris_saved_pc_after_call); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - /* Helpful for backtracing and returning in a call dummy. */ set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); /* Use target_specific function to define link map offsets. */ set_solib_svr4_fetch_link_map_offsets diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 2696c60..d522580 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -44,6 +44,7 @@ #include "gdb/sim-d10v.h" #include "sim-regno.h" #include "disasm.h" +#include "trad-frame.h" #include "gdb_assert.h" @@ -85,13 +86,13 @@ enum RET1_REGNUM = R0_REGNUM, }; -int +static int nr_dmap_regs (struct gdbarch *gdbarch) { return gdbarch_tdep (gdbarch)->nr_dmap_regs; } -int +static int a0_regnum (struct gdbarch *gdbarch) { return gdbarch_tdep (gdbarch)->a0_regnum; @@ -101,8 +102,6 @@ a0_regnum (struct gdbarch *gdbarch) extern void _initialize_d10v_tdep (void); -static CORE_ADDR d10v_read_sp (void); - static void d10v_eva_prepare_to_trace (void); static void d10v_eva_get_trace_data (void); @@ -563,21 +562,20 @@ d10v_skip_prologue (CORE_ADDR pc) struct d10v_unwind_cache { - CORE_ADDR return_pc; /* The previous frame's inner most stack address. Used as this frame ID's stack_addr. */ CORE_ADDR prev_sp; /* The frame's base, optionally used by the high-level debug info. */ CORE_ADDR base; int size; - CORE_ADDR *saved_regs; /* How far the SP and r11 (FP) have been offset from the start of the stack frame (as defined by the previous frame's stack pointer). */ LONGEST sp_offset; LONGEST r11_offset; int uses_frame; - void **regs; + /* Table indicating the location of each and every register. */ + struct trad_frame_saved_reg *saved_regs; }; static int @@ -591,7 +589,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, { n = (op & 0x1E0) >> 5; info->sp_offset -= 2; - info->saved_regs[n] = info->sp_offset; + info->saved_regs[n].addr = info->sp_offset; return 1; } @@ -600,8 +598,8 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, { n = (op & 0x1E0) >> 5; info->sp_offset -= 4; - info->saved_regs[n] = info->sp_offset; - info->saved_regs[n + 1] = info->sp_offset + 2; + info->saved_regs[n + 0].addr = info->sp_offset + 0; + info->saved_regs[n + 1].addr = info->sp_offset + 2; return 1; } @@ -627,7 +625,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, if ((op & 0x7E1F) == 0x6816) { n = (op & 0x1E0) >> 5; - info->saved_regs[n] = info->r11_offset; + info->saved_regs[n].addr = info->r11_offset; return 1; } @@ -639,7 +637,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, if ((op & 0x7E1F) == 0x681E) { n = (op & 0x1E0) >> 5; - info->saved_regs[n] = info->sp_offset; + info->saved_regs[n].addr = info->sp_offset; return 1; } @@ -647,8 +645,8 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, if ((op & 0x7E3F) == 0x3A1E) { n = (op & 0x1E0) >> 5; - info->saved_regs[n] = info->sp_offset; - info->saved_regs[n + 1] = info->sp_offset + 2; + info->saved_regs[n + 0].addr = info->sp_offset + 0; + info->saved_regs[n + 1].addr = info->sp_offset + 2; return 1; } @@ -661,7 +659,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, in the stack frame. sp is even more special: the address we return for it IS the sp for the next frame. */ -struct d10v_unwind_cache * +static struct d10v_unwind_cache * d10v_frame_unwind_cache (struct frame_info *next_frame, void **this_prologue_cache) { @@ -679,10 +677,9 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct d10v_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = FRAME_OBSTACK_CALLOC (NUM_REGS, CORE_ADDR); + info->saved_regs = trad_frame_alloc_saved_regs (next_frame); info->size = 0; - info->return_pc = 0; info->sp_offset = 0; info->uses_frame = 0; @@ -705,15 +702,15 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, /* st rn, @(offset,sp) */ short offset = op & 0xFFFF; short n = (op >> 20) & 0xF; - info->saved_regs[n] = info->sp_offset + offset; + info->saved_regs[n].addr = info->sp_offset + offset; } else if ((op & 0x3F1F0000) == 0x350F0000) { /* st2w rn, @(offset,sp) */ short offset = op & 0xFFFF; short n = (op >> 20) & 0xF; - info->saved_regs[n] = info->sp_offset + offset; - info->saved_regs[n + 1] = info->sp_offset + offset + 2; + info->saved_regs[n + 0].addr = info->sp_offset + offset + 0; + info->saved_regs[n + 1].addr = info->sp_offset + offset + 2; } else break; @@ -739,7 +736,8 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info->size = -info->sp_offset; - /* Compute the frame's base, and the previous frame's SP. */ + /* Compute the previous frame's stack pointer (which is also the + frame's ID's stack address), and this frame's base pointer. */ if (info->uses_frame) { /* The SP was moved to the FP. This indicates that a new frame @@ -750,16 +748,6 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, to before the first saved register giving the SP. */ prev_sp = this_base + info->size; } - else if (info->saved_regs[D10V_SP_REGNUM]) - { - /* The SP was saved (which is very unusual), the frame base is - just the PREV's frame's TOP-OF-STACK. */ - this_base - = get_frame_memory_unsigned (next_frame, - info->saved_regs[D10V_SP_REGNUM], - register_size (gdbarch, D10V_SP_REGNUM)); - prev_sp = this_base; - } else { /* Assume that the FP is this frame's SP but with that pushed @@ -768,34 +756,28 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, prev_sp = this_base + info->size; } + /* Convert that SP/BASE into real addresses. */ + info->prev_sp = d10v_make_daddr (prev_sp); info->base = d10v_make_daddr (this_base); - info->prev_sp = d10v_make_daddr (prev_sp); /* Adjust all the saved registers so that they contain addresses and not offsets. */ for (i = 0; i < NUM_REGS - 1; i++) - if (info->saved_regs[i]) + if (info->saved_regs[i].addr) { - info->saved_regs[i] = (info->prev_sp + info->saved_regs[i]); + info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr); } - if (info->saved_regs[LR_REGNUM]) - { - CORE_ADDR return_pc - = get_frame_memory_unsigned (next_frame, info->saved_regs[LR_REGNUM], - register_size (gdbarch, LR_REGNUM)); - info->return_pc = d10v_make_iaddr (return_pc); - } - else - { - ULONGEST return_pc; - frame_unwind_unsigned_register (next_frame, LR_REGNUM, &return_pc); - info->return_pc = d10v_make_iaddr (return_pc); - } + /* The call instruction moves the caller's PC in the callee's LR. + Since this is an unwind, do the reverse. Copy the location of LR + into PC (the address / regnum) so that a request for PC will be + converted into a request for the LR. */ + info->saved_regs[D10V_PC_REGNUM] = info->saved_regs[LR_REGNUM]; - /* The D10V_SP_REGNUM is special. Instead of the address of the SP, the - previous frame's SP value is saved. */ - info->saved_regs[D10V_SP_REGNUM] = info->prev_sp; + /* The previous frame's SP needed to be computed. Save the computed + value. */ + trad_frame_register_value (info->saved_regs, D10V_SP_REGNUM, + d10v_make_daddr (prev_sp)); return info; } @@ -918,9 +900,11 @@ d10v_write_pc (CORE_ADDR val, ptid_t ptid) } static CORE_ADDR -d10v_read_sp (void) +d10v_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { - return (d10v_make_daddr (read_register (D10V_SP_REGNUM))); + ULONGEST sp; + frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &sp); + return d10v_make_daddr (sp); } /* When arguments must be pushed onto the stack, they go on in reverse @@ -1446,55 +1430,6 @@ d10v_frame_this_id (struct frame_info *next_frame, } static void -saved_regs_unwinder (struct frame_info *next_frame, - CORE_ADDR *this_saved_regs, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, void *bufferp) -{ - struct gdbarch *gdbarch = get_frame_arch (next_frame); - if (this_saved_regs[regnum] != 0) - { - if (regnum == D10V_SP_REGNUM) - { - /* SP register treated specially. */ - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (bufferp != NULL) - store_unsigned_integer (bufferp, - register_size (gdbarch, regnum), - this_saved_regs[regnum]); - } - else - { - /* Any other register is saved in memory, fetch it but cache - a local copy of its value. */ - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = this_saved_regs[regnum]; - *realnump = -1; - if (bufferp != NULL) - { - /* Read the value in from memory. */ - get_frame_memory (next_frame, this_saved_regs[regnum], bufferp, - register_size (gdbarch, regnum)); - } - } - return; - } - - /* No luck, assume this and the next frame have the same register - value. If a value is needed, pass the request on down the chain; - otherwise just return an indication that the value is in the same - register as the next frame. */ - frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp, - realnump, bufferp); -} - - -static void d10v_frame_prev_register (struct frame_info *next_frame, void **this_prologue_cache, int regnum, int *optimizedp, @@ -1503,19 +1438,8 @@ d10v_frame_prev_register (struct frame_info *next_frame, { struct d10v_unwind_cache *info = d10v_frame_unwind_cache (next_frame, this_prologue_cache); - if (regnum == D10V_PC_REGNUM) - { - /* The call instruction saves the caller's PC in LR. The - function prologue of the callee may then save the LR on the - stack. Find that possibly saved LR value and return it. */ - saved_regs_unwinder (next_frame, info->saved_regs, LR_REGNUM, optimizedp, - lvalp, addrp, realnump, bufferp); - } - else - { - saved_regs_unwinder (next_frame, info->saved_regs, regnum, optimizedp, - lvalp, addrp, realnump, bufferp); - } + trad_frame_prev_register (next_frame, info->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, bufferp); } static const struct frame_unwind d10v_frame_unwind = { @@ -1524,7 +1448,7 @@ static const struct frame_unwind d10v_frame_unwind = { d10v_frame_prev_register }; -const struct frame_unwind * +static const struct frame_unwind * d10v_frame_p (CORE_ADDR pc) { return &d10v_frame_unwind; @@ -1553,9 +1477,8 @@ static const struct frame_base d10v_frame_base = { static struct frame_id d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { - ULONGEST base; - frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &base); - return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame)); + return frame_id_build (d10v_unwind_sp (gdbarch, next_frame), + frame_pc_unwind (next_frame)); } static gdbarch_init_ftype d10v_gdbarch_init; @@ -1604,7 +1527,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, d10v_read_pc); set_gdbarch_write_pc (gdbarch, d10v_write_pc); - set_gdbarch_read_sp (gdbarch, d10v_read_sp); + set_gdbarch_unwind_sp (gdbarch, d10v_unwind_sp); set_gdbarch_num_regs (gdbarch, d10v_num_regs); set_gdbarch_sp_regnum (gdbarch, D10V_SP_REGNUM); @@ -1660,7 +1583,6 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_align (gdbarch, d10v_frame_align); set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno); @@ -1670,9 +1592,10 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_unwind_append_predicate (gdbarch, d10v_frame_p); frame_base_set_default (gdbarch, &d10v_frame_base); - /* Methods for saving / extracting a dummy frame's ID. */ + /* Methods for saving / extracting a dummy frame's ID. The ID's + stack address must match the SP value returned by + PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */ set_gdbarch_unwind_dummy_id (gdbarch, d10v_unwind_dummy_id); - set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); /* Return the unwound PC value. */ set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc); diff --git a/gdb/dbug-rom.c b/gdb/dbug-rom.c index aadab6f..a592334 100644 --- a/gdb/dbug-rom.c +++ b/gdb/dbug-rom.c @@ -160,6 +160,8 @@ dbug_open (char *args, int from_tty) monitor_open (args, &dbug_cmds, from_tty); } +extern initialize_file_ftype _initialize_dbug_rom; /* -Wmissing-prototypes */ + void _initialize_dbug_rom (void) { diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 752efdd..fbfd1a9 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1232,7 +1232,7 @@ read_dbx_dynamic_symtab (struct objfile *objfile) } #ifdef SOFUN_ADDRESS_MAYBE_MISSING -CORE_ADDR +static CORE_ADDR find_stab_function_addr (char *namestring, char *filename, struct objfile *objfile) { @@ -2484,7 +2484,6 @@ dbx_psymtab_to_symtab_1 (struct partial_symtab *pst) /* Read in this file's symbols */ bfd_seek (pst->objfile->obfd, SYMBOL_OFFSET (pst), SEEK_SET); read_ofile_symtab (pst); - sort_symtab_syms (pst->symtab); do_cleanups (old_chain); } diff --git a/gdb/defs.h b/gdb/defs.h index 492afe5..eb7ae08 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -405,6 +405,8 @@ extern void reinitialize_more_filter (void); /* Normal results */ extern struct ui_file *gdb_stdout; +/* Input stream */ +extern struct ui_file *gdb_stdin; /* Serious error notifications */ extern struct ui_file *gdb_stderr; /* Log/debug/trace messages that should bypass normal stdout/stderr @@ -417,6 +419,8 @@ extern struct ui_file *gdb_stdlog; very near future that restriction shall be removed - either call shall be unfiltered. (cagney 1999-07-02). */ extern struct ui_file *gdb_stdtarg; +extern struct ui_file *gdb_stdtargerr; +extern struct ui_file *gdb_stdtargin; #if defined(TUI) #include "tui.h" @@ -881,6 +885,9 @@ extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (pri extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN; +/* Initialize the error buffer. */ +extern void error_init (void); + /* Returns a freshly allocate buffer containing the last error message. */ extern char *error_last_message (void); diff --git a/gdb/dictionary.c b/gdb/dictionary.c new file mode 100644 index 0000000..3802000 --- /dev/null +++ b/gdb/dictionary.c @@ -0,0 +1,836 @@ +/* Routines for name->symbol lookups in GDB. + + Copyright 2003 Free Software Foundation, Inc. + + Contributed by David Carlton and by Kealia, + 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 "gdb_obstack.h" +#include "symtab.h" +#include "buildsym.h" +#include "gdb_assert.h" +#include "dictionary.h" + +/* This file implements dictionaries, which are tables that associate + symbols to names. They are represented by an opaque type 'struct + dictionary'. That type has various internal implementations, which + you can choose between depending on what properties you need + (e.g. fast lookup, order-preserving, expandable). + + Each dictionary starts with a 'virtual function table' that + contains the functions that actually implement the various + operations that dictionaries provide. (Note, however, that, for + the sake of client code, we also provide some functions that can be + implemented generically in terms of the functions in the vtable.) + + To add a new dictionary implementation , what you should do + is: + + * Add a new element DICT_ to dict_type. + + * Create a new structure dictionary_. If your new + implementation is a variant of an existing one, make sure that + their structs have the same initial data members. Define accessor + macros for your new data members. + + * Implement all the functions in dict_vector as static functions, + whose name is the same as the corresponding member of dict_vector + plus _. You don't have to do this for those members where + you can reuse existing generic functions + (e.g. add_symbol_nonexpandable, free_obstack) or in the case where + your new implementation is a variant of an existing implementation + and where the variant doesn't affect the member function in + question. + + * Define a static const struct dict_vector dict__vector. + + * Define a function dict_create_ to create these + gizmos. Add its declaration to dictionary.h. + + To add a new operation on all existing implementations, what + you should do is: + + * Add a new member to struct dict_vector. + + * If there is useful generic behavior , define a static + function _something_informative that implements that behavior. + (E.g. add_symbol_nonexpandable, free_obstack.) + + * For every implementation that should have its own specific + behavior for , define a static function _ + implementing it. + + * Modify all existing dict_vector_'s to include the appropriate + member. + + * Define a function dict_ that looks up in the dict_vector + and calls the appropriate function. Add a declaration for + dict_ to dictionary.h. + +*/ + +/* An enum representing the various implementations of dictionaries. + Used only for debugging. */ + +enum dict_type + { + /* Symbols are stored in a fixed-size hash table. */ + DICT_HASHED, + /* Symbols are stored in an expandable hash table. */ + DICT_HASHED_EXPANDABLE, + /* Symbols are stored in a fixed-size array. */ + DICT_LINEAR, + /* Symbols are stored in an expandable array. */ + DICT_LINEAR_EXPANDABLE, + }; + +/* The virtual function table. */ + +struct dict_vector +{ + /* The type of the dictionary. This is only here to make debugging + a bit easier; it's not actually used. */ + enum dict_type type; + /* The function to free a dictionary. */ + void (*free) (struct dictionary *dict); + /* Add a symbol to a dictionary, if possible. */ + void (*add_symbol) (struct dictionary *dict, struct symbol *sym); + /* Iterator functions. */ + struct symbol *(*iterator_first) (const struct dictionary *dict, + struct dict_iterator *iterator); + struct symbol *(*iterator_next) (struct dict_iterator *iterator); + /* Functions to iterate over symbols with a given name. */ + struct symbol *(*iter_name_first) (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator); + struct symbol *(*iter_name_next) (const char *name, + struct dict_iterator *iterator); + /* A size function, for maint print symtabs. */ + int (*size) (const struct dictionary *dict); +}; + +/* Now comes the structs used to store the data for different + implementations. If two implementations have data in common, put + the common data at the top of their structs, ordered in the same + way. */ + +struct dictionary_hashed +{ + int nbuckets; + struct symbol **buckets; +}; + +struct dictionary_hashed_expandable +{ + /* How many buckets we currently have. */ + int nbuckets; + struct symbol **buckets; + /* How many syms we currently have; we need this so we will know + when to add more buckets. */ + int nsyms; +}; + +struct dictionary_linear +{ + int nsyms; + struct symbol **syms; +}; + +struct dictionary_linear_expandable +{ + /* How many symbols we currently have. */ + int nsyms; + struct symbol **syms; + /* How many symbols we can store before needing to reallocate. */ + int capacity; +}; + +/* And now, the star of our show. */ + +struct dictionary +{ + const struct dict_vector *vector; + union + { + struct dictionary_hashed hashed; + struct dictionary_hashed_expandable hashed_expandable; + struct dictionary_linear linear; + struct dictionary_linear_expandable linear_expandable; + } + data; +}; + +/* Accessor macros. */ + +#define DICT_VECTOR(d) (d)->vector + +/* These can be used for DICT_HASHED_EXPANDABLE, too. */ + +#define DICT_HASHED_NBUCKETS(d) (d)->data.hashed.nbuckets +#define DICT_HASHED_BUCKETS(d) (d)->data.hashed.buckets +#define DICT_HASHED_BUCKET(d,i) DICT_HASHED_BUCKETS (d) [i] + +#define DICT_HASHED_EXPANDABLE_NSYMS(d) (d)->data.hashed_expandable.nsyms + +/* These can be used for DICT_LINEAR_EXPANDABLEs, too. */ + +#define DICT_LINEAR_NSYMS(d) (d)->data.linear.nsyms +#define DICT_LINEAR_SYMS(d) (d)->data.linear.syms +#define DICT_LINEAR_SYM(d,i) DICT_LINEAR_SYMS (d) [i] + +#define DICT_LINEAR_EXPANDABLE_CAPACITY(d) \ + (d)->data.linear_expandable.capacity + +/* The initial size of a DICT_*_EXPANDABLE dictionary. */ + +#define DICT_EXPANDABLE_INITIAL_CAPACITY 10 + +/* This calculates the number of buckets we'll use in a hashtable, + given the number of symbols that it will contain. */ + +#define DICT_HASHTABLE_SIZE(n) ((n)/5 + 1) + +/* Accessor macros for dict_iterators; they're here rather than + dictionary.h because code elsewhere should treat dict_iterators as + opaque. */ + +/* The dictionary that the iterator is associated to. */ +#define DICT_ITERATOR_DICT(iter) (iter)->dict +/* For linear dictionaries, the index of the last symbol returned; for + hashed dictionaries, the bucket of the last symbol returned. */ +#define DICT_ITERATOR_INDEX(iter) (iter)->index +/* For hashed dictionaries, this points to the last symbol returned; + otherwise, this is unused. */ +#define DICT_ITERATOR_CURRENT(iter) (iter)->current + +/* Declarations of functions for vectors. */ + +/* Functions that might work across a range of dictionary types. */ + +static void add_symbol_nonexpandable (struct dictionary *dict, + struct symbol *sym); + +static void free_obstack (struct dictionary *dict); + +/* Functions for DICT_HASHED and DICT_HASHED_EXPANDABLE + dictionaries. */ + +static struct symbol *iterator_first_hashed (const struct dictionary *dict, + struct dict_iterator *iterator); + +static struct symbol *iterator_next_hashed (struct dict_iterator *iterator); + +static struct symbol *iter_name_first_hashed (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator); + +static struct symbol *iter_name_next_hashed (const char *name, + struct dict_iterator *iterator); + +/* Functions only for DICT_HASHED. */ + +static int size_hashed (const struct dictionary *dict); + +/* Functions only for DICT_HASHED_EXPANDABLE. */ + +static void free_hashed_expandable (struct dictionary *dict); + +static void add_symbol_hashed_expandable (struct dictionary *dict, + struct symbol *sym); + +static int size_hashed_expandable (const struct dictionary *dict); + +/* Functions for DICT_LINEAR and DICT_LINEAR_EXPANDABLE + dictionaries. */ + +static struct symbol *iterator_first_linear (const struct dictionary *dict, + struct dict_iterator *iterator); + +static struct symbol *iterator_next_linear (struct dict_iterator *iterator); + +static struct symbol *iter_name_first_linear (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator); + +static struct symbol *iter_name_next_linear (const char *name, + struct dict_iterator *iterator); + +static int size_linear (const struct dictionary *dict); + +/* Functions only for DICT_LINEAR_EXPANDABLE. */ + +static void free_linear_expandable (struct dictionary *dict); + +static void add_symbol_linear_expandable (struct dictionary *dict, + struct symbol *sym); + +/* Various vectors that we'll actually use. */ + +static const struct dict_vector dict_hashed_vector = + { + DICT_HASHED, /* type */ + free_obstack, /* free */ + add_symbol_nonexpandable, /* add_symbol */ + iterator_first_hashed, /* iteractor_first */ + iterator_next_hashed, /* iterator_next */ + iter_name_first_hashed, /* iter_name_first */ + iter_name_next_hashed, /* iter_name_next */ + size_hashed, /* size */ + }; + +static const struct dict_vector dict_hashed_expandable_vector = + { + DICT_HASHED_EXPANDABLE, /* type */ + free_hashed_expandable, /* free */ + add_symbol_hashed_expandable, /* add_symbol */ + iterator_first_hashed, /* iteractor_first */ + iterator_next_hashed, /* iterator_next */ + iter_name_first_hashed, /* iter_name_first */ + iter_name_next_hashed, /* iter_name_next */ + size_hashed_expandable, /* size */ + }; + +static const struct dict_vector dict_linear_vector = + { + DICT_LINEAR, /* type */ + free_obstack, /* free */ + add_symbol_nonexpandable, /* add_symbol */ + iterator_first_linear, /* iteractor_first */ + iterator_next_linear, /* iterator_next */ + iter_name_first_linear, /* iter_name_first */ + iter_name_next_linear, /* iter_name_next */ + size_linear, /* size */ + }; + +static const struct dict_vector dict_linear_expandable_vector = + { + DICT_LINEAR_EXPANDABLE, /* type */ + free_linear_expandable, /* free */ + add_symbol_linear_expandable, /* add_symbol */ + iterator_first_linear, /* iteractor_first */ + iterator_next_linear, /* iterator_next */ + iter_name_first_linear, /* iter_name_first */ + iter_name_next_linear, /* iter_name_next */ + size_linear, /* size */ + }; + +/* Declarations of helper functions (i.e. ones that don't go into + vectors). */ + +static struct symbol *iterator_hashed_advance (struct dict_iterator *iter); + +static void insert_symbol_hashed (struct dictionary *dict, + struct symbol *sym); + +static void expand_hashtable (struct dictionary *dict); + +/* The creation functions. */ + +/* Create a dictionary implemented via a fixed-size hashtable. All + memory it uses is allocated on OBSTACK; the environment is + initialized from SYMBOL_LIST. */ + +struct dictionary * +dict_create_hashed (struct obstack *obstack, + const struct pending *symbol_list) +{ + struct dictionary *retval; + int nsyms = 0, nbuckets, i; + struct symbol **buckets; + const struct pending *list_counter; + + retval = obstack_alloc (obstack, sizeof (struct dictionary)); + DICT_VECTOR (retval) = &dict_hashed_vector; + + /* Calculate the number of symbols, and allocate space for them. */ + for (list_counter = symbol_list; + list_counter != NULL; + list_counter = list_counter->next) + { + nsyms += list_counter->nsyms; + } + nbuckets = DICT_HASHTABLE_SIZE (nsyms); + DICT_HASHED_NBUCKETS (retval) = nbuckets; + buckets = obstack_alloc (obstack, nbuckets * sizeof (struct symbol *)); + memset (buckets, 0, nbuckets * sizeof (struct symbol *)); + DICT_HASHED_BUCKETS (retval) = buckets; + + /* Now fill the buckets. */ + for (list_counter = symbol_list; + list_counter != NULL; + list_counter = list_counter->next) + { + for (i = list_counter->nsyms - 1; i >= 0; --i) + { + insert_symbol_hashed (retval, list_counter->symbol[i]); + } + } + + return retval; +} + +/* Create a dictionary implemented via a hashtable that grows as + necessary. The dictionary is initially empty; to add symbols to + it, call dict_add_symbol(). Call dict_free() when you're done with + it. */ + +extern struct dictionary * +dict_create_hashed_expandable (void) +{ + struct dictionary *retval; + + retval = xmalloc (sizeof (struct dictionary)); + DICT_VECTOR (retval) = &dict_hashed_expandable_vector; + DICT_HASHED_NBUCKETS (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY; + DICT_HASHED_BUCKETS (retval) = xcalloc (DICT_EXPANDABLE_INITIAL_CAPACITY, + sizeof (struct symbol *)); + DICT_HASHED_EXPANDABLE_NSYMS (retval) = 0; + + return retval; +} + +/* Create a dictionary implemented via a fixed-size array. All memory + it uses is allocated on OBSTACK; the environment is initialized + from the SYMBOL_LIST. The symbols are ordered in the same order + that they're found in SYMBOL_LIST. */ + +struct dictionary * +dict_create_linear (struct obstack *obstack, + const struct pending *symbol_list) +{ + struct dictionary *retval; + int nsyms = 0, i, j; + struct symbol **syms; + const struct pending *list_counter; + + retval = obstack_alloc (obstack, sizeof (struct dictionary)); + DICT_VECTOR (retval) = &dict_linear_vector; + + /* Calculate the number of symbols, and allocate space for them. */ + for (list_counter = symbol_list; + list_counter != NULL; + list_counter = list_counter->next) + { + nsyms += list_counter->nsyms; + } + DICT_LINEAR_NSYMS (retval) = nsyms; + syms = obstack_alloc (obstack, nsyms * sizeof (struct symbol *)); + DICT_LINEAR_SYMS (retval) = syms; + + /* Now fill in the symbols. Start filling in from the back, so as + to preserve the original order of the symbols. */ + for (list_counter = symbol_list, j = nsyms - 1; + list_counter != NULL; + list_counter = list_counter->next) + { + for (i = list_counter->nsyms - 1; + i >= 0; + --i, --j) + { + syms[j] = list_counter->symbol[i]; + } + } + + return retval; +} + +/* Create a dictionary implemented via an array that grows as + necessary. The dictionary is initially empty; to add symbols to + it, call dict_add_symbol(). Call dict_free() when you're done with + it. */ + +struct dictionary * +dict_create_linear_expandable (void) +{ + struct dictionary *retval; + + retval = xmalloc (sizeof (struct dictionary)); + DICT_VECTOR (retval) = &dict_linear_expandable_vector; + DICT_LINEAR_NSYMS (retval) = 0; + DICT_LINEAR_EXPANDABLE_CAPACITY (retval) + = DICT_EXPANDABLE_INITIAL_CAPACITY; + DICT_LINEAR_SYMS (retval) + = xmalloc (DICT_LINEAR_EXPANDABLE_CAPACITY (retval) + * sizeof (struct symbol *)); + + return retval; +} + +/* The functions providing the dictionary interface. */ + +/* Free the memory used by a dictionary that's not on an obstack. (If + any.) */ + +void +dict_free (struct dictionary *dict) +{ + (DICT_VECTOR (dict))->free (dict); +} + +/* Add SYM to DICT. DICT had better be expandable. */ + +void +dict_add_symbol (struct dictionary *dict, struct symbol *sym) +{ + (DICT_VECTOR (dict))->add_symbol (dict, sym); +} + +/* Initialize ITERATOR to point at the first symbol in DICT, and + return that first symbol, or NULL if DICT is empty. */ + +struct symbol * +dict_iterator_first (const struct dictionary *dict, + struct dict_iterator *iterator) +{ + return (DICT_VECTOR (dict))->iterator_first (dict, iterator); +} + +/* Advance ITERATOR, and return the next symbol, or NULL if there are + no more symbols. */ + +struct symbol * +dict_iterator_next (struct dict_iterator *iterator) +{ + return (DICT_VECTOR (DICT_ITERATOR_DICT (iterator))) + ->iterator_next (iterator); +} + +struct symbol * +dict_iter_name_first (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator) +{ + return (DICT_VECTOR (dict))->iter_name_first (dict, name, iterator); +} + +struct symbol * +dict_iter_name_next (const char *name, struct dict_iterator *iterator) +{ + return (DICT_VECTOR (DICT_ITERATOR_DICT (iterator))) + ->iter_name_next (name, iterator); +} + +int +dict_size (const struct dictionary *dict) +{ + return (DICT_VECTOR (dict))->size (dict); +} + +/* Now come functions (well, one function, currently) that are + implemented generically by means of the vtable. Typically, they're + rarely used. */ + +/* Test to see if DICT is empty. */ + +int +dict_empty (struct dictionary *dict) +{ + struct dict_iterator iter; + + return (dict_iterator_first (dict, &iter) == NULL); +} + + +/* The functions implementing the dictionary interface. */ + +/* Generic functions, where appropriate. */ + +static void +free_obstack (struct dictionary *dict) +{ + /* Do nothing! */ +} + +static void +add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym) +{ + internal_error (__FILE__, __LINE__, + "dict_add_symbol: non-expandable dictionary"); +} + +/* Functions for DICT_HASHED and DICT_HASHED_EXPANDABLE. */ + +static struct symbol * +iterator_first_hashed (const struct dictionary *dict, + struct dict_iterator *iterator) +{ + DICT_ITERATOR_DICT (iterator) = dict; + DICT_ITERATOR_INDEX (iterator) = -1; + return iterator_hashed_advance (iterator); +} + +static struct symbol * +iterator_next_hashed (struct dict_iterator *iterator) +{ + const struct dictionary *dict = DICT_ITERATOR_DICT (iterator); + struct symbol *next; + + next = DICT_ITERATOR_CURRENT (iterator)->hash_next; + + if (next == NULL) + return iterator_hashed_advance (iterator); + else + { + DICT_ITERATOR_CURRENT (iterator) = next; + return next; + } +} + +static struct symbol * +iterator_hashed_advance (struct dict_iterator *iterator) +{ + const struct dictionary *dict = DICT_ITERATOR_DICT (iterator); + int nbuckets = DICT_HASHED_NBUCKETS (dict); + int i; + + for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nbuckets; ++i) + { + struct symbol *sym = DICT_HASHED_BUCKET (dict, i); + + if (sym != NULL) + { + DICT_ITERATOR_INDEX (iterator) = i; + DICT_ITERATOR_CURRENT (iterator) = sym; + return sym; + } + } + + return NULL; +} + +static struct symbol * +iter_name_first_hashed (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator) +{ + unsigned int hash_index + = msymbol_hash_iw (name) % DICT_HASHED_NBUCKETS (dict); + struct symbol *sym; + + DICT_ITERATOR_DICT (iterator) = dict; + + /* Loop through the symbols in the given bucket, breaking when SYM + first matches. If SYM never matches, it will be set to NULL; + either way, we have the right return value. */ + + for (sym = DICT_HASHED_BUCKET (dict, hash_index); + sym != NULL; + sym = sym->hash_next) + { + /* Warning: the order of arguments to strcmp_iw matters! */ + if (strcmp_iw (SYMBOL_NATURAL_NAME (sym), name) == 0) + { + break; + } + + } + + DICT_ITERATOR_CURRENT (iterator) = sym; + return sym; +} + +static struct symbol * +iter_name_next_hashed (const char *name, struct dict_iterator *iterator) +{ + struct symbol *next; + + for (next = DICT_ITERATOR_CURRENT (iterator)->hash_next; + next != NULL; + next = next->hash_next) + { + if (strcmp_iw (SYMBOL_NATURAL_NAME (next), name) == 0) + break; + } + + DICT_ITERATOR_CURRENT (iterator) = next; + + return next; +} + +/* Insert SYM into DICT. */ + +static void +insert_symbol_hashed (struct dictionary *dict, + struct symbol *sym) +{ + unsigned int hash_index; + struct symbol **buckets = DICT_HASHED_BUCKETS (dict); + + hash_index = (msymbol_hash_iw (SYMBOL_NATURAL_NAME (sym)) + % DICT_HASHED_NBUCKETS (dict)); + sym->hash_next = buckets[hash_index]; + buckets[hash_index] = sym; +} + +static int +size_hashed (const struct dictionary *dict) +{ + return DICT_HASHED_NBUCKETS (dict); +} + +/* Functions only for DICT_HASHED_EXPANDABLE. */ + +static void +free_hashed_expandable (struct dictionary *dict) +{ + xfree (DICT_HASHED_BUCKETS (dict)); + xfree (dict); +} + +static void +add_symbol_hashed_expandable (struct dictionary *dict, + struct symbol *sym) +{ + int nsyms = ++DICT_HASHED_EXPANDABLE_NSYMS (dict); + + if (DICT_HASHTABLE_SIZE (nsyms) > DICT_HASHED_NBUCKETS (dict)) + expand_hashtable (dict); + + insert_symbol_hashed (dict, sym); + DICT_HASHED_EXPANDABLE_NSYMS (dict) = nsyms; +} + +static int +size_hashed_expandable (const struct dictionary *dict) +{ + return DICT_HASHED_EXPANDABLE_NSYMS (dict); +} + +static void +expand_hashtable (struct dictionary *dict) +{ + int old_nbuckets = DICT_HASHED_NBUCKETS (dict); + struct symbol **old_buckets = DICT_HASHED_BUCKETS (dict); + int new_nbuckets = 2*old_nbuckets + 1; + struct symbol **new_buckets = xcalloc (new_nbuckets, + sizeof (struct symbol *)); + int i; + + DICT_HASHED_NBUCKETS (dict) = new_nbuckets; + DICT_HASHED_BUCKETS (dict) = new_buckets; + + for (i = 0; i < old_nbuckets; ++i) { + struct symbol *sym, *next_sym; + + sym = old_buckets[i]; + if (sym != NULL) { + for (next_sym = sym->hash_next; + next_sym != NULL; + next_sym = sym->hash_next) { + insert_symbol_hashed (dict, sym); + sym = next_sym; + } + + insert_symbol_hashed (dict, sym); + } + } + + xfree (old_buckets); +} + +/* Functions for DICT_LINEAR and DICT_LINEAR_EXPANDABLE. */ + +static struct symbol * +iterator_first_linear (const struct dictionary *dict, + struct dict_iterator *iterator) +{ + DICT_ITERATOR_DICT (iterator) = dict; + DICT_ITERATOR_INDEX (iterator) = 0; + return DICT_LINEAR_NSYMS (dict) ? DICT_LINEAR_SYM (dict, 0) : NULL; +} + +static struct symbol * +iterator_next_linear (struct dict_iterator *iterator) +{ + const struct dictionary *dict = DICT_ITERATOR_DICT (iterator); + + if (++DICT_ITERATOR_INDEX (iterator) >= DICT_LINEAR_NSYMS (dict)) + return NULL; + else + return DICT_LINEAR_SYM (dict, DICT_ITERATOR_INDEX (iterator)); +} + +static struct symbol * +iter_name_first_linear (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator) +{ + DICT_ITERATOR_DICT (iterator) = dict; + DICT_ITERATOR_INDEX (iterator) = -1; + + return iter_name_next_linear (name, iterator); +} + +static struct symbol * +iter_name_next_linear (const char *name, struct dict_iterator *iterator) +{ + const struct dictionary *dict = DICT_ITERATOR_DICT (iterator); + int i, nsyms = DICT_LINEAR_NSYMS (dict); + struct symbol *sym, *retval = NULL; + + for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nsyms; ++i) + { + sym = DICT_LINEAR_SYM (dict, i); + if (strcmp_iw (SYMBOL_NATURAL_NAME (sym), name) == 0) + { + retval = sym; + break; + } + } + + DICT_ITERATOR_INDEX (iterator) = i; + + return retval; +} + +static int +size_linear (const struct dictionary *dict) +{ + return DICT_LINEAR_NSYMS (dict); +} + +/* Functions only for DICT_LINEAR_EXPANDABLE. */ + +static void +free_linear_expandable (struct dictionary *dict) +{ + xfree (DICT_LINEAR_SYMS (dict)); + xfree (dict); +} + + +static void +add_symbol_linear_expandable (struct dictionary *dict, + struct symbol *sym) +{ + int nsyms = ++DICT_LINEAR_NSYMS (dict); + + /* Do we have enough room? If not, grow it. */ + if (nsyms > DICT_LINEAR_EXPANDABLE_CAPACITY (dict)) { + DICT_LINEAR_EXPANDABLE_CAPACITY (dict) *= 2; + DICT_LINEAR_SYMS (dict) + = xrealloc (DICT_LINEAR_SYMS (dict), + DICT_LINEAR_EXPANDABLE_CAPACITY (dict) + * sizeof (struct symbol *)); + } + + DICT_LINEAR_SYM (dict, nsyms - 1) = sym; +} diff --git a/gdb/dictionary.h b/gdb/dictionary.h new file mode 100644 index 0000000..75edd7f --- /dev/null +++ b/gdb/dictionary.h @@ -0,0 +1,156 @@ +/* Routines for name->symbol lookups in GDB. + + Copyright 2003 Free Software Foundation, Inc. + + Contributed by David Carlton and by Kealia, + 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 DICTIONARY_H +#define DICTIONARY_H + +/* An opaque type for dictionaries; only dictionary.c should know + about its innards. */ + +struct dictionary; + +/* Other types needed for declarations. */ + +struct symbol; +struct obstack; +struct pending; + + +/* The creation functions for various implementations of + dictionaries. */ + +/* Create a dictionary implemented via a fixed-size hashtable. All + memory it uses is allocated on OBSTACK; the environment is + initialized from SYMBOL_LIST. */ + +extern struct dictionary *dict_create_hashed (struct obstack *obstack, + const struct pending + *symbol_list); + +/* Create a dictionary implemented via a hashtable that grows as + necessary. The dictionary is initially empty; to add symbols to + it, call dict_add_symbol(). Call dict_free() when you're done with + it. */ + +extern struct dictionary *dict_create_hashed_expandable (void); + +/* Create a dictionary implemented via a fixed-size array. All memory + it uses is allocated on OBSTACK; the environment is initialized + from the SYMBOL_LIST. The symbols are ordered in the same order + that they're found in SYMBOL_LIST. */ + +extern struct dictionary *dict_create_linear (struct obstack *obstack, + const struct pending + *symbol_list); + +/* Create a dictionary implemented via an array that grows as + necessary. The dictionary is initially empty; to add symbols to + it, call dict_add_symbol(). Call dict_free() when you're done with + it. */ + +extern struct dictionary *dict_create_linear_expandable (void); + + +/* The functions providing the interface to dictionaries. Note that + the most common parts of the interface, namely symbol lookup, are + only provided via iterator functions. */ + +/* Free the memory used by a dictionary that's not on an obstack. (If + any.) */ + +extern void dict_free (struct dictionary *dict); + +/* Add a symbol to an expandable dictionary. */ + +extern void dict_add_symbol (struct dictionary *dict, struct symbol *sym); + +/* Is the dictionary empty? */ + +extern int dict_empty (struct dictionary *dict); + +/* A type containing data that is used when iterating over all symbols + in a dictionary. Don't ever look at its innards; this type would + be opaque if we didn't need to be able to allocate it on the + stack. */ + +struct dict_iterator +{ + /* The dictionary that this iterator is associated to. */ + const struct dictionary *dict; + /* The next two members are data that is used in a way that depends + on DICT's implementation type. */ + int index; + struct symbol *current; +}; + +/* Initialize ITERATOR to point at the first symbol in DICT, and + return that first symbol, or NULL if DICT is empty. */ + +extern struct symbol *dict_iterator_first (const struct dictionary *dict, + struct dict_iterator *iterator); + +/* Advance ITERATOR, and return the next symbol, or NULL if there are + no more symbols. Don't call this if you've previously received + NULL from dict_iterator_first or dict_iterator_next on this + iteration. */ + +extern struct symbol *dict_iterator_next (struct dict_iterator *iterator); + +/* Initialize ITERATOR to point at the first symbol in DICT whose + SYMBOL_BEST_NAME is NAME (as tested using strcmp_iw), and return + that first symbol, or NULL if there are no such symbols. */ + +extern struct symbol *dict_iter_name_first (const struct dictionary *dict, + const char *name, + struct dict_iterator *iterator); + +/* Advance ITERATOR to point at the next symbol in DICT whose + SYMBOL_BEST_NAME is NAME (as tested using strcmp_iw), or NULL if + there are no more such symbols. Don't call this if you've + previously received NULL from dict_iterator_first or + dict_iterator_next on this iteration. And don't call it unless + ITERATOR was created by a previous call to dict_iter_name_first + with the same NAME. */ + +extern struct symbol *dict_iter_name_next (const char *name, + struct dict_iterator *iterator); + +/* Return some notion of the size of the dictionary: the number of + symbols if we have that, the number of hash buckets otherwise. */ + +extern int dict_size (const struct dictionary *dict); + +/* Macro to loop through all symbols in a dictionary DICT, in no + particular order. ITER is a struct dict_iterator (NOTE: __not__ a + struct dict_iterator *), and SYM points to the current symbol. + + It's implemented as a single loop, so you can terminate the loop + early by a break if you desire. */ + +#define ALL_DICT_SYMBOLS(dict, iter, sym) \ + for ((sym) = dict_iterator_first ((dict), &(iter)); \ + (sym); \ + (sym) = dict_iterator_next (&(iter))) + +#endif /* DICTIONARY_H */ diff --git a/gdb/dink32-rom.c b/gdb/dink32-rom.c index f62e712..3b10c7c 100644 --- a/gdb/dink32-rom.c +++ b/gdb/dink32-rom.c @@ -142,6 +142,8 @@ dink32_open (char *args, int from_tty) monitor_open (args, &dink32_cmds, from_tty); } +extern initialize_file_ftype _initialize_dink32_rom; /* -Wmissing-prototypes */ + void _initialize_dink32_rom (void) { diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 5530f7b..7dcda46 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,27 @@ +2003-06-13 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Deprecate + REMOTE_BREAKPOINT, LITTLE_REMOTE_BREAKPOINT, and + BIG_REMOTE_BREAKPOINT. Cross reference BREAKPOINT_FROM_PC. + +2003-06-09 Jim Blandy + + * gdb.texinfo (Separate Debug Files): Remove extra semicolon. + +2003-06-08 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Delete + documentation on FRAME_ARGS_ADDRESS_CORRECT. + +2003-06-08 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Document + "unwind_sp". Cross reference "unwind_sp" and TARGET_READ_SP. + +2003-06-07 Adam Fedor + + * gdb.texinfo: Add Objective-C documentation. + 2003-06-01 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Add "func_addr" diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9136e65..95fd5a0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -210,6 +210,9 @@ syntax. it may be necessary to refer to some variables with a trailing underscore. +@value{GDBN} can be used to debug programs written in Objective-C, +using either the Apple/NeXT or the GNU Objective-C runtime. + @menu * Free Software:: Freely redistributable software * Contributors:: Contributors to GDB @@ -3180,7 +3183,8 @@ end @cindex overloading @cindex symbol overloading -Some programming languages (notably C@t{++}) permit a single function name +Some programming languages (notably C@t{++} and Objective-C) permit a +single function name to be defined several times, for application in different contexts. This is called @dfn{overloading}. When a function name is overloaded, @samp{break @var{function}} is not enough to tell @value{GDBN} where you want @@ -7487,6 +7491,9 @@ C source file @itemx .c++ C@t{++} source file +@item .m +Objective-C source file + @item .f @itemx .F Fortran source file @@ -7762,7 +7769,7 @@ being set automatically by @value{GDBN}. @node Support @section Supported languages -@value{GDBN} supports C, C@t{++}, Fortran, Java, assembly, and Modula-2. +@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, and Modula-2. @c This is false ... Some @value{GDBN} features may be used in expressions regardless of the language you use: the @value{GDBN} @code{@@} and @code{::} operators, @@ -7779,8 +7786,9 @@ books written on each of these languages; please look to these for a language reference or tutorial. @menu -* C:: C and C@t{++} -* Modula-2:: Modula-2 +* C:: C and C@t{++} +* Objective-C:: Objective-C +* Modula-2:: Modula-2 @end menu @node C @@ -8297,7 +8305,101 @@ available choices, or to finish the type list for you. @xref{Completion,, Command completion}, for details on how to do this. @end table -@node Modula-2 +@node Objective-C +@subsection Objective-C + +@cindex Objective-C +This section provides information about some commands and command +options that are useful for debugging Objective-C code. + +@menu +* Method Names in Commands:: +* The Print Command with Objective-C:: +@end menu + +@node Method Names in Commands, The Print Command with Objective-C, Objective-C, Objective-C +@subsubsection Method Names in Commands + +The following commands have been extended to accept Objective-C method +names as line specifications: + +@kindex clear@r{, and Objective-C} +@kindex break@r{, and Objective-C} +@kindex info line@r{, and Objective-C} +@kindex jump@r{, and Objective-C} +@kindex list@r{, and Objective-C} +@itemize +@item @code{clear} +@item @code{break} +@item @code{info line} +@item @code{jump} +@item @code{list} +@end itemize + +A fully qualified Objective-C method name is specified as + +@smallexample +-[@var{Class} @var{methodName}] +@end smallexample + +where the minus sign is used to indicate an instance method and a plus +sign (not shown) is used to indicate a class method. The +class name @var{Class} and method name @var{methoName} are enclosed in +brackets, similar to the way messages are specified in Objective-C source +code. For example, to set a breakpoint at the @code{create} instance method of +class @code{Fruit} in the program currently being debugged, enter: + +@smallexample +break -[Fruit create] +@end smallexample + +To list ten program lines around the @code{initialize} class method, +enter: + +@smallexample +list +[NSText initialize] +@end smallexample + +In the current version of GDB, the plus or minus sign is required. In +future versions of GDB, the plus or minus sign will be optional, but you +can use it to narrow the search. It is also possible to specify just a +method name: + +@smallexample +break create +@end smallexample + +You must specify the complete method name, including any colons. If +your program's source files contain more than one @code{create} method, +you'll be presented with a numbered list of classes that implement that +method. Indicate your choice by number, or type @samp{0} to exit if +none apply. + +As another example, to clear a breakpoint established at the +@code{makeKeyAndOrderFront:} method of the @code{NSWindow} class, enter: + +@smallexample +clear -[NSWindow makeKeyAndOrderFront:] +@end smallexample + +@node The Print Command with Objective-C +@subsubsection The Print Command With Objective-C + +The print command has also been extended to accept methods. For example: + +@smallexample +print -[object hash] +@end smallexample + +@cindex print an Objective-C object description +will tell gdb to send the -hash message to object and print the +result. Also an additional command has been added, @code{print-object} +or @code{po} for short, which is meant to print the description of an +object. However, this command may only work with certain Objective-C +libraries that have a particular hook function, called +@code{_NSPrintForDebugger} defined. + +@node Modula-2, , Objective-C, Support @subsection Modula-2 @cindex Modula-2, @value{GDBN} support @@ -8937,6 +9039,20 @@ Print the names and data types of all variables (except for local variables) whose names contain a match for regular expression @var{regexp}. +@kindex info classes +@item info classes +@itemx info classes @var{regexp} +Display all Objective-C classes in your program, or +(with the @var{regexp} argument) all those matching a particular regular +expression. + +@kindex info selectors +@item info selectors +@itemx info selectors @var{regexp} +Display all Objective-C selectors in your program, or +(with the @var{regexp} argument) all those matching a particular regular +expression. + @ignore This was never implemented. @kindex info methods @@ -10011,7 +10127,7 @@ gnu_debuglink_crc32 (unsigned long crc, crc = ~crc & 0xffffffff; for (end = buf + len; buf < end; ++buf) crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); - return ~crc & 0xffffffff;; + return ~crc & 0xffffffff; @} @end smallexample diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index dc5c6b8..68ff5dc 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3012,24 +3012,26 @@ Similar to BREAKPOINT, but used for bi-endian targets. @code{BIG_BREAKPOINT} and @code{LITTLE_BREAKPOINT} have been deprecated in favor of @code{BREAKPOINT_FROM_PC}. -@item REMOTE_BREAKPOINT -@itemx LITTLE_REMOTE_BREAKPOINT -@itemx BIG_REMOTE_BREAKPOINT -@findex BIG_REMOTE_BREAKPOINT -@findex LITTLE_REMOTE_BREAKPOINT -@findex REMOTE_BREAKPOINT -Similar to BREAKPOINT, but used for remote targets. - -@code{BIG_REMOTE_BREAKPOINT} and @code{LITTLE_REMOTE_BREAKPOINT} have been -deprecated in favor of @code{BREAKPOINT_FROM_PC}. +@item DEPRECATED_REMOTE_BREAKPOINT +@itemx DEPRECATED_LITTLE_REMOTE_BREAKPOINT +@itemx DEPRECATED_BIG_REMOTE_BREAKPOINT +@findex DEPRECATED_BIG_REMOTE_BREAKPOINT +@findex DEPRECATED_LITTLE_REMOTE_BREAKPOINT +@findex DEPRECATED_REMOTE_BREAKPOINT +Specify the breakpoint instruction sequence for a remote target. +@code{DEPRECATED_REMOTE_BREAKPOINT}, +@code{DEPRECATED_BIG_REMOTE_BREAKPOINT} and +@code{DEPRECATED_LITTLE_REMOTE_BREAKPOINT} have been deprecated in +favor of @code{BREAKPOINT_FROM_PC} (@pxref{BREAKPOINT_FROM_PC}). @item BREAKPOINT_FROM_PC (@var{pcptr}, @var{lenptr}) @findex BREAKPOINT_FROM_PC -Use the program counter to determine the contents and size of a -breakpoint instruction. It returns a pointer to a string of bytes -that encode a breakpoint instruction, stores the length of the string -to *@var{lenptr}, and adjusts pc (if necessary) to point to the actual -memory location where the breakpoint should be inserted. +@anchor{BREAKPOINT_FROM_PC} Use the program counter to determine the +contents and size of a breakpoint instruction. It returns a pointer to +a string of bytes that encode a breakpoint instruction, stores the +length of the string to @code{*@var{lenptr}}, and adjusts the program +counter (if necessary) to point to the actual memory location where the +breakpoint should be inserted. Although it is common to use a trap instruction for a breakpoint, it's not required; for instance, the bit pattern could be an invalid @@ -3233,10 +3235,6 @@ the direction of stack growth. By default, no frame based stack alignment is performed. -@item FRAME_ARGS_ADDRESS_CORRECT -@findex FRAME_ARGS_ADDRESS_CORRECT -See @file{stack.c}. - @item DEPRECATED_FRAME_CHAIN(@var{frame}) @findex DEPRECATED_FRAME_CHAIN Given @var{frame}, return a pointer to the calling frame. @@ -3291,6 +3289,23 @@ return d10v_make_iaddr (pc); @noindent @xref{DEPRECATED_FRAME_SAVED_PC}, which this method replaces. +@item CORE_ADDR unwind_sp (struct frame_info *@var{this_frame}) +@findex unwind_sp +@anchor{unwind_sp} Return the frame's inner most stack address. This is +commonly refered to as the frame's @dfn{stack pointer}. + +The implementation, which must be frame agnostic (work with any frame), +is typically no more than: + +@smallexample +ULONGEST sp; +frame_unwind_unsigned_register (this_frame, D10V_SP_REGNUM, &sp); +return d10v_make_daddr (sp); +@end smallexample + +@noindent +@xref{TARGET_READ_SP}, which this method replaces. + @item FUNCTION_EPILOGUE_SIZE @findex FUNCTION_EPILOGUE_SIZE For some COFF targets, the @code{x_sym.x_misc.x_fsize} field of the @@ -3890,15 +3905,17 @@ Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}. @findex write_pc @findex read_sp @findex read_fp -These change the behavior of @code{read_pc}, @code{write_pc}, -@code{read_sp} and @code{deprecated_read_fp}. For most targets, these -may be left undefined. @value{GDBN} will call the read and write -register functions with the relevant @code{_REGNUM} argument. +@anchor{TARGET_READ_SP} These change the behavior of @code{read_pc}, +@code{write_pc}, @code{read_sp} and @code{deprecated_read_fp}. For most +targets, these may be left undefined. @value{GDBN} will call the read +and write register functions with the relevant @code{_REGNUM} argument. These macros are useful when a target keeps one of these registers in a hard to get at place; for example, part in a segment register and part in an ordinary register. +@xref{unwind_sp}, which replaces @code{TARGET_READ_SP}. + @item TARGET_VIRTUAL_FRAME_POINTER(@var{pc}, @var{regp}, @var{offsetp}) @findex TARGET_VIRTUAL_FRAME_POINTER Returns a @code{(register, offset)} pair representing the virtual frame diff --git a/gdb/doublest.c b/gdb/doublest.c index 101240b..09bb155 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -404,7 +404,15 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt, { mant_long <<= 1; mant_long &= 0xffffffffL; - mant_bits -= 1; + /* If we are processing the top 32 mantissa bits of a doublest + so as to convert to a float value with implied integer bit, + we will only be putting 31 of those 32 bits into the + final value due to the discarding of the top bit. In the + case of a small float value where the number of mantissa + bits is less than 32, discarding the top bit does not alter + the number of bits we will be adding to the result. */ + if (mant_bits == 32) + mant_bits -= 1; } if (mant_bits < 32) @@ -625,7 +633,7 @@ floatformat_from_doublest (const struct floatformat *fmt, target-dependent code, the format of floating-point types is known, but not passed on by GDB. This should be fixed. */ -const struct floatformat * +static const struct floatformat * floatformat_from_length (int len) { if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT) diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 94413f4..c395c93 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -360,10 +360,6 @@ dummy_frame_this_id (struct frame_info *next_frame, just asking for trouble. */ if (gdbarch_unwind_dummy_id_p (current_gdbarch)) { - /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS, - previously saved the dummy frame's ID. Things only work if - the two return the same value. */ - gdb_assert (SAVE_DUMMY_FRAME_TOS_P ()); /* Use an architecture specific method to extract the prev's dummy ID from the next frame. Note that this method uses frame_register_unwind to obtain the register values needed to diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index f28fade..999cef7 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -455,7 +455,7 @@ struct dwarf2_frame_cache struct dwarf2_frame_state_reg *reg; }; -struct dwarf2_frame_cache * +static struct dwarf2_frame_cache * dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) { struct cleanup *old_chain; @@ -544,6 +544,13 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) /* Skip the return address column. */ if (reg == fs->retaddr_column) + /* NOTE: cagney/2003-06-07: Is this right? What if the + RETADDR_COLUM corresponds to a real register (and, worse, + that isn't the PC_REGNUM)? I'm guessing that the PC_REGNUM + further down is trying to handle this. That can't be right + though - PC_REGNUM may not be valid (it can be -ve). I + think, instead when RETADDR_COLUM isn't a real register, it + should map itself onto frame_pc_unwind. */ continue; /* Use the GDB register number as index. */ @@ -558,12 +565,22 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) implies a copy from the ra column register. */ if (fs->retaddr_column < fs->regs.num_regs && fs->regs.reg[fs->retaddr_column].how != REG_UNSAVED) - cache->reg[PC_REGNUM] = fs->regs.reg[fs->retaddr_column]; + { + /* See comment above about a possibly -ve PC_REGNUM. If this + assertion fails, it's a problem with this code and not the + architecture. */ + gdb_assert (PC_REGNUM >= 0); + cache->reg[PC_REGNUM] = fs->regs.reg[fs->retaddr_column]; + } else { reg = DWARF2_REG_TO_REGNUM (fs->retaddr_column); if (reg != PC_REGNUM) { + /* See comment above about PC_REGNUM being -ve. If this + assertion fails, it's a problem with this code and not + the architecture. */ + gdb_assert (PC_REGNUM >= 0); cache->reg[PC_REGNUM].loc.reg = reg; cache->reg[PC_REGNUM].how = REG_SAVED_REG; } @@ -606,6 +623,21 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, /* GCC defines the CFA as the value of the stack pointer just before the call instruction is executed. Do other compilers use the same definition? */ + /* DWARF V3 Draft 7 p102: Typically, the CFA is defined to + be the value of the stack pointer at the call site in the + previous frame (which may be different from its value on + entry to the current frame). */ + /* DWARF V3 Draft 7 p103: The first column of the rules + defines the rule which computes the CFA value; it may be + either a register and a signed offset that are added + together or a DWARF expression that is evaluated. */ + /* FIXME: cagney/2003-07-07: I don't understand this. The + CFI info should have provided unwind information for the + SP register and then pointed ->cfa_reg at it, not the + reverse. Assuming that SP_REGNUM is !-ve, there is a + very real posibility that CFA is an offset from some + other register, having nothing to do with the unwound SP + value. */ *optimizedp = 0; if (valuep) { diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h index 9e6fe80..0a60edb 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -76,7 +76,7 @@ struct dwarf_expr_context int in_reg; }; -struct dwarf_expr_context *new_dwarf_expr_context (); +struct dwarf_expr_context *new_dwarf_expr_context (void); void free_dwarf_expr_context (struct dwarf_expr_context *ctx); void dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 182ee4f..55b335d 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1740,7 +1740,6 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) } pst->symtab = symtab; pst->readin = 1; - sort_symtab_syms (pst->symtab); do_cleanups (back_to); } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 38b5d92..0856b89 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -2348,7 +2348,6 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) wrap_here (""); gdb_flush (gdb_stdout); } - sort_symtab_syms (pst->symtab); do_cleanups (old_chain); } pst->readin = 1; diff --git a/gdb/elfread.c b/gdb/elfread.c index 7aee37c..ff766fb 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -177,7 +177,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic) asymbol **symbol_table; long number_of_symbols; long i; - int index; struct cleanup *back_to; CORE_ADDR symaddr; CORE_ADDR offset; @@ -372,34 +371,40 @@ elf_symtab_read (struct objfile *objfile, int dynamic) } else if (sym->flags & BSF_LOCAL) { - /* Named Local variable in a Data section. Check its - name for stabs-in-elf. The STREQ macro checks the - first character inline, so we only actually do a - strcmp function call on names that start with 'B' - or 'D' */ - index = SECT_OFF_MAX; - if (STREQ ("Bbss.bss", sym->name)) - { - index = SECT_OFF_BSS (objfile); - } - else if (STREQ ("Ddata.data", sym->name)) - { - index = SECT_OFF_DATA (objfile); - } - else if (STREQ ("Drodata.rodata", sym->name)) - { - index = SECT_OFF_RODATA (objfile); - } - if (index != SECT_OFF_MAX) + /* Named Local variable in a Data section. + Check its name for stabs-in-elf. The STREQ + macro checks the first character inline, so + we only actually do a strcmp function call on + names that start with 'B' or 'D'. */ + int special_local_sect; + if (strcmp ("Bbss.bss", sym->name) == 0) + special_local_sect = SECT_OFF_BSS (objfile); + else if (strcmp ("Ddata.data", sym->name) == 0) + special_local_sect = SECT_OFF_DATA (objfile); + else if (strcmp ("Drodata.rodata", sym->name) == 0) + special_local_sect = SECT_OFF_RODATA (objfile); + else + special_local_sect = -1; + if (special_local_sect >= 0) { /* Found a special local symbol. Allocate a sectinfo, if needed, and fill it in. */ if (sectinfo == NULL) { + int max_index; + size_t size; + + max_index + = max (SECT_OFF_BSS (objfile), + max (SECT_OFF_DATA (objfile), + SECT_OFF_RODATA (objfile))); + size = (sizeof (struct stab_section_info) + + (sizeof (CORE_ADDR) + * (max_index - 1))); sectinfo = (struct stab_section_info *) - xmmalloc (objfile->md, sizeof (*sectinfo)); - memset (sectinfo, 0, - sizeof (*sectinfo)); + xmmalloc (objfile->md, size); + memset (sectinfo, 0, size); + sectinfo->num_sections = max_index; if (filesym == NULL) { complaint (&symfile_complaints, @@ -412,36 +417,23 @@ elf_symtab_read (struct objfile *objfile, int dynamic) (char *) filesym->name; } } - if (index != -1) - { - if (sectinfo->sections[index] != 0) - { - complaint (&symfile_complaints, - "duplicated elf/stab section information for %s", - sectinfo->filename); - } - } - else - internal_error (__FILE__, __LINE__, - "Section index uninitialized."); - /* Bfd symbols are section relative. */ + if (sectinfo->sections[special_local_sect] != 0) + complaint (&symfile_complaints, + "duplicated elf/stab section information for %s", + sectinfo->filename); + /* BFD symbols are section relative. */ symaddr = sym->value + sym->section->vma; - /* Relocate non-absolute symbols by the section offset. */ + /* Relocate non-absolute symbols by the + section offset. */ if (sym->section != &bfd_abs_section) - { - symaddr += offset; - } - if (index != -1) - sectinfo->sections[index] = symaddr; - else - internal_error (__FILE__, __LINE__, - "Section index uninitialized."); + symaddr += offset; + sectinfo->sections[special_local_sect] = symaddr; /* The special local symbols don't go in the - minimal symbol table, so ignore this one. */ + minimal symbol table, so ignore this one. */ continue; } /* Not a special stabs-in-elf symbol, do regular - symbol processing. */ + symbol processing. */ if (sym->section->flags & SEC_LOAD) { ms_type = mst_file_data; @@ -740,8 +732,9 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst) /* Found it! Allocate a new psymtab struct, and fill it in. */ maybe->found++; pst->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS); - for (i = 0; i < SECT_OFF_MAX; i++) + obstack_alloc (&objfile->psymbol_obstack, + SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); + for (i = 0; i < maybe->num_sections; i++) (pst->section_offsets)->offsets[i] = maybe->sections[i]; return; } diff --git a/gdb/findvar.c b/gdb/findvar.c index 4aa4f46..3155697 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -284,10 +284,10 @@ value_of_register (int regnum, struct frame_info *frame) /* Convert raw data to virtual format if necessary. */ - if (REGISTER_CONVERTIBLE (regnum)) + if (DEPRECATED_REGISTER_CONVERTIBLE (regnum)) { - REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum), - raw_buffer, VALUE_CONTENTS_RAW (reg_val)); + DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum), + raw_buffer, VALUE_CONTENTS_RAW (reg_val)); } else if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum)) memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer, diff --git a/gdb/frame-base.c b/gdb/frame-base.c index f7ba4be..6f666a7 100644 --- a/gdb/frame-base.c +++ b/gdb/frame-base.c @@ -46,17 +46,7 @@ static CORE_ADDR default_frame_args_address (struct frame_info *next_frame, void **this_cache) { struct frame_info *this_frame = get_prev_frame (next_frame); - /* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except - that if it is unsure about the answer, it returns 0 instead of - guessing (this happens on the VAX and i960, for example). - - On most machines, we never have to guess about the args address, - so FRAME_ARGS_ADDRESS{,_CORRECT} are the same. */ -#ifdef FRAME_ARGS_ADDRESS_CORRECT - return FRAME_ARGS_ADDRESS_CORRECT (this_frame); -#else return FRAME_ARGS_ADDRESS (this_frame); -#endif } const struct frame_base default_frame_base = { @@ -146,6 +136,8 @@ frame_base_find_by_pc (struct gdbarch *gdbarch, CORE_ADDR pc) return table->default_base; } +extern initialize_file_ftype _initialize_frame_base; /* -Wmissing-prototypes */ + void _initialize_frame_base (void) { diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index c72d24a..921d30b 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -98,6 +98,8 @@ frame_unwind_find_by_pc (struct gdbarch *gdbarch, CORE_ADDR pc) return legacy_saved_regs_unwind; } +extern initialize_file_ftype _initialize_frame_unwind; /* -Wmissing-prototypes */ + void _initialize_frame_unwind (void) { diff --git a/gdb/frame.c b/gdb/frame.c index dd69dde..18f9561 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -674,12 +674,12 @@ frame_read_signed_register (struct frame_info *frame, int regnum, } void -generic_unwind_get_saved_register (char *raw_buffer, - int *optimizedp, - CORE_ADDR *addrp, - struct frame_info *frame, - int regnum, - enum lval_type *lvalp) +deprecated_unwind_get_saved_register (char *raw_buffer, + int *optimizedp, + CORE_ADDR *addrp, + struct frame_info *frame, + int regnum, + enum lval_type *lvalp) { int optimizedx; CORE_ADDR addrx; @@ -778,7 +778,7 @@ frame_map_regnum_to_name (int regnum) /* Create a sentinel frame. */ -struct frame_info * +static struct frame_info * create_sentinel_frame (struct regcache *regcache) { struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info); @@ -1944,11 +1944,11 @@ get_prev_frame (struct frame_info *this_frame) Doing this makes it possible for the user to examine a frame that has an invalid frame ID. - The very old VAX frame_args_address_correct() method noted: [...] - For the sake of argument, suppose that the stack is somewhat - trashed (which is one reason that "info frame" exists). So, - return 0 (indicating we don't know the address of the arglist) if - we don't know what frame this frame calls. */ + Some very old VAX code noted: [...] For the sake of argument, + suppose that the stack is somewhat trashed (which is one reason + that "info frame" exists). So, return 0 (indicating we don't + know the address of the arglist) if we don't know what frame this + frame calls. */ /* Link it in. */ this_frame->prev = prev_frame; @@ -2250,6 +2250,37 @@ get_frame_arch (struct frame_info *this_frame) return current_gdbarch; } +/* Stack pointer methods. */ + +CORE_ADDR +get_frame_sp (struct frame_info *this_frame) +{ + return frame_sp_unwind (this_frame->next); +} + +CORE_ADDR +frame_sp_unwind (struct frame_info *next_frame) +{ + /* Normality, an architecture that provides a way of obtaining any + frame inner-most address. */ + if (gdbarch_unwind_sp_p (current_gdbarch)) + return gdbarch_unwind_sp (current_gdbarch, next_frame); + /* Things are looking grim. If it's the inner-most frame and there + is a TARGET_READ_SP then that can be used. */ + if (next_frame->level < 0 && TARGET_READ_SP_P ()) + return TARGET_READ_SP (); + /* Now things are really are grim. Hope that the value returned by + the SP_REGNUM register is meaningful. */ + if (SP_REGNUM >= 0) + { + ULONGEST sp; + frame_unwind_unsigned_register (next_frame, SP_REGNUM, &sp); + return sp; + } + internal_error (__FILE__, __LINE__, "Missing unwind SP method"); +} + + int legacy_frame_p (struct gdbarch *current_gdbarch) { @@ -2257,10 +2288,11 @@ legacy_frame_p (struct gdbarch *current_gdbarch) || DEPRECATED_INIT_FRAME_PC_FIRST_P () || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () || DEPRECATED_FRAME_CHAIN_P () - || !gdbarch_unwind_dummy_id_p (current_gdbarch) - || !SAVE_DUMMY_FRAME_TOS_P ()); + || !gdbarch_unwind_dummy_id_p (current_gdbarch)); } +extern initialize_file_ftype _initialize_frame; /* -Wmissing-prototypes */ + void _initialize_frame (void) { diff --git a/gdb/frame.h b/gdb/frame.h index bfd9469..4dc7560 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -166,6 +166,13 @@ extern struct frame_info *frame_find_by_id (struct frame_id id); This replaced: frame->pc; */ extern CORE_ADDR get_frame_pc (struct frame_info *); +/* The frame's inner-most bound. AKA the stack-pointer. Confusingly + known as top-of-stack. */ + +extern CORE_ADDR get_frame_sp (struct frame_info *); +extern CORE_ADDR frame_sp_unwind (struct frame_info *); + + /* Following on from the `resume' address. Return the entry point address of the function containing that resume address, or zero if that function isn't known. */ @@ -451,9 +458,6 @@ extern CORE_ADDR get_pc_function_start (CORE_ADDR); extern int frameless_look_for_prologue (struct frame_info *); -extern void print_frame_args (struct symbol *, struct frame_info *, - int, struct ui_file *); - extern struct frame_info *find_relative_frame (struct frame_info *, int *); extern void show_and_print_stack_frame (struct frame_info *fi, int level, @@ -488,19 +492,16 @@ extern int generic_pc_in_call_dummy (CORE_ADDR pc, extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp); -void generic_unwind_get_saved_register (char *raw_buffer, - int *optimizedp, - CORE_ADDR *addrp, - struct frame_info *frame, - int regnum, - enum lval_type *lvalp); - -/* The function generic_get_saved_register() has been made obsolete. - DEPRECATED_GET_SAVED_REGISTER now defaults to the recursive - equivalent - generic_unwind_get_saved_register() - so there is no - need to even set DEPRECATED_GET_SAVED_REGISTER. Architectures that - need to override the register unwind mechanism should modify - frame->unwind(). */ + +/* The DEPRECATED_GET_SAVED_REGISTER architecture interface is + entirely redundant. New architectures should implement per-frame + unwinders (ref "frame-unwind.h"). */ +extern void deprecated_unwind_get_saved_register (char *raw_buffer, + int *optimizedp, + CORE_ADDR *addrp, + struct frame_info *frame, + int regnum, + enum lval_type *lvalp); extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *, struct frame_info *, int, enum lval_type *); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 666aa25..e4dc885 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -30,15 +30,10 @@ extern void _initialize_frv_tdep (void); static gdbarch_init_ftype frv_gdbarch_init; static gdbarch_register_name_ftype frv_register_name; -static gdbarch_register_raw_size_ftype frv_register_raw_size; -static gdbarch_register_virtual_size_ftype frv_register_virtual_size; -static gdbarch_register_virtual_type_ftype frv_register_virtual_type; -static gdbarch_register_byte_ftype frv_register_byte; static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc; static gdbarch_skip_prologue_ftype frv_skip_prologue; static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address; -static gdbarch_use_struct_convention_ftype frv_use_struct_convention; static gdbarch_frameless_function_invocation_ftype frv_frameless_function_invocation; static gdbarch_init_extra_frame_info_ftype stupid_useless_init_extra_frame_info; static gdbarch_push_arguments_ftype frv_push_arguments; @@ -738,18 +733,6 @@ frv_frame_init_saved_regs (struct frame_info *frame) } } -/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of - EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc - and TYPE is the type (which is known to be struct, union or array). - - The frv returns all structs in memory. */ - -static int -frv_use_struct_convention (int gcc_p, struct type *type) -{ - return 1; -} - static void frv_extract_return_value (struct type *type, char *regbuf, char *valbuf) { @@ -1059,17 +1042,16 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, frv_register_name); set_gdbarch_deprecated_register_size (gdbarch, 4); set_gdbarch_deprecated_register_bytes (gdbarch, frv_num_regs * 4); - set_gdbarch_register_byte (gdbarch, frv_register_byte); - set_gdbarch_register_raw_size (gdbarch, frv_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, frv_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, frv_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); - set_gdbarch_register_virtual_size (gdbarch, frv_register_virtual_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, frv_register_virtual_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4); - set_gdbarch_register_virtual_type (gdbarch, frv_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, frv_register_virtual_type); set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue); set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation); @@ -1080,7 +1062,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs); - set_gdbarch_use_struct_convention (gdbarch, frv_use_struct_convention); + set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value); set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return); @@ -1099,10 +1081,8 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Settings that should be unnecessary. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_read_pc (gdbarch, generic_target_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h index abe2d33..097f9d9 100644 --- a/gdb/gdb-stabs.h +++ b/gdb/gdb-stabs.h @@ -29,8 +29,6 @@ #if !defined (GDBSTABS_H) #define GDBSTABS_H -#define SECT_OFF_MAX 64 /* Count of possible values */ - /* The stab_section_info chain remembers info from the ELF symbol table, while psymtabs are being built for the other symbol tables in the objfile. It is destroyed at the complation of psymtab-reading. @@ -39,9 +37,10 @@ struct stab_section_info { char *filename; - CORE_ADDR sections[SECT_OFF_MAX]; struct stab_section_info *next; int found; /* Count of times it's found in searching */ + size_t num_sections; + CORE_ADDR sections[1]; }; /* Information is passed among various dbxread routines for accessing diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 7c0a8fd..03d6b99 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -168,14 +168,14 @@ struct gdbarch gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum; gdbarch_register_name_ftype *register_name; int deprecated_register_size; + gdbarch_register_type_ftype *register_type; + gdbarch_deprecated_register_virtual_type_ftype *deprecated_register_virtual_type; int deprecated_register_bytes; - gdbarch_register_byte_ftype *register_byte; - gdbarch_register_raw_size_ftype *register_raw_size; + gdbarch_deprecated_register_byte_ftype *deprecated_register_byte; + gdbarch_deprecated_register_raw_size_ftype *deprecated_register_raw_size; + gdbarch_deprecated_register_virtual_size_ftype *deprecated_register_virtual_size; int deprecated_max_register_raw_size; - gdbarch_register_virtual_size_ftype *register_virtual_size; int deprecated_max_register_virtual_size; - gdbarch_register_virtual_type_ftype *register_virtual_type; - gdbarch_register_type_ftype *register_type; gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info; gdbarch_print_registers_info_ftype *print_registers_info; gdbarch_print_float_info_ftype *print_float_info; @@ -202,9 +202,9 @@ struct gdbarch int believe_pcc_promotion; int believe_pcc_promotion_type; gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register; - 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_deprecated_register_convertible_ftype *deprecated_register_convertible; + gdbarch_deprecated_register_convert_to_virtual_ftype *deprecated_register_convert_to_virtual; + gdbarch_deprecated_register_convert_to_raw_ftype *deprecated_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; @@ -243,6 +243,7 @@ struct gdbarch gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid; gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc; gdbarch_unwind_pc_ftype *unwind_pc; + gdbarch_unwind_sp_ftype *unwind_sp; gdbarch_frame_args_address_ftype *frame_args_address; gdbarch_frame_locals_address_ftype *frame_locals_address; gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call; @@ -293,161 +294,162 @@ struct gdbarch startup_gdbarch = { 1, /* Always initialized. */ /* basic architecture information */ - &bfd_default_arch_struct, - BFD_ENDIAN_BIG, - GDB_OSABI_UNKNOWN, + &bfd_default_arch_struct, /* bfd_arch_info */ + BFD_ENDIAN_BIG, /* byte_order */ + GDB_OSABI_UNKNOWN, /* osabi */ /* target specific vector and its dump routine */ NULL, NULL, /*per-architecture data-pointers and swap regions */ 0, NULL, NULL, /* Multi-arch values */ - 8 * sizeof (short), - 8 * sizeof (int), - 8 * sizeof (long), - 8 * sizeof (LONGEST), - 8 * sizeof (float), - 8 * sizeof (double), - 8 * sizeof (long double), - 8 * sizeof (void*), - 8 * sizeof (void*), - 8 * sizeof (void*), - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - -1, - -1, - -1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - generic_register_byte, - generic_register_size, - 0, - generic_register_size, - 0, - 0, - 0, - 0, - default_print_registers_info, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - generic_pc_in_call_dummy, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - generic_remote_translate_xfer_address, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - generic_in_function_epilogue_p, - construct_inferior_arguments, - 0, - 0, - 0, - "malloc", - 0, - 0, - 0, - 0, - 0, - default_register_reggroup_p, - 0, + 8 * sizeof (short), /* short_bit */ + 8 * sizeof (int), /* int_bit */ + 8 * sizeof (long), /* long_bit */ + 8 * sizeof (LONGEST), /* long_long_bit */ + 8 * sizeof (float), /* float_bit */ + 8 * sizeof (double), /* double_bit */ + 8 * sizeof (long double), /* long_double_bit */ + 8 * sizeof (void*), /* ptr_bit */ + 8 * sizeof (void*), /* addr_bit */ + 8 * sizeof (void*), /* bfd_vma_bit */ + 1, /* char_signed */ + 0, /* read_pc */ + 0, /* write_pc */ + 0, /* deprecated_target_read_fp */ + 0, /* read_sp */ + 0, /* deprecated_dummy_write_sp */ + 0, /* virtual_frame_pointer */ + 0, /* pseudo_register_read */ + 0, /* pseudo_register_write */ + 0, /* num_regs */ + 0, /* num_pseudo_regs */ + -1, /* sp_regnum */ + -1, /* deprecated_fp_regnum */ + -1, /* pc_regnum */ + -1, /* ps_regnum */ + 0, /* fp0_regnum */ + 0, /* npc_regnum */ + 0, /* stab_reg_to_regnum */ + 0, /* ecoff_reg_to_regnum */ + 0, /* dwarf_reg_to_regnum */ + 0, /* sdb_reg_to_regnum */ + 0, /* dwarf2_reg_to_regnum */ + 0, /* register_name */ + 0, /* deprecated_register_size */ + 0, /* register_type */ + 0, /* deprecated_register_virtual_type */ + 0, /* deprecated_register_bytes */ + generic_register_byte, /* deprecated_register_byte */ + generic_register_size, /* deprecated_register_raw_size */ + generic_register_size, /* deprecated_register_virtual_size */ + 0, /* deprecated_max_register_raw_size */ + 0, /* deprecated_max_register_virtual_size */ + 0, /* deprecated_do_registers_info */ + default_print_registers_info, /* print_registers_info */ + 0, /* print_float_info */ + 0, /* print_vector_info */ + 0, /* register_sim_regno */ + 0, /* register_bytes_ok */ + 0, /* cannot_fetch_register */ + 0, /* cannot_store_register */ + 0, /* get_longjmp_target */ + 0, /* deprecated_use_generic_dummy_frames */ + 0, /* call_dummy_location */ + 0, /* call_dummy_address */ + 0, /* deprecated_call_dummy_start_offset */ + 0, /* deprecated_call_dummy_breakpoint_offset */ + 0, /* deprecated_call_dummy_length */ + generic_pc_in_call_dummy, /* deprecated_pc_in_call_dummy */ + 0, /* deprecated_call_dummy_words */ + 0, /* deprecated_sizeof_call_dummy_words */ + 0, /* deprecated_call_dummy_stack_adjust */ + 0, /* deprecated_fix_call_dummy */ + 0, /* push_dummy_code */ + 0, /* deprecated_init_frame_pc_first */ + 0, /* deprecated_init_frame_pc */ + 0, /* believe_pcc_promotion */ + 0, /* believe_pcc_promotion_type */ + 0, /* deprecated_get_saved_register */ + 0, /* deprecated_register_convertible */ + 0, /* deprecated_register_convert_to_virtual */ + 0, /* deprecated_register_convert_to_raw */ + 0, /* convert_register_p */ + 0, /* register_to_value */ + 0, /* value_to_register */ + 0, /* pointer_to_address */ + 0, /* address_to_pointer */ + 0, /* integer_to_address */ + 0, /* return_value_on_stack */ + 0, /* deprecated_push_arguments */ + 0, /* push_dummy_call */ + 0, /* deprecated_push_dummy_frame */ + 0, /* deprecated_push_return_address */ + 0, /* deprecated_pop_frame */ + 0, /* deprecated_store_struct_return */ + 0, /* extract_return_value */ + 0, /* store_return_value */ + 0, /* deprecated_extract_return_value */ + 0, /* deprecated_store_return_value */ + 0, /* extract_struct_value_address */ + 0, /* deprecated_extract_struct_value_address */ + 0, /* use_struct_convention */ + 0, /* deprecated_frame_init_saved_regs */ + 0, /* deprecated_init_extra_frame_info */ + 0, /* skip_prologue */ + 0, /* prologue_frameless_p */ + 0, /* inner_than */ + 0, /* breakpoint_from_pc */ + 0, /* memory_insert_breakpoint */ + 0, /* memory_remove_breakpoint */ + 0, /* decr_pc_after_break */ + 0, /* prepare_to_proceed */ + 0, /* function_start_offset */ + generic_remote_translate_xfer_address, /* remote_translate_xfer_address */ + 0, /* frame_args_skip */ + 0, /* frameless_function_invocation */ + 0, /* deprecated_frame_chain */ + 0, /* deprecated_frame_chain_valid */ + 0, /* deprecated_frame_saved_pc */ + 0, /* unwind_pc */ + 0, /* unwind_sp */ + 0, /* frame_args_address */ + 0, /* frame_locals_address */ + 0, /* deprecated_saved_pc_after_call */ + 0, /* frame_num_args */ + 0, /* stack_align */ + 0, /* frame_align */ + 0, /* deprecated_extra_stack_alignment_needed */ + 0, /* reg_struct_has_addr */ + 0, /* save_dummy_frame_tos */ + 0, /* unwind_dummy_id */ + 0, /* parm_boundary */ + 0, /* float_format */ + 0, /* double_format */ + 0, /* long_double_format */ + 0, /* convert_from_func_ptr_addr */ + 0, /* addr_bits_remove */ + 0, /* smash_text_address */ + 0, /* software_single_step */ + 0, /* print_insn */ + 0, /* skip_trampoline_code */ + 0, /* in_solib_call_trampoline */ + 0, /* in_solib_return_trampoline */ + 0, /* pc_in_sigtramp */ + 0, /* sigtramp_start */ + 0, /* sigtramp_end */ + generic_in_function_epilogue_p, /* in_function_epilogue_p */ + construct_inferior_arguments, /* construct_inferior_arguments */ + 0, /* dwarf2_build_frame_info */ + 0, /* elf_make_msymbol_special */ + 0, /* coff_make_msymbol_special */ + "malloc", /* name_of_malloc */ + 0, /* cannot_step_breakpoint */ + 0, /* have_nonsteppable_watchpoint */ + 0, /* address_class_type_flags */ + 0, /* address_class_type_flags_to_name */ + 0, /* address_class_name_to_type_flags */ + default_register_reggroup_p, /* register_reggroup_p */ + 0, /* fetch_pointer_argument */ /* startup_gdbarch() */ }; @@ -501,9 +503,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->ptr_bit = TARGET_INT_BIT; current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address; current_gdbarch->char_signed = -1; - current_gdbarch->read_pc = generic_target_read_pc; current_gdbarch->write_pc = generic_target_write_pc; - current_gdbarch->read_sp = generic_target_read_sp; current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer; current_gdbarch->num_regs = -1; current_gdbarch->sp_regnum = -1; @@ -518,9 +518,9 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->register_name = legacy_register_name; - current_gdbarch->register_byte = generic_register_byte; - current_gdbarch->register_raw_size = generic_register_size; - current_gdbarch->register_virtual_size = generic_register_size; + current_gdbarch->deprecated_register_byte = generic_register_byte; + current_gdbarch->deprecated_register_raw_size = generic_register_size; + current_gdbarch->deprecated_register_virtual_size = generic_register_size; current_gdbarch->print_registers_info = default_print_registers_info; current_gdbarch->register_sim_regno = legacy_register_sim_regno; current_gdbarch->cannot_fetch_register = cannot_register_not; @@ -531,7 +531,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy; current_gdbarch->deprecated_call_dummy_words = legacy_call_dummy_words; current_gdbarch->deprecated_sizeof_call_dummy_words = legacy_sizeof_call_dummy_words; - current_gdbarch->register_convertible = generic_register_convertible_not; + current_gdbarch->deprecated_register_convertible = deprecated_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; @@ -620,10 +620,10 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of bfd_vma_bit, invalid_p == 0 */ if (gdbarch->char_signed == -1) gdbarch->char_signed = 1; - /* Skip verify of read_pc, invalid_p == 0 */ + /* Skip verify of read_pc, has predicate */ /* Skip verify of write_pc, invalid_p == 0 */ /* Skip verify of deprecated_target_read_fp, has predicate */ - /* Skip verify of read_sp, invalid_p == 0 */ + /* Skip verify of read_sp, has predicate */ /* Skip verify of deprecated_dummy_write_sp, has predicate */ /* Skip verify of virtual_frame_pointer, invalid_p == 0 */ /* Skip verify of pseudo_register_read, has predicate */ @@ -644,13 +644,13 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */ /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */ /* Skip verify of register_name, invalid_p == 0 */ - /* Skip verify of register_byte, has predicate */ - /* Skip verify of register_raw_size, invalid_p == 0 */ + /* Skip verify of register_type, has predicate */ + /* Skip verify of deprecated_register_virtual_type, has predicate */ + /* Skip verify of deprecated_register_byte, has predicate */ + /* Skip verify of deprecated_register_raw_size, invalid_p == 0 */ + /* Skip verify of deprecated_register_virtual_size, invalid_p == 0 */ /* Skip verify of deprecated_max_register_raw_size, has predicate */ - /* Skip verify of register_virtual_size, invalid_p == 0 */ /* Skip verify of deprecated_max_register_virtual_size, has predicate */ - /* Skip verify of register_virtual_type, has predicate */ - /* Skip verify of register_type, has predicate */ /* Skip verify of deprecated_do_registers_info, has predicate */ /* Skip verify of print_registers_info, invalid_p == 0 */ /* Skip verify of print_float_info, has predicate */ @@ -672,9 +672,9 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of deprecated_init_frame_pc_first, has predicate */ /* Skip verify of deprecated_init_frame_pc, has predicate */ /* Skip verify of deprecated_get_saved_register, has predicate */ - /* 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 deprecated_register_convertible, invalid_p == 0 */ + /* Skip verify of deprecated_register_convert_to_virtual, invalid_p == 0 */ + /* Skip verify of deprecated_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 */ @@ -723,12 +723,11 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of deprecated_frame_chain_valid, has predicate */ /* Skip verify of deprecated_frame_saved_pc, has predicate */ /* Skip verify of unwind_pc, has predicate */ + /* Skip verify of unwind_sp, has predicate */ /* Skip verify of frame_args_address, invalid_p == 0 */ /* Skip verify of frame_locals_address, invalid_p == 0 */ /* Skip verify of deprecated_saved_pc_after_call, has predicate */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->frame_num_args == 0)) - fprintf_unfiltered (log, "\n\tframe_num_args"); + /* Skip verify of frame_num_args, has predicate */ /* Skip verify of stack_align, has predicate */ /* Skip verify of frame_align, has predicate */ /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */ @@ -1491,6 +1490,45 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: DEPRECATED_REGISTER_BYTES = %d\n", DEPRECATED_REGISTER_BYTES); #endif +#ifdef DEPRECATED_REGISTER_CONVERTIBLE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_CONVERTIBLE(nr)", + XSTRING (DEPRECATED_REGISTER_CONVERTIBLE (nr))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_CONVERTIBLE = <0x%08lx>\n", + (long) current_gdbarch->deprecated_register_convertible + /*DEPRECATED_REGISTER_CONVERTIBLE ()*/); +#endif +#ifdef DEPRECATED_REGISTER_CONVERT_TO_RAW +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_CONVERT_TO_RAW(type, regnum, from, to)", + XSTRING (DEPRECATED_REGISTER_CONVERT_TO_RAW (type, regnum, from, to))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_CONVERT_TO_RAW = <0x%08lx>\n", + (long) current_gdbarch->deprecated_register_convert_to_raw + /*DEPRECATED_REGISTER_CONVERT_TO_RAW ()*/); +#endif +#ifdef DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to)", + XSTRING (DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL = <0x%08lx>\n", + (long) current_gdbarch->deprecated_register_convert_to_virtual + /*DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL ()*/); +#endif #ifdef DEPRECATED_REGISTER_SIZE fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n", @@ -1765,6 +1803,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->frame_locals_address /*FRAME_LOCALS_ADDRESS ()*/); #endif +#ifdef FRAME_NUM_ARGS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FRAME_NUM_ARGS_P()", + XSTRING (FRAME_NUM_ARGS_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: FRAME_NUM_ARGS_P() = %d\n", + FRAME_NUM_ARGS_P ()); +#endif #ifdef FRAME_NUM_ARGS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2040,7 +2087,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: REGISTER_BYTE = <0x%08lx>\n", - (long) current_gdbarch->register_byte + (long) current_gdbarch->deprecated_register_byte /*REGISTER_BYTE ()*/); #endif #ifdef REGISTER_BYTES_OK_P @@ -2063,45 +2110,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->register_bytes_ok /*REGISTER_BYTES_OK ()*/); #endif -#ifdef REGISTER_CONVERTIBLE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_CONVERTIBLE(nr)", - XSTRING (REGISTER_CONVERTIBLE (nr))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_CONVERTIBLE = <0x%08lx>\n", - (long) current_gdbarch->register_convertible - /*REGISTER_CONVERTIBLE ()*/); -#endif -#ifdef REGISTER_CONVERT_TO_RAW -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_CONVERT_TO_RAW(type, regnum, from, to)", - XSTRING (REGISTER_CONVERT_TO_RAW (type, regnum, from, to))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_CONVERT_TO_RAW = <0x%08lx>\n", - (long) current_gdbarch->register_convert_to_raw - /*REGISTER_CONVERT_TO_RAW ()*/); -#endif -#ifdef REGISTER_CONVERT_TO_VIRTUAL -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to)", - XSTRING (REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_CONVERT_TO_VIRTUAL = <0x%08lx>\n", - (long) current_gdbarch->register_convert_to_virtual - /*REGISTER_CONVERT_TO_VIRTUAL ()*/); -#endif #ifdef REGISTER_NAME fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2121,7 +2129,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: REGISTER_RAW_SIZE = <0x%08lx>\n", - (long) current_gdbarch->register_raw_size + (long) current_gdbarch->deprecated_register_raw_size /*REGISTER_RAW_SIZE ()*/); #endif #ifdef REGISTER_SIM_REGNO @@ -2165,7 +2173,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: REGISTER_VIRTUAL_SIZE = <0x%08lx>\n", - (long) current_gdbarch->register_virtual_size + (long) current_gdbarch->deprecated_register_virtual_size /*REGISTER_VIRTUAL_SIZE ()*/); #endif #ifdef REGISTER_VIRTUAL_TYPE_P @@ -2185,7 +2193,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: REGISTER_VIRTUAL_TYPE = <0x%08lx>\n", - (long) current_gdbarch->register_virtual_type + (long) current_gdbarch->deprecated_register_virtual_type /*REGISTER_VIRTUAL_TYPE ()*/); #endif #ifdef REG_STRUCT_HAS_ADDR_P @@ -2546,6 +2554,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_PTR_BIT = %d\n", TARGET_PTR_BIT); #endif +#ifdef TARGET_READ_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_PC_P()", + XSTRING (TARGET_READ_PC_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_READ_PC_P() = %d\n", + TARGET_READ_PC_P ()); +#endif #ifdef TARGET_READ_PC fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2557,6 +2574,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->read_pc /*TARGET_READ_PC ()*/); #endif +#ifdef TARGET_READ_SP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_SP_P()", + XSTRING (TARGET_READ_SP_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_READ_SP_P() = %d\n", + TARGET_READ_SP_P ()); +#endif #ifdef TARGET_READ_SP fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2620,6 +2646,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: unwind_pc = 0x%08lx\n", (long) current_gdbarch->unwind_pc); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n", + gdbarch_unwind_sp_p (current_gdbarch)); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: unwind_sp = 0x%08lx\n", + (long) current_gdbarch->unwind_sp); #ifdef USE_STRUCT_CONVENTION fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2876,6 +2910,13 @@ set_gdbarch_char_signed (struct gdbarch *gdbarch, gdbarch->char_signed = char_signed; } +int +gdbarch_read_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->read_pc != 0; +} + CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid) { @@ -2940,6 +2981,13 @@ set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdbarch->deprecated_target_read_fp = deprecated_target_read_fp; } +int +gdbarch_read_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->read_sp != 0; +} + CORE_ADDR gdbarch_read_sp (struct gdbarch *gdbarch) { @@ -3325,182 +3373,182 @@ set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, } int -gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch) +gdbarch_register_type_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->register_type != 0; +} + +struct type * +gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); + if (gdbarch->register_type == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_register_type invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_bytes called\n"); - return gdbarch->deprecated_register_bytes; + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n"); + return gdbarch->register_type (gdbarch, reg_nr); } void -set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, - int deprecated_register_bytes) +set_gdbarch_register_type (struct gdbarch *gdbarch, + gdbarch_register_type_ftype register_type) { - gdbarch->deprecated_register_bytes = deprecated_register_bytes; + gdbarch->register_type = register_type; } int -gdbarch_register_byte_p (struct gdbarch *gdbarch) +gdbarch_deprecated_register_virtual_type_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->register_byte != generic_register_byte; + return gdbarch->deprecated_register_virtual_type != 0; } -int -gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr) +struct type * +gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_byte == 0) + if (gdbarch->deprecated_register_virtual_type == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_byte invalid"); - /* Ignore predicate (gdbarch->register_byte != generic_register_byte). */ + "gdbarch: gdbarch_deprecated_register_virtual_type invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_byte called\n"); - return gdbarch->register_byte (reg_nr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_virtual_type called\n"); + return gdbarch->deprecated_register_virtual_type (reg_nr); } void -set_gdbarch_register_byte (struct gdbarch *gdbarch, - gdbarch_register_byte_ftype register_byte) +set_gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, + gdbarch_deprecated_register_virtual_type_ftype deprecated_register_virtual_type) { - gdbarch->register_byte = register_byte; + gdbarch->deprecated_register_virtual_type = deprecated_register_virtual_type; } int -gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr) +gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_raw_size == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_raw_size invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_raw_size called\n"); - return gdbarch->register_raw_size (reg_nr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_bytes called\n"); + return gdbarch->deprecated_register_bytes; } void -set_gdbarch_register_raw_size (struct gdbarch *gdbarch, - gdbarch_register_raw_size_ftype register_raw_size) +set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, + int deprecated_register_bytes) { - gdbarch->register_raw_size = register_raw_size; + gdbarch->deprecated_register_bytes = deprecated_register_bytes; } int -gdbarch_deprecated_max_register_raw_size_p (struct gdbarch *gdbarch) +gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->deprecated_max_register_raw_size != 0; + return gdbarch->deprecated_register_byte != generic_register_byte; } int -gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch) +gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_register_byte == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_register_byte invalid"); + /* Ignore predicate (gdbarch->deprecated_register_byte != generic_register_byte). */ if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_max_register_raw_size called\n"); - return gdbarch->deprecated_max_register_raw_size; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_byte called\n"); + return gdbarch->deprecated_register_byte (reg_nr); } void -set_gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch, - int deprecated_max_register_raw_size) +set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, + gdbarch_deprecated_register_byte_ftype deprecated_register_byte) { - gdbarch->deprecated_max_register_raw_size = deprecated_max_register_raw_size; + gdbarch->deprecated_register_byte = deprecated_register_byte; } int -gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr) +gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_virtual_size == 0) + if (gdbarch->deprecated_register_raw_size == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_virtual_size invalid"); + "gdbarch: gdbarch_deprecated_register_raw_size invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_size called\n"); - return gdbarch->register_virtual_size (reg_nr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_raw_size called\n"); + return gdbarch->deprecated_register_raw_size (reg_nr); } void -set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, - gdbarch_register_virtual_size_ftype register_virtual_size) +set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, + gdbarch_deprecated_register_raw_size_ftype deprecated_register_raw_size) { - gdbarch->register_virtual_size = register_virtual_size; + gdbarch->deprecated_register_raw_size = deprecated_register_raw_size; } int -gdbarch_deprecated_max_register_virtual_size_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->deprecated_max_register_virtual_size != 0; -} - -int -gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch) +gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr) { gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_register_virtual_size == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_register_virtual_size invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_max_register_virtual_size called\n"); - return gdbarch->deprecated_max_register_virtual_size; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_virtual_size called\n"); + return gdbarch->deprecated_register_virtual_size (reg_nr); } void -set_gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch, - int deprecated_max_register_virtual_size) +set_gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, + gdbarch_deprecated_register_virtual_size_ftype deprecated_register_virtual_size) { - gdbarch->deprecated_max_register_virtual_size = deprecated_max_register_virtual_size; + gdbarch->deprecated_register_virtual_size = deprecated_register_virtual_size; } int -gdbarch_register_virtual_type_p (struct gdbarch *gdbarch) +gdbarch_deprecated_max_register_raw_size_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->register_virtual_type != 0; + return gdbarch->deprecated_max_register_raw_size != 0; } -struct type * -gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr) +int +gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_virtual_type == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_virtual_type invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_virtual_type called\n"); - return gdbarch->register_virtual_type (reg_nr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_max_register_raw_size called\n"); + return gdbarch->deprecated_max_register_raw_size; } void -set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, - gdbarch_register_virtual_type_ftype register_virtual_type) +set_gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch, + int deprecated_max_register_raw_size) { - gdbarch->register_virtual_type = register_virtual_type; + gdbarch->deprecated_max_register_raw_size = deprecated_max_register_raw_size; } int -gdbarch_register_type_p (struct gdbarch *gdbarch) +gdbarch_deprecated_max_register_virtual_size_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->register_type != 0; + return gdbarch->deprecated_max_register_virtual_size != 0; } -struct type * -gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr) +int +gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_type == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_type invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n"); - return gdbarch->register_type (gdbarch, reg_nr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_max_register_virtual_size called\n"); + return gdbarch->deprecated_max_register_virtual_size; } void -set_gdbarch_register_type (struct gdbarch *gdbarch, - gdbarch_register_type_ftype register_type) +set_gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch, + int deprecated_max_register_virtual_size) { - gdbarch->register_type = register_type; + gdbarch->deprecated_max_register_virtual_size = deprecated_max_register_virtual_size; } int @@ -4057,60 +4105,60 @@ set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, } int -gdbarch_register_convertible (struct gdbarch *gdbarch, int nr) +gdbarch_deprecated_register_convertible (struct gdbarch *gdbarch, int nr) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_convertible == 0) + if (gdbarch->deprecated_register_convertible == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_convertible invalid"); + "gdbarch: gdbarch_deprecated_register_convertible invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convertible called\n"); - return gdbarch->register_convertible (nr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_convertible called\n"); + return gdbarch->deprecated_register_convertible (nr); } void -set_gdbarch_register_convertible (struct gdbarch *gdbarch, - gdbarch_register_convertible_ftype register_convertible) +set_gdbarch_deprecated_register_convertible (struct gdbarch *gdbarch, + gdbarch_deprecated_register_convertible_ftype deprecated_register_convertible) { - gdbarch->register_convertible = register_convertible; + gdbarch->deprecated_register_convertible = deprecated_register_convertible; } void -gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to) +gdbarch_deprecated_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_convert_to_virtual == 0) + if (gdbarch->deprecated_register_convert_to_virtual == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_convert_to_virtual invalid"); + "gdbarch: gdbarch_deprecated_register_convert_to_virtual invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_virtual called\n"); - gdbarch->register_convert_to_virtual (regnum, type, from, to); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_convert_to_virtual called\n"); + gdbarch->deprecated_register_convert_to_virtual (regnum, type, from, to); } void -set_gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, - gdbarch_register_convert_to_virtual_ftype register_convert_to_virtual) +set_gdbarch_deprecated_register_convert_to_virtual (struct gdbarch *gdbarch, + gdbarch_deprecated_register_convert_to_virtual_ftype deprecated_register_convert_to_virtual) { - gdbarch->register_convert_to_virtual = register_convert_to_virtual; + gdbarch->deprecated_register_convert_to_virtual = deprecated_register_convert_to_virtual; } void -gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to) +gdbarch_deprecated_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, const char *from, char *to) { gdb_assert (gdbarch != NULL); - if (gdbarch->register_convert_to_raw == 0) + if (gdbarch->deprecated_register_convert_to_raw == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_register_convert_to_raw invalid"); + "gdbarch: gdbarch_deprecated_register_convert_to_raw invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_register_convert_to_raw called\n"); - gdbarch->register_convert_to_raw (type, regnum, from, to); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_convert_to_raw called\n"); + gdbarch->deprecated_register_convert_to_raw (type, regnum, from, to); } void -set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, - gdbarch_register_convert_to_raw_ftype register_convert_to_raw) +set_gdbarch_deprecated_register_convert_to_raw (struct gdbarch *gdbarch, + gdbarch_deprecated_register_convert_to_raw_ftype deprecated_register_convert_to_raw) { - gdbarch->register_convert_to_raw = register_convert_to_raw; + gdbarch->deprecated_register_convert_to_raw = deprecated_register_convert_to_raw; } int @@ -4940,6 +4988,32 @@ set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch->unwind_pc = unwind_pc; } +int +gdbarch_unwind_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->unwind_sp != 0; +} + +CORE_ADDR +gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->unwind_sp == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_unwind_sp invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n"); + return gdbarch->unwind_sp (gdbarch, next_frame); +} + +void +set_gdbarch_unwind_sp (struct gdbarch *gdbarch, + gdbarch_unwind_sp_ftype unwind_sp) +{ + gdbarch->unwind_sp = unwind_sp; +} + CORE_ADDR gdbarch_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi) { @@ -5005,6 +5079,13 @@ set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, } int +gdbarch_frame_num_args_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->frame_num_args != 0; +} + +int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 9678f4f..6c0eb3e 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -283,9 +283,29 @@ extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed); #define TARGET_CHAR_SIGNED (gdbarch_char_signed (current_gdbarch)) #endif +#if defined (TARGET_READ_PC) +/* Legacy for systems yet to multi-arch TARGET_READ_PC */ +#if !defined (TARGET_READ_PC_P) +#define TARGET_READ_PC_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_PC_P) +#define TARGET_READ_PC_P() (0) +#endif + +extern int gdbarch_read_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_PC_P) +#error "Non multi-arch definition of TARGET_READ_PC" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_PC_P) +#define TARGET_READ_PC_P() (gdbarch_read_pc_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_PC) -#define TARGET_READ_PC(ptid) (generic_target_read_pc (ptid)) +#define TARGET_READ_PC(ptid) (internal_error (__FILE__, __LINE__, "TARGET_READ_PC"), 0) #endif typedef CORE_ADDR (gdbarch_read_pc_ftype) (ptid_t ptid); @@ -351,9 +371,31 @@ extern void set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdba #define DEPRECATED_TARGET_READ_FP() (gdbarch_deprecated_target_read_fp (current_gdbarch)) #endif +/* UNWIND_SP is a direct replacement for TARGET_READ_SP. */ + +#if defined (TARGET_READ_SP) +/* Legacy for systems yet to multi-arch TARGET_READ_SP */ +#if !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (0) +#endif + +extern int gdbarch_read_sp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_SP_P) +#error "Non multi-arch definition of TARGET_READ_SP" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (gdbarch_read_sp_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_SP) -#define TARGET_READ_SP() (generic_target_read_sp ()) +#define TARGET_READ_SP() (internal_error (__FILE__, __LINE__, "TARGET_READ_SP"), 0) #endif typedef CORE_ADDR (gdbarch_read_sp_ftype) (void); @@ -464,7 +506,8 @@ extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo /* GDB's standard (or well known) register numbers. These can map onto a real register or a pseudo (computed) register or not be defined at - all (-1). */ + all (-1). + SP_REGNUM will hopefully be replaced by UNWIND_SP. */ /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (SP_REGNUM) @@ -653,6 +696,8 @@ extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register #define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr)) #endif +/* See the dummy frame code. */ + extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch); extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int deprecated_register_size); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_SIZE) @@ -662,6 +707,54 @@ extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int d #define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch)) #endif +/* REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. */ + +extern int gdbarch_register_type_p (struct gdbarch *gdbarch); + +typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr); +extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type); + +/* REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. */ + +#if defined (REGISTER_VIRTUAL_TYPE) +/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_TYPE */ +#if !defined (REGISTER_VIRTUAL_TYPE_P) +#define REGISTER_VIRTUAL_TYPE_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_TYPE_P) +#define REGISTER_VIRTUAL_TYPE_P() (0) +#endif + +extern int gdbarch_deprecated_register_virtual_type_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE_P) +#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_TYPE_P) +#define REGISTER_VIRTUAL_TYPE_P() (gdbarch_deprecated_register_virtual_type_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_TYPE) +#define REGISTER_VIRTUAL_TYPE(reg_nr) (internal_error (__FILE__, __LINE__, "REGISTER_VIRTUAL_TYPE"), 0) +#endif + +typedef struct type * (gdbarch_deprecated_register_virtual_type_ftype) (int reg_nr); +extern struct type * gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, gdbarch_deprecated_register_virtual_type_ftype *deprecated_register_virtual_type); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE) +#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE" +#endif +#if !defined (REGISTER_VIRTUAL_TYPE) +#define REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_deprecated_register_virtual_type (current_gdbarch, reg_nr)) +#endif + +/* DEPRECATED_REGISTER_BYTES can be deleted. The value is computed + from REGISTER_TYPE. */ + extern int gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch); extern void set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, int deprecated_register_bytes); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTES) @@ -671,11 +764,12 @@ extern void set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, int #define DEPRECATED_REGISTER_BYTES (gdbarch_deprecated_register_bytes (current_gdbarch)) #endif -/* NOTE: cagney/2002-05-02: This function with predicate has a valid - (callable) initial value. As a consequence, even when the predicate - is false, the corresponding function works. This simplifies the - migration process - old code, calling REGISTER_BYTE, doesn't need to - be modified. */ +/* DEPRECATED_REGISTER_BYTE can be deleted. The value is computed from + REGISTER_TYPE. NOTE: cagney/2002-05-02: This function with + predicate has a valid (callable) initial value. As a consequence, + even when the predicate is false, the corresponding function works. + This simplifies the migration process - old code, calling + DEPRECATED_REGISTER_BYTE, doesn't need to be modified. */ #if defined (REGISTER_BYTE) /* Legacy for systems yet to multi-arch REGISTER_BYTE */ @@ -689,12 +783,12 @@ extern void set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, int #define REGISTER_BYTE_P() (0) #endif -extern int gdbarch_register_byte_p (struct gdbarch *gdbarch); +extern int gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_BYTE_P) #error "Non multi-arch definition of REGISTER_BYTE" #endif #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTE_P) -#define REGISTER_BYTE_P() (gdbarch_register_byte_p (current_gdbarch)) +#define REGISTER_BYTE_P() (gdbarch_deprecated_register_byte_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ @@ -702,37 +796,54 @@ extern int gdbarch_register_byte_p (struct gdbarch *gdbarch); #define REGISTER_BYTE(reg_nr) (generic_register_byte (reg_nr)) #endif -typedef int (gdbarch_register_byte_ftype) (int reg_nr); -extern int gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr); -extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register_byte_ftype *register_byte); +typedef int (gdbarch_deprecated_register_byte_ftype) (int reg_nr); +extern int gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, gdbarch_deprecated_register_byte_ftype *deprecated_register_byte); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_BYTE) #error "Non multi-arch definition of REGISTER_BYTE" #endif #if !defined (REGISTER_BYTE) -#define REGISTER_BYTE(reg_nr) (gdbarch_register_byte (current_gdbarch, reg_nr)) +#define REGISTER_BYTE(reg_nr) (gdbarch_deprecated_register_byte (current_gdbarch, reg_nr)) #endif -/* The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and - REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. */ +/* DEPRECATED_REGISTER_RAW_SIZE can be deleted. The value is computed + from REGISTER_TYPE. */ /* 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); +typedef int (gdbarch_deprecated_register_raw_size_ftype) (int reg_nr); +extern int gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, gdbarch_deprecated_register_raw_size_ftype *deprecated_register_raw_size); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_RAW_SIZE) #error "Non multi-arch definition of REGISTER_RAW_SIZE" #endif #if !defined (REGISTER_RAW_SIZE) -#define REGISTER_RAW_SIZE(reg_nr) (gdbarch_register_raw_size (current_gdbarch, reg_nr)) +#define REGISTER_RAW_SIZE(reg_nr) (gdbarch_deprecated_register_raw_size (current_gdbarch, reg_nr)) +#endif + +/* DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. The value is + computed from REGISTER_TYPE. */ + +/* 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_deprecated_register_virtual_size_ftype) (int reg_nr); +extern int gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr); +extern void set_gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, gdbarch_deprecated_register_virtual_size_ftype *deprecated_register_virtual_size); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_SIZE) +#error "Non multi-arch definition of REGISTER_VIRTUAL_SIZE" +#endif +#if !defined (REGISTER_VIRTUAL_SIZE) +#define REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_deprecated_register_virtual_size (current_gdbarch, reg_nr)) #endif -/* The methods DEPRECATED_MAX_REGISTER_RAW_SIZE and - DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE are all being replaced by - MAX_REGISTER_SIZE (a constant). */ +/* DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted. It has been + replaced by the constant MAX_REGISTER_SIZE. */ #if defined (DEPRECATED_MAX_REGISTER_RAW_SIZE) /* Legacy for systems yet to multi-arch DEPRECATED_MAX_REGISTER_RAW_SIZE */ @@ -768,27 +879,8 @@ extern void set_gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarc #define DEPRECATED_MAX_REGISTER_RAW_SIZE (gdbarch_deprecated_max_register_raw_size (current_gdbarch)) #endif -/* The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and - REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. */ - -/* 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); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_SIZE) -#error "Non multi-arch definition of REGISTER_VIRTUAL_SIZE" -#endif -#if !defined (REGISTER_VIRTUAL_SIZE) -#define REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_register_virtual_size (current_gdbarch, reg_nr)) -#endif - -/* The methods DEPRECATED_MAX_REGISTER_RAW_SIZE and - DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE are all being replaced by - MAX_REGISTER_SIZE (a constant). */ +/* DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE can be deleted. It has been + replaced by the constant MAX_REGISTER_SIZE. */ #if defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE) /* Legacy for systems yet to multi-arch DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE */ @@ -824,50 +916,6 @@ extern void set_gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gd #define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE (gdbarch_deprecated_max_register_virtual_size (current_gdbarch)) #endif -/* The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and - REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. */ - -#if defined (REGISTER_VIRTUAL_TYPE) -/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_TYPE */ -#if !defined (REGISTER_VIRTUAL_TYPE_P) -#define REGISTER_VIRTUAL_TYPE_P() (1) -#endif -#endif - -/* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_TYPE_P) -#define REGISTER_VIRTUAL_TYPE_P() (0) -#endif - -extern int gdbarch_register_virtual_type_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE_P) -#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE" -#endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_TYPE_P) -#define REGISTER_VIRTUAL_TYPE_P() (gdbarch_register_virtual_type_p (current_gdbarch)) -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_TYPE) -#define REGISTER_VIRTUAL_TYPE(reg_nr) (internal_error (__FILE__, __LINE__, "REGISTER_VIRTUAL_TYPE"), 0) -#endif - -typedef struct type * (gdbarch_register_virtual_type_ftype) (int reg_nr); -extern struct type * gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr); -extern void set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, gdbarch_register_virtual_type_ftype *register_virtual_type); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE) -#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE" -#endif -#if !defined (REGISTER_VIRTUAL_TYPE) -#define REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_register_virtual_type (current_gdbarch, reg_nr)) -#endif - -extern int gdbarch_register_type_p (struct gdbarch *gdbarch); - -typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr); -extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr); -extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type); - #if defined (DEPRECATED_DO_REGISTERS_INFO) /* Legacy for systems yet to multi-arch DEPRECATED_DO_REGISTERS_INFO */ #if !defined (DEPRECATED_DO_REGISTERS_INFO_P) @@ -1404,49 +1452,58 @@ extern void set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, #define DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_deprecated_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) #endif +/* For register <-> value conversions, replaced by CONVERT_REGISTER_P et.al. + For raw <-> cooked register conversions, replaced by pseudo registers. */ + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (REGISTER_CONVERTIBLE) -#define REGISTER_CONVERTIBLE(nr) (generic_register_convertible_not (nr)) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_CONVERTIBLE) +#define DEPRECATED_REGISTER_CONVERTIBLE(nr) (deprecated_register_convertible_not (nr)) #endif -typedef int (gdbarch_register_convertible_ftype) (int nr); -extern int gdbarch_register_convertible (struct gdbarch *gdbarch, int nr); -extern void set_gdbarch_register_convertible (struct gdbarch *gdbarch, gdbarch_register_convertible_ftype *register_convertible); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_CONVERTIBLE) -#error "Non multi-arch definition of REGISTER_CONVERTIBLE" +typedef int (gdbarch_deprecated_register_convertible_ftype) (int nr); +extern int gdbarch_deprecated_register_convertible (struct gdbarch *gdbarch, int nr); +extern void set_gdbarch_deprecated_register_convertible (struct gdbarch *gdbarch, gdbarch_deprecated_register_convertible_ftype *deprecated_register_convertible); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_CONVERTIBLE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_CONVERTIBLE" #endif -#if !defined (REGISTER_CONVERTIBLE) -#define REGISTER_CONVERTIBLE(nr) (gdbarch_register_convertible (current_gdbarch, nr)) +#if !defined (DEPRECATED_REGISTER_CONVERTIBLE) +#define DEPRECATED_REGISTER_CONVERTIBLE(nr) (gdbarch_deprecated_register_convertible (current_gdbarch, nr)) #endif +/* For register <-> value conversions, replaced by CONVERT_REGISTER_P et.al. + For raw <-> cooked register conversions, replaced by pseudo registers. */ + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (REGISTER_CONVERT_TO_VIRTUAL) -#define REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (internal_error (__FILE__, __LINE__, "REGISTER_CONVERT_TO_VIRTUAL"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL) +#define DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (internal_error (__FILE__, __LINE__, "DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL"), 0) #endif -typedef void (gdbarch_register_convert_to_virtual_ftype) (int regnum, struct type *type, char *from, char *to); -extern void gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to); -extern void set_gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_CONVERT_TO_VIRTUAL) -#error "Non multi-arch definition of REGISTER_CONVERT_TO_VIRTUAL" +typedef void (gdbarch_deprecated_register_convert_to_virtual_ftype) (int regnum, struct type *type, char *from, char *to); +extern void gdbarch_deprecated_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to); +extern void set_gdbarch_deprecated_register_convert_to_virtual (struct gdbarch *gdbarch, gdbarch_deprecated_register_convert_to_virtual_ftype *deprecated_register_convert_to_virtual); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL) +#error "Non multi-arch definition of DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL" #endif -#if !defined (REGISTER_CONVERT_TO_VIRTUAL) -#define REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (gdbarch_register_convert_to_virtual (current_gdbarch, regnum, type, from, to)) +#if !defined (DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL) +#define DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (gdbarch_deprecated_register_convert_to_virtual (current_gdbarch, regnum, type, from, to)) #endif +/* For register <-> value conversions, replaced by CONVERT_REGISTER_P et.al. + For raw <-> cooked register conversions, replaced by pseudo registers. */ + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (REGISTER_CONVERT_TO_RAW) -#define REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (internal_error (__FILE__, __LINE__, "REGISTER_CONVERT_TO_RAW"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_CONVERT_TO_RAW) +#define DEPRECATED_REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (internal_error (__FILE__, __LINE__, "DEPRECATED_REGISTER_CONVERT_TO_RAW"), 0) #endif -typedef void (gdbarch_register_convert_to_raw_ftype) (struct type *type, int regnum, char *from, char *to); -extern void gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to); -extern void set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarch_register_convert_to_raw_ftype *register_convert_to_raw); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_CONVERT_TO_RAW) -#error "Non multi-arch definition of REGISTER_CONVERT_TO_RAW" +typedef void (gdbarch_deprecated_register_convert_to_raw_ftype) (struct type *type, int regnum, const char *from, char *to); +extern void gdbarch_deprecated_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, const char *from, char *to); +extern void set_gdbarch_deprecated_register_convert_to_raw (struct gdbarch *gdbarch, gdbarch_deprecated_register_convert_to_raw_ftype *deprecated_register_convert_to_raw); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_CONVERT_TO_RAW) +#error "Non multi-arch definition of DEPRECATED_REGISTER_CONVERT_TO_RAW" #endif -#if !defined (REGISTER_CONVERT_TO_RAW) -#define REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (gdbarch_register_convert_to_raw (current_gdbarch, type, regnum, from, to)) +#if !defined (DEPRECATED_REGISTER_CONVERT_TO_RAW) +#define DEPRECATED_REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (gdbarch_deprecated_register_convert_to_raw (current_gdbarch, type, regnum, from, to)) #endif /* Default (function) for non- multi-arch platforms. */ @@ -2217,6 +2274,12 @@ typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct fra extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame); extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc); +extern int gdbarch_unwind_sp_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp); + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (FRAME_ARGS_ADDRESS) #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi)) @@ -2282,6 +2345,31 @@ extern void set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, #define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (gdbarch_deprecated_saved_pc_after_call (current_gdbarch, frame)) #endif +#if defined (FRAME_NUM_ARGS) +/* Legacy for systems yet to multi-arch FRAME_NUM_ARGS */ +#if !defined (FRAME_NUM_ARGS_P) +#define FRAME_NUM_ARGS_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (FRAME_NUM_ARGS_P) +#define FRAME_NUM_ARGS_P() (0) +#endif + +extern int gdbarch_frame_num_args_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_NUM_ARGS_P) +#error "Non multi-arch definition of FRAME_NUM_ARGS" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_NUM_ARGS_P) +#define FRAME_NUM_ARGS_P() (gdbarch_frame_num_args_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (FRAME_NUM_ARGS) +#define FRAME_NUM_ARGS(frame) (internal_error (__FILE__, __LINE__, "FRAME_NUM_ARGS"), 0) +#endif + typedef int (gdbarch_frame_num_args_ftype) (struct frame_info *frame); extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame); extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 006ec96..9911ec8 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -426,12 +426,13 @@ v:2:TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE # One if \`char' acts like \`signed char', zero if \`unsigned char'. v:2:TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1:::: # -f:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0 +F:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid f:2:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0 # This is simply not needed. See value_of_builtin_frame_fp_reg and # call_function_by_hand. F::DEPRECATED_TARGET_READ_FP:CORE_ADDR:deprecated_target_read_fp:void -f:2:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0 +# UNWIND_SP is a direct replacement for TARGET_READ_SP. +F:2:TARGET_READ_SP:CORE_ADDR:read_sp:void # The dummy call frame SP should be set by push_dummy_call. F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val # Function for getting target's idea of a frame pointer. FIXME: GDB's @@ -452,6 +453,7 @@ v:2:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0::: # GDB's standard (or well known) register numbers. These can map onto # a real register or a pseudo (computed) register or not be defined at # all (-1). +# SP_REGNUM will hopefully be replaced by UNWIND_SP. v:2:SP_REGNUM:int:sp_regnum::::-1:-1::0 # This is simply not needed. See value_of_builtin_frame_fp_reg and # call_function_by_hand. @@ -472,33 +474,36 @@ f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0 f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0 f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0 +# See the dummy frame code. v::DEPRECATED_REGISTER_SIZE:int:deprecated_register_size + +# REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. +M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0: +# REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. +F:2:REGISTER_VIRTUAL_TYPE:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr::0:0 +# DEPRECATED_REGISTER_BYTES can be deleted. The value is computed +# from REGISTER_TYPE. v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes -# NOTE: cagney/2002-05-02: This function with predicate has a valid -# (callable) initial value. As a consequence, even when the predicate -# is false, the corresponding function works. This simplifies the -# migration process - old code, calling REGISTER_BYTE, doesn't need to -# be modified. -F::REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte -# The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and -# REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. -f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 -# The methods DEPRECATED_MAX_REGISTER_RAW_SIZE and -# DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE are all being replaced by -# MAX_REGISTER_SIZE (a constant). +# DEPRECATED_REGISTER_BYTE can be deleted. The value is computed from +# REGISTER_TYPE. NOTE: cagney/2002-05-02: This function with +# predicate has a valid (callable) initial value. As a consequence, +# even when the predicate is false, the corresponding function works. +# This simplifies the migration process - old code, calling +# DEPRECATED_REGISTER_BYTE, doesn't need to be modified. +F::REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte +# DEPRECATED_REGISTER_RAW_SIZE can be deleted. The value is computed +# from REGISTER_TYPE. +f:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 +# DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. The value is +# computed from REGISTER_TYPE. +f:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 +# DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted. It has been +# replaced by the constant MAX_REGISTER_SIZE. V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size -# The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and -# REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. -f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 -# The methods DEPRECATED_MAX_REGISTER_RAW_SIZE and -# DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE are all being replaced by -# MAX_REGISTER_SIZE (a constant). +# DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE can be deleted. It has been +# replaced by the constant MAX_REGISTER_SIZE. V:2:DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE:int:deprecated_max_register_virtual_size -# The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and -# REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. -F:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0 -M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0: -# + F:2:DEPRECATED_DO_REGISTERS_INFO:void:deprecated_do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs m:2:PRINT_REGISTERS_INFO:void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all:::default_print_registers_info::0 M:2:PRINT_FLOAT_INFO:void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args @@ -553,9 +558,15 @@ v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v::BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: F:2:DEPRECATED_GET_SAVED_REGISTER:void:deprecated_get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval # -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 +# For register <-> value conversions, replaced by CONVERT_REGISTER_P et.al. +# For raw <-> cooked register conversions, replaced by pseudo registers. +f:2:DEPRECATED_REGISTER_CONVERTIBLE:int:deprecated_register_convertible:int nr:nr:::deprecated_register_convertible_not::0 +# For register <-> value conversions, replaced by CONVERT_REGISTER_P et.al. +# For raw <-> cooked register conversions, replaced by pseudo registers. +f:2:DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL:void:deprecated_register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 +# For register <-> value conversions, replaced by CONVERT_REGISTER_P et.al. +# For raw <-> cooked register conversions, replaced by pseudo registers. +f:2:DEPRECATED_REGISTER_CONVERT_TO_RAW:void:deprecated_register_convert_to_raw:struct type *type, int regnum, const 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 @@ -609,10 +620,11 @@ F:2:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chai # interfaces they have very different underlying implementations. F:2:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi::0:0 M::UNWIND_PC:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame: +M::UNWIND_SP:CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame: f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:get_frame_base::0 f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:get_frame_base::0 F::DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame -f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0 +F:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame # F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0 M:::CORE_ADDR:frame_align:CORE_ADDR address:address @@ -1401,7 +1413,7 @@ function_list | while do_read do if class_is_info_p then - printf " ${staticdefault},\n" + printf " ${staticdefault}, /* ${function} */\n" fi done cat < + + From Kelley Cook : + * configure.srv: Accept i[34567]86 variants. + 2003-06-05 Daniel Jacobowitz * linux-low.c (linux_wait_for_event): Correct comment typos. diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 28dc2aa..6ab60e9 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -23,7 +23,7 @@ case "${target}" in srv_linux_usrregs=yes srv_linux_thread_db=yes ;; - i[3456]86-*-linux*) srv_regobj=reg-i386-linux.o + i[34567]86-*-linux*) srv_regobj=reg-i386-linux.o srv_tgtobj="linux-low.o linux-i386-low.o i387-fp.o" srv_linux_usrregs=yes srv_linux_regsets=yes diff --git a/gdb/gdbserver/linux-ppc64-low.c b/gdb/gdbserver/linux-ppc64-low.c new file mode 100644 index 0000000..f88db35 --- /dev/null +++ b/gdb/gdbserver/linux-ppc64-low.c @@ -0,0 +1,113 @@ +/* gdbserver low-level interface for GNU/Linux running on 64-bit PowerPC. + Copyright 2003 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 "server.h" +#include "linux-low.h" + +#include + +#define ppc64_num_regs (sizeof (ppc64_regmap) / sizeof (ppc64_regmap[0])) + +#define FPR(n) ((PT_FPR0 + (n)) * 8) + +/* Currently, don't check/send MQ. */ +static int ppc64_regmap[] = + { + PT_R0 * 8, PT_R1 * 8, PT_R2 * 8, PT_R3 * 8, + PT_R4 * 8, PT_R5 * 8, PT_R6 * 8, PT_R7 * 8, + PT_R8 * 8, PT_R9 * 8, PT_R10 * 8, PT_R11 * 8, + PT_R12 * 8, PT_R13 * 8, PT_R14 * 8, PT_R15 * 8, + PT_R16 * 8, PT_R17 * 8, PT_R18 * 8, PT_R19 * 8, + PT_R20 * 8, PT_R21 * 8, PT_R22 * 8, PT_R23 * 8, + PT_R24 * 8, PT_R25 * 8, PT_R26 * 8, PT_R27 * 8, + PT_R28 * 8, PT_R29 * 8, PT_R30 * 8, PT_R31 * 8, + FPR (0), FPR (1), FPR (2), FPR (3), + FPR (4), FPR (5), FPR (6), FPR (7), + FPR (8), FPR (9), FPR (10), FPR (11), + FPR (12), FPR (13), FPR (14), FPR (15), + FPR (16), FPR (17), FPR (18), FPR (19), + FPR (20), FPR (21), FPR (22), FPR (23), + FPR (24), FPR (25), FPR (26), FPR (27), + FPR (28), FPR (29), FPR (30), FPR (31), + PT_NIP * 8, PT_MSR * 8, PT_CCR * 8, PT_LNK * 8, + PT_CTR * 8, PT_XER * 8, PT_FPSCR * 8, + }; + +static int +ppc64_cannot_store_register (int regno) +{ + return 0; +} + +static int +ppc64_cannot_fetch_register (int regno) +{ + return 0; +} + +static CORE_ADDR +ppc64_get_pc (void) +{ + unsigned long pc; + + collect_register_by_name ("pc", &pc); + return (CORE_ADDR) pc; +} + +static void +ppc64_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. + This instruction is "twge r2, r2", which GDB uses as a software + breakpoint. */ +static const unsigned int ppc64_breakpoint = 0x7d821008; +#define ppc64_breakpoint_len 4 + +static int +ppc64_breakpoint_at (CORE_ADDR where) +{ + unsigned int insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == ppc64_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + +struct linux_target_ops the_low_target = { + ppc64_num_regs, + ppc64_regmap, + ppc64_cannot_fetch_register, + ppc64_cannot_store_register, + ppc64_get_pc, + ppc64_set_pc, + (const char *) &ppc64_breakpoint, + ppc64_breakpoint_len, + NULL, + 0, + ppc64_breakpoint_at, +}; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 3b8e62f..3889afc 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -434,7 +434,7 @@ address_space_int_to_name (int space_flag) /* 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 * +static struct type * make_qualified_type (struct type *type, int new_flags, struct type *storage) { @@ -1668,7 +1668,7 @@ check_typedef (struct type *type) /* Parse a type expression in the string [P..P+LENGTH). If an error occurs, silently return builtin_type_void. */ -struct type * +static struct type * safe_parse_type (char *p, int length) { struct ui_file *saved_gdb_stderr; diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 47d6e12..da04c74 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -184,7 +184,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, } -struct type * +static struct type * gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) { struct type *known_type; @@ -401,6 +401,8 @@ init_gnuv2_ops (void) gnu_v2_abi_ops.baseclass_offset = gnuv2_baseclass_offset; } +extern initialize_file_ftype _initialize_gnu_v2_abi; /* -Wmissing-prototypes */ + void _initialize_gnu_v2_abi (void) { diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index da2a2d6..bbfd118 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -372,7 +372,7 @@ gnuv3_virtual_fn_field (struct value **value_p, to (the address of)(ARG) + OFFSET. -1 is returned on error. */ -int +static int gnuv3_baseclass_offset (struct type *type, int index, char *valaddr, CORE_ADDR address) { @@ -447,6 +447,7 @@ init_gnuv3_ops (void) gnu_v3_abi_ops.baseclass_offset = gnuv3_baseclass_offset; } +extern initialize_file_ftype _initialize_gnu_v3_abi; /* -Wmissing-prototypes */ void _initialize_gnu_v3_abi (void) diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index e7eb1fa..0ebcf22 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -40,12 +40,8 @@ struct frame_extra_info { CORE_ADDR from_pc; - CORE_ADDR args_pointer; - CORE_ADDR locals_pointer; }; -#define E_NUM_REGS (h8300smode ? 14 : 13) - enum { h8300_reg_size = 2, @@ -57,7 +53,8 @@ enum enum gdb_regnum { E_R0_REGNUM, E_ER0_REGNUM = E_R0_REGNUM, E_ARG0_REGNUM = E_R0_REGNUM, - E_R1_REGNUM, E_ER1_REGNUM = E_R1_REGNUM, + E_RET0_REGNUM = E_R0_REGNUM, + E_R1_REGNUM, E_ER1_REGNUM = E_R1_REGNUM, E_RET1_REGNUM = E_R1_REGNUM, E_R2_REGNUM, E_ER2_REGNUM = E_R2_REGNUM, E_ARGLAST_REGNUM = E_R2_REGNUM, E_R3_REGNUM, E_ER3_REGNUM = E_R3_REGNUM, E_R4_REGNUM, E_ER4_REGNUM = E_R4_REGNUM, @@ -69,7 +66,11 @@ enum gdb_regnum E_CYCLES_REGNUM, E_TICK_REGNUM, E_EXR_REGNUM = E_TICK_REGNUM, E_INST_REGNUM, E_TICKS_REGNUM = E_INST_REGNUM, - E_INSTS_REGNUM + E_INSTS_REGNUM, + E_MACH_REGNUM, + E_MACL_REGNUM, + E_SBR_REGNUM, + E_VBR_REGNUM }; #define UNSIGNED_SHORT(X) ((X) & 0xffff) @@ -270,7 +271,9 @@ gdb_print_insn_h8300 (bfd_vma memaddr, disassemble_info * info) of the instruction. */ static CORE_ADDR -h8300_next_prologue_insn (CORE_ADDR addr, CORE_ADDR lim, unsigned short* pword1) +h8300_next_prologue_insn (CORE_ADDR addr, + CORE_ADDR lim, + unsigned short* pword1) { char buf[2]; if (addr < lim + 8) @@ -439,10 +442,6 @@ h8300_examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, break; } - /* The args are always reffed based from the stack pointer */ - get_frame_extra_info (fi)->args_pointer = after_prolog_fp; - /* Locals are always reffed based from the fp */ - get_frame_extra_info (fi)->locals_pointer = after_prolog_fp; /* The PC is at a known place */ get_frame_extra_info (fi)->from_pc = read_memory_unsigned_integer (after_prolog_fp + BINWORD, BINWORD); @@ -452,7 +451,8 @@ h8300_examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, if (have_fp) /* We keep the old FP in the SP spot */ - fsr[E_SP_REGNUM] = read_memory_unsigned_integer (fsr[E_FP_REGNUM], BINWORD); + fsr[E_SP_REGNUM] = read_memory_unsigned_integer (fsr[E_FP_REGNUM], + BINWORD); else fsr[E_SP_REGNUM] = after_prolog_fp + auto_depth; @@ -470,10 +470,12 @@ h8300_frame_init_saved_regs (struct frame_info *fi) /* Find the beginning of this function, so we can analyze its prologue. */ - if (find_pc_partial_function (get_frame_pc (fi), NULL, &func_addr, &func_end)) + if (find_pc_partial_function (get_frame_pc (fi), NULL, + &func_addr, &func_end)) { struct symtab_and_line sal = find_pc_line (func_addr, 0); - CORE_ADDR limit = (sal.end && sal.end < get_frame_pc (fi)) ? sal.end : get_frame_pc (fi); + CORE_ADDR limit = (sal.end && sal.end < get_frame_pc (fi)) + ? sal.end : get_frame_pc (fi); /* This will fill in fields in fi. */ h8300_examine_prologue (func_addr, limit, get_frame_base (fi), get_frame_saved_regs (fi), fi); @@ -489,7 +491,8 @@ h8300_frame_init_saved_regs (struct frame_info *fi) will be called for the new frame. For us, the frame address is its stack pointer value, so we look up - the function prologue to determine the caller's sp value, and return it. */ + the function prologue to determine the caller's sp value, and + return it. */ static CORE_ADDR h8300_frame_chain (struct frame_info *thisframe) @@ -532,8 +535,6 @@ h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi) { frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); get_frame_extra_info (fi)->from_pc = 0; - get_frame_extra_info (fi)->args_pointer = 0; /* Unknown */ - get_frame_extra_info (fi)->locals_pointer = 0; /* Unknown */ if (!get_frame_pc (fi)) { @@ -544,27 +545,6 @@ h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi) } } -static CORE_ADDR -h8300_frame_locals_address (struct frame_info *fi) -{ - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), - get_frame_base (fi))) - return (CORE_ADDR) 0; /* Not sure what else to do... */ - return get_frame_extra_info (fi)->locals_pointer; -} - -/* Return the address of the argument block for the frame - described by FI. Returns 0 if the address is unknown. */ - -static CORE_ADDR -h8300_frame_args_address (struct frame_info *fi) -{ - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), - get_frame_base (fi))) - return (CORE_ADDR) 0; /* Not sure what else to do... */ - return get_frame_extra_info (fi)->args_pointer; -} - /* Round N up or down to the nearest multiple of UNIT. Evaluate N only once, UNIT several times. UNIT must be a power of two. */ @@ -706,7 +686,8 @@ h8300_push_arguments (int nargs, struct value **args, CORE_ADDR sp, for (offset = 0; offset < padded_len; offset += wordsize) { - ULONGEST word = extract_unsigned_integer (padded + offset, wordsize); + ULONGEST word = extract_unsigned_integer (padded + offset, + wordsize); write_register (reg++, word); } } @@ -769,8 +750,8 @@ h8300_pop_frame (void) actual value we want, not the address of the value we want. */ if (get_frame_saved_regs (frame)[regno] && regno != E_SP_REGNUM) write_register (regno, - read_memory_integer (get_frame_saved_regs (frame)[regno], - BINWORD)); + read_memory_integer + (get_frame_saved_regs (frame)[regno], BINWORD)); else if (get_frame_saved_regs (frame)[regno] && regno == E_SP_REGNUM) write_register (regno, get_frame_base (frame) + 2 * BINWORD); } @@ -786,68 +767,105 @@ h8300_pop_frame (void) Copy that into VALBUF. Be sure to account for CPU type. */ static void -h8300_extract_return_value (struct type *type, char *regbuf, char *valbuf) +h8300_extract_return_value (struct type *type, struct regcache *regcache, + void *valbuf) { - int wordsize = BINWORD; int len = TYPE_LENGTH (type); + ULONGEST c; switch (len) { - case 1: /* (char) */ - case 2: /* (short), (int) */ - memcpy (valbuf, regbuf + REGISTER_BYTE (0) + (wordsize - len), len); - break; - case 4: /* (long), (float) */ - if (wordsize == 4) - { - memcpy (valbuf, regbuf + REGISTER_BYTE (0), 4); - } - else - { - memcpy (valbuf, regbuf + REGISTER_BYTE (0), 2); - memcpy (valbuf + 2, regbuf + REGISTER_BYTE (1), 2); - } - break; - case 8: /* (double) (doesn't seem to happen, which is good, - because this almost certainly isn't right. */ - error ("I don't know how a double is returned."); - break; + case 1: + case 2: + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); + store_unsigned_integer (valbuf, len, c); + break; + case 4: /* Needs two registers on plain H8/300 */ + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); + store_unsigned_integer (valbuf, 2, c); + regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c); + store_unsigned_integer ((void*)((char *)valbuf + 2), 2, c); + break; + case 8: /* long long, double and long double are all defined + as 4 byte types so far so this shouldn't happen. */ + error ("I don't know how a 8 byte value is returned."); + break; } } +static void +h8300h_extract_return_value (struct type *type, struct regcache *regcache, + void *valbuf) +{ + int len = TYPE_LENGTH (type); + ULONGEST c; + + switch (len) + { + case 1: + case 2: + case 4: + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); + store_unsigned_integer (valbuf, len, c); + break; + case 8: /* long long, double and long double are all defined + as 4 byte types so far so this shouldn't happen. */ + error ("I don't know how a 8 byte value is returned."); + break; + } +} + + /* Function: store_return_value Place the appropriate value in the appropriate registers. Primarily used by the RETURN command. */ static void -h8300_store_return_value (struct type *type, char *valbuf) +h8300_store_return_value (struct type *type, struct regcache *regcache, + const void *valbuf) { - int regval; - int wordsize = BINWORD; int len = TYPE_LENGTH (type); + ULONGEST val; switch (len) { - case 1: /* char */ - case 2: /* short, int */ - regval = extract_unsigned_integer (valbuf, len); - write_register (0, regval); - break; - case 4: /* long, float */ - regval = extract_unsigned_integer (valbuf, len); - if (wordsize == 4) - { - write_register (0, regval); - } - else - { - write_register (0, regval >> 16); - write_register (1, regval & 0xffff); - } - break; - case 8: /* presumeably double, but doesn't seem to happen */ - error ("I don't know how to return a double."); - break; + case 1: + case 2: + val = extract_unsigned_integer (valbuf, len); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val); + break; + case 4: /* long, float */ + val = extract_unsigned_integer (valbuf, len); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, + (val >> 16) &0xffff); + regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff); + break; + case 8: /* long long, double and long double are all defined + as 4 byte types so far so this shouldn't happen. */ + error ("I don't know how to return a 8 byte value."); + break; + } +} + +static void +h8300h_store_return_value (struct type *type, struct regcache *regcache, + const void *valbuf) +{ + int len = TYPE_LENGTH (type); + ULONGEST val; + + switch (len) + { + case 1: + case 2: + case 4: /* long, float */ + val = extract_unsigned_integer (valbuf, len); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val); + break; + case 8: /* long long, double and long double are all defined + as 4 byte types so far so this shouldn't happen. */ + error ("I don't know how to return a 8 byte value."); + break; } } @@ -856,21 +874,47 @@ static struct cmd_list_element *setmachinelist; static const char * h8300_register_name (int regno) { - /* The register names change depending on whether the h8300h processor + /* The register names change depending on which h8300 processor type is selected. */ - static char *h8300_register_names[] = { + static char *register_names[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles", "tick", "inst", "" }; - static char *h8300s_register_names[] = { + if (regno < 0 + || regno >= (sizeof (register_names) / sizeof (*register_names))) + internal_error (__FILE__, __LINE__, + "h8300_register_name: illegal register number %d", regno); + else + return register_names[regno]; +} + +static const char * +h8300s_register_name (int regno) +{ + static char *register_names[] = { "er0", "er1", "er2", "er3", "er4", "er5", "er6", "sp", "ccr", "pc", "cycles", "exr", "tick", "inst" }; - char **register_names = - h8300smode ? h8300s_register_names : h8300_register_names; - if (regno < 0 || regno >= E_NUM_REGS) + if (regno < 0 + || regno >= (sizeof (register_names) / sizeof (*register_names))) + internal_error (__FILE__, __LINE__, + "h8300s_register_name: illegal register number %d", regno); + else + return register_names[regno]; +} + +static const char * +h8300sx_register_name (int regno) +{ + static char *register_names[] = { + "er0", "er1", "er2", "er3", "er4", "er5", "er6", + "sp", "ccr", "pc", "cycles", "exr", "tick", "inst", + "mach", "macl", "sbr", "vbr" + }; + if (regno < 0 + || regno >= (sizeof (register_names) / sizeof (*register_names))) internal_error (__FILE__, __LINE__, - "h8300_register_name: illegal register number %d", regno); + "h8300sx_register_name: illegal register number %d", regno); else return register_names[regno]; } @@ -879,44 +923,30 @@ static void h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regno) { - ULONGEST rval; - long val; - const char *name = h8300_register_name (regno); + LONGEST rval; + const char *name = gdbarch_register_name (gdbarch, regno); if (!name || !*name) return; - /* FIXME: cagney/2002-10-22: The code below assumes that VAL is at - least 4 bytes (32 bits) in size and hence is large enough to hold - the largest h8300 register. Should instead be using ULONGEST and - the phex() functions. */ - gdb_assert (sizeof (val) >= 4); - frame_read_unsigned_register (frame, regno, &rval); - val = rval; + frame_read_signed_register (frame, regno, &rval); fprintf_filtered (file, "%-14s ", name); - if (h8300hmode) + if (regno == E_CCR_REGNUM || (regno == E_EXR_REGNUM && h8300smode)) { - if (val) - fprintf_filtered (file, "0x%08lx %-8ld", val, val); - else - fprintf_filtered (file, "0x%-8lx %-8ld", val, val); + fprintf_filtered (file, "0x%02x ", (unsigned char)rval); + print_longest (file, 'u', 1, rval); } else { - if (val) - fprintf_filtered (file, "0x%04lx %-4ld", val, val); - else - fprintf_filtered (file, "0x%-4lx %-4ld", val, val); + fprintf_filtered (file, "0x%s ", phex ((ULONGEST)rval, BINWORD)); + print_longest (file, 'd', 1, rval); } if (regno == E_CCR_REGNUM) { /* CCR register */ int C, Z, N, V; - unsigned char b[h8300h_reg_size]; - unsigned char l; - frame_register_read (deprecated_selected_frame, regno, b); - l = b[REGISTER_VIRTUAL_SIZE (E_CCR_REGNUM) - 1]; + unsigned char l = rval & 0xff; fprintf_filtered (file, "\t"); fprintf_filtered (file, "I-%d ", (l & 0x80) != 0); fprintf_filtered (file, "UI-%d ", (l & 0x40) != 0); @@ -954,10 +984,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, else if (regno == E_EXR_REGNUM && h8300smode) { /* EXR register */ - unsigned char b[h8300h_reg_size]; - unsigned char l; - frame_register_read (deprecated_selected_frame, regno, b); - l = b[REGISTER_VIRTUAL_SIZE (E_EXR_REGNUM) - 1]; + unsigned char l = rval & 0xff; fprintf_filtered (file, "\t"); fprintf_filtered (file, "T-%d - - - ", (l & 0x80) != 0); fprintf_filtered (file, "I2-%d ", (l & 4) != 0); @@ -972,7 +999,7 @@ h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regno, int cpregs) { if (regno < 0) - for (regno = 0; regno < E_NUM_REGS; ++regno) + for (regno = 0; regno < NUM_REGS; ++regno) h8300_print_register (gdbarch, file, frame, regno); else h8300_print_register (gdbarch, file, frame, regno); @@ -984,56 +1011,41 @@ h8300_saved_pc_after_call (struct frame_info *ignore) return read_memory_unsigned_integer (read_register (E_SP_REGNUM), BINWORD); } -static int -h8300_register_byte (int regno) -{ - if (regno < 0 || regno >= E_NUM_REGS) - internal_error (__FILE__, __LINE__, - "h8300_register_byte: illegal register number %d", regno); - else - return regno * BINWORD; -} - -static int -h8300_register_raw_size (int regno) -{ - if (regno < 0 || regno >= E_NUM_REGS) - internal_error (__FILE__, __LINE__, - "h8300_register_raw_size: illegal register number %d", - regno); - else - return BINWORD; -} - static struct type * -h8300_register_virtual_type (int regno) +h8300_register_type (struct gdbarch *gdbarch, int regno) { - if (regno < 0 || regno >= E_NUM_REGS) + if (regno < 0 || regno >= NUM_REGS) internal_error (__FILE__, __LINE__, - "h8300_register_virtual_type: illegal register number %d", + "h8300_register_type: illegal register number %d", regno); else - return h8300hmode ? - builtin_type_unsigned_long : builtin_type_unsigned_short; -} - -static void -h8300_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -{ - write_register (0, addr); -} - -static int -h8300_use_struct_convention (int gcc_p, struct type *type) -{ - return 1; + { + switch (regno) + { + case E_PC_REGNUM: + return builtin_type_void_func_ptr; + case E_SP_REGNUM: + case E_FP_REGNUM: + return builtin_type_void_data_ptr; + case E_CCR_REGNUM: + return builtin_type_uint8; + case E_EXR_REGNUM: + if (h8300smode) + return builtin_type_uint8; + /*FALLTHRU*/ + default: + return h8300hmode ? builtin_type_int32 + : builtin_type_int16; + } + } } static CORE_ADDR -h8300_extract_struct_value_address (char *regbuf) +h8300_extract_struct_value_address (struct regcache *regcache) { - return extract_unsigned_integer (regbuf + h8300_register_byte (E_ARG0_REGNUM), - h8300_register_raw_size (E_ARG0_REGNUM)); + ULONGEST addr; + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr); + return addr; } const static unsigned char * @@ -1046,6 +1058,22 @@ h8300_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) return breakpoint; } +static CORE_ADDR +h8300_push_dummy_code (struct gdbarch *gdbarch, + CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, + struct value **args, int nargs, + struct type *value_type, + CORE_ADDR *real_pc, CORE_ADDR *bp_addr) +{ + /* Allocate space sufficient for a breakpoint. */ + sp = (sp - 2) & ~1; + /* Store the address of that breakpoint */ + *bp_addr = sp; + /* h8300 always starts the call at the callee's entry point. */ + *real_pc = funaddr; + return sp; +} + static void h8300_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) @@ -1057,7 +1085,6 @@ No floating-point info available for this processor.\n"); static struct gdbarch * h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { - static LONGEST call_dummy_words[1] = { 0 }; struct gdbarch_tdep *tdep = NULL; struct gdbarch *gdbarch; @@ -1072,34 +1099,59 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) if (info.bfd_arch_info->arch != bfd_arch_h8300) return NULL; + gdbarch = gdbarch_alloc (&info, 0); + switch (info.bfd_arch_info->mach) { case bfd_mach_h8300: h8300sxmode = 0; h8300smode = 0; h8300hmode = 0; + set_gdbarch_num_regs (gdbarch, 13); + set_gdbarch_register_name (gdbarch, h8300_register_name); + set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_extract_return_value (gdbarch, h8300_extract_return_value); + set_gdbarch_store_return_value (gdbarch, h8300_store_return_value); break; case bfd_mach_h8300h: case bfd_mach_h8300hn: h8300sxmode = 0; h8300smode = 0; h8300hmode = 1; + set_gdbarch_num_regs (gdbarch, 13); + set_gdbarch_register_name (gdbarch, h8300_register_name); + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value); + set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value); break; case bfd_mach_h8300s: case bfd_mach_h8300sn: h8300sxmode = 0; h8300smode = 1; h8300hmode = 1; + set_gdbarch_num_regs (gdbarch, 14); + set_gdbarch_register_name (gdbarch, h8300s_register_name); + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value); + set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value); break; case bfd_mach_h8300sx: + case bfd_mach_h8300sxn: h8300sxmode = 1; h8300smode = 1; h8300hmode = 1; + set_gdbarch_num_regs (gdbarch, 18); + set_gdbarch_register_name (gdbarch, h8300sx_register_name); + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value); + set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value); break; } - gdbarch = gdbarch_alloc (&info, 0); - /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); @@ -1108,34 +1160,27 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * Basic register fields and methods. */ - set_gdbarch_num_regs (gdbarch, E_NUM_REGS); set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); - set_gdbarch_register_name (gdbarch, h8300_register_name); - set_gdbarch_deprecated_register_size (gdbarch, BINWORD); - set_gdbarch_deprecated_register_bytes (gdbarch, E_NUM_REGS * BINWORD); - set_gdbarch_register_byte (gdbarch, h8300_register_byte); - set_gdbarch_register_raw_size (gdbarch, h8300_register_raw_size); - set_gdbarch_deprecated_max_register_raw_size (gdbarch, h8300h_reg_size); - set_gdbarch_register_virtual_size (gdbarch, h8300_register_raw_size); - set_gdbarch_deprecated_max_register_virtual_size (gdbarch, h8300h_reg_size); - set_gdbarch_register_virtual_type (gdbarch, h8300_register_virtual_type); + set_gdbarch_register_type (gdbarch, h8300_register_type); set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info); set_gdbarch_print_float_info (gdbarch, h8300_print_float_info); /* * Frame Info */ - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs); - set_gdbarch_deprecated_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info); + set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue); + + set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, + h8300_frame_init_saved_regs); + set_gdbarch_deprecated_init_extra_frame_info (gdbarch, + h8300_init_extra_frame_info); set_gdbarch_deprecated_frame_chain (gdbarch, h8300_frame_chain); - set_gdbarch_deprecated_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, + h8300_saved_pc_after_call); set_gdbarch_deprecated_frame_saved_pc (gdbarch, h8300_frame_saved_pc); - set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue); - set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address); - set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address); /* * Miscelany @@ -1149,41 +1194,41 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); /* This value is almost never non-zero... */ set_gdbarch_frame_args_skip (gdbarch, 0); - /* OK to default this value to 'unknown'. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - /* - * Call Dummies - * - * These values and methods are used when gdb calls a target function. */ - set_gdbarch_deprecated_push_return_address (gdbarch, h8300_push_return_address); - set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value); - set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments); - set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame); - set_gdbarch_deprecated_store_struct_return (gdbarch, h8300_store_struct_return); - set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value); - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address); - set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention); - set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words); - set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0); + set_gdbarch_extract_struct_value_address (gdbarch, + h8300_extract_struct_value_address); + set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc); + set_gdbarch_push_dummy_code (gdbarch, h8300_push_dummy_code); set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_ptr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT); - set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT); + set_gdbarch_long_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */ set_gdbarch_believe_pcc_promotion (gdbarch, 1); - /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + /* + * Call Dummies + * + * These values and methods are used when gdb calls a target function. */ + /* Can all be replaced by push_dummy_call */ + set_gdbarch_deprecated_push_return_address (gdbarch, + h8300_push_return_address); + set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments); + set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + return gdbarch; } +extern initialize_file_ftype _initialize_h8300_tdep; /* -Wmissing-prototypes */ + void _initialize_h8300_tdep (void) { diff --git a/gdb/hpacc-abi.c b/gdb/hpacc-abi.c index 799d4c7..0fb3adc 100644 --- a/gdb/hpacc-abi.c +++ b/gdb/hpacc-abi.c @@ -309,6 +309,7 @@ init_hpacc_ops (void) hpacc_abi_ops.baseclass_offset = gnuv2_baseclass_offset; } +extern initialize_file_ftype _initialize_hpacc_abi; /* -Wmissing-prototypes */ void _initialize_hpacc_abi (void) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 24305ff..7c8e762 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -4875,26 +4875,6 @@ hppa_cannot_store_register (int regnum) } CORE_ADDR -hppa_frame_args_address (struct frame_info *fi) -{ - return get_frame_base (fi); -} - -CORE_ADDR -hppa_frame_locals_address (struct frame_info *fi) -{ - return get_frame_base (fi); -} - -int -hppa_frame_num_args (struct frame_info *frame) -{ - /* We can't tell how many args there are now that the C compiler delays - popping them. */ - return -1; -} - -CORE_ADDR hppa_smash_text_address (CORE_ADDR addr) { /* The low two bits of the PC on the PA contain the privilege level. @@ -4959,13 +4939,13 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fp0_regnum (gdbarch, 64); set_gdbarch_pc_regnum (gdbarch, PCOQ_HEAD_REGNUM); set_gdbarch_npc_regnum (gdbarch, PCOQ_TAIL_REGNUM); - set_gdbarch_register_raw_size (gdbarch, hppa_register_raw_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, hppa_register_raw_size); set_gdbarch_deprecated_register_bytes (gdbarch, hppa_num_regs * 4); - set_gdbarch_register_byte (gdbarch, hppa_register_byte); - set_gdbarch_register_virtual_size (gdbarch, hppa_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, hppa_register_byte); + set_gdbarch_deprecated_register_virtual_size (gdbarch, hppa_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8); - set_gdbarch_register_virtual_type (gdbarch, hppa_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, hppa_register_virtual_type); set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, hppa_extract_return_value); @@ -4980,9 +4960,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, hppa_frameless_function_invocation); set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc); - set_gdbarch_frame_args_address (gdbarch, hppa_frame_args_address); - set_gdbarch_frame_locals_address (gdbarch, hppa_frame_locals_address); - set_gdbarch_frame_num_args (gdbarch, hppa_frame_num_args); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame); set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame); diff --git a/gdb/i386-interix-tdep.c b/gdb/i386-interix-tdep.c index 7713863..2fced72 100644 --- a/gdb/i386-interix-tdep.c +++ b/gdb/i386-interix-tdep.c @@ -90,7 +90,7 @@ pei_adjust_objfile_offsets (struct objfile *objfile, return; } - for (i = 0; i < SECT_OFF_MAX; i++) + for (i = 0; i < objfile->num_sections; i++) { (objfile->section_offsets)->offsets[i] += symbols_offset; } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index b8fd0e5..467f686 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -751,6 +751,7 @@ i386_frame_this_id (struct frame_info *next_frame, void **this_cache, if (cache->base == 0) return; + /* See the end of i386_push_dummy_call. */ (*this_id) = frame_id_build (cache->base + 8, cache->pc); } @@ -902,6 +903,7 @@ i386_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache, struct i386_frame_cache *cache = i386_sigtramp_frame_cache (next_frame, this_cache); + /* See the end of i386_push_dummy_call. */ (*this_id) = frame_id_build (cache->base + 8, frame_pc_unwind (next_frame)); } @@ -960,12 +962,6 @@ static const struct frame_base i386_frame_base = i386_frame_base_address }; -static void -i386_save_dummy_frame_tos (CORE_ADDR sp) -{ - generic_save_dummy_frame_tos (sp + 8); -} - static struct frame_id i386_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -975,6 +971,7 @@ i386_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) frame_unwind_register (next_frame, I386_EBP_REGNUM, buf); fp = extract_unsigned_integer (buf, 4); + /* See the end of i386_push_dummy_call. */ return frame_id_build (fp + 8, frame_pc_unwind (next_frame)); } @@ -1058,7 +1055,16 @@ i386_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* ...and fake a frame pointer. */ regcache_cooked_write (regcache, I386_EBP_REGNUM, buf); - return sp; + /* MarkK wrote: This "+ 8" is all over the place: + (i386_frame_this_id, i386_sigtramp_frame_this_id, + i386_unwind_dummy_id). It's there, since all frame unwinders for + a given target have to agree (within a certain margin) on the + defenition of the stack address of a frame. Otherwise + frame_id_inner() won't work correctly. Since DWARF2/GCC uses the + stack address *before* the function call as a frame's CFA. On + the i386, when %ebp is used as a frame pointer, the offset + between the contents %ebp and the CFA as defined by GCC. */ + return sp + 8; } /* These registers are used for returning integers (and on some @@ -1359,7 +1365,7 @@ i386_register_convert_to_virtual (int regnum, struct type *type, static void i386_register_convert_to_raw (struct type *type, int regnum, - char *from, char *to) + const char *from, char *to) { gdb_assert (i386_fp_regnum_p (regnum)); @@ -1686,10 +1692,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Call dummy code. */ set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call); - set_gdbarch_register_convertible (gdbarch, i386_register_convertible); - set_gdbarch_register_convert_to_virtual (gdbarch, - i386_register_convert_to_virtual); - set_gdbarch_register_convert_to_raw (gdbarch, i386_register_convert_to_raw); + set_gdbarch_deprecated_register_convertible (gdbarch, i386_register_convertible); + set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, i386_register_convert_to_virtual); + set_gdbarch_deprecated_register_convert_to_raw (gdbarch, i386_register_convert_to_raw); set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value); set_gdbarch_store_return_value (gdbarch, i386_store_return_value); @@ -1707,7 +1712,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_frame_args_skip (gdbarch, 8); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp); /* Wire in the MMX registers. */ @@ -1718,7 +1722,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, i386_print_insn); set_gdbarch_unwind_dummy_id (gdbarch, i386_unwind_dummy_id); - set_gdbarch_save_dummy_frame_tos (gdbarch, i386_save_dummy_frame_tos); set_gdbarch_unwind_pc (gdbarch, i386_unwind_pc); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 4697574..b3290da 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -28,7 +28,7 @@ #include "regcache.h" #include "doublest.h" #include "value.h" - +#include "gdb_assert.h" #include "objfiles.h" #include "elf/common.h" /* for DT_PLTGOT value */ #include "elf-bfd.h" @@ -86,10 +86,6 @@ extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int); static gdbarch_init_ftype ia64_gdbarch_init; static gdbarch_register_name_ftype ia64_register_name; -static gdbarch_register_raw_size_ftype ia64_register_raw_size; -static gdbarch_register_virtual_size_ftype ia64_register_virtual_size; -static gdbarch_register_virtual_type_ftype ia64_register_virtual_type; -static gdbarch_register_byte_ftype ia64_register_byte; static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc; static gdbarch_skip_prologue_ftype ia64_skip_prologue; static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value; @@ -253,7 +249,7 @@ ia64_register_virtual_size (int reg) /* Return true iff register N's virtual format is different from its raw format. */ -int +static int ia64_register_convertible (int nr) { return (IA64_FR0_REGNUM <= nr && nr <= IA64_FR127_REGNUM); @@ -265,7 +261,7 @@ const struct floatformat floatformat_ia64_ext = floatformat_intbit_yes }; -void +static void ia64_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { @@ -279,9 +275,9 @@ ia64_register_convert_to_virtual (int regnum, struct type *type, error("ia64_register_convert_to_virtual called with non floating point register number"); } -void +static void ia64_register_convert_to_raw (struct type *type, int regnum, - char *from, char *to) + const char *from, char *to) { if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR127_REGNUM) { @@ -623,7 +619,19 @@ ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) return breakpoint; } -CORE_ADDR +static CORE_ADDR +ia64_read_fp (void) +{ + /* We won't necessarily have a frame pointer and even if we do, it + winds up being extraordinarly messy when attempting to find the + frame chain. So for the purposes of creating frames (which is + all deprecated_read_fp() is used for), simply use the stack + pointer value instead. */ + gdb_assert (SP_REGNUM >= 0); + return read_register (SP_REGNUM); +} + +static CORE_ADDR ia64_read_pc (ptid_t ptid) { CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, ptid); @@ -633,7 +641,7 @@ ia64_read_pc (ptid_t ptid) return pc_value | (slot_num * SLOT_MULTIPLIER); } -void +static void ia64_write_pc (CORE_ADDR new_pc, ptid_t ptid) { int slot_num = (int) (new_pc & 0xf) / SLOT_MULTIPLIER; @@ -691,7 +699,7 @@ rse_address_add(CORE_ADDR addr, int nslots) represent the frame chain as the end of the previous frame instead of the beginning. */ -CORE_ADDR +static CORE_ADDR ia64_frame_chain (struct frame_info *frame) { if ((get_frame_type (frame) == SIGTRAMP_FRAME)) @@ -711,7 +719,7 @@ ia64_frame_chain (struct frame_info *frame) } } -CORE_ADDR +static CORE_ADDR ia64_frame_saved_pc (struct frame_info *frame) { if ((get_frame_type (frame) == SIGTRAMP_FRAME)) @@ -1222,7 +1230,7 @@ ia64_skip_prologue (CORE_ADDR pc) return examine_prologue (pc, pc+1024, 0); } -void +static void ia64_frame_init_saved_regs (struct frame_info *frame) { if (get_frame_saved_regs (frame)) @@ -1276,7 +1284,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame) } } -void +static void ia64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, @@ -1508,7 +1516,7 @@ ia64_extract_struct_value_address (char *regbuf) return struct_return_address; } -void +static void ia64_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) { /* FIXME: See above. */ @@ -1529,7 +1537,7 @@ ia64_saved_pc_after_call (struct frame_info *frame) return read_register (IA64_BR0_REGNUM); } -CORE_ADDR +static CORE_ADDR ia64_frame_args_address (struct frame_info *frame) { /* frame->frame points at the SP for this frame; But we want the start @@ -1537,7 +1545,7 @@ ia64_frame_args_address (struct frame_info *frame) return ia64_frame_chain (frame); } -CORE_ADDR +static CORE_ADDR ia64_frame_locals_address (struct frame_info *frame) { /* frame->frame points at the SP for this frame; But we want the start @@ -1545,7 +1553,7 @@ ia64_frame_locals_address (struct frame_info *frame) return ia64_frame_chain (frame); } -void +static void ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) { CORE_ADDR bsp, cfm; @@ -1844,7 +1852,7 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr) return fdesc; } -CORE_ADDR +static CORE_ADDR ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { @@ -2009,7 +2017,7 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, return sp; } -CORE_ADDR +static CORE_ADDR ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { CORE_ADDR global_pointer = FIND_GLOBAL_POINTER (pc); @@ -2021,7 +2029,7 @@ ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp) return sp; } -void +static void ia64_store_return_value (struct type *type, char *valbuf) { if (TYPE_CODE (type) == TYPE_CODE_FLT) @@ -2035,7 +2043,7 @@ ia64_store_return_value (struct type *type, char *valbuf) valbuf, TYPE_LENGTH (type)); } -void +static void ia64_pop_frame (void) { generic_pop_current_frame (ia64_pop_frame_regular); @@ -2231,7 +2239,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); - set_gdbarch_long_double_bit (gdbarch, 64); + set_gdbarch_long_double_bit (gdbarch, 128); set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_num_regs (gdbarch, ia64_num_regs); @@ -2243,16 +2251,15 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, ia64_register_name); set_gdbarch_deprecated_register_size (gdbarch, 8); set_gdbarch_deprecated_register_bytes (gdbarch, ia64_num_regs * 8 + 128*8); - set_gdbarch_register_byte (gdbarch, ia64_register_byte); - set_gdbarch_register_raw_size (gdbarch, ia64_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, ia64_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, ia64_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16); - set_gdbarch_register_virtual_size (gdbarch, ia64_register_virtual_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, ia64_register_virtual_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16); - set_gdbarch_register_virtual_type (gdbarch, ia64_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, ia64_register_virtual_type); set_gdbarch_skip_prologue (gdbarch, ia64_skip_prologue); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frameless_function_invocation (gdbarch, ia64_frameless_function_invocation); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call); @@ -2263,9 +2270,9 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs); set_gdbarch_deprecated_get_saved_register (gdbarch, ia64_get_saved_register); - set_gdbarch_register_convertible (gdbarch, ia64_register_convertible); - set_gdbarch_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual); - set_gdbarch_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw); + set_gdbarch_deprecated_register_convertible (gdbarch, ia64_register_convertible); + set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual); + set_gdbarch_deprecated_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw); set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention); set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value); @@ -2296,13 +2303,12 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame chain. So for the purposes of creating frames (which is all deprecated_read_fp() is used for), simply use the stack pointer value instead. */ - set_gdbarch_deprecated_target_read_fp (gdbarch, generic_target_read_sp); + set_gdbarch_deprecated_target_read_fp (gdbarch, ia64_read_fp); /* Settings that should be unnecessary. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_function_start_offset (gdbarch, 0); @@ -2314,6 +2320,8 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return gdbarch; } +extern initialize_file_ftype _initialize_ia64_tdep; /* -Wmissing-prototypes */ + void _initialize_ia64_tdep (void) { diff --git a/gdb/infcall.c b/gdb/infcall.c index 546e33c..0a10c31 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -34,6 +34,7 @@ #include "gdbcmd.h" #include "command.h" #include "gdb_string.h" +#include "infcall.h" /* NOTE: cagney/2003-04-16: What's the future of this code? @@ -822,7 +823,15 @@ You must use a pointer to function type variable. Command ignored.", arg_name); if (DEPRECATED_DUMMY_WRITE_SP_P ()) DEPRECATED_DUMMY_WRITE_SP (sp); - if (SAVE_DUMMY_FRAME_TOS_P ()) + if (gdbarch_unwind_dummy_id_p (current_gdbarch)) + { + /* Sanity. The exact same SP value is returned by + PUSH_DUMMY_CALL, saved as the dummy-frame TOS, and used by + unwind_dummy_id to form the frame ID's stack address. */ + gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES); + generic_save_dummy_frame_tos (sp); + } + else if (SAVE_DUMMY_FRAME_TOS_P ()) SAVE_DUMMY_FRAME_TOS (sp); /* Now proceed, having reached the desired place. */ @@ -842,17 +851,29 @@ You must use a pointer to function type variable. Command ignored.", arg_name); set_momentary_breakpoint. We need to give the breakpoint a frame ID so that the breakpoint code can correctly re-identify the dummy breakpoint. */ - /* The assumption here is that push_dummy_call() returned the - stack part of the frame ID. Unfortunatly, many older - architectures were, via a convoluted mess, relying on the - poorly defined and greatly overloaded DEPRECATED_TARGET_READ_FP - or DEPRECATED_FP_REGNUM to supply the value. */ - if (DEPRECATED_TARGET_READ_FP_P ()) - frame = frame_id_build (DEPRECATED_TARGET_READ_FP (), sal.pc); - else if (DEPRECATED_FP_REGNUM >= 0) - frame = frame_id_build (read_register (DEPRECATED_FP_REGNUM), sal.pc); + if (gdbarch_unwind_dummy_id_p (current_gdbarch)) + { + /* Sanity. The exact same SP value is returned by + PUSH_DUMMY_CALL, saved as the dummy-frame TOS, and used by + unwind_dummy_id to form the frame ID's stack address. */ + gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES); + frame = frame_id_build (sp, sal.pc); + } else - frame = frame_id_build (sp, sal.pc); + { + /* The assumption here is that push_dummy_call() returned the + stack part of the frame ID. Unfortunatly, many older + architectures were, via a convoluted mess, relying on the + poorly defined and greatly overloaded + DEPRECATED_TARGET_READ_FP or DEPRECATED_FP_REGNUM to supply + the value. */ + if (DEPRECATED_TARGET_READ_FP_P ()) + frame = frame_id_build (DEPRECATED_TARGET_READ_FP (), sal.pc); + else if (DEPRECATED_FP_REGNUM >= 0) + frame = frame_id_build (read_register (DEPRECATED_FP_REGNUM), sal.pc); + else + frame = frame_id_build (sp, sal.pc); + } bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy); bpt->disposition = disp_del; } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index de6c319..0ed0ce2 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1551,9 +1551,9 @@ default_print_registers_info (struct gdbarch *gdbarch, The function frame_register_read() should have returned the pre-cooked register so no conversion is necessary. */ /* Convert raw data to virtual format if necessary. */ - if (REGISTER_CONVERTIBLE (i)) + if (DEPRECATED_REGISTER_CONVERTIBLE (i)) { - REGISTER_CONVERT_TO_VIRTUAL (i, register_type (current_gdbarch, i), + DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (i, register_type (current_gdbarch, i), raw_buffer, virtual_buffer); } else diff --git a/gdb/inferior.h b/gdb/inferior.h index 1de3b25..ed49d23 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -168,8 +168,6 @@ extern CORE_ADDR read_pc (void); extern CORE_ADDR read_pc_pid (ptid_t); -extern CORE_ADDR generic_target_read_pc (ptid_t); - extern void write_pc (CORE_ADDR); extern void write_pc_pid (CORE_ADDR, ptid_t); @@ -178,9 +176,7 @@ extern void generic_target_write_pc (CORE_ADDR, ptid_t); extern CORE_ADDR read_sp (void); -extern CORE_ADDR generic_target_read_sp (void); - -extern void generic_target_write_sp (CORE_ADDR); +extern void deprecated_write_sp (CORE_ADDR); extern CORE_ADDR deprecated_read_fp (void); diff --git a/gdb/interps.c b/gdb/interps.c index 748b5b6..6df1d4b 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -290,7 +290,7 @@ interp_quiet_p (struct interp *interp) return current_interpreter->quiet_p; } -int +static int interp_set_quiet (struct interp *interp, int quiet) { int old_val = interp->quiet_p; @@ -357,7 +357,7 @@ initialize_interps (void) /* Don't know if anything needs to be done here... */ } -void +static void interpreter_exec_cmd (char *args, int from_tty) { struct interp *old_interp, *interp_to_use; diff --git a/gdb/interps.h b/gdb/interps.h index 3954e55..74008d6 100644 --- a/gdb/interps.h +++ b/gdb/interps.h @@ -63,7 +63,7 @@ extern int current_interp_named_p (const char *name); extern int current_interp_display_prompt_p (void); extern void current_interp_command_loop (void); -extern void clear_interpreter_hooks (); +extern void clear_interpreter_hooks (void); /* well-known interpreters */ #define INTERP_CONSOLE "console" diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 7fe020d..7120620 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -1228,9 +1228,7 @@ java_type_from_name (name) Otherwise, return 0. */ static int -push_variable (name) - struct stoken name; - +push_variable (struct stoken name) { char *tmp = copy_name (name); int is_a_field_of_this = 0; @@ -1302,9 +1300,7 @@ push_fieldnames (name) Handle a qualified name, where DOT_INDEX is the index of the first '.' */ static void -push_qualified_expression_name (name, dot_index) - struct stoken name; - int dot_index; +push_qualified_expression_name (struct stoken name, int dot_index) { struct stoken token; char *tmp; diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index a2a44f0..e3ae188 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -35,6 +35,7 @@ #include "gdbcore.h" #include "block.h" #include "demangle.h" +#include "dictionary.h" #include struct type *java_int_type; @@ -91,9 +92,7 @@ get_dynamics_objfile (void) static struct symtab *class_symtab = NULL; -/* Maximum number of class in class_symtab before relocation is needed. */ - -static int class_symtab_space; +static void free_class_block (struct symtab *symtab); static struct symtab * get_java_class_symtab (void) @@ -106,15 +105,16 @@ get_java_class_symtab (void) class_symtab = allocate_symtab ("", objfile); class_symtab->language = language_java; bv = (struct blockvector *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct blockvector)); + obstack_alloc (&objfile->symbol_obstack, + sizeof (struct blockvector) + sizeof (struct block *)); BLOCKVECTOR_NBLOCKS (bv) = 1; BLOCKVECTOR (class_symtab) = bv; /* Allocate dummy STATIC_BLOCK. */ bl = (struct block *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); - BLOCK_NSYMS (bl) = 0; - BLOCK_HASHTABLE (bl) = 0; + BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + NULL); BLOCK_START (bl) = 0; BLOCK_END (bl) = 0; BLOCK_FUNCTION (bl) = NULL; @@ -124,13 +124,12 @@ get_java_class_symtab (void) BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl; /* Allocate GLOBAL_BLOCK. This has to be relocatable. */ - class_symtab_space = 128; - bl = xmmalloc (objfile->md, - sizeof (struct block) - + ((class_symtab_space - 1) * sizeof (struct symbol *))); + bl = (struct block *) + obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); *bl = *BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); + BLOCK_DICT (bl) = dict_create_hashed_expandable (); BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl; - class_symtab->free_ptr = (char *) bl; + class_symtab->free_func = free_class_block; } return class_symtab; } @@ -140,20 +139,7 @@ add_class_symtab_symbol (struct symbol *sym) { struct symtab *symtab = get_java_class_symtab (); struct blockvector *bv = BLOCKVECTOR (symtab); - struct block *bl = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - if (BLOCK_NSYMS (bl) >= class_symtab_space) - { - /* Need to re-allocate. */ - class_symtab_space *= 2; - bl = xmrealloc (symtab->objfile->md, bl, - sizeof (struct block) - + ((class_symtab_space - 1) * sizeof (struct symbol *))); - class_symtab->free_ptr = (char *) bl; - BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl; - } - - BLOCK_SYM (bl, BLOCK_NSYMS (bl)) = sym; - BLOCK_NSYMS (bl) = BLOCK_NSYMS (bl) + 1; + dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym); } static struct symbol *add_class_symbol (struct type *type, CORE_ADDR addr); @@ -174,6 +160,16 @@ add_class_symbol (struct type *type, CORE_ADDR addr) SYMBOL_VALUE_ADDRESS (sym) = addr; return sym; } + +/* Free the dynamic symbols block. */ +static void +free_class_block (struct symtab *symtab) +{ + struct blockvector *bv = BLOCKVECTOR (symtab); + struct block *bl = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); + + dict_free (BLOCK_DICT (bl)); +} #endif struct type * @@ -268,7 +264,7 @@ type_from_class (struct value *clas) char *nptr; CORE_ADDR addr; struct block *bl; - int i; + struct dict_iterator iter; int is_array = 0; type = check_typedef (VALUE_TYPE (clas)); @@ -283,9 +279,8 @@ type_from_class (struct value *clas) #if 0 get_java_class_symtab (); bl = BLOCKVECTOR_BLOCK (BLOCKVECTOR (class_symtab), GLOBAL_BLOCK); - for (i = BLOCK_NSYMS (bl); --i >= 0;) + ALL_BLOCK_SYMBOLS (block, iter, sym) { - struct symbol *sym = BLOCK_SYM (bl, i); if (SYMBOL_VALUE_ADDRESS (sym) == addr) return SYMBOL_TYPE (sym); } diff --git a/gdb/linespec.c b/gdb/linespec.c index 682018f..b8f7274 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -34,6 +34,7 @@ #include "parser-defs.h" #include "block.h" #include "objc-lang.h" +#include "linespec.h" /* We share this one with symtab.c, but it is not exported widely. */ diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index b35c30c..c1859f3 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -419,12 +419,6 @@ m68hc11_frame_args_address (struct frame_info *frame) return addr; } -static CORE_ADDR -m68hc11_frame_locals_address (struct frame_info *frame) -{ - return get_frame_base (frame); -} - /* Discard from the stack the innermost frame, restoring all saved registers. */ @@ -1057,7 +1051,7 @@ m68hc11_push_arguments (int nargs, /* Return a location where we can set a breakpoint that will be hit when an inferior function call returns. */ -CORE_ADDR +static CORE_ADDR m68hc11_call_dummy_address (void) { return entry_point_address (); @@ -1365,17 +1359,15 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68hc11_frame_init_saved_regs); set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_read_pc (gdbarch, generic_target_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM); set_gdbarch_deprecated_fp_regnum (gdbarch, SOFT_FP_REGNUM); set_gdbarch_register_name (gdbarch, m68hc11_register_name); set_gdbarch_deprecated_register_size (gdbarch, 2); set_gdbarch_deprecated_register_bytes (gdbarch, M68HC11_ALL_REGS * 2); - set_gdbarch_register_virtual_type (gdbarch, m68hc11_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, m68hc11_register_virtual_type); set_gdbarch_pseudo_register_read (gdbarch, m68hc11_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, m68hc11_pseudo_register_write); @@ -1395,9 +1387,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_frame_chain (gdbarch, m68hc11_frame_chain); set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, m68hc11_frame_args_address); - set_gdbarch_frame_locals_address (gdbarch, m68hc11_frame_locals_address); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); @@ -1429,6 +1419,8 @@ m68hc11_gdbarch_init (struct gdbarch_info info, return gdbarch; } +extern initialize_file_ftype _initialize_m68hc11_tdep; /* -Wmissing-prototypes */ + void _initialize_m68hc11_tdep (void) { diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 44be19d..c8158c4 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -929,18 +929,16 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs); set_gdbarch_frameless_function_invocation (gdbarch, m68k_frameless_function_invocation); - /* OK to default this value to 'unknown'. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_args_skip (gdbarch, 8); - set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, m68k_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, m68k_register_virtual_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 12); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 12); - set_gdbarch_register_virtual_type (gdbarch, m68k_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, m68k_register_virtual_type); set_gdbarch_register_name (gdbarch, m68k_register_name); set_gdbarch_deprecated_register_size (gdbarch, 4); - set_gdbarch_register_byte (gdbarch, m68k_register_byte); + set_gdbarch_deprecated_register_byte (gdbarch, m68k_register_byte); set_gdbarch_num_regs (gdbarch, 29); set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok); set_gdbarch_deprecated_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4)); @@ -964,7 +962,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_pop_frame (gdbarch, m68k_pop_frame); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); /* Disassembler. */ set_gdbarch_print_insn (gdbarch, print_insn_m68k); @@ -998,6 +996,8 @@ m68k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) return; } +extern initialize_file_ftype _initialize_m68k_tdep; /* -Wmissing-prototypes */ + void _initialize_m68k_tdep (void) { diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c index 612f9fd..1fa9f74 100644 --- a/gdb/m68klinux-tdep.c +++ b/gdb/m68klinux-tdep.c @@ -149,9 +149,9 @@ m68k_linux_extract_return_value (struct type *type, char *regbuf, char *valbuf) { if (TYPE_CODE (type) == TYPE_CODE_FLT) { - REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, type, - regbuf + REGISTER_BYTE (FP0_REGNUM), - valbuf); + DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, type, + regbuf + REGISTER_BYTE (FP0_REGNUM), + valbuf); } else if (TYPE_CODE (type) == TYPE_CODE_PTR) memcpy (valbuf, regbuf + REGISTER_BYTE (M68K_A0_REGNUM), @@ -171,7 +171,7 @@ m68k_linux_store_return_value (struct type *type, char *valbuf) if (TYPE_CODE (type) == TYPE_CODE_FLT) { char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)]; - REGISTER_CONVERT_TO_RAW (type, FP0_REGNUM, valbuf, raw_buffer); + DEPRECATED_REGISTER_CONVERT_TO_RAW (type, FP0_REGNUM, valbuf, raw_buffer); deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), raw_buffer, TYPE_LENGTH (type)); } diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c index 02f44fc..7c2ebbe 100644 --- a/gdb/macrocmd.c +++ b/gdb/macrocmd.c @@ -222,6 +222,8 @@ macro_list_command (char *exp, int from_tty) /* Initializing the `macrocmd' module. */ +extern initialize_file_ftype _initialize_macrocmd; /* -Wmissing-prototypes */ + void _initialize_macrocmd (void) { diff --git a/gdb/macrotab.c b/gdb/macrotab.c index 1432847..4f0761d 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -123,7 +123,7 @@ macro_bcache_str (struct macro_table *t, const char *s) /* Free a possibly bcached object OBJ. That is, if the macro table T has a bcache, it's an error; otherwise, xfree OBJ. */ -void +static void macro_bcache_free (struct macro_table *t, void *obj) { gdb_assert (! t->bcache); diff --git a/gdb/main.c b/gdb/main.c index 240aa00..5a06017 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -73,10 +73,10 @@ struct ui_file *gdb_stdout; struct ui_file *gdb_stderr; struct ui_file *gdb_stdlog; struct ui_file *gdb_stdtarg; - -/* Used to initialize error() - defined in utils.c */ - -extern void error_init (void); +struct ui_file *gdb_stdin; +/* target IO streams */ +struct ui_file *gdb_stdtargin; +struct ui_file *gdb_stdtargerr; /* Whether to enable writing into executable and core files */ extern int write_files; @@ -197,6 +197,9 @@ captured_main (void *data) gdb_stderr = stdio_fileopen (stderr); gdb_stdlog = gdb_stderr; /* for moment */ gdb_stdtarg = gdb_stderr; /* for moment */ + gdb_stdin = stdio_fileopen (stdin); + gdb_stdtargerr = gdb_stderr; /* for moment */ + gdb_stdtargin = gdb_stdin; /* for moment */ /* initialize error() */ error_init (); diff --git a/gdb/maint.c b/gdb/maint.c index aa34239..b55cb67 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -407,7 +407,7 @@ maintenance_print_statistics (char *args, int from_tty) print_symbol_bcache_statistics (); } -void +static void maintenance_print_architecture (char *args, int from_tty) { if (args == NULL) diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index cd544f6..18d7600 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -30,51 +30,10 @@ #include "gdb_string.h" #include "disasm.h" -/* Functions declared and used only in this file */ - -static CORE_ADDR mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc, int skip_prologue); - -static struct frame_info *analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame); - +static CORE_ADDR mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc, + int skip_prologue); static int get_insn (CORE_ADDR pc); -/* Functions exported from this file */ - -int mcore_use_struct_convention (int gcc_p, struct type *type); - -void _initialize_mcore (void); - -void mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi); - -CORE_ADDR mcore_frame_saved_pc (struct frame_info *fi); - -CORE_ADDR mcore_find_callers_reg (struct frame_info *fi, int regnum); - -CORE_ADDR mcore_frame_args_address (struct frame_info *fi); - -CORE_ADDR mcore_frame_locals_address (struct frame_info *fi); - -CORE_ADDR mcore_push_return_address (CORE_ADDR pc, CORE_ADDR sp); - -CORE_ADDR mcore_push_arguments (int nargs, struct value ** args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr); - -void mcore_pop_frame (); - -CORE_ADDR mcore_skip_prologue (CORE_ADDR pc); - -CORE_ADDR mcore_frame_chain (struct frame_info *fi); - -const unsigned char *mcore_breakpoint_from_pc (CORE_ADDR * bp_addr, int *bp_size); - -int mcore_use_struct_convention (int gcc_p, struct type *type); - -void mcore_store_return_value (struct type *type, char *valbuf); - -CORE_ADDR mcore_extract_struct_value_address (char *regbuf); - -void mcore_extract_return_value (struct type *type, char *regbuf, char *valbuf); - #ifdef MCORE_DEBUG int mcore_debug = 0; #endif @@ -243,7 +202,7 @@ mcore_register_name (int regnum) instructions are 16 bits, this is all we need, regardless of address. bpkt = 0x0000 */ -const unsigned char * +static const unsigned char * mcore_breakpoint_from_pc (CORE_ADDR * bp_addr, int *bp_size) { static char breakpoint[] = @@ -647,7 +606,7 @@ mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc, int skip_prologue) then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be called for the new frame. */ -CORE_ADDR +static CORE_ADDR mcore_frame_chain (struct frame_info * fi) { struct frame_info *dummy; @@ -705,7 +664,7 @@ mcore_frame_chain (struct frame_info * fi) /* Skip the prologue of the function at PC. */ -CORE_ADDR +static CORE_ADDR mcore_skip_prologue (CORE_ADDR pc) { CORE_ADDR func_addr, func_end; @@ -725,13 +684,13 @@ mcore_skip_prologue (CORE_ADDR pc) } /* Return the address at which function arguments are offset. */ -CORE_ADDR +static CORE_ADDR mcore_frame_args_address (struct frame_info * fi) { return get_frame_base (fi) - get_frame_extra_info (fi)->framesize; } -CORE_ADDR +static CORE_ADDR mcore_frame_locals_address (struct frame_info * fi) { return get_frame_base (fi) - get_frame_extra_info (fi)->framesize; @@ -739,7 +698,7 @@ mcore_frame_locals_address (struct frame_info * fi) /* Return the frame pointer in use at address PC. */ -void +static void mcore_virtual_frame_pointer (CORE_ADDR pc, int *reg, LONGEST *offset) { struct frame_info *dummy = analyze_dummy_frame (pc, 0); @@ -757,7 +716,7 @@ mcore_virtual_frame_pointer (CORE_ADDR pc, int *reg, LONGEST *offset) /* Find the value of register REGNUM in frame FI. */ -CORE_ADDR +static CORE_ADDR mcore_find_callers_reg (struct frame_info *fi, int regnum) { for (; fi != NULL; fi = get_next_frame (fi)) @@ -776,7 +735,7 @@ mcore_find_callers_reg (struct frame_info *fi, int regnum) /* Find the saved pc in frame FI. */ -CORE_ADDR +static CORE_ADDR mcore_frame_saved_pc (struct frame_info * fi) { @@ -793,7 +752,7 @@ mcore_frame_saved_pc (struct frame_info * fi) /* This routine gets called when either the user uses the "return" command, or the call dummy breakpoint gets hit. */ -void +static void mcore_pop_frame (void) { int rn; @@ -843,7 +802,7 @@ mcore_pop_frame (void) FIRST_ARGREG, since the MCORE treats struct returns (of less than eight bytes) as hidden first arguments. */ -CORE_ADDR +static CORE_ADDR mcore_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { @@ -953,7 +912,7 @@ mcore_push_arguments (int nargs, struct value **args, CORE_ADDR sp, opted to use generic call dummies, so we simply store the CALL_DUMMY_ADDRESS into the PR register (r15). */ -CORE_ADDR +static CORE_ADDR mcore_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { write_register (PR_REGNUM, CALL_DUMMY_ADDRESS ()); @@ -979,7 +938,7 @@ mcore_push_return_address (CORE_ADDR pc, CORE_ADDR sp) EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc and TYPE is the type (which is known to be struct, union or array). */ -int +static int mcore_use_struct_convention (int gcc_p, struct type *type) { return (TYPE_LENGTH (type) > 8); @@ -989,7 +948,7 @@ mcore_use_struct_convention (int gcc_p, struct type *type) this buffer was passed as a hidden first argument, so just return that address. */ -CORE_ADDR +static CORE_ADDR mcore_extract_struct_value_address (char *regbuf) { return extract_unsigned_integer (regbuf + REGISTER_BYTE (FIRST_ARGREG), DEPRECATED_REGISTER_SIZE); @@ -999,7 +958,7 @@ mcore_extract_struct_value_address (char *regbuf) the function's return value and place the result into VALBUF. REGBUF is the register contents of the target. */ -void +static void mcore_extract_return_value (struct type *type, char *regbuf, char *valbuf) { /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */ @@ -1019,7 +978,7 @@ mcore_extract_return_value (struct type *type, char *regbuf, char *valbuf) significant word) and r3 (least significant word, left justified). Note that this includes structures of less than eight bytes, too. */ -void +static void mcore_store_return_value (struct type *type, char *valbuf) { int value_size; @@ -1045,7 +1004,7 @@ mcore_store_return_value (struct type *type, char *valbuf) This includes allocating space for saved registers and analyzing the prologue of this frame. */ -void +static void mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) { if (fi && get_next_frame (fi)) @@ -1106,10 +1065,10 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_max_register_raw_size (gdbarch, MCORE_REG_SIZE); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, MCORE_REG_SIZE); set_gdbarch_register_name (gdbarch, mcore_register_name); - set_gdbarch_register_virtual_type (gdbarch, mcore_register_virtual_type); - set_gdbarch_register_virtual_size (gdbarch, mcore_register_size); - set_gdbarch_register_raw_size (gdbarch, mcore_register_size); - set_gdbarch_register_byte (gdbarch, mcore_register_byte); + set_gdbarch_deprecated_register_virtual_type (gdbarch, mcore_register_virtual_type); + set_gdbarch_deprecated_register_virtual_size (gdbarch, mcore_register_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, mcore_register_size); + set_gdbarch_deprecated_register_byte (gdbarch, mcore_register_byte); set_gdbarch_deprecated_register_bytes (gdbarch, MCORE_REG_SIZE * MCORE_NUM_REGS); set_gdbarch_num_regs (gdbarch, MCORE_NUM_REGS); set_gdbarch_pc_regnum (gdbarch, 64); @@ -1144,7 +1103,6 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_args_address (gdbarch, mcore_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, mcore_frame_locals_address); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_deprecated_pop_frame (gdbarch, mcore_pop_frame); set_gdbarch_virtual_frame_pointer (gdbarch, mcore_virtual_frame_pointer); @@ -1159,7 +1117,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_reg_struct_has_addr (gdbarch, mcore_reg_struct_has_addr); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); return gdbarch; } @@ -1170,6 +1128,8 @@ mcore_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) } +extern initialize_file_ftype _initialize_mcore_tdep; /* -Wmissing-prototypes */ + void _initialize_mcore_tdep (void) { diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 379a363..1bb1e05 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -54,6 +54,7 @@ #include "demangle.h" #include "gdb_assert.h" #include "block.h" +#include "dictionary.h" /* These are needed if the tm.h file does not contain the necessary mips specific definitions. */ @@ -284,9 +285,11 @@ static struct symbol *new_symbol (char *); static struct type *new_type (char *); -static struct block *new_block (int); +enum block_type { FUNCTION_BLOCK, NON_FUNCTION_BLOCK }; -static struct symtab *new_symtab (char *, int, int, struct objfile *); +static struct block *new_block (enum block_type); + +static struct symtab *new_symtab (char *, int, struct objfile *); static struct linetable *new_linetable (int); @@ -298,8 +301,6 @@ static struct type *parse_type (int, union aux_ext *, unsigned int, int *, static struct symbol *mylookup_symbol (char *, struct block *, domain_enum, enum address_class); -static struct block *shrink_block (struct block *, struct symtab *); - static void sort_blocks (struct symtab *); static struct partial_symtab *new_psymtab (char *, struct objfile *); @@ -483,7 +484,6 @@ static struct parse_stack int blocktype; - int maxsyms; /* Max symbols in this block. */ struct type *cur_type; /* Type we parse fields for. */ int cur_field; /* Field number in cur_type. */ CORE_ADDR procadr; /* Start addres of this procedure */ @@ -834,7 +834,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, TYPE_FLAGS (SYMBOL_TYPE (s)) |= TYPE_FLAG_PROTOTYPED; /* Create and enter a new lexical context */ - b = new_block (top_stack->maxsyms); + b = new_block (FUNCTION_BLOCK); SYMBOL_BLOCK_VALUE (s) = b; BLOCK_FUNCTION (b) = s; BLOCK_START (b) = BLOCK_END (b) = sh->value; @@ -1169,7 +1169,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, } top_stack->blocktype = stBlock; - b = new_block (top_stack->maxsyms); + b = new_block (NON_FUNCTION_BLOCK); BLOCK_START (b) = sh->value + top_stack->procadr; BLOCK_SUPERBLOCK (b) = top_stack->cur_block; top_stack->cur_block = b; @@ -1189,7 +1189,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* Finished with procedure */ struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st); struct mips_extra_func_info *e; - struct block *b; + struct block *b = top_stack->cur_block; struct type *ftype = top_stack->cur_type; int i; @@ -1209,9 +1209,6 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, e->pdr.framereg = -1; add_symbol (s, top_stack->cur_block); - /* Reallocate symbols, saving memory */ - b = shrink_block (top_stack->cur_block, top_stack->cur_st); - /* f77 emits proc-level with address bounds==[0,0], So look for such child blocks, and patch them. */ for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); i++) @@ -1236,13 +1233,17 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (nparams > 0) { + struct dict_iterator iter; TYPE_NFIELDS (ftype) = nparams; TYPE_FIELDS (ftype) = (struct field *) TYPE_ALLOC (ftype, nparams * sizeof (struct field)); - for (i = iparams = 0; iparams < nparams; i++) + iparams = 0; + ALL_BLOCK_SYMBOLS (b, iter, sym) { - sym = BLOCK_SYM (b, i); + if (iparams == nparams) + break; + switch (SYMBOL_CLASS (sym)) { case LOC_ARG: @@ -1266,7 +1267,6 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, displacement from the procedure`s start address of the end of this block. */ BLOCK_END (top_stack->cur_block) = sh->value + top_stack->procadr; - shrink_block (top_stack->cur_block, top_stack->cur_st); } else if (sh->sc == scText && top_stack->blocktype == stNil) { @@ -4008,10 +4008,6 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) end_stabs (); } - /* Sort the symbol table now, we are done adding symbols to it. - We must do this before parse_procedure calls lookup_symbol. */ - sort_symtab_syms (st); - /* There used to be a call to sort_blocks here, but this should not be necessary for stabs symtabs. And as sort_blocks modifies the start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK, @@ -4065,19 +4061,15 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) int maxlines; EXTR *ext_ptr; - /* How many symbols will we need */ - /* FIXME, this does not count enum values. */ - f_max = pst->n_global_syms + pst->n_static_syms; if (fh == 0) { maxlines = 0; - st = new_symtab ("unknown", f_max, 0, pst->objfile); + st = new_symtab ("unknown", 0, pst->objfile); } else { - f_max += fh->csym + fh->cpd; maxlines = 2 * fh->cline; - st = new_symtab (pst->filename, 2 * f_max, maxlines, pst->objfile); + st = new_symtab (pst->filename, maxlines, pst->objfile); /* The proper language was already determined when building the psymtab, use it. */ @@ -4097,7 +4089,6 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) BLOCK_START (top_stack->cur_block) = pst->textlow; BLOCK_END (top_stack->cur_block) = 0; top_stack->blocktype = stFile; - top_stack->maxsyms = 2 * f_max; top_stack->cur_type = 0; top_stack->procadr = 0; top_stack->numargs = 0; @@ -4181,10 +4172,6 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) top_stack->cur_block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack->cur_st), GLOBAL_BLOCK); top_stack->blocktype = stFile; - top_stack->maxsyms - = (debug_info->symbolic_header.isymMax - + debug_info->symbolic_header.ipdMax - + debug_info->symbolic_header.iextMax); ext_ptr = PST_PRIVATE (pst)->extern_tab; for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++) @@ -4206,9 +4193,6 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) st->primary = 1; - /* Sort the symbol table now, we are done adding symbols to it. */ - sort_symtab_syms (st); - sort_blocks (st); } @@ -4457,11 +4441,12 @@ static struct symbol * mylookup_symbol (char *name, register struct block *block, domain_enum domain, enum address_class class) { - int i, inc; + struct dict_iterator iter; + int inc; struct symbol *sym; inc = name[0]; - ALL_BLOCK_SYMBOLS (block, i, sym) + ALL_BLOCK_SYMBOLS (block, iter, sym) { if (DEPRECATED_SYMBOL_NAME (sym)[0] == inc && SYMBOL_DOMAIN (sym) == domain @@ -4477,41 +4462,12 @@ mylookup_symbol (char *name, register struct block *block, } -/* Add a new symbol S to a block B. - Infrequently, we will need to reallocate the block to make it bigger. - We only detect this case when adding to top_stack->cur_block, since - that's the only time we know how big the block is. FIXME. */ +/* Add a new symbol S to a block B. */ static void add_symbol (struct symbol *s, struct block *b) { - int nsyms = BLOCK_NSYMS (b)++; - struct block *origb; - struct parse_stack *stackp; - - if (b == top_stack->cur_block && - nsyms >= top_stack->maxsyms) - { - complaint (&symfile_complaints, "block containing %s overfilled", - DEPRECATED_SYMBOL_NAME (s)); - /* In this case shrink_block is actually grow_block, since - BLOCK_NSYMS(b) is larger than its current size. */ - origb = b; - b = shrink_block (top_stack->cur_block, top_stack->cur_st); - - /* Now run through the stack replacing pointers to the - original block. shrink_block has already done this - for the blockvector and BLOCK_FUNCTION. */ - for (stackp = top_stack; stackp; stackp = stackp->next) - { - if (stackp->cur_block == origb) - { - stackp->cur_block = b; - stackp->maxsyms = BLOCK_NSYMS (b); - } - } - } - BLOCK_SYM (b, nsyms) = s; + dict_add_symbol (BLOCK_DICT (b), s); } /* Add a new block B to a symtab S */ @@ -4633,11 +4589,11 @@ sort_blocks (struct symtab *s) /* Constructor/restructor/destructor procedures */ -/* Allocate a new symtab for NAME. Needs an estimate of how many symbols - MAXSYMS and linenumbers MAXLINES we'll put in it */ +/* Allocate a new symtab for NAME. Needs an estimate of how many + linenumbers MAXLINES we'll put in it */ static struct symtab * -new_symtab (char *name, int maxsyms, int maxlines, struct objfile *objfile) +new_symtab (char *name, int maxlines, struct objfile *objfile) { struct symtab *s = allocate_symtab (name, objfile); @@ -4645,8 +4601,10 @@ new_symtab (char *name, int maxsyms, int maxlines, struct objfile *objfile) /* All symtabs must have at least two blocks */ BLOCKVECTOR (s) = new_bvect (2); - BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK) = new_block (maxsyms); - BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK) = new_block (maxsyms); + BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK) + = new_block (NON_FUNCTION_BLOCK); + BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK) + = new_block (NON_FUNCTION_BLOCK); BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)) = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); @@ -4730,48 +4688,22 @@ new_bvect (int nblocks) return bv; } -/* Allocate and zero a new block of MAXSYMS symbols */ +/* Allocate and zero a new block, and set its BLOCK_DICT. If function + is non-zero, assume the block is associated to a function, and make + sure that the symbols are stored linearly; otherwise, store them + hashed. */ static struct block * -new_block (int maxsyms) +new_block (enum block_type type) { - int size = sizeof (struct block) + (maxsyms - 1) * sizeof (struct symbol *); - - return (struct block *) xzalloc (size); -} - -/* Ooops, too big. Shrink block B in symtab S to its minimal size. - Shrink_block can also be used by add_symbol to grow a block. */ + struct block *retval = xzalloc (sizeof (struct block)); -static struct block * -shrink_block (struct block *b, struct symtab *s) -{ - struct block *new; - struct blockvector *bv = BLOCKVECTOR (s); - int i; + if (type == FUNCTION_BLOCK) + BLOCK_DICT (retval) = dict_create_linear_expandable (); + else + BLOCK_DICT (retval) = dict_create_hashed_expandable (); - /* Just reallocate it and fix references to the old one */ - - new = (struct block *) xrealloc ((void *) b, - (sizeof (struct block) - + ((BLOCK_NSYMS (b) - 1) - * sizeof (struct symbol *)))); - - /* FIXME: Not worth hashing this block as it's built. */ - /* All callers should have created the block with new_block (), which - would mean it was not previously hashed. Make sure. */ - gdb_assert (BLOCK_HASHTABLE (new) == 0); - - /* Should chase pointers to old one. Fortunately, that`s just - the block`s function and inferior blocks */ - if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b) - SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) = new; - for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); i++) - if (BLOCKVECTOR_BLOCK (bv, i) == b) - BLOCKVECTOR_BLOCK (bv, i) = new; - else if (BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, i)) == b) - BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, i)) = new; - return new; + return retval; } /* Create a new symbol with printname NAME */ @@ -4908,7 +4840,7 @@ fixup_sigtramp (void) TYPE_TARGET_TYPE (SYMBOL_TYPE (s)) = mdebug_type_void; /* Need a block to allocate MIPS_EFI_SYMBOL_NAME in */ - b = new_block (1); + b = new_block (NON_FUNCTION_BLOCK); SYMBOL_BLOCK_VALUE (s) = b; BLOCK_START (b) = sigtramp_address; BLOCK_END (b) = sigtramp_end; @@ -4951,7 +4883,7 @@ fixup_sigtramp (void) current_objfile = NULL; } - BLOCK_SYM (b, BLOCK_NSYMS (b)++) = s; + dict_add_symbol (BLOCK_DICT (b), s); } #endif /* TM_MIPS_H */ diff --git a/gdb/memattr.c b/gdb/memattr.c index 05ad413..4ab5dbf 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -514,6 +514,8 @@ mem_delete_command (char *args, int from_tty) dont_repeat (); } +extern initialize_file_ftype _initialize_mem; /* -Wmissing-prototype */ + void _initialize_mem (void) { diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 3b0124c..57651c2 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,23 @@ +2003-06-11 David Carlton + + * mi-cmd-stack.c: Include dictionary.h. + (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS. + +2003-06-11 Andrew Cagney + + * mi-main.c (get_register): Replace REGISTER_CONVERTIBLE with + DEPRECATED_REGISTER_CONVERTIBLE. + +2003-06-08 Andrew Cagney + + * mi-parse.c (_initialize_mi_parse): Delete function. + * mi-main.c: Include "mi-main.h". + * mi-interp.c (_initialize_mi_interp): Add declaration. + * mi-cmd-stack.c: Include "stack.h". + (select_frame_command_wrapper): Delete extern declaration. + (mi_cmd_stack_select_frame): Replace select_frame_command_wrapper + with select_frame_command. + 2003-05-16 Andrew Cagney * mi-main.c (mi_setup_architecture_data): diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 1f6a9a1..6330cda 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -27,11 +27,8 @@ #include "ui-out.h" #include "symtab.h" #include "block.h" - -/* FIXME: these should go in some .h file but stack.c doesn't have a - corresponding .h file. These wrappers will be obsolete anyway, once - we pull the plug on the sanitization. */ -extern void select_frame_command_wrapper (char *, int); +#include "stack.h" +#include "dictionary.h" static void list_args_or_locals (int locals, int values, struct frame_info *fi); @@ -217,7 +214,8 @@ list_args_or_locals (int locals, int values, struct frame_info *fi) { struct block *block; struct symbol *sym; - int i, nsyms; + struct dict_iterator iter; + int nsyms; struct cleanup *cleanup_list; static struct ui_stream *stb = NULL; @@ -229,7 +227,7 @@ list_args_or_locals (int locals, int values, struct frame_info *fi) while (block != 0) { - ALL_BLOCK_SYMBOLS (block, i, sym) + ALL_BLOCK_SYMBOLS (block, iter, sym) { int print_me = 0; @@ -311,8 +309,8 @@ mi_cmd_stack_select_frame (char *command, char **argv, int argc) /* with no args, don't change frame */ if (argc == 0) - select_frame_command_wrapper (0, 1 /* not used */ ); + select_frame_command (0, 1 /* not used */ ); else - select_frame_command_wrapper (argv[0], 1 /* not used */ ); + select_frame_command (argv[0], 1 /* not used */ ); return MI_CMD_DONE; } diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 87ed17f..696ae06 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -393,6 +393,8 @@ mi_input (char *buf) return gdb_readline (NULL); } +extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */ + void _initialize_mi_interp (void) { diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 0e9cb24..5e55913 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -41,6 +41,7 @@ #include "regcache.h" #include "gdb.h" #include "frame.h" +#include "mi-main.h" #include #include @@ -535,9 +536,9 @@ get_register (int regnum, int format) /* Convert raw data to virtual format if necessary. */ - if (REGISTER_CONVERTIBLE (regnum)) + if (DEPRECATED_REGISTER_CONVERTIBLE (regnum)) { - REGISTER_CONVERT_TO_VIRTUAL (regnum, + DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum), raw_buffer, virtual_buffer); } diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c index caefd59..ebfddc7 100644 --- a/gdb/mi/mi-parse.c +++ b/gdb/mi/mi-parse.c @@ -231,8 +231,3 @@ mi_parse (char *cmd) parse->op = MI_COMMAND; return parse; } - -void -_initialize_mi_parse (void) -{ -} diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7bc4aeb..70bb92b 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -621,7 +621,7 @@ mips_register_convert_to_virtual (int n, struct type *virtual_type, static void mips_register_convert_to_raw (struct type *virtual_type, int n, - char *virt_buf, char *raw_buf) + const char *virt_buf, char *raw_buf) { memset (raw_buf, 0, REGISTER_RAW_SIZE (n)); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) @@ -768,12 +768,6 @@ mips_n32n64_use_struct_convention (int gcc_p, struct type *type) return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE); } -static int -mips_o32_use_struct_convention (int gcc_p, struct type *type) -{ - return 1; /* Structures are returned by ref in extra arg0. */ -} - /* Should call_function pass struct by reference? For each architecture, structs are passed either by value or by reference, depending on their size. */ @@ -5453,8 +5447,8 @@ mips_get_saved_register (char *raw_buffer, lvalp = &lvalx; if (optimizedp == NULL) optimizedp = &optimizedx; - generic_unwind_get_saved_register (raw_buffer, optimizedp, addrp, frame, - regnum, lvalp); + deprecated_unwind_get_saved_register (raw_buffer, optimizedp, addrp, frame, + regnum, lvalp); /* FIXME: cagney/2002-09-13: This is just so bad. The MIPS should have a pseudo register range that correspons to the ABI's, rather than the ISA's, view of registers. These registers would then @@ -5747,7 +5741,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); set_gdbarch_long_double_bit (gdbarch, 64); - set_gdbarch_register_raw_size (gdbarch, mips_register_raw_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, mips_register_raw_size); tdep->found_abi = found_abi; tdep->mips_abi = mips_abi; @@ -5778,7 +5772,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_reg_struct_has_addr (gdbarch, mips_o32_reg_struct_has_addr); set_gdbarch_use_struct_convention (gdbarch, - mips_o32_use_struct_convention); + always_use_struct_convention); break; case MIPS_ABI_O64: set_gdbarch_push_dummy_call (gdbarch, mips_o64_push_dummy_call); @@ -5796,8 +5790,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_reg_struct_has_addr (gdbarch, mips_o32_reg_struct_has_addr); - set_gdbarch_use_struct_convention (gdbarch, - mips_o32_use_struct_convention); + set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); break; case MIPS_ABI_EABI32: set_gdbarch_push_dummy_call (gdbarch, mips_eabi_push_dummy_call); @@ -5961,17 +5954,14 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_frame_align (gdbarch, mips_frame_align); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); - set_gdbarch_register_convertible (gdbarch, mips_register_convertible); - set_gdbarch_register_convert_to_virtual (gdbarch, - mips_register_convert_to_virtual); - set_gdbarch_register_convert_to_raw (gdbarch, - mips_register_convert_to_raw); + set_gdbarch_deprecated_register_convertible (gdbarch, mips_register_convertible); + set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, mips_register_convert_to_virtual); + set_gdbarch_deprecated_register_convert_to_raw (gdbarch, mips_register_convert_to_raw); set_gdbarch_deprecated_frame_chain (gdbarch, mips_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); set_gdbarch_deprecated_frame_saved_pc (gdbarch, mips_frame_saved_pc); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_deprecated_get_saved_register (gdbarch, mips_get_saved_register); @@ -5991,7 +5981,7 @@ mips_gdbarch_init (struct gdbarch_info info, /* There are MIPS targets which do not yet use this since they still define REGISTER_VIRTUAL_TYPE. */ - set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, mips_register_virtual_type); set_gdbarch_print_registers_info (gdbarch, mips_print_registers_info); set_gdbarch_pc_in_sigtramp (gdbarch, mips_pc_in_sigtramp); @@ -6402,6 +6392,8 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) _PROC_MAGIC_); } +extern initialize_file_ftype _initialize_mips_tdep; /* -Wmissing-prototypes */ + void _initialize_mips_tdep (void) { diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h index 8e19bcd..5d3aa85 100644 --- a/gdb/mips-tdep.h +++ b/gdb/mips-tdep.h @@ -40,4 +40,7 @@ enum mips_abi /* Return the MIPS ABI associated with GDBARCH. */ enum mips_abi mips_abi (struct gdbarch *gdbarch); +/* For wince :-(. */ +extern CORE_ADDR mips_next_pc (CORE_ADDR pc); + #endif /* MIPS_TDEP_H */ diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 76f0245..85b4a8e 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -31,6 +31,7 @@ #include "symfile.h" #include "regcache.h" #include "arch-utils.h" +#include "gdb_assert.h" #define D0_REGNUM 0 #define D2_REGNUM 2 @@ -1091,6 +1092,14 @@ mn10300_do_registers_info (int regnum, int fpregs) } } +static CORE_ADDR +mn10300_read_fp (void) +{ + /* That's right, we're using the stack pointer as our frame pointer. */ + gdb_assert (SP_REGNUM >= 0); + return read_register (SP_REGNUM); +} + /* Dump out the mn10300 speciic architecture information. */ static void @@ -1149,11 +1158,11 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_register_size (gdbarch, 4); set_gdbarch_deprecated_register_bytes (gdbarch, num_regs * gdbarch_deprecated_register_size (gdbarch)); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); - set_gdbarch_register_raw_size (gdbarch, mn10300_register_raw_size); - set_gdbarch_register_byte (gdbarch, mn10300_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, mn10300_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, mn10300_register_byte); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4); - set_gdbarch_register_virtual_size (gdbarch, mn10300_register_virtual_size); - set_gdbarch_register_virtual_type (gdbarch, mn10300_register_virtual_type); + set_gdbarch_deprecated_register_virtual_size (gdbarch, mn10300_register_virtual_size); + set_gdbarch_deprecated_register_virtual_type (gdbarch, mn10300_register_virtual_type); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum); set_gdbarch_deprecated_do_registers_info (gdbarch, mn10300_do_registers_info); set_gdbarch_sp_regnum (gdbarch, 8); @@ -1182,9 +1191,8 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* That's right, we're using the stack pointer as our frame pointer. */ - set_gdbarch_deprecated_target_read_fp (gdbarch, generic_target_read_sp); + set_gdbarch_deprecated_target_read_fp (gdbarch, mn10300_read_fp); /* Calling functions in the inferior from GDB. */ set_gdbarch_deprecated_call_dummy_words (gdbarch, mn10300_call_dummy_words); @@ -1199,7 +1207,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, tdep->am33_mode = am33_mode; /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); return gdbarch; } diff --git a/gdb/monitor.c b/gdb/monitor.c index eabbbd9..ee2280d 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -1054,12 +1054,11 @@ monitor_wait_cleanup (void *old_timeout) -void +static void monitor_wait_filter (char *buf, int bufmax, int *ext_resp_len, - struct target_waitstatus *status -) + struct target_waitstatus *status) { int resp_len; do @@ -2335,6 +2334,8 @@ init_monitor_ops (struct target_ops *ops) /* Define additional commands that are usually only used by monitors. */ +extern initialize_file_ftype _initialize_remote_monitors; /* -Wmissing-prototypes */ + void _initialize_remote_monitors (void) { diff --git a/gdb/nlm/configure b/gdb/nlm/configure index 3918fee..ca1146a 100755 --- a/gdb/nlm/configure +++ b/gdb/nlm/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.2 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -28,6 +28,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -142,6 +143,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 @@ -312,6 +314,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=*) @@ -333,7 +340,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.2" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -477,12 +484,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 @@ -569,7 +580,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:573: checking host system type" >&5 +echo "configure:584: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -590,7 +601,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:594: checking target system type" >&5 +echo "configure:605: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -608,7 +619,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:612: checking build system type" >&5 +echo "configure:623: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -662,7 +673,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # 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:666: checking for a BSD compatible install" >&5 +echo "configure:677: 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 @@ -710,6 +721,8 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' @@ -719,7 +732,7 @@ case "${target_cpu}" in alpha) gdb_target_cpu=alpha ;; c[12]) gdb_target_cpu=convex ;; hppa*) gdb_target_cpu=pa ;; -i[3456]86) gdb_target_cpu=i386 ;; +i[34567]86) gdb_target_cpu=i386 ;; m68*) gdb_target_cpu=m68k ;; np1) gdb_target_cpu=gould ;; pn) gdb_target_cpu=gould ;; @@ -773,7 +786,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -852,7 +865,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.2" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -876,6 +889,7 @@ s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -910,6 +924,7 @@ s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@target_makefile_frag_path@%$target_makefile_frag_path%g /@target_makefile_frag@/r $target_makefile_frag diff --git a/gdb/nlm/configure.in b/gdb/nlm/configure.in index 845b486..ba415aa 100644 --- a/gdb/nlm/configure.in +++ b/gdb/nlm/configure.in @@ -15,7 +15,7 @@ case "${target_cpu}" in alpha) gdb_target_cpu=alpha ;; c[12]) gdb_target_cpu=convex ;; hppa*) gdb_target_cpu=pa ;; -i[3456]86) gdb_target_cpu=i386 ;; +i[34567]86) gdb_target_cpu=i386 ;; m68*) gdb_target_cpu=m68k ;; np1) gdb_target_cpu=gould ;; pn) gdb_target_cpu=gould ;; diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index dfdd315..a52f39f 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -357,12 +357,6 @@ ns32k_frame_args_address (struct frame_info *frame) return (read_register (SP_REGNUM) - 4); } -static CORE_ADDR -ns32k_frame_locals_address (struct frame_info *frame) -{ - return (get_frame_base (frame)); -} - /* Code to initialize the addresses of the saved registers of frame described by FRAME_INFO. This includes special registers such as pc and fp saved in special ways in the stack frame. sp is even more special: the address we @@ -513,7 +507,7 @@ ns32k_gdbarch_init_32082 (struct gdbarch *gdbarch) set_gdbarch_register_name (gdbarch, ns32k_register_name_32082); set_gdbarch_deprecated_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32082); - set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32082); + set_gdbarch_deprecated_register_byte (gdbarch, ns32k_register_byte_32082); } void @@ -523,7 +517,7 @@ ns32k_gdbarch_init_32382 (struct gdbarch *gdbarch) set_gdbarch_register_name (gdbarch, ns32k_register_name_32382); set_gdbarch_deprecated_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32382); - set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32382); + set_gdbarch_deprecated_register_byte (gdbarch, ns32k_register_byte_32382); } /* Initialize the current architecture based on INFO. If possible, re-use an @@ -557,12 +551,12 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, NS32K_PS_REGNUM); set_gdbarch_deprecated_register_size (gdbarch, NS32K_REGISTER_SIZE); - set_gdbarch_register_raw_size (gdbarch, ns32k_register_raw_size); + set_gdbarch_deprecated_register_raw_size (gdbarch, ns32k_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, NS32K_MAX_REGISTER_RAW_SIZE); - set_gdbarch_register_virtual_size (gdbarch, ns32k_register_virtual_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, ns32k_register_virtual_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, NS32K_MAX_REGISTER_VIRTUAL_SIZE); - set_gdbarch_register_virtual_type (gdbarch, ns32k_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, ns32k_register_virtual_type); /* Frame and stack info */ set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue); @@ -576,7 +570,6 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_saved_pc (gdbarch, ns32k_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address); - set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs); @@ -611,7 +604,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); /* Hook in OS ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); @@ -619,6 +612,8 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return (gdbarch); } +extern initialize_file_ftype _initialize_ns32k_tdep; /* -Wmissing-prototypes */ + void _initialize_ns32k_tdep (void) { diff --git a/gdb/ns32knbsd-tdep.c b/gdb/ns32knbsd-tdep.c index 33b99d9..b241851 100644 --- a/gdb/ns32knbsd-tdep.c +++ b/gdb/ns32knbsd-tdep.c @@ -61,6 +61,8 @@ ns32knbsd_aout_osabi_sniffer (bfd *abfd) return GDB_OSABI_UNKNOWN; } +extern initialize_file_ftype _initialize_ns32knbsd_tdep; /* -Wmissing-prototypes */ + void _initialize_ns32knbsd_tdep (void) { diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index 40dc5b8..9e7cf11 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -1775,7 +1775,6 @@ yylex () CORE_ADDR Class = lookup_objc_class(tmp); if (Class) { - extern struct symbol *lookup_struct_typedef(); yylval.class.class = Class; if ((sym = lookup_struct_typedef (tmp, expression_context_block, diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 25d40ab..9a983b7 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -775,7 +775,8 @@ end_msglist(void) * Used for qsorting lists of objc methods (either by class or selector). */ -int specialcmp(char *a, char *b) +static int +specialcmp (char *a, char *b) { while (*a && *a != ' ' && *a != ']' && *b && *b != ' ' && *b != ']') { @@ -1518,7 +1519,7 @@ char *find_imps (struct symtab *symtab, struct block *block, return method + (tmp - buf); } -void +static void print_object_command (char *args, int from_tty) { struct value *object, *function, *description; @@ -1606,7 +1607,7 @@ static struct objc_methcall methcalls[] = { * case the functions have moved for some reason. */ -void +static void find_objc_msgsend (void) { unsigned int i; @@ -1653,7 +1654,7 @@ struct objc_submethod_helper_data { CORE_ADDR *new_pc; }; -int +static int find_objc_msgcall_submethod_helper (void * arg) { struct objc_submethod_helper_data *s = @@ -1665,7 +1666,7 @@ find_objc_msgcall_submethod_helper (void * arg) return 0; } -int +static int find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *), CORE_ADDR pc, CORE_ADDR *new_pc) @@ -1709,6 +1710,8 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc) return 0; } +extern initialize_file_ftype _initialize_objc_language; /* -Wmissing-prototypes */ + void _initialize_objc_language (void) { @@ -1722,41 +1725,6 @@ _initialize_objc_language (void) add_com_alias ("po", "print-object", class_vars, 1); } -#if 1 -/* Disable these functions until we put them in the gdbarch vector. */ -static unsigned long FETCH_ARGUMENT (int i) -{ - internal_error (__FILE__, __LINE__, "FETCH_ARGUMENT not implemented"); - return 0; -} -#else -#if defined (__powerpc__) || defined (__ppc__) -static unsigned long FETCH_ARGUMENT (int i) -{ - return read_register (3 + i); -} -#elif defined (__i386__) -static unsigned long FETCH_ARGUMENT (int i) -{ - CORE_ADDR stack = read_register (SP_REGNUM); - return read_memory_unsigned_integer (stack + (4 * (i + 1)), 4); -} -#elif defined (__sparc__) -static unsigned long FETCH_ARGUMENT (int i) -{ - return read_register (O0_REGNUM + i); -} -#elif defined (__hppa__) || defined (__hppa) -static unsigned long FETCH_ARGUMENT (int i) -{ - return read_register (R0_REGNUM + 26 - i); -} -#else -#error unknown architecture -#endif - -#endif - static void read_objc_method (CORE_ADDR addr, struct objc_method *method) { @@ -1807,7 +1775,7 @@ read_objc_class (CORE_ADDR addr, struct objc_class *class) class->protocols = read_memory_unsigned_integer (addr + 36, 4); } -CORE_ADDR +static CORE_ADDR find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel) { CORE_ADDR subclass = class; @@ -1857,7 +1825,7 @@ find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel) return 0; } -CORE_ADDR +static CORE_ADDR find_implementation (CORE_ADDR object, CORE_ADDR sel) { struct objc_object ostr; @@ -1871,6 +1839,9 @@ find_implementation (CORE_ADDR object, CORE_ADDR sel) return find_implementation_from_class (ostr.isa, sel); } +#define OBJC_FETCH_POINTER_ARGUMENT(argi) \ + FETCH_POINTER_ARGUMENT (get_current_frame (), argi, builtin_type_void_func_ptr) + static int resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc) { @@ -1878,8 +1849,8 @@ resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc) CORE_ADDR sel; CORE_ADDR res; - object = FETCH_ARGUMENT (0); - sel = FETCH_ARGUMENT (1); + object = OBJC_FETCH_POINTER_ARGUMENT (0); + sel = OBJC_FETCH_POINTER_ARGUMENT (1); res = find_implementation (object, sel); if (new_pc != 0) @@ -1896,8 +1867,8 @@ resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc) CORE_ADDR sel; CORE_ADDR res; - object = FETCH_ARGUMENT (1); - sel = FETCH_ARGUMENT (2); + object = OBJC_FETCH_POINTER_ARGUMENT (1); + sel = OBJC_FETCH_POINTER_ARGUMENT (2); res = find_implementation (object, sel); if (new_pc != 0) @@ -1916,8 +1887,8 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc) CORE_ADDR sel; CORE_ADDR res; - super = FETCH_ARGUMENT (0); - sel = FETCH_ARGUMENT (1); + super = OBJC_FETCH_POINTER_ARGUMENT (0); + sel = OBJC_FETCH_POINTER_ARGUMENT (1); read_objc_super (super, &sstr); if (sstr.class == 0) @@ -1940,8 +1911,8 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc) CORE_ADDR sel; CORE_ADDR res; - super = FETCH_ARGUMENT (1); - sel = FETCH_ARGUMENT (2); + super = OBJC_FETCH_POINTER_ARGUMENT (1); + sel = OBJC_FETCH_POINTER_ARGUMENT (2); read_objc_super (super, &sstr); if (sstr.class == 0) diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h index 0c49bac..c88a0f7 100644 --- a/gdb/objc-lang.h +++ b/gdb/objc-lang.h @@ -62,4 +62,7 @@ extern void start_msglist (void); extern void add_msglist (struct stoken *str, int addcolon); extern int end_msglist (void); +struct symbol *lookup_struct_typedef (char *name, struct block *block, + int noerr); + #endif diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e695ebe..39f5623 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -43,6 +43,7 @@ #include "breakpoint.h" #include "block.h" +#include "dictionary.h" /* Prototypes for local functions */ @@ -613,7 +614,8 @@ void objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) { struct section_offsets *delta = - (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); + ((struct section_offsets *) + alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections))); { int i; @@ -656,13 +658,13 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) { struct block *b; struct symbol *sym; - int j; + struct dict_iterator iter; b = BLOCKVECTOR_BLOCK (bv, i); BLOCK_START (b) += ANOFFSET (delta, s->block_line_section); BLOCK_END (b) += ANOFFSET (delta, s->block_line_section); - ALL_BLOCK_SYMBOLS (b, j, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { fixup_symbol_section (sym, objfile); diff --git a/gdb/ocd.c b/gdb/ocd.c index 4dfda5d..3c8d5d2 100644 --- a/gdb/ocd.c +++ b/gdb/ocd.c @@ -1365,6 +1365,8 @@ bdm_read_register_command (char *args, int from_tty) } +extern initialize_file_ftype _initialize_remote_ocd; /* -Wmissing-prototypes */ + void _initialize_remote_ocd (void) { diff --git a/gdb/osabi.c b/gdb/osabi.c index 2241406..5f935d2 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -531,7 +531,7 @@ set_osabi (char *args, int from_tty, struct cmd_list_element *c) internal_error (__FILE__, __LINE__, "Updating OS ABI failed."); } -void +static void show_osabi (char *args, int from_tty) { if (user_osabi_state == osabi_auto) @@ -546,6 +546,8 @@ show_osabi (char *args, int from_tty) gdbarch_osabi_name (GDB_OSABI_DEFAULT)); } +extern initialize_file_ftype _initialize_gdb_osabi; /* -Wmissing-prototype */ + void _initialize_gdb_osabi (void) { diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 282d25a..13d0f78 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -158,8 +158,8 @@ parse_number (char *, int, int, YYSTYPE *); static struct type *current_type; -static void push_current_type (); -static void pop_current_type (); +static void push_current_type (void); +static void pop_current_type (void); static int search_field; %} @@ -992,7 +992,8 @@ struct type_push static struct type_push *tp_top = NULL; -static void push_current_type () +static void +push_current_type (void) { struct type_push *tpnew; tpnew = (struct type_push *) malloc (sizeof (struct type_push)); @@ -1002,7 +1003,8 @@ static void push_current_type () tp_top = tpnew; } -static void pop_current_type () +static void +pop_current_type (void) { struct type_push *tp = tp_top; if (tp) diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 4e460cc..4867dcb 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -1097,6 +1097,7 @@ pascal_object_print_class_member (char *valaddr, struct type *domain, fprintf_filtered (stream, "%ld", (long int) (val >> 3)); } +extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */ void _initialize_pascal_valprint (void) diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index 43910da..b67532d 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -222,9 +222,9 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, bfd *tmp_bfd; asection *sec; obj_private_data_t *obj_private; - struct section_addr_info section_addrs; + struct section_addr_info *section_addrs; + struct cleanup *my_cleanups; - memset (§ion_addrs, 0, sizeof (section_addrs)); /* We need the BFD so that we can look at its sections. We open up the file temporarily, then close it when we are done. */ tmp_bfd = bfd_openr (name, gnutarget); @@ -262,15 +262,18 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, text_addr += sec->filepos; } + section_addrs = alloc_section_addr_info (bfd_count_sections (tmp_bfd)); + my_cleanups = make_cleanup (xfree, section_addrs); + /* We are done with the temporary bfd. Get rid of it and make sure nobody else can us it. */ bfd_close (tmp_bfd); tmp_bfd = NULL; /* Now let the generic code load up symbols for this library. */ - section_addrs.other[0].addr = text_addr; - section_addrs.other[0].name = ".text"; - so->objfile = symbol_file_add (name, from_tty, §ion_addrs, 0, OBJF_SHARED); + section_addrs->other[0].addr = text_addr; + section_addrs->other[0].name = ".text"; + so->objfile = symbol_file_add (name, from_tty, section_addrs, 0, OBJF_SHARED); so->abfd = so->objfile->obfd; /* Mark this as a shared library and save private data. */ @@ -289,6 +292,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, obj_private = (obj_private_data_t *) so->objfile->obj_private; obj_private->so_info = so; obj_private->dp = so->pa64_solib_desc.linkage_ptr; + do_cleanups (my_cleanups); } /* Load debugging information for a shared library. TARGET may be diff --git a/gdb/ppc-bdm.c b/gdb/ppc-bdm.c index 9e7133e..f189818 100644 --- a/gdb/ppc-bdm.c +++ b/gdb/ppc-bdm.c @@ -346,6 +346,8 @@ a wiggler, specify wiggler and then the port it is connected to\n\ bdm_ppc_ops.to_magic = OPS_MAGIC; } /* init_bdm_ppc_ops */ +extern initialize_file_ftype _initialize_bdm_ppc; /* -Wmissing-prototypes */ + void _initialize_bdm_ppc (void) { diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index d320499..d0bff2e 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -127,32 +127,37 @@ ppc_register_u_addr (int regno) { int u_addr = -1; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + int wordsize = tdep->wordsize; /* General purpose registers occupy 1 slot each in the buffer */ if (regno >= tdep->ppc_gp0_regnum && regno <= tdep->ppc_gplast_regnum ) - u_addr = ((PT_R0 + regno) * 4); + u_addr = ((PT_R0 + regno) * wordsize); - /* Floating point regs: 2 slots each */ + /* Floating point regs: eight bytes each in both 32- and 64-bit + ptrace interfaces. Thus, two slots each in 32-bit interface, one + slot each in 64-bit interface. */ if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM) - u_addr = ((PT_FPR0 + (regno - FP0_REGNUM) * 2) * 4); + u_addr = (PT_FPR0 * wordsize) + ((regno - FP0_REGNUM) * 8); /* UISA special purpose registers: 1 slot each */ if (regno == PC_REGNUM) - u_addr = PT_NIP * 4; + u_addr = PT_NIP * wordsize; if (regno == tdep->ppc_lr_regnum) - u_addr = PT_LNK * 4; + u_addr = PT_LNK * wordsize; if (regno == tdep->ppc_cr_regnum) - u_addr = PT_CCR * 4; + u_addr = PT_CCR * wordsize; if (regno == tdep->ppc_xer_regnum) - u_addr = PT_XER * 4; + u_addr = PT_XER * wordsize; if (regno == tdep->ppc_ctr_regnum) - u_addr = PT_CTR * 4; + u_addr = PT_CTR * wordsize; +#ifdef PT_MQ if (regno == tdep->ppc_mq_regnum) - u_addr = PT_MQ * 4; + u_addr = PT_MQ * wordsize; +#endif if (regno == tdep->ppc_ps_regnum) - u_addr = PT_MSR * 4; + u_addr = PT_MSR * wordsize; if (regno == tdep->ppc_fpscr_regnum) - u_addr = PT_FPSCR * 4; + u_addr = PT_FPSCR * wordsize; return u_addr; } @@ -503,9 +508,11 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno) regcache_collect (tdep->ppc_xer_regnum, regp + PT_XER); if ((regno == -1) || regno == tdep->ppc_ctr_regnum) regcache_collect (tdep->ppc_ctr_regnum, regp + PT_CTR); +#ifdef PT_MQ if (((regno == -1) || regno == tdep->ppc_mq_regnum) && (tdep->ppc_mq_regnum != -1)) regcache_collect (tdep->ppc_mq_regnum, regp + PT_MQ); +#endif if ((regno == -1) || regno == tdep->ppc_ps_regnum) regcache_collect (tdep->ppc_ps_regnum, regp + PT_MSR); } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index ef1d9f0..f2d76b8 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -229,7 +229,7 @@ ppc_linux_at_sigtramp_return_path (CORE_ADDR pc) && insn_is_sigreturn (extract_unsigned_integer (buf, 4)))); } -CORE_ADDR +static CORE_ADDR ppc_linux_skip_trampoline_code (CORE_ADDR pc) { char buf[4]; @@ -632,6 +632,258 @@ ppc_linux_svr4_fetch_link_map_offsets (void) return lmp; } + +/* Macros for matching instructions. Note that, since all the + operands are masked off before they're or-ed into the instruction, + you can use -1 to make masks. */ + +#define insn_d(opcd, rts, ra, d) \ + ((((opcd) & 0x3f) << 26) \ + | (((rts) & 0x1f) << 21) \ + | (((ra) & 0x1f) << 16) \ + | ((d) & 0xffff)) + +#define insn_ds(opcd, rts, ra, d, xo) \ + ((((opcd) & 0x3f) << 26) \ + | (((rts) & 0x1f) << 21) \ + | (((ra) & 0x1f) << 16) \ + | ((d) & 0xfffc) \ + | ((xo) & 0x3)) + +#define insn_xfx(opcd, rts, spr, xo) \ + ((((opcd) & 0x3f) << 26) \ + | (((rts) & 0x1f) << 21) \ + | (((spr) & 0x1f) << 16) \ + | (((spr) & 0x3e0) << 6) \ + | (((xo) & 0x3ff) << 1)) + +/* Read a PPC instruction from memory. PPC instructions are always + big-endian, no matter what endianness the program is running in, so + we can't use read_memory_integer or one of its friends here. */ +static unsigned int +read_insn (CORE_ADDR pc) +{ + unsigned char buf[4]; + + read_memory (pc, buf, 4); + return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; +} + + +/* An instruction to match. */ +struct insn_pattern +{ + unsigned int mask; /* mask the insn with this... */ + unsigned int data; /* ...and see if it matches this. */ + int optional; /* If non-zero, this insn may be absent. */ +}; + +/* Return non-zero if the instructions at PC match the series + described in PATTERN, or zero otherwise. PATTERN is an array of + 'struct insn_pattern' objects, terminated by an entry whose mask is + zero. + + When the match is successful, fill INSN[i] with what PATTERN[i] + matched. If PATTERN[i] is optional, and the instruction wasn't + present, set INSN[i] to 0 (which is not a valid PPC instruction). + INSN should have as many elements as PATTERN. Note that, if + PATTERN contains optional instructions which aren't present in + memory, then INSN will have holes, so INSN[i] isn't necessarily the + i'th instruction in memory. */ +static int +insns_match_pattern (CORE_ADDR pc, + struct insn_pattern *pattern, + unsigned int *insn) +{ + int i; + + for (i = 0; pattern[i].mask; i++) + { + insn[i] = read_insn (pc); + if ((insn[i] & pattern[i].mask) == pattern[i].data) + pc += 4; + else if (pattern[i].optional) + insn[i] = 0; + else + return 0; + } + + return 1; +} + + +/* Return the 'd' field of the d-form instruction INSN, properly + sign-extended. */ +static CORE_ADDR +insn_d_field (unsigned int insn) +{ + return ((((CORE_ADDR) insn & 0xffff) ^ 0x8000) - 0x8000); +} + + +/* Return the 'ds' field of the ds-form instruction INSN, with the two + zero bits concatenated at the right, and properly + sign-extended. */ +static CORE_ADDR +insn_ds_field (unsigned int insn) +{ + return ((((CORE_ADDR) insn & 0xfffc) ^ 0x8000) - 0x8000); +} + + +/* Pattern for the standard linkage function. These are built by + build_plt_stub in elf64-ppc.c, whose GLINK argument is always + zero. */ +static struct insn_pattern ppc64_standard_linkage[] = + { + /* addis r12, r2, */ + { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 }, + + /* std r2, 40(r1) */ + { -1, insn_ds (62, 2, 1, 40, 0), 0 }, + + /* ld r11, (r12) */ + { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 }, + + /* addis r12, r12, 1 */ + { insn_d (-1, -1, -1, -1), insn_d (15, 12, 2, 1), 1 }, + + /* ld r2, (r12) */ + { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 }, + + /* addis r12, r12, 1 */ + { insn_d (-1, -1, -1, -1), insn_d (15, 12, 2, 1), 1 }, + + /* mtctr r11 */ + { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), + 0 }, + + /* ld r11, (r12) */ + { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 }, + + /* bctr */ + { -1, 0x4e800420, 0 }, + + { 0, 0, 0 } + }; +#define PPC64_STANDARD_LINKAGE_LEN \ + (sizeof (ppc64_standard_linkage) / sizeof (ppc64_standard_linkage[0])) + + +/* Recognize a 64-bit PowerPC Linux linkage function --- what GDB + calls a "solib trampoline". */ +static int +ppc64_in_solib_call_trampoline (CORE_ADDR pc, char *name) +{ + /* Detecting solib call trampolines on PPC64 Linux is a pain. + + It's not specifically solib call trampolines that are the issue. + Any call from one function to another function that uses a + different TOC requires a trampoline, to save the caller's TOC + pointer and then load the callee's TOC. An executable or shared + library may have more than one TOC, so even intra-object calls + may require a trampoline. Since executable and shared libraries + will all have their own distinct TOCs, every inter-object call is + also an inter-TOC call, and requires a trampoline --- so "solib + call trampolines" are just a special case. + + The 64-bit PowerPC Linux ABI calls these call trampolines + "linkage functions". Since they need to be near the functions + that call them, they all appear in .text, not in any special + section. The .plt section just contains an array of function + descriptors, from which the linkage functions load the callee's + entry point, TOC value, and environment pointer. So + in_plt_section is useless. The linkage functions don't have any + special linker symbols to name them, either. + + The only way I can see to recognize them is to actually look at + their code. They're generated by ppc_build_one_stub and some + other functions in bfd/elf64-ppc.c, so that should show us all + the instruction sequences we need to recognize. */ + unsigned int insn[PPC64_STANDARD_LINKAGE_LEN]; + + return insns_match_pattern (pc, ppc64_standard_linkage, insn); +} + + +/* When the dynamic linker is doing lazy symbol resolution, the first + call to a function in another object will go like this: + + - The user's function calls the linkage function: + + 100007c4: 4b ff fc d5 bl 10000498 + 100007c8: e8 41 00 28 ld r2,40(r1) + + - The linkage function loads the entry point (and other stuff) from + the function descriptor in the PLT, and jumps to it: + + 10000498: 3d 82 00 00 addis r12,r2,0 + 1000049c: f8 41 00 28 std r2,40(r1) + 100004a0: e9 6c 80 98 ld r11,-32616(r12) + 100004a4: e8 4c 80 a0 ld r2,-32608(r12) + 100004a8: 7d 69 03 a6 mtctr r11 + 100004ac: e9 6c 80 a8 ld r11,-32600(r12) + 100004b0: 4e 80 04 20 bctr + + - But since this is the first time that PLT entry has been used, it + sends control to its glink entry. That loads the number of the + PLT entry and jumps to the common glink0 code: + + 10000c98: 38 00 00 00 li r0,0 + 10000c9c: 4b ff ff dc b 10000c78 + + - The common glink0 code then transfers control to the dynamic + linker's fixup code: + + 10000c78: e8 41 00 28 ld r2,40(r1) + 10000c7c: 3d 82 00 00 addis r12,r2,0 + 10000c80: e9 6c 80 80 ld r11,-32640(r12) + 10000c84: e8 4c 80 88 ld r2,-32632(r12) + 10000c88: 7d 69 03 a6 mtctr r11 + 10000c8c: e9 6c 80 90 ld r11,-32624(r12) + 10000c90: 4e 80 04 20 bctr + + Eventually, this code will figure out how to skip all of this, + including the dynamic linker. At the moment, we just get through + the linkage function. */ + +/* If the current thread is about to execute a series of instructions + at PC matching the ppc64_standard_linkage pattern, and INSN is the result + from that pattern match, return the code address to which the + standard linkage function will send them. (This doesn't deal with + dynamic linker lazy symbol resolution stubs.) */ +static CORE_ADDR +ppc64_standard_linkage_target (CORE_ADDR pc, unsigned int *insn) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + /* The address of the function descriptor this linkage function + references. */ + CORE_ADDR desc + = ((CORE_ADDR) read_register (tdep->ppc_gp0_regnum + 2) + + (insn_d_field (insn[0]) << 16) + + insn_ds_field (insn[2])); + + /* The first word of the descriptor is the entry point. Return that. */ + return (CORE_ADDR) read_memory_unsigned_integer (desc, 8); +} + + +/* Given that we've begun executing a call trampoline at PC, return + the entry point of the function the trampoline will go to. */ +static CORE_ADDR +ppc64_skip_trampoline_code (CORE_ADDR pc) +{ + unsigned int ppc64_standard_linkage_insn[PPC64_STANDARD_LINKAGE_LEN]; + + if (insns_match_pattern (pc, ppc64_standard_linkage, + ppc64_standard_linkage_insn)) + return ppc64_standard_linkage_target (pc, ppc64_standard_linkage_insn); + else + return 0; +} + + enum { ELF_NGREG = 48, ELF_NFPREG = 33, @@ -743,13 +995,20 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_memory_remove_breakpoint (gdbarch, ppc_linux_memory_remove_breakpoint); + /* Shared library handling. */ + set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); + set_gdbarch_skip_trampoline_code (gdbarch, + ppc_linux_skip_trampoline_code); set_solib_svr4_fetch_link_map_offsets (gdbarch, ppc_linux_svr4_fetch_link_map_offsets); } - - /* Shared library handling. */ - set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); + + if (tdep->wordsize == 8) + { + set_gdbarch_in_solib_call_trampoline + (gdbarch, ppc64_in_solib_call_trampoline); + set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); + } } void diff --git a/gdb/ppcbug-rom.c b/gdb/ppcbug-rom.c index 712af06..0619964 100644 --- a/gdb/ppcbug-rom.c +++ b/gdb/ppcbug-rom.c @@ -196,6 +196,8 @@ ppcbug_open1 (char *args, int from_tty) monitor_open (args, &ppcbug_cmds1, from_tty); } +extern initialize_file_ftype _initialize_ppcbug_rom; /* -Wmissing-prototypes */ + void _initialize_ppcbug_rom (void) { diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 11fd1df..410b950 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -140,9 +140,6 @@ static void disable_display_command (char *, int); static void printf_command (char *, int); -static void print_frame_nameless_args (struct frame_info *, long, - int, int, struct ui_file *); - static void display_info (char *, int); static void do_one_display (struct display *); @@ -1745,228 +1742,6 @@ print_variable_value (struct symbol *var, struct frame_info *frame, value_print (val, stream, 0, Val_pretty_default); } -/* Print the arguments of a stack frame, given the function FUNC - running in that frame (as a symbol), the info on the frame, - and the number of args according to the stack frame (or -1 if unknown). */ - -/* References here and elsewhere to "number of args according to the - stack frame" appear in all cases to refer to "number of ints of args - according to the stack frame". At least for VAX, i386, isi. */ - -void -print_frame_args (struct symbol *func, struct frame_info *fi, int num, - struct ui_file *stream) -{ - struct block *b = NULL; - int first = 1; - register int i; - register struct symbol *sym; - struct value *val; - /* Offset of next stack argument beyond the one we have seen that is - at the highest offset. - -1 if we haven't come to a stack argument yet. */ - long highest_offset = -1; - int arg_size; - /* Number of ints of arguments that we have printed so far. */ - int args_printed = 0; - struct cleanup *old_chain, *list_chain; - struct ui_stream *stb; - - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); - - if (func) - { - b = SYMBOL_BLOCK_VALUE (func); - /* Function blocks are order sensitive, and thus should not be - hashed. */ - gdb_assert (BLOCK_HASHTABLE (b) == 0); - - ALL_BLOCK_SYMBOLS (b, i, sym) - { - QUIT; - - /* Keep track of the highest stack argument offset seen, and - skip over any kinds of symbols we don't care about. */ - - switch (SYMBOL_CLASS (sym)) - { - case LOC_ARG: - case LOC_REF_ARG: - { - long current_offset = SYMBOL_VALUE (sym); - arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); - - /* Compute address of next argument by adding the size of - this argument and rounding to an int boundary. */ - current_offset = - ((current_offset + arg_size + sizeof (int) - 1) - & ~(sizeof (int) - 1)); - - /* If this is the highest offset seen yet, set highest_offset. */ - if (highest_offset == -1 - || (current_offset > highest_offset)) - highest_offset = current_offset; - - /* Add the number of ints we're about to print to args_printed. */ - args_printed += (arg_size + sizeof (int) - 1) / sizeof (int); - } - - /* We care about types of symbols, but don't need to keep track of - stack offsets in them. */ - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_LOCAL_ARG: - case LOC_BASEREG_ARG: - case LOC_COMPUTED_ARG: - break; - - /* Other types of symbols we just skip over. */ - default: - continue; - } - - /* We have to look up the symbol because arguments can have - two entries (one a parameter, one a local) and the one we - want is the local, which lookup_symbol will find for us. - This includes gcc1 (not gcc2) on the sparc when passing a - small structure and gcc2 when the argument type is float - and it is passed as a double and converted to float by - the prologue (in the latter case the type of the LOC_ARG - symbol is double and the type of the LOC_LOCAL symbol is - float). */ - /* But if the parameter name is null, don't try it. - Null parameter names occur on the RS/6000, for traceback tables. - FIXME, should we even print them? */ - - if (*DEPRECATED_SYMBOL_NAME (sym)) - { - struct symbol *nsym; - nsym = lookup_symbol - (DEPRECATED_SYMBOL_NAME (sym), - b, VAR_DOMAIN, (int *) NULL, (struct symtab **) NULL); - if (SYMBOL_CLASS (nsym) == LOC_REGISTER) - { - /* There is a LOC_ARG/LOC_REGISTER pair. This means that - it was passed on the stack and loaded into a register, - or passed in a register and stored in a stack slot. - GDB 3.x used the LOC_ARG; GDB 4.0-4.11 used the LOC_REGISTER. - - Reasons for using the LOC_ARG: - (1) because find_saved_registers may be slow for remote - debugging, - (2) because registers are often re-used and stack slots - rarely (never?) are. Therefore using the stack slot is - much less likely to print garbage. - - Reasons why we might want to use the LOC_REGISTER: - (1) So that the backtrace prints the same value as - "print foo". I see no compelling reason why this needs - to be the case; having the backtrace print the value which - was passed in, and "print foo" print the value as modified - within the called function, makes perfect sense to me. - - Additional note: It might be nice if "info args" displayed - both values. - One more note: There is a case with sparc structure passing - where we need to use the LOC_REGISTER, but this is dealt with - by creating a single LOC_REGPARM in symbol reading. */ - - /* Leave sym (the LOC_ARG) alone. */ - ; - } - else - sym = nsym; - } - - /* Print the current arg. */ - if (!first) - ui_out_text (uiout, ", "); - ui_out_wrap_hint (uiout, " "); - - annotate_arg_begin (); - - list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (sym), - SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); - ui_out_field_stream (uiout, "name", stb); - annotate_arg_name_end (); - ui_out_text (uiout, "="); - - /* Avoid value_print because it will deref ref parameters. We just - want to print their addresses. Print ??? for args whose address - we do not know. We pass 2 as "recurse" to val_print because our - standard indentation here is 4 spaces, and val_print indents - 2 for each recurse. */ - val = read_var_value (sym, fi); - - annotate_arg_value (val == NULL ? NULL : VALUE_TYPE (val)); - - if (val) - { - val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, - VALUE_ADDRESS (val), - stb->stream, 0, 0, 2, Val_no_prettyprint); - ui_out_field_stream (uiout, "value", stb); - } - else - ui_out_text (uiout, "???"); - - /* Invoke ui_out_tuple_end. */ - do_cleanups (list_chain); - - annotate_arg_end (); - - first = 0; - } - } - - /* Don't print nameless args in situations where we don't know - enough about the stack to find them. */ - if (num != -1) - { - long start; - - if (highest_offset == -1) - start = FRAME_ARGS_SKIP; - else - start = highest_offset; - - print_frame_nameless_args (fi, start, num - args_printed, - first, stream); - } - do_cleanups (old_chain); -} - -/* Print nameless args on STREAM. - FI is the frameinfo for this frame, START is the offset - of the first nameless arg, and NUM is the number of nameless args to - print. FIRST is nonzero if this is the first argument (not just - the first nameless arg). */ - -static void -print_frame_nameless_args (struct frame_info *fi, long start, int num, - int first, struct ui_file *stream) -{ - int i; - CORE_ADDR argsaddr; - long arg_value; - - for (i = 0; i < num; i++) - { - QUIT; - argsaddr = get_frame_args_address (fi); - if (!argsaddr) - return; - arg_value = read_memory_integer (argsaddr + start, sizeof (int)); - if (!first) - fprintf_filtered (stream, ", "); - fprintf_filtered (stream, "%ld", arg_value); - first = 0; - start += sizeof (int); - } -} - /* ARGSUSED */ static void printf_command (char *arg, int from_tty) diff --git a/gdb/regcache.c b/gdb/regcache.c index 09b48f0..facaab3 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -82,7 +82,7 @@ struct regcache_descr struct type **register_type; }; -void +static void init_legacy_regcache_descr (struct gdbarch *gdbarch, struct regcache_descr *descr) { @@ -340,7 +340,7 @@ regcache_xfree (struct regcache *regcache) xfree (regcache); } -void +static void do_regcache_xfree (void *data) { regcache_xfree (data); @@ -1064,7 +1064,7 @@ typedef void (regcache_read_ftype) (struct regcache *regcache, int regnum, typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum, const void *buf); -void +static void regcache_xfer_part (struct regcache *regcache, int regnum, int offset, int len, void *in, const void *out, regcache_read_ftype *read, regcache_write_ftype *write) @@ -1267,41 +1267,16 @@ regcache_collect (int regnum, void *buf) /* read_pc, write_pc, read_sp, deprecated_read_fp, etc. Special handling for registers PC, SP, and FP. */ -/* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(), - read_pc_pid(), read_pc(), generic_target_write_pc(), - write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(), - generic_target_write_sp(), and deprecated_read_fp(), will - eventually be moved out of the reg-cache into either frame.[hc] or - to the multi-arch framework. The are not part of the raw register - cache. */ - -/* This routine is getting awfully cluttered with #if's. It's probably - time to turn this into READ_PC and define it in the tm.h file. - Ditto for write_pc. - - 1999-06-08: The following were re-written so that it assumes the - existence of a TARGET_READ_PC et.al. macro. A default generic - version of that macro is made available where needed. +/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc(), + read_sp(), and deprecated_read_fp(), will eventually be replaced by + per-frame methods. Instead of relying on the global INFERIOR_PTID, + they will use the contextual information provided by the FRAME. + These functions do not belong in the register cache. */ - Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled - by the multi-arch framework, it will eventually be possible to - eliminate the intermediate read_pc_pid(). The client would call - TARGET_READ_PC directly. (cagney). */ - -CORE_ADDR -generic_target_read_pc (ptid_t ptid) -{ -#ifdef PC_REGNUM - if (PC_REGNUM >= 0) - { - CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, ptid)); - return pc_val; - } -#endif - internal_error (__FILE__, __LINE__, - "generic_target_read_pc"); - return 0; -} +/* NOTE: cagney/2003-06-07: The functions generic_target_write_pc(), + write_pc_pid(), write_pc(), and deprecated_read_fp(), all need to + be replaced by something that does not rely on global state. But + what? */ CORE_ADDR read_pc_pid (ptid_t ptid) @@ -1313,7 +1288,17 @@ read_pc_pid (ptid_t ptid) saved_inferior_ptid = inferior_ptid; inferior_ptid = ptid; - pc_val = TARGET_READ_PC (ptid); + if (TARGET_READ_PC_P ()) + pc_val = TARGET_READ_PC (ptid); + /* Else use per-frame method on get_current_frame. */ + else if (PC_REGNUM >= 0) + { + CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid); + CORE_ADDR pc_val = ADDR_BITS_REMOVE (raw_val); + return pc_val; + } + else + internal_error (__FILE__, __LINE__, "read_pc_pid: Unable to find PC"); inferior_ptid = saved_inferior_ptid; return pc_val; @@ -1362,34 +1347,24 @@ write_pc (CORE_ADDR pc) /* Cope with strage ways of getting to the stack and frame pointers */ CORE_ADDR -generic_target_read_sp (void) -{ -#ifdef SP_REGNUM - if (SP_REGNUM >= 0) - return read_register (SP_REGNUM); -#endif - internal_error (__FILE__, __LINE__, - "generic_target_read_sp"); -} - -CORE_ADDR read_sp (void) { - return TARGET_READ_SP (); + if (TARGET_READ_SP_P ()) + return TARGET_READ_SP (); + else if (gdbarch_unwind_sp_p (current_gdbarch)) + return get_frame_sp (get_current_frame ()); + else if (SP_REGNUM >= 0) + /* Try SP_REGNUM last: this makes all sorts of [wrong] assumptions + about the architecture so put it at the end. */ + return read_register (SP_REGNUM); + internal_error (__FILE__, __LINE__, "read_sp: Unable to find SP"); } void -generic_target_write_sp (CORE_ADDR val) +deprecated_write_sp (CORE_ADDR val) { -#ifdef SP_REGNUM - if (SP_REGNUM >= 0) - { - write_register (SP_REGNUM, val); - return; - } -#endif - internal_error (__FILE__, __LINE__, - "generic_target_write_sp"); + gdb_assert (SP_REGNUM >= 0); + write_register (SP_REGNUM, val); } CORE_ADDR @@ -1692,6 +1667,8 @@ maintenance_print_register_groups (char *args, int from_tty) regcache_print (args, regcache_dump_groups); } +extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */ + void _initialize_regcache (void) { diff --git a/gdb/regformats/reg-ppc64.dat b/gdb/regformats/reg-ppc64.dat new file mode 100644 index 0000000..281432a --- /dev/null +++ b/gdb/regformats/reg-ppc64.dat @@ -0,0 +1,76 @@ +name:ppc64 +expedite:r1,pc +64:r0 +64:r1 +64:r2 +64:r3 +64:r4 +64:r5 +64:r6 +64:r7 +64:r8 +64:r9 +64:r10 +64:r11 +64:r12 +64:r13 +64:r14 +64:r15 +64:r16 +64:r17 +64:r18 +64:r19 +64:r20 +64:r21 +64:r22 +64:r23 +64:r24 +64:r25 +64:r26 +64:r27 +64:r28 +64:r29 +64:r30 +64:r31 + +64:f0 +64:f1 +64:f2 +64:f3 +64:f4 +64:f5 +64:f6 +64:f7 +64:f8 +64:f9 +64:f10 +64:f11 +64:f12 +64:f13 +64:f14 +64:f15 +64:f16 +64:f17 +64:f18 +64:f19 +64:f20 +64:f21 +64:f22 +64:f23 +64:f24 +64:f25 +64:f26 +64:f27 +64:f28 +64:f29 +64:f30 +64:f31 + +64:pc +64:ps + +32:cr +64:lr +64:ctr +32:xer +32:fpscr diff --git a/gdb/reggroups.c b/gdb/reggroups.c index b72140e..ea9a9ec 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -245,6 +245,8 @@ struct reggroup *const all_reggroup = &all_group; struct reggroup *const save_reggroup = &save_group; struct reggroup *const restore_reggroup = &restore_group; +extern initialize_file_ftype _initialize_reggroup; /* -Wmissing-prototypes */ + void _initialize_reggroup (void) { diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 643c6b6..94985fe 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -781,7 +781,7 @@ gbyte (void) return (high << 4) + low; } -void +static void fetch_regs_from_dump (int (*nextchar) (), char *want) { int regno; @@ -1873,7 +1873,7 @@ why_stop (void) /* Suck characters, if a string match, then return the strings index otherwise echo them. */ -int +static int expect_n (char **strings) { char *(ptr[10]); @@ -2165,6 +2165,8 @@ target e7000 foobar"; e7000_ops.to_magic = OPS_MAGIC; }; +extern initialize_file_ftype _initialize_remote_e7000; /* -Wmissing-prototypes */ + void _initialize_remote_e7000 (void) { diff --git a/gdb/remote-est.c b/gdb/remote-est.c index 93eddc9..a2c0f7c 100644 --- a/gdb/remote-est.c +++ b/gdb/remote-est.c @@ -168,6 +168,8 @@ est_open (char *args, int from_tty) monitor_open (args, &est_cmds, from_tty); } +extern initialize_file_ftype _initialize_est; /* -Wmissing-prototypes */ + void _initialize_est (void) { diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c new file mode 100644 index 0000000..fd57617 --- /dev/null +++ b/gdb/remote-fileio.c @@ -0,0 +1,1379 @@ +/* Remote File-I/O communications + + Copyright 2003 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. */ + +/* See the GDB User Guide for details of the GDB remote protocol. */ + +#include "defs.h" +#include "gdb_string.h" +#include "gdbcmd.h" +#include "remote.h" +#include "gdb/fileio.h" +#include "gdb_wait.h" +#include "gdb_stat.h" +#include "remote-fileio.h" + +#include +#include +#ifdef __CYGWIN__ +#include /* For cygwin_conv_to_full_posix_path. */ +#endif +#include + +static struct { + int *fd_map; + int fd_map_size; +} remote_fio_data; + +#define FIO_FD_INVALID -1 +#define FIO_FD_CONSOLE_IN -2 +#define FIO_FD_CONSOLE_OUT -3 + +static int remote_fio_system_call_allowed = 0; + +static int +remote_fileio_init_fd_map (void) +{ + int i; + + if (!remote_fio_data.fd_map) + { + remote_fio_data.fd_map = (int *) xmalloc (10 * sizeof (int)); + remote_fio_data.fd_map_size = 10; + remote_fio_data.fd_map[0] = FIO_FD_CONSOLE_IN; + remote_fio_data.fd_map[1] = FIO_FD_CONSOLE_OUT; + remote_fio_data.fd_map[2] = FIO_FD_CONSOLE_OUT; + for (i = 3; i < 10; ++i) + remote_fio_data.fd_map[i] = FIO_FD_INVALID; + } + return 3; +} + +static int +remote_fileio_resize_fd_map (void) +{ + if (!remote_fio_data.fd_map) + return remote_fileio_init_fd_map (); + remote_fio_data.fd_map_size += 10; + remote_fio_data.fd_map = + (int *) xrealloc (remote_fio_data.fd_map, + remote_fio_data.fd_map_size * sizeof (int)); + return remote_fio_data.fd_map_size - 10; +} + +static int +remote_fileio_next_free_fd (void) +{ + int i; + + for (i = 0; i < remote_fio_data.fd_map_size; ++i) + if (remote_fio_data.fd_map[i] == FIO_FD_INVALID) + return i; + return remote_fileio_resize_fd_map (); +} + +static int +remote_fileio_fd_to_targetfd (int fd) +{ + int target_fd = remote_fileio_next_free_fd (); + remote_fio_data.fd_map[target_fd] = fd; + return target_fd; +} + +static int +remote_fileio_map_fd (int target_fd) +{ + remote_fileio_init_fd_map (); + if (target_fd < 0 || target_fd >= remote_fio_data.fd_map_size) + return FIO_FD_INVALID; + return remote_fio_data.fd_map[target_fd]; +} + +static void +remote_fileio_close_target_fd (int target_fd) +{ + remote_fileio_init_fd_map (); + if (target_fd >= 0 && target_fd < remote_fio_data.fd_map_size) + remote_fio_data.fd_map[target_fd] = FIO_FD_INVALID; +} + +static int +remote_fileio_oflags_to_host (long flags) +{ + int hflags = 0; + + if (flags & FILEIO_O_CREAT) + hflags |= O_CREAT; + if (flags & FILEIO_O_EXCL) + hflags |= O_EXCL; + if (flags & FILEIO_O_TRUNC) + hflags |= O_TRUNC; + if (flags & FILEIO_O_APPEND) + hflags |= O_APPEND; + if (flags & FILEIO_O_RDONLY) + hflags |= O_RDONLY; + if (flags & FILEIO_O_WRONLY) + hflags |= O_WRONLY; + if (flags & FILEIO_O_RDWR) + hflags |= O_RDWR; +/* On systems supporting binary and text mode, always open files in + binary mode. */ +#ifdef O_BINARY + hflags |= O_BINARY; +#endif + return hflags; +} + +static mode_t +remote_fileio_mode_to_host (long mode, int open_call) +{ + mode_t hmode = 0; + + if (!open_call) + { + if (mode & FILEIO_S_IFREG) + hmode |= S_IFREG; + if (mode & FILEIO_S_IFDIR) + hmode |= S_IFDIR; + if (mode & FILEIO_S_IFCHR) + hmode |= S_IFCHR; + } + if (mode & FILEIO_S_IRUSR) + hmode |= S_IRUSR; + if (mode & FILEIO_S_IWUSR) + hmode |= S_IWUSR; + if (mode & FILEIO_S_IXUSR) + hmode |= S_IXUSR; + if (mode & FILEIO_S_IRGRP) + hmode |= S_IRGRP; + if (mode & FILEIO_S_IWGRP) + hmode |= S_IWGRP; + if (mode & FILEIO_S_IXGRP) + hmode |= S_IXGRP; + if (mode & FILEIO_S_IROTH) + hmode |= S_IROTH; + if (mode & FILEIO_S_IWOTH) + hmode |= S_IWOTH; + if (mode & FILEIO_S_IXOTH) + hmode |= S_IXOTH; + return hmode; +} + +static LONGEST +remote_fileio_mode_to_target (mode_t mode) +{ + mode_t tmode = 0; + + if (mode & S_IFREG) + tmode |= FILEIO_S_IFREG; + if (mode & S_IFDIR) + tmode |= FILEIO_S_IFDIR; + if (mode & S_IFCHR) + tmode |= FILEIO_S_IFCHR; + if (mode & S_IRUSR) + tmode |= FILEIO_S_IRUSR; + if (mode & S_IWUSR) + tmode |= FILEIO_S_IWUSR; + if (mode & S_IXUSR) + tmode |= FILEIO_S_IXUSR; + if (mode & S_IRGRP) + tmode |= FILEIO_S_IRGRP; + if (mode & S_IWGRP) + tmode |= FILEIO_S_IWGRP; + if (mode & S_IXGRP) + tmode |= FILEIO_S_IXGRP; + if (mode & S_IROTH) + tmode |= FILEIO_S_IROTH; + if (mode & S_IWOTH) + tmode |= FILEIO_S_IWOTH; + if (mode & S_IXOTH) + tmode |= FILEIO_S_IXOTH; + return tmode; +} + +static int +remote_fileio_errno_to_target (int error) +{ + switch (error) + { + case EPERM: + return FILEIO_EPERM; + case ENOENT: + return FILEIO_ENOENT; + case EINTR: + return FILEIO_EINTR; + case EIO: + return FILEIO_EIO; + case EBADF: + return FILEIO_EBADF; + case EACCES: + return FILEIO_EACCES; + case EFAULT: + return FILEIO_EFAULT; + case EBUSY: + return FILEIO_EBUSY; + case EEXIST: + return FILEIO_EEXIST; + case ENODEV: + return FILEIO_ENODEV; + case ENOTDIR: + return FILEIO_ENOTDIR; + case EISDIR: + return FILEIO_EISDIR; + case EINVAL: + return FILEIO_EINVAL; + case ENFILE: + return FILEIO_ENFILE; + case EMFILE: + return FILEIO_EMFILE; + case EFBIG: + return FILEIO_EFBIG; + case ENOSPC: + return FILEIO_ENOSPC; + case ESPIPE: + return FILEIO_ESPIPE; + case EROFS: + return FILEIO_EROFS; + case ENOSYS: + return FILEIO_ENOSYS; + case ENAMETOOLONG: + return FILEIO_ENAMETOOLONG; + } + return FILEIO_EUNKNOWN; +} + +static int +remote_fileio_seek_flag_to_host (long num, int *flag) +{ + if (!flag) + return 0; + switch (num) + { + case FILEIO_SEEK_SET: + *flag = SEEK_SET; + break; + case FILEIO_SEEK_CUR: + *flag = SEEK_CUR; + break; + case FILEIO_SEEK_END: + *flag = SEEK_END; + break; + default: + return -1; + } + return 0; +} + +static int +remote_fileio_extract_long (char **buf, LONGEST *retlong) +{ + char *c; + int sign = 1; + + if (!buf || !*buf || !**buf || !retlong) + return -1; + c = strchr (*buf, ','); + if (c) + *c++ = '\0'; + else + c = strchr (*buf, '\0'); + while (strchr ("+-", **buf)) + { + if (**buf == '-') + sign = -sign; + ++*buf; + } + for (*retlong = 0; **buf; ++*buf) + { + *retlong <<= 4; + if (**buf >= '0' && **buf <= '9') + *retlong += **buf - '0'; + else if (**buf >= 'a' && **buf <= 'f') + *retlong += **buf - 'a' + 10; + else if (**buf >= 'A' && **buf <= 'F') + *retlong += **buf - 'A' + 10; + else + return -1; + } + *retlong *= sign; + *buf = c; + return 0; +} + +static int +remote_fileio_extract_int (char **buf, long *retint) +{ + int ret; + LONGEST retlong; + + if (!retint) + return -1; + ret = remote_fileio_extract_long (buf, &retlong); + if (!ret) + *retint = (long) retlong; + return ret; +} + +static int +remote_fileio_extract_ptr_w_len (char **buf, CORE_ADDR *ptrval, int *length) +{ + char *c; + LONGEST retlong; + + if (!buf || !*buf || !**buf || !ptrval || !length) + return -1; + c = strchr (*buf, '/'); + if (!c) + return -1; + *c++ = '\0'; + if (remote_fileio_extract_long (buf, &retlong)) + return -1; + *ptrval = (CORE_ADDR) retlong; + *buf = c; + if (remote_fileio_extract_long (buf, &retlong)) + return -1; + *length = (int) retlong; + return 0; +} + +/* Convert to big endian */ +static void +remote_fileio_to_be (LONGEST num, char *buf, int bytes) +{ + int i; + + for (i = 0; i < bytes; ++i) + buf[i] = (num >> (8 * (bytes - i - 1))) & 0xff; +} + +static void +remote_fileio_to_fio_int (long num, fio_int_t fnum) +{ + remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4); +} + +static void +remote_fileio_to_fio_uint (long num, fio_uint_t fnum) +{ + remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4); +} + +static void +remote_fileio_to_fio_mode (mode_t num, fio_mode_t fnum) +{ + remote_fileio_to_be (remote_fileio_mode_to_target(num), (char *) fnum, 4); +} + +static void +remote_fileio_to_fio_time (time_t num, fio_time_t fnum) +{ + remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4); +} + +static void +remote_fileio_to_fio_long (LONGEST num, fio_long_t fnum) +{ + remote_fileio_to_be (num, (char *) fnum, 8); +} + +static void +remote_fileio_to_fio_ulong (LONGEST num, fio_ulong_t fnum) +{ + remote_fileio_to_be (num, (char *) fnum, 8); +} + +static void +remote_fileio_to_fio_stat (struct stat *st, struct fio_stat *fst) +{ + /* `st_dev' is set in the calling function */ + remote_fileio_to_fio_uint ((long) st->st_ino, fst->fst_ino); + remote_fileio_to_fio_mode (st->st_mode, fst->fst_mode); + remote_fileio_to_fio_uint ((long) st->st_nlink, fst->fst_nlink); + remote_fileio_to_fio_uint ((long) st->st_uid, fst->fst_uid); + remote_fileio_to_fio_uint ((long) st->st_gid, fst->fst_gid); + remote_fileio_to_fio_uint ((long) st->st_rdev, fst->fst_rdev); + remote_fileio_to_fio_ulong ((LONGEST) st->st_size, fst->fst_size); + remote_fileio_to_fio_ulong ((LONGEST) st->st_blksize, fst->fst_blksize); + remote_fileio_to_fio_ulong ((LONGEST) st->st_blocks, fst->fst_blocks); + remote_fileio_to_fio_time (st->st_atime, fst->fst_atime); + remote_fileio_to_fio_time (st->st_mtime, fst->fst_mtime); + remote_fileio_to_fio_time (st->st_ctime, fst->fst_ctime); +} + +static void +remote_fileio_to_fio_timeval (struct timeval *tv, struct fio_timeval *ftv) +{ + remote_fileio_to_fio_time (tv->tv_sec, ftv->ftv_sec); + remote_fileio_to_fio_long (tv->tv_usec, ftv->ftv_usec); +} + +static int remote_fio_ctrl_c_flag = 0; +static int remote_fio_no_longjmp = 0; + +#if defined (HAVE_SIGACTION) && defined (SA_RESTART) +static struct sigaction remote_fio_sa; +static struct sigaction remote_fio_osa; +#else +static void (*remote_fio_ofunc)(int); +#endif + +static void +remote_fileio_sig_init (void) +{ +#if defined (HAVE_SIGACTION) && defined (SA_RESTART) + remote_fio_sa.sa_handler = SIG_IGN; + sigemptyset (&remote_fio_sa.sa_mask); + remote_fio_sa.sa_flags = 0; + sigaction (SIGINT, &remote_fio_sa, &remote_fio_osa); +#else + remote_fio_ofunc = signal (SIGINT, SIG_IGN); +#endif +} + +static void +remote_fileio_sig_set (void (*sigint_func)(int)) +{ +#if defined (HAVE_SIGACTION) && defined (SA_RESTART) + remote_fio_sa.sa_handler = sigint_func; + sigemptyset (&remote_fio_sa.sa_mask); + remote_fio_sa.sa_flags = 0; + sigaction (SIGINT, &remote_fio_sa, NULL); +#else + signal (SIGINT, sigint_func); +#endif +} + +static void +remote_fileio_sig_exit (void) +{ +#if defined (HAVE_SIGACTION) && defined (SA_RESTART) + sigaction (SIGINT, &remote_fio_osa, NULL); +#else + signal (SIGINT, remote_fio_ofunc); +#endif +} + +static void +remote_fileio_ctrl_c_signal_handler (int signo) +{ + remote_fileio_sig_set (SIG_IGN); + remote_fio_ctrl_c_flag = 1; + if (!remote_fio_no_longjmp) + throw_exception (RETURN_QUIT); + remote_fileio_sig_set (remote_fileio_ctrl_c_signal_handler); +} + +static void +remote_fileio_reply (int retcode, int error) +{ + char buf[32]; + + remote_fileio_sig_set (SIG_IGN); + strcpy (buf, "F"); + if (retcode < 0) + { + strcat (buf, "-"); + retcode = -retcode; + } + sprintf (buf + strlen (buf), "%x", retcode); + if (error || remote_fio_ctrl_c_flag) + { + if (error && remote_fio_ctrl_c_flag) + error = FILEIO_EINTR; + if (error < 0) + { + strcat (buf, "-"); + error = -error; + } + sprintf (buf + strlen (buf), ",%x", error); + if (remote_fio_ctrl_c_flag) + strcat (buf, ",C"); + } + remote_fileio_sig_set (remote_fileio_ctrl_c_signal_handler); + putpkt (buf); +} + +static void +remote_fileio_ioerror (void) +{ + remote_fileio_reply (-1, FILEIO_EIO); +} + +static void +remote_fileio_badfd (void) +{ + remote_fileio_reply (-1, FILEIO_EBADF); +} + +static void +remote_fileio_return_errno (int retcode) +{ + remote_fileio_reply (retcode, + retcode < 0 ? remote_fileio_errno_to_target (errno) : 0); +} + +static void +remote_fileio_return_success (int retcode) +{ + remote_fileio_reply (retcode, 0); +} + +/* Wrapper function for remote_write_bytes() which has the disadvantage to + write only one packet, regardless of the requested number of bytes to + transfer. This wrapper calls remote_write_bytes() as often as needed. */ +static int +remote_fileio_write_bytes (CORE_ADDR memaddr, char *myaddr, int len) +{ + int ret = 0, written; + + while (len > 0 && (written = remote_write_bytes (memaddr, myaddr, len)) > 0) + { + len -= written; + memaddr += written; + myaddr += written; + ret += written; + } + return ret; +} + +static void +remote_fileio_func_open (char *buf) +{ + CORE_ADDR ptrval; + int length, retlength; + long num; + int flags, fd; + mode_t mode; + char *pathname; + struct stat st; + + /* 1. Parameter: Ptr to pathname / length incl. trailing zero */ + if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length)) + { + remote_fileio_ioerror (); + return; + } + /* 2. Parameter: open flags */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + flags = remote_fileio_oflags_to_host (num); + /* 3. Parameter: open mode */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + mode = remote_fileio_mode_to_host (num, 1); + + /* Request pathname using 'm' packet */ + pathname = alloca (length); + retlength = remote_read_bytes (ptrval, pathname, length); + if (retlength != length) + { + remote_fileio_ioerror (); + return; + } + + /* Check if pathname exists and is not a regular file or directory. If so, + return an appropriate error code. Same for trying to open directories + for writing. */ + if (!stat (pathname, &st)) + { + if (!S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode)) + { + remote_fileio_reply (-1, FILEIO_ENODEV); + return; + } + if (S_ISDIR (st.st_mode) + && ((flags & O_WRONLY) == O_WRONLY || (flags & O_RDWR) == O_RDWR)) + { + remote_fileio_reply (-1, FILEIO_EISDIR); + return; + } + } + + remote_fio_no_longjmp = 1; + fd = open (pathname, flags, mode); + if (fd < 0) + { + remote_fileio_return_errno (-1); + return; + } + + fd = remote_fileio_fd_to_targetfd (fd); + remote_fileio_return_success (fd); +} + +static void +remote_fileio_func_close (char *buf) +{ + long num; + int fd; + + /* Parameter: file descriptor */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + fd = remote_fileio_map_fd ((int) num); + if (fd == FIO_FD_INVALID) + { + remote_fileio_badfd (); + return; + } + + remote_fio_no_longjmp = 1; + if (fd != FIO_FD_CONSOLE_IN && fd != FIO_FD_CONSOLE_OUT && close (fd)) + remote_fileio_return_errno (-1); + remote_fileio_close_target_fd ((int) num); + remote_fileio_return_success (0); +} + +static void +remote_fileio_func_read (char *buf) +{ + long target_fd, num; + LONGEST lnum; + CORE_ADDR ptrval; + int fd, ret, retlength; + char *buffer; + size_t length; + off_t old_offset, new_offset; + + /* 1. Parameter: file descriptor */ + if (remote_fileio_extract_int (&buf, &target_fd)) + { + remote_fileio_ioerror (); + return; + } + fd = remote_fileio_map_fd ((int) target_fd); + if (fd == FIO_FD_INVALID) + { + remote_fileio_badfd (); + return; + } + /* 2. Parameter: buffer pointer */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + ptrval = (CORE_ADDR) lnum; + /* 3. Parameter: buffer length */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + length = (size_t) num; + + switch (fd) + { + case FIO_FD_CONSOLE_OUT: + remote_fileio_badfd (); + return; + case FIO_FD_CONSOLE_IN: + { + static char *remaining_buf = NULL; + static int remaining_length = 0; + + buffer = (char *) xmalloc (32768); + if (remaining_buf) + { + remote_fio_no_longjmp = 1; + if (remaining_length > length) + { + memcpy (buffer, remaining_buf, length); + memmove (remaining_buf, remaining_buf + length, + remaining_length - length); + remaining_length -= length; + ret = length; + } + else + { + memcpy (buffer, remaining_buf, remaining_length); + xfree (remaining_buf); + remaining_buf = NULL; + ret = remaining_length; + } + } + else + { + ret = ui_file_read (gdb_stdtargin, buffer, 32767); + remote_fio_no_longjmp = 1; + if (ret > 0 && (size_t)ret > length) + { + remaining_buf = (char *) xmalloc (ret - length); + remaining_length = ret - length; + memcpy (remaining_buf, buffer + length, remaining_length); + ret = length; + } + } + } + break; + default: + buffer = (char *) xmalloc (length); + /* POSIX defines EINTR behaviour of read in a weird way. It's allowed + for read() to return -1 even if "some" bytes have been read. It + has been corrected in SUSv2 but that doesn't help us much... + Therefore a complete solution must check how many bytes have been + read on EINTR to return a more reliable value to the target */ + old_offset = lseek (fd, 0, SEEK_CUR); + remote_fio_no_longjmp = 1; + ret = read (fd, buffer, length); + if (ret < 0 && errno == EINTR) + { + new_offset = lseek (fd, 0, SEEK_CUR); + /* If some data has been read, return the number of bytes read. + The Ctrl-C flag is set in remote_fileio_reply() anyway */ + if (old_offset != new_offset) + ret = new_offset - old_offset; + } + break; + } + + if (ret > 0) + { + retlength = remote_fileio_write_bytes (ptrval, buffer, ret); + if (retlength != ret) + ret = -1; /* errno has been set to EIO in remote_fileio_write_bytes() */ + } + + if (ret < 0) + remote_fileio_return_errno (-1); + else + remote_fileio_return_success (ret); + + xfree (buffer); +} + +static void +remote_fileio_func_write (char *buf) +{ + long target_fd, num; + LONGEST lnum; + CORE_ADDR ptrval; + int fd, ret, retlength; + char *buffer; + size_t length; + + /* 1. Parameter: file descriptor */ + if (remote_fileio_extract_int (&buf, &target_fd)) + { + remote_fileio_ioerror (); + return; + } + fd = remote_fileio_map_fd ((int) target_fd); + if (fd == FIO_FD_INVALID) + { + remote_fileio_badfd (); + return; + } + /* 2. Parameter: buffer pointer */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + ptrval = (CORE_ADDR) lnum; + /* 3. Parameter: buffer length */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + length = (size_t) num; + + buffer = (char *) xmalloc (length); + retlength = remote_read_bytes (ptrval, buffer, length); + if (retlength != length) + { + xfree (buffer); + remote_fileio_ioerror (); + return; + } + + remote_fio_no_longjmp = 1; + switch (fd) + { + case FIO_FD_CONSOLE_IN: + remote_fileio_badfd (); + return; + case FIO_FD_CONSOLE_OUT: + ui_file_write (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr, buffer, + length); + gdb_flush (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr); + ret = length; + break; + default: + ret = write (fd, buffer, length); + if (ret < 0 && errno == EACCES) + errno = EBADF; /* Cygwin returns EACCESS when writing to a R/O file.*/ + break; + } + + if (ret < 0) + remote_fileio_return_errno (-1); + else + remote_fileio_return_success (ret); + + xfree (buffer); +} + +static void +remote_fileio_func_lseek (char *buf) +{ + long num; + LONGEST lnum; + int fd, flag; + off_t offset, ret; + + /* 1. Parameter: file descriptor */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + fd = remote_fileio_map_fd ((int) num); + if (fd == FIO_FD_INVALID) + { + remote_fileio_badfd (); + return; + } + else if (fd == FIO_FD_CONSOLE_IN || fd == FIO_FD_CONSOLE_OUT) + { + remote_fileio_reply (-1, FILEIO_ESPIPE); + return; + } + + /* 2. Parameter: offset */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + offset = (off_t) lnum; + /* 3. Parameter: flag */ + if (remote_fileio_extract_int (&buf, &num)) + { + remote_fileio_ioerror (); + return; + } + if (remote_fileio_seek_flag_to_host (num, &flag)) + { + remote_fileio_reply (-1, FILEIO_EINVAL); + return; + } + + remote_fio_no_longjmp = 1; + ret = lseek (fd, offset, flag); + + if (ret == (off_t) -1) + remote_fileio_return_errno (-1); + else + remote_fileio_return_success (ret); +} + +static void +remote_fileio_func_rename (char *buf) +{ + CORE_ADDR ptrval; + int length, retlength; + char *oldpath, *newpath; + int ret, of, nf; + struct stat ost, nst; + + /* 1. Parameter: Ptr to oldpath / length incl. trailing zero */ + if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length)) + { + remote_fileio_ioerror (); + return; + } + /* Request oldpath using 'm' packet */ + oldpath = alloca (length); + retlength = remote_read_bytes (ptrval, oldpath, length); + if (retlength != length) + { + remote_fileio_ioerror (); + return; + } + /* 2. Parameter: Ptr to newpath / length incl. trailing zero */ + if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length)) + { + remote_fileio_ioerror (); + return; + } + /* Request newpath using 'm' packet */ + newpath = alloca (length); + retlength = remote_read_bytes (ptrval, newpath, length); + if (retlength != length) + { + remote_fileio_ioerror (); + return; + } + + /* Only operate on regular files and directories */ + of = stat (oldpath, &ost); + nf = stat (newpath, &nst); + if ((!of && !S_ISREG (ost.st_mode) && !S_ISDIR (ost.st_mode)) + || (!nf && !S_ISREG (nst.st_mode) && !S_ISDIR (nst.st_mode))) + { + remote_fileio_reply (-1, FILEIO_EACCES); + return; + } + + remote_fio_no_longjmp = 1; + ret = rename (oldpath, newpath); + + if (ret == -1) + { + /* Special case: newpath is a non-empty directory. Some systems + return ENOTEMPTY, some return EEXIST. We coerce that to be + always EEXIST. */ + if (errno == ENOTEMPTY) + errno = EEXIST; +#ifdef __CYGWIN__ + /* Workaround some Cygwin problems with correct errnos. */ + if (errno == EACCES) + { + if (!of && !nf && S_ISDIR (nst.st_mode)) + { + if (S_ISREG (ost.st_mode)) + errno = EISDIR; + else + { + char oldfullpath[PATH_MAX + 1]; + char newfullpath[PATH_MAX + 1]; + int len; + + cygwin_conv_to_full_posix_path (oldpath, oldfullpath); + cygwin_conv_to_full_posix_path (newpath, newfullpath); + len = strlen (oldfullpath); + if (newfullpath[len] == '/' + && !strncmp (oldfullpath, newfullpath, len)) + errno = EINVAL; + else + errno = EEXIST; + } + } + } +#endif + + remote_fileio_return_errno (-1); + } + else + remote_fileio_return_success (ret); +} + +static void +remote_fileio_func_unlink (char *buf) +{ + CORE_ADDR ptrval; + int length, retlength; + char *pathname; + int ret; + struct stat st; + + /* Parameter: Ptr to pathname / length incl. trailing zero */ + if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length)) + { + remote_fileio_ioerror (); + return; + } + /* Request pathname using 'm' packet */ + pathname = alloca (length); + retlength = remote_read_bytes (ptrval, pathname, length); + if (retlength != length) + { + remote_fileio_ioerror (); + return; + } + + /* Only operate on regular files (and directories, which allows to return + the correct return code) */ + if (!stat (pathname, &st) && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode)) + { + remote_fileio_reply (-1, FILEIO_ENODEV); + return; + } + + remote_fio_no_longjmp = 1; + ret = unlink (pathname); + + if (ret == -1) + remote_fileio_return_errno (-1); + else + remote_fileio_return_success (ret); +} + +static void +remote_fileio_func_stat (char *buf) +{ + CORE_ADDR ptrval; + int ret, length, retlength; + char *pathname; + LONGEST lnum; + struct stat st; + struct fio_stat fst; + + /* 1. Parameter: Ptr to pathname / length incl. trailing zero */ + if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length)) + { + remote_fileio_ioerror (); + return; + } + /* Request pathname using 'm' packet */ + pathname = alloca (length); + retlength = remote_read_bytes (ptrval, pathname, length); + if (retlength != length) + { + remote_fileio_ioerror (); + return; + } + + /* 2. Parameter: Ptr to struct stat */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + ptrval = (CORE_ADDR) lnum; + + remote_fio_no_longjmp = 1; + ret = stat (pathname, &st); + + if (ret == -1) + { + remote_fileio_return_errno (-1); + return; + } + /* Only operate on regular files and directories */ + if (!ret && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode)) + { + remote_fileio_reply (-1, FILEIO_EACCES); + return; + } + if (ptrval) + { + remote_fileio_to_fio_stat (&st, &fst); + remote_fileio_to_fio_uint (0, fst.fst_dev); + + retlength = remote_fileio_write_bytes (ptrval, (char *) &fst, sizeof fst); + if (retlength != sizeof fst) + { + remote_fileio_return_errno (-1); + return; + } + } + remote_fileio_return_success (ret); +} + +static void +remote_fileio_func_fstat (char *buf) +{ + CORE_ADDR ptrval; + int fd, ret, retlength; + long target_fd; + LONGEST lnum; + struct stat st; + struct fio_stat fst; + struct timeval tv; + + /* 1. Parameter: file descriptor */ + if (remote_fileio_extract_int (&buf, &target_fd)) + { + remote_fileio_ioerror (); + return; + } + fd = remote_fileio_map_fd ((int) target_fd); + if (fd == FIO_FD_INVALID) + { + remote_fileio_badfd (); + return; + } + /* 2. Parameter: Ptr to struct stat */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + ptrval = (CORE_ADDR) lnum; + + remote_fio_no_longjmp = 1; + if (fd == FIO_FD_CONSOLE_IN || fd == FIO_FD_CONSOLE_OUT) + { + remote_fileio_to_fio_uint (1, fst.fst_dev); + st.st_mode = S_IFCHR | (fd == FIO_FD_CONSOLE_IN ? S_IRUSR : S_IWUSR); + st.st_nlink = 1; + st.st_uid = getuid (); + st.st_gid = getgid (); + st.st_rdev = 0; + st.st_size = 0; + st.st_blksize = 512; + st.st_blocks = 0; + if (!gettimeofday (&tv, NULL)) + st.st_atime = st.st_mtime = st.st_ctime = tv.tv_sec; + else + st.st_atime = st.st_mtime = st.st_ctime = (time_t) 0; + ret = 0; + } + else + ret = fstat (fd, &st); + + if (ret == -1) + { + remote_fileio_return_errno (-1); + return; + } + if (ptrval) + { + remote_fileio_to_fio_stat (&st, &fst); + + retlength = remote_fileio_write_bytes (ptrval, (char *) &fst, sizeof fst); + if (retlength != sizeof fst) + { + remote_fileio_return_errno (-1); + return; + } + } + remote_fileio_return_success (ret); +} + +static void +remote_fileio_func_gettimeofday (char *buf) +{ + LONGEST lnum; + CORE_ADDR ptrval; + int ret, retlength; + struct timeval tv; + struct fio_timeval ftv; + + /* 1. Parameter: struct timeval pointer */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + ptrval = (CORE_ADDR) lnum; + /* 2. Parameter: some pointer value... */ + if (remote_fileio_extract_long (&buf, &lnum)) + { + remote_fileio_ioerror (); + return; + } + /* ...which has to be NULL */ + if (lnum) + { + remote_fileio_reply (-1, FILEIO_EINVAL); + return; + } + + remote_fio_no_longjmp = 1; + ret = gettimeofday (&tv, NULL); + + if (ret == -1) + { + remote_fileio_return_errno (-1); + return; + } + + if (ptrval) + { + remote_fileio_to_fio_timeval (&tv, &ftv); + + retlength = remote_fileio_write_bytes (ptrval, (char *) &ftv, sizeof ftv); + if (retlength != sizeof ftv) + { + remote_fileio_return_errno (-1); + return; + } + } + remote_fileio_return_success (ret); +} + +static void +remote_fileio_func_isatty (char *buf) +{ + long target_fd; + int fd; + + /* Parameter: file descriptor */ + if (remote_fileio_extract_int (&buf, &target_fd)) + { + remote_fileio_ioerror (); + return; + } + remote_fio_no_longjmp = 1; + fd = remote_fileio_map_fd ((int) target_fd); + remote_fileio_return_success (fd == FIO_FD_CONSOLE_IN || + fd == FIO_FD_CONSOLE_OUT ? 1 : 0); +} + +static void +remote_fileio_func_system (char *buf) +{ + CORE_ADDR ptrval; + int ret, length, retlength; + char *cmdline; + + /* Check if system(3) has been explicitely allowed using the + `set remote system-call-allowed 1' command. If not, return + EPERM */ + if (!remote_fio_system_call_allowed) + { + remote_fileio_reply (-1, FILEIO_EPERM); + return; + } + + /* Parameter: Ptr to commandline / length incl. trailing zero */ + if (remote_fileio_extract_ptr_w_len (&buf, &ptrval, &length)) + { + remote_fileio_ioerror (); + return; + } + /* Request commandline using 'm' packet */ + cmdline = alloca (length); + retlength = remote_read_bytes (ptrval, cmdline, length); + if (retlength != length) + { + remote_fileio_ioerror (); + return; + } + + remote_fio_no_longjmp = 1; + ret = system (cmdline); + + if (ret == -1) + remote_fileio_return_errno (-1); + else + remote_fileio_return_success (WEXITSTATUS (ret)); +} + +static struct { + char *name; + void (*func)(char *); +} remote_fio_func_map[] = { + "open", remote_fileio_func_open, + "close", remote_fileio_func_close, + "read", remote_fileio_func_read, + "write", remote_fileio_func_write, + "lseek", remote_fileio_func_lseek, + "rename", remote_fileio_func_rename, + "unlink", remote_fileio_func_unlink, + "stat", remote_fileio_func_stat, + "fstat", remote_fileio_func_fstat, + "gettimeofday", remote_fileio_func_gettimeofday, + "isatty", remote_fileio_func_isatty, + "system", remote_fileio_func_system, + NULL, NULL +}; + +static int +do_remote_fileio_request (struct ui_out *uiout, void *buf_arg) +{ + char *buf = buf_arg; + char *c; + int idx; + + remote_fileio_sig_set (remote_fileio_ctrl_c_signal_handler); + + c = strchr (++buf, ','); + if (c) + *c++ = '\0'; + else + c = strchr (buf, '\0'); + for (idx = 0; remote_fio_func_map[idx].name; ++idx) + if (!strcmp (remote_fio_func_map[idx].name, buf)) + break; + if (!remote_fio_func_map[idx].name) /* ERROR: No such function. */ + return RETURN_ERROR; + remote_fio_func_map[idx].func (c); + return 0; +} + +void +remote_fileio_request (char *buf) +{ + int ex; + + remote_fileio_sig_init (); + + remote_fio_ctrl_c_flag = 0; + remote_fio_no_longjmp = 0; + + ex = catch_exceptions (uiout, do_remote_fileio_request, (void *)buf, + NULL, RETURN_MASK_ALL); + switch (ex) + { + case RETURN_ERROR: + remote_fileio_reply (-1, FILEIO_ENOSYS); + break; + case RETURN_QUIT: + remote_fileio_reply (-1, FILEIO_EINTR); + break; + default: + break; + } + + remote_fileio_sig_exit (); +} + +static void +set_system_call_allowed (char *args, int from_tty) +{ + if (args) + { + char *arg_end; + int val = strtoul (args, &arg_end, 10); + if (*args && *arg_end == '\0') + { + remote_fio_system_call_allowed = !!val; + return; + } + } + error ("Illegal argument for \"set remote system-call-allowed\" command"); +} + +static void +show_system_call_allowed (char *args, int from_tty) +{ + if (args) + error ("Garbage after \"show remote system-call-allowed\" command: `%s'", args); + printf_unfiltered ("Calling host system(3) call from target is %sallowed\n", + remote_fio_system_call_allowed ? "" : "not "); +} + +void +initialize_remote_fileio (struct cmd_list_element *remote_set_cmdlist, + struct cmd_list_element *remote_show_cmdlist) +{ + add_cmd ("system-call-allowed", no_class, + set_system_call_allowed, + "Set if the host system(3) call is allowed for the target.\n", + &remote_set_cmdlist); + add_cmd ("system-call-allowed", no_class, + show_system_call_allowed, + "Show if the host system(3) call is allowed for the target.\n", + &remote_show_cmdlist); +} diff --git a/gdb/remote-fileio.h b/gdb/remote-fileio.h new file mode 100644 index 0000000..da248ec --- /dev/null +++ b/gdb/remote-fileio.h @@ -0,0 +1,36 @@ +/* Remote File-I/O communications + + Copyright 2003 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. */ + +/* See the GDB User Guide for details of the GDB remote protocol. */ + +#ifndef REMOTE_FILEIO_H +#define REMOTE_FILEIO_H + +/* Unified interface to remote fileio, called in remote.c from + remote_wait () and remote_async_wait () */ +extern void remote_fileio_request (char *buf); + +/* Called from _initialize_remote () */ +extern void initialize_remote_fileio ( + struct cmd_list_element *remote_set_cmdlist, + struct cmd_list_element *remote_show_cmdlist); + +#endif diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c index 438d6c6..cd7f4d3 100644 --- a/gdb/remote-hms.c +++ b/gdb/remote-hms.c @@ -140,6 +140,8 @@ hms_open (char *args, int from_tty) int write_dos_tick_delay; +extern initialize_file_ftype _initialize_remote_hms; /* -Wmissing-prototypes */ + void _initialize_remote_hms (void) { diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index e290849..96f3972 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -536,7 +536,7 @@ fputs_readable (const char *string, struct ui_file *file) timed out. TIMEOUT specifies timeout value in seconds. */ -int +static int mips_expect_timeout (const char *string, int timeout) { const char *p = string; @@ -592,7 +592,7 @@ mips_expect_timeout (const char *string, int timeout) mips_expect_timeout if a different timeout value is needed. */ -int +static int mips_expect (const char *string) { return mips_expect_timeout (string, remote_timeout); @@ -600,7 +600,7 @@ mips_expect (const char *string) /* Read the required number of characters into the given buffer (which is assumed to be large enough). The only failure is a timeout. */ -int +static int mips_getstring (char *string, int n) { char *p = string; @@ -1721,7 +1721,7 @@ mips_resume (ptid_t ptid, int step, enum target_signal siggnal) /* Return the signal corresponding to SIG, where SIG is the number which the MIPS protocol uses for the signal. */ -enum target_signal +static enum target_signal mips_signal_from_protocol (int sig) { /* We allow a few more signals than the IDT board actually returns, on @@ -2437,7 +2437,7 @@ calculate_mask (CORE_ADDR addr, int len) /* Insert a hardware breakpoint. This works only on LSI targets, which implement ordinary breakpoints using hardware facilities. */ -int +static int remote_mips_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache) { if (strcmp (target_shortname, "lsi") == 0) @@ -2450,7 +2450,7 @@ remote_mips_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache) /* Remove a hardware breakpoint. This works only on LSI targets, which implement ordinary breakpoints using hardware facilities. */ -int +static int remote_mips_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache) { if (strcmp (target_shortname, "lsi") == 0) @@ -3477,6 +3477,8 @@ pmon_command (char *args, int from_tty) printf_filtered ("Received packet: %s\n", buf); } +extern initialize_file_ftype _initialize_remote_mips; /* -Wmissing-prototypes */ + void _initialize_remote_mips (void) { diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index a85fbb1..94cb676 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -146,7 +146,7 @@ arm_rdi_start_remote (char *dummy) /* Helper callbacks for the "host interface" structure. RDI functions call these to forward output from the target system and so forth. */ -void +static void voiddummy (void *dummy) { fprintf_unfiltered (gdb_stdout, "void dummy\n"); @@ -1009,6 +1009,8 @@ rdilogenable_command (char *args, int from_tty) " try y or n\n", args); } +extern initialize_file_ftype _initialize_remote_rdi; /* -Wmissing-prototypes */ + void _initialize_remote_rdi (void) { diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index a9dba9a..6cbf73c 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -374,7 +374,7 @@ rdp_init (int cold, int tty) } -void +static void send_rdp (char *template,...) { char buf[200]; @@ -1403,6 +1403,8 @@ init_remote_rdp_ops (void) remote_rdp_ops.to_magic = OPS_MAGIC; } +extern initialize_file_ftype _initialize_remote_rdp; /* -Wmissing-prototypes */ + void _initialize_remote_rdp (void) { diff --git a/gdb/remote.c b/gdb/remote.c index e55e141..d5a5cf6 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -55,6 +55,8 @@ #include "gdbcore.h" /* for exec_bfd */ +#include "remote-fileio.h" + /* Prototypes for local functions */ static void cleanup_sigint_signal_handler (void *dummy); static void initialize_sigint_signal_handler (void); @@ -67,10 +69,6 @@ void async_remote_interrupt_twice (gdb_client_data); static void build_remote_gdbarch_data (void); -static int remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len); - -static int remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len); - static void remote_files_info (struct target_ops *ignore); static int remote_xfer_memory (CORE_ADDR memaddr, char *myaddr, @@ -1989,8 +1987,10 @@ get_offsets (void) if (symfile_objfile == NULL) return; - offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); - memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS); + offs = ((struct section_offsets *) + alloca (SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections))); + memcpy (offs, symfile_objfile->section_offsets, + SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections)); offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_addr; @@ -2101,8 +2101,10 @@ remote_cisco_objfile_relocate (bfd_signed_vma text_off, bfd_signed_vma data_off, broken for xcoff, dwarf, sdb-coff, etc. But there is no simple canonical representation for this stuff. */ - offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); - memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS); + offs = (struct section_offsets *) + alloca (SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections)); + memcpy (offs, symfile_objfile->section_offsets, + SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections)); offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_off; offs->offsets[SECT_OFF_DATA (symfile_objfile)] = data_off; @@ -2949,6 +2951,9 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status) case 'E': /* Error of some sort */ warning ("Remote failure reply: %s", buf); continue; + case 'F': /* File-I/O request */ + remote_fileio_request (buf); + continue; case 'T': /* Status with PC, SP, FP, ... */ { int i; @@ -3200,6 +3205,9 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status) case 'E': /* Error of some sort */ warning ("Remote failure reply: %s", buf); continue; + case 'F': /* File-I/O request */ + remote_fileio_request (buf); + continue; case 'T': /* Status with PC, SP, FP, ... */ { int i; @@ -3754,7 +3762,7 @@ check_binary_download (CORE_ADDR addr) Returns number of bytes transferred, or 0 (setting errno) for error. Only transfer a single packet. */ -static int +int remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len) { unsigned char *buf; @@ -3898,7 +3906,7 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len) caller and its callers caller ;-) already contains code for handling partial reads. */ -static int +int remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len) { char *buf; @@ -4629,33 +4637,33 @@ extended_remote_async_create_inferior (char *exec_file, char *args, char **env) /* On some machines, e.g. 68k, we may use a different breakpoint - instruction than other targets; in those use REMOTE_BREAKPOINT - instead of just BREAKPOINT_FROM_PC. Also, bi-endian targets may - define LITTLE_REMOTE_BREAKPOINT and BIG_REMOTE_BREAKPOINT. If none - of these are defined, we just call the standard routines that are - in mem-break.c. */ - -/* FIXME, these ought to be done in a more dynamic fashion. For instance, - the choice of breakpoint instruction affects target program design and - vice versa, and by making it user-tweakable, the special code here - goes away and we need fewer special GDB configurations. */ - -#if defined (LITTLE_REMOTE_BREAKPOINT) && defined (BIG_REMOTE_BREAKPOINT) && !defined(REMOTE_BREAKPOINT) -#define REMOTE_BREAKPOINT + instruction than other targets; in those use + DEPRECATED_REMOTE_BREAKPOINT instead of just BREAKPOINT_FROM_PC. + Also, bi-endian targets may define + DEPRECATED_LITTLE_REMOTE_BREAKPOINT and + DEPRECATED_BIG_REMOTE_BREAKPOINT. If none of these are defined, we + just call the standard routines that are in mem-break.c. */ + +/* NOTE: cagney/2003-06-08: This is silly. A remote and simulator + target should use an identical BREAKPOINT_FROM_PC. As for native, + the ARCH-OS-tdep.c code can override the default. */ + +#if defined (DEPRECATED_LITTLE_REMOTE_BREAKPOINT) && defined (DEPRECATED_BIG_REMOTE_BREAKPOINT) && !defined(DEPRECATED_REMOTE_BREAKPOINT) +#define DEPRECATED_REMOTE_BREAKPOINT #endif -#ifdef REMOTE_BREAKPOINT +#ifdef DEPRECATED_REMOTE_BREAKPOINT /* If the target isn't bi-endian, just pretend it is. */ -#if !defined (LITTLE_REMOTE_BREAKPOINT) && !defined (BIG_REMOTE_BREAKPOINT) -#define LITTLE_REMOTE_BREAKPOINT REMOTE_BREAKPOINT -#define BIG_REMOTE_BREAKPOINT REMOTE_BREAKPOINT +#if !defined (DEPRECATED_LITTLE_REMOTE_BREAKPOINT) && !defined (DEPRECATED_BIG_REMOTE_BREAKPOINT) +#define DEPRECATED_LITTLE_REMOTE_BREAKPOINT DEPRECATED_REMOTE_BREAKPOINT +#define DEPRECATED_BIG_REMOTE_BREAKPOINT DEPRECATED_REMOTE_BREAKPOINT #endif -static unsigned char big_break_insn[] = BIG_REMOTE_BREAKPOINT; -static unsigned char little_break_insn[] = LITTLE_REMOTE_BREAKPOINT; +static unsigned char big_break_insn[] = DEPRECATED_BIG_REMOTE_BREAKPOINT; +static unsigned char little_break_insn[] = DEPRECATED_LITTLE_REMOTE_BREAKPOINT; -#endif /* REMOTE_BREAKPOINT */ +#endif /* DEPRECATED_REMOTE_BREAKPOINT */ /* Insert a breakpoint on targets that don't have any better breakpoint support. We read the contents of the target location @@ -4669,7 +4677,7 @@ static int remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache) { struct remote_state *rs = get_remote_state (); -#ifdef REMOTE_BREAKPOINT +#ifdef DEPRECATED_REMOTE_BREAKPOINT int val; #endif int bp_size; @@ -4706,7 +4714,7 @@ remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache) } } -#ifdef REMOTE_BREAKPOINT +#ifdef DEPRECATED_REMOTE_BREAKPOINT val = target_read_memory (addr, contents_cache, sizeof big_break_insn); if (val == 0) @@ -4722,7 +4730,7 @@ remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache) return val; #else return memory_insert_breakpoint (addr, contents_cache); -#endif /* REMOTE_BREAKPOINT */ +#endif /* DEPRECATED_REMOTE_BREAKPOINT */ } static int @@ -4751,11 +4759,11 @@ remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache) return (buf[0] == 'E'); } -#ifdef REMOTE_BREAKPOINT +#ifdef DEPRECATED_REMOTE_BREAKPOINT return target_write_memory (addr, contents_cache, sizeof big_break_insn); #else return memory_remove_breakpoint (addr, contents_cache); -#endif /* REMOTE_BREAKPOINT */ +#endif /* DEPRECATED_REMOTE_BREAKPOINT */ } static int @@ -4850,7 +4858,7 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type) int remote_hw_watchpoint_limit = -1; int remote_hw_breakpoint_limit = -1; -int +static int remote_check_watch_resources (int type, int cnt, int ot) { if (type == bp_hardware_breakpoint) @@ -4876,13 +4884,13 @@ remote_check_watch_resources (int type, int cnt, int ot) return -1; } -int +static int remote_stopped_by_watchpoint (void) { return remote_stopped_by_watchpoint_p; } -CORE_ADDR +static CORE_ADDR remote_stopped_data_address (void) { if (remote_stopped_by_watchpoint ()) @@ -6272,4 +6280,7 @@ Set use of remote protocol `Z' packets", set_remote_protocol_Z_packet_cmd, show_remote_protocol_Z_packet_cmd, &remote_set_cmdlist, &remote_show_cmdlist); + + /* Eventually initialize fileio. See fileio.c */ + initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist); } diff --git a/gdb/remote.h b/gdb/remote.h index 4477148..7c0df32 100644 --- a/gdb/remote.h +++ b/gdb/remote.h @@ -54,6 +54,10 @@ extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off, extern void async_remote_interrupt_twice (void *arg); +extern int remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len); + +extern int remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len); + extern void (*target_resume_hook) (void); extern void (*target_wait_loop_hook) (void); diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c index 6b0926b..af5e023 100644 --- a/gdb/rom68k-rom.c +++ b/gdb/rom68k-rom.c @@ -246,6 +246,8 @@ rom68k_open (char *args, int from_tty) monitor_open (args, &rom68k_cmds, from_tty); } +extern initialize_file_ftype _initialize_rom68k; /* -Wmissing-prototypes */ + void _initialize_rom68k (void) { diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index c5a0ea7..e825529 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -485,7 +485,8 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, /* Fetch trailing memory needed for alignment. */ if (addr + count * sizeof (int) > memaddr + len) - if (!read_word (addr, buf + count - 1, arch64)) + if (!read_word (addr + (count - 1) * sizeof (int), + buf + count - 1, arch64)) return 0; /* Copy supplied data into memory buffer. */ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 98e1a0c..2e52ee5 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -231,7 +231,7 @@ rs6000_saved_pc_after_call (struct frame_info *fi) } /* Get the ith function argument for the current function. */ -CORE_ADDR +static CORE_ADDR rs6000_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { @@ -1944,7 +1944,7 @@ rs6000_register_convert_to_virtual (int n, struct type *type, static void rs6000_register_convert_to_raw (struct type *type, int n, - char *from, char *to) + const char *from, char *to) { if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n)) { @@ -2164,7 +2164,7 @@ rs6000_create_inferior (int pid) /* Return real function address if ADDR (a function pointer) is in the data space and is therefore a special function pointer. */ -CORE_ADDR +static CORE_ADDR rs6000_convert_from_func_ptr_addr (CORE_ADDR addr) { struct obj_section *s; @@ -2910,22 +2910,20 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc); - set_gdbarch_read_pc (gdbarch, generic_target_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_num_regs (gdbarch, v->nregs); set_gdbarch_num_pseudo_regs (gdbarch, v->npregs); set_gdbarch_register_name (gdbarch, rs6000_register_name); set_gdbarch_deprecated_register_size (gdbarch, wordsize); set_gdbarch_deprecated_register_bytes (gdbarch, off); - set_gdbarch_register_byte (gdbarch, rs6000_register_byte); - set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, rs6000_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, rs6000_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16); - set_gdbarch_register_virtual_size (gdbarch, generic_register_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, generic_register_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16); - set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, rs6000_register_virtual_type); set_gdbarch_ptr_bit (gdbarch, wordsize * TARGET_CHAR_BIT); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); @@ -2946,9 +2944,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address); set_gdbarch_believe_pcc_promotion (gdbarch, 1); - set_gdbarch_register_convertible (gdbarch, rs6000_register_convertible); - set_gdbarch_register_convert_to_virtual (gdbarch, rs6000_register_convert_to_virtual); - set_gdbarch_register_convert_to_raw (gdbarch, rs6000_register_convert_to_raw); + set_gdbarch_deprecated_register_convertible (gdbarch, rs6000_register_convertible); + set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, rs6000_register_convert_to_virtual); + set_gdbarch_deprecated_register_convert_to_raw (gdbarch, rs6000_register_convert_to_raw); set_gdbarch_stab_reg_to_regnum (gdbarch, rs6000_stab_reg_to_regnum); /* Note: kevinb/2002-04-12: I'm not convinced that rs6000_push_arguments() is correct for the SysV ABI when the wordsize is 8, but I'm also @@ -3004,10 +3002,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Helpers for function argument information. */ set_gdbarch_fetch_pointer_argument (gdbarch, rs6000_fetch_pointer_argument); - /* We can't tell how many args there are - now that the C compiler delays popping them. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); @@ -3035,6 +3029,8 @@ rs6000_info_powerpc_command (char *args, int from_tty) /* Initialization code. */ +extern initialize_file_ftype _initialize_rs6000_tdep; /* -Wmissing-prototypes */ + void _initialize_rs6000_tdep (void) { diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index c7dce06..e3bf677 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -45,7 +45,7 @@ /* Number of bytes of storage in the actual machine representation for register N. */ -int +static int s390_register_raw_size (int reg_nr) { if (S390_FP0_REGNUM <= reg_nr @@ -55,21 +55,21 @@ s390_register_raw_size (int reg_nr) return 4; } -int +static int s390x_register_raw_size (int reg_nr) { return (reg_nr == S390_FPC_REGNUM) || (reg_nr >= S390_FIRST_ACR && reg_nr <= S390_LAST_ACR) ? 4 : 8; } -int +static int s390_cannot_fetch_register (int regno) { return (regno >= S390_FIRST_CR && regno < (S390_FIRST_CR + 9)) || (regno >= (S390_FIRST_CR + 12) && regno <= S390_LAST_CR); } -int +static int s390_register_byte (int reg_nr) { if (reg_nr <= S390_GP_LAST_REGNUM) @@ -119,7 +119,7 @@ struct frame_extra_info static CORE_ADDR s390_frame_saved_pc_nofix (struct frame_info *fi); -int +static int s390_readinstruction (bfd_byte instr[], CORE_ADDR at, struct disassemble_info *info) { @@ -150,7 +150,7 @@ s390_memset_extra_info (struct frame_extra_info *fextra_info) -const char * +static const char * s390_register_name (int reg_nr) { static char *register_names[] = { @@ -175,7 +175,7 @@ s390_register_name (int reg_nr) -int +static int s390_stab_reg_to_regnum (int regno) { return regno >= 64 ? S390_PSWM_REGNUM - 64 : @@ -210,7 +210,7 @@ is_arg_reg (int regidx) */ -int +static int s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info, struct frame_info *fi, int init_extra_info) { @@ -675,7 +675,7 @@ s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info, } -int +static int s390_check_function_end (CORE_ADDR pc) { bfd_byte instr[S390_MAX_INSTR_SIZE]; @@ -767,7 +767,7 @@ s390_sniff_pc_function_start (CORE_ADDR pc, struct frame_info *fi) -CORE_ADDR +static CORE_ADDR s390_function_start (struct frame_info *fi) { CORE_ADDR function_start = 0; @@ -782,7 +782,7 @@ s390_function_start (struct frame_info *fi) -int +static int s390_frameless_function_invocation (struct frame_info *fi) { struct frame_extra_info fextra_info, *fextra_info_ptr; @@ -881,7 +881,7 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi, for the moment. For some reason the blockframe.c calls us with fi->next->fromleaf so this seems of little use to us. */ -CORE_ADDR +static CORE_ADDR s390_init_frame_pc_first (int next_fromleaf, struct frame_info *fi) { CORE_ADDR sigcaller_pc; @@ -901,7 +901,7 @@ s390_init_frame_pc_first (int next_fromleaf, struct frame_info *fi) return pc; } -void +static void s390_init_extra_frame_info (int fromleaf, struct frame_info *fi) { frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); @@ -916,7 +916,7 @@ s390_init_extra_frame_info (int fromleaf, struct frame_info *fi) &FEXTRA_INFOP contains struct frame_extra_info; TDATAP can be NULL, in which case the framedata are read. */ -void +static void s390_frame_init_saved_regs (struct frame_info *fi) { @@ -941,15 +941,6 @@ s390_frame_init_saved_regs (struct frame_info *fi) -CORE_ADDR -s390_frame_args_address (struct frame_info *fi) -{ - - /* Apparently gdb already knows gdb_args_offset itself */ - return get_frame_base (fi); -} - - static CORE_ADDR s390_frame_saved_pc_nofix (struct frame_info *fi) { @@ -979,7 +970,7 @@ s390_frame_saved_pc_nofix (struct frame_info *fi) return 0; } -CORE_ADDR +static CORE_ADDR s390_frame_saved_pc (struct frame_info *fi) { CORE_ADDR saved_pc = 0, sig_pc; @@ -1008,7 +999,7 @@ s390_frame_saved_pc (struct frame_info *fi) /* We want backtraces out of signal handlers so we don't set (get_frame_type (thisframe) == SIGTRAMP_FRAME) to 1 */ -CORE_ADDR +static CORE_ADDR s390_frame_chain (struct frame_info *thisframe) { CORE_ADDR prev_fp = 0; @@ -1088,7 +1079,7 @@ s390_frame_chain (struct frame_info *thisframe) /* a given return value in `regbuf' with a type `valtype', extract and copy its value into `valbuf' */ -void +static void s390_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) { /* floats and doubles are returned in fpr0. fpr's have a size of 8 bytes. @@ -1146,7 +1137,7 @@ s390_promote_integer_argument (struct type *valtype, char *valbuf, return (value); } -void +static void s390_store_return_value (struct type *valtype, char *valbuf) { int arglen; @@ -1194,7 +1185,7 @@ gdb_print_insn_s390 (bfd_vma memaddr, disassemble_info * info) /* Not the most efficent code in the world */ -int +static int s390_fp_regnum (void) { int regno = S390_SP_REGNUM; @@ -1209,7 +1200,7 @@ s390_fp_regnum (void) return regno; } -CORE_ADDR +static CORE_ADDR s390_read_fp (void) { return read_register (s390_fp_regnum ()); @@ -1251,7 +1242,7 @@ s390_pop_frame_regular (struct frame_info *frame) machine state that was in effect before the frame was created. Used in the contexts of the "return" command, and of target function calls from the debugger. */ -void +static void s390_pop_frame (void) { /* This function checks for and handles generic dummy frames, and @@ -1501,7 +1492,7 @@ alignment_of (struct type *type) Our caller has taken care of any type promotions needed to satisfy prototypes or the old K&R argument-passing rules. */ -CORE_ADDR +static CORE_ADDR s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { @@ -1685,7 +1676,7 @@ s390_use_struct_convention (int gcc_p, struct type *value_type) /* Return the GDB type object for the "standard" data type of data in register N. */ -struct type * +static struct type * s390_register_virtual_type (int regno) { if (S390_FP0_REGNUM <= regno && regno < S390_FP0_REGNUM + S390_NUM_FPRS) @@ -1695,7 +1686,7 @@ s390_register_virtual_type (int regno) } -struct type * +static struct type * s390x_register_virtual_type (int regno) { return (regno == S390_FPC_REGNUM) || @@ -1705,7 +1696,7 @@ s390x_register_virtual_type (int regno) -void +static void s390_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) { write_register (S390_GP0_REGNUM + 2, addr); @@ -1713,7 +1704,7 @@ s390_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -const static unsigned char * +static const unsigned char * s390_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { static unsigned char breakpoint[] = { 0x0, 0x1 }; @@ -1724,7 +1715,7 @@ s390_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) /* Advance PC across any function entry prologue instructions to reach some "real" code. */ -CORE_ADDR +static CORE_ADDR s390_skip_prologue (CORE_ADDR pc) { struct frame_extra_info fextra_info; @@ -1737,7 +1728,7 @@ s390_skip_prologue (CORE_ADDR pc) Can't go through the frames for this because on some machines the new frame is not set up until the new function executes some instructions. */ -CORE_ADDR +static CORE_ADDR s390_saved_pc_after_call (struct frame_info *frame) { return ADDR_BITS_REMOVE (read_register (S390_RETADDR_REGNUM)); @@ -1775,7 +1766,7 @@ s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) return NULL; } -int +static int s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, int *type_flags_ptr) { @@ -1788,7 +1779,7 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name return 0; } -struct gdbarch * +static struct gdbarch * s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { static LONGEST s390_call_dummy_words[] = { 0 }; @@ -1816,12 +1807,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_char_signed (gdbarch, 0); set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address); set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs); - set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address); - /* We can't do this */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value); set_gdbarch_deprecated_store_return_value (gdbarch, s390_store_return_value); @@ -1853,7 +1840,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) produces the frame's chain-pointer. */ set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, s390_saved_pc_after_call); - set_gdbarch_register_byte (gdbarch, s390_register_byte); + set_gdbarch_deprecated_register_byte (gdbarch, s390_register_byte); set_gdbarch_pc_regnum (gdbarch, S390_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM); set_gdbarch_deprecated_fp_regnum (gdbarch, S390_FP_REGNUM); @@ -1883,19 +1870,18 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { case bfd_mach_s390_31: set_gdbarch_deprecated_register_size (gdbarch, 4); - set_gdbarch_register_raw_size (gdbarch, s390_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, s390_register_raw_size); - set_gdbarch_register_virtual_type (gdbarch, s390_register_virtual_type); + set_gdbarch_deprecated_register_raw_size (gdbarch, s390_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, s390_register_raw_size); + set_gdbarch_deprecated_register_virtual_type (gdbarch, s390_register_virtual_type); set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove); set_gdbarch_deprecated_register_bytes (gdbarch, S390_REGISTER_BYTES); break; case bfd_mach_s390_64: set_gdbarch_deprecated_register_size (gdbarch, 8); - set_gdbarch_register_raw_size (gdbarch, s390x_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, s390x_register_raw_size); - set_gdbarch_register_virtual_type (gdbarch, - s390x_register_virtual_type); + set_gdbarch_deprecated_register_raw_size (gdbarch, s390x_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, s390x_register_raw_size); + set_gdbarch_deprecated_register_virtual_type (gdbarch, s390x_register_virtual_type); set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); @@ -1911,13 +1897,15 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); return gdbarch; } +extern initialize_file_ftype _initialize_s390_tdep; /* -Wmissing-prototypes */ + void _initialize_s390_tdep (void) { diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c index dcc583e..94c1ee3 100644 --- a/gdb/sentinel-frame.c +++ b/gdb/sentinel-frame.c @@ -44,7 +44,7 @@ sentinel_frame_cache (struct regcache *regcache) /* Here the register value is taken direct from the register cache. */ -void +static void sentinel_frame_prev_register (struct frame_info *next_frame, void **this_prologue_cache, int regnum, int *optimized, @@ -70,7 +70,7 @@ sentinel_frame_prev_register (struct frame_info *next_frame, } } -void +static void sentinel_frame_this_id (struct frame_info *next_frame, void **this_prologue_cache, struct frame_id *this_id) diff --git a/gdb/ser-e7kpc.c b/gdb/ser-e7kpc.c index 063cca1..8496ae4 100644 --- a/gdb/ser-e7kpc.c +++ b/gdb/ser-e7kpc.c @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if defined __GO32__ || defined _WIN32 #include "defs.h" +#if defined __GO32__ || defined _WIN32 #include "serial.h" #include "gdb_string.h" @@ -425,6 +425,8 @@ static struct serial_ops e7000pc_ops = #endif /*_WIN32 or __GO32__*/ +extern initialize_file_ftype _initialize_ser_e7000pc; /* -Wmissing-prototypes */ + void _initialize_ser_e7000pc (void) { diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 57c3f48..655aaaa 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -362,7 +362,7 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) #define MSYMBOL_IS_SPECIAL(msym) \ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) -void +static void sh64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) { if (msym == NULL) @@ -1239,7 +1239,7 @@ is_media_pseudo (int rn) && rn <= tdep->FV_LAST_REGNUM); } -int +static int sh64_get_gdb_regnum (int gcc_regnum, CORE_ADDR pc) { return translate_insn_rn (gcc_regnum, pc_is_isa32 (pc)); @@ -1813,7 +1813,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) } } -void +static void sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) @@ -2297,8 +2297,9 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) { memset (valbuf_tmp, 0, sizeof (valbuf_tmp)); - REGISTER_CONVERT_TO_VIRTUAL (regnum, - type, val, valbuf_tmp); + DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, + type, val, + valbuf_tmp); val = valbuf_tmp; } #endif @@ -3035,7 +3036,8 @@ sh64_show_regs (void) sh64_show_compact_regs (); } -void sh_show_regs_command (char *args, int from_tty) +static void +sh_show_regs_command (char *args, int from_tty) { if (sh_show_regs) (*sh_show_regs)(); @@ -3409,7 +3411,7 @@ sh_sh4_register_convert_to_virtual (int regnum, struct type *type, error ("sh_register_convert_to_virtual called with non DR register number"); } -void +static void sh_sh64_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { @@ -3451,7 +3453,7 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum, error("sh_register_convert_to_raw called with non DR register number"); } -void +static void sh_sh64_register_convert_to_raw (struct type *type, int regnum, const void *from, void *to) { @@ -3476,7 +3478,7 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum, error("sh_register_convert_to_raw called with non DR register number"); } -void +static void sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int reg_nr, void *buffer) { @@ -3679,7 +3681,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, } } -void +static void sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int reg_nr, const void *buffer) { @@ -3715,7 +3717,7 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, } } -void +static void sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int reg_nr, const void *buffer) { @@ -4123,7 +4125,7 @@ sh_print_register (int regnum) do_pseudo_register (regnum); } -void +static void sh_do_registers_info (int regnum, int fpregs) { if (regnum != -1) /* do one specified register */ @@ -4175,7 +4177,7 @@ sh_do_registers_info (int regnum, int fpregs) } } -void +static void sh_compact_do_registers_info (int regnum, int fpregs) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); @@ -4201,7 +4203,7 @@ sh_compact_do_registers_info (int regnum, int fpregs) } } -void +static void sh64_do_registers_info (int regnum, int fpregs) { if (pc_is_isa32 (get_frame_pc (deprecated_selected_frame))) @@ -4306,7 +4308,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) struct gdbarch_tdep *tdep; gdbarch_register_name_ftype *sh_register_name; gdbarch_deprecated_store_return_value_ftype *sh_store_return_value; - gdbarch_register_virtual_type_ftype *sh_register_virtual_type; + gdbarch_deprecated_register_virtual_type_ftype *sh_register_virtual_type; /* If there is already a candidate, use it. */ arches = gdbarch_list_lookup_by_info (arches, &info); @@ -4393,9 +4395,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh_default_store_return_value; sh_register_virtual_type = sh_default_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); break; case bfd_mach_sh2: sh_register_name = sh_sh_register_name; @@ -4403,9 +4405,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh_default_store_return_value; sh_register_virtual_type = sh_default_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); break; case bfd_mach_sh2e: sh_register_name = sh_sh2e_register_name; @@ -4413,9 +4415,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh3e_sh4_store_return_value; sh_register_virtual_type = sh_sh3e_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); set_gdbarch_fp0_regnum (gdbarch, 25); tdep->FPUL_REGNUM = 23; tdep->FPSCR_REGNUM = 24; @@ -4427,9 +4429,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh_default_store_return_value; sh_register_virtual_type = sh_default_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno); tdep->DSR_REGNUM = 24; tdep->A0G_REGNUM = 25; @@ -4452,9 +4454,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh_default_store_return_value; sh_register_virtual_type = sh_default_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); tdep->SSR_REGNUM = 41; tdep->SPC_REGNUM = 42; break; @@ -4464,9 +4466,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh3e_sh4_store_return_value; sh_register_virtual_type = sh_sh3e_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); set_gdbarch_fp0_regnum (gdbarch, 25); tdep->FPUL_REGNUM = 23; @@ -4481,9 +4483,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh_default_store_return_value; sh_register_virtual_type = sh_default_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); tdep->DSR_REGNUM = 24; tdep->A0G_REGNUM = 25; tdep->A0_REGNUM = 26; @@ -4509,9 +4511,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs); set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); set_gdbarch_fp0_regnum (gdbarch, 25); - set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_sh4_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_sh4_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_sh4_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_sh4_register_byte); set_gdbarch_num_pseudo_regs (gdbarch, 12); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4 * 4); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4 * 4); @@ -4597,9 +4599,9 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_sh64_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_sh64_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_sh64_register_byte); /* This seems awfully wrong!*/ /*set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);*/ /* should include the size of the pseudo regs. */ @@ -4631,19 +4633,17 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh_default_store_return_value; sh_register_virtual_type = sh_default_register_virtual_type; set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); - set_gdbarch_register_byte (gdbarch, sh_default_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_default_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, sh_default_register_byte); break; } - set_gdbarch_read_pc (gdbarch, generic_target_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_register_name (gdbarch, sh_register_name); - set_gdbarch_register_virtual_type (gdbarch, sh_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, sh_register_virtual_type); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -4667,7 +4667,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sh_saved_pc_after_call); - 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. */ @@ -4687,6 +4686,8 @@ sh_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) /* FIXME: dump the rest of gdbarch_tdep. */ } +extern initialize_file_ftype _initialize_sh_tdep; /* -Wmissing-prototypes */ + void _initialize_sh_tdep (void) { diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index 7d07fa5..b946e6f 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -343,6 +343,8 @@ sh3_close (int quitting) } } +extern initialize_file_ftype _initialize_sh3_rom; /* -Wmissing-prototypes */ + void _initialize_sh3_rom (void) { diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index ca46a9e..c808d1f 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -819,6 +819,8 @@ Use \"info signals\" for a list of symbolic signals."); } #ifndef GDBSERVER +extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */ + void _initialize_signals (void) { diff --git a/gdb/solib-legacy.c b/gdb/solib-legacy.c index 2dd9fa5..a87eb21 100644 --- a/gdb/solib-legacy.c +++ b/gdb/solib-legacy.c @@ -142,6 +142,8 @@ legacy_svr4_fetch_link_map_offsets (void) #endif /* HAVE_LINK_H */ +extern initialize_file_ftype _initialize_svr4_lm; /* -Wmissing-prototypes */ + void _initialize_svr4_lm (void) { diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 3658be6..d433534 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -81,6 +81,17 @@ static char *solib_break_names[] = "_dl_debug_state", "rtld_db_dlactivity", "_rtld_debug_state", + + /* On the 64-bit PowerPC, the linker symbol with the same name as + the C function points to a function descriptor, not to the entry + point. The linker symbol whose name is the C function name + prefixed with a '.' points to the function's entry point. So + when we look through this table, we ignore symbols that point + into the data section (thus skipping the descriptor's symbol), + and eventually try this one, giving us the real entry point + address. */ + "._dl_debug_state", + NULL }; @@ -1455,6 +1466,8 @@ init_fetch_link_map_offsets (struct gdbarch *gdbarch) static struct target_so_ops svr4_so_ops; +extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */ + void _initialize_svr4_solib (void) { diff --git a/gdb/solib.c b/gdb/solib.c index 7eb06d7..6428a7c 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -382,7 +382,7 @@ symbol_add_stub (void *arg) the section table. But we only use this for core files and processes we've just attached to, so that's okay. */ -void +static void update_solib_list (int from_tty, struct target_ops *target) { struct so_list *inferior = TARGET_SO_CURRENT_SOS (); @@ -857,6 +857,8 @@ reload_shared_libraries (char *ignored, int from_tty) solib_add (NULL, from_tty, NULL, auto_solib_add); } +extern initialize_file_ftype _initialize_solib; /* -Wmissing-prototypes */ + void _initialize_solib (void) { diff --git a/gdb/somread.c b/gdb/somread.c index 654ae06..cb7b048 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -430,9 +430,10 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) int i; CORE_ADDR text_addr; - objfile->num_sections = SECT_OFF_MAX; + objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS); + obstack_alloc (&objfile->psymbol_obstack, + SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); /* FIXME: ezannoni 2000-04-20 The section names in SOM are not .text, .data, etc, but $TEXT$, $DATA$,... We should initialize @@ -457,7 +458,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) break; text_addr = addrs->other[i].addr; - for (i = 0; i < SECT_OFF_MAX; i++) + for (i = 0; i < objfile->num_sections; i++) (objfile->section_offsets)->offsets[i] = text_addr; } } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index ccd3a3b..3171813 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -2186,7 +2186,7 @@ sparc_do_registers_info (int regnum, int all) #endif -int +static int gdb_print_insn_sparc (bfd_vma memaddr, disassemble_info *info) { /* It's necessary to override mach again because print_insn messes it up. */ @@ -2448,7 +2448,7 @@ sparc_extract_struct_value_address (struct regcache *regcache) /* FIXME: kettenis/2003/05/24: Still used for sparc64. */ -void +static void sparc_store_return_value (struct type *type, char *valbuf) { int regno; @@ -2597,6 +2597,8 @@ static struct gdbarch * sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches); static void sparc_dump_tdep (struct gdbarch *, struct ui_file *); +extern initialize_file_ftype _initialize_sparc_tdep; /* -Wmissing-prototypes */ + void _initialize_sparc_tdep (void) { @@ -2611,7 +2613,7 @@ _initialize_sparc_tdep (void) /* Compensate for stack bias. Note that we currently don't handle mixed 32/64 bit code. */ -CORE_ADDR +static CORE_ADDR sparc64_read_sp (void) { CORE_ADDR sp = read_register (SP_REGNUM); @@ -2621,7 +2623,7 @@ sparc64_read_sp (void) return sp; } -CORE_ADDR +static CORE_ADDR sparc64_read_fp (void) { CORE_ADDR fp = read_register (DEPRECATED_FP_REGNUM); @@ -2631,7 +2633,7 @@ sparc64_read_fp (void) return fp; } -void +static void sparc64_write_sp (CORE_ADDR val) { CORE_ADDR oldsp = read_register (SP_REGNUM); @@ -2655,7 +2657,7 @@ sparc64_write_sp (CORE_ADDR val) for both; this means that if the arguments alternate between int and float, we will waste every other register of both types. */ -CORE_ADDR +static CORE_ADDR sparc64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_retaddr) { @@ -2772,7 +2774,7 @@ sparc64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* Values <= 32 bytes are returned in o0-o3 (floating-point values are returned in f0-f3). */ -void +static void sp64_extract_return_value (struct type *type, char *regbuf, char *valbuf, int bitoffset) { @@ -2829,7 +2831,7 @@ sp64_extract_return_value (struct type *type, char *regbuf, char *valbuf, } } -extern void +static void sparc64_extract_return_value (struct type *type, char *regbuf, char *valbuf) { sp64_extract_return_value (type, regbuf, valbuf, 0); @@ -2855,7 +2857,7 @@ sparc32_stack_align (CORE_ADDR addr) return ((addr + 7) & -8); } -extern CORE_ADDR +static CORE_ADDR sparc64_stack_align (CORE_ADDR addr) { return ((addr + 15) & -16); @@ -2993,7 +2995,7 @@ sparc64_register_name (int regno) // OBSOLETE } #endif -CORE_ADDR +static CORE_ADDR sparc_push_return_address (CORE_ADDR pc_unused, CORE_ADDR sp) { if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) @@ -3186,7 +3188,7 @@ sparc_call_dummy_address (void) /* Supply the Y register number to those that need it. */ -int +static int sparc_y_regnum (void) { return gdbarch_tdep (current_gdbarch)->y_regnum; @@ -3201,7 +3203,7 @@ sparc_reg_struct_has_addr (int gcc_p, struct type *type) return (gcc_p != 1); } -int +static int sparc_intreg_size (void) { return SPARC_INTREG_SIZE; @@ -3218,8 +3220,9 @@ sparc_return_value_on_stack (struct type *type) } /* Get the ith function argument for the current function. */ -CORE_ADDR -sparc_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) +static CORE_ADDR +sparc_fetch_pointer_argument (struct frame_info *frame, int argi, + struct type *type) { CORE_ADDR addr; frame_read_register (frame, O0_REGNUM + argi, &addr); @@ -3306,7 +3309,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fp0_regnum (gdbarch, SPARC_FP0_REGNUM); set_gdbarch_deprecated_frame_chain (gdbarch, sparc_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs); - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_deprecated_frame_saved_pc (gdbarch, sparc_frame_saved_pc); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); @@ -3321,7 +3323,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_pop_frame (gdbarch, sparc_pop_frame); set_gdbarch_deprecated_push_return_address (gdbarch, sparc_push_return_address); set_gdbarch_deprecated_push_dummy_frame (gdbarch, sparc_push_dummy_frame); - set_gdbarch_read_pc (gdbarch, generic_target_read_pc); set_gdbarch_reg_struct_has_addr (gdbarch, sparc_reg_struct_has_addr); set_gdbarch_return_value_on_stack (gdbarch, sparc_return_value_on_stack); set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call); @@ -3424,14 +3425,12 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_register_byte (gdbarch, sparc32_register_byte); - set_gdbarch_register_raw_size (gdbarch, sparc32_register_size); + set_gdbarch_deprecated_register_byte (gdbarch, sparc32_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sparc32_register_size); set_gdbarch_deprecated_register_size (gdbarch, 4); - set_gdbarch_register_virtual_size (gdbarch, sparc32_register_size); - set_gdbarch_register_virtual_type (gdbarch, - sparc32_register_virtual_type); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sparc32_register_size); + set_gdbarch_deprecated_register_virtual_type (gdbarch, sparc32_register_virtual_type); #ifdef SPARC32_CALL_DUMMY_ON_STACK set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_32)); #else @@ -3442,7 +3441,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_struct_return (gdbarch, sparc32_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention); - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); tdep->y_regnum = SPARC32_Y_REGNUM; tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32; tdep->intreg_size = 4; @@ -3480,12 +3479,11 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_sp (gdbarch, sparc64_read_sp); /* Some of the registers aren't 64 bits, but it's a lot simpler just to assume they all are (since most of them are). */ - set_gdbarch_register_byte (gdbarch, sparc64_register_byte); - set_gdbarch_register_raw_size (gdbarch, sparc64_register_size); + set_gdbarch_deprecated_register_byte (gdbarch, sparc64_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, sparc64_register_size); set_gdbarch_deprecated_register_size (gdbarch, 8); - set_gdbarch_register_virtual_size (gdbarch, sparc64_register_size); - set_gdbarch_register_virtual_type (gdbarch, - sparc64_register_virtual_type); + set_gdbarch_deprecated_register_virtual_size (gdbarch, sparc64_register_size); + set_gdbarch_deprecated_register_virtual_type (gdbarch, sparc64_register_virtual_type); #ifdef SPARC64_CALL_DUMMY_ON_STACK set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_64)); #else diff --git a/gdb/stack.c b/gdb/stack.c index a0bd7a4..ff098a1 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -40,6 +40,9 @@ #include "annotate.h" #include "ui-out.h" #include "block.h" +#include "stack.h" +#include "gdb_assert.h" +#include "dictionary.h" /* Prototypes for exported functions. */ @@ -71,8 +74,6 @@ void frame_command (char *, int); static void current_frame_command (char *, int); -static void select_frame_command (char *, int); - static void print_frame_arg_vars (struct frame_info *, struct ui_file *); static void catch_info (char *, int); @@ -168,6 +169,225 @@ struct print_args_args static int print_args_stub (void *); +/* Print nameless args on STREAM. + FI is the frameinfo for this frame, START is the offset + of the first nameless arg, and NUM is the number of nameless args to + print. FIRST is nonzero if this is the first argument (not just + the first nameless arg). */ + +static void +print_frame_nameless_args (struct frame_info *fi, long start, int num, + int first, struct ui_file *stream) +{ + int i; + CORE_ADDR argsaddr; + long arg_value; + + for (i = 0; i < num; i++) + { + QUIT; + argsaddr = get_frame_args_address (fi); + if (!argsaddr) + return; + arg_value = read_memory_integer (argsaddr + start, sizeof (int)); + if (!first) + fprintf_filtered (stream, ", "); + fprintf_filtered (stream, "%ld", arg_value); + first = 0; + start += sizeof (int); + } +} + +/* Print the arguments of a stack frame, given the function FUNC + running in that frame (as a symbol), the info on the frame, + and the number of args according to the stack frame (or -1 if unknown). */ + +/* References here and elsewhere to "number of args according to the + stack frame" appear in all cases to refer to "number of ints of args + according to the stack frame". At least for VAX, i386, isi. */ + +static void +print_frame_args (struct symbol *func, struct frame_info *fi, int num, + struct ui_file *stream) +{ + struct block *b = NULL; + int first = 1; + struct dict_iterator iter; + register struct symbol *sym; + struct value *val; + /* Offset of next stack argument beyond the one we have seen that is + at the highest offset. + -1 if we haven't come to a stack argument yet. */ + long highest_offset = -1; + int arg_size; + /* Number of ints of arguments that we have printed so far. */ + int args_printed = 0; + struct cleanup *old_chain, *list_chain; + struct ui_stream *stb; + + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup_ui_out_stream_delete (stb); + + if (func) + { + b = SYMBOL_BLOCK_VALUE (func); + + ALL_BLOCK_SYMBOLS (b, iter, sym) + { + QUIT; + + /* Keep track of the highest stack argument offset seen, and + skip over any kinds of symbols we don't care about. */ + + switch (SYMBOL_CLASS (sym)) + { + case LOC_ARG: + case LOC_REF_ARG: + { + long current_offset = SYMBOL_VALUE (sym); + arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); + + /* Compute address of next argument by adding the size of + this argument and rounding to an int boundary. */ + current_offset = + ((current_offset + arg_size + sizeof (int) - 1) + & ~(sizeof (int) - 1)); + + /* If this is the highest offset seen yet, set highest_offset. */ + if (highest_offset == -1 + || (current_offset > highest_offset)) + highest_offset = current_offset; + + /* Add the number of ints we're about to print to args_printed. */ + args_printed += (arg_size + sizeof (int) - 1) / sizeof (int); + } + + /* We care about types of symbols, but don't need to keep track of + stack offsets in them. */ + case LOC_REGPARM: + case LOC_REGPARM_ADDR: + case LOC_LOCAL_ARG: + case LOC_BASEREG_ARG: + case LOC_COMPUTED_ARG: + break; + + /* Other types of symbols we just skip over. */ + default: + continue; + } + + /* We have to look up the symbol because arguments can have + two entries (one a parameter, one a local) and the one we + want is the local, which lookup_symbol will find for us. + This includes gcc1 (not gcc2) on the sparc when passing a + small structure and gcc2 when the argument type is float + and it is passed as a double and converted to float by + the prologue (in the latter case the type of the LOC_ARG + symbol is double and the type of the LOC_LOCAL symbol is + float). */ + /* But if the parameter name is null, don't try it. + Null parameter names occur on the RS/6000, for traceback tables. + FIXME, should we even print them? */ + + if (*DEPRECATED_SYMBOL_NAME (sym)) + { + struct symbol *nsym; + nsym = lookup_symbol + (DEPRECATED_SYMBOL_NAME (sym), + b, VAR_DOMAIN, (int *) NULL, (struct symtab **) NULL); + if (SYMBOL_CLASS (nsym) == LOC_REGISTER) + { + /* There is a LOC_ARG/LOC_REGISTER pair. This means that + it was passed on the stack and loaded into a register, + or passed in a register and stored in a stack slot. + GDB 3.x used the LOC_ARG; GDB 4.0-4.11 used the LOC_REGISTER. + + Reasons for using the LOC_ARG: + (1) because find_saved_registers may be slow for remote + debugging, + (2) because registers are often re-used and stack slots + rarely (never?) are. Therefore using the stack slot is + much less likely to print garbage. + + Reasons why we might want to use the LOC_REGISTER: + (1) So that the backtrace prints the same value as + "print foo". I see no compelling reason why this needs + to be the case; having the backtrace print the value which + was passed in, and "print foo" print the value as modified + within the called function, makes perfect sense to me. + + Additional note: It might be nice if "info args" displayed + both values. + One more note: There is a case with sparc structure passing + where we need to use the LOC_REGISTER, but this is dealt with + by creating a single LOC_REGPARM in symbol reading. */ + + /* Leave sym (the LOC_ARG) alone. */ + ; + } + else + sym = nsym; + } + + /* Print the current arg. */ + if (!first) + ui_out_text (uiout, ", "); + ui_out_wrap_hint (uiout, " "); + + annotate_arg_begin (); + + list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (sym), + SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); + ui_out_field_stream (uiout, "name", stb); + annotate_arg_name_end (); + ui_out_text (uiout, "="); + + /* Avoid value_print because it will deref ref parameters. We just + want to print their addresses. Print ??? for args whose address + we do not know. We pass 2 as "recurse" to val_print because our + standard indentation here is 4 spaces, and val_print indents + 2 for each recurse. */ + val = read_var_value (sym, fi); + + annotate_arg_value (val == NULL ? NULL : VALUE_TYPE (val)); + + if (val) + { + val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, + VALUE_ADDRESS (val), + stb->stream, 0, 0, 2, Val_no_prettyprint); + ui_out_field_stream (uiout, "value", stb); + } + else + ui_out_text (uiout, "???"); + + /* Invoke ui_out_tuple_end. */ + do_cleanups (list_chain); + + annotate_arg_end (); + + first = 0; + } + } + + /* Don't print nameless args in situations where we don't know + enough about the stack to find them. */ + if (num != -1) + { + long start; + + if (highest_offset == -1) + start = FRAME_ARGS_SKIP; + else + start = highest_offset; + + print_frame_nameless_args (fi, start, num - args_printed, + first, stream); + } + do_cleanups (old_chain); +} + /* Pass the args the way catch_errors wants them. */ static int @@ -176,7 +396,13 @@ print_args_stub (void *args) int numargs; struct print_args_args *p = (struct print_args_args *) args; - numargs = FRAME_NUM_ARGS (p->fi); + if (FRAME_NUM_ARGS_P ()) + { + numargs = FRAME_NUM_ARGS (p->fi); + gdb_assert (numargs >= 0); + } + else + numargs = -1; print_frame_args (p->func, p->fi, numargs, p->stream); return 0; } @@ -760,15 +986,22 @@ frame_info (char *addr_exp, int from_tty) print_address_numeric (arg_list, 1, gdb_stdout); printf_filtered (","); - numargs = FRAME_NUM_ARGS (fi); - if (numargs < 0) - puts_filtered (" args: "); - else if (numargs == 0) - puts_filtered (" no args."); - else if (numargs == 1) - puts_filtered (" 1 arg: "); + if (!FRAME_NUM_ARGS_P ()) + { + numargs = -1; + puts_filtered (" args: "); + } else - printf_filtered (" %d args: ", numargs); + { + numargs = FRAME_NUM_ARGS (fi); + gdb_assert (numargs >= 0); + if (numargs == 0) + puts_filtered (" no args."); + else if (numargs == 1) + puts_filtered (" 1 arg: "); + else + printf_filtered (" %d args: ", numargs); + } print_frame_args (func, fi, numargs, gdb_stdout); puts_filtered ("\n"); } @@ -1076,14 +1309,15 @@ backtrace_full_command (char *arg, int from_tty) Return 1 if any variables were printed; 0 otherwise. */ static int -print_block_frame_locals (struct block *b, register struct frame_info *fi, - int num_tabs, register struct ui_file *stream) +print_block_frame_locals (struct block *b, struct frame_info *fi, + int num_tabs, struct ui_file *stream) { - register int i, j; - register struct symbol *sym; - register int values_printed = 0; + struct dict_iterator iter; + int j; + struct symbol *sym; + int values_printed = 0; - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { switch (SYMBOL_CLASS (sym)) { @@ -1115,11 +1349,11 @@ static int print_block_frame_labels (struct block *b, int *have_default, register struct ui_file *stream) { - register int i; + struct dict_iterator iter; register struct symbol *sym; register int values_printed = 0; - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default")) { @@ -1297,7 +1531,7 @@ print_frame_arg_vars (register struct frame_info *fi, { struct symbol *func = get_frame_function (fi); register struct block *b; - register int i; + struct dict_iterator iter; register struct symbol *sym, *sym2; register int values_printed = 0; @@ -1308,7 +1542,7 @@ print_frame_arg_vars (register struct frame_info *fi, } b = SYMBOL_BLOCK_VALUE (func); - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { switch (SYMBOL_CLASS (sym)) { @@ -1460,14 +1694,7 @@ find_relative_frame (register struct frame_info *frame, and select it. See parse_frame_specification for more info on proper frame expressions. */ -/* ARGSUSED */ void -select_frame_command_wrapper (char *level_exp, int from_tty) -{ - select_frame_command (level_exp, from_tty); -} - -static void select_frame_command (char *level_exp, int from_tty) { struct frame_info *frame; diff --git a/gdb/stack.h b/gdb/stack.h new file mode 100644 index 0000000..0891c94 --- /dev/null +++ b/gdb/stack.h @@ -0,0 +1,27 @@ +/* Stack manipulation commands, for GDB the GNU Debugger. + + Copyright 2003 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 STACK_H +#define STACK_H + +void select_frame_command (char *level_exp, int from_tty); + +#endif /* #ifndef STACK_H */ diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 93d5102..1241852 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -133,6 +133,8 @@ value_of_builtin_frame_ps_reg (struct frame_info *frame) error ("Standard register ``$ps'' is not available for this target"); } +extern initialize_file_ftype _initialize_frame_reg; /* -Wmissing-prototypes */ + void _initialize_frame_reg (void) { diff --git a/gdb/symfile.c b/gdb/symfile.c index 3d63502..0fab10f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -236,38 +236,6 @@ sort_pst_symbols (struct partial_symtab *pst) compare_psymbols); } -/* Call sort_block_syms to sort alphabetically the symbols of one block. */ - -void -sort_block_syms (register struct block *b) -{ - qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b), - sizeof (struct symbol *), compare_symbols); -} - -/* Call sort_symtab_syms to sort alphabetically - the symbols of each block of one symtab. */ - -void -sort_symtab_syms (register struct symtab *s) -{ - register struct blockvector *bv; - int nbl; - int i; - register struct block *b; - - if (s == 0) - return; - bv = BLOCKVECTOR (s); - nbl = BLOCKVECTOR_NBLOCKS (bv); - for (i = 0; i < nbl; i++) - { - b = BLOCKVECTOR_BLOCK (bv, i); - if (BLOCK_SHOULD_SORT (b)) - sort_block_syms (b); - } -} - /* Make a null terminated copy of the string at PTR with SIZE characters in the obstack pointed to by OBSTACKP . Returns the address of the copy. Note that the string at PTR does not have to be null terminated, I.E. it @@ -401,6 +369,22 @@ find_lowest_section (bfd *abfd, asection *sect, void *obj) *lowest = sect; } +/* Create a new section_addr_info, with room for NUM_SECTIONS. */ + +struct section_addr_info * +alloc_section_addr_info (size_t num_sections) +{ + struct section_addr_info *sap; + size_t size; + + size = (sizeof (struct section_addr_info) + + sizeof (struct other_sections) * (num_sections - 1)); + sap = (struct section_addr_info *) xmalloc (size); + memset (sap, 0, size); + sap->num_sections = num_sections; + + return sap; +} /* Build (allocate and populate) a section_addr_info struct from an existing section table. */ @@ -413,14 +397,13 @@ build_section_addr_info_from_section_table (const struct section_table *start, const struct section_table *stp; int oidx; - sap = xmalloc (sizeof (struct section_addr_info)); - memset (sap, 0, sizeof (struct section_addr_info)); + sap = alloc_section_addr_info (end - start); for (stp = start, oidx = 0; stp != end; stp++) { if (bfd_get_section_flags (stp->bfd, stp->the_bfd_section) & (SEC_ALLOC | SEC_LOAD) - && oidx < MAX_SECTIONS) + && oidx < end - start) { sap->other[oidx].addr = stp->addr; sap->other[oidx].name @@ -441,7 +424,7 @@ free_section_addr_info (struct section_addr_info *sap) { int idx; - for (idx = 0; idx < MAX_SECTIONS; idx++) + for (idx = 0; idx < sap->num_sections; idx++) if (sap->other[idx].name) xfree (sap->other[idx].name); xfree (sap); @@ -514,14 +497,16 @@ default_symfile_offsets (struct objfile *objfile, { int i; - objfile->num_sections = SECT_OFF_MAX; + objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS); - memset (objfile->section_offsets, 0, SIZEOF_SECTION_OFFSETS); + obstack_alloc (&objfile->psymbol_obstack, + SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); + memset (objfile->section_offsets, 0, + SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); /* Now calculate offsets for section that were specified by the caller. */ - for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++) + for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) { struct other_sections *osp ; @@ -584,23 +569,12 @@ syms_from_objfile (struct objfile *objfile, asection *lower_sect; asection *sect; CORE_ADDR lower_offset; - struct section_addr_info local_addr; + struct section_addr_info *local_addr = NULL; struct cleanup *old_chain; int i; gdb_assert (! (addrs && offsets)); - /* If ADDRS and OFFSETS are both NULL, put together a dummy address - list. We now establish the convention that an addr of zero means - no load address was specified. */ - if (! addrs && ! offsets) - { - memset (&local_addr, 0, sizeof (local_addr)); - addrs = &local_addr; - } - - /* Now either addrs or offsets is non-zero. */ - init_entry_point_info (objfile); find_sym_fns (objfile); @@ -611,6 +585,19 @@ syms_from_objfile (struct objfile *objfile, if an error occurs during symbol reading. */ old_chain = make_cleanup_free_objfile (objfile); + /* If ADDRS and OFFSETS are both NULL, put together a dummy address + list. We now establish the convention that an addr of zero means + no load address was specified. */ + if (! addrs && ! offsets) + { + local_addr + = alloc_section_addr_info (bfd_count_sections (objfile->obfd)); + make_cleanup (xfree, local_addr); + addrs = local_addr; + } + + /* Now either addrs or offsets is non-zero. */ + if (mainline) { /* We will modify the main symbol table, make sure that all its users @@ -674,7 +661,7 @@ syms_from_objfile (struct objfile *objfile, /* Calculate offsets for sections. */ if (addrs) - for (i=0 ; i < MAX_SECTIONS && addrs->other[i].name; i++) + for (i=0 ; i < addrs->num_sections && addrs->other[i].name; i++) { if (addrs->other[i].addr != 0) { @@ -758,7 +745,7 @@ syms_from_objfile (struct objfile *objfile, int i; for (i = 0; - !s_addr && i < MAX_SECTIONS && addrs->other[i].name; + !s_addr && i < addrs->num_sections && addrs->other[i].name; i++) if (strcmp (bfd_section_name (s->objfile->obfd, s->the_bfd_section), @@ -849,10 +836,8 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, struct partial_symtab *psymtab; char *debugfile; bfd *abfd; - struct section_addr_info orig_addrs; - - if (addrs) - orig_addrs = *addrs; + struct section_addr_info *orig_addrs; + struct cleanup *my_cleanups; /* Open a bfd for the file, and give user a chance to burp if we'd be interactively wiping out any existing symbols. */ @@ -867,6 +852,11 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, objfile = allocate_objfile (abfd, flags); + orig_addrs = alloc_section_addr_info (bfd_count_sections (abfd)); + my_cleanups = make_cleanup (xfree, orig_addrs); + if (addrs) + *orig_addrs = *addrs; + /* If the objfile uses a mapped symbol file, and we have a psymtab for it, then skip reading any symbols at this time. */ @@ -933,7 +923,7 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, if (addrs != NULL) { objfile->separate_debug_objfile - = symbol_file_add (debugfile, from_tty, &orig_addrs, 0, flags); + = symbol_file_add (debugfile, from_tty, orig_addrs, 0, flags); } else { @@ -972,6 +962,8 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, time. */ gdb_flush (gdb_stdout); + do_cleanups (my_cleanups); + if (objfile->sf == NULL) return objfile; /* No symbols. */ @@ -1689,15 +1681,21 @@ add_symbol_file_command (char *args, int from_tty) int expecting_sec_name = 0; int expecting_sec_addr = 0; - struct + struct sect_opt { char *name; char *value; - } sect_opts[SECT_OFF_MAX]; + }; - struct section_addr_info section_addrs; + struct section_addr_info *section_addrs; + struct sect_opt *sect_opts = NULL; + size_t num_sect_opts = 0; struct cleanup *my_cleanups = make_cleanup (null_cleanup, NULL); + num_sect_opts = 16; + sect_opts = (struct sect_opt *) xmalloc (num_sect_opts + * sizeof (struct sect_opt)); + dont_repeat (); if (args == NULL) @@ -1706,9 +1704,6 @@ add_symbol_file_command (char *args, int from_tty) /* Make a copy of the string that we can safely write into. */ args = xstrdup (args); - /* Ensure section_addrs is initialized */ - memset (§ion_addrs, 0, sizeof (section_addrs)); - while (*args != '\000') { /* Any leading spaces? */ @@ -1741,7 +1736,14 @@ add_symbol_file_command (char *args, int from_tty) to load the program. */ sect_opts[section_index].name = ".text"; sect_opts[section_index].value = arg; - section_index++; + if (++section_index > num_sect_opts) + { + num_sect_opts *= 2; + sect_opts = ((struct sect_opt *) + xrealloc (sect_opts, + num_sect_opts + * sizeof (struct sect_opt))); + } } else { @@ -1758,8 +1760,6 @@ add_symbol_file_command (char *args, int from_tty) else if (strcmp (arg, "-s") == 0) { - if (section_index >= SECT_OFF_MAX) - error ("Too many sections specified."); expecting_sec_name = 1; expecting_sec_addr = 1; } @@ -1776,7 +1776,14 @@ add_symbol_file_command (char *args, int from_tty) { sect_opts[section_index].value = arg; expecting_sec_addr = 0; - section_index++; + if (++section_index > num_sect_opts) + { + num_sect_opts *= 2; + sect_opts = ((struct sect_opt *) + xrealloc (sect_opts, + num_sect_opts + * sizeof (struct sect_opt))); + } } else error ("USAGE: add-symbol-file [-mapped] [-readnow] [-s ]*"); @@ -1792,6 +1799,8 @@ add_symbol_file_command (char *args, int from_tty) string. */ printf_filtered ("add symbol table from file \"%s\" at\n", filename); + section_addrs = alloc_section_addr_info (section_index); + make_cleanup (xfree, section_addrs); for (i = 0; i < section_index; i++) { CORE_ADDR addr; @@ -1806,8 +1815,8 @@ add_symbol_file_command (char *args, int from_tty) /* Here we store the section offsets in the order they were entered on the command line. */ - section_addrs.other[sec_num].name = sec; - section_addrs.other[sec_num].addr = addr; + section_addrs->other[sec_num].name = sec; + section_addrs->other[sec_num].addr = addr; printf_filtered ("\t%s_addr = %s\n", sec, local_hex_string ((unsigned long)addr)); @@ -1823,7 +1832,7 @@ add_symbol_file_command (char *args, int from_tty) if (from_tty && (!query ("%s", ""))) error ("Not confirmed."); - symbol_file_add (filename, from_tty, §ion_addrs, 0, flags); + symbol_file_add (filename, from_tty, section_addrs, 0, flags); /* Getting new symbols may change our opinion about what is frameless. */ @@ -1920,8 +1929,10 @@ reread_symbols (void) /* Save the offsets, we will nuke them with the rest of the psymbol_obstack. */ num_offsets = objfile->num_sections; - offsets = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); - memcpy (offsets, objfile->section_offsets, SIZEOF_SECTION_OFFSETS); + offsets = ((struct section_offsets *) + alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets))); + memcpy (offsets, objfile->section_offsets, + SIZEOF_N_SECTION_OFFSETS (num_offsets)); /* Nuke all the state that we will re-read. Much of the following code which sets things to NULL really is necessary to tell @@ -1989,8 +2000,10 @@ reread_symbols (void) /* We use the same section offsets as from last time. I'm not sure whether that is always correct for shared libraries. */ objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS); - memcpy (objfile->section_offsets, offsets, SIZEOF_SECTION_OFFSETS); + obstack_alloc (&objfile->psymbol_obstack, + SIZEOF_N_SECTION_OFFSETS (num_offsets)); + memcpy (objfile->section_offsets, offsets, + SIZEOF_N_SECTION_OFFSETS (num_offsets)); objfile->num_sections = num_offsets; /* What the hell is sym_new_init for, anyway? The concept of @@ -2965,7 +2978,7 @@ pc_in_mapped_range (CORE_ADDR pc, asection *section) /* Return true if the mapped ranges of sections A and B overlap, false otherwise. */ -int +static int sections_overlap (asection *a, asection *b) { /* FIXME: need bfd *, so we can use bfd_section_vma methods. */ diff --git a/gdb/symfile.h b/gdb/symfile.h index 04b0d89..5339253 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -1,7 +1,7 @@ /* Definitions for reading symbol files into GDB. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -26,113 +26,117 @@ /* This file requires that you first include "bfd.h". */ /* Opaque declarations. */ +struct section_table; struct objfile; struct obstack; struct block; -/* Partial symbols are stored in the psymbol_cache and pointers to them - are kept in a dynamically grown array that is obtained from malloc and - grown as necessary via realloc. Each objfile typically has two of these, - one for global symbols and one for static symbols. Although this adds - a level of indirection for storing or accessing the partial symbols, - it allows us to throw away duplicate psymbols and set all pointers - to the single saved instance. */ +/* Partial symbols are stored in the psymbol_cache and pointers to + them are kept in a dynamically grown array that is obtained from + malloc and grown as necessary via realloc. Each objfile typically + has two of these, one for global symbols and one for static + symbols. Although this adds a level of indirection for storing or + accessing the partial symbols, it allows us to throw away duplicate + psymbols and set all pointers to the single saved instance. */ struct psymbol_allocation_list - { +{ - /* Pointer to beginning of dynamically allocated array of pointers to - partial symbols. The array is dynamically expanded as necessary to - accommodate more pointers. */ + /* Pointer to beginning of dynamically allocated array of pointers + to partial symbols. The array is dynamically expanded as + necessary to accommodate more pointers. */ - struct partial_symbol **list; + struct partial_symbol **list; - /* Pointer to next available slot in which to store a pointer to a partial - symbol. */ + /* Pointer to next available slot in which to store a pointer to a + partial symbol. */ - struct partial_symbol **next; + struct partial_symbol **next; - /* Number of allocated pointer slots in current dynamic array (not the - number of bytes of storage). The "next" pointer will always point - somewhere between list[0] and list[size], and when at list[size] the - array will be expanded on the next attempt to store a pointer. */ + /* Number of allocated pointer slots in current dynamic array (not + the number of bytes of storage). The "next" pointer will always + point somewhere between list[0] and list[size], and when at + list[size] the array will be expanded on the next attempt to + store a pointer. */ - int size; - }; + int size; +}; /* Define an array of addresses to accommodate non-contiguous dynamic loading of modules. This is for use when entering commands, so we - can keep track of the section names until we read the file and - can map them to bfd sections. This structure is also used by - solib.c to communicate the section addresses in shared objects to - symbol_file_add (). */ - -#define MAX_SECTIONS 64 -struct section_addr_info + can keep track of the section names until we read the file and can + map them to bfd sections. This structure is also used by solib.c + to communicate the section addresses in shared objects to + symbol_file_add (). */ + +struct section_addr_info { + /* The number of sections for which address information is + available. */ + size_t num_sections; /* Sections whose names are file format dependent. */ struct other_sections { CORE_ADDR addr; char *name; int sectindex; - } other[MAX_SECTIONS]; + } other[1]; }; /* Structure to keep track of symbol reading functions for various object file types. */ struct sym_fns - { +{ - /* BFD flavour that we handle, or (as a special kludge, see xcoffread.c, - (enum bfd_flavour)-1 for xcoff). */ + /* BFD flavour that we handle, or (as a special kludge, see + xcoffread.c, (enum bfd_flavour)-1 for xcoff). */ - enum bfd_flavour sym_flavour; + enum bfd_flavour sym_flavour; - /* Initializes anything that is global to the entire symbol table. It is - called during symbol_file_add, when we begin debugging an entirely new - program. */ + /* Initializes anything that is global to the entire symbol table. + It is called during symbol_file_add, when we begin debugging an + entirely new program. */ - void (*sym_new_init) (struct objfile *); + void (*sym_new_init) (struct objfile *); - /* Reads any initial information from a symbol file, and initializes the - struct sym_fns SF in preparation for sym_read(). It is called every - time we read a symbol file for any reason. */ + /* Reads any initial information from a symbol file, and initializes + the struct sym_fns SF in preparation for sym_read(). It is + called every time we read a symbol file for any reason. */ - void (*sym_init) (struct objfile *); + void (*sym_init) (struct objfile *); - /* sym_read (objfile, mainline) - Reads a symbol file into a psymtab (or possibly a symtab). - OBJFILE is the objfile struct for the file we are reading. - MAINLINE is 1 if this is the - main symbol table being read, and 0 if a secondary - symbol file (e.g. shared library or dynamically loaded file) - is being read. */ + /* sym_read (objfile, mainline) Reads a symbol file into a psymtab + (or possibly a symtab). OBJFILE is the objfile struct for the + file we are reading. MAINLINE is 1 if this is the main symbol + table being read, and 0 if a secondary symbol file (e.g. shared + library or dynamically loaded file) is being read. */ - void (*sym_read) (struct objfile *, int); + void (*sym_read) (struct objfile *, int); - /* Called when we are finished with an objfile. Should do all cleanup - that is specific to the object file format for the particular objfile. */ + /* Called when we are finished with an objfile. Should do all + cleanup that is specific to the object file format for the + particular objfile. */ - void (*sym_finish) (struct objfile *); + void (*sym_finish) (struct objfile *); - /* This function produces a file-dependent section_offsets structure, - allocated in the objfile's storage, and based on the parameter. - The parameter is currently a CORE_ADDR (FIXME!) for backward compatibility - with the higher levels of GDB. It should probably be changed to - a string, where NULL means the default, and others are parsed in a file - dependent way. */ + /* This function produces a file-dependent section_offsets + structure, allocated in the objfile's storage, and based on the + parameter. The parameter is currently a CORE_ADDR (FIXME!) for + backward compatibility with the higher levels of GDB. It should + probably be changed to a string, where NULL means the default, + and others are parsed in a file dependent way. */ - void (*sym_offsets) (struct objfile *, struct section_addr_info *); + void (*sym_offsets) (struct objfile *, struct section_addr_info *); - /* Finds the next struct sym_fns. They are allocated and initialized - in whatever module implements the functions pointed to; an - initializer calls add_symtab_fns to add them to the global chain. */ + /* Finds the next struct sym_fns. They are allocated and + initialized in whatever module implements the functions pointed + to; an initializer calls add_symtab_fns to add them to the global + chain. */ - struct sym_fns *next; + struct sym_fns *next; - }; +}; /* The default version of sym_fns.sym_offsets for readers that don't do anything special. */ @@ -144,21 +148,21 @@ extern void default_symfile_offsets (struct objfile *objfile, extern void extend_psymbol_list (struct psymbol_allocation_list *, struct objfile *); -/* Add any kind of symbol to a psymbol_allocation_list. */ +/* Add any kind of symbol to a psymbol_allocation_list. */ /* #include "demangle.h" */ -extern void -add_psymbol_to_list (char *, int, domain_enum, enum address_class, - struct psymbol_allocation_list *, long, CORE_ADDR, - enum language, struct objfile *); +extern void add_psymbol_to_list (char *, int, domain_enum, enum address_class, + struct psymbol_allocation_list *, long, + CORE_ADDR, enum language, struct objfile *); -extern void -add_psymbol_with_dem_name_to_list (char *, int, char *, int, domain_enum, - enum address_class, - struct psymbol_allocation_list *, - long, CORE_ADDR, - enum language, struct objfile *); +extern void add_psymbol_with_dem_name_to_list (char *, int, char *, int, + domain_enum, + enum address_class, + struct psymbol_allocation_list + *, long, CORE_ADDR, + enum language, + struct objfile *); extern void init_psymbol_list (struct objfile *, int); @@ -176,24 +180,30 @@ extern void add_symtab_fns (struct sym_fns *); extern void init_entry_point_info (struct objfile *); extern void syms_from_objfile (struct objfile *, - struct section_addr_info *, - struct section_offsets *, int, - int, int); + struct section_addr_info *, + struct section_offsets *, int, int, int); extern void new_symfile_objfile (struct objfile *, int, int); extern struct objfile *symbol_file_add (char *, int, struct section_addr_info *, int, int); -/* Build (allocate and populate) a section_addr_info struct from - an existing section table. */ +/* Create a new section_addr_info, with room for NUM_SECTIONS. */ -struct section_table; -extern struct section_addr_info * -build_section_addr_info_from_section_table (const struct section_table *start, - const struct section_table *end); +extern struct section_addr_info *alloc_section_addr_info (size_t + num_sections); + +/* Build (allocate and populate) a section_addr_info struct from an + existing section table. */ -/* Free all memory allocated by build_section_addr_info_from_section_table. */ +extern struct section_addr_info + *build_section_addr_info_from_section_table (const struct section_table + *start, + const struct section_table + *end); + +/* Free all memory allocated by + build_section_addr_info_from_section_table. */ extern void free_section_addr_info (struct section_addr_info *); @@ -204,20 +214,14 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *, struct partial_symbol **, struct partial_symbol **); -/* Sorting your symbols for fast lookup or alphabetical printing. */ - -extern void sort_block_syms (struct block *); - -extern void sort_symtab_syms (struct symtab *); - -/* Make a copy of the string at PTR with SIZE characters in the symbol obstack - (and add a null character at the end in the copy). - Returns the address of the copy. */ +/* Make a copy of the string at PTR with SIZE characters in the symbol + obstack (and add a null character at the end in the copy). Returns + the address of the copy. */ extern char *obsavestring (const char *, int, struct obstack *); -/* Concatenate strings S1, S2 and S3; return the new string. - Space is found in the symbol_obstack. */ +/* Concatenate strings S1, S2 and S3; return the new string. Space is + found in the symbol_obstack. */ extern char *obconcat (struct obstack *obstackp, const char *, const char *, const char *); @@ -232,7 +236,7 @@ extern char *obconcat (struct obstack *obstackp, const char *, const char *, this flag and then add the shared library symbols as needed. Note that there is a potential for confusion, since if the shared library symbols are not loaded, commands like "info fun" will *not* - report all the functions that are actually present. */ + report all the functions that are actually present. */ extern int auto_solib_add; @@ -241,8 +245,7 @@ extern int auto_solib_add; known to the debugger would cause the total shared library symbol size to exceed this threshhold, then the shlib's symbols are not added. The threshold is ignored if the user explicitly asks for a - shlib to be added, such as when using the "sharedlibrary" - command. */ + shlib to be added, such as when using the "sharedlibrary" command. */ extern int auto_solib_limit; @@ -261,58 +264,59 @@ extern bfd *symfile_bfd_open (char *); extern int get_section_index (struct objfile *, char *); /* Utility functions for overlay sections: */ -extern enum overlay_debugging_state { - ovly_off, - ovly_on, +extern enum overlay_debugging_state +{ + ovly_off, + ovly_on, ovly_auto } overlay_debugging; extern int overlay_cache_invalid; -/* return the "mapped" overlay section containing the PC */ +/* Return the "mapped" overlay section containing the PC. */ extern asection *find_pc_mapped_section (CORE_ADDR); -/* return any overlay section containing the PC (even in its LMA region) */ +/* Return any overlay section containing the PC (even in its LMA + region). */ extern asection *find_pc_overlay (CORE_ADDR); -/* return true if the section is an overlay */ +/* Return true if the section is an overlay. */ extern int section_is_overlay (asection *); -/* return true if the overlay section is currently "mapped" */ +/* Return true if the overlay section is currently "mapped". */ extern int section_is_mapped (asection *); -/* return true if pc belongs to section's VMA */ +/* Return true if pc belongs to section's VMA. */ extern CORE_ADDR pc_in_mapped_range (CORE_ADDR, asection *); -/* return true if pc belongs to section's LMA */ +/* Return true if pc belongs to section's LMA. */ extern CORE_ADDR pc_in_unmapped_range (CORE_ADDR, asection *); -/* map an address from a section's LMA to its VMA */ +/* Map an address from a section's LMA to its VMA. */ extern CORE_ADDR overlay_mapped_address (CORE_ADDR, asection *); -/* map an address from a section's VMA to its LMA */ +/* Map an address from a section's VMA to its LMA. */ extern CORE_ADDR overlay_unmapped_address (CORE_ADDR, asection *); -/* convert an address in an overlay section (force into VMA range) */ +/* Convert an address in an overlay section (force into VMA range). */ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); -/* Load symbols from a file. */ +/* Load symbols from a file. */ extern void symbol_file_add_main (char *args, int from_tty); -/* Clear GDB symbol tables. */ +/* Clear GDB symbol tables. */ extern void symbol_file_clear (int from_tty); extern bfd_byte *symfile_relocate_debug_section (bfd *abfd, asection *sectp, - bfd_byte *buf); + bfd_byte * buf); /* From dwarfread.c */ -extern void -dwarf_build_psymtabs (struct objfile *, int, file_ptr, unsigned int, - file_ptr, unsigned int); +extern void dwarf_build_psymtabs (struct objfile *, int, file_ptr, + unsigned int, file_ptr, unsigned int); /* From dwarf2read.c */ -extern int dwarf2_has_info (bfd * abfd); +extern int dwarf2_has_info (bfd *abfd); extern void dwarf2_build_psymtabs (struct objfile *, int); extern void dwarf2_build_frame_info (struct objfile *); @@ -321,17 +325,17 @@ extern void dwarf2_build_frame_info (struct objfile *); /* Hack to force structures to exist before use in parameter list. */ struct ecoff_debug_hack - { - struct ecoff_debug_swap *a; - struct ecoff_debug_info *b; - }; -extern void -mdebug_build_psymtabs (struct objfile *, - const struct ecoff_debug_swap *, - struct ecoff_debug_info *); - -extern void -elfmdebug_build_psymtabs (struct objfile *, - const struct ecoff_debug_swap *, asection *); +{ + struct ecoff_debug_swap *a; + struct ecoff_debug_info *b; +}; + +extern void mdebug_build_psymtabs (struct objfile *, + const struct ecoff_debug_swap *, + struct ecoff_debug_info *); + +extern void elfmdebug_build_psymtabs (struct objfile *, + const struct ecoff_debug_swap *, + asection *); #endif /* !defined(SYMFILE_H) */ diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 3b57e5f..c3cd7ab 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -34,6 +34,7 @@ #include "bcache.h" #include "block.h" #include "gdb_regex.h" +#include "dictionary.h" #include "gdb_string.h" #include @@ -87,22 +88,22 @@ static void free_symtab_block (struct objfile *, struct block *); /* Free a struct block <- B and all the symbols defined in that block. */ +/* FIXME: carlton/2003-04-28: I don't believe this is currently ever + used. */ + static void free_symtab_block (struct objfile *objfile, struct block *b) { - register int i, n; - struct symbol *sym, *next_sym; + struct dict_iterator iter; + struct symbol *sym; - n = BLOCK_BUCKETS (b); - for (i = 0; i < n; i++) + ALL_BLOCK_SYMBOLS (b, iter, sym) { - for (sym = BLOCK_BUCKET (b, i); sym; sym = next_sym) - { - next_sym = sym->hash_next; - xmfree (objfile->md, DEPRECATED_SYMBOL_NAME (sym)); - xmfree (objfile->md, sym); - } + xmfree (objfile->md, DEPRECATED_SYMBOL_NAME (sym)); + xmfree (objfile->md, sym); } + + dict_free (BLOCK_DICT (b)); xmfree (objfile->md, b); } @@ -141,7 +142,7 @@ free_symtab (register struct symtab *s) /* Also free the linetable. */ case free_linetable: - /* Everything will be freed either by our `free_ptr' + /* Everything will be freed either by our `free_func' or by some other symtab, except for our linetable. Free that now. */ if (LINETABLE (s)) @@ -150,8 +151,8 @@ free_symtab (register struct symtab *s) } /* If there is a single block of memory to free, free it. */ - if (s->free_ptr != NULL) - xmfree (s->objfile->md, s->free_ptr); + if (s->free_func != NULL) + s->free_func (s); /* Free source-related stuff */ if (s->line_charpos != NULL) @@ -444,12 +445,13 @@ static void dump_symtab (struct objfile *objfile, struct symtab *symtab, struct ui_file *outfile) { - register int i, j; + int i; + struct dict_iterator iter; int len, blen; - register struct linetable *l; + struct linetable *l; struct blockvector *bv; struct symbol *sym; - register struct block *b; + struct block *b; int depth; fprintf_filtered (outfile, "\nSymtab for file %s\n", symtab->filename); @@ -496,11 +498,8 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab, /* drow/2002-07-10: We could save the total symbols count even if we're using a hashtable, but nothing else but this message wants it. */ - blen = BLOCK_BUCKETS (b); - if (BLOCK_HASHTABLE (b)) - fprintf_filtered (outfile, ", %d buckets in ", blen); - else - fprintf_filtered (outfile, ", %d syms in ", blen); + fprintf_filtered (outfile, ", %d syms/buckets in ", + dict_size (BLOCK_DICT (b))); print_address_numeric (BLOCK_START (b), 1, outfile); fprintf_filtered (outfile, ".."); print_address_numeric (BLOCK_END (b), 1, outfile); @@ -518,7 +517,7 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab, fprintf_filtered (outfile, "\n"); /* Now print each symbol in this block (in no particular order, if we're using a hashtable). */ - ALL_BLOCK_SYMBOLS (b, j, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { struct print_symbol_args s; s.symbol = sym; diff --git a/gdb/symtab.c b/gdb/symtab.c index 1e1b5de..ddf8748 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -46,6 +46,7 @@ #include "gdb_obstack.h" #include "block.h" +#include "dictionary.h" #include #include @@ -76,11 +77,6 @@ static int find_line_common (struct linetable *, int, int *); char *operator_chars (char *p, char **end); -static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *, - const char *, - const char *, int, - domain_enum); - static struct symbol *lookup_symbol_aux (const char *name, const char *linkage_name, const struct block *block, @@ -135,8 +131,6 @@ static void print_msymbol_info (struct minimal_symbol *); static void symtab_symbol_info (char *, domain_enum, int); -static void overload_list_add_symbol (struct symbol *sym, char *oload_name); - void _initialize_symtab (void); /* */ @@ -1233,7 +1227,7 @@ lookup_symbol_aux_minsyms (const char *name, bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - /* This call used to pass `DEPRECATED_SYMBOL_NAME (msymbol)' as the + /* This call used to pass `SYMBOL_LINKAGE_NAME (msymbol)' as the `name' argument to lookup_block_symbol. But the name of a minimal symbol is always mangled, so that seems to be clearly the wrong thing to pass as the @@ -1391,7 +1385,7 @@ lookup_symbol_global (const char *name, linkage name matches it. Check the global symbols if GLOBAL, the static symbols if not */ -static struct partial_symbol * +struct partial_symbol * lookup_partial_symbol (struct partial_symtab *pst, const char *name, const char *linkage_name, int global, domain_enum domain) @@ -1633,127 +1627,39 @@ lookup_block_symbol (register const struct block *block, const char *name, const char *linkage_name, const domain_enum domain) { - register int bot, top, inc; - register struct symbol *sym; - register struct symbol *sym_found = NULL; - register int do_linear_search = 1; + struct dict_iterator iter; + struct symbol *sym; - if (BLOCK_HASHTABLE (block)) + if (!BLOCK_FUNCTION (block)) { - unsigned int hash_index; - hash_index = msymbol_hash_iw (name); - hash_index = hash_index % BLOCK_BUCKETS (block); - for (sym = BLOCK_BUCKET (block, hash_index); sym; sym = sym->hash_next) + for (sym = dict_iter_name_first (BLOCK_DICT (block), name, &iter); + sym != NULL; + sym = dict_iter_name_next (name, &iter)) { - if (SYMBOL_DOMAIN (sym) == domain - && (linkage_name - ? strcmp (DEPRECATED_SYMBOL_NAME (sym), linkage_name) == 0 - : SYMBOL_MATCHES_NATURAL_NAME (sym, name))) + if (SYMBOL_DOMAIN (sym) == domain + && (linkage_name != NULL + ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1)) return sym; } return NULL; } - - /* If the blocks's symbols were sorted, start with a binary search. */ - - if (BLOCK_SHOULD_SORT (block)) + else { - /* Reset the linear search flag so if the binary search fails, we - won't do the linear search once unless we find some reason to - do so */ - - do_linear_search = 0; - top = BLOCK_NSYMS (block); - bot = 0; + /* Note that parameter symbols do not always show up last in the + list; this loop makes sure to take anything else other than + parameter symbols first; it only uses parameter symbols as a + last resort. Note that this only takes up extra computation + time on a match. */ - /* Advance BOT to not far before the first symbol whose name is NAME. */ + struct symbol *sym_found = NULL; - while (1) - { - inc = (top - bot + 1); - /* No need to keep binary searching for the last few bits worth. */ - if (inc < 4) - { - break; - } - inc = (inc >> 1) + bot; - sym = BLOCK_SYM (block, inc); - if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java)) - { - do_linear_search = 1; - } - if (SYMBOL_NATURAL_NAME (sym)[0] < name[0]) - { - bot = inc; - } - else if (SYMBOL_NATURAL_NAME (sym)[0] > name[0]) - { - top = inc; - } - else if (strcmp (SYMBOL_NATURAL_NAME (sym), name) < 0) - { - bot = inc; - } - else - { - top = inc; - } - } - - /* Now scan forward until we run out of symbols, find one whose - name is greater than NAME, or find one we want. If there is - more than one symbol with the right name and domain, we - return the first one; I believe it is now impossible for us - to encounter two symbols with the same name and domain - here, because blocks containing argument symbols are no - longer sorted. The exception is for C++, where multiple functions - (cloned constructors / destructors, in particular) can have - the same demangled name. So if we have a particular - mangled name to match, try to do so. */ - - top = BLOCK_NSYMS (block); - while (bot < top) - { - sym = BLOCK_SYM (block, bot); - if (SYMBOL_DOMAIN (sym) == domain - && (linkage_name - ? strcmp (DEPRECATED_SYMBOL_NAME (sym), linkage_name) == 0 - : SYMBOL_MATCHES_NATURAL_NAME (sym, name))) - { - return sym; - } - if (SYMBOL_PRINT_NAME (sym)[0] > name[0]) - { - break; - } - bot++; - } - } - - /* Here if block isn't sorted, or we fail to find a match during the - binary search above. If during the binary search above, we find a - symbol which is a Java symbol, then we have re-enabled the linear - search flag which was reset when starting the binary search. - - This loop is equivalent to the loop above, but hacked greatly for speed. - - Note that parameter symbols do not always show up last in the - list; this loop makes sure to take anything else other than - parameter symbols first; it only uses parameter symbols as a - last resort. Note that this only takes up extra computation - time on a match. */ - - if (do_linear_search) - { - top = BLOCK_NSYMS (block); - bot = 0; - while (bot < top) + for (sym = dict_iter_name_first (BLOCK_DICT (block), name, &iter); + sym != NULL; + sym = dict_iter_name_next (name, &iter)) { - sym = BLOCK_SYM (block, bot); if (SYMBOL_DOMAIN (sym) == domain - && (linkage_name - ? strcmp (DEPRECATED_SYMBOL_NAME (sym), linkage_name) == 0 - : SYMBOL_MATCHES_NATURAL_NAME (sym, name))) + && (linkage_name != NULL + ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1)) { /* If SYM has aliases, then use any alias that is active at the current PC. If no alias is active at the current @@ -1762,18 +1668,18 @@ lookup_block_symbol (register const struct block *block, const char *name, ?!? Is checking the current pc correct? Is this routine ever called to look up a symbol from another context? - FIXME: No, it's not correct. If someone sets a - conditional breakpoint at an address, then the - breakpoint's `struct expression' should refer to the - `struct symbol' appropriate for the breakpoint's - address, which may not be the PC. + FIXME: No, it's not correct. If someone sets a + conditional breakpoint at an address, then the + breakpoint's `struct expression' should refer to the + `struct symbol' appropriate for the breakpoint's + address, which may not be the PC. - Even if it were never called from another context, - it's totally bizarre for lookup_symbol's behavior to - depend on the value of the inferior's current PC. We - should pass in the appropriate PC as well as the - block. The interface to lookup_symbol should change - to require the caller to provide a PC. */ + Even if it were never called from another context, + it's totally bizarre for lookup_symbol's behavior to + depend on the value of the inferior's current PC. We + should pass in the appropriate PC as well as the + block. The interface to lookup_symbol should change + to require the caller to provide a PC. */ if (SYMBOL_ALIASES (sym)) sym = find_active_alias (sym, read_pc ()); @@ -1790,10 +1696,9 @@ lookup_block_symbol (register const struct block *block, const char *name, break; } } - bot++; } + return (sym_found); /* Will be NULL if not found. */ } - return (sym_found); /* Will be NULL if not found. */ } /* Given a main symbol SYM and ADDR, search through the alias @@ -1896,16 +1801,16 @@ find_pc_sect_symtab (CORE_ADDR pc, asection *section) } if (section != 0) { - int i; + struct dict_iterator iter; struct symbol *sym = NULL; - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { fixup_symbol_section (sym, objfile); if (section == SYMBOL_BFD_SECTION (sym)) break; } - if ((i >= BLOCK_BUCKETS (b)) && (sym == NULL)) + if (sym == NULL) continue; /* no symbol in this symtab matches section */ } distance = BLOCK_END (b) - BLOCK_START (b); @@ -2056,7 +1961,8 @@ find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent) if (msymbol != NULL) if (MSYMBOL_TYPE (msymbol) == mst_solib_trampoline) { - mfunsym = lookup_minimal_symbol_text (DEPRECATED_SYMBOL_NAME (msymbol), NULL, NULL); + mfunsym = lookup_minimal_symbol_text (SYMBOL_LINKAGE_NAME (msymbol), + NULL, NULL); if (mfunsym == NULL) /* I eliminated this warning since it is coming out * in the following situation: @@ -2067,12 +1973,12 @@ find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent) * so of course we can't find the real func/line info, * but the "break" still works, and the warning is annoying. * So I commented out the warning. RT */ - /* warning ("In stub for %s; unable to find real function/line info", DEPRECATED_SYMBOL_NAME (msymbol)) */ ; + /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_LINKAGE_NAME (msymbol)) */ ; /* fall through */ else if (SYMBOL_VALUE (mfunsym) == SYMBOL_VALUE (msymbol)) /* Avoid infinite recursion */ /* See above comment about why warning is commented out */ - /* warning ("In stub for %s; unable to find real function/line info", DEPRECATED_SYMBOL_NAME (msymbol)) */ ; + /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_LINKAGE_NAME (msymbol)) */ ; /* fall through */ else return find_pc_line (SYMBOL_VALUE (mfunsym), 0); @@ -2842,7 +2748,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], struct blockvector *prev_bv = 0; register struct block *b; register int i = 0; - register int j; + struct dict_iterator iter; register struct symbol *sym; struct partial_symbol **psym; struct objfile *objfile; @@ -3006,7 +2912,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], symbol associated to a given minimal symbol (if any). */ if (kind == FUNCTIONS_DOMAIN - || lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), + || lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), (struct block *) NULL, VAR_DOMAIN, 0, (struct symtab **) NULL) == NULL) @@ -3031,7 +2937,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], struct symbol_search *prevtail = tail; int nfound = 0; b = BLOCKVECTOR_BLOCK (bv, i); - ALL_BLOCK_SYMBOLS (b, j, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { QUIT; if (file_matches (s->filename, files, nfiles) @@ -3098,7 +3004,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))) { /* Variables/Absolutes: Look up by name */ - if (lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), + if (lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), (struct block *) NULL, VAR_DOMAIN, 0, (struct symtab **) NULL) == NULL) { @@ -3278,12 +3184,12 @@ rbreak_command (char *regexp, int from_tty) { if (p->msymbol == NULL) { - char *string = (char *) alloca (strlen (p->symtab->filename) - + strlen (DEPRECATED_SYMBOL_NAME (p->symbol)) - + 4); + char *string = alloca (strlen (p->symtab->filename) + + strlen (SYMBOL_LINKAGE_NAME (p->symbol)) + + 4); strcpy (string, p->symtab->filename); strcat (string, ":'"); - strcat (string, DEPRECATED_SYMBOL_NAME (p->symbol)); + strcat (string, SYMBOL_LINKAGE_NAME (p->symbol)); strcat (string, "'"); break_command (string, from_tty); print_symbol_info (FUNCTIONS_DOMAIN, @@ -3294,7 +3200,7 @@ rbreak_command (char *regexp, int from_tty) } else { - break_command (DEPRECATED_SYMBOL_NAME (p->msymbol), from_tty); + break_command (SYMBOL_LINKAGE_NAME (p->msymbol), from_tty); printf_filtered (" %s;\n", SYMBOL_PRINT_NAME (p->msymbol)); } @@ -3311,17 +3217,8 @@ static int return_val_index; static char **return_val; #define COMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \ - do { \ - if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) \ - /* Put only the mangled name on the list. */ \ - /* Advantage: "b foo" completes to "b foo(int, int)" */ \ - /* Disadvantage: "b foo__i" doesn't complete. */ \ completion_list_add_name \ - (SYMBOL_DEMANGLED_NAME (symbol), (sym_text), (len), (text), (word)); \ - else \ - completion_list_add_name \ - (DEPRECATED_SYMBOL_NAME (symbol), (sym_text), (len), (text), (word)); \ - } while (0) + (SYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word)) /* Test to see if the symbol specified by SYMNAME (which is already demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN @@ -3492,13 +3389,14 @@ language_search_unquoted_string (char *text, char *p) char ** make_symbol_completion_list (char *text, char *word) { - register struct symbol *sym; - register struct symtab *s; - register struct partial_symtab *ps; - register struct minimal_symbol *msymbol; - register struct objfile *objfile; - register struct block *b, *surrounding_static_block = 0; - register int i, j; + struct symbol *sym; + struct symtab *s; + struct partial_symtab *ps; + struct minimal_symbol *msymbol; + struct objfile *objfile; + struct block *b, *surrounding_static_block = 0; + struct dict_iterator iter; + int j; struct partial_symbol **psym; /* The symbol we are completing on. Points in same buffer as text. */ char *sym_text; @@ -3621,7 +3519,7 @@ make_symbol_completion_list (char *text, char *word) /* Also catch fields of types defined in this places which match our text string. Only complete on types visible from current context. */ - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { QUIT; COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); @@ -3652,7 +3550,7 @@ make_symbol_completion_list (char *text, char *word) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); } @@ -3665,7 +3563,7 @@ make_symbol_completion_list (char *text, char *word) /* Don't do this block twice. */ if (b == surrounding_static_block) continue; - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); } @@ -3683,7 +3581,7 @@ make_file_symbol_completion_list (char *text, char *word, char *srcfile) register struct symbol *sym; register struct symtab *s; register struct block *b; - register int i; + struct dict_iterator iter; /* The symbol we are completing on. Points in same buffer as text. */ char *sym_text; /* Length of sym_text. */ @@ -3762,13 +3660,13 @@ make_file_symbol_completion_list (char *text, char *word, char *srcfile) symbols which match. */ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); } b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, sym) + ALL_BLOCK_SYMBOLS (b, iter, sym) { COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); } @@ -4009,211 +3907,6 @@ in_prologue (CORE_ADDR pc, CORE_ADDR func_start) return func_addr <= pc && pc < sal.end; } - -/* Begin overload resolution functions */ - -static char * -remove_params (const char *demangled_name) -{ - const char *argp; - char *new_name; - int depth; - - if (demangled_name == NULL) - return NULL; - - /* First find the end of the arg list. */ - argp = strrchr (demangled_name, ')'); - if (argp == NULL) - return NULL; - - /* Back up to the beginning. */ - depth = 1; - - while (argp-- > demangled_name) - { - if (*argp == ')') - depth ++; - else if (*argp == '(') - { - depth --; - - if (depth == 0) - break; - } - } - if (depth != 0) - internal_error (__FILE__, __LINE__, - "bad demangled name %s\n", demangled_name); - while (argp[-1] == ' ' && argp > demangled_name) - argp --; - - new_name = xmalloc (argp - demangled_name + 1); - memcpy (new_name, demangled_name, argp - demangled_name); - new_name[argp - demangled_name] = '\0'; - return new_name; -} - -/* Helper routine for make_symbol_completion_list. */ - -static int sym_return_val_size; -static int sym_return_val_index; -static struct symbol **sym_return_val; - -/* Test to see if the symbol specified by SYMNAME (which is already - demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN - characters. If so, add it to the current completion list. */ - -static void -overload_list_add_symbol (struct symbol *sym, char *oload_name) -{ - int newsize; - int i; - char *sym_name; - - /* If there is no type information, we can't do anything, so skip */ - if (SYMBOL_TYPE (sym) == NULL) - return; - - /* skip any symbols that we've already considered. */ - for (i = 0; i < sym_return_val_index; ++i) - if (!strcmp (DEPRECATED_SYMBOL_NAME (sym), DEPRECATED_SYMBOL_NAME (sym_return_val[i]))) - return; - - /* Get the demangled name without parameters */ - sym_name = remove_params (SYMBOL_DEMANGLED_NAME (sym)); - if (!sym_name) - return; - - /* skip symbols that cannot match */ - if (strcmp (sym_name, oload_name) != 0) - { - xfree (sym_name); - return; - } - - xfree (sym_name); - - /* We have a match for an overload instance, so add SYM to the current list - * of overload instances */ - if (sym_return_val_index + 3 > sym_return_val_size) - { - newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *); - sym_return_val = (struct symbol **) xrealloc ((char *) sym_return_val, newsize); - } - sym_return_val[sym_return_val_index++] = sym; - sym_return_val[sym_return_val_index] = NULL; -} - -/* Return a null-terminated list of pointers to function symbols that - * match name of the supplied symbol FSYM. - * This is used in finding all overloaded instances of a function name. - * This has been modified from make_symbol_completion_list. */ - - -struct symbol ** -make_symbol_overload_list (struct symbol *fsym) -{ - register struct symbol *sym; - register struct symtab *s; - register struct partial_symtab *ps; - register struct objfile *objfile; - register struct block *b, *surrounding_static_block = 0; - register int i; - /* The name we are completing on. */ - char *oload_name = NULL; - /* Length of name. */ - int oload_name_len = 0; - - /* Look for the symbol we are supposed to complete on. */ - - oload_name = remove_params (SYMBOL_DEMANGLED_NAME (fsym)); - if (!oload_name) - { - sym_return_val_size = 1; - sym_return_val = (struct symbol **) xmalloc (2 * sizeof (struct symbol *)); - sym_return_val[0] = fsym; - sym_return_val[1] = NULL; - - return sym_return_val; - } - oload_name_len = strlen (oload_name); - - sym_return_val_size = 100; - sym_return_val_index = 0; - sym_return_val = (struct symbol **) xmalloc ((sym_return_val_size + 1) * sizeof (struct symbol *)); - sym_return_val[0] = NULL; - - /* Read in all partial symtabs containing a partial symbol named - OLOAD_NAME. */ - - ALL_PSYMTABS (objfile, ps) - { - struct partial_symbol **psym; - - /* If the psymtab's been read in we'll get it when we search - through the blockvector. */ - if (ps->readin) - continue; - - if ((lookup_partial_symbol (ps, oload_name, NULL, 1, VAR_DOMAIN) - != NULL) - || (lookup_partial_symbol (ps, oload_name, NULL, 0, VAR_DOMAIN) - != NULL)) - PSYMTAB_TO_SYMTAB (ps); - } - - /* Search upwards from currently selected frame (so that we can - complete on local vars. */ - - for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b)) - { - if (!BLOCK_SUPERBLOCK (b)) - { - surrounding_static_block = b; /* For elimination of dups */ - } - - /* Also catch fields of types defined in this places which match our - text string. Only complete on types visible from current context. */ - - ALL_BLOCK_SYMBOLS (b, i, sym) - { - overload_list_add_symbol (sym, oload_name); - } - } - - /* Go through the symtabs and check the externs and statics for - symbols which match. */ - - ALL_SYMTABS (objfile, s) - { - QUIT; - b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); - ALL_BLOCK_SYMBOLS (b, i, sym) - { - overload_list_add_symbol (sym, oload_name); - } - } - - ALL_SYMTABS (objfile, s) - { - QUIT; - b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); - /* Don't do this block twice. */ - if (b == surrounding_static_block) - continue; - ALL_BLOCK_SYMBOLS (b, i, sym) - { - overload_list_add_symbol (sym, oload_name); - } - } - - xfree (oload_name); - - return (sym_return_val); -} - -/* End of overload resolution functions */ struct symtabs_and_lines decode_line_spec (char *string, int funfirstline) diff --git a/gdb/symtab.h b/gdb/symtab.h index 26ea51e..771675a 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -743,9 +743,6 @@ struct section_offsets (sizeof (struct section_offsets) \ + sizeof (((struct section_offsets *) 0)->offsets) * ((n)-1)) -/* The maximum possible size of a section_offsets table. */ -#define SIZEOF_SECTION_OFFSETS (SIZEOF_N_SECTION_OFFSETS (SECT_OFF_MAX)) - /* Each source file or header is represented by a struct symtab. These objects are chained through the `next' field. */ @@ -804,10 +801,10 @@ struct symtab } free_code; - /* Pointer to one block of storage to be freed, if nonzero. */ - /* This is IN ADDITION to the action indicated by free_code. */ + /* A function to call to free space, if necessary. This is IN + ADDITION to the action indicated by free_code. */ - char *free_ptr; + void (*free_func)(struct symtab *symtab); /* Total number of lines found in source file. */ @@ -1027,6 +1024,13 @@ extern struct symbol *lookup_symbol_aux_block (const char *name, const domain_enum domain, struct symtab **symtab); +/* Lookup a partial symbol. */ + +extern struct partial_symbol *lookup_partial_symbol (struct partial_symtab *, + const char *, + const char *, int, + domain_enum); + /* lookup a symbol by name, within a specified block */ extern struct symbol *lookup_block_symbol (const struct block *, const char *, @@ -1289,8 +1293,6 @@ extern char **make_symbol_completion_list (char *, char *); extern char **make_file_symbol_completion_list (char *, char *, char *); -extern struct symbol **make_symbol_overload_list (struct symbol *); - extern char **make_source_files_completion_list (char *, char *); /* symtab.c */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3942eb7..4392f54 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,36 @@ +2003-06-12 Jeff Johnston + + * gdb.base/float.exp: Add ia64 support. + +2003-06-12 Corinna Vinschen + + * gdb.base/fileio.exp: Run only on remote targets. + +2003-06-10 Corinna Vinschen + + * gdb.base/fileio.c: New file, testing File-I/O. + * gdb.base/fileio.exp: Ditto. + +2003-06-09 Raoul Gough + + * gdb.base/shreloc.exp: New file, check symbol values obtained from + shared objects after relocation at load time (gdb PR/1132). + * gdb.base/shreloc.c, gdb.base/shreloc1.c, gdb.base/shreloc2.c: + as above, part of the shared object relocation test. + +2003-06-08 Mark Kettenis + + * gdb.base/readline.exp: Add tests for operate-and-get-next with a + fully filled history list. + * gdb.base/gdb_history: New file. + + * gdb.base/signals.exp: XFAIL "continue to func1" on + i*86-*-freebsd*. + + * gdb.base/attach.exp: When trying to attach to a nonexistent + process, make it possible to specify the PID based on the target, + and do so for *-*-freebsd*. + 2003-06-02 Richard Henderson * gdb.base/float.exp: Add expected regexp for alpha-*-*. diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index c561080..6adb6e3 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -106,32 +106,41 @@ proc do_attach_tests {} { } # Verify that we cannot attach to what appears to be a valid - # process ID, but is a process that doesn't exist. (I don't - # believe any process is ever assigned #0, at least on HPUX.) + # process ID, but is a process that doesn't exist. Traditionally, + # most systems didn't have a process with ID 0, so we take that as + # the default. However, there are a few exceptions. # - send_gdb "attach 0\n" + set boguspid 0 + if { [istarget "*-*-freebsd*"] } { + # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead + # (which should have the desired effect on any version of FreeBSD). + set boguspid -1 + } + send_gdb "attach $boguspid\n" gdb_expect { - -re "Attaching to.*, process 0.*No such process.*$gdb_prompt $"\ - { - # Response expected on HP-UX 10.20 (i.e., ptrace-based). - pass "attach to nonexistent process is prohibited" - } - -re "Attaching to.*, process 0 failed.*Hint.*$gdb_prompt $"\ - { - # Response expected on HP-UX 11.0 (i.e., ttrace-based). - pass "attach to nonexistent process is prohibited" - } - -re "Attaching to.*, process 0.*denied.*$gdb_prompt $"\ - {pass "attach to nonexistent process is prohibited"} - -re "Attaching to.*, process 0.*Operation not permitted.*$gdb_prompt $"\ - {pass "attach to nonexistent process is prohibited"} - -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ - { - # Response expected from /proc-based systems. - pass "attach to nonexistent process is prohibited" - } - -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} - timeout {fail "(timeout) attach to nonexistent process is prohibited"} + -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\ + { + # Response expected on ptrace-based systems (i.e. HP-UX 10.20). + pass "attach to nonexistent process is prohibited" + } + -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\ + { + # Response expected on ttrace-based systems (i.e. HP-UX 11.0). + pass "attach to nonexistent process is prohibited" + } + -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\ + {pass "attach to nonexistent process is prohibited"} + -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\ + {pass "attach to nonexistent process is prohibited"} + -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ + { + # Response expected from /proc-based systems. + pass "attach to nonexistent process is prohibited" + } + -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} + timeout { + fail "(timeout) attach to nonexistent process is prohibited" + } } # Verify that we can attach to the process by first giving its diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c new file mode 100644 index 0000000..fd410cd --- /dev/null +++ b/gdb/testsuite/gdb.base/fileio.c @@ -0,0 +1,468 @@ +#include +#include +#include +#include +#include +#include +#include +#include +/************************************************************************** + * TESTS : + * - open(const char *pathname, int flags, mode_t mode); +1) Attempt to create file that already exists - EEXIST +2) Attempt to open a directory for writing - EISDIR +3) Pathname does not exist - ENOENT +4) Open for write but no write permission - EACCES + +read(int fd, void *buf, size_t count); +1) Read using invalid file descriptor - EBADF + +write(int fd, const void *buf, size_t count); +1) Write using invalid file descriptor - EBADF +2) Attempt to write to read-only file - EBADF + +lseek(int fildes, off_t offset, int whence); +1) Seeking on an invalid file descriptor - EBADF +2) Invalid "whence" (3rd param) value - EINVAL + +close(int fd); +1) Attempt to close an invalid file descriptor - EBADF + +stat(const char *file_name, struct stat *buf); +1) Pathname is a null string - ENOENT +2) Pathname does not exist - ENOENT + +fstat(int filedes, struct stat *buf); +1) Attempt to stat using an invalid file descriptor - EBADF + +isatty (int desc); +Not applicable. We will test that it returns 1 when expected and a case +where it should return 0. + +rename(const char *oldpath, const char *newpath); +1) newpath is an existing directory, but oldpath is not a directory. - EISDIR +2) newpath is a non-empty directory. - ENOTEMPTY or EEXIST +3) newpath is a subdirectory of old path. - EINVAL +4) oldpath does not exist. - ENOENT + +unlink(const char *pathname); +1) pathname does not have write access. - EACCES +2) pathname does not exist. - ENOENT + +time(time_t *t); +Not applicable. + +system (const char * string); +1) Invalid string/command. - returns 127. + + ***************************************************************************/ + +#define FILENAME "foo.fileio.test" +#define RENAMED "bar.fileio.test" +#define NONEXISTANT "nofoo.fileio.test" +#define NOWRITE "nowrt.fileio.test" + +#define TESTDIR1 "dir1.fileio.test" +#define TESTDIR2 "dir2.fileio.test" +#define TESTSUBDIR "dir1.fileio.test/subdir.fileio.test" + +#define STRING "Hello World" + +int +test_open () +{ + int ret; + + /* Test opening */ + errno = 0; + ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDONLY, S_IWUSR | S_IRUSR); + printf ("open 1: ret = %d, errno = %d %s\n", ret, errno, + ret >= 0 ? "OK" : ""); + if (ret >= 0) + close (ret); + /* Creating an already existing file (created by fileio.exp) */ + errno = 0; + ret = open (FILENAME, O_CREAT | O_EXCL | O_WRONLY, S_IWUSR | S_IRUSR); + printf ("open 2: ret = %d, errno = %d %s\n", ret, errno, + errno == EEXIST ? "OK" : ""); + if (ret >= 0) + close (ret); + /* Open directory (for writing) */ + errno = 0; + ret = open (".", O_WRONLY); + printf ("open 3: ret = %d, errno = %d %s\n", ret, errno, + errno == EISDIR ? "OK" : ""); + if (ret >= 0) + close (ret); + /* Opening nonexistant file */ + errno = 0; + ret = open (NONEXISTANT, O_RDONLY); + printf ("open 4: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOENT ? "OK" : ""); + if (ret >= 0) + close (ret); + /* Open for write but no write permission */ + errno = 0; + ret = open (NOWRITE, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR); + if (ret >= 0) + { + close (ret); + errno = 0; + ret = open (NOWRITE, O_WRONLY); + printf ("open 5: ret = %d, errno = %d %s\n", ret, errno, + errno == EACCES ? "OK" : ""); + if (ret >= 0) + close (ret); + } + else + printf ("open 5: ret = %d, errno = %d\n", ret, errno); +} + +int +test_write () +{ + int fd, ret; + + /* Test writing */ + errno = 0; + fd = open (FILENAME, O_WRONLY); + if (fd >= 0) + { + errno = 0; + ret = write (fd, STRING, strlen (STRING)); + printf ("write 1: ret = %d, errno = %d %s\n", ret, errno, + ret == strlen (STRING) ? "OK" : ""); + close (fd); + } + else + printf ("write 1: ret = %d, errno = %d\n", ret, errno); + /* Write using invalid file descriptor */ + errno = 0; + ret = write (999, STRING, strlen (STRING)); + printf ("write 2: ret = %d, errno = %d, %s\n", ret, errno, + errno == EBADF ? "OK" : ""); + /* Write to a read-only file */ + errno = 0; + fd = open (FILENAME, O_RDONLY); + if (fd >= 0) + { + errno = 0; + ret = write (fd, STRING, strlen (STRING)); + printf ("write 3: ret = %d, errno = %d %s\n", ret, errno, + errno == EBADF ? "OK" : ""); + } + else + printf ("write 3: ret = %d, errno = %d\n", ret, errno); +} + +int +test_read () +{ + int fd, ret; + char buf[16]; + + /* Test reading */ + errno = 0; + fd = open (FILENAME, O_RDONLY); + if (fd >= 0) + { + memset (buf, 0, 16); + errno = 0; + ret = read (fd, buf, 16); + buf[15] = '\0'; /* Don't trust anybody... */ + if (ret == strlen (STRING)) + printf ("read 1: %s %s\n", buf, !strcmp (buf, STRING) ? "OK" : ""); + else + printf ("read 1: ret = %d, errno = %d\n", ret, errno); + close (fd); + } + else + printf ("read 1: ret = %d, errno = %d\n", ret, errno); + /* Read using invalid file descriptor */ + errno = 0; + ret = read (999, buf, 16); + printf ("read 2: ret = %d, errno = %d %s\n", ret, errno, + errno == EBADF ? "OK" : ""); +} + +int +test_lseek () +{ + int fd; + off_t ret; + + /* Test seeking */ + errno = 0; + fd = open (FILENAME, O_RDONLY); + if (fd >= 0) + { + errno = 0; + ret = lseek (fd, 0, SEEK_CUR); + printf ("lseek 1: ret = %ld, errno = %d, %s\n", ret, errno, + ret == 0 ? "OK" : ""); + errno = 0; + ret = lseek (fd, 0, SEEK_END); + printf ("lseek 2: ret = %ld, errno = %d, %s\n", ret, errno, + ret == 11 ? "OK" : ""); + errno = 0; + ret = lseek (fd, 3, SEEK_SET); + printf ("lseek 3: ret = %ld, errno = %d, %s\n", ret, errno, + ret == 3 ? "OK" : ""); + close (fd); + } + else + { + printf ("lseek 1: ret = %d, errno = %d\n", ret, errno); + printf ("lseek 2: ret = %d, errno = %d\n", ret, errno); + printf ("lseek 3: ret = %d, errno = %d\n", ret, errno); + } + /* Seeking on an invalid file descriptor */ + +} + +int +test_close () +{ + int fd, ret; + + /* Test close */ + errno = 0; + fd = open (FILENAME, O_RDONLY); + if (fd >= 0) + { + errno = 0; + ret = close (fd); + printf ("close 1: ret = %ld, errno = %d, %s\n", ret, errno, + ret == 0 ? "OK" : ""); + } + else + printf ("close 1: ret = %d, errno = %d\n", ret, errno); + /* Close an invalid file descriptor */ + errno = 0; + ret = close (999); + printf ("close 2: ret = %ld, errno = %d, %s\n", ret, errno, + errno == EBADF ? "OK" : ""); +} + +int +test_stat () +{ + int ret; + struct stat st; + + /* Test stat */ + errno = 0; + ret = stat (FILENAME, &st); + if (!ret) + printf ("stat 1: ret = %d, errno = %d %s\n", ret, errno, + st.st_size == 11 ? "OK" : ""); + else + printf ("stat 1: ret = %d, errno = %d\n", ret, errno); + /* NULL pathname */ + errno = 0; + ret = stat (NULL, &st); + printf ("stat 2: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOENT ? "OK" : ""); + /* Empty pathname */ + errno = 0; + ret = stat ("", &st); + printf ("stat 3: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOENT ? "OK" : ""); + /* Nonexistant file */ + errno = 0; + ret = stat (NONEXISTANT, &st); + printf ("stat 4: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOENT ? "OK" : ""); +} + +int +test_fstat () +{ + int fd, ret; + struct stat st; + + /* Test fstat */ + errno = 0; + fd = open (FILENAME, O_RDONLY); + if (fd >= 0) + { + errno = 0; + ret = fstat (fd, &st); + if (!ret) + printf ("fstat 1: ret = %d, errno = %d %s\n", ret, errno, + st.st_size == 11 ? "OK" : ""); + else + printf ("fstat 1: ret = %d, errno = %d\n", ret, errno); + close (fd); + } + else + printf ("fstat 1: ret = %d, errno = %d\n", ret, errno); + /* Fstat using invalid file descriptor */ + errno = 0; + ret = fstat (999, &st); + printf ("fstat 2: ret = %d, errno = %d %s\n", ret, errno, + errno == EBADF ? "OK" : ""); +} + +int +test_isatty () +{ + int fd; + + /* Check std I/O */ + printf ("isatty 1: stdin %s\n", isatty (0) ? "yes OK" : "no"); + printf ("isatty 2: stdout %s\n", isatty (1) ? "yes OK" : "no"); + printf ("isatty 3: stderr %s\n", isatty (2) ? "yes OK" : "no"); + /* Check invalid fd */ + printf ("isatty 4: invalid %s\n", isatty (999) ? "yes" : "no OK"); + /* Check open file */ + fd = open (FILENAME, O_RDONLY); + if (fd >= 0) + { + printf ("isatty 5: file %s\n", isatty (fd) ? "yes" : "no OK"); + close (fd); + } + else + printf ("isatty 5: file couldn't open\n"); +} + +int +test_system () +{ + /* + * Requires test framework to switch on "set remote system-call-allowed 1" + */ + int ret; + char sys[512]; + + /* This test prepares the directory for test_rename() */ + sprintf (sys, "mkdir -p %s %s", TESTSUBDIR, TESTDIR2); + ret = system (sys); + if (ret == 127) + printf ("system 1: ret = %d /bin/sh unavailable???\n", ret); + else + printf ("system 1: ret = %d %s\n", ret, ret == 0 ? "OK" : ""); + /* Invalid command (just guessing ;-) ) */ + ret = system ("wrtzlpfrmpft"); + printf ("system 2: ret = %d %s\n", ret, ret == 127 ? "OK" : ""); +} + +int +test_rename () +{ + int ret; + struct stat st; + + /* Test rename */ + errno = 0; + ret = rename (FILENAME, RENAMED); + if (!ret) + { + errno = 0; + ret = stat (FILENAME, &st); + if (ret && errno == ENOENT) + { + errno = 0; + ret = stat (RENAMED, &st); + printf ("rename 1: ret = %d, errno = %d %s\n", ret, errno, + errno == 0 ? "OK" : ""); + errno = 0; + } + else + printf ("rename 1: ret = %d, errno = %d\n", ret, errno); + } + else + printf ("rename 1: ret = %d, errno = %d\n", ret, errno); + /* newpath is existing directory, oldpath is not a directory */ + errno = 0; + ret = rename (RENAMED, TESTDIR2); + printf ("rename 2: ret = %d, errno = %d %s\n", ret, errno, + errno == EISDIR ? "OK" : ""); + /* newpath is a non-empty directory */ + errno = 0; + ret = rename (TESTDIR2, TESTDIR1); + printf ("rename 3: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOTEMPTY || errno == EEXIST ? "OK" : ""); + /* newpath is a subdirectory of old path */ + errno = 0; + ret = rename (TESTDIR1, TESTSUBDIR); + printf ("rename 4: ret = %d, errno = %d %s\n", ret, errno, + errno == EINVAL ? "OK" : ""); + /* oldpath does not exist */ + errno = 0; + ret = rename (NONEXISTANT, FILENAME); + printf ("rename 5: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOENT ? "OK" : ""); +} + +int +test_unlink () +{ + int ret; + char name[256]; + char sys[512]; + + /* Test unlink */ + errno = 0; + ret = unlink (RENAMED); + printf ("unlink 1: ret = %d, errno = %d %s\n", ret, errno, + errno == 0 ? "OK" : ""); + /* No write access */ + sprintf (name, "%s/%s", TESTDIR2, FILENAME); + errno = 0; + ret = open (name, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR); + if (ret >= 0) + { + sprintf (sys, "chmod -w %s", TESTDIR2); + ret = system (sys); + if (!ret) + { + errno = 0; + ret = unlink (name); + printf ("unlink 2: ret = %d, errno = %d %s\n", ret, errno, + errno == EACCES ? "OK" : ""); + } + else + printf ("unlink 2: ret = %d chmod failed\n", ret, errno); + } + else + printf ("unlink 2: ret = %d, errno = %d\n", ret, errno); + /* pathname doesn't exist */ + errno = 0; + ret = unlink (NONEXISTANT); + printf ("unlink 3: ret = %d, errno = %d %s\n", ret, errno, + errno == ENOENT ? "OK" : ""); +} + +int +test_time () +{ + time_t ret, t; + + errno = 0; + ret = time (&t); + printf ("time 1: ret = %d, errno = %d, t = %d %s\n", ret, errno, t, ret == t ? "OK" : ""); + errno = 0; + ret = time (NULL); + printf ("time 2: ret = %d, errno = %d, t = %d %s\n", ret, errno, t, + ret >= t && ret < t + 10 ? "OK" : ""); +} + +int +main () +{ + /* Don't change the order of the calls. They partly depend on each other */ + test_open (); + test_write (); + test_read (); + test_lseek (); + test_close (); + test_stat (); + test_fstat (); + test_isatty (); + test_system (); + test_rename (); + test_unlink (); + test_time (); + return 0; +} diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp new file mode 100644 index 0000000..49e8c38 --- /dev/null +++ b/gdb/testsuite/gdb.base/fileio.exp @@ -0,0 +1,272 @@ +# Copyright 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Corinna Vinschen + + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "fileio" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# test only on a remote target board +if {! [is_remote target]} { + return 0; +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# Create and source the file that provides information about the compiler +# used to compile the test case. + +if [get_compiler_info ${binfile}] { + return -1; +} + +catch "system \"chmod -f +w dir2.fileio.test\"" +catch "system \"rm -rf *.fileio.test\"" + +set oldtimeout $timeout +set timeout [expr "$timeout + 60"] + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" +send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $" +send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "tbreak 81\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*open 1:.*OK.*test_open \\(\\) at.*$srcfile:81.*" \ +"Open a file" + +send_gdb "tbreak 88\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*open 2:.*OK.*test_open \\(\\) at.*$srcfile:88.*" \ +"Creating already existing file returns EEXIST" + +send_gdb "tbreak 95\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*open 3:.*OK.*test_open \\(\\) at.*$srcfile:95.*" \ +"Open directory for writing returns EISDIR" + +send_gdb "tbreak 102\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*open 4:.*OK.*test_open \\(\\) at.*$srcfile:102.*" \ +"Opening nonexistant file returns ENOENT" + +send_gdb "tbreak 109\n" ; gdb_expect -re "$gdb_prompt $" +send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $" +catch "system \"chmod -f -w nowrt.fileio.test\"" + +send_gdb "tbreak 119\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*open 5:.*OK.*test_open \\(\\) at.*$srcfile:119.*" \ +"Open for write but no write permission returns EACCES" + +send_gdb "tbreak 140\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*write 1:.*OK.*test_write \\(\\) at.*$srcfile:140.*" \ +"Writing to a file" + +send_gdb "tbreak 145\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*write 2:.*OK.*test_write \\(\\) at.*$srcfile:145.*" \ +"Write using invalid file descriptor returns EBADF" + +send_gdb "tbreak 156\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*write 3:.*OK.*test_write \\(\\) at.*$srcfile:156.*" \ +"Writing to a read-only file returns EBADF" + +send_gdb "tbreak 182\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*read 1:.*OK.*test_read \\(\\) at.*$srcfile:182.*" \ +"Reading from a file" + +send_gdb "tbreak 186\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*read 2:.*OK.*test_read \\(\\) at.*$srcfile:186.*" \ +"Read using invalid file descriptor returns EBADF" + +send_gdb "tbreak 221\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*lseek 1:.*OK.*lseek 2:.*OK.*lseek 3:.*OK.*test_lseek \\(\\) at.*$srcfile:221.*" \ +"Lseeking a file" + +send_gdb "tbreak 241\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*close 1:.*OK.*test_close \\(\\) at.*$srcfile:241.*" \ +"Closing a file" + +send_gdb "tbreak 245\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*close 2:.*OK.*test_close \\(\\) at.*$srcfile:245.*" \ +"Closing an invalid file descriptor returns EBADF" + +send_gdb "tbreak 262\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*stat 1:.*OK.*test_stat \\(\\) at.*$srcfile:262.*" \ +"Stat a file" + +send_gdb "tbreak 267\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*stat 2:.*OK.*test_stat \\(\\) at.*$srcfile:267.*" \ +"Stat a NULL pathname returns ENOENT" + +send_gdb "tbreak 272\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*stat 3:.*OK.*test_stat \\(\\) at.*$srcfile:272.*" \ +"Stat an empty pathname returns ENOENT" + +send_gdb "tbreak 276\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*stat 4:.*OK.*test_stat \\(\\) at.*$srcfile:276.*" \ +"Stat a nonexistant file returns ENOENT" + +send_gdb "tbreak 301\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*fstat 1:.*OK.*test_fstat \\(\\) at.*$srcfile:301.*" \ +"Fstat an open file" + +send_gdb "tbreak 305\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*fstat 2:.*OK.*test_fstat \\(\\) at.*$srcfile:305.*" \ +"Fstat an invalid file descriptor returns EBADF" + +send_gdb "tbreak 314\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*isatty 1:.*OK.*test_isatty \\(\\) at.*$srcfile:314.*" \ +"Isatty (stdin)" + +send_gdb "tbreak 315\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*isatty 2:.*OK.*test_isatty \\(\\) at.*$srcfile:315.*" \ +"Isatty (stdout)" + +send_gdb "tbreak 317\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*isatty 3:.*OK.*test_isatty \\(\\) at.*$srcfile:317.*" \ +"Isatty (stderr)" + +send_gdb "tbreak 319\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*isatty 4:.*OK.*test_isatty \\(\\) at.*$srcfile:319.*" \ +"Isatty (invalid fd)" + +send_gdb "tbreak 327\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*isatty 5:.*OK.*test_isatty \\(\\) at.*$srcfile:327.*" \ +"Isatty (open file)" + +send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $" +send_gdb "tbreak 347\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*system 1:.*OK.*test_system \\(\\) at.*$srcfile:347.*" \ +"System(3) call" + +send_gdb "tbreak 349\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*system 2:.*OK.*test_system \\(\\) at.*$srcfile:349.*" \ +"System with invalid command returns 127" + +send_gdb "tbreak 378\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*rename 1:.*OK.*test_rename \\(\\) at.*$srcfile:378.*" \ +"Rename a file" + +send_gdb "tbreak 383\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*rename 2:.*OK.*test_rename \\(\\) at.*$srcfile:383.*" \ +"Renaming a file to existing directory returns EISDIR" + +send_gdb "tbreak 388\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*rename 3:.*OK.*test_rename \\(\\) at.*$srcfile:388.*" \ +"Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST" + +send_gdb "tbreak 393\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*rename 4:.*OK.*test_rename \\(\\) at.*$srcfile:393.*" \ +"Renaming a directory to a subdir of itself returns EINVAL" + +send_gdb "tbreak 397\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*rename 5:.*OK.*test_rename \\(\\) at.*$srcfile:397.*" \ +"Renaming a nonexistant file returns ENOENT" + +send_gdb "tbreak 412\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*unlink 1:.*OK.*test_unlink \\(\\) at.*$srcfile:412.*" \ +"Unlink a file" + +send_gdb "tbreak 432\n" ; gdb_expect -re "$gdb_prompt $" +# This test fails on Cygwin because unlink() succeeds on Win32 systems +# in that situation. +if [ishost *cygwin*] { + setup_xfail "*-*-*" +} +gdb_test continue \ +"Continuing\\..*unlink 2:.*OK.*test_unlink \\(\\) at.*$srcfile:432.*" \ +"Unlinking a file in a directory w/o write access returns EACCES" + +send_gdb "tbreak 436\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*unlink 3:.*OK.*test_unlink \\(\\) at.*$srcfile:436.*" \ +"Unlinking a nonexistant file returns ENOENT" + +send_gdb "tbreak 446\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*time 1:.*OK.*test_time \\(\\) at.*$srcfile:446.*" \ +"Time(2) call returns the same value as in parameter" + +sleep 2 +send_gdb "tbreak 450\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test continue \ +"Continuing\\..*time 2:.*OK.*test_time \\(\\) at.*$srcfile:450.*" \ +"Time(2) returns feasible values" + +send_gdb "quit\n" +send_gdb "y\n" + +catch "system \"chmod -f +w dir2.fileio.test\"" +catch "system \"rm -rf *.fileio.test\"" + +set timeout $oldtimeout +return 0 + diff --git a/gdb/testsuite/gdb.base/float.exp b/gdb/testsuite/gdb.base/float.exp index fff9fe6..7aa75f3 100644 --- a/gdb/testsuite/gdb.base/float.exp +++ b/gdb/testsuite/gdb.base/float.exp @@ -59,6 +59,8 @@ if { [istarget "alpha*-*-*"] } then { gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } then { gdb_test "info float" "R7:.*Status Word:.*Opcode:.*" "info float" +} elseif [istarget "ia64-*-*"] then { + gdb_test "info float" "f0.*f1.*f127.*" "info float" } else { gdb_test "info float" "No floating.point info available for this processor." "info float" } diff --git a/gdb/testsuite/gdb.base/gdb_history b/gdb/testsuite/gdb.base/gdb_history new file mode 100644 index 0000000..cc22f69 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb_history @@ -0,0 +1,256 @@ +add-symbol-file +append +append binary +append memory +append value +append binary memory +append binary value +attach +break +b +br +bre +brea +backtrace +bt +ba +bac +continue +c +call +catch +cd +clear +commands +condition +core-file +d +delete +define +delete breakpoints +delete display +detach +directory +dis +disa +disable +disable breakpoints +disable display +disassemble +display +do +document +down +down-silently +dump +dump binary +dump ihex +dump memory +dump srec +dump tekhex +dump value +dump binary memory +dump binary value +dump ihex memory +dump ihex value +dump srec memory +dump srec value +dump tekhex memory +dump tekhex value +echo +enable breakpoints delete +enable breakpoints once +enable breakpoints +enable delete +enable display +enable once +enable +exec-file +f +frame +fg +file +finish +forward-search +gcore +generate-core-file +h +help +handle +i +info +ignore +info address +info all-registers +info args +info bogus-gdb-command +info breakpoints +info catch +info copying +info display +info f +info frame +info files +info float +info functions +info locals +info program +info registers +info s +info stack +info set +info symbol +info source +info sources +info target +info terminal +info types +info variables +info warranty +info watchpoints +inspect +jump +kill +l +list +load +n +next +ni +nexti +output +overlay +overlay on +overlay manual +overlay auto +overlay off +overlay list +overlay map +overlay unmap +overlay manual +overlay map +overlay unmap +p +print +printf +ptype +pwd +r +run +rbreak +restore +return +reverse-search +s +step +search +section +set annotate +set args +set c +set ch +set check +set check range +set check type +set complaints +set confirm +set environment +set height +set history expansion +set history filename +set history save +set history size +set history +set language +set listsize +set p +set pr +set print +set print address +set print array +set print asm-demangle +set print demangle +set print elements +set print object +set print pretty +set print sevenbit-strings +set print union +set print vtbl +set radix +set symbol-reloading +set variable +set verbose +set width +set write +set +shell echo Hi dad! +show annotate +show args +show c +show ch +show check +show check range +show check type +show commands +show complaints +show confirm +show convenience +show directories +show editing +show height +show history expansion +show history filename +show history save +show history size +show history +show language +show listsize +show p +show pr +show print +show paths +show print address +show print array +show print asm-demangle +show print demangle +show print elements +show print object +show print pretty +show print sevenbit-strings +show print union +show print vtbl +show prompt +show radix +show symbol-reloading +show user +show values +show verbose +show version +show width +show write +show +si +stepi +signal +source +s +step +symbol-file +target child +target procfs +target core +target exec +target remote +target +tbreak +tty +u +until +undisplay +unset environment +unset +up-silently +watch +whatis +where +x diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp index 8edd133..511cb6b 100644 --- a/gdb/testsuite/gdb.base/readline.exp +++ b/gdb/testsuite/gdb.base/readline.exp @@ -169,7 +169,7 @@ set timeout 30 # A simple test of operate-and-get-next. operate_and_get_next "Simple operate-and-get-next" \ "p 1" ".* = 1" \ - "p 2" ".* = 2"\ + "p 2" ".* = 2" \ "p 3" ".* = 3" # Test operate-and-get-next with a secondary prompt. @@ -179,12 +179,44 @@ operate_and_get_next "operate-and-get-next with secondary prompt" \ "end" ".* = 5" +# Now repeat the first test with a history file that fills the entire +# history list. + +if [info exists env(GDBHISTFILE)] { + set old_gdbhistfile $env(GDBHISTFILE) +} +if [info exists env(HISTSIZE)] { + set old_histsize $env(HISTSIZE) +} +set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" +set env(HISTSIZE) "10" + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +operate_and_get_next "Simple operate-and-get-next" \ + "p 7" ".* = 7" \ + "p 8" ".* = 8" \ + "p 9" ".* = 9" + + # Restore globals modified in this test... if [info exists old_inputrc] { set env(INPUTRC) $old_inputrc } else { unset env(INPUTRC) } +if [info exists old_gdbhistfile] { + set env(GDBHISTFILE) $old_gdbhistfile +} else { + unset env(GDBHISTFILE) +} +if [info exists old_histsize] { + set env(HISTSIZE) $old_histsize +} else { + unset env(HISTSIZE) +} set timeout $oldtimeout1 return 0 diff --git a/gdb/testsuite/gdb.base/shreloc.c b/gdb/testsuite/gdb.base/shreloc.c new file mode 100644 index 0000000..6867362 --- /dev/null +++ b/gdb/testsuite/gdb.base/shreloc.c @@ -0,0 +1,18 @@ +#if defined(_WIN32) || defined(__CYGWIN__) +# define ATTRIBUTES __attribute((__dllimport__)) +#else +# define ATTRIBUTES +#endif + +extern ATTRIBUTES void fn_1 (int); +extern ATTRIBUTES void fn_2 (int); +extern ATTRIBUTES int extern_var_1; +extern ATTRIBUTES int extern_var_2; + +int main () +{ + fn_1 (extern_var_1); + fn_2 (extern_var_2); + + return 0; +} diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp new file mode 100644 index 0000000..ac48774 --- /dev/null +++ b/gdb/testsuite/gdb.base/shreloc.exp @@ -0,0 +1,257 @@ +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# Tests for shared object file relocation. If two shared objects have +# the same load address (actually, overlapping load spaces), one of +# them gets relocated at load-time. Check that gdb gets the right +# values for the debugging and minimal symbols. + +if $tracelevel then { + strace $tracelevel +} + +# +# This file uses shreloc.c, shreloc1.c and shreloc2.c +# + +set prms_id 0 +set bug_id 0 + +set workdir ${objdir}/${subdir} + +foreach module [list "shreloc" "shreloc1" "shreloc2"] { + if {[gdb_compile "${srcdir}/${subdir}/${module}.c" "${workdir}/${module}.o" object {debug}] != ""} { + untested "Couldn't compile ${module}.c" + return -1 + } +} + +set additional_flags "additional_flags=-shared" + +if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { + set additional_flags "${additional_flags} -Wl,--image-base,0x04000000" +} + +foreach module [list "shreloc1" "shreloc2"] { + if {[gdb_compile "${workdir}/${module}.o" "${workdir}/${module}.dll" executable [list debug $additional_flags]] != ""} { + untested "Couldn't link ${module}.dll" + return -1 + } +} + +if {[gdb_compile [list "${workdir}/shreloc.o" "${workdir}/shreloc1.dll" "${workdir}/shreloc2.dll"] "${workdir}/shreloc" executable debug] != ""} { + untested "Couldn't link shreloc executable" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${workdir}/shreloc + +# Load up the shared objects +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + +proc get_var_address { var } { + global gdb_prompt hex + + send_gdb "print &${var}\n" + # Match output like: + # $1 = (int *) 0x0 + # $5 = (int (*)()) 0 + # $6 = (int (*)()) 0x24 + gdb_expect { + -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" + { + pass "get address of ${var}" + if { $expect_out(1,string) == "0" } { + return "0x0" + } else { + return $expect_out(1,string) + } + } + -re "${gdb_prompt} $" + { fail "get address of ${var} (unknown output)" } + timeout + { fail "get address of ${var} (timeout)" } + } + return "" +} + +# +# Check debugging symbol relocations +# + +# Check extern function for relocation +set fn_1_addr [get_var_address fn_1] +set fn_2_addr [get_var_address fn_2] + +if { "${fn_1_addr}" == "${fn_2_addr}" } { + fail "relocated extern functions have different addresses" +} else { + pass "relocated extern functions have different addresses" +} + +# Check extern var for relocation +set extern_var_1_addr [get_var_address extern_var_1] +set extern_var_2_addr [get_var_address extern_var_2] + +if { "${extern_var_1_addr}" == "${extern_var_2_addr}" } { + fail "relocated extern variables have different addresses" +} else { + pass "relocated extern variables have different addresses" +} + +# Check static var for relocation +set static_var_1_addr [get_var_address static_var_1] +set static_var_2_addr [get_var_address static_var_2] + +if { "${static_var_1_addr}" == "${static_var_2_addr}" } { + fail "relocated static variables have different addresses" +} else { + pass "relocated static variables have different addresses" +} + +# +# Check minimal symbol relocations +# + +proc send_gdb_discard { command } { + # Send a command to gdb and discard output up to the next prompt + + global gdb_prompt + + send_gdb "${command}\n" + + # Discard output + gdb_expect { + -re ".*\[\r\n]+${gdb_prompt} $" { + return 1 + } + timeout { + fail "{$command} (timeout)" + return 0 + } + } +} + +proc get_msym_addrs { var msymfile } { + # Extract the list of values for symbols matching var in the + # minimal symbol output file + + global gdb_prompt hex + set result "" + + send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" + + while 1 { + gdb_expect { + -re "\[\[\]\[ 0-9\]+\] . (${hex}) ${var}(\[ \t\]+\[^\r\n\]*)?\[\r\n\]+" { + set result [concat $result $expect_out(1,string)] + } + + -re "$gdb_prompt $" { + pass "get_msym_addrs ${var} (${result})" + return "${result}" + } + + -re "\[^\r\n\]*\[\r\n\]+" { + # Skip + } + + timeout { + fail "get_msym_addrs ${var} (timeout)" + return -1 + } + } + } +} + +proc check_same {var msymfile} { + # Check that the minimal symbol values matching var are the same + + set len [llength [lsort -unique [get_msym_addrs "${var}" "${msymfile}"]]] + + if { $len == 1 } { + return 1 + } else { + return 0 + } +} + +proc check_different {var msymfile} { + # Check that the minimal symbol values matching var are different + + set addr_list [lsort [get_msym_addrs "${var}" "${msymfile}"]] + set prev "" + + if { [llength ${addr_list}] < 2 } { + return 0 + } + + foreach addr ${addr_list} { + if { ${prev} == ${addr} } { + return 0 + } + set prev ${addr} + } + + return 1 +} + +set msymfile "${workdir}/shreloc.txt" + +if [send_gdb_discard "maint print msymbols ${msymfile}"] { + if {[check_different "static_var_\[12\]" "${msymfile}"]} { + pass "(msymbol) relocated static vars have different addresses" + } else { + fail "(msymbol) relocated static vars have different addresses" + } + + if {[check_different "extern_var_\[12\]" "${msymfile}"]} { + pass "(msymbol) relocated extern vars have different addresses" + } else { + fail "(msymbol) relocated extern vars have different addresses" + } + + if {[check_different "fn_\[12\]" "${msymfile}"]} { + pass "(msymbol) relocated functions have different addresses" + } else { + fail "(msymbol) relocated functions have different addresses" + } +} + +if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { + # + # We know the names of some absolute symbols included in the + # portable-executable (DLL) format. Check that they didn't get + # relocated. + # + # A better approach would be include absolute symbols via the assembler. + # + if {[check_same "_minor_os_version__" "${msymfile}"]} { + pass "Absolute symbols not relocated" + } else { + fail "Absolute symbols not relocated" + } +} diff --git a/gdb/testsuite/gdb.base/shreloc1.c b/gdb/testsuite/gdb.base/shreloc1.c new file mode 100644 index 0000000..b1bffde --- /dev/null +++ b/gdb/testsuite/gdb.base/shreloc1.c @@ -0,0 +1,10 @@ +#if defined(_WIN32) || defined(__CYGWIN__) +# define ATTRIBUTES __attribute((__dllexport__)) +#else +# define ATTRIBUTES +#endif + +static int static_var_1; + +ATTRIBUTES void fn_1 (int unused) { } +ATTRIBUTES int extern_var_1 = 0; diff --git a/gdb/testsuite/gdb.base/shreloc2.c b/gdb/testsuite/gdb.base/shreloc2.c new file mode 100644 index 0000000..1459093 --- /dev/null +++ b/gdb/testsuite/gdb.base/shreloc2.c @@ -0,0 +1,10 @@ +#if defined(_WIN32) || defined(__CYGWIN__) +# define ATTRIBUTES __attribute((__dllexport__)) +#else +# define ATTRIBUTES +#endif + +static int static_var_2; + +ATTRIBUTES void fn_2 (int unused) { } +ATTRIBUTES int extern_var_2 = 0; diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index be97455..a07e3a8 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -195,6 +195,7 @@ proc signal_tests_1 {} { # a SIGTRAP, but with different symptoms. setup_xfail "vax-*-ultrix*" setup_xfail "i*86-*-bsd*" + setup_xfail "i*86-*-freebsd*" setup_xfail "i*86-pc-linux-gnu*" setup_xfail "i*86-*-solaris2*" send_gdb "continue\n" diff --git a/gdb/testsuite/gdb.c++/Makefile.in b/gdb/testsuite/gdb.c++/Makefile.in new file mode 100644 index 0000000..8f4a90e --- /dev/null +++ b/gdb/testsuite/gdb.c++/Makefile.in @@ -0,0 +1,16 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ + derivation inherit local member-ptr method misc \ + overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace ref-types + +all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." + +clean mostlyclean: + -rm -f *~ *.o *.ci + -rm -f core ${EXECUTABLES} + +distclean maintainer-clean realclean: clean + -rm -f Makefile config.status config.log diff --git a/gdb/testsuite/gdb.c++/ambiguous.cc b/gdb/testsuite/gdb.c++/ambiguous.cc new file mode 100644 index 0000000..6ee7bc1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.cc @@ -0,0 +1,110 @@ + +void marker1() +{ + return; +} + +class A1 { +public: + int x; + int y; +}; + +class A2 { +public: + int x; + int y; +}; + +class A3 { +public: + int x; + int y; +}; + +class X : public A1, public A2 { +public: + int z; +}; + +class L : public A1 { +public: + int z; +}; + +class LV : public virtual A1 { +public: + int z; +}; + +class M : public A2 { +public: + int w; +}; + +class N : public L, public M { +public: + int r; +}; + +class K : public A1 { +public: + int i; +}; + +class KV : public virtual A1 { +public: + int i; +}; + +class J : public K, public L { +public: + int j; +}; + +class JV : public KV, public LV { +public: + int jv; +}; + +class JVA1 : public KV, public LV, public A1 { +public: + int jva1; +}; + +class JVA2 : public KV, public LV, public A2 { +public: + int jva2; +}; + +class JVA1V : public KV, public LV, public virtual A1 { +public: + int jva1v; +}; + +int main() +{ + A1 a1; + A2 a2; + A3 a3; + X x; + L l; + M m; + N n; + K k; + J j; + JV jv; + JVA1 jva1; + JVA2 jva2; + JVA1V jva1v; + + int i; + + i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j; + + marker1(); + +} + + + diff --git a/gdb/testsuite/gdb.c++/ambiguous.exp b/gdb/testsuite/gdb.c++/ambiguous.exp new file mode 100644 index 0000000..4224b2d --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.exp @@ -0,0 +1,237 @@ +# Copyright 1998, 1999 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file is part of the gdb testsuite + +# tests relating to ambiguous class members +# Written by Satish Pai 1997-07-28 + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "ambiguous" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" + send_gdb "cont\n" + gdb_expect { + -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { + send_gdb "up\n" + gdb_expect { + -re ".*$gdb_prompt $" { pass "up from marker1" } + timeout { fail "up from marker1" } + } + } + -re "$gdb_prompt $" { fail "continue to marker1" } + timeout { fail "(timeout) continue to marker1" } + } + +# print out various class objects' members. The values aren't +# important, just check that the warning is emitted at the +# right times. + +# X is derived from A1 and A2; both A1 and A2 have a member 'x' +send_gdb "print x.x\n" +gdb_expect { + -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re ".*$gdb_prompt $" { fail "print x.x" } + timeout { fail "(timeout) print x.x" } +} + + +# N is derived from A1 and A2, but not immediately -- two steps +# up in the hierarchy. Both A1 and A2 have a member 'x'. +send_gdb "print n.x\n" +gdb_expect { + -re "warning: x ambiguous; using N::M::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re "warning: x ambiguous; using N::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re ".*$gdb_prompt $" { fail "print n.x" } + timeout { fail "(timeout) print n.x" } +} + +# J is derived from A1 twice. A1 has a member x. +send_gdb "print j.x\n" +gdb_expect { + -re "warning: x ambiguous; using J::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re "warning: x ambiguous; using J::K::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re ".*$gdb_prompt $" { fail "print j.x" } + timeout { fail "(timeout) print j.x" } +} + +# JV is derived from A1 but A1 is a virtual base. Should not +# report an ambiguity in this case. +send_gdb "print jv.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jv.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jv.x" } + -re ".*$gdb_prompt $" { fail "print jv.x (??)" } + timeout { fail "(timeout) print jv.x" } +} + +# JVA1 is derived from A1; A1 occurs as a virtual base in two +# ancestors, and as a non-virtual immediate base. Ambiguity must +# be reported. +send_gdb "print jva1.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA1::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re "warning: x ambiguous; using JVA1::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re ".*$gdb_prompt $" { fail "print jva1.x" } + timeout { fail "(timeout) print jva1.x" } +} + +# JVA2 is derived from A1 & A2; A1 occurs as a virtual base in two +# ancestors, and A2 is a non-virtual immediate base. Ambiguity must +# be reported as A1 and A2 both have a member 'x'. +send_gdb "print jva2.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA2::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re "warning: x ambiguous; using JVA2::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re ".*$gdb_prompt $" { fail "print jva2.x" } + timeout { fail "(timeout) print jva2.x" } +} + +# JVA1V is derived from A1; A1 occurs as a virtual base in two +# ancestors, and also as a virtual immediate base. Ambiguity must +# not be reported. +send_gdb "print jva1v.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jva1v.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jva1v.x" } + -re ".*$gdb_prompt $" { fail "print jva1v.x (??)" } + timeout { fail "(timeout) print jva1v.x" } +} + +# Now check for ambiguous bases. + +# J is derived from A1 twice; report ambiguity if a J is +# cast to an A1. +send_gdb "print (A1)j\n" +gdb_expect { + -re "warning: A1 ambiguous; using J::L::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re "warning: A1 ambiguous; using J::K::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re ".*$gdb_prompt $" { fail "print (A1)j" } + timeout { fail "(timeout) print (A1)j" } +} + +# JV is derived from A1 twice, but A1 is a virtual base; should +# not report ambiguity when a JV is cast to an A1. +send_gdb "print (A1)jv\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jv (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jv" } + -re ".*$gdb_prompt $" { fail "print (A1)jv (??)" } + timeout { fail "(timeout) print (A1)jv" } +} + +# JVA1 is derived from A1; A1 is a virtual base and also a +# non-virtual base. Must report ambiguity if a JVA1 is cast to an A1. +send_gdb "print (A1)jva1\n" +gdb_expect { + -re "warning: A1 ambiguous; using JVA1::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re "warning: A1 ambiguous; using JVA1::KV::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1" } + timeout { fail "(timeout) print (A1)jva1" } +} + +# JVA1V is derived from A1; A1 is a virtual base indirectly +# and also directly; must not report ambiguity when a JVA1V is cast to an A1. +send_gdb "print (A1)jva1v\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jva1v (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jva1v" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1v (??)" } + timeout { fail "(timeout) print (A1)jva1v" } +} + diff --git a/gdb/testsuite/gdb.c++/annota2.cc b/gdb/testsuite/gdb.c++/annota2.cc new file mode 100644 index 0000000..234752e --- /dev/null +++ b/gdb/testsuite/gdb.c++/annota2.cc @@ -0,0 +1,28 @@ +#include + +class A { +public: + int x; + int y; + int foo (int arg); +}; + + +int A::foo (int arg) +{ + x += arg; + return arg *2; +} + +int main() +{ + A a; + + a.x = 0; + a.x = 1; + a.y = 2; + + printf ("a.x is %d\n", a.x); + return 0; +} + diff --git a/gdb/testsuite/gdb.c++/annota2.exp b/gdb/testsuite/gdb.c++/annota2.exp new file mode 100644 index 0000000..0446eb3 --- /dev/null +++ b/gdb/testsuite/gdb.c++/annota2.exp @@ -0,0 +1,234 @@ +# Copyright 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Elena Zannoni (ezannoni@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "annota2" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# are we on a target board? If so, don't run these tests. +# note: this is necessary because we cannot use runto_main (which would +# work for remote targets too) because of the different prompt we get +# when using annotation level 2. +# +if [is_remote target] then { + return 0 +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if [target_info exists gdb_stub] { + gdb_step_for_stub; +} + +# +# line number where we need to stop in main +# +set main_line 25 + +# The commands we test here produce many lines of output; disable "press +# to continue" prompts. +send_gdb "set height 0\n" +gdb_expect -re "$gdb_prompt $" + +# +# break at main +# +gdb_test "break 25" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint main" + + +# +# NOTE: this prompt is OK only when the annotation level is > 1 +# NOTE: When this prompt is in use the gdb_test procedure cannot be used because +# it assumes that the last char of the gdb_prompt is a white space. This is not +# true with this annotated prompt. So we must use send_gdb and gdb_expect. +# + +set old_gdb_prompt $gdb_prompt +set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" + +send_gdb "set annotate 2\n" +gdb_expect { + -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" } + -re ".*$gdb_prompt$" { fail "annotation set at level 2" } + timeout { fail "annotation set at level 2 (timeout)" } + } + +send_gdb "run\n" + gdb_expect { + -re "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" } + -re ".*$gdb_prompt$" { fail "run until main breakpoint" } + timeout { fail "run until main breakpoint (timeout)" } + } + +# +# print class 'a' with public fields. +# this will test: +# annotate-field-begin +# annotate-field-name-end +# annotate-field-value +# annotate-field-end +# +send_gdb "print a\n" +gdb_expect { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n\\{\r\n\032\032field-begin -\r\nx\r\n\032\032field-name-end\r\n = \r\n\032\032field-value\r\n1\r\n\032\032field-end\r\n, \r\n\032\032field-begin -\r\ny\r\n\032\032field-name-end\r\n = \r\n\032\032field-value\r\n2\r\n\032\032field-end\r\n\\}\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" \ + { pass "print class" } + -re ".*$gdb_prompt$" { fail "print class" } + timeout { fail "print class (timeout)" } +} + +# +# continue until exit +# this will test: +# annotate-exited +# +send_gdb "continue\n" +gdb_expect { + -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\na.x is 1\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + { pass "continue until exit" } + -re ".*$gdb_prompt$" { fail "continue to exit" } + timeout { fail "continue to exit (timeout)" } +} + +# +# delete all breakpoints +# +send_gdb "delete\n" +gdb_expect { + -re ".*Delete all breakpoints. \\(y or n\\) \r\n\032\032query.*$" { + send_gdb "y\n" + gdb_expect { + -re "\r\n\032\032post-query\r\n$gdb_prompt$" { pass "delete bps" } + -re ".*$gdb_prompt$" { fail "delete bps" } + timeout { fail "delete bps (timeout)" } + } + } + -re ".*$gdb_prompt$" { fail "delete bps" } + timeout { fail "delete bps (timeout)" } +} + +# +# break at first line of main. +# +send_gdb "break 22\n" +gdb_expect { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \ + { pass "breakpoint at main" } + -re ".*$gdb_prompt$" { fail "break at main" } + timeout { fail "break at main (timeout)" } +} + +# +# change value of main_line +# +set main_line 22 + +# +# run program up to breakpoint. +# + + +send_gdb "run\n" + gdb_expect { + -re "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" } + -re ".*$gdb_prompt$" { fail "run until main breakpoint" } + timeout { fail "run until main breakpoint (timeout)" } + } + +# +# set up a watch point on a.x +# +send_gdb "watch a.x\n" +gdb_expect { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n.*atchpoint 3: a.x\r\n$gdb_prompt$" \ + { pass "set watch on a.x" } + -re ".*$gdb_prompt$" { fail "set watch on a.x" } + timeout { fail "set watch on a.x (timeout)" } +} + +# +# do a next, so that the watchpoint triggers. This will test: +# annotate-watchpoint +# +send_gdb "next\n" +gdb_expect { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032watchpoint 3\r\nWatchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + { pass "watch triggered on a.x" } + -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032watchpoint 3\r\n\.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" \ + { pass "watch triggered on a.x" } + -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + { kfail "gdb/38" "watch triggered on a.x" } + -re ".*$gdb_prompt$" { fail "watch triggered on a.x" } + timeout { fail "watch triggered on a.x (timeout)" } +} + + +# +# send ^C to gdb, so that the quit() function gets called +# and annotate-quit is tested +# 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$" \ + { pass "annotate-quit" } + -re "$gdb_prompt$" { kfail "gdb/544" "annotate-quit" } + -re ".*$gdb_prompt$" { fail "annotate-quit" } + timeout { fail "annotate-quit (timeout)" } +} + +# +# FIXME: the testsuite does not currently have tests for +# annotate_catchpoints and annotate_function_call +# and a few variants of the annotations that are +# tested (marked by FIXME on the annot?.exp files) +# + +# reinstall the old prompt for the rest of the testsuite. + +set gdb_prompt $old_gdb_prompt + diff --git a/gdb/testsuite/gdb.c++/anon-union.cc b/gdb/testsuite/gdb.c++/anon-union.cc new file mode 100644 index 0000000..0b3fd13 --- /dev/null +++ b/gdb/testsuite/gdb.c++/anon-union.cc @@ -0,0 +1,55 @@ + +struct Foo { + union { + int zero; + unsigned int one; + } num1; + struct X { + int rock; + unsigned int rock2; + }; + union { + int pebble; + X x; + union { + int qux; + unsigned int mux; + }; + unsigned int boulder; + }; + union { + int paper; + unsigned int cloth; + }; + union { + int two; + unsigned int three; + } num2; +}; + +union Bar { + int x; + unsigned int y; +}; + + +int main() +{ + Foo foo = {0, 0}; + + foo.paper = 33; + foo.pebble = 44; + foo.mux = 55; + + Bar bar = {0}; + + union { + int z; + unsigned int w; + }; w = 0; + + bar.x = 33; + + w = 45; + +} diff --git a/gdb/testsuite/gdb.c++/anon-union.exp b/gdb/testsuite/gdb.c++/anon-union.exp new file mode 100644 index 0000000..0d5c777 --- /dev/null +++ b/gdb/testsuite/gdb.c++/anon-union.exp @@ -0,0 +1,348 @@ +# Tests for anonymous union support. +# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# Written by Satish Pai 1997-08-19 + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "anon-union" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + perror "Testcase compile failed" 0 + continue +} + +# Start with a fresh gdb +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "set width 0\n" +gdb_expect -re "$gdb_prompt $" + +#send_gdb "ptype foo\n" +#gdb_expect { +# -re "\r\n$gdb_prompt $" { +# pass "ptype foo" +# } +# -re ".*$gdb_prompt $" { fail "ptype foo" } +# timeout { fail "(timeout) ptype foo" } +#} + +#send_gdb "ptype bar\n" +#gdb_expect { +# -re "\r\n$gdb_prompt $" { +# pass "ptype foo" +# } +# -re ".*$gdb_prompt $" { fail "ptype foo" } +# timeout { fail "(timeout) ptype foo" } +#} + +# NOTE: Add -- ptype foo.x, etc. when things are working + +#Initialize foo +send_gdb "next\n" +gdb_expect { + -re "40\[ \t\]*foo.paper = 33;\r\n$gdb_prompt $" { + pass "next 1" + } + -re ".*$gdb_prompt $" { fail "next 1" } + timeout { fail "(timeout) next 1" } +} + +# Print out the big anon union. +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 0, cloth = 0\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 1" + } + -re ".*$gdb_prompt $" { fail "print foo 1" } + timeout { fail "(timeout) print foo 1" } +} + +# Step over assignment to member + +send_gdb "next\n" +gdb_expect { + -re "41\[ \t\]*foo.pebble = 44;\r\n$gdb_prompt $" { + pass "next 1" + } + -re ".*$gdb_prompt $" { fail "next 1" } + timeout { fail "(timeout) next 1" } +} + +# Now print out anon union again +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 33, cloth = 33\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 2" + } + -re ".*$gdb_prompt $" { fail "print foo 2" } + timeout { fail "(timeout) print foo 2" } +} + +# Modify the member just set +send_gdb "set var foo.cloth = 35\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var foo.cloth" + } + timeout { fail "(timeout) set var foo.cloth" } +} + +# Now print out anon union again to see if the right member was set +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 3" + } + -re ".*$gdb_prompt $" { fail "print foo 3" } + timeout { fail "(timeout) print foo 3" } +} + + +# Step over next assignment to member + +send_gdb "next\n" +gdb_expect { + -re "42\[ \t\]*foo.mux = 55;\r\n$gdb_prompt $" { + pass "next 2" + } + -re ".*$gdb_prompt $" { fail "next 2" } + timeout { fail "(timeout) next 2" } +} + +# Now print out anon union again +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 4" + } + -re ".*$gdb_prompt $" { fail "print foo 4" } + timeout { fail "(timeout) print foo 4" } +} + +# Modify the member just set +send_gdb "set var foo.pebble = 45\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var foo.pebble" + } + timeout { fail "(timeout) set var foo.pebble" } +} + +# Now print out anon union again to see if the right member was set +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 5" + } + -re ".*$gdb_prompt $" { fail "print foo 5" } + timeout { fail "(timeout) print foo 5" } +} + +# Modify another member at a different level +send_gdb "set var foo.qux = 46\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var foo.qux" + } + timeout { fail "(timeout) set var foo.qux" } +} + +# Now print out anon union again to see if the right member was set +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 6" + } + -re ".*$gdb_prompt $" { fail "print foo 6" } + timeout { fail "(timeout) print foo 6" } +} + +# Modify the member at another level, but not the first one in the union +send_gdb "set var foo.mux = 47\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var foo.mux" + } + timeout { fail "(timeout) set var foo.mux" } +} + +# Now print out anon union again to see if things worked +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 47, x = \{rock = 47, rock2 = 0\}, \{qux = 47, mux = 47\}, boulder = 47\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 7" + } + -re ".*$gdb_prompt $" { fail "print foo 7" } + timeout { fail "(timeout) print foo 7" } +} + +# Modify a member of a struct in an anon union +send_gdb "set var foo.x.rock = 48\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var foo.x.rock" + } + timeout { fail "(timeout) set var foo.x.rock" } +} + +# Now print out anon union again to see if things worked +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 0\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 8" + } + -re ".*$gdb_prompt $" { fail "print foo 8" } + timeout { fail "(timeout) print foo 8" } +} + +# Modify a member of a struct in an anon union, but something +# that doesn't alias to some other union member +send_gdb "set var foo.x.rock2 = 49\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var foo.x.rock2" + } + timeout { fail "(timeout) set var foo.x.rock2" } +} + +# Now print out anon union again to see if things worked +send_gdb "print foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 49\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" { + pass "print foo 9" + } + -re ".*$gdb_prompt $" { fail "print foo 9" } + timeout { fail "(timeout) print foo 9" } +} + + +# Step over next four assignments +send_gdb "next 4\n" +gdb_expect { + -re "53\[ \t\]*w = 45;\r\n$gdb_prompt $" { + pass "next 3" + } + -re ".*$gdb_prompt $" { fail "next 3" } + timeout { fail "(timeout) next 3" } +} + +# Tests for anon unions that are not members of a class or struct + +send_gdb "print w\n" +gdb_expect { + -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" { + pass "print w 1" + } + -re ".*$gdb_prompt $" { fail "print w 1" } + timeout { fail "(timeout) print w 1" } +} + +send_gdb "print z\n" +gdb_expect { + -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" { + pass "print z 1" + } + -re ".*$gdb_prompt $" { fail "print z 1" } + timeout { fail "(timeout) print z 1" } +} + +# Step over next assignment to w +send_gdb "next\n" +gdb_expect { + -re "55\[ \t\]*\}\r\n$gdb_prompt $" { + pass "next 4" + } + -re ".*$gdb_prompt $" { fail "next 4" } + timeout { fail "(timeout) next 4" } +} + +# See if the change in value is noticed +send_gdb "print w\n" +gdb_expect { + -re "\\$\[0-9\]* = 45\r\n$gdb_prompt $" { + pass "print w 2" + } + -re ".*$gdb_prompt $" { fail "print w 2" } + timeout { fail "(timeout) print w 2" } +} + +# See if z shows the same value +send_gdb "print z\n" +gdb_expect { + -re "\\$\[0-9\]* = 45\r\n$gdb_prompt $" { + pass "print z 2" + } + -re ".*$gdb_prompt $" { fail "print z 2" } + timeout { fail "(timeout) print z 2" } +} + +# Set the anon union member +send_gdb "set var z = 27\n" +gdb_expect { + -re "\r\n$gdb_prompt $" { + pass "set var z" + } + timeout { fail "(timeout) set var z" } +} + +# See if the change in value is noticed +send_gdb "print w\n" +gdb_expect { + -re "\\$\[0-9\]* = 27\r\n$gdb_prompt $" { + pass "print w 3" + } + -re ".*$gdb_prompt $" { fail "print w 3" } + timeout { fail "(timeout) print w 3" } +} + +# See if z shows the same value +send_gdb "print z\n" +gdb_expect { + -re "\\$\[0-9\]* = 27\r\n$gdb_prompt $" { + pass "print z 3" + } + -re ".*$gdb_prompt $" { fail "print z 3" } + timeout { fail "(timeout) print z 3" } +} diff --git a/gdb/testsuite/gdb.c++/casts.cc b/gdb/testsuite/gdb.c++/casts.cc new file mode 100644 index 0000000..831add9 --- /dev/null +++ b/gdb/testsuite/gdb.c++/casts.cc @@ -0,0 +1,20 @@ +struct A +{ + int a; + A (int aa): a (aa) {} +}; + +struct B: public A +{ + int b; + B (int aa, int bb): A (aa), b(bb) {} +}; + +int +main (int argc, char **argv) +{ + A *a = new B(42, 1729); + B *b = (B *) a; + + return 0; /* breakpoint spot: casts.exp: 1 */ +} diff --git a/gdb/testsuite/gdb.c++/casts.exp b/gdb/testsuite/gdb.c++/casts.exp new file mode 100644 index 0000000..5b6cabe --- /dev/null +++ b/gdb/testsuite/gdb.c++/casts.exp @@ -0,0 +1,85 @@ +# Copyright 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file is part of the gdb testsuite + +# Test casting, especially between class types or pointer-to-class +# types. + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "casts" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +gdb_test "break [gdb_get_line_number "casts.exp: 1"]" \ + "Breakpoint.*at.* file .*" \ + "" + +gdb_test "continue" "Breakpoint .* at .*casts.cc.*" "" + +# Casting a pointer to a base class to a pointer to a derived class +# should yield the entire derived class. Until August 2002, GDB got +# the enclosing type on `(B *) a' wrong: while the value's static type +# was `B *', as it should be, the enclosing type (which is supposed to +# be the dynamic type) was `A *'. It's senseless to have a static +# type derived from the dynamic type; it should be the other way +# 'round. Dereferencing this oddly typed pointer yielded a value in +# which only the base class's members were initialized, since GDB uses +# the enclosing type to decide how many bytes to read. Members from +# the derived class were garbage, from GDB's address space. +gdb_test "print * (B *) a" ".* = { = {a = 42}, b = 1729}" \ + "cast base class pointer to derived class pointer" + +# Check also that we get the same results from letting the compiler do +# the dereference. +gdb_test "print * b" ".* = { = {a = 42}, b = 1729}" \ + "let compiler cast base class pointer to derived class pointer" diff --git a/gdb/testsuite/gdb.c++/classes.exp b/gdb/testsuite/gdb.c++/classes.exp new file mode 100644 index 0000000..3f398ac --- /dev/null +++ b/gdb/testsuite/gdb.c++/classes.exp @@ -0,0 +1,918 @@ +# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +set testfile "misc" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +# Create and source the file that provides information about the compiler +# used to compile the test case. + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# +# Test ptype of class objects. +# + +proc test_ptype_class_objects {} { + global gdb_prompt + global ws + global nl + + # Note that struct members are public by default, so we don't print + # "public:" for the public members of structs. + # Accept it if gdb just fails to distinguish between + # class and struct, and everything else is OK. + + send_gdb "ptype struct default_public_struct\n" + gdb_expect { + -re "type = struct default_public_struct \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { + pass "ptype struct default_public_struct" + } + -re "type = class default_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct default_public_struct" + } + -re ".*$gdb_prompt $" { fail "ptype struct default_public_struct" } + timeout { fail "ptype struct default_public_struct (timeout)" ; return } + } + + # Note that struct members are public by default, so we don't print + # "public:" for the public members of structs. + # Accept it if gdb just fails to distinguish between + # class and struct, and everything else is OK. + + send_gdb "ptype struct explicit_public_struct\n" + gdb_expect { + -re "type = struct explicit_public_struct \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct explicit_public_struct" + } + -re "type = class explicit_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct explicit_public_struct" + } + -re ".*$gdb_prompt $" { fail "ptype struct explicit_public_struct" } + timeout { fail "ptype struct explicit_public_struct (timeout)" ; return } + } + + # Accept it if gdb just fails to distinguish between + # class and struct, and everything else is OK. + + send_gdb "ptype struct protected_struct\n" + gdb_expect { + -re "type = struct protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { + pass "ptype struct protected_struct" + } + -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct protected_struct" + } + -re ".*$gdb_prompt $" { fail "ptype struct protected_struct" } + timeout { fail "ptype struct protected_struct (timeout)" ; return } + } + + # Accept it if gdb just fails to distinguish between + # class and struct, and everything else is OK. + + send_gdb "ptype struct private_struct\n" + gdb_expect { + -re "type = struct private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { + pass "ptype struct private_struct" + } + -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct private_struct" + } + -re ".*$gdb_prompt $" { fail "ptype struct private_struct" } + timeout { fail "ptype struct private_struct (timeout)" ; return } + } + + # Accept it if gdb just fails to distinguish between + # class and struct, and everything else is OK. + + send_gdb "ptype struct mixed_protection_struct\n" + gdb_expect { + -re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" { + pass "ptype struct mixed_protection_struct" + } + -re "type = struct mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct mixed_protection_struct (extra public)" + } + -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct mixed_protection_struct" + } + -re ".*$gdb_prompt $" { fail "ptype struct mixed_protection_struct" } + timeout { fail "ptype struct mixed_protection_struct (timeout)" ; return } + } + + # Accept it if gdb just fails to distinguish between + # class and struct, and everything else is OK. + + send_gdb "ptype class public_class\n" + gdb_expect { + -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class public_class" + } + -re "type = struct public_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { + pass "ptype class public_class" + } + -re ".*$gdb_prompt $" { fail "ptype class public_class" } + timeout { fail "ptype class public_class (timeout)" ; return } + } + + send_gdb "ptype class protected_class\n" + gdb_expect { + -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class protected_class" + } + -re "type = struct protected_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { + fail "ptype class protected_class" + } + -re ".*$gdb_prompt $" { fail "ptype class protected_class" } + timeout { fail "ptype class protected_class (timeout)" ; return } + } + + # Accept it if gdb just emits a superflous "private:" + # attribute, since classes default to private and for consistency with + # structs (where we don't print the "public:" attribute) we don't print + # the "private:" attribute. + + send_gdb "ptype class default_private_class\n" + gdb_expect { + -re "type = class default_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class default_private_class" + } + -re "type = class default_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class default_private_class" + } + -re ".*$gdb_prompt $" { fail "ptype class default_private_class" } + timeout { fail "ptype class default_private_class (timeout)" ; return } + } + + send_gdb "ptype class explicit_private_class\n" + gdb_expect { + -re "type = class explicit_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class explicit_private_class" + } + -re "type = class explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class explicit_private_class" + } + -re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + fail "ptype class explicit_private_class" + } + -re ".*$gdb_prompt $" { fail "ptype class explicit_private_class" } + timeout { fail "ptype class explicit_private_class (timeout)" ; return } + } + + send_gdb "ptype class mixed_protection_class\n" + gdb_expect { + -re "type = class mixed_protection_class \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class mixed_protection_class" + } + -re "type = struct mixed_protection_class \{${ws}int a;${ws}int b;${ws}int c;${ws}int d;${ws}int e;${ws}int f;${ws}int g;${ws}int h;${ws}int i;$nl.*\}$nl$gdb_prompt $" { + fail "ptype class mixed_protection_class" + } + -re ".*$gdb_prompt $" { fail "ptype class mixed_protection_class" } + timeout { fail "ptype class mixed_protection_class (timeout)" ; return } + } + + # This class does not use any C++-specific features, so it's fine for + # it to print as "struct". + send_gdb "ptype class A\n" + gdb_expect { + -re "type = (class|struct) A \{(${ws}public:|)${ws}int a;${ws}int x;((${ws}A & operator=\\(A const ?&\\);)|(${ws}A\\((A const|const A) ?&\\);)|(${ws}A\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class A" + } + -re ".*$gdb_prompt $" { + fail "ptype class A" + } + timeout { + fail "ptype class A (timeout)" + return + } + } + + send_gdb "ptype class B\n" + gdb_expect { + -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class B" + } + -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;((${ws}B & operator=\\(B const ?&\\);)|(${ws}B\\(B const ?&\\);)|(${ws}B\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class B (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class B" + } + timeout { + fail "ptype class B (timeout)" + return + } + } + + send_gdb "ptype class C\n" + gdb_expect { + -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class C" + } + -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;((${ws}C & operator=\\(C const ?&\\);)|(${ws}C\\(C const ?&\\);)|(${ws}C\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class C (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class C" + } + timeout { + fail "ptype class C (timeout)" + return + } + } + + send_gdb "ptype class D\n" + gdb_expect { + -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class D" + } + -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(D const ?&\\);)|(${ws}D\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class D (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class D" + } + timeout { + fail "ptype class D (timeout)" + return + } + } + + send_gdb "ptype class E\n" + gdb_expect { + -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class E" + } + -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;((${ws}E & operator=\\(E const ?&\\);)|(${ws}E\\((E const|const E) ?&\\);)|(${ws}E\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class E" + } + -re ".*$gdb_prompt $" { + fail "ptype class E" + } + timeout { + fail "ptype class E (timeout)" + return + } + } + + # With g++ 2.x and stabs debug info, we misinterpret static methods + # whose name matches their argument mangling. + send_gdb "ptype class Static\n" + gdb_expect { + -re "type = (class|struct) Static \{(${ws}public:|)${ws}Static & operator=\\(Static const ?&\\);${ws}Static\\((Static const|const Static) ?&\\);${ws}Static\\((void|)\\);${ws}static void ii\\(int, int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class Static" + } + -re "type = (class|struct) Static \{(${ws}public:|)${ws}static void ii\\(int, int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class Static" + } + -re ".*$gdb_prompt $" { + fail "ptype class Static" + } + timeout { + fail "ptype class Static (timeout)" + return + } + } + + send_gdb "ptype class vA\n" + gdb_expect { + -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vA" + } + -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;${ws}vA & operator=\\(vA const ?&\\);${ws}vA\\((vA const|const vA) ?&\\);${ws}vA\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class vA" + } + -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;((${ws}vA & operator=\\(vA const ?&\\);)|(${ws}vA\\(vA const ?&\\);)|(${ws}vA\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class vA (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class vA" + } + timeout { + fail "ptype class vA (timeout)" + return + } + } + + # Accept the form with embedded GNU style mangled virtual table constructs + # for now, but with a FIXME. At some future point, gdb should use a + # portable representation for the virtual table constructs. + + # The format of a g++ virtual base pointer. + set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?" + + send_gdb "ptype class vB\n" + gdb_expect { + -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}vB & operator=\\(vB const ?&\\);${ws}vB\\((vB const|const vB) ?&\\);${ws}vB\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class vB" + } + -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*${vbptr}vA;${ws}public:${ws}int vb;${ws}int vx;${ws}vB & operator=\\(vB const ?&\\);${ws}vB\\(int, vB const ?&\\);${ws}vB\\(int\\);${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vB (FIXME: non-portable virtual table constructs)" + } + -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vB" + } + -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vb;${ws}int vx;((${ws}vB & operator=\\(vB const ?&\\);)|(${ws}vB\\(int, vB const ?&\\);)|(${ws}vB\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vB (FIXME) (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class vB" + } + timeout { + fail "ptype class vB (timeout)" + return + } + } + + # Accept the form with embedded GNU style mangled virtual table constructs + # for now, but with a FIXME. At some future point, gdb should use a + # portable representation for the virtual table constructs. + + send_gdb "ptype class vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}vC & operator=\\(vC const ?&\\);${ws}vC\\((vC const|const vC) ?&\\);${ws}vC\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class vC" + } + -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*${vbptr}vA;${ws}public:${ws}int vc;${ws}int vx;${ws}vC & operator=\\(vC const ?&\\);${ws}vC\\(int, vC const ?&\\);${ws}vC\\(int\\);${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vC (FIXME: non-portable virtual table constructs)" + } + -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vC" + } + -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vc;${ws}int vx;((${ws}vC & operator=\\(vC const ?&\\);)|(${ws}vC\\(int, vC const ?&\\);)|(${ws}vC\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vC (FIXME) (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class vC" + } + timeout { + fail "ptype class vC (timeout)" + return + } + } + + # Accept the form with embedded GNU style mangled virtual table constructs + # for now, but with a FIXME. At some future point, gdb should use a + # portable representation for the virtual table constructs. + + send_gdb "ptype class vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}vD & operator=\\(vD const ?&\\);${ws}vD\\((vD const|const vD) ?&\\);${ws}vD\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class vD" + } + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;${ws}vD & operator=\\(vD const ?&\\);${ws}vD\\(int, vD const ?&\\);${ws}vD\\(int\\);${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vD (FIXME: non-portable virtual table constructs)" + } + -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vD" + } + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*_vb.vC;${ws}vB \\*_vb.vB;${ws}public:${ws}int vd;${ws}int vx;((${ws}vD & operator=\\(vD const ?&\\);)|(${ws}vD\\(int, vD const ?&\\);)|(${ws}vD\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vD (FIXME) (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class vD" + } + timeout { + fail "ptype class vD (timeout)" + return + } + } + + # Accept the form with embedded GNU style mangled virtual table constructs + # for now, but with a FIXME. At some future point, gdb should use a + # portable representation for the virtual table constructs. + + send_gdb "ptype class vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}vE & operator=\\(vE const ?&\\);${ws}vE\\((vE const|const vE) ?&\\);${ws}vE\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class vE" + } + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;${ws}vE & operator=\\(vE const ?&\\);${ws}vE\\(int, vE const ?&\\);${ws}vE\\(int\\);${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vE (FIXME: non-portable virtual table constructs)" + } + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vE" + } + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*_vb.vD;${ws}public:${ws}int ve;${ws}int vx;((${ws}vE & operator=\\(vE const ?&\\);)|(${ws}vE\\(int, vE const ?&\\);)|(${ws}vE\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype class vE (FIXME) (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class vE" + } + timeout { + fail "ptype class vE (timeout)" + return + } + } + + send_gdb "ptype class Base1\n" + gdb_expect { + -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 & operator=\\(Base1 const ?&\\);${ws}Base1\\(((Base1 const)|(const Base1)) ?&\\);${ws}Base1\\(int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class Base1" + } + -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1\\(int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class Base1" + } + -re "type = class Base1 \{${ws}public:${ws}int x;((${ws}Base1 & operator=\\(Base1 const ?&\\);)|(${ws}Base1\\(Base1 const ?&\\);)|(${ws}Base1\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class Base1 (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class Base1" + } + timeout { + fail "ptype class Base1 (timeout)" + return + } + } + + send_gdb "ptype class Foo\n" + gdb_expect { + -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;\r\n${ws}Foo\\(int, int\\);${ws}int operator!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" { + pass "ptype class Foo" + } + -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo & operator=\\(Foo const ?&\\);${ws}Foo\\((Foo const|const Foo) ?&\\);${ws}Foo\\(int, int\\);${ws}int operator!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class Foo" + } + -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;((${ws}Foo & operator=\\(Foo const ?&\\);)|(${ws}Foo\\(Foo const ?&\\);)|(${ws}Foo\\(int, int\\);)|(${ws}int operator!\\((void|)\\);)|(${ws}int operator int\\((void|)\\);)|(${ws}int times\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class Foo (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class Foo" + } + timeout { + fail "ptype class Foo (timeout)" + return + } + } + + send_gdb "ptype class Bar\n" + gdb_expect { + -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar & operator=\\(Bar const ?&\\);${ws}Bar\\((Bar const|const Bar) ?&\\);${ws}Bar\\(int, int, int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype class Bar" + } + -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;((${ws}Bar & operator=\\(Bar const ?&\\);)|(${ws}Bar\\(Bar const ?&\\);)|(${ws}Bar\\(int, int, int\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype class Bar (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype class Bar" + } + timeout { + fail "ptype class Bar (timeout)" + return + } + } +} + +# +# Test simple access to class members. +# + +proc test_non_inherited_member_access {} { + global gdb_prompt + + # Print non-inherited members of g_A. + + gdb_test "print g_A.a" ".* = 1" "g_A.a incorrect" + + gdb_test "print g_A.x" ".* = 2" "g_A.x incorrect" + + # Print non-inherited members of g_B. + + gdb_test "print g_B.b" ".* = 5" "g_B.b incorrect" + + gdb_test "print g_B.x" ".* = 6" "g_B.x incorrect" + + # Print non-inherited members of g_C. + + gdb_test "print g_C.c" ".* = 9" "g_C.c incorrect" + + gdb_test "print g_C.x" ".* = 10" "g_C.x incorrect" + + # Print non-inherited members of g_D. + + gdb_test "print g_D.d" ".* = 19" "g_D.d incorrect" + + gdb_test "print g_D.x" ".* = 20" "g_D.x incorrect" + + # Print non-inherited members of g_E. + + gdb_test "print g_E.e" ".* = 31" "g_E.e incorrect" + + gdb_test "print g_E.x" ".* = 32" "g_E.x incorrect" +} + +# +# Try access to non-members that are members of another class. +# Should give errors. +# + +proc test_wrong_class_members {} { + global gdb_prompt + + gdb_test "print g_A.b" "There is no member( or method|) named b." "print g_A.b should be error" + + gdb_test "print g_B.c" "There is no member( or method|) named c." "print g_B.c should be error" + + gdb_test "print g_B.d" "There is no member( or method|) named d." "print g_B.d should be error" + + gdb_test "print g_C.b" "There is no member( or method|) named b." "print g_C.b should be error" + + gdb_test "print g_C.d" "There is no member( or method|) named d." "print g_C.d should be error" + + gdb_test "print g_D.e" "There is no member( or method|) named e." "print g_D.e should be error" +} + +# +# Try access to non-members that are not members of any class. +# Should give errors. +# + +proc test_nonexistent_members {} { + global gdb_prompt + + gdb_test "print g_A.y" "There is no member( or method|) named y." "print g_A.y should be error" + + gdb_test "print g_B.z" "There is no member( or method|) named z." "print g_B.z should be error" + + gdb_test "print g_C.q" "There is no member( or method|) named q." "print g_C.q should be error" + + gdb_test "print g_D.p" "There is no member( or method|) named p." "print g_D.p should be error" +} + +# +# Call a method that expects a base class parameter with base, inherited, +# and unrelated class arguments. +# + +proc test_method_param_class {} { + gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1" "base class param->a" + gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2" "base class param->x" + gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3" "inherited class param->a" + gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4" "inherited class param->x" + gdb_test "call class_param.Aref_a (g_A)" ".* = 1" "base class (¶m)->a" + gdb_test "call class_param.Aref_x (g_A)" ".* = 2" "base class (¶m)->x" + gdb_test "call class_param.Aref_a (g_B)" ".* = 3" "inherited class (¶m)->a" + gdb_test "call class_param.Aref_x (g_B)" ".* = 4" "inherited class (¶m)->x" + gdb_test "call class_param.Aval_a (g_A)" ".* = 1" "base class param.a" + gdb_test "call class_param.Aval_x (g_A)" ".* = 2" "base class param.x" + gdb_test "call class_param.Aval_a (g_B)" ".* = 3" "inherited class param.a" + gdb_test "call class_param.Aval_x (g_B)" ".* = 4" "inherited class param.x" + + gdb_test "call class_param.Aptr_a (&foo)" "Cannot resolve .*" "unrelated class *param" + gdb_test "call class_param.Aref_a (foo)" "Cannot resolve .*" "unrelated class ¶m" + gdb_test "call class_param.Aval_a (foo)" "Cannot resolve .*" "unrelated class param" +} + +# +# Examine a class with an enum field. +# + +proc test_enums {} { + global gdb_prompt + global hp_aCC_compiler + + # print the object + send_gdb "print obj_with_enum\n" + gdb_expect { + -re "\\$\[0-9\]* = \\{priv_enum = red, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (1)" } + -re "$gdb_prompt $" { fail "print obj_with_enum (1)" } + timeout { fail "(timeout) print obj_with_enum (1)" } + } + + send_gdb "next\n" + gdb_expect { + -re "$gdb_prompt $" { pass "next" } + timeout { fail "(timeout) next" } + } + + # print the object again + send_gdb "print obj_with_enum\n" + gdb_expect { + -re "\\$\[0-9\]* = \\{priv_enum = green, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (2)" } + -re "$gdb_prompt $" { fail "print obj_with_enum (2)" } + timeout { fail "(timeout) print obj_with_enum (2)" } + } + + # print out the enum member + send_gdb "print obj_with_enum.priv_enum\n" + gdb_expect { + -re "\\$\[0-9\]* = green.*$gdb_prompt $" { pass "print obj_with_enum.priv_enum" } + -re "$gdb_prompt $" { fail "print obj_with_enum.priv_enum" } + timeout { fail "(timeout) print obj_with_enum.priv_enum" } + } + + # ptype on the enum member + # The third success case is a little dubious, but it's not clear what + # ought to be required of a ptype on a private enum... -sts 19990324 + send_gdb "ptype obj_with_enum.priv_enum\n" + gdb_expect { + -re "type = enum ClassWithEnum::PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" } + -re "type = enum PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" } + -re "type = enum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" } + -re "$gdb_prompt $" { fail "ptype obj_with_enum.priv_enum" } + timeout { fail "(timeout) ptype obj_with_enum.priv_enum" } + } + + # ptype on the object + send_gdb "ptype obj_with_enum\n" + gdb_expect { + -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" } + -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)PrivEnum priv_enum;\r\n\[ \t\]*int x;.*\\}\r\n$gdb_prompt $" + { + # NOTE: carlton/2003-02-28: One could certainly argue that + # this output is acceptable: PrivEnum is a member of + # ClassWithEnum, so there's no need to explicitly qualify + # its name with "ClassWithEnum::". The truth, though, is + # that GDB is simply forgetting that PrivEnum is a member + # of ClassWithEnum, so we do that output for a bad reason + # instead of a good reason. Under stabs, we probably + # can't get this right; under DWARF-2, we can. + kfail "gdb/57" "ptype obj_with_enum" + } + -re "$gdb_prompt $" { fail "ptype obj_with_enum" } + timeout { fail "(timeout) ptype obj_with_enum" } + } + + # We'll do this test twice, because of a parser bug: see + # PR gdb/826. + + send_gdb "print (ClassWithEnum::PrivEnum) 42\n" + gdb_expect { + -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" } + -re "A parse error in expression, near `42'.\r\n$gdb_prompt $" + { kfail "gdb/826" "print (ClassWithEnum::PrivEnum) 42" } + -re "$gdb_prompt $" { fail "print (ClassWithEnum::PrivEnum) 42" } + timeout { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" } + } + + send_gdb "print ('ClassWithEnum::PrivEnum') 42\n" + gdb_expect { + -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print ('ClassWithEnum::PrivEnum') 42" } + -re "No symbol \"ClassWithEnum::PrivEnum\" in current context.\r\n$gdb_prompt $" + { kfail "gdb/57" "print ('ClassWithEnum::PrivEnum') 42" } + -re "$gdb_prompt $" { fail "print ('ClassWithEnum::PrivEnum') 42" } + timeout { fail "(timeout) print ('ClassWithEnum::PrivEnum') 42" } + } +} + +# +# Pointers to class members +# + +proc test_pointers_to_class_members {} { + global gdb_prompt + global decimal + global nl + + gdb_test "print Bar::z" ".* = .int\[ \]*\[( \]*Bar::&\[)\]+\[ \]*Bar::z" "print Bar::z" + + gdb_test "print &Foo::x" ".* = .int\[ \]*\[( \]*Foo::\[*)\]+\[ \]*&Foo::x" "print &Foo::x" + + gdb_test "print (int)&Foo::x" ".* = 0" "print (int)&Foo::x" + + send_gdb "print (int)&Bar::y == 2*sizeof(int)\n" + gdb_expect { + -re ".* = true$nl$gdb_prompt $" { + pass "print (int)&Bar::y == 2*sizeof(int)" + } + -re "There is no field named y.*$gdb_prompt $" { + setup_xfail "*-*-*" + fail "print (int)&Bar::y == 2*sizeof(int)" + } + -re ".*$gdb_prompt $" { fail "print (int)&Bar::y == 2*sizeof(int)" } + timeout { fail "print (int)&Bar::y == 2*sizeof(int) (timeout)" ; return } + } + + send_gdb "next 2\n" + setup_xfail "*-*-*" + gdb_expect { + -re "$decimal\[ \t\]+inheritance3 \[)(\]+;$nl$gdb_prompt $" {} + -re ".*$gdb_prompt $" { fail "next to inheritance3" ; return } + } + clear_xfail "*-*-*" + + gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)" +} + +# +# Test static members. +# + +proc test_static_members {} { + global gdb_prompt + global hex + global nl + + send_gdb "print Foo::st\n" + gdb_expect { + -re ".* = 100$nl$gdb_prompt $" { + pass "print Foo::st" + } + -re "There is no field named st.*$gdb_prompt $" { + setup_xfail "*-*-*" + fail "print Foo::st" + } + -re ".*$gdb_prompt $" { fail "print Foo::st" } + timeout { fail "print Foo::st (timeout)" ; return } + } + + send_gdb "set foo.st = 200\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + } + + send_gdb "print bar.st\n" + gdb_expect { + -re ".* = 200$nl$gdb_prompt $" { + pass "print bar.st" + } + -re "There is no member( or method|) named st.*$gdb_prompt $" { + setup_xfail "*-*-*" + fail "print bar.st" + } + -re ".*$gdb_prompt $" { fail "print bar.st" } + timeout { fail "print bar.st (timeout)" ; return } + } + + send_gdb "print &foo.st\n" + gdb_expect { + -re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" { + pass "print &foo.st" + } + -re "There is no member( or method|) named st.*$gdb_prompt $" { + setup_xfail "*-*-*" + fail "print &foo.st" + } + -re ".*$gdb_prompt $" { fail "print &foo.st" } + timeout { fail "print &foo.st (timeout)" ; return } + } + + set got_bar_st 0 + send_gdb "print &Bar::st\n" + gdb_expect { + -re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" { + pass "print &Bar::st" + set got_bar_st 1 + } + -re "There is no field named st.*$gdb_prompt $" { + setup_xfail "*-*-*" + fail "print &Bar::st" + } + -re ".*$gdb_prompt $" { fail "print &Bar::st" } + timeout { fail "print &Bar::st (timeout)" ; return } + } + + if $got_bar_st then { + gdb_test "print *\$" ".* = 200" "print *\$" + } + + gdb_test "set print static-members off" "" + gdb_test "print csi" \ + "{x = 10, y = 20}" \ + "print csi without static members" + gdb_test "print cnsi" \ + "{x = 30, y = 40}" \ + "print cnsi without static members" + + gdb_test "set print static-members on" "" + gdb_test "print csi" \ + "{x = 10, y = 20, static null = {x = 0, y = 0, static null = }}" \ + "print csi with static members" + gdb_test "print cnsi" \ + "{x = 30, y = 40, static null = {x = 0, y = 0, static null = , static yy = {z = 5, static xx = {x = 1, y = 2, static null = , static yy = }}}, static yy = }" \ + "print cnsi with static members" +} + +proc do_tests {} { + global prms_id + global bug_id + global subdir + global objdir + global srcdir + global binfile + global gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language c++\n" + gdb_expect -re "$gdb_prompt $" + send_gdb "set width 0\n" + gdb_expect -re "$gdb_prompt $" + + runto_main + test_ptype_class_objects + + if [ runto 'inheritance2' ] then { + test_non_inherited_member_access + test_wrong_class_members + test_nonexistent_members + test_method_param_class + } + + gdb_breakpoint enums2 + if [ gdb_continue "enums2(\\(\\)|)" ]==0 then { + gdb_test "finish" "" "" + test_enums + } + + if [istarget "mips-idt-*"] then { + # Restart because IDT/SIM runs out of file descriptors. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + } + + if [ runto_main ] then { + test_pointers_to_class_members + test_static_members + } + + if [istarget "mips-idt-*"] then { + # Restart because IDT/SIM runs out of file descriptors. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + } + + if [ runto marker_reg1 ] then { + + gdb_test "finish" "Run till exit from.*" "finish from marker_reg1" + + send_gdb "print v.method ()\n" + gdb_expect { + -re "= 82.*$gdb_prompt $" { + pass "calling method for small class" + } + -re "Address requested for identifier .v. which is in register.*$gdb_prompt $" { + setup_xfail "*-*-*" 2972 + fail "calling method for small class" + } + -re ".*$gdb_prompt $" { fail "calling method for small class" } + timeout { fail "calling method for small class (timeout)" } + eof { fail "calling method for small class (eof)" } + } + } + +} + +do_tests + +send_gdb "maint demangle inheritance1__Fv\n" +gdb_expect { + -re "inheritance1\\(void\\).*$gdb_prompt $" { pass "demangle" } + -re ".*$gdb_prompt $" { fail "demangle" } + timeout { fail "(timeout) demangle" } +} diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.cc b/gdb/testsuite/gdb.c++/cplusfuncs.cc new file mode 100644 index 0000000..7f033d6 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cplusfuncs.cc @@ -0,0 +1,196 @@ +#include + +class foo { +public: + foo (int); + foo (int, const char *); + foo (foo&); + ~foo (); + + void operator * (foo&); + void operator % (foo&); + void operator - (foo&); + void operator >> (foo&); + void operator != (foo&); + void operator > (foo&); + void operator >= (foo&); + void operator | (foo&); + void operator && (foo&); + void operator ! (void); + void operator ++ (int); + void operator = (foo&); + void operator += (foo&); + void operator *= (foo&); + void operator %= (foo&); + void operator >>= (foo&); + void operator |= (foo&); + void operator , (foo&); + void operator / (foo&); + void operator + (foo&); + void operator << (foo&); + void operator == (foo&); + void operator < (foo&); + void operator <= (foo&); + void operator & (foo&); + void operator ^ (foo&); + void operator || (foo&); + void operator ~ (void); + void operator -- (int); + foo* operator -> (void); + void operator -= (foo&); + void operator /= (foo&); + void operator <<= (foo&); + void operator &= (foo&); + void operator ^= (foo&); + void operator ->* (foo&); + void operator [] (foo&); + void operator () (foo&); + void* operator new (size_t) throw (); + void operator delete (void *); + /**/ operator int (); + /**/ operator char* (); + + int foofunc (int); // forced to have int return type, which is required + int foofunc (int, signed char *); // forced to have int return type, which is required + int ifoo; + const char *ccpfoo; +}; + +#ifdef usestubs +extern "C" { + void set_debug_traps(); + void breakpoint(); +}; +#endif + +int main () { +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + int z=3; +} + +foo::foo (int i) { ifoo = i;} +foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; } +foo::foo (foo& afoo) { afoo.ifoo = 0; } +foo::~foo () {} + +void foo::operator * (foo& afoo) { afoo.ifoo = 0; } +void foo::operator % (foo& afoo) { afoo.ifoo = 0; } +void foo::operator - (foo& afoo) { afoo.ifoo = 0; } +void foo::operator >> (foo& afoo) { afoo.ifoo = 0; } +void foo::operator != (foo& afoo) { afoo.ifoo = 0; } +void foo::operator > (foo& afoo) { afoo.ifoo = 0; } +void foo::operator >= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator | (foo& afoo) { afoo.ifoo = 0; } +void foo::operator && (foo& afoo) { afoo.ifoo = 0; } +void foo::operator ! (void) {} +void foo::operator ++ (int ival) { ival = 0; } +void foo::operator = (foo& afoo) { afoo.ifoo = 0; } +void foo::operator += (foo& afoo) { afoo.ifoo = 0; } +void foo::operator *= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator %= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator >>= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator |= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator , (foo& afoo) { afoo.ifoo = 0; } +void foo::operator / (foo& afoo) { afoo.ifoo = 0; } +void foo::operator + (foo& afoo) { afoo.ifoo = 0; } +void foo::operator << (foo& afoo) { afoo.ifoo = 0; } +void foo::operator == (foo& afoo) { afoo.ifoo = 0; } +void foo::operator < (foo& afoo) { afoo.ifoo = 0; } +void foo::operator <= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator & (foo& afoo) { afoo.ifoo = 0; } +void foo::operator ^ (foo& afoo) { afoo.ifoo = 0; } +void foo::operator || (foo& afoo) { afoo.ifoo = 0; } +void foo::operator ~ (void) {} +void foo::operator -- (int ival) { ival = 0; } +foo* foo::operator -> (void) {return this;} +void foo::operator -= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator /= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator <<= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator &= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator ^= (foo& afoo) { afoo.ifoo = 0; } +void foo::operator ->* (foo& afoo) { afoo.ifoo = 0; } +void foo::operator [] (foo& afoo) { afoo.ifoo = 0; } +void foo::operator () (foo& afoo) { afoo.ifoo = 0; } +void* foo::operator new (size_t ival) throw () { ival = 0; return 0; } +void foo::operator delete (void *ptr) { ptr = 0; } +/**/ foo::operator int () { return 0; } +/**/ foo::operator char* () { return 0; } + +/* Some functions to test overloading by varying one argument type. */ + +void overload1arg (void) { } +void overload1arg (char arg) { arg = 0; } +void overload1arg (signed char arg) { arg = 0; } +void overload1arg (unsigned char arg) { arg = 0; } +void overload1arg (short arg) { arg = 0; } +void overload1arg (unsigned short arg) { arg = 0; } +void overload1arg (int arg) { arg = 0; } +void overload1arg (unsigned int arg) { arg = 0; } +void overload1arg (long arg) { arg = 0; } +void overload1arg (unsigned long arg) { arg = 0; } +void overload1arg (float arg) { arg = 0; } +void overload1arg (double arg) { arg = 0; } + +/* Some functions to test overloading by varying argument count. */ + +void overloadargs (int a1) { a1 = 0; } +void overloadargs (int a1, int a2) { a1 = a2 = 0; } +void overloadargs (int a1, int a2, int a3) { a1 = a2 = a3 = 0; } +void overloadargs (int a1, int a2, int a3, int a4) + { a1 = a2 = a3 = a4 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5) + { a1 = a2 = a3 = a4 = a5 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6) + { a1 = a2 = a3 = a4 = a5 = a6 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = + a10 = 0; } +void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10, int a11) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = + a10 = a11 == 0; } + +/* Some hairy function definitions. + Use typedefs to help maintain sanity. */ + +typedef int (*PFPc_i)(char *); +typedef short (*PFPl_s)(long *); +typedef short (*PFPc_s)(char *); +typedef int (*PFl_i)(long); +typedef PFl_i (*PFPc_PFl_i)(char *); +typedef PFl_i (*PFPi_PFl_i)(int *); +typedef PFl_i (*PFPFPc_i_PFl_i)(PFPc_i); +typedef PFl_i (*PFs_PFl_i)(short); +typedef int (*PFPFPl_s_i)(PFPl_s); +typedef int (*PFPFPc_s_i)(PFPc_s); + +PFs_PFl_i hairyfunc1 (int arg) { arg = 0; return 0; } +int hairyfunc2 (PFPc_i arg) { arg = 0; return 0; } +int hairyfunc3 (PFPFPl_s_i arg) { arg = 0; return 0; } +int hairyfunc4 (PFPFPc_s_i arg) { arg = 0; return 0; } +int hairyfunc5 (PFPc_PFl_i arg) { arg = 0; return 0; } +int hairyfunc6 (PFPi_PFl_i arg) { arg = 0; return 0; } +int hairyfunc7 (PFPFPc_i_PFl_i arg) { arg = 0; return 0; } + +/* gdb has two demanglers (one for g++ 2.95, one for g++ 3). + These marker functions help me figure out which demangler is in use. */ + +char * dm_type_char_star (char * p) { return p; } +int dm_type_foo_ref (foo & foo) { return foo.ifoo; } +int * dm_type_int_star (int * p) { return p; } +long * dm_type_long_star (long * p) { return p; } +int dm_type_unsigned_int (unsigned int i) { return i; } +int dm_type_void (void) { return 0; } +void * dm_type_void_star (void * p) { return p; } diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.exp b/gdb/testsuite/gdb.c++/cplusfuncs.exp new file mode 100644 index 0000000..0a5e1b3 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cplusfuncs.exp @@ -0,0 +1,564 @@ +# Copyright 1992, 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) +# Adapted for g++ 3.0 ABI by Michael Chastain. (chastain@redhat.com) + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +set testfile "cplusfuncs" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [get_compiler_info $binfile "c++"] } { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# +# g++ changed its ABI between 2.95 and 3.0. gdb has two demanglers +# for the two different styles. The two demanglers have some subtle +# discrepancies in their output. +# +# old demangler new demangler +# --- --------- --- --------- +# "operator, " "operator," +# "char *" "char*" +# "int *" "int*" +# "long *" "long*" +# "void *" "void*" +# "foo &" "foo&" +# "unsigned int" "unsigned" +# "void" "" +# +# I probe for the forms in use. +# The defaults are for the v3 demangler (as of 2001-02-13). +# + +set dm_operator_comma "," +set dm_type_char_star "char*" +set dm_type_char_star_quoted "char\\*" +set dm_type_foo_ref "foo&" +set dm_type_int_star "int*" +set dm_type_long_star "long*" +set dm_type_unsigned_int "unsigned" +set dm_type_void "" +set dm_type_void_star "void*" + +proc probe_demangler { } { + global gdb_prompt + global dm_operator_comma + global dm_type_char_star + global dm_type_char_star_quoted + global dm_type_foo_ref + global dm_type_int_star + global dm_type_long_star + global dm_type_unsigned_int + global dm_type_void + global dm_type_void_star + + send_gdb "print &'foo::operator,(foo&)'\n" + gdb_expect { + -re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_operator_comma ", " + pass "detect dm_operator_comma" + } + -re ".*foo::operator,\\(.*foo.*&.*\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_operator_comma" + } + -re ".*$gdb_prompt $" { + fail "detect dm_operator_comma" + } + timeout { + fail "detect dm_operator_comma" + } + } + + send_gdb "print &'dm_type_char_star'\n" + gdb_expect { + -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_char_star "char *" + set dm_type_char_star_quoted "char \\*" + pass "detect dm_type_char_star" + } + -re ".*dm_type_char_star\\(char\\*\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_char_star" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_char_star" + } + timeout { + fail "detect dm_type_char_star (timeout)" + } + } + + send_gdb "print &'dm_type_foo_ref'\n" + gdb_expect { + -re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_foo_ref "foo &" + pass "detect dm_type_foo_ref" + } + -re ".*dm_type_foo_ref\\(foo&\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_foo_ref" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_foo_ref" + } + timeout { + fail "detect dm_type_foo_ref (timeout)" + } + } + + send_gdb "print &'dm_type_int_star'\n" + gdb_expect { + -re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_int_star "int *" + pass "detect dm_type_int_star" + } + -re ".*dm_type_int_star\\(int\\*\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_int_star" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_int_star" + } + timeout { + fail "detect dm_type_int_star (timeout)" + } + } + + send_gdb "print &'dm_type_long_star'\n" + gdb_expect { + -re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_long_star "long *" + pass "detect dm_type_long_star" + } + -re ".*dm_type_long_star\\(long\\*\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_long_star" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_long_star" + } + timeout { + fail "detect dm_type_long_star (timeout)" + } + } + + send_gdb "print &'dm_type_unsigned_int'\n" + gdb_expect { + -re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_unsigned_int "unsigned int" + pass "detect dm_type_unsigned_int" + } + -re ".*dm_type_unsigned_int\\(unsigned\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_unsigned_int" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_unsigned_int" + } + timeout { + fail "detect dm_unsigned int (timeout)" + } + } + + send_gdb "print &'dm_type_void'\n" + gdb_expect { + -re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_void "void" + pass "detect dm_type_void" + } + -re ".*dm_type_void\\(\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_void" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_void" + } + timeout { + fail "detect dm_type_void (timeout)" + } + } + + send_gdb "print &'dm_type_void_star'\n" + gdb_expect { + -re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" { + # v2 demangler + set dm_type_void_star "void *" + pass "detect dm_type_void_star" + } + -re ".*dm_type_void_star\\(void\\*\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_type_void_star" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_void_star" + } + timeout { + fail "detect dm_type_void_star (timeout)" + } + } +} + +# +# Lookup a specific C++ function and print the demangled type. +# This form accepts the demangled type as a regexp. +# + +proc info_func_regexp { name demangled } { + global gdb_prompt + + send_gdb "info function $name\n" + gdb_expect { + -re ".*File .*:\r\n(class |)$demangled\r\n.*$gdb_prompt $" { + pass "info function for \"$name\"" + } + -re ".*$gdb_prompt $" { + fail "info function for \"$name\"" + } + timeout { + fail "info function for \"$name\" (timeout)" + } + } +} + +# +# Lookup a specific C++ function and print the demangled type. +# This form accepts the demangled type as a literal string. +# + +proc info_func { name demangled } { + info_func_regexp "$name" [string_to_regexp "$demangled"] +} + +# +# Print the address of a function. +# This checks that I can lookup a fully qualified C++ function. +# This also checks the argument types on the return string. + +# Note: carlton/2003-01-16: If you modify this, make a corresponding +# modification to print_addr_2_kfail. + +proc print_addr_2 { name good } { + global gdb_prompt + global hex + + set good_pattern [string_to_regexp $good] + + send_gdb "print &'$name'\n" + gdb_expect { + -re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" { + pass "print &'$name'" + } + -re ".*$gdb_prompt $" { + fail "print &'$name'" + } + timeout { + fail "print &'$name' (timeout)" + } + } +} + +# NOTE: carlton/2003-01-16: hairyfunc5-6 fail on GCC 3.x (for at least +# x=1 and x=2.1). So I'm modifying print_addr_2 to accept a failure +# condition. FIXME: It would be nice if the failure condition were +# conditional on the compiler version, but I'm not sufficiently +# motivated. I did hardwire in the versions of char * and int *, +# which will give some compiler-specificity to the failure. + +proc print_addr_2_kfail { name good bad bugid } { + global gdb_prompt + global hex + + set good_pattern [string_to_regexp $good] + set bad_pattern [string_to_regexp $bad] + + send_gdb "print &'$name'\n" + gdb_expect { + -re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" { + pass "print &'$name'" + } + -re ".* = .* $hex <$bad_pattern>\r\n$gdb_prompt $" { + kfail $bugid "print &'$name'" + } + -re ".*$gdb_prompt $" { + fail "print &'$name'" + } + timeout { + fail "print &'$name' (timeout)" + } + } +} + +# +# Simple interfaces to print_addr_2. +# + +proc print_addr { name } { + print_addr_2 "$name" "$name" +} + +# +# Test name demangling for operators. +# +# The '(' at the end of each regex input pattern is so that we match only +# the one we are looking for. I.E. "operator&" would match both +# "operator&(foo &)" and "operator&&(foo &)". +# +# gdb-gnats bug gdb/18: +# "gdb can't parse "info func operator*" or "info func operator\*". +# The star in "operator*" is interpreted as a regexp, but the "\*" +# in "operator\*" is not a legal operator. +# + +proc test_lookup_operator_functions {} { + global dm_operator_comma + global dm_type_char_star + global dm_type_char_star_quoted + global dm_type_foo_ref + global dm_type_void + global dm_type_void_star + + # operator* requires quoting so that GDB does not treat it as a regexp. + info_func "operator\\*(" "void foo::operator*($dm_type_foo_ref);" + info_func "operator%(" "void foo::operator%($dm_type_foo_ref);" + info_func "operator-(" "void foo::operator-($dm_type_foo_ref);" + info_func "operator>>(" "void foo::operator>>($dm_type_foo_ref);" + info_func "operator!=(" "void foo::operator!=($dm_type_foo_ref);" + info_func "operator>(" "void foo::operator>($dm_type_foo_ref);" + info_func "operator>=(" "void foo::operator>=($dm_type_foo_ref);" + info_func "operator|(" "void foo::operator|($dm_type_foo_ref);" + info_func "operator&&(" "void foo::operator&&($dm_type_foo_ref);" + info_func "operator!(" "void foo::operator!($dm_type_void);" + info_func "operator++(" "void foo::operator++(int);" + info_func "operator=(" "void foo::operator=($dm_type_foo_ref);" + info_func "operator+=(" "void foo::operator+=($dm_type_foo_ref);" + # operator*= requires quoting so that GDB does not treat it as a regexp. + info_func "operator\\*=(" "void foo::operator*=($dm_type_foo_ref);" + info_func "operator%=(" "void foo::operator%=($dm_type_foo_ref);" + info_func "operator>>=(" "void foo::operator>>=($dm_type_foo_ref);" + info_func "operator|=(" "void foo::operator|=($dm_type_foo_ref);" + info_func "operator$dm_operator_comma\(" \ + "void foo::operator$dm_operator_comma\($dm_type_foo_ref);" + info_func "operator/(" "void foo::operator/($dm_type_foo_ref);" + info_func "operator+(" "void foo::operator+($dm_type_foo_ref);" + info_func "operator<<(" "void foo::operator<<($dm_type_foo_ref);" + info_func "operator==(" "void foo::operator==($dm_type_foo_ref);" + info_func "operator<(" "void foo::operator<($dm_type_foo_ref);" + info_func "operator<=(" "void foo::operator<=($dm_type_foo_ref);" + info_func "operator&(" "void foo::operator&($dm_type_foo_ref);" + info_func "operator^(" "void foo::operator^($dm_type_foo_ref);" + info_func "operator||(" "void foo::operator||($dm_type_foo_ref);" + info_func "operator~(" "void foo::operator~($dm_type_void);" + info_func "operator--(" "void foo::operator--(int);" + info_func "operator->(" "foo *foo::operator->($dm_type_void);" + info_func "operator-=(" "void foo::operator-=($dm_type_foo_ref);" + info_func "operator/=(" "void foo::operator/=($dm_type_foo_ref);" + info_func "operator<<=(" "void foo::operator<<=($dm_type_foo_ref);" + info_func "operator&=(" "void foo::operator&=($dm_type_foo_ref);" + info_func "operator^=(" "void foo::operator^=($dm_type_foo_ref);" + # operator->* requires quoting so that GDB does not treat it as a regexp. + info_func "operator->\\*(" "void foo::operator->*($dm_type_foo_ref);" + + # operator[] needs double backslashes, so that a single backslash + # will be sent to GDB, preventing the square brackets from being + # evaluated as a regular expression. + info_func "operator\\\[\\\](" "void foo::operator\[\]($dm_type_foo_ref);" + + # These are gnarly because they might end with 'static'. + set dm_type_void_star_regexp [string_to_regexp $dm_type_void_star] + info_func_regexp "operator new(" "void \\*foo::operator new\\(.*\\)(| static);" + info_func_regexp "operator delete(" "void foo::operator delete\\($dm_type_void_star_regexp\\)(| static);" + + info_func "operator int(" "int foo::operator int($dm_type_void);" + info_func "operator()(" "void foo::operator()($dm_type_foo_ref);" + info_func "operator $dm_type_char_star_quoted\(" \ + "char *foo::operator $dm_type_char_star\($dm_type_void);" + +} + + +proc test_paddr_operator_functions {} { + global hex + global hp_aCC_compiler + global dm_operator_comma + global dm_type_char_star + global dm_type_foo_ref + global dm_type_long_star + global dm_type_unsigned_int + global dm_type_void + global dm_type_void_star + + print_addr "foo::operator*($dm_type_foo_ref)" + print_addr "foo::operator%($dm_type_foo_ref)" + print_addr "foo::operator-($dm_type_foo_ref)" + print_addr "foo::operator>>($dm_type_foo_ref)" + print_addr "foo::operator!=($dm_type_foo_ref)" + print_addr "foo::operator>($dm_type_foo_ref)" + print_addr "foo::operator>=($dm_type_foo_ref)" + print_addr "foo::operator|($dm_type_foo_ref)" + print_addr "foo::operator&&($dm_type_foo_ref)" + print_addr "foo::operator!($dm_type_void)" + print_addr "foo::operator++(int)" + print_addr "foo::operator=($dm_type_foo_ref)" + print_addr "foo::operator+=($dm_type_foo_ref)" + print_addr "foo::operator*=($dm_type_foo_ref)" + print_addr "foo::operator%=($dm_type_foo_ref)" + print_addr "foo::operator>>=($dm_type_foo_ref)" + print_addr "foo::operator|=($dm_type_foo_ref)" + print_addr "foo::operator$dm_operator_comma\($dm_type_foo_ref)" + print_addr "foo::operator/($dm_type_foo_ref)" + print_addr "foo::operator+($dm_type_foo_ref)" + print_addr "foo::operator<<($dm_type_foo_ref)" + print_addr "foo::operator==($dm_type_foo_ref)" + print_addr "foo::operator<($dm_type_foo_ref)" + print_addr "foo::operator<=($dm_type_foo_ref)" + print_addr "foo::operator&($dm_type_foo_ref)" + print_addr "foo::operator^($dm_type_foo_ref)" + print_addr "foo::operator||($dm_type_foo_ref)" + print_addr "foo::operator~($dm_type_void)" + print_addr "foo::operator--(int)" + print_addr "foo::operator->($dm_type_void)" + print_addr "foo::operator-=($dm_type_foo_ref)" + print_addr "foo::operator/=($dm_type_foo_ref)" + print_addr "foo::operator<<=($dm_type_foo_ref)" + print_addr "foo::operator&=($dm_type_foo_ref)" + print_addr "foo::operator^=($dm_type_foo_ref)" + print_addr "foo::operator->*($dm_type_foo_ref)" + print_addr "foo::operator\[\]($dm_type_foo_ref)" + print_addr "foo::operator()($dm_type_foo_ref)" + + gdb_test "print &'foo::operator new'" \ + " = .* $hex " + if { !$hp_aCC_compiler } { + print_addr "foo::operator delete($dm_type_void_star)" + } else { + gdb_test "print &'foo::operator delete($dm_type_void_star) static'" \ + " = .*(0x\[0-9a-f\]+|) " + } + + print_addr "foo::operator int($dm_type_void)" + print_addr "foo::operator $dm_type_char_star\($dm_type_void)" +} + +# +# Test overloaded functions (1 arg). +# + +proc test_paddr_overloaded_functions {} { + global dm_type_unsigned_int + global dm_type_void + + print_addr "overload1arg($dm_type_void)" + print_addr "overload1arg(char)" + print_addr "overload1arg(signed char)" + print_addr "overload1arg(unsigned char)" + print_addr "overload1arg(short)" + print_addr "overload1arg(unsigned short)" + print_addr "overload1arg(int)" + print_addr "overload1arg($dm_type_unsigned_int)" + print_addr "overload1arg(long)" + print_addr "overload1arg(unsigned long)" + print_addr "overload1arg(float)" + print_addr "overload1arg(double)" + + print_addr "overloadargs(int)" + print_addr "overloadargs(int, int)" + print_addr "overloadargs(int, int, int)" + print_addr "overloadargs(int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int, int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int, int, int, int, int, int)" + print_addr "overloadargs(int, int, int, int, int, int, int, int, int, int, int)" +} + +proc test_paddr_hairy_functions {} { + global gdb_prompt + global hex + global dm_type_char_star + global dm_type_int_star + global dm_type_long_star + + print_addr_2 "hairyfunc1" "hairyfunc1(int)" + print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" + print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" + print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" + + # gdb-gnats bug gdb/19: + # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" + print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" + print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" + print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" +} + +proc do_tests {} { + global prms_id + global bug_id + global subdir + global objdir + global srcdir + global binfile + global gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language c++\n" + gdb_expect -re "$gdb_prompt $" + send_gdb "set width 0\n" + gdb_expect -re "$gdb_prompt $" + + runto_main + + probe_demangler + test_paddr_overloaded_functions + test_paddr_operator_functions + test_paddr_hairy_functions + test_lookup_operator_functions +} + +do_tests diff --git a/gdb/testsuite/gdb.c++/ctti.exp b/gdb/testsuite/gdb.c++/ctti.exp new file mode 100644 index 0000000..96e9fcf --- /dev/null +++ b/gdb/testsuite/gdb.c++/ctti.exp @@ -0,0 +1,269 @@ +# Copyright 1998, 1999, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + + +# This file is part of the gdb testsuite +# file written by Elena Zannoni (ezannoni@cygnus.com) +# +# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc +# + + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +# Check to see if we have an executable to test. If not, then either we +# haven't tried to compile one, or the compilation failed for some reason. +# In either case, just notify the user and skip the tests in this file. + +set testfile "cttiadd" +set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc +set srcfile2 ${testfile}2.cc +set srcfile3 ${testfile}3.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +#if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } { +# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +#} + +set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}" + +remote_exec build $cmdline + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = 2;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = 4.5;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*add1\\(\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "print c\n" +gdb_expect { + -re ".$decimal = -62.*\r\n$gdb_prompt $" { + pass "print value of c" + } + -re ".*$gdb_prompt $" { fail "print value of c" } + timeout { fail "(timeout) print value of c" } + } + + +send_gdb "print f\n" +gdb_expect { + -re ".$decimal = 9\r\n$gdb_prompt $" { + pass "print value of f" + } + -re ".*$gdb_prompt $" { fail "print value of f" } + timeout { fail "(timeout) print value of f" } + } + + +send_gdb "print i\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of i" + } + -re ".*$gdb_prompt $" { fail "print value of i" } + timeout { fail "(timeout) print value of i" } + } + + + +send_gdb "print add(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add(2,2)" } + timeout { fail "(timeout) print value of add(2,2)" } + } + +send_gdb "print add(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add(2.3,2.3)" } + timeout { fail "(timeout) print value of add(2.3,2.3)" } + } + +send_gdb "print add('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add('A','A')" } + timeout { fail "(timeout) print value of add('A','A')" } + } + + +send_gdb "print add2(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add2(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add2(2,2)" } + timeout { fail "(timeout) print value of add2(2,2)" } + } + +send_gdb "print add2(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add2(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add2(2.3,2.3)" } + timeout { fail "(timeout) print value of add2(2.3,2.3)" } + } + +send_gdb "print add2('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add2('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add2('A','A')" } + timeout { fail "(timeout) print value of add2('A','A')" } + } + +send_gdb "print add3(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add3(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add3(2,2)" } + timeout { fail "(timeout) print value of add3(2,2)" } + } + +send_gdb "print add3(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add3(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add3(2.3,2.3)" } + timeout { fail "(timeout) print value of add3(2.3,2.3)" } + } + +send_gdb "print add3('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add3('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add3('A','A')" } + timeout { fail "(timeout) print value of add3('A','A')" } + } + +send_gdb "print add4(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add4(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add4(2,2)" } + timeout { fail "(timeout) print value of add4(2,2)" } + } + +send_gdb "print add4(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add4(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add4(2.3,2.3)" } + timeout { fail "(timeout) print value of add4(2.3,2.3)" } + } + +send_gdb "print add4('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add4('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add4('A','A')" } + timeout { fail "(timeout) print value of add4('A','A')" } + } + + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/cttiadd.cc b/gdb/testsuite/gdb.c++/cttiadd.cc new file mode 100644 index 0000000..1f50fae --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd.cc @@ -0,0 +1,29 @@ +template T add(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; + } + +int main() +{ + char c; + int i; + float f; + extern void add1(); + extern void subr2(); + extern void subr3(); + + c = 'a'; + i = 2; + f = 4.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); + + add1(); + subr2(); + subr3(); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd1.cc b/gdb/testsuite/gdb.c++/cttiadd1.cc new file mode 100644 index 0000000..7113ece --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd1.cc @@ -0,0 +1,16 @@ +template T add(T v1, T v2); + +void add1() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd2.cc b/gdb/testsuite/gdb.c++/cttiadd2.cc new file mode 100644 index 0000000..d0d9891 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd2.cc @@ -0,0 +1,22 @@ +template T add2(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr2() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add2(c, c); + i = add2(i, i); + f = add2(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd3.cc b/gdb/testsuite/gdb.c++/cttiadd3.cc new file mode 100644 index 0000000..7ba1b01 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd3.cc @@ -0,0 +1,33 @@ +template T add3(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +template T add4(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr3() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add3(c, c); + i = add3(i, i); + f = add3(f, f); + c = add4(c, c); + i = add4(i, i); + f = add4(f, f); +} diff --git a/gdb/testsuite/gdb.c++/demangle.exp b/gdb/testsuite/gdb.c++/demangle.exp new file mode 100644 index 0000000..7bd9fc5 --- /dev/null +++ b/gdb/testsuite/gdb.c++/demangle.exp @@ -0,0 +1,1582 @@ +# Copyright (C) 1992, 1997, 1999, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +### The demangling style we last sent to GDB. +set current_demangling_style none + +### Set GDB's current demangling style to STYLE. Subsequent calls to +### test_demangle will include STYLE in the test name when reporting +### passes and failures. +proc set_demangling_style {style} { + global gdb_prompt + global current_demangling_style + + send_gdb "set demangle-style $style\n" + gdb_expect { + -re "set demangle-style $style\[\r\n\]+$gdb_prompt $" { + pass "$style: set demangle-style" + } + -re ".*$gdb_prompt $" { + fail "$style: set demangle-style" + error "set_demangling_style: set style" + } + timeout { + fail "$style: set demangle-style (timeout)" + error "set_demangling_style: set style" + } + } + + send_gdb "show demangle-style\n" + gdb_expect { + -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" { + pass "$style: check demangling style" + } + -re ".*$gdb_prompt $" { + fail "$style: check demangling style" + error "set_demangling_style: check style" + } + timeout { + fail "$style: check demangling style (timeout)" + error "set_demangling_style: check style" + } + } + + set current_demangling_style $style +} + + +### Utility function for test_demangling and test_demangling_exact. +proc test_demangling_core {tester test result} { + global current_demangling_style + + if {! [regexp {^([^ ]+): (.+)$} $test dummy style name]} { + error "bad test name passed to test_demangling" + } + + if {[string compare $style $current_demangling_style]} { + set_demangling_style $style + } + + $tester "maintenance demangle $name" $result $test +} + +### Demangle an identifier, and check that the result matches a pattern. +### +### TEST should be of the form "STYLE: NAME", where STYLE is the name +### of a demangling style (like "gnu" or "arm"), and NAME is a mangled +### identifier to demangle. Pass when the result matches the regular +### expression RESULT. Report passes and fails using TEST as the name +### of the test. +### +### Why don't we just pass the STYLE and NAME as two separate +### arguments, or let the style be a global variable? That would be +### cleaner. However, doing it this way means that: +### +### 1) the name of the test, as recorded in the summary and log, +### appears verbatim in the script, and +### +### 2) that test names are unique, even though we try to demangle the same +### identifiers using several different mangling styles. +### +### This makes it a lot easier for people tracking down failures to +### find the one they care about. + +proc test_demangling {test result} { + test_demangling_core gdb_test $test $result +} + +### Like test_demangling, above, except that RESULT is not a regexp, +### but a string that must match exactly. + +proc test_demangling_exact {test result} { + test_demangling_core gdb_test_exact $test $result +} + + + +# +# Test gnu style name demangling +# + +proc test_gnu_style_demangling {} { + global gdb_prompt + + test_demangling "gnu: Abort__FP6EditoriPCc" \ + "Abort\[(\]+Editor \[*\]+, int, (const char|char const) \[*\]+\[)\]+" + test_demangling_exact "gnu: AddAlignment__9ivTSolverUiP12ivInteractorP7ivTGlue" "ivTSolver::AddAlignment(unsigned int, ivInteractor *, ivTGlue *)" + test_demangling "gnu: Append__15NameChooserViewPCc" \ + "NameChooserView::Append\[(\]+(const char|char const) \[*\]+\[)\]+" + test_demangling_exact "gnu: ArrowheadIntersects__9ArrowLineP9ArrowheadR6BoxObjP7Graphic" "ArrowLine::ArrowheadIntersects(Arrowhead *, BoxObj &, Graphic *)" + test_demangling_exact "gnu: AtEnd__13ivRubberGroup" "ivRubberGroup::AtEnd(void)" + test_demangling_exact "gnu: BgFilter__9ivTSolverP12ivInteractor" "ivTSolver::BgFilter(ivInteractor *)" + test_demangling "gnu: BitPatterntoa__FRC10BitPatternccc" \ + "BitPatterntoa\[(\]+(const BitPattern|BitPattern const) &, char, char, char\[)\]+" + test_demangling_exact "gnu: Check__6UArrayi" "UArray::Check(int)" + test_demangling_exact "gnu: CoreConstDecls__8TextCodeR7ostream" "TextCode::CoreConstDecls(ostream &)" + test_demangling_exact "gnu: Detach__8StateVarP12StateVarView" "StateVar::Detach(StateVarView *)" + test_demangling_exact "gnu: Done__9ComponentG8Iterator" "Component::Done(Iterator)" + test_demangling "gnu: DrawDestinationTransformedImage__FP7_XImageiiT0iiUlUiiiUiUlUlP4_XGCRC13ivTransformeriiii" \ + "DrawDestinationTransformedImage\[(\]+_XImage \[*\]+, int, int, _XImage \[*\]+, int, int, unsigned long, unsigned int, int, int, unsigned int, unsigned long, unsigned long, _XGC \[*\]+, (const ivTransformer|ivTransformer const) &, int, int, int, int\[)\]+" + + test_demangling "gnu: Edit__12StringEditorPCcii" \ + "StringEditor::Edit\[(\]+(const char|char const) \[*\]+, int, int\[)\]+" + test_demangling_exact "gnu: Effect__11RelateManipR7ivEvent" "RelateManip::Effect(ivEvent &)" + test_demangling "gnu: FilterName__FPCc" \ + "FilterName\[(\]+(const char|char const) \[*\]+\[)\]+" + test_demangling "gnu: Filter__6PSTextPCci" \ + "PSText::Filter\[(\]+(const char|char const) \[*\]+, int\[)\]+" + test_demangling "gnu: FindColor__7CatalogPCciii" \ + "Catalog::FindColor\[(\]+(const char|char const) \[*\]+, int, int, int\[)\]+" + test_demangling_exact "gnu: FindFixed__FRP4CNetP4CNet" "FindFixed(CNet *&, CNet *)" + test_demangling "gnu: FindFont__7CatalogPCcN21" \ + "Catalog::FindFont\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+" + test_demangling_exact "gnu: Fix48_abort__FR8twolongs" "Fix48_abort(twolongs &)" + test_demangling_exact "gnu: GetBarInfo__15iv2_6_VScrollerP13ivPerspectiveRiT2" "iv2_6_VScroller::GetBarInfo(ivPerspective *, int &, int &)" + test_demangling_exact "gnu: GetBgColor__C9ivPainter" "ivPainter::GetBgColor(void) const" + + test_demangling "gnu: Iisdouble__FPC6IntRep" \ + "Iisdouble\[(\]+(const IntRep|IntRep const) \[*\]+\[)\]+" + test_demangling_exact "gnu: InsertBody__15H_PullrightMenuii" "H_PullrightMenu::InsertBody(int, int)" + test_demangling_exact "gnu: InsertCharacter__9TextManipc" "TextManip::InsertCharacter(char)" + + test_demangling_exact "gnu: InsertToplevel__7ivWorldP12ivInteractorT1" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *)" + test_demangling_exact "gnu: InsertToplevel__7ivWorldP12ivInteractorT1iiUi" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *, int, int, unsigned int)" + test_demangling "gnu: IsADirectory__FPCcR4stat" \ + "IsADirectory\[(\]+(const char|char const) \[*\]+, stat &\[)\]+" + test_demangling_exact "gnu: IsAGroup__FP11GraphicViewP11GraphicComp" "IsAGroup(GraphicView *, GraphicComp *)" + test_demangling_exact "gnu: IsA__10ButtonCodeUl" "ButtonCode::IsA(unsigned long)" + + test_demangling_exact "gnu: ReadName__FR7istreamPc" "ReadName(istream &, char *)" + test_demangling_exact "gnu: Redraw__13StringBrowseriiii" "StringBrowser::Redraw(int, int, int, int)" + test_demangling_exact "gnu: Rotate__13ivTransformerf" "ivTransformer::Rotate(float)" + test_demangling_exact "gnu: Rotated__C13ivTransformerf" "ivTransformer::Rotated(float) const" + test_demangling_exact "gnu: Round__Ff" "Round(float)" + + test_demangling_exact "gnu: SetExport__16MemberSharedNameUi" "MemberSharedName::SetExport(unsigned int)" + test_demangling_exact "gnu: Set__14ivControlState13ControlStatusUi" "ivControlState::Set(ControlStatus, unsigned int)" + test_demangling_exact "gnu: Set__5DFacePcii" "DFace::Set(char *, int, int)" + + test_demangling_exact "gnu: VConvert__9ivTSolverP12ivInteractorRP8TElementT2" "ivTSolver::VConvert(ivInteractor *, TElement *&, TElement *&)" + test_demangling_exact "gnu: VConvert__9ivTSolverP7ivTGlueRP8TElement" "ivTSolver::VConvert(ivTGlue *, TElement *&)" + test_demangling_exact "gnu: VOrder__9ivTSolverUiRP12ivInteractorT2" "ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&)" + test_demangling "gnu: Valid__7CatalogPCcRP4Tool" \ + "Catalog::Valid\[(\]+(const char|char const) \[*\]+, Tool \[*\]+&\[)\]+" + test_demangling_exact "gnu: _10PageButton\$__both" "PageButton::__both" + test_demangling_exact "gnu: _3RNG\$singleMantissa" "RNG::singleMantissa" + test_demangling_exact "gnu: _5IComp\$_release" "IComp::_release" + test_demangling_exact "gnu: _\$_10BitmapComp" "BitmapComp::~BitmapComp(void)" + + test_demangling_exact "gnu: _\$_9__io_defs" "__io_defs::~__io_defs(void)" + test_demangling_exact "gnu: _\$_Q23foo3bar" "foo::bar::~bar(void)" + test_demangling_exact "gnu: _\$_Q33foo3bar4bell" "foo::bar::bell::~bell(void)" + test_demangling_exact "gnu: __10ivTelltaleiP7ivGlyph" "ivTelltale::ivTelltale(int, ivGlyph *)" + test_demangling_exact "gnu: __10ivViewportiP12ivInteractorUi" "ivViewport::ivViewport(int, ivInteractor *, unsigned int)" + test_demangling_exact "gnu: __10ostrstream" "ostrstream::ostrstream(void)" + test_demangling_exact "gnu: __10ostrstreamPcii" "ostrstream::ostrstream(char *, int, int)" + test_demangling "gnu: __11BasicDialogiPCcP13ivButtonStateN22Ui" \ + "BasicDialog::BasicDialog\[(\]+int, (const char|char const) \[*\]+, ivButtonState \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+, unsigned int\[)\]+" + test_demangling_exact "gnu: __11BitmapTablei" "BitmapTable::BitmapTable(int)" + test_demangling_exact "gnu: __12ViewportCodeP12ViewportComp" "ViewportCode::ViewportCode(ViewportComp *)" + test_demangling "gnu: __12iv2_6_BorderiPCci" \ + "iv2_6_Border::iv2_6_Border\[(\]+int, (const char|char const) \[*\]+, int\[)\]+" + test_demangling_exact "gnu: __12iv2_6_Borderii" "iv2_6_Border::iv2_6_Border(int, int)" + test_demangling "gnu: __12ivBackgroundiP7ivGlyphPC7ivColor" \ + "ivBackground::ivBackground\[(\]+int, ivGlyph \[*\]+, (const ivColor|ivColor const) \[*\]+\[)\]+" + test_demangling_exact "gnu: __12ivBreak_Listl" "ivBreak_List::ivBreak_List(long)" + test_demangling "gnu: __14TextInteractoriPCcUi" \ + "TextInteractor::TextInteractor\[(\]+int, (const char|char const) \[*\]+, unsigned int\[)\]+" + test_demangling_exact "gnu: __14iv2_6_MenuItemiP12ivInteractor" "iv2_6_MenuItem::iv2_6_MenuItem(int, ivInteractor *)" + test_demangling "gnu: __14iv2_6_MenuItemiPCcP12ivInteractor" \ + "iv2_6_MenuItem::iv2_6_MenuItem\[(\]+int, (const char|char const) \[*\]+, ivInteractor \[*\]+\[)\]+" + + test_demangling_exact "gnu: __20DisplayList_IteratorR11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList &)" + test_demangling_exact "gnu: __3fooRT0" "foo::foo(foo &)" + test_demangling_exact "gnu: __3fooiN31" "foo::foo(int, int, int, int)" + test_demangling "gnu: __3fooiPCc" \ + "foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+" + test_demangling_exact "gnu: __3fooiRT0iT2iT2" "foo::foo(int, foo &, int, foo &, int, foo &)" + test_demangling "gnu: __6GetOptiPPcPCc" \ + "GetOpt::GetOpt\[(\]+int, char \[*\]+\[*\]+, (const char|char const) \[*\]+\[)\]+" + test_demangling_exact "gnu: __6KeyMapPT0" "KeyMap::KeyMap(KeyMap *)" + test_demangling "gnu: __7ivWorldPCcRiPPcPC12ivOptionDescPC14ivPropertyData" \ + "ivWorld::ivWorld\[(\]+(const char|char const) \[*\]+, int &, char \[*\]+\[*\]+, (const ivOptionDesc|ivOptionDesc const) \[*\]+, (const ivPropertyData|ivPropertyData const) \[*\]+\[)\]+" + test_demangling "gnu: __7procbufPCci" \ + "procbuf::procbuf\[(\]+(const char|char const) \[*\]+, int\[)\]+" + test_demangling_exact "gnu: __8ArrowCmdP6EditorUiUi" "ArrowCmd::ArrowCmd(Editor *, unsigned int, unsigned int)" + + test_demangling_exact "gnu: __9F_EllipseiiiiP7Graphic" "F_Ellipse::F_Ellipse(int, int, int, int, Graphic *)" + test_demangling_exact "gnu: __9FrameDataP9FrameCompi" "FrameData::FrameData(FrameComp *, int)" + test_demangling_exact "gnu: __9HVGraphicP9CanvasVarP7Graphic" "HVGraphic::HVGraphic(CanvasVar *, Graphic *)" + test_demangling_exact "gnu: __Q23foo3bar" "foo::bar::bar(void)" + test_demangling_exact "gnu: __Q33foo3bar4bell" "foo::bar::bell::bell(void)" + test_demangling_exact "gnu: __aa__3fooRT0" "foo::operator&&(foo &)" + test_demangling_exact "gnu: __aad__3fooRT0" "foo::operator&=(foo &)" + test_demangling_exact "gnu: __ad__3fooRT0" "foo::operator&(foo &)" + test_demangling_exact "gnu: __adv__3fooRT0" "foo::operator/=(foo &)" + test_demangling_exact "gnu: __aer__3fooRT0" "foo::operator^=(foo &)" + test_demangling_exact "gnu: __als__3fooRT0" "foo::operator<<=(foo &)" + test_demangling_exact "gnu: __amd__3fooRT0" "foo::operator%=(foo &)" + test_demangling_exact "gnu: __ami__3fooRT0" "foo::operator-=(foo &)" + test_demangling_exact "gnu: __aml__3FixRT0" "Fix::operator*=(Fix &)" + test_demangling_exact "gnu: __aml__5Fix16i" "Fix16::operator*=(int)" + test_demangling_exact "gnu: __aml__5Fix32RT0" "Fix32::operator*=(Fix32 &)" + test_demangling_exact "gnu: __aor__3fooRT0" "foo::operator|=(foo &)" + test_demangling_exact "gnu: __apl__3fooRT0" "foo::operator+=(foo &)" + test_demangling_exact "gnu: __ars__3fooRT0" "foo::operator>>=(foo &)" + + test_demangling_exact "gnu: __as__3fooRT0" "foo::operator=(foo &)" + test_demangling_exact "gnu: __cl__3fooRT0" "foo::operator()(foo &)" + test_demangling_exact "gnu: __cl__6Normal" "Normal::operator()(void)" + test_demangling_exact "gnu: __cl__6Stringii" "String::operator()(int, int)" + test_demangling_exact "gnu: __cm__3fooRT0" "foo::operator, (foo &)" + test_demangling_exact "gnu: __co__3foo" "foo::operator~(void)" + test_demangling_exact "gnu: __dl__3fooPv" "foo::operator delete(void *)" + test_demangling_exact "gnu: __dv__3fooRT0" "foo::operator/(foo &)" + test_demangling_exact "gnu: __eq__3fooRT0" "foo::operator==(foo &)" + test_demangling_exact "gnu: __er__3fooRT0" "foo::operator^(foo &)" + test_demangling_exact "gnu: __ge__3fooRT0" "foo::operator>=(foo &)" + test_demangling_exact "gnu: __gt__3fooRT0" "foo::operator>(foo &)" + test_demangling_exact "gnu: __le__3fooRT0" "foo::operator<=(foo &)" + test_demangling_exact "gnu: __ls__3fooRT0" "foo::operator<<(foo &)" + test_demangling_exact "gnu: __ls__FR7ostreamPFR3ios_R3ios" "operator<<(ostream &, ios &(*)(ios &))" + test_demangling_exact "gnu: __ls__FR7ostreamR3Fix" "operator<<(ostream &, Fix &)" + test_demangling_exact "gnu: __lt__3fooRT0" "foo::operator<(foo &)" + test_demangling_exact "gnu: __md__3fooRT0" "foo::operator%(foo &)" + test_demangling_exact "gnu: __mi__3fooRT0" "foo::operator-(foo &)" + test_demangling_exact "gnu: __ml__3fooRT0" "foo::operator*(foo &)" + test_demangling_exact "gnu: __mm__3fooi" "foo::operator--(int)" + + test_demangling_exact "gnu: __ne__3fooRT0" "foo::operator!=(foo &)" + test_demangling "gnu: __ne__FRC7ComplexT0" \ + "operator!=\[(\]+(const Complex|Complex const) &, (const Complex|Complex const) &\[)\]+" + test_demangling "gnu: __ne__FRC7Complexd" \ + "operator!=\[(\]+(const Complex|Complex const) &, double\[)\]+" + test_demangling "gnu: __ne__FRC9SubStringRC6String" \ + "operator!=\[(\]+(const SubString|SubString const) &, (const String|String const) &\[)\]+" + test_demangling_exact "gnu: __nt__3foo" "foo::operator!(void)" + test_demangling_exact "gnu: __nw__3fooi" "foo::operator new(int)" + test_demangling_exact "gnu: __oo__3fooRT0" "foo::operator||(foo &)" + test_demangling_exact "gnu: __opPc__3foo" "foo::operator char *(void)" + test_demangling_exact "gnu: __opi__3foo" "foo::operator int(void)" + test_demangling_exact "gnu: __or__3fooRT0" "foo::operator|(foo &)" + test_demangling_exact "gnu: __pl__3fooRT0" "foo::operator+(foo &)" + test_demangling_exact "gnu: __pp__3fooi" "foo::operator++(int)" + test_demangling_exact "gnu: __rf__3foo" "foo::operator->(void)" + test_demangling_exact "gnu: __rm__3fooRT0" "foo::operator->*(foo &)" + test_demangling_exact "gnu: __rs__3fooRT0" "foo::operator>>(foo &)" + test_demangling "gnu: __vc__3fooRT0" "foo::operator\\\[\\\]\\(foo &\\)" + test_demangling "gnu: _gsub__6StringRC5RegexPCci" \ + "String::_gsub\[(\]+(const Regex|Regex const) &, (const char|char const) \[*\]+, int\[)\]+" + test_demangling_exact "gnu: _new_Fix__FUs" "_new_Fix(unsigned short)" + + # gcc 2.4.5 (and earlier) style virtual tables. We want to continue to + # correctly demangle these even if newer compilers use a different form. + test_demangling_exact "gnu: _vt.foo" "foo virtual table" + test_demangling_exact "gnu: _vt.foo.bar" "foo::bar virtual table" + test_demangling_exact "gnu: _vt\$foo" "foo virtual table" + test_demangling_exact "gnu: _vt\$foo\$bar" "foo::bar virtual table" + + test_demangling_exact "gnu: append__7ivGlyphPT0" "ivGlyph::append(ivGlyph *)" + test_demangling "gnu: arg__FRC7Complex" \ + "arg\[(\]+(const Complex|Complex const) &\[)\]+" + test_demangling_exact "gnu: clearok__FP7_win_sti" "clearok(_win_st *, int)" + + test_demangling_exact "gnu: complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))" + test_demangling_exact "gnu: complexfunc3__FPFPFPl_s_i" "complexfunc3(int (*)(short (*)(long *)))" + test_demangling_exact "gnu: complexfunc4__FPFPFPc_s_i" "complexfunc4(int (*)(short (*)(char *)))" + test_demangling_exact "gnu: complexfunc5__FPFPc_PFl_i" "complexfunc5(int (*(*)(char *))(long))" + test_demangling_exact "gnu: complexfunc6__FPFPi_PFl_i" "complexfunc6(int (*(*)(int *))(long))" + test_demangling_exact "gnu: complexfunc7__FPFPFPc_i_PFl_i" "complexfunc7(int (*(*)(int (*)(char *)))(long))" + test_demangling "gnu: contains__C9BitStringRC10BitPattern" \ + "BitString::contains\[(\]+(const BitPattern|BitPattern const) &\[)\]+ const" + test_demangling "gnu: contains__C9BitStringRC12BitSubStringi" \ + "BitString::contains\[(\]+(const BitSubString|BitSubString const) &, int\[)\]+ const" + test_demangling "gnu: contains__C9BitStringRT0" \ + "BitString::contains\[(\]+(const BitString|BitString const) &\[)\]+ const" + test_demangling "gnu: div__FPC6IntRepT0P6IntRep" \ + "div\[(\]+(const IntRep|IntRep const) \[*\]+, (const IntRep|IntRep const) \[*\]+, IntRep \[*\]+\[)\]+" + test_demangling "gnu: div__FPC6IntReplP6IntRep" \ + "div\[(\]+(const IntRep|IntRep const) \[*\]+, long, IntRep \[*\]+\[)\]+" + test_demangling "gnu: div__FRC8RationalT0R8Rational" \ + "div\[(\]+(const Rational|Rational const) &, (const Rational|Rational const) &, Rational &\[)\]+" + test_demangling "gnu: divide__FRC7IntegerT0R7IntegerT2" \ + "divide\[(\]+(const Integer|Integer const) &, (const Integer|Integer const) &, Integer &, Integer &\[)\]+" + test_demangling "gnu: divide__FRC7IntegerlR7IntegerRl" \ + "divide\[(\]+(const Integer|Integer const) &, long, Integer &, long &\[)\]+" + test_demangling "gnu: enable__14DocumentViewerPCcUi" \ + "DocumentViewer::enable\[(\]+(const char|char const) \[*\]+, unsigned int\[)\]+" + + test_demangling_exact "gnu: foo__FiN30" "foo(int, int, int, int)" + test_demangling_exact "gnu: foo__FiR3fooiT1iT1" "foo(int, foo &, int, foo &, int, foo &)" + test_demangling_exact "gnu: foo___3barl" "bar::foo_(long)" + test_demangling_exact "gnu: insert__15ivClippingStacklRP8_XRegion" "ivClippingStack::insert(long, _XRegion *&)" + test_demangling_exact "gnu: insert__16ChooserInfo_ListlR11ChooserInfo" "ChooserInfo_List::insert(long, ChooserInfo &)" + test_demangling_exact "gnu: insert__17FontFamilyRepListlRP15ivFontFamilyRep" "FontFamilyRepList::insert(long, ivFontFamilyRep *&)" + test_demangling_exact "gnu: leaveok__FP7_win_stc" "leaveok(_win_st *, char)" + test_demangling_exact "gnu: left_mover__C7ivMFKitP12ivAdjustableP7ivStyle" "ivMFKit::left_mover(ivAdjustable *, ivStyle *) const" + test_demangling "gnu: matches__C9BitStringRC10BitPatterni" \ + "BitString::matches\[(\]+(const BitPattern|BitPattern const) &, int\[)\]+ const" + test_demangling "gnu: matches__C9SubStringRC5Regex" \ + "SubString::matches\[(\]+(const Regex|Regex const) &\[)\]+ const" + + test_demangling_exact "gnu: overload1arg__FSc" "overload1arg(signed char)" + test_demangling_exact "gnu: overload1arg__FUc" "overload1arg(unsigned char)" + test_demangling_exact "gnu: overload1arg__FUi" "overload1arg(unsigned int)" + test_demangling_exact "gnu: overload1arg__FUl" "overload1arg(unsigned long)" + test_demangling_exact "gnu: overload1arg__FUs" "overload1arg(unsigned short)" + test_demangling_exact "gnu: overload1arg__Fc" "overload1arg(char)" + test_demangling_exact "gnu: overload1arg__Fd" "overload1arg(double)" + test_demangling_exact "gnu: overload1arg__Ff" "overload1arg(float)" + test_demangling_exact "gnu: overload1arg__Fi" "overload1arg(int)" + test_demangling_exact "gnu: overload1arg__Fl" "overload1arg(long)" + test_demangling_exact "gnu: overload1arg__Fs" "overload1arg(short)" + test_demangling_exact "gnu: overload1arg__Fv" "overload1arg(void)" + test_demangling_exact "gnu: overloadargs__Fi" "overloadargs(int)" + test_demangling_exact "gnu: overloadargs__Fii" "overloadargs(int, int)" + test_demangling_exact "gnu: overloadargs__Fiii" "overloadargs(int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiii" "overloadargs(int, int, int, int)" + + test_demangling_exact "gnu: overloadargs__Fiiiii" "overloadargs(int, int, int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiiiii" "overloadargs(int, int, int, int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiiiiii" "overloadargs(int, int, int, int, int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int)" + test_demangling_exact "gnu: overloadargs__Fiiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int, int)" + test_demangling "gnu: pick__13ivCompositionP8ivCanvasRC12ivAllocationiR5ivHit" \ + "ivComposition::pick\[(\]+ivCanvas \[*\]+, (const ivAllocation|ivAllocation const) &, int, ivHit &\[)\]+" + test_demangling "gnu: pointer__C11ivHScrollerRC7ivEventRC12ivAllocation" \ + "ivHScroller::pointer\[(\]+(const ivEvent|ivEvent const) &, (const ivAllocation|ivAllocation const) &\[)\]+ const" + test_demangling_exact "gnu: poke__8ivRasterUlUlffff" "ivRaster::poke(unsigned long, unsigned long, float, float, float, float)" + test_demangling_exact "gnu: polar__Fdd" "polar(double, double)" + test_demangling "gnu: read__10osStdInputRPCc" \ + "osStdInput::read\[(\]+(const char|char const) \[*\]+&\[)\]+" + + test_demangling_exact "gnu: scale__13ivTransformerff" "ivTransformer::scale(float, float)" + test_demangling "gnu: scanw__12CursesWindowPCce" \ + "CursesWindow::scanw\[(\]+(const char|char const) \[*\]+,...\[)\]+" + test_demangling "gnu: scmp__FPCcT0" \ + "scmp\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+" + test_demangling_exact "gnu: sgetn__7filebufPci" "filebuf::sgetn(char *, int)" + test_demangling_exact "gnu: shift__FP5_FrepiT0" "shift(_Frep *, int, _Frep *)" + test_demangling_exact "gnu: test__C6BitSeti" "BitSet::test(int) const" + test_demangling_exact "gnu: test__C6BitSetii" "BitSet::test(int, int) const" + test_demangling "gnu: testbit__FRC7Integerl" \ + "testbit\[(\]+(const Integer|Integer const) &, long\[)\]+" + test_demangling_exact "gnu: text_source__8Documentl" "Document::text_source(long)" + test_demangling_exact "gnu: variance__6Erlangd" "Erlang::variance(double)" + test_demangling "gnu: vform__8iostreamPCcPc" \ + "iostream::vform\[(\]+(const char|char const) \[*\]+, char \[*\]+\[)\]+" + test_demangling_exact "gnu: view__14DocumentViewerP8ItemViewP11TabularItem" "DocumentViewer::view(ItemView *, TabularItem *)" + test_demangling_exact "gnu: xy_extents__11ivExtensionffff" "ivExtension::xy_extents(float, float, float, float)" + test_demangling_exact "gnu: zero__8osMemoryPvUi" "osMemory::zero(void *, unsigned int)" + test_demangling_exact "gnu: _2T4\$N" "T4::N" + test_demangling_exact "gnu: _Q22T42t1\$N" "T4::t1::N" + test_demangling_exact "gnu: get__2T1" "T1::get(void)" + test_demangling_exact "gnu: get__Q22T11a" "T1::a::get(void)" + test_demangling_exact "gnu: get__Q32T11a1b" "T1::a::b::get(void)" + test_demangling_exact "gnu: get__Q42T11a1b1c" "T1::a::b::c::get(void)" + test_demangling_exact "gnu: get__Q52T11a1b1c1d" "T1::a::b::c::d::get(void)" + test_demangling_exact "gnu: put__2T1i" "T1::put(int)" + test_demangling_exact "gnu: put__Q22T11ai" "T1::a::put(int)" + test_demangling_exact "gnu: put__Q32T11a1bi" "T1::a::b::put(int)" + test_demangling_exact "gnu: put__Q42T11a1b1ci" "T1::a::b::c::put(int)" + test_demangling_exact "gnu: put__Q52T11a1b1c1di" "T1::a::b::c::d::put(int)" + + test_demangling_exact "gnu: bar__3fooPv" "foo::bar(void *)" + test_demangling "gnu: bar__3fooPCv" \ + "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+" + test_demangling_exact "gnu: bar__C3fooPv" "foo::bar(void *) const" + test_demangling "gnu: bar__C3fooPCv" \ + "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const" + test_demangling_exact "gnu: __eq__3fooRT0" "foo::operator==(foo &)" + test_demangling "gnu: __eq__3fooRC3foo" \ + "foo::operator==\[(\]+(const foo|foo const) &\[)\]+" + test_demangling_exact "gnu: __eq__C3fooR3foo" "foo::operator==(foo &) const" + test_demangling "gnu: __eq__C3fooRT0" \ + "foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const" + + test_demangling_exact "gnu: elem__t6vector1Zdi" "vector::elem(int)" + test_demangling_exact "gnu: elem__t6vector1Zii" "vector::elem(int)" + test_demangling_exact "gnu: __t6vector1Zdi" "vector::vector(int)" + test_demangling_exact "gnu: __t6vector1Zii" "vector::vector(int)" + test_demangling_exact "gnu: _\$_t6vector1Zdi" "vector::~vector(int)" + test_demangling_exact "gnu: _\$_t6vector1Zii" "vector::~vector(int)" + + test_demangling_exact "gnu: __nw__t2T11ZcUi" "T1::operator new(unsigned int)" + test_demangling_exact "gnu: __nw__t2T11Z1tUi" "T1::operator new(unsigned int)" + test_demangling_exact "gnu: __dl__t2T11ZcPv" "T1::operator delete(void *)" + test_demangling_exact "gnu: __dl__t2T11Z1tPv" "T1::operator delete(void *)" + test_demangling_exact "gnu: __t2T11Zci" "T1::T1(int)" + test_demangling_exact "gnu: __t2T11Zc" "T1::T1(void)" + test_demangling_exact "gnu: __t2T11Z1ti" "T1::T1(int)" + test_demangling_exact "gnu: __t2T11Z1t" "T1::T1(void)" + + test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3Pix" \ + "List::Pix::Pix(void)" + + test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixPQ2t4List1Z10VHDLEntity7element" \ + "List::Pix::Pix(List::element *)" + + test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixRCQ2t4List1Z10VHDLEntity3Pix" \ + "List::Pix::Pix(List::Pix const &)" + + test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity7elementRC10VHDLEntityPT0" \ + "List::element::element(VHDLEntity const &, List::element *)" + + test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity7elementRCQ2t4List1Z10VHDLEntity7element" \ + "List::element::element(List::element const &)" + + test_demangling_exact "gnu: __cl__C11VHDLLibraryGt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \ + "VHDLLibrary::operator()(PixX >) const" + + test_demangling_exact "gnu: __cl__Ct4List1Z10VHDLEntityRCQ2t4List1Z10VHDLEntity3Pix" \ + "List::operator()(List::Pix const &) const" + + test_demangling_exact "gnu: __ne__FPvRCQ2t4List1Z10VHDLEntity3Pix" \ + "operator!=(void *, List::Pix const &)" + + test_demangling_exact "gnu: __ne__FPvRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \ + "operator!=(void *, PixX > const &)" + + test_demangling_exact "gnu: __t4List1Z10VHDLEntityRCt4List1Z10VHDLEntity" \ + "List::List(List const &)" + + test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \ + "PixX >::PixX(void)" + + test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityP14VHDLLibraryRepGQ2t4List1Z10VHDLEntity3Pix" \ + "PixX >::PixX(VHDLLibraryRep *, List::Pix)" + + test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \ + "PixX >::PixX(PixX > const &)" + + test_demangling_exact "gnu: nextE__C11VHDLLibraryRt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \ + "VHDLLibrary::nextE(PixX > &) const" + + test_demangling_exact "gnu: next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix" \ + "List::next(List::Pix &) const" + + test_demangling_exact "gnu: _GLOBAL_\$D\$set" "global destructors keyed to set" + + test_demangling_exact "gnu: _GLOBAL_\$I\$set" "global constructors keyed to set" + + test_demangling_exact "gnu: __as__t5ListS1ZUiRCt5ListS1ZUi" \ + "ListS::operator=(ListS const &)" + + test_demangling_exact "gnu: __cl__Ct5ListS1ZUiRCQ2t5ListS1ZUi3Vix" \ + "ListS::operator()(ListS::Vix const &) const" + + test_demangling_exact "gnu: __cl__Ct5SetLS1ZUiRCQ2t5SetLS1ZUi3Vix" \ + "SetLS::operator()(SetLS::Vix const &) const" + + test_demangling_exact "gnu: __t10ListS_link1ZUiRCUiPT0" \ + "ListS_link::ListS_link(unsigned int const &, ListS_link *)" + + test_demangling_exact "gnu: __t10ListS_link1ZUiRCt10ListS_link1ZUi" \ + "ListS_link::ListS_link(ListS_link const &)" + + test_demangling_exact "gnu: __t5ListS1ZUiRCt5ListS1ZUi" \ + "ListS::ListS(ListS const &)" + + test_demangling_exact "gnu: next__Ct5ListS1ZUiRQ2t5ListS1ZUi3Vix" \ + "ListS::next(ListS::Vix &) const" + + test_demangling_exact "gnu: __ne__FPvRCQ2t5SetLS1ZUi3Vix" \ + "operator!=(void *, SetLS::Vix const &)" + test_demangling_exact "gnu: __t8ListElem1Z5LabelRt4List1Z5Label" \ + "ListElem = \{a = 1, aa = 2\}, = \{b = 3, bb = 4\}, = \{c = 5, cc = 6\}, d = 7, dd = 8\}\r\n$gdb_prompt $" { + pass "print value of d_instance" + } + -re ".\[0-9\]* = \{ = \{a = 1, aa = 2\}, = \{b = 3, bb = 4\}, = \{c = 5, cc = 6\}, d = 7, dd = 8\}\r\n$gdb_prompt $" { + pass "print value of d_instance" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance" } + timeout { fail "(timeout) print value of d_instance" } + } + + if {$gcc_compiled} then { + send_gdb "ptype d_instance\n" + gdb_expect { + -re "type = class D : private A, public B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t ]+D & operator=\\(D const ?&\\);\[\r\n\t ]+D\\((D const|const D) ?&\\);\[\r\n\t \]+D\\((void|)\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } + -re "type = class D : private A, public B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t ]+D & operator=\\(D const ?&\\);\[\r\n\t ]+D\\((D const|const D) ?&\\);\[\r\n\t \]+D\\((void|)\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } + -re "type = class D : private A, public B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } + -re ".*$gdb_prompt $" { fail "ptype d_instance" } + timeout { fail "(timeout) ptype d_instance" } + } + } else { + send_gdb "ptype d_instance\n" + gdb_expect { + -re "type = class D : private A, public B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } + -re ".*$gdb_prompt $" { fail "ptype d_instance" } + timeout { fail "(timeout) ptype d_instance" } + } + } + + +send_gdb "print e_instance\n" +gdb_expect { + -re ".\[0-9\]* = \{ = \{a = 1, aa = 2\}, = \{b = 3, bb = 4\}, = \{c = 5, cc = 6\}, e = 9, ee = 10\}\r\n$gdb_prompt $" { + pass "print value of e_instance" + } + -re ".\[0-9\]* = \{ = \{a = 1, aa = 2\}, = \{b = 3, bb = 4\}, = \{c = 5, cc = 6\}, e = 9, ee = 10\}\r\n$gdb_prompt $" { + pass "print value of e_instance" + } + -re ".*$gdb_prompt $" { fail "print value of e_instance" } + timeout { fail "(timeout) print value of e_instance" } + } + + if {$gcc_compiled} { + send_gdb "ptype e_instance\n" + gdb_expect { + -re "type = class E : public A, private B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t ]+E & operator=\\(E const ?&\\);\[\r\n\t ]+E\\((E const|const E) ?&\\);\[\r\n\t \]+E\\((void|)\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" } + -re "type = class E : public A, private B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\((void|)\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" } + -re ".*$gdb_prompt $" { fail "ptype e_instance" } + timeout { fail "(timeout) ptype e_instance" } + } + } else { + send_gdb "ptype e_instance\n" + gdb_expect { + -re "type = class E : public A, private B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\((void|)\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" } + -re ".*$gdb_prompt $" { fail "ptype e_instance" } + timeout { fail "(timeout) ptype e_instance" } + } + } + + +send_gdb "print f_instance\n" +gdb_expect { + -re ".\[0-9\]* = \{ = \{a = 1, aa = 2\}, = \{b = 3, bb = 4\}, = \{c = 5, cc = 6\}, f = 11, ff = 12\}\r\n$gdb_prompt $" { + pass "print value of f_instance" + } + -re ".\[0-9\]* = \{ = \{a = 1, aa = 2\}, = \{b = 3, bb = 4\}, = \{c = 5, cc = 6\}, f = 11, ff = 12\}\r\n$gdb_prompt $" { + pass "print value of f_instance" + } + -re ".*$gdb_prompt $" { fail "print value of f_instance" } + timeout { fail "(timeout) print value of f_instance" } + } + +send_gdb "ptype f_instance\n" +gdb_expect { + -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t ]+F & operator=\\(F const ?&\\);\[\r\n\t ]+F\\((F const|const F) ?&\\);\[\r\n\t \]+F\\((void|)\\);\r\n\[\t \]*int ffoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" } + -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t \]+F\\((void|)\\);\r\n\[\t \]*int ffoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" } + -re ".*$gdb_prompt $" { fail "ptype f_instance" } + timeout { fail "(timeout) ptype f_instance" } +} + + + +send_gdb "print d_instance.a\n" +gdb_expect { + -re ".\[0-9\]* = 1.*$gdb_prompt $" { + pass "print value of d_instance.a" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.a" } + timeout { fail "(timeout) print value of d_instance.a" } + } + +send_gdb "print d_instance.aa\n" +gdb_expect { + -re ".\[0-9\]* = 2.*$gdb_prompt $" { + pass "print value of d_instance.aa" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.aa" } + timeout { fail "(timeout) print value of d_instance.aa" } + } + +send_gdb "print d_instance.b\n" +gdb_expect { + -re ".\[0-9\]* = 3.*$gdb_prompt $" { + pass "print value of d_instance.b" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.b" } + timeout { fail "(timeout) print value of d_instance.b" } + } + +send_gdb "print d_instance.bb\n" +gdb_expect { + -re ".\[0-9\]* = 4.*$gdb_prompt $" { + pass "print value of d_instance.bb" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.bb" } + timeout { fail "(timeout) print value of d_instance.bb" } + } + +send_gdb "print d_instance.c\n" +gdb_expect { + -re ".\[0-9\]* = 5.*$gdb_prompt $" { + pass "print value of d_instance.c" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.c" } + timeout { fail "(timeout) print value of d_instance.c" } + } + +send_gdb "print d_instance.cc\n" +gdb_expect { + -re ".\[0-9\]* = 6.*$gdb_prompt $" { + pass "print value of d_instance.cc" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.cc" } + timeout { fail "(timeout) print value of d_instance.cc" } + } + +send_gdb "print d_instance.d\n" +gdb_expect { + -re ".\[0-9\]* = 7.*$gdb_prompt $" { + pass "print value of d_instance.d" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.d" } + timeout { fail "(timeout) print value of d_instance.d" } + } + +send_gdb "print d_instance.dd\n" +gdb_expect { + -re ".\[0-9\]* = 8.*$gdb_prompt $" { + pass "print value of d_instance.dd" + } + -re ".*$gdb_prompt $" { fail "print value of d_instance.dd" } + timeout { fail "(timeout) print value of d_instance.dd" } + } + +send_gdb "print g_instance.a\n" +gdb_expect { + -re "warning.*$gdb_prompt $" { + # The compiler doesn't think this is ambiguous. + fail "print value of g_instance.a" + } + -re ".\[0-9\]* = 15.*$gdb_prompt $" { + pass "print value of g_instance.a" + } + -re ".*$gdb_prompt $" { fail "print value of g_instance.a" } + timeout { fail "(timeout) print value of g_instance.a" } + } + +send_gdb "print g_instance.b\n" +gdb_expect { + -re "warning.*$gdb_prompt $" { + # The compiler doesn't think this is ambiguous. + fail "print value of g_instance.b" + } + -re ".\[0-9\]* = 16.*$gdb_prompt $" { + pass "print value of g_instance.b" + } + -re ".*$gdb_prompt $" { fail "print value of g_instance.b" } + timeout { fail "(timeout) print value of g_instance.b" } + } + +send_gdb "print g_instance.c\n" +gdb_expect { + -re "warning.*$gdb_prompt $" { + # The compiler doesn't think this is ambiguous. + fail "print value of g_instance.c" + } + -re ".\[0-9\]* = 17.*$gdb_prompt $" { + pass "print value of g_instance.c" + } + -re ".*$gdb_prompt $" { fail "print value of g_instance.c" } + timeout { fail "(timeout) print value of g_instance.c" } + } + +send_gdb "print g_instance.afoo()\n" +gdb_expect { + -re ".\[0-9\]* = 1.*$gdb_prompt $" { + pass "print value of g_instance.afoo()" + } + -re ".*$gdb_prompt $" { fail "print value of g_instance.afoo()" } + timeout { fail "(timeout) print value of g_instance.afoo()" } + } + + +# If GDB fails to restore the selected frame properly after the +# inferior function call above (see GDB PR 1155 for an explanation of +# why this might happen), all the subsequent tests will fail. We +# should detect report that failure, but let the marker call finish so +# that the rest of the tests can run undisturbed. +gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" { + -re "#0 marker1.*$gdb_prompt $" { + setup_kfail "gdb/1155" s390-*-linux-gnu + fail "re-selected 'main' frame after inferior call" + gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.*" \ + "finish call to marker1" + } + -re "#1 ($hex in )?main.*$gdb_prompt $" { + pass "re-selected 'main' frame after inferior call" + } +} + +send_gdb "print g_instance.bfoo()\n" +gdb_expect { + -re ".\[0-9\]* = 2.*$gdb_prompt $" { + pass "print value of g_instance.bfoo()" + } + -re ".*$gdb_prompt $" { fail "print value of g_instance.bfoo()" } + timeout { fail "(timeout) print value of g_instance.bfoo()" } + } + +send_gdb "print g_instance.cfoo()\n" +gdb_expect { + -re ".\[0-9\]* = 3.*$gdb_prompt $" { + pass "print value of g_instance.cfoo()" + } + -re ".*$gdb_prompt $" { fail "print value of g_instance.cfoo()" } + timeout { fail "(timeout) print value of g_instance.cfoo()" } + } diff --git a/gdb/testsuite/gdb.c++/hang.H b/gdb/testsuite/gdb.c++/hang.H new file mode 100644 index 0000000..26fec87 --- /dev/null +++ b/gdb/testsuite/gdb.c++/hang.H @@ -0,0 +1,12 @@ +struct A +{ + struct B *b_ptr_in_a; +}; + +struct C +{ + struct B + { + int member_of_B_in_C; + }; +}; diff --git a/gdb/testsuite/gdb.c++/hang.exp b/gdb/testsuite/gdb.c++/hang.exp new file mode 100644 index 0000000..4c117a1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/hang.exp @@ -0,0 +1,128 @@ +# Copyright (C) 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile hang +set binfile ${objdir}/${subdir}/${testfile} + +foreach file {hang1 hang2 hang3} { + if {[gdb_compile "${srcdir}/${subdir}/${file}.C" "${file}.o" object {c++ debug}] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + } +} + +if {[gdb_compile "hang1.o hang2.o hang3.o" ${binfile} executable {c++ debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# As of May 1, 2002, GDB hangs trying to read the debug info for the +# `hang2.o' compilation unit from the executable `hang', when compiled +# by g++ 2.96 with STABS debugging info. Here's what's going on, as +# best as I can tell. +# +# The definition of `struct A' in `hang.H' refers to `struct B' as an +# incomplete type. The stabs declare type number (1,3) to be a cross- +# reference type, `xsB:'. +# +# The definition of `struct C' contains a nested definition for +# `struct B' --- or more properly, `struct C::B'. However, the stabs +# fail to qualify the structure tag: it just looks like a definition +# for `struct B'. I think this is a compiler bug, but perhaps GCC +# doesn't emit qualified names for a reason. +# +# `hang.H' gets #included by both `hang1.C' and `hang2.C'. So the +# stabs for `struct A', the incomplete `struct B', and `struct C' +# appear in both hang1.o's and hang2.o's stabs. +# +# When those two files are linked together, since hang2.o appears +# later in the command line, its #inclusion of `hang.H' gets replaced +# with an N_EXCL stab, referring back to hang1.o's stabs for the +# header file. +# +# When GDB builds psymtabs for the executable hang, it notes that +# hang2.o's stabs contain an N_EXCL referring to a header that appears +# in full in hang1.o's stabs. So hang2.o's psymtab lists a dependency +# on hang1.o's psymtab. +# +# When the user types the command `print var_in_b', GDB scans the +# psymtabs for a symbol by that name, and decides to read full symbols +# for `hang2.o'. +# +# Since `hang2.o''s psymtab lists `hang1.o' as a dependency, GDB first +# reads `hang1.o''s symbols. When GDB sees `(1,3)=xsB:', it creates a +# type object for `struct B', sets its TYPE_FLAG_STUB flag, and +# records it as type number `(1,3)'. +# +# When GDB finds the definition of `struct C::B', since the stabs +# don't indicate that the type is nested within C, it treats it as +# a definition of `struct B'. +# +# When GDB is finished reading `hang1.o''s symbols, it calls +# `cleanup_undefined_types'. This function mistakes the definition of +# `struct C::B' for a definition for `struct B', and overwrites the +# incomplete type object for the real `struct B', using `memcpy'. Now +# stabs type number `(1,3)' refers to this (incorrect) complete type. +# Furthermore, the `memcpy' simply copies the original's `cv_type' +# field to the target, giving the target a corrupt `cv_type' ring: the +# chain does not point back to the target type. +# +# Having satisfied `hang2.o''s psymtab's dependencies, GDB begins to +# read `hang2.o''s symbols. These contain the true definition for +# `struct B', which refers to type number `(1,3)' as the type it's +# defining. GDB looks up type `(1,3)', and finds the (incorrect) +# complete type established by the call to `cleanup_undefined_types' +# above. However, it doesn't notice that the type is already defined, +# and passes it to `read_struct_type', which then writes the new +# definition's size, field list, etc. into the type object which +# already has those fields initialized. Adding insult to injury, +# `read_struct_type' then calls `finish_cv_type'; since the `memcpy' +# in `cleanup_undefined_types' corrupted the target type's `cv_type' +# ring, `finish_cv_type' enters an infinite loop. + +# This checks that GDB recognizes when a structure is about to be +# overwritten, and refuses, with a complaint. +gdb_test "print var_in_b" " = 1729" "doesn't overwrite struct type" + +# This checks that cleanup_undefined_types doesn't create corrupt +# cv_type chains. Note that var_in_hang3 does need to be declared in +# a separate compilation unit, whose psymtab depends on hang1.o's +# psymtab. Otherwise, GDB won't call cleanup_undefined_types (as it +# finishes hang1.o's symbols) before it calls make_cv_type (while +# reading hang3.o's symbols). +# +# The bug only happens when you compile with -gstabs+; Otherwise, GCC +# won't include the `const' qualifier on `const_B_ptr' in `hang3.o''s +# STABS, so GDB won't try to create a const variant of the smashed +# struct type, and get caught by the corrupted cv_type chain. +gdb_test "print var_in_hang3" " = 42" "doesn't corrupt cv_type chain" diff --git a/gdb/testsuite/gdb.c++/hang1.C b/gdb/testsuite/gdb.c++/hang1.C new file mode 100644 index 0000000..4b04d77 --- /dev/null +++ b/gdb/testsuite/gdb.c++/hang1.C @@ -0,0 +1,3 @@ +#include "hang.H" + +int main (int argc, char **argv) { return 0; } diff --git a/gdb/testsuite/gdb.c++/hang2.C b/gdb/testsuite/gdb.c++/hang2.C new file mode 100644 index 0000000..59732f8 --- /dev/null +++ b/gdb/testsuite/gdb.c++/hang2.C @@ -0,0 +1,8 @@ +#include "hang.H" + +struct B +{ + int member_of_B; +}; + +int var_in_b = 1729; diff --git a/gdb/testsuite/gdb.c++/hang3.C b/gdb/testsuite/gdb.c++/hang3.C new file mode 100644 index 0000000..92c82fa --- /dev/null +++ b/gdb/testsuite/gdb.c++/hang3.C @@ -0,0 +1,4 @@ +#include "hang.H" + +const struct B *const_B_ptr; +int var_in_hang3 = 42; diff --git a/gdb/testsuite/gdb.c++/inherit.exp b/gdb/testsuite/gdb.c++/inherit.exp new file mode 100644 index 0000000..86c1f83 --- /dev/null +++ b/gdb/testsuite/gdb.c++/inherit.exp @@ -0,0 +1,996 @@ +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" + +# The format of a g++ virtual base pointer. +set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?" + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +# Note - create separate "inherit" executable from misc.cc + +set testfile "inherit" +set srcfile misc.cc +set binfile ${objdir}/${subdir}/${testfile} + + +# Create and source the file that provides information about the compiler +# used to compile the test case. + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# +# Single inheritance, print individual members. +# + +proc test_print_si_members {} { + # Print all members of g_A using fully qualified form. + + gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a" + + gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x" + + # Print members of g_A using nonambiguous compact form. + + gdb_test "print g_A.a" ".* = 1" "print g_A.a" + + gdb_test "print g_A.x" ".* = 2" "print g_A.x" + + # Print all members of g_B using fully qualified form. + + gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a" + + gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x" + + gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b" + + gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x" + + # Print members of g_B using nonambiguous compact form. + + gdb_test "print g_B.a" ".* = 3" "print g_B.a" + + gdb_test "print g_B.b" ".* = 5" "print g_B.b" + + gdb_test "print g_B.x" ".* = 6" "print g_B.x" + + # Print all members of g_C using fully qualified form. + + gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a" + + gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x" + + gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c" + + gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x" + + # Print members of g_C using nonambiguous compact form. + + gdb_test "print g_C.a" ".* = 7" "print g_C.a" + + gdb_test "print g_C.c" ".* = 9" "print g_C.c" + + gdb_test "print g_C.x" ".* = 10" "print g_C.x" +} + +# +# Single inheritance, print type definitions. +# + +proc test_ptype_si {} { + global gdb_prompt + global ws + global nl + global hp_aCC_compiler + + # Print class A as a type. + + send_gdb "ptype A\n" + gdb_expect { + -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" { + pass "ptype A (FIXME)" + } + -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { + setup_xfail "*-*-*" + fail "ptype A (FIXME)" + } + -re ".*$gdb_prompt $" { fail "ptype A" } + timeout { fail "ptype A (timeout)" ; return } + } + + # Print class A as an explicit class. + + send_gdb "ptype class A\n" + gdb_expect { + -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" { + pass "ptype class A (FIXME)" + } + -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} + fail "ptype class A (FIXME)" + } + -re ".*$gdb_prompt $" { fail "ptype class A" } + timeout { fail "ptype class A (timeout)" ; return } + } + + # Print type of an object of type A. + + send_gdb "ptype g_A\n" + gdb_expect { + -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" { + pass "ptype g_A (FIXME)" + } + -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} + fail "ptype g_A (FIXME)" + } + -re ".*$gdb_prompt $" { fail "ptype g_A" } + timeout { fail "ptype g_A (timeout)" ; return } + } + + # Print class B as a type. + + gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B" + + # Print class B as an explicit class. + + gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B" + + # Print type of an object of type B. + + gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B" + + # Print class C as a type. + + gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C" + + # Print class C as an explicit class. + + gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C" + + # Print type of an object of type g_C. + + gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C" + + # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of + # cygnus-2.3.3-930417. PR 2819. + send_gdb "ptype tagless_struct\n" + gdb_expect { + -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype tagless struct" + } + -re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" { + pass "ptype tagless struct" + } + -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" { + pass "ptype tagless struct (obsolete gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype tagless struct" + } + timeout { + fail "ptype tagless struct (timeout)" + } + } + + send_gdb "ptype v_tagless\n" + gdb_expect { + -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype variable of type tagless struct" + } + -re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" { + pass "ptype tagless struct" + } + -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" { + pass "ptype variable of type tagless struct (obsolete gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype variable of type tagless struct" + } + timeout { + fail "ptype variable of type tagless struct (timeout)" + } + } +} + +# +# Single inheritance, print complete classes. +# + +proc test_print_si_classes {} { + # Print all members of g_A. + + gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A" + + # Print all members of g_B. + + gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B" + + # Print all members of g_C. + + gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C" +} + +# +# Single inheritance, print anonymous unions. +# GDB versions prior to 4.14 entered an infinite loop when printing +# the type of a class containing an anonymous union, and they were also +# incapable of printing the member of an anonymous union. +# We test the printing of the member first, and perform the other tests +# only if the test succeeds, to avoid the infinite loop. +# + +proc test_print_anon_union {} { + global gdb_prompt + global ws + global nl + + gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member" + send_gdb "print g_anon_union\n" + gdb_expect { + -re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" { + pass "print variable of type anonymous union" + } + -re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" { + pass "print variable of type anonymous union (obsolete gcc or gdb)" + } + -re ".*$nl$gdb_prompt $" { + fail "print variable of type anonymous union" + } + timeout { + fail "print variableof type anonymous union (timeout)" + } + } + send_gdb "ptype g_anon_union\n" + gdb_expect { + -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "print type of anonymous union" + } + -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}int a;${ws}long int b;${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "print type of anonymous union" + } + -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}int a;${ws}long int b;${ws}\};${ws}\}$nl$gdb_prompt $" { + pass "print type of anonymous union" + } + -re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}$nl$gdb_prompt $" { + pass "print type of anonymous union (obsolete gcc or gdb)" + } + -re ".*$nl$gdb_prompt $" { + fail "print type of anonymous union" + } + timeout { + fail "print type of anonymous union (timeout)" + } + } +} + +# +# Multiple inheritance, print individual members. +# + +proc test_print_mi_members {} { + global gdb_prompt + global nl + global hp_aCC_compiler + + # Print all members of g_A. + + gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a" + + gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x" + + # Print all members of g_B. + + gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a" + + gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x" + + gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b" + + gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x" + + # Print all members of g_C. + + gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a" + + gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x" + + gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c" + + gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x" + + # Print all members of g_D. + + # The following is ambiguous, and gdb should detect this. + # For now, accept gdb's behavior as an expected failure if it + # simply prints either member correctly. + + send_gdb "print g_D.A::a\n" + gdb_expect { + -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" { + pass "print g_D.A::a" + } + -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" { + pass "print g_D.A::a (using B)" + } + -re ".* = 15$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::a" + } + -re ".* = 11$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::a" + } + -re ".*$gdb_prompt $" { fail "print g_D.A::a" } + timeout { fail "print g_D.A::a (timeout)" ; return } + } + + # The following is ambiguous, and gdb should detect this. + # For now, accept gdb's behavior as an expected failure if it + # simply prints either member correctly. + + send_gdb "print g_D.A::x\n" + gdb_expect { + -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 16$nl$gdb_prompt $" { + pass "print g_D.A::x" + } + -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 12$nl$gdb_prompt $" { + pass "print g_D.A::x (using B)" + } + -re ".* = 16$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::x" + } + -re ".* = 12$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::x" + } + -re ".*$gdb_prompt $" { fail "print g_D.A::x" } + timeout { fail "print g_D.A::x (timeout)" ; return } + } + + gdb_test "print g_D.B::b" ".* = 13" "print g_D.B::b" + + gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x" + + gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c" + + gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x" + + gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d" + + gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x" + + # Print all members of g_E. + + # The following is ambiguous, and gdb should detect this. + # For now, accept gdb's behavior as an expected failure if it + # simply prints either member correctly. + + send_gdb "print g_E.A::a\n" + gdb_expect { + -re ".* = 21$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::a" + } + -re ".* = 25$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::a" + } + -re ".*$gdb_prompt $" { fail "print g_E.A::a" } + timeout { fail "print g_E.A::a (timeout)" ; return } + } + + # The following is ambiguous, and gdb should detect this. + # For now, accept gdb's behavior as an expected failure if it + # simply prints either member correctly. + + send_gdb "print g_E.A::x\n" + gdb_expect { + -re "warning: A ambiguous; using E::D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 26$nl$gdb_prompt $" { + pass "print g_E.A::x" + } + -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 22$nl$gdb_prompt $" { + pass "print g_E.A::x (using B)" + } + -re ".* = 26$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::x" + } + -re ".* = 22$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::x" + } + -re ".*$gdb_prompt $" { fail "print g_E.A::x" } + timeout { fail "print g_E.A::x (timeout)" ; return } + } + + gdb_test "print g_E.B::b" ".* = 23" "print g_E.B::b" + + gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x" + + gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c" + + gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x" + + gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d" + + gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x" + + gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e" + + gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x" +} + +# +# Multiple inheritance, print type definitions. +# + +proc test_ptype_mi {} { + global nl + + gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D" + + gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D" + + gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D" + + gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E" + + gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E" + + gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E" +} + +# +# Multiple inheritance, print complete classes. +# + +proc test_print_mi_classes {} { + # Print all members of g_D. + + gdb_test "print g_D" ".* = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D" + + # Print all members of g_E. + + gdb_test "print g_E" ".* = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E" +} + +# +# Single virtual inheritance, print individual members. +# + +proc test_print_svi_members {} { + global gdb_prompt + global decimal + global nl + + # Print all members of g_vA. + + gdb_test "print g_vA.vA::va" ".* = 1" "print g_vA.vA::va" + + gdb_test "print g_vA.vA::vx" ".* = 2" "print g_vA.vA::vx" + + # Print members of g_vA using compact form. + + gdb_test "print g_vA.va" ".* = 1" "print g_vA.va" + + gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx" + + # Print all members of g_vB. + + send_gdb "print g_vB.vA::va\n" + gdb_expect { + -re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" } + -re ".*virtual baseclass botch.*$gdb_prompt $" { + # Does not happen with gcc cygnus-2.4.5-930828 + fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)" + # Many of the rest of these tests have the same problem. + return 0 + } + -re ".*$gdb_prompt $" { fail "print g_vB.vA::va" } + timeout { fail "print g_vB.vA::va (timeout)" ; return } + } + + gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx" + + gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb" + + gdb_test "print g_vB.vB::vx" ".* = 6" "print g_vB.vB::vx" + + # Print members of g_vB using compact form. + + gdb_test "print g_vB.va" ".* = 3" "print g_vB.va" + + gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb" + + gdb_test "print g_vB.vx" ".* = 6" "print g_vB.vx" + + # Print all members of g_vC. + + gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va" + + gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx" + + gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc" + + gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx" + + # Print members of g_vC using compact form. + + gdb_test "print g_vC.va" ".* = 7" "print g_vC.va" + + gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc" + + gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx" +} + +# +# Single virtual inheritance, print type definitions. +# + +proc test_ptype_vi {} { + global gdb_prompt + global ws + global nl + global vbptr + + # This class does not use any C++-specific features, so it's fine for + # it to print as "struct". + send_gdb "ptype vA\n" + gdb_expect { + -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vA" + } + -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" { + pass "ptype vA" + } + -re ".*$gdb_prompt $" { fail "ptype vA" } + timeout { fail "ptype vA (timeout)" ; return } + } + + # This class does not use any C++-specific features, so it's fine for + # it to print as "struct". + send_gdb "ptype class vA\n" + gdb_expect { + -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vA" + } + -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" { + pass "ptype class vA" + } + -re ".*$gdb_prompt $" { fail "ptype class vA" } + timeout { fail "ptype class vA (timeout)" ; return } + } + + # This class does not use any C++-specific features, so it's fine for + # it to print as "struct". + send_gdb "ptype g_vA\n" + gdb_expect { + -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vA" + } + -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" { + pass "ptype g_vA" + } + -re ".*$gdb_prompt $" { fail "ptype g_vA" } + timeout { fail "ptype g_vA (timeout)" ; return } + } + + send_gdb "ptype vB\n" + gdb_expect { + -re "ptype vB${nl}type = class vB : public virtual vA \{$nl private:${ws}vA \\*${vbptr}vA;$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vB" + } + -re "ptype vB${nl}type = class vB : public virtual vA \{$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vB (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype vB" } + timeout { fail "ptype vB (timeout)" } + } + + send_gdb "ptype class vB\n" + gdb_expect { + -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vB" + } + -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vB (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype class vB" } + timeout { fail "ptype class vB (timeout)" } + } + + send_gdb "ptype g_vB\n" + gdb_expect { + -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vB" + } + -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vB (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype g_vB" } + timeout { fail "ptype g_vB (timeout)" } + } + + send_gdb "ptype vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vC" + } + -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vC (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype vC" } + timeout { fail "ptype vC (timeout)" } + } + + send_gdb "ptype class vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vC" + } + -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vC (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype class vC" } + timeout { fail "ptype class vC (timeout)" } + } + + send_gdb "ptype g_vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vC" + } + -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vC (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype g_vC" } + timeout { fail "ptype g_vC (timeout)" } + } +} + +# +# Single virtual inheritance, print complete classes. +# + +proc test_print_svi_classes {} { + global gdb_prompt + global hex + global decimal + global nl + global vbptr + + # Print all members of g_vA. + + gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA" + + # Print all members of g_vB. + + send_gdb "print g_vB\n" + gdb_expect { + -re ".* = \{\ = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vB (aCC)" + } + -re ".* = \{\ = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vB (aCC)" + } + -re ".* = \{\ = \{va = 3, vx = 4\}, ${vbptr}vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { + pass "print g_vB" + } + -re ".* = \{\ = \{va = 3, vx = 4\}, _vptr.vB = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { + pass "print g_vB (FIXME v3 vtbl ptr)" + } + -re ".*invalid address 0x0.*$gdb_prompt $" { + # Does not happen with gcc cygnus-2.4.5-930828 + fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)" + # Many of the rest of these tests have the same problem. + return 0 + } + -re ".*$gdb_prompt $" { fail "print g_vB" } + timeout { fail "print g_vB (timeout)" ; return } + } + + # Print all members of g_vC. + + send_gdb "print g_vC\n" + gdb_expect { + -re ".* = \{\ = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vC (aCC)" + } + -re ".* = \{\ = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vC (aCC)" + } + -re ".* = \{\ = \{va = 7, vx = 8\}, ${vbptr}vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + pass "print g_vC" + } + -re ".* = \{\ = \{va = 7, vx = 8\}, _vptr.vC = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + pass "print g_vC (FIXME v3 vtbl ptr)" + } + -re ".*$gdb_prompt $" { fail "print g_vC" } + timeout { fail "print g_vC (timeout)" } + } +} + +# +# Multiple virtual inheritance, print individual members. +# + +proc test_print_mvi_members {} { + global gdb_prompt + global decimal + global nl + + # Print all members of g_vD. + + send_gdb "print g_vD.vA::va\n" + gdb_expect { + -re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" } + -re ".*virtual baseclass botch.*$gdb_prompt $" { + # Does not happen with gcc cygnus-2.4.5-930828 + fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)" + # Many of the rest of these tests have the same problem. + return 0 + } + -re ".*$gdb_prompt $" { fail "print g_vD.vA::va" } + timeout { fail "print g_vD.vA::va (timeout)" ; return } + } + + gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx" + + gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb" + + gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx" + + gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc" + + gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx" + + gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd" + + gdb_test "print g_vD.vD::vx" ".* = 26" "print g_vD.vD::vx" + + # Print all members of g_vE. + + gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va" + + gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx" + + gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb" + + gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx" + + gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc" + + gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx" + + gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd" + + gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx" + + gdb_test "print g_vE.vE::ve" ".* = 27" "print g_vE.vE::ve" + + gdb_test "print g_vE.vE::vx" ".* = 28" "print g_vE.vE::vx" +} + +# +# Multiple virtual inheritance, print type definitions. +# + +proc test_ptype_mvi {} { + global gdb_prompt + global ws + global nl + global vbptr + + send_gdb "ptype vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype vD" + } + -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" { + pass "ptype vD" + } + -re ".*$gdb_prompt $" { fail "ptype vD" } + timeout { fail "(timeout) ptype vD" } + } + + send_gdb "ptype class vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype class vD" + } + -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" { + pass "ptype class vD" + } + -re ".*$gdb_prompt $" { fail "ptype class vD" } + timeout { fail "(timeout) ptype class vD" } + } + + send_gdb "ptype g_vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype g_vD" + } + -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype g_vD" + } + -re ".*$gdb_prompt $" { fail "ptype g_vD" } + timeout { fail "(timeout) ptype g_vD" } + } + + send_gdb "ptype vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype vE" + } + -re ".*class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype vE" + } + -re ".*$gdb_prompt $" { fail "ptype vE" } + timeout { fail "(timeout) ptype vE" } + } + + send_gdb "ptype class vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype class vE" + } + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype class vE" + } + -re ".*$gdb_prompt $" { fail "ptype class vE" } + timeout { fail "(timeout) ptype class vE" } + } + + send_gdb "ptype g_vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype g_vE" + } + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype g_vE" + } + -re ".*$gdb_prompt $" { fail "ptype g_vE" } + timeout { fail "(timeout) ptype g_vE" } + } +} + +# +# Multiple virtual inheritance, print complete classes. +# + +proc test_print_mvi_classes {} { + global gdb_prompt + global hex + global decimal + global nl + global vbptr + + # Print all members of g_vD. + + send_gdb "print g_vD\n" + gdb_expect { + -re ".* = \{\ = \{\ = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \ = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vD (aCC)" + } + -re ".* = \{\ = \{\ = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \ = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vD (aCC)" + } + -re ".* = \{\ = \{\ = \{va = 19, vx = 20\}, ${vbptr}vA = $hex, vb = 21, vx = 22\}, \ = \{${vbptr}vA = $hex, vc = 23, vx = 24\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + pass "print g_vD" + } + -re ".* = \{\ = \{\ = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \ = \{_vptr.vC = $hex, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + pass "print g_vD (FIXME v3 vtbl ptr)" + } + -re ".*invalid address 0x0.*$gdb_prompt $" { + # Does not happen with gcc cygnus-2.4.5-930828 + fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)" + # Many of the rest of these tests have the same problem. + return 0 + } + -re ".*$gdb_prompt $" { fail "print g_vD" } + timeout { fail "print g_vD (timeout)" ; return } + } + + # Print all members of g_vE. + + send_gdb "print g_vE\n" + gdb_expect { + -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \ = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vE (aCC)" + } + -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \ = \{vc = 0, vx = 0, __vfp = $hex\}, vd = 0, vx = 0, __vfp = $hex\}, ve = 27, vx = 28, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vE (aCC)" + } + -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \ = \{${vbptr}vA = $hex, vc = 0, vx = 0\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 0, vx = 0\}, ${vbptr}vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + pass "print g_vE" + } + -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, _vptr.vB = $hex *(\)?, vb = 0, vx = 0\}, \ = \{_vptr.vC = $hex *(\)?, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + pass "print g_vE (FIXME v3 vtbl ptr)" + } + -re ".*$gdb_prompt $" { fail "print g_vE" } + timeout { fail "print g_vE (timeout)" } + } +} + +proc do_tests {} { + global prms_id + global bug_id + global subdir + global objdir + global srcdir + global binfile + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language c++" "" + gdb_test "set width 0" "" + + # Get the debug format for the compiled test case. + + if { ![ runto_main] } { + gdb_suppress_tests; + } + + test_ptype_si + test_ptype_mi + test_ptype_vi + test_ptype_mvi + + gdb_stop_suppressing_tests; + + if { ![ runto 'inheritance2' ] } { + gdb_suppress_tests; + } + + test_print_si_members + test_print_si_classes + test_print_mi_members + test_print_mi_classes + test_print_anon_union + + gdb_stop_suppressing_tests; + + if { ![ runto 'inheritance4' ] } { + gdb_suppress_tests; + } + + test_print_svi_members + test_print_svi_classes + test_print_mvi_members + test_print_mvi_classes +} + +do_tests diff --git a/gdb/testsuite/gdb.c++/local.cc b/gdb/testsuite/gdb.c++/local.cc new file mode 100644 index 0000000..85fd6e1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/local.cc @@ -0,0 +1,66 @@ +// Tests for local types + +void marker1 (void) +{ +} + +void marker2 (void) +{ +} + +int foobar (int x) +{ + class Local { + public: + int loc1; + char loc_foo (char c) + { + return c + 3; + } + }; + + Local l; + static Local l1; + char c; + + marker1 (); + + l.loc1 = 23; + + c = l.loc_foo('x'); + return c + 2; +} + +int main() +{ + int c; + + c = foobar (31); + + { // inner block + class InnerLocal { + public: + char ilc; + int * ip; + int il_foo (unsigned const char & uccr) + { + return uccr + 333; + } + class NestedInnerLocal { + public: + int nil; + int nil_foo (int i) + { + return i * 27; + } + }; + NestedInnerLocal nest1; + }; + + InnerLocal il; + + il.ilc = 'b'; + il.ip = &c; + marker2(); + } +} diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp new file mode 100644 index 0000000..21ceb7a --- /dev/null +++ b/gdb/testsuite/gdb.c++/local.exp @@ -0,0 +1,228 @@ +# Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# tests for local variables +# Written by Satish Pai 1997-07-08 +# Cleaned by Michael Chastain 2002-04-08 + + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "local" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info $binfile "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +if ![runto 'marker1'] then { + perror "couldn't run to marker1" + continue +} + +gdb_test "up" ".*foobar.*" "up from marker1" + +# Local classes in g++ get names like "main.1::InnerLocal", just like local +# static variables. Some targets use "___" instead of ".". + +# --- +# Pattern 1: +# PASS +# dwarf-2 +# gcc 2.95.3 +# +# Pattern 2: +# FAIL +# This has a duplicate "char loc_foo" line. This is a bug. +# Historically this has been an XFAIL. +# dwarf-2 +# gcc 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# +# Pattern 3: +# PASS +# stabs+ +# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# +# Pattern 4: +# This an old pattern from the hppa aCC version of this file. +# I left it alone. +# +# chastain 2002-04-08 + +set sep "(\[.\]|___)\[0-9\]" + +send_gdb "ptype Local\n" +gdb_expect { + -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" } + -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { + kfail "gdb/483" "ptype Local" + } + -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" } + -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { xpass "ptype Local (old aCC)" } + -re ".*$gdb_prompt $" { fail "ptype Local" } + timeout { fail "(timeout) ptype Local" } +} + +gdb_test "break marker2" +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2.*" \ + "continuing to marker2" + +gdb_test "up" ".*main.*" "up from marker2" + +# Make sure that `Local' isn't in scope here; it's local to foobar. +# setup_kfail "gdb/825" +send_gdb "ptype Local\n" +set eol "\[\t \]*\[\r\n\]+\[\t \]*" +gdb_expect { + -re "No symbol \"Local\" in current context.*${gdb_prompt} $" { + pass "Local out of scope" + } + -re "ptype Local${eol}type = class Local {${eol} public:${eol} int loc1;${eol}.*${eol} char loc_foo\\(char\\);${eol}}${eol}${gdb_prompt} " { + # GCC emits STABS debugging information in a way that doesn't + # properly preserve the scoping of local classes. I think + # we'd need to start using Sun's extensions to stabs to get + # this right. + kfail gdb/825 "Local out of scope" + } + -re ".*${gdb_prompt} $" { + fail "Local out of scope" + } + timeout { + fail "Local out of scope (timeout)" + } +} + + +# DTS CLLbs14316 and CLLbs17058 +# coulter - I added a clause for HP's aCC compiler. We print out the type +# as xx instead of const unsigned char, but we still have an expected failure +# because of two reasons: +# There is a number at the end of InnerLocal4 which should not be there, +# DTS CLLbs14316 +# The line number for the class +# setup_xfail "hppa*-*-*" CLLbs14316 + +# --- +# Pattern 1: +# PASS +# dwarf-2 +# 2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD +# +# Pattern 2: +# PASS +# stabs+ +# 2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD +# +# Pattern 3: +# Old hppa pattern. +# +# Pattern 4: +# Old hppa pattern. +# +# chastain 2002-05-27 + +send_gdb "ptype InnerLocal\n" +gdb_expect { + -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 1)" } + -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 2)" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" } + -re ".*$gdb_prompt $" { fail "ptype InnerLocal" } + timeout { fail "(timeout) ptype InnerLocal" } +} + +#--- +# Pattern 1: +# PASS +# dwarf-2 +# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# +# Pattern 2: +# PASS +# stabs+ +# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# +# chastain 2002-04-08 + +send_gdb "ptype NestedInnerLocal\n" +gdb_expect { + -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype NestedInnerLocal" } + -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*NestedInnerLocal *& *operator *= *\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((void|)\\);\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype NestedInnerLocal" } + -re ".*$gdb_prompt $" { fail "ptype NestedInnerLocal" } + timeout { fail "(timeout) ptype NestedInnerLocal" } +} + +# gdb incorrectly interprets the NestedInnerLocal in +# InnerLocal::NestedInnerLocal as field name instead of a type name; +# See CLLbs14784. + +#--- +# Pattern 3: +# FAIL +# The comment above, about CLLbs14784, is still correct. +# dwarf-2 +# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# stabs+ +# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# +# chastain 2002-04-08 + +send_gdb "ptype InnerLocal::NestedInnerLocal\n" +gdb_expect { + -re "type = class InnerLocal::NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" } + -re "type = class InnerLocal::NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*NestedInnerLocal *& *operator *= *\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((void|)\\);\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" } + -re "There is no field named NestedInnerLocal.*$gdb_prompt $" { + setup_kfail "gdb/482" *-*-* + fail "ptype InnerLocal::NestedInnerLocal" + } + -re "No symbol .*NestedInnerLocal.* in current context.*$gdb_prompt $" { fail "ptype InnerLocal::NestedInnerLocal (bogus symbol lookup)" } + -re ".*$gdb_prompt $" { fail "ptype InnerLocal::NestedInnerLocal" } + timeout { fail "(timeout) ptype InnerLocal::NestedInnerLocal" } +} diff --git a/gdb/testsuite/gdb.c++/m-data.cc b/gdb/testsuite/gdb.c++/m-data.cc new file mode 100644 index 0000000..c97e719 --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-data.cc @@ -0,0 +1,64 @@ +// 2002-05-13 + +enum region { oriental, egyptian, greek, etruscan, roman }; + +// Test one. +class gnu_obj_1 +{ +protected: + typedef region antiquities; + const bool test; + const int key1; + long key2; + + antiquities value; + +public: + gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {} +}; + +// Test two. +template +class gnu_obj_2: public virtual gnu_obj_1 +{ +protected: + antiquities value_derived; + +public: + gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { } +}; + +// Test three. +template +class gnu_obj_3 +{ +protected: + typedef region antiquities; + gnu_obj_2 data; + +public: + gnu_obj_3(antiquities b): data(etruscan) { } +}; + +int shadow = 0; + +class C +{ +public: + C (int x) : shadow (x) {} + void marker () {} +private: + int shadow; +}; + +int main() +{ + gnu_obj_1 test1(egyptian, 4589); + gnu_obj_2 test2(roman); + gnu_obj_3 test3(greek); + + C theC (1); // breakpoint: first-constructs-done + theC.marker (); + + return 0; +} diff --git a/gdb/testsuite/gdb.c++/m-data.exp b/gdb/testsuite/gdb.c++/m-data.exp new file mode 100644 index 0000000..85adb5e --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-data.exp @@ -0,0 +1,119 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for member data +# 2002-05-13 Benjamin Kosnik + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "m-data" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed all the gnu_obj_N's: + +gdb_breakpoint [gdb_get_line_number "first-constructs-done"] +gdb_continue_to_breakpoint "end of first constructors" + +# One. + +# simple object, const bool +gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, const bool" + +# simple object, const int +gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, const int" + +# simple object, long +gdb_test "print test1.key2" "\\$\[0-9\]* = 4589" "simple object, long" + +# simple object, enum +gdb_test "print test1.value" "\\$\[0-9\]* = egyptian" "simple object, enum" + +# Two. + +# derived template object, base const bool +gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base const bool" + +# derived template object, base const int +gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base const int" + +# derived template object, base long +gdb_test "print test2.key2" "\\$\[0-9\]* = 7" "derived template object, base long" + +# derived template object, base enum +gdb_test "print test2.value" "\\$\[0-9\]* = oriental" "derived template object, base enum" + +# derived template object, enum +gdb_test "print test2.value_derived" "\\$\[0-9\]* = roman" "derived template object, derived enum" + +# Three. + +# template object, derived template data member's base const bool +gdb_test "print test3.data.test" "\\$\[0-9\]* = true" "template object, const bool" + +# template object, derived template data member's base const int +gdb_test "print test3.data.key1" "\\$\[0-9\]* = 5" "template object, const int" + +# template object, derived template data member's base long +gdb_test "print test3.data.key2" "\\$\[0-9\]* = 7" "template object, long" + +# template object, derived template data member's base enum +gdb_test "print test3.data.value" "\\$\[0-9\]* = oriental" "template object, base enum" + +# template object, derived template data member's enum +gdb_test "print test3.data.value_derived" "\\$\[0-9]\* = etruscan" "template object, derived enum" + +# Now some tests for shadowing (see PR gdb/804): + +gdb_breakpoint "C::marker" +gdb_continue_to_breakpoint "continue to shadow breakpoint" + +gdb_test "print shadow" "\\$\[0-9]\* = 1" "shadowing member" +gdb_test "print ::shadow" "\\$\[0-9]\* = 0" "shadowed global variable" + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/m-static.cc b/gdb/testsuite/gdb.c++/m-static.cc new file mode 100644 index 0000000..6d08cb0 --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-static.cc @@ -0,0 +1,72 @@ +// 2002-05-13 + +enum region { oriental, egyptian, greek, etruscan, roman }; + +// Test one. +class gnu_obj_1 +{ +protected: + typedef region antiquities; + static const bool test = true; + static const int key1 = 5; + static long key2; + + static antiquities value; + +public: + gnu_obj_1(antiquities a, long l) {} +}; + +const bool gnu_obj_1::test; +const int gnu_obj_1::key1; +long gnu_obj_1::key2 = 77; +gnu_obj_1::antiquities gnu_obj_1::value = oriental; + + +// Test two. +template +class gnu_obj_2: public virtual gnu_obj_1 +{ +public: + static antiquities value_derived; + +public: + gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { } +}; + +template +typename gnu_obj_2::antiquities gnu_obj_2::value_derived = etruscan; + +// Test three. +template +class gnu_obj_3 +{ +public: + typedef region antiquities; + static gnu_obj_2 data; + +public: + gnu_obj_3(antiquities b) { } +}; + +template +gnu_obj_2 gnu_obj_3::data(etruscan); + +// 2002-08-16 +// Test four. +#include "m-static.h" + +// instantiate templates explicitly so their static members will exist +template class gnu_obj_2; +template class gnu_obj_2; +template class gnu_obj_3; + +int main() +{ + gnu_obj_1 test1(egyptian, 4589); + gnu_obj_2 test2(roman); + gnu_obj_3 test3(greek); + gnu_obj_4 test4; + + return 0; // breakpoint: constructs-done +} diff --git a/gdb/testsuite/gdb.c++/m-static.exp b/gdb/testsuite/gdb.c++/m-static.exp new file mode 100644 index 0000000..d291135 --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-static.exp @@ -0,0 +1,128 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for member static data +# 2002-05-13 Benjamin Kosnik +# 2002-08-22 David Carlton + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "m-static" +set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed all the objects: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + + +# One. + +# simple object, static const bool +gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool" + +# simple object, static const int +gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, static const int" + +# simple object, static long +gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long" + +# simple object, static enum +gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum" + +# Two. + +# derived template object, base static const bool +gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool" + +# derived template object, base static const int +gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base static const int" + +# derived template object, base static long +gdb_test "print test2.key2" "\\$\[0-9\]* = 77" "derived template object, base static long" + +# derived template object, base static enum +gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, base static enum" + +# derived template object, static enum +gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum" + +# Three. + +# template object, static derived template data member's base static const bool +gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool" + +# template object, static derived template data member's base static const int +gdb_test "print test3.data.key1" "\\$\[0-9\].* = 5" "template object, static const int" + +# template object, static derived template data member's base static long +gdb_test "print test3.data.key2" "\\$\[0-9\].* = 77" "template object, static long" + +# template object, static derived template data member's base static enum +gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, static enum" + +# template object, static derived template data member's static enum +gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum" + +# 2002-08-16 +# Four. + +# static const int initialized in another file. +gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere" + +# static const int that nobody initializes. From PR gdb/635. +gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere" + +# Perhaps at some point test4 should also include a test for a static +# const int that was initialized in the header file. But I'm not sure +# that GDB's current behavior in such situations is either consistent +# across platforms or optimal, so I'm not including one now. + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/m-static.h b/gdb/testsuite/gdb.c++/m-static.h new file mode 100644 index 0000000..137d3b7 --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-static.h @@ -0,0 +1,11 @@ +// 2002-08-16 + +class gnu_obj_4 +{ + public: + static const int elsewhere; + static const int nowhere; + // At some point, perhaps: + // static const int everywhere = 317; +}; + diff --git a/gdb/testsuite/gdb.c++/m-static1.cc b/gdb/testsuite/gdb.c++/m-static1.cc new file mode 100644 index 0000000..302a5ad --- /dev/null +++ b/gdb/testsuite/gdb.c++/m-static1.cc @@ -0,0 +1,5 @@ +// 2002-08-16 + +#include "m-static.h" + +const int gnu_obj_4::elsewhere = 221; diff --git a/gdb/testsuite/gdb.c++/maint.exp b/gdb/testsuite/gdb.c++/maint.exp new file mode 100644 index 0000000..a0f15f9 --- /dev/null +++ b/gdb/testsuite/gdb.c++/maint.exp @@ -0,0 +1,91 @@ +# Copyright 2003 Free Software Foundation Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + + +# This file tests C++-specific maintenance commands and help on those. + +# Currently, no source file is used. + +if $tracelevel then { + strace $tracelevel + } + +# Test the help messages. + +proc test_help {} { + gdb_test "help maintenance cplus" "C\\+\\+ maintenance commands.\r\n\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous." + + gdb_test "help maint cp" "C\\+\\+ maintenance commands.\r\n\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous." + + gdb_test "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\nList of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- Print the first class/namespace component of NAME\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous." + + gdb_test "help maint cp first_component" "Print the first class/namespace component of NAME." +} + +# This is used when NAME should contain only a single component. Be +# careful to make sure that parentheses get escaped properly. +proc test_single_component {name} { + set matchname [string_to_regexp "$name"] + gdb_test "maint cp first_component $name" "$matchname" +} + +proc test_first_component {} { + test_single_component "foo" + test_single_component "operator<<" + test_single_component "operator>>" + test_single_component "operator ->" + test_single_component "operator()" + test_single_component "operator>" + test_single_component "operator<" + test_single_component "operator ->" + test_single_component "operator ->" + + test_single_component "foo()" + test_single_component "foo(int)" + test_single_component "foo(X::Y)" + test_single_component "foo(X::Y, A::B)" + test_single_component "foo(std::basic_streambuf >)" + test_single_component "operator>(X::Y)" + + # Operator names can show up in weird places. + + test_single_component "int operator<< ()" + test_single_component "T" + + # NOTE: carlton/2003-04-23: I've only seen the first of these + # produced by the demangler, but I'm including two more just to be + # on the safe side. + test_single_component "int foo<&(operator<<(C, C))>()" + test_single_component "int foo<&operator<<(C, C)>()" + test_single_component "int foo()" + + gdb_test "maint cp first_component foo::bar" "foo" + gdb_test "maint cp first_component foo::bar::baz" "foo" + gdb_test "maint cp first_component C::bar" "C" + gdb_test "maint cp first_component C > >::bar" "C > >" +} + +gdb_exit +gdb_start + +test_help +test_first_component + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/member-ptr.cc b/gdb/testsuite/gdb.c++/member-ptr.cc new file mode 100644 index 0000000..4beb926 --- /dev/null +++ b/gdb/testsuite/gdb.c++/member-ptr.cc @@ -0,0 +1,106 @@ +extern "C" { +#include +} + + +class A { +public: + A(); + int foo (int x); + int bar (int y); + virtual int baz (int z); + char c; + int j; + int jj; + static int s; +}; + +class B { +public: + static int s; +}; + +int A::s = 10; +int B::s = 20; + +A::A() +{ + c = 'x'; + j = 5; +} + +int A::foo (int dummy) +{ + j += 3; + return j + dummy; +} + +int A::bar (int dummy) +{ + int r; + j += 13; + r = this->foo(15); + return r + j + 2 * dummy; +} + +int A::baz (int dummy) +{ + int r; + j += 15; + r = this->foo(15); + return r + j + 12 * dummy; +} + +int fum (int dummy) +{ + return 2 + 13 * dummy; +} + +typedef int (A::*PMF)(int); + +typedef int A::*PMI; + +int main () +{ + A a; + A * a_p; + PMF pmf; + + PMF * pmf_p; + PMI pmi; + + a.j = 121; + a.jj = 1331; + + int k; + + a_p = &a; + + pmi = &A::j; + pmf = &A::bar; + pmf_p = &pmf; + + pmi = NULL; + + k = (a.*pmf)(3); + + pmi = &A::jj; + pmf = &A::foo; + pmf_p = &pmf; + + k = (a.*pmf)(4); + + k = (a.**pmf_p)(5); + + k = a.*pmi; + + + k = a.bar(2); + + k += fum (4); + + B b; + + k += b.s; + +} diff --git a/gdb/testsuite/gdb.c++/member-ptr.exp b/gdb/testsuite/gdb.c++/member-ptr.exp new file mode 100644 index 0000000..f21cd15 --- /dev/null +++ b/gdb/testsuite/gdb.c++/member-ptr.exp @@ -0,0 +1,549 @@ +# Copyright 1998, 1999 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu +# Tests for pointer-to-member support +# Written by Satish Pai 1997-08-19 + +# This file is part of the gdb testsuite + + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# + +# Start with a fresh gdb +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +set prms_id 0 +set bug_id 0 + +set testfile "member-ptr" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +# Create and source the file that provides information about the compiler +# used to compile the test case. + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +# Nearly all of these tests fail when compiled with G++, so just give up +# until GDB gets enhanced. -sts 1999-06-22 + +if {$gcc_compiled} { + continue +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "break 83\n" +gdb_expect { + -re "Breakpoint \[0-9\]*.*line 83\\.\r\n$gdb_prompt $" { + pass "set break at 83" + } + -re ".*$gdb_prompt $" { fail "set break at 83" } + timeout { fail "(timeout) set break at 83" } +} + +send_gdb "continue\n" +gdb_expect { + -re "Continuing\\.\r\n\r\nBreakpoint.*at.*member-ptr\\.cc:83\r\n83\[ \t]*pmi = NULL;\r\n$gdb_prompt $" { + pass "continue to 83" + } + -re ".*$gdb_prompt $" { fail "continue to 83" } + timeout { fail "(timeout) continue to 83" } +} + +# ptype on pointer to data member + +send_gdb "ptype pmi\n" +gdb_expect { + -re "type = int \\( A::\\*\\)\r\n$gdb_prompt $" { + pass "ptype pmi" + } + -re ".*$gdb_prompt $" { fail "ptype pmi" } + timeout { fail "(timeout) ptype pmi" } +} + +# print pointer to data member + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::j\r\n$gdb_prompt $" { + pass "print pmi" + } + -re ".*$gdb_prompt $" { fail "print pmi" } + timeout { fail "(timeout) print pmi" } +} + + +# print dereferenced pointer to data member + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a.*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" { + pass "print a.*pmi" + } + -re ".*$gdb_prompt $" { fail "print a.*pmi" } + timeout { fail "(timeout) print a.*pmi" } +} + +# print dereferenced pointer to data member +# this time, dereferenced through a pointer + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a_p->*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" { + pass "print a->*pmi" + } + -re ".*$gdb_prompt $" { fail "print a->*pmi" } + timeout { fail "(timeout) print a->*pmi" } +} + + +# set the pointer to data member + +send_gdb "set var pmi = &A::jj\n" +gdb_expect { + -re "$gdb_prompt $" { + pass "set var (not really a pass)" + } + timeout { fail "(timeout) " } +} + +# Now print the pointer again + +send_gdb "print pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" { + pass "print pmi after setting" + } + -re ".*$gdb_prompt $" { fail "print pmi after setting" } + timeout { fail "(timeout) print pmi after setting" } +} + +# print dereferenced pointer to data member again + +send_gdb "print a.*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" { + pass "print a.*pmi after setting" + } + -re ".*$gdb_prompt $" { fail "print a.*pmi after setting" } + timeout { fail "(timeout) print a.*pmi after setting" } +} + +# set the pointer to data member back to A::j + +send_gdb "set var pmi = &A::j\n" +gdb_expect { + -re "$gdb_prompt $" { + pass "set var back to A::j (not really a pass)" + } + timeout { fail "(timeout) set var pmi" } +} + +# print dereferenced pointer to data member yet again (extra check, why not) + +send_gdb "print a.*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" { + pass "print a.*pmi after resetting" + } + -re ".*$gdb_prompt $" { fail "print a.*pmi after resetting" } + timeout { fail "(timeout) print a.*pmi after resetting" } +} + +# Set the data member pointed to. + +send_gdb "print a.*pmi = 33\n" +gdb_expect { + -re "\\$\[0-9\]* = 33\r\n$gdb_prompt $" { + pass "print command to set" + } + -re ".*$gdb_prompt $" { fail "print command to set" } + timeout { fail "(timeout) print command to set" } +} + +# Now check that the data really was changed +send_gdb "print a.*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 33\r\n$gdb_prompt $" { + pass "print a.*pmi after setting member pointed to" + } + -re ".*$gdb_prompt $" { fail "print a.*pmi after setting member pointed to" } + timeout { fail "(timeout) print a.*pmi after setting member pointed to" } +} + +# Double-check by printing a. +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a\n" +gdb_expect { + -re "\\$\[0-9\]* = \{c = 120 'x', j = 33, jj = 1331, static s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" { + pass "print a after setting member pointed to by pmi" + } + -re ".*$gdb_prompt $" { fail "print a after setting member pointed to by pmi" } + timeout { fail "(timeout) print a after setting member pointed to by pmi" } +} + + +# Set the data member pointed to, using ->* + +send_gdb "print a_p->*pmi = 44\n" +gdb_expect { + -re "\\$\[0-9\]* = 44\r\n$gdb_prompt $" { + pass "print command to set (->)" + } + -re ".*$gdb_prompt $" { fail "print command to set (->)" } + timeout { fail "(timeout) print command to set (->)" } +} + +# Now check that the data really was changed +send_gdb "print a_p->*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 44\r\n$gdb_prompt $" { + pass "print a_p->*pmi after setting member pointed to" + } + -re ".*$gdb_prompt $" { fail "print a_p->*pmi after setting member pointed to" } + timeout { fail "(timeout) print a_p->*pmi after setting member pointed to" } +} + +# Double-check by printing a. +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a\n" +gdb_expect { + -re "\\$\[0-9\]* = \{c = 120 'x', j = 44, jj = 1331, static s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" { + pass "print a after setting member pointed to by pmi (->) " + } + -re ".*$gdb_prompt $" { fail "print a after setting member pointed to by pmi (->) " } + timeout { fail "(timeout) print a after setting member pointed to by pmi (->) " } +} + + +# Do a ptype on the dereferenced pointer to member +# pai/1997-08-20 Doesn't work + +# send_gdb "ptype a.*pmi\n" +# gdb_expect { +# -re "type = int\r\n$gdb_prompt $" { +# pass "ptype a.*pmi" +# } +# -re ".*$gdb_prompt $" { fail "ptype a.*pmi" } +# timeout { fail "(timeout) ptype a.*pmi" } +#} + +# Try to dereference the pointer to data member without any object + +send_gdb "print *pmi\n" +gdb_expect { + -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" { + pass "attempt to print ptr to member without object" + } + -re ".*$gdb_prompt $" { fail "attempt to print ptr to member without object" } + timeout { fail "(timeout) attempt to print ptr to member without object" } +} + +# Try to ptype a dereference of the pointer to data member without any object + +send_gdb "ptype *pmi\n" +gdb_expect { + -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" { + pass "attempt to ptype ptr to member without object" + } + -re ".*$gdb_prompt $" { fail "attempt to ptype ptr to member without object" } + timeout { fail "(timeout) attempt to ptype ptr to member without object" } +} + +# Ptype a pointer to a method. + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "ptype pmf\n" +gdb_expect { + -re "type = int \\( A::\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" { + pass "ptype pmf" + } + -re ".*$gdb_prompt $" { fail "ptype pmf" } + timeout { fail "(timeout) ptype pmf" } +} + +# print a pointer to a method + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print pmf\n" +gdb_expect { + -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\(\\.\\.\\.\\)\\) \\?\\? \r\n$gdb_prompt $" { + pass "print pmf" + } + -re ".*$gdb_prompt $" { fail "print pmf" } + timeout { fail "(timeout) print pmf" } +} + + +# Ptype a pointer to a pointer to a method + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "ptype pmf_p\n" +gdb_expect { + -re "type = int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" { + pass "ptype pmf_p" + } + -re ".*$gdb_prompt $" { fail "ptype pmf_p" } + timeout { fail "(timeout) ptype pmf_p" } +} + +# print a pointer to a pointer to a method + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print pmf_p\n" +gdb_expect { + -re "\\$\[0-9\]* = \\(int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\\) $hex\r\n$gdb_prompt $" { + pass "print pmf_p" + } + -re ".*$gdb_prompt $" { fail "print pmf_p" } + timeout { fail "(timeout) print pmf_p" } +} + +# print dereferenced pointer to method + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a.*pmf\n" +gdb_expect { + -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" { + pass "print a.*pmf (known aCC limitation)" + } + -re ".*$gdb_prompt $" { fail "print a.*pmf" } + timeout { fail "(timeout) print a.*pmf" } +} + +# print dereferenced pointer to method, using ->* + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a_p->*pmf\n" +gdb_expect { + -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" { + pass "print a_p->*pmf (known aCC limitation)" + } + -re ".*$gdb_prompt $" { fail "print a_p->*pmf" } + timeout { fail "(timeout) print a_p->*pmf" } +} + +# set the pointer to data member + +setup_xfail "hppa*-*-*" +send_gdb "set var pmf = &A::foo\n" +gdb_expect { + -re "Assignment to pointers to methods not implemented with HP aCC\r\n$gdb_prompt $" { + pass "set var pmf (known aCC limitation)" + } + -re ".*$gdb_prompt $" { fail "set var pmf" } + timeout { fail "(timeout) set var pmf" } +} + +# Try to dereference the pointer to method without any object + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print *pmf\n" +gdb_expect { + -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" { + pass "attempt to print ptr to method without object" + } + -re ".*$gdb_prompt $" { fail "attempt to print ptr to method without object" } + timeout { fail "(timeout) attempt to print ptr to method without object" } +} + +# Try to ptype a dereference of the pointer to method without any object + +send_gdb "ptype *pmi\n" +gdb_expect { + -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" { + pass "attempt to ptype ptr to member without object" + } + -re ".*$gdb_prompt $" { fail "attempt to ptype ptr to member without object" } + timeout { fail "(timeout) attempt to ptype ptr to member without object" } +} + +# Check cast of pointer to member to integer +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print (int) pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 8\r\n$gdb_prompt $" { + pass "casting pmi to int" + } + -re ".*$gdb_prompt $" { fail "casting pmi to int" } + timeout { fail "(timeout) casting pmi to int" } +} + +# Check cast of pointer to method to integer +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print (int) pmf\n" +gdb_expect { + -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" { + pass "casting pmf to int (known aCC limitation)" + } + -re ".*$gdb_prompt $" { fail "casting pmf to int" } + timeout { fail "(timeout) casting pmf to int" } +} + +# Try to invoke a function through a pointer to data member +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print (a.*pmi)(3)\n" +gdb_expect { + -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" { + pass "print (a.*pmi)(3) -- error message should be different" + } + -re ".*$gdb_prompt $" { fail "print (a.*pmi)(3)" } + timeout { fail "(timeout) print (a.*pmi)(3)" } +} + +# Try to invoke a function through a pointer to a method +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print (a.*pmf)(3)\n" +gdb_expect { + -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" { + pass "print (a.*pmi)(3) -- known aCC limitation" + } + -re ".*$gdb_prompt $" { fail "print (a.*pmf)(3)" } + timeout { fail "(timeout) print (a.*pmf)(3)" } +} + + +# Go past assignment of NULL to pmi +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "next\n" +gdb_expect { + -re "\r\n85\[ \t\]*k = \\(a.\\*pmf\\)\\(3\\);\r\n$gdb_prompt $" { + pass "next past 83" + } + -re ".*$gdb_prompt $" { fail "next past 83" } + timeout { fail "(timeout) next past 83" } +} + +#send_gdb "print pmi\n" +#gdb_expect { +# -re "Attempted dereference of null pointer-to-member\r\n$gdb_prompt $" { +# pass "" +# } +# -re ".*$gdb_prompt $" { fail "" } +# timeout { fail "(timeout) " } +#} + +# Dereference the null pointer to member +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a.*pmi\n" +gdb_expect { + -re "Attempted dereference of null pointer-to-member\r\n$gdb_prompt $" { + pass "print a.*NULL" + } + -re ".*$gdb_prompt $" { fail "print a.*NULL" } + timeout { fail "(timeout) print a.*NULL" } +} + + +# Go to another part of the program +send_gdb "break 91\n" +gdb_expect { + -re "Breakpoint \[0-9\]*.*line 91\\.\r\n$gdb_prompt $" { + pass "set break at 91" + } + -re ".*$gdb_prompt $" { fail "set break at 91" } + timeout { fail "(timeout) set break at 91" } +} + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "continue\n" +gdb_expect { + -re "Continuing\\.\r\n\r\nBreakpoint.*at.*member-ptr\\.cc:91\r\n91\[ \t]*k = \\(a.\\*pmf\\)\\(4\\);\r\n$gdb_prompt $" { + pass "continue to 91" + } + -re ".*$gdb_prompt $" { fail "continue to 91" } + timeout { fail "(timeout) continue to 91" } +} + + +# Now check again that pmi works even when not set to +# something that's at the beginning of the object + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" { + pass "print pmi (2)" + } + -re ".*$gdb_prompt $" { fail "print pmi (2)" } + timeout { fail "(timeout) print pmi (2)" } +} + + +# print dereferenced pointer to data member + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a.*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" { + pass "print a.*pmi (2)" + } + -re ".*$gdb_prompt $" { fail "print a.*pmi (2)" } + timeout { fail "(timeout) print a.*pmi (2)" } +} + +# print dereferenced pointer to data member +# this time, dereferenced through a pointer + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "print a_p->*pmi\n" +gdb_expect { + -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" { + pass "print a->*pmi" + } + -re ".*$gdb_prompt $" { fail "print a->*pmi (2)" } + timeout { fail "(timeout) print a->*pmi (2)" } +} + + +# p a.*pmf - fail + +# p pmi + +# p a.*pmi + diff --git a/gdb/testsuite/gdb.c++/method.cc b/gdb/testsuite/gdb.c++/method.cc new file mode 100644 index 0000000..949b027 --- /dev/null +++ b/gdb/testsuite/gdb.c++/method.cc @@ -0,0 +1,80 @@ +// Class funk has a constructor and an ordinary method +// Test for CHFts23426 + +class funk +{ +public: + funk(); + void getFunky(int a, int b); + int data_; +}; + +funk::funk() + : data_(33) +{ +} + +void funk::getFunky(int a, int b) +{ + int res; + res = a + b - data_; + data_ = res; +} + +// Class A has const and volatile methods + +class A { +public: + int x; + int y; + int foo (int arg); + int bar (int arg) const; + int baz (int arg, char c) volatile; + int qux (int arg, float f) const volatile; +}; + +int A::foo (int arg) +{ + x += arg; + return arg *2; +} + +int A::bar (int arg) const +{ + return arg + 2 * x; +} + +int A::baz (int arg, char c) volatile +{ + return arg - 2 * x + c; +} + +int A::qux (int arg, float f) const volatile +{ + if (f > 0) + return 2 * arg - x; + else + return 2 * arg + x; +} + + +int main() +{ + A a; + int k; + + k = 10; + a.x = k * 2; + + k = a.foo(13); + + k += a.bar(15); + + // Test for CHFts23426 follows + funk f; + f.getFunky(1, 2); + return 0; +} + + + diff --git a/gdb/testsuite/gdb.c++/method.exp b/gdb/testsuite/gdb.c++/method.exp new file mode 100644 index 0000000..a085b14 --- /dev/null +++ b/gdb/testsuite/gdb.c++/method.exp @@ -0,0 +1,194 @@ +# Copyright 1998, 1999, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# tests for misc. C++ method stuff +# Written by Satish Pai 1997-07-08 + +# This file is part of the gdb testsuite + +# This tests: +# 0. method arguments are correct +# 1. access to class data members inside method scopes +# 2. correct param types for methods in ptype. +# 3. const and volatile methods + +# (#0 and #1 above relate to an HP specific problem -- GDB must correctly +# integrate FPARAM symbols in HP debug info into the local var list +# for the function or method's block.) + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "method" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info $binfile "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +gdb_test "break A::foo" \ + "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 38\\." + +gdb_test "continue" \ + "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, A::foo(\\(int\\)|) \\(this=$hex, arg=13\\) at .*method\\.cc:38\r\n38\[\t \]*x \\+= arg;" \ + "continue to A::foo" + +# Check ability to access this-relative stuff. + +gdb_test "print x" \ + "\\$\[0-9\]* = 20" \ + "print x in A::foo" + +# Check access to this pointer + +gdb_test "print this" \ + "\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex" \ + "print this in A::foo" + +# Now do everything over again for A::bar, because sometimes processing one method +# (the first one) is fine, but the second one's debug info gets munged beyond recognition. + +gdb_test "break A::bar" \ + "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 44\\." + +gdb_test "continue" \ + "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, A::bar(\\(int\\) const|) \\(this=$hex, arg=15\\) at .*method\\.cc:44\r\n44\[\t \]*return arg \\+ 2 \\* x;" \ + "continue to A::bar" + +# Check ability to access this-relative stuff. + +gdb_test "print x" \ + "\\$\[0-9\]* = 33" \ + "print x in A::bar" + +# Check access to this pointer + +get_debug_format + +send_gdb "print this\n" +gdb_expect { + -re "\\$\[0-9\]* = \\(const (class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" { + pass "print this in A::bar" + } + -re "\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" { + # gcc versions up to 3.0.4 with -gstabs+ do not emit "const" indicators, + # so the output is "A *". It should be "const A *" or "const A * const". + setup_xfail_format "stabs" + fail "print this in A::bar (missing const)" + } + -re "\\$\[0-9\]* = \\(const (class |)\{\\.\\.\\.\} *\\* *(const|)\\) $hex\r\n$gdb_prompt $" { + # gcc versions gcc-3_1-branch%20020404 and HEAD%20020404 with -gstabs+ + # produce good stabs, but gdb prints "const class {...} *" const. + # This is PR gdb/277. + # setup_kfail "gdb/277" + fail "print this in A::bar (gdb/277)" + } + -re ".*$gdb_prompt $" { fail "print this in A::bar" } + timeout { fail "(timeout) print this in A::bar" } +} + +# Check again with funk::getFunky (this is the original test case +# for CHFts23426); sometimes having a constructor with no arguments +# will nuke the debug info read in for other methods in the class. + +gdb_test "break 21" \ + "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 21\\." + +gdb_test "continue" \ + "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, funk::getFunky(\\(int, int\\)|) \\(this=$hex, a=1, b=2\\) at .*method\\.cc:21\r\n21\[\t \]*data_ = res;" \ + "continue to 21" + +# Check ability to access this-relative stuff. + +gdb_test "print data_" \ + "\\$\[0-9\]* = 33" \ + "print data_ in funk::getFunky" + +# Check access to this pointer + +gdb_test "print this" \ + "\\$\[0-9\]* = \\((class |)funk *\\* *(const|)\\) $hex" \ + "print this in funk::getFunky" + +# Check access to local variable + +gdb_test "print res" \ + "\\$\[0-9\]* = -30" \ + "print res in funk::getFunky" + +# Check ptype of class -- should show const/volatile methods + +send_gdb "ptype A\n" +gdb_expect { + -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\}\r\n$gdb_prompt $" { + pass "ptype A" + } + -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*A & operator=\\(A const ?&\\);\r\n\[ \]*A\\(A const ?&\\);\r\n\[ \]*A\\((void|)\\);\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\}\r\n$gdb_prompt $" { + pass "ptype A" + } + -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\);\r\n\[ \]*int qux\\(int, float\\) const;\r\n\}\r\n$gdb_prompt $" { + pass "ptype A (HP aCC bug -- volatile not indicated)" + } + -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" { + pass "ptype A" + } + -re ".*$gdb_prompt $" { fail "ptype A" } + timeout { fail "(timeout) ptype A" } +} + +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.c++/misc.cc b/gdb/testsuite/gdb.c++/misc.cc new file mode 100644 index 0000000..286c02b --- /dev/null +++ b/gdb/testsuite/gdb.c++/misc.cc @@ -0,0 +1,587 @@ +// Test various -*- C++ -*- things. + +// ====================== basic C++ types ======================= +bool v_bool; +bool v_bool_array[2]; + +typedef struct fleep fleep; +struct fleep { int a; } s; + +// ====================== simple class structures ======================= + +struct default_public_struct { + // defaults to public: + int a; + int b; +}; + +struct explicit_public_struct { + public: + int a; + int b; +}; + +struct protected_struct { + protected: + int a; + int b; +}; + +struct private_struct { + private: + int a; + int b; +}; + +struct mixed_protection_struct { + public: + int a; + int b; + private: + int c; + int d; + protected: + int e; + int f; + public: + int g; + private: + int h; + protected: + int i; +}; + +class public_class { + public: + int a; + int b; +}; + +class protected_class { + protected: + int a; + int b; +}; + +class default_private_class { + // defaults to private: + int a; + int b; +}; + +class explicit_private_class { + private: + int a; + int b; +}; + +class mixed_protection_class { + public: + int a; + int b; + private: + int c; + int d; + protected: + int e; + int f; + public: + int g; + private: + int h; + protected: + int i; +}; + +class const_vol_method_class { +public: + int a; + int b; + int foo (int &) const; + int bar (int &) volatile; + int baz (int &) const volatile; +}; + +int const_vol_method_class::foo (int & ir) const +{ + return ir + 3; +} +int const_vol_method_class::bar (int & ir) volatile +{ + return ir + 4; +} +int const_vol_method_class::baz (int & ir) const volatile +{ + return ir + 5; +} + +// ========================= simple inheritance ========================== + +class A { + public: + int a; + int x; +}; + +A g_A; + +class B : public A { + public: + int b; + int x; +}; + +B g_B; + +class C : public A { + public: + int c; + int x; +}; + +C g_C; + +class D : public B, public C { + public: + int d; + int x; +}; + +D g_D; + +class E : public D { + public: + int e; + int x; +}; + +E g_E; + +class class_with_anon_union +{ + public: + int one; + union + { + int a; + long b; + }; +}; + +class_with_anon_union g_anon_union; + +void inheritance2 (void) +{ +} + +void inheritance1 (void) +{ + int ival; + int *intp; + + // {A::a, A::x} + + g_A.A::a = 1; + g_A.A::x = 2; + + // {{A::a,A::x},B::b,B::x} + + g_B.A::a = 3; + g_B.A::x = 4; + g_B.B::b = 5; + g_B.B::x = 6; + + // {{A::a,A::x},C::c,C::x} + + g_C.A::a = 7; + g_C.A::x = 8; + g_C.C::c = 9; + g_C.C::x = 10; + + // {{{A::a,A::x},B::b,B::x},{{A::a,A::x},C::c,C::x},D::d,D::x} + + // The following initialization code is non-portable, but allows us + // to initialize all members of g_D until we can fill in the missing + // initialization code with legal C++ code. + + for (intp = (int *) &g_D, ival = 11; + intp < ((int *) &g_D + sizeof (g_D) / sizeof (int)); + intp++, ival++) + { + *intp = ival; + } + + // Overlay the nonportable initialization with legal initialization. + + // ????? = 11; (g_D.A::a = 11; is ambiguous) + // ????? = 12; (g_D.A::x = 12; is ambiguous) +/* djb 6-3-2000 + + This should take care of it. Rather than try to initialize using an ambiguous + construct, use 2 unambiguous ones for each. Since the ambiguous a/x member is + coming from C, and B, initialize D's C::a, and B::a, and D's C::x and B::x. + */ + g_D.C::a = 15; + g_D.C::x = 12; + g_D.B::a = 11; + g_D.B::x = 12; + g_D.B::b = 13; + g_D.B::x = 14; + // ????? = 15; + // ????? = 16; + g_D.C::c = 17; + g_D.C::x = 18; + g_D.D::d = 19; + g_D.D::x = 20; + + + // {{{{A::a,A::x},B::b,B::x},{{A::a,A::x},C::c,C::x},D::d,D::x}},E::e,E::x} + + // The following initialization code is non-portable, but allows us + // to initialize all members of g_D until we can fill in the missing + // initialization code with legal C++ code. + + for (intp = (int *) &g_E, ival = 21; + intp < ((int *) &g_E + sizeof (g_E) / sizeof (int)); + intp++, ival++) + { + *intp = ival; + } + + // Overlay the nonportable initialization with legal initialization. + + // ????? = 21; (g_E.A::a = 21; is ambiguous) + // ????? = 22; (g_E.A::x = 22; is ambiguous) + g_E.B::b = 23; + g_E.B::x = 24; + // ????? = 25; + // ????? = 26; + g_E.C::c = 27; + g_E.C::x = 28; + g_E.D::d = 29; + g_E.D::x = 30; + g_E.E::e = 31; + g_E.E::x = 32; + + g_anon_union.one = 1; + g_anon_union.a = 2; + + inheritance2 (); +} + +// ======================== static member functions ===================== + +class Static { +public: + static void ii(int, int); +}; +void Static::ii (int, int) { } + +// ======================== virtual base classes========================= + +class vA { + public: + int va; + int vx; +}; + +vA g_vA; + +class vB : public virtual vA { + public: + int vb; + int vx; +}; + +vB g_vB; + +class vC : public virtual vA { + public: + int vc; + int vx; +}; + +vC g_vC; + +class vD : public virtual vB, public virtual vC { + public: + int vd; + int vx; +}; + +vD g_vD; + +class vE : public virtual vD { + public: + int ve; + int vx; +}; + +vE g_vE; + +void inheritance4 (void) +{ +} + +void inheritance3 (void) +{ + int ival; + int *intp; + + // {vA::va, vA::vx} + + g_vA.vA::va = 1; + g_vA.vA::vx = 2; + + // {{vA::va, vA::vx}, vB::vb, vB::vx} + + g_vB.vA::va = 3; + g_vB.vA::vx = 4; + g_vB.vB::vb = 5; + g_vB.vB::vx = 6; + + // {{vA::va, vA::vx}, vC::vc, vC::vx} + + g_vC.vA::va = 7; + g_vC.vA::vx = 8; + g_vC.vC::vc = 9; + g_vC.vC::vx = 10; + + // {{{{vA::va, vA::vx}, vB::vb, vB::vx}, vC::vc, vC::vx}, vD::vd,vD::vx} + + g_vD.vA::va = 11; + g_vD.vA::vx = 12; + g_vD.vB::vb = 13; + g_vD.vB::vx = 14; + g_vD.vC::vc = 15; + g_vD.vC::vx = 16; + g_vD.vD::vd = 17; + g_vD.vD::vx = 18; + + + // {{{{{vA::va,vA::vx},vB::vb,vB::vx},vC::vc,vC::vx},vD::vd,vD::vx},vE::ve,vE::vx} + + g_vD.vA::va = 19; + g_vD.vA::vx = 20; + g_vD.vB::vb = 21; + g_vD.vB::vx = 22; + g_vD.vC::vc = 23; + g_vD.vC::vx = 24; + g_vD.vD::vd = 25; + g_vD.vD::vx = 26; + g_vE.vE::ve = 27; + g_vE.vE::vx = 28; + + inheritance4 (); +} + +// ====================================================================== + +class Base1 { + public: + int x; + Base1(int i) { x = i; } +}; + +class Foo +{ + public: + int x; + int y; + static int st; + Foo (int i, int j) { x = i; y = j; } + int operator! (); + operator int (); + int times (int y); +}; + +class Bar : public Base1, public Foo { + public: + int z; + Bar (int i, int j, int k) : Base1 (10*k), Foo (i, j) { z = k; } +}; + +int Foo::operator! () { return !x; } + +int Foo::times (int y) { return x * y; } + +int Foo::st = 100; + +Foo::operator int() { return x; } + +Foo foo(10, 11); +Bar bar(20, 21, 22); + +class ClassWithEnum { +public: + enum PrivEnum { red, green, blue, yellow = 42 }; + PrivEnum priv_enum; + int x; +}; + +void enums2 (void) +{ +} + +/* classes.exp relies on statement order in this function for testing + enumeration fields. */ + +void enums1 () +{ + ClassWithEnum obj_with_enum; + obj_with_enum.priv_enum = ClassWithEnum::red; + obj_with_enum.x = 0; + enums2 (); + obj_with_enum.priv_enum = ClassWithEnum::green; +} + +class ClassParam { +public: + int Aptr_a (A *a) { return a->a; } + int Aptr_x (A *a) { return a->x; } + int Aref_a (A &a) { return a.a; } + int Aref_x (A &a) { return a.x; } + int Aval_a (A a) { return a.a; } + int Aval_x (A a) { return a.x; } +}; + +ClassParam class_param; + +class Contains_static_instance +{ + public: + int x; + int y; + Contains_static_instance (int i, int j) { x = i; y = j; } + static Contains_static_instance null; +}; + +Contains_static_instance Contains_static_instance::null(0,0); +Contains_static_instance csi(10,20); + +class Contains_nested_static_instance +{ + public: + class Nested + { + public: + Nested(int i) : z(i) {} + int z; + static Contains_nested_static_instance xx; + }; + + Contains_nested_static_instance(int i, int j) : x(i), y(j) {} + + int x; + int y; + + static Contains_nested_static_instance null; + static Nested yy; +}; + +Contains_nested_static_instance Contains_nested_static_instance::null(0, 0); +Contains_nested_static_instance::Nested Contains_nested_static_instance::yy(5); +Contains_nested_static_instance + Contains_nested_static_instance::Nested::xx(1,2); +Contains_nested_static_instance cnsi(30,40); + +typedef struct { + int one; + int two; +} tagless_struct; +tagless_struct v_tagless; + +/* Try to get the compiler to allocate a class in a register. */ +class small { + public: + int x; + int method (); +}; + +int +small::method () +{ + return x + 5; +} + +void marker_reg1 () {} + +int +register_class () +{ + /* We don't call any methods for v, so gcc version cygnus-2.3.3-930220 + might put this variable in a register. This is a lose, though, because + it means that GDB can't call any methods for that variable. */ + register small v; + + int i; + + /* Perform a computation sufficiently complicated that optimizing compilers + won't optimized out the variable. If some compiler constant-folds this + whole loop, maybe using a parameter to this function here would help. */ + v.x = 0; + for (i = 0; i < 13; ++i) + v.x += i; + --v.x; /* v.x is now 77 */ + marker_reg1 (); + return v.x + 5; +} + +void dummy() +{ + v_bool = true; + v_bool_array[0] = false; + v_bool_array[1] = v_bool; +} + +void use_methods () +{ + /* Refer to methods so that they don't get optimized away. */ + int i; + i = class_param.Aptr_a (&g_A); + i = class_param.Aptr_x (&g_A); + i = class_param.Aref_a (g_A); + i = class_param.Aref_x (g_A); + i = class_param.Aval_a (g_A); + i = class_param.Aval_x (g_A); +} + + +int +main() +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + dummy(); + inheritance1 (); + inheritance3 (); + enums1 (); + register_class (); + + /* FIXME: pmi gets optimized out. Need to do some more computation with + it or something. (No one notices, because the test is xfail'd anyway, + but that probably won't always be true...). */ + int Foo::* pmi = &Foo::y; + + /* Make sure the AIX linker doesn't remove the variable. */ + v_tagless.one = 5; + + use_methods (); + + return foo.*pmi; +} + +/* Create an instance for some classes, otherwise they get optimized away. */ + +default_public_struct default_public_s; +explicit_public_struct explicit_public_s; +protected_struct protected_s; +private_struct private_s; +mixed_protection_struct mixed_protection_s; +public_class public_c; +protected_class protected_c; +default_private_class default_private_c; +explicit_private_class explicit_private_c; +mixed_protection_class mixed_protection_c; diff --git a/gdb/testsuite/gdb.c++/misc.exp b/gdb/testsuite/gdb.c++/misc.exp new file mode 100644 index 0000000..a2d122f --- /dev/null +++ b/gdb/testsuite/gdb.c++/misc.exp @@ -0,0 +1,159 @@ +# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2002 Free Software +# Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +set testfile "misc" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# +# Deduce language of main() +# + +proc deduce_language_of_main {} { + global gdb_prompt + + # See what language gdb thinks main() is, prior to reading full symbols. + # I think this fails for COFF targets. + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" { + pass "deduced language is C++, before full symbols" + } + -re ".*$gdb_prompt $" { + fail "source language not correct for C++ (psymtabs only)" + return + } + timeout { + fail "can't show language (timeout)" + return + } + } + + runto_main + + # See if our idea of the language has changed. + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" { + pass "deduced language is C++, after full symbols" + } + -re ".*$gdb_prompt $" { + fail "source language not correct for C++ (full symbols)" + return + } + timeout { + fail "can't show language (timeout)" + return + } + } +} + +proc test_expr { args } { + if { [llength $args] % 2 } { + warning "an even # of arguments should be passed to test_expr" + } + set last_ent [expr [llength $args] - 1]; + set testname [lindex $args $last_ent]; + if [gdb_test [lindex $args 0] "" "$testname (setup)"] { + gdb_suppress_tests; + } + for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { + if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"] { + gdb_suppress_tests; + } + } + gdb_stop_suppressing_tests; +} + +proc do_tests {} { + global prms_id + global bug_id + global subdir + global objdir + global srcdir + global binfile + global gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + deduce_language_of_main + # Check for fixes for PRs 8916 and 8630 + gdb_test "print s.a" ".* = 0" "print s.a for foo struct (known gcc 2.7.2 and earlier bug)" +} + +do_tests + +test_expr "set language c++" \ + "print 1 == 1" "print.*\\$\[0-9\]* = true" \ + "print 1 == 2" "print.*\\$\[0-9\]* = false" \ + "print as bool" + +# Test bool type printing, etc. +# Note: Language is already set to C++ above! +gdb_test "print v_bool" "\\$\[0-9\]* = false" "print a bool var" + +# set a bool variable +test_expr "set variable v_bool = true" \ + "print v_bool" "\\$\[0-9\]* = true" \ + "set a bool var" + +# next print an array of bool +gdb_test "print v_bool_array" "\\$\[0-9\]* = \\{false, false\\}" "print a bool array" + +# set elements of a bool array +test_expr "set variable v_bool_array\[1\] = true" \ + "print v_bool_array" "\\$\[0-9\]* = \\{false, true\\}" \ + "set a bool array elem" + +# bool constants +gdb_test "print true" "\\$\[0-9\]* = true" "print true" +gdb_test "print false" "\\$\[0-9\]* = false" "print false" + +# arithmetic conversions +gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true" +gdb_test "print 3 + false" "\\$\[0-9\]* = 3" "3 + false" +gdb_test "print 1 < 2 < 3" "\\$\[0-9\]* = true" "1 < 2 < 3" +gdb_test "print 2 < 1 > 4" "\\$\[0-9\]* = false" "2 < 1 > 4" +gdb_test "print (bool)43" "\\$\[0-9\]* = true" "(bool)43" +gdb_test "print (bool)0" "\\$\[0-9\]* = false" "(bool)0" +gdb_test "print (bool)17.93" "\\$\[0-9\]* = true" "(bool)17.93" +gdb_test "print (bool)0.0" "\\$\[0-9\]* = false" "(bool)0.0" +gdb_test "print (int)true" "\\$\[0-9\]* = 1" "(int)true" +gdb_test "print (int)false" "\\$\[0-9\]* = 0" "(int)false" diff --git a/gdb/testsuite/gdb.c++/namespace.cc b/gdb/testsuite/gdb.c++/namespace.cc new file mode 100644 index 0000000..7b9a173 --- /dev/null +++ b/gdb/testsuite/gdb.c++/namespace.cc @@ -0,0 +1,163 @@ +namespace AAA { + char c; + int i; + int A_xyzq (int); + char xyzq (char); + class inA { + public: + int xx; + int fum (int); + }; +}; + +int AAA::inA::fum (int i) +{ + return 10 + i; +} + +namespace BBB { + char c; + int i; + int B_xyzq (int); + char xyzq (char); + + namespace CCC { + char xyzq (char); + }; + + class Class { + public: + char xyzq (char); + int dummy; + }; +}; + +int AAA::A_xyzq (int x) +{ + return 2 * x; +} + +char AAA::xyzq (char c) +{ + return 'a'; +} + + +int BBB::B_xyzq (int x) +{ + return 3 * x; +} + +char BBB::xyzq (char c) +{ + return 'b'; +} + +char BBB::CCC::xyzq (char c) +{ + return 'z'; +} + +char BBB::Class::xyzq (char c) +{ + return 'o'; +} + +void marker1(void) +{ + return; +} + +namespace +{ + int X = 9; + + namespace G + { + int Xg = 10; + } +} + +namespace C +{ + int c = 1; + int shadow = 12; + + namespace + { + int cX = 6; + + namespace F + { + int cXf = 7; + } + } + + namespace C + { + int cc = 2; + } + + namespace D + { + int cd = 3; + int shadow = 13; + + namespace E + { + int cde = 5; + } + + void marker2 (void) + { + // NOTE: carlton/2003-04-23: I'm listing the expressions that I + // plan to have GDB try to print out, just to make sure that the + // compiler and I agree which ones should be legal! It's easy + // to screw up when testing the boundaries of namespace stuff. + c; + //cc; + C::cc; + cd; + E::cde; + shadow; + cX; + F::cXf; + X; + G::Xg; + //cXOtherFile; + //XOtherFile; + + return; + } + + } +} + +int main () +{ + using AAA::inA; + char c1; + + using namespace BBB; + + c1 = xyzq ('x'); + c1 = AAA::xyzq ('x'); + c1 = BBB::CCC::xyzq ('m'); + + inA ina; + + ina.xx = 33; + + int y; + + y = AAA::A_xyzq (33); + y += B_xyzq (44); + + BBB::Class cl; + + c1 = cl.xyzq('e'); + + marker1(); + + C::D::marker2 (); +} diff --git a/gdb/testsuite/gdb.c++/namespace.exp b/gdb/testsuite/gdb.c++/namespace.exp new file mode 100644 index 0000000..f4efaf6 --- /dev/null +++ b/gdb/testsuite/gdb.c++/namespace.exp @@ -0,0 +1,219 @@ +# Copyright 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# tests for namespaces +# Written by Satish Pai 1997-07-23 + +# This file is part of the gdb testsuite + +# Note: These tests are geared to the HP aCC compiler, +# which has an idiosyncratic way of emitting debug info +# for namespaces. +# Note: As of 2000-06-03, these pass under g++ - djb + + +if $tracelevel then { + strace $tracelevel + } + +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "namespace" +set srcfile ${testfile}.cc +set objfile ${objdir}/${subdir}/${testfile}.o +set srcfile1 ${testfile}1.cc +set objfile1 ${objdir}/${subdir}/${testfile}1.o +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1; +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${objfile1}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${objfile} ${objfile1}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +if ![runto 'marker1'] then { + perror "couldn't run to marker1" + continue +} + +gdb_test "up" ".*main.*" "up from marker1" + +# Access a data item inside a namespace using colons and +# single quotes :-( + +send_gdb "print 'AAA::c'\n" +gdb_expect { + -re "\\$\[0-9\]* = 0 '\\\\(0|000)'\r\n$gdb_prompt $" { pass "print 'AAA::c'" } + -re ".*$gdb_prompt $" { fail "print 'AAA::c'" } + timeout { fail "(timeout) print 'AAA::c'" } +} + +# An object declared using "using". + +send_gdb "print ina\n" +gdb_expect { + -re "\\$\[0-9\]+ = {xx = 33}.*$gdb_prompt $" { + pass "print ina" + } + -re ".*$gdb_prompt $" { fail "print ina" } + timeout { fail "(timeout) print ina" } +} + +send_gdb "ptype ina\n" +gdb_expect { + -re "type = class (AAA::|)inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*.*int fum\\(int\\);\r\n\}\r\n$gdb_prompt $" { + pass "ptype ina" + } + -re ".*$gdb_prompt $" { fail "ptype ina" } + timeout { fail "(timeout) ptype ina" } +} + +# Check all functions are known to GDB + +setup_xfail hppa*-*-*11* CLLbs14869 +send_gdb "info func xyzq\n" +gdb_expect { + -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" { + pass "info func xyzq" + } + -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" { + pass "info func xyzq" + } + -re ".*$gdb_prompt $" { fail "info func xyzq" } + timeout { fail "(timeout) info func xyzq" } +} + +# Call a function in a namespace + +send_gdb "print 'AAA::xyzq'('x')\n" +gdb_expect { + -re "\\$\[0-9\]* = 97 'a'\r\n$gdb_prompt $" { + pass "print 'AAA::xyzq'('x')" + } + -re ".*$gdb_prompt $" { fail "print 'AAA::xyzq'('x')" } + timeout { fail "(timeout) print 'AAA::xyzq'('x')" } +} + +# Break on a function in a namespace + +send_gdb "break AAA::xyzq\n" +gdb_expect { + -re "Breakpoint.*at $hex: file.*namespace.cc, line 42\\.\r\n$gdb_prompt $" { + pass "break AAA::xyzq" + } + -re ".*$gdb_prompt $" { fail "break AAA::xyzq" } + timeout { fail "(timeout) break AAA::xyzq" } +} + +# Call a function in a nested namespace + +send_gdb "print 'BBB::CCC::xyzq'('x')\n" +gdb_expect { + -re "\\$\[0-9\]* = 122 'z'\r\n$gdb_prompt $" { + pass "print 'BBB::CCC::xyzq'('x')" + } + -re ".*$gdb_prompt $" { fail "print 'BBB::CCC::xyzq'('x')" } + timeout { fail "(timeout) print 'BBB::CCC::xyzq'('x')" } +} + +# Break on a function in a nested namespace + +send_gdb "break BBB::CCC::xyzq\n" +gdb_expect { + -re "Breakpoint.*at $hex: file.*namespace.cc, line 58\\.\r\n$gdb_prompt $" { + pass "break BBB::CCC::xyzq" + } + -re ".*$gdb_prompt $" { fail "break BBB::CCC::xyzq" } + timeout { fail "(timeout) break BBB::CCC::xyzq" } +} + +# Print address of a function in a class in a namespace + +send_gdb "print 'BBB::Class::xyzq'\n" +gdb_expect { + -re "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex \r\n$gdb_prompt $" { + pass "print 'BBB::Class::xyzq'" + } + -re ".*$gdb_prompt $" { fail "print 'BBB::Class::xyzq'" } + timeout { fail "(timeout) print 'BBB::Class::xyzq'" } +} + +# Break on a function in a class in a namespace + +send_gdb "break BBB::Class::xyzq\n" +gdb_expect { + -re "Breakpoint.*at $hex: file.*namespace.cc, line 63\\.\r\n$gdb_prompt $" { + pass "break BBB::Class::xyzq" + } + -re ".*$gdb_prompt $" { fail "break BBB::Class::xyzq" } + timeout { fail "(timeout) break BBB::Class::xyzq" } +} + +# Test to see if the appropriate namespaces are in scope when trying +# to print out stuff from within a function defined within a +# namespace. + +if ![runto "C::D::marker2"] then { + perror "couldn't run to marker2" + continue +} + +gdb_test "print c" "\\$\[0-9\].* = 1" +gdb_test "print cc" "No symbol \"cc\" in current context." +gdb_test "print 'C::cc'" "\\$\[0-9\].* = 2" +gdb_test "print cd" "\\$\[0-9\].* = 3" +gdb_test "print 'E::cde'" "\\$\[0-9\].* = 5" +gdb_test "print shadow" "\\$\[0-9\].* = 13" +gdb_test "print cOtherFile" "\\$\[0-9\].* = 316" + +# Some anonymous namespace tests. + +gdb_test "print cX" "\\$\[0-9\].* = 6" +gdb_test "print 'F::cXf'" "\\$\[0-9\].* = 7" +gdb_test "print X" "\\$\[0-9\].* = 9" +gdb_test "print 'G::Xg'" "\\$\[0-9\].* = 10" +gdb_test "print cXOtherFile" "No symbol \"cXOtherFile\" in current context." +gdb_test "print XOtherFile" "No symbol \"XOtherFile\" in current context." diff --git a/gdb/testsuite/gdb.c++/namespace1.cc b/gdb/testsuite/gdb.c++/namespace1.cc new file mode 100644 index 0000000..4a5900a --- /dev/null +++ b/gdb/testsuite/gdb.c++/namespace1.cc @@ -0,0 +1,31 @@ +/* Copyright 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +namespace C +{ + namespace { + int cXOtherFile = 29; + }; + + int cOtherFile = 316; +} + +namespace { + int XOtherFile = 317; +} diff --git a/gdb/testsuite/gdb.c++/overload.cc b/gdb/testsuite/gdb.c++/overload.cc new file mode 100644 index 0000000..56afc96 --- /dev/null +++ b/gdb/testsuite/gdb.c++/overload.cc @@ -0,0 +1,168 @@ +#include + +class foo { +public: + foo (int); + foo (int, const char *); + foo (foo&); + ~foo (); + void foofunc (int); + void foofunc (int, signed char *); + int ifoo; + const char *ccpfoo; + +int overload1arg (void); +int overload1arg (char); +int overload1arg (signed char); +int overload1arg (unsigned char); +int overload1arg (short); +int overload1arg (unsigned short); +int overload1arg (int); +int overload1arg (unsigned int); +int overload1arg (long); +int overload1arg (unsigned long); +int overload1arg (float); +int overload1arg (double); + +int overloadfnarg (void); +int overloadfnarg (int); +int overloadfnarg (int, int (*) (int)); + +int overloadargs (int a1); +int overloadargs (int a1, int a2); +int overloadargs (int a1, int a2, int a3); +int overloadargs (int a1, int a2, int a3, int a4); +int overloadargs (int a1, int a2, int a3, int a4, int a5); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10, int a11); + + +}; + +int intToChar (char c) +{ + return 297; +} + +void marker1() +{} + +int main () +{ + char arg2 = 2; + signed char arg3 =3; + unsigned char arg4 =4; + short arg5 =5; + unsigned short arg6 =6; + int arg7 =7; + unsigned int arg8 =8; + long arg9 =9; + unsigned long arg10 =10; + float arg11 =100.0; + double arg12 = 200.0; + + char *str = (char *) "A"; + foo foo_instance1(111); + foo foo_instance2(222, str); + foo foo_instance3(foo_instance2); + + #ifdef usestubs + set_debug_traps(); + breakpoint(); + #endif + + // Verify that intToChar should work: + intToChar(1); + + marker1(); // marker1-returns-here + return 0; // marker1-returns-here +} + +foo::foo (int i) { ifoo = i; ccpfoo = NULL; } +foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; } +foo::foo (foo& afoo) { ifoo = afoo.ifoo; ccpfoo = afoo.ccpfoo;} +foo::~foo () {} + + +/* Some functions to test overloading by varying one argument type. */ + +int foo::overload1arg (void) { return 1; } +int foo::overload1arg (char arg) { arg = 0; return 2;} +int foo::overload1arg (signed char arg) { arg = 0; return 3;} +int foo::overload1arg (unsigned char arg) { arg = 0; return 4;} +int foo::overload1arg (short arg) { arg = 0; return 5;} +int foo::overload1arg (unsigned short arg) { arg = 0; return 6;} +int foo::overload1arg (int arg) { arg = 0; return 7;} +int foo::overload1arg (unsigned int arg) { arg = 0; return 8;} +int foo::overload1arg (long arg) { arg = 0; return 9;} +int foo::overload1arg (unsigned long arg) { arg = 0; return 10;} +int foo::overload1arg (float arg) { arg = 0; return 11;} +int foo::overload1arg (double arg) { arg = 0; return 12;} + +/* Test to see that we can explicitly request overloaded functions + with function pointers in the prototype. */ + +int foo::overloadfnarg (void) { return ifoo * 20; } +int foo::overloadfnarg (int arg) { arg = 0; return 13;} +int foo::overloadfnarg (int arg, int (*foo) (int)) { return foo(arg); } + +/* Some functions to test overloading by varying argument count. */ + +int foo::overloadargs (int a1) +{ a1 = 0; +return 1;} + +int foo::overloadargs (int a1, int a2) +{ a1 = a2 = 0; +return 2;} + +int foo::overloadargs (int a1, int a2, int a3) +{ a1 = a2 = a3 = 0; +return 3;} + +int foo::overloadargs (int a1, int a2, int a3, int a4) +{ a1 = a2 = a3 = a4 = 0; +return 4;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5) +{ a1 = a2 = a3 = a4 = a5 = 0; +return 5;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6) +{ a1 = a2 = a3 = a4 = a5 = a6 = 0; +return 6;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7) +{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0; +return 7;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8) +{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0; +return 8;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9) +{ + a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0; + return 9; +} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = + a10 = 0; return 10;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10, int a11) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = + a10 = a11 = 0; return 11;} + + + diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp new file mode 100644 index 0000000..3e14678 --- /dev/null +++ b/gdb/testsuite/gdb.c++/overload.exp @@ -0,0 +1,400 @@ +# Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# written by Elena Zannoni (ezannoni@cygnus.com) + +# This file is part of the gdb testsuite +# +# tests for overloaded member functions. Command Line calls +# + + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "overload" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +if ![runto 'marker1'] then { + perror "couldn't run to marker1" + continue +} + +gdb_test "up" ".*main.*" "up from marker1" + +send_gdb "print foo_instance1\n" +gdb_expect { + -re ".\[0-9\]* = \{ifoo = 111, ccpfoo = 0x0\}\r\n$gdb_prompt $" { + pass "print foo_instance1" + } + -re ".*$gdb_prompt $" { fail "print foo_instance1" } + timeout { fail "(timeout) print foo_instance1" } + } + + +setup_xfail "hppa*-*-*" CLLbs16901 +send_gdb "ptype foo_instance1\n" +gdb_expect { + -re "type = class foo \{.*public:.*int ifoo;.*const char \\*ccpfoo;.*foo\\(int\\);.*foo\\(int, (const char|char const) \\*\\);.*foo\\(foo &\\);.*~foo\\(void\\);.*void foofunc\\(int\\);.*void foofunc\\(int, signed char \\*\\);.*int overload1arg\\(void\\);.*int overload1arg\\(char\\);.*int overload1arg\\(signed char\\);.*int overload1arg\\(unsigned char\\);.*int overload1arg\\(short\\);.*int overload1arg\\(unsigned short\\);.*int overload1arg\\(int\\);.*int overload1arg\\(unsigned int\\);.*int overload1arg\\(long\\);.*int overload1arg\\(unsigned long\\);.*int overload1arg\\(float\\);.*int overload1arg\\(double\\);.*int overloadargs\\(int\\);.*int overloadargs\\(int, int\\);.*int overloadargs\\(int, int, int\\);.*int overloadargs\\(int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);\r\n\}\r\n$gdb_prompt $" { + pass "ptype foo_instance1 (HP aCC -- known quirk with ~foo parameter list)" + } + -re "type = class foo .*int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);\r\n\}\r\n$gdb_prompt $" { + pass "ptype foo_instance1 (shorter match)" + } + -re ".*$gdb_prompt $" { fail "ptype foo_instance1" } + timeout { fail "(timeout) ptype foo_instance1" } + } + +send_gdb "print foo_instance2\n" +gdb_expect { + -re ".\[0-9\]* = \{ifoo = 222, ccpfoo = $hex \"A\"\}\r\n$gdb_prompt $" { + pass "print foo_instance2" + } + -re ".*$gdb_prompt $" { fail "print foo_instance2" } + timeout { fail "(timeout) print foo_instance2" } + } + +send_gdb "print foo_instance3\n" +gdb_expect { + -re ".\[0-9\]* = \{ifoo = 222, ccpfoo = $hex \"A\"\}\r\n$gdb_prompt $" { + pass "print foo_instance3" + } + -re ".*$gdb_prompt $" { fail "print foo_instance3" } + timeout { fail "(timeout) print foo_instance3" } + } + + +send_gdb "print foo_instance1.overloadargs(1)\n" +gdb_expect { + -re ".\[0-9\]* = 1\r\n$gdb_prompt $" { + pass "print call overloaded func 1 arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 1 arg" } + timeout { fail "(timeout) print call overloaded func 1 arg" } + } + + +# If GDB fails to restore the selected frame properly after the +# inferior function call above (see GDB PR 1155 for an explanation of +# why this might happen), all the subsequent tests will fail. We +# should detect and report that failure, but let the marker call +# finish so that the rest of the tests can run undisturbed. +gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" { + -re "#0 marker1.*$gdb_prompt $" { + setup_kfail "gdb/1155" s390-*-linux-gnu + fail "re-selected 'main' frame after inferior call" + gdb_test "finish" ".*main.*at .*overload.cc:.*// marker1-returns-here.*" \ + "finish call to marker1" + } + -re "#1 ($hex in )?main.*$gdb_prompt $" { + pass "re-selected 'main' frame after inferior call" + } +} + + +send_gdb "print foo_instance1.overloadargs(1, 2)\n" +gdb_expect { + -re ".\[0-9\]* = 2\r\n$gdb_prompt $" { + pass "print call overloaded func 2 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 2 args" } + timeout { fail "(timeout) print call overloaded func 2 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3)\n" +gdb_expect { + -re ".\[0-9\]* = 3\r\n$gdb_prompt $" { + pass "print call overloaded func 3 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 3 args" } + timeout { fail "(timeout) print call overloaded func 3 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4)\n" +gdb_expect { + -re ".\[0-9\]* = 4\r\n$gdb_prompt $" { + pass "print call overloaded func 4 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 4 args" } + timeout { fail "(timeout) print call overloaded func 4 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5)\n" +gdb_expect { + -re ".\[0-9\]* = 5\r\n$gdb_prompt $" { + pass "print call overloaded func 5 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 5 args" } + timeout { fail "(timeout) print call overloaded func 5 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)\n" +gdb_expect { + -re ".\[0-9\]* = 6\r\n$gdb_prompt $" { + pass "print call overloaded func 6 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 6 args" } + timeout { fail "(timeout) print call overloaded func 6 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)\n" +gdb_expect { + -re ".\[0-9\]* = 7\r\n$gdb_prompt $" { + pass "print call overloaded func 7 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 7 args" } + timeout { fail "(timeout) print call overloaded func 7 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)\n" +gdb_expect { + -re ".\[0-9\]* = 8\r\n$gdb_prompt $" { + pass "print call overloaded func 8 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 8 args" } + timeout { fail "(timeout) print call overloaded func 8 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)\n" +gdb_expect { + -re ".\[0-9\]* = 9\r\n$gdb_prompt $" { + pass "print call overloaded func 9 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 9 args" } + timeout { fail "(timeout) print call overloaded func 9 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n" +gdb_expect { + -re ".\[0-9\]* = 10\r\n$gdb_prompt $" { + pass "print call overloaded func 10 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 10 args" } + timeout { fail "(timeout) print call overloaded func 10 args" } + } + + +send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)\n" +gdb_expect { + -re ".\[0-9\]* = 11\r\n$gdb_prompt $" { + pass "print call overloaded func 11 args" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func 11 args" } + timeout { fail "(timeout) print call overloaded func 11 args" } + } + + +send_gdb "print foo_instance1.overload1arg()\n" +gdb_expect { + -re ".\[0-9\]* = 1\r\n$gdb_prompt $" { + pass "print call overloaded func void arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func void arg" } + timeout { fail "(timeout) print call overloaded func void arg" } + } + + +send_gdb "print foo_instance1.overload1arg((char)arg2)\n" +gdb_expect { + -re ".\[0-9\]* = 2\r\n$gdb_prompt $" { + pass "print call overloaded func char arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func char arg" } + timeout { fail "(timeout) print call overloaded func char arg" } + } + + +send_gdb "print foo_instance1.overload1arg((signed char)arg3)\n" +gdb_expect { + -re ".\[0-9\]* = 3\r\n$gdb_prompt $" { + pass "print call overloaded func signed char arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func signed char arg" } + timeout { fail "(timeout) print call overloaded func signed char arg" } + } + + +send_gdb "print foo_instance1.overload1arg((unsigned char)arg4)\n" +gdb_expect { + -re ".\[0-9\]* = 4\r\n$gdb_prompt $" { + pass "print call overloaded func unsigned char arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned char arg" } + timeout { fail "(timeout) print call overloaded func unsigned char arg" } + } + + +send_gdb "print foo_instance1.overload1arg((short)arg5)\n" +gdb_expect { + -re ".\[0-9\]* = 5\r\n$gdb_prompt $" { + pass "print call overloaded func short arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func short arg" } + timeout { fail "(timeout) print call overloaded func short arg" } + } + + +send_gdb "print foo_instance1.overload1arg((unsigned short)arg6)\n" +gdb_expect { + -re ".\[0-9\]* = 6\r\n$gdb_prompt $" { + pass "print call overloaded func unsigned short arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned short arg" } + timeout { fail "(timeout) print call overloaded func unsigned short arg" } + } + + +send_gdb "print foo_instance1.overload1arg((int)arg7)\n" +gdb_expect { + -re ".\[0-9\]* = 7\r\n$gdb_prompt $" { + pass "print call overloaded func int arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func int arg" } + timeout { fail "(timeout) print call overloaded func int arg" } + } + + +send_gdb "print foo_instance1.overload1arg((unsigned int)arg8)\n" +gdb_expect { + -re ".\[0-9\]* = 8\r\n$gdb_prompt $" { + pass "print call overloaded func unsigned int arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned int arg" } + timeout { fail "(timeout) print call overloaded func unsigned int arg" } + } + + +send_gdb "print foo_instance1.overload1arg((long)arg9)\n" +gdb_expect { + -re ".\[0-9\]* = 9\r\n$gdb_prompt $" { + pass "print call overloaded func long arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func long arg" } + timeout { fail "(timeout) print call overloaded func long arg" } + } + + +send_gdb "print foo_instance1.overload1arg((unsigned long)arg10)\n" +gdb_expect { + -re ".\[0-9\]* = 10\r\n$gdb_prompt $" { + pass "print call overloaded func unsigned long arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned long arg" } + timeout { fail "(timeout) print call overloaded func unsigned long arg" } + } + + +send_gdb "print foo_instance1.overload1arg((float)arg11)\n" +gdb_expect { + -re ".\[0-9\]* = 11\r\n$gdb_prompt $" { + pass "print call overloaded func float arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func float arg" } + timeout { fail "(timeout) print call overloaded func float arg" } + } + + +send_gdb "print foo_instance1.overload1arg((double)arg12)\n" +gdb_expect { + -re ".\[0-9\]* = 12\r\n$gdb_prompt $" { + pass "print call overloaded func double arg" + } + -re ".*$gdb_prompt $" { fail "print call overloaded func double arg" } + timeout { fail "(timeout) print call overloaded func double arg" } + } + +# Now some tests to see if we can list overloaded functions properly: + +gdb_test "set listsize 1" "" "" +# send_gdb "set listsize 1\n" +# gdb_expect -re ".*$gdb_prompt $" + +# +# Decide whether to use "()" or "(void)" +# + +send_gdb "info func overloadfnarg\n" +gdb_expect { + -re ".*overloadfnarg\\(void\\).*$gdb_prompt $" { + gdb_test "list foo::overloadfnarg(void)"\ + ".*int foo::overloadfnarg.*\\(void\\).*" \ + "list overloaded function with no args" + } + -re ".*overloadfnarg\\(\\).*$gdb_prompt $" { + gdb_test "list foo::overloadfnarg()"\ + ".*int foo::overloadfnarg.*\\(void\\).*" \ + "list overloaded function with no args" + } + -re ".*$gdb_prompt $" { + fail "list overloaded function with no args (no matching symbol)" + } +} + +gdb_test "list foo::overloadfnarg(int)"\ + "int foo::overloadfnarg.*\\(int arg\\).*" \ + "list overloaded function with int arg" + +gdb_test "list foo::overloadfnarg(int, int (*)(int))" \ + "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \ + "list overloaded function with function ptr args" + +# This one crashes GDB. Don't know why yet. +gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \ + "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \ + "list overloaded function with function ptr args - quotes around argument" + +gdb_test "print intToChar(1)" ".\[0-9\]* = 297" diff --git a/gdb/testsuite/gdb.c++/ovldbreak.cc b/gdb/testsuite/gdb.c++/ovldbreak.cc new file mode 100644 index 0000000..9a5b5cb --- /dev/null +++ b/gdb/testsuite/gdb.c++/ovldbreak.cc @@ -0,0 +1,177 @@ +#include + +class foo { +public: + foo (int); + foo (int, const char *); + foo (foo&); + ~foo (); + void foofunc (int); + void foofunc (int, signed char *); + int ifoo; + const char *ccpfoo; + +int overload1arg (void); +int overload1arg (char); +int overload1arg (signed char); +int overload1arg (unsigned char); +int overload1arg (short); +int overload1arg (unsigned short); +int overload1arg (int); +int overload1arg (unsigned int); +int overload1arg (long); +int overload1arg (unsigned long); +int overload1arg (float); +int overload1arg (double); + +int overloadargs (int a1); +int overloadargs (int a1, int a2); +int overloadargs (int a1, int a2, int a3); +int overloadargs (int a1, int a2, int a3, int a4); +int overloadargs (int a1, int a2, int a3, int a4, int a5); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10); +int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10, int a11); + + +}; + +void marker1() +{} + +int main () +{ + char arg2 = 2; + signed char arg3 =3; + unsigned char arg4 =4; + short arg5 =5; + unsigned short arg6 =6; + int arg7 =7; + unsigned int arg8 =8; + long arg9 =9; + unsigned long arg10 =10; + float arg11 =100.0; + double arg12 = 200.0; + + char ch='A'; + foo foo_instance1(111); + foo foo_instance2(222, &ch); + foo foo_instance3(foo_instance2); + + foo_instance1.overload1arg(); + foo_instance1.overload1arg(arg2); + foo_instance1.overload1arg(arg3); + foo_instance1.overload1arg(arg4); + foo_instance1.overload1arg(arg5); + foo_instance1.overload1arg(arg6); + foo_instance1.overload1arg(arg7); + foo_instance1.overload1arg(arg8); + foo_instance1.overload1arg(arg9); + foo_instance1.overload1arg(arg10); + foo_instance1.overload1arg(arg11); + foo_instance1.overload1arg(arg12); + + foo_instance1.overloadargs(1); + foo_instance1.overloadargs(1, 2); + foo_instance1.overloadargs(1, 2, 3); + foo_instance1.overloadargs(1, 2, 3, 4); + foo_instance1.overloadargs(1, 2, 3, 4, 5); + foo_instance1.overloadargs(1, 2, 3, 4, 5, 6); + foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7); + foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8); + foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9); + foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + + + #ifdef usestubs + set_debug_traps(); + breakpoint(); + #endif + + + marker1(); + return 0; +} + +foo::foo (int i) { ifoo = i;} +foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; } +foo::foo (foo& afoo) { ifoo = afoo.ifoo; ccpfoo = afoo.ccpfoo;} +foo::~foo () {} + + +/* Some functions to test overloading by varying one argument type. */ + +int foo::overload1arg (void) { return 1; } +int foo::overload1arg (char arg) { arg = 0; return 2;} +int foo::overload1arg (signed char arg) { arg = 0; return 3;} +int foo::overload1arg (unsigned char arg) { arg = 0; return 4;} +int foo::overload1arg (short arg) { arg = 0; return 5;} +int foo::overload1arg (unsigned short arg) { arg = 0; return 6;} +int foo::overload1arg (int arg) { arg = 0; return 7;} +int foo::overload1arg (unsigned int arg) { arg = 0; return 8;} +int foo::overload1arg (long arg) { arg = 0; return 9;} +int foo::overload1arg (unsigned long arg) { arg = 0; return 10;} +int foo::overload1arg (float arg) { arg = 0; return 11;} +int foo::overload1arg (double arg) { arg = 0; return 12;} + + +/* Some functions to test overloading by varying argument count. */ + +int foo::overloadargs (int a1) +{ a1 = 0; +return 1;} + +int foo::overloadargs (int a1, int a2) +{ a1 = a2 = 0; +return 2;} + +int foo::overloadargs (int a1, int a2, int a3) +{ a1 = a2 = a3 = 0; +return 3;} + +int foo::overloadargs (int a1, int a2, int a3, int a4) +{ a1 = a2 = a3 = a4 = 0; +return 4;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5) +{ a1 = a2 = a3 = a4 = a5 = 0; +return 5;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6) +{ a1 = a2 = a3 = a4 = a5 = a6 = 0; +return 6;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7) +{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0; +return 7;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8) +{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0; +return 8;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9) +{ + a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0; + return 9; +} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = + a10 = 0; return 10;} + +int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int a10, int a11) + { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = + a10 = a11 = 0; return 11;} + + + diff --git a/gdb/testsuite/gdb.c++/ovldbreak.exp b/gdb/testsuite/gdb.c++/ovldbreak.exp new file mode 100644 index 0000000..043243d --- /dev/null +++ b/gdb/testsuite/gdb.c++/ovldbreak.exp @@ -0,0 +1,360 @@ +# Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# written by Elena Zannoni (ezannoni@cygnus.com) +# modified by Michael Chastain (chastain@redhat.com) + +# This file is part of the gdb testsuite +# +# tests for overloaded member functions. Set breakpoints on +# overloaded member functions +# + + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "ovldbreak" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + + + +# When I ask gdb to set a breakpoint on an overloaded function, +# gdb gives me a choice menu. I might get stuck in that choice menu +# (for example, if C++ name mangling is not working properly). +# +# This procedure issues a command that works at either the menu +# prompt or the command prompt to get back to the command prompt. +# +# Note that an empty line won't do it (it means 'repeat the previous command' +# at top level). A line with a single space in it works nicely. + +proc take_gdb_out_of_choice_menu {} { + global gdb_prompt + send_gdb " \n" + gdb_expect { + -re ".*$gdb_prompt $" { + } + timeout { + perror "could not resynchronize to command prompt (timeout)" + continue + } + } +} + + + +# This procedure sets an overloaded breakpoint. +# When I ask for such a breakpoint, gdb gives me a menu of 'cancel' 'all' +# and a bunch of choices. I then choose from that menu by number. + +proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} { + global gdb_prompt hex srcfile + + # Get into the overload menu. + send_gdb "break $name\n" + gdb_expect { + -re "$expectedmenu" { + pass "bp menu for $name choice $mychoice" + + # Choose my choice. + send_gdb "$mychoice\n" + gdb_expect { + -re "Breakpoint $bpnumber at $hex: file.*$srcfile, line $linenumber.\r\n$gdb_prompt $" { + pass "set bp $bpnumber on $name $mychoice line $linenumber" + } + -re ".*$gdb_prompt $" { + fail "set bp $bpnumber on $name $mychoice line $linenumber (bad bp)" + } + timeout { + fail "set bp $bpnumber on $name $mychoice line $linenumber (timeout)" + take_gdb_out_of_choice_menu + } + } + } + -re ".*\r\n> " { + fail "bp menu for $name choice $mychoice (bad menu)" + take_gdb_out_of_choice_menu + } + -re ".*$gdb_prompt $" { + fail "bp menu for $name choice $mychoice (no menu)" + } + timeout { + fail "bp menu for $name choice $mychoice (timeout)" + take_gdb_out_of_choice_menu + } + } +} + +# This is the expected menu for overload1arg. +# Note the arg type variations on lines 6 and 13. +# This accommodates different versions of g++. + +set menu_overload1arg "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n> $" + + + +# Set breakpoints on foo::overload1arg, one by one. + +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 12 2 111 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 11 3 112 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 10 4 113 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 9 5 114 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 8 6 115 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 7 7 116 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 6 8 117 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 5 9 118 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 4 10 119 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 3 11 120 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 2 12 121 +set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 110 + + + +# Verify the breakpoints. + +gdb_test "info break" \ + "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r +\[\t \]+breakpoint already hit 1 time\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ + "breakpoint info (after setting one-by-one)" + + + +# Test choice "cancel". +# This is copy-and-paste from set_bp_overloaded. + +send_gdb "break foo::overload1arg\n" +gdb_expect { + -re "$menu_overload1arg" { + pass "bp menu for foo::overload1arg choice cancel" + # Choose cancel. + send_gdb "0\n" + gdb_expect { + -re "canceled\r\n$gdb_prompt $" { + pass "set bp on overload1arg canceled" + } + -re "cancelled\r\n$gdb_prompt $" { + pass "set bp on overload1arg canceled" + } + -re ".*$gdb_prompt $" { + fail "set bp on overload1arg canceled (bad message)" + } + timeout { + fail "set bp on overload1arg canceled (timeout)" + take_gdb_out_of_choice_menu + } + } + } + -re ".*\r\n> " { + fail "bp menu for foo::overload1arg choice cancel (bad menu)" + take_gdb_out_of_choice_menu + } + -re ".*$gdb_prompt $" { + fail "bp menu for foo::overload1arg choice cancel (no menu)" + } + timeout { + fail "bp menu for foo::overload1arg choice cancel (timeout)" + take_gdb_out_of_choice_menu + } +} + +gdb_test "info break" \ + "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r +\[\t \]+breakpoint already hit 1 time\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ + "breakpoint info (after cancel)" + + + +# Delete these breakpoints. + +send_gdb "delete breakpoints\n" +gdb_expect { + -re "Delete all breakpoints.* $" { + send_gdb "y\n" + gdb_expect { + -re ".*$gdb_prompt $" { + pass "delete all breakpoints" + } + timeout { + fail "delete all breakpoints (timeout)" + } + } + } + timeout { + fail "delete all breakpoints (timeout)" + } +} + +gdb_test "info breakpoints" "No breakpoints or watchpoints." "breakpoint info (after delete)" + + + +# Test choice "all". +# This is copy-and-paste from set_bp_overloaded. + +send_gdb "break foo::overload1arg\n" +gdb_expect { + -re "$menu_overload1arg" { + pass "bp menu for foo::overload1arg choice all" + # Choose all. + send_gdb "1\n" + gdb_expect { + -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nwarning: Multiple breakpoints were set.\r\nwarning: Use the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" { + pass "set bp on overload1arg all" + } + -re ".*$gdb_prompt $" { + fail "set bp on overload1arg all (bad message)" + } + timeout { + fail "set bp on overload1arg all (timeout)" + take_gdb_out_of_choice_menu + } + } + } + -re ".*\r\n> " { + fail "bp menu for foo::overload1arg choice all (bad menu)" + take_gdb_out_of_choice_menu + } + -re ".*$gdb_prompt $" { + fail "bp menu for foo::overload1arg choice all (no menu)" + } + timeout { + fail "bp menu for foo::overload1arg choice all (timeout)" + take_gdb_out_of_choice_menu + } +} + +gdb_test "info break" \ + "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ + "breakpoint info (after setting on all)" + + + +# Run through each breakpoint. + +# NOTE: carlton/2003-02-03: I'm seeing failures on some of the tests, +# with the wrong arg being printed out. Michael Chastain sees +# failures at times, too, albeit fewer than I do. + +proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} { + global gdb_prompt hex decimal srcfile + + send_gdb "continue\n" + gdb_expect { + -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { + pass "continue to bp overloaded : ${argtype}" + } + -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { + if $might_kfail { + kfail "gdb/1025" "continue to bp overloaded : ${argtype}" + } else { + fail "continue to bp overloaded : ${argtype}" + } + } + -re ".*$gdb_prompt $" { + fail "continue to bp overloaded : ${argtype}" + } + timeout { + fail "continue to bp overloaded : ${argtype} (timeout)" + } + } +} + +continue_to_bp_overloaded 0 25 "(void|)" "" +continue_to_bp_overloaded 1 24 "char" "arg=2 \\'\\\\002\\'" +continue_to_bp_overloaded 1 23 "signed char" "arg=3 \\'\\\\003\\'" +continue_to_bp_overloaded 1 22 "unsigned char" "arg=4 \\'\\\\004\\'" +continue_to_bp_overloaded 1 21 "short" "arg=5" +continue_to_bp_overloaded 1 20 "unsigned short" "arg=6" +continue_to_bp_overloaded 0 19 "int" "arg=7" +continue_to_bp_overloaded 0 18 "(unsigned|unsigned int)" "arg=8" +continue_to_bp_overloaded 0 17 "long" "arg=9" +continue_to_bp_overloaded 0 16 "unsigned long" "arg=10" +continue_to_bp_overloaded 0 15 "float" "arg=100" +continue_to_bp_overloaded 1 14 "double" "arg=200" + + + +# That's all, folks. + +gdb_continue_to_end "finish program" diff --git a/gdb/testsuite/gdb.c++/pr-1023.cc b/gdb/testsuite/gdb.c++/pr-1023.cc new file mode 100644 index 0000000..7583084 --- /dev/null +++ b/gdb/testsuite/gdb.c++/pr-1023.cc @@ -0,0 +1,20 @@ +class myClass +{ + public: + myClass() {}; + ~myClass() {}; + void performUnblocking( short int cell_index ); + void performBlocking( int cell_index ); +}; + +void myClass::performUnblocking( short int cell_index ) {} + +void myClass::performBlocking( int cell_index ) {} + +int main () +{ + myClass mc; + mc.performBlocking (0); + mc.performUnblocking (0); +} + diff --git a/gdb/testsuite/gdb.c++/pr-1023.exp b/gdb/testsuite/gdb.c++/pr-1023.exp new file mode 100644 index 0000000..c8c9802 --- /dev/null +++ b/gdb/testsuite/gdb.c++/pr-1023.exp @@ -0,0 +1,79 @@ +# Copyright 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for PR gdb/1023. +# 2003-02-03 Michael Chastain + +# This file is part of the gdb testsuite. + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "pr-1023" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "break myClass::performBlocking\n" +gdb_expect { + -re "Breakpoint $decimal at $hex: file .*$srcfile, line 12.*$gdb_prompt $" { + pass "break myClass::performBlocking" + } + -re "the class myClass does not have any method named performBlocking.*$gdb_prompt $" { + # fails with gcc 2.95.3 -gstabs+, native i686-pc-linux-gnu + # -- chastain 2003-02-03 + kfail "gdb/1023" "break myClass::performBlocking" + } + -re ".*$gdb_prompt $" { + fail "break myClass::performBlocking" + } + timeout { + fail "break myClass::performBlocking (timeout)" + } +} + +gdb_test \ + "break myClass::performUnblocking" \ + "Breakpoint $decimal at $hex: file .*$srcfile, line 10.*" + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/pr-574.cc b/gdb/testsuite/gdb.c++/pr-574.cc new file mode 100644 index 0000000..eb06b61 --- /dev/null +++ b/gdb/testsuite/gdb.c++/pr-574.cc @@ -0,0 +1,22 @@ +/* + An attempt to replicate PR gdb/574 with a shorter program. + + Printing out *theB failed if the program was compiled with GCC 2.95. +*/ + +class A { +public: + virtual void foo() {}; // Stick in a virtual function. + int a; // Stick in a data member. +}; + +class B : public A { + static int b; // Stick in a static data member. +}; + +int main() +{ + B *theB = new B; + + return 0; // breakpoint: constructs-done +} diff --git a/gdb/testsuite/gdb.c++/pr-574.exp b/gdb/testsuite/gdb.c++/pr-574.exp new file mode 100644 index 0000000..5beacd1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/pr-574.exp @@ -0,0 +1,72 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for the bug mentioned in PR gdb/574. It's a bit +# idiosyncratic, so I gave it its own file. + +# 2002-08-16 David Carlton + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "pr-574" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed the object: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + +# This failed, as long as the code was compiled with GCC v. 2. + +# Different compilers order the data for differently, so I'm not +# matching the result exactly. + +gdb_test "print *theB" "\\$\[0-9\]* = { = {\[^}\]*}, static b = }" "PR gdb/574" + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/printmethod.cc b/gdb/testsuite/gdb.c++/printmethod.cc new file mode 100644 index 0000000..d32e1b1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/printmethod.cc @@ -0,0 +1,14 @@ +/* Create some objects, and try to print out their methods. */ + +class A { +public: + virtual void virt() {}; + void nonvirt() {}; +}; + +int main() +{ + A *theA = new A; + + return 0; // breakpoint: constructs-done +} diff --git a/gdb/testsuite/gdb.c++/printmethod.exp b/gdb/testsuite/gdb.c++/printmethod.exp new file mode 100644 index 0000000..a45393f --- /dev/null +++ b/gdb/testsuite/gdb.c++/printmethod.exp @@ -0,0 +1,69 @@ +# Copyright 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This tries to print out methods of classes. + +# 2002-08-16 David Carlton + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "printmethod" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed the object: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + +# The first of these is for PR gdb/653. + +gdb_test "print theA->virt" "\\$\[0-9\]* = &A::virt\\((void|)\\)" "print virtual method." +gdb_test "print theA->nonvirt" "Cannot take address of a method" "print nonvirtual method." + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/psmang.exp b/gdb/testsuite/gdb.c++/psmang.exp new file mode 100644 index 0000000..31dd346 --- /dev/null +++ b/gdb/testsuite/gdb.c++/psmang.exp @@ -0,0 +1,226 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file is part of the gdb testsuite + +# Looking up methods by name, in programs with multiple compilation units. + +# ====== PLEASE BE VERY CAREFUL WHEN CHANGING THIS TEST. ===== +# +# The bug we're testing for (circa October 2002) is very sensitive to +# various conditions that are hard to control directly in the test +# suite. If you change the test, please revert this change, and make +# sure the test still fails: +# +# 2002-08-29 Jim Blandy +# +# * symtab.c (lookup_symbol_aux): In the cases where we find a +# minimal symbol of an appropriate name and use its address to +# select a symtab to read and search, use `name' (as passed to us) +# as the demangled name when searching the symtab's global and +# static blocks, not the minsym's name. +# +# The original bug was that you'd try to set a breakpoint on a method +# (e.g., `break s::method1'), and you'd get an error, but if you +# repeated the command, it would work the second time: +# +# (gdb) break s::method1 +# the class s does not have any method named method1 +# Hint: try 's::method1 or 's::method1 +# (Note leading single quote.) +# (gdb) break s::method1 +# Breakpoint 1 at 0x804841b: file psmang1.cc, line 13. +# (gdb) +# +# We observed this bug first using Stabs, and then using Dwarf 2. +# +# The problem was in lookup_symbol_aux: when looking up s::method1, it +# would fail to find it in any symtabs, find the minsym with the +# corresponding mangled name (say, `_ZN1S7method1Ev'), pass the +# minsym's address to find_pc_sect_symtab to look up the symtab +# (causing the compilation unit's full symbols to be read in), and +# then look up the symbol in that symtab's global block. All that is +# correct. However, it would pass the minsym's name as the NAME +# argument to lookup_block_symbol; a minsym's name is mangled, whereas +# lookup_block_symbol's NAME argument should be demangled. +# +# This is a pretty simple bug, but it turns out to be a bear to +# construct a test for. That's why this test case is so delicate. If +# you can see how to make it less so, please contribute a patch. +# +# Here are the twists: +# +# The bug only manifests itself when we call lookup_symbol to look up +# a method name (like "s::method1" or "s::method2"), and that method's +# definition is in a compilation unit for which we have read partial +# symbols, but not full symbols. The partial->full conversion must be +# caused by that specific lookup. (If we already have full symbols +# for the method's compilation unit, we won't need to look up the +# minsym, find the symtab for the minsym's address, and then call +# lookup_block_symbol; it's that last call where things go awry.) +# +# Now, when asked to set a breakpoint at `s::method1', GDB will first +# look up `s' to see if that is, in fact, the name of a class, and +# then look up 's::method1'. So we have to make sure that looking up +# `s' doesn't cause full symbols to be read for the compilation unit +# containing the definition of `s::method1'. +# +# The partial symbol tables for `psmang1.cc' and `psmang2.cc' will +# both have entries for `s'; GDB will read full symbols for whichever +# compilation unit's partial symbol table appears first in the +# objfile's list. The order in which compilation units appear in the +# partial symbol table list depends on how the program is linked, and +# how the debug info reader does the partial symbol scan. Ideally, +# the test shouldn't rely on them appearing in any particular order. +# +# So, since we don't know which compilation unit's full symbols are +# going to get read, we simply try looking up one method from each of +# the two compilation units. One of them has to come after the other +# in the partial symbol table list, so whichever comes later will +# still need its partial symbols read by the time we go to look up +# 's::methodX'. +# +# Second twist: don't move the common definition of `struct s' into a +# header file. If the compiler emits identical stabs for the +# #inclusion of that header file into psmang1.cc and into psmang2.cc, +# then the linker will do stabs compression, and replace one of the +# BINCL/EINCL regions with an EXCL stab, pointing to the other +# BINCL/EINCL region. GDB will read this, and record that the +# compilation unit that got the EXCL depends on the compilation unit +# that kept the BINCL/EINCL. Then, when it decides it needs to read +# full symbols for the former, it'll also read full symbols for the +# latter. Now, if it just so happens that the compilation unit that +# got the EXCL is also the first one with a definition of `s' in the +# partial symbol table list, then that first probe for `s' will cause +# both compilation units' full symbols to be read --- again defeating +# the test. +# +# We could work around this by having three compilation units, or by +# ensuring that the header file produces different stabs each time +# it's #included, but it seems simplest just to avoid compilation unit +# dependencies altogether, drop the header file, and duplicate the +# (pretty trivial) struct definition. +# +# Note that #including any header file at all into both compilation +# units --- say, --- could create this sort of dependency. +# +# This is the aspect of the test which the debug format is most likely +# to affect, I think. The different formats create different kinds of +# inter-CU dependencies, which could mask the bug. It might be +# possible for the test to check that at least one of the partial +# symtabs remains unread, and fail otherwise --- the failure +# indicating that the test itself isn't going to catch the bug it was +# meant to, not that GDB is misbehaving. +# +# Third twist: given the way lookup_block_symbol is written, it's +# possible to find the symbol even when it gets passed a mangled name +# for its NAME parameter. There are three ways lookup_block_symbol +# might search a block, depending on how it was constructed: +# +# linear search. In this case, this bug will never manifest itself, +# since we check every symbol against NAME using SYMBOL_MATCHES_NAME. +# Since that macro checks its second argument (NAME) against both the +# mangled and demangled names of the symbol, this will always find the +# symbol successfully, so, no bug. +# +# hash table. If both the mangled and demangled names hash to the +# same bucket, then you'll again find the symbol "by accident", since +# we search the entire bucket using SYMBOL_SOURCE_NAME. Since GDB +# chooses the number of buckets based on the number of symbols, small +# compilation units may have only one hash bucket; in this case, the +# search always succeeds, even though we hashed on the wrong name. +# This test works around that by having a lot of dummy variables, +# making it less likely that the mangled and demangled names fall in +# the same bucket. +# +# binary search. (GDB 5.2 produced these sorts of blocks, and this +# test tries to detect the bug there, but subsequent versions of GDB +# almost never build them, and they may soon be removed entirely.) In +# this case, the symbols in the block are sorted by their +# SYMBOL_SOURCE_NAME (whose behavior depends on the current demangling +# setting, so that's wrong, but let's try to stay focussed). +# lookup_block_symbol does a binary search comparing NAME with +# SYMBOL_SOURCE_NAME until the range has been narrowed down to only a +# few symbols; then it starts a linear search forward from the lower +# end of that range, until it reaches a symbol whose +# SYMBOL_SOURCE_NAME follows NAME in lexicographic order. This means +# that, if you're doing a binary search for a mangled name in a block +# sorted by SYMBOL_SOURCE_NAME, you might find the symbol `by +# accident' if the mangled and demangled names happen to fall near +# each other in the ordering. The initial version of this patch used +# a class called `S'; all the other symbols in the compilation unit +# started with lower-case letters, so the demangled name `S::method1' +# sorted at the same place as the mangled name `_ZN1S7method1Ev': at +# the very beginning. Using a lower-case 's' as the name ensures that +# the demangled name falls after all the dummy symbols introduced for +# the hash table, as described above. +# +# This is all so tortured, someone will probably come up with still +# other ways this test could fail to do its job. If you need to make +# revisions, please be very careful. + +if $tracelevel then { + strace $tracelevel +} + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "psmang" +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { [gdb_compile "${srcdir}/${subdir}/${testfile}1.cc" "${testfile}1.o" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${testfile}2.cc" "${testfile}2.o" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${testfile}1.o ${testfile}2.o" ${binfile} executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "break s::method1" "Breakpoint .* at .*: file .*psmang1.cc.*" + +# We have to exit and restart GDB here, to make sure that all the +# compilation units are psymtabs again. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "break s::method2" "Breakpoint .* at .*: file .*psmang2.cc.*" diff --git a/gdb/testsuite/gdb.c++/psmang1.cc b/gdb/testsuite/gdb.c++/psmang1.cc new file mode 100644 index 0000000..19a9283 --- /dev/null +++ b/gdb/testsuite/gdb.c++/psmang1.cc @@ -0,0 +1,159 @@ +/* Do not move this definition into a header file! See the comments + in psmang.exp. */ +struct s +{ + int value; + void method1 (void); + void method2 (void); +}; + +void +s::method1 () +{ + value = 42; +} + +int +main (int argc, char **argv) +{ + s si; + + si.method1 (); + si.method2 (); +} + + +/* The presence of these variables ensures there will be so many + symbols in psmang1.cc's symtab's global block that it will have a + non-trivial hash table. When there are only a very few symbols, + the block only has one hash bucket, so even if we compute the hash + value for the wrong symbol name, we'll still find a symbol that + matches. */ +int ax; +int bx; +int a1x; +int b1x; +int a2x; +int b2x; +int a12x; +int b12x; +int a3x; +int b3x; +int a13x; +int b13x; +int a23x; +int b23x; +int a123x; +int b123x; +int a4x; +int b4x; +int a14x; +int b14x; +int a24x; +int b24x; +int a124x; +int b124x; +int a34x; +int b34x; +int a134x; +int b134x; +int a234x; +int b234x; +int a1234x; +int b1234x; +int a5x; +int b5x; +int a15x; +int b15x; +int a25x; +int b25x; +int a125x; +int b125x; +int a35x; +int b35x; +int a135x; +int b135x; +int a235x; +int b235x; +int a1235x; +int b1235x; +int a45x; +int b45x; +int a145x; +int b145x; +int a245x; +int b245x; +int a1245x; +int b1245x; +int a345x; +int b345x; +int a1345x; +int b1345x; +int a2345x; +int b2345x; +int a12345x; +int b12345x; +int a6x; +int b6x; +int a16x; +int b16x; +int a26x; +int b26x; +int a126x; +int b126x; +int a36x; +int b36x; +int a136x; +int b136x; +int a236x; +int b236x; +int a1236x; +int b1236x; +int a46x; +int b46x; +int a146x; +int b146x; +int a246x; +int b246x; +int a1246x; +int b1246x; +int a346x; +int b346x; +int a1346x; +int b1346x; +int a2346x; +int b2346x; +int a12346x; +int b12346x; +int a56x; +int b56x; +int a156x; +int b156x; +int a256x; +int b256x; +int a1256x; +int b1256x; +int a356x; +int b356x; +int a1356x; +int b1356x; +int a2356x; +int b2356x; +int a12356x; +int b12356x; +int a456x; +int b456x; +int a1456x; +int b1456x; +int a2456x; +int b2456x; +int a12456x; +int b12456x; +int a3456x; +int b3456x; +int a13456x; +int b13456x; +int a23456x; +int b23456x; +int a123456x; +int b123456x; diff --git a/gdb/testsuite/gdb.c++/psmang2.cc b/gdb/testsuite/gdb.c++/psmang2.cc new file mode 100644 index 0000000..b9b1bb5 --- /dev/null +++ b/gdb/testsuite/gdb.c++/psmang2.cc @@ -0,0 +1,152 @@ +#include + +/* Do not move this definition into a header file! See the comments + in psmang.exp. */ +struct s +{ + int value; + void method1 (void); + void method2 (void); +}; + +void +s::method2 (void) +{ + printf ("%d\n", value); +} + + +/* The presence of these variables ensures there will be so many + symbols in psmang2.cc's symtab's global block that it will have a + non-trivial hash table. When there are only a very few symbols, + the block only has one hash bucket, so even if we compute the hash + value for the wrong symbol name, we'll still find a symbol that + matches. */ +int a; +int b; +int a1; +int b1; +int a2; +int b2; +int a12; +int b12; +int a3; +int b3; +int a13; +int b13; +int a23; +int b23; +int a123; +int b123; +int a4; +int b4; +int a14; +int b14; +int a24; +int b24; +int a124; +int b124; +int a34; +int b34; +int a134; +int b134; +int a234; +int b234; +int a1234; +int b1234; +int a5; +int b5; +int a15; +int b15; +int a25; +int b25; +int a125; +int b125; +int a35; +int b35; +int a135; +int b135; +int a235; +int b235; +int a1235; +int b1235; +int a45; +int b45; +int a145; +int b145; +int a245; +int b245; +int a1245; +int b1245; +int a345; +int b345; +int a1345; +int b1345; +int a2345; +int b2345; +int a12345; +int b12345; +int a6; +int b6; +int a16; +int b16; +int a26; +int b26; +int a126; +int b126; +int a36; +int b36; +int a136; +int b136; +int a236; +int b236; +int a1236; +int b1236; +int a46; +int b46; +int a146; +int b146; +int a246; +int b246; +int a1246; +int b1246; +int a346; +int b346; +int a1346; +int b1346; +int a2346; +int b2346; +int a12346; +int b12346; +int a56; +int b56; +int a156; +int b156; +int a256; +int b256; +int a1256; +int b1256; +int a356; +int b356; +int a1356; +int b1356; +int a2356; +int b2356; +int a12356; +int b12356; +int a456; +int b456; +int a1456; +int b1456; +int a2456; +int b2456; +int a12456; +int b12456; +int a3456; +int b3456; +int a13456; +int b13456; +int a23456; +int b23456; +int a123456; +int b123456; diff --git a/gdb/testsuite/gdb.c++/ref-types.cc b/gdb/testsuite/gdb.c++/ref-types.cc new file mode 100644 index 0000000..23cc510 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ref-types.cc @@ -0,0 +1,79 @@ +int main2(void); + +void marker1 (void) +{ + +} + + + +int main(void) +{ + short s; + short &rs = s; + short *ps; + short *&rps = ps; + short as[4]; + short (&ras)[4] = as; + s = -1; + ps = &s; + as[0] = 0; + as[1] = 1; + as[2] = 2; + as[3] = 3; + + #ifdef usestubs + set_debug_traps(); + breakpoint(); + #endif + marker1(); + + main2(); + + return 0; +} + +int f() +{ + int f1; + f1 = 1; + return f1; +} + +int main2(void) +{ + char C; + unsigned char UC; + short S; + unsigned short US; + int I; + unsigned int UI; + long L; + unsigned long UL; + float F; + double D; + char &rC = C; + unsigned char &rUC = UC; + short &rS = S; + unsigned short &rUS = US; + int &rI = I; + unsigned int &rUI = UI; + long &rL = L; + unsigned long &rUL = UL; + float &rF = F; + double &rD = D; + C = 'A'; + UC = 21; + S = -14; + US = 7; + I = 102; + UI = 1002; + L = -234; + UL = 234; + F = 1.25E10; + D = -1.375E-123; + I = f(); + + return 0; + +} diff --git a/gdb/testsuite/gdb.c++/ref-types.exp b/gdb/testsuite/gdb.c++/ref-types.exp new file mode 100644 index 0000000..dd06f02 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ref-types.exp @@ -0,0 +1,663 @@ +# Tests for reference types with short type variables in GDB. +# Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# written by Elena Zannoni (ezannoni@cygnus.com) + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +if { [skip_cplus_tests] } { continue } + +set testfile "ref-types" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +if ![runto 'marker1'] then { + perror "couldn't run to marker1" + continue +} + +gdb_test "up" ".*main.*" "up from marker1 1" + +proc gdb_start_again {} { + global srcdir + global subdir + global binfile + global gdb_prompt + global decimal + + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + + source ${binfile}.ci + + # + # set it up at a breakpoint so we can play with the variable values + # + if ![runto_main] then { + perror "couldn't run to breakpoint" + continue + } + + if ![runto 'marker1'] then { + perror "couldn't run to marker1" + continue + } + + gdb_test "up" ".*main.*" "up from marker1 2" +} + + + +send_gdb "print s\n" +gdb_expect { + -re ".\[0-9\]* = -1.*$gdb_prompt $" { + pass "print value of s" + } + -re ".*$gdb_prompt $" { fail "print value of s" } + timeout { fail "(timeout) print value of s" } + } + + +send_gdb "ptype s\n" +gdb_expect { + -re "type = short.*$gdb_prompt $" { pass "ptype s" } + -re ".*$gdb_prompt $" { fail "ptype s" } + timeout { fail "(timeout) ptype s" } +} + + +send_gdb "print *ps\n" +gdb_expect { + -re ".\[0-9\]* = -1.*$gdb_prompt $" { + pass "print value of ps" + } + -re ".*$gdb_prompt $" { fail "print value of ps" } + timeout { fail "(timeout) print value of ps" } + } + + +send_gdb "ptype ps\n" +gdb_expect { + -re "type = short \*.*$gdb_prompt $" { pass "ptype ps" } + -re ".*$gdb_prompt $" { fail "ptype ps" } + timeout { fail "(timeout) ptype ps" } +} + +send_gdb "print as\[0\]\n" +gdb_expect { + -re ".\[0-9\]* = 0.*$gdb_prompt $" { + pass "print value of as\[0\]" + } + -re ".*$gdb_prompt $" { fail "print value of as\[0\]" } + timeout { fail "(timeout) print value of as\[0\]" } + } + + +send_gdb "ptype as\n" +gdb_expect { + -re "type = short \\\[4\\\].*$gdb_prompt $" { pass "ptype as" } + -re "type = short int \\\[4\\\].*$gdb_prompt $" { pass "ptype as" } + -re ".*$gdb_prompt $" { fail "ptype as" } + timeout { fail "(timeout) ptype as" } +} + +send_gdb "print as\[1\]\n" +gdb_expect { + -re ".\[0-9\]* = 1.*$gdb_prompt $" { + pass "print value of as\[1\]" + } + -re ".*$gdb_prompt $" { fail "print value of as\[1\]" } + timeout { fail "(timeout) print value of as\[1\]" } + } + +send_gdb "print as\[2\]\n" +gdb_expect { + -re ".\[0-9\]* = 2.*$gdb_prompt $" { + pass "print value of as\[2\]" + } + -re ".*$gdb_prompt $" { fail "print value of as\[2\]" } + timeout { fail "(timeout) print value of as\[2\]" } + } + +send_gdb "print as\[3\]\n" +gdb_expect { + -re ".\[0-9\]* = 3.*$gdb_prompt $" { + pass "print value of as\[3\]" + } + -re ".*$gdb_prompt $" { fail "print value of as\[3\]" } + timeout { fail "(timeout) print value of as\[3\]" } + } + +send_gdb "print rs\n" +gdb_expect { + -re ".\[0-9\]* = \\(short &\\) @$hex: -1.*$gdb_prompt $" { + pass "print value of rs" + } + -re ".\[0-9\]* = \\(short int &\\) @$hex: -1.*$gdb_prompt $" { + pass "print value of rs" + } + -re ".*$gdb_prompt $" { fail "print value of rs" } + timeout { fail "(timeout) print value of rs" } + eof { fail "print rs ($GDB dumped core) (FIXME)" ; gdb_start_again ; } + + } + +send_gdb "ptype rs\n" +gdb_expect { + -re "type = short &.*$gdb_prompt $" { pass "ptype rs" } + -re "type = short int &.*$gdb_prompt $" { pass "ptype rs" } + -re ".*$gdb_prompt $" { fail "ptype rs" } + timeout { fail "(timeout) ptype rs" } +} + + +send_gdb "print *rps\n" +gdb_expect { + -re ".\[0-9\]* = -1.*$gdb_prompt $" { + pass "print value of *rps" + } + -re ".*$gdb_prompt $" { fail "print value of *rps" } + timeout { fail "(timeout) print value of *rps" } + } + + +send_gdb "ptype rps\n" +gdb_expect { + -re "type = short \\*&.*$gdb_prompt $" { pass "ptype rps" } + -re "type = short int \\*&.*$gdb_prompt $" { pass "ptype rps" } + -re ".*$gdb_prompt $" { fail "ptype rps" } + timeout { fail "(timeout) ptype rps" } +} + + + +send_gdb "print ras\[0\]\n" +gdb_expect { + -re ".\[0-9\]* = 0.*$gdb_prompt $" { + pass "print value of ras\[0\]" + } + -re ".*$gdb_prompt $" { fail "print value of ras\[0\]" } + timeout { fail "(timeout) print value of ras\[0\]" } + } + + +send_gdb "ptype ras\n" +gdb_expect { + -re "type = short \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" } + -re "type = short int \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" } + -re ".*$gdb_prompt $" { fail "ptype ras" } + timeout { fail "(timeout) ptype ras" } +} + +send_gdb "print ras\[1\]\n" +gdb_expect { + -re ".\[0-9\]* = 1.*$gdb_prompt $" { + pass "print value of ras\[1\]" + } + -re ".*$gdb_prompt $" { fail "print value of ras\[1\]" } + timeout { fail "(timeout) print value of ras\[1\]" } + } + +send_gdb "print ras\[2\]\n" +gdb_expect { + -re ".\[0-9\]* = 2.*$gdb_prompt $" { + pass "print value of ras\[2\]" + } + -re ".*$gdb_prompt $" { fail "print value of ras\[2\]" } + timeout { fail "(timeout) print value of ras\[2\]" } + } + +send_gdb "print ras\[3\]\n" +gdb_expect { + -re ".\[0-9\]* = 3.*$gdb_prompt $" { + pass "print value of ras\[3\]" + } + -re ".*$gdb_prompt $" { fail "print value of ras\[3\]" } + timeout { fail "(timeout) print value of ras\[3\]" } + } + + +if ![runto 'f'] then { + perror "couldn't run to f" + continue +} + +gdb_test "up" ".main2.*" "up from f" + +send_gdb "print C\n" +gdb_expect { + -re ".\[0-9\]* = 65 \'A\'.*$gdb_prompt $" { + pass "print value of C" + } + -re ".*$gdb_prompt $" { fail "print value of C" } + timeout { fail "(timeout) print value of C" } + } + + +send_gdb "ptype C\n" +gdb_expect { + -re "type = char.*$gdb_prompt $" { pass "ptype C" } + -re ".*$gdb_prompt $" { fail "ptype C" } + timeout { fail "(timeout) ptype C" } +} + + +send_gdb "print UC\n" +gdb_expect { + -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" { + pass "print value of UC" + } + -re ".*$gdb_prompt $" { fail "print value of UC" } + timeout { fail "(timeout) print value of UC" } + } + + +send_gdb "ptype UC\n" +gdb_expect { + -re "type = unsigned char.*$gdb_prompt $" { pass "ptype UC" } + -re ".*$gdb_prompt $" { fail "ptype UC" } + timeout { fail "(timeout) ptype UC" } +} + + +send_gdb "print S\n" +gdb_expect { + -re ".\[0-9\]* = -14.*$gdb_prompt $" { + pass "print value of S" + } + -re ".*$gdb_prompt $" { fail "print value of S" } + timeout { fail "(timeout) print value of S" } + } + + +send_gdb "ptype S\n" +gdb_expect { + -re "type = short.*$gdb_prompt $" { pass "ptype S" } + -re ".*$gdb_prompt $" { fail "ptype S" } + timeout { fail "(timeout) ptype S" } +} + + +send_gdb "print US\n" +gdb_expect { + -re ".\[0-9\]* = 7.*$gdb_prompt $" { + pass "print value of US" + } + -re ".*$gdb_prompt $" { fail "print value of US" } + timeout { fail "(timeout) print value of US" } + } + + +send_gdb "ptype US\n" +gdb_expect { + -re "type = unsigned short.*$gdb_prompt $" { pass "ptype US" } + -re "type = short unsigned.*$gdb_prompt $" { pass "ptype US" } + -re ".*$gdb_prompt $" { fail "ptype US" } + timeout { fail "(timeout) ptype US" } +} + + +send_gdb "print I\n" +gdb_expect { + -re ".\[0-9\]* = 102.*$gdb_prompt $" { + pass "print value of I" + } + -re ".*$gdb_prompt $" { fail "print value of I" } + timeout { fail "(timeout) print value of I" } + } + + +send_gdb "ptype I\n" +gdb_expect { + -re "type = int.*$gdb_prompt $" { pass "ptype I" } + -re ".*$gdb_prompt $" { fail "ptype I" } + timeout { fail "(timeout) ptype I" } +} + + +send_gdb "print UI\n" +gdb_expect { + -re ".\[0-9\]* = 1002.*$gdb_prompt $" { + pass "print value of UI" + } + -re ".*$gdb_prompt $" { fail "print value of UI" } + timeout { fail "(timeout) print value of UI" } + } + + +send_gdb "ptype UI\n" +gdb_expect { + -re "type = unsigned int.*$gdb_prompt $" { pass "ptype UI" } + -re ".*$gdb_prompt $" { fail "ptype UI" } + timeout { fail "(timeout) ptype UI" } +} + + +send_gdb "print L\n" +gdb_expect { + -re ".\[0-9\]* = -234.*$gdb_prompt $" { + pass "print value of L" + } + -re ".*$gdb_prompt $" { fail "print value of L" } + timeout { fail "(timeout) print value of L" } + } + + +send_gdb "ptype L\n" +gdb_expect { + -re "type = long.*$gdb_prompt $" { pass "ptype L" } + -re ".*$gdb_prompt $" { fail "ptype L" } + timeout { fail "(timeout) ptype L" } +} + + +send_gdb "print UL\n" +gdb_expect { + -re ".\[0-9\]* = 234.*$gdb_prompt $" { + pass "print value of UL" + } + -re ".*$gdb_prompt $" { fail "print value of UL" } + timeout { fail "(timeout) print value of UL" } + } + + +send_gdb "ptype UL\n" +gdb_expect { + -re "type = unsigned long.*$gdb_prompt $" { pass "ptype UL" } + -re "type = long unsigned.*$gdb_prompt $" { pass "ptype UL" } + -re ".*$gdb_prompt $" { fail "ptype UL" } + timeout { fail "(timeout) ptype UL" } +} + + +send_gdb "print F\n" +gdb_expect { + -re ".\[0-9\]* = 1.2\[0-9\]*e\\+10.*$gdb_prompt $" { + pass "print value of F" + } + -re ".*$gdb_prompt $" { fail "print value of F" } + timeout { fail "(timeout) print value of F" } + } + + + +send_gdb "ptype F\n" +gdb_expect { + -re "type = float.*$gdb_prompt $" { pass "ptype F" } + -re ".*$gdb_prompt $" { fail "ptype F" } + timeout { fail "(timeout) ptype F" } +} + + +send_gdb "print D\n" +gdb_expect { + -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" { + pass "print value of D" + } + -re ".*$gdb_prompt $" { fail "print value of D" } + timeout { fail "(timeout) print value of D" } + } + + +send_gdb "ptype D\n" +gdb_expect { + -re "type = double.*$gdb_prompt $" { pass "ptype D" } + -re ".*$gdb_prompt $" { fail "ptype D" } + timeout { fail "(timeout) ptype D" } +} + + + +# +# test reference types +# + + + + +send_gdb "ptype rC\n" +gdb_expect { + -re "type = char &.*$gdb_prompt $" { pass "ptype rC" } + -re ".*$gdb_prompt $" { fail "ptype rC" } + timeout { fail "(timeout) ptype rC" } +} + + + + +send_gdb "ptype rUC\n" +gdb_expect { + -re "type = unsigned char &.*$gdb_prompt $" { pass "ptype rUC" } + -re ".*$gdb_prompt $" { fail "ptype rUC" } + timeout { fail "(timeout) ptype rUC" } +} + + + +send_gdb "ptype rS\n" +gdb_expect { + -re "type = short &.*$gdb_prompt $" { pass "ptype rS" } + -re "type = short int &.*$gdb_prompt $" { pass "ptype rS" } + -re ".*$gdb_prompt $" { fail "ptype rS" } + timeout { fail "(timeout) ptype rS" } +} + + + +send_gdb "ptype rUS\n" +gdb_expect { + -re "type = unsigned short &.*$gdb_prompt $" { pass "ptype rUS" } + -re "type = short unsigned int &.*$gdb_prompt $" { pass "ptype rUS" } + -re ".*$gdb_prompt $" { fail "ptype rUS" } + timeout { fail "(timeout) ptype rUS" } +} + + +send_gdb "ptype rI\n" +gdb_expect { + -re "type = int &.*$gdb_prompt $" { pass "ptype rI" } + -re ".*$gdb_prompt $" { fail "ptype rI" } + timeout { fail "(timeout) ptype rI" } +} + + + +send_gdb "ptype rUI\n" +gdb_expect { + -re "type = unsigned int &.*$gdb_prompt $" { pass "ptype rUI" } + -re ".*$gdb_prompt $" { fail "ptype rUI" } + timeout { fail "(timeout) ptype rUI" } +} + + + +send_gdb "ptype rL\n" +gdb_expect { + -re "type = long &.*$gdb_prompt $" { pass "ptype rL" } + -re "type = long int &.*$gdb_prompt $" { pass "ptype rL" } + -re ".*$gdb_prompt $" { fail "ptype rL" } + timeout { fail "(timeout) ptype rL" } +} + + +send_gdb "ptype rUL\n" +gdb_expect { + -re "type = unsigned long &.*$gdb_prompt $" { pass "ptype rUL" } + -re "type = long unsigned int &.*$gdb_prompt $" { pass "ptype rUL" } + -re ".*$gdb_prompt $" { fail "ptype rUL" } + timeout { fail "(timeout) ptype rUL" } +} + + +send_gdb "ptype rF\n" +gdb_expect { + -re "type = float &.*$gdb_prompt $" { pass "ptype rF" } + -re ".*$gdb_prompt $" { fail "ptype rF" } + timeout { fail "(timeout) ptype rF" } +} + + +send_gdb "ptype rD\n" +gdb_expect { + -re "type = double &.*$gdb_prompt $" { pass "ptype rD" } + -re ".*$gdb_prompt $" { fail "ptype rD" } + timeout { fail "(timeout) ptype rD" } +} + + +send_gdb "print rC\n" +gdb_expect { + -re ".\[0-9\]* = \\(char &\\) @$hex: 65 \'A\'.*$gdb_prompt $" { + pass "print value of rC" + } + -re ".*$gdb_prompt $" { fail "print value of rC" } + timeout { fail "(timeout) print value of rC" } + } + + +send_gdb "print rUC\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" { + pass "print value of rUC" + } + -re ".*$gdb_prompt $" { fail "print value of rUC" } + timeout { fail "(timeout) print value of rUC" } + } + + +send_gdb "print rS\n" +gdb_expect { + -re ".\[0-9\]* = \\(short &\\) @$hex: -14.*$gdb_prompt $" { + pass "print value of rS" + } + -re ".\[0-9\]* = \\(short int &\\) @$hex: -14.*$gdb_prompt $" { + pass "print value of rS" + } + -re ".*$gdb_prompt $" { fail "print value of rS" } + timeout { fail "(timeout) print value of rS" } + } + + +send_gdb "print rUS\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned short &\\) @$hex: 7.*$gdb_prompt $" { + pass "print value of rUS" + } + -re ".\[0-9\]* = \\(short unsigned int &\\) @$hex: 7.*$gdb_prompt $" { + pass "print value of rUS" + } + -re ".*$gdb_prompt $" { fail "print value of rUS" } + timeout { fail "(timeout) print value of rUS" } + } + + +send_gdb "print rI\n" +gdb_expect { + -re ".\[0-9\]* = \\(int &\\) @$hex: 102.*$gdb_prompt $" { + pass "print value of rI" + } + -re ".*$gdb_prompt $" { fail "print value of rI" } + timeout { fail "(timeout) print value of rI" } + } + + +send_gdb "print rUI\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned int &\\) @$hex: 1002.*$gdb_prompt $" { + pass "print value of UI" + } + -re ".*$gdb_prompt $" { fail "print value of rUI" } + timeout { fail "(timeout) print value of rUI" } + } + + +send_gdb "print rL\n" +gdb_expect { + -re ".\[0-9\]* = \\(long &\\) @$hex: -234.*$gdb_prompt $" { + pass "print value of rL" + } + -re ".\[0-9\]* = \\(long int &\\) @$hex: -234.*$gdb_prompt $" { + pass "print value of rL" + } + -re ".*$gdb_prompt $" { fail "print value of rL" } + timeout { fail "(timeout) print value of rL" } + } + + + +send_gdb "print rUL\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned long &\\) @$hex: 234.*$gdb_prompt $" { + pass "print value of rUL" + } + -re ".\[0-9\]* = \\(long unsigned int &\\) @$hex: 234.*$gdb_prompt $" { + pass "print value of rUL" + } + -re ".*$gdb_prompt $" { fail "print value of rUL" } + timeout { fail "(timeout) print value of rUL" } + } + + +send_gdb "print rF\n" +gdb_expect { + -re ".\[0-9\]* = \\(float &\\) @$hex: 1.2\[0-9\]*e\\+10.*$gdb_prompt $" { + pass "print value of rF" + } + -re ".*$gdb_prompt $" { fail "print value of rF" } + timeout { fail "(timeout) print value of rF" } + } + + +send_gdb "print rD\n" +gdb_expect { + -re ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*$gdb_prompt $" { + pass "print value of rD" + } + -re ".*$gdb_prompt $" { fail "print value of rD" } + timeout { fail "(timeout) print value of rD" } + } + diff --git a/gdb/testsuite/gdb.c++/rtti.exp b/gdb/testsuite/gdb.c++/rtti.exp new file mode 100644 index 0000000..f99637a --- /dev/null +++ b/gdb/testsuite/gdb.c++/rtti.exp @@ -0,0 +1,127 @@ +# Copyright 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This file is part of the gdb testsuite. + +# This contains tests for GDB's use of RTTI information. This stems +# from a bug reported in PR gdb/488 and other places, which leads to +# statements like 'warning: can't find class named 'C::D', as given by +# C++ RTTI'. It arises from GDB not knowing about classes that are +# defined in namespaces. + +# NOTE: carlton/2003-05-16: I suspect it could arise from nested class +# issues, too, and even once we fix that, there might be situations +# (involving templates, in particular) where this problem triggers +# because GDB and GCC have different ideas what a class is called. + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "rtti" +set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc" +set objfile1 "${objdir}/${subdir}/${testfile}1.o" +set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc" +set objfile2 "${objdir}/${subdir}/${testfile}2.o" +set binfile ${objdir}/${subdir}/${testfile} + +# gdb_get_line_number needs this to be called srcfile. +set srcfile "${srcfile1}" + +if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcfile2}" "${objfile2}" object {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${objfile1} ${objfile2}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# First, run to after we've constructed the object: + +gdb_breakpoint [gdb_get_line_number "constructs-done"] +gdb_continue_to_breakpoint "end of constructors" + +gdb_test_multiple "print *e1" "print *e1" { + -re "warning: can't find class named `n1::D1', as given by C\\+\\+ RTTI.*$gdb_prompt $" { + kfail "gdb/488" "print *e1" + } + -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" { + pass "print *e1" + } + -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" { + # NOTE: carlton/2003-05-16: If code is compiled by GCC2, we + # don't print the warning (for no particular reason), but we + # still call the class via the wrong name; PR gdb/57 is our + # catch-all PR for nested type problems. + kfail "gdb/57" "print *e1" + } +} + +# NOTE: carlton/2003-05-16: This test fails on my branch with an +# "" message because, within rtt1.cc, GDB has no way +# of knowing that the class is called 'n2::D2' instead of just 'D2'. +# This is an artifical test case, though: if we were using these +# classes in a more substantial way, G++ would emit more debug info. +# As is, I don't think there's anything that GDB can do about this +# case until G++ starts emitting DW_TAG_namespace info; when that part +# of the branch gets merged in, then we'll probably want to convert +# that fail branch to an xfail. + +gdb_test_multiple "print *e2" "print *e2" { + -re "warning: can't find class named `n2::D2', as given by C\\+\\+ RTTI.*$gdb_prompt $" { + kfail "gdb/488" "print *e2" + } + -re "\\$\[0-9\]* = \r\n$gdb_prompt $" { + # See above NOTE. + fail "print *e2" + } + -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" { + pass "print *e2" + } + -re "\\$\[0-9\]* = { = .*}\r\n$gdb_prompt $" { + kfail "gdb/57" "print *e2" + } +} + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/rtti.h b/gdb/testsuite/gdb.c++/rtti.h new file mode 100644 index 0000000..879896d --- /dev/null +++ b/gdb/testsuite/gdb.c++/rtti.h @@ -0,0 +1,48 @@ +/* Code to go along with tests in rtti.exp. + + Copyright 2003 Free Software Foundation, Inc. + + Contributed by David Carlton and by Kealia, + 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. */ + +namespace n2 { + + class C2; + + class Base2 { + public: + virtual ~Base2() { } + }; + + + class C2: public Base2 { + public: + }; + + class D2 : public C2{ + public: + D2(C2 *, C2 *); + + C2* expr_1_; + C2* expr_2_; + }; + + extern C2 *create2(); +} diff --git a/gdb/testsuite/gdb.c++/rtti1.cc b/gdb/testsuite/gdb.c++/rtti1.cc new file mode 100644 index 0000000..6e9d862 --- /dev/null +++ b/gdb/testsuite/gdb.c++/rtti1.cc @@ -0,0 +1,67 @@ +/* Code to go along with tests in rtti.exp. + + Copyright 2003 Free Software Foundation, Inc. + + Contributed by David Carlton and by Kealia, + 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 "rtti.h" + +namespace n1 { + + class C1; + + class Base1 { + public: + virtual ~Base1() { } + }; + + + class C1: public Base1 { + public: + }; + + class D1 : public C1{ + public: + D1(C1 *, C1 *); + + C1* expr_1_; + C1* expr_2_; + }; + + D1::D1(C1 *expr_1, C1 *expr_2) + : expr_1_(expr_1), expr_2_(expr_2) { } + + C1 *create1() { + return new D1(0, 0); + } + +} // n1 + +int main() +{ + using namespace n1; + using namespace n2; + + C1 *e1 = create1(); + C2 *e2 = create2(); + + return 0; // constructs-done +} diff --git a/gdb/testsuite/gdb.c++/rtti2.cc b/gdb/testsuite/gdb.c++/rtti2.cc new file mode 100644 index 0000000..8bb1ed6 --- /dev/null +++ b/gdb/testsuite/gdb.c++/rtti2.cc @@ -0,0 +1,36 @@ +/* Code to go along with tests in rtti.exp. + + Copyright 2003 Free Software Foundation, Inc. + + Contributed by David Carlton and by Kealia, + 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 "rtti.h" + +namespace n2 { + + D2::D2(C2 *expr_1, C2 *expr_2) + : expr_1_(expr_1), expr_2_(expr_2) { } + + C2 *create2() { + return new D2(0, 0); + } + +} diff --git a/gdb/testsuite/gdb.c++/templates.cc b/gdb/testsuite/gdb.c++/templates.cc new file mode 100644 index 0000000..c13f18b --- /dev/null +++ b/gdb/testsuite/gdb.c++/templates.cc @@ -0,0 +1,785 @@ +/* This test code is from Wendell Baker (wbaker@comet.berkeley.edu) */ + +#include + +int a_i; +char a_c; +double a_d; + +typedef void *Pix; + +int +f(int i) +{ return 0; } + +int +f(int i, char c) +{ return 0; } + +int +f(int i, char c, double d) +{ return 0; } + +int +f(int i, char c, double d, char *cs) +{ return 0; } + +int +f(int i, char c, double d, char *cs, void (*fig)(int, char)) +{ return 0; } + +int +f(int i, char c, double d, char *cs, void (*fig)(char, int)) +{ return 0; } + +class R { +public: + int i; +}; +class S { +public: + int i; +}; +class T { +public: + int i; +}; + +char g(char, const char, volatile char) +{ return 'c'; } +char g(R, char&, const char&, volatile char&) +{ return 'c'; } +char g(char*, const char*, volatile char*) +{ return 'c'; } +char g(S, char*&, const char*&, volatile char*&) +{ return 'c'; } + +signed char g(T,signed char, const signed char, volatile signed char) +{ return 'c'; } +signed char g(T, R, signed char&, const signed char&, volatile signed char&) +{ return 'c'; } +signed char g(T, signed char*, const signed char*, volatile signed char*) +{ return 'c'; } +signed char g(T, S, signed char*&, const signed char*&, volatile signed char*&) +{ return 'c'; } + +unsigned char g(unsigned char, const unsigned char, volatile unsigned char) +{ return 'c'; } +unsigned char g(R, unsigned char&, const unsigned char&, volatile unsigned char&) +{ return 'c'; } +unsigned char g(unsigned char*, const unsigned char*, volatile unsigned char*) +{ return 'c'; } +unsigned char g(S, unsigned char*&, const unsigned char*&, volatile unsigned char*&) +{ return 'c'; } + +short g(short, const short, volatile short) +{ return 0; } +short g(R, short&, const short&, volatile short&) +{ return 0; } +short g(short*, const short*, volatile short*) +{ return 0; } +short g(S, short*&, const short*&, volatile short*&) +{ return 0; } + +signed short g(T, signed short, const signed short, volatile signed short) +{ return 0; } +signed short g(T, R, signed short&, const signed short&, volatile signed short&) +{ return 0; } +signed short g(T, signed short*, const signed short*, volatile signed short*) +{ return 0; } +signed short g(T, S, double, signed short*&, const signed short*&, volatile signed short*&) +{ return 0; } + +unsigned short g(unsigned short, const unsigned short, volatile unsigned short) +{ return 0; } +unsigned short g(R, unsigned short&, const unsigned short&, volatile unsigned short&) +{ return 0; } +unsigned short g(unsigned short*, const unsigned short*, volatile unsigned short*) +{ return 0; } +unsigned short g(S, unsigned short*&, const unsigned short*&, volatile unsigned short*&) +{ return 0; } + +int g(int, const int, volatile int) +{ return 0; } +int g(R, int&, const int&, volatile int&) +{ return 0; } +int g(int*, const int*, volatile int*) +{ return 0; } +int g(S, int*&, const int*&, volatile int*&) +{ return 0; } + +signed int g(T, signed int, const signed int, volatile signed int) +{ return 0; } +signed int g(T, R, signed int&, const signed int&, volatile signed int&) +{ return 0; } +signed int g(T, signed int*, const signed int*, volatile signed int*) +{ return 0; } +signed int g(T, S, signed int*&, const signed int*&, volatile signed int*&) +{ return 0; } + +unsigned int g(unsigned int, const unsigned int, volatile unsigned int) +{ return 0; } +unsigned int g(R, unsigned int&, const unsigned int&, volatile unsigned int&) +{ return 0; } +unsigned int g(unsigned int*, const unsigned int*, volatile unsigned int*) +{ return 0; } +unsigned int g(S, unsigned int*&, const unsigned int*&, volatile unsigned int*&) +{ return 0; } + +long g(long, const long, volatile long) +{ return 0; } +long g(R, long&, const long&, volatile long&) +{ return 0; } +long g(long*, const long*, volatile long*) +{ return 0; } +long g(S, long*&, const long*&, volatile long*&) +{ return 0; } + +signed long g(T, signed long, const signed long, volatile signed long) +{ return 0; } +signed long g(T, R, signed long&, const signed long&, volatile signed long&) +{ return 0; } +signed long g(T, signed long*, const signed long*, volatile signed long*) +{ return 0; } +signed long g(T, S, signed long*&, const signed long*&, volatile signed long*&) +{ return 0; } + +unsigned long g(unsigned long, const unsigned long, volatile unsigned long) +{ return 0; } +unsigned long g(S, unsigned long&, const unsigned long&, volatile unsigned long&) +{ return 0; } +unsigned long g(unsigned long*, const unsigned long*, volatile unsigned long*) +{ return 0; } +unsigned long g(S, unsigned long*&, const unsigned long*&, volatile unsigned long*&) +{ return 0; } + +#ifdef __GNUC__ +long long g(long long, const long long, volatile long long) +{ return 0; } +long long g(S, long long&, const long long&, volatile long long&) +{ return 0; } +long long g(long long*, const long long*, volatile long long*) +{ return 0; } +long long g(R, long long*&, const long long*&, volatile long long*&) +{ return 0; } + +signed long long g(T, signed long long, const signed long long, volatile signed long long) +{ return 0; } +signed long long g(T, R, signed long long&, const signed long long&, volatile signed long long&) +{ return 0; } +signed long long g(T, signed long long*, const signed long long*, volatile signed long long*) +{ return 0; } +signed long long g(T, S, signed long long*&, const signed long long*&, volatile signed long long*&) +{ return 0; } + +unsigned long long g(unsigned long long, const unsigned long long, volatile unsigned long long) +{ return 0; } +unsigned long long g(R, unsigned long long*, const unsigned long long*, volatile unsigned long long*) +{ return 0; } +unsigned long long g(unsigned long long&, const unsigned long long&, volatile unsigned long long&) +{ return 0; } +unsigned long long g(S, unsigned long long*&, const unsigned long long*&, volatile unsigned long long*&) +{ return 0; } +#endif + +float g(float, const float, volatile float) +{ return 0; } +float g(char, float&, const float&, volatile float&) +{ return 0; } +float g(float*, const float*, volatile float*) +{ return 0; } +float g(char, float*&, const float*&, volatile float*&) +{ return 0; } + +double g(double, const double, volatile double) +{ return 0; } +double g(char, double&, const double&, volatile double&) +{ return 0; } +double g(double*, const double*, volatile double*) +{ return 0; } +double g(char, double*&, const double*&, volatile double*&) +{ return 0; } + +#ifdef __GNUC__ +long double g(long double, const long double, volatile long double) +{ return 0; } +long double g(char, long double&, const long double&, volatile long double&) +{ return 0; } +long double g(long double*, const long double*, volatile long double*) +{ return 0; } +long double g(char, long double*&, const long double*&, volatile long double*&) +{ return 0; } +#endif + +class c { +public: + c(int) {}; + int i; +}; + +class c g(c, const c, volatile c) +{ return 0; } +c g(char, c&, const c&, volatile c&) +{ return 0; } +c g(c*, const c*, volatile c*) +{ return 0; } +c g(char, c*&, const c*&, volatile c*&) +{ return 0; } + +/* +void h(char = 'a') +{ } +void h(char, signed char = 'a') +{ } +void h(unsigned char = 'a') +{ } +*/ +/* +void h(char = (char)'a') +{ } +void h(char, signed char = (signed char)'a') +{ } +void h(unsigned char = (unsigned char)'a') +{ } + + +void h(short = (short)43) +{ } +void h(char, signed short = (signed short)43) +{ } +void h(unsigned short = (unsigned short)43) +{ } + +void h(int = (int)43) +{ } +void h(char, signed int = (signed int)43) +{ } +void h(unsigned int = (unsigned int)43) +{ } + + +void h(long = (long)43) +{ } +void h(char, signed long = (signed long)43) +{ } +void h(unsigned long = (unsigned long)43) +{ } + +#ifdef __GNUC__ +void h(long long = 43) +{ } +void h(char, signed long long = 43) +{ } +void h(unsigned long long = 43) +{ } +#endif + +void h(float = 4.3e-10) +{ } +void h(double = 4.3) +{ } +#ifdef __GNUC__ +void h(long double = 4.33e33) +{ } +#endif +*/ + +/* An unneeded printf() definition - actually, just a stub - used to occupy + this space. It has been removed and replaced with this comment which + exists to occupy some lines so that templates.exp won't need adjustment. */ + +class T1 { +public: + static void* operator new(size_t) throw (); + static void operator delete(void *pointer); + + void operator=(const T1&); + T1& operator=(int); + + int operator==(int) const; + int operator==(const T1&) const; + int operator!=(int) const; + int operator!=(const T1&) const; + + int operator<=(int) const; + int operator<=(const T1&) const; + int operator<(int) const; + int operator<(const T1&) const; + int operator>=(int) const; + int operator>=(const T1&) const; + int operator>(int) const; + int operator>(const T1&) const; + + void operator+(int) const; + T1& operator+(const T1&) const; + void operator+=(int) const; + T1& operator+=(const T1&) const; + + T1& operator++() const; + + void operator-(int) const; + T1& operator-(const T1&) const; + void operator-=(int) const; + T1& operator-=(const T1&) const; + + T1& operator--() const; + + void operator*(int) const; + T1& operator*(const T1&) const; + void operator*=(int) const; + T1& operator*=(const T1&) const; + + void operator/(int) const; + T1& operator/(const T1&) const; + void operator/=(int) const; + T1& operator/=(const T1&) const; + + void operator%(int) const; + T1& operator%(const T1&) const; + void operator%=(int) const; + T1& operator%=(const T1&) const; + + void operator&&(int) const; + T1& operator&&(const T1&) const; + + void operator||(int) const; + T1& operator||(const T1&) const; + + void operator&(int) const; + T1& operator&(const T1&) const; + void operator&=(int) const; + T1& operator&=(const T1&) const; + + void operator|(int) const; + T1& operator|(const T1&) const; + void operator|=(int) const; + T1& operator|=(const T1&) const; + + void operator^(int) const; + T1& operator^(const T1&) const; + void operator^=(int) const; + T1& operator^=(const T1&) const; + + T1& operator!() const; + T1& operator~() const; +}; + +void* +T1::operator new(size_t) throw () +{ return 0; } + +void +T1::operator delete(void *pointer) +{ } + +class T2 { +public: + T2(int i): integer(i) + { } + int integer; +}; + +int operator==(const T2&, const T2&) +{ return 0; } +int operator==(const T2&, char) +{ return 0; } +int operator!=(const T2&, const T2&) +{ return 0; } +int operator!=(const T2&, char) +{ return 0; } + +int operator<=(const T2&, const T2&) +{ return 0; } +int operator<=(const T2&, char) +{ return 0; } +int operator<(const T2&, const T2&) +{ return 0; } +int operator<(const T2&, char) +{ return 0; } +int operator>=(const T2&, const T2&) +{ return 0; } +int operator>=(const T2&, char) +{ return 0; } +int operator>(const T2&, const T2&) +{ return 0; } +int operator>(const T2&, char) +{ return 0; } + +T2 operator+(const T2 t, int i) +{ return t.integer + i; } +T2 operator+(const T2 a, const T2& b) +{ return a.integer + b.integer; } +T2& operator+=(T2& t, int i) +{ t.integer += i; return t; } +T2& operator+=(T2& a, const T2& b) +{ a.integer += b.integer; return a; } + +T2 operator-(const T2 t, int i) +{ return t.integer - i; } +T2 operator-(const T2 a, const T2& b) +{ return a.integer - b.integer; } +T2& operator-=(T2& t, int i) +{ t.integer -= i; return t; } +T2& operator-=(T2& a, const T2& b) +{ a.integer -= b.integer; return a; } + +T2 operator*(const T2 t, int i) +{ return t.integer * i; } +T2 operator*(const T2 a, const T2& b) +{ return a.integer * b.integer; } +T2& operator*=(T2& t, int i) +{ t.integer *= i; return t; } +T2& operator*=(T2& a, const T2& b) +{ a.integer *= b.integer; return a; } + +T2 operator/(const T2 t, int i) +{ return t.integer / i; } +T2 operator/(const T2 a, const T2& b) +{ return a.integer / b.integer; } +T2& operator/=(T2& t, int i) +{ t.integer /= i; return t; } +T2& operator/=(T2& a, const T2& b) +{ a.integer /= b.integer; return a; } + +T2 operator%(const T2 t, int i) +{ return t.integer % i; } +T2 operator%(const T2 a, const T2& b) +{ return a.integer % b.integer; } +T2& operator%=(T2& t, int i) +{ t.integer %= i; return t; } +T2& operator%=(T2& a, const T2& b) +{ a.integer %= b.integer; return a; } + +template +class T5 { +public: + T5(int); + T5(const T5&); + ~T5(); + static void* operator new(size_t) throw (); + static void operator delete(void *pointer); + int value(); + + static T X; + T x; + int val; +}; + +template +T5::T5(int v) +{ val = v; } + +template +T5::T5(const T5&) +{} + +template +T5::~T5() +{} + +template +void* +T5::operator new(size_t) throw () +{ return 0; } + +template +void +T5::operator delete(void *pointer) +{ } + +template +int +T5::value() +{ return val; } + + +#if ! defined(__GNUC__) || defined(GCC_BUG) +template +T T5::X; +#endif + + + + +T5 t5c(1); +T5 t5i(2); +T5 t5fi1(3); +T5 t5fi2(4); + + + + + + +class x { +public: + int (*manage[5])(double, + void *(*malloc)(unsigned size), + void (*free)(void *pointer)); + int (*device[5])(int open(const char *, unsigned mode, unsigned perms, int extra), + int *(*read)(int fd, void *place, unsigned size), + int *(*write)(int fd, void *place, unsigned size), + void (*close)(int fd)); +}; +T5 t5x(5); + +#if !defined(__GNUC__) || (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6) +template class T5; +template class T5; +template class T5; +template class T5; +template class T5; +#endif + +class T7 { +public: + static int get(); + static void put(int); +}; + +int +T7::get() +{ return 1; } + +void +T7::put(int i) +{ + // nothing +} + +// More template kinds. GDB 4.16 didn't handle these, but +// Wildebeest does. Note: Assuming HP aCC is used to compile +// this file; with g++ or HP cfront or other compilers the +// demangling may not get done correctly. + +// Ordinary template, to be instantiated with different types +template +class Foo { +public: + int x; + T t; + T foo (int, T); +}; + + +template T Foo::foo (int i, T tt) +{ + return tt; +} + +// Template with int parameter + +template +class Bar { +public: + int x; + T t; + T bar (int, T); +}; + + +template T Bar::bar (int i, T tt) +{ + if (i < sz) + return tt; + else + return 0; +} + +// function template with int parameter +template int dummy (T tt, int i) +{ + return tt; +} + +// Template with partial specializations +template +class Spec { +public: + int x; + T1 spec (T2); +}; + +template +T1 Spec::spec (T2 t2) +{ + return 0; +} + +template +class Spec { +public: + int x; + T spec (T*); +}; + +template +T Spec::spec (T * tp) +{ + return *tp; +} + +// Template with char parameter +template +class Baz { +public: + int x; + T t; + T baz (int, T); +}; + +template T Baz::baz (int i, T tt) +{ + if (i < sz) + return tt; + else + return 0; +} + +// Template with char * parameter +template +class Qux { +public: + int x; + T t; + T qux (int, T); +}; + +template T Qux::qux (int i, T tt) +{ + if (sz[0] == 'q') + return tt; + else + return 0; +} + +// Template with a function pointer parameter +template +class Qux1 { +public: + int x; + T t; + T qux (int, T); +}; + +template T Qux1::qux (int i, T tt) +{ + if (f != 0) + return tt; + else + return 0; +} + +// Some functions to provide as arguments to template +int gf1 (int a) { + return a * 2 + 13; +} +int gf2 (int a) { + return a * 2 + 26; +} + +char string[3]; + + +// Template for nested instantiations + +template +class Garply { +public: + int x; + T t; + T garply (int, T); +}; + +template T Garply::garply (int i, T tt) +{ + if (i > x) + return tt; + else + { + x += i; + return tt; + } +} + + +int main() +{ + int i; +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + i = i + 1; + + // New tests added here + + Foo fint={0,0}; + Foo fchar={0,0}; + Foo fvpchar = {0, 0}; + + Bar bint; + Bar 3)> bint2; + + Baz bazint; + Baz bazint2; + + Qux quxint2; + Qux quxint; + + Qux1 qux11; + + int x = fint.foo(33, 47); + char c = fchar.foo(33, 'x'); + volatile char * cp = fvpchar.foo(33, 0); + + int y = dummy (400, 600); + + int z = bint.bar(55, 66); + z += bint2.bar(55, 66); + + c = bazint2.baz(4, 'y'); + c = quxint2.qux(4, 'z'); + + y = bazint.baz(4,3); + y = quxint.qux(4, 22); + y += qux11.qux(4, 22); + + y *= gf1(y) - gf2(y); + + Spec sic; + Spec siip; + + sic.spec ('c'); + siip.spec (&x); + + Garply f; + Garply fc; + f.x = 13; + + Garply > nf; + nf.x = 31; + + x = f.garply (3, 4); + + fc = nf.garply (3, fc); + + y = x + fc.x; + + + return 0; + +} + + + + + + + + + + + + + diff --git a/gdb/testsuite/gdb.c++/templates.exp b/gdb/testsuite/gdb.c++/templates.exp new file mode 100644 index 0000000..00f5ada --- /dev/null +++ b/gdb/testsuite/gdb.c++/templates.exp @@ -0,0 +1,516 @@ +# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +set ws "\[\r\n\t \]+" + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +set testfile "templates" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +# Create and source the file that provides information about the compiler +# used to compile the test case. +if [get_compiler_info ${binfile} "c++"] { + return -1 +} +source ${binfile}.ci + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# +# Test printing of the types of templates. +# + +proc test_ptype_of_templates {} { + global gdb_prompt + global ws + + send_gdb "ptype T5\n" + gdb_expect { + -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5 & operator=\\(T5 const ?&\\);${ws}T5\\(int\\);${ws}T5\\((T5 const|const T5) ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype T5" + } + -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}${ws}T5 \\(int\\);${ws}T5 \\(const class T5 &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}${ws}$gdb_prompt $" { pass "ptype T5 -- new with unsigned int" } + -re "type = class T5 \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5 &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void ?\\*\\);.*int value \\((void|)\\);.*\\}\r\n$gdb_prompt $" { pass "ptype T5 -- new with unsigned long" } + -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5 & operator=\\(T5 const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\((T5 const|const T5) ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype T5 (obsolescent gcc or gdb)" + } + -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5 const|const T5) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { + # This also triggers gdb/1113... + kfail "gdb/1111" "ptype T5" + } + -re ".*$gdb_prompt $" { + fail "ptype T5" + } + timeout { + fail "ptype T5 (timeout)" + } + } + + send_gdb "ptype t5i\n" + gdb_expect { + -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5 const ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype T5 -- with several fixes from 4.17" } + -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5 &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i -- new with unsigned int" } + -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5 &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i -- new with unsigned long" } + -re "type = class T5 \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\((void|)\\);.*\}.*$gdb_prompt $" { + pass "ptype t5i" + } + -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5 & operator=\\(T5 const ?&\\);${ws}T5\\(int\\);${ws}T5\\((T5 const|const T5) ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype t5i" + } + -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5 & operator=\\(T5 const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5 const ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype t5i (obsolescent gcc or gdb)" + } + -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5 const|const T5) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { + # This also triggers gdb/1113... + kfail "gdb/1111" "ptype T5" + } + -re ".*$gdb_prompt $" { + fail "ptype t5i" + } + timeout { + fail "ptype t5i (timeout)" + } + } +} + +# +# Test breakpoint setting on template methods. +# + +proc test_template_breakpoints {} { + global gdb_prompt + global testfile + global srcdir + global hp_aCC_compiler + + send_gdb "break T5::T5\n" + gdb_expect { + -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5::T5\\(int\\) at .*\[\r\n\]*.3. T5::T5\\((T5 const|const T5) ?&\\) at .*\[\r\n\]*> $" { + gdb_test "0" \ + "canceled" \ + "constructor breakpoint (obsolete format!)" + } + -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5::T5\\((T5 const|const T5) ?&\\) at .*templates.cc:.*\[\r\n\]*.3. T5::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" { + gdb_test "0" \ + "canceled" \ + "constructor breakpoint" + } + -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5 at .*\[\r\n\]*.3. T5 at .*\[\r\n\]*> $" { + setup_kfail "gdb/1062" "*-*-*" + gdb_test "0" \ + "nonsense intended to insure that this test fails" \ + "constructor breakpoint" + } + -re ".*\n> $" { + gdb_test "0" \ + "nonsense intended to insure that this test fails" \ + "constructor breakpoint (bad menu choices)" + } + -re ".*$gdb_prompt $" { fail "constructor breakpoint" } + default { fail "constructor breakpoint (timeout)" } + } + +# See CLLbs14792 + if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792} + + gdb_test_multiple "break T5::~T5" "destructor_breakpoint" { + -re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $" + { + pass "destructor breakpoint" + } + -re "the class `T5' does not have destructor defined\r\nHint: try 'T5::~T5 or 'T5::~T5\r\n\\(Note leading single quote.\\)\r\n$gdb_prompt $" + { + kfail "gdb/1112" "destructor breakpoint" + } + } + + gdb_test "break T5::value" \ + "Breakpoint.*at.* file .*${testfile}.cc, line.*" \ + "value method breakpoint" + + delete_breakpoints +} + +# +# Test calling of template methods. +# + +proc test_template_calls {} { + global gdb_prompt + global hp_aCC_compiler + + if [target_info exists gdb,cannot_call_functions] { + setup_xfail "*-*-*" 2416 + fail "This target can not call functions" + return + } + + if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*} + send_gdb "print t5i.value()\n" + gdb_expect { + -re ".* = 2\[\r\n\]*$gdb_prompt $" { pass "print t5i.value()" } + -re "Cannot invoke functions on this machine.*$gdb_prompt $" { + fail "print t5i.value()" + } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + xfail "print t5i.value" + } + -re ".*$gdb_prompt $" { fail "print t5i.value()" } + timeout { fail "print t5i.value() (timeout)" } + } +} + + +proc do_tests {} { + global prms_id + global bug_id + global subdir + global objdir + global srcdir + global binfile + global gdb_prompt + global supports_template_debugging + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + if { !$supports_template_debugging } { + warning "compiler lacks debugging info for templates; tests suppressed." 0 + return + } + + runto_main + + test_ptype_of_templates + test_template_breakpoints + + if [ runto_main] { + test_template_calls + } +} + +do_tests + + +# More tests for different kinds of template parameters, +# templates with partial specializations, nested templates, etc. +# These have been tested only with HP aCC. They probably won't +# work with other compilers because of differences in mangling +# schemes. +# Added by Satish Pai 1997-09-25 +# As of 2000-06-03, C++ support has been improved to the point that g++ can +# pass all of theses, excluding what appears to be one that exposes a stabs bug. - djb + +# I don't know how HP could be passing these tests without this. They +# weren't breakpointing past a point where the below expressions were +# initialized in the actual source. - djb + +send_gdb "b 770\n" +gdb_expect { + -re ".*$gdb_prompt $" +} +send_gdb "c\n" +gdb_expect { + -re ".*$gdb_prompt $" +} +send_gdb "print fint\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" } + -re "$gdb_prompt $" { fail "print fint" } + timeout { fail "(timeout) print fint" } +} + +send_gdb "print fvpchar\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" } + -re "$gdb_prompt $" { fail "print fvpchar" } + timeout { fail "(timeout) print fvpchar" } +} + +# Template Foo + +# Neither stabs nor DWARF-2 contains type information about templates +# (as opposed to instantiations of templates), so in those +# circumstances we expect GDB to not find a symbol. HP has a debug +# format that contains more info, though, so it's also correct to +# print out template info. (This affects several subsequent tests as +# well.) + +# NOTE: carlton/2003-02-26: However, because of a bug in the way GDB +# handles nested types, we don't get this right in the DWARF-2 case. + +send_gdb "ptype Foo\n" +gdb_expect { + -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo\r\n\[ \t\]*(class |)Foo\r\n\[ \t\]*(class |)Foo\r\n$gdb_prompt $" { pass "ptype Foo" } + -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" } + -re "type = class Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" + { # GCC 3.1, DWARF-2 output. + kfail "gdb/57" "ptype Foo" } + -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" + { # GCC 2.95.3, stabs+ output. + pass "ptype Foo" } + -re "$gdb_prompt $" { fail "ptype Foo" } + timeout { fail "(timeout) ptype Foo" } +} +# -re "type = class Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo(int, int);\r\n\\}\r\n$gdb_prompt $" + +# ptype Foo + +send_gdb "ptype fint\n" +gdb_expect { + -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" } + -re "$gdb_prompt $" { fail "ptype fint" } + timeout { fail "(timeout) ptype fint" } +} + +# ptype Foo + +send_gdb "ptype fchar\n" +gdb_expect { + -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" } + -re "$gdb_prompt $" { fail "ptype fchar" } + timeout { fail "(timeout) ptype fchar" } +} + +# ptype Foo + +send_gdb "ptype fvpchar\n" +gdb_expect { + -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" } + -re "$gdb_prompt $" { fail "ptype fvpchar" } + timeout { fail "(timeout) ptype fvpchar" } +} + +# print a function from Foo + +# This test is sensitive to whitespace matching, so we'll do it twice, +# varying the spacing, because of PR gdb/33. + +send_gdb "print Foo::foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo \\*(| const), int, .*char \\*\\)\\} $hex ::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo::foo" } + -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" + { + # This used to be a kfail gdb/33, but it shouldn't occur any more now. + fail "print Foo::foo" + } + -re "$gdb_prompt $" { fail "print Foo::foo" } + timeout { fail "(timeout) print Foo::foo" } +} + +send_gdb "print Foo::foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo \\*(| const), int, .*char \\*\\)\\} $hex ::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo::foo" } + -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" + { + # This used to be a kfail gdb/33, but it shouldn't occur any more now. + fail "print Foo::foo" + } + -re "$gdb_prompt $" { fail "print Foo::foo" } + timeout { fail "(timeout) print Foo::foo" } +} + +# Template Bar + +# same as Foo for g++ +send_gdb "ptype Bar\n" +gdb_expect { + -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar\r\n\[ \t\]*(class |)Bar\r\n$gdb_prompt $" { pass "ptype Bar" } + -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" } + -re "ptype Bar\r\ntype = class Bar {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $" + { # GCC 3.1, DWARF-2 output. + kfail "gdb/57" "ptype Bar" } + -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $" + { # GCC 2.95.3, stabs+ output. + pass "ptype Bar" } + -re "$gdb_prompt $" { fail "ptype Bar" } + timeout { fail "(timeout) ptype Bar" } +} + + +# ptype Bar + +send_gdb "ptype bint\n" +gdb_expect { + -re "type = (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" } + -re "$gdb_prompt $" { fail "ptype bint" } + timeout { fail "(timeout) ptype bint" } +} + +# ptype Bar3)> + +send_gdb "ptype bint2\n" +gdb_expect { + -re "type = (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" } + -re "$gdb_prompt $" { fail "ptype bint2" } + timeout { fail "(timeout) ptype bint2" } +} + +# Template Baz + +# Same as Foo, for g++ +send_gdb "ptype Baz\n" +gdb_expect { + -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz\r\n\[ \t\]*(class |)Baz\r\n$gdb_prompt $" { pass "ptype Baz" } + -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" } + -re "type = class Baz {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $" + { # GCC 3.1, DWARF-2 output. + kfail "gdb/57" "ptype Baz" } + -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $" + { # GCC 2.95.3, stabs+ output. + pass "ptype Baz" } + -re "$gdb_prompt $" { fail "ptype Baz" } + timeout { fail "(timeout) ptype Baz" } +} + + +# ptype Baz + +send_gdb "ptype bazint\n" +gdb_expect { + -re "type = (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" } + -re "$gdb_prompt $" { fail "ptype bazint" } + timeout { fail "(timeout) ptype bazint" } +} + +# ptype Baz + +send_gdb "ptype bazint2\n" +gdb_expect { + -re "type = (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" } + -re "$gdb_prompt $" { fail "ptype bazint2" } + timeout { fail "(timeout) ptype bazint2" } +} + +# Template Qux +# Same as Foo for g++ +send_gdb "ptype Qux\n" +gdb_expect { + -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux\r\n\[ \t\]*(class |)Qux\r\n$gdb_prompt $" { pass "ptype Qux" } + -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" } + -re "type = class Qux {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $" + { # GCC 3.1, DWARF-2 output. + kfail "gdb/57" "ptype Qux" } + -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $" + { # GCC 2.95.3, stabs+ output. + pass "ptype Qux" } + -re "$gdb_prompt $" { fail "ptype Qux" } + timeout { fail "(timeout) ptype Qux" } +} + +# pt Qux + +send_gdb "ptype quxint\n" +gdb_expect { + -re "type = class Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" } + -re "$gdb_prompt $" { fail "ptype quxint" } + timeout { fail "(timeout) ptype quxint" } +} + +# pt Qux + +# commented out this as quxint2 declaration was commented out in +# templates.exp -- ovidiu +# send_gdb "ptype quxint2\n" +# gdb_expect { +# -re "type = class Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint2" } +# -re "$gdb_prompt $" { fail "ptype quxint2" } +# timeout { fail "(timeout) ptype quxint2" } +# } + +# Template Spec + +# Same as Foo for g++ +send_gdb "ptype Spec\n" +gdb_expect { + -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec\r\n\[ \t\]*(class |)Spec\r\n$gdb_prompt $" { pass "ptype Spec" } + -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" } + -re "type = class Spec {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $" + { # GCC 3.1, DWARF-2 output. + kfail "gdb/57" "ptype Spec" } + -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $" + { # GCC 2.95.3, stabs+ output. + pass "ptype Spec" } + -re "$gdb_prompt $" { fail "ptype Spec" } + timeout { fail "(timeout) ptype Spec" } +} + +# pt Spec + +send_gdb "ptype siip\n" +gdb_expect { + -re "type = class Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*.*int spec\\(int ?\\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" } + -re "$gdb_prompt $" { fail "ptype siip" } + timeout { fail "(timeout) ptype siip" } +} + +# pt Garply + +send_gdb "ptype Garply\n" +gdb_expect { + -re "type = class Garply \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply" } + -re "$gdb_prompt $" { fail "ptype Garply" } + timeout { fail "(timeout) ptype Garply" } +} + +# ptype of nested template name + +send_gdb "ptype Garply >\n" +gdb_expect { + -re "type = (class |)Garply > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply t;\r\n\r\n\[ \t\]*.*(class |)Garply garply\\(int, (class |)Garply\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply >" } + -re "$gdb_prompt $" { fail "ptype Garply >" } + timeout { fail "(timeout) ptype Garply >" } +} + +# print out a function from a nested template name + +send_gdb "print Garply >::garply\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{(class |)Garply \\((class |)Garply > \\*(| const), int, (class |)Garply\\)\\} $hex \[ \t\]*>::garply\\(int, (class |)Garply\\)>\r\n$gdb_prompt $" { pass "print Garply >::garply" } + -re ".*$gdb_prompt $" { fail "print Garply >::garply" } + timeout { fail "print Garply >::garply (timeout)" } +} + +# djb - 06-03-2000 +# Now should work fine +send_gdb "break Garply >::garply\n" +gdb_expect { + -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply >::garply" } + -re ".*$gdb_prompt $" { fail "break Garply >::garply" } + timeout { fail "break Garply >::garply (timeout)" } +} diff --git a/gdb/testsuite/gdb.c++/try_catch.cc b/gdb/testsuite/gdb.c++/try_catch.cc new file mode 100644 index 0000000..e13dd64 --- /dev/null +++ b/gdb/testsuite/gdb.c++/try_catch.cc @@ -0,0 +1,121 @@ +// 2002-05-27 + +#include +#include +#include + +enum region { oriental, egyptian, greek, etruscan, roman }; + +// Test one. +class gnu_obj_1 +{ +public: + typedef region antiquities; + const bool test; + const int key1; + long key2; + + antiquities value; + + gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {} +}; + +// Test two. +template +class gnu_obj_2: public virtual gnu_obj_1 +{ +public: + antiquities value_derived; + + gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { } +}; + +// Test three. +template +class gnu_obj_3 +{ +public: + typedef region antiquities; + gnu_obj_2 data; + + gnu_obj_3(antiquities b): data(etruscan) { } +}; + +int main() +{ + bool test = true; + const int i = 5; + int j = i; + gnu_obj_2 test2(roman); + gnu_obj_3 test3(greek); + + // 1 + try + { + ++j; + throw gnu_obj_1(egyptian, 4589); // marker 1-throw + } + catch (gnu_obj_1& obj) + { + ++j; + if (obj.value != egyptian) // marker 1-catch + test &= false; + if (obj.key2 != 4589) + test &= false; + } + catch (...) + { + j = 0; + test &= false; + } + + // 2 + try + { + ++j; // marker 2-start + try + { + ++j; // marker 2-next + try + { + ++j; + throw gnu_obj_1(egyptian, 4589); // marker 2-throw + } + catch (gnu_obj_1& obj) + { + ++j; + if (obj.value != egyptian) // marker 2-catch + test &= false; + if (obj.key2 != 4589) + test &= false; + } + } + catch (gnu_obj_1& obj) + { + ++j; + if (obj.value != egyptian) + test &= false; + if (obj.key2 != 4589) + test &= false; + } + } + catch (...) + { + j = 0; + test &= false; + } + + // 3 use standard library + using namespace std; + try + { + if (j < 100) + throw invalid_argument("gdb.1"); // marker 3-throw + } + catch (exception& obj) + { + if (obj.what() != "gdb.1") // marker 3-catch + test &= false; + } + return 0; +} diff --git a/gdb/testsuite/gdb.c++/try_catch.exp b/gdb/testsuite/gdb.c++/try_catch.exp new file mode 100644 index 0000000..1473e20 --- /dev/null +++ b/gdb/testsuite/gdb.c++/try_catch.exp @@ -0,0 +1,82 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for member data +# 2002-05-27 Benjamin Kosnik + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "try_catch" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +gdb_breakpoint [gdb_get_line_number "marker 1-throw"] +gdb_continue_to_breakpoint "marker 1-throw" + +gdb_breakpoint [gdb_get_line_number "marker 1-catch"] +gdb_continue_to_breakpoint "marker 1-catch" + +gdb_breakpoint [gdb_get_line_number "marker 2-start"] +gdb_continue_to_breakpoint "marker 2-start" + +gdb_breakpoint [gdb_get_line_number "marker 2-next"] +gdb_continue_to_breakpoint "marker 2-next" + +gdb_breakpoint [gdb_get_line_number "marker 2-throw"] +gdb_continue_to_breakpoint "marker 2-throw" + +gdb_breakpoint [gdb_get_line_number "marker 2-catch"] +gdb_continue_to_breakpoint "marker 2-catch" + +gdb_breakpoint [gdb_get_line_number "marker 3-throw"] +gdb_continue_to_breakpoint "marker 3-throw" + +gdb_breakpoint [gdb_get_line_number "marker 3-catch"] +gdb_continue_to_breakpoint "marker 3-catch" + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/userdef.cc b/gdb/testsuite/gdb.c++/userdef.cc new file mode 100644 index 0000000..0bb88a2 --- /dev/null +++ b/gdb/testsuite/gdb.c++/userdef.cc @@ -0,0 +1,341 @@ +#include + +using namespace std; + +void marker1() +{ + return; +} + +class A1 { + int x; + int y; + +friend ostream& operator<<(ostream& outs, A1 one); + +public: + + A1(int a, int b) + { + x=a; + y=b; + } + +A1 operator+=(int value); +A1 operator+(const A1&); +A1 operator-(const A1&); +A1 operator%(const A1&); +int operator==(const A1&); +int operator!=(const A1&); +int operator&&(const A1&); +int operator||(const A1&); +A1 operator<<(int); +A1 operator>>(int); +A1 operator|(const A1&); +A1 operator^(const A1&); +A1 operator&(const A1&); +int operator<(const A1&); +int operator<=(const A1&); +int operator>=(const A1&); +int operator>(const A1&); +A1 operator*(const A1&); +A1 operator/(const A1&); +A1 operator=(const A1&); + +A1 operator~(); +A1 operator-(); +int operator!(); +A1 operator++(); +A1 operator++(int); +A1 operator--(); +A1 operator--(int); + +}; + + +A1 A1::operator+(const A1& second) +{ + A1 sum(0,0); + sum.x = x + second.x; + sum.y = y + second.y; + + return (sum); +} + +A1 A1::operator*(const A1& second) +{ + A1 product(0,0); + product.x = this->x * second.x; + product.y = this->y * second.y; + + return product; +} + +A1 A1::operator-(const A1& second) +{ + A1 diff(0,0); + diff.x = x - second.x; + diff.y = y - second.y; + + return diff; +} + +A1 A1::operator/(const A1& second) +{ + A1 div(0,0); + div.x = x / second.x; + div.y = y / second.y; + + return div; +} + +A1 A1::operator%(const A1& second) +{ + A1 rem(0,0); + rem.x = x % second.x; + rem.y = y % second.y; + + return rem; +} + +int A1::operator==(const A1& second) +{ + int a = (x == second.x); + int b = (y == second.y); + + return (a && b); +} + +int A1::operator!=(const A1& second) +{ + int a = (x != second.x); + int b = (y != second.y); + + return (a || b); +} + +int A1::operator&&(const A1& second) +{ + return ( x && second.x); +} + +int A1::operator||(const A1& second) +{ + return ( x || second.x); +} + +A1 A1::operator<<(int value) +{ + A1 lshft(0,0); + lshft.x = x << value; + lshft.y = y << value; + + return lshft; +} + +A1 A1::operator>>(int value) +{ + A1 rshft(0,0); + rshft.x = x >> value; + rshft.y = y >> value; + + return rshft; +} + +A1 A1::operator|(const A1& second) +{ + A1 abitor(0,0); + abitor.x = x | second.x; + abitor.y = y | second.y; + + return abitor; +} + +A1 A1::operator^(const A1& second) +{ + A1 axor(0,0); + axor.x = x ^ second.x; + axor.y = y ^ second.y; + + return axor; +} + +A1 A1::operator&(const A1& second) +{ + A1 abitand(0,0); + abitand.x = x & second.x; + abitand.y = y & second.y; + + return abitand; +} + +int A1::operator<(const A1& second) +{ + A1 b(0,0); + b.x = 3; + return (x < second.x); +} + +int A1::operator<=(const A1& second) +{ + return (x <= second.x); +} + +int A1::operator>=(const A1& second) +{ + return (x >= second.x); +} + +int A1::operator>(const A1& second) +{ + return (x > second.x); +} + +int A1::operator!(void) +{ + return (!x); +} + +A1 A1::operator-(void) +{ + A1 neg(0,0); + neg.x = -x; + neg.y = -y; + + return (neg); +} + +A1 A1::operator~(void) +{ + A1 acompl(0,0); + acompl.x = ~x; + acompl.y = ~y; + + return (acompl); +} + +A1 A1::operator++() // pre increment +{ + x = x +1; + + return (*this); +} + +A1 A1::operator++(int) // post increment +{ + y = y +1; + + return (*this); +} + +A1 A1::operator--() // pre decrement +{ + x = x -1; + + return (*this); +} + +A1 A1::operator--(int) // post decrement +{ + y = y -1; + + return (*this); +} + + +A1 A1::operator=(const A1& second) +{ + + x = second.x; + y = second.y; + + return (*this); +} + +A1 A1::operator+=(int value) +{ + + x += value; + y += value; + + return (*this); +} + +ostream& operator<<(ostream& outs, A1 one) +{ + return (outs << endl << "x = " << one.x << endl << "y = " << one.y << endl << "-------" << endl); +} + +int main (void) +{ + A1 one(2,3); + A1 two(4,5); + A1 three(0,0); + int val; + + marker1(); // marker1-returns-here + cout << one; // marker1-returns-here + cout << two; + three = one + two; + cout << "+ " << three; + three = one - two; + cout << "- " << three; + three = one * two; + cout <<"* " << three; + three = one / two; + cout << "/ " << three; + three = one % two; + cout << "% " << three; + three = one | two; + cout << "| " <= two; + cout << ">= " << val << endl << "-----"< two; + cout << "> " << val << endl << "-----"<> 2; + cout << "rsh " << three; + + three = one; + cout << " = "<< three; + three += 5; + cout << " += "<< three; + + val = (!one); + cout << "! " << val << endl << "-----"< two" "\\\$\[0-9\]* = 0\[\r\n\]" + +gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]" + +gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]" + +gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]" + +# Can't really check the output of this one without knowing +# target integer width. Make sure we don't try to call +# the iostreams operator instead, though. +gdb_test "print one << 31" "\\\$\[0-9\]* = {x = -?\[0-9\]*, y = -?\[0-9\]*}" + +# Should be fine even on < 32-bit targets. +gdb_test "print one >> 31" "\\\$\[0-9\]* = {x = 0, y = 0}" + +gdb_test "print !one" "\\\$\[0-9\]* = 0\[\r\n\]" + +# Assumes 2's complement. So does everything... +gdb_test "print ~one" "\\\$\[0-9\]* = {x = -3, y = -4}" + +gdb_test "print -one" "\\\$\[0-9\]* = {x = -2, y = -3}" + +gdb_test "print one++" "\\\$\[0-9\]* = {x = 2, y = 4}" + +gdb_test "print ++one" "\\\$\[0-9\]* = {x = 3, y = 4}" + +gdb_test "print one--" "\\\$\[0-9\]* = {x = 3, y = 3}" + +gdb_test "print --one" "\\\$\[0-9\]* = {x = 2, y = 3}" + +gdb_test "print one += 7" "\\\$\[0-9\]* = {x = 9, y = 10}" + +gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}" + +# Check that GDB tolerates whitespace in operator names. +gdb_test "break A1::'operator+'" ".*Breakpoint $decimal at.*" +gdb_test "break A1::'operator +'" ".*Breakpoint $decimal at.*" + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/virtfunc.cc b/gdb/testsuite/gdb.c++/virtfunc.cc new file mode 100644 index 0000000..005de9d --- /dev/null +++ b/gdb/testsuite/gdb.c++/virtfunc.cc @@ -0,0 +1,201 @@ +// Pls try the following program on virtual functions and try to do print on +// most of the code in main(). Almost none of them works ! + +// +// The inheritance structure is: +// +// V : VA VB +// A : (V) +// B : A +// D : AD (V) +// C : (V) +// E : B (V) D C +// + +class VA +{ +public: + int va; +}; + +class VB +{ +public: + int vb; + int fvb(); + virtual int vvb(); +}; + +class V : public VA, public VB +{ +public: + int f(); + virtual int vv(); + int w; +}; + +class A : virtual public V +{ +public: + virtual int f(); +private: + int a; +}; + +class B : public A +{ +public: + int f(); +private: + int b; +}; + +class C : public virtual V +{ +public: + int c; +}; + +class AD +{ +public: + virtual int vg() = 0; +}; + +class D : public AD, virtual public V +{ +public: + static void s(); + virtual int vg(); + virtual int vd(); + int fd(); + int d; +}; + +class E : public B, virtual public V, public D, public C +{ +public: + int f(); + int vg(); + int vv(); + int e; +}; + +D dd; +D* ppd = ⅆ +AD* pAd = ⅆ + +A a; +B b; +C c; +D d; +E e; +V v; +VB vb; + + +A* pAa = &a; +A* pAe = &e; + +B* pBe = &e; + +D* pDd = &d; +D* pDe = &e; + +V* pVa = &a; +V* pVv = &v; +V* pVe = &e; +V* pVd = &d; + +AD* pADe = &e; + +E* pEe = &e; + +VB* pVB = &vb; + +void init() +{ + a.vb = 1; + b.vb = 2; + c.vb = 3; + d.vb = 4; + e.vb = 5; + v.vb = 6; + vb.vb = 7; + + d.d = 1; + e.d = 2; +} + +extern "C" int printf(const char *, ...); + +int all_count = 0; +int failed_count = 0; + +#define TEST(EXPR, EXPECTED) \ + ret = EXPR; \ + if (ret != EXPECTED) {\ + printf("Failed %s is %d, should be %d!\n", #EXPR, ret, EXPECTED); \ + failed_count++; } \ + all_count++; + +int ret; + +void test_calls() +{ + TEST(pAe->f(), 20); + TEST(pAa->f(), 1); + + TEST(pDe->vg(), 202); + TEST(pADe->vg(), 202); + TEST(pDd->vg(), 101); + + TEST(pEe->vvb(), 411); + + TEST(pVB->vvb(), 407); + + TEST(pBe->vvb(), 411); + TEST(pDe->vvb(), 411); + + TEST(pEe->vd(), 282); + TEST(pEe->fvb(), 311); + + TEST(pEe->D::vg(), 102); + printf("Did %d tests, of which %d failed.\n", all_count, failed_count); +} +#ifdef usestubs +extern "C" { + void set_debug_traps(); + void breakpoint(); +}; +#endif + +int main() +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + init(); + + e.w = 7; + e.vb = 11; + + test_calls(); + return 0; + +} + +int A::f() {return 1;} +int B::f() {return 2;} +void D::s() {} +int E::f() {return 20;} +int D::vg() {return 100+d;} +int E::vg() {return 200+d;} +int V::f() {return 600+w;} +int V::vv() {return 400+w;} +int E::vv() {return 450+w;} +int D::fd() {return 250+d;} +int D::vd() {return 280+d;} +int VB::fvb() {return 300+vb;} +int VB::vvb() {return 400+vb;} diff --git a/gdb/testsuite/gdb.c++/virtfunc.exp b/gdb/testsuite/gdb.c++/virtfunc.exp new file mode 100644 index 0000000..dbd575c --- /dev/null +++ b/gdb/testsuite/gdb.c++/virtfunc.exp @@ -0,0 +1,948 @@ +# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" + +if $tracelevel then { + strace $tracelevel +} + +if { [skip_cplus_tests] } { continue } + +set testfile "virtfunc" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +source ${binfile}.ci + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +proc gdb_virtfunc_init {} { + global srcdir subdir binfile + global gdb_prompt + + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language c++\n" + gdb_expect -re "$gdb_prompt $" + send_gdb "set width 0\n" + gdb_expect -re "$gdb_prompt $" +} + +proc gdb_virtfunc_restart {} { + gdb_exit; + gdb_start; + gdb_virtfunc_init; + runto 'test_calls'; +} + +# +# Test printing of the types of various classes. +# + +proc test_ptype_of_classes {} { + global gdb_prompt + global ws + global nl + + # This used to be a fail if it printed "struct" not "class". But + # since this struct doesn't use any special C++ features, it is + # considered right for GDB to print it as "struct". + send_gdb "ptype VA\n" + gdb_expect { + -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;${ws}VA & operator=\\(VA const ?&\\);${ws}VA\\((VA const|const VA) ?&\\);${ws}VA\\((void|)\\);${ws}\}.*$gdb_prompt $" { + pass "ptype VA" + } + -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;((${ws}VA & operator=\\(VA const ?&\\);)|(${ws}VA\\(VA const ?&\\);)|(${ws}VA\\((void|)\\);))*${ws}\}.*$gdb_prompt $" { + pass "ptype VA (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype VA" + } + timeout { + fail "ptype VA (timeout)" + } + } + + send_gdb "ptype VB\n" + gdb_expect { + -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\}.*$gdb_prompt $" { + pass "ptype VB" + } + -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\}.*$gdb_prompt $" { + pass "ptype VB (aCC)" + } + -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const ?&\\);)|(${ws}VB\\(VB const ?&\\);)|(${ws}VB\\((void|)\\);)|(${ws}int fvb\\((void|)\\);)|(${ws}virtual int vvb\\((void|)\\);))*${ws}\}.*$gdb_prompt $" { + pass "ptype VB (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype VB" + } + timeout { + fail "ptype VB (timeout)" + } + } + + send_gdb "ptype V\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype V" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype V (aCC)" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype V (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype V" + } + timeout { + fail "ptype V (timeout)" + } + } + + # The format of a g++ virtual base pointer. + set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?" + + send_gdb "ptype A\n" + gdb_expect { + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype A" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype A" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype A (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const ?&\\);)|(${ws}A\\(int, A const ?&\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype A (obsolescent gcc or gdb)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}$nl$gdb_prompt $" { + # This happens because the type is defined only after it is + # too late. + fail "ptype A (known failure with gcc cygnus-2.4.5-930417)" + # Many of the rest of these tests have the same problem. + return 0 + } + -re ".*$gdb_prompt $" { + fail "ptype A" + } + timeout { + fail "ptype A (timeout)" + } + } + + send_gdb "ptype B\n" + gdb_expect { + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype B" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype B" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype B (aCC)" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const ?&\\);)|(${ws}B\\(int, B const ?&\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype B (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype B" + } + timeout { + fail "ptype B (timeout)" + } + } + + send_gdb "ptype C\n" + gdb_expect { + -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype C" + } + -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype C" + } + -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" { + pass "ptype C (aCC)" + } + -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const ?&\\);)|(${ws}C\\(int, C const ?&\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype C (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype C" + } + timeout { + fail "ptype C (timeout)" + } + } + + send_gdb "ptype AD\n" + gdb_expect { + -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype AD" + } + -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype AD (aCC)" + } + -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const ?&\\);)|(${ws}AD\\(AD const ?&\\);)|(${ws}AD\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype AD (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype AD" + } + timeout { + fail "ptype AD (timeout)" + } + } + + send_gdb "ptype D\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype D" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype D" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype D (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(int, D const ?&\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vd\\((void|)\\);)|(${ws}int fd\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype D (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype D" + } + timeout { + fail "ptype D (timeout)" + } + } + + send_gdb "ptype E\n" + gdb_expect { + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype E" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype E" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\((void|)\\);${ws}virtual int vg \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype E (aCC)" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const ?&\\);)|(${ws}E\\(int, E const ?&\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype E (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype E" + } + timeout { + fail "ptype E (timeout)" + } + } + + send_gdb "ptype dd\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype dd" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype dd" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype dd (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(int, D const ?&\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vd\\((void|)\\);)|(${ws}int fd\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype dd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype dd" + } + timeout { + fail "ptype dd (timeout)" + } + } + + send_gdb "ptype ppd\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype ppd" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype ppd" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype ppd (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(int, D const ?&\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vd\\((void|)\\);)|(${ws}int fd\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype ppd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype ppd" + } + timeout { + fail "ptype ppd (timeout)" + } + } + + send_gdb "ptype pAd\n" + gdb_expect { + -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAd" + } + -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAd (aCC)" + } + -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const ?&\\);)|(${ws}AD\\(AD const ?&\\);)|(${ws}AD\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pAd" + } + timeout { + fail "ptype pAd (timeout)" + } + } + + send_gdb "ptype a\n" + gdb_expect { + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype a" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype a" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype a (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const ?&\\);)|(${ws}A\\(int, A const ?&\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype a (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype a" + } + timeout { + fail "ptype a (timeout)" + } + } + + send_gdb "ptype b\n" + gdb_expect { + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype b" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype b" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype b (aCC)" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const ?&\\);)|(${ws}B\\(int, B const ?&\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype b (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype b" + } + timeout { + fail "ptype b (timeout)" + } + } + + send_gdb "ptype c\n" + gdb_expect { + -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype c" + } + -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype c" + } + -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" { + pass "ptype c (aCC)" + } + -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const ?&\\);)|(${ws}C\\(int, C const ?&\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype c (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype c" + } + timeout { + fail "ptype c (timeout)" + } + } + + send_gdb "ptype d\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype d" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype d" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype d (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(int, D const ?&\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vd\\((void|)\\);)|(${ws}int fd\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype d (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype d" + } + timeout { + fail "ptype d (timeout)" + } + } + + send_gdb "ptype e\n" + gdb_expect { + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype e" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype e" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\((void|)\\);${ws}virtual int vg \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype e (aCC)" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const ?&\\);)|(${ws}E\\(int, E const ?&\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype e (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype e" + } + timeout { + fail "ptype e (timeout)" + } + } + + send_gdb "ptype v\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype v" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype v (aCC)" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype v (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype v" + } + timeout { + fail "ptype v (timeout)" + } + } + + send_gdb "ptype vb\n" + gdb_expect { + -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype vb" + } + -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype vb (aCC)" + } + -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const ?&\\);)|(${ws}VB\\(VB const ?&\\);)|(${ws}VB\\((void|)\\);)|(${ws}int fvb\\((void|)\\);)|(${ws}virtual int vvb\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { + pass "ptype vb (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype vb" + } + timeout { + fail "ptype vb (timeout)" + } + } + + send_gdb "ptype pAa\n" + gdb_expect { + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAa" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAa" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAa (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const ?&\\);)|(${ws}A\\(int, A const ?&\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAa (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pAa" + } + timeout { + fail "ptype pAa (timeout)" + } + } + + send_gdb "ptype pAe\n" + gdb_expect { + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAe" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAe" + } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAe (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const ?&\\);)|(${ws}A\\(int, A const ?&\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pAe" + } + timeout { + fail "ptype pAe (timeout)" + } + } + + send_gdb "ptype pBe\n" + gdb_expect { + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pBe" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pBe" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pBe (aCC)" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const ?&\\);)|(${ws}B\\(int, B const ?&\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pBe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pBe" + } + timeout { + fail "ptype pBe (timeout)" + } + } + + send_gdb "ptype pDd\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDd" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDd" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDd (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(int, D const ?&\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vd\\((void|)\\);)|(${ws}int fd\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pDd" + } + timeout { + fail "ptype pDd (timeout)" + } + } + + send_gdb "ptype pDe\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDe" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDe" + } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDe (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const ?&\\);)|(${ws}D\\(int, D const ?&\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vd\\((void|)\\);)|(${ws}int fd\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pDe" + } + timeout { + fail "ptype pDe (timeout)" + } + } + + send_gdb "ptype pVa\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVa" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVa (aCC)" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVa (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVa" + } + timeout { + fail "ptype pVa (timeout)" + } + } + + send_gdb "ptype pVv\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVv" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVv (aCC)" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVv (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVv" + } + timeout { + fail "ptype pVv (timeout)" + } + } + + send_gdb "ptype pVe\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVe" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVe (aCC)" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVe" + } + timeout { + fail "ptype pVe (timeout)" + } + } + + send_gdb "ptype pVd\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVd" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVd (aCC)" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVd" + } + timeout { + fail "ptype pVd (timeout)" + } + } + + send_gdb "ptype pADe\n" + gdb_expect { + -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pADe" + } + -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pADe (aCC)" + } + -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const ?&\\);)|(${ws}AD\\(AD const ?&\\);)|(${ws}AD\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pADe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pADe" + } + timeout { + fail "ptype pADe (timeout)" + } + } + + send_gdb "ptype pEe\n" + gdb_expect { + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pEe" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pEe" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\((void|)\\);${ws}virtual int vg \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pEe (aCC)" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const ?&\\);)|(${ws}E\\(int, E const ?&\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pEe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pEe" + } + timeout { + fail "ptype pEe (timeout)" + } + } + + send_gdb "ptype pVB\n" + gdb_expect { + -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVB" + } + -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVB (aCC)" + } + -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const ?&\\);)|(${ws}VB\\(VB const ?&\\);)|(${ws}VB\\((void|)\\);)|(${ws}int fvb\\((void|)\\);)|(${ws}virtual int vvb\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVB (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVB" + } + timeout { + fail "ptype pVB (timeout)" + } + } +} + +# +# Test calling of virtual functions. +# + +proc test_virtual_calls {} { + global gdb_prompt + global GDB + global nl + global gcc_compiled + + if [target_info exists gdb,cannot_call_functions] { + setup_xfail "*-*-*" 2416 + fail "This target can not call functions" + return 0 + } + + send_gdb "print pAe->f()\n" + gdb_expect { + -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" } + -re "Cannot invoke functions on this machine.*$gdb_prompt $" { + fail "print pAe->f() (cannot invoke functions, skipping virtual calls)" + return 0 + } + -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" { + fail "print pAe->f() \ +(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)" + return 0 + } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pAe->f()" + } + -re ".*$gdb_prompt $" { fail "print pAe->f()" } + timeout { fail "print pAe->f() (timeout)" } + eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pAa->f()\n" + gdb_expect { + -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pAa->f()" + } + -re ".*$gdb_prompt $" { fail "print pAa->f()" } + timeout { fail "print pAa->f() (timeout)" } + eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pDe->vg()\n" + gdb_expect { + -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pDe->vg()" + } + -re ".*$gdb_prompt $" { fail "print pDe->vg()" } + timeout { fail "print pDe->vg() (timeout)" } + eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pADe->vg()\n" + gdb_expect { + -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pADe->vg()" + } + -re ".*$gdb_prompt $" { fail "print pADe->vg()" } + timeout { fail "print pADe->vg() (timeout)" } + eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pDd->vg()\n" + gdb_expect { + -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pDd->vg()" + } + -re ".*$gdb_prompt $" { fail "print pDd->vg()" } + timeout { fail "print pDd->vg() (timeout)" } + eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->vvb()\n" + gdb_expect { + -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pEe->vvb()" + } + -re ".*$gdb_prompt $" { fail "print pEe->vvb()" } + timeout { fail "print pEe->vvb() (timeout)" } + eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pVB->vvb()\n" + gdb_expect { + -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pVB->vvb()" + } + -re ".*$gdb_prompt $" { fail "print pVB->vvb()" } + timeout { fail "print pVB->vvb() (timeout)" } + eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pBe->vvb()\n" + gdb_expect { + -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pBe->vvb()" + } + -re ".*$gdb_prompt $" { fail "print pBe->vvb()" } + timeout { fail "print pBe->vvb() (timeout)" } + eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pDe->vvb()\n" + gdb_expect { + -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pDe->vvb()" + } + -re ".*$gdb_prompt $" { fail "print pDe->vvb()" } + timeout { fail "print pDe->vvb() (timeout)" } + eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->vd()\n" + gdb_expect { + -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pEe->vd()" + } + -re ".*$gdb_prompt $" { fail "print pEe->vd()" } + timeout { fail "print pEe->vd() (timeout)" } + eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->fvb()\n" + gdb_expect { + -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pEe->fvb()" + } + -re ".*$gdb_prompt $" { fail "print pEe->fvb()" } + timeout { fail "print pEe->fvb() (timeout)" } + eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gstabs+. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gdwarf-2. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gstabs+. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gdwarf-2. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gstabs+. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gdwarf-2. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gstabs+. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gdwarf-2. + # + # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, + # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gstabs+. + # + # -- chastain 2002-02-20 + + send_gdb "print pEe->D::vg()\n" + gdb_expect { + -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" } + -re "Attempt to take address of value not located in memory.\r\n$gdb_prompt $" + { kfail "gdb/1064" "print pEe->D::vg()" } + -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" } + timeout { fail "print pEe->D::vg() (timeout)" } + eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } +} + +proc do_tests {} { + global prms_id + global bug_id + + set prms_id 0 + set bug_id 0 + + gdb_start; + gdb_virtfunc_init; + + runto_main + + test_ptype_of_classes + + if [ runto 'test_calls' ] then { + test_virtual_calls + } +} + +do_tests diff --git a/gdb/testsuite/gdb.objc/Makefile.in b/gdb/testsuite/gdb.objc/Makefile.in new file mode 100644 index 0000000..381e48a --- /dev/null +++ b/gdb/testsuite/gdb.objc/Makefile.in @@ -0,0 +1,22 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = basicclass + +all: + @echo "Nothing to be done for all..." + +info: +install-info: +dvi: +install: +uninstall: force +installcheck: +check: + +clean mostlyclean: + -rm -f *~ *.o *.ci + -rm -f core ${EXECUTABLES} + +distclean maintainer-clean realclean: clean + -rm -f Makefile config.status config.log diff --git a/gdb/testsuite/gdb.objc/basicclass.exp b/gdb/testsuite/gdb.objc/basicclass.exp new file mode 100644 index 0000000..44b709e --- /dev/null +++ b/gdb/testsuite/gdb.objc/basicclass.exp @@ -0,0 +1,199 @@ +# Copyright 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This file was written by Adam Fedor (fedor@gnu.org) + +if $tracelevel then { + strace $tracelevel +} + +set testfile "basicclass" +set srcfile ${testfile}.m +set binfile ${objdir}/${subdir}/${testfile} + +# +# Objective-C program compilation isn't standard. We need to figure out +# which libraries to link in. Most of the time it uses pthread +# +if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# +# Deduce language of main() +# + +proc deduce_language_of_main {} { + global gdb_prompt + + # See what language gdb thinks main() is, prior to reading full symbols. + # I think this fails for COFF targets. + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"auto; currently objective-c\".*$gdb_prompt $" { + pass "deduced language is Objective-C, before full symbols" + } + -re ".*$gdb_prompt $" { + fail "source language not correct for Objective-C (psymtabs only)" + return + } + timeout { + fail "can't show language (timeout)" + return + } + } + + runto_main + + # See if our idea of the language has changed. + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"auto; currently objective-c\".*$gdb_prompt $" { + pass "deduced language is Objective-C, after full symbols" + } + -re ".*$gdb_prompt $" { + fail "source language not correct for Objective-C (full symbols)" + return + } + timeout { + fail "can't show language (timeout)" + return + } + } +} + +proc do_objc_tests {} { + global prms_id + global bug_id + global subdir + global objdir + global srcdir + global binfile + global gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + deduce_language_of_main +} + +do_objc_tests + +# +# Breakpoint tests +# +gdb_test "break doIt" \ + "Breakpoint.*at.* file .*$srcfile, line.29.*" \ + "breakpoint method" + +gdb_test "break takeArg:" \ + "Breakpoint.*at.* file .*$srcfile, line.34.*" \ + "breakpoint method with colon" + +gdb_test "break newWithArg:" \ + "Breakpoint.*at.* file .*$srcfile, line.22.*" \ + "breakpoint class method with colon" + +# +# Continue until breakpoint (test re-setting breakpoint) +# +gdb_test continue \ + "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass takeArg:. \\(self=.*, _cmd=.*, arg=.*\\) at .*$srcfile:34.*" \ + "continue until method breakpoint" + +# +# Test resetting breakpoints when re-running program +# +send_gdb "run\n" +gdb_expect { + -re "The program .* has been started already.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*$gdb_prompt $"\ + { pass "resetting breakpoints when rerunning" } + -re ".*$gdb_prompt $" { fail "resetting breakpoints when rerunning" } + timeout { fail "resetting breakpoints when rerunning" } +} + +# +# Continue until breakpoint (test re-setting breakpoint) +# +gdb_test continue \ + "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass takeArg:. \\(self=.*, _cmd=.*, arg=.*\\) at .*$srcfile:34.*" \ + "continue until method breakpoint" + +# +# Test printing objects +# +gdb_test "print object" \ + "\\$\[0-9\] = .*0x0" \ + " print an ivar of self" + +gdb_test "print self" \ + "\\$\[0-9\] = \\(.*BasicClass \\*\\) 0x\[0-9a-f\]+" \ + " print self" + +gdb_test "print \*self" \ + "\\$\[0-9\] = \{isa = 0x\[0-9a-f\]+, object = 0x0\}" \ + " print contents of self" + +# +# Break in a category +# +gdb_test "break hiddenMethod" \ + "Breakpoint.*at.* file .*$srcfile, line.61." \ + "breakpoint in category method" + + +# +# Continue until breakpoint (test re-setting category breakpoint) +# +gdb_test continue \ + "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass\\(Private\\) hiddenMethod. \\(self=.*, _cmd=.*\\) at .*$srcfile:61.*" \ + "continue until category method" + +# +# Test calling Objective-C methods +# +gdb_test "print \[self printHi\]" \ + "Hi.*\\$\[0-9\] = \[0-9\]+" \ + "Call an Objective-C method with no arguments" + +gdb_test "print \[self printNumber: 42\]" \ + "42.*\\$\[0-9\] = 43" \ + "Call an Objective-C method with one argument" + +# +# Test printing the object description +# +gdb_test "print-object object" \ + "BasicClass gdb test object" \ + "Use of the print-object command" + +gdb_test "po self" \ + "BasicClass gdb test object" \ + "Use of the po (print-object) command" + + diff --git a/gdb/testsuite/gdb.objc/basicclass.m b/gdb/testsuite/gdb.objc/basicclass.m new file mode 100644 index 0000000..0de12db --- /dev/null +++ b/gdb/testsuite/gdb.objc/basicclass.m @@ -0,0 +1,81 @@ +#include + +@interface BasicClass: Object +{ + id object; +} ++ newWithArg: arg; +- doIt; +- takeArg: arg; +- printHi; +- (int) printNumber: (int)number; +- (const char *) myDescription; +@end + +@interface BasicClass (Private) +- hiddenMethod; +@end + +@implementation BasicClass ++ newWithArg: arg +{ + id obj = [self new]; + [obj takeArg: arg]; + return obj; +} + +- doIt +{ + return self; +} + +- takeArg: arg +{ + object = arg; + [self hiddenMethod]; + return self; +} + +- printHi +{ + printf("Hi\n"); + return self; +} + +- (int) printNumber: (int)number +{ + printf("%d\n", number); + return number+1; +} + +- (const char *) myDescription +{ + return "BasicClass gdb test object"; +} + +@end + +@implementation BasicClass (Private) +- hiddenMethod +{ + return self; +} +@end + +int main (int argc, const char *argv[]) +{ + id obj; + obj = [BasicClass new]; + [obj takeArg: obj]; + return 0; +} + +const char *_NSPrintForDebugger(id object) +{ + /* This is not really what _NSPrintForDebugger should do, but it + is a simple test if gdb can call this function */ + if (object && [object respondsTo: @selector(myDescription)]) + return [object myDescription]; + + return NULL; +} diff --git a/gdb/top.c b/gdb/top.c index 24410c4..3efebec 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -490,7 +490,7 @@ struct catch_errors_args void *func_args; }; -int +static int do_catch_errors (struct ui_out *uiout, void *data) { struct catch_errors_args *args = data; @@ -1061,7 +1061,7 @@ static int operate_saved_history = -1; /* This is put on the appropriate hook and helps operate-and-get-next do its work. */ -void +static void gdb_rl_operate_and_get_next_completion (void) { int delta = where_history () - operate_saved_history; diff --git a/gdb/top.h b/gdb/top.h index b103040..50361dc 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -72,4 +72,14 @@ extern int history_expansion_p; extern int server_command; extern char *lim_at_start; +extern void show_commands (char *args, int from_tty); + +extern void set_history (char *, int); + +extern void show_history (char *, int); + +extern void set_verbose (char *, int, struct cmd_list_element *); + +extern void do_restore_instream_cleanup (void *stream); + #endif diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 17ee07c..3b1cfd5 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -38,6 +38,7 @@ #include "completer.h" #include "gdb-events.h" #include "block.h" +#include "dictionary.h" #include "ax.h" #include "ax-gdb.h" @@ -1289,13 +1290,14 @@ add_local_symbols (struct collection_list *collect, CORE_ADDR pc, { struct symbol *sym; struct block *block; - int i, count = 0; + struct dict_iterator iter; + int count = 0; block = block_for_pc (pc); while (block != 0) { QUIT; /* allow user to bail out with ^C */ - ALL_BLOCK_SYMBOLS (block, i, sym) + ALL_BLOCK_SYMBOLS (block, iter, sym) { switch (SYMBOL_CLASS (sym)) { @@ -2333,7 +2335,8 @@ scope_info (char *args, int from_tty) struct minimal_symbol *msym; struct block *block; char **canonical, *symname, *save_args = args; - int i, j, count = 0; + struct dict_iterator iter; + int j, count = 0; if (args == 0 || *args == 0) error ("requires an argument (function, line or *addr) to define a scope"); @@ -2349,7 +2352,7 @@ scope_info (char *args, int from_tty) while (block != 0) { QUIT; /* allow user to bail out with ^C */ - ALL_BLOCK_SYMBOLS (block, i, sym) + ALL_BLOCK_SYMBOLS (block, iter, sym) { QUIT; /* allow user to bail out with ^C */ if (count == 0) diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c new file mode 100644 index 0000000..92e6f83 --- /dev/null +++ b/gdb/trad-frame.c @@ -0,0 +1,96 @@ +/* Traditional frame unwind support, for GDB the GNU Debugger. + + Copyright 2003 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 "frame.h" +#include "trad-frame.h" +#include "regcache.h" + +/* A traditional frame is unwound by analysing the function prologue + and using the information gathered to track registers. For + non-optimized frames, the technique is reliable (just need to check + for all potential instruction sequences). */ + +struct trad_frame_saved_reg * +trad_frame_alloc_saved_regs (struct frame_info *next_frame) +{ + int regnum; + struct gdbarch *gdbarch = get_frame_arch (next_frame); + int numregs = NUM_REGS + NUM_PSEUDO_REGS; + struct trad_frame_saved_reg *this_saved_regs + = FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg); + for (regnum = 0; regnum < numregs; regnum++) + this_saved_regs[regnum].realnum = regnum; + return this_saved_regs; +} + +void +trad_frame_register_value (struct trad_frame_saved_reg this_saved_regs[], + int regnum, LONGEST val) +{ + /* Make the REALNUM invalid, indicating that the ADDR contains the + register's value. */ + this_saved_regs[regnum].realnum = -1; + this_saved_regs[regnum].addr = val; +} + +void +trad_frame_prev_register (struct frame_info *next_frame, + struct trad_frame_saved_reg this_saved_regs[], + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *bufferp) +{ + struct gdbarch *gdbarch = get_frame_arch (next_frame); + if (this_saved_regs[regnum].realnum >= 0 + && this_saved_regs[regnum].addr != 0) + { + /* The register was saved in memory. */ + *optimizedp = 0; + *lvalp = lval_memory; + *addrp = this_saved_regs[regnum].addr; + *realnump = -1; + if (bufferp != NULL) + { + /* Read the value in from memory. */ + get_frame_memory (next_frame, this_saved_regs[regnum].addr, bufferp, + register_size (gdbarch, regnum)); + } + } + else if (this_saved_regs[regnum].realnum >= 0 + && this_saved_regs[regnum].addr == 0) + { + /* As the next frame to return the value of the register. */ + frame_register_unwind (next_frame, this_saved_regs[regnum].realnum, + optimizedp, lvalp, addrp, realnump, bufferp); + } + else + { + /* The register's value is available. */ + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (bufferp != NULL) + store_unsigned_integer (bufferp, register_size (gdbarch, regnum), + this_saved_regs[regnum].addr); + } +} diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h new file mode 100644 index 0000000..4d75315 --- /dev/null +++ b/gdb/trad-frame.h @@ -0,0 +1,68 @@ +/* Traditional frame unwind support, for GDB the GNU Debugger. + + Copyright 2003 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 TRAD_FRAME_H +#define TRAD_FRAME_H + +/* A traditional saved regs table, indexed by REGNUM, encoding where + the value of REGNUM for the previous frame can be found in this + frame. + + The table is initialized with an identity encoding (ADDR == 0, + REALNUM == REGNUM) indicating that the value of REGNUM in the + previous frame can be found in register REGNUM (== REALNUM) in this + frame. + + The initial encoding can then be changed: + + Modify ADDR (REALNUM >= 0, ADDR != 0) to indicate that the value of + register REGNUM in the previous frame can be found in memory at + ADDR in this frame. + + Modify REALNUM (REALNUM >= 0, ADDR == 0) to indicate that the value + of register REGNUM in the previous frame is found in register + REALNUM in this frame. + + Call trad_frame_register_value (REALNUM < 0) to indicate that the + value of register REGNUM in the previous frame is found in ADDR. */ + +struct trad_frame_saved_reg +{ + LONGEST addr; /* A CORE_ADDR fits in a longest. */ + int realnum; +}; + +/* Convenience function, encode REGNUM's location in the trad-frame. */ +void trad_frame_register_value (struct trad_frame_saved_reg this_saved_regs[], + int regnum, LONGEST val); + +/* Return a freshly allocated (and initialized) trad_frame array. */ +struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame); + +/* Given the trad_frame info, return the location of the specified + register. */ +void trad_frame_prev_register (struct frame_info *next_frame, + struct trad_frame_saved_reg this_saved_regs[], + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *bufferp); + +#endif diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index f44f9aa..79a3353 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,14 @@ +2003-06-12 Andreas Schwab + + * tuiSource.c (tuiVerticalSourceScroll): Use get_frame_pc. + * tuiSourceWin.c (tuiHorizontalSourceScroll): Likewise. + * tuiStack.c (tui_get_function_from_frame): Likewise. + (tuiShowFrameInfo): Likewise. + * tuiWin.c (_makeVisibleWithNewHeight): Likewise. + * tui-hooks.c (tui_selected_frame_level_changed_hook): Likewise. + * tuiDisassem.c (tuiVerticalDisassemScroll): Likewise. + Include "disasm.h". + 2003-05-08 Andrew Cagney * tuiRegs.c: Use MAX_REGISTER_SIZE instead of diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index db6c3f6..569ab07 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -250,7 +250,7 @@ tui_selected_frame_level_changed_hook (int level) { struct symtab *s; - s = find_pc_symtab (fi->pc); + s = find_pc_symtab (get_frame_pc (fi)); /* elz: this if here fixes the problem with the pc not being displayed in the tui asm layout, with no debug symbols. The value of s would be 0 here, and select_source_symtab would abort the diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index 0ddf32c..a8668c4 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -45,6 +45,7 @@ #include "frame.h" #include "value.h" #include "source.h" +#include "disasm.h" #include "tui.h" #include "tuiData.h" @@ -408,7 +409,7 @@ tuiVerticalDisassemScroll (TuiScrollDirection scrollDirection, content = (TuiWinContent) disassemWin->generic.content; if (cursal.symtab == (struct symtab *) NULL) - s = find_pc_symtab (deprecated_selected_frame->pc); + s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); else s = cursal.symtab; diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c index ceccd64..68e7d99 100644 --- a/gdb/tui/tuiSource.c +++ b/gdb/tui/tuiSource.c @@ -340,7 +340,7 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, struct symtab_and_line cursal = get_current_source_symtab_and_line (); if (cursal.symtab == (struct symtab *) NULL) - s = find_pc_symtab (deprecated_selected_frame->pc); + s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); else s = cursal.symtab; diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c index ae844ce..cd52333 100644 --- a/gdb/tui/tuiSourceWin.c +++ b/gdb/tui/tuiSourceWin.c @@ -355,7 +355,7 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, struct symtab_and_line cursal = get_current_source_symtab_and_line (); if (cursal.symtab == (struct symtab *) NULL) - s = find_pc_symtab (deprecated_selected_frame->pc); + s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); else s = cursal.symtab; diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c index 69a6b6c..dca0618 100644 --- a/gdb/tui/tuiStack.c +++ b/gdb/tui/tuiStack.c @@ -233,7 +233,7 @@ tui_get_function_from_frame (struct frame_info *fi) struct ui_file *stream = tui_sfileopen (256); char *p; - print_address_symbolic (fi->pc, stream, demangle, ""); + print_address_symbolic (get_frame_pc (fi), stream, demangle, ""); p = tui_file_get_strbuf (stream); /* Use simple heuristics to isolate the function name. The symbol can @@ -356,7 +356,7 @@ tuiShowFrameInfo (struct frame_info *fi) tui_set_locator_info (sal.symtab == 0 ? "??" : sal.symtab->filename, tui_get_function_from_frame (fi), sal.line, - fi->pc); + get_frame_pc (fi)); tuiShowLocatorContent (); startLine = 0; for (i = 0; i < (sourceWindows ())->count; i++) @@ -374,10 +374,11 @@ tuiShowFrameInfo (struct frame_info *fi) } else { - if (find_pc_partial_function (fi->pc, (char **) NULL, &low, (CORE_ADDR) NULL) == 0) + if (find_pc_partial_function (get_frame_pc (fi), (char **) NULL, + &low, (CORE_ADDR) NULL) == 0) error ("No function contains program counter for selected frame.\n"); else - low = tuiGetLowDisassemblyAddress (low, fi->pc); + low = tuiGetLowDisassemblyAddress (low, get_frame_pc (fi)); } if (winInfo == srcWin) diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index 9ad82f5..268562e 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -1406,7 +1406,7 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) struct symtab_and_line cursal = get_current_source_symtab_and_line (); - s = find_pc_symtab (deprecated_selected_frame->pc); + s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); if (winInfo->generic.type == SRC_WIN) line.lineNo = cursal.line; else diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 22a1eab..a9a7447 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -33,7 +33,7 @@ #include "target.h" #include "language.h" #include "cp-abi.h" - +#include "typeprint.h" #include "gdb_string.h" #include diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 3af6d2c..6ad5414 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -25,9 +25,12 @@ #include "ui-file.h" #include "gdb_string.h" +#include + static ui_file_isatty_ftype null_file_isatty; static ui_file_write_ftype null_file_write; static ui_file_fputs_ftype null_file_fputs; +static ui_file_read_ftype null_file_read; static ui_file_flush_ftype null_file_flush; static ui_file_delete_ftype null_file_delete; static ui_file_rewind_ftype null_file_rewind; @@ -39,6 +42,7 @@ struct ui_file ui_file_flush_ftype *to_flush; ui_file_write_ftype *to_write; ui_file_fputs_ftype *to_fputs; + ui_file_read_ftype *to_read; ui_file_delete_ftype *to_delete; ui_file_isatty_ftype *to_isatty; ui_file_rewind_ftype *to_rewind; @@ -56,6 +60,7 @@ ui_file_new (void) set_ui_file_flush (file, null_file_flush); set_ui_file_write (file, null_file_write); set_ui_file_fputs (file, null_file_fputs); + set_ui_file_read (file, null_file_read); set_ui_file_isatty (file, null_file_isatty); set_ui_file_rewind (file, null_file_rewind); set_ui_file_put (file, null_file_put); @@ -123,6 +128,15 @@ null_file_write (struct ui_file *file, } } +static long +null_file_read (struct ui_file *file, + char *buf, + long sizeof_buf) +{ + errno = EBADF; + return 0; +} + static void null_file_fputs (const char *buf, struct ui_file *file) { @@ -186,6 +200,12 @@ ui_file_write (struct ui_file *file, file->to_write (file, buf, length_buf); } +long +ui_file_read (struct ui_file *file, char *buf, long length_buf) +{ + return file->to_read (file, buf, length_buf); +} + void fputs_unfiltered (const char *buf, struct ui_file *file) { @@ -224,6 +244,12 @@ set_ui_file_write (struct ui_file *file, } void +set_ui_file_read (struct ui_file *file, ui_file_read_ftype *read) +{ + file->to_read = read; +} + +void set_ui_file_fputs (struct ui_file *file, ui_file_fputs_ftype *fputs) { file->to_fputs = fputs; @@ -383,6 +409,7 @@ mem_file_write (struct ui_file *file, static ui_file_write_ftype stdio_file_write; static ui_file_fputs_ftype stdio_file_fputs; +static ui_file_read_ftype stdio_file_read; static ui_file_isatty_ftype stdio_file_isatty; static ui_file_delete_ftype stdio_file_delete; static struct ui_file *stdio_file_new (FILE * file, int close_p); @@ -409,6 +436,7 @@ stdio_file_new (FILE *file, int close_p) set_ui_file_flush (ui_file, stdio_file_flush); set_ui_file_write (ui_file, stdio_file_write); set_ui_file_fputs (ui_file, stdio_file_fputs); + set_ui_file_read (ui_file, stdio_file_read); set_ui_file_isatty (ui_file, stdio_file_isatty); return ui_file; } @@ -437,6 +465,16 @@ stdio_file_flush (struct ui_file *file) fflush (stdio->file); } +static long +stdio_file_read (struct ui_file *file, char *buf, long length_buf) +{ + struct stdio_file *stdio = ui_file_data (file); + if (stdio->magic != &stdio_file_magic) + internal_error (__FILE__, __LINE__, + "stdio_file_read: bad magic number"); + return read (fileno (stdio->file), buf, length_buf); +} + static void stdio_file_write (struct ui_file *file, const char *buf, long length_buf) { diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 989c343..8b28d1a 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -41,6 +41,9 @@ extern void set_ui_file_write (struct ui_file *stream, ui_file_write_ftype *fput typedef void (ui_file_fputs_ftype) (const char *, struct ui_file * stream); extern void set_ui_file_fputs (struct ui_file *stream, ui_file_fputs_ftype * fputs); +typedef long (ui_file_read_ftype) (struct ui_file * stream, char *buf, long length_buf); +extern void set_ui_file_read (struct ui_file *stream, ui_file_read_ftype *fread); + typedef int (ui_file_isatty_ftype) (struct ui_file * stream); extern void set_ui_file_isatty (struct ui_file *stream, ui_file_isatty_ftype * isatty); @@ -78,6 +81,8 @@ extern char *ui_file_xstrdup (struct ui_file *file, long *length); +extern long ui_file_read (struct ui_file *file, char *buf, long length_buf); + /* Create/open a memory based file. Can be used as a scratch buffer for collecting output. */ extern struct ui_file *mem_fileopen (void); diff --git a/gdb/ui-out.c b/gdb/ui-out.c index ed32da3..71e6d6a 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -437,15 +437,6 @@ make_cleanup_ui_out_end (struct ui_out *uiout, } struct cleanup * -make_cleanup_ui_out_begin_end (struct ui_out *uiout, - enum ui_out_type type, - const char *id) -{ - ui_out_begin (uiout, type, id); - return make_cleanup_ui_out_end (uiout, type); -} - -struct cleanup * make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout, const char *id) { diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index f415af1..19bdec3 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -797,7 +797,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) when trying to get the value of caller-saves registers for an inner frame. */ -CORE_ADDR +static CORE_ADDR v850_find_callers_reg (struct frame_info *fi, int regnum) { for (; fi; fi = get_next_frame (fi)) @@ -819,7 +819,7 @@ v850_find_callers_reg (struct frame_info *fi, int regnum) just return the stack pointer that was in use at the time the function call was made. */ -CORE_ADDR +static CORE_ADDR v850_frame_chain (struct frame_info *fi) { struct prologue_info pi; @@ -850,7 +850,7 @@ v850_frame_chain (struct frame_info *fi) /* Function: skip_prologue Return the address of the first code past the prologue of the function. */ -CORE_ADDR +static CORE_ADDR v850_skip_prologue (CORE_ADDR pc) { CORE_ADDR func_addr, func_end; @@ -880,7 +880,7 @@ v850_skip_prologue (CORE_ADDR pc) This routine gets called when either the user uses the `return' command, or the call dummy breakpoint gets hit. */ -void +static void v850_pop_frame (void) { struct frame_info *frame = get_current_frame (); @@ -917,7 +917,7 @@ v850_pop_frame (void) Stack space for the args has NOT been allocated: that job is up to us. */ -CORE_ADDR +static CORE_ADDR v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { @@ -997,7 +997,7 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, Set up the return address for the inferior function call. Needed for targets where we don't actually execute a JSR/BSR instruction */ -CORE_ADDR +static CORE_ADDR v850_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { write_register (E_RP_REGNUM, CALL_DUMMY_ADDRESS ()); @@ -1011,7 +1011,7 @@ v850_push_return_address (CORE_ADDR pc, CORE_ADDR sp) instead of RP, because that's where "caller" of the dummy-frame will be found. */ -CORE_ADDR +static CORE_ADDR v850_frame_saved_pc (struct frame_info *fi) { if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), @@ -1030,7 +1030,7 @@ v850_frame_saved_pc (struct frame_info *fi) trap */ -void +static void v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p) { @@ -1231,12 +1231,12 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, v850_register_name); set_gdbarch_deprecated_register_size (gdbarch, v850_reg_size); set_gdbarch_deprecated_register_bytes (gdbarch, E_ALL_REGS_SIZE); - set_gdbarch_register_byte (gdbarch, v850_register_byte); - set_gdbarch_register_raw_size (gdbarch, v850_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, v850_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, v850_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, v850_reg_size); - set_gdbarch_register_virtual_size (gdbarch, v850_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, v850_register_raw_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, v850_reg_size); - set_gdbarch_register_virtual_type (gdbarch, v850_reg_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, v850_reg_virtual_type); set_gdbarch_deprecated_target_read_fp (gdbarch, v850_target_read_fp); @@ -1262,8 +1262,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); /* This value is almost never non-zero... */ set_gdbarch_frame_args_skip (gdbarch, 0); - /* OK to default this value to 'unknown'. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* * Call Dummies @@ -1288,11 +1286,13 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); return gdbarch; } +extern initialize_file_ftype _initialize_v850_tdep; /* -Wmissing-prototypes */ + void _initialize_v850_tdep (void) { diff --git a/gdb/valops.c b/gdb/valops.c index e6fb6c8..2767630 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -35,6 +35,8 @@ #include "cp-abi.h" #include "block.h" #include "infcall.h" +#include "dictionary.h" +#include "cp-support.h" #include #include "gdb_string.h" @@ -2475,7 +2477,6 @@ value_of_local (const char *name, int complain) { struct symbol *func, *sym; struct block *b; - int i; struct value * ret; if (deprecated_selected_frame == 0) @@ -2496,8 +2497,7 @@ value_of_local (const char *name, int complain) } b = SYMBOL_BLOCK_VALUE (func); - i = BLOCK_NSYMS (b); - if (i <= 0) + if (dict_empty (BLOCK_DICT (b))) { if (complain) error ("no args, no `%s'", name); diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index fe96e7f..1b6f8ca 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -34,10 +34,6 @@ #include "vax-tdep.h" static gdbarch_register_name_ftype vax_register_name; -static gdbarch_register_byte_ftype vax_register_byte; -static gdbarch_register_raw_size_ftype vax_register_raw_size; -static gdbarch_register_virtual_size_ftype vax_register_virtual_size; -static gdbarch_register_virtual_type_ftype vax_register_virtual_type; static gdbarch_skip_prologue_ftype vax_skip_prologue; static gdbarch_frame_num_args_ftype vax_frame_num_args; @@ -162,40 +158,24 @@ vax_frame_saved_pc (struct frame_info *frame) return (read_memory_integer (get_frame_base (frame) + 16, 4)); } -CORE_ADDR -vax_frame_args_address_correct (struct frame_info *frame) -{ - /* Cannot find the AP register value directly from the FP value. Must - find it saved in the frame called by this one, or in the AP register - for the innermost frame. However, there is no way to tell the - difference between the innermost frame and a frame for which we - just don't know the frame that it called (e.g. "info frame 0x7ffec789"). - For the sake of argument, suppose that the stack is somewhat trashed - (which is one reason that "info frame" exists). So, return 0 (indicating - we don't know the address of the arglist) if we don't know what frame - this frame calls. */ - if (get_next_frame (frame)) - return (read_memory_integer (get_frame_base (get_next_frame (frame)) + 8, 4)); - - return (0); -} - static CORE_ADDR vax_frame_args_address (struct frame_info *frame) { - /* In most of GDB, getting the args address is too important to - just say "I don't know". This is sometimes wrong for functions - that aren't on top of the stack, but c'est la vie. */ + /* In most of GDB, getting the args address is too important to just + say "I don't know". This is sometimes wrong for functions that + aren't on top of the stack, but c'est la vie. */ if (get_next_frame (frame)) return (read_memory_integer (get_frame_base (get_next_frame (frame)) + 8, 4)); - - return (read_register (VAX_AP_REGNUM)); -} - -static CORE_ADDR -vax_frame_locals_address (struct frame_info *frame) -{ - return (get_frame_base (frame)); + /* Cannot find the AP register value directly from the FP value. + Must find it saved in the frame called by this one, or in the AP + register for the innermost frame. However, there is no way to + tell the difference between the innermost frame and a frame for + which we just don't know the frame that it called (e.g. "info + frame 0x7ffec789"). For the sake of argument, suppose that the + stack is somewhat trashed (which is one reason that "info frame" + exists). So, return 0 (indicating we don't know the address of + the arglist) if we don't know what frame this frame calls. */ + return 0; } static int @@ -381,13 +361,13 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, vax_register_name); set_gdbarch_deprecated_register_size (gdbarch, VAX_REGISTER_SIZE); set_gdbarch_deprecated_register_bytes (gdbarch, VAX_REGISTER_BYTES); - set_gdbarch_register_byte (gdbarch, vax_register_byte); - set_gdbarch_register_raw_size (gdbarch, vax_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, vax_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, vax_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, VAX_MAX_REGISTER_RAW_SIZE); - set_gdbarch_register_virtual_size (gdbarch, vax_register_virtual_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, vax_register_virtual_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, VAX_MAX_REGISTER_VIRTUAL_SIZE); - set_gdbarch_register_virtual_type (gdbarch, vax_register_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, vax_register_virtual_type); /* Frame and stack info */ set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue); @@ -401,7 +381,6 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_saved_pc (gdbarch, vax_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address); - set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, vax_frame_init_saved_regs); @@ -435,7 +414,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_believe_pcc_promotion (gdbarch, 1); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); @@ -445,6 +424,8 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return (gdbarch); } +extern initialize_file_ftype _initialize_vax_tdep; /* -Wmissing-prototypes */ + void _initialize_vax_tdep (void) { diff --git a/gdb/version.in b/gdb/version.in index 0577be7..d7456ac 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-06-06-cvs +2003-06-13-cvs diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 72e8c3f..c2227cd 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -842,14 +842,17 @@ solib_symbols_add (char *name, int from_tty, CORE_ADDR load_addr) else { /* Fallback on handling just the .text section. */ - struct section_addr_info section_addrs; + struct section_addr_info *section_addrs; + struct cleanup *my_cleanups; - memset (§ion_addrs, 0, sizeof (section_addrs)); - section_addrs.other[0].name = ".text"; - section_addrs.other[0].addr = load_addr; + section_addrs = alloc_section_addr_info (1); + my_cleanups = make_cleanup (xfree, section_addrs); + section_addrs->other[0].name = ".text"; + section_addrs->other[0].addr = load_addr; result = safe_symbol_file_add (name, from_tty, §ion_addrs, 0, OBJF_SHARED); + do_cleanups (my_cleanups); } return result; diff --git a/gdb/wince.c b/gdb/wince.c index 322564e..41541dc 100644 --- a/gdb/wince.c +++ b/gdb/wince.c @@ -56,6 +56,9 @@ #include "wince-stub.h" #include #include "regcache.h" +#ifdef MIPS +#include "mips-tdep.h" +#endif /* The ui's event loop. */ extern int (*ui_loop_hook) (int signo); diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 0b2f691..6c38f8d 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -783,7 +783,7 @@ x86_64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* ...and fake a frame pointer. */ regcache_cooked_write (regcache, X86_64_RBP_REGNUM, buf); - return sp; + return sp + 16; } @@ -1122,12 +1122,6 @@ static const struct frame_base x86_64_frame_base = x86_64_frame_base_address }; -static void -x86_64_save_dummy_frame_tos (CORE_ADDR sp) -{ - generic_save_dummy_frame_tos (sp + 16); -} - static struct frame_id x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -1196,7 +1190,6 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_unwind_dummy_id (gdbarch, x86_64_unwind_dummy_id); - set_gdbarch_save_dummy_frame_tos (gdbarch, x86_64_save_dummy_frame_tos); /* FIXME: kettenis/20021026: This is ELF-specific. Fine for now, since all supported x86-64 targets are ELF, but that might change diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 5a0b286..de23d5d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2981,9 +2981,10 @@ xcoff_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) asection *sect = NULL; int i; - objfile->num_sections = SECT_OFF_MAX; + objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS); + obstack_alloc (&objfile->psymbol_obstack, + SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); /* Initialize the section indexes for future use. */ sect = bfd_get_section_by_name (objfile->obfd, ".text"); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 97cdd0a..9c0c70a 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -307,7 +307,7 @@ xstormy16_push_arguments (int nargs, struct value **args, CORE_ADDR sp, (which may or may not be the same as before). */ -CORE_ADDR +static CORE_ADDR xstormy16_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { unsigned char buf[xstormy16_pc_size]; @@ -995,7 +995,7 @@ xstormy16_stack_align (CORE_ADDR addr) return addr; } -void +static void xstormy16_save_dummy_frame_tos (CORE_ADDR sp) { generic_save_dummy_frame_tos (sp - xstormy16_pc_size); @@ -1039,12 +1039,12 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, xstormy16_register_name); set_gdbarch_deprecated_register_size (gdbarch, xstormy16_reg_size); set_gdbarch_deprecated_register_bytes (gdbarch, E_ALL_REGS_SIZE); - set_gdbarch_register_byte (gdbarch, xstormy16_register_byte); - set_gdbarch_register_raw_size (gdbarch, xstormy16_register_raw_size); + set_gdbarch_deprecated_register_byte (gdbarch, xstormy16_register_byte); + set_gdbarch_deprecated_register_raw_size (gdbarch, xstormy16_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, xstormy16_pc_size); - set_gdbarch_register_virtual_size (gdbarch, xstormy16_register_raw_size); + set_gdbarch_deprecated_register_virtual_size (gdbarch, xstormy16_register_raw_size); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4); - set_gdbarch_register_virtual_type (gdbarch, xstormy16_reg_virtual_type); + set_gdbarch_deprecated_register_virtual_type (gdbarch, xstormy16_reg_virtual_type); /* * Frame Info @@ -1075,8 +1075,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); /* This value is almost never non-zero... */ set_gdbarch_frame_args_skip (gdbarch, 0); - /* OK to default this value to 'unknown'. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* * Call Dummies @@ -1114,7 +1112,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) xstormy16_in_solib_call_trampoline); /* Should be using push_dummy_call. */ - set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); return gdbarch; } @@ -1123,6 +1121,8 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) Initializer function for the Sanyo Xstormy16a module. Called by gdb at start-up. */ +extern initialize_file_ftype _initialize_xstormy16_tdep; /* -Wmissing-prototypes */ + void _initialize_xstormy16_tdep (void) { diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index db652e2..eb4b7cc 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,12 @@ +2003-06-13 Robert Millan + + * common.h (GNU_ABI_TAG_NETBSD): New tag. + (GNU_ABI_TAG_FREEBSD): New tag. + +2003-06-10 Richard Sandiford + + * h8.h (E_H8_MACH_H8300SXN): New flag. + 2003-06-03 Nick Clifton * v850.h (R_V850_32): Rename to R_V850_ABS32. diff --git a/include/elf/common.h b/include/elf/common.h index 3635bbb..1a84339 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -397,6 +397,8 @@ #define GNU_ABI_TAG_LINUX 0 #define GNU_ABI_TAG_HURD 1 #define GNU_ABI_TAG_SOLARIS 2 +#define GNU_ABI_TAG_FREEBSD 3 +#define GNU_ABI_TAG_NETBSD 4 /* Values for NetBSD .note.netbsd.ident notes. Note name is "NetBSD". */ diff --git a/include/elf/h8.h b/include/elf/h8.h index 79c0a34..1aad7a4 100644 --- a/include/elf/h8.h +++ b/include/elf/h8.h @@ -95,5 +95,6 @@ END_RELOC_NUMBERS (R_H8_max) #define E_H8_MACH_H8300HN 0x00830000 #define E_H8_MACH_H8300SN 0x00840000 #define E_H8_MACH_H8300SX 0x00850000 +#define E_H8_MACH_H8300SXN 0x00860000 #endif diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index 77a8551..79c8178 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,7 @@ +2003-06-10 Corinna Vinschen + + * gdb/fileio.h: New file. + 2003-05-07 Andrew Cagney * sim-d10v.h (sim_d10v_translate_addr): Add regcache parameter. diff --git a/include/gdb/fileio.h b/include/gdb/fileio.h new file mode 100644 index 0000000..d844781 --- /dev/null +++ b/include/gdb/fileio.h @@ -0,0 +1,146 @@ +/* Hosted File I/O interface definitions, for GDB, the GNU Debugger. + + Copyright 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef GDB_FILEIO_H_ +#define GDB_FILEIO_H_ + +/* The following flags are defined to be independent of the host + as well as the target side implementation of these constants. + All constants are defined with a leading FILEIO_ in the name + to allow the usage of these constants together with the + corresponding implementation dependent constants in one module. */ + +/* open(2) flags */ +#define FILEIO_O_RDONLY 0x0 +#define FILEIO_O_WRONLY 0x1 +#define FILEIO_O_RDWR 0x2 +#define FILEIO_O_APPEND 0x8 +#define FILEIO_O_CREAT 0x200 +#define FILEIO_O_TRUNC 0x400 +#define FILEIO_O_EXCL 0x800 +#define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \ + FILEIO_O_RDWR | FILEIO_O_APPEND| \ + FILEIO_O_CREAT | FILEIO_O_TRUNC| \ + FILEIO_O_EXCL) + +/* mode_t bits */ +#define FILEIO_S_IFREG 0100000 +#define FILEIO_S_IFDIR 040000 +#define FILEIO_S_IFCHR 020000 +#define FILEIO_S_IRUSR 0400 +#define FILEIO_S_IWUSR 0200 +#define FILEIO_S_IXUSR 0100 +#define FILEIO_S_IRWXU 0700 +#define FILEIO_S_IRGRP 040 +#define FILEIO_S_IWGRP 020 +#define FILEIO_S_IXGRP 010 +#define FILEIO_S_IRWXG 070 +#define FILEIO_S_IROTH 04 +#define FILEIO_S_IWOTH 02 +#define FILEIO_S_IXOTH 01 +#define FILEIO_S_IRWXO 07 +#define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \ + FILEIO_S_IRWXU|FILEIO_S_IRWXG| \ + FILEIO_S_IRWXO) + +/* lseek(2) flags */ +#define FILEIO_SEEK_SET 0 +#define FILEIO_SEEK_CUR 1 +#define FILEIO_SEEK_END 2 + +/* errno values */ +#define FILEIO_EPERM 1 +#define FILEIO_ENOENT 2 +#define FILEIO_EINTR 4 +#define FILEIO_EIO 5 +#define FILEIO_EBADF 9 +#define FILEIO_EACCES 13 +#define FILEIO_EFAULT 14 +#define FILEIO_EBUSY 16 +#define FILEIO_EEXIST 17 +#define FILEIO_ENODEV 19 +#define FILEIO_ENOTDIR 20 +#define FILEIO_EISDIR 21 +#define FILEIO_EINVAL 22 +#define FILEIO_ENFILE 23 +#define FILEIO_EMFILE 24 +#define FILEIO_EFBIG 27 +#define FILEIO_ENOSPC 28 +#define FILEIO_ESPIPE 29 +#define FILEIO_EROFS 30 +#define FILEIO_ENOSYS 88 +#define FILEIO_ENAMETOOLONG 91 +#define FILEIO_EUNKNOWN 9999 + +/* limits */ +#define FILEIO_INT_MIN -2147483648L +#define FILEIO_INT_MAX 2147483647L +#define FILEIO_UINT_MAX 4294967295UL +#define FILEIO_LONG_MIN -9223372036854775808LL +#define FILEIO_LONG_MAX 9223372036854775807LL +#define FILEIO_ULONG_MAX 18446744073709551615ULL + +/* Integral types as used in protocol. */ +#if 0 +typedef __int32_t fio_int_t; +typedef __uint32_t fio_uint_t, fio_mode_t, fio_time_t; +typedef __int64_t fio_long_t; +typedef __uint64_t fio_ulong_t; +#endif + +#define FIO_INT_LEN 4 +#define FIO_UINT_LEN 4 +#define FIO_MODE_LEN 4 +#define FIO_TIME_LEN 4 +#define FIO_LONG_LEN 8 +#define FIO_ULONG_LEN 8 + +typedef char fio_int_t[FIO_INT_LEN]; +typedef char fio_uint_t[FIO_UINT_LEN]; +typedef char fio_mode_t[FIO_MODE_LEN]; +typedef char fio_time_t[FIO_TIME_LEN]; +typedef char fio_long_t[FIO_LONG_LEN]; +typedef char fio_ulong_t[FIO_ULONG_LEN]; + +/* Struct stat as used in protocol. For complete independence + of host/target systems, it's defined as an array with offsets + to the members. */ + +struct fio_stat { + fio_uint_t fst_dev; + fio_uint_t fst_ino; + fio_mode_t fst_mode; + fio_uint_t fst_nlink; + fio_uint_t fst_uid; + fio_uint_t fst_gid; + fio_uint_t fst_rdev; + fio_ulong_t fst_size; + fio_ulong_t fst_blksize; + fio_ulong_t fst_blocks; + fio_time_t fst_atime; + fio_time_t fst_mtime; + fio_time_t fst_ctime; +}; + +struct fio_timeval { + fio_time_t ftv_sec; + fio_long_t ftv_usec; +}; + +#endif /* GDB_FILEIO_H_ */ diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 25a6ffe..94c3031 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,7 +1,17 @@ +2003-06-10 Gary Hade + + * ppc.h (PPC_OPERAND_DQ): Define. + +2003-06-10 Richard Sandiford + + * h8300.h (IMM4_NS, IMM8_NS): New. + (h8_opcodes): Replace IMM4 with IMM4_NS in mov.b and mov.w entries. + Likewise IMM8 for mov.w and mov.l. Likewise IMM16U for mov.l. + 2003-06-03 Michael Snyder * h8sx.h (enum h8_model): Add AV_H8S to distinguish from H8H. - (ldc): Split ccr ops from exr ops (which are only available + (ldc): Split ccr ops from exr ops (which are only available on H8S or H8SX). (stc): Ditto. (andc, orc, xorc): Ditto. @@ -154,7 +164,7 @@ fields. (h8_opcodes). Modify initializer and initializer macros to no longer initialize the removed fields. - + 2002-11-19 Svein E. Seldal * tic4x.h (c4x_insts): Fixed LDHI constraint @@ -191,10 +201,10 @@ * cgen.h: Test __BFD_H_SEEN__ rather than BFD_VERSION_DATE. 2002-09-30 Gavin Romig-Koch - Ken Raeburn - Aldy Hernandez - Eric Christopher - Richard Sandiford + Ken Raeburn + Aldy Hernandez + Eric Christopher + Richard Sandiford * mips.h: Update comment for new opcodes. (OP_MASK_VECBYTE, OP_SH_VECBYTE): New. @@ -205,12 +215,12 @@ Don't match CPU_R4111 with INSN_4100. 2002-08-19 Elena Zannoni - - From matthew green - * ppc.h (PPC_OPCODE_SPE): New opcode flag for Powerpc e500 + From matthew green + + * ppc.h (PPC_OPCODE_SPE): New opcode flag for Powerpc e500 instructions. - (PPC_OPCODE_ISEL, PPC_OPCODE_BRLOCK, PPC_OPCODE_PMR, + (PPC_OPCODE_ISEL, PPC_OPCODE_BRLOCK, PPC_OPCODE_PMR, PPC_OPCODE_CACHELCK, PPC_OPCODE_RFMCI): New opcode flags for the e500x2 Integer select, branch locking, performance monitor, cache locking and machine check APUs, respectively. @@ -265,9 +275,9 @@ 2002-05-17 Andrey Volkov - * h8300.h: Corrected defs of all control regs + * h8300.h: Corrected defs of all control regs and eepmov instr. - + 2002-04-11 Alan Modra * i386.h: Add intel mode cmpsd and movsd. @@ -534,9 +544,9 @@ Mon Dec 31 16:45:41 2001 Jeffrey A Law (law@cygnus.com) 2001-02-02 Patrick Macdonald - * cgen.h (CGEN_SYNTAX_CHAR_TYPE): Typedef as unsigned short. - (CGEN_MAX_SYNTAX_ELEMENTS): Rename from CGEN_MAX_SYNTAX_BYTES. - (CGEN_SYNTAX): Define using CGEN_MAX_SYNTAX_ELEMENTS. + * cgen.h (CGEN_SYNTAX_CHAR_TYPE): Typedef as unsigned short. + (CGEN_MAX_SYNTAX_ELEMENTS): Rename from CGEN_MAX_SYNTAX_BYTES. + (CGEN_SYNTAX): Define using CGEN_MAX_SYNTAX_ELEMENTS. 2001-01-24 Karsten Keil @@ -611,35 +621,35 @@ Mon Dec 31 16:45:41 2001 Jeffrey A Law (law@cygnus.com) 2000-12-01 Chris Demetriou - mips.h (OP_MASK_SYSCALL, OP_SH_SYSCALL): Delete. - (OP_MASK_CODE20, OP_SH_CODE20): Define, with values of old - OP_*_SYSCALL definitions. - (OP_SH_CODE19, OP_MASK_CODE19): Define, for use as - 19 bit wait codes. - (MIPS operand specifier comments): Remove 'm', add 'U' and - 'J', and update the meaning of 'B' so that it's more general. - - * mips.h (INSN_ISA1, INSN_ISA2, INSN_ISA3, INSN_ISA4, - INSN_ISA5): Renumber, redefine to mean the ISA at which the - instruction was added. - (INSN_ISA32): New constant. - (INSN_4650, INSN_4010, INSN_4100, INSN_3900, INSN_GP32): - Renumber to avoid new and/or renumbered INSN_* constants. - (INSN_MIPS32): Delete. - (ISA_UNKNOWN): New constant to indicate unknown ISA. - (ISA_MIPS1, ISA_MIPS2, ISA_MIPS3, ISA_MIPS4, ISA_MIPS5, - ISA_MIPS32): New constants, defined to be the mask of INSN_* - constants available at that ISA level. - (CPU_UNKNOWN): New constant to indicate unknown CPU. - (CPU_4K, CPU_MIPS32_4K): Rename the former to the latter, - define it with a unique value. - (OPCODE_IS_MEMBER): Update for new ISA membership-related - constant meanings. - - * mips.h (INSN_ISA64, ISA_MIPS5, ISA_MIPS64): New - definitions. - - * mips.h (CPU_SB1): New constant. + mips.h (OP_MASK_SYSCALL, OP_SH_SYSCALL): Delete. + (OP_MASK_CODE20, OP_SH_CODE20): Define, with values of old + OP_*_SYSCALL definitions. + (OP_SH_CODE19, OP_MASK_CODE19): Define, for use as + 19 bit wait codes. + (MIPS operand specifier comments): Remove 'm', add 'U' and + 'J', and update the meaning of 'B' so that it's more general. + + * mips.h (INSN_ISA1, INSN_ISA2, INSN_ISA3, INSN_ISA4, + INSN_ISA5): Renumber, redefine to mean the ISA at which the + instruction was added. + (INSN_ISA32): New constant. + (INSN_4650, INSN_4010, INSN_4100, INSN_3900, INSN_GP32): + Renumber to avoid new and/or renumbered INSN_* constants. + (INSN_MIPS32): Delete. + (ISA_UNKNOWN): New constant to indicate unknown ISA. + (ISA_MIPS1, ISA_MIPS2, ISA_MIPS3, ISA_MIPS4, ISA_MIPS5, + ISA_MIPS32): New constants, defined to be the mask of INSN_* + constants available at that ISA level. + (CPU_UNKNOWN): New constant to indicate unknown CPU. + (CPU_4K, CPU_MIPS32_4K): Rename the former to the latter, + define it with a unique value. + (OPCODE_IS_MEMBER): Update for new ISA membership-related + constant meanings. + + * mips.h (INSN_ISA64, ISA_MIPS5, ISA_MIPS64): New + definitions. + + * mips.h (CPU_SB1): New constant. 2000-10-20 Jakub Jelinek @@ -820,14 +830,14 @@ Fri Apr 21 13:20:53 2000 Richard Henderson 2000-03-02 J"orn Rennecke - * d30v.h: - (SHORT_B2r, SHORT_B3, SHORT_B3r, SHORT_B3b, SHORT_B3br): Updated. - (SHORT_D1r, SHORT_D2, SHORT_D2r, SHORT_D2Br, SHORT_U): Updated. - (SHORT_F, SHORT_AF, SHORT_T, SHORT_A5, SHORT_CMP, SHORT_CMPU): Updated. - (SHORT_A1, SHORT_AA, SHORT_RA, SHORT_MODINC, SHORT_MODDEC): Updated. - (SHORT_C1, SHORT_C2, SHORT_UF, SHORT_A2, SHORT_NONE, LONG): Updated. - (LONG_U, LONG_Ur, LONG_CMP, LONG_M, LONG_M2, LONG_2, LONG_2r): Updated. - (LONG_2b, LONG_2br, LONG_D, LONG_Dr, LONG_Dbr): Updated. + * d30v.h: + (SHORT_B2r, SHORT_B3, SHORT_B3r, SHORT_B3b, SHORT_B3br): Updated. + (SHORT_D1r, SHORT_D2, SHORT_D2r, SHORT_D2Br, SHORT_U): Updated. + (SHORT_F, SHORT_AF, SHORT_T, SHORT_A5, SHORT_CMP, SHORT_CMPU): Updated. + (SHORT_A1, SHORT_AA, SHORT_RA, SHORT_MODINC, SHORT_MODDEC): Updated. + (SHORT_C1, SHORT_C2, SHORT_UF, SHORT_A2, SHORT_NONE, LONG): Updated. + (LONG_U, LONG_Ur, LONG_CMP, LONG_M, LONG_M2, LONG_2, LONG_2r): Updated. + (LONG_2b, LONG_2br, LONG_D, LONG_Dr, LONG_Dbr): Updated. 2000-02-25 Alan Modra @@ -837,7 +847,7 @@ Fri Apr 21 13:20:53 2000 Richard Henderson 2000-02-24 Nick Clifton * cgen.h (cgen_cpu_desc): Rename field 'flags' to - 'signed_overflow_ok_p'. + 'signed_overflow_ok_p'. Delete prototypes for cgen_set_flags() and cgen_get_flags(). 2000-02-24 Andrew Haley @@ -906,14 +916,14 @@ Wed Nov 24 20:28:58 1999 Jeffrey A Law (law@cygnus.com) Sun Oct 10 01:46:56 1999 Jerry Quinn - * hppa.h (pa_opcodes): Add load and store cache control to + * hppa.h (pa_opcodes): Add load and store cache control to instructions. Add ordered access load and store. * hppa.h (pa_opcode): Add new entries for addb and addib. * hppa.h (pa_opcodes): Fix cmpb and cmpib entries. - * hppa.h (pa_opcodes): Add entries for cmpb and cmpib. + * hppa.h (pa_opcodes): Add entries for cmpb and cmpib. Thu Oct 7 00:12:25 MDT 1999 Diego Novillo @@ -997,22 +1007,22 @@ Sat Aug 28 00:25:25 1999 Jerry Quinn * hppa.h (pa_opcodes): Add extrd, extrw, depd, depdi, depw, depwi. Add supporting args. - * hppa.h: Document new completers and args. - * hppa.h (pa_opcodes): Add 64 bit patterns and pa2.0 syntax for uxor, + * hppa.h: Document new completers and args. + * hppa.h (pa_opcodes): Add 64 bit patterns and pa2.0 syntax for uxor, uaddcm, dcor, addi, add, sub, subi, shladd, rfi, and probe. Add pa2.0 extensions for ssm, rsm, pdtlb, pitlb. Add performance instructions pmenb and pmdis. - * hppa.h (pa_opcodes): Add pa2.0 instructions hadd, hshl, + * hppa.h (pa_opcodes): Add pa2.0 instructions hadd, hshl, hshr, hsub, mixh, mixw, permh. * hppa.h (pa_opcodes): Change completers in instructions to use 'c' prefix. - * hppa.h (pa_opcodes): Add popbts, new forms of bb, havg, + * hppa.h (pa_opcodes): Add popbts, new forms of bb, havg, hshladd, hshradd, shrpd, and shrpw instructions. Update arg comments. - * hppa.h (pa_opcodes): Change fmpyfadd, fmpynfadd, fneg, + * hppa.h (pa_opcodes): Change fmpyfadd, fmpynfadd, fneg, fnegabs to use 'I' instead of 'F'. 1999-08-21 Alan Modra @@ -1030,7 +1040,7 @@ Fri Aug 6 09:46:35 1999 Jerry Quinn * hppa.h (pa_opcodes): Add 64 bit versions of or, xor, and, and andcm. Add 32 and 64 bit version of cmpclr, cmpiclr. - * hppa.h: Document 64 bit condition completers. + * hppa.h: Document 64 bit condition completers. Thu Aug 5 16:56:07 1999 Jerry Quinn @@ -1049,7 +1059,7 @@ Wed Jul 28 02:04:24 1999 Jerry Quinn * hppa.h (pa_opcodes): Mark all PA2.0 opcodes with FLAG_STRICT. - * hppa.h (pa_opcodes): Change xmpyu, fmpyfadd, + * hppa.h (pa_opcodes): Change xmpyu, fmpyfadd, and fmpynfadd to use 'J' and 'K' instead of 'E' and 'X'. 1999-07-13 Alan Modra @@ -1206,22 +1216,22 @@ Sat Feb 13 14:13:44 1999 Richard Henderson Mon Feb 1 21:09:14 1999 Catherine Moore - * i386.h (d_Suf, x_Suf, sld_Suf, sldx_Suf, bwld_Suf): Define. - (x_FP, d_FP, dls_FP, sldx_FP): Define. - Change *Suf definitions to include x and d suffixes. - (movsx): Use w_Suf and b_Suf. - (movzx): Likewise. - (movs): Use bwld_Suf. - (fld): Change ordering. Use sld_FP. - (fild): Add Intel Syntax equivalent of fildq. - (fst): Use sld_FP. - (fist): Use sld_FP. - (fstp): Use sld_FP. Add x_FP version. - (fistp): LLongMem version for Intel Syntax. - (fcom, fcomp): Use sld_FP. - (fadd, fiadd, fsub): Use sld_FP. - (fsubr): Use sld_FP. - (fmul, fimul, fdvi, fidiv, fdivr): Use sld_FP. + * i386.h (d_Suf, x_Suf, sld_Suf, sldx_Suf, bwld_Suf): Define. + (x_FP, d_FP, dls_FP, sldx_FP): Define. + Change *Suf definitions to include x and d suffixes. + (movsx): Use w_Suf and b_Suf. + (movzx): Likewise. + (movs): Use bwld_Suf. + (fld): Change ordering. Use sld_FP. + (fild): Add Intel Syntax equivalent of fildq. + (fst): Use sld_FP. + (fist): Use sld_FP. + (fstp): Use sld_FP. Add x_FP version. + (fistp): LLongMem version for Intel Syntax. + (fcom, fcomp): Use sld_FP. + (fadd, fiadd, fsub): Use sld_FP. + (fsubr): Use sld_FP. + (fmul, fimul, fdvi, fidiv, fdivr): Use sld_FP. 1999-01-27 Doug Evans @@ -1791,7 +1801,7 @@ Fri Apr 4 14:02:32 1997 Ian Lance Taylor Tue Mar 25 22:57:26 1997 Stu Grossman (grossman@critters.cygnus.com) - * v850.h (extract): Make unsigned. + * v850.h (extract): Make unsigned. Mon Mar 24 14:38:15 1997 Ian Lance Taylor @@ -2009,7 +2019,7 @@ Wed Oct 2 21:31:26 1996 Jeffrey A Law (law@cygnus.com) Fri Sep 27 18:26:46 1996 Stu Grossman (grossman@critters.cygnus.com) - * v850.h: Add new flag to indicate this instruction uses a PC + * v850.h: Add new flag to indicate this instruction uses a PC displacement. Fri Sep 13 14:58:13 1996 Jeffrey A Law (law@cygnus.com) @@ -2378,9 +2388,9 @@ Mon Jan 23 16:45:43 1995 Ken Raeburn Sat Jan 21 17:50:38 1995 Pat Rankin (rankin@eql.caltech.edu) - * vax.h (struct vot_wot, field `args'): Make it pointer to const + * vax.h (struct vot_wot, field `args'): Make it pointer to const char. - (struct vot, field `name'): ditto. + (struct vot, field `name'): ditto. Thu Jan 19 14:47:53 1995 Ken Raeburn @@ -2636,7 +2646,7 @@ Thu Aug 5 09:15:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com) Fri Jul 30 18:41:11 1993 John Gilmore (gnu@cygnus.com) - * sparc.h (F_JSR, F_UNBR, F_CONDBR): Add new flags to mark + * sparc.h (F_JSR, F_UNBR, F_CONDBR): Add new flags to mark jump instructions, for use in disassemblers. Thu Jul 22 07:25:27 1993 Ian Lance Taylor (ian@cygnus.com) @@ -2755,29 +2765,29 @@ Fri Apr 9 13:26:16 1993 Jim Kingdon (kingdon@cygnus.com) Thu Mar 18 13:45:31 1993 Per Bothner (bothner@rtl.cygnus.com) - * i386.h: 486 extensions from John Hassey (hassey@dg-rtp.dg.com). - * mips.h: Add casts, to suppress warnings about shifting too much. - * m68k.h: Document the placement code '9'. + * i386.h: 486 extensions from John Hassey (hassey@dg-rtp.dg.com). + * mips.h: Add casts, to suppress warnings about shifting too much. + * m68k.h: Document the placement code '9'. Thu Feb 18 02:03:14 1993 John Gilmore (gnu@cygnus.com) - * m68k.h (BREAK_UP_BIG_DECL, AND_OTHER_PART): Add kludge which + * m68k.h (BREAK_UP_BIG_DECL, AND_OTHER_PART): Add kludge which allows callers to break up the large initialized struct full of opcodes into two half-sized ones. This permits GCC to compile this module, since it takes exponential space for initializers. - (numopcodes, endop): Revise to use AND_OTHER_PART in size calcs. + (numopcodes, endop): Revise to use AND_OTHER_PART in size calcs. Thu Feb 4 02:06:56 1993 John Gilmore (gnu@cygnus.com) - * a29k.h: Remove RCS crud, update GPL to v2, update copyrights. - * convex.h: Added, from GDB's convx-opcode.h. Added CONST to all + * a29k.h: Remove RCS crud, update GPL to v2, update copyrights. + * convex.h: Added, from GDB's convx-opcode.h. Added CONST to all initialized structs in it. Thu Jan 28 21:32:22 1993 John Gilmore (gnu@cygnus.com) Delta 88 changes inspired by Carl Greco, : - * m88k.h (PMEM): Avoid previous definition from . - (AND): Change to AND_ to avoid ansidecl.h `AND' conflict. + * m88k.h (PMEM): Avoid previous definition from . + (AND): Change to AND_ to avoid ansidecl.h `AND' conflict. Sat Jan 23 18:10:49 PST 1993 Ralph Campbell (ralphc@pyramid.com) @@ -2793,7 +2803,7 @@ Sun Jan 3 14:13:35 1993 Steve Chamberlain (sac@thepub.cygnus.com) Mon Dec 21 21:29:08 1992 Stu Grossman (grossman at cygnus.com) - * hppa.h: Move handy aliases to the front. Fix masks for extract + * hppa.h: Move handy aliases to the front. Fix masks for extract and deposit instructions. Sat Dec 12 16:09:48 1992 Ian Lance Taylor (ian@cygnus.com) @@ -2828,7 +2838,7 @@ Tue Sep 22 14:08:14 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) Tue Sep 22 00:38:41 1992 John Gilmore (gnu@cygnus.com) - * mips.h (break): Disassemble the argument. Patch from + * mips.h (break): Disassemble the argument. Patch from jonathan@cs.stanford.edu (Jonathan Stone). Wed Sep 9 11:25:28 1992 Ian Lance Taylor (ian@cygnus.com) @@ -2865,10 +2875,10 @@ Wed Aug 19 11:22:24 1992 Ian Lance Taylor (ian@cygnus.com) Fri Aug 14 14:20:38 1992 Per Bothner (bothner@cygnus.com) - * m68k.h: Merged in patches (mostly m68040-specific) from + * m68k.h: Merged in patches (mostly m68040-specific) from Colin Smith . - * m68k.h: Merged m68kmri.h and m68k.h (using the former as a + * m68k.h: Merged m68kmri.h and m68k.h (using the former as a base). Also cleaned up duplicates, re-ordered instructions for the sake of dis-assembling (so aliases come after standard names). * m68kmri.h: Now just defines some macros, and #includes m68k.h. @@ -2886,24 +2896,24 @@ Mon Aug 10 23:22:33 1992 Ken Raeburn (raeburn@cygnus.com) Sun Jun 28 13:29:03 1992 Fred Fish (fnf@cygnus.com) - * h8300.h: Finish filling in all the holes in the opcode table, + * h8300.h: Finish filling in all the holes in the opcode table, so that the Lucid C compiler can digest this as well... Fri Jun 26 21:27:17 1992 John Gilmore (gnu at cygnus.com) - * i386.h: Add setc, setnc, addr16, data16, repz, repnz aliases. + * i386.h: Add setc, setnc, addr16, data16, repz, repnz aliases. Fix opcodes on various sizes of fild/fist instructions (16bit=no suffix, 32bit="l" suffix, 64bit="ll" suffix). Use tabs to indent for comments. Fixes suggested by Minh Tran-Le. Thu Jun 25 16:13:26 1992 Stu Grossman (grossman at cygnus.com) - * h8300.h: Fill in all the holes in the opcode table so that the + * h8300.h: Fill in all the holes in the opcode table so that the losing HPUX C compiler can digest this... Thu Jun 11 12:15:25 1992 John Gilmore (gnu at cygnus.com) - * mips.h: Fix decoding of coprocessor instructions, somewhat. + * mips.h: Fix decoding of coprocessor instructions, somewhat. (Fix by Eric Anderson, 3jean@maas-neotek.arc.nasa.gov.) Thu May 28 11:17:44 1992 Jim Wilson (wilson@sphagnum.cygnus.com) @@ -2913,35 +2923,35 @@ Thu May 28 11:17:44 1992 Jim Wilson (wilson@sphagnum.cygnus.com) Tue May 5 14:23:27 1992 Per Bothner (bothner@rtl.cygnus.com) - * mips.h: Add some more opcode synonyms (from Frank Yellin, + * mips.h: Add some more opcode synonyms (from Frank Yellin, fy@lucid.com). Thu Apr 16 18:25:26 1992 Per Bothner (bothner@cygnus.com) - * rs6k.h: New version from IBM (Metin). + * rs6k.h: New version from IBM (Metin). Thu Apr 9 00:31:19 1992 Per Bothner (bothner@rtl.cygnus.com) * rs6k.h: Fix incorrect extended opcode for instructions `fm' - and `fd'. (From metin@ibmpa.awdpa.ibm.com (Metin G. Ozisik).) + and `fd'. (From metin@ibmpa.awdpa.ibm.com (Metin G. Ozisik).) Tue Apr 7 13:38:47 1992 Stu Grossman (grossman at cygnus.com) - * rs6k.h: Move from ../../gdb/rs6k-opcode.h. + * rs6k.h: Move from ../../gdb/rs6k-opcode.h. Fri Apr 3 11:30:20 1992 Fred Fish (fnf@cygnus.com) - * m68k.h (one, two): Cast macro args to unsigned to suppress + * m68k.h (one, two): Cast macro args to unsigned to suppress complaints from compiler and lint about integer overflow during shift. Sun Mar 29 12:22:08 1992 John Gilmore (gnu at cygnus.com) - * sparc.h (OP): Avoid signed overflow when shifting to high order bit. + * sparc.h (OP): Avoid signed overflow when shifting to high order bit. Fri Mar 6 00:22:38 1992 John Gilmore (gnu at cygnus.com) - * mips.h: Make bitfield layout depend on the HOST compiler, + * mips.h: Make bitfield layout depend on the HOST compiler, not on the TARGET system. Fri Feb 21 01:29:51 1992 K. Richard Pixley (rich@cygnus.com) @@ -2956,15 +2966,15 @@ Thu Jan 30 07:31:44 1992 Steve Chamberlain (sac at rtl.cygnus.com) Thu Jan 30 01:07:24 1992 John Gilmore (gnu at cygnus.com) - * sparc.h: Remove "cypress" architecture. Remove "fitox" and + * sparc.h: Remove "cypress" architecture. Remove "fitox" and similar instructions -- they've been renamed to "fitoq", etc. REALLY fix tsubcctv. Fix "fcmpeq" and "fcmpq" which had wrong number of arguments. - * h8300.h: Remove extra ; which produces compiler warning. + * h8300.h: Remove extra ; which produces compiler warning. Tue Jan 28 22:59:22 1992 Stu Grossman (grossman at cygnus.com) - * sparc.h: fix opcode for tsubcctv. + * sparc.h: fix opcode for tsubcctv. Tue Jan 7 17:19:39 1992 K. Richard Pixley (rich at cygnus.com) @@ -2972,7 +2982,7 @@ Tue Jan 7 17:19:39 1992 K. Richard Pixley (rich at cygnus.com) Fri Dec 27 10:55:50 1991 Per Bothner (bothner at cygnus.com) - * sparc.h (nop): Made the 'lose' field be even tighter, + * sparc.h (nop): Made the 'lose' field be even tighter, so only a standard 'nop' is disassembled as a nop. Sun Dec 22 12:18:18 1991 Michael Tiemann (tiemann at cygnus.com) @@ -2982,7 +2992,7 @@ Sun Dec 22 12:18:18 1991 Michael Tiemann (tiemann at cygnus.com) Wed Dec 18 17:19:44 1991 Stu Grossman (grossman at cygnus.com) - * m68k.h, sparc.h: ANSIfy enums. + * m68k.h, sparc.h: ANSIfy enums. Tue Dec 10 00:22:20 1991 K. Richard Pixley (rich at rtl.cygnus.com) diff --git a/include/opcode/h8300.h b/include/opcode/h8300.h index 45357ef..4318dcc 100644 --- a/include/opcode/h8300.h +++ b/include/opcode/h8300.h @@ -130,6 +130,8 @@ enum h8_flags { IMM3NZ_NS = IMM3NZ | NO_SYMBOLS, IMM2_NS = IMM2 | NO_SYMBOLS, + IMM4_NS = IMM4 | NO_SYMBOLS, + IMM8_NS = IMM8 | NO_SYMBOLS, IMM16_NS = IMM16 | NO_SYMBOLS, IMM16U_NS = IMM16U | NO_SYMBOLS, @@ -1441,8 +1443,8 @@ struct h8_opcode h8_opcodes[] = {O (O_MOV, SB), AV_H8, 2, "mov.b", {{IMM8, RD8, E}}, {{0xF, RD8, IMM8LIST, E}}}, - {O (O_MOV, SB), AV_H8SX, 0, "mov.b", {{IMM4, ABS16DST, E}}, {{0x6, 0xa, 0xd, IMM4, DSTABS16LIST, E}}}, - {O (O_MOV, SB), AV_H8SX, 0, "mov.b", {{IMM4, ABS32DST, E}}, {{0x6, 0xa, 0xf, IMM4, DSTABS32LIST, E}}}, + {O (O_MOV, SB), AV_H8SX, 0, "mov.b", {{IMM4_NS, ABS16DST, E}}, {{0x6, 0xa, 0xd, IMM4, DSTABS16LIST, E}}}, + {O (O_MOV, SB), AV_H8SX, 0, "mov.b", {{IMM4_NS, ABS32DST, E}}, {{0x6, 0xa, 0xf, IMM4, DSTABS32LIST, E}}}, MOVFROM_IMM8 (O (O_MOV, SB), PREFIX_017D, "mov.b", IMM8), {O (O_MOV, SB), AV_H8, 2, "mov.b", {{RS8, RD8, E}}, {{0x0, 0xC, RS8, RD8, E}}}, @@ -1470,10 +1472,10 @@ struct h8_opcode h8_opcodes[] = {O (O_MOV, SW), AV_H8SX, 0, "mov.w", {{IMM3NZ_NS, RD16, E}}, {{0x0, 0xf, B30 | IMM3NZ, RD16, E}}}, {O (O_MOV, SW), AV_H8, 4, "mov.w", {{IMM16, RD16, E}}, {{0x7, 0x9, 0x0, RD16, IMM16LIST, E}}}, - {O (O_MOV, SW), AV_H8SX, 0, "mov.w", {{IMM4, ABS16DST, E}}, {{0x6, 0xb, 0xd, IMM4, DSTABS16LIST, E}}}, - {O (O_MOV, SW), AV_H8SX, 0, "mov.w", {{IMM4, ABS32DST, E}}, {{0x6, 0xb, 0xf, IMM4, DSTABS32LIST, E}}}, + {O (O_MOV, SW), AV_H8SX, 0, "mov.w", {{IMM4_NS, ABS16DST, E}}, {{0x6, 0xb, 0xd, IMM4, DSTABS16LIST, E}}}, + {O (O_MOV, SW), AV_H8SX, 0, "mov.w", {{IMM4_NS, ABS32DST, E}}, {{0x6, 0xb, 0xf, IMM4, DSTABS32LIST, E}}}, - MOVFROM_IMM8 (O (O_MOV, SW), PREFIX_015D, "mov.w", IMM8), + MOVFROM_IMM8 (O (O_MOV, SW), PREFIX_015D, "mov.w", IMM8_NS), MOVFROM_IMM (O (O_MOV, SW), PREFIX_7974, "mov.w", IMM16, IMM16LIST), {O (O_MOV, SW), AV_H8, 2, "mov.w", {{RS16, RD16, E}}, {{0x0, 0xD, RS16, RD16, E}}}, @@ -1499,8 +1501,8 @@ struct h8_opcode h8_opcodes[] = {O (O_MOV, SL), AV_H8SX, 0, "mov.l", {{IMM3NZ_NS, RD32, E}}, {{0x0, 0xf, B31 | IMM3NZ, B31 | RD32, E}}}, - MOVFROM_IMM8 (O (O_MOV, SL), PREFIX_010D, "mov.l", IMM8), - MOVFROM_IMM (O (O_MOV, SL), PREFIX_7A7C, "mov.l", IMM16U, IMM16ULIST), + MOVFROM_IMM8 (O (O_MOV, SL), PREFIX_010D, "mov.l", IMM8_NS), + MOVFROM_IMM (O (O_MOV, SL), PREFIX_7A7C, "mov.l", IMM16U_NS, IMM16ULIST), {O (O_MOV, SL), AV_H8SX, 0, "mov.l", {{IMM16U_NS, RD32, E}}, {{0x7, 0xa, 0x0, B31 | RD32, IMM16ULIST, E}}}, {O (O_MOV, SL), AV_H8H, 4, "mov.l", {{IMM32, RD32, E}}, {{0x7, 0xa, 0x0, B30 | RD32, IMM32LIST, E}}}, diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h index ffd313a..c4adf71 100644 --- a/include/opcode/ppc.h +++ b/include/opcode/ppc.h @@ -1,5 +1,5 @@ /* ppc.h -- Header file for PowerPC opcode table - Copyright 1994, 1995, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support @@ -273,6 +273,9 @@ extern const struct powerpc_operand powerpc_operands[]; /* This operand is for the DS field in a DS form instruction. */ #define PPC_OPERAND_DS (020000) + +/* This operand is for the DQ field in a DQ form instruction. */ +#define PPC_OPERAND_DQ (040000) /* The POWER and PowerPC assemblers use a few macros. We keep them with the operands table for simplicity. The macro table is an diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index baa15cd..75b6636 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,12 @@ +2003-06-09 Albert Chin-A-Young + + PR bootstrap/10974 + * physmem.c: Update comment. + * configure.in: Modify test for _system_configuration for older + AIX systems. + + * config.in, configure: Regenerated. + 2003-06-05 John David Anglin PR other/10810 diff --git a/libiberty/config.in b/libiberty/config.in index 14ab379..51d161a 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -316,9 +316,6 @@ /* Define if you have the sys_siglist variable. */ #undef HAVE_SYS_SIGLIST -/* Define if you have the _system_configuration variable. */ -#undef HAVE__SYSTEM_CONFIGURATION - /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ @@ -331,6 +328,9 @@ STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION +/* Define if you have the _system_configuration variable. */ +#undef HAVE__SYSTEM_CONFIGURATION + /* Define if canonicalize_file_name is not declared in system header files. */ #undef NEED_DECLARATION_CANONICALIZE_FILE_NAME diff --git a/libiberty/configure b/libiberty/configure index d0899a2..9182fc3 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -1875,7 +1875,7 @@ funcs="$funcs waitpid" # Also in the old function.def file: alloca, vfork, getopt. -vars="sys_errlist sys_nerr sys_siglist _system_configuration" +vars="sys_errlist sys_nerr sys_siglist" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" @@ -1959,10 +1959,6 @@ EOF #define HAVE_SYS_SIGLIST 1 EOF - cat >> confdefs.h <<\EOF -#define HAVE__SYSTEM_CONFIGURATION 1 -EOF - fi # For each of these functions, if the host does not provide the @@ -2157,7 +2153,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:2161: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2157: 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. @@ -2168,12 +2164,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2172 "configure" +#line 2168 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2173: \"$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 @@ -2199,19 +2195,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:2203: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2199: 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:2210: checking for $ac_func" >&5 +echo "configure:2206: 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:2234: \"$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 @@ -2261,12 +2257,12 @@ done echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2265: checking whether alloca needs Cray hooks" >&5 +echo "configure:2261: 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:2295: checking for $ac_func" >&5 +echo "configure:2291: 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:2319: \"$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 @@ -2345,7 +2341,7 @@ fi fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2349: checking stack direction for C alloca" >&5 +echo "configure:2345: 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 @@ -2353,7 +2349,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:2372: \"$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 @@ -2394,17 +2390,17 @@ EOF ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2398: checking for vfork.h" >&5 +echo "configure:2394: 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:2408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2404: \"$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* @@ -2429,18 +2425,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2433: checking for working vfork" >&5 +echo "configure:2429: 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:2439: checking for vfork" >&5 +echo "configure:2435: 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:2463: \"$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 @@ -2485,7 +2481,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -2580,7 +2576,7 @@ main() { } } EOF -if { (eval echo configure:2584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2580: \"$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 @@ -2612,12 +2608,12 @@ fi for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2616: checking for $ac_func" >&5 +echo "configure:2612: 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:2640: \"$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 @@ -2670,12 +2666,12 @@ done for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2674: checking for $ac_func" >&5 +echo "configure:2670: 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:2698: \"$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 @@ -2726,19 +2722,19 @@ done for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:2730: checking for $v" >&5 +echo "configure:2726: 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:2738: \"$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 @@ -2761,15 +2757,43 @@ EOF echo "$ac_t""no" 1>&6 fi done + + # special check for _system_configuration because AIX <4.3.2 do not + # contain the `physmem' member. + echo $ac_n "checking for external symbol _system_configuration""... $ac_c" 1>&6 +echo "configure:2765: checking for external symbol _system_configuration" >&5 + cat > conftest.$ac_ext < +int main() { +double x = _system_configuration.physmem; +; return 0; } +EOF +if { (eval echo configure:2774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE__SYSTEM_CONFIGURATION 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2768: checking for $ac_func" >&5 +echo "configure:2792: 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:2820: \"$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 @@ -2817,12 +2841,12 @@ fi done echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:2821: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:2845: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+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:2872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_decl_needed_canonicalize_file_name=no else @@ -2880,17 +2904,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:2884: checking for $ac_hdr" >&5 +echo "configure:2908: 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:2894: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2918: \"$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* @@ -2919,12 +2943,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2923: checking for $ac_func" >&5 +echo "configure:2947: 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:2975: \"$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 @@ -2972,7 +2996,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2976: checking for working mmap" >&5 +echo "configure:3000: 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 @@ -2980,7 +3004,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:3148: \"$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 @@ -3144,7 +3168,7 @@ fi echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:3148: checking for working strncmp" >&5 +echo "configure:3172: 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 @@ -3152,7 +3176,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:3244: \"$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 diff --git a/libiberty/configure.in b/libiberty/configure.in index 4a704e8..0eab855 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -209,7 +209,7 @@ funcs="$funcs waitpid" # Also in the old function.def file: alloca, vfork, getopt. -vars="sys_errlist sys_nerr sys_siglist _system_configuration" +vars="sys_errlist sys_nerr sys_siglist" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" @@ -230,7 +230,6 @@ if test "x" = "y"; then AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) - AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.]) fi # For each of these functions, if the host does not provide the @@ -433,6 +432,17 @@ if test -z "${setobjs}"; then AC_MSG_RESULT(no) fi done + + # special check for _system_configuration because AIX <4.3.2 do not + # contain the `physmem' member. + AC_MSG_CHECKING([for external symbol _system_configuration]) + AC_TRY_COMPILE([#include ], + [double x = _system_configuration.physmem;], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, + [Define if you have the _system_configuration variable.])], + [AC_MSG_RESULT([no])]) + AC_CHECK_FUNCS($checkfuncs) libiberty_NEED_DECLARATION(canonicalize_file_name) fi diff --git a/libiberty/physmem.c b/libiberty/physmem.c index 9185c12..f64e07c 100644 --- a/libiberty/physmem.c +++ b/libiberty/physmem.c @@ -145,7 +145,7 @@ physmem_total () #endif #if HAVE__SYSTEM_CONFIGURATION - /* This works on AIX. */ + /* This works on AIX 4.3.3+. */ return _system_configuration.physmem; #endif diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 8200278..c5e3fff 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,39 @@ +2003-06-11 H.J. Lu + + * po/Make-in (DESTDIR): New. + (install-data-yes): Support $(DESTDIR). + (uninstall): Likewise. + +2003-06-11 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * po/POTFILES.in: Regenerate. + +2003-06-10 Doug Evans + + * cgen-asm.in (@arch@_cgen_assemble_insn): CGEN_INSN_RELAX renamed to + CGEN_INSN_RELAXED. + * fr30-asm.c,fr30-desc.c,fr30-desc.h: Regenerate. + * frv-asm.c,frv-desc.c,frv-desc.h: Regenerate. + * ip2k-asm.c,ip2k-desc.c,ip2k-desc.h: Regenerate. + * iq2000-asm.c,iq2000-desc.c,iq2000-desc.h: Regenerate. + * m32r-asm.c,m32r-desc.c,m32r-desc.h,m32r-opc.c: Regenerate. + * openrisc-asm.c,openrisc-desc.c,openrisc-desc.h: Regenerate. + * xstormy16-asm.c,xstormy16-desc.c,xstormy16-desc.h: Regenerate. + +2003-06-10 Gary Hade + Alan Modra + + * ppc-opc.c (DQ, RAQ, RSQ, RTQ): Define. + (insert_dq, extract_dq, insert_raq, insert_rtq, insert_rsq): New. + (powerpc_opcodes): Add "attn", "lq" and "stq". + +2003-06-10 Richard Sandiford + + * h8300-dis.c (bfd_h8_disassemble): Don't print brackets round + rts/l and rte/l register lists. + 2003-06-03 Nick Clifton * frv-desc.c: Regenerate. @@ -47,9 +83,9 @@ 2003-05-17 Andreas Jaeger - * Makefile.am (libopcodes_la_LIBADD): Add libbfd.la. - (libopcodes_la_DEPENDENCIES): Add libbfd.la. - * Makefile.in: Regenerated. + * Makefile.am (libopcodes_la_LIBADD): Add libbfd.la. + (libopcodes_la_DEPENDENCIES): Add libbfd.la. + * Makefile.in: Regenerated. 2003-05-16 Nick Clifton @@ -113,7 +149,7 @@ 2003-03-25 Stan Cox Nick Clifton - + Contribute support for Intel's iWMMXt chip - an ARM variant: * arm-dis.c (regnames): Add iWMMXt register names. @@ -221,24 +257,24 @@ 2002-01-02 Ben Elliston Jeff Johnston - * iq2000-asm.c: New file. - * iq2000-desc.c: Likewise. - * iq2000-desc.h: Likewise. - * iq2000-dis.c: Likewise. - * iq2000-ibld.c: Likewise. - * iq2000-opc.c: Likewise. - * iq2000-opc.h: Likewise. - * Makefile.am (HFILES): Add iq2000-desc.h, iq2000-opc.h. - (CFILES): Add iq2000-asm.c, iq2000-desc.c, iq2000-dis.c, - iq2000-ibld.c, iq2000-opc.c. - (ALL_MACHINES): Add iq2000-asm.lo, iq2000-desc.lo, iq2000-dis.lo, - iq2000-ibld.lo, iq2000-opc.lo. - (CLEANFILES): Add stamp-iq2000. - (IQ2000_DEPS): New macro. - (stamp-iq2000): New target. - * Makefile.in: Regenerate. - * configure.in: Handle bfd_iq2000_arch. - * configure: Regenerate. + * iq2000-asm.c: New file. + * iq2000-desc.c: Likewise. + * iq2000-desc.h: Likewise. + * iq2000-dis.c: Likewise. + * iq2000-ibld.c: Likewise. + * iq2000-opc.c: Likewise. + * iq2000-opc.h: Likewise. + * Makefile.am (HFILES): Add iq2000-desc.h, iq2000-opc.h. + (CFILES): Add iq2000-asm.c, iq2000-desc.c, iq2000-dis.c, + iq2000-ibld.c, iq2000-opc.c. + (ALL_MACHINES): Add iq2000-asm.lo, iq2000-desc.lo, iq2000-dis.lo, + iq2000-ibld.lo, iq2000-opc.lo. + (CLEANFILES): Add stamp-iq2000. + (IQ2000_DEPS): New macro. + (stamp-iq2000): New target. + * Makefile.in: Regenerate. + * configure.in: Handle bfd_iq2000_arch. + * configure: Regenerate. 2003-01-02 Chris Demetriou @@ -434,7 +470,7 @@ (lookup_regindex): Recognize AR[FCR], AR[EFLAG], AR[CSD], AR[SSD], AR[CFLG], AR[FSR], AR[FIR], and AR[FDR]. * ia64-asmtab.c: Regenerate. - + 2002-11-25 Aldy Hernandez * ppc-opc.c: Remove evmwlssf, evmwlssfa, evmwlsmf, evmwlsmfa, @@ -512,7 +548,7 @@ * xstormy16-desc.c: Regenerate. * xstormy16-opc.c: Regenerate. * xstormy16-opc.h: Regenerate. - + 2002-11-18 Klee Dienes * avr-dis.c: Include libiberty.h (for xmalloc). @@ -594,18 +630,18 @@ 2002-11-07 Klee Dienes - * Makefile.am (ia64-asmtab.c): Update to use the new '--srcdir' - argument to ia64-gen. + * Makefile.am (ia64-asmtab.c): Update to use the new '--srcdir' + argument to ia64-gen. Regenerate dependencies for ia64-len.lo. * Makefile.in: Regenerate. - * ia64-gen.c: Convert to use getopt(). Add the standard GNU - options, as well as '--srcdir', which controls the directory in - which ia64-gen looks for the sources it uses to generate the - output table. Add a 'const' to the declaration of the final - output table. Call xmalloc_set_program_name to set the program - name. + * ia64-gen.c: Convert to use getopt(). Add the standard GNU + options, as well as '--srcdir', which controls the directory in + which ia64-gen looks for the sources it uses to generate the + output table. Add a 'const' to the declaration of the final + output table. Call xmalloc_set_program_name to set the program + name. * ia64-asmtab.c: Regenerate. - + 2002-11-07 Nick Clifton * ia64-gen.c: Fix comment formatting and compile time warnings. @@ -619,7 +655,7 @@ 2002-11-06 Aldy Hernandez - * opcodes/ppc-opc.c: Change RD to RS for evmerge*. + * opcodes/ppc-opc.c: Change RD to RS for evmerge*. 2002-10-07 Nathan Tallent @@ -634,10 +670,10 @@ at the end. 2002-09-30 Gavin Romig-Koch - Ken Raeburn - Aldy Hernandez - Eric Christopher - Richard Sandiford + Ken Raeburn + Aldy Hernandez + Eric Christopher + Richard Sandiford * mips-dis.c (print_insn_arg): Handle '[', ']', 'e' and '%'. (mips_isa_type): Handle bfd_mach_mips4120, bfd_mach_mips5400 diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index 6ec05e4..7097be0 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -649,10 +649,12 @@ iq2000-asm.lo: iq2000-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h iq2000-desc.lo: iq2000-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h iq2000-desc.h $(INCDIR)/opcode/cgen.h \ - iq2000-opc.h opintl.h $(INCDIR)/libiberty.h + iq2000-opc.h opintl.h $(INCDIR)/libiberty.h $(INCDIR)/xregex.h \ + $(INCDIR)/xregex2.h iq2000-dis.lo: iq2000-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h iq2000-desc.h \ - $(INCDIR)/opcode/cgen.h iq2000-opc.h opintl.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \ + iq2000-desc.h $(INCDIR)/opcode/cgen.h iq2000-opc.h \ + opintl.h iq2000-ibld.lo: iq2000-ibld.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h iq2000-desc.h \ $(INCDIR)/opcode/cgen.h iq2000-opc.h opintl.h $(INCDIR)/safe-ctype.h diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 8c03c17..2823902 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -467,7 +467,7 @@ acinclude.m4 aclocal.m4 config.in configure configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES) OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS) @@ -1145,10 +1145,12 @@ iq2000-asm.lo: iq2000-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h iq2000-desc.lo: iq2000-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h iq2000-desc.h $(INCDIR)/opcode/cgen.h \ - iq2000-opc.h opintl.h $(INCDIR)/libiberty.h + iq2000-opc.h opintl.h $(INCDIR)/libiberty.h $(INCDIR)/xregex.h \ + $(INCDIR)/xregex2.h iq2000-dis.lo: iq2000-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h iq2000-desc.h \ - $(INCDIR)/opcode/cgen.h iq2000-opc.h opintl.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \ + iq2000-desc.h $(INCDIR)/opcode/cgen.h iq2000-opc.h \ + opintl.h iq2000-ibld.lo: iq2000-ibld.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h iq2000-desc.h \ $(INCDIR)/opcode/cgen.h iq2000-opc.h opintl.h $(INCDIR)/safe-ctype.h diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in index 525177c..1ea0768 100644 --- a/opcodes/cgen-asm.in +++ b/opcodes/cgen-asm.in @@ -361,10 +361,10 @@ const CGEN_INSN * if (! @arch@_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c index be9c36c..8e7c7b8 100644 --- a/opcodes/fr30-asm.c +++ b/opcodes/fr30-asm.c @@ -657,10 +657,10 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg) if (! fr30_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c index 01d896f..3309d54 100644 --- a/opcodes/fr30-desc.c +++ b/opcodes/fr30-desc.c @@ -105,7 +105,7 @@ const CGEN_ATTR_TABLE fr30_cgen_insn_attr_table[] = { "SKIP-CTI", &bool_attr[0], &bool_attr[0] }, { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, { "RELAXABLE", &bool_attr[0], &bool_attr[0] }, - { "RELAX", &bool_attr[0], &bool_attr[0] }, + { "RELAXED", &bool_attr[0], &bool_attr[0] }, { "NO-DIS", &bool_attr[0], &bool_attr[0] }, { "PBB", &bool_attr[0], &bool_attr[0] }, { "NOT-IN-DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, diff --git a/opcodes/fr30-desc.h b/opcodes/fr30-desc.h index 6be96d9..35d0de7 100644 --- a/opcodes/fr30-desc.h +++ b/opcodes/fr30-desc.h @@ -240,7 +240,7 @@ typedef enum cgen_operand_type { /* Enum declaration for cgen_insn attrs. */ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI - , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAX + , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_NOT_IN_DELAY_SLOT, CGEN_INSN_END_BOOLS , CGEN_INSN_START_NBOOLS = 31, CGEN_INSN_MACH, CGEN_INSN_END_NBOOLS } CGEN_INSN_ATTR; diff --git a/opcodes/frv-asm.c b/opcodes/frv-asm.c index b4647b1..0e3d8dd 100644 --- a/opcodes/frv-asm.c +++ b/opcodes/frv-asm.c @@ -960,10 +960,10 @@ frv_cgen_assemble_insn (cd, str, fields, buf, errmsg) if (! frv_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/frv-desc.c b/opcodes/frv-desc.c index ffb0b27..97d49b3 100644 --- a/opcodes/frv-desc.c +++ b/opcodes/frv-desc.c @@ -188,7 +188,7 @@ const CGEN_ATTR_TABLE frv_cgen_insn_attr_table[] = { "SKIP-CTI", &bool_attr[0], &bool_attr[0] }, { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, { "RELAXABLE", &bool_attr[0], &bool_attr[0] }, - { "RELAX", &bool_attr[0], &bool_attr[0] }, + { "RELAXED", &bool_attr[0], &bool_attr[0] }, { "NO-DIS", &bool_attr[0], &bool_attr[0] }, { "PBB", &bool_attr[0], &bool_attr[0] }, { "PRIVILEGED", &bool_attr[0], &bool_attr[0] }, diff --git a/opcodes/frv-desc.h b/opcodes/frv-desc.h index 3ecf091..a169e7a 100644 --- a/opcodes/frv-desc.h +++ b/opcodes/frv-desc.h @@ -696,7 +696,7 @@ typedef enum cgen_operand_type { /* Enum declaration for cgen_insn attrs. */ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI - , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAX + , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_PRIVILEGED, CGEN_INSN_NON_EXCEPTING , CGEN_INSN_CONDITIONAL, CGEN_INSN_FR_ACCESS, CGEN_INSN_PRESERVE_OVF, CGEN_INSN_END_BOOLS , CGEN_INSN_START_NBOOLS = 31, CGEN_INSN_MACH, CGEN_INSN_UNIT, CGEN_INSN_FR400_MAJOR diff --git a/opcodes/h8300-dis.c b/opcodes/h8300-dis.c index 299267f..ea8d30b 100644 --- a/opcodes/h8300-dis.c +++ b/opcodes/h8300-dis.c @@ -698,7 +698,7 @@ bfd_h8_disassemble (addr, info, mach) outfn (stream, "er%d", regno[1]); else { - outfn (stream, "(er%d-er%d)", regno[1] - regno[0], + outfn (stream, "er%d-er%d", regno[1] - regno[0], regno[1]); } return qi->length; diff --git a/opcodes/ip2k-asm.c b/opcodes/ip2k-asm.c index 6a1653b..524f256 100644 --- a/opcodes/ip2k-asm.c +++ b/opcodes/ip2k-asm.c @@ -908,10 +908,10 @@ ip2k_cgen_assemble_insn (cd, str, fields, buf, errmsg) if (! ip2k_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/ip2k-desc.c b/opcodes/ip2k-desc.c index f8e4932..0ab2cc5 100644 --- a/opcodes/ip2k-desc.c +++ b/opcodes/ip2k-desc.c @@ -105,7 +105,7 @@ const CGEN_ATTR_TABLE ip2k_cgen_insn_attr_table[] = { "SKIP-CTI", &bool_attr[0], &bool_attr[0] }, { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, { "RELAXABLE", &bool_attr[0], &bool_attr[0] }, - { "RELAX", &bool_attr[0], &bool_attr[0] }, + { "RELAXED", &bool_attr[0], &bool_attr[0] }, { "NO-DIS", &bool_attr[0], &bool_attr[0] }, { "PBB", &bool_attr[0], &bool_attr[0] }, { "EXT-SKIP-INSN", &bool_attr[0], &bool_attr[0] }, diff --git a/opcodes/ip2k-desc.h b/opcodes/ip2k-desc.h index 84db7fb..1122026 100644 --- a/opcodes/ip2k-desc.h +++ b/opcodes/ip2k-desc.h @@ -225,7 +225,7 @@ typedef enum cgen_operand_type { /* Enum declaration for cgen_insn attrs. */ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI - , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAX + , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_EXT_SKIP_INSN, CGEN_INSN_SKIPA , CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31, CGEN_INSN_MACH, CGEN_INSN_END_NBOOLS } CGEN_INSN_ATTR; diff --git a/opcodes/iq2000-asm.c b/opcodes/iq2000-asm.c index bb61af0..7fb795e 100644 --- a/opcodes/iq2000-asm.c +++ b/opcodes/iq2000-asm.c @@ -794,10 +794,10 @@ iq2000_cgen_assemble_insn (cd, str, fields, buf, errmsg) if (! iq2000_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/iq2000-desc.c b/opcodes/iq2000-desc.c index 402f726..6c7f3b0 100644 --- a/opcodes/iq2000-desc.c +++ b/opcodes/iq2000-desc.c @@ -105,7 +105,7 @@ const CGEN_ATTR_TABLE iq2000_cgen_insn_attr_table[] = { "SKIP-CTI", &bool_attr[0], &bool_attr[0] }, { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, { "RELAXABLE", &bool_attr[0], &bool_attr[0] }, - { "RELAX", &bool_attr[0], &bool_attr[0] }, + { "RELAXED", &bool_attr[0], &bool_attr[0] }, { "NO-DIS", &bool_attr[0], &bool_attr[0] }, { "PBB", &bool_attr[0], &bool_attr[0] }, { "YIELD-INSN", &bool_attr[0], &bool_attr[0] }, diff --git a/opcodes/iq2000-desc.h b/opcodes/iq2000-desc.h index fe3a5e3..13b4f56 100644 --- a/opcodes/iq2000-desc.h +++ b/opcodes/iq2000-desc.h @@ -273,7 +273,7 @@ typedef enum cgen_operand_type { /* Enum declaration for cgen_insn attrs. */ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI - , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAX + , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_YIELD_INSN, CGEN_INSN_LOAD_DELAY , CGEN_INSN_EVEN_REG_NUM, CGEN_INSN_UNSUPPORTED, CGEN_INSN_USES_RD, CGEN_INSN_USES_RS , CGEN_INSN_USES_RT, CGEN_INSN_USES_R31, CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31 diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c index 4abe187..2bd751a 100644 --- a/opcodes/m32r-asm.c +++ b/opcodes/m32r-asm.c @@ -659,10 +659,10 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg) if (! m32r_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c index 30a0719..023ab62 100644 --- a/opcodes/m32r-desc.c +++ b/opcodes/m32r-desc.c @@ -118,7 +118,7 @@ const CGEN_ATTR_TABLE m32r_cgen_insn_attr_table[] = { "SKIP-CTI", &bool_attr[0], &bool_attr[0] }, { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, { "RELAXABLE", &bool_attr[0], &bool_attr[0] }, - { "RELAX", &bool_attr[0], &bool_attr[0] }, + { "RELAXED", &bool_attr[0], &bool_attr[0] }, { "NO-DIS", &bool_attr[0], &bool_attr[0] }, { "PBB", &bool_attr[0], &bool_attr[0] }, { "FILL-SLOT", &bool_attr[0], &bool_attr[0] }, diff --git a/opcodes/m32r-desc.h b/opcodes/m32r-desc.h index 85e22ee..8781772 100644 --- a/opcodes/m32r-desc.h +++ b/opcodes/m32r-desc.h @@ -204,7 +204,7 @@ typedef enum cgen_operand_type { /* Enum declaration for cgen_insn attrs. */ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI - , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAX + , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_FILL_SLOT, CGEN_INSN_SPECIAL , CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31, CGEN_INSN_MACH, CGEN_INSN_PIPE , CGEN_INSN_END_NBOOLS diff --git a/opcodes/m32r-opc.c b/opcodes/m32r-opc.c index b60c1bf..8143b61 100644 --- a/opcodes/m32r-opc.c +++ b/opcodes/m32r-opc.c @@ -1187,7 +1187,7 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* bc $disp24 */ { -1, "bc24r", "bc", 32, - { 0|A(RELAX)|A(COND_CTI)|A(ALIAS), { (1<> 21; + + if (value == rtvalue && errmsg != NULL) + *errmsg = _("source and target register operands must be different"); + return insn | ((value & 0x1f) << 16); +} + /* The RA field in a D or X form instruction which is an updating store or an updating floating point load, which means that the RA field may not be zero. */ @@ -1298,6 +1373,38 @@ extract_rbs (insn, dialect, invalid) return 0; } + /* The RT field of the DQ form lq instruction, which has special + value restrictions. */ + +/*ARGSUSED*/ +static unsigned long +insert_rtq (insn, value, dialect, errmsg) + unsigned long insn; + long value; + int dialect ATTRIBUTE_UNUSED; + const char **errmsg; +{ + if ((value & 1) != 0 && errmsg != NULL) + *errmsg = _("target register operand must be even"); + return insn | ((value & 0x1f) << 21); +} + + /* The RS field of the DS form stq instruction, which has special + value restrictions. */ + +/*ARGSUSED*/ +static unsigned long +insert_rsq (insn, value, dialect, errmsg) + unsigned long insn; + long value ATTRIBUTE_UNUSED; + int dialect ATTRIBUTE_UNUSED; + const char **errmsg; +{ + if ((value & 1) != 0 && errmsg != NULL) + *errmsg = _("source register operand must be even"); + return insn | ((value & 0x1f) << 21); +} + /* The SH field in an MD form instruction. This is split. */ /*ARGSUSED*/ @@ -1768,6 +1875,7 @@ extract_tbr (insn, dialect, invalid) sorted by major opcode. */ const struct powerpc_opcode powerpc_opcodes[] = { +{ "attn", X(0,256), X_MASK, POWER4, { 0 } }, { "tdlgti", OPTO(2,TOLGT), OPTO_MASK, PPC64, { RA, SI } }, { "tdllti", OPTO(2,TOLLT), OPTO_MASK, PPC64, { RA, SI } }, { "tdeqi", OPTO(2,TOEQ), OPTO_MASK, PPC64, { RA, SI } }, @@ -4335,6 +4443,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "stfdu", OP(55), OP_MASK, COM, { FRS, D, RAS } }, +{ "lq", OP(56), OP_MASK, POWER4, { RTQ, DQ, RAQ } }, + { "lfq", OP(56), OP_MASK, POWER2, { FRT, D, RA } }, { "lfqu", OP(57), OP_MASK, POWER2, { FRT, D, RA } }, @@ -4411,6 +4521,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "stdu", DSO(62,1), DS_MASK, PPC64, { RS, DS, RAS } }, +{ "stq", DSO(62,2), DS_MASK, POWER4, { RSQ, DS, RA } }, + { "fcmpu", X(63,0), X_MASK|(3<<21), COM, { BF, FRA, FRB } }, { "frsp", XRC(63,12,0), XRA_MASK, COM, { FRT, FRB } }, diff --git a/opcodes/xstormy16-asm.c b/opcodes/xstormy16-asm.c index 324c091..810938c 100644 --- a/opcodes/xstormy16-asm.c +++ b/opcodes/xstormy16-asm.c @@ -618,10 +618,10 @@ xstormy16_cgen_assemble_insn (cd, str, fields, buf, errmsg) if (! xstormy16_cgen_insn_supported (cd, insn)) continue; #endif - /* If the RELAX attribute is set, this is an insn that shouldn't be + /* If the RELAXED attribute is set, this is an insn that shouldn't be chosen immediately. Instead, it is used during assembler/linker relaxation if possible. */ - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) + if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0) continue; str = start; diff --git a/opcodes/xstormy16-desc.c b/opcodes/xstormy16-desc.c index 9c9f30b..1c94fd7 100644 --- a/opcodes/xstormy16-desc.c +++ b/opcodes/xstormy16-desc.c @@ -104,7 +104,7 @@ const CGEN_ATTR_TABLE xstormy16_cgen_insn_attr_table[] = { "SKIP-CTI", &bool_attr[0], &bool_attr[0] }, { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] }, { "RELAXABLE", &bool_attr[0], &bool_attr[0] }, - { "RELAX", &bool_attr[0], &bool_attr[0] }, + { "RELAXED", &bool_attr[0], &bool_attr[0] }, { "NO-DIS", &bool_attr[0], &bool_attr[0] }, { "PBB", &bool_attr[0], &bool_attr[0] }, { 0, 0, 0 } diff --git a/opcodes/xstormy16-desc.h b/opcodes/xstormy16-desc.h index a880321..e613505 100644 --- a/opcodes/xstormy16-desc.h +++ b/opcodes/xstormy16-desc.h @@ -261,7 +261,7 @@ typedef enum cgen_operand_type { /* Enum declaration for cgen_insn attrs. */ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI - , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAX + , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31 , CGEN_INSN_MACH, CGEN_INSN_END_NBOOLS } CGEN_INSN_ATTR; diff --git a/sim/testsuite/sim/sh64/ChangeLog b/sim/testsuite/sim/sh64/ChangeLog deleted file mode 100644 index 8bb2f76..0000000 --- a/sim/testsuite/sim/sh64/ChangeLog +++ /dev/null @@ -1,21 +0,0 @@ -2001-01-06 Ben Elliston - - * misc/fr-dr.s: New test. - -2001-01-03 Ben Elliston - - * interwork.exp: Match .s files only. - -2000-12-06 Ben Elliston - - * interwork.exp: New test case. - -2000-11-16 Ben Elliston - - * allinsn.exp: Rename from this .. - * compact.exp: .. to this. - * media.exp: New test case. - -2000-11-13 Ben Elliston - - * allinsn.exp: New test case. diff --git a/sim/testsuite/sim/sh64/compact.exp b/sim/testsuite/sim/sh64/compact.exp deleted file mode 100644 index d3d482a..0000000 --- a/sim/testsuite/sim/sh64/compact.exp +++ /dev/null @@ -1,19 +0,0 @@ -# SHcompact testsuite. - -if [istarget sh64-*-*] { - # load support procs (none yet) - # load_lib cgen.exp - - # all machines - set all_machs "sh5" - - # The .cgs suffix is for "cgen .s". - foreach src [lsort [glob -nocomplain $srcdir/$subdir/compact/*.cgs]] { - # If we're only testing specific files and this isn't one of them, - # skip it. - if ![runtest_file_p $runtests $src] { - continue - } - run_sim_test $src $all_machs - } -} diff --git a/sim/testsuite/sim/sh64/compact/ChangeLog b/sim/testsuite/sim/sh64/compact/ChangeLog deleted file mode 100644 index 99aaec1..0000000 --- a/sim/testsuite/sim/sh64/compact/ChangeLog +++ /dev/null @@ -1,26 +0,0 @@ -2002-01-09 Ben Elliston - - * macl.cgs: For good measure, clear the S bit at startup. - -2001-01-11 Ben Elliston - - * fmov.cgs (f13b): Compare R0 with R1, not R2, when testing that - the source register was correctly post-incremented. - -2000-12-01 Ben Elliston - - * *.cgs (ld): Link tests with -m shelf32. - -2000-11-24 Ben Elliston - - * fmov.cgs: New test case. - * ftrv.cgs: Populate the matrix with meaningful values. - -2000-11-22 Ben Elliston - - * *.cgs (as): Assemble tests with -isa=shcompact. - -2000-11-16 Ben Elliston - - * *.cgs: New test cases. - diff --git a/sim/testsuite/sim/sh64/compact/add.cgs b/sim/testsuite/sim/sh64/compact/add.cgs deleted file mode 100644 index 105e484..0000000 --- a/sim/testsuite/sim/sh64/compact/add.cgs +++ /dev/null @@ -1,55 +0,0 @@ -# sh testcase for add $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -init: - # Initialise some registers with values which help us to verify - # that the correct source registers are used by the ADD instruction. - mov #0, r0 - mov #1, r1 - mov #2, r2 - mov #3, r3 - mov #5, r5 - mov #15, r15 - -add: - # 0 + 0 = 0. - add r0, r0 - assert r0, #0 - - # 0 + 1 = 1. - add r0, r1 - assert r1, #1 - - # 1 + 2 = 3. - add r1, r2 - assert r2, #3 - - # 3 + 5 = 8. - add r3, r5 - assert r5, #8 - - # 8 + 8 = 16. - add r5, r5 - assert r5, #16 - - # 15 + 1 = 16. - add r15, r1 - assert r1, #16 - -neg: - mov #1, r0 - neg r0, r0 - mov #2, r1 - add r0, r1 - assert r1, #1 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/addc.cgs b/sim/testsuite/sim/sh64/compact/addc.cgs deleted file mode 100644 index f6e46e1..0000000 --- a/sim/testsuite/sim/sh64/compact/addc.cgs +++ /dev/null @@ -1,90 +0,0 @@ -# sh testcase for addc $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - # Initialise some registers with values which help us to verify - # that the correct source registers are used by the ADDC instruction. - - .macro init - mov #0, r0 - mov #1, r1 - mov #2, r2 - mov #3, r3 - mov #5, r5 - mov #15, r15 - .endm - - start - - init -add: - clrt - addc r0, r0 - assert r0, #0 - clrt - addc r0, r1 - assert r1, #1 - clrt - addc r1, r2 - assert r2, #3 - clrt - addc r3, r5 - assert r5, #8 - clrt - addc r5, r5 - assert r5, #16 - clrt - addc r15, r1 - assert r1, #16 - - init -addt: - sett - addc r0, r0 - assert r0, #1 - sett - addc r0, r1 - assert r1, #3 - sett - addc r1, r2 - assert r2, #6 - sett - addc r3, r5 - assert r5, #9 - sett - addc r5, r5 - assert r5, #19 - sett - addc r15, r1 - assert r1, #19 - - bra next - nop - -wrong: - fail - -next: - init -large: - clrt - mov #1, r0 - neg r0, r0 - mov #2, r1 - addc r0, r1 - assert r1, #1 - - init -larget: - sett - mov #1, r0 - neg r0, r0 - mov #2, r1 - addc r0, r1 - assert r1, #2 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/addi.cgs b/sim/testsuite/sim/sh64/compact/addi.cgs deleted file mode 100644 index 7c96ddf..0000000 --- a/sim/testsuite/sim/sh64/compact/addi.cgs +++ /dev/null @@ -1,46 +0,0 @@ -# sh testcase for add #$imm8, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -init: - # Initialise some registers with values which help us to verify - # that the correct source registers are used by the ADD instruction. - mov #0, r0 - mov #1, r1 - mov #2, r2 - mov #3, r3 - mov #5, r5 - mov #15, r15 - -addi: - # 0 + 0 = 0. - add #0, r0 - assert r0, #0 - - # 0 + 1 = 1. - add #0, r1 - assert r1, #1 - - # 2 + 2 = 4. - add #2, r2 - assert r2, #4 - - # 120 + 5 = 125. - add #120, r5 - assert r5, #125 - -large: - mov #1, r0 - neg r0, r0 - add #2, r0 - assert r0, #1 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/addv.cgs b/sim/testsuite/sim/sh64/compact/addv.cgs deleted file mode 100644 index 0267e5d..0000000 --- a/sim/testsuite/sim/sh64/compact/addv.cgs +++ /dev/null @@ -1,48 +0,0 @@ -# sh testcase for addv $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -zero: - mov #0, r0 - mov #0, r1 - addv r0, r1 - # Assert !T and #0. - bt wrong - assert r1, #0 - -one: - mov #0, r0 - mov #1, r1 - addv r0, r1 - # Assert !T and #1. - bt wrong - assert r1, #1 - -large: - # Produce MAXINT in R0. - mov #0, r0 - not r0, r0 - shlr r0 - - # Put #3 into R1. - mov #3, r1 - - # Add them and overflow. - addv r0, r1 - - # Assert T and overflowed value. - bf wrong - mov #1, r7 - rotr r7 - add #2, r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/and.cgs b/sim/testsuite/sim/sh64/compact/and.cgs deleted file mode 100644 index e145275..0000000 --- a/sim/testsuite/sim/sh64/compact/and.cgs +++ /dev/null @@ -1,33 +0,0 @@ -# sh testcase for and $rm64, $rn64 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global and -and: - mov #1, r1 - mov #7, r2 - rotr r2 - rotr r2 - and r1, r2 - - # R1 & R2 = 1. - assert r2, #1 - -another: - mov #192, r1 - mov #0, r2 - and r1, r2 - - # R1 & R2 = 0. - assert r2, #0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/andb.cgs b/sim/testsuite/sim/sh64/compact/andb.cgs deleted file mode 100644 index 77e6285..0000000 --- a/sim/testsuite/sim/sh64/compact/andb.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for and.b #$imm8, @(r0, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global orb -init: - # Init GBR and R0. - mov #30, r0 - ldc r0, gbr - mov #40, r0 - -orb: - and.b #255, @(r0, gbr) - and.b #170, @(r0, gbr) - and.b #255, @(r0, gbr) - and.b #0, @(r0, gbr) - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/andi.cgs b/sim/testsuite/sim/sh64/compact/andi.cgs deleted file mode 100644 index 32d71c5..0000000 --- a/sim/testsuite/sim/sh64/compact/andi.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for and #$imm8, r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global andi -andi: - mov #0, r0 - or #255, r0 - and #0, r0 - assert r0, #0 - -large: - mov #0, r0 - or #255, r0 - shll8 r0 - or #255, r0 - shll8 r0 - or #255, r0 - shll8 r0 - or #255, r0 - -mask: - and #255, r0 - mov r0, r1 - mov #0, r0 - or #255, r0 - cmp/eq r0, r1 - bf wrong - -mask0: - and #0, r0 - assert r0, #0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/bf.cgs b/sim/testsuite/sim/sh64/compact/bf.cgs deleted file mode 100644 index 5c361f9..0000000 --- a/sim/testsuite/sim/sh64/compact/bf.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for bf $disp8 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global taken -taken: - clrt - bf ntaken - fail - .global ntaken -ntaken: - sett - bf bad - pass -bad: - fail - fail - fail - fail diff --git a/sim/testsuite/sim/sh64/compact/bfs.cgs b/sim/testsuite/sim/sh64/compact/bfs.cgs deleted file mode 100644 index 3cad5f6..0000000 --- a/sim/testsuite/sim/sh64/compact/bfs.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for bf/s $disp8 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global taken -taken: - clrt - bf/s ntaken -slot1: - nop - fail - .global ntaken -ntaken: - sett - bf/s bad -slot2: - nop - pass -bad: - fail - fail - fail - fail diff --git a/sim/testsuite/sim/sh64/compact/bra.cgs b/sim/testsuite/sim/sh64/compact/bra.cgs deleted file mode 100644 index 77c6da9..0000000 --- a/sim/testsuite/sim/sh64/compact/bra.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for bra $disp12 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global bra -bra: - bra okay -slot: - nop -bad: - fail - fail - fail - .global okay -okay: - pass - fail - diff --git a/sim/testsuite/sim/sh64/compact/braf.cgs b/sim/testsuite/sim/sh64/compact/braf.cgs deleted file mode 100644 index e761f6d..0000000 --- a/sim/testsuite/sim/sh64/compact/braf.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for braf $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global braf -braf: - mov #4, r0 - braf r0 -slot: - nop -bad: - fail - fail -okay: - pass -alsobad: - fail - fail - fail diff --git a/sim/testsuite/sim/sh64/compact/brk.cgs b/sim/testsuite/sim/sh64/compact/brk.cgs deleted file mode 100644 index 9908072..0000000 --- a/sim/testsuite/sim/sh64/compact/brk.cgs +++ /dev/null @@ -1,18 +0,0 @@ -# sh testcase for brk -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - .global brk -brk: - # If we hit the breakpoint, the sim will stop. - pass - - # FIXME: breakpoint instruction. - # The SH4 assembler doesn't know about "brk". - .word 0x003b -bad: - fail diff --git a/sim/testsuite/sim/sh64/compact/bsr.cgs b/sim/testsuite/sim/sh64/compact/bsr.cgs deleted file mode 100644 index 75a1a2b..0000000 --- a/sim/testsuite/sim/sh64/compact/bsr.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for bsr $disp12 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global bsr -bsr: - bsr okay -slot: - nop -bad: - fail - fail -okay: - pass -alsobad: - fail diff --git a/sim/testsuite/sim/sh64/compact/bsrf.cgs b/sim/testsuite/sim/sh64/compact/bsrf.cgs deleted file mode 100644 index 9360eaa..0000000 --- a/sim/testsuite/sim/sh64/compact/bsrf.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for bsrf $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -bsrf: - mov #4, r0 - bsrf r0 -slot: - nop -bad: - fail - fail -okay: - pass -alsobad: - fail - fail diff --git a/sim/testsuite/sim/sh64/compact/bt.cgs b/sim/testsuite/sim/sh64/compact/bt.cgs deleted file mode 100644 index 65b9d61..0000000 --- a/sim/testsuite/sim/sh64/compact/bt.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for bt $disp8 -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global taken -taken: - sett - bt ntaken - fail - .global ntaken -ntaken: - clrt - bt bad - pass -bad: - fail - fail - fail - fail diff --git a/sim/testsuite/sim/sh64/compact/bts.cgs b/sim/testsuite/sim/sh64/compact/bts.cgs deleted file mode 100644 index 3d62e4d..0000000 --- a/sim/testsuite/sim/sh64/compact/bts.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for bt/s $disp8 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global taken -taken: - sett - bt/s ntaken -slot1: - nop - fail - .global ntaken -ntaken: - clrt - bt/s bad -slot2: - nop - pass -bad: - fail - fail - fail - fail diff --git a/sim/testsuite/sim/sh64/compact/clrmac.cgs b/sim/testsuite/sim/sh64/compact/clrmac.cgs deleted file mode 100644 index 482dc80..0000000 --- a/sim/testsuite/sim/sh64/compact/clrmac.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for clrmac -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global clrmac -clrmac: - clrmac - pass diff --git a/sim/testsuite/sim/sh64/compact/clrs.cgs b/sim/testsuite/sim/sh64/compact/clrs.cgs deleted file mode 100644 index bed5fd5..0000000 --- a/sim/testsuite/sim/sh64/compact/clrs.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for clrs -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global clrs -clrs: - clrs - # Somehow ensure that S is set. - pass diff --git a/sim/testsuite/sim/sh64/compact/clrt.cgs b/sim/testsuite/sim/sh64/compact/clrt.cgs deleted file mode 100644 index 281c2f4..0000000 --- a/sim/testsuite/sim/sh64/compact/clrt.cgs +++ /dev/null @@ -1,16 +0,0 @@ -# sh testcase for clrt -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global clrt -clrt: - clrt - bt wrong - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/cmpeq.cgs b/sim/testsuite/sim/sh64/compact/cmpeq.cgs deleted file mode 100644 index 3cc744c..0000000 --- a/sim/testsuite/sim/sh64/compact/cmpeq.cgs +++ /dev/null @@ -1,52 +0,0 @@ -# sh testcase for cmp/eq $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zeroes: - mov #0, r1 - mov #0, r2 - cmp/eq r1, r2 - bf wrong - -zero1: - mov #0, r1 - mov #1, r2 - cmp/eq r1, r2 - bt wrong - -zero2: - mov #0, r2 - mov #1, r1 - cmp/eq r2, r1 - bt wrong - -equal: - mov #192, r1 - mov #192, r2 - cmp/eq r1, r2 - bf wrong - -noteq: - mov #192, r1 - mov #193, r2 - cmp/eq r1, r2 - bt wrong - -large: - mov #1, r1 - rotr r1 - mov #1, r2 - rotr r2 - cmp/eq r1, r2 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/cmpeqi.cgs b/sim/testsuite/sim/sh64/compact/cmpeqi.cgs deleted file mode 100644 index 79900a0..0000000 --- a/sim/testsuite/sim/sh64/compact/cmpeqi.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for cmp/eq #$imm8, r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zeroes: - mov #0, r0 - cmp/eq #0, r0 - bf wrong - -zero1: - mov #0, r0 - cmp/eq #1, r0 - bt wrong - -zero2: - mov #1, r0 - cmp/eq #0, r0 - bt wrong - -equal: - mov #192, r0 - cmp/eq #192, r0 - bf wrong - -sign: - mov #255, r0 - cmp/eq #255, r0 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/cmpge.cgs b/sim/testsuite/sim/sh64/compact/cmpge.cgs deleted file mode 100644 index 9d4327e..0000000 --- a/sim/testsuite/sim/sh64/compact/cmpge.cgs +++ /dev/null @@ -1,69 +0,0 @@ -# sh testcase for cmp/ge $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zero: - mov #0, r0 - mov #0, r1 - cmp/ge r0, r1 - bf wrong - -onezero: - mov #1, r0 - mov #0, r1 - cmp/ge r0, r1 - bt wrong - -zeroone: - mov #0, r0 - mov #1, r1 - cmp/ge r0, r1 - bf wrong - -equal: - mov #192, r0 - mov #192, r1 - cmp/ge r0, r1 - bf wrong - -eqlarge: - mov #1, r0 - rotr r0 - add #85, r0 - mov #1, r1 - rotr r1 - add #85, r1 - cmp/ge r0, r1 - bf wrong - -large2: - mov #1, r0 - rotr r0 - add #85, r0 - mov #1, r1 - rotr r1 - add #84, r1 - cmp/ge r0, r1 - bt wrong - -large3: - mov #1, r0 - rotr r0 - add #84, r0 - mov #1, r1 - rotr r1 - add #85, r1 - cmp/ge r0, r1 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/cmpgt.cgs b/sim/testsuite/sim/sh64/compact/cmpgt.cgs deleted file mode 100644 index 460ca65..0000000 --- a/sim/testsuite/sim/sh64/compact/cmpgt.cgs +++ /dev/null @@ -1,69 +0,0 @@ -# sh testcase for cmp/gt $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zero: - mov #0, r0 - mov #0, r1 - cmp/gt r0, r1 - bt wrong - -onezero: - mov #1, r0 - mov #0, r1 - cmp/gt r0, r1 - bt wrong - -zeroone: - mov #0, r0 - mov #1, r1 - cmp/gt r0, r1 - bf wrong - -equal: - mov #192, r0 - mov #192, r1 - cmp/gt r0, r1 - bt wrong - -eqlarge: - mov #1, r0 - rotr r0 - add #85, r0 - mov #1, r1 - rotr r1 - add #85, r1 - cmp/gt r0, r1 - bt wrong - -large2: - mov #1, r0 - rotr r0 - add #85, r0 - mov #1, r1 - rotr r1 - add #84, r1 - cmp/gt r0, r1 - bt wrong - -large3: - mov #1, r0 - rotr r0 - add #84, r0 - mov #1, r1 - rotr r1 - add #85, r1 - cmp/gt r0, r1 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/cmphi.cgs b/sim/testsuite/sim/sh64/compact/cmphi.cgs deleted file mode 100644 index efbcaa3..0000000 --- a/sim/testsuite/sim/sh64/compact/cmphi.cgs +++ /dev/null @@ -1,68 +0,0 @@ -# sh testcase for cmp/hi $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zero: - mov #0, r0 - mov #0, r0 - cmp/hi r0, r1 - bt wrong - -equal: - mov #1, r0 - rotr r0 - add #3, r0 - - mov #1, r1 - rotr r1 - add #3, r1 - - cmp/hi r0, r1 - bt wrong - -gt: - mov #10, r0 - mov #12, r1 - cmp/hi r0, r1 - bf wrong - -lt: - mov #12, r0 - mov #10, r1 - cmp/hi r0, r1 - bt wrong - -gtneg: - mov #1, r0 - rotr r0 - add #1, r0 - - mov #1, r1 - rotr r1 - add #3, r1 - - cmp/hi r0, r1 - bf wrong - -ltneg: - mov #1, r0 - rotr r0 - add #3, r0 - - mov #1, r1 - rotr r1 - add #1, r1 - - cmp/hi r0, r1 - bt wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/cmphs.cgs b/sim/testsuite/sim/sh64/compact/cmphs.cgs deleted file mode 100644 index 957f80c..0000000 --- a/sim/testsuite/sim/sh64/compact/cmphs.cgs +++ /dev/null @@ -1,59 +0,0 @@ -# sh testcase for cmp/hs $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zero: - mov #0, r0 - mov #0, r0 - cmp/hs r0, r1 - -equal: - mov #1, r0 - rotr r0 - add #3, r0 - - mov #1, r1 - rotr r1 - add #3, r1 - - cmp/hs r0, r1 - -gt: - mov #10, r0 - mov #12, r1 - cmp/hs r0, r1 - -lt: - mov #12, r0 - mov #10, r1 - cmp/hs r0, r1 - -gtneg: - mov #1, r0 - rotr r0 - add #1, r0 - - mov #1, r1 - rotr r1 - add #3, r1 - - cmp/hs r0, r1 - -ltneg: - mov #1, r0 - rotr r0 - add #3, r0 - - mov #1, r1 - rotr r1 - add #1, r1 - - cmp/hs r0, r1 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/cmppl.cgs b/sim/testsuite/sim/sh64/compact/cmppl.cgs deleted file mode 100644 index 1c11377..0000000 --- a/sim/testsuite/sim/sh64/compact/cmppl.cgs +++ /dev/null @@ -1,37 +0,0 @@ -# sh testcase for cmp/pl $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zero: - mov #0, r0 - cmp/pl r0 - bt wrong - -plus: - mov #10, r0 - cmp/pl r0 - bf wrong - -minus: - mov #10, r0 - neg r0, r0 - cmp/pl r0 - bt wrong - -large: - mov #10, r0 - shll8 r0 - add #123, r0 - cmp/pl r0 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/cmppz.cgs b/sim/testsuite/sim/sh64/compact/cmppz.cgs deleted file mode 100644 index 2e0bf48..0000000 --- a/sim/testsuite/sim/sh64/compact/cmppz.cgs +++ /dev/null @@ -1,37 +0,0 @@ -# sh testcase for cmp/pz $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -zero: - mov #0, r0 - cmp/pz r0 - bf wrong - -plus: - mov #10, r0 - cmp/pz r0 - bf wrong - -minus: - mov #10, r0 - neg r0, r0 - cmp/pz r0 - bt wrong - -large: - mov #10, r0 - shll8 r0 - add #123, r0 - cmp/pz r0 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/cmpstr.cgs b/sim/testsuite/sim/sh64/compact/cmpstr.cgs deleted file mode 100644 index 70d90d3..0000000 --- a/sim/testsuite/sim/sh64/compact/cmpstr.cgs +++ /dev/null @@ -1,148 +0,0 @@ -# sh testcase for cmp/str $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - -.macro rot8 - rotr r0 - rotr r0 - rotr r0 - rotr r0 - rotr r0 - rotr r0 - rotr r0 - rotr r0 -.endm - - start - -# Use multiple "wrong" labels because this program is quite long. It's -# likely that some instructions will be too far away from the branch -# target to use PC-relative branches. - -match0: - # No bytes matching. - mov #1, r0 - neg r0, r0 - xor #170, r0 - rot8 - xor #170, r0 - rot8 - xor #170, r0 - rot8 - xor #170, r0 - rot8 - mov r0, r1 - mov #1, r0 - neg r0, r0 - xor #85, r0 - rot8 - xor #85, r0 - rot8 - xor #85, r0 - rot8 - xor #85, r0 - rot8 - cmp/str r0, r1 - bt wrong0 - - bra match1 - nop -wrong0: - fail - -match1: - # One byte matching. - mov #1, r0 - neg r0, r0 - xor #170, r0 - rot8 - xor #170, r0 - rot8 - xor #170, r0 - rot8 - mov r0, r1 - mov #1, r0 - neg r0, r0 - xor #85, r0 - rot8 - xor #85, r0 - rot8 - xor #85, r0 - rot8 - cmp/str r0, r1 - bf wrong1 - - bra match2 - nop -wrong1: - fail - -match2: - # Two bytes matching. - mov #1, r0 - neg r0, r0 - xor #170, r0 - rot8 - xor #170, r0 - rot8 - mov r0, r1 - mov #1, r0 - neg r0, r0 - xor #85, r0 - rot8 - xor #85, r0 - rot8 - cmp/str r0, r1 - bf wrong2 - - bra match3 - nop -wrong2: - fail - -byte0: -match3: - # One byte matching. - # This is also the test for byte 0. - mov #85, r0 - mov #85, r1 - cmp/str r0, r1 - bf wrong3 - -byte1: - # Match in byte position 1. - mov #85, r0 - shll8 r0 - mov #85, r1 - shll8 r1 - cmp/str r0, r1 - bf wrong3 - -byte2: - # Match in byte position 2. - mov #85, r0 - shll16 r0 - mov #85, r1 - shll16 r1 - cmp/str r0, r1 - bf wrong3 - -byte3: - # Match in byte position 3. - mov #85, r0 - shll16 r0 - shll8 r0 - mov #85, r1 - shll16 r1 - shll8 r1 - cmp/str r0, r1 - bf wrong3 - -okay: - pass -wrong3: - fail - diff --git a/sim/testsuite/sim/sh64/compact/div0s.cgs b/sim/testsuite/sim/sh64/compact/div0s.cgs deleted file mode 100644 index 8cd6422..0000000 --- a/sim/testsuite/sim/sh64/compact/div0s.cgs +++ /dev/null @@ -1,52 +0,0 @@ -# sh testcase for div0s $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -init: - mov #0, r0 - mov #3, r1 - mov #4, r2 - neg r1, r3 - neg r2, r4 - -perm1: - div0s r0, r0 - bt wrong - div0s r0, r1 - bt wrong - div0s r1, r0 - bt wrong - -perm2: - div0s r0, r4 - bf wrong - div0s r4, r0 - bf wrong - -perm3: - div0s r1, r2 - bt wrong - div0s r2, r1 - bt wrong - -perm4: - div0s r3, r4 - bt wrong - div0s r4, r3 - bt wrong - -perm5: - div0s r1, r1 - bt wrong - div0s r3, r3 - bt wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/div0u.cgs b/sim/testsuite/sim/sh64/compact/div0u.cgs deleted file mode 100644 index 02f8534..0000000 --- a/sim/testsuite/sim/sh64/compact/div0u.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for div0u -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global div0u -div0u: - div0u - # Can't easily test Q and M (other than visually inspecting - # the simulator's trace output). - bt wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/div1.cgs b/sim/testsuite/sim/sh64/compact/div1.cgs deleted file mode 100644 index 63a0e81..0000000 --- a/sim/testsuite/sim/sh64/compact/div1.cgs +++ /dev/null @@ -1,52 +0,0 @@ -# sh testcase for div1 $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #10, r0 - mov #2, r1 - div0s r0,r1 - - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - div1 r0, r1 - - pass diff --git a/sim/testsuite/sim/sh64/compact/dmulsl.cgs b/sim/testsuite/sim/sh64/compact/dmulsl.cgs deleted file mode 100644 index 081ce16..0000000 --- a/sim/testsuite/sim/sh64/compact/dmulsl.cgs +++ /dev/null @@ -1,115 +0,0 @@ -# sh testcase for dmuls.l $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #0, r0 - mov #0, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #0 - -test2: - mov #0, r0 - mov #5, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #0 - -test3: - mov #5, r0 - mov #0, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #0 - -test4: - mov #1, r0 - mov #5, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #5 - -test5: - mov #5, r0 - mov #1, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #5 - - bra test6 - nop - -wrong: - fail - -test6: - mov #2, r0 - mov #2, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #4 - -test7: - mov #1, r0 - neg r0, r0 - mov #2, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - - mov #0, r8 - not r8, r9 - not r8, r10 - shll r10 - cmp/eq r3, r9 - bf wrong - cmp/eq r4, r10 - bf wrong - -test8: - mov #1, r0 - neg r0, r0 - mov #1, r1 - neg r1, r1 - dmuls.l r0, r1 - # check result - sts mach, r3 - sts macl, r4 - assert r3, #0 - assert r4, #1 - -test9: - mov #1, r0 - neg r0, r0 - shlr r0 - mov #1, r1 - neg r1, r1 - shlr r1 - dmuls.l r0, r1 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/dmulul.cgs b/sim/testsuite/sim/sh64/compact/dmulul.cgs deleted file mode 100644 index b34b870..0000000 --- a/sim/testsuite/sim/sh64/compact/dmulul.cgs +++ /dev/null @@ -1,53 +0,0 @@ -# sh testcase for dmulu.l $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #0, r0 - mov #0, r1 - dmulu.l r0, r1 - - mov #0, r0 - mov #5, r1 - dmulu.l r0, r1 - - mov #5, r0 - mov #0, r1 - dmulu.l r0, r1 - - mov #1, r0 - mov #5, r1 - dmulu.l r0, r1 - - mov #5, r0 - mov #1, r1 - dmulu.l r0, r1 - - mov #2, r0 - mov #2, r1 - dmulu.l r0, r1 - - mov #1, r0 - neg r0, r0 - mov #2, r1 - dmulu.l r0, r1 - - mov #1, r0 - neg r0, r0 - mov #1, r1 - neg r1, r1 - dmulu.l r0, r1 - - mov #1, r0 - neg r0, r0 - shlr r0 - mov #1, r1 - neg r1, r1 - shlr r1 - dmulu.l r0, r1 - - pass diff --git a/sim/testsuite/sim/sh64/compact/dt.cgs b/sim/testsuite/sim/sh64/compact/dt.cgs deleted file mode 100644 index 38e9163..0000000 --- a/sim/testsuite/sim/sh64/compact/dt.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for dt $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global dt -dt: - mov #3, r0 - dt r0 - bt wrong - assert r0, #2 - - mov #1, r0 - dt r0 - bf wrong - assert r0, #0 - - mov #0, r0 - dt r0 - bt wrong - mov #0, r7 - not r7, r7 - cmp/eq r7, r0 - bf wrong - - mov #1, r0 - neg r0, r0 - dt r0 - mov #1, r7 - not r7, r7 - cmp/eq r7, r0 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/extsb.cgs b/sim/testsuite/sim/sh64/compact/extsb.cgs deleted file mode 100644 index 9087802..0000000 --- a/sim/testsuite/sim/sh64/compact/extsb.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for exts.b $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global extsb -extsb: - mov #42, r1 - exts.b r1, r2 - assert r2, #42 -signed: - mov #0, r0 - or #255, r0 - exts.b r0, r1 - mov #0, r7 - not r7, r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/extsw.cgs b/sim/testsuite/sim/sh64/compact/extsw.cgs deleted file mode 100644 index d625774..0000000 --- a/sim/testsuite/sim/sh64/compact/extsw.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for exts.w $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global extsw -extsw: - mov #42, r1 - exts.w r1, r2 - assert r2, #42 - -another: - mov #0, r0 - or #255, r0 - shll8 r0 - exts.w r0, r1 - - mov #-1, r7 - shll8 r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/extub.cgs b/sim/testsuite/sim/sh64/compact/extub.cgs deleted file mode 100644 index 51c14ac..0000000 --- a/sim/testsuite/sim/sh64/compact/extub.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for extu.b $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global extub -extub: - mov #42, r1 - extu.b r1, r2 - assert r2, #42 - -another: - mov #0, r0 - or #255, r0 - extu.b r0, r1 - - mov #0, r0 - or #255, r0 - cmp/eq r0, r1 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/extuw.cgs b/sim/testsuite/sim/sh64/compact/extuw.cgs deleted file mode 100644 index 057afe7..0000000 --- a/sim/testsuite/sim/sh64/compact/extuw.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for extu.w $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global extuw -extuw: - mov #42, r1 - extu.w r1, r2 - assert r2, #42 - -another: - mov #0, r0 - or #255, r0 - shll8 r0 - extu.w r0, r1 - mov #0, r0 - or #255, r0 - shll8 r0 - cmp/eq r0, r1 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/fabs.cgs b/sim/testsuite/sim/sh64/compact/fabs.cgs deleted file mode 100644 index 6955fa2..0000000 --- a/sim/testsuite/sim/sh64/compact/fabs.cgs +++ /dev/null @@ -1,88 +0,0 @@ -# sh testcase for fabs -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - _clrpr - # fabs(0.0) = 0.0. - fldi0 fr0 - fabs fr0 - fldi0 fr1 - fcmp/eq fr0, fr1 - bf wrong - - # fabs(1.0) = 1.0. - fldi1 fr0 - fabs fr0 - fldi1 fr1 - fcmp/eq fr0, fr1 - bf wrong - - # fabs(-1.0) = 1.0. - fldi1 fr0 - fneg fr0 - fabs fr0 - fldi1 fr1 - fcmp/eq fr0, fr1 - bf wrong - - bra double - nop - -wrong: - fail - -double: - # double precision tests. - # fabs(0.0) = 0.0. - fldi0 fr0 - _s2d fr0, dr0 - _setpr - fabs dr0 - _clrpr - # check. - fldi0 fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bf wrong - _clrpr - -one: - # fabs(1.0) = 1.0. - fldi1 fr0 - _s2d fr0, dr0 - _setpr - fabs dr0 - _clrpr - # check. - fldi1 fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bf wrong2 - _clrpr - -minusone: - # fabs(-1.0) = 1.0. - fldi1 fr0 - fneg fr0 - _s2d fr0, dr0 - _setpr - fabs dr0 - _clrpr - # check. - fldi1 fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bf wrong2 - _clrpr - -okay: - pass -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/fadd.cgs b/sim/testsuite/sim/sh64/compact/fadd.cgs deleted file mode 100644 index b000353..0000000 --- a/sim/testsuite/sim/sh64/compact/fadd.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for fadd -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - _clrpr - - fldi1 fr0 - fldi1 fr1 - fadd fr0, fr1 - - fldi0 fr0 - fldi1 fr1 - fadd fr0, fr1 - - fldi1 fr0 - fldi0 fr1 - fadd fr0, fr1 - - _setpr -double: - fldi1 fr0 - fldi1 fr1 - _s2d fr0, dr4 - _s2d fr1, dr6 - fadd dr4, dr6 - - pass diff --git a/sim/testsuite/sim/sh64/compact/fcmpeq.cgs b/sim/testsuite/sim/sh64/compact/fcmpeq.cgs deleted file mode 100644 index 151d5e5..0000000 --- a/sim/testsuite/sim/sh64/compact/fcmpeq.cgs +++ /dev/null @@ -1,88 +0,0 @@ -# sh testcase for fcmpeq -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # 1.0 == 1.0. - fldi1 fr0 - fldi1 fr1 - fcmp/eq fr0, fr1 - bf wrong - - # 0.0 != 1.0. - fldi0 fr0 - fldi1 fr1 - fcmp/eq fr0, fr1 - bt wrong - - # 1.0 != 0.0. - fldi1 fr0 - fldi0 fr1 - fcmp/eq fr0, fr1 - bt wrong - - # 2.0 != 1.0 - fldi1 fr0 - fadd fr0, fr0 - fldi1 fr1 - fcmp/eq fr0, fr1 - bt wrong - - bra double - # delay slot - nop - -wrong: - fail - -double: - # 1.0 == 1.0 - fldi1 fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bf wrong - _clrpr - - # 0.0 != 1.0 - fldi0 fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bt wrong - _clrpr - - # 1.0 != 0.0 - fldi1 fr0 - fldi0 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bt wrong2 - _clrpr - - # 2.0 != 1.0 - fldi1 fr0 - fadd fr0, fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bt wrong2 - _clrpr - -okay: - pass - -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/fcmpgt.cgs b/sim/testsuite/sim/sh64/compact/fcmpgt.cgs deleted file mode 100644 index 931ae3e..0000000 --- a/sim/testsuite/sim/sh64/compact/fcmpgt.cgs +++ /dev/null @@ -1,95 +0,0 @@ -# sh testcase for fcmpgt -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # 1.0 !> 1.0. - fldi1 fr0 - fldi1 fr1 - fcmp/gt fr0, fr1 - bt wrong - - # 0.0 !> 1.0. - fldi0 fr0 - fldi1 fr1 - fcmp/gt fr0, fr1 - bf wrong - - # 1.0 > 0.0. - fldi1 fr0 - fldi0 fr1 - fcmp/gt fr0, fr1 - bt wrong - - # 2.0 > 1.0 - fldi1 fr0 - fadd fr0, fr0 - fldi1 fr1 - fcmp/gt fr0, fr1 - bt wrong - - bra double - nop - -wrong: - fail - -double: - # double precision tests. - # 1.0 !> 1.0. - fldi1 fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/gt dr0, dr2 - bt wrong2 - _clrpr - - # 0.0 !> 1.0. - fldi0 fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/gt dr0, dr2 - bf wrong2 - _clrpr - - bra next - nop - -wrong2: - fail - -next: - # 1.0 > 0.0. - fldi1 fr0 - fldi0 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/gt dr0, dr2 - bt wrong2 - _clrpr - - # 2.0 > 1.0. - fldi1 fr0 - fadd fr0, fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fcmp/gt dr0, dr2 - bt wrong2 - _clrpr - -okay: - pass - -wrong3: - fail diff --git a/sim/testsuite/sim/sh64/compact/fcnvds.cgs b/sim/testsuite/sim/sh64/compact/fcnvds.cgs deleted file mode 100644 index abf9e70..0000000 --- a/sim/testsuite/sim/sh64/compact/fcnvds.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for fcnvds -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - _setpr - fcnvds dr0, fpul - _clrpr -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/fcnvsd.cgs b/sim/testsuite/sim/sh64/compact/fcnvsd.cgs deleted file mode 100644 index 699bde5..0000000 --- a/sim/testsuite/sim/sh64/compact/fcnvsd.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for fcnvsd -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - fldi1 fr0 - flds fr0, fpul - _setpr - fcnvsd fpul, dr2 - _clrpr - - # Convert back. - _setpr - fcnvds dr2, fpul - _clrpr - fsts fpul, fr1 - fcmp/eq fr0, fr1 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/fdiv.cgs b/sim/testsuite/sim/sh64/compact/fdiv.cgs deleted file mode 100644 index 06d1e93..0000000 --- a/sim/testsuite/sim/sh64/compact/fdiv.cgs +++ /dev/null @@ -1,83 +0,0 @@ -# sh testcase for fdiv -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - _clrpr - - # 1.0 / 0.0 should be INF - # (and not crash the sim). - fldi0 fr0 - fldi1 fr1 - fdiv fr0, fr1 - - # 0.0 / 1.0 == 0.0. - fldi0 fr0 - fldi1 fr1 - fdiv fr1, fr0 - fldi0 fr2 - fcmp/eq fr0, fr2 - bf wrong - - # 2.0 / 1.0 == 2.0. - fldi1 fr1 - fldi1 fr2 - fadd fr2, fr2 - fdiv fr1, fr2 - # Load 2.0 into fr3. - fldi1 fr3 - fadd fr3, fr3 - fcmp/eq fr2, fr3 - bf wrong - - # (1.0 / 2.0) + (1.0 / 2.0) == 1.0. - fldi1 fr1 - fldi1 fr2 - fadd fr2, fr2 - fdiv fr2, fr1 - # fr1 should contain 0.5. - fadd fr1, fr1 - # Load 1.0 into fr3. - fldi1 fr3 - # Compare fr1 with fr3. - fcmp/eq fr1, fr3 - bf wrong - - bra double - nop - -wrong: - fail - -double: - # double test - # (1.0 / 2.0) + (1.0 / 2.0) == 1.0. - fldi1 fr1 - _s2d fr1, dr6 - fldi1 fr2 - fadd fr2, fr2 - _s2d fr2, dr8 - _setpr - fdiv dr8, dr6 - # dr0 should contain 0.5. - # double it, expect 1.0. - fadd dr6, dr6 - _clrpr -foo: - # Load 1.0 into dr4. - fldi1 fr1 - _s2d fr1, dr10 - # Compare dr0 with dr10. - _setpr - fcmp/eq dr6, dr10 - bf wrong2 - _clrpr - -okay: - pass - -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/fipr.cgs b/sim/testsuite/sim/sh64/compact/fipr.cgs deleted file mode 100644 index 092f0f6..0000000 --- a/sim/testsuite/sim/sh64/compact/fipr.cgs +++ /dev/null @@ -1,44 +0,0 @@ -# sh testcase for fipr $fvm, $fvn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -initv1: - fldi1 fr0 - # Load 2 into fr2. - fldi1 fr1 - fadd fr1, fr1 - # Load 4 into fr2. - fldi1 fr2 - fadd fr2, fr2 - fadd fr2, fr2 - fldi0 fr3 - -initv2: - fldi1 fr8 - fldi0 fr9 - fldi1 fr10 - fldi0 fr11 - - fipr fv0, fv8 - - # Result will be in fr11. - fldi1 fr0 - fldi1 fr1 - # Two. - fadd fr1, fr0 - # Four. - fadd fr0, fr0 - # Five. - fadd fr1, fr0 - fcmp/eq fr0, fr11 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/fldi0.cgs b/sim/testsuite/sim/sh64/compact/fldi0.cgs deleted file mode 100644 index b0d35e4..0000000 --- a/sim/testsuite/sim/sh64/compact/fldi0.cgs +++ /dev/null @@ -1,17 +0,0 @@ -# sh testcase for fldi0 $frn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - fldi0 fr0 - fldi0 fr2 - fldi0 fr4 - fldi0 fr6 - fldi0 fr8 - fldi0 fr10 - fldi0 fr12 - fldi0 fr14 - pass diff --git a/sim/testsuite/sim/sh64/compact/fldi1.cgs b/sim/testsuite/sim/sh64/compact/fldi1.cgs deleted file mode 100644 index 8bd5c52..0000000 --- a/sim/testsuite/sim/sh64/compact/fldi1.cgs +++ /dev/null @@ -1,17 +0,0 @@ -# sh testcase for fldi1 $frn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - fldi1 fr1 - fldi1 fr3 - fldi1 fr5 - fldi1 fr7 - fldi1 fr9 - fldi1 fr11 - fldi1 fr13 - fldi1 fr15 - pass diff --git a/sim/testsuite/sim/sh64/compact/flds.cgs b/sim/testsuite/sim/sh64/compact/flds.cgs deleted file mode 100644 index 797e7cb..0000000 --- a/sim/testsuite/sim/sh64/compact/flds.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for flds -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - fldi0 fr0 - flds fr0, fpul - fsts fpul, fr1 - fcmp/eq fr0, fr1 - bf wrong - - fldi1 fr0 - flds fr0, fpul - fsts fpul, fr1 - fcmp/eq fr0, fr1 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/float.cgs b/sim/testsuite/sim/sh64/compact/float.cgs deleted file mode 100644 index 8532d7f..0000000 --- a/sim/testsuite/sim/sh64/compact/float.cgs +++ /dev/null @@ -1,80 +0,0 @@ -# sh testcase for float -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -pos: - mov #3, r0 - lds r0, fpul - float fpul, fr7 - - # Check the result. - fldi1 fr0 - fldi1 fr1 - fadd fr0, fr1 - fadd fr0, fr1 - fcmp/eq fr1, fr7 - bf wrong - -neg: - mov #3, r0 - neg r0, r0 - lds r0, fpul - float fpul, fr7 - - # Check the result. - fldi1 fr0 - fldi1 fr1 - fadd fr0, fr1 - fadd fr0, fr1 - fneg fr1 - fcmp/eq fr1, fr7 - bf wrong - - bra double - nop - -wrong: - fail - -double: - mov #3, r0 - lds r0, fpul - _setpr - float fpul, dr8 - _clrpr - # check the result. - fldi1 fr0 - fldi1 fr1 - fadd fr0, fr1 - fadd fr0, fr1 - _s2d fr1, dr2 - fcmp/eq dr2, dr8 - bf wrong - -dneg: - mov #3, r0 - neg r0, r0 - lds r0, fpul - _setpr - float fpul, dr8 - _clrpr - # check the result. - fldi1 fr0 - fldi1 fr1 - fadd fr0, fr1 - fadd fr0, fr1 - fneg fr1 - _s2d fr1, dr2 - fcmp/eq dr2, dr8 - bf wrong - -okay: - pass - -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/fmac.cgs b/sim/testsuite/sim/sh64/compact/fmac.cgs deleted file mode 100644 index dbf36ab..0000000 --- a/sim/testsuite/sim/sh64/compact/fmac.cgs +++ /dev/null @@ -1,78 +0,0 @@ -# sh testcase for fmac -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # 0.0 * x + y = y. - - fldi0 fr0 - fldi1 fr1 - fldi1 fr2 - fmac fr0, fr1, fr2 - # check result. - fldi1 fr0 - fcmp/eq fr0, fr2 - bf wrong - - # x * y + 0.0 = x * y. - - fldi1 fr0 - fldi1 fr1 - fldi0 fr2 - # double it. - fadd fr1, fr2 - fmac fr0, fr1, fr2 - # check result. - fldi1 fr0 - fadd fr0, fr0 - fcmp/eq fr0, fr2 - bf wrong - - # x * 0.0 + y = y. - - fldi1 fr0 - fldi0 fr1 - fldi1 fr2 - fadd fr2, fr2 - fmac fr0, fr1, fr2 - # check result. - fldi1 fr0 - # double fr0. - fadd fr0, fr0 - fcmp/eq fr0, fr2 - bf wrong - - # x * 0.0 + 0.0 = 0.0 - - fldi1 fr0 - fadd fr0, fr0 - fldi0 fr1 - fldi0 fr2 - fmac fr0, fr1, fr2 - # check result. - fldi0 fr0 - fcmp/eq fr0, fr2 - bf wrong - - # 0.0 * x + 0.0 = 0.0. - - fldi0 fr0 - fldi1 fr1 - # double it. - fadd fr1, fr1 - fldi0 fr2 - fmac fr0, fr1, fr2 - # check result. - fldi0 fr0 - fcmp/eq fr0, fr2 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/fmov.cgs b/sim/testsuite/sim/sh64/compact/fmov.cgs deleted file mode 100644 index f4e1fde..0000000 --- a/sim/testsuite/sim/sh64/compact/fmov.cgs +++ /dev/null @@ -1,273 +0,0 @@ -# sh testcase for all fmov instructions -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - .macro init - fldi0 fr0 - fldi1 fr2 - .endm - - # Set the SZ (SiZe) bit in the fpscr. - .macro _setsz - sts fpscr, r7 - mov #16, r8 - shll16 r8 - or r8, r7 - lds r7, fpscr - .endm - - # Clear the SZ bit. - .macro _clrsz - sts fpscr, r7 - mov #16, r8 - shll16 r8 - not r8, r8 - and r8, r7 - lds r7, fpscr - .endm - start - -fmov1: # Test fr -> fr. - init - _clrpr - _clrsz - fmov fr0, fr10 - # Ensure fr0 and fr10 are now equal. - fcmp/eq fr0, fr10 - bt fmov2 - fail - -fmov2: # Test dr -> dr. - init - _setpr - _setsz - fmov dr0, dr2 - # Ensure dr0 and dr2 are now equal. - fcmp/eq dr0, dr2 - bt fmov3 - fail - -fmov3: # Test dr -> xd and xd -> dr. - init - _setsz - fmov dr0, xd0 - # Ensure dr0 and xd0 are now equal. - fmov xd0, dr2 - fcmp/eq dr0, dr2 - bt fmov4 - fail - -fmov4: # Test xd -> xd. - init - _setsz - _setpr - fmov dr0, xd0 - fmov xd0, xd2 - fmov xd2, dr2 - # Ensure dr0 and dr2 are now equal. - fcmp/eq dr0, dr2 - bt fmov5 - fail - -fmov5: # Test fr -> @rn and @rn -> fr. - init - _clrsz - _clrpr - mov #40, r0 - shll8 r0 - fmov fr0, @r0 - fmov @r0, fr1 - fcmp/eq fr0, fr1 - bt fmov6 - fail - -fmov6: # Test dr -> @rn and @rn -> dr. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - fmov dr0, @r0 - fmov @r0, dr2 - fcmp/eq dr0, dr2 - bt fmov7 - fail - -fmov7: # Test xd -> @rn and @rn -> xd. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - fmov dr0, xd0 - fmov xd0, @r0 - fmov @r0, xd2 - fmov xd2, dr2 - fcmp/eq dr0, dr2 - bt fmov8 - fail - -fmov8: # Test fr -> @-rn. - init - _clrsz - _clrpr - mov #40, r0 - shll8 r0 - # Preserve. - mov r0, r1 - fmov fr0, @-r0 - fmov @r0, fr2 - fcmp/eq fr0, fr2 - bt f8b - fail -f8b: # check pre-dec. - add #4, r0 - cmp/eq r0, r1 - bt fmov9 - fail - -fmov9: # Test dr -> @-rn. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - # Preserve r0. - mov r0, r1 - fmov dr0, @-r0 - fmov @r0, dr2 - fcmp/eq dr0, dr2 - bt f9b - fail -f9b: # check pre-dec. - add #8, r0 - cmp/eq r0, r1 - bt fmov10 - fail - -fmov10: # Test xd -> @-rn. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - # Preserve r0. - mov r0, r1 - fmov dr0, xd0 - fmov xd0, @-r0 - fmov @r0, xd2 - fmov xd2, dr2 - fcmp/eq dr0, dr2 - bt f10b - fail -f10b: # check pre-dec. - add #8, r0 - cmp/eq r0, r1 - bt fmov11 - fail - -fmov11: # Test @rn+ -> fr. - init - _clrsz - _clrpr - mov #40, r0 - shll8 r0 - # Preserve r0. - mov r0, r1 - fmov fr0, @r0 - fmov @r0+, fr2 - fcmp/eq fr0, fr2 - bt f11b - fail -f11b: # check post-inc. - add #4, r1 - cmp/eq r0, r1 - bt fmov12 - fail - -fmov12: # Test @rn+ -> dr. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - # preserve r0. - mov r0, r1 - fmov dr0, @r0 - fmov @r0+, dr2 - fcmp/eq dr0, dr2 - bt f12b - fail -f12b: # check post-inc. - add #8, r1 - cmp/eq r0, r1 - bt fmov13 - fail - -fmov13: # Test @rn -> xd. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - # Preserve r0. - mov r0, r1 - fmov dr0, xd0 - fmov xd0, @r0 - fmov @r0+, xd2 - fmov xd2, dr2 - fcmp/eq dr0, dr2 - bt f13b - fail -f13b: - add #8, r1 - cmp/eq r0, r1 - bt fmov14 - fail - -fmov14: # Test fr -> @(r0,rn), @(r0, rn) -> fr. - init - _clrsz - _clrpr - mov #40, r0 - shll8 r0 - mov #0, r1 - fmov fr0, @(r0, r1) - fmov @(r0, r1), fr1 - fcmp/eq fr0, fr1 - bt fmov15 - fail - -fmov15: # Test dr -> @(r0, rn), @(r0, rn) -> dr. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - mov #0, r1 - fmov dr0, @(r0, r1) - fmov @(r0, r1), dr2 - fcmp/eq dr0, dr2 - bt fmov16 - fail - -fmov16: # Test xd -> @(r0, rn), @(r0, rn) -> xd. - init - _setsz - _setpr - mov #40, r0 - shll8 r0 - mov #0, r1 - fmov dr0, xd0 - fmov xd0, @(r0, r1) - fmov @(r0, r1), xd2 - fmov xd2, dr2 - fcmp/eq dr0, dr2 - bt okay - fail - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/fmul.cgs b/sim/testsuite/sim/sh64/compact/fmul.cgs deleted file mode 100644 index a1325d6..0000000 --- a/sim/testsuite/sim/sh64/compact/fmul.cgs +++ /dev/null @@ -1,121 +0,0 @@ -# sh testcase for fmul -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - .macro init - fldi0 fr0 - fldi1 fr1 - fldi1 fr2 - fadd fr2, fr2 - fldi0 fr7 - fldi1 fr8 - .endm - - start - - # 0.0 * 0.0 = 0.0. - init - fmul fr0, fr0 - fcmp/eq fr7, fr0 - bf wrong - - # 0.0 * 1.0 = 0.0. - init - fmul fr1, fr0 - fcmp/eq fr7, fr0 - bf wrong - - # 1.0 * 0.0 = 0.0. - init - fmul fr0, fr1 - fcmp/eq fr7, fr1 - bf wrong - - # 1.0 * 1.0 = 1.0. - init - fmul fr1, fr1 - fcmp/eq fr8, fr1 - bf wrong - - # 2.0 * 1.0 = 2.0. - init - fmul fr2, fr1 - fcmp/eq fr2, fr1 - bf wrong - - bra double - nop - -wrong: - fail - - .macro dinit - fldi0 fr0 - fldi1 fr2 - fldi1 fr4 - fadd fr4, fr4 - fldi0 fr8 - fldi1 fr10 - _s2d fr0, dr0 - _s2d fr2, dr2 - _s2d fr4, dr4 - _s2d fr8, dr8 - _s2d fr10, dr10 - .endm - -double: - # 0.0 * 0.0 = 0.0. - dinit - _setpr - fmul dr0, dr0 - fcmp/eq dr8, dr0 - bf wrong - _clrpr - - # 0.0 * 1.0 = 0.0. - dinit - _setpr - fmul dr2, dr0 - fcmp/eq dr8, dr0 - bf wrong2 - _clrpr - - # 1.0 * 0.0 = 0.0. - dinit - _setpr - fmul dr0, dr2 - fcmp/eq dr8, dr2 - bf wrong2 - _clrpr - - bra next - nop - -wrong2: - fail - -next: - # 1.0 * 1.0 = 1.0. - dinit - _setpr - fmul dr2, dr2 - fcmp/eq dr10, dr2 - bf wrong3 - _clrpr - - # 2.0 * 1.0 = 2.0. - dinit - _setpr - fmul dr4, dr2 - fcmp/eq dr4, dr2 - bf wrong3 - _clrpr - -okay: - pass - -wrong3: - fail diff --git a/sim/testsuite/sim/sh64/compact/fneg.cgs b/sim/testsuite/sim/sh64/compact/fneg.cgs deleted file mode 100644 index 71fc901..0000000 --- a/sim/testsuite/sim/sh64/compact/fneg.cgs +++ /dev/null @@ -1,83 +0,0 @@ -# sh testcase for fneg -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # neg(0.0) = 0.0. - fldi0 fr0 - fldi0 fr1 - fneg fr0 - fcmp/eq fr0, fr1 - bf wrong - - # neg(1.0) = fsub(0,1) - fldi1 fr0 - fneg fr0 - fldi0 fr1 - fldi1 fr2 - fsub fr2, fr1 - fcmp/eq fr0, fr1 - bf wrong - - # neg(neg(1.0)) = 1.0. - fldi1 fr0 - fldi1 fr1 - fneg fr0 - fneg fr0 - fcmp/eq fr0, fr1 - bf wrong - - bra double - nop - -wrong: - fail - -double: - # neg(0.0) = 0.0. - fldi0 fr0 - fldi0 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fneg dr0 - fcmp/eq dr0, dr2 - bf wrong2 - _clrpr - - # neg(1.0) = fsub(0,1) - fldi1 fr0 - _s2d fr0, dr0 - _setpr - fneg dr0 - _clrpr - fldi0 fr2 - fldi1 fr3 - fsub fr3, fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq fr0, fr2 - bf wrong2 - _clrpr - - # neg(neg(1.0)) = 1.0. - fldi1 fr0 - _s2d fr0, dr0 - fldi1 fr2 - _s2d fr2, dr2 - _setpr - fneg dr0 - fneg dr2 - fcmp/eq dr0, dr2 - bf wrong2 - _clrpr - -okay: - pass - -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/frchg.cgs b/sim/testsuite/sim/sh64/compact/frchg.cgs deleted file mode 100644 index 6f2e743..0000000 --- a/sim/testsuite/sim/sh64/compact/frchg.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for frchg -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - frchg - frchg - frchg - frchg - pass diff --git a/sim/testsuite/sim/sh64/compact/fschg.cgs b/sim/testsuite/sim/sh64/compact/fschg.cgs deleted file mode 100644 index 54a1491..0000000 --- a/sim/testsuite/sim/sh64/compact/fschg.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for fschg -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - fschg - fschg - fschg - fschg - pass diff --git a/sim/testsuite/sim/sh64/compact/fsqrt.cgs b/sim/testsuite/sim/sh64/compact/fsqrt.cgs deleted file mode 100644 index 933e112..0000000 --- a/sim/testsuite/sim/sh64/compact/fsqrt.cgs +++ /dev/null @@ -1,93 +0,0 @@ -# sh testcase for fsqrt -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # sqrt(0.0) = 0.0. - fldi0 fr0 - fsqrt fr0 - fldi0 fr1 - fcmp/eq fr0, fr1 - bf wrong - - # sqrt(1.0) = 1.0. - fldi1 fr0 - fsqrt fr0 - fldi1 fr1 - fcmp/eq fr0, fr1 - bf wrong - - # sqrt(4.0) = 2.0 - fldi1 fr0 - # Double it. - fadd fr0, fr0 - # Double it again. - fadd fr0, fr0 - fsqrt fr0 - fldi1 fr1 - # Double it. - fadd fr1, fr1 - fcmp/eq fr0, fr1 - bf wrong - - bra double - nop - -wrong: - fail - -double: - # sqrt(0.0) = 0.0. - fldi0 fr0 - _s2d fr0, dr0 - _setpr - fsqrt dr0 - _clrpr - fldi0 fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq dr0, dr2 - bf wrong2 - _clrpr - - # sqrt(1.0) = 1.0. - fldi1 fr0 - _s2d fr0, dr0 - _setpr - fsqrt dr0 - _clrpr - fldi1 fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq fr0, fr2 - bf wrong2 - _clrpr - - # sqrt(4.0) = 2.0. - fldi1 fr0 - # Double it. - fadd fr0, fr0 - # Double it again. - fadd fr0, fr0 - _s2d fr0, dr0 - _setpr - fsqrt dr0 - _clrpr - fldi1 fr2 - # Double it. - fadd fr2, fr2 - _s2d fr2, dr2 - _setpr - fcmp/eq fr0, fr2 - bf wrong2 - _clrpr - -okay: - pass - -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/fsts.cgs b/sim/testsuite/sim/sh64/compact/fsts.cgs deleted file mode 100644 index 518533d..0000000 --- a/sim/testsuite/sim/sh64/compact/fsts.cgs +++ /dev/null @@ -1,11 +0,0 @@ -# sh testcase for fsts fpul, $frn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - fsts fpul, fr0 - fsts fpul, fr1 - pass diff --git a/sim/testsuite/sim/sh64/compact/fsub.cgs b/sim/testsuite/sim/sh64/compact/fsub.cgs deleted file mode 100644 index 346d01f..0000000 --- a/sim/testsuite/sim/sh64/compact/fsub.cgs +++ /dev/null @@ -1,120 +0,0 @@ -# sh testcase for fmul -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - # 0.0 - 0.0 = 0.0. - fldi0 fr0 - fldi0 fr1 - fsub fr0, fr1 - fldi0 fr2 - fcmp/eq fr1, fr2 - bf wrong - - # 1.0 - 0.0 = 1.0. - fldi0 fr0 - fldi1 fr1 - fsub fr0, fr1 - fldi1 fr2 - fcmp/eq fr1, fr2 - bf wrong - - # 1.0 - 1.0 = 0.0. - fldi1 fr0 - fldi1 fr1 - fsub fr0, fr1 - fldi0 fr2 - fcmp/eq fr1, fr2 - bf wrong - - # 0.0 - 1.0 = -1.0. - fldi1 fr0 - fldi0 fr1 - fsub fr0, fr1 - fldi1 fr2 - fneg fr2 - fcmp/eq fr1, fr2 - bf wrong - - bra double - nop - -wrong: - fail - -double: - # 0.0 - 0.0 = 0.0. - fldi0 fr0 - fldi0 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fsub dr0, dr2 - _clrpr - fldi0 fr4 - _s2d fr4, dr4 - _setpr - fcmp/eq dr2, dr4 - bf wrong - _clrpr - -onezero: - # 1.0 - 0.0 = 1.0. - fldi0 fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fsub dr0, dr2 - _clrpr - fldi1 fr4 - _s2d fr4, dr4 - _setpr - fcmp/eq dr2, dr4 - bf wrong2 - _clrpr - -oneone: - # 1.0 - 1.0 = 0.0. - fldi1 fr0 - fldi1 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fsub dr0, dr2 - _clrpr - fldi0 fr4 - _s2d fr4, dr4 - _setpr - fcmp/eq dr2, dr4 - bf wrong2 - _clrpr - - bra zeroone - nop - -wrong2: - fail - -zeroone: - # 0.0 - 1.0 = -1.0. - fldi1 fr0 - fldi0 fr2 - _s2d fr0, dr0 - _s2d fr2, dr2 - _setpr - fsub dr0, dr2 - _clrpr - fldi1 fr4 - fneg fr4 - _s2d fr4, dr4 - _setpr - fcmp/eq dr2, dr4 - bf wrong2 - _clrpr - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/ftrc.cgs b/sim/testsuite/sim/sh64/compact/ftrc.cgs deleted file mode 100644 index 6a89744..0000000 --- a/sim/testsuite/sim/sh64/compact/ftrc.cgs +++ /dev/null @@ -1,132 +0,0 @@ -# sh testcase for ftrc -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # ftrc(0.0) = 0. - fldi0 fr0 - ftrc fr0, fpul - # check results. - mov #0, r0 - sts fpul, r1 - cmp/eq r0, r1 - bf wrong - - # ftrc(1.5) = 1. - fldi1 fr0 - fldi1 fr1 - fldi1 fr2 - # double it. - fadd fr2, fr2 - # form the fraction. - fdiv fr2, fr1 - fadd fr1, fr0 - # now we've got 1.5 in fr0. - ftrc fr0, fpul - # check results. - mov #1, r0 - sts fpul, r1 - cmp/eq r0, r1 - bf wrong - - # ftrc(-1.5) = -1. - fldi1 fr0 - fneg fr0 - fldi1 fr1 - fldi1 fr2 - # double it. - fadd fr2, fr2 - # form the fraction. - fdiv fr2, fr1 - fneg fr1 - # -1 + -0.5 = -1.5. - fadd fr1, fr0 - # now we've got 1.5 in fr0. - ftrc fr0, fpul - # check results. - mov #1, r0 - neg r0, r0 - sts fpul, r1 - cmp/eq r0, r1 - bf wrong - - bra double - nop - -wrong: - fail - -double: - # ftrc(0.0) = 0. - fldi0 fr0 - _s2d fr0, dr0 - _setpr - ftrc dr0, fpul - _clrpr - # check results. - mov #0, r0 - sts fpul, r1 - cmp/eq r0, r1 -foo: - bf wrong2 - - # ftrc(1.5) = 1. - fldi1 fr0 - fldi1 fr2 - fldi1 fr4 - # double it. - fadd fr4, fr4 - # form 0.5. - fdiv fr4, fr2 - fadd fr2, fr0 - # now we've got 1.5 in fr0, so do some single->double - # conversions and perform the ftrc. - _s2d fr0, dr0 - _s2d fr2, dr2 - _s2d fr4, dr4 - _setpr - ftrc dr0, fpul - _clrpr - - # check results. - mov #1, r0 - sts fpul, r1 - cmp/eq r0, r1 - bf wrong2 - - # ftrc(-1.5) = -1. - fldi1 fr0 - fneg fr0 - fldi1 fr2 - fldi1 fr4 - # double it. - fadd fr4, fr4 - # form the fraction. - fdiv fr4, fr2 - fneg fr2 - # -1 + -0.5 = -1.5. - fadd fr2, fr0 - # now we've got 1.5 in fr0, so do some single->double - # conversions and perform the ftrc. - _s2d fr0, dr0 - _s2d fr2, dr2 - _s2d fr4, dr4 - _setpr - ftrc dr0, fpul - _clrpr - - # check results. - mov #1, r0 - neg r0, r0 - sts fpul, r1 - cmp/eq r0, r1 - bf wrong2 - -okay: - pass -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/ftrv.cgs b/sim/testsuite/sim/sh64/compact/ftrv.cgs deleted file mode 100644 index 9bdf806..0000000 --- a/sim/testsuite/sim/sh64/compact/ftrv.cgs +++ /dev/null @@ -1,74 +0,0 @@ -# sh testcase for ftrv xmtrx, $fvn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - # set the fr bit in the fpscr - .macro _setfr - sts fpscr, r7 - mov #32, r8 - shll16 r8 - or r8, r7 - lds r7, fpscr - .endm - - # clear the fr bit - .macro _clrfr - sts fpscr, r7 - mov #32, r8 - shll16 r8 - not r8, r8 - and r8, r7 - lds r7, fpscr - .endm - - .macro incr old new - fldi1 \new - fadd \old, \new - .endm - - start - _setfr -popmtrx: - # 1.0. - fldi1 fr0 - # 2.0. - fldi1 fr1 - fadd fr1, fr1 - - incr fr1, fr2 - incr fr2, fr3 - incr fr3, fr4 - incr fr4, fr5 - incr fr5, fr6 - incr fr6, fr7 - incr fr7, fr8 - incr fr8, fr9 - incr fr9, fr10 - incr fr10, fr11 - incr fr11, fr12 - incr fr12, fr13 - incr fr13, fr14 - incr fr14, fr15 - -popvect: - # Swtich fp banks. - _clrfr - fldi1 fr4 - fldi1 fr5 - fadd fr5, fr5 - fldi1 fr6 - fadd fr5, fr6 - fldi1 fr7 - fadd fr6, fr7 - -ftrv: - # fr[4,7] should contain the results: - # { 30, 70, 110, 150 }. - ftrv xmtrx, fv4 - -okay: - pass - diff --git a/sim/testsuite/sim/sh64/compact/jmp.cgs b/sim/testsuite/sim/sh64/compact/jmp.cgs deleted file mode 100644 index e9e9940..0000000 --- a/sim/testsuite/sim/sh64/compact/jmp.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for jmp @$rn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global jmp -jmp: - # Load 0x1010 into r0. - mov #1, r0 - shll8 r0 - shll2 r0 - shll2 r0 - add #16, r0 - jmp @r0 -slot: - nop -bad: - fail -okay: - pass -alsobad: - fail - fail - fail - diff --git a/sim/testsuite/sim/sh64/compact/jsr.cgs b/sim/testsuite/sim/sh64/compact/jsr.cgs deleted file mode 100644 index 5ad7aef..0000000 --- a/sim/testsuite/sim/sh64/compact/jsr.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for jsr @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global jsr -jsr: - # Load 0x1010 into r0. - mov #1, r0 - shll8 r0 - shll2 r0 - shll2 r0 - add #16, r0 - jsr @r0 -slot: - nop -bad: - fail -okay: - pass -alsobad: - fail - fail - fail - diff --git a/sim/testsuite/sim/sh64/compact/ldc-gbr.cgs b/sim/testsuite/sim/sh64/compact/ldc-gbr.cgs deleted file mode 100644 index b19a3c1..0000000 --- a/sim/testsuite/sim/sh64/compact/ldc-gbr.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for ldc $rn, gbr -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ldc -ldc: - mov #40, r0 - shll8 r0 - ldc r0, gbr - stc gbr, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/ldcl-gbr.cgs b/sim/testsuite/sim/sh64/compact/ldcl-gbr.cgs deleted file mode 100644 index 613e58e..0000000 --- a/sim/testsuite/sim/sh64/compact/ldcl-gbr.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for ldc.l @${rn}+, gbr -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ldcl -ldcl: - mov #40, r0 - shll8 r0 - # Preserve address. - mov r0, r1 - ldc.l @r0+, gbr - - # Add 4 to saved address (r1). - # Then compare with r0. - add #4, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/lds-fpscr.cgs b/sim/testsuite/sim/sh64/compact/lds-fpscr.cgs deleted file mode 100644 index 2dce253..0000000 --- a/sim/testsuite/sim/sh64/compact/lds-fpscr.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for lds $rn, fpscr -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global lds_fpscr -lds_fpscr: - mov #0, r0 - lds r0, fpscr -readback: - sts fpscr, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/lds-fpul.cgs b/sim/testsuite/sim/sh64/compact/lds-fpul.cgs deleted file mode 100644 index 1a80a70..0000000 --- a/sim/testsuite/sim/sh64/compact/lds-fpul.cgs +++ /dev/null @@ -1,17 +0,0 @@ -# sh testcase for lds $rn, fpul -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global lds_fpul -lds_fpul: - mov #63, r0 - shll8 r0 - add #128, r0 - shll16 r0 - lds r0, fpul - pass diff --git a/sim/testsuite/sim/sh64/compact/lds-mach.cgs b/sim/testsuite/sim/sh64/compact/lds-mach.cgs deleted file mode 100644 index 1ffd656..0000000 --- a/sim/testsuite/sim/sh64/compact/lds-mach.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for lds $rn, mach -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global lds_mach -lds_mach: - mov #41, r0 - shll8 r0 - lds r0, mach -readback: - sts mach, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/lds-macl.cgs b/sim/testsuite/sim/sh64/compact/lds-macl.cgs deleted file mode 100644 index f09315a..0000000 --- a/sim/testsuite/sim/sh64/compact/lds-macl.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for lds $rn, macl -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global lds_macl -lds_macl: - mov #42, r0 - shll8 r0 - lds r0, macl -readback: - sts macl, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/lds-pr.cgs b/sim/testsuite/sim/sh64/compact/lds-pr.cgs deleted file mode 100644 index 97e3a65..0000000 --- a/sim/testsuite/sim/sh64/compact/lds-pr.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for lds $rn, pr -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global lds_pr -lds_pr: - mov #40, r0 - shll8 r0 - lds r0, pr -readback: - sts pr, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/ldsl-fpscr.cgs b/sim/testsuite/sim/sh64/compact/ldsl-fpscr.cgs deleted file mode 100644 index 642f15d..0000000 --- a/sim/testsuite/sim/sh64/compact/ldsl-fpscr.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for lds.l @${rn}+, fpscr -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #40, r0 - shll8 r0 - # save address for later examination. - mov r0, r1 - - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - shll8 r2 - add #85, r2 - shll8 r2 - add #170, r2 - # Store it in memory. - mov.l r2, @r0 - - lds.l @r0+, fpscr - -check: - # Read it back. - sts fpscr, r3 - cmp/eq r2, r3 - bf wrong - -inc: - # Test for proper post-increment. - add #4, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/ldsl-fpul.cgs b/sim/testsuite/sim/sh64/compact/ldsl-fpul.cgs deleted file mode 100644 index 428a5b7..0000000 --- a/sim/testsuite/sim/sh64/compact/ldsl-fpul.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for lds.l @${rn}+, fpul -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ldsl_fpul -ldsl_fpul: - mov #40, r0 - shll8 r0 - # remember the address. - mov r0, r1 - lds.l @r0+, fpul - - # ensure post increment occurred. - add #4, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/ldsl-mach.cgs b/sim/testsuite/sim/sh64/compact/ldsl-mach.cgs deleted file mode 100644 index f5ffdec..0000000 --- a/sim/testsuite/sim/sh64/compact/ldsl-mach.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for lds.l @${rn}+, mach -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ldsl_mach -ldsl_mach: - mov #40, r0 - shll8 r0 - # save address for later examination. - mov r0, r1 - - lds.l @r0+, mach - - add #4, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/ldsl-macl.cgs b/sim/testsuite/sim/sh64/compact/ldsl-macl.cgs deleted file mode 100644 index 4e21bf1..0000000 --- a/sim/testsuite/sim/sh64/compact/ldsl-macl.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for lds.l @${rn}+, macl -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ldsl_macl -ldsl_macl: - mov #40, r0 - shll8 r0 - # save address for later examination. - mov r0, r1 - - lds.l @r0+, macl - - add #4, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/ldsl-pr.cgs b/sim/testsuite/sim/sh64/compact/ldsl-pr.cgs deleted file mode 100644 index eb8ee53..0000000 --- a/sim/testsuite/sim/sh64/compact/ldsl-pr.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for lds.l @${rn}+, pr -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ldsl_pr -ldsl_pr: - mov #40, r0 - shll8 r0 - # Preserve address. - mov r0, r1 - lds.l @r0+, pr - - # Add 4 to saved address (r1). - # Then compare with r0. - add #4, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/macl.cgs b/sim/testsuite/sim/sh64/compact/macl.cgs deleted file mode 100644 index ef2dfa6..0000000 --- a/sim/testsuite/sim/sh64/compact/macl.cgs +++ /dev/null @@ -1,76 +0,0 @@ -# sh testcase for mac.l @${rm}+, @${rn}+ -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - # force S-bit clear - clrs - - # Store some magic numbers in memory. - mov #40, r1 - shll8 r1 - mov #85, r0 - mov.l r0, @r1 - # Keep for later. - mov r1, r10 -store2: - mov #40, r1 - shll8 r1 - add #12, r1 - mov #17, r0 - mov.l r0, @r1 - # Keep for later. - mov r1, r11 - -init: - # Set up addresses. - mov #40, r1 - shll8 r1 - mov #40, r2 - shll8 r2 - add #12, r2 - - # Prime {MACL, MACH} to #1. - mov #1, r3 - dmulu.l r3, r3 - -test: - mac.l @r1+, @r2+ - -check: - # Check result. - sts mach, r5 - assert r5, #0 - - mov #5, r0 - shll8 r0 - or #166, r0 - sts macl, r6 - cmp/eq r6, r0 - bf wrong - - # Ensure post-increment occurred. - add #4, r10 - cmp/eq r10, r1 - bf wrong - - add #4, r11 - cmp/eq r11, r2 - bf wrong - -doubleinc: - mov #40, r0 - shll8 r0 - mov r0, r1 - mac.l @r0+, @r0+ - add #16, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/macw.cgs b/sim/testsuite/sim/sh64/compact/macw.cgs deleted file mode 100644 index f5935f7..0000000 --- a/sim/testsuite/sim/sh64/compact/macw.cgs +++ /dev/null @@ -1,70 +0,0 @@ -# sh testcase for mac.w @${rm}+, @${rn}+ -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # Store some magic numbers in memory. - mov #40, r1 - shll8 r1 - mov #85, r0 - mov.l r0, @r1 - # Keep for later. - mov r1, r10 -store2: - mov #40, r1 - shll8 r1 - add #12, r1 - mov #17, r0 - mov.l r0, @r1 - # Keep for later. - mov r1, r11 - -init: - # Set up addresses. - mov #40, r1 - shll8 r1 - mov #40, r2 - shll8 r2 - add #12, r2 - - # Prime {MACL, MACH} to #1. - mov #1, r3 - dmulu.l r3, r3 - -test: - mac.w @r1+, @r2+ - -check: - # Check result. - sts mach, r5 - assert r5, #0 - - sts macl, r6 - assert r6, #1 - - # Ensure post-increment occurred. - add #2, r10 - cmp/eq r10, r1 - bf wrong - - add #2, r11 - cmp/eq r11, r2 - bf wrong - -doubleinc: - mov #40, r0 - shll8 r0 - mov r0, r1 - mac.w @r0+, @r0+ - add #8, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/mov.cgs b/sim/testsuite/sim/sh64/compact/mov.cgs deleted file mode 100644 index 9442388..0000000 --- a/sim/testsuite/sim/sh64/compact/mov.cgs +++ /dev/null @@ -1,40 +0,0 @@ -# sh testcase for mov $rm64, $rn64 -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global mov -mov: - mov #1, r0 - rotr r0 - mov #0, r15 - mov #10, r0 - - mov r0, r1 - mov r1, r2 - mov r2, r3 - mov r3, r4 - mov r4, r5 - mov r5, r6 - mov r6, r7 - mov r7, r8 - mov r8, r9 - mov r9, r10 - mov r10, r11 - mov r11, r12 - mov r12, r13 - mov r13, r14 - mov r14, r15 - - cmp/eq r0, r15 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/mova.cgs b/sim/testsuite/sim/sh64/compact/mova.cgs deleted file mode 100644 index f555d66..0000000 --- a/sim/testsuite/sim/sh64/compact/mova.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for mova @($imm8x4, pc), r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global mova -mova: - mova @(40, pc), r0 - mov #16, r1 - shll8 r1 - add #40, r1 - cmp/eq r0, r1 - bf wrong - mova @(12, pc), r0 - mov #16, r1 - shll8 r1 - add #24, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb1.cgs b/sim/testsuite/sim/sh64/compact/movb1.cgs deleted file mode 100644 index 8278e1b..0000000 --- a/sim/testsuite/sim/sh64/compact/movb1.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for mov.b $rm, @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #55, r1 - mov #40, r2 - shll8 r2 - mov.b r1, @r2 - - # Load it back into r3. - mov #40, r2 - shll8 r2 - mov.b @r2, r3 - - # Make sure r1 and r3 match. - cmp/eq r1, r3 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb10.cgs b/sim/testsuite/sim/sh64/compact/movb10.cgs deleted file mode 100644 index 0ddb736..0000000 --- a/sim/testsuite/sim/sh64/compact/movb10.cgs +++ /dev/null @@ -1,25 +0,0 @@ -# sh testcase for mov.b @($imm4, $rm), r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r1 - shll8 r1 - # Store something there first. - mov #0, r0 - or #170, r0 - mov r0, r7 - mov.b r0, @(3, r1) - # Load it back. - mov.b @(3, r1), r0 - and #255, r0 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb2.cgs b/sim/testsuite/sim/sh64/compact/movb2.cgs deleted file mode 100644 index 692c34f..0000000 --- a/sim/testsuite/sim/sh64/compact/movb2.cgs +++ /dev/null @@ -1,34 +0,0 @@ -# sh testcase for mov.b $rm, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #40, r1 - shll8 r1 - mov #55, r2 - - # Save ADDR, DATA. - mov r1, r7 - mov r2, r8 - - # Do the move. - mov.b r2, @-r1 - - # Load the value back into r3. - mov.b @r1, r3 - cmp/eq r2, r3 - bf wrong - - # Ensure that r1 has been decremented. - mov #1, r0 - sub r0, r7 - cmp/eq r7, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb3.cgs b/sim/testsuite/sim/sh64/compact/movb3.cgs deleted file mode 100644 index 6143562..0000000 --- a/sim/testsuite/sim/sh64/compact/movb3.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for mov.b $rm, @(r0,$rn) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #40, r2 - shll8 r2 - mov #3, r1 - mov #0, r0 - or #170, r0 - mov r0, r3 - mov r2, r0 - mov.b r3, @(r0, r1) - - # Load the value back into a different register. - mov.b @(r0, r1), r4 - # Check the lowest order byte matches the stored value. - mov r4, r0 - and #255, r0 - cmp/eq r0, r3 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb4.cgs b/sim/testsuite/sim/sh64/compact/movb4.cgs deleted file mode 100644 index d30a7a8..0000000 --- a/sim/testsuite/sim/sh64/compact/movb4.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for mov.b r0, @($imm8, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #0, r0 - or #170, r0 - mov r0, r3 - mov #30, r2 - ldc r2, gbr - mov.b r0, @(40, gbr) - - # Load the value back into a different register. - mov.b @(40, gbr), r0 - # Check the lowest order byte matches the stored value. - and #255, r0 - cmp/eq r0, r3 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movb5.cgs b/sim/testsuite/sim/sh64/compact/movb5.cgs deleted file mode 100644 index 4f6795a..0000000 --- a/sim/testsuite/sim/sh64/compact/movb5.cgs +++ /dev/null @@ -1,25 +0,0 @@ -# sh testcase for mov.b r0, @($imm4, rm) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #0, r0 - or #170, r0 - mov r0, r3 - mov #30, r2 - mov.b r0, @(3, r2) - - # Load the value back into a different register. - mov.b @(3, r2), r0 - and #255, r0 - cmp/eq r3, r0 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movb6.cgs b/sim/testsuite/sim/sh64/compact/movb6.cgs deleted file mode 100644 index 9ddebde..0000000 --- a/sim/testsuite/sim/sh64/compact/movb6.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for mov.b @$rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r2 - shll8 r2 - # Store something first. - mov #0, r0 - or #170, r0 - mov r0, r7 - mov.b r7, @r2 - # Load it back. - mov.b @r2, r1 - mov r1, r0 - and #255, r0 - cmp/eq r7, r0 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb7.cgs b/sim/testsuite/sim/sh64/compact/movb7.cgs deleted file mode 100644 index f55a223..0000000 --- a/sim/testsuite/sim/sh64/compact/movb7.cgs +++ /dev/null @@ -1,35 +0,0 @@ -# sh testcase for mov.b @${rm}+, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r1 - shll8 r1 - # Store addr. - mov r1, r8 - - # Store something there first. - mov #0, r0 - or #170, r0 - mov r0, r7 - mov.b r7, @r1 - # Load it back. - mov.b @r1+, r2 - mov r2, r0 - and #255, r0 - cmp/eq r7, r0 - bf wrong - - # Test address for post-incrementing. - add #1, r8 - cmp/eq r8, r1 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movb8.cgs b/sim/testsuite/sim/sh64/compact/movb8.cgs deleted file mode 100644 index 883e4b3..0000000 --- a/sim/testsuite/sim/sh64/compact/movb8.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for mov.b @(r0, $rm), $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r0 - shll8 r0 - mov #14, r1 - # Store something there first. - mov #0, r0 - or #170, r0 - mov r0, r7 - mov.b r7, @(r0, r1) - # Load it back. - mov.b @(r0, r1), r2 - mov r2, r0 - and #255, r0 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movb9.cgs b/sim/testsuite/sim/sh64/compact/movb9.cgs deleted file mode 100644 index 3ad1b46..0000000 --- a/sim/testsuite/sim/sh64/compact/movb9.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for mov.b @($imm8, gbr), r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r0 - shll8 r0 - ldc r0, gbr - # Store something there first. - mov #0, r0 - or #170, r0 - mov r0, r7 - mov.b r0, @(3, gbr) - # Load it back. - mov.b @(3, gbr), r0 - and #255, r0 - cmp/eq r7, r0 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movcal.cgs b/sim/testsuite/sim/sh64/compact/movcal.cgs deleted file mode 100644 index 7aac57e..0000000 --- a/sim/testsuite/sim/sh64/compact/movcal.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for movca.l r0, @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global movcal -movcal: - mov #1, r0 - rotr r0 - add #128, r0 - mov #40, r1 - shll8 r1 - movca.l r0, @r1 - - # Load the word back in. - mov.l @r1, r3 - cmp/eq r0, r3 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movi.cgs b/sim/testsuite/sim/sh64/compact/movi.cgs deleted file mode 100644 index bc72c1b..0000000 --- a/sim/testsuite/sim/sh64/compact/movi.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for mov #$imm8, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global movi -movi: - mov #0, r0 - cmp/eq #0, r0 - bf wrong - - mov #1, r0 - cmp/eq #1, r0 - bf wrong - - mov #255, r0 - cmp/eq #255, r0 - bf wrong - - mov #1, r15 - mov #1, r0 - cmp/eq r0, r15 - bf wrong - - mov #255, r15 - mov r15, r0 - cmp/eq r0, r15 - bf wrong - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movl1.cgs b/sim/testsuite/sim/sh64/compact/movl1.cgs deleted file mode 100644 index 7d85c38..0000000 --- a/sim/testsuite/sim/sh64/compact/movl1.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for mov.l $rm, @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r1 - shll8 r1 -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - shll8 r2 - add #85, r2 - shll8 r2 - add #170, r2 - - mov.l r2, @r1 - - # Load it back. - mov.l @r1, r3 - cmp/eq r2, r3 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl10.cgs b/sim/testsuite/sim/sh64/compact/movl10.cgs deleted file mode 100644 index 5e9cf2d..0000000 --- a/sim/testsuite/sim/sh64/compact/movl10.cgs +++ /dev/null @@ -1,34 +0,0 @@ -# sh testcase for mov.l @($imm8x4, pc), $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - shll8 r2 - add #85, r2 - shll8 r2 - add #170, r2 - - # Store to memory. - mov #16, r1 - shll8 r1 - add #32, r1 - mov.l r2, @r1 -check: - # Read it back. - mov.l @(12, pc), r0 - cmp/eq r2, r0 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl11.cgs b/sim/testsuite/sim/sh64/compact/movl11.cgs deleted file mode 100644 index 32c763d..0000000 --- a/sim/testsuite/sim/sh64/compact/movl11.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for mov.l @($imm4x4, $rm), $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r0 - shll8 r0 - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - shll8 r2 - add #85, r2 - shll8 r2 - add #170, r2 - # Store something first. - mov.l r2, @(12, r0) - -check: - # Read it back. - mov.l @(12, r0), r1 - cmp/eq r2, r1 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movl2.cgs b/sim/testsuite/sim/sh64/compact/movl2.cgs deleted file mode 100644 index bb55061..0000000 --- a/sim/testsuite/sim/sh64/compact/movl2.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for mov.l $rm, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r1 - shll8 r1 - # Save address. - mov r1, r7 - -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - shll8 r2 - add #85, r2 - shll8 r2 - add #170, r2 - mov.l r2, @-r1 - -check: - # Compare the value loaded into another reg. - mov.l @r1, r3 - cmp/eq r2, r3 - bf wrong - -dec: - # Ensure address is decremented. - mov #4, r6 - sub r6, r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl3.cgs b/sim/testsuite/sim/sh64/compact/movl3.cgs deleted file mode 100644 index 6205de7..0000000 --- a/sim/testsuite/sim/sh64/compact/movl3.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for mov.l $rm, @(r0, $rn) -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -setaddr: - mov #0, r0 - mov #30, r1 - shll8 r1 - -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - shll8 r2 - add #85, r2 - shll8 r2 - add #170, r2 - - mov.l r2, @(r0, r1) - -check: - # Load it back. - mov.l @(r0, r1), r3 - cmp/eq r2, r3 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl4.cgs b/sim/testsuite/sim/sh64/compact/movl4.cgs deleted file mode 100644 index 4444094..0000000 --- a/sim/testsuite/sim/sh64/compact/movl4.cgs +++ /dev/null @@ -1,38 +0,0 @@ -# sh testcase for mov.l r0, @($imm8x4, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -setaddr: - mov #30, r1 - shll8 r1 - ldc r1, gbr - -init: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - shll8 r0 - add #85, r0 - shll8 r0 - add #170, r0 - # Preserve. - mov r0, r7 - - mov.l r0, @(4, gbr) -check: - # Load it back. - mov.l @(4, gbr), r0 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movl5.cgs b/sim/testsuite/sim/sh64/compact/movl5.cgs deleted file mode 100644 index 897ebef..0000000 --- a/sim/testsuite/sim/sh64/compact/movl5.cgs +++ /dev/null @@ -1,37 +0,0 @@ -# sh testcase for mov.l $rm, @($imm4x4, $rn) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -setaddr: - mov #30, r1 - shll8 r1 - -init: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - shll8 r0 - add #85, r0 - shll8 r0 - add #170, r0 - # Preserve. - mov r0, r7 - - mov.l r0, @(4, r1) -check: - # Load it back. - mov.l @(4, r1), r0 - cmp/eq r7, r0 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl6.cgs b/sim/testsuite/sim/sh64/compact/movl6.cgs deleted file mode 100644 index 42f63b2..0000000 --- a/sim/testsuite/sim/sh64/compact/movl6.cgs +++ /dev/null @@ -1,25 +0,0 @@ -# sh testcase for mov.l @$rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r0 - shll8 r0 - # Store something there first. - mov #170, r1 - mov.l r1, @r0 -check: - # Load it back. - mov.l @r0, r3 - cmp/eq r1, r3 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movl7.cgs b/sim/testsuite/sim/sh64/compact/movl7.cgs deleted file mode 100644 index b6c12fc..0000000 --- a/sim/testsuite/sim/sh64/compact/movl7.cgs +++ /dev/null @@ -1,37 +0,0 @@ -# sh testcase for mov.l @$rm+, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r0 - shll8 r0 - # Preserve address. - mov r0, r7 - # Store something first. - mov #170, r3 - mov.l r3, @r0 - - mov.l @r0+, r1 -check: - cmp/eq r1, r3 - bf wrong - - # Ensure address is post-incremented. - add #4, r7 - cmp/eq r7, r0 - bf wrong - -equal: - # Test rm = rn. - mov #30, r0 - shll8 r0 - mov.l @r0+, r0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl8.cgs b/sim/testsuite/sim/sh64/compact/movl8.cgs deleted file mode 100644 index a6cd932..0000000 --- a/sim/testsuite/sim/sh64/compact/movl8.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for mov.l @(r0, $rm), $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #0, r0 - mov #30, r1 - shll8 r1 - # Store something there first. - mov #170, r3 - mov.l r3, @(r0, r1) -check: - # Load it back. - mov.l @(r0, r1), r2 - cmp/eq r2, r3 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movl9.cgs b/sim/testsuite/sim/sh64/compact/movl9.cgs deleted file mode 100644 index 4fa07b0..0000000 --- a/sim/testsuite/sim/sh64/compact/movl9.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for mov.l @($imm8x4, gbr), r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r1 - shll8 r1 - ldc r1, gbr - # Store something there first. - mov #170, r0 - mov r0, r7 - mov.l r0, @(12, gbr) -check: - # Load it back. - mov.l @(12, gbr), r0 - cmp/eq r0, r7 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movt.cgs b/sim/testsuite/sim/sh64/compact/movt.cgs deleted file mode 100644 index 4553981..0000000 --- a/sim/testsuite/sim/sh64/compact/movt.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for movt $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global movt -init: - sett - movt r1 - assert r1, #1 -clear: - clrt - movt r1 - assert r1, #0 -set: - sett - movt r1 - assert r1, #1 - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw1.cgs b/sim/testsuite/sim/sh64/compact/movw1.cgs deleted file mode 100644 index 5d55a58..0000000 --- a/sim/testsuite/sim/sh64/compact/movw1.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for mov.w $rm, @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r1 - shll8 r1 -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - mov.w r2, @r1 -check: - # Read it back. - mov.w @r1, r3 - shll16 r2 - shll16 r3 - cmp/eq r2, r3 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movw10.cgs b/sim/testsuite/sim/sh64/compact/movw10.cgs deleted file mode 100644 index 5bab911..0000000 --- a/sim/testsuite/sim/sh64/compact/movw10.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for mov.w @($imm8x2, pc), $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - - # Store to memory. - mov #16, r1 - shll8 r1 - add #32, r1 - mov.w r2, @r1 - -check: - # Read it back. - mov.w @(18, pc), r0 - shll16 r0 - shll16 r2 - cmp/eq r0, r2 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movw11.cgs b/sim/testsuite/sim/sh64/compact/movw11.cgs deleted file mode 100644 index df739fa..0000000 --- a/sim/testsuite/sim/sh64/compact/movw11.cgs +++ /dev/null @@ -1,35 +0,0 @@ -# sh testcase for mov.w @($imm4x2, $rm), r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r1 - shll8 r1 - - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - - # Preserve r0. - mov r0, r3 - - # Store something first. - mov.w r0, @(12, r1) - -check: - # Read it back. - mov.w @(12, r1), r0 - shll16 r0 - shll16 r3 - cmp/eq r0, r3 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw2.cgs b/sim/testsuite/sim/sh64/compact/movw2.cgs deleted file mode 100644 index 27c29dc..0000000 --- a/sim/testsuite/sim/sh64/compact/movw2.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for mov.w $rm, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r1 - shll8 r1 - # Preserve. - mov r1, r7 -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 -store: - mov.w r2, @-r1 -check: - # Read it back. - mov.w @r1, r3 - shll16 r2 - shll16 r3 - cmp/eq r2, r3 - bf wrong -dec: - add #2, r1 - cmp/eq r7, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movw3.cgs b/sim/testsuite/sim/sh64/compact/movw3.cgs deleted file mode 100644 index d7b39c8..0000000 --- a/sim/testsuite/sim/sh64/compact/movw3.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for mov.w $rm, @(r0, $rn) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #0, r0 - mov #30, r1 - shll8 r1 -init: - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - mov.w r2, @(r0, r1) -check: - # Read it back. - mov.w @(r0, r1), r3 - shll16 r2 - shll16 r3 - cmp/eq r2, r3 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw4.cgs b/sim/testsuite/sim/sh64/compact/movw4.cgs deleted file mode 100644 index 4853b50..0000000 --- a/sim/testsuite/sim/sh64/compact/movw4.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for mov.w r0, @($imm8x2, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r0 - shll8 r0 - ldc r0, gbr - -init: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - # Preserve r0. - mov r0, r7 - mov.w r0, @(12, gbr) -check: - mov.w @(12, gbr), r0 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw5.cgs b/sim/testsuite/sim/sh64/compact/movw5.cgs deleted file mode 100644 index 9b4f84f..0000000 --- a/sim/testsuite/sim/sh64/compact/movw5.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for mov.w r0, @($imm4x2, $rn) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r1 - shll8 r1 - -init: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - # Preserve. - mov r0, r7 -move: - mov.w r0, @(12, r1) -check: - mov.w @(12, r1), r0 - shll16 r0 - shll16 r7 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw6.cgs b/sim/testsuite/sim/sh64/compact/movw6.cgs deleted file mode 100644 index 758497c..0000000 --- a/sim/testsuite/sim/sh64/compact/movw6.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for mov.w @$rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - mov #30, r0 - shll8 r0 - - # Store something first. - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - mov.w r2, @r0 - -check: - # Read it back. - mov.w @r0, r1 - cmp/eq r1, r2 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw7.cgs b/sim/testsuite/sim/sh64/compact/movw7.cgs deleted file mode 100644 index 45f5c09..0000000 --- a/sim/testsuite/sim/sh64/compact/movw7.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for mov.w @${rm}+, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r0 - shll8 r0 - # Preserve address. - mov r0, r7 - - # Store something first. - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - mov.w r2, @r0 -check: - # Read it back. - mov.w @r0+, r3 - cmp/eq r2, r3 - bf wrong - -inc: - # Ensure address is post-incremented. - add #2, r7 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/movw8.cgs b/sim/testsuite/sim/sh64/compact/movw8.cgs deleted file mode 100644 index 0a7ce3f..0000000 --- a/sim/testsuite/sim/sh64/compact/movw8.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for mov.w @(r0, $rm), $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r0 - shll8 r0 - mov #10, r1 - - # Store something first. - # Build up a distinctive bit pattern. - mov #1, r2 - shll8 r2 - add #12, r2 - - mov.w r2, @(r0, r1) -check: - # Read it back. - mov.w @(r0, r1), r3 - shll16 r2 - shll16 r3 - cmp/eq r2, r3 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/movw9.cgs b/sim/testsuite/sim/sh64/compact/movw9.cgs deleted file mode 100644 index 1872f06..0000000 --- a/sim/testsuite/sim/sh64/compact/movw9.cgs +++ /dev/null @@ -1,33 +0,0 @@ -# sh testcase for mov.w @($imm8x2, gbr), r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - mov #30, r0 - shll8 r0 - ldc r0, gbr - - # Store something first. - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - # Preserve r0. - mov r0, r7 - mov.w r0, @(12, gbr) - -check: - # Load it back. - mov.w @(12, gbr), r0 - shll16 r0 - shll16 r7 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/mull.cgs b/sim/testsuite/sim/sh64/compact/mull.cgs deleted file mode 100644 index 921141a..0000000 --- a/sim/testsuite/sim/sh64/compact/mull.cgs +++ /dev/null @@ -1,64 +0,0 @@ -# sh testcase for mul.l $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global mull -mull: - mov #3, r0 - mov #5, r1 - mul.l r0, r1 - - # Check the result. - sts macl, r3 - mov #15, r4 - cmp/eq r3, r4 - bf wrong - -lxs: - # Large * small. - mov #255, r0 - mov #0, r1 - mul.l r0, r1 - - # Check the result. - sts macl, r3 - mov #0, r4 - cmp/eq r3, r4 - bf wrong - -sxl: - # Small * large. - mov #0, r0 - mov #255, r1 - mul.l r0, r1 - - # Check the result. - sts macl, r3 - mov #0, r4 - cmp/eq r3, r4 - bf wrong - -lxl: - # Large * large. - mov #1, r0 - neg r0, r0 - mov #2, r1 - mul.l r0, r1 - - # Check the result. - sts macl, r3 - mov #2, r4 - neg r4, r4 - cmp/eq r3, r4 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/mulsw.cgs b/sim/testsuite/sim/sh64/compact/mulsw.cgs deleted file mode 100644 index 05c8a3d..0000000 --- a/sim/testsuite/sim/sh64/compact/mulsw.cgs +++ /dev/null @@ -1,91 +0,0 @@ -# sh testcase for muls.w $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - sts mach, r7 - - .global mulsw -zero: - mov #0, r0 - mov #1, r1 - muls.w r0, r1 - - # Check the result. - sts macl, r3 - mov #0, r4 - cmp/eq r3, r4 - bf wrong - -sxs: - # Small * small. - mov #1, r0 - mov #2, r1 - muls.w r0, r1 - - # Check the result. - sts macl, r3 - mov #2, r4 - cmp/eq r3, r4 - bf wrong - -sxl: - # Small * large. - mov #1, r0 - mov #255, r1 - shll8 r1 - muls.w r0, r1 - - # Check the result. - sts macl, r3 - mov #0, r4 - not r4, r4 - shll8 r4 - cmp/eq r3, r4 - bf wrong - -lxs: - # Large * small. - mov #255, r0 - shll8 r0 - mov #1, r1 - muls.w r0, r1 - - # Check the result. - sts macl, r3 - mov #0, r4 - not r4, r4 - shll8 r4 - cmp/eq r3, r4 - bf wrong - -lxl: - # Large * large. - mov #255, r0 - shll8 r0 - mov #255, r1 - shll8 r1 - muls.w r0, r1 - - # Check the result. - sts macl, r3 - mov #1, r4 - shll16 r4 - cmp/eq r3, r4 - bf wrong - -invariant: - # Ensure MACH is invariant. - sts mach, r8 - cmp/eq r7, r8 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/muluw.cgs b/sim/testsuite/sim/sh64/compact/muluw.cgs deleted file mode 100644 index fa0a334..0000000 --- a/sim/testsuite/sim/sh64/compact/muluw.cgs +++ /dev/null @@ -1,96 +0,0 @@ -# sh testcase for mulu.w $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - sts mach, r7 - - .global mulsw -zero: - mov #0, r0 - mov #1, r1 - mulu.w r0, r1 - - # Check the result. - sts macl, r1 - mov #0, r0 - cmp/eq r0, r1 - bf wrong - -sxs: - # Small * small. - mov #1, r0 - mov #2, r1 - mulu.w r0, r1 - - # Check the result. - sts macl, r1 - mov #2, r0 - cmp/eq r0, r1 - bf wrong - -sxl: - # Small * large. - mov #1, r1 - mov #0, r0 - or #255, r0 - shll8 r0 - mulu.w r1, r0 - - # Check the result. - sts macl, r1 - mov #0, r0 - or #255, r0 - shll8 r0 - cmp/eq r0, r1 - bf wrong - -lxs: - # Large * small. - mov #0, r0 - or #255, r0 - shll8 r0 - mov #1, r1 - mulu.w r0, r1 - - # Check the result. - sts macl, r1 - mov #0, r0 - or #255, r0 - shll8 r0 - cmp/eq r0, r1 - bf wrong - -lxl: - # Large * large. - mov #0, r0 - or #255, r0 - shll8 r0 - mov r0, r1 - mulu.w r0, r1 - - # Check the result. - sts macl, r1 - mov #0, r0 - or #254, r0 - shll8 r0 - or #1, r0 - shll16 r0 - cmp/eq r0, r1 - bf wrong - -invariant: - # Ensure MACH is invariant. - sts mach, r8 - cmp/eq r7, r8 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/neg.cgs b/sim/testsuite/sim/sh64/compact/neg.cgs deleted file mode 100644 index b6f98d7..0000000 --- a/sim/testsuite/sim/sh64/compact/neg.cgs +++ /dev/null @@ -1,55 +0,0 @@ -# sh testcase for neg $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - .macro signbit sign - shlr16 r1 - shlr8 r1 - shlr r1 - shlr r1 - shlr r1 - shlr r1 - shlr r1 - shlr r1 - shlr r1 - assert r1, \sign - .endm - start - - .global neg -neg: - mov #0, r0 - neg r0, r1 - signbit #0 - - mov #42, r0 - neg r0, r1 - signbit #1 - - mov #0, r0 - or #25, r0 - neg r0, r1 - signbit #1 - - # neg(0) is 0. - mov #0, r0 - neg r0, r1 - signbit #0 - - # neg(neg(x)) = x. - mov #42, r0 - neg r0, r1 - signbit #1 - mov #42, r0 - neg r0, r2 - neg r2, r1 - signbit #0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/negc.cgs b/sim/testsuite/sim/sh64/compact/negc.cgs deleted file mode 100644 index 1f5547d..0000000 --- a/sim/testsuite/sim/sh64/compact/negc.cgs +++ /dev/null @@ -1,66 +0,0 @@ -# sh testcase for negc $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - .macro signbit sign - mov r1, r2 - shlr16 r2 - shlr8 r2 - shlr r2 - shlr r2 - shlr r2 - shlr r2 - shlr r2 - shlr r2 - shlr r2 - assert r2, \sign - .endm - start - - .global negc -negc: - clrt - mov #1, r0 - negc r0, r1 - signbit #1 - -negc2: - sett - mov #1, r0 - negc r0, r1 - signbit #1 - -negc3: - clrt - mov #0, r0 - negc r0, r1 - signbit #0 - -negc4: - sett - mov #0, r0 - negc r0, r1 - signbit #1 - -negc5: - clrt - mov #0, r0 - or #255, r0 - negc r0, r1 - signbit #1 - -negc6: - sett - mov #0, r0 - or #255, r0 - negc r0, r1 - signbit #1 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/nop.cgs b/sim/testsuite/sim/sh64/compact/nop.cgs deleted file mode 100644 index 8ce910c..0000000 --- a/sim/testsuite/sim/sh64/compact/nop.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for nop -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global nop -nop: - nop - pass diff --git a/sim/testsuite/sim/sh64/compact/not.cgs b/sim/testsuite/sim/sh64/compact/not.cgs deleted file mode 100644 index 380808d..0000000 --- a/sim/testsuite/sim/sh64/compact/not.cgs +++ /dev/null @@ -1,47 +0,0 @@ -# sh testcase for not $rm64, $rn64 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global not -not: - mov #0, r0 - or #192, r0 - not r0, r1 - - mov #0, r0 - or #255, r0 - shll8 r0 - or #255, r0 - shll8 r0 - or #255, r0 - shll8 r0 - or #63, r0 - - cmp/eq r0, r1 - bf wrong - -ones: - mov #0, r1 - not r1, r2 - - mov #0, r0 - or #255, r0 - shll8 r0 - or #255, r0 - shll8 r0 - or #255, r0 - shll8 r0 - or #255, r0 - cmp/eq r0, r2 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/ocbi.cgs b/sim/testsuite/sim/sh64/compact/ocbi.cgs deleted file mode 100644 index 12fb2a1..0000000 --- a/sim/testsuite/sim/sh64/compact/ocbi.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for ocbi @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - .global ocbi -ocbi: - ocbi @r0 - ocbi @r1 - ocbi @r15 - pass diff --git a/sim/testsuite/sim/sh64/compact/ocbp.cgs b/sim/testsuite/sim/sh64/compact/ocbp.cgs deleted file mode 100644 index 153aff2..0000000 --- a/sim/testsuite/sim/sh64/compact/ocbp.cgs +++ /dev/null @@ -1,15 +0,0 @@ -# sh testcase for ocbp @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ocbp -ocbp: - ocbp @r0 - ocbp @r1 - ocbp @r15 - pass diff --git a/sim/testsuite/sim/sh64/compact/ocbwb.cgs b/sim/testsuite/sim/sh64/compact/ocbwb.cgs deleted file mode 100644 index 6b0a741..0000000 --- a/sim/testsuite/sim/sh64/compact/ocbwb.cgs +++ /dev/null @@ -1,15 +0,0 @@ -# sh testcase for ocbwb @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ocbwb -ocbwb: - ocbwb @r0 - ocbwb @r1 - ocbwb @r15 - pass diff --git a/sim/testsuite/sim/sh64/compact/or.cgs b/sim/testsuite/sim/sh64/compact/or.cgs deleted file mode 100644 index a02eee3..0000000 --- a/sim/testsuite/sim/sh64/compact/or.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for or $rm64, $rn64 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global or -or: - mov #1, r0 - rotr r0 - mov #1, r1 - or r0, r1 - - mov #1, r7 - rotr r7 - add #1, r7 - cmp/eq r7, r1 - bf wrong - - .global or2 -or2: - mov #85, r0 - shll16 r0 - shll8 r0 - mov #85, r1 - shll8 r1 - or r0, r1 - - mov #85, r7 - shll16 r7 - add #85 ,r7 - shll8 r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/orb.cgs b/sim/testsuite/sim/sh64/compact/orb.cgs deleted file mode 100644 index 7e962f6..0000000 --- a/sim/testsuite/sim/sh64/compact/orb.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for or.b #$imm8, @(r0, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global orb -init: - # Init GBR and R0. - mov #30, r0 - ldc r0, gbr - mov #40, r0 - -orb: - or.b #0, @(r0, gbr) - or.b #170, @(r0, gbr) - or.b #0, @(r0, gbr) - or.b #255, @(r0, gbr) - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/ori.cgs b/sim/testsuite/sim/sh64/compact/ori.cgs deleted file mode 100644 index 63a5fb5..0000000 --- a/sim/testsuite/sim/sh64/compact/ori.cgs +++ /dev/null @@ -1,40 +0,0 @@ -# sh testcase for or #$imm8, r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global ori -ori: - mov #1, r0 - rotr r0 - or #1, r0 - - mov #1, r7 - rotr r7 - add #1, r7 - cmp/eq r0, r7 - bf wrong - - .global ori2 -ori2: - mov #85, r0 - shll16 r0 - shll8 r0 - or #85, r0 - - mov #85, r7 - shll16 r7 - shll8 r7 - add #85, r7 - cmp/eq r0, r7 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/pref.cgs b/sim/testsuite/sim/sh64/compact/pref.cgs deleted file mode 100644 index 065e093..0000000 --- a/sim/testsuite/sim/sh64/compact/pref.cgs +++ /dev/null @@ -1,15 +0,0 @@ -# sh testcase for pref @$rn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global pref -pref: - pref @r0 - pref @r1 - pref @r15 - pass diff --git a/sim/testsuite/sim/sh64/compact/rotcl.cgs b/sim/testsuite/sim/sh64/compact/rotcl.cgs deleted file mode 100644 index 5e1a3b9..0000000 --- a/sim/testsuite/sim/sh64/compact/rotcl.cgs +++ /dev/null @@ -1,121 +0,0 @@ -# sh testcase for rotcl $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global rotcl - -rotcl: - clrt - mov #1, r1 - rotcl r1 - assert r1, #2 - clrt - rotcl r1 - assert r1, #4 - clrt - rotcl r1 - assert r1, #8 - clrt - rotcl r1 - assert r1, #16 - clrt - rotcl r1 - assert r1, #32 - clrt - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - bf wrong - rotcl r1 - assert r1, #1 - - bra trotcl - nop - -wrong: - fail - -trotcl: - sett - mov #1, r1 - rotcl r1 - assert r1, #3 - clrt - rotcl r1 - assert r1, #6 - clrt - rotcl r1 - assert r1, #12 - clrt - rotcl r1 - assert r1, #24 - clrt - rotcl r1 - assert r1, #48 - clrt - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - rotcl r1 - bf wrong2 - assert r1, #1 - rotcl r1 - rotcl r1 - -okay: - pass -wrong2: - fail diff --git a/sim/testsuite/sim/sh64/compact/rotcr.cgs b/sim/testsuite/sim/sh64/compact/rotcr.cgs deleted file mode 100644 index b53300e..0000000 --- a/sim/testsuite/sim/sh64/compact/rotcr.cgs +++ /dev/null @@ -1,103 +0,0 @@ -# sh testcase for rotcr $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global rotcr -rotcr: - clrt - mov #1, r1 - rotcr r1 - bf wrong - assert r1, #0 - sett - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - assert r1, #1 - rotcr r1 - bf wrong - -trotcr: - sett - mov #1, r1 - rotcr r1 - bf wrong - sett - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - rotcr r1 - bf wrong - assert r1, #1 - rotcr r1 - bf wrong - rotcr r1 - -okay: - pass -wrong: - fail - - diff --git a/sim/testsuite/sim/sh64/compact/rotl.cgs b/sim/testsuite/sim/sh64/compact/rotl.cgs deleted file mode 100644 index e292de7..0000000 --- a/sim/testsuite/sim/sh64/compact/rotl.cgs +++ /dev/null @@ -1,62 +0,0 @@ -# sh testcase for rotl $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global rotl -rotl: - mov #1, r1 - rotl r1 - assert r1, #2 - rotl r1 - assert r1, #4 - rotl r1 - assert r1, #8 - rotl r1 - assert r1, #16 - rotl r1 - assert r1, #32 - rotl r1 - assert r1, #64 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - rotl r1 - bf wrong - assert r1, #1 - rotl r1 - rotl r1 - rotl r1 - assert r1, #8 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/rotr.cgs b/sim/testsuite/sim/sh64/compact/rotr.cgs deleted file mode 100644 index 7f80f99..0000000 --- a/sim/testsuite/sim/sh64/compact/rotr.cgs +++ /dev/null @@ -1,55 +0,0 @@ -# sh testcase for rotr $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global rotr -rotr: - mov #1, r1 - rotr r1 - bf wrong - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - rotr r1 - assert r1, #1 - rotr r1 - rotr r1 - rotr r1 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/rts.cgs b/sim/testsuite/sim/sh64/compact/rts.cgs deleted file mode 100644 index eeb8dce..0000000 --- a/sim/testsuite/sim/sh64/compact/rts.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for rts -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global rts -rts: - bsr subroutine -slot: - nop -return: - pass - fail - -subroutine: - rts -rts_slot: - nop -bad: - fail diff --git a/sim/testsuite/sim/sh64/compact/sets.cgs b/sim/testsuite/sim/sh64/compact/sets.cgs deleted file mode 100644 index f031701..0000000 --- a/sim/testsuite/sim/sh64/compact/sets.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for sets -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sets -sets: - sets - pass diff --git a/sim/testsuite/sim/sh64/compact/sett.cgs b/sim/testsuite/sim/sh64/compact/sett.cgs deleted file mode 100644 index 9ae8af5..0000000 --- a/sim/testsuite/sim/sh64/compact/sett.cgs +++ /dev/null @@ -1,16 +0,0 @@ -# sh testcase for sett -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sett -sett: - sett - bf wrong - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shad.cgs b/sim/testsuite/sim/sh64/compact/shad.cgs deleted file mode 100644 index 340743d..0000000 --- a/sim/testsuite/sim/sh64/compact/shad.cgs +++ /dev/null @@ -1,58 +0,0 @@ -# sh testcase for shad $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global null -null: - mov #1, r0 - mov #0, r1 - shad r1, r0 - # no shift is performed. - assert r0, #1 - - .global gt0 -gt0: - mov #4, r0 - mov #3, r1 - shad r1, r0 - # shift left 3 bits. - assert r0, #32 - - .global lt0 -lt0: - mov #32, r0 - mov #3, r1 - neg r1, r1 - shad r1, r0 - # shift right 3 bits. - assert r0, #4 - - .global fillpos -fillpos: - mov #1, r0 - mov #1, r1 - rotr r1 - shad r1, r0 - # check result. - assert r0, #0 - - .global fillneg -fillneg: - mov #1, r0 - neg r0, r0 - mov #1, r1 - rotr r1 - shad r1, r0 - # check result. - not r0, r0 - assert r0, #0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shal.cgs b/sim/testsuite/sim/sh64/compact/shal.cgs deleted file mode 100644 index dfea947..0000000 --- a/sim/testsuite/sim/sh64/compact/shal.cgs +++ /dev/null @@ -1,57 +0,0 @@ -# sh testcase for shal $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shal -shal: - mov #1, r1 - shal r1 - assert r1, #2 - shal r1 - assert r1, #4 - shal r1 - assert r1, #8 - shal r1 - assert r1, #16 - shal r1 - assert r1, #32 - shal r1 - assert r1, #64 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - shal r1 - assert r1, #0 - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/shar.cgs b/sim/testsuite/sim/sh64/compact/shar.cgs deleted file mode 100644 index e3e92fc..0000000 --- a/sim/testsuite/sim/sh64/compact/shar.cgs +++ /dev/null @@ -1,40 +0,0 @@ -# sh testcase for shar $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shar -shar: - mov #0, r0 - or #192, r0 - shar r0 - bt wrong - shar r0 - bt wrong - shar r0 - bt wrong - shar r0 - bt wrong - shar r0 - bt wrong - shar r0 - bt wrong - shar r0 - bf wrong - shar r0 - bf wrong - shar r0 - bt wrong - shar r0 - bt wrong - assert r0, #0 - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/shld.cgs b/sim/testsuite/sim/sh64/compact/shld.cgs deleted file mode 100644 index 32e4100..0000000 --- a/sim/testsuite/sim/sh64/compact/shld.cgs +++ /dev/null @@ -1,48 +0,0 @@ -# sh testcase for shld $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global null -null: - mov #1, r0 - mov #0, r1 - shld r1, r0 - # no shift is performed. - assert r0, #1 - - .global gt0 -gt0: - mov #4, r0 - mov #3, r1 - shld r1, r0 - # shift left 3 bits. - assert r0, #32 - - .global lt0 -lt0: - mov #32, r0 - mov #3, r1 - neg r1, r1 - shld r1, r0 - # shift right 3 bits. - assert r0, #4 - - .global fill -fill: - mov #1, r0 - rotr r0 - mov #1, r1 - rotr r1 - shld r1, r0 - assert r0, #0 - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/shll.cgs b/sim/testsuite/sim/sh64/compact/shll.cgs deleted file mode 100644 index 882f2c2..0000000 --- a/sim/testsuite/sim/sh64/compact/shll.cgs +++ /dev/null @@ -1,57 +0,0 @@ -# sh testcase for shll $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shll -shll: - mov #1, r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - shll r1 - assert r1, #0 -another: - mov #1, r1 - shll r1 - shll r1 - shll r1 - assert r1, #8 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shll16.cgs b/sim/testsuite/sim/sh64/compact/shll16.cgs deleted file mode 100644 index 0637c3d..0000000 --- a/sim/testsuite/sim/sh64/compact/shll16.cgs +++ /dev/null @@ -1,44 +0,0 @@ -# sh testcase for shll16 $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shll16 -shll16: - mov #108, r1 - shll16 r1 - shll16 r1 - assert r1, #0 - -another: - mov #1, r1 - shll16 r1 - mov #1, r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shll2.cgs b/sim/testsuite/sim/sh64/compact/shll2.cgs deleted file mode 100644 index 6e28c66..0000000 --- a/sim/testsuite/sim/sh64/compact/shll2.cgs +++ /dev/null @@ -1,40 +0,0 @@ -# sh testcase for shll2 $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shll2 -shll2: - mov #1, r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - shll2 r1 - assert r1, #0 - -another: - mov #1, r1 - shll2 r1 - assert r1, #4 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shll8.cgs b/sim/testsuite/sim/sh64/compact/shll8.cgs deleted file mode 100644 index fe455ec..0000000 --- a/sim/testsuite/sim/sh64/compact/shll8.cgs +++ /dev/null @@ -1,38 +0,0 @@ -# sh testcase for shll8 $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shll8 -shll8: - mov #1, r1 - shll8 r1 - shll8 r1 - shll8 r1 - shll8 r1 - assert r1, #0 - -another: - mov #1, r1 - shll8 r1 - mov #1, r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - shll r7 - cmp/eq r1, r7 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shlr.cgs b/sim/testsuite/sim/sh64/compact/shlr.cgs deleted file mode 100644 index 9d86461..0000000 --- a/sim/testsuite/sim/sh64/compact/shlr.cgs +++ /dev/null @@ -1,33 +0,0 @@ -# sh testcase for shlr $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shlr -shlr: - mov #0, r0 - or #192, r0 - shlr r0 - shlr r0 - shlr r0 - shlr r0 - shlr r0 - shlr r0 - # Make sure a bit is shifted into T. - shlr r0 - bf wrong - # Ditto. - shlr r0 - bf wrong - shlr r0 - assert r0, #0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/shlr16.cgs b/sim/testsuite/sim/sh64/compact/shlr16.cgs deleted file mode 100644 index 7bfc627..0000000 --- a/sim/testsuite/sim/sh64/compact/shlr16.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for shlr16 $rn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shrl16 -shrl16: - shlr16 r0 - - pass diff --git a/sim/testsuite/sim/sh64/compact/shlr2.cgs b/sim/testsuite/sim/sh64/compact/shlr2.cgs deleted file mode 100644 index 6f08597..0000000 --- a/sim/testsuite/sim/sh64/compact/shlr2.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for shlr2 $rn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shrl2 -shrl2: - shlr2 r0 - - pass diff --git a/sim/testsuite/sim/sh64/compact/shlr8.cgs b/sim/testsuite/sim/sh64/compact/shlr8.cgs deleted file mode 100644 index 82040b5..0000000 --- a/sim/testsuite/sim/sh64/compact/shlr8.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for shlr8 $rn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global shrl8 -shrl8: - shlr8 r0 - - pass diff --git a/sim/testsuite/sim/sh64/compact/stc-gbr.cgs b/sim/testsuite/sim/sh64/compact/stc-gbr.cgs deleted file mode 100644 index 1b84008..0000000 --- a/sim/testsuite/sim/sh64/compact/stc-gbr.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for stc gbr, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stc_gbr -stc_gbr: - stc gbr, r1 - mov #42, r1 - ldc r1, gbr - stc gbr, r2 - cmp/eq r1, r2 - bf wrong -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/stcl-gbr.cgs b/sim/testsuite/sim/sh64/compact/stcl-gbr.cgs deleted file mode 100644 index 3e74cc5..0000000 --- a/sim/testsuite/sim/sh64/compact/stcl-gbr.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for stc.l gbr, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stcl_gbr -stcl_gbr: - mov #42, r0 - ldc r0, gbr - mov #40, r0 - shll8 r0 - # save address - mov r0, r1 - stc.l gbr, @-r0 - - add #4, r0 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/sts-fpscr.cgs b/sim/testsuite/sim/sh64/compact/sts-fpscr.cgs deleted file mode 100644 index 42724b4..0000000 --- a/sim/testsuite/sim/sh64/compact/sts-fpscr.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for sts fpscr, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sts_fpscr -sts_fpscr: - sts fpscr, r0 - mov #42, r0 - lds r0, fpscr - sts fpscr, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/sts-fpul.cgs b/sim/testsuite/sim/sh64/compact/sts-fpul.cgs deleted file mode 100644 index ddbdaf1..0000000 --- a/sim/testsuite/sim/sh64/compact/sts-fpul.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for sts fpul, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sts_fpul -sts_fpul: - # This is properly exercised by the lds-fpul test case. - sts fpul, r1 - pass diff --git a/sim/testsuite/sim/sh64/compact/sts-mach.cgs b/sim/testsuite/sim/sh64/compact/sts-mach.cgs deleted file mode 100644 index 4d34bc1..0000000 --- a/sim/testsuite/sim/sh64/compact/sts-mach.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for sts mach, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sts_mach -sts_mach: - mov #42, r0 - lds r0, mach - sts mach, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/sts-macl.cgs b/sim/testsuite/sim/sh64/compact/sts-macl.cgs deleted file mode 100644 index b805f79..0000000 --- a/sim/testsuite/sim/sh64/compact/sts-macl.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for sts macl, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sts_macl -sts_macl: - mov #42, r0 - lds r0, macl - sts macl, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/sts-pr.cgs b/sim/testsuite/sim/sh64/compact/sts-pr.cgs deleted file mode 100644 index 3e4f6ee..0000000 --- a/sim/testsuite/sim/sh64/compact/sts-pr.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for sts pr, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sts_pr -sts_pr: - mov #42, r0 - lds r0, pr - sts pr, r1 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/stsl-fpscr.cgs b/sim/testsuite/sim/sh64/compact/stsl-fpscr.cgs deleted file mode 100644 index 032870d..0000000 --- a/sim/testsuite/sim/sh64/compact/stsl-fpscr.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for sts.l fpscr, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stsl_fpscr -stsl_fpscr: - mov #40, r0 - shll8 r0 - # Preserve r0. - mov r0, r7 - sts.l fpscr, @-r0 - -check: - # Ensure r0 is decremented. - add #4, r0 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/stsl-fpul.cgs b/sim/testsuite/sim/sh64/compact/stsl-fpul.cgs deleted file mode 100644 index 89bd9e7..0000000 --- a/sim/testsuite/sim/sh64/compact/stsl-fpul.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for sts.l fpul, @-$rn -*- Asm -*_ -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stsl_fpul -stsl_fpul: - mov #40, r0 - shll8 r0 - # Preserve r0. - mov r0, r7 - sts.l fpul, @-r0 - -dec: - # Check for proper pre-decrementing. - add #4, r0 - cmp/eq r0, r7 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/stsl-mach.cgs b/sim/testsuite/sim/sh64/compact/stsl-mach.cgs deleted file mode 100644 index e15bdde..0000000 --- a/sim/testsuite/sim/sh64/compact/stsl-mach.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for sts.l mach, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stsl_mach -stsl_mach: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - shll8 r0 - add #85, r0 - shll8 r0 - add #170, r0 - - lds r0, mach - mov #40, r2 - shll8 r2 - # Preserve r2. - mov r2, r7 - sts.l mach, @-r2 - - # check results. - mov.l @r2, r3 - cmp/eq r0, r3 - bf wrong - - # Ensure decrement occurred. - add #4, r2 - cmp/eq r2, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/stsl-macl.cgs b/sim/testsuite/sim/sh64/compact/stsl-macl.cgs deleted file mode 100644 index 854ef34..0000000 --- a/sim/testsuite/sim/sh64/compact/stsl-macl.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for sts.l macl, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stsl_macl -stsl_macl: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - shll8 r0 - add #85, r0 - shll8 r0 - add #170, r0 - - lds r0, macl - mov #40, r2 - shll8 r2 - # Preserve r2. - mov r2, r7 - sts.l macl, @-r2 - - # check results. - mov.l @r2, r3 - cmp/eq r0, r3 - bf wrong - - # Ensure decrement occurred. - add #4, r2 - cmp/eq r2, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/stsl-pr.cgs b/sim/testsuite/sim/sh64/compact/stsl-pr.cgs deleted file mode 100644 index b519c9b..0000000 --- a/sim/testsuite/sim/sh64/compact/stsl-pr.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for sts.l pr, @-$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global stsl_pr -stsl_pr: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - shll8 r0 - add #85, r0 - shll8 r0 - add #170, r0 - - lds r0, pr - mov #40, r2 - shll8 r2 - # Preserve r2. - mov r2, r7 - sts.l pr, @-r2 - - # check results. - mov.l @r2, r3 - cmp/eq r0, r3 - bf wrong - - # Ensure decrement occurred. - add #4, r2 - cmp/eq r2, r7 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/sub.cgs b/sim/testsuite/sim/sh64/compact/sub.cgs deleted file mode 100644 index 3ba29f8..0000000 --- a/sim/testsuite/sim/sh64/compact/sub.cgs +++ /dev/null @@ -1,68 +0,0 @@ -# sh testcase for sub $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global sub1 -sub1: - # 0 - x. - mov #0, r0 - mov #3, r1 - sub r1, r0 - - mov #2, r7 - not r7, r7 - cmp/eq r7, r0 - bf wrong - - .global sub2 -sub2: - # x - 0. - mov #0, r0 - mov #3, r1 - sub r0, r1 - assert r1, #3 - - .global sub3 -sub3: - # x - y. - mov #4, r0 - mov #3, r1 - sub r0, r1 - - mov #0, r7 - not r7, r7 - cmp/eq r7, r1 - bf wrong - - .global sub4 -sub4: - # y - x. - mov #4, r0 - mov #3, r1 - sub r1, r0 - assert r0, #1 - - .global sub5 -sub5: - # y - y == 0 (where y are in two distinct registers). - mov #4, r0 - mov #4, r1 - sub r1, r0 - assert r0, #0 - - .global sub6 -sub6: - # y - y = 0 (where y is the same register). - mov #4, r1 - sub r1, r1 - assert r1, #0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/subc.cgs b/sim/testsuite/sim/sh64/compact/subc.cgs deleted file mode 100644 index cda1e84..0000000 --- a/sim/testsuite/sim/sh64/compact/subc.cgs +++ /dev/null @@ -1,109 +0,0 @@ -# sh testcase for subc $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -zero: - mov #0, r0 - mov #0, r1 - clrt - subc r0, r1 - assert r1, #0 - -zerot: - mov #0, r0 - mov #0, r1 - sett - subc r0, r1 - # Invert all 1's to all 0's for ease of comparison. - not r1, r1 - assert r1, #0 - -null: - mov #0, r0 - mov #10, r1 - clrt - subc r0, r1 - assert r1, #10 - -nullt: - mov #0, r0 - mov #10, r1 - sett - subc r0, r1 - assert r1, #9 - -subc: - mov #10, r0 - mov #0, r1 - clrt - subc r0, r1 - # Again, invert .. - not r1, r1 - assert r1, #9 - -subct: - mov #10, r0 - mov #0, r1 - sett - subc r0, r1 - # Again, invert .. - not r1, r1 - assert r1, #10 - -subc2: - mov #10, r0 - mov #20, r1 - clrt - subc r0, r1 - assert r1, #10 - -subc2t: - mov #20, r0 - mov #10, r1 - sett - subc r0, r1 - # Again, invert .. - not r1, r1 - assert r1, #10 - -subc3: - mov #5, r0 - mov #5, r1 - clrt - subc r0, r1 - assert r1, #0 - -subc3t: - mov #5, r0 - mov #5, r1 - sett - subc r0, r1 - # Again, invert .. - not r1, r1 - assert r1, #0 - -large: - mov #2, r0 - mov #10, r1 - clrt - subc r1, r0 - # Again, invert .. - not r0, r0 - assert r0, #7 - -larget: - mov #2, r0 - mov #10, r1 - sett - subc r0, r1 - assert r1, #7 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/subv.cgs b/sim/testsuite/sim/sh64/compact/subv.cgs deleted file mode 100644 index ceb8c64..0000000 --- a/sim/testsuite/sim/sh64/compact/subv.cgs +++ /dev/null @@ -1,55 +0,0 @@ -# sh testcase for subv $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start -zero: - mov #0, r0 - mov #0, r1 - subv r0, r1 - bt wrong - assert r1, #0 - -one: - mov #10, r0 - mov #0, r1 - subv r0, r1 - bt wrong - not r1, r1 - assert r1, #9 - -large: - # Produce MAXINT in R0. - mov #0, r0 - not r0, r0 - shlr r0 - - # Put -3 into R1. - mov #3, r1 - neg r1, r1 - - # Subtract them and underflow. - subv r0, r1 - bf wrong - -another: - # Produce MAXINT in R0. - mov #0, r0 - not r0, r0 - shlr r0 - - # Put -3 into R1. - mov #3, r1 - neg r1, r1 - - # Subtract them and overflow. - subv r1, r0 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/swapb.cgs b/sim/testsuite/sim/sh64/compact/swapb.cgs deleted file mode 100644 index 22f6f16..0000000 --- a/sim/testsuite/sim/sh64/compact/swapb.cgs +++ /dev/null @@ -1,44 +0,0 @@ -# sh testcase for swap.b $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -init: - # Build up a distinctive bit pattern. - mov #1, r0 - shll8 r0 - add #12, r0 - shll8 r0 - add #85, r0 - shll8 r0 - add #70, r0 - -test: - # Swap the lower two bytes into a different register. - swap.b r0, r1 - mov #1, r7 - shll8 r7 - add #12, r7 - shll8 r7 - add #70, r7 - shll8 r7 - add #85, r7 - cmp/eq r1, r7 - bf wrong - -swapback: - # Swap the lower two bytes into the same registers. - # R0 should now equal R1. - swap.b r1, r2 - cmp/eq r0, r2 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/swapw.cgs b/sim/testsuite/sim/sh64/compact/swapw.cgs deleted file mode 100644 index fa1ab69..0000000 --- a/sim/testsuite/sim/sh64/compact/swapw.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for swap.w $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global swapw -swapw: - # Build up a characteristic bit pattern in R0. - mov #85, r0 - shll16 r0 - add #3, r0 - rotr r0 - rotr r0 - or #170, r0 - # Preserve for later. - mov r0, r8 - -test: - swap.w r0, r1 - mov #64, r0 - shll8 r0 - or #170, r0 - shll8 r0 - or #192, r0 - shll8 r0 - or #21, r0 - cmp/eq r1, r0 - bf wrong - -swapback: - swap.w r1, r2 - cmp/eq r2, r8 - bf wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/tasb.cgs b/sim/testsuite/sim/sh64/compact/tasb.cgs deleted file mode 100644 index cb7f618..0000000 --- a/sim/testsuite/sim/sh64/compact/tasb.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for tas.b @$rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -tasb1: - mov #40, r0 - shll8 r0 - tas.b @r0 - bf wrong - -tasb2: - mov #40, r0 - shll8 r0 - tas.b @r0 - bt wrong - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/testutils.inc b/sim/testsuite/sim/sh64/compact/testutils.inc deleted file mode 100644 index b1ad830..0000000 --- a/sim/testsuite/sim/sh64/compact/testutils.inc +++ /dev/null @@ -1,49 +0,0 @@ -# Support macros for the assembly test cases. - - .macro start - .text - .global start -start: - .endm - - # Perform a single to double precision floating point conversion. - .macro _s2d fpr dpr - flds \fpr, fpul - _setpr - fcnvsd fpul, \dpr - _clrpr - .endm - - # Set the PR (PRecision) bit in the FPSCR. - .macro _setpr - sts fpscr, r7 - mov #8, r8 - shll16 r8 - or r8, r7 - lds r7, fpscr - .endm - - # Clear the PR bit. - .macro _clrpr - sts fpscr, r7 - mov #8, r8 - shll16 r8 - not r8, r8 - and r8, r7 - lds r7, fpscr - .endm - - # nb: this macro clobbers R7. - .macro assert reg value - mov \value, r7 - cmp/eq \reg, r7 - bf wrong - .endm - - .macro pass - trapa #253 - .endm - - .macro fail - trapa #254 - .endm diff --git a/sim/testsuite/sim/sh64/compact/trapa.cgs b/sim/testsuite/sim/sh64/compact/trapa.cgs deleted file mode 100644 index 24f8a6b..0000000 --- a/sim/testsuite/sim/sh64/compact/trapa.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for trapa #$imm8 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global trapa -trapa: - # pass is a macro for "trapa #253". - trapa #253 diff --git a/sim/testsuite/sim/sh64/compact/tst.cgs b/sim/testsuite/sim/sh64/compact/tst.cgs deleted file mode 100644 index a72b8a9..0000000 --- a/sim/testsuite/sim/sh64/compact/tst.cgs +++ /dev/null @@ -1,62 +0,0 @@ -# sh testcase for tst $rm, $rn -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global tst1 -tst1: - mov #0, r0 - mov #0, r1 - tst r0, r0 - bf wrong - -test2: - mov #0, r0 - mov #1, r1 - tst r0, r1 - bf wrong - -test3: - mov #0, r0 - mov #1, r1 - tst r1, r0 - bf wrong - -test4: - mov #1, r0 - mov #1, r1 - tst r0, r1 - bt wrong - -test5: - mov #1, r0 - rotr r0 - add #85, r0 - shll16 r0 - add #12, r0 - mov #1, r1 - rotr r1 - add #85, r1 - shll16 r1 - add #12, r1 - tst r0, r1 - bt wrong - -test6: - mov #1, r0 - rotr r0 - add #85, r0 - shll16 r0 - add #12, r0 - mov #1, r1 - tst r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/tstb.cgs b/sim/testsuite/sim/sh64/compact/tstb.cgs deleted file mode 100644 index 1b3829b..0000000 --- a/sim/testsuite/sim/sh64/compact/tstb.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for tst.b #$imm8, @(r0, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global orb -init: - # Init GBR and R0. - mov #30, r0 - ldc r0, gbr - mov #40, r0 - -orb: - tst.b #0, @(r0, gbr) - bf wrong - tst.b #170, @(r0, gbr) - bf wrong - tst.b #0, @(r0, gbr) - bf wrong - tst.b #255, @(r0, gbr) - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/compact/tsti.cgs b/sim/testsuite/sim/sh64/compact/tsti.cgs deleted file mode 100644 index e088029..0000000 --- a/sim/testsuite/sim/sh64/compact/tsti.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for tst #$imm8, r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global tsti -tsti: - mov #0, r0 - tst #0, r0 - -tsti2: - mov #0, r0 - tst #1, r0 - -tsti3: - mov #1, r0 - tst #0, r0 - -tsti4: - mov #1, r0 - tst #1, r0 - -tsti5: - mov #255, r0 - tst #255, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/xor.cgs b/sim/testsuite/sim/sh64/compact/xor.cgs deleted file mode 100644 index d158aaf..0000000 --- a/sim/testsuite/sim/sh64/compact/xor.cgs +++ /dev/null @@ -1,70 +0,0 @@ -# sh testcase for xor $rm64, $rn64 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global xor -xor: - # 0 (+) 1 = 1. - mov #0, r0 - mov #1, r1 - xor r0, r1 - assert r1, #1 - -xor2: - # 1 (+) 0 = 0. - mov #1, r0 - mov #0, r1 - xor r0, r1 - assert r1, #1 - -xor3: - # 0 (+) 0 = 0. - mov #0, r0 - mov #0, r1 - xor r0, r1 - assert r1, #0 - -xor4: - # 0 (+) 0 = 0. - mov #0, r0 - xor r0, r0 - assert r0, #0 - -xor5: - mov #0, r0 - or #85, r0 - shll16 r0 - or #170, r0 - mov r0, r1 - mov #0, r0 - or #85, r0 - shll16 r0 - or #170, r0 - xor r1, r0 - assert r0, #0 - -xor6: - mov #0, r0 - or #85, r0 - shll16 r0 - or #170, r0 - mov r0, r1 - mov #0, r0 - or #85, r0 - shll16 r0 - or #12, r0 - xor r0, r1 - mov #0, r0 - or #166, r0 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/xorb.cgs b/sim/testsuite/sim/sh64/compact/xorb.cgs deleted file mode 100644 index b31464b..0000000 --- a/sim/testsuite/sim/sh64/compact/xorb.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for xor.b #$imm8, @(r0, gbr) -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global orb -init: - # Init GBR and R0. - mov #30, r0 - ldc r0, gbr - mov #40, r0 - -orb: - xor.b #0, @(r0, gbr) - xor.b #170, @(r0, gbr) - xor.b #0, @(r0, gbr) - xor.b #255, @(r0, gbr) - -okay: - pass diff --git a/sim/testsuite/sim/sh64/compact/xori.cgs b/sim/testsuite/sim/sh64/compact/xori.cgs deleted file mode 100644 index 732b9ec..0000000 --- a/sim/testsuite/sim/sh64/compact/xori.cgs +++ /dev/null @@ -1,50 +0,0 @@ -# sh testcase for xor #$imm8, r0 -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - - .global xori -xori: - # 0 (+) 1 = 1. - mov #0, r0 - xor #1, r0 - assert r0, #1 - -xori2: - # 1 (+) 0 = 1. - mov #1, r0 - xor #0, r0 - assert r0, #1 - -xori3: - # 1 (+) 1 = 0. - mov #1, r0 - xor #1, r0 - assert r0, #0 - -xori4: - # 255 (+) 255 = 0. - mov #0, r0 - or #255, r0 - xor #255, r0 - assert r0, #0 - -xori5: - # 0 (+) 255 = 255. - mov #0, r0 - xor #255, r0 - mov r0, r1 - - mov #0, r0 - or #255, r0 - cmp/eq r0, r1 - bf wrong - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/compact/xtrct.cgs b/sim/testsuite/sim/sh64/compact/xtrct.cgs deleted file mode 100644 index 11dae7c..0000000 --- a/sim/testsuite/sim/sh64/compact/xtrct.cgs +++ /dev/null @@ -1,46 +0,0 @@ -# sh testcase for xtrct $rm, $rn -*- Asm -*- -# mach: all -# as: -isa=shcompact -# ld: -m shelf32 - - .include "compact/testutils.inc" - - start - -init: - mov #170, r0 - shll8 r0 - add #1, r0 - shll8 r0 - add #66, r0 - shll8 r0 - mov r0, r1 - - mov #85, r0 - shll8 r0 - add #2, r0 - shll8 r0 - add #42, r0 - shll8 r0 - add #3, r0 - -copy: - mov r0, r3 - mov r1, r4 - -xtrct: - xtrct r0, r1 - -check: - # Lower r3, upper r4. - shll16 r3 - shlr16 r4 - or r3, r4 - cmp/eq r1, r4 - bf wrong - -okay: - pass -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/interwork.exp b/sim/testsuite/sim/sh64/interwork.exp deleted file mode 100644 index acd19b3..0000000 --- a/sim/testsuite/sim/sh64/interwork.exp +++ /dev/null @@ -1,20 +0,0 @@ -# SH64 interworking testsuite. -# In particular, test parts of the instruction set that can be used -# for SHmedia/SHcompact instruction set mode switches. - -if [istarget sh64-*-*] { - # load support procs (none yet) - # load_lib cgen.exp - - # all machines - set all_machs "sh5" - - foreach src [lsort [glob -nocomplain $srcdir/$subdir/misc/*.s]] { - # If we're only testing specific files and this isn't one of them, - # skip it. - if ![runtest_file_p $runtests $src] { - continue - } - run_sim_test $src $all_machs - } -} diff --git a/sim/testsuite/sim/sh64/media.exp b/sim/testsuite/sim/sh64/media.exp deleted file mode 100644 index 1a3d9f4..0000000 --- a/sim/testsuite/sim/sh64/media.exp +++ /dev/null @@ -1,19 +0,0 @@ -# SHmedia testsuite. - -if [istarget sh64-*-*] { - # load support procs (none yet) - # load_lib cgen.exp - - # all machines - set all_machs "sh5" - - # The .cgs suffix is for "cgen .s". - foreach src [lsort [glob -nocomplain $srcdir/$subdir/media/*.cgs]] { - # If we're only testing specific files and this isn't one of them, - # skip it. - if ![runtest_file_p $runtests $src] { - continue - } - run_sim_test $src $all_machs - } -} diff --git a/sim/testsuite/sim/sh64/media/ChangeLog b/sim/testsuite/sim/sh64/media/ChangeLog deleted file mode 100644 index e435dbe..0000000 --- a/sim/testsuite/sim/sh64/media/ChangeLog +++ /dev/null @@ -1,102 +0,0 @@ -2001-01-09 Ben Elliston - - * nsb.cgs: Test consecutive bits of zeros as well as ones. - * ptb.cgs: Clean up. - -2001-01-08 Ben Elliston - - * fcmpund.cgs, fcmpuns.cgs: Complete test cases. - * fcnvds.cgs, fcnvsd.cgs, fgetscr.cgs, fiprs.cgs: Ditto. - * floatld.cgs, floatls.cgs, floatqd.cgs, floatqs.cgs: Ditto. - * fmuld.cgs, fmuls.cgs, fputscr.cgs, fstxp.cgs: Ditto. - * fsubd.cgs, fsubs.cgs, ftrcdl.cgs, ftrcdq.cgs: Ditto. - * ftrcsl.cgs, ftrcsq.cgs, ftrvs.cgs: Ditto. - * ldhil.cgs, ldhiq.cgs, ldlol.cgs, ldloq.cgs: Ditto. - * mabsl.cgs, mabsw.cgs, maddl.cgs, maddsl.cgs: Ditto. - * maddsub.cgs, maddsw.cgs, maddw.cgs: Ditto. - * mcmpeqb.cgs, mcmpeql.cgs, mcmpeqw.cgs: Ditto. - * mcmpgtl.cgs, mcmpgtub.cgs, mcmpgtw.cgs: Ditto. - * mcmv.cgs, mcnvslw.cgs, mcnvswb.cgs, mcnvswub.cgs: Ditto. - * mmacfxwl.cgs, mmacnfx-wl.cgs: Ditto. - * mmulfxl.cgs, mmulfxrpw.cgs, mmulfxw.cgs: Ditto. - * mmulhiwl.cgs, mmull.cgs, mmullowl.cgs: Ditto. - * mmulsumwq.cgs, mmulw.cgs, movi.cgs: Ditto. - * mpermw.cgs, msadubq.cgs: Ditto. - * mshaldsl.cgs, mshaldsw.cgs: Ditto. - * mshardl.cgs, mshardsq.cgs, mshardw.cgs: Ditto. - * mshfhib.cgs, mshfhil.cgs, mshfhiw.cgs: Ditto. - * mshflob.cgs, mshflol.cgs, mshflow.cgs: Ditto. - * mshlldl.cgs, mshlldw.cgs, mshlrdl.cgs: Ditto. - * mshlrdw.cgs, msubl.cgs, msubsl.cgs: Ditto. - * msubsub.cgs, msubsw.cgs, msubw.cgs: Ditto. - * mulsl.cgs, mulul.cgs: Ditto. - * ptabs.cgs, ptb.cgs, ptrel.cgs: Ditto. - * shard.cgs, shardl.cgs, shari.cgs, sharil.cgs: Ditto. - * shlld.cgs, shlldl.cgs, shlli.cgs, shllil.cgs: Ditto. - * shlrd.cgs, shlrdl.cgs, shlri.cgs, shlril.cgs: Ditto. - * sthil.cgs, sthiq.cgs, swapq.cgs, trapa.cgs: Ditto. - - * testutils.inc (pass): Pass correct "syscall" number. - (fail): Ditto. - -2000-12-13 Ben Elliston - - * sub.cgs, subl.cgs: Complete test cases. - * ptrel.cgs: Likewise. - - * shori.cgs: Test for zero extension of immediate operand. - * fcmpged.cgs, fcmpges.cgs, fldd.cgs: Complete test cases. - * fldp.cgs, flds.cgs, fldxd.cgs, fldxp.cgs: Likewise. - * fldxs.cgs, fmacs.cgs, fnegd.cgs, fnegs.cgs: Likewise. - * fsqrtd.cgs, fsqrts.cgs, fstd.cgs, fstp.cgs: Likewise. - * fsts.cgs, fstxd.cgs, fstxs.cgs: Likewise. - -2000-12-12 Ben Elliston - - * testutils.inc (pass): Use simple syscall mechanism. - (fail): Likewise. - (_packb, _packw, _packl): New macros for packing slices. - - * stb.cgs, stq.cgs, stxb.cgs, stxq.cgs: Complete test cases. - * stl.cgs, stw.cgs, stxl.cgs, stxw.cgs: Likewise. - * ldl.cgs, ldq.cgs, ldub.cgs, lduw.cgs, ldw.cgs: Likewise. - * ldxb.cgs, ldxl.cgs, ldxq.cgs, ldxub.cgs: Likewise. - * ldxuw.cgs, ldxw.cgs, nsb.cgs, trapa.cgs: Likewise. - - * fcmpeqd.cgs, fcmpeqs.cgs, fcmpgtd.cgs: Complete test cases. - * fcmpgts.cgs, fdivd.cgs, fdivs.cgs, fmovd.cgs: Likewise. - * fmovdq.cgs, fmovqd.cgs, fmovls.cgs, fmovs.cgs: Likewise. - * fmovsl.cgs: Likewise. - -2000-12-11 Ben Elliston - - * fabss.cgs, fabsd.cgs, fadds.cgs, faddd.cgs: Complete test cases. - * getcfg.cgs, getcon.cgs, gettr.cgs, icbi.cgs: Likewise. - * prefi.cgs, pta.cgs, ptabs.cgs, ptb.cgs: Likewise. - * putcon.cgs, putcfg.cgs, rte.cgs: Likewise. - - * add.cgs, addi.cgs, addl.cgs, addil.cgs: Complete test cases. - * addl.cgs, addzl.cgs, alloco.cgs, and.cgs, andc.cgs: Likewise. - * andi.cgs, beq.cgs, beqi.cgs, bge.cgs, bgeu.cgs: Likewise. - * bgt.cgs, bgtu.cgs, blink.cgs, bne.cgs, bnei.cgs: Likewise. - * brk.cgs, byterev.cgs, cmpeq.cgs, cmpgt.cgs: Likewise. - * cmpgtu.cgs, cmveq.cgs, cmvne.cgs: Likewise. - -2000-12-07 Ben Elliston - - * mextr1.cgs, mextr2.cgs, mextr3.cgs: Complete test cases. - * mextr4.cgs, mextr5.cgs, mextr6.cgs, mextr7.cgs: Likewise. - -2000-12-05 Ben Elliston - - * nop.cgs, ocbi.cgs, ocbp.cgs, ocbwb.cgs: Complete test cases. - * or.cgs, ori.cgs, xor.cgs, xori.cgs: Ditto. - * sleep.cgs, synci.cgs, synco.cgs: Ditto. - -2000-11-22 Ben Elliston - - * *.cgs: Include "media/testutils.inc", not "testutils.inc" as - generated test cases do. Miscellaneous fixes. - - * testutils.inc: New file. - * *.cgs: Generate test cases. diff --git a/sim/testsuite/sim/sh64/media/add.cgs b/sim/testsuite/sim/sh64/media/add.cgs deleted file mode 100644 index 9778e8f..0000000 --- a/sim/testsuite/sim/sh64/media/add.cgs +++ /dev/null @@ -1,47 +0,0 @@ -# sh testcase for add $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global add -init: - pta wrong, tr0 -add: - movi 10, r0 - movi 0, r1 - add r0, r1, r3 - movi 10, r4 - bne r3, r4, tr0 - -add0: - movi 1, r63 - add r63, r63, r1 - bnei r1, 0, tr0 - -add2: - movi 0, r0 - movi 10, r1 - add r0, r1, r3 - movi 10, r4 - bne r3, r4, tr0 - -add3: - movi 10, r1 - add r63, r1, r3 - movi 10, r4 - bne r3, r4, tr0 - -add4: - movi 10, r1 - add r1, r63, r3 - movi 10, r4 - bne r3, r4, tr0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/addi.cgs b/sim/testsuite/sim/sh64/media/addi.cgs deleted file mode 100644 index 3d4b49f..0000000 --- a/sim/testsuite/sim/sh64/media/addi.cgs +++ /dev/null @@ -1,37 +0,0 @@ -# sh testcase for addi $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -addi1: - movi 1, r0 - addi r0, 10, r0 - bnei r0, 11, tr0 - -addi2: - movi 10, r0 - addi r0, 1, r0 - bnei r0, 11, tr0 - -addi3: - movi 10, r0 - addi r0, -1, r0 - bnei r0, 9, tr0 - -addi4: - movi 20, r0 - addi r0, -2, r0 - bnei r0, 18, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/addil.cgs b/sim/testsuite/sim/sh64/media/addil.cgs deleted file mode 100644 index 5c92e27..0000000 --- a/sim/testsuite/sim/sh64/media/addil.cgs +++ /dev/null @@ -1,49 +0,0 @@ -# sh testcase for addi.l $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -addil0: - movi 1, r63 - addi.l r63, 0, r1 - bnei r1, 0, tr0 - -addil1: - movi 10, r0 - addi.l r0, 0, r3 - bnei r3, 10, tr0 - -addil2: - movi 0, r0 - addi.l r0, 10, r2 - bnei r2, 10, tr0 - -addil3: - addi.l r63, 10, r1 - bnei r1, 10, tr0 - -addil4: - movi 10, r0 - addi.l r0, 0, r1 - bnei r1, 10, tr0 - -addil5: - # Ensure top 32-bits are discarded when adding. - movi 10, r0 - shlli r0, 32, r0 - addi r0, 10, r0 - addi.l r0, 10, r2 - bnei r2, 20, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/addl.cgs b/sim/testsuite/sim/sh64/media/addl.cgs deleted file mode 100644 index 7f94b61..0000000 --- a/sim/testsuite/sim/sh64/media/addl.cgs +++ /dev/null @@ -1,61 +0,0 @@ -# sh testcase for add.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global addl -init: - pta wrong, tr0 - -addl0: - movi 1, r63 - add.l r63, r63, r1 - bnei r1, 0, tr0 - -addl1: - movi 10, r0 - movi 0, r1 - add.l r0, r1, r3 - movi 10, r4 - bne r3, r4, tr0 - -addl2: - movi 0, r0 - movi 10, r1 - add.l r0, r1, r2 - movi 10, r3 - bne r2, r3, tr0 - -addl3: - movi 10, r0 - add.l r63, r0, r1 - movi 10, r2 - bne r1, r2, tr0 - -addl4: - movi 10, r0 - add.l r0, r63, r1 - movi 10, r2 - bne r1, r2, tr0 - -addl5: - # Ensure top 32-bits are discarded when adding. - movi 10, r0 - shlli r0, 32, r0 - addi r0, 10, r0 - movi 10, r1 - shlli r1, 32, r1 - addi r1, 10, r1 - add.l r0, r1, r2 - movi 20, r3 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/addzl.cgs b/sim/testsuite/sim/sh64/media/addzl.cgs deleted file mode 100644 index b7917d3..0000000 --- a/sim/testsuite/sim/sh64/media/addzl.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for addz.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -addzl1: - movi 1, r0 - movi 2, r1 - addz.l r0, r1, r2 - bnei r2, 3, tr0 - -addzl2: - movi 1, r0 - shlli r0, 32, r0 - addi r0, 2, r0 - movi 1, r1 - shlli r1, 32, r1 - addi r1, 2, r1 - addz.l r0, r1, r2 - bnei r2, 4, tr0 - -addzl3: - movi 1, r0 - shlli r0, 31, r0 - addi r0, 2, r0 - movi 2, r1 - addz.l r0, r1, r2 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/alloco.cgs b/sim/testsuite/sim/sh64/media/alloco.cgs deleted file mode 100644 index 5f27359..0000000 --- a/sim/testsuite/sim/sh64/media/alloco.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for alloco $rm, $disp6x32 -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - alloco r0, 32 - pass diff --git a/sim/testsuite/sim/sh64/media/and.cgs b/sim/testsuite/sim/sh64/media/and.cgs deleted file mode 100644 index c2d4233..0000000 --- a/sim/testsuite/sim/sh64/media/and.cgs +++ /dev/null @@ -1,68 +0,0 @@ -# sh testcase for and $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -and0: - # 0 and 0 is 0. - movi 0, r0 - movi 0, r1 - and r0, r1, r2 - bnei r2, 0, tr0 - -and1: - # 0 and 1 is 0. - movi 0, r0 - movi 1, r1 - and r0, r1, r2 - bnei r2, 0, tr0 - -and2: - # 1 and 0 is 0. - movi 1, r0 - movi 0, r1 - and r0, r1, r2 - bnei r2, 0, tr0 - -and3: - # 1 and 1 is 1. - movi 1, r0 - movi 1, r1 - and r0, r1, r2 - bnei r2, 1, tr0 - -and4: - movi 1, r0 - shlli r0, 63, r0 - movi 1, r1 - shlli r1, 63, r1 - and r0, r1, r2 - # Check it. - movi 1, r3 - shlli r3, 63, r3 - bne r2, r3, tr0 - -and5: - movi 1, r0 - shlli r0, 63, r0 - movi 1, r1 - shlli r1, 63, r1 - ori r1, 1, r1 - and r0, r1, r2 - # Check it. - movi 1, r3 - shlli r1, 63, r1 - bne r1, r2, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/andc.cgs b/sim/testsuite/sim/sh64/media/andc.cgs deleted file mode 100644 index 60b50ac..0000000 --- a/sim/testsuite/sim/sh64/media/andc.cgs +++ /dev/null @@ -1,50 +0,0 @@ -# sh testcase for andc $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -andc1: - # X . !X = 0. - movi 3, r0 - movi 3, r1 - andc r0, r1, r2 - bnei r2, 0, tr0 - -andc2: - # X . 0 = X. - movi 3, r0 - movi 0, r1 - andc r0, r1, r2 - bnei r2, 3, tr0 - -andc3: - # wide X . 0 = wide X. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - movi 0, r1 - andc r0, r1, r2 - bne r0, r2, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/andi.cgs b/sim/testsuite/sim/sh64/media/andi.cgs deleted file mode 100644 index decfc2f..0000000 --- a/sim/testsuite/sim/sh64/media/andi.cgs +++ /dev/null @@ -1,46 +0,0 @@ -# sh testcase for andi $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -andi0: - # 0 and 0 is 0. - movi 0, r0 - andi r0, 0, r2 - bnei r2, 0, tr0 - -and1: - # 0 and 1 is 0. - movi 0, r0 - andi r0, 1, r2 - bnei r2, 0, tr0 - -and2: - # 1 and 0 is 0. - movi 1, r0 - andi r0, 0, r2 - bnei r2, 0, tr0 - -and3: - # 1 and 1 is 1. - movi 1, r0 - andi r0, 1, r2 - bnei r2, 1, tr0 - -and4: - movi 15, r0 - andi r0, 3, r2 - bnei r2, 3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/beq.cgs b/sim/testsuite/sim/sh64/media/beq.cgs deleted file mode 100644 index 6f96ffd..0000000 --- a/sim/testsuite/sim/sh64/media/beq.cgs +++ /dev/null @@ -1,52 +0,0 @@ -# sh testcase for beq$likely $rm, $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global beq -init: - # Load up the branch target registers. - pta beq2, tr0 - pta beq3, tr1 - pta wrong, tr2 - -beq1: - # Compare r0 with itself. - # Always true, so branch likely. - movi 1, r0 - beq/l r0, r0, tr0 - # We should branch over this. - fail - -beq2: - # Ensure high order bits are compared, too. - movi 1, r0 - shlli r0, 35, r0 - addi r0, 10, r0 - movi 1, r1 - shlli r1, 35, r1 - addi r1, 10, r1 - beq r0, r1, tr1 - # We should branch over this, too. - fail - -beq3: - movi 1, r0 - shlli r0, 35, r0 - addi r0, 10, r0 - movi 2, r1 - shlli r1, 35, r1 - addi r1, 9, r1 - # Unlikely we'll branch! - beq/u r0, r1, tr2 - # We should proceed to pass here. - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/beqi.cgs b/sim/testsuite/sim/sh64/media/beqi.cgs deleted file mode 100644 index c2b4ea8..0000000 --- a/sim/testsuite/sim/sh64/media/beqi.cgs +++ /dev/null @@ -1,40 +0,0 @@ -# sh testcase for beqi$likely $rm, $imm6, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global beqi -init: - # Load up the branch target registers. - pta beqi2, tr0 - pta beqi3, tr1 - pta wrong, tr2 - -beqi1: - # Always true, so branch likely. - movi 1, r0 - beqi/l r0, 1, tr0 - # We should branch over this. - fail - -beqi2: - movi 22, r3 - beqi r3, 22, tr1 - # We should branch over this. - fail - -beqi3: - movi 27, r7 - # We shouldn't branch here. - beqi/u r7, 23, tr2 - # We should proceed to pass here. - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/bge.cgs b/sim/testsuite/sim/sh64/media/bge.cgs deleted file mode 100644 index 832ff06..0000000 --- a/sim/testsuite/sim/sh64/media/bge.cgs +++ /dev/null @@ -1,40 +0,0 @@ -# sh testcase for bge$likely $rm, $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global bge -init: - pta bge2, tr0 - pta bge3, tr1 - pta wrong, tr2 - movi 0, r0 - -bge1: - # Compare r0 with itself. - bge/l r0, r0, tr0 - # We should branch here. - fail - -bge2: - movi 1, r1 - movi 1, r2 - bge r1, r2, tr1 - # We should branch here. - fail - -bge3: - movi -1, r1 - movi 1, r2 - bge r1, r2, tr2 - # We should not branch here. - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/bgeu.cgs b/sim/testsuite/sim/sh64/media/bgeu.cgs deleted file mode 100644 index da469d0..0000000 --- a/sim/testsuite/sim/sh64/media/bgeu.cgs +++ /dev/null @@ -1,47 +0,0 @@ -# sh testcase for bgeu$likely $rm, $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global bgeu -init: - movi 0, r0 - -bgeu1: - # Compare r0 with itself. - pta bgeu2, tr0 - bgeu/l r0, r0, tr0 - # We should branch here. - fail - -bgeu2: - movi 1, r1 - movi 1, r2 - pta bge3, tr0 - bgeu r1, r2, tr0 - # We should branch here. - fail - -bge3: - movi -1, r1 - movi 1, r2 - # We SHOULD branch here. - pta bge4, tr0 - bgeu r1, r2, tr0 - fail - -bge4: - movi 1, r1 - movi -1, r2 - # We should not branch here. - pta wrong, tr0 - bgeu r1, r2, tr0 -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/bgt.cgs b/sim/testsuite/sim/sh64/media/bgt.cgs deleted file mode 100644 index 8866635..0000000 --- a/sim/testsuite/sim/sh64/media/bgt.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for bgt$likely $rm, $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - -init: - pta wrong, tr0 - -bgt1: - movi 1, r0 - movi -1, r1 - bgt r1, r0, tr0 - -bgt2: - bgt r0, r0, tr0 - -bgt3: - pta okay, tr1 - movi -1, r0 - movi 1, r1 - bgt r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/bgtu.cgs b/sim/testsuite/sim/sh64/media/bgtu.cgs deleted file mode 100644 index 3cc0269..0000000 --- a/sim/testsuite/sim/sh64/media/bgtu.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for bgtu$likely $rm, $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - -init: - pta wrong, tr0 - -bgtu1: - movi 1, r0 - movi -1, r1 - pta bgt2, tr1 - bgtu r1, r0, tr1 - fail - -bgt2: - bgtu r0, r0, tr0 - -bgt3: - pta okay, tr1 - movi -1, r0 - movi 1, r1 - pta okay, tr1 - bgtu r0, r1, tr1 - fail - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/blink.cgs b/sim/testsuite/sim/sh64/media/blink.cgs deleted file mode 100644 index 000d1f5..0000000 --- a/sim/testsuite/sim/sh64/media/blink.cgs +++ /dev/null @@ -1,17 +0,0 @@ -# sh testcase for blink $trb, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -blink: - pta target, tr0 - gettr tr0, r1 - ptabs r1, tr0 - blink tr0, r0 - fail - -target: - pass diff --git a/sim/testsuite/sim/sh64/media/bne.cgs b/sim/testsuite/sim/sh64/media/bne.cgs deleted file mode 100644 index f574147..0000000 --- a/sim/testsuite/sim/sh64/media/bne.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for bne$likely $rm, $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 1, r0 - pta wrong, tr0 - pta okay, tr1 - -bne1: - bne r63, r63, tr0 -bne2: - bne r0, r63, tr1 -bad: - fail -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/bnei.cgs b/sim/testsuite/sim/sh64/media/bnei.cgs deleted file mode 100644 index 5ce3399..0000000 --- a/sim/testsuite/sim/sh64/media/bnei.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for bnei$likely $rm, $imm6, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 1, r0 - pta wrong, tr0 - pta okay, tr1 - -bnei1: - bnei r63, 0, tr0 -bnei2: - bnei r0, 3, tr1 -bad: - fail -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/brk.cgs b/sim/testsuite/sim/sh64/media/brk.cgs deleted file mode 100644 index 0736414..0000000 --- a/sim/testsuite/sim/sh64/media/brk.cgs +++ /dev/null @@ -1,11 +0,0 @@ -# sh testcase for brk -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - # brk will cause the sim to trap, so avoid it. - pass - brk diff --git a/sim/testsuite/sim/sh64/media/byterev.cgs b/sim/testsuite/sim/sh64/media/byterev.cgs deleted file mode 100644 index d97c3ad..0000000 --- a/sim/testsuite/sim/sh64/media/byterev.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for byterev $rm, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - pta wrong, tr0 -init: - # Put a distinctive pattern in r0. - movi 10, r0 - shlli r0, 8, r0 - ori r0, 20, r0 - shlli r0, 8, r0 - ori r0, 30, r0 - shlli r0, 8, r0 - ori r0, 40, r0 - shlli r0, 8, r0 - ori r0, 50, r0 - shlli r0, 8, r0 - ori r0, 60, r0 - shlli r0, 8, r0 - ori r0, 70, r0 - shlli r0, 8, r0 - ori r0, 80, r0 - -byterev: - byterev r0, r1 - -check: - andi r1, 255, r2 - movi 10, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 20, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 30, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 40, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 50, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 60, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 70, r3 - bne r2, r3, tr0 - shlri r1, 8, r1 - andi r1, 255, r2 - movi 80, r3 - bne r2, r3, tr0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/cmpeq.cgs b/sim/testsuite/sim/sh64/media/cmpeq.cgs deleted file mode 100644 index 78f51f4..0000000 --- a/sim/testsuite/sim/sh64/media/cmpeq.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for cmpeq $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - movi 2, r2 - movi 2, r3 - movi 3, r4 - -cmpeq1: - cmpeq r2, r2, r7 - bne r7, r1, tr0 - -cmpeq2: - cmpeq r2, r3, r7 - bne r7, r1, tr0 - -cmpeq3: - cmpeq r2, r4, r7 - bne r7, r0, tr0 - -cmpeq4: - movi 1, r2 - shlli r2, 63, r2 - movi 1, r3 - shlli r3, 63, r3 - cmpeq r2, r3, r7 - bne r7, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/cmpgt.cgs b/sim/testsuite/sim/sh64/media/cmpgt.cgs deleted file mode 100644 index e4a971b..0000000 --- a/sim/testsuite/sim/sh64/media/cmpgt.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for cmpgt $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - movi 2, r2 - movi 2, r3 - movi 3, r4 - -cmpgt1: - cmpgt r2, r2, r7 - bne r7, r0, tr0 - -cmpgt2: - cmpgt r2, r3, r7 - bne r7, r0, tr0 - -cmpgt3: - cmpgt r4, r2, r7 - bne r7, r1, tr0 - -cmpgt4: - movi 1, r2 - shlli r2, 63, r2 - movi 1, r3 - shlli r3, 63, r3 - addi r3, 1, r3 - cmpgt r3, r2, r7 - bne r7, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/cmpgtu.cgs b/sim/testsuite/sim/sh64/media/cmpgtu.cgs deleted file mode 100644 index b896dfc..0000000 --- a/sim/testsuite/sim/sh64/media/cmpgtu.cgs +++ /dev/null @@ -1,43 +0,0 @@ -# sh testcase for cmpgtu $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - movi 2, r2 - movi 2, r3 - movi 3, r4 - -cmpgt1: - cmpgtu r2, r2, r7 - bne r7, r0, tr0 - -cmpgt2: - cmpgtu r2, r3, r7 - bne r7, r0, tr0 - -cmpgt3: - cmpgtu r4, r2, r7 - bne r7, r1, tr0 - -cmpgt4: - movi 1, r2 - shlli r2, 63, r2 - movi 1, r3 - shlli r3, 63, r3 - addi r3, 1, r3 - cmpgtu r3, r2, r7 - bne r7, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/cmveq.cgs b/sim/testsuite/sim/sh64/media/cmveq.cgs deleted file mode 100644 index 0f49733..0000000 --- a/sim/testsuite/sim/sh64/media/cmveq.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for cmveq $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - - movi 0, r0 - movi 1, r1 - movi 2, r2 - movi 21, r3 - -cmveq: - # Zap r7. - movi 0, r7 - - cmveq r0, r2, r7 - bne r2, r7, tr0 - - cmveq r1, r3, r7 - # Make sure r7 is still equal to r2. - bne r2, r7, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/cmvne.cgs b/sim/testsuite/sim/sh64/media/cmvne.cgs deleted file mode 100644 index 909179a..0000000 --- a/sim/testsuite/sim/sh64/media/cmvne.cgs +++ /dev/null @@ -1,32 +0,0 @@ -# sh testcase for cmvne $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - - movi 0, r0 - movi 1, r1 - movi 2, r2 - movi 21, r3 - -cmvne: - # Zap r7. - movi 0, r7 - - cmvne r1, r2, r7 - bne r2, r7, tr0 - - cmvne r0, r3, r7 - # Make sure r7 is still equal to r2. - bne r2, r7, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fabsd.cgs b/sim/testsuite/sim/sh64/media/fabsd.cgs deleted file mode 100644 index 47060fc..0000000 --- a/sim/testsuite/sim/sh64/media/fabsd.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for fabs.d $drgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - -fabs0: - # Ensure fabs(-1) = 1. - fmov.ls r0, fr7 - float.ld fr7, dr0 - fmov.ls r1, fr7 - float.ld fr7, dr2 - fsub.d dr0, dr2, dr4 - fabs.d dr4, dr6 - fcmpeq.d dr6, dr2, r7 - bnei r7, 1, tr0 - -fabs1: - # Ensure fabs(1) = 1. - fmov.ls r0, fr7 - float.ld fr7, dr0 - fmov.ls r1, fr7 - float.ld fr7, dr2 - fabs.d dr2, dr4 - fcmpeq.d dr2, dr4, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fabss.cgs b/sim/testsuite/sim/sh64/media/fabss.cgs deleted file mode 100644 index dd9aec7..0000000 --- a/sim/testsuite/sim/sh64/media/fabss.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for fabs.s $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - -fabs0: - # Ensure fabs(-1) = 1. - fmov.ls r0, fr7 - float.ls fr7, fr0 - fmov.ls r1, fr7 - float.ls fr7, fr1 - fsub.s fr0, fr1, fr2 - fabs.s fr2, fr3 - fcmpeq.s fr3, fr1, r7 - bnei r7, 1, tr0 - -fabs1: - # Ensure fabs(1) = 1. - fmov.ls r0, fr7 - float.ls fr7, fr0 - fmov.ls r1, fr7 - float.ls fr7, fr1 - fabs.s fr1, fr2 - fcmpeq.s fr1, fr2, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/faddd.cgs b/sim/testsuite/sim/sh64/media/faddd.cgs deleted file mode 100644 index 096f852..0000000 --- a/sim/testsuite/sim/sh64/media/faddd.cgs +++ /dev/null @@ -1,33 +0,0 @@ -# sh testcase for fadd.d $drg, $drh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - movi 2, r0 - movi 3, r1 - -fadd0: - # Add 2 and 3. - fmov.ls r0, fr7 - float.ld fr7, dr0 - fmov.ls r1, fr7 - float.ld fr7, dr2 - fadd.d dr0, dr2, dr4 - # Check to make sure we got 5. - movi 5, r2 - fmov.ls r2, fr7 - float.ld fr7, dr6 - fcmpeq.d dr4, dr6, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fadds.cgs b/sim/testsuite/sim/sh64/media/fadds.cgs deleted file mode 100644 index fb93979..0000000 --- a/sim/testsuite/sim/sh64/media/fadds.cgs +++ /dev/null @@ -1,34 +0,0 @@ -# sh testcase for fadd.s $frg, $frh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fadds -init: - pta wrong, tr0 - movi 2, r0 - movi 3, r1 - -fadd0: - # Add 2 and 3. - fmov.ls r0, fr7 - float.ls fr7, fr0 - fmov.ls r1, fr7 - float.ls fr7, fr1 - fadd.s fr0, fr1, fr2 - # Check to make sure we got 5. - movi 5, r2 - fmov.ls r2, fr7 - float.ls fr7, fr3 - fcmpeq.s fr2, fr3, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpeqd.cgs b/sim/testsuite/sim/sh64/media/fcmpeqd.cgs deleted file mode 100644 index c193564..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpeqd.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for fcmpeq.d $drg, $drh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fcmpeq1: - movi 1, r0 - fmov.ls r0, fr0 - fmov.ls r0, fr1 - float.ld fr0, dr2 - float.ld fr1, dr4 - fcmpeq.d dr2, dr2, r7 - bnei r7, 1, tr0 - -fcmpeq2: - movi 1, r0 - fmov.ls r0, fr0 - movi 2, r1 - fmov.ls r1, fr1 - float.ld fr0, dr4 - float.ld fr1, dr6 - fcmpeq.d dr4, dr6, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpeqs.cgs b/sim/testsuite/sim/sh64/media/fcmpeqs.cgs deleted file mode 100644 index 216894d..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpeqs.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for fcmpeq.s $frg, $frh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fcmpeq1: - movi 1, r0 - fmov.ls r0, fr0 - fmov.ls r0, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpeq.s fr2, fr3, r7 - bnei r7, 1, tr0 - -fcmpeq2: - movi 1, r0 - fmov.ls r0, fr0 - movi 2, r1 - fmov.ls r1, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpeq.s fr2, fr3, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpged.cgs b/sim/testsuite/sim/sh64/media/fcmpged.cgs deleted file mode 100644 index 52496cc..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpged.cgs +++ /dev/null @@ -1,46 +0,0 @@ -# sh testcase for fcmpge.d $drg, $drh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fcmpge1: # 2 = 2. - movi 2, r0 - fmov.ls r0, fr0 - fmov.ls r0, fr1 - float.ld fr0, dr2 - float.ld fr1, dr4 - fcmpge.d dr2, dr4, r7 - bnei r7, 1, tr0 - -fcmpge2: # 4 > 2. - movi 4, r0 - fmov.ls r0, fr0 - movi 2, r0 - fmov.ls r0, fr1 - float.ld fr0, dr2 - float.ld fr1, dr4 - fcmpge.d dr2, dr4, r7 - bnei r7, 1, tr0 - -fcmpge3: # 2 < 4. - movi 2, r0 - fmov.ls r0, fr0 - movi 4, r0 - fmov.ls r0, fr1 - float.ld fr0, dr2 - float.ld fr1, dr4 - fcmpge.d dr2, dr4, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpges.cgs b/sim/testsuite/sim/sh64/media/fcmpges.cgs deleted file mode 100644 index 2dd0a35..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpges.cgs +++ /dev/null @@ -1,46 +0,0 @@ -# sh testcase for fcmpge.s $frg, $frh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fcmpge1: # 2 = 2. - movi 2, r0 - fmov.ls r0, fr0 - fmov.ls r0, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpge.s fr2, fr3, r7 - bnei r7, 1, tr0 - -fcmpge2: # 3 > 2. - movi 3, r0 - fmov.ls r0, fr0 - movi 2, r0 - fmov.ls r0, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpge.s fr2, fr3, r7 - bnei r7, 1, tr0 - -fcmpge3: # 2 < 3. - movi 2, r0 - fmov.ls r0, fr0 - movi 3, r0 - fmov.ls r0, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpge.s fr2, fr3, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpgtd.cgs b/sim/testsuite/sim/sh64/media/fcmpgtd.cgs deleted file mode 100644 index aec9520..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpgtd.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for fcmpgt.d $drg, $drh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fcmpgt1: - movi 2, r0 - fmov.qd r0, dr0 - movi 1, r1 - fmov.qd r1, dr2 - float.qd dr0, dr4 - float.qd dr2, dr6 - fcmpgt.d dr4, dr6, r7 - bnei r7, 1, tr0 - -fcmpgt2: - movi 1, r0 - fmov.qd r0, dr0 - fmov.qd r0, dr2 - float.qd dr0, dr4 - float.qd dr2, dr6 - fcmpgt.d dr4, dr6, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpgts.cgs b/sim/testsuite/sim/sh64/media/fcmpgts.cgs deleted file mode 100644 index 893bbcb..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpgts.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for fcmpgt.s $frg, $frh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fcmpgt1: - movi 2, r0 - fmov.ls r0, fr0 - movi 1, r1 - fmov.ls r1, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpgt.s fr2, fr3, r7 - bnei r7, 1, tr0 - -fcmpgt2: - movi 1, r0 - fmov.ls r0, fr0 - fmov.ls r0, fr1 - float.ls fr0, fr2 - float.ls fr1, fr3 - fcmpgt.s fr2, fr3, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpund.cgs b/sim/testsuite/sim/sh64/media/fcmpund.cgs deleted file mode 100644 index b87fb8d..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpund.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for fcmpun.d $drg, $drh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fcmpund: - movi 0, r0 - movi 1, r1 - fmov.qd r0, dr0 - float.qd dr0, dr0 - fmov.qd r1, dr2 - float.qd dr2, dr2 - fcmpun.d dr0, dr2, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcmpuns.cgs b/sim/testsuite/sim/sh64/media/fcmpuns.cgs deleted file mode 100644 index 6c2ed96..0000000 --- a/sim/testsuite/sim/sh64/media/fcmpuns.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for fcmpun.s $frg, $frh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fcmpuns: - movi 0, r0 - movi 1, r1 - fmov.ls r0, fr0 - float.ls fr0, fr0 - fmov.ls r1, fr1 - float.ls fr1, fr1 - fcmpun.s fr0, fr1, r7 - bnei r7, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcnvds.cgs b/sim/testsuite/sim/sh64/media/fcnvds.cgs deleted file mode 100644 index aa6c993..0000000 --- a/sim/testsuite/sim/sh64/media/fcnvds.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for fcnv.ds $drgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fcnvds: - movi 9, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - fcnv.ds dr0, fr3 - movi 9, r0 - fmov.ls r0, fr4 - float.ls fr4, fr4 - fcmpeq.s fr3, fr4, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fcnvsd.cgs b/sim/testsuite/sim/sh64/media/fcnvsd.cgs deleted file mode 100644 index 6c2396f..0000000 --- a/sim/testsuite/sim/sh64/media/fcnvsd.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for fcnv.sd $frgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fcnvsd: - movi 9, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - fcnv.sd fr0, dr2 - movi 9, r0 - fmov.qd r0, dr4 - float.qd dr4, dr4 - fcmpeq.d dr2, dr4, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fdivd.cgs b/sim/testsuite/sim/sh64/media/fdivd.cgs deleted file mode 100644 index 62401c6..0000000 --- a/sim/testsuite/sim/sh64/media/fdivd.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for fdiv.d $drg, $drh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fdivd1: - movi 1, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - movi 2, r1 - fmov.qd r1, dr2 - float.qd dr2, dr2 - fdiv.d dr0, dr2, dr4 - -fdvid2: - movi 6, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - movi 2, r1 - fmov.qd r1, dr2 - float.qd dr2, dr2 - fdiv.d dr0, dr2, dr4 - movi 3, r3 - fmov.qd r3, dr6 - float.qd dr6, dr6 - fcmpeq.d dr4, dr6, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fdivs.cgs b/sim/testsuite/sim/sh64/media/fdivs.cgs deleted file mode 100644 index 9b20f68..0000000 --- a/sim/testsuite/sim/sh64/media/fdivs.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for fdiv.s $frg, $frh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fdivs1: - movi 1, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - movi 2, r1 - fmov.ls r1, fr1 - float.ls fr1, fr1 - fdiv.s fr0, fr1, fr2 - -fdvis2: - movi 6, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - movi 2, r1 - fmov.ls r1, fr1 - float.ls fr1, fr1 - fdiv.s fr0, fr1, fr2 - movi 3, r3 - fmov.ls r3, fr3 - float.ls fr3, fr3 - fcmpeq.s fr2, fr3, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fgetscr.cgs b/sim/testsuite/sim/sh64/media/fgetscr.cgs deleted file mode 100644 index 6aa2274..0000000 --- a/sim/testsuite/sim/sh64/media/fgetscr.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for fgetscr $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fgetscr -fgetscr: - fgetscr fr0 - - pass diff --git a/sim/testsuite/sim/sh64/media/fiprs.cgs b/sim/testsuite/sim/sh64/media/fiprs.cgs deleted file mode 100644 index fef62d1..0000000 --- a/sim/testsuite/sim/sh64/media/fiprs.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for fipr.s $fvg, $fvh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - .macro _load val, fpreg - # This macro clobbers r0. - movi \val, r0 - fmov.ls r0, \fpreg - float.ls \fpreg, \fpreg - .endm - - start - - .global fiprs -init: - pta wrong, tr0 - - _load 1, fr0 - _load 2, fr1 - _load 3, fr2 - _load 4, fr3 - _load 1, fr4 - _load 2, fr5 - _load 3, fr6 - _load 4, fr7 - -fiprs: - fipr.s fv0, fv4, fr9 - -check: - _load 30, fr10 - fcmpeq.s fr9, fr10, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fldd.cgs b/sim/testsuite/sim/sh64/media/fldd.cgs deleted file mode 100644 index ded2a9f..0000000 --- a/sim/testsuite/sim/sh64/media/fldd.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for fld.d $rm, $disp10x8, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 0x2800, r0 - fld.d r0, 0, dr0 - fld.d r0, 8, dr0 - fld.d r0, -8, dr0 - pass diff --git a/sim/testsuite/sim/sh64/media/fldp.cgs b/sim/testsuite/sim/sh64/media/fldp.cgs deleted file mode 100644 index 8727110..0000000 --- a/sim/testsuite/sim/sh64/media/fldp.cgs +++ /dev/null @@ -1,16 +0,0 @@ -# sh testcase for fld.p $rm, $disp10x8, $fpf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 0x2800, r0 - -fldp: - fld.p r0, 0, fp0 - fld.p r0, 8, fp2 - fld.p r0, -8, fp4 - pass diff --git a/sim/testsuite/sim/sh64/media/flds.cgs b/sim/testsuite/sim/sh64/media/flds.cgs deleted file mode 100644 index 75d5e96..0000000 --- a/sim/testsuite/sim/sh64/media/flds.cgs +++ /dev/null @@ -1,13 +0,0 @@ -# sh testcase for fld.s $rm, $disp10x4, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 0x2800, r0 - fld.s r0, 0, fr0 - fld.s r0, 4, fr0 - fld.s r0, -4, fr0 - pass diff --git a/sim/testsuite/sim/sh64/media/fldxd.cgs b/sim/testsuite/sim/sh64/media/fldxd.cgs deleted file mode 100644 index 63cb56b..0000000 --- a/sim/testsuite/sim/sh64/media/fldxd.cgs +++ /dev/null @@ -1,16 +0,0 @@ -# sh testcase for fldx.d $rm, $rn, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 0x2800, r0 - movi 0, r1 - fldx.d r0, r1, dr0 - movi 8, r1 - fldx.d r0, r1, dr0 - movi -8, r1 - fldx.d r0, r1, dr0 - pass diff --git a/sim/testsuite/sim/sh64/media/fldxp.cgs b/sim/testsuite/sim/sh64/media/fldxp.cgs deleted file mode 100644 index 3d929c6..0000000 --- a/sim/testsuite/sim/sh64/media/fldxp.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for fldx.p $rm, $rn, $fpf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 0x2800, r0 - -fldxp: - movi 0, r1 - fldx.p r0, r1, fp0 - - movi 8, r1 - fldx.p r0, r1, fp2 - - movi -8, r1 - fldx.p r0, r1, fp4 - - pass diff --git a/sim/testsuite/sim/sh64/media/fldxs.cgs b/sim/testsuite/sim/sh64/media/fldxs.cgs deleted file mode 100644 index 10feb3e..0000000 --- a/sim/testsuite/sim/sh64/media/fldxs.cgs +++ /dev/null @@ -1,16 +0,0 @@ -# sh testcase for fldx.s $rm, $rn, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 0x2800, r0 - movi 0, r1 - fldx.s r0, r1, fr0 - movi 4, r1 - fldx.s r0, r1, fr0 - movi -4, r1 - fldx.s r0, r1, fr0 - pass diff --git a/sim/testsuite/sim/sh64/media/floatld.cgs b/sim/testsuite/sim/sh64/media/floatld.cgs deleted file mode 100644 index 31f6111..0000000 --- a/sim/testsuite/sim/sh64/media/floatld.cgs +++ /dev/null @@ -1,12 +0,0 @@ -# sh testcase for float.ld $frgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 1, r0 - fmov.ls r0, fr0 - float.ld fr0, dr0 - pass diff --git a/sim/testsuite/sim/sh64/media/floatls.cgs b/sim/testsuite/sim/sh64/media/floatls.cgs deleted file mode 100644 index 4c8fb99..0000000 --- a/sim/testsuite/sim/sh64/media/floatls.cgs +++ /dev/null @@ -1,12 +0,0 @@ -# sh testcase for float.ls $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 1, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - pass diff --git a/sim/testsuite/sim/sh64/media/floatqd.cgs b/sim/testsuite/sim/sh64/media/floatqd.cgs deleted file mode 100644 index ea5ddd9..0000000 --- a/sim/testsuite/sim/sh64/media/floatqd.cgs +++ /dev/null @@ -1,12 +0,0 @@ -# sh testcase for float.qd $drgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 1, r0 - fmov.qd r0, dr0 - float.qd dr0, dr2 - pass diff --git a/sim/testsuite/sim/sh64/media/floatqs.cgs b/sim/testsuite/sim/sh64/media/floatqs.cgs deleted file mode 100644 index fcf35e2..0000000 --- a/sim/testsuite/sim/sh64/media/floatqs.cgs +++ /dev/null @@ -1,12 +0,0 @@ -# sh testcase for float.qs $drgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - movi 1, r0 - fmov.qd r0, dr0 - float.qs dr0, fr1 - pass diff --git a/sim/testsuite/sim/sh64/media/fmacs.cgs b/sim/testsuite/sim/sh64/media/fmacs.cgs deleted file mode 100644 index 62219c5..0000000 --- a/sim/testsuite/sim/sh64/media/fmacs.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for fmac.s $frg, $frh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fmacs: - movi 2, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - - movi 3, r1 - fmov.ls r1, fr1 - float.ls fr1, fr1 - - movi 4, r2 - fmov.ls r2, fr2 - float.ls fr2, fr2 - - fmac.s fr0, fr1, fr2 - - movi 10, r3 - fmov.ls r3, fr3 - float.ls fr3, fr3 - - fcmpeq.s fr2, fr3, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmovd.cgs b/sim/testsuite/sim/sh64/media/fmovd.cgs deleted file mode 100644 index 03c05ad..0000000 --- a/sim/testsuite/sim/sh64/media/fmovd.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for fmov.d $drgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fmovd: - movi 4, r0 - fmov.qd r0, dr0 - float.qd dr0, dr2 - fmov.d dr2, dr4 - fcmpeq.d dr2, dr4, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmovdq.cgs b/sim/testsuite/sim/sh64/media/fmovdq.cgs deleted file mode 100644 index ff5c3fe..0000000 --- a/sim/testsuite/sim/sh64/media/fmovdq.cgs +++ /dev/null @@ -1,23 +0,0 @@ -# sh testcase for fmov.dq $drgh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fmovdq: - movi 4, r0 - fmov.qd r0, dr0 - fmov.dq dr0, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmovls.cgs b/sim/testsuite/sim/sh64/media/fmovls.cgs deleted file mode 100644 index 850ec33..0000000 --- a/sim/testsuite/sim/sh64/media/fmovls.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for fmov.ls $rm, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -fmovls0: - movi 0, r0 - fmov.ls r0, fr0 - -fmovls1: - movi 1, r1 - fmov.ls r1, fr1 - -upper: - movi 1, r2 - shlli r2, 63, r2 - ori r2, 3, r2 - # Bit 63 should be ignored. - fmov.ls r2, fr2 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/fmovqd.cgs b/sim/testsuite/sim/sh64/media/fmovqd.cgs deleted file mode 100644 index 64eac72..0000000 --- a/sim/testsuite/sim/sh64/media/fmovqd.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for fmov.qd $rm, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fmovdq: - movi 4, r0 - fmov.qd r0, dr0 - fmov.dq dr0, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmovs.cgs b/sim/testsuite/sim/sh64/media/fmovs.cgs deleted file mode 100644 index f126aa5..0000000 --- a/sim/testsuite/sim/sh64/media/fmovs.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for fmov.s $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fmovs: - movi 8, r0 - fmov.ls r0, fr7 - float.ls fr7, fr0 - fmov.s fr0, fr1 - fcmpeq.s fr0, fr1, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmovsl.cgs b/sim/testsuite/sim/sh64/media/fmovsl.cgs deleted file mode 100644 index 7dfdab1..0000000 --- a/sim/testsuite/sim/sh64/media/fmovsl.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for fmov.sl $frgh, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -fmovsl: - pta wrong, tr0 - movi 9, r0 - fmov.ls r0, fr0 - fmov.sl fr0, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmuld.cgs b/sim/testsuite/sim/sh64/media/fmuld.cgs deleted file mode 100644 index 2ad67cd..0000000 --- a/sim/testsuite/sim/sh64/media/fmuld.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for fmul.d $drg, $drh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -fmuld1: - movi 2, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - movi 3, r1 - fmov.qd r1, dr2 - float.qd dr2, dr2 - fmul.d dr0, dr2, dr4 - movi 6, r2 - fmov.qd r2, dr6 - float.qd dr6, dr6 - fcmpeq.d dr4, dr6, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fmuls.cgs b/sim/testsuite/sim/sh64/media/fmuls.cgs deleted file mode 100644 index 4b8875f..0000000 --- a/sim/testsuite/sim/sh64/media/fmuls.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for fmul.s $frg, $frh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -fmuls1: - movi 2, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - movi 3, r1 - fmov.ls r1, fr1 - float.ls fr1, fr1 - fmul.s fr0, fr1, fr2 - movi 6, r2 - fmov.ls r2, fr3 - float.ls fr3, fr3 - fcmpeq.s fr2, fr3, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fnegd.cgs b/sim/testsuite/sim/sh64/media/fnegd.cgs deleted file mode 100644 index 67b3813..0000000 --- a/sim/testsuite/sim/sh64/media/fnegd.cgs +++ /dev/null @@ -1,35 +0,0 @@ -# sh testcase for fneg.d $drgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - -fnegd0: - # Ensure fnegd(0) = 0. - fmov.ls r0, fr7 - float.ld fr7, dr0 - fneg.d dr0, dr2 - fcmpeq.d dr0, dr2, r7 - bnei r7, 1, tr0 - -fnegd1: - # Ensure fnegd(fnegd(1)) = 1. - fmov.ls r1, fr7 - float.ld fr7, dr0 - fneg.d dr0, dr2 - fneg.d dr2, dr4 - fcmpeq.d dr0, dr4, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fnegs.cgs b/sim/testsuite/sim/sh64/media/fnegs.cgs deleted file mode 100644 index 9ad625a..0000000 --- a/sim/testsuite/sim/sh64/media/fnegs.cgs +++ /dev/null @@ -1,35 +0,0 @@ -# sh testcase for fneg.s $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - -fnegs0: - # Ensure fnegs(0) = 0. - fmov.ls r0, fr7 - float.ls fr7, fr0 - fneg.s fr0, fr1 - fcmpeq.s fr0, fr1, r7 - bnei r7, 1, tr0 - -fnegs1: - # Ensure fnegs(fnegs(1)) = 1. - fmov.ls r1, fr7 - float.ls fr7, fr0 - fneg.s fr0, fr1 - fneg.s fr1, fr2 - fcmpeq.s fr0, fr2, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fputscr.cgs b/sim/testsuite/sim/sh64/media/fputscr.cgs deleted file mode 100644 index 28d2e72..0000000 --- a/sim/testsuite/sim/sh64/media/fputscr.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for fputscr $frgh -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fputscr -fputscr: - fputscr fr0 - - pass diff --git a/sim/testsuite/sim/sh64/media/fsqrtd.cgs b/sim/testsuite/sim/sh64/media/fsqrtd.cgs deleted file mode 100644 index ae61200..0000000 --- a/sim/testsuite/sim/sh64/media/fsqrtd.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for fsqrt.d $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 9, r0 - fmov.ls r0, fr7 - float.ld fr7, dr0 - movi 3, r1 - fmov.ls r1, fr7 - float.ld fr7, dr2 - -fsqrtd: - fsqrt.d dr0, dr4 - fcmpeq.d dr2, dr4, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fsqrts.cgs b/sim/testsuite/sim/sh64/media/fsqrts.cgs deleted file mode 100644 index f118393..0000000 --- a/sim/testsuite/sim/sh64/media/fsqrts.cgs +++ /dev/null @@ -1,27 +0,0 @@ -# sh testcase for fsqrt.s $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 9, r0 - fmov.ls r0, fr7 - float.ls fr7, fr0 - movi 3, r1 - fmov.ls r1, fr7 - float.ls fr7, fr2 - -fsqrts: - fsqrt.s fr0, fr1 - fcmpeq.s fr1, fr2, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fstd.cgs b/sim/testsuite/sim/sh64/media/fstd.cgs deleted file mode 100644 index 16ab5b6..0000000 --- a/sim/testsuite/sim/sh64/media/fstd.cgs +++ /dev/null @@ -1,34 +0,0 @@ -# sh testcase for fst.d $rm, $disp10x8, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fstd -fstd: - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - # Set target address. - movi 0x2800, r1 - fmov.qd r0, dr0 - - fst.d r1, 0, dr0 - fst.d r1, 8, dr0 - fst.d r1, -8, dr0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/fstp.cgs b/sim/testsuite/sim/sh64/media/fstp.cgs deleted file mode 100644 index e0c396a..0000000 --- a/sim/testsuite/sim/sh64/media/fstp.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for fst.p $rm, $disp10x8, $fpf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fstp -fstp: - fst.p r0, 0, fp0 - - pass diff --git a/sim/testsuite/sim/sh64/media/fsts.cgs b/sim/testsuite/sim/sh64/media/fsts.cgs deleted file mode 100644 index fb692cf..0000000 --- a/sim/testsuite/sim/sh64/media/fsts.cgs +++ /dev/null @@ -1,34 +0,0 @@ -# sh testcase for fst.s $rm, $disp10x4, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fsts -fsts: - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - # Set target address. - movi 0x2800, r1 - fmov.ls r0, fr0 - - fst.s r1, 0, fr0 - fst.s r1, 4, fr0 - fst.s r1, -4, fr0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/fstxd.cgs b/sim/testsuite/sim/sh64/media/fstxd.cgs deleted file mode 100644 index 10f6c14..0000000 --- a/sim/testsuite/sim/sh64/media/fstxd.cgs +++ /dev/null @@ -1,31 +0,0 @@ -# sh testcase for fstx.d $rm, $rn, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fstxd -fstxd: - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - fmov.qd r0, dr0 - movi 0x2800, r1 - movi -8, r2 - fstx.d r1, r2, dr0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/fstxp.cgs b/sim/testsuite/sim/sh64/media/fstxp.cgs deleted file mode 100644 index 1829f58..0000000 --- a/sim/testsuite/sim/sh64/media/fstxp.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for fstx.p $rm, $rn, $fpf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fstxp -fstxp: - fstx.p r0, r0, fp0 - - pass diff --git a/sim/testsuite/sim/sh64/media/fstxs.cgs b/sim/testsuite/sim/sh64/media/fstxs.cgs deleted file mode 100644 index 0b4ff96..0000000 --- a/sim/testsuite/sim/sh64/media/fstxs.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for fstx.s $rm, $rn, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - .global fstxs -fstxs: - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - fmov.ls r0, fr0 - movi 0x2800, r1 - movi -8, r2 - fstx.s r1, r2, fr0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/fsubd.cgs b/sim/testsuite/sim/sh64/media/fsubd.cgs deleted file mode 100644 index 93dc421..0000000 --- a/sim/testsuite/sim/sh64/media/fsubd.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for fsub.d $drg, $drh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fsubd -init: - pta wrong, tr0 - -fsubd: - movi 9, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - - movi 3, r0 - fmov.qd r0, dr2 - float.qd dr2, dr2 - - fsub.d dr0, dr2, dr4 - - movi 6, r0 - fmov.qd r0, dr6 - float.qd dr6, dr6 - - fcmpeq.d dr4, dr6, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/fsubs.cgs b/sim/testsuite/sim/sh64/media/fsubs.cgs deleted file mode 100644 index b009f09..0000000 --- a/sim/testsuite/sim/sh64/media/fsubs.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for fsub.s $frg, $frh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global fsubs -init: - pta wrong, tr0 - -fsubs: - movi 9, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - - movi 3, r0 - fmov.ls r0, fr1 - float.ls fr1, fr1 - - fsub.s fr0, fr1, fr2 - - movi 6, r0 - fmov.ls r0, fr3 - float.ls fr3, fr3 - - fcmpeq.s fr2, fr3, r7 - bnei r7, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ftrcdl.cgs b/sim/testsuite/sim/sh64/media/ftrcdl.cgs deleted file mode 100644 index 3aafb83..0000000 --- a/sim/testsuite/sim/sh64/media/ftrcdl.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for ftrc.dl $drgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ftrcdl -init: - pta wrong, tr0 - -ftrcdl: - movi -9, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - ftrc.dl dr0, fr0 - fmov.sl fr0, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ftrcdq.cgs b/sim/testsuite/sim/sh64/media/ftrcdq.cgs deleted file mode 100644 index 6cd63fb..0000000 --- a/sim/testsuite/sim/sh64/media/ftrcdq.cgs +++ /dev/null @@ -1,24 +0,0 @@ -# sh testcase for ftrc.dq $drgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -ftrcdq: - movi -9, r0 - fmov.qd r0, dr0 - float.qd dr0, dr0 - ftrc.dq dr0, dr2 - fmov.dq dr2, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ftrcsl.cgs b/sim/testsuite/sim/sh64/media/ftrcsl.cgs deleted file mode 100644 index 9fd7fae..0000000 --- a/sim/testsuite/sim/sh64/media/ftrcsl.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for ftrc.sl $frgh, $frf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ftrcsl -init: - pta wrong, tr0 - -ftrcsl: - movi -9, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - ftrc.sl fr0, fr1 - fmov.sl fr1, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ftrcsq.cgs b/sim/testsuite/sim/sh64/media/ftrcsq.cgs deleted file mode 100644 index 8f19d59..0000000 --- a/sim/testsuite/sim/sh64/media/ftrcsq.cgs +++ /dev/null @@ -1,25 +0,0 @@ -# sh testcase for ftrc.sq $frgh, $drf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -ftrcsq: - movi -9, r0 - fmov.ls r0, fr0 - float.ls fr0, fr0 - ftrc.sq fr0, dr2 - fmov.dq dr2, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ftrvs.cgs b/sim/testsuite/sim/sh64/media/ftrvs.cgs deleted file mode 100644 index be7a75a..0000000 --- a/sim/testsuite/sim/sh64/media/ftrvs.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for ftrv.s $mtrxg, $fvh, $fvf -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - .macro _load val, fpreg - # This macro clobbers r0. - movi \val, r0 - fmov.ls r0, \fpreg - float.ls \fpreg, \fpreg - .endm - - start - -init: - pta wrong, tr0 - - _load 1, fr0 - _load 2, fr4 - _load 3, fr8 - _load 4, fr12 - _load 5, fr1 - _load 6, fr5 - _load 7, fr9 - _load 8, fr13 - _load 9, fr2 - _load 10, fr6 - _load 11, fr10 - _load 12, fr14 - _load 13, fr3 - _load 14, fr7 - _load 15, fr11 - _load 16, fr15 - - _load 1, fr16 - _load 2, fr17 - _load 3, fr18 - _load 4, fr19 - -ftrvs: - ftrv.s mtrx0, fv16, fv20 - -check: - _load 30, fr0 - _load 70, fr1 - _load 110, fr2 - _load 150, fr3 - - fcmpeq.s fr0, fr20, r0 - bnei r0, 1, tr0 - - fcmpeq.s fr1, fr21, r0 - bnei r0, 1, tr0 - - fcmpeq.s fr2, fr22, r0 - bnei r0, 1, tr0 - - fcmpeq.s fr3, fr23, r0 - bnei r0, 1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/getcfg.cgs b/sim/testsuite/sim/sh64/media/getcfg.cgs deleted file mode 100644 index d151739..0000000 --- a/sim/testsuite/sim/sh64/media/getcfg.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for getcfg $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - getcfg r0, 0, r0 - pass diff --git a/sim/testsuite/sim/sh64/media/getcon.cgs b/sim/testsuite/sim/sh64/media/getcon.cgs deleted file mode 100644 index 8eeb43c..0000000 --- a/sim/testsuite/sim/sh64/media/getcon.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for getcon $crk, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -getcon1: - movi 22, r0 - putcon r0, cr0 - getcon cr0, r1 - bne r0, r1, tr0 - -getcon2: - movi 12, r0 - shlli r0, 35, r0 - putcon r0, cr20 - getcon cr20, r20 - bne r0, r20, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/gettr.cgs b/sim/testsuite/sim/sh64/media/gettr.cgs deleted file mode 100644 index 8840a36..0000000 --- a/sim/testsuite/sim/sh64/media/gettr.cgs +++ /dev/null @@ -1,48 +0,0 @@ -# sh testcase for gettr $trb, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - # tr0 is reserved. - # don't use it anywhere else in this test. - pta wrong, tr0 - -gettr1: - # Put garbage in r1, r2. - movi 20, r1 - movi 30, r2 - - pta foo, tr1 - pta foo, tr2 - -check1: - gettr tr1, r1 - gettr tr2, r2 - bne r1, r2, tr0 - -gettr2: - # Put garbage in r3, r4. - movi 21, r3 - movi 42, r4 - -check2: - pta foo, tr1 - gettr tr1, r2 - ptabs r2, tr2 - gettr tr2, r3 - ptabs r3, tr3 - gettr tr3, r4 - bne r2, r4, tr0 - -okay: - pass - -wrong: - fail - -foo: - nop diff --git a/sim/testsuite/sim/sh64/media/icbi.cgs b/sim/testsuite/sim/sh64/media/icbi.cgs deleted file mode 100644 index 9ba1845..0000000 --- a/sim/testsuite/sim/sh64/media/icbi.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for icbi $rm, $disp6x32 -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - icbi r0, 0 - pass diff --git a/sim/testsuite/sim/sh64/media/ldb.cgs b/sim/testsuite/sim/sh64/media/ldb.cgs deleted file mode 100644 index fad1e6e..0000000 --- a/sim/testsuite/sim/sh64/media/ldb.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for ld.b $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 20, r3 - shlli r3, 8, r3 - -ldb1: - ld.b r3, 0, r0 -ldb2: - ld.b r3, -1, r0 -ldb3: - ld.b r3, 1, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldhil.cgs b/sim/testsuite/sim/sh64/media/ldhil.cgs deleted file mode 100644 index 4323985..0000000 --- a/sim/testsuite/sim/sh64/media/ldhil.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for ldhi.l $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ldhil -ldhil: - ldhi.l r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/ldhiq.cgs b/sim/testsuite/sim/sh64/media/ldhiq.cgs deleted file mode 100644 index c34a952..0000000 --- a/sim/testsuite/sim/sh64/media/ldhiq.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for ldhi.q $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ldhiq -ldhiq: - ldhi.q r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/ldl.cgs b/sim/testsuite/sim/sh64/media/ldl.cgs deleted file mode 100644 index b8b8725..0000000 --- a/sim/testsuite/sim/sh64/media/ldl.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for ld.l $rm, $disp10x4, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 20, r3 - shlli r3, 8, r3 - -ldl1: - ld.l r3, 0, r0 -ldl2: - ld.l r3, -4, r0 -ldl3: - ld.l r3, 4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldlol.cgs b/sim/testsuite/sim/sh64/media/ldlol.cgs deleted file mode 100644 index 8204f40..0000000 --- a/sim/testsuite/sim/sh64/media/ldlol.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for ldlo.l $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ldlol -ldlol: - ldlo.l r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/ldloq.cgs b/sim/testsuite/sim/sh64/media/ldloq.cgs deleted file mode 100644 index 0cf128e..0000000 --- a/sim/testsuite/sim/sh64/media/ldloq.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for ldlo.q $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ldloq -ldloq: - ldlo.q r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/ldq.cgs b/sim/testsuite/sim/sh64/media/ldq.cgs deleted file mode 100644 index cacc076..0000000 --- a/sim/testsuite/sim/sh64/media/ldq.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for ld.q $rm, $disp10x8, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 20, r3 - shlli r3, 8, r3 - -ldl1: - ld.q r3, 0, r0 -ldl2: - ld.q r3, -8, r0 -ldl3: - ld.q r3, 8, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldub.cgs b/sim/testsuite/sim/sh64/media/ldub.cgs deleted file mode 100644 index 825ce64..0000000 --- a/sim/testsuite/sim/sh64/media/ldub.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for ld.ub $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi 20, r3 - shlli r3, 8, r3 - -ldub1: - ld.ub r3, 0, r0 -ldub2: - ld.ub r3, -1, r0 -ldub3: - ld.ub r3, 1, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/lduw.cgs b/sim/testsuite/sim/sh64/media/lduw.cgs deleted file mode 100644 index a329802..0000000 --- a/sim/testsuite/sim/sh64/media/lduw.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for ld.uw $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi 20, r3 - shlli r3, 8, r3 - -lduw1: - ld.uw r3, 0, r0 -lduw2: - ld.uw r3, -2, r0 -lduw3: - ld.uw r3, 2, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldw.cgs b/sim/testsuite/sim/sh64/media/ldw.cgs deleted file mode 100644 index d394055..0000000 --- a/sim/testsuite/sim/sh64/media/ldw.cgs +++ /dev/null @@ -1,21 +0,0 @@ -# sh testcase for ld.w $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 20, r3 - shlli r3, 8, r3 - -ldw1: - ld.w r3, 0, r0 -ldw2: - ld.w r3, -2, r0 -ldw3: - ld.w r3, 2, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldxb.cgs b/sim/testsuite/sim/sh64/media/ldxb.cgs deleted file mode 100644 index 36038df..0000000 --- a/sim/testsuite/sim/sh64/media/ldxb.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for ldx.b $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -ldxb1: - movi 20, r3 - shlli r3, 8, r3 - movi 0, r4 - ldx.b r3, r4, r0 - -ldxb2: - movi 20, r3 - shlli r3, 8, r3 - movi 1, r4 - ldx.b r3, r4, r0 - -ldxb3: - movi 20, r3 - shlli r3, 8, r3 - movi -1, r4 - ldx.b r3, r4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldxl.cgs b/sim/testsuite/sim/sh64/media/ldxl.cgs deleted file mode 100644 index 0596e9f..0000000 --- a/sim/testsuite/sim/sh64/media/ldxl.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for ldx.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -ldxl1: - movi 20, r3 - shlli r3, 8, r3 - movi 0, r4 - ldx.l r3, r4, r0 - -ldxl2: - movi 20, r3 - shlli r3, 8, r3 - movi 4, r4 - ldx.l r3, r4, r0 - -ldxl3: - movi 20, r3 - shlli r3, 8, r3 - movi -4, r4 - ldx.l r3, r4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldxq.cgs b/sim/testsuite/sim/sh64/media/ldxq.cgs deleted file mode 100644 index 1247f22..0000000 --- a/sim/testsuite/sim/sh64/media/ldxq.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for ldx.q $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -ldxq1: - movi 20, r3 - shlli r3, 8, r3 - movi 0, r4 - ldx.q r3, r4, r0 - -ldxq2: - movi 20, r3 - shlli r3, 8, r3 - movi 8, r4 - ldx.q r3, r4, r0 - -ldxq3: - movi 20, r3 - shlli r3, 8, r3 - movi -8, r4 - ldx.q r3, r4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldxub.cgs b/sim/testsuite/sim/sh64/media/ldxub.cgs deleted file mode 100644 index e863a3b..0000000 --- a/sim/testsuite/sim/sh64/media/ldxub.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for ldx.ub $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -ldxub1: - movi 20, r3 - shlli r3, 8, r3 - movi 0, r4 - ldx.ub r3, r4, r0 - -ldxub2: - movi 20, r3 - shlli r3, 8, r3 - movi 1, r4 - ldx.ub r3, r4, r0 - -ldxub3: - movi 20, r3 - shlli r3, 8, r3 - movi -1, r4 - ldx.ub r3, r4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldxuw.cgs b/sim/testsuite/sim/sh64/media/ldxuw.cgs deleted file mode 100644 index 282812d..0000000 --- a/sim/testsuite/sim/sh64/media/ldxuw.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for ldx.uw $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -ldxuw1: - movi 20, r3 - shlli r3, 8, r3 - movi 0, r4 - ldx.uw r3, r4, r0 - -ldxuw2: - movi 20, r3 - shlli r3, 8, r3 - movi 2, r4 - ldx.uw r3, r4, r0 - -ldxuw3: - movi 20, r3 - shlli r3, 8, r3 - movi -2, r4 - ldx.uw r3, r4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ldxw.cgs b/sim/testsuite/sim/sh64/media/ldxw.cgs deleted file mode 100644 index d377fef..0000000 --- a/sim/testsuite/sim/sh64/media/ldxw.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for ldx.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -ldxw1: - movi 20, r3 - shlli r3, 8, r3 - movi 0, r4 - ldx.w r3, r4, r0 - -ldxw2: - movi 20, r3 - shlli r3, 8, r3 - movi 2, r4 - ldx.w r3, r4, r0 - -ldxw3: - movi 20, r3 - shlli r3, 8, r3 - movi -2, r4 - ldx.w r3, r4, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/mabsl.cgs b/sim/testsuite/sim/sh64/media/mabsl.cgs deleted file mode 100644 index a8af663..0000000 --- a/sim/testsuite/sim/sh64/media/mabsl.cgs +++ /dev/null @@ -1,39 +0,0 @@ -# sh testcase for mabs.l $rm, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mabsl -init: - pta wrong, tr0 - -mabsl1: - # Pack { 1 3 } into R0. - _packl 1, 3, r0 - - mabs.l r0, r1 - - # Test for { 1 3 } in R0. - _packl 1, 3, r2 - bne r0, r2, tr0 - -mabsl2: - # Pack { -1, -1 } into R0. - _packl 1, 1, r0 - - # Set the left sign bit. - movi 1, r1 - shlli r1, 63, r1 - or r0, r1, r0 - - mabs.l r0, r2 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mabsw.cgs b/sim/testsuite/sim/sh64/media/mabsw.cgs deleted file mode 100644 index f4e980a..0000000 --- a/sim/testsuite/sim/sh64/media/mabsw.cgs +++ /dev/null @@ -1,38 +0,0 @@ -# sh testcase for mabs.w $rm, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -mabsw1: - # Pack { 1 3 5 7 } into R0. - _packw 1, 3, 5, 7, r0 - - mabs.l r0, r1 - - # Test for { 1 3 5 7 } in R0. - _packw 1, 3, 5, 7, r2 - bne r0, r2, tr0 - -mabsw2: - # Pack { -1, -1, -1, -1 } into R0. - _packw 1, 1, 1, 1, r0 - - # Set the left sign bit - movi 1, r1 - shlli r1, 63, r1 - or r0, r1, r0 - - mabs.w r0, r2 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/maddl.cgs b/sim/testsuite/sim/sh64/media/maddl.cgs deleted file mode 100644 index 4bdf546..0000000 --- a/sim/testsuite/sim/sh64/media/maddl.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for madd.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -maddl: - # Load { 1 2 } into r0. - _packl 1, 2, r0 - # Load { 3 4 } into r1. - _packl 3, 4, r1 - - # Add slices to produce { 4 6 }. - madd.l r0, r1, r2 - - _packl 4, 6, r3 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/maddsl.cgs b/sim/testsuite/sim/sh64/media/maddsl.cgs deleted file mode 100644 index 3977275..0000000 --- a/sim/testsuite/sim/sh64/media/maddsl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for madds.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global maddsl -maddsl: - madds.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/maddsub.cgs b/sim/testsuite/sim/sh64/media/maddsub.cgs deleted file mode 100644 index a55f927..0000000 --- a/sim/testsuite/sim/sh64/media/maddsub.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for madds.ub $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global maddsub -maddsub: - madds.ub r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/maddsw.cgs b/sim/testsuite/sim/sh64/media/maddsw.cgs deleted file mode 100644 index 45a774e..0000000 --- a/sim/testsuite/sim/sh64/media/maddsw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for madds.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global maddsw -maddsw: - madds.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/maddw.cgs b/sim/testsuite/sim/sh64/media/maddw.cgs deleted file mode 100644 index b220ef4..0000000 --- a/sim/testsuite/sim/sh64/media/maddw.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for madd.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -maddw: - # Load { 1 2 3 4 } into R0. - _packw 1, 2, 3, 4, r0 - - # Load { 3 4 5 6 } into R1. - _packw 3, 4, 5, 6, r1 - - # Add slices to produce { 4 6 8 10 }. - madd.w r0, r1, r2 - - _packw 4, 6, 8, 10, r3 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mcmpeqb.cgs b/sim/testsuite/sim/sh64/media/mcmpeqb.cgs deleted file mode 100644 index d7af6fa..0000000 --- a/sim/testsuite/sim/sh64/media/mcmpeqb.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmpeq.b $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmpeqb -mcmpeqb: - mcmpeq.b r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcmpeql.cgs b/sim/testsuite/sim/sh64/media/mcmpeql.cgs deleted file mode 100644 index 2851e80..0000000 --- a/sim/testsuite/sim/sh64/media/mcmpeql.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmpeq.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmpeql -mcmpeql: - mcmpeq.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcmpeqw.cgs b/sim/testsuite/sim/sh64/media/mcmpeqw.cgs deleted file mode 100644 index 085df84..0000000 --- a/sim/testsuite/sim/sh64/media/mcmpeqw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmpeq.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmpeqw -mcmpeqw: - mcmpeq.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcmpgtl.cgs b/sim/testsuite/sim/sh64/media/mcmpgtl.cgs deleted file mode 100644 index 2ace048..0000000 --- a/sim/testsuite/sim/sh64/media/mcmpgtl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmpgt.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmpgtl -mcmpgtl: - mcmpgt.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcmpgtub.cgs b/sim/testsuite/sim/sh64/media/mcmpgtub.cgs deleted file mode 100644 index 540ce96..0000000 --- a/sim/testsuite/sim/sh64/media/mcmpgtub.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmpgt.ub $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmpgtub -mcmpgtub: - mcmpgt.ub r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcmpgtw.cgs b/sim/testsuite/sim/sh64/media/mcmpgtw.cgs deleted file mode 100644 index 8327451..0000000 --- a/sim/testsuite/sim/sh64/media/mcmpgtw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmpgt.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmpgtw -mcmpgtw: - mcmpgt.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcmv.cgs b/sim/testsuite/sim/sh64/media/mcmv.cgs deleted file mode 100644 index c1f59aa..0000000 --- a/sim/testsuite/sim/sh64/media/mcmv.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcmv $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcmv -mcmv: - mcmv r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcnvslw.cgs b/sim/testsuite/sim/sh64/media/mcnvslw.cgs deleted file mode 100644 index 005108b..0000000 --- a/sim/testsuite/sim/sh64/media/mcnvslw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcnvs.lw $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcnvslw -mcnvslw: - mcnvs.lw r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcnvswb.cgs b/sim/testsuite/sim/sh64/media/mcnvswb.cgs deleted file mode 100644 index 0d25920..0000000 --- a/sim/testsuite/sim/sh64/media/mcnvswb.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcnvs.wb $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcnvswb -mcnvswb: - mcnvs.wb r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mcnvswub.cgs b/sim/testsuite/sim/sh64/media/mcnvswub.cgs deleted file mode 100644 index 2fc7446..0000000 --- a/sim/testsuite/sim/sh64/media/mcnvswub.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mcnvs.wub $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mcnvswub -mcnvswub: - mcnvs.wub r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mextr1.cgs b/sim/testsuite/sim/sh64/media/mextr1.cgs deleted file mode 100644 index b2cb3c3..0000000 --- a/sim/testsuite/sim/sh64/media/mextr1.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr1 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr1: - mextr1 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x2535, r3 - shlli r3, 8, r3 - ori r3, 0x45, r3 - shlli r3, 8, r3 - ori r3, 0x55, r3 - shlli r3, 8, r3 - ori r3, 0x65, r3 - shlli r3, 8, r3 - ori r3, 0x75, r3 - shlli r3, 8, r3 - ori r3, 0x85, r3 - shlli r3, 8, r3 - ori r3, 0x10, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mextr2.cgs b/sim/testsuite/sim/sh64/media/mextr2.cgs deleted file mode 100644 index cf136be..0000000 --- a/sim/testsuite/sim/sh64/media/mextr2.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr2 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr2: - mextr2 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x3545, r3 - shlli r3, 8, r3 - ori r3, 0x55, r3 - shlli r3, 8, r3 - ori r3, 0x65, r3 - shlli r3, 8, r3 - ori r3, 0x75, r3 - shlli r3, 8, r3 - ori r3, 0x85, r3 - shlli r3, 8, r3 - ori r3, 0x10, r3 - shlli r3, 8, r3 - ori r3, 0x20, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mextr3.cgs b/sim/testsuite/sim/sh64/media/mextr3.cgs deleted file mode 100644 index b8d60a4..0000000 --- a/sim/testsuite/sim/sh64/media/mextr3.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr3 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr3: - mextr3 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x4555, r3 - shlli r3, 8, r3 - ori r3, 0x65, r3 - shlli r3, 8, r3 - ori r3, 0x75, r3 - shlli r3, 8, r3 - ori r3, 0x85, r3 - shlli r3, 8, r3 - ori r3, 0x10, r3 - shlli r3, 8, r3 - ori r3, 0x20, r3 - shlli r3, 8, r3 - ori r3, 0x30, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mextr4.cgs b/sim/testsuite/sim/sh64/media/mextr4.cgs deleted file mode 100644 index e9ebff9..0000000 --- a/sim/testsuite/sim/sh64/media/mextr4.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr4 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr4: - mextr4 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x5565, r3 - shlli r3, 8, r3 - ori r3, 0x75, r3 - shlli r3, 8, r3 - ori r3, 0x85, r3 - shlli r3, 8, r3 - ori r3, 0x10, r3 - shlli r3, 8, r3 - ori r3, 0x20, r3 - shlli r3, 8, r3 - ori r3, 0x30, r3 - shlli r3, 8, r3 - ori r3, 0x40, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mextr5.cgs b/sim/testsuite/sim/sh64/media/mextr5.cgs deleted file mode 100644 index c61a0c8..0000000 --- a/sim/testsuite/sim/sh64/media/mextr5.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr5 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr5: - mextr5 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x6575, r3 - shlli r3, 8, r3 - ori r3, 0x85, r3 - shlli r3, 8, r3 - ori r3, 0x10, r3 - shlli r3, 8, r3 - ori r3, 0x20, r3 - shlli r3, 8, r3 - ori r3, 0x30, r3 - shlli r3, 8, r3 - ori r3, 0x40, r3 - shlli r3, 8, r3 - ori r3, 0x50, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mextr6.cgs b/sim/testsuite/sim/sh64/media/mextr6.cgs deleted file mode 100644 index 5c6c7f6..0000000 --- a/sim/testsuite/sim/sh64/media/mextr6.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr6 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr6: - mextr6 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x7585, r3 - shlli r3, 8, r3 - ori r3, 0x10, r3 - shlli r3, 8, r3 - ori r3, 0x20, r3 - shlli r3, 8, r3 - ori r3, 0x30, r3 - shlli r3, 8, r3 - ori r3, 0x40, r3 - shlli r3, 8, r3 - ori r3, 0x50, r3 - shlli r3, 8, r3 - ori r3, 0x60, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mextr7.cgs b/sim/testsuite/sim/sh64/media/mextr7.cgs deleted file mode 100644 index e05ec7f..0000000 --- a/sim/testsuite/sim/sh64/media/mextr7.cgs +++ /dev/null @@ -1,67 +0,0 @@ -# sh testcase for mextr7 $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - # Put a distinguised bit pattern in R0. - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - # Put another distinguished bit pattern in R1. - movi 0x1525, r1 - shlli r1, 8, r1 - ori r1, 0x35, r1 - shlli r1, 8, r1 - ori r1, 0x45, r1 - shlli r1, 8, r1 - ori r1, 0x55, r1 - shlli r1, 8, r1 - ori r1, 0x65, r1 - shlli r1, 8, r1 - ori r1, 0x75, r1 - shlli r1, 8, r1 - ori r1, 0x85, r1 - -mextr7: - mextr7 r0, r1, r2 - -check: - # Put the result in R3. - movi 0x8510, r3 - shlli r3, 8, r3 - ori r3, 0x20, r3 - shlli r3, 8, r3 - ori r3, 0x30, r3 - shlli r3, 8, r3 - ori r3, 0x40, r3 - shlli r3, 8, r3 - ori r3, 0x50, r3 - shlli r3, 8, r3 - ori r3, 0x60, r3 - shlli r3, 8, r3 - ori r3, 0x70, r3 - - pta wrong, tr0 - bne r2, r3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mmacfxwl.cgs b/sim/testsuite/sim/sh64/media/mmacfxwl.cgs deleted file mode 100644 index dd2d9a4..0000000 --- a/sim/testsuite/sim/sh64/media/mmacfxwl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmacfx.wl $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmacfxwl -mmacfxwl: - mmacfx.wl r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmacnfx-wl.cgs b/sim/testsuite/sim/sh64/media/mmacnfx-wl.cgs deleted file mode 100644 index ba634d2..0000000 --- a/sim/testsuite/sim/sh64/media/mmacnfx-wl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmacnfx.wl $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmacnfx_wl -mmacnfx_wl: - mmacnfx.wl r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmulfxl.cgs b/sim/testsuite/sim/sh64/media/mmulfxl.cgs deleted file mode 100644 index 7d2d1a6..0000000 --- a/sim/testsuite/sim/sh64/media/mmulfxl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmulfx.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmulfxl -mmulfxl: - mmulfx.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmulfxrpw.cgs b/sim/testsuite/sim/sh64/media/mmulfxrpw.cgs deleted file mode 100644 index 13fdcc7..0000000 --- a/sim/testsuite/sim/sh64/media/mmulfxrpw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmulfxrp.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmulfxrpw -mmulfxrpw: - mmulfxrp.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmulfxw.cgs b/sim/testsuite/sim/sh64/media/mmulfxw.cgs deleted file mode 100644 index e2a66a7..0000000 --- a/sim/testsuite/sim/sh64/media/mmulfxw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmulfx.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmulfxw -mmulfxw: - mmulfx.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmulhiwl.cgs b/sim/testsuite/sim/sh64/media/mmulhiwl.cgs deleted file mode 100644 index 1a41ac5..0000000 --- a/sim/testsuite/sim/sh64/media/mmulhiwl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmulhi.wl $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmulhiwl -mmulhiwl: - mmulhi.wl r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmull.cgs b/sim/testsuite/sim/sh64/media/mmull.cgs deleted file mode 100644 index b3ed9df..0000000 --- a/sim/testsuite/sim/sh64/media/mmull.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmul.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmull -mmull: - mmul.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmullowl.cgs b/sim/testsuite/sim/sh64/media/mmullowl.cgs deleted file mode 100644 index b50ccfc..0000000 --- a/sim/testsuite/sim/sh64/media/mmullowl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmullo.wl $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmullowl -mmullowl: - mmullo.wl r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmulsumwq.cgs b/sim/testsuite/sim/sh64/media/mmulsumwq.cgs deleted file mode 100644 index 344710b..0000000 --- a/sim/testsuite/sim/sh64/media/mmulsumwq.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmulsum.wq $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmulsumwq -mmulsumwq: - mmulsum.wq r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mmulw.cgs b/sim/testsuite/sim/sh64/media/mmulw.cgs deleted file mode 100644 index 675c620..0000000 --- a/sim/testsuite/sim/sh64/media/mmulw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mmul.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mmulw -mmulw: - mmul.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/movi.cgs b/sim/testsuite/sim/sh64/media/movi.cgs deleted file mode 100644 index a01bcae..0000000 --- a/sim/testsuite/sim/sh64/media/movi.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for movi $imm16, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -movi0: - movi 0, r0 - bnei r0, 0, tr0 -movi1: - movi 1, r0 - bnei r0, 1, tr0 -movi2: - movi 23, r0 - bnei r0, 23, tr0 -movn: - movi -1, r0 - addi r0, 1, r0 - bnei r0, 0, tr0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/mpermw.cgs b/sim/testsuite/sim/sh64/media/mpermw.cgs deleted file mode 100644 index 3b6741e..0000000 --- a/sim/testsuite/sim/sh64/media/mpermw.cgs +++ /dev/null @@ -1,51 +0,0 @@ -# sh testcase for mperm.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - movi 27, r1 - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - -mpermw: - mperm.w r0, r1, r2 - -check: - # Expect 0x7080506030401020. - movi 0x7080, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x10, r0 - shlli r0, 8, r0 - ori r0, 0x20, r0 - - bne r0, r2, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/msadubq.cgs b/sim/testsuite/sim/sh64/media/msadubq.cgs deleted file mode 100644 index 4361883..0000000 --- a/sim/testsuite/sim/sh64/media/msadubq.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for msad.ubq $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global msadubq -msadubq: - msad.ubq r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshaldsl.cgs b/sim/testsuite/sim/sh64/media/mshaldsl.cgs deleted file mode 100644 index 1dd86ec..0000000 --- a/sim/testsuite/sim/sh64/media/mshaldsl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshalds.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshaldsl -mshaldsl: - mshalds.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshaldsw.cgs b/sim/testsuite/sim/sh64/media/mshaldsw.cgs deleted file mode 100644 index 7ab6797..0000000 --- a/sim/testsuite/sim/sh64/media/mshaldsw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshalds.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshaldsw -mshaldsw: - mshalds.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshardl.cgs b/sim/testsuite/sim/sh64/media/mshardl.cgs deleted file mode 100644 index 0dc102e..0000000 --- a/sim/testsuite/sim/sh64/media/mshardl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshard.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshardl -mshardl: - mshard.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshardsq.cgs b/sim/testsuite/sim/sh64/media/mshardsq.cgs deleted file mode 100644 index 5f29afb..0000000 --- a/sim/testsuite/sim/sh64/media/mshardsq.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshards.q $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshardsq -mshardsq: - mshards.q r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshardw.cgs b/sim/testsuite/sim/sh64/media/mshardw.cgs deleted file mode 100644 index ecc7004..0000000 --- a/sim/testsuite/sim/sh64/media/mshardw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshard.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshardw -mshardw: - mshard.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshfhib.cgs b/sim/testsuite/sim/sh64/media/mshfhib.cgs deleted file mode 100644 index b7b245e..0000000 --- a/sim/testsuite/sim/sh64/media/mshfhib.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshfhi.b $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshfhib -mshfhib: - mshfhi.b r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshfhil.cgs b/sim/testsuite/sim/sh64/media/mshfhil.cgs deleted file mode 100644 index 2fab7ae..0000000 --- a/sim/testsuite/sim/sh64/media/mshfhil.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshfhi.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshfhil -mshfhil: - mshfhi.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshfhiw.cgs b/sim/testsuite/sim/sh64/media/mshfhiw.cgs deleted file mode 100644 index 0311141..0000000 --- a/sim/testsuite/sim/sh64/media/mshfhiw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshfhi.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshfhiw -mshfhiw: - mshfhi.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshflob.cgs b/sim/testsuite/sim/sh64/media/mshflob.cgs deleted file mode 100644 index 400e81a..0000000 --- a/sim/testsuite/sim/sh64/media/mshflob.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshflo.b $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshflob -mshflob: - mshflo.b r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshflol.cgs b/sim/testsuite/sim/sh64/media/mshflol.cgs deleted file mode 100644 index 2fbdf89..0000000 --- a/sim/testsuite/sim/sh64/media/mshflol.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshflo.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshflol -mshflol: - mshflo.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshflow.cgs b/sim/testsuite/sim/sh64/media/mshflow.cgs deleted file mode 100644 index 542eb04..0000000 --- a/sim/testsuite/sim/sh64/media/mshflow.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshflo.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshflow -mshflow: - mshflo.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshlldl.cgs b/sim/testsuite/sim/sh64/media/mshlldl.cgs deleted file mode 100644 index 2a17c33..0000000 --- a/sim/testsuite/sim/sh64/media/mshlldl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshlld.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshlldl -mshlldl: - mshlld.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshlldw.cgs b/sim/testsuite/sim/sh64/media/mshlldw.cgs deleted file mode 100644 index e4afe3d..0000000 --- a/sim/testsuite/sim/sh64/media/mshlldw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshlld.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshlldw -mshlldw: - mshlld.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshlrdl.cgs b/sim/testsuite/sim/sh64/media/mshlrdl.cgs deleted file mode 100644 index 89e7077..0000000 --- a/sim/testsuite/sim/sh64/media/mshlrdl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshlrd.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshlrdl -mshlrdl: - mshlrd.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mshlrdw.cgs b/sim/testsuite/sim/sh64/media/mshlrdw.cgs deleted file mode 100644 index 4cbf280..0000000 --- a/sim/testsuite/sim/sh64/media/mshlrdw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for mshlrd.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mshlrdw -mshlrdw: - mshlrd.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/msubl.cgs b/sim/testsuite/sim/sh64/media/msubl.cgs deleted file mode 100644 index 87151fa..0000000 --- a/sim/testsuite/sim/sh64/media/msubl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for msub.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global msubl -msubl: - msub.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/msubsl.cgs b/sim/testsuite/sim/sh64/media/msubsl.cgs deleted file mode 100644 index 014422e..0000000 --- a/sim/testsuite/sim/sh64/media/msubsl.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for msubs.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global msubsl -msubsl: - msubs.l r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/msubsub.cgs b/sim/testsuite/sim/sh64/media/msubsub.cgs deleted file mode 100644 index c92c77e..0000000 --- a/sim/testsuite/sim/sh64/media/msubsub.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for msubs.ub $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global msubsub -msubsub: - msubs.ub r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/msubsw.cgs b/sim/testsuite/sim/sh64/media/msubsw.cgs deleted file mode 100644 index 83b76a1..0000000 --- a/sim/testsuite/sim/sh64/media/msubsw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for msubs.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global msubsw -msubsw: - msubs.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/msubw.cgs b/sim/testsuite/sim/sh64/media/msubw.cgs deleted file mode 100644 index 9d5e639..0000000 --- a/sim/testsuite/sim/sh64/media/msubw.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for msub.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global msubw -msubw: - msub.w r0, r0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/mulsl.cgs b/sim/testsuite/sim/sh64/media/mulsl.cgs deleted file mode 100644 index d65c80c..0000000 --- a/sim/testsuite/sim/sh64/media/mulsl.cgs +++ /dev/null @@ -1,54 +0,0 @@ -# sh testcase for muls.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mulsl -init: - pta wrong, tr0 - -mulsl1: - movi 0, r0 - muls.l r0, r0, r1 - bnei r1, 0, tr0 - -mulsl2: - movi 0, r0 - movi 1, r1 - muls.l r0, r1, r2 - bnei r2, 0, tr0 - -mulsl3: - movi 1, r0 - movi 0, r1 - muls.l r0, r1, r2 - bnei r2, 0, tr0 - -mulsl4: - movi 1, r0 - movi 1, r1 - muls.l r0, r1, r2 - bnei r2, 1, tr0 - -mulsl5: - movi 2, r0 - movi 9, r1 - muls.l r0, r1, r2 - bnei r2, 18, tr0 - -mulsl6: - movi 2, r0 - movi -9, r1 - muls.l r0, r1, r2 - bnei r2, -18, tr0 - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/media/mulul.cgs b/sim/testsuite/sim/sh64/media/mulul.cgs deleted file mode 100644 index b795cf7..0000000 --- a/sim/testsuite/sim/sh64/media/mulul.cgs +++ /dev/null @@ -1,54 +0,0 @@ -# sh testcase for mulu.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global mulul -init: - pta wrong, tr0 - -mulul1: - movi 0, r0 - mulu.l r0, r0, r1 - bnei r1, 0, tr0 - -mulul2: - movi 0, r0 - movi 1, r1 - mulu.l r0, r1, r2 - bnei r2, 0, tr0 - -mulul3: - movi 1, r0 - movi 0, r1 - mulu.l r0, r1, r2 - bnei r2, 0, tr0 - -mulul4: - movi 1, r0 - movi 1, r1 - mulu.l r0, r1, r2 - bnei r2, 1, tr0 - -mulul5: - movi 2, r0 - movi 9, r1 - mulu.l r0, r1, r2 - bnei r2, 18, tr0 - -mulul6: - movi 2, r0 - movi -9, r1 - mulu.l r0, r1, r2 - beqi r2, -18, tr0 - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/media/nop.cgs b/sim/testsuite/sim/sh64/media/nop.cgs deleted file mode 100644 index a0e5753..0000000 --- a/sim/testsuite/sim/sh64/media/nop.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for nop -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - nop - pass diff --git a/sim/testsuite/sim/sh64/media/nsb.cgs b/sim/testsuite/sim/sh64/media/nsb.cgs deleted file mode 100644 index 8b3cffe..0000000 --- a/sim/testsuite/sim/sh64/media/nsb.cgs +++ /dev/null @@ -1,66 +0,0 @@ -# sh testcase for nsb $rm, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -nsb0: - movi 0, r0 - nsb r0, r1 -check0: - movi 63, r4 - bne r1, r4, tr0 - -nsb1: - # set up a loop target reg. - pta again1, tr1 - # r4 holds the loop count. - movi 62, r4 - movi 1, r0 -again1: - nsb r0, r1 - bne r1, r4, tr0 - # okay? go around again. - shlli r0, 1, r0 - addi r4, -1, r4 - bnei r4, 0, tr1 - -nsb2: - # set up a loop target reg. - pta again2, tr1 - # r4 holds the loop count. - movi 63, r4 - movi -1, r0 -again2: - nsb r0, r1 - bne r1, r4, tr0 - # okay? go around again. - shlli r0, 1, r0 - addi r4, -1, r4 - bnei r4, 0, tr1 - -nsb3: - movi 1, r0 - shlli r0, 63, r0 - nsb r0, r1 -check3: - movi 0, r4 - bne r1, r4, tr0 - -nsb4: - movi 7, r0 - shlli r0, 61, r0 - nsb r0, r1 -check4: - movi 2, r4 - bne r1, r4, tr0 - -okay: - pass -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ocbi.cgs b/sim/testsuite/sim/sh64/media/ocbi.cgs deleted file mode 100644 index b210216..0000000 --- a/sim/testsuite/sim/sh64/media/ocbi.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for ocbi $rm, $disp6x32 -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - ocbi r0, 0 - pass diff --git a/sim/testsuite/sim/sh64/media/ocbp.cgs b/sim/testsuite/sim/sh64/media/ocbp.cgs deleted file mode 100644 index 9158c6f..0000000 --- a/sim/testsuite/sim/sh64/media/ocbp.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for ocbp $rm, $disp6x32 -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - ocbp r0, 0 - pass diff --git a/sim/testsuite/sim/sh64/media/ocbwb.cgs b/sim/testsuite/sim/sh64/media/ocbwb.cgs deleted file mode 100644 index 6addabc..0000000 --- a/sim/testsuite/sim/sh64/media/ocbwb.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for ocbwb $rm, $disp6x32 -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - ocbwb r0, 0 - pass diff --git a/sim/testsuite/sim/sh64/media/or.cgs b/sim/testsuite/sim/sh64/media/or.cgs deleted file mode 100644 index e067592..0000000 --- a/sim/testsuite/sim/sh64/media/or.cgs +++ /dev/null @@ -1,44 +0,0 @@ -# sh testcase for or $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -or1: - movi 0, r0 - or r0, r0, r1 - bnei r1, 0, tr0 - -or2: - movi 0, r0 - movi 1, r1 - or r0, r1, r2 - bnei r2, 1, tr0 - -or3: - movi 1, r0 - movi 0, r1 - or r0, r1, r2 - bnei r2, 1, tr0 - -or4: - movi 1, r0 - or r0, r0, r1 - bnei r1, 1, tr0 - -or5: - movi 1, r0 - shlli r0, 63, r0 - movi 1, r1 - or r0, r1, r2 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/ori.cgs b/sim/testsuite/sim/sh64/media/ori.cgs deleted file mode 100644 index 7b25542..0000000 --- a/sim/testsuite/sim/sh64/media/ori.cgs +++ /dev/null @@ -1,41 +0,0 @@ -# sh testcase for ori $rm, $imm10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -or1: - movi 0, r0 - ori r0, 0, r1 - bnei r1, 0, tr0 - -or2: - movi 0, r0 - ori r0, 1, r2 - bnei r2, 1, tr0 - -or3: - movi 1, r0 - ori r0, 0, r2 - bnei r2, 1, tr0 - -or4: - movi 1, r0 - ori r0, 1, r1 - bnei r1, 1, tr0 - -or5: - movi 1, r0 - shlli r0, 63, r0 - ori r0, 1, r2 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/prefi.cgs b/sim/testsuite/sim/sh64/media/prefi.cgs deleted file mode 100644 index 68d7bfe..0000000 --- a/sim/testsuite/sim/sh64/media/prefi.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for prefi $rm, $disp6x32 -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - prefi r0, 0 - pass diff --git a/sim/testsuite/sim/sh64/media/pta.cgs b/sim/testsuite/sim/sh64/media/pta.cgs deleted file mode 100644 index 9f6484a..0000000 --- a/sim/testsuite/sim/sh64/media/pta.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for pta$likely $disp16, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -pta0: - pta foo, tr0 -pta1: - pta/l bar, tr1 -pta2: - pta/u baz, tr2 - movi 0, r0 - bnei r0, 1, tr2 - fail - -foo: -bar: -baz: - pass - fail - fail - fail - fail diff --git a/sim/testsuite/sim/sh64/media/ptabs.cgs b/sim/testsuite/sim/sh64/media/ptabs.cgs deleted file mode 100644 index 0c01f83..0000000 --- a/sim/testsuite/sim/sh64/media/ptabs.cgs +++ /dev/null @@ -1,25 +0,0 @@ -# sh testcase for ptabs$likely $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global ptabs -ptabs: - movi 16, r0 - shlli r0, 8, r0 - # Add one to stay in SHmedia mode. - addi r0, 29, r0 - ptabs r0, tr0 - - # Now jump. - beqi r63, 0, tr0 - -wrong: - fail - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/ptb.cgs b/sim/testsuite/sim/sh64/media/ptb.cgs deleted file mode 100644 index 129d626..0000000 --- a/sim/testsuite/sim/sh64/media/ptb.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for ptb$likely $disp16, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -ptb0: - ptb foo, tr0 -ptb: - ptb/l bar, tr1 -ptb2: - ptb/u baz, tr2 - movi 0, r0 - bnei r0, 1, tr2 - fail - -.mode SHcompact - -foo: -bar: -baz: - trapa #253 - trapa #254 - trapa #254 - trapa #254 - trapa #254 diff --git a/sim/testsuite/sim/sh64/media/ptrel.cgs b/sim/testsuite/sim/sh64/media/ptrel.cgs deleted file mode 100644 index 7e5f19b..0000000 --- a/sim/testsuite/sim/sh64/media/ptrel.cgs +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for ptrel$likely $rn, $tra -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - # Add one to stay in SHmedia mode. - movi 53, r0 - ptrel r0, tr0 - movi 0, r0 - # Always branch. - bnei r0, 1, tr0 - fail - fail - fail - fail - fail - pass - fail - fail diff --git a/sim/testsuite/sim/sh64/media/putcfg.cgs b/sim/testsuite/sim/sh64/media/putcfg.cgs deleted file mode 100644 index 8538575..0000000 --- a/sim/testsuite/sim/sh64/media/putcfg.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for putcfg $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - putcfg r0, 0, r0 - pass diff --git a/sim/testsuite/sim/sh64/media/putcon.cgs b/sim/testsuite/sim/sh64/media/putcon.cgs deleted file mode 100644 index 39dfc03..0000000 --- a/sim/testsuite/sim/sh64/media/putcon.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for putcon $rm, $crj -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -putcon1: - movi 22, r0 - putcon r0, cr0 - getcon cr0, r1 - bne r0, r1, tr0 - -putcon2: - movi 12, r0 - shlli r0, 35, r0 - putcon r0, cr20 - getcon cr20, r20 - bne r0, r20, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/rte.cgs b/sim/testsuite/sim/sh64/media/rte.cgs deleted file mode 100644 index e80f085..0000000 --- a/sim/testsuite/sim/sh64/media/rte.cgs +++ /dev/null @@ -1,11 +0,0 @@ -# sh testcase for rte -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - # Unimplemented. - rte - pass diff --git a/sim/testsuite/sim/sh64/media/shard.cgs b/sim/testsuite/sim/sh64/media/shard.cgs deleted file mode 100644 index 029e529..0000000 --- a/sim/testsuite/sim/sh64/media/shard.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for shard $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shard1: - movi 128, r0 - movi 3, r1 - shard r0, r1, r2 - bnei r2, 16, tr0 - -shard2: - movi -4, r0 - movi 2, r1 - shard r0, r1, r2 - addi r2, 1, r2 - bnei r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shardl.cgs b/sim/testsuite/sim/sh64/media/shardl.cgs deleted file mode 100644 index d9acaa5..0000000 --- a/sim/testsuite/sim/sh64/media/shardl.cgs +++ /dev/null @@ -1,45 +0,0 @@ -# sh testcase for shard.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shardl1: - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - movi 1, r1 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - shard.l r0, r1, r0 - movi 20, r1 - shard.l r0, r1, r0 - bnei r0, 5, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shari.cgs b/sim/testsuite/sim/sh64/media/shari.cgs deleted file mode 100644 index 3d3a650..0000000 --- a/sim/testsuite/sim/sh64/media/shari.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for shari $rm, $imm, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shari1: - movi 128, r0 - shari r0, 3, r2 - bnei r2, 16, tr0 - -shari2: - movi -4, r0 - shari r0, 2, r2 - addi r2, 1, r2 - bnei r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/sharil.cgs b/sim/testsuite/sim/sh64/media/sharil.cgs deleted file mode 100644 index be946e0..0000000 --- a/sim/testsuite/sim/sh64/media/sharil.cgs +++ /dev/null @@ -1,45 +0,0 @@ -# sh testcase for shari.l $rm, $imm6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -sharil1: - movi 0x1020, r0 - shlli r0, 8, r0 - ori r0, 0x30, r0 - shlli r0, 8, r0 - ori r0, 0x40, r0 - shlli r0, 8, r0 - ori r0, 0x50, r0 - shlli r0, 8, r0 - ori r0, 0x60, r0 - shlli r0, 8, r0 - ori r0, 0x70, r0 - shlli r0, 8, r0 - ori r0, 0x80, r0 - - movi 1, r1 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 1, r0 - shari.l r0, 20, r0 - bnei r0, 5, tr0 - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/media/shlld.cgs b/sim/testsuite/sim/sh64/media/shlld.cgs deleted file mode 100644 index 05d2da4..0000000 --- a/sim/testsuite/sim/sh64/media/shlld.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for shlld $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shlld1: - movi 1, r0 - movi 5, r1 - shlld r0, r1, r2 - movi 32, r7 - bne r2, r7, tr0 - -shlld2: - movi 2, r1 - shlld r2, r1, r3 - movi 128, r7 - bne r3, r7, tr0 - -shlld3: - movi 32, r1 - shlld r0, r1, r7 - shlld r7, r1, r2 - bnei r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shlldl.cgs b/sim/testsuite/sim/sh64/media/shlldl.cgs deleted file mode 100644 index 3d37f53..0000000 --- a/sim/testsuite/sim/sh64/media/shlldl.cgs +++ /dev/null @@ -1,34 +0,0 @@ -# sh testcase for shlld.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -shlldl1: - movi 1, r0 - shlli r0, 32, r0 - ori r0, 1, r0 - movi 1, r1 - shlli r1, 7, r1 - ori r1, 3, r1 - - shlld.l r0, r1, r2 - -check1: - bnei r2, 8, tr0 - -shlldl2: - movi 1, r0 - movi 31, r1 - shlld.l r0, r1, r2 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shlli.cgs b/sim/testsuite/sim/sh64/media/shlli.cgs deleted file mode 100644 index 9ab331c..0000000 --- a/sim/testsuite/sim/sh64/media/shlli.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for shlli $rm, $imm6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shlli: - movi 1, r0 - shlli r0, 3, r0 - bnei r0, 8, tr0 - -shlli2: - shlli r0, 3, r0 - -shlli3: - # Shift all bits out of sight. - shlli r0, 63, r0 - bnei r0, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shllil.cgs b/sim/testsuite/sim/sh64/media/shllil.cgs deleted file mode 100644 index 347acd6..0000000 --- a/sim/testsuite/sim/sh64/media/shllil.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for shlli.l $rm, $imm6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global shllil -shllil: - shlli.l r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/shlrd.cgs b/sim/testsuite/sim/sh64/media/shlrd.cgs deleted file mode 100644 index 56f10bf..0000000 --- a/sim/testsuite/sim/sh64/media/shlrd.cgs +++ /dev/null @@ -1,30 +0,0 @@ -# sh testcase for shlrd $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shlrd1: - movi 128, r0 - movi 3, r1 - shlrd r0, r1, r2 - bnei r2, 16, tr0 - -shlrd2: - movi -4, r0 - movi 2, r1 - shlrd r0, r1, r2 - addi r2, 1, r2 - beqi r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shlrdl.cgs b/sim/testsuite/sim/sh64/media/shlrdl.cgs deleted file mode 100644 index 32b20c0..0000000 --- a/sim/testsuite/sim/sh64/media/shlrdl.cgs +++ /dev/null @@ -1,37 +0,0 @@ -# sh testcase for shlrd.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shlrdl1: - movi 1, r0 - shlli r0, 32, r0 - ori r0, 8, r0 - movi 1, r1 - shlli r1, 7, r1 - ori r1, 3, r1 - - shlrd.l r0, r1, r2 - -check1: - bnei r2, 1, tr0 - -shlrdl2: - movi 1, r0 - shlli r0, 31, r0 - movi 31, r1 - shlld.l r0, r1, r2 - bnei r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shlri.cgs b/sim/testsuite/sim/sh64/media/shlri.cgs deleted file mode 100644 index 488cac9..0000000 --- a/sim/testsuite/sim/sh64/media/shlri.cgs +++ /dev/null @@ -1,28 +0,0 @@ -# sh testcase for shlri $rm, $imm, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shlri1: - movi 128, r0 - shlri r0, 3, r2 - bnei r2, 16, tr0 - -shlri2: - movi -4, r0 - shlri r0, 2, r2 - addi r2, 1, r2 - beqi r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/shlril.cgs b/sim/testsuite/sim/sh64/media/shlril.cgs deleted file mode 100644 index bb1b2a6..0000000 --- a/sim/testsuite/sim/sh64/media/shlril.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for shlri.l $rm, $imm6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global shlril -shlril: - shlri.l r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/shori.cgs b/sim/testsuite/sim/sh64/media/shori.cgs deleted file mode 100644 index 5f02b7d..0000000 --- a/sim/testsuite/sim/sh64/media/shori.cgs +++ /dev/null @@ -1,35 +0,0 @@ -# sh testcase for shori $imm16, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -shori1: - movi 1, r0 - shori 7, r0 - # check it. - andi r0, 15, r7 - bnei r7, 7, tr0 - shlri r0, 16, r0 - bnei r0, 1, tr0 - -shori2: - # Test for zero extension bug reported by - # Alexandre Oliva . - movi 0, r0 - shori 65535, r0 - # check it. - movi 0xffff, r1 - bne r0, r1, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/sleep.cgs b/sim/testsuite/sim/sh64/media/sleep.cgs deleted file mode 100644 index b4c35ee..0000000 --- a/sim/testsuite/sim/sh64/media/sleep.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for sleep -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - sleep - pass diff --git a/sim/testsuite/sim/sh64/media/stb.cgs b/sim/testsuite/sim/sh64/media/stb.cgs deleted file mode 100644 index 09de47b..0000000 --- a/sim/testsuite/sim/sh64/media/stb.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for st.b $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stb1: - st.b r0, 0, r7 - -stb2: - st.b r0, 1, r7 - -stb3: - st.b r0, -1, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/sthil.cgs b/sim/testsuite/sim/sh64/media/sthil.cgs deleted file mode 100644 index cfee284..0000000 --- a/sim/testsuite/sim/sh64/media/sthil.cgs +++ /dev/null @@ -1,55 +0,0 @@ -# sh testcase for sthi.l $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - - movi 40, r0 - shlli r0, 8, r0 - - movi 0x1020, r1 - shlli r1, 8, r1 - addi r1, 0x30, r1 - shlli r1, 8, r1 - addi r1, 0x40, r1 - shlli r1, 8, r1 - addi r1, 0x50, r1 - shlli r1, 8, r1 - addi r1, 0x60, r1 - shlli r1, 8, r1 - addi r1, 0x70, r1 - shlli r1, 8, r1 - addi r1, 0x80, r1 - -sthil1: - sthi.l r0, 0, r1 - -sthil2: - sthi.l r0, 1, r1 - -sthil3: - sthi.l r0, 2, r1 - -sthil4: - sthi.l r0, 3, r1 - -sthil5: - sthi.l r0, -1, r1 - -sthil6: - sthi.l r0, -2, r1 - -sthil7: - sthi.l r0, -3, r1 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/sthiq.cgs b/sim/testsuite/sim/sh64/media/sthiq.cgs deleted file mode 100644 index 6310d43..0000000 --- a/sim/testsuite/sim/sh64/media/sthiq.cgs +++ /dev/null @@ -1,79 +0,0 @@ -# sh testcase for sthi.q $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - - movi 40, r0 - shlli r0, 8, r0 - - movi 0x1020, r1 - shlli r1, 8, r1 - addi r1, 0x30, r1 - shlli r1, 8, r1 - addi r1, 0x40, r1 - shlli r1, 8, r1 - addi r1, 0x50, r1 - shlli r1, 8, r1 - addi r1, 0x60, r1 - shlli r1, 8, r1 - addi r1, 0x70, r1 - shlli r1, 8, r1 - addi r1, 0x80, r1 - -sthiq1: - sthi.q r0, 0, r1 - -sthiq2: - sthi.q r0, 1, r1 - -sthiq3: - sthi.q r0, 2, r1 - -sthiq4: - sthi.q r0, 3, r1 - -sthiq5: - sthi.q r0, 4, r1 - -sthiq6: - sthi.q r0, 5, r1 - -sthiq7: - sthi.q r0, 6, r1 - -sthiq8: - sthi.q r0, 7, r1 - -sthiq9: - sthi.q r0, -1, r1 - -sthiq10: - sthi.q r0, -2, r1 - -sthiq11: - sthi.q r0, -3, r1 - -sthiq12: - sthi.q r0, -4, r1 - -sthiq13: - sthi.q r0, -5, r1 - -sthiq14: - sthi.q r0, -6, r1 - -sthiq15: - sthi.q r0, -7, r1 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/stl.cgs b/sim/testsuite/sim/sh64/media/stl.cgs deleted file mode 100644 index 8737e35..0000000 --- a/sim/testsuite/sim/sh64/media/stl.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for st.l $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stl1: - st.l r0, 0, r7 - -stl2: - st.l r0, 4, r7 - -stl3: - st.l r0, -4, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/stlol.cgs b/sim/testsuite/sim/sh64/media/stlol.cgs deleted file mode 100644 index f2d9055..0000000 --- a/sim/testsuite/sim/sh64/media/stlol.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for stlo.l $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global stlol -stlol: - stlo.l r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/stloq.cgs b/sim/testsuite/sim/sh64/media/stloq.cgs deleted file mode 100644 index 35c84c2..0000000 --- a/sim/testsuite/sim/sh64/media/stloq.cgs +++ /dev/null @@ -1,14 +0,0 @@ -# sh testcase for stlo.q $rm, $disp6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - - .global stloq -stloq: - stlo.q r0, 0, r0 - - pass diff --git a/sim/testsuite/sim/sh64/media/stq.cgs b/sim/testsuite/sim/sh64/media/stq.cgs deleted file mode 100644 index e1af795..0000000 --- a/sim/testsuite/sim/sh64/media/stq.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for st.q $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stq1: - st.q r0, 0, r7 - -stq2: - st.q r0, 8, r7 - -stq3: - st.q r0, -8, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/stw.cgs b/sim/testsuite/sim/sh64/media/stw.cgs deleted file mode 100644 index 2446aa6..0000000 --- a/sim/testsuite/sim/sh64/media/stw.cgs +++ /dev/null @@ -1,26 +0,0 @@ -# sh testcase for st.q $rm, $disp10, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stw1: - st.w r0, 0, r7 - -stw2: - st.w r0, 2, r7 - -stw3: - st.w r0, -2, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/stxb.cgs b/sim/testsuite/sim/sh64/media/stxb.cgs deleted file mode 100644 index 8ab2ae3..0000000 --- a/sim/testsuite/sim/sh64/media/stxb.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for stx.b $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stxb1: - movi 0, r1 - stx.b r0, r1, r7 - -stxb2: - movi 1, r1 - stx.b r0, r1, r7 - -stxb3: - movi -1, r1 - stx.b r0, r1, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/stxl.cgs b/sim/testsuite/sim/sh64/media/stxl.cgs deleted file mode 100644 index 8ed2e36..0000000 --- a/sim/testsuite/sim/sh64/media/stxl.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for stx.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stxl1: - movi 0, r1 - stx.l r0, r1, r7 - -stxl2: - movi 4, r1 - stx.l r0, r1, r7 - -stxl3: - movi -4, r1 - stx.l r0, r1, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/stxq.cgs b/sim/testsuite/sim/sh64/media/stxq.cgs deleted file mode 100644 index 10759fd..0000000 --- a/sim/testsuite/sim/sh64/media/stxq.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for stx.q $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stxq1: - movi 0, r1 - stx.q r0, r1, r7 - -stxq2: - movi 8, r1 - stx.q r0, r1, r7 - -stxq3: - movi -8, r1 - stx.q r0, r1, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/stxw.cgs b/sim/testsuite/sim/sh64/media/stxw.cgs deleted file mode 100644 index d039811..0000000 --- a/sim/testsuite/sim/sh64/media/stxw.cgs +++ /dev/null @@ -1,29 +0,0 @@ -# sh testcase for stx.w $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - movi -1, r7 - xori r7, 13, r7 - movi 40, r0 - shlli r0, 8, r0 - -stxw1: - movi 0, r1 - stx.w r0, r1, r7 - -stxw2: - movi 2, r1 - stx.w r0, r1, r7 - -stxw3: - movi -2, r1 - stx.w r0, r1, r7 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/sub.cgs b/sim/testsuite/sim/sh64/media/sub.cgs deleted file mode 100644 index e5e7530..0000000 --- a/sim/testsuite/sim/sh64/media/sub.cgs +++ /dev/null @@ -1,42 +0,0 @@ -# sh testcase for sub $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - movi 0, r0 - movi 1, r1 - -sub1: - # 0 - 0 = 0. - sub r0, r0, r2 - bnei r2, 0, tr0 - -sub2: - # 1 - 0 = 1. - sub r1, r0, r2 - bnei r2, 1, tr0 - -sub3: - # 0 - 1 = -1. - sub r0, r1, r2 - addi r2, 1, r2 - bnei r2, 0, tr0 - -sub4: - # 5 - 2 = 3. - movi 5, r0 - movi 2, r1 - sub r0, r1, r2 - bnei r2, 3, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/subl.cgs b/sim/testsuite/sim/sh64/media/subl.cgs deleted file mode 100644 index 98abe59..0000000 --- a/sim/testsuite/sim/sh64/media/subl.cgs +++ /dev/null @@ -1,38 +0,0 @@ -# sh testcase for sub.l $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - -init: - pta wrong, tr0 - -subl1: - # Test that the top 32 bits are ignored. - movi 1, r0 - shlli r0, 32, r0 - ori r0, 7, r0 - - movi 1, r1 - shlli r1, 32, r1 - ori r1, 2, r1 - - sub.l r0, r1, r2 - bnei r2, 5, tr0 - -subl2: - # Test that 0 - 1 is sign extended. - movi 0, r0 - movi 1, r1 - sub.l r0, r1, r2 - addi r2, 1, r2 - bnei r2, 0, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/media/swapq.cgs b/sim/testsuite/sim/sh64/media/swapq.cgs deleted file mode 100644 index 6f168b1..0000000 --- a/sim/testsuite/sim/sh64/media/swapq.cgs +++ /dev/null @@ -1,36 +0,0 @@ -# sh testcase for swap.q $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - movi 10, r0 - shlli r0, 8, r0 - ori r0, 20, r0 - shlli r0, 8, r0 - ori r0, 30, r0 - shlli r0, 8, r0 - ori r0, 40, r0 - shlli r0, 8, r0 - ori r0, 50, r0 - shlli r0, 8, r0 - ori r0, 60, r0 - shlli r0, 8, r0 - ori r0, 70, r0 - shlli r0, 8, r0 - ori r0, 80, r0 - - # Set up two address operands. - - movi 40, r1 - shlli r1, 8, r1 - movi 8, r2 - -swapq: - swap.q r1, r2, r0 - -okay: - pass diff --git a/sim/testsuite/sim/sh64/media/synci.cgs b/sim/testsuite/sim/sh64/media/synci.cgs deleted file mode 100644 index 65e0621..0000000 --- a/sim/testsuite/sim/sh64/media/synci.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for synci -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - synci - pass diff --git a/sim/testsuite/sim/sh64/media/synco.cgs b/sim/testsuite/sim/sh64/media/synco.cgs deleted file mode 100644 index 2db6df3..0000000 --- a/sim/testsuite/sim/sh64/media/synco.cgs +++ /dev/null @@ -1,10 +0,0 @@ -# sh testcase for synco -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - synco - pass diff --git a/sim/testsuite/sim/sh64/media/testutils.inc b/sim/testsuite/sim/sh64/media/testutils.inc deleted file mode 100644 index d3b383a..0000000 --- a/sim/testsuite/sim/sh64/media/testutils.inc +++ /dev/null @@ -1,51 +0,0 @@ -# Support macros for the assembly test cases. - - .macro start - .text - .global start -start: - .endm - - .macro pass - movi 253, r0 - trapa r0 - .endm - - .macro fail - movi 254, r0 - trapa r0 - .endm - - .macro _packb v1 v2 v3 v4 v5 v6 v7 v8 reg - movi \v1, \reg - shlli \reg, 8, \reg - addi \reg, \v2, \reg - shlli \reg, 8, \reg - addi \reg, \v3, \reg - shlli \reg, 8, \reg - addi \reg, \v4, \reg - shlli \reg, 8, \reg - addi \reg, \v5, \reg - shlli \reg, 8, \reg - addi \reg, \v6, \reg - shlli \reg, 8, \reg - addi \reg, \v7, \reg - shlli \reg, 8, \reg - addi \reg, \v8, \reg - .endm - - .macro _packw v1 v2 v3 v4 reg - movi \v1, \reg - shlli \reg, 16, \reg - addi \reg, \v2, \reg - shlli \reg, 16, \reg - addi \reg, \v3, \reg - shlli \reg, 16, \reg - addi \reg, \v4, \reg - .endm - - .macro _packl v1 v2 reg - movi \v1, \reg - shlli \reg, 32, \reg - addi \reg, \v2, \reg - .endm diff --git a/sim/testsuite/sim/sh64/media/trapa.cgs b/sim/testsuite/sim/sh64/media/trapa.cgs deleted file mode 100644 index c961bac..0000000 --- a/sim/testsuite/sim/sh64/media/trapa.cgs +++ /dev/null @@ -1,11 +0,0 @@ -# sh testcase for trapa $rm -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start - # This performs a trap to emit "pass". - movi 253, r0 - trapa r0 diff --git a/sim/testsuite/sim/sh64/media/xor.cgs b/sim/testsuite/sim/sh64/media/xor.cgs deleted file mode 100644 index 80278f0..0000000 --- a/sim/testsuite/sim/sh64/media/xor.cgs +++ /dev/null @@ -1,54 +0,0 @@ -# sh testcase for xor $rm, $rn, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -xor1: - # 0 xor 0 = 0. - movi 0, r0 - movi 0, r1 - xor r0, r1, r2 - bnei r2, 0, tr0 - -xor2: - # 0 xor 1 = 1. - movi 0, r0 - movi 1, r1 - xor r0, r1, r2 - bnei r2, 1, tr0 - -xor3: - # 1 xor 0 = 1. - movi 1, r0 - movi 0, r1 - xor r0, r1, r2 - bnei r2, 1, tr0 - -xor4: - # 1 xor 1 = 0. - movi 1, r0 - movi 1, r1 - xor r0, r1, r2 - bnei r2, 0, tr0 - -xor5: - movi 1, r0 - shlli r0, 63, r0 - ori r0, 1, r0 - movi 3, r1 - xor r0, r1, r2 - andi r2, 255, r2 - bnei r2, 2, tr0 - -okay: - pass - -wrong: - fail - diff --git a/sim/testsuite/sim/sh64/media/xori.cgs b/sim/testsuite/sim/sh64/media/xori.cgs deleted file mode 100644 index 0d4d96a..0000000 --- a/sim/testsuite/sim/sh64/media/xori.cgs +++ /dev/null @@ -1,48 +0,0 @@ -# sh testcase for xori $rm, $imm6, $rd -*- Asm -*- -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - - .include "media/testutils.inc" - - start -init: - pta wrong, tr0 - -xori1: - # 0 xor 0 = 0. - movi 0, r0 - xori r0, 0, r2 - bnei r2, 0, tr0 - -xori2: - # 0 xor 1 = 1. - movi 0, r0 - xori r0, 1, r2 - bnei r2, 1, tr0 - -xori3: - # 1 xor 0 = 1. - movi 1, r0 - xori r0, 0, r2 - bnei r2, 1, tr0 - -xori4: - # 1 xor 1 = 0. - movi 1, r0 - xori r0, 1, r2 - bnei r2, 0, tr0 - -xori5: - movi 1, r0 - shlli r0, 63, r0 - ori r0, 1, r0 - xori r0, 3, r2 - andi r2, 255, r2 - bnei r2, 2, tr0 - -okay: - pass - -wrong: - fail diff --git a/sim/testsuite/sim/sh64/misc/fr-dr.s b/sim/testsuite/sim/sh64/misc/fr-dr.s deleted file mode 100644 index 52f0e13..0000000 --- a/sim/testsuite/sim/sh64/misc/fr-dr.s +++ /dev/null @@ -1,22 +0,0 @@ -# sh testcase for floating point register shared state (see below). -# mach: all -# as: -isa=shmedia -# ld: -m shelf64 - -# (fr, dr, fp, fv amd mtrx provide different views of the same architecrual state). -# Hitachi SH-5 CPU volume 1, p. 15. - - .include "media/testutils.inc" - - start - - movi 42, r0 - fmov.ls r0, fr12 - # save this reg. - fmov.s fr12, fr14 - - movi 42, r0 - fmov.qd r0, dr12 - -okay: - pass