diff options
author | nobody <> | 2004-02-14 00:00:34 +0000 |
---|---|---|
committer | nobody <> | 2004-02-14 00:00:34 +0000 |
commit | 2f344a4dcd2a8c4297702027a943e3587e6b60c8 (patch) | |
tree | 8614f4d9fc669ec37a90e4b4f70b31f00c489661 | |
parent | a5dd37ab655106440e987830db5111b43f271ecc (diff) | |
download | fsf-binutils-gdb-cagney_bfdfile-20040213-branchpoint.zip fsf-binutils-gdb-cagney_bfdfile-20040213-branchpoint.tar.gz fsf-binutils-gdb-cagney_bfdfile-20040213-branchpoint.tar.bz2 |
This commit was manufactured by cvs2svn to create branchcagney_bfdfile-20040213-branchpointcagney_bfdfile-20040213-branch
'cagney_bfdfile-20040213-branch'.
Sprout from cagney_bigcore-20040122-branch 2004-01-22 00:00:03 UTC nobody 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from master 2004-02-14 00:00:33 UTC gdbadmin <gdbadmin@sourceware.org> '*** empty log message ***':
COPYING.NEWLIB
ChangeLog
Makefile.def
Makefile.in
bfd/ChangeLog
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/bfdio.c
bfd/cache.c
bfd/coff-h8300.c
bfd/config.in
bfd/configure
bfd/configure.in
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-arm.h
bfd/elf32-frv.c
bfd/elf32-h8300.c
bfd/elf64-alpha.c
bfd/elfxx-ia64.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h
bfd/elfxx-target.h
bfd/libbfd-in.h
bfd/libbfd.h
bfd/version.h
binutils/ChangeLog
binutils/readelf.c
configure
configure.in
gas/ChangeLog
gas/config/tc-arm.c
gas/config/tc-ia64.c
gas/config/tc-ia64.h
gas/config/tc-m68k.c
gas/config/tc-m68k.h
gas/config/tc-mips.c
gas/config/tc-mips.h
gas/doc/internals.texi
gas/dwarf2dbg.c
gas/frags.c
gas/frags.h
gas/read.c
gas/read.h
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/arm.exp
gas/testsuite/gas/arm/undefined.l
gas/testsuite/gas/arm/undefined.s
gas/testsuite/gas/macros/test2.s
gas/testsuite/gas/mips/div.d
gas/testsuite/gas/mips/elf-rel-got-n32.d
gas/testsuite/gas/mips/elf-rel-got-n64.d
gas/testsuite/gas/mips/elf-rel-xgot-n32.d
gas/testsuite/gas/mips/elf-rel-xgot-n64.d
gas/testsuite/gas/mips/elf-rel19.d
gas/testsuite/gas/mips/elf-rel19.s
gas/testsuite/gas/mips/la-svr4pic.d
gas/testsuite/gas/mips/la-xgot.d
gas/testsuite/gas/mips/lca-svr4pic.d
gas/testsuite/gas/mips/lca-xgot.d
gas/testsuite/gas/mips/macro-warn-1-n32.d
gas/testsuite/gas/mips/macro-warn-1-n32.l
gas/testsuite/gas/mips/macro-warn-1.d
gas/testsuite/gas/mips/macro-warn-1.l
gas/testsuite/gas/mips/macro-warn-1.s
gas/testsuite/gas/mips/macro-warn-2-n32.d
gas/testsuite/gas/mips/macro-warn-2.d
gas/testsuite/gas/mips/macro-warn-2.l
gas/testsuite/gas/mips/macro-warn-2.s
gas/testsuite/gas/mips/macro-warn-3.d
gas/testsuite/gas/mips/macro-warn-3.l
gas/testsuite/gas/mips/macro-warn-3.s
gas/testsuite/gas/mips/macro-warn-4.d
gas/testsuite/gas/mips/macro-warn-4.l
gas/testsuite/gas/mips/macro-warn-4.s
gas/testsuite/gas/mips/mips.exp
gas/testsuite/gas/mips/relax-swap1-mips2.d
gas/testsuite/gas/mips/relax-swap1.s
gas/testsuite/gas/mips/relax-swap2.s
gas/testsuite/gas/sh/basic.exp
gas/testsuite/gas/sh/err-sh4a-fp.s
gas/testsuite/gas/sh/sh4a-fp.d
gas/testsuite/gas/sh/sh4a-fp.s
gdb/ChangeLog
gdb/Makefile.in
gdb/NEWS
gdb/PROBLEMS
gdb/ada-lang.c
gdb/alpha-tdep.c
gdb/arch-utils.c
gdb/arch-utils.h
gdb/arm-tdep.c
gdb/auxv.c
gdb/auxv.h
gdb/avr-tdep.c
gdb/ax-gdb.c
gdb/bcache.c
gdb/blockframe.c
gdb/breakpoint.c
gdb/breakpoint.h
gdb/buildsym.c
gdb/c-lang.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/coffread.c
gdb/config/mips/tm-linux.h
gdb/config/nm-linux.h
gdb/config/sparc/nm-nbsd.h
gdb/config/sparc/obsd.mt
gdb/config/sparc/obsd64.mt
gdb/configure
gdb/configure.host
gdb/configure.in
gdb/configure.tgt
gdb/corelow.c
gdb/cp-namespace.c
gdb/cp-support.c
gdb/cp-support.h
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/dbxread.c
gdb/defs.h
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/doc/gdbint.texinfo
gdb/doc/stabs.texinfo
gdb/dwarf2-frame.c
gdb/dwarf2-frame.h
gdb/dwarf2loc.c
gdb/dwarf2loc.h
gdb/dwarf2read.c
gdb/dwarfread.c
gdb/elfread.c
gdb/f-lang.c
gdb/findvar.c
gdb/frame.c
gdb/frame.h
gdb/frv-tdep.c
gdb/gdb-events.h
gdb/gdb-events.sh
gdb/gdb_curses.h
gdb/gdb_obstack.h
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/gdbserver/linux-low.h
gdb/gdbserver/regcache.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/hpread.c
gdb/i386-linux-tdep.c
gdb/i386-nto-tdep.c
gdb/ia64-tdep.c
gdb/infcmd.c
gdb/infrun.c
gdb/inftarg.c
gdb/jv-lang.c
gdb/language.c
gdb/language.h
gdb/linespec.c
gdb/linux-proc.c
gdb/m2-lang.c
gdb/m32r-rom.c
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/m68klinux-tdep.c
gdb/main.c
gdb/mcore-tdep.c
gdb/mdebugread.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-cmds.h
gdb/minsyms.c
gdb/mips-linux-nat.c
gdb/mips-linux-tdep.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/ns32k-tdep.c
gdb/objc-lang.c
gdb/objfiles.c
gdb/objfiles.h
gdb/osabi.c
gdb/p-lang.c
gdb/pa64solib.c
gdb/printcmd.c
gdb/proc-api.c
gdb/procfs.c
gdb/regcache.c
gdb/remote-fileio.c
gdb/remote-rdi.c
gdb/remote-sim.c
gdb/remote.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/scm-lang.c
gdb/ser-pipe.c
gdb/sh-tdep.c
gdb/sh64-tdep.c
gdb/sol-thread.c
gdb/solib-sunos.c
gdb/somread.c
gdb/somsolib.c
gdb/source.c
gdb/sparc-nat.c
gdb/sparc-tdep.c
gdb/sparc-tdep.h
gdb/sparc64-tdep.h
gdb/sparc64nbsd-tdep.c
gdb/sparc64obsd-tdep.c
gdb/sparcnbsd-tdep.c
gdb/sparcobsd-tdep.c
gdb/stabsread.c
gdb/stack.c
gdb/symfile.c
gdb/symfile.h
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/target.h
gdb/testsuite/ChangeLog
gdb/testsuite/config/sim.exp
gdb/testsuite/gdb.arch/gdb1291.c
gdb/testsuite/gdb.arch/gdb1431.c
gdb/testsuite/gdb.asm/asm-source.exp
gdb/testsuite/gdb.asm/ia64.inc
gdb/testsuite/gdb.asm/openbsd.inc
gdb/testsuite/gdb.base/Makefile.in
gdb/testsuite/gdb.base/bang.exp
gdb/testsuite/gdb.base/call-ar-st.exp
gdb/testsuite/gdb.base/charset.c
gdb/testsuite/gdb.base/chng-syms.c
gdb/testsuite/gdb.base/chng-syms.exp
gdb/testsuite/gdb.base/completion.exp
gdb/testsuite/gdb.base/dump.c
gdb/testsuite/gdb.base/dump.exp
gdb/testsuite/gdb.base/fileio.c
gdb/testsuite/gdb.base/finish.exp
gdb/testsuite/gdb.base/gcore.exp
gdb/testsuite/gdb.base/huge.c
gdb/testsuite/gdb.base/huge.exp
gdb/testsuite/gdb.base/info-proc.exp
gdb/testsuite/gdb.base/langs.exp
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/gdb.base/pending.c
gdb/testsuite/gdb.base/pending.exp
gdb/testsuite/gdb.base/pendshr.c
gdb/testsuite/gdb.base/return2.exp
gdb/testsuite/gdb.base/shlib-call.exp
gdb/testsuite/gdb.cp/ambiguous.exp
gdb/testsuite/gdb.cp/annota2.exp
gdb/testsuite/gdb.cp/annota3.exp
gdb/testsuite/gdb.cp/anon-union.exp
gdb/testsuite/gdb.cp/breakpoint.cc
gdb/testsuite/gdb.cp/breakpoint.exp
gdb/testsuite/gdb.cp/bs15503.cc
gdb/testsuite/gdb.cp/casts.exp
gdb/testsuite/gdb.cp/class2.cc
gdb/testsuite/gdb.cp/classes.exp
gdb/testsuite/gdb.cp/cplusfuncs.exp
gdb/testsuite/gdb.cp/ctti.exp
gdb/testsuite/gdb.cp/cttiadd.cc
gdb/testsuite/gdb.cp/cttiadd1.cc
gdb/testsuite/gdb.cp/cttiadd2.cc
gdb/testsuite/gdb.cp/cttiadd3.cc
gdb/testsuite/gdb.cp/demangle.exp
gdb/testsuite/gdb.cp/derivation.exp
gdb/testsuite/gdb.cp/exception.cc
gdb/testsuite/gdb.cp/exception.exp
gdb/testsuite/gdb.cp/hang.exp
gdb/testsuite/gdb.cp/inherit.exp
gdb/testsuite/gdb.cp/local.exp
gdb/testsuite/gdb.cp/maint.exp
gdb/testsuite/gdb.cp/member-ptr.cc
gdb/testsuite/gdb.cp/member-ptr.exp
gdb/testsuite/gdb.cp/method.exp
gdb/testsuite/gdb.cp/misc.exp
gdb/testsuite/gdb.cp/namespace.cc
gdb/testsuite/gdb.cp/namespace.exp
gdb/testsuite/gdb.cp/namespace1.cc
gdb/testsuite/gdb.cp/overload.cc
gdb/testsuite/gdb.cp/overload.exp
gdb/testsuite/gdb.cp/ovldbreak.exp
gdb/testsuite/gdb.cp/psmang.exp
gdb/testsuite/gdb.cp/ref-types.exp
gdb/testsuite/gdb.cp/rtti.exp
gdb/testsuite/gdb.cp/rtti1.cc
gdb/testsuite/gdb.cp/templates.exp
gdb/testsuite/gdb.cp/userdef.exp
gdb/testsuite/gdb.cp/virtfunc.exp
gdb/testsuite/gdb.mi/mi-stack.exp
gdb/testsuite/gdb.mi/mi-var-child.exp
gdb/testsuite/gdb.objc/basicclass.exp
gdb/testsuite/gdb.threads/gcore-thread.exp
gdb/testsuite/gdb.threads/thread-specific.c
gdb/testsuite/gdb.threads/thread-specific.exp
gdb/testsuite/lib/compiler.c
gdb/testsuite/lib/compiler.cc
gdb/testsuite/lib/gdb.exp
gdb/tui/tui-command.c
gdb/tui/tui-data.c
gdb/tui/tui-data.h
gdb/tui/tui-disasm.c
gdb/tui/tui-file.c
gdb/tui/tui-hooks.c
gdb/tui/tui-hooks.h
gdb/tui/tui-interp.c
gdb/tui/tui-io.c
gdb/tui/tui-layout.c
gdb/tui/tui-layout.h
gdb/tui/tui-regs.c
gdb/tui/tui-regs.h
gdb/tui/tui-source.c
gdb/tui/tui-source.h
gdb/tui/tui-stack.c
gdb/tui/tui-stack.h
gdb/tui/tui-win.c
gdb/tui/tui-win.h
gdb/tui/tui-windata.c
gdb/tui/tui-windata.h
gdb/tui/tui-wingeneral.c
gdb/tui/tui-wingeneral.h
gdb/tui/tui-winsource.c
gdb/tui/tui-winsource.h
gdb/tui/tui.c
gdb/tui/tui.h
gdb/utils.c
gdb/v850-tdep.c
gdb/valops.c
gdb/values.c
gdb/vax-tdep.c
gdb/version.in
gdb/xcoffread.c
gdb/xstormy16-tdep.c
include/elf/ChangeLog
include/elf/common.h
include/opcode/ChangeLog
include/opcode/h8300.h
ld/ChangeLog
ld/emulparams/armelf.sh
ld/emulparams/armelf_linux.sh
ld/emulparams/elf32bmip.sh
ld/emulparams/elf32bmipn32.sh
ld/emulparams/elf32btsmipn32.sh
ld/emulparams/elf64_ia64.sh
ld/emulparams/shlelf_linux.sh
ld/emultempl/pe.em
ld/genscripts.sh
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-app-abs32.d
ld/testsuite/ld-arm/arm-app-abs32.r
ld/testsuite/ld-arm/arm-app-abs32.s
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-h8300/h8300.exp
ld/testsuite/ld-h8300/relax-5-coff.d
ld/testsuite/ld-h8300/relax-5.d
ld/testsuite/ld-h8300/relax-5.s
libiberty/ChangeLog
libiberty/Makefile.in
libiberty/configure
libiberty/configure.ac
libiberty/getpwd.c
libiberty/maint-tool
opcodes/ChangeLog
opcodes/m32r-dis.c
opcodes/sh-opc.h
readline/ChangeLog.gdb
readline/bind.c
readline/mbutil.c
readline/readline.c
readline/vi_mode.c
sim/ChangeLog
sim/configure
sim/configure.in
sim/m32r/ChangeLog
sim/m32r/mloop2.in
sim/m32r/mloopx.in
sim/ppc/ChangeLog
sim/ppc/ppc-instructions
sim/sh/ChangeLog
sim/sh/gencode.c
sim/sh/interp.c
sim/testsuite/ChangeLog
sim/testsuite/lib/sim-defs.exp
sim/testsuite/sim/mips/ChangeLog
sim/testsuite/sim/mips/basic.exp
sim/testsuite/sim/mips/sanity.s
sim/testsuite/sim/mips/testutils.inc
sim/testsuite/sim/sh/ChangeLog
sim/testsuite/sim/sh/allinsn.exp
sim/testsuite/sim/sh/and.s
sim/testsuite/sim/sh/movi.s
sim/testsuite/sim/sh/sett.s
sim/testsuite/sim/sh/testutils.inc
Delete:
gdb/testsuite/gdb.mi/mi1-basics.exp
gdb/testsuite/gdb.mi/mi1-break.exp
gdb/testsuite/gdb.mi/mi1-console.exp
gdb/testsuite/gdb.mi/mi1-disassemble.exp
gdb/testsuite/gdb.mi/mi1-eval.exp
gdb/testsuite/gdb.mi/mi1-hack-cli.exp
gdb/testsuite/gdb.mi/mi1-pthreads.exp
gdb/testsuite/gdb.mi/mi1-read-memory.exp
gdb/testsuite/gdb.mi/mi1-regs.exp
gdb/testsuite/gdb.mi/mi1-return.exp
gdb/testsuite/gdb.mi/mi1-simplerun.exp
gdb/testsuite/gdb.mi/mi1-stack.exp
gdb/testsuite/gdb.mi/mi1-stepi.exp
gdb/testsuite/gdb.mi/mi1-symbol.exp
gdb/testsuite/gdb.mi/mi1-until.exp
gdb/testsuite/gdb.mi/mi1-var-block.exp
gdb/testsuite/gdb.mi/mi1-var-child.exp
gdb/testsuite/gdb.mi/mi1-var-cmd.exp
gdb/testsuite/gdb.mi/mi1-var-display.exp
gdb/testsuite/gdb.mi/mi1-watch.exp
417 files changed, 17462 insertions, 16784 deletions
diff --git a/COPYING.NEWLIB b/COPYING.NEWLIB index e0eff07..60b63df 100644 --- a/COPYING.NEWLIB +++ b/COPYING.NEWLIB @@ -670,14 +670,68 @@ 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. -(27) Red Hat Incorporated +(27) Konstantin Chuguev (--enable-newlib-iconv) + +Copyright (c) 1999, 2000 + Konstantin Chuguev. 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + + iconv (Charset Conversion Library) v2.0 + +(27) Artem Bityuckiy (--enable-newlib-iconv) + +Copyright (c) 2003, Artem B. Bityuckiy, SoftMine Corporation. +Rights transferred to Franklin Electronic Publishers. + +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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + +(28) Red Hat Incorporated Unless otherwise stated in each remaining newlib file, the remaining files in the newlib subdirectory default to the following copyright. It should be noted that Red Hat Incorporated now owns copyrights belonging to Cygnus Solutions and Cygnus Support. -Copyright (c) 1994, 1997, 2001, 2002 Red Hat Incorporated. +Copyright (c) 1994, 1997, 2001, 2002, 2003, 2004 Red Hat Incorporated. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1,3 +1,42 @@ +2004-02-11 David Edelsohn <edelsohn@gnu.org> + + * configure.in (powerpc-*-aix*): Add target-libada to noconfigdirs. + (rs6000-*-aix*): Same. + * configure: Regenerate. + +2004-02-11 Kelley Cook <kcook@gcc.gnu.org> + + * configure.in (host): Add in missing $noconfigdirs to defines. + * configure: Regenerate. + +2004-02-10 Arnaud Charlet <charlet@act-europe.fr>, + Nathanael Nerode <neroden@gcc.gnu.org> + + PR ada/6637, PR ada/5911 + Merge with libada-branch: + * configure.in, Makefile.tpl, Makefile.def: Add target-libada, + with appropriate dependencies. Add --enable-libada configure switch. + * configure, Makefile.in: Regenerate. + +2004-02-05 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * configure.in: Don't pass --with-stabs on IRIX 5 either. + * configure: Regenerate. + +2004-02-02 Jeff Johnston <jjohnstn@redhat.com> + + * COPYING.NEWLIB: Update Red Hat license to 2004. + +2004-01-23 DJ Delorie <dj@redhat.com> + + * Makefile.def (target_modules) [libiberty]: Don't stage. + * Makefile.in: Rebuilt. + +2004-01-23 Jeff Johnston <jjohnstn@redhat.com> + + * COPYING.NEWLIB: Update to include copyrights for new + iconv code. + 2004-01-15 Andrew Cagney <cagney@redhat.com> * src-release: Update copyright year. diff --git a/Makefile.def b/Makefile.def index 319711a..5a68098 100644 --- a/Makefile.def +++ b/Makefile.def @@ -107,7 +107,7 @@ target_modules = { module= libtermcap; no_check=true; stage=true; missing=maintainer-clean; }; target_modules = { module= winsup; }; target_modules = { module= libgloss; no_check=true; }; -target_modules = { module= libiberty; stage=true; }; +target_modules = { module= libiberty; }; target_modules = { module= gperf; }; target_modules = { module= examples; no_check=true; no_install=true; }; target_modules = { module= libffi; }; @@ -116,6 +116,7 @@ target_modules = { module= zlib; stage=true; }; target_modules = { module= boehm-gc; }; target_modules = { module= qthreads; }; target_modules = { module= rda; }; +target_modules = { module= libada; }; // These are (some of) the make targets to be done in each subdirectory. // Not all; these are the ones which don't have special options. diff --git a/Makefile.in b/Makefile.in index 33f87b6..061a76f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -611,7 +611,8 @@ configure-target: \ maybe-configure-target-zlib \ maybe-configure-target-boehm-gc \ maybe-configure-target-qthreads \ - maybe-configure-target-rda + maybe-configure-target-rda \ + maybe-configure-target-libada # The target built for a native build. .PHONY: all.normal @@ -700,7 +701,8 @@ all-target: \ maybe-all-target-zlib \ maybe-all-target-boehm-gc \ maybe-all-target-qthreads \ - maybe-all-target-rda + maybe-all-target-rda \ + maybe-all-target-libada # Do a target for all the subdirectories. A ``make do-X'' will do a # ``make X'' in all subdirectories (because, in general, there is a @@ -794,7 +796,8 @@ info-target: \ maybe-info-target-zlib \ maybe-info-target-boehm-gc \ maybe-info-target-qthreads \ - maybe-info-target-rda + maybe-info-target-rda \ + maybe-info-target-libada # GCC, the eternal special case .PHONY: maybe-info-gcc info-gcc @@ -2582,6 +2585,28 @@ info-target-rda: \ || exit 1 +.PHONY: maybe-info-target-libada info-target-libada +maybe-info-target-libada: + +info-target-libada: \ + configure-target-libada + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing info in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + + .PHONY: do-dvi do-dvi: dvi-host dvi-target @@ -2670,7 +2695,8 @@ dvi-target: \ maybe-dvi-target-zlib \ maybe-dvi-target-boehm-gc \ maybe-dvi-target-qthreads \ - maybe-dvi-target-rda + maybe-dvi-target-rda \ + maybe-dvi-target-libada # GCC, the eternal special case .PHONY: maybe-dvi-gcc dvi-gcc @@ -4458,6 +4484,28 @@ dvi-target-rda: \ || exit 1 +.PHONY: maybe-dvi-target-libada dvi-target-libada +maybe-dvi-target-libada: + +dvi-target-libada: \ + configure-target-libada + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + + .PHONY: do-TAGS do-TAGS: TAGS-host TAGS-target @@ -4546,7 +4594,8 @@ TAGS-target: \ maybe-TAGS-target-zlib \ maybe-TAGS-target-boehm-gc \ maybe-TAGS-target-qthreads \ - maybe-TAGS-target-rda + maybe-TAGS-target-rda \ + maybe-TAGS-target-libada # GCC, the eternal special case .PHONY: maybe-TAGS-gcc TAGS-gcc @@ -6334,6 +6383,28 @@ TAGS-target-rda: \ || exit 1 +.PHONY: maybe-TAGS-target-libada TAGS-target-libada +maybe-TAGS-target-libada: + +TAGS-target-libada: \ + configure-target-libada + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + + .PHONY: do-install-info do-install-info: install-info-host install-info-target @@ -6422,7 +6493,8 @@ install-info-target: \ maybe-install-info-target-zlib \ maybe-install-info-target-boehm-gc \ maybe-install-info-target-qthreads \ - maybe-install-info-target-rda + maybe-install-info-target-rda \ + maybe-install-info-target-libada # GCC, the eternal special case .PHONY: maybe-install-info-gcc install-info-gcc @@ -8291,6 +8363,29 @@ install-info-target-rda: \ || exit 1 +.PHONY: maybe-install-info-target-libada install-info-target-libada +maybe-install-info-target-libada: + +install-info-target-libada: \ + configure-target-libada \ + info-target-libada + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + + .PHONY: do-installcheck do-installcheck: installcheck-host installcheck-target @@ -8379,7 +8474,8 @@ installcheck-target: \ maybe-installcheck-target-zlib \ maybe-installcheck-target-boehm-gc \ maybe-installcheck-target-qthreads \ - maybe-installcheck-target-rda + maybe-installcheck-target-rda \ + maybe-installcheck-target-libada # GCC, the eternal special case .PHONY: maybe-installcheck-gcc installcheck-gcc @@ -10167,6 +10263,28 @@ installcheck-target-rda: \ || exit 1 +.PHONY: maybe-installcheck-target-libada installcheck-target-libada +maybe-installcheck-target-libada: + +installcheck-target-libada: \ + configure-target-libada + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + + .PHONY: do-mostlyclean do-mostlyclean: mostlyclean-host mostlyclean-target @@ -10255,7 +10373,8 @@ mostlyclean-target: \ maybe-mostlyclean-target-zlib \ maybe-mostlyclean-target-boehm-gc \ maybe-mostlyclean-target-qthreads \ - maybe-mostlyclean-target-rda + maybe-mostlyclean-target-rda \ + maybe-mostlyclean-target-libada # GCC, the eternal special case .PHONY: maybe-mostlyclean-gcc mostlyclean-gcc @@ -11920,6 +12039,27 @@ mostlyclean-target-rda: || exit 1 +.PHONY: maybe-mostlyclean-target-libada mostlyclean-target-libada +maybe-mostlyclean-target-libada: + +mostlyclean-target-libada: + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + + .PHONY: do-clean do-clean: clean-host clean-target @@ -12008,7 +12148,8 @@ clean-target: \ maybe-clean-target-zlib \ maybe-clean-target-boehm-gc \ maybe-clean-target-qthreads \ - maybe-clean-target-rda + maybe-clean-target-rda \ + maybe-clean-target-libada # GCC, the eternal special case .PHONY: maybe-clean-gcc clean-gcc @@ -13687,6 +13828,27 @@ clean-target-rda: || exit 1 +.PHONY: maybe-clean-target-libada clean-target-libada +maybe-clean-target-libada: + +clean-target-libada: + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing clean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + + .PHONY: do-distclean do-distclean: distclean-host distclean-target @@ -13775,7 +13937,8 @@ distclean-target: \ maybe-distclean-target-zlib \ maybe-distclean-target-boehm-gc \ maybe-distclean-target-qthreads \ - maybe-distclean-target-rda + maybe-distclean-target-rda \ + maybe-distclean-target-libada # GCC, the eternal special case .PHONY: maybe-distclean-gcc distclean-gcc @@ -15454,6 +15617,27 @@ distclean-target-rda: || exit 1 +.PHONY: maybe-distclean-target-libada distclean-target-libada +maybe-distclean-target-libada: + +distclean-target-libada: + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + + .PHONY: do-maintainer-clean do-maintainer-clean: maintainer-clean-host maintainer-clean-target @@ -15542,7 +15726,8 @@ maintainer-clean-target: \ maybe-maintainer-clean-target-zlib \ maybe-maintainer-clean-target-boehm-gc \ maybe-maintainer-clean-target-qthreads \ - maybe-maintainer-clean-target-rda + maybe-maintainer-clean-target-rda \ + maybe-maintainer-clean-target-libada # GCC, the eternal special case .PHONY: maybe-maintainer-clean-gcc maintainer-clean-gcc @@ -17221,6 +17406,27 @@ maintainer-clean-target-rda: || exit 1 +.PHONY: maybe-maintainer-clean-target-libada maintainer-clean-target-libada +maybe-maintainer-clean-target-libada: + +maintainer-clean-target-libada: + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + + # Here are the targets which correspond to the do-X targets. @@ -17363,7 +17569,8 @@ do-check: maybe-check-gcc \ maybe-check-target-zlib \ maybe-check-target-boehm-gc \ maybe-check-target-qthreads \ - maybe-check-target-rda + maybe-check-target-rda \ + maybe-check-target-libada # Automated reporting of test results. @@ -17542,7 +17749,8 @@ install-target: \ maybe-install-target-zlib \ maybe-install-target-boehm-gc \ maybe-install-target-qthreads \ - maybe-install-target-rda + maybe-install-target-rda \ + maybe-install-target-libada uninstall: @echo "the uninstall target is not supported in this tree" @@ -22560,30 +22768,8 @@ configure-target-libiberty: $(TARGET_SUBDIR)/libiberty/multilib.out *) topdir="../../$(srcdir)" ;; \ esac ;; \ esac; \ - if [ "$(srcdir)" = "." ] ; then \ - if [ "$(TARGET_SUBDIR)" != "." ] ; then \ - if $(SHELL) $$s/symlink-tree $${topdir}/libiberty "no-such-file" ; then \ - if [ -f Makefile ]; then \ - if $(MAKE) distclean; then \ - true; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - srcdiroption="--srcdir=."; \ - libsrcdir="."; \ - else \ srcdiroption="--srcdir=$${topdir}/libiberty"; \ libsrcdir="$$s/libiberty"; \ - fi; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ $(TARGET_CONFIGARGS) $${srcdiroption} \ @@ -23276,6 +23462,107 @@ install-target-rda: installdirs $(MAKE) $(TARGET_FLAGS_TO_PASS) install) +.PHONY: configure-target-libada maybe-configure-target-libada +maybe-configure-target-libada: + +# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. +$(TARGET_SUBDIR)/libada/multilib.out: multilib.out + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \ + rm -f $(TARGET_SUBDIR)/libada/Makefile || : ; \ + cp multilib.out $(TARGET_SUBDIR)/libada/multilib.out + +configure-target-libada: $(TARGET_SUBDIR)/libada/multilib.out + @test ! -f $(TARGET_SUBDIR)/libada/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + AR="$(AR_FOR_TARGET)"; export AR; \ + AS="$(AS_FOR_TARGET)"; export AS; \ + CC="$(CC_FOR_TARGET)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ + CXX="$(CXX_FOR_TARGET)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ + GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ + DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ + LD="$(LD_FOR_TARGET)"; export LD; \ + LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ + NM="$(NM_FOR_TARGET)"; export NM; \ + RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ + WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo Configuring in $(TARGET_SUBDIR)/libada; \ + cd "$(TARGET_SUBDIR)/libada" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) \ + topdir=$(srcdir) ;; \ + *) \ + case "$(TARGET_SUBDIR)" in \ + .) topdir="../$(srcdir)" ;; \ + *) topdir="../../$(srcdir)" ;; \ + esac ;; \ + esac; \ + if [ "$(srcdir)" = "." ] ; then \ + if [ "$(TARGET_SUBDIR)" != "." ] ; then \ + if $(SHELL) $$s/symlink-tree $${topdir}/libada "no-such-file" ; then \ + if [ -f Makefile ]; then \ + if $(MAKE) distclean; then \ + true; \ + else \ + exit 1; \ + fi; \ + else \ + true; \ + fi; \ + else \ + exit 1; \ + fi; \ + else \ + true; \ + fi; \ + srcdiroption="--srcdir=."; \ + libsrcdir="."; \ + else \ + srcdiroption="--srcdir=$${topdir}/libada"; \ + libsrcdir="$$s/libada"; \ + fi; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ + --with-target-subdir="$(TARGET_SUBDIR)" \ + || exit 1 + +.PHONY: all-target-libada maybe-all-target-libada +maybe-all-target-libada: +all-target-libada: configure-target-libada + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + +.PHONY: check-target-libada maybe-check-target-libada +maybe-check-target-libada: + +check-target-libada: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + + +.PHONY: install-target-libada maybe-install-target-libada +maybe-install-target-libada: + +install-target-libada: installdirs + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(SET_LIB_PATH) \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + + # ---------- # GCC module @@ -23571,6 +23858,7 @@ ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3 configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads configure-target-fastjar: maybe-configure-target-zlib all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty +configure-target-libada: $(ALL_GCC_C) configure-target-libf2c: $(ALL_GCC_C) all-target-libf2c: maybe-all-target-libiberty configure-target-libffi: $(ALL_GCC_C) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c1c024c..4192e84 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,77 @@ +2004-02-13 Andrew Cagney <cagney@redhat.com> + + * elf.c (vma_page_aligned_bias): New function. + (assign_file_positions_except_relocs) + (assign_file_positions_for_segments): Replace broken modulo + arithmetic with call to vma_page_aligned_bias. + +2004-02-11 Andrew Cagney <cagney@redhat.com> + + * bfd-in.h: Update copyright. + (bfd_tell): Change return type to file_ptr. + * bfd-in2.h: Re-generate. + * cache.c: Update copyright. + (bfd_cache_lookup_worker): Use real_fseek, do not cast offset + parameter. + (close_one): Use real_ftell. + * bfdio.c: Update copyright. + (real_ftell, real_fseek): New functions. + (bfd_tell): Use real_fseek and real_ftell, change return type to + file_ptr. + (bfd_seek): Use real_ftell and real_fseek, change type of + file_position to a file_ptr. + * libbfd-in.h: Update copyright. + (real_ftell, real_fseek): Declare. + * libbfd.h: Re-generate. + + * configure.in (AC_CHECK_FUNCS): Check for ftello, ftello64, + fseeko and fseeko64. Determine bfd_file_ptr. + * configure: Re-generate. + * config.in: Re-generate. + +2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com> + + * coff-h8300.c: Added comments about relaxation for ldc.w and stc.w. + * elf32-h8300.c: Likewise. + +2004-02-09 Christian Vogel <vogelchr@vogel.cx> + Nick Clifton <nickc@redhat.com> + + * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Catch + GOT entries with no associated GOT subsection. + +2004-02-09 Richard Sandiford <rsandifo@redhat.com> + + * bfd-elf.h (elf_backend_name_local_section_symbols): New hook. + * elf.c (swap_out_syms): Use it to decide whether local section + symbols should be named. + * elfxx-target.h (elf_backend_name_local_section_symbols): New macro. + * elfxx-mips.h (_bfd_mips_elf_name_local_section_symbols): Declare. + (elf_backend_name_local_section_symbols): Define. + * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): New. + +2004-01-30 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_ia64_relax_brl): New function. + (elfNN_ia64_relax_section): Optimize brl to br during the relax + finalize pass. + +2004-01-30 Alexandre Oliva <aoliva@redhat.com> + + * elf32-frv.c (elf32_frv_always_size_sections): Initialize pointer + to bfd_link_hash_entry passed by reference to + _bfd_generic_link_add_one_symbol. + +2004-01-25 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_ia64_relocate_section): Disallow imm + relocations against dynamic symbols. + +2004-01-23 Daniel Jacobowitz <drow@mvista.com> + + * elf32-arm.h (elf32_arm_check_relocs): Revert part of 2004-01-13 + change. + 2004-01-21 Tom Rix <tcrix@worldnet.att.net> * reloc.c: New 5 bit reloc, BFD_RELOC_M68HC12_5B, for m68hc12 movb/movw. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index ccfef1e..cf75f63 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -1,7 +1,7 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -456,7 +456,7 @@ extern void bfd_hash_traverse extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); extern int bfd_seek (bfd *, file_ptr, int); -extern ufile_ptr bfd_tell (bfd *); +extern file_ptr bfd_tell (bfd *); extern int bfd_flush (bfd *); extern int bfd_stat (bfd *, struct stat *); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index f66c29c..ce809d4 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -8,7 +8,7 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -463,7 +463,7 @@ extern void bfd_hash_traverse extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); extern int bfd_seek (bfd *, file_ptr, int); -extern ufile_ptr bfd_tell (bfd *); +extern file_ptr bfd_tell (bfd *); extern int bfd_flush (bfd *); extern int bfd_stat (bfd *, struct stat *); diff --git a/bfd/bfdio.c b/bfd/bfdio.c index b196a52..a90cb33 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -1,6 +1,8 @@ /* Low-level I/O routines for BFDs. - 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, 2004 Free Software Foundation, Inc. + Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -36,6 +38,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define S_IXOTH 0001 /* Execute by others. */ #endif +file_ptr +real_ftell (FILE *file) +{ +#if defined (HAVE_FTELLO64) + return ftello64 (file); +#elif defined (HAVE_FTELLO) + return ftello (file); +#else + return ftell (file); +#endif +} + +int +real_fseek (FILE *file, file_ptr offset, int whence) +{ +#if defined (HAVE_FSEEKO64) + return fseeko64 (file, offset, whence); +#elif defined (HAVE_FSEEKO) + return fseeko (file, offset, whence); +#else + return fseek (file, offset, whence); +#endif +} + /* Note that archive entries don't have streams; they share their parent's. This allows someone to play with the iostream behind BFD's back. @@ -162,7 +188,7 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd) return nwrote; } -bfd_vma +file_ptr bfd_tell (bfd *abfd) { file_ptr ptr; @@ -170,7 +196,7 @@ bfd_tell (bfd *abfd) if ((abfd->flags & BFD_IN_MEMORY) != 0) return abfd->where; - ptr = ftell (bfd_cache_lookup (abfd)); + ptr = real_ftell (bfd_cache_lookup (abfd)); if (abfd->my_archive) ptr -= abfd->origin; @@ -217,7 +243,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) { int result; FILE *f; - long file_position; + file_ptr file_position; /* For the time being, a BFD may not seek to it's end. The problem is that we don't easily have a way to recognize the end of an element in an archive. */ @@ -278,7 +304,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) tripping the abort, we can probably safely disable this code, so that the real optimizations happen. */ file_ptr where_am_i_now; - where_am_i_now = ftell (bfd_cache_lookup (abfd)); + where_am_i_now = real_ftell (bfd_cache_lookup (abfd)); if (abfd->my_archive) where_am_i_now -= abfd->origin; if (where_am_i_now != abfd->where) @@ -307,7 +333,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) if (direction == SEEK_SET && abfd->my_archive != NULL) file_position += abfd->origin; - result = fseek (f, file_position, direction); + result = real_fseek (f, file_position, direction); if (result != 0) { int hold_errno = errno; diff --git a/bfd/cache.c b/bfd/cache.c index b309165..7d056ea 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -1,6 +1,8 @@ /* BFD library -- caching of file descriptors. - Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of BFD, the Binary File Descriptor library. @@ -155,7 +157,7 @@ close_one (void) return TRUE; } - kill->where = ftell ((FILE *) kill->iostream); + kill->where = real_ftell ((FILE *) kill->iostream); return bfd_cache_delete (kill); } @@ -356,7 +358,7 @@ bfd_cache_lookup_worker (bfd *abfd) return NULL; if (abfd->where != (unsigned long) abfd->where) return NULL; - if (fseek ((FILE *) abfd->iostream, (long) abfd->where, SEEK_SET) != 0) + if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0) return NULL; } diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index bd798a6..e4d1399 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -780,8 +780,8 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, instructions: "band", "bclr", "biand", "bild", "bior", "bist", "bixor", - "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and - "mov.[bwl]" + "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", "ldc.w", + "stc.w" and "mov.[bwl]" We may relax this into an 16-bit absolute address if it's in the right range. */ diff --git a/bfd/config.in b/bfd/config.in index ab273c8..ef9eca4 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -61,6 +61,18 @@ /* Define if you have the fdopen function. */ #undef HAVE_FDOPEN +/* Define if you have the fseeko function. */ +#undef HAVE_FSEEKO + +/* Define if you have the fseeko64 function. */ +#undef HAVE_FSEEKO64 + +/* Define if you have the ftello function. */ +#undef HAVE_FTELLO + +/* Define if you have the ftello64 function. */ +#undef HAVE_FTELLO64 + /* Define if you have the getcwd function. */ #undef HAVE_GETCWD @@ -190,6 +202,12 @@ /* Define as 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT +/* The number of bytes in type long long */ +#undef SIZEOF_LONG_LONG + +/* The number of bytes in type long */ +#undef SIZEOF_LONG + /* Use b modifier when opening binary files? */ #undef USE_BINARY_FOPEN @@ -262,6 +280,9 @@ /* Name of host specific header file to include in trad-core.c. */ #undef TRAD_HEADER +/* The number of bytes in type off_t */ +#undef SIZEOF_OFF_T + /* Use mmap if it's available? */ #undef USE_MMAP diff --git a/bfd/configure b/bfd/configure index 5704aef..22d246d 100755 --- a/bfd/configure +++ b/bfd/configure @@ -6619,6 +6619,124 @@ esac +# Determine the host dependant file_ptr a.k.a. off_t type. In order +# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and +# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long. +# Hopefully a reasonable assumption since fseeko et.al. should be +# upward compatible. +for ac_func in ftello ftello64 fseeko fseeko64 +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6631: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6636 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6659: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking file_ptr type""... $ac_c" 1>&6 +echo "configure:6684: checking file_ptr type" >&5 +bfd_file_ptr="long" +bfd_ufile_ptr="unsigned long" +if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then + echo $ac_n "checking size of off_t""... $ac_c" 1>&6 +echo "configure:6689: checking size of off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +#line 6695 "configure" +#include "confdefs.h" +#include "confdefs.h" +#include <sys/types.h> + + +int main() { +switch (0) case 0: case (sizeof (off_t) == $ac_size):; +; return 0; } +EOF +if { (eval echo configure:6705: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_off_t=$ac_size +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + if test x$ac_cv_sizeof_off_t != x ; then break; fi +done + +fi + +if test x$ac_cv_sizeof_off_t = x ; then + { echo "configure: error: cannot determine a size for off_t" 1>&2; exit 1; } +fi +echo "$ac_t""$ac_cv_sizeof_off_t" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +EOF + + + if test "x${ac_cv_sizeof_off_t}" = "x8"; then + bfd_file_ptr=BFD_HOST_64_BIT + bfd_ufile_ptr=BFD_HOST_U_64_BIT + fi +fi +if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes; then + bfd_file_ptr=BFD_HOST_64_BIT + bfd_ufile_ptr=BFD_HOST_U_64_BIT +fi +echo "$ac_t""$bfd_file_ptr" 1>&6 + + + + tdefaults="" test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" @@ -6631,17 +6749,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:6635: checking for $ac_hdr" >&5 +echo "configure:6753: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6640 "configure" +#line 6758 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6763: \"$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* @@ -6670,12 +6788,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6674: checking for $ac_func" >&5 +echo "configure:6792: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6679 "configure" +#line 6797 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6698,7 +6816,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6820: \"$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 @@ -6723,7 +6841,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6727: checking for working mmap" >&5 +echo "configure:6845: 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 @@ -6731,7 +6849,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6735 "configure" +#line 6853 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6871,7 +6989,7 @@ main() } EOF -if { (eval echo configure:6875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6993: \"$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 @@ -6896,12 +7014,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6900: checking for $ac_func" >&5 +echo "configure:7018: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6905 "configure" +#line 7023 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6924,7 +7042,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7046: \"$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 @@ -7174,6 +7292,8 @@ s%@all_backends@%$all_backends%g s%@bfd_backends@%$bfd_backends%g s%@bfd_machines@%$bfd_machines%g s%@bfd_default_target_size@%$bfd_default_target_size%g +s%@bfd_file_ptr@%$bfd_file_ptr%g +s%@bfd_ufile_ptr@%$bfd_ufile_ptr%g s%@tdefaults@%$tdefaults%g CEOF diff --git a/bfd/configure.in b/bfd/configure.in index 760bfe3..72f4580 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -917,6 +917,31 @@ AC_SUBST(bfd_backends) AC_SUBST(bfd_machines) AC_SUBST(bfd_default_target_size) +# Determine the host dependant file_ptr a.k.a. off_t type. In order +# prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and +# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long. +# Hopefully a reasonable assumption since fseeko et.al. should be +# upward compatible. +AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64) +AC_MSG_CHECKING([file_ptr type]) +bfd_file_ptr="long" +bfd_ufile_ptr="unsigned long" +if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then + AC_COMPILE_CHECK_SIZEOF(off_t) + if test "x${ac_cv_sizeof_off_t}" = "x8"; then + bfd_file_ptr=BFD_HOST_64_BIT + bfd_ufile_ptr=BFD_HOST_U_64_BIT + fi +fi +if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes; then + bfd_file_ptr=BFD_HOST_64_BIT + bfd_ufile_ptr=BFD_HOST_U_64_BIT +fi +AC_MSG_RESULT($bfd_file_ptr) +AC_SUBST(bfd_file_ptr) +AC_SUBST(bfd_ufile_ptr) + + tdefaults="" test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index c457a39..6bbacad 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -576,6 +576,11 @@ struct elf_backend_data int (*elf_backend_get_symbol_type) (Elf_Internal_Sym *, int); + /* Return true if local section symbols should have a non-null st_name. + NULL implies false. */ + bfd_boolean (*elf_backend_name_local_section_symbols) + (bfd *); + /* A function to do additional processing on the ELF section header just before writing it out. This is used to set the flags and type fields for some sections, or to actually write out data for @@ -1,6 +1,7 @@ /* ELF executable support for BFD. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -3571,6 +3572,35 @@ elf_sort_sections (const void *arg1, const void *arg2) return sec1->target_index - sec2->target_index; } +/* Ian Lance Taylor writes: + + We shouldn't be using % with a negative signed number. That's just + not good. We have to make sure either that the number is not + negative, or that the number has an unsigned type. When the types + are all the same size they wind up as unsigned. When file_ptr is a + larger signed type, the arithmetic winds up as signed long long, + which is wrong. + + What we're trying to say here is something like ``increase OFF by + the least amount that will cause it to be equal to the VMA modulo + the page size.'' */ +/* In other words, something like: + + vma_offset = m->sections[0]->vma % bed->maxpagesize; + off_offset = off % bed->maxpagesize; + if (vma_offset < off_offset) + adjustment = vma_offset + bed->maxpagesize - off_offset; + else + adjustment = vma_offset - off_offset; + + which can can be collapsed into the expression below. */ + +static file_ptr +vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize) +{ + return ((vma - off) % maxpagesize); +} + /* Assign file positions to the sections based on the mapping from sections to segments. This function also sets up some fields in the file header, and writes out the program headers. */ @@ -3698,7 +3728,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) && (m->sections[0]->flags & SEC_ALLOC) != 0) { if ((abfd->flags & D_PAGED) != 0) - off += (m->sections[0]->vma - off) % bed->maxpagesize; + off += vma_page_aligned_bias (m->sections[0]->vma, off, + bed->maxpagesize); else { bfd_size_type align; @@ -3713,7 +3744,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) align = secalign; } - off += (m->sections[0]->vma - off) % (1 << align); + off += vma_page_aligned_bias (m->sections[0]->vma, off, + 1 << align); } } @@ -3875,9 +3907,11 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) not have the SEC_LOAD case just above, and then this was necessary, but now I'm not sure. */ if ((abfd->flags & D_PAGED) != 0) - adjust = (sec->vma - voff) % bed->maxpagesize; + adjust = vma_page_aligned_bias (sec->vma, voff, + bed->maxpagesize); else - adjust = (sec->vma - voff) % align; + adjust = vma_page_aligned_bias (sec->vma, voff, + align); } else adjust = 0; @@ -4211,9 +4245,11 @@ assign_file_positions_except_relocs (bfd *abfd, ? "*unknown*" : hdr->bfd_section->name))); if ((abfd->flags & D_PAGED) != 0) - off += (hdr->sh_addr - off) % bed->maxpagesize; + off += vma_page_aligned_bias (hdr->sh_addr, off, + bed->maxpagesize); else - off += (hdr->sh_addr - off) % hdr->sh_addralign; + off += vma_page_aligned_bias (hdr->sh_addr, off, + hdr->sh_addralign); off = _bfd_elf_assign_file_position_for_section (hdr, off, FALSE); } @@ -5261,6 +5297,7 @@ swap_out_syms (bfd *abfd, char *outbound_shndx; int idx; bfd_size_type amt; + bfd_boolean name_local_sections; if (!elf_map_symbols (abfd)) return FALSE; @@ -5326,6 +5363,10 @@ swap_out_syms (bfd *abfd, outbound_shndx += sizeof (Elf_External_Sym_Shndx); } + name_local_sections + = (bed->elf_backend_name_local_section_symbols + && bed->elf_backend_name_local_section_symbols (abfd)); + syms = bfd_get_outsymbols (abfd); for (idx = 0; idx < symcount; idx++) { @@ -5335,7 +5376,8 @@ swap_out_syms (bfd *abfd, flagword flags = syms[idx]->flags; int type; - if ((flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM) + if (!name_local_sections + && (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM) { /* Local section symbols have no name. */ sym.st_name = 0; diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 369bbe3..7c284c1 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -2945,10 +2945,11 @@ elf32_arm_check_relocs (abfd, info, sec, relocs) symbol local. */ if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24 || ELF32_R_TYPE (rel->r_info) == R_ARM_PLT32) - { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.refcount += 1; - } + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + /* If we create a PLT entry, this relocation will reference + it, even if it's an ABS32 relocation. */ + h->plt.refcount += 1; } /* If we are creating a shared library, and this is a reloc diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 016f233..488438e 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -3454,7 +3454,7 @@ elf32_frv_always_size_sections (bfd *output_bfd, || h->type != STT_OBJECT || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) { - struct bfd_link_hash_entry *bh; + struct bfd_link_hash_entry *bh = NULL; if (!(_bfd_generic_link_add_one_symbol (info, output_bfd, "__stacksize", diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 1a17621..547adfa 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -1198,7 +1198,7 @@ elf32_h8_relax_section (bfd *abfd, asection *sec, "band", "bclr", "biand", "bild", "bior", "bist", "bixor", "bld", "bnot", "bor", "bset", "bst", "btst", - "bxor", and "mov.[bwl]" + "bxor", "ldc.w", "stc.w" and "mov.[bwl]" We may relax this into an 16-bit absolute address if it's in the right range. */ diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 6025277..8bd03c2 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3547,6 +3547,7 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg) struct alpha_elf_link_hash_entry *h; PTR arg ATTRIBUTE_UNUSED; { + bfd_boolean result = TRUE; struct alpha_elf_got_entry *gotent; if (h->root.root.type == bfd_link_hash_warning) @@ -3555,14 +3556,23 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg) for (gotent = h->got_entries; gotent; gotent = gotent->next) if (gotent->use_count > 0) { - bfd_size_type *plge - = &alpha_elf_tdata (gotent->gotobj)->got->_raw_size; + struct alpha_elf_obj_tdata *td; + bfd_size_type *plge; + td = alpha_elf_tdata (gotent->gotobj); + if (td == NULL) + { + _bfd_error_handler (_("Symbol %s has no GOT subsection for offset 0x%x"), + h->root.root.root.string, gotent->got_offset); + result = FALSE; + continue; + } + plge = &td->got->_raw_size; gotent->got_offset = *plge; *plge += alpha_got_entry_size (gotent->reloc_type); } - return TRUE; + return result; } static void diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index c699922..e223a10 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -672,6 +672,36 @@ bfd_elfNN_ia64_after_parse (int itanium) oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl); } +static void +elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off) +{ + int template; + bfd_byte *hit_addr; + bfd_vma t0, t1, i0, i1, i2; + + hit_addr = (bfd_byte *) (contents + off); + hit_addr -= (long) hit_addr & 0x3; + t0 = bfd_get_64 (abfd, hit_addr); + t1 = bfd_get_64 (abfd, hit_addr + 8); + + /* Keep the instruction in slot 0. */ + i0 = (t0 >> 5) & 0x1ffffffffffLL; + /* Use nop.b for slot 1. */ + i1 = 0x4000000000LL; + /* For slot 2, turn brl into br by masking out bit 40. */ + i2 = (t1 >> 23) & 0x0ffffffffffLL; + + /* Turn a MLX bundle into a MBB bundle with the same stop-bit + variety. */ + template = 0x12; + if ((t0 & 0x1fLL) == 5) + template += 1; + t0 = (i1 << 46) | (i0 << 5) | template; + t1 = (i2 << 23) | (i1 >> 18); + + bfd_put_64 (abfd, t0, hit_addr); + bfd_put_64 (abfd, t1, hit_addr + 8); +} /* These functions do relaxation for IA-64 ELF. */ @@ -765,13 +795,30 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_PCREL21BI: case R_IA64_PCREL21M: case R_IA64_PCREL21F: + /* In the finalize pass, all br relaxations are done. We can + skip it. */ if (!link_info->need_relax_finalize) continue; is_branch = TRUE; break; + case R_IA64_PCREL60B: + /* We can't optimize brl to br before the finalize pass since + br relaxations will increase the code size. Defer it to + the finalize pass. */ + if (link_info->need_relax_finalize) + { + sec->need_finalize_relax = 1; + continue; + } + is_branch = TRUE; + break; + case R_IA64_LTOFF22X: case R_IA64_LDXMOV: + /* We can't relax ldx/mov before the finalize pass since + br relaxations will increase the code size. Defer it to + the finalize pass. */ if (link_info->need_relax_finalize) { sec->need_finalize_relax = 1; @@ -885,6 +932,25 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* If the branch is in range, no need to do anything. */ if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000 && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0) + { + /* If the 60-bit branch is in 21-bit range, optimize it. */ + if (r_type == R_IA64_PCREL60B) + { + elfNN_ia64_relax_brl (abfd, contents, roff); + + irel->r_info + = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_IA64_PCREL21B); + + /* If the original relocation offset points to slot + 1, change it to slot 2. */ + if ((irel->r_offset & 3) == 1) + irel->r_offset += 1; + } + + continue; + } + else if (r_type == R_IA64_PCREL60B) continue; /* If the branch and target are in the same section, you've @@ -3951,6 +4017,24 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (srel != NULL); + switch (r_type) + { + case R_IA64_IMM14: + case R_IA64_IMM22: + case R_IA64_IMM64: + /* ??? People shouldn't be doing non-pic code in + shared libraries nor dynamic executables. */ + (*_bfd_error_handler) + (_("%s: non-pic code with imm relocation against dynamic symbol `%s'"), + bfd_archive_filename (input_bfd), + h->root.root.string); + ret_val = FALSE; + continue; + + default: + break; + } + /* If we don't need dynamic symbol lookup, find a matching RELATIVE relocation. */ dyn_r_type = r_type; @@ -3978,17 +4062,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, break; default: - /* We can't represent this without a dynamic symbol. - Adjust the relocation to be against an output - section symbol, which are always present in the - dynamic symbol table. */ - /* ??? People shouldn't be doing non-pic code in - shared libraries. Hork. */ - (*_bfd_error_handler) - (_("%s: linking non-pic code in a shared library"), - bfd_archive_filename (input_bfd)); - ret_val = FALSE; - continue; + break; } dynindx = 0; addend = value; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 7bcdb11..a296458 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -4271,6 +4271,26 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym) } } +/* There appears to be a bug in the MIPSpro linker that causes GOT_DISP + relocations against two unnamed section symbols to resolve to the + same address. For example, if we have code like: + + lw $4,%got_disp(.data)($gp) + lw $25,%got_disp(.text)($gp) + jalr $25 + + then the linker will resolve both relocations to .data and the program + will jump there rather than to .text. + + We can work around this problem by giving names to local section symbols. + This is also what the MIPSpro tools do. */ + +bfd_boolean +_bfd_mips_elf_name_local_section_symbols (bfd *abfd) +{ + return SGI_COMPAT (abfd); +} + /* Work over a section just before writing it out. This routine is used by both the 32-bit and the 64-bit ABI. FIXME: We recognize sections that need the SHF_MIPS_GPREL flag by name; there has to be diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index d3787e9..9e5d7af 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -24,6 +24,8 @@ extern bfd_boolean _bfd_mips_elf_new_section_hook (bfd *, asection *); extern void _bfd_mips_elf_symbol_processing (bfd *, asymbol *); +extern bfd_boolean _bfd_mips_elf_name_local_section_symbols + (bfd *); extern bfd_boolean _bfd_mips_elf_section_processing (bfd *, Elf_Internal_Shdr *); extern bfd_boolean _bfd_mips_elf_section_from_shdr @@ -119,4 +121,6 @@ extern bfd_vma _bfd_mips_elf_sign_extend (bfd_vma, int); extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]; +#define elf_backend_name_local_section_symbols \ + _bfd_mips_elf_name_local_section_symbols #define elf_backend_special_sections _bfd_mips_elf_special_sections diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 40fe8e7..ca0e47b 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -274,6 +274,9 @@ #ifndef elf_backend_get_symbol_type #define elf_backend_get_symbol_type 0 #endif +#ifndef elf_backend_name_local_section_symbols +#define elf_backend_name_local_section_symbols 0 +#endif #ifndef elf_backend_section_processing #define elf_backend_section_processing 0 #endif @@ -456,6 +459,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_symbol_processing, elf_backend_symbol_table_processing, elf_backend_get_symbol_type, + elf_backend_name_local_section_symbols, elf_backend_section_processing, elf_backend_section_from_shdr, elf_backend_section_flags, diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 0ec808d..10cafef 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -1,8 +1,9 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) - 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, 2004 Free Software Foundation, Inc. + Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -594,6 +595,11 @@ extern void _bfd_abort #undef abort #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) +/* Manipulate a system FILE but using BFD's "file_ptr", rather than + the system "off_t" or "off64_t", as the offset. */ +extern file_ptr real_ftell (FILE *file); +extern int real_fseek (FILE *file, file_ptr offset, int whence); + FILE * bfd_cache_lookup_worker (bfd *); diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 40e1b78..62043f3 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -5,9 +5,10 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) - 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, 2004 Free Software Foundation, Inc. + Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -599,6 +600,11 @@ extern void _bfd_abort #undef abort #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) +/* Manipulate a system FILE but using BFD's "file_ptr", rather than + the system "off_t" or "off64_t", as the offset. */ +extern file_ptr real_ftell (FILE *file); +extern int real_fseek (FILE *file, file_ptr offset, int whence); + FILE * bfd_cache_lookup_worker (bfd *); diff --git a/bfd/version.h b/bfd/version.h index cf5a4d5..b4988ed 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20040122 +#define BFD_VERSION_DATE 20040213 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0059ad2..49ce6e7 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2004-01-21 Roland McGrath <roland@redhat.com> + + * readelf.c (get_note_type): Match NT_AUXV. + 2004-01-20 Nick Clifton <nickc@redhat.com> * version.c (print_version): Update copyright year to 2004. diff --git a/binutils/readelf.c b/binutils/readelf.c index 6604cad..258c746 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -25,7 +25,7 @@ Both programs are capabale of displaying the contents of ELF format files, so why does the binutils project have two file dumpers ? - + The reason is that objdump sees an ELF file through a BFD filter of the world; if BFD has a bug where, say, it disagrees about a machine constant in e_flags, then the odds are good that it will remain internally @@ -2271,7 +2271,7 @@ get_ia64_section_type_name (unsigned int sh_type) /* If the top 8 bits are 0x78 the next 8 are the os/abi ID. */ if ((sh_type & 0xFF000000) == SHT_IA_64_LOPSREG) return get_osabi_name ((sh_type & 0x00FF0000) >> 16); - + switch (sh_type) { case SHT_IA_64_EXT: return "IA_64_EXT"; @@ -3478,7 +3478,7 @@ process_section_headers (FILE *file) if (string_table == NULL) return 0; - + string_table_length = section->sh_size; } @@ -3706,7 +3706,7 @@ process_relocs (FILE *file) const char *name; int has_dynamic_reloc; unsigned int i; - + has_dynamic_reloc = 0; for (i = 0; i < ARRAY_SIZE (dynamic_relocations); i++) @@ -4364,7 +4364,7 @@ dynamic_segment_ia64_val (Elf_Internal_Dyn *entry) { switch (entry->d_tag) { - case DT_IA_64_PLT_RESERVE: + case DT_IA_64_PLT_RESERVE: /* First 3 slots reserved. */ print_vma (entry->d_un.d_ptr, PREFIX_HEX); printf (" -- "); @@ -6279,7 +6279,7 @@ find_section (const char * name) { Elf_Internal_Shdr *sec; unsigned int i; - + for (i = elf_header.e_shnum, sec = section_headers + i - 1; i; --i, --sec) if (strcmp (SECTION_NAME (sec), name) == 0) @@ -6382,7 +6382,7 @@ get_debug_line_pointer_sizes (FILE * file) { /* For 32-bit DWARF, the 1-byte address_size field is 10 bytes from the start of the section: - + unit_length: 4 bytes version: 2 bytes debug_abbrev_offset: 4 bytes @@ -9892,6 +9892,7 @@ get_note_type (unsigned e_type) switch (e_type) { + case NT_AUXV: return _("NT_AUXV (auxiliary vector)"); case NT_PRSTATUS: return _("NT_PRSTATUS (prstatus structure)"); case NT_FPREGSET: return _("NT_FPREGSET (floating point registers)"); case NT_PRPSINFO: return _("NT_PRPSINFO (prpsinfo structure)"); @@ -12,6 +12,8 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help + --enable-libada Builds libada directory" +ac_help="$ac_help --enable-serial-[{host,target,build}-]configure Force sequential configuration of sub-packages for the host, target or build @@ -577,7 +579,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:581: checking host system type" >&5 +echo "configure:583: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -598,7 +600,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:602: checking target system type" >&5 +echo "configure:604: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -616,7 +618,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:620: checking build system type" >&5 +echo "configure:622: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -671,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:675: 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 @@ -891,7 +893,8 @@ target_libraries="target-libiberty \ target-libstdc++-v3 \ target-libf2c \ ${libgcj} \ - target-libobjc" + target-libobjc \ + target-libada" # these tools are built using the target libraries, and are intended to # run only in the target environment @@ -1038,26 +1041,26 @@ case "${host}" in noconfigdirs="$noconfigdirs byacc" ;; i[3456789]86-*-vsta) - noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext" + noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext" ;; i[3456789]86-*-go32* | i[3456789]86-*-msdosdjgpp*) - noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi" + noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi" ;; i[3456789]86-*-mingw32*) # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv" - noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool" + noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool" ;; i[3456789]86-*-beos*) noconfigdirs="$noconfigdirs tk itcl tix libgui gdb" ;; *-*-cygwin*) - noconfigdirs="autoconf automake send-pr rcs guile perl" + noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl" ;; *-*-netbsd*) - noconfigdirs="rcs" + noconfigdirs="$noconfigdirs rcs" ;; ppc*-*-pe) - noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv" + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv" ;; powerpc-*-beos*) noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline" @@ -1067,6 +1070,18 @@ case "${host}" in ;; esac +# Check whether --enable-libada or --disable-libada was given. +if test "${enable_libada+set}" = set; then + enableval="$enable_libada" + ENABLE_LIBADA=$enableval +else + ENABLE_LIBADA=yes +fi + +if test "${ENABLE_LIBADA}" != "yes" ; then + noconfigdirs="$noconfigdirs target-libada" +fi + # Save it here so that, even in case of --enable-libgcj, if the Java # front-end isn't enabled, we still get libgcj disabled. libgcj_saved=$libgcj @@ -1364,7 +1379,7 @@ case "${target}" in ;; powerpc-*-aix*) # copied from rs6000-*-* entry - noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" ;; powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) target_configdirs="$target_configdirs target-winsup" @@ -1386,7 +1401,7 @@ case "${target}" in noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}" ;; rs6000-*-aix*) - noconfigdirs="$noconfigdirs gprof ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" ;; rs6000-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" @@ -2011,7 +2026,7 @@ fi # Default to using --with-stabs for certain targets. if test x${with_stabs} = x ; then case "${target}" in - mips*-*-irix6*) + mips*-*-irix[56]*) ;; mips*-*-* | alpha*-*-osf*) with_stabs=yes; @@ -2837,7 +2852,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:2841: checking for $ac_word" >&5 +echo "configure:2856: 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 @@ -2870,7 +2885,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:2874: checking for $ac_word" >&5 +echo "configure:2889: 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 @@ -2909,7 +2924,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:2913: checking for $ac_word" >&5 +echo "configure:2928: 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 @@ -2942,7 +2957,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:2946: checking for $ac_word" >&5 +echo "configure:2961: 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 @@ -2981,7 +2996,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:2985: checking for $ac_word" >&5 +echo "configure:3000: 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 @@ -3014,7 +3029,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:3018: checking for $ac_word" >&5 +echo "configure:3033: 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 @@ -3053,7 +3068,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:3057: checking for $ac_word" >&5 +echo "configure:3072: 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 @@ -3086,7 +3101,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:3090: checking for $ac_word" >&5 +echo "configure:3105: 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 @@ -3125,7 +3140,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:3129: checking for $ac_word" >&5 +echo "configure:3144: 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 @@ -3158,7 +3173,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:3162: checking for $ac_word" >&5 +echo "configure:3177: 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 @@ -3197,7 +3212,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:3201: checking for $ac_word" >&5 +echo "configure:3216: 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 @@ -3230,7 +3245,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:3234: checking for $ac_word" >&5 +echo "configure:3249: 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 @@ -3269,7 +3284,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:3273: checking for $ac_word" >&5 +echo "configure:3288: 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 @@ -3302,7 +3317,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:3306: checking for $ac_word" >&5 +echo "configure:3321: 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 @@ -3341,7 +3356,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:3345: checking for $ac_word" >&5 +echo "configure:3360: 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 @@ -3374,7 +3389,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:3378: checking for $ac_word" >&5 +echo "configure:3393: 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 @@ -3413,7 +3428,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:3417: checking for $ac_word" >&5 +echo "configure:3432: 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 @@ -3446,7 +3461,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:3450: checking for $ac_word" >&5 +echo "configure:3465: 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 @@ -3495,7 +3510,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:3499: checking for $ac_word" >&5 +echo "configure:3514: 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 @@ -3528,7 +3543,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:3532: checking for $ac_word" >&5 +echo "configure:3547: 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 @@ -3567,7 +3582,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:3571: checking for $ac_word" >&5 +echo "configure:3586: 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 @@ -3600,7 +3615,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:3604: checking for $ac_word" >&5 +echo "configure:3619: 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 @@ -3639,7 +3654,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:3643: checking for $ac_word" >&5 +echo "configure:3658: 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 @@ -3672,7 +3687,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:3676: checking for $ac_word" >&5 +echo "configure:3691: 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 @@ -3711,7 +3726,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:3715: checking for $ac_word" >&5 +echo "configure:3730: 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 @@ -3744,7 +3759,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:3748: checking for $ac_word" >&5 +echo "configure:3763: 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 @@ -3783,7 +3798,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:3787: checking for $ac_word" >&5 +echo "configure:3802: 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 @@ -3816,7 +3831,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:3820: checking for $ac_word" >&5 +echo "configure:3835: 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 @@ -3855,7 +3870,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:3859: checking for $ac_word" >&5 +echo "configure:3874: 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 @@ -3888,7 +3903,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:3892: checking for $ac_word" >&5 +echo "configure:3907: 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 @@ -3927,7 +3942,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:3931: checking for $ac_word" >&5 +echo "configure:3946: 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 @@ -3960,7 +3975,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:3964: checking for $ac_word" >&5 +echo "configure:3979: 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 @@ -4027,7 +4042,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:4031: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:4046: 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 b286f1a..bfbb6a1 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -151,7 +151,8 @@ target_libraries="target-libiberty \ target-libstdc++-v3 \ target-libf2c \ ${libgcj} \ - target-libobjc" + target-libobjc \ + target-libada" # these tools are built using the target libraries, and are intended to # run only in the target environment @@ -277,26 +278,26 @@ case "${host}" in noconfigdirs="$noconfigdirs byacc" ;; i[[3456789]]86-*-vsta) - noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext" + noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext" ;; i[[3456789]]86-*-go32* | i[[3456789]]86-*-msdosdjgpp*) - noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi" + noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi" ;; i[[3456789]]86-*-mingw32*) # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv" - noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool" + noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool" ;; i[[3456789]]86-*-beos*) noconfigdirs="$noconfigdirs tk itcl tix libgui gdb" ;; *-*-cygwin*) - noconfigdirs="autoconf automake send-pr rcs guile perl" + noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl" ;; *-*-netbsd*) - noconfigdirs="rcs" + noconfigdirs="$noconfigdirs rcs" ;; ppc*-*-pe) - noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv" + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv" ;; powerpc-*-beos*) noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline" @@ -306,6 +307,14 @@ case "${host}" in ;; esac +AC_ARG_ENABLE(libada, +[ --enable-libada Builds libada directory], +ENABLE_LIBADA=$enableval, +ENABLE_LIBADA=yes) +if test "${ENABLE_LIBADA}" != "yes" ; then + noconfigdirs="$noconfigdirs target-libada" +fi + # Save it here so that, even in case of --enable-libgcj, if the Java # front-end isn't enabled, we still get libgcj disabled. libgcj_saved=$libgcj @@ -603,7 +612,7 @@ case "${target}" in ;; powerpc-*-aix*) # copied from rs6000-*-* entry - noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" ;; powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) target_configdirs="$target_configdirs target-winsup" @@ -625,7 +634,7 @@ case "${target}" in noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}" ;; rs6000-*-aix*) - noconfigdirs="$noconfigdirs gprof ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" ;; rs6000-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" @@ -1250,7 +1259,7 @@ fi # Default to using --with-stabs for certain targets. if test x${with_stabs} = x ; then case "${target}" in - mips*-*-irix6*) + mips*-*-irix[[56]]*) ;; mips*-*-* | alpha*-*-osf*) with_stabs=yes; diff --git a/gas/ChangeLog b/gas/ChangeLog index 438ea36..0e33bb2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,158 @@ +2004-02-13 Hannes Reinecke <hare@suse.de> + Jakub Jelinek <jakub@redhat.com> + + * dwarf2dbg.c (get_filenum): Do not read beyond allocated memory. + +2004-02-10 Steve Ellcey <sje@cup.hp.com> + + * config/tc-ia64.h (ia64_frob_symbol): New declaration. + (tc_frob_symbol): New macro definition. + * config/tc-ia64.c (ia64_frob_symbol): New routine. + +2004-02-09 Daniel Jacobowitz <drow@mvista.com> + + * config/tc-arm.c (md_begin): Mark .note.gnu.arm.ident as + read-only. + +2004-02-09 Nathan Sidwell <nathan@codesourcery.com> + + * read.h (IGNORE_OPCODE_CASE): Do not define. Replace with ... + (TC_CASE_SENSITIVE): ... this. + * read.c: Replace IGNORE_OPCODE_CASE with TC_CASE_SENSITIVE. + * doc/internals.texi (TC_CASE_SENSITIVE): Document. + +2004-02-06 James E Wilson <wilson@specifixinc.com> + + * config/tc-ia64.c (dot_endp): Delete call to output_endp. + (generate_unwind_image): Re-add it here. + +2004-02-06 Nathan Sidwell <nathan@codesourcery.com> + + * dwarf2dbg.c (DWARF2_ADDR_SIZE): Remove trailing ';' + * read.h (SKIP_WHITESPACE): Turn into an expression. + * read.c (read_a_source_file): A pseudo is removed by having a + NULL handler. + +2004-02-05 James E Wilson <wilson@specifixinc.com> + + * config/tc-ia64.c (output_endp): New. + (count_bits): Delete. + (ia64_flush_insns, process_one_record, optimize_unw_records): Handle + endp unwind records. + (fixup_unw_records): Handle endp unwind records. Delete code for + shortening prologue regions not followed by a body record. + (dot_endp): Call add_unwind_entry to emit endp unwind record. + * config/tc-ia64.h (unw_record_type): Add endp. + +2004-02-03 James E Wilson <wilson@specifixinc.com> + + * config/tc-ia64.c (ia64_convert_frag): Call md_number_to_chars to + fill padding bytes with zeroes. + (emit_one_bundle): New locals last_ptr, end_ptr. Rewrite code that + sets unwind_record slot_number and slot_frag fields. + +2004-02-02 Maciej W. Rozycki <macro@ds2.pg.gda.pl> + + * config/tc-mips.c (add_got_offset_hilo): New function. + (macro): Use load_register() and add_got_offset_hilo() to load + constants instead of hardcoding code sequences throughout. + +2004-01-28 H.J. Lu <hongjiu.lu@intel.com> + + * config/tc-ia64.c (emit_one_bundle): Add proper indentation. + +2004-01-26 Bernardo Innocenti <bernie@develer.com> + + * config/tc-m68k.h (EXTERN_FORCE_RELOC): Handle m68k-uclinux specially, + like m68k-elf. + * config/tc-m68k.c (RELAXABLE_SYMBOL): Use EXTERN_FORCE_RELOC instead + of hard-coded test for TARGET_OS=elf. + +2004-01-24 Chris Demetriou <cgd@broadcom.com> + + * config/tc-mips.c (hilo_interlocks): Change definition + so that MIPS32, MIPS64 and later ISAs are included, along with + the already-included machines. Update comments. + +2004-01-23 Daniel Jacobowitz <drow@mvista.com> + + * config/tc-arm.c (tc_gen_reloc): Improve error message for + undefined local labels. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * config/tc-mips.c (load_address, macro): Update comments about + NewABI GP relaxation. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * config/tc-mips.c (macro_build): Remove place and counter arguments. + (mips_build_lui, macro_build_ldst_constoffset): Likewise. + (mips16_macro_build, macro_build_jalr): Remove counter argument. + (set_at, load_register, load_address, move_register): Likewise. + (load_got_offset, add_got_offset): Likewise. + Update all calls and tidy accordingly. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * config/tc-mips.c (RELAX_ENCODE): Remove WARN argument. + (RELAX_FIRST, RELAX_SECOND): Turn into 8-bit quantities. + (RELAX_USE_SECOND): Bump to 0x10000. + (RELAX_SECOND_LONGER, RELAX_NOMACRO, RELAX_DELAY_SLOT): New flags. + (mips_macro_warning): New variable. + (md_assemble): Wrap macro expansion in macro_start() and macro_end(). + (s_cpload, s_cpsetup, s_cprestore, s_cpreturn): Likewise. + (relax_close_frag): Set mips_macro_warning.first_frag. Adjust use + of RELAX_ENCODE. + (append_insn): Update mips_macro_warning.sizes. + (macro_start, macro_warning, macro_end): New functions. + (macro_build): Don't emit warnings here. + (macro_build_lui, md_estimate_size_before_relax): ...or here. + (md_convert_frag): Check for cases where one macro alternative + needs a warning and the other doesn't. Emit a warning if the + longer sequence was chosen. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * config/tc-mips.h (tc_frag_data_type, TC_FRAG_TYPE): Remove. + * config/tc-mips.c (RELAX_ENCODE): Take three arguments: the size of + the first sequence, the size of the second sequence, and a flag + that says whether we should warn. + (RELAX_OLD, RELAX_NEW, RELAX_RELOC[123]): Delete. + (RELAX_FIRST, RELAX_SECOND): New. + (mips_relax): New variable. + (relax_close_frag, relax_start, relax_switch, relax_end): New fns. + (append_insn): Remove "place" argument. Use mips_relax.sequence + rather than "place" to check whether we're expanding the second + alternative of a relaxable macro. Remove redundant check for + branch relaxation. If generating a normal insn, and there + is not enough room in the current frag, call relax_close_frag() + to close it. Update mips_relax.sizes[]. Emit fixups for the + second version of a relaxable macro. Record the first relaxable + fixup in mips_relax. Remove tc_gen_reloc workaround. + (macro_build): Remove all uses of "place". Use mips_relax.sequence + in the same way as in append_insn. + (mips16_macro_build): Remove "place" argument. + (macro_build_lui): As for macro_build. Don't drop the add_symbol + when generating the second version of a relaxable macro. + (load_got_offset, add_got_offset): New functions. + (load_address, macro): Use new relaxation machinery. Remove + tc_gen_reloc workarounds. + (md_estimate_size_before_relax): Set RELAX_USE_SECOND if the second + version of a relaxable macro is needed. Return -RELAX_SECOND if the + first version is needed. + (tc_gen_reloc): Remove relaxation handling. + (md_convert_frag): Go through the fixups for a relaxable macro and + mark those that belong to the unneeded alternative as done. If the + second alternative is needed, adjust the fixup addresses to account + for the deleted first alternative. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * frags.h (frag_room): Declare. + * frags.c (frag_room): New function. + * doc/internals.texi: Document it. + 2004-01-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> * config/tc-mips.c (append_insn): Don't do r3900 interlock diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index c290a92..5f79508 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -11809,6 +11809,9 @@ md_begin () bfd_set_section_flags (stdoutput, arm_arch, SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_LINK_ONCE \ | SEC_HAS_CONTENTS); +#else + bfd_set_section_flags (stdoutput, arm_arch, + SEC_READONLY | SEC_HAS_CONTENTS); #endif arm_arch->output_section = arm_arch; subseg_set (arm_arch, 0); @@ -12823,6 +12826,16 @@ tc_gen_reloc (section, fixp) return NULL; case BFD_RELOC_ARM_OFFSET_IMM: + if (fixp->fx_addsy != NULL + && !S_IS_DEFINED (fixp->fx_addsy) + && S_IS_LOCAL (fixp->fx_addsy)) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("undefined local label `%s'"), + S_GET_NAME (fixp->fx_addsy)); + return NULL; + } + as_bad_where (fixp->fx_file, fixp->fx_line, _("internal_relocation (type: OFFSET_IMM) not fixed up")); return NULL; diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 4e98aa4..fe66ffa 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -822,6 +822,7 @@ static void output_X2_format PARAMS ((vbyte_func, int, int, int, int, int, unsig static void output_X3_format PARAMS ((vbyte_func, unw_record_type, int, int, int, unsigned long, unsigned long)); static void output_X4_format PARAMS ((vbyte_func, int, int, int, int, int, int, unsigned long)); +static unw_rec_list *output_endp PARAMS ((void)); static unw_rec_list *output_prologue PARAMS ((void)); static unw_rec_list *output_prologue_gr PARAMS ((unsigned int, unsigned int)); static unw_rec_list *output_body PARAMS ((void)); @@ -896,7 +897,6 @@ static void process_one_record PARAMS ((unw_rec_list *, vbyte_func)); static void process_unw_records PARAMS ((unw_rec_list *, vbyte_func)); static int calc_record_size PARAMS ((unw_rec_list *)); static void set_imask PARAMS ((unw_rec_list *, unsigned long, unsigned long, unsigned int)); -static int count_bits PARAMS ((unsigned long)); static unsigned long slot_index PARAMS ((unsigned long, fragS *, unsigned long, fragS *)); static unw_rec_list *optimize_unw_records PARAMS ((unw_rec_list *)); @@ -1088,12 +1088,12 @@ ia64_flush_insns () CURR_SLOT.tag_fixups = 0; /* In case there are unwind directives following the last instruction, - resolve those now. We only handle body and prologue directives here. - Give an error for others. */ + resolve those now. We only handle prologue, body, and endp directives + here. Give an error for others. */ for (ptr = unwind.current_entry; ptr; ptr = ptr->next) { if (ptr->r.type == prologue || ptr->r.type == prologue_gr - || ptr->r.type == body) + || ptr->r.type == body || ptr->r.type == endp) { ptr->slot_number = (unsigned long) frag_more (0); ptr->slot_frag = frag_now; @@ -1712,6 +1712,16 @@ alloc_record (unw_record_type t) return ptr; } +/* Dummy unwind record used for calculating the length of the last prologue or + body region. */ + +static unw_rec_list * +output_endp () +{ + unw_rec_list *ptr = alloc_record (endp); + return ptr; +} + static unw_rec_list * output_prologue () { @@ -2332,6 +2342,10 @@ process_one_record (ptr, f) switch (ptr->r.type) { + /* This is a dummy record that takes up no space in the output. */ + case endp: + break; + case gr_mem: case fr_mem: case br_mem: @@ -2574,19 +2588,6 @@ set_imask (region, regmask, t, type) } } -static int -count_bits (unsigned long mask) -{ - int n = 0; - - while (mask) - { - mask &= mask - 1; - ++n; - } - return n; -} - /* Return the number of instruction slots from FIRST_ADDR to SLOT_ADDR. SLOT_FRAG is the frag containing SLOT_ADDR, and FIRST_FRAG is the frag containing FIRST_ADDR. */ @@ -2680,8 +2681,8 @@ optimize_unw_records (list) /* If the only unwind record is ".prologue" or ".prologue" followed by ".body", then we can optimize the unwind directives away. */ if (list->r.type == prologue - && (list->next == NULL - || (list->next->r.type == body && list->next->next == NULL))) + && (list->next->r.type == endp + || (list->next->r.type == body && list->next->next->r.type == endp))) return NULL; return list; @@ -2713,59 +2714,23 @@ fixup_unw_records (list) case body: { unw_rec_list *last; - int size, dir_len = 0; - unsigned long last_addr; - fragS *last_frag; + int size; + unsigned long last_addr = 0; + fragS *last_frag = NULL; first_addr = ptr->slot_number; first_frag = ptr->slot_frag; /* Find either the next body/prologue start, or the end of - the list, and determine the size of the region. */ - last_addr = list->next_slot_number; - last_frag = list->next_slot_frag; + the function, and determine the size of the region. */ for (last = ptr->next; last != NULL; last = last->next) if (last->r.type == prologue || last->r.type == prologue_gr - || last->r.type == body) + || last->r.type == body || last->r.type == endp) { last_addr = last->slot_number; last_frag = last->slot_frag; break; } - else if (!last->next) - { - /* In the absence of an explicit .body directive, - the prologue ends after the last instruction - covered by an unwind directive. */ - if (ptr->r.type != body) - { - last_addr = last->slot_number; - last_frag = last->slot_frag; - switch (last->r.type) - { - case frgr_mem: - dir_len = (count_bits (last->r.record.p.frmask) - + count_bits (last->r.record.p.grmask)); - break; - case fr_mem: - case gr_mem: - dir_len += count_bits (last->r.record.p.rmask); - break; - case br_mem: - case br_gr: - dir_len += count_bits (last->r.record.p.brmask); - break; - case gr_gr: - dir_len += count_bits (last->r.record.p.grmask); - break; - default: - dir_len = 1; - break; - } - } - break; - } - size = (slot_index (last_addr, last_frag, first_addr, first_frag) - + dir_len); + size = slot_index (last_addr, last_frag, first_addr, first_frag); rlen = ptr->r.record.r.rlen = size; if (ptr->r.type == body) /* End of region. */ @@ -2911,6 +2876,12 @@ ia64_convert_frag (fragS *frag) /* Skip the header. */ vbyte_mem_ptr = frag->fr_literal + 8; process_unw_records (list, output_vbyte_mem); + + /* Fill the padding bytes with zeros. */ + if (pad != 0) + md_number_to_chars (frag->fr_literal + len + 8 - md.pointer_size + pad, 0, + md.pointer_size - pad); + frag->fr_fix += size; frag->fr_type = rs_fill; frag->fr_var = 0; @@ -3283,6 +3254,10 @@ generate_unwind_image (text_name) int size, pad; unw_rec_list *list; + /* Mark the end of the unwind info, so that we can compute the size of the + last unwind region. */ + add_unwind_entry (output_endp ()); + /* Force out pending instructions, to make sure all unwind records have a valid slot_number field. */ ia64_flush_insns (); @@ -6032,7 +6007,7 @@ emit_one_bundle () struct ia64_opcode *idesc; int end_of_insn_group = 0, user_template = -1; int n, i, j, first, curr; - unw_rec_list *ptr; + unw_rec_list *ptr, *last_ptr, *end_ptr; bfd_vma t0 = 0, t1 = 0; struct label_fix *lfix; struct insn_fix *ifix; @@ -6076,18 +6051,39 @@ emit_one_bundle () end_of_insn_group = 0; for (i = 0; i < 3 && md.num_slots_in_use > 0; ++i) { - /* Set the slot number for prologue/body records now as those - refer to the current point, not the point after the - instruction has been issued: */ - /* Don't try to delete prologue/body records here, as that will cause - them to also be deleted from the master list of unwind records. */ - for (ptr = md.slot[curr].unwind_record; ptr; ptr = ptr->next) - if (ptr->r.type == prologue || ptr->r.type == prologue_gr - || ptr->r.type == body) - { - ptr->slot_number = (unsigned long) f + i; - ptr->slot_frag = frag_now; - } + /* If we have unwind records, we may need to update some now. */ + ptr = md.slot[curr].unwind_record; + if (ptr) + { + /* Find the last prologue/body record in the list for the current + insn, and set the slot number for all records up to that point. + This needs to be done now, because prologue/body records refer to + the current point, not the point after the instruction has been + issued. This matters because there may have been nops emitted + meanwhile. Any non-prologue non-body record followed by a + prologue/body record must also refer to the current point. */ + last_ptr = NULL; + end_ptr = md.slot[(curr + 1) % NUM_SLOTS].unwind_record; + for (; ptr != end_ptr; ptr = ptr->next) + if (ptr->r.type == prologue || ptr->r.type == prologue_gr + || ptr->r.type == body) + last_ptr = ptr; + if (last_ptr) + { + /* Make last_ptr point one after the last prologue/body + record. */ + last_ptr = last_ptr->next; + for (ptr = md.slot[curr].unwind_record; ptr != last_ptr; + ptr = ptr->next) + { + ptr->slot_number = (unsigned long) f + i; + ptr->slot_frag = frag_now; + } + /* Remove the initialized records, so that we won't accidentally + update them again if we insert a nop and continue. */ + md.slot[curr].unwind_record = last_ptr; + } + } if (idesc->flags & IA64_OPCODE_SLOT2) { @@ -6292,15 +6288,20 @@ emit_one_bundle () build_insn (md.slot + curr, insn + i); - /* Set slot counts for non prologue/body unwind records. */ - for (ptr = md.slot[curr].unwind_record; ptr; ptr = ptr->next) - if (ptr->r.type != prologue && ptr->r.type != prologue_gr - && ptr->r.type != body) - { - ptr->slot_number = (unsigned long) f + i; - ptr->slot_frag = frag_now; - } - md.slot[curr].unwind_record = NULL; + ptr = md.slot[curr].unwind_record; + if (ptr) + { + /* Set slot numbers for all remaining unwind records belonging to the + current insn. There can not be any prologue/body unwind records + here. */ + end_ptr = md.slot[(curr + 1) % NUM_SLOTS].unwind_record; + for (; ptr != end_ptr; ptr = ptr->next) + { + ptr->slot_number = (unsigned long) f + i; + ptr->slot_frag = frag_now; + } + md.slot[curr].unwind_record = NULL; + } if (required_unit == IA64_UNIT_L) { @@ -6375,8 +6376,8 @@ emit_one_bundle () if (unwind.list) { - unwind.list->next_slot_number = (unsigned long) f + 16; - unwind.list->next_slot_frag = frag_now; + unwind.list->next_slot_number = (unsigned long) f + 16; + unwind.list->next_slot_frag = frag_now; } } @@ -7118,6 +7119,23 @@ ia64_frob_label (sym) } } +#ifdef TE_HPUX +/* The HP-UX linker will give unresolved symbol errors for symbols + that are declared but unused. This routine removes declared, + unused symbols from an object. */ +int +ia64_frob_symbol (sym) + struct symbol *sym; +{ + if ((S_GET_SEGMENT (sym) == &bfd_und_section && ! symbol_used_p (sym) && + ELF_ST_VISIBILITY (S_GET_OTHER (sym)) == STV_DEFAULT) + || (S_GET_SEGMENT (sym) == &bfd_abs_section + && ! S_IS_EXTERNAL (sym))) + return 1; + return 0; +} +#endif + void ia64_flush_pending_output () { diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h index 6fd049f..d1a04ee 100644 --- a/gas/config/tc-ia64.h +++ b/gas/config/tc-ia64.h @@ -91,6 +91,9 @@ extern void ia64_end_of_source PARAMS((void)); extern void ia64_start_line PARAMS((void)); extern int ia64_unrecognized_line PARAMS((int ch)); extern void ia64_frob_label PARAMS((struct symbol *sym)); +#ifdef TE_HPUX +extern int ia64_frob_symbol PARAMS((struct symbol *sym)); +#endif extern void ia64_flush_pending_output PARAMS((void)); extern int ia64_parse_name (char *name, expressionS *e); extern int ia64_optimize_expr PARAMS((expressionS *l, operatorT op, @@ -118,6 +121,9 @@ extern void ia64_convert_frag (fragS *); #define md_start_line_hook() ia64_start_line () #define tc_unrecognized_line(ch) ia64_unrecognized_line (ch) #define tc_frob_label(s) ia64_frob_label (s) +#ifdef TE_HPUX +#define tc_frob_symbol(s,p) p |= ia64_frob_symbol (s) +#endif /* TE_HPUX */ #define md_flush_pending_output() ia64_flush_pending_output () #define md_parse_name(s,e,c) ia64_parse_name (s, e) #define tc_canonicalize_symbol_name(s) ia64_canonicalize_symbol_name (s) @@ -202,7 +208,7 @@ typedef enum bspstore_gr, bspstore_psprel, bspstore_sprel, rnat_when, rnat_gr, rnat_psprel, rnat_sprel, epilogue, label_state, copy_state, spill_psprel, spill_sprel, spill_reg, spill_psprel_p, spill_sprel_p, - spill_reg_p, unwabi + spill_reg_p, unwabi, endp } unw_record_type; /* These structures declare the fields that can be used in each of the diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 09a8396..5bef34b 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -1,6 +1,6 @@ /* tc-m68k.c -- Assemble for the m68k family Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -732,7 +732,7 @@ tc_coff_fix2rtype (fixP) libraries, and we can relax any external sym. */ #define relaxable_symbol(symbol) \ - (!((S_IS_EXTERNAL (symbol) && strcmp (TARGET_OS, "elf") != 0) \ + (!((S_IS_EXTERNAL (symbol) && EXTERN_FORCE_RELOC) \ || S_IS_WEAK (symbol))) /* Compute the relocation code for a fixup of SIZE bytes, using pc diff --git a/gas/config/tc-m68k.h b/gas/config/tc-m68k.h index 1182820..559d5e3 100644 --- a/gas/config/tc-m68k.h +++ b/gas/config/tc-m68k.h @@ -1,6 +1,6 @@ /* This file is tc-m68k.h Copyright 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003 + 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -169,8 +169,11 @@ while (0) #define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X) extern int tc_m68k_fix_adjustable PARAMS ((struct fix *)); -/* Target *-*-elf implies an embedded target. No shared libs. */ -#define EXTERN_FORCE_RELOC (strcmp (TARGET_OS, "elf") != 0) +/* Target *-*-elf implies an embedded target. No shared libs. + *-*-uclinux also requires special casing to prevent GAS from + generating unsupported R_68K_PC16 relocs. */ +#define EXTERN_FORCE_RELOC \ + ((strcmp (TARGET_OS, "elf") != 0) && (strcmp (TARGET_OS, "uclinux") != 0)) /* Values passed to md_apply_fix3 don't include symbol values. */ #define MD_APPLY_SYM_VALUE(FIX) 0 diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index e0aa61e..66f52b0 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -325,15 +325,30 @@ static int mips_32bitmode = 0; /* True if CPU has a ror instruction. */ #define CPU_HAS_ROR(CPU) CPU_HAS_DROR (CPU) -/* Whether the processor uses hardware interlocks to protect - reads from the HI and LO registers, and thus does not - require nops to be inserted. */ - -#define hilo_interlocks (mips_opts.arch == CPU_R4010 \ - || mips_opts.arch == CPU_VR5500 \ - || mips_opts.arch == CPU_RM7000 \ - || mips_opts.arch == CPU_SB1 \ - ) +/* True if mflo and mfhi can be immediately followed by instructions + which write to the HI and LO registers. + + According to MIPS specifications, MIPS ISAs I, II, and III need + (at least) two instructions between the reads of HI/LO and + instructions which write them, and later ISAs do not. Contradicting + the MIPS specifications, some MIPS IV processor user manuals (e.g. + the UM for the NEC Vr5000) document needing the instructions between + HI/LO reads and writes, as well. Therefore, we declare only MIPS32, + MIPS64 and later ISAs to have the interlocks, plus any specific + earlier-ISA CPUs for which CPU documentation declares that the + instructions are really interlocked. */ +#define hilo_interlocks \ + (mips_opts.isa == ISA_MIPS32 \ + || mips_opts.isa == ISA_MIPS32R2 \ + || mips_opts.isa == ISA_MIPS64 \ + || mips_opts.isa == ISA_MIPS64R2 \ + || mips_opts.arch == CPU_R4010 \ + || mips_opts.arch == CPU_R10000 \ + || mips_opts.arch == CPU_R12000 \ + || mips_opts.arch == CPU_RM7000 \ + || mips_opts.arch == CPU_SB1 \ + || mips_opts.arch == CPU_VR5500 \ + ) /* Whether the processor uses hardware interlocks to protect reads from the GPRs after they are loaded from memory, and thus does not @@ -616,81 +631,61 @@ static int mips_fix_4122_bugs; static int mips_relax_branch; -/* Since the MIPS does not have multiple forms of PC relative - instructions, we do not have to do relaxing as is done on other - platforms. However, we do have to handle GP relative addressing - correctly, which turns out to be a similar problem. - - Every macro that refers to a symbol can occur in (at least) two - forms, one with GP relative addressing and one without. For - example, loading a global variable into a register generally uses - a macro instruction like this: - lw $4,i - If i can be addressed off the GP register (this is true if it is in - the .sbss or .sdata section, or if it is known to be smaller than - the -G argument) this will generate the following instruction: - lw $4,i($gp) - This instruction will use a GPREL reloc. If i can not be addressed - off the GP register, the following instruction sequence will be used: - lui $at,i - lw $4,i($at) - In this case the first instruction will have a HI16 reloc, and the - second reloc will have a LO16 reloc. Both relocs will be against - the symbol i. - - The issue here is that we may not know whether i is GP addressable - until after we see the instruction that uses it. Therefore, we - want to be able to choose the final instruction sequence only at - the end of the assembly. This is similar to the way other - platforms choose the size of a PC relative instruction only at the - end of assembly. - - When generating position independent code we do not use GP - addressing in quite the same way, but the issue still arises as - external symbols and local symbols must be handled differently. - - We handle these issues by actually generating both possible - instruction sequences. The longer one is put in a frag_var with - type rs_machine_dependent. We encode what to do with the frag in - the subtype field. We encode (1) the number of existing bytes to - replace, (2) the number of new bytes to use, (3) the offset from - the start of the existing bytes to the first reloc we must generate - (that is, the offset is applied from the start of the existing - bytes after they are replaced by the new bytes, if any), (4) the - offset from the start of the existing bytes to the second reloc, - (5) whether a third reloc is needed (the third reloc is always four - bytes after the second reloc), and (6) whether to warn if this - variant is used (this is sometimes needed if .set nomacro or .set - noat is in effect). All these numbers are reasonably small. - - Generating two instruction sequences must be handled carefully to - ensure that delay slots are handled correctly. Fortunately, there - are a limited number of cases. When the second instruction - sequence is generated, append_insn is directed to maintain the - existing delay slot information, so it continues to apply to any - code after the second instruction sequence. This means that the - second instruction sequence must not impose any requirements not - required by the first instruction sequence. - - These variant frags are then handled in functions called by the - machine independent code. md_estimate_size_before_relax returns - the final size of the frag. md_convert_frag sets up the final form - of the frag. tc_gen_reloc adjust the first reloc and adds a second - one if needed. */ -#define RELAX_ENCODE(old, new, reloc1, reloc2, reloc3, warn) \ - ((relax_substateT) \ - (((old) << 23) \ - | ((new) << 16) \ - | (((reloc1) + 64) << 9) \ - | (((reloc2) + 64) << 2) \ - | ((reloc3) ? (1 << 1) : 0) \ - | ((warn) ? 1 : 0))) -#define RELAX_OLD(i) (((i) >> 23) & 0x7f) -#define RELAX_NEW(i) (((i) >> 16) & 0x7f) -#define RELAX_RELOC1(i) ((valueT) (((i) >> 9) & 0x7f) - 64) -#define RELAX_RELOC2(i) ((valueT) (((i) >> 2) & 0x7f) - 64) -#define RELAX_RELOC3(i) (((i) >> 1) & 1) -#define RELAX_WARN(i) ((i) & 1) +/* The expansion of many macros depends on the type of symbol that + they refer to. For example, when generating position-dependent code, + a macro that refers to a symbol may have two different expansions, + one which uses GP-relative addresses and one which uses absolute + addresses. When generating SVR4-style PIC, a macro may have + different expansions for local and global symbols. + + We handle these situations by generating both sequences and putting + them in variant frags. In position-dependent code, the first sequence + will be the GP-relative one and the second sequence will be the + absolute one. In SVR4 PIC, the first sequence will be for global + symbols and the second will be for local symbols. + + The frag's "subtype" is RELAX_ENCODE (FIRST, SECOND), where FIRST and + SECOND are the lengths of the two sequences in bytes. These fields + can be extracted using RELAX_FIRST() and RELAX_SECOND(). In addition, + the subtype has the following flags: + + RELAX_USE_SECOND + Set if it has been decided that we should use the second + sequence instead of the first. + + RELAX_SECOND_LONGER + Set in the first variant frag if the macro's second implementation + is longer than its first. This refers to the macro as a whole, + not an individual relaxation. + + RELAX_NOMACRO + Set in the first variant frag if the macro appeared in a .set nomacro + block and if one alternative requires a warning but the other does not. + + RELAX_DELAY_SLOT + Like RELAX_NOMACRO, but indicates that the macro appears in a branch + delay slot. + + The frag's "opcode" points to the first fixup for relaxable code. + + Relaxable macros are generated using a sequence such as: + + relax_start (SYMBOL); + ... generate first expansion ... + relax_switch (); + ... generate second expansion ... + relax_end (); + + The code and fixups for the unwanted alternative are discarded + by md_convert_frag. */ +#define RELAX_ENCODE(FIRST, SECOND) (((FIRST) << 8) | (SECOND)) + +#define RELAX_FIRST(X) (((X) >> 8) & 0xff) +#define RELAX_SECOND(X) ((X) & 0xff) +#define RELAX_USE_SECOND 0x10000 +#define RELAX_SECOND_LONGER 0x20000 +#define RELAX_NOMACRO 0x40000 +#define RELAX_DELAY_SLOT 0x80000 /* Branch without likely bit. If label is out of range, we turn: @@ -823,6 +818,42 @@ static int mips_relax_branch; || (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff)) +/* Global variables used when generating relaxable macros. See the + comment above RELAX_ENCODE for more details about how relaxation + is used. */ +static struct { + /* 0 if we're not emitting a relaxable macro. + 1 if we're emitting the first of the two relaxation alternatives. + 2 if we're emitting the second alternative. */ + int sequence; + + /* The first relaxable fixup in the current frag. (In other words, + the first fixup that refers to relaxable code.) */ + fixS *first_fixup; + + /* sizes[0] says how many bytes of the first alternative are stored in + the current frag. Likewise sizes[1] for the second alternative. */ + unsigned int sizes[2]; + + /* The symbol on which the choice of sequence depends. */ + symbolS *symbol; +} mips_relax; + +/* Global variables used to decide whether a macro needs a warning. */ +static struct { + /* True if the macro is in a branch delay slot. */ + bfd_boolean delay_slot_p; + + /* For relaxable macros, sizes[0] is the length of the first alternative + in bytes and sizes[1] is the length of the second alternative. + For non-relaxable macros, both elements give the length of the + macro in bytes. */ + unsigned int sizes[2]; + + /* The first variant frag for this macro. */ + fragS *first_frag; +} mips_macro_warning; + /* Prototypes for static functions. */ #define internalError() \ @@ -831,12 +862,13 @@ static int mips_relax_branch; enum mips_regclass { MIPS_GR_REG, MIPS_FP_REG, MIPS16_REG }; static void append_insn - (char *place, struct mips_cl_insn *ip, expressionS *p, - bfd_reloc_code_real_type *r); + (struct mips_cl_insn *ip, expressionS *p, bfd_reloc_code_real_type *r); static void mips_no_prev_insn (int); static void mips16_macro_build - (char *, int *, expressionS *, const char *, const char *, va_list); -static void load_register (int *, int, expressionS *, int); + (expressionS *, const char *, const char *, va_list); +static void load_register (int, expressionS *, int); +static void macro_start (void); +static void macro_end (void); static void macro (struct mips_cl_insn * ip); static void mips16_macro (struct mips_cl_insn * ip); #ifdef LOSING_COMPILER @@ -1354,19 +1386,21 @@ md_assemble (char *str) if (insn.insn_mo->pinfo == INSN_MACRO) { + macro_start (); if (mips_opts.mips16) mips16_macro (&insn); else macro (&insn); + macro_end (); } else { if (imm_expr.X_op != O_absent) - append_insn (NULL, &insn, &imm_expr, imm_reloc); + append_insn (&insn, &imm_expr, imm_reloc); else if (offset_expr.X_op != O_absent) - append_insn (NULL, &insn, &offset_expr, offset_reloc); + append_insn (&insn, &offset_expr, offset_reloc); else - append_insn (NULL, &insn, NULL, unused_reloc); + append_insn (&insn, NULL, unused_reloc); } } @@ -1526,13 +1560,58 @@ mips16_mark_labels (void) } } -/* Output an instruction. PLACE is where to put the instruction; if - it is NULL, this uses frag_more to get room. IP is the instruction - information. ADDRESS_EXPR is an operand of the instruction to be - used with RELOC_TYPE. */ +/* End the current frag. Make it a variant frag and record the + relaxation info. */ + +static void +relax_close_frag (void) +{ + mips_macro_warning.first_frag = frag_now; + frag_var (rs_machine_dependent, 0, 0, + RELAX_ENCODE (mips_relax.sizes[0], mips_relax.sizes[1]), + mips_relax.symbol, 0, (char *) mips_relax.first_fixup); + + memset (&mips_relax.sizes, 0, sizeof (mips_relax.sizes)); + mips_relax.first_fixup = 0; +} + +/* Start a new relaxation sequence whose expansion depends on SYMBOL. + See the comment above RELAX_ENCODE for more details. */ + +static void +relax_start (symbolS *symbol) +{ + assert (mips_relax.sequence == 0); + mips_relax.sequence = 1; + mips_relax.symbol = symbol; +} + +/* Start generating the second version of a relaxable sequence. + See the comment above RELAX_ENCODE for more details. */ + +static void +relax_switch (void) +{ + assert (mips_relax.sequence == 1); + mips_relax.sequence = 2; +} + +/* End the current relaxable sequence. */ + +static void +relax_end (void) +{ + assert (mips_relax.sequence == 2); + relax_close_frag (); + mips_relax.sequence = 0; +} + +/* Output an instruction. IP is the instruction information. + ADDRESS_EXPR is an operand of the instruction to be used with + RELOC_TYPE. */ static void -append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, +append_insn (struct mips_cl_insn *ip, expressionS *address_expr, bfd_reloc_code_real_type *reloc_type) { register unsigned long prev_pinfo, pinfo; @@ -1549,7 +1628,8 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, prev_pinfo = prev_insn.insn_mo->pinfo; pinfo = ip->insn_mo->pinfo; - if (place == NULL && (! mips_opts.noreorder || prev_nop_frag != NULL)) + if (mips_relax.sequence != 2 + && (!mips_opts.noreorder || prev_nop_frag != NULL)) { int prev_prev_nop; @@ -1925,8 +2005,7 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, if (prev_insn_frag) prev_insn_frag_type = prev_insn_frag->fr_type; - if (place == NULL - && address_expr + if (address_expr && *reloc_type == BFD_RELOC_16_PCREL_S2 && (pinfo & INSN_UNCOND_BRANCH_DELAY || pinfo & INSN_COND_BRANCH_DELAY || pinfo & INSN_COND_BRANCH_LIKELY) @@ -1967,8 +2046,6 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, == BFD_RELOC_MIPS16_JMP)), make_expr_symbol (address_expr), 0, NULL); } - else if (place != NULL) - f = place; else if (mips_opts.mips16 && ! ip->use_extend && *reloc_type != BFD_RELOC_MIPS16_JMP) @@ -1985,6 +2062,21 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, && (prev_pinfo & INSN_UNCOND_BRANCH_DELAY) != 0) as_warn (_("extended instruction in delay slot")); + if (mips_relax.sequence) + { + /* If we've reached the end of this frag, turn it into a variant + frag and record the information for the instructions we've + written so far. */ + if (frag_room () < 4) + relax_close_frag (); + mips_relax.sizes[mips_relax.sequence - 1] += 4; + } + + if (mips_relax.sequence != 2) + mips_macro_warning.sizes[0] += 4; + if (mips_relax.sequence != 1) + mips_macro_warning.sizes[1] += 4; + f = frag_more (4); } @@ -2058,84 +2150,85 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, } } else - { need_reloc: - /* Don't generate a reloc if we are writing into a variant frag. */ - if (place == NULL) - { - reloc_howto_type *howto; - int i; + { + reloc_howto_type *howto; + int i; - /* In a compound relocation, it is the final (outermost) - operator that determines the relocated field. */ - for (i = 1; i < 3; i++) - if (reloc_type[i] == BFD_RELOC_UNUSED) - break; + /* In a compound relocation, it is the final (outermost) + operator that determines the relocated field. */ + for (i = 1; i < 3; i++) + if (reloc_type[i] == BFD_RELOC_UNUSED) + break; - howto = bfd_reloc_type_lookup (stdoutput, reloc_type[i - 1]); - fixp[0] = fix_new_exp (frag_now, f - frag_now->fr_literal, - bfd_get_reloc_size(howto), - address_expr, - reloc_type[0] == BFD_RELOC_16_PCREL_S2, - reloc_type[0]); - - /* These relocations can have an addend that won't fit in - 4 octets for 64bit assembly. */ - if (HAVE_64BIT_GPRS - && ! howto->partial_inplace - && (reloc_type[0] == BFD_RELOC_16 - || reloc_type[0] == BFD_RELOC_32 - || reloc_type[0] == BFD_RELOC_MIPS_JMP - || reloc_type[0] == BFD_RELOC_HI16_S - || reloc_type[0] == BFD_RELOC_LO16 - || reloc_type[0] == BFD_RELOC_GPREL16 - || reloc_type[0] == BFD_RELOC_MIPS_LITERAL - || reloc_type[0] == BFD_RELOC_GPREL32 - || reloc_type[0] == BFD_RELOC_64 - || reloc_type[0] == BFD_RELOC_CTOR - || reloc_type[0] == BFD_RELOC_MIPS_SUB - || reloc_type[0] == BFD_RELOC_MIPS_HIGHEST - || reloc_type[0] == BFD_RELOC_MIPS_HIGHER - || reloc_type[0] == BFD_RELOC_MIPS_SCN_DISP - || reloc_type[0] == BFD_RELOC_MIPS_REL16 - || reloc_type[0] == BFD_RELOC_MIPS_RELGOT)) - fixp[0]->fx_no_overflow = 1; - - if (reloc_needs_lo_p (*reloc_type)) - { - struct mips_hi_fixup *hi_fixup; + howto = bfd_reloc_type_lookup (stdoutput, reloc_type[i - 1]); + fixp[0] = fix_new_exp (frag_now, f - frag_now->fr_literal, + bfd_get_reloc_size(howto), + address_expr, + reloc_type[0] == BFD_RELOC_16_PCREL_S2, + reloc_type[0]); + + /* These relocations can have an addend that won't fit in + 4 octets for 64bit assembly. */ + if (HAVE_64BIT_GPRS + && ! howto->partial_inplace + && (reloc_type[0] == BFD_RELOC_16 + || reloc_type[0] == BFD_RELOC_32 + || reloc_type[0] == BFD_RELOC_MIPS_JMP + || reloc_type[0] == BFD_RELOC_HI16_S + || reloc_type[0] == BFD_RELOC_LO16 + || reloc_type[0] == BFD_RELOC_GPREL16 + || reloc_type[0] == BFD_RELOC_MIPS_LITERAL + || reloc_type[0] == BFD_RELOC_GPREL32 + || reloc_type[0] == BFD_RELOC_64 + || reloc_type[0] == BFD_RELOC_CTOR + || reloc_type[0] == BFD_RELOC_MIPS_SUB + || reloc_type[0] == BFD_RELOC_MIPS_HIGHEST + || reloc_type[0] == BFD_RELOC_MIPS_HIGHER + || reloc_type[0] == BFD_RELOC_MIPS_SCN_DISP + || reloc_type[0] == BFD_RELOC_MIPS_REL16 + || reloc_type[0] == BFD_RELOC_MIPS_RELGOT)) + fixp[0]->fx_no_overflow = 1; + + if (mips_relax.sequence) + { + if (mips_relax.first_fixup == 0) + mips_relax.first_fixup = fixp[0]; + } + else if (reloc_needs_lo_p (*reloc_type)) + { + struct mips_hi_fixup *hi_fixup; - /* Reuse the last entry if it already has a matching %lo. */ - hi_fixup = mips_hi_fixup_list; - if (hi_fixup == 0 - || !fixup_has_matching_lo_p (hi_fixup->fixp)) - { - hi_fixup = ((struct mips_hi_fixup *) - xmalloc (sizeof (struct mips_hi_fixup))); - hi_fixup->next = mips_hi_fixup_list; - mips_hi_fixup_list = hi_fixup; - } - hi_fixup->fixp = fixp[0]; - hi_fixup->seg = now_seg; + /* Reuse the last entry if it already has a matching %lo. */ + hi_fixup = mips_hi_fixup_list; + if (hi_fixup == 0 + || !fixup_has_matching_lo_p (hi_fixup->fixp)) + { + hi_fixup = ((struct mips_hi_fixup *) + xmalloc (sizeof (struct mips_hi_fixup))); + hi_fixup->next = mips_hi_fixup_list; + mips_hi_fixup_list = hi_fixup; } + hi_fixup->fixp = fixp[0]; + hi_fixup->seg = now_seg; + } - /* Add fixups for the second and third relocations, if given. - Note that the ABI allows the second relocation to be - against RSS_UNDEF, RSS_GP, RSS_GP0 or RSS_LOC. At the - moment we only use RSS_UNDEF, but we could add support - for the others if it ever becomes necessary. */ - for (i = 1; i < 3; i++) - if (reloc_type[i] != BFD_RELOC_UNUSED) - { - address_expr->X_op = O_absent; - address_expr->X_add_symbol = 0; - address_expr->X_add_number = 0; + /* Add fixups for the second and third relocations, if given. + Note that the ABI allows the second relocation to be + against RSS_UNDEF, RSS_GP, RSS_GP0 or RSS_LOC. At the + moment we only use RSS_UNDEF, but we could add support + for the others if it ever becomes necessary. */ + for (i = 1; i < 3; i++) + if (reloc_type[i] != BFD_RELOC_UNUSED) + { + address_expr->X_op = O_absent; + address_expr->X_add_symbol = 0; + address_expr->X_add_number = 0; - fixp[i] = fix_new_exp (frag_now, fixp[0]->fx_where, - fixp[0]->fx_size, address_expr, - FALSE, reloc_type[i]); - } - } + fixp[i] = fix_new_exp (frag_now, fixp[0]->fx_where, + fixp[0]->fx_size, address_expr, + FALSE, reloc_type[i]); + } } } @@ -2223,7 +2316,7 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, & MIPS16OP_MASK_REGR32); } - if (place == NULL && ! mips_opts.noreorder) + if (mips_relax.sequence != 2 && !mips_opts.noreorder) { /* Filling the branch delay slot is more complex. We try to switch the branch with the previous instruction, which we can @@ -2647,7 +2740,7 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, prev_insn_where = f - frag_now->fr_literal; prev_insn_valid = 1; } - else if (place == NULL) + else if (mips_relax.sequence != 2) { /* We need to record a bit of information even when we are not reordering, in order to determine the base address for mips16 @@ -2663,15 +2756,6 @@ append_insn (char *place, struct mips_cl_insn *ip, expressionS *address_expr, /* We just output an insn, so the next one doesn't have a label. */ mips_clear_insn_labels (); - - /* We must ensure that the frag to which an instruction that was - moved from a non-variant frag doesn't become a variant frag, - otherwise tc_gen_reloc may get confused. */ - if (force_new_frag) - { - frag_wane (frag_now); - frag_new (0); - } } /* This function forgets that there was any previous instruction or @@ -2819,14 +2903,78 @@ mips_emit_delays (bfd_boolean insns) mips_no_prev_insn (insns); } +/* Set up global variables for the start of a new macro. */ + +static void +macro_start (void) +{ + memset (&mips_macro_warning.sizes, 0, sizeof (mips_macro_warning.sizes)); + mips_macro_warning.delay_slot_p = (mips_opts.noreorder + && (prev_insn.insn_mo->pinfo + & (INSN_UNCOND_BRANCH_DELAY + | INSN_COND_BRANCH_DELAY + | INSN_COND_BRANCH_LIKELY)) != 0); +} + +/* Given that a macro is longer than 4 bytes, return the appropriate warning + for it. Return null if no warning is needed. SUBTYPE is a bitmask of + RELAX_DELAY_SLOT and RELAX_NOMACRO. */ + +static const char * +macro_warning (relax_substateT subtype) +{ + if (subtype & RELAX_DELAY_SLOT) + return _("Macro instruction expanded into multiple instructions" + " in a branch delay slot"); + else if (subtype & RELAX_NOMACRO) + return _("Macro instruction expanded into multiple instructions"); + else + return 0; +} + +/* Finish up a macro. Emit warnings as appropriate. */ + +static void +macro_end (void) +{ + if (mips_macro_warning.sizes[0] > 4 || mips_macro_warning.sizes[1] > 4) + { + relax_substateT subtype; + + /* Set up the relaxation warning flags. */ + subtype = 0; + if (mips_macro_warning.sizes[1] > mips_macro_warning.sizes[0]) + subtype |= RELAX_SECOND_LONGER; + if (mips_opts.warn_about_macros) + subtype |= RELAX_NOMACRO; + if (mips_macro_warning.delay_slot_p) + subtype |= RELAX_DELAY_SLOT; + + if (mips_macro_warning.sizes[0] > 4 && mips_macro_warning.sizes[1] > 4) + { + /* Either the macro has a single implementation or both + implementations are longer than 4 bytes. Emit the + warning now. */ + const char *msg = macro_warning (subtype); + if (msg != 0) + as_warn (msg); + } + else + { + /* One implementation might need a warning but the other + definitely doesn't. */ + mips_macro_warning.first_frag->fr_subtype |= subtype; + } + } +} + /* Build an instruction created by a macro expansion. This is passed a pointer to the count of instructions created so far, an expression, the name of the instruction to build, an operand format string, and corresponding arguments. */ static void -macro_build (char *place, int *counter, expressionS *ep, const char *name, - const char *fmt, ...) +macro_build (expressionS *ep, const char *name, const char *fmt, ...) { struct mips_cl_insn insn; bfd_reloc_code_real_type r[3]; @@ -2834,32 +2982,9 @@ macro_build (char *place, int *counter, expressionS *ep, const char *name, va_start (args, fmt); - /* - * If the macro is about to expand into a second instruction, - * print a warning if needed. We need to pass ip as a parameter - * to generate a better warning message here... - */ - if (mips_opts.warn_about_macros && place == NULL && *counter == 1) - as_warn (_("Macro instruction expanded into multiple instructions")); - - /* - * If the macro is about to expand into a second instruction, - * and it is in a delay slot, print a warning. - */ - if (place == NULL - && *counter == 1 - && mips_opts.noreorder - && (prev_prev_insn.insn_mo->pinfo - & (INSN_UNCOND_BRANCH_DELAY | INSN_COND_BRANCH_DELAY - | INSN_COND_BRANCH_LIKELY)) != 0) - as_warn (_("Macro instruction expanded into multiple instructions in a branch delay slot")); - - if (place == NULL) - ++*counter; /* bump instruction counter */ - if (mips_opts.mips16) { - mips16_macro_build (place, counter, ep, name, fmt, args); + mips16_macro_build (ep, name, fmt, args); va_end (args); return; } @@ -3073,12 +3198,11 @@ macro_build (char *place, int *counter, expressionS *ep, const char *name, va_end (args); assert (*r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); - append_insn (place, &insn, ep, r); + append_insn (&insn, ep, r); } static void -mips16_macro_build (char *place, int *counter ATTRIBUTE_UNUSED, - expressionS *ep, const char *name, const char *fmt, +mips16_macro_build (expressionS *ep, const char *name, const char *fmt, va_list args) { struct mips_cl_insn insn; @@ -3195,7 +3319,7 @@ mips16_macro_build (char *place, int *counter ATTRIBUTE_UNUSED, assert (*r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); - append_insn (place, &insn, ep, r); + append_insn (&insn, ep, r); } /* @@ -3203,7 +3327,7 @@ mips16_macro_build (char *place, int *counter ATTRIBUTE_UNUSED, * function. This occurs in NewABI PIC code. */ static void -macro_build_jalr (int icnt, expressionS *ep) +macro_build_jalr (expressionS *ep) { char *f = NULL; @@ -3212,7 +3336,7 @@ macro_build_jalr (int icnt, expressionS *ep) frag_grow (8); f = frag_more (0); } - macro_build (NULL, &icnt, NULL, "jalr", "d,s", RA, PIC_CALL_REG); + macro_build (NULL, "jalr", "d,s", RA, PIC_CALL_REG); if (HAVE_NEWABI) fix_new_exp (frag_now, f - frag_now->fr_literal, 4, ep, FALSE, BFD_RELOC_MIPS_JALR); @@ -3222,7 +3346,7 @@ macro_build_jalr (int icnt, expressionS *ep) * Generate a "lui" instruction. */ static void -macro_build_lui (char *place, int *counter, expressionS *ep, int regnum) +macro_build_lui (expressionS *ep, int regnum) { expressionS high_expr; struct mips_cl_insn insn; @@ -3233,13 +3357,7 @@ macro_build_lui (char *place, int *counter, expressionS *ep, int regnum) assert (! mips_opts.mips16); - if (place == NULL) - high_expr = *ep; - else - { - high_expr.X_op = O_constant; - high_expr.X_add_number = ep->X_add_number; - } + high_expr = *ep; if (high_expr.X_op == O_constant) { @@ -3258,17 +3376,6 @@ macro_build_lui (char *place, int *counter, expressionS *ep, int regnum) *r = BFD_RELOC_HI16_S; } - /* - * If the macro is about to expand into a second instruction, - * print a warning if needed. We need to pass ip as a parameter - * to generate a better warning message here... - */ - if (mips_opts.warn_about_macros && place == NULL && *counter == 1) - as_warn (_("Macro instruction expanded into multiple instructions")); - - if (place == NULL) - ++*counter; /* bump instruction counter */ - insn.insn_mo = (struct mips_opcode *) hash_find (op_hash, name); assert (insn.insn_mo); assert (strcmp (name, insn.insn_mo->name) == 0); @@ -3278,18 +3385,18 @@ macro_build_lui (char *place, int *counter, expressionS *ep, int regnum) if (*r == BFD_RELOC_UNUSED) { insn.insn_opcode |= high_expr.X_add_number; - append_insn (place, &insn, NULL, r); + append_insn (&insn, NULL, r); } else - append_insn (place, &insn, &high_expr, r); + append_insn (&insn, &high_expr, r); } /* Generate a sequence of instructions to do a load or store from a constant offset off of a base register (breg) into/from a target register (treg), using AT if necessary. */ static void -macro_build_ldst_constoffset (char *place, int *counter, expressionS *ep, - const char *op, int treg, int breg, int dbl) +macro_build_ldst_constoffset (expressionS *ep, const char *op, + int treg, int breg, int dbl) { assert (ep->X_op == O_constant); @@ -3311,8 +3418,7 @@ macro_build_ldst_constoffset (char *place, int *counter, expressionS *ep, if (IS_SEXT_16BIT_NUM(ep->X_add_number)) { /* Signed 16-bit offset will fit in the op. Easy! */ - macro_build (place, counter, ep, op, "t,o(b)", treg, BFD_RELOC_LO16, - breg); + macro_build (ep, op, "t,o(b)", treg, BFD_RELOC_LO16, breg); } else { @@ -3321,15 +3427,9 @@ macro_build_ldst_constoffset (char *place, int *counter, expressionS *ep, addu $tempreg,$tempreg,$breg <op> $treg,const_lo($tempreg) (BFD_RELOC_LO16) to handle the complete offset. */ - macro_build_lui (place, counter, ep, AT); - if (place != NULL) - place += 4; - macro_build (place, counter, NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, - breg); - if (place != NULL) - place += 4; - macro_build (place, counter, ep, op, "t,o(b)", treg, BFD_RELOC_LO16, - AT); + macro_build_lui (ep, AT); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, breg); + macro_build (ep, op, "t,o(b)", treg, BFD_RELOC_LO16, AT); if (mips_opts.noat) as_warn (_("Macro used $at after \".set noat\"")); @@ -3341,18 +3441,17 @@ macro_build_ldst_constoffset (char *place, int *counter, expressionS *ep, * if reg is less than the immediate expression. */ static void -set_at (int *counter, int reg, int unsignedp) +set_at (int reg, int unsignedp) { if (imm_expr.X_op == O_constant && imm_expr.X_add_number >= -0x8000 && imm_expr.X_add_number < 0x8000) - macro_build (NULL, counter, &imm_expr, unsignedp ? "sltiu" : "slti", - "t,r,j", AT, reg, BFD_RELOC_LO16); + macro_build (&imm_expr, unsignedp ? "sltiu" : "slti", "t,r,j", + AT, reg, BFD_RELOC_LO16); else { - load_register (counter, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, counter, NULL, unsignedp ? "sltu" : "slt", - "d,v,t", AT, reg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, unsignedp ? "sltu" : "slt", "d,v,t", AT, reg, AT); } } @@ -3458,7 +3557,7 @@ check_absolute_expr (struct mips_cl_insn *ip, expressionS *ex) * an absolute expression value into a register. */ static void -load_register (int *counter, int reg, expressionS *ep, int dbl) +load_register (int reg, expressionS *ep, int dbl) { int freg; expressionS hi32, lo32; @@ -3483,25 +3582,22 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) /* We can handle 16 bit signed values with an addiu to $zero. No need to ever use daddiu here, since $zero and the result are always correct in 32 bit mode. */ - macro_build (NULL, counter, ep, "addiu", "t,r,j", reg, 0, - BFD_RELOC_LO16); + macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16); return; } else if (ep->X_add_number >= 0 && ep->X_add_number < 0x10000) { /* We can handle 16 bit unsigned values with an ori to $zero. */ - macro_build (NULL, counter, ep, "ori", "t,r,i", reg, 0, - BFD_RELOC_LO16); + macro_build (ep, "ori", "t,r,i", reg, 0, BFD_RELOC_LO16); return; } else if ((IS_SEXT_32BIT_NUM (ep->X_add_number))) { /* 32 bit values require an lui. */ - macro_build (NULL, counter, ep, "lui", "t,u", reg, BFD_RELOC_HI16); + macro_build (ep, "lui", "t,u", reg, BFD_RELOC_HI16); if ((ep->X_add_number & 0xffff) != 0) - macro_build (NULL, counter, ep, "ori", "t,r,i", reg, reg, - BFD_RELOC_LO16); + macro_build (ep, "ori", "t,r,i", reg, reg, BFD_RELOC_LO16); return; } } @@ -3512,8 +3608,7 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) { as_bad (_("Number (0x%lx) larger than 32 bits"), (unsigned long) ep->X_add_number); - macro_build (NULL, counter, ep, "addiu", "t,r,j", reg, 0, - BFD_RELOC_LO16); + macro_build (ep, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16); return; } @@ -3550,17 +3645,14 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) { if ((lo32.X_add_number & 0xffff8000) == 0xffff8000) { - macro_build (NULL, counter, &lo32, "addiu", "t,r,j", reg, 0, - BFD_RELOC_LO16); + macro_build (&lo32, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16); return; } if (lo32.X_add_number & 0x80000000) { - macro_build (NULL, counter, &lo32, "lui", "t,u", reg, - BFD_RELOC_HI16); + macro_build (&lo32, "lui", "t,u", reg, BFD_RELOC_HI16); if (lo32.X_add_number & 0xffff) - macro_build (NULL, counter, &lo32, "ori", "t,r,i", reg, reg, - BFD_RELOC_LO16); + macro_build (&lo32, "ori", "t,r,i", reg, reg, BFD_RELOC_LO16); return; } } @@ -3594,12 +3686,9 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) | (lo32.X_add_number >> shift)); else tmp.X_add_number = hi32.X_add_number >> (shift - 32); - macro_build (NULL, counter, &tmp, "ori", "t,r,i", reg, 0, - BFD_RELOC_LO16); - macro_build (NULL, counter, NULL, - (shift >= 32) ? "dsll32" : "dsll", - "d,w,<", reg, reg, - (shift >= 32) ? shift - 32 : shift); + macro_build (&tmp, "ori", "t,r,i", reg, 0, BFD_RELOC_LO16); + macro_build (NULL, (shift >= 32) ? "dsll32" : "dsll", "d,w,<", + reg, reg, (shift >= 32) ? shift - 32 : shift); return; } ++shift; @@ -3646,20 +3735,15 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) ones. */ tmp.X_op = O_constant; tmp.X_add_number = (offsetT) -1; - macro_build (NULL, counter, &tmp, "addiu", "t,r,j", reg, 0, - BFD_RELOC_LO16); + macro_build (&tmp, "addiu", "t,r,j", reg, 0, BFD_RELOC_LO16); if (bit != 0) { bit += shift; - macro_build (NULL, counter, NULL, - (bit >= 32) ? "dsll32" : "dsll", - "d,w,<", reg, reg, - (bit >= 32) ? bit - 32 : bit); + macro_build (NULL, (bit >= 32) ? "dsll32" : "dsll", "d,w,<", + reg, reg, (bit >= 32) ? bit - 32 : bit); } - macro_build (NULL, counter, NULL, - (shift >= 32) ? "dsrl32" : "dsrl", - "d,w,<", reg, reg, - (shift >= 32) ? shift - 32 : shift); + macro_build (NULL, (shift >= 32) ? "dsrl32" : "dsrl", "d,w,<", + reg, reg, (shift >= 32) ? shift - 32 : shift); return; } } @@ -3668,14 +3752,14 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) generally get better code when we load a sign extended value. */ if ((hi32.X_add_number & 0x80000000) != 0) hi32.X_add_number |= ~(offsetT) 0xffffffff; - load_register (counter, reg, &hi32, 0); + load_register (reg, &hi32, 0); freg = reg; } if ((lo32.X_add_number & 0xffff0000) == 0) { if (freg != 0) { - macro_build (NULL, counter, NULL, "dsll32", "d,w,<", reg, freg, 0); + macro_build (NULL, "dsll32", "d,w,<", reg, freg, 0); freg = reg; } } @@ -3685,36 +3769,31 @@ load_register (int *counter, int reg, expressionS *ep, int dbl) if ((freg == 0) && (lo32.X_add_number == (offsetT) 0xffffffff)) { - macro_build (NULL, counter, &lo32, "lui", "t,u", reg, - BFD_RELOC_HI16); - macro_build (NULL, counter, NULL, "dsrl32", "d,w,<", reg, reg, 0); + macro_build (&lo32, "lui", "t,u", reg, BFD_RELOC_HI16); + macro_build (NULL, "dsrl32", "d,w,<", reg, reg, 0); return; } if (freg != 0) { - macro_build (NULL, counter, NULL, "dsll", "d,w,<", reg, freg, 16); + macro_build (NULL, "dsll", "d,w,<", reg, freg, 16); freg = reg; } mid16 = lo32; mid16.X_add_number >>= 16; - macro_build (NULL, counter, &mid16, "ori", "t,r,i", reg, freg, - BFD_RELOC_LO16); - macro_build (NULL, counter, NULL, "dsll", "d,w,<", reg, reg, 16); + macro_build (&mid16, "ori", "t,r,i", reg, freg, BFD_RELOC_LO16); + macro_build (NULL, "dsll", "d,w,<", reg, reg, 16); freg = reg; } if ((lo32.X_add_number & 0xffff) != 0) - macro_build (NULL, counter, &lo32, "ori", "t,r,i", reg, freg, - BFD_RELOC_LO16); + macro_build (&lo32, "ori", "t,r,i", reg, freg, BFD_RELOC_LO16); } /* Load an address into a register. */ static void -load_address (int *counter, int reg, expressionS *ep, int *used_at) +load_address (int reg, expressionS *ep, int *used_at) { - char *p = NULL; - if (ep->X_op != O_constant && ep->X_op != O_symbol) { @@ -3724,7 +3803,7 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) if (ep->X_op == O_constant) { - load_register (counter, reg, ep, HAVE_64BIT_ADDRESSES); + load_register (reg, ep, HAVE_64BIT_ADDRESSES); return; } @@ -3756,35 +3835,30 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) */ if (HAVE_64BIT_ADDRESSES) { - /* We don't do GP optimization for now because RELAX_ENCODE can't - hold the data for such large chunks. */ + /* ??? We don't provide a GP-relative alternative for these macros. + It used not to be possible with the original relaxation code, + but it could be done now. */ if (*used_at == 0 && ! mips_opts.noat) { - macro_build (p, counter, ep, "lui", "t,u", - reg, BFD_RELOC_MIPS_HIGHEST); - macro_build (p, counter, ep, "lui", "t,u", - AT, BFD_RELOC_HI16_S); - macro_build (p, counter, ep, "daddiu", "t,r,j", - reg, reg, BFD_RELOC_MIPS_HIGHER); - macro_build (p, counter, ep, "daddiu", "t,r,j", - AT, AT, BFD_RELOC_LO16); - macro_build (p, counter, NULL, "dsll32", "d,w,<", reg, reg, 0); - macro_build (p, counter, NULL, "daddu", "d,v,t", reg, reg, AT); + macro_build (ep, "lui", "t,u", reg, BFD_RELOC_MIPS_HIGHEST); + macro_build (ep, "lui", "t,u", AT, BFD_RELOC_HI16_S); + macro_build (ep, "daddiu", "t,r,j", reg, reg, + BFD_RELOC_MIPS_HIGHER); + macro_build (ep, "daddiu", "t,r,j", AT, AT, BFD_RELOC_LO16); + macro_build (NULL, "dsll32", "d,w,<", reg, reg, 0); + macro_build (NULL, "daddu", "d,v,t", reg, reg, AT); *used_at = 1; } else { - macro_build (p, counter, ep, "lui", "t,u", - reg, BFD_RELOC_MIPS_HIGHEST); - macro_build (p, counter, ep, "daddiu", "t,r,j", - reg, reg, BFD_RELOC_MIPS_HIGHER); - macro_build (p, counter, NULL, "dsll", "d,w,<", reg, reg, 16); - macro_build (p, counter, ep, "daddiu", "t,r,j", - reg, reg, BFD_RELOC_HI16_S); - macro_build (p, counter, NULL, "dsll", "d,w,<", reg, reg, 16); - macro_build (p, counter, ep, "daddiu", "t,r,j", - reg, reg, BFD_RELOC_LO16); + macro_build (ep, "lui", "t,u", reg, BFD_RELOC_MIPS_HIGHEST); + macro_build (ep, "daddiu", "t,r,j", reg, reg, + BFD_RELOC_MIPS_HIGHER); + macro_build (NULL, "dsll", "d,w,<", reg, reg, 16); + macro_build (ep, "daddiu", "t,r,j", reg, reg, BFD_RELOC_HI16_S); + macro_build (NULL, "dsll", "d,w,<", reg, reg, 16); + macro_build (ep, "daddiu", "t,r,j", reg, reg, BFD_RELOC_LO16); } } else @@ -3792,19 +3866,16 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) if ((valueT) ep->X_add_number <= MAX_GPREL_OFFSET && ! nopic_need_relax (ep->X_add_symbol, 1)) { - frag_grow (20); - macro_build (NULL, counter, ep, ADDRESS_ADDI_INSN, "t,r,j", reg, + relax_start (ep->X_add_symbol); + macro_build (ep, ADDRESS_ADDI_INSN, "t,r,j", reg, mips_gp_register, BFD_RELOC_GPREL16); - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (4, 8, 0, 4, 0, - mips_opts.warn_about_macros), - ep->X_add_symbol, 0, NULL); + relax_switch (); } - macro_build_lui (p, counter, ep, reg); - if (p != NULL) - p += 4; - macro_build (p, counter, ep, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, - BFD_RELOC_LO16); + macro_build_lui (ep, reg); + macro_build (ep, ADDRESS_ADDI_INSN, "t,r,j", + reg, reg, BFD_RELOC_LO16); + if (mips_relax.sequence) + relax_end (); } } else if (mips_pic == SVR4_PIC && ! mips_big_got) @@ -3825,59 +3896,45 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) offset, in which case cst must be added separately. */ if (HAVE_NEWABI) { - frag_grow (12); - if (ep->X_add_number) { - frag_now->tc_frag_data.tc_fr_offset = - ex.X_add_number = ep->X_add_number; + ex.X_add_number = ep->X_add_number; ep->X_add_number = 0; - macro_build (NULL, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", - reg, BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); + relax_start (ep->X_add_symbol); + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, + BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); if (ex.X_add_number < -0x8000 || ex.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); ex.X_op = O_constant; - macro_build (NULL, counter, &ex, ADDRESS_ADDI_INSN, "t,r,j", + macro_build (&ex, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, BFD_RELOC_LO16); - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (8, 4, 0, 0, 0, - mips_opts.warn_about_macros), - ep->X_add_symbol, 0, NULL); ep->X_add_number = ex.X_add_number; + relax_switch (); } - - macro_build (p, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); - - if (! p) - { - /* To avoid confusion in tc_gen_reloc, we must ensure - that this does not become a variant frag. */ - frag_wane (frag_now); - frag_new (0); - } + if (mips_relax.sequence) + relax_end (); } else { ex.X_add_number = ep->X_add_number; ep->X_add_number = 0; - frag_grow (20); - macro_build (NULL, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, - BFD_RELOC_MIPS_GOT16, - mips_gp_register); - macro_build (NULL, counter, NULL, "nop", ""); - p = frag_var (rs_machine_dependent, 4, 0, - RELAX_ENCODE (0, 4, -8, 0, 0, mips_opts.warn_about_macros), - ep->X_add_symbol, 0, NULL); - macro_build (p, counter, ep, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, + BFD_RELOC_MIPS_GOT16, mips_gp_register); + macro_build (NULL, "nop", ""); + relax_start (ep->X_add_symbol); + relax_switch (); + macro_build (ep, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, BFD_RELOC_LO16); + relax_end (); if (ex.X_add_number != 0) { if (ex.X_add_number < -0x8000 || ex.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); ex.X_op = O_constant; - macro_build (NULL, counter, &ex, ADDRESS_ADDI_INSN, "t,r,j", + macro_build (&ex, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, BFD_RELOC_LO16); } } @@ -3885,7 +3942,6 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) else if (mips_pic == SVR4_PIC) { expressionS ex; - int off; /* This is the large GOT case. If this is a reference to an external symbol, we want @@ -3905,79 +3961,64 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) */ if (HAVE_NEWABI) { - frag_grow (24); - - frag_now->tc_frag_data.tc_fr_offset = - ex.X_add_number = ep->X_add_number; + ex.X_add_number = ep->X_add_number; ep->X_add_number = 0; - macro_build (NULL, counter, ep, "lui", "t,u", reg, - BFD_RELOC_MIPS_GOT_HI16); - macro_build (NULL, counter, NULL, ADDRESS_ADD_INSN, "d,v,t", reg, - reg, mips_gp_register); - macro_build (NULL, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, - BFD_RELOC_MIPS_GOT_LO16, reg); + relax_start (ep->X_add_symbol); + macro_build (ep, "lui", "t,u", reg, BFD_RELOC_MIPS_GOT_HI16); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", + reg, reg, mips_gp_register); + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", + reg, BFD_RELOC_MIPS_GOT_LO16, reg); if (ex.X_add_number < -0x8000 || ex.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); else if (ex.X_add_number) { ex.X_op = O_constant; - macro_build (NULL, counter, &ex, ADDRESS_ADDI_INSN, "t,r,j", - reg, reg, BFD_RELOC_LO16); + macro_build (&ex, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, + BFD_RELOC_LO16); } ep->X_add_number = ex.X_add_number; - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (ex.X_add_number ? 16 : 12, 8, 0, 4, 0, - mips_opts.warn_about_macros), - ep->X_add_symbol, 0, NULL); - macro_build (p, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, + relax_switch (); + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); - macro_build (p + 4, counter, ep, ADDRESS_ADDI_INSN, "t,r,j", reg, - reg, BFD_RELOC_MIPS_GOT_OFST); + macro_build (ep, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, + BFD_RELOC_MIPS_GOT_OFST); + relax_end (); } else { ex.X_add_number = ep->X_add_number; ep->X_add_number = 0; + relax_start (ep->X_add_symbol); + macro_build (ep, "lui", "t,u", reg, BFD_RELOC_MIPS_GOT_HI16); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", + reg, reg, mips_gp_register); + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", + reg, BFD_RELOC_MIPS_GOT_LO16, reg); + relax_switch (); if (reg_needs_delay (mips_gp_register)) - off = 4; - else - off = 0; - frag_grow (32); - macro_build (NULL, counter, ep, "lui", "t,u", reg, - BFD_RELOC_MIPS_GOT_HI16); - macro_build (NULL, counter, NULL, ADDRESS_ADD_INSN, "d,v,t", reg, - reg, mips_gp_register); - macro_build (NULL, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, - BFD_RELOC_MIPS_GOT_LO16, reg); - p = frag_var (rs_machine_dependent, 12 + off, 0, - RELAX_ENCODE (12, 12 + off, off, 8 + off, 0, - mips_opts.warn_about_macros), - ep->X_add_symbol, 0, NULL); - if (off > 0) { /* We need a nop before loading from $gp. This special check is required because the lui which starts the main instruction stream does not refer to $gp, and so will not insert the nop which may be required. */ - macro_build (p, counter, NULL, "nop", ""); - p += 4; + macro_build (NULL, "nop", ""); } - macro_build (p, counter, ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, + macro_build (ep, ADDRESS_LOAD_INSN, "t,o(b)", reg, BFD_RELOC_MIPS_GOT16, mips_gp_register); - p += 4; - macro_build (p, counter, NULL, "nop", ""); - p += 4; - macro_build (p, counter, ep, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, + macro_build (NULL, "nop", ""); + macro_build (ep, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, BFD_RELOC_LO16); + relax_end (); if (ex.X_add_number != 0) { if (ex.X_add_number < -0x8000 || ex.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); ex.X_op = O_constant; - macro_build (NULL, counter, &ex, ADDRESS_ADDI_INSN, "t,r,j", - reg, reg, BFD_RELOC_LO16); + macro_build (&ex, ADDRESS_ADDI_INSN, "t,r,j", reg, reg, + BFD_RELOC_LO16); } } } @@ -3986,8 +4027,8 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) /* We always do addiu $reg,$gp,<sym> (BFD_RELOC_GPREL16) */ - macro_build (NULL, counter, ep, ADDRESS_ADDI_INSN, "t,r,j", reg, - mips_gp_register, BFD_RELOC_GPREL16); + macro_build (ep, ADDRESS_ADDI_INSN, "t,r,j", + reg, mips_gp_register, BFD_RELOC_GPREL16); } else abort (); @@ -3996,10 +4037,85 @@ load_address (int *counter, int reg, expressionS *ep, int *used_at) /* Move the contents of register SOURCE into register DEST. */ static void -move_register (int *counter, int dest, int source) +move_register (int dest, int source) +{ + macro_build (NULL, HAVE_32BIT_GPRS ? "addu" : "daddu", "d,v,t", + dest, source, 0); +} + +/* Emit an SVR4 PIC sequence to load address LOCAL into DEST, where + LOCAL is the sum of a symbol and a 16-bit or 32-bit displacement. + The two alternatives are: + + Global symbol Local sybmol + ------------- ------------ + lw DEST,%got(SYMBOL) lw DEST,%got(SYMBOL + OFFSET) + ... ... + addiu DEST,DEST,OFFSET addiu DEST,DEST,%lo(SYMBOL + OFFSET) + + load_got_offset emits the first instruction and add_got_offset + emits the second for a 16-bit offset or add_got_offset_hilo emits + a sequence to add a 32-bit offset using a scratch register. */ + +static void +load_got_offset (int dest, expressionS *local) +{ + expressionS global; + + global = *local; + global.X_add_number = 0; + + relax_start (local->X_add_symbol); + macro_build (&global, ADDRESS_LOAD_INSN, "t,o(b)", dest, + BFD_RELOC_MIPS_GOT16, mips_gp_register); + relax_switch (); + macro_build (local, ADDRESS_LOAD_INSN, "t,o(b)", dest, + BFD_RELOC_MIPS_GOT16, mips_gp_register); + relax_end (); +} + +static void +add_got_offset (int dest, expressionS *local) { - macro_build (NULL, counter, NULL, HAVE_32BIT_GPRS ? "addu" : "daddu", - "d,v,t", dest, source, 0); + expressionS global; + + global.X_op = O_constant; + global.X_op_symbol = NULL; + global.X_add_symbol = NULL; + global.X_add_number = local->X_add_number; + + relax_start (local->X_add_symbol); + macro_build (&global, ADDRESS_ADDI_INSN, "t,r,j", + dest, dest, BFD_RELOC_LO16); + relax_switch (); + macro_build (local, ADDRESS_ADDI_INSN, "t,r,j", dest, dest, BFD_RELOC_LO16); + relax_end (); +} + +static void +add_got_offset_hilo (int dest, expressionS *local, int tmp) +{ + expressionS global; + int hold_mips_optimize; + + global.X_op = O_constant; + global.X_op_symbol = NULL; + global.X_add_symbol = NULL; + global.X_add_number = local->X_add_number; + + relax_start (local->X_add_symbol); + load_register (tmp, &global, HAVE_64BIT_ADDRESSES); + relax_switch (); + /* Set mips_optimize around the lui instruction to avoid + inserting an unnecessary nop after the lw. */ + hold_mips_optimize = mips_optimize; + mips_optimize = 2; + macro_build_lui (&global, tmp); + mips_optimize = hold_mips_optimize; + macro_build (local, ADDRESS_ADDI_INSN, "t,r,j", tmp, tmp, BFD_RELOC_LO16); + relax_end (); + + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", dest, dest, tmp); } /* @@ -4026,7 +4142,6 @@ macro (struct mips_cl_insn *ip) register int treg, sreg, dreg, breg; int tempreg; int mask; - int icnt = 0; int used_at = 0; expressionS expr1; const char *s; @@ -4038,8 +4153,8 @@ macro (struct mips_cl_insn *ip) int lr = 0; int imm = 0; int call = 0; - offsetT maxnum; int off; + offsetT maxnum; bfd_reloc_code_real_type r; int hold_mips_optimize; @@ -4055,30 +4170,6 @@ macro (struct mips_cl_insn *ip) expr1.X_add_symbol = NULL; expr1.X_add_number = 1; - /* Unmatched fixups should not be put in the same frag as a relaxable - macro. For example, suppose we have: - - lui $4,%hi(l1) # 1 - la $5,l2 # 2 - addiu $4,$4,%lo(l1) # 3 - - If instructions 1 and 2 were put in the same frag, md_frob_file would - move the fixup for #1 after the fixups for the "unrelaxed" version of - #2. This would confuse tc_gen_reloc, which expects the relocations - for #2 to be the last for that frag. - - Also, if tc_gen_reloc sees certain relocations in a variant frag, - it assumes that they belong to a relaxable macro. We mustn't put - other uses of such relocations into a variant frag. - - To avoid both problems, finish the current frag it contains a - %reloc() operator. The macro then goes into a new frag. */ - if (prev_reloc_op_frag == frag_now) - { - frag_wane (frag_now); - frag_new (0); - } - switch (mask) { case M_DABS: @@ -4094,13 +4185,12 @@ macro (struct mips_cl_insn *ip) mips_any_noreorder = 1; expr1.X_add_number = 8; - macro_build (NULL, &icnt, &expr1, "bgez", "s,p", sreg); + macro_build (&expr1, "bgez", "s,p", sreg); if (dreg == sreg) - macro_build (NULL, &icnt, NULL, "nop", "", 0); + macro_build (NULL, "nop", "", 0); else - move_register (&icnt, dreg, sreg); - macro_build (NULL, &icnt, NULL, dbl ? "dsub" : "sub", "d,v,t", dreg, 0, - sreg); + move_register (dreg, sreg); + macro_build (NULL, dbl ? "dsub" : "sub", "d,v,t", dreg, 0, sreg); --mips_opts.noreorder; return; @@ -4127,12 +4217,11 @@ macro (struct mips_cl_insn *ip) && imm_expr.X_add_number >= -0x8000 && imm_expr.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &imm_expr, s, "t,r,j", treg, sreg, - BFD_RELOC_LO16); + macro_build (&imm_expr, s, "t,r,j", treg, sreg, BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, s2, "d,v,t", treg, sreg, AT); + load_register (AT, &imm_expr, dbl); + macro_build (NULL, s2, "d,v,t", treg, sreg, AT); break; case M_AND_I: @@ -4156,19 +4245,18 @@ macro (struct mips_cl_insn *ip) && imm_expr.X_add_number < 0x10000) { if (mask != M_NOR_I) - macro_build (NULL, &icnt, &imm_expr, s, "t,r,i", treg, sreg, - BFD_RELOC_LO16); + macro_build (&imm_expr, s, "t,r,i", treg, sreg, BFD_RELOC_LO16); else { - macro_build (NULL, &icnt, &imm_expr, "ori", "t,r,i", treg, sreg, - BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, "nor", "d,v,t", treg, treg, 0); + macro_build (&imm_expr, "ori", "t,r,i", + treg, sreg, BFD_RELOC_LO16); + macro_build (NULL, "nor", "d,v,t", treg, treg, 0); } return; } - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, s2, "d,v,t", treg, sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, s2, "d,v,t", treg, sreg, AT); break; case M_BEQ_I: @@ -4187,11 +4275,11 @@ macro (struct mips_cl_insn *ip) beq_i: if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0) { - macro_build (NULL, &icnt, &offset_expr, s, "s,t,p", sreg, 0); + macro_build (&offset_expr, s, "s,t,p", sreg, 0); return; } - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, &offset_expr, s, "s,t,p", sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (&offset_expr, s, "s,t,p", sreg, AT); break; case M_BGEL: @@ -4199,19 +4287,16 @@ macro (struct mips_cl_insn *ip) case M_BGE: if (treg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bgezl" : "bgez", - "s,p", sreg); + macro_build (&offset_expr, likely ? "bgezl" : "bgez", "s,p", sreg); return; } if (sreg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "blezl" : "blez", - "s,p", treg); + macro_build (&offset_expr, likely ? "blezl" : "blez", "s,p", treg); return; } - macro_build (NULL, &icnt, NULL, "slt", "d,v,t", AT, sreg, treg); - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", - "s,t,p", AT, 0); + macro_build (NULL, "slt", "d,v,t", AT, sreg, treg); + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0); break; case M_BGTL_I: @@ -4233,9 +4318,9 @@ macro (struct mips_cl_insn *ip) do_false: /* result is always false */ if (! likely) - macro_build (NULL, &icnt, NULL, "nop", "", 0); + macro_build (NULL, "nop", "", 0); else - macro_build (NULL, &icnt, &offset_expr, "bnel", "s,t,p", 0, 0); + macro_build (&offset_expr, "bnel", "s,t,p", 0, 0); return; } if (imm_expr.X_op != O_constant) @@ -4248,14 +4333,12 @@ macro (struct mips_cl_insn *ip) likely = 1; if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bgezl" : "bgez", - "s,p", sreg); + macro_build (&offset_expr, likely ? "bgezl" : "bgez", "s,p", sreg); return; } if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bgtzl" : "bgtz", - "s,p", sreg); + macro_build (&offset_expr, likely ? "bgtzl" : "bgtz", "s,p", sreg); return; } maxnum = 0x7fffffff; @@ -4274,12 +4357,11 @@ macro (struct mips_cl_insn *ip) do_true: /* result is always true */ as_warn (_("Branch %s is always true"), ip->insn_mo->name); - macro_build (NULL, &icnt, &offset_expr, "b", "p"); + macro_build (&offset_expr, "b", "p"); return; } - set_at (&icnt, sreg, 0); - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", - "s,t,p", AT, 0); + set_at (sreg, 0); + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0); break; case M_BGEUL: @@ -4289,13 +4371,12 @@ macro (struct mips_cl_insn *ip) goto do_true; if (sreg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", 0, treg); return; } - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", AT, sreg, treg); - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", - "s,t,p", AT, 0); + macro_build (NULL, "sltu", "d,v,t", AT, sreg, treg); + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0); break; case M_BGTUL_I: @@ -4318,13 +4399,12 @@ macro (struct mips_cl_insn *ip) goto do_true; if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", sreg, 0); return; } - set_at (&icnt, sreg, 1); - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", - "s,t,p", AT, 0); + set_at (sreg, 1); + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0); break; case M_BGTL: @@ -4332,19 +4412,16 @@ macro (struct mips_cl_insn *ip) case M_BGT: if (treg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bgtzl" : "bgtz", - "s,p", sreg); + macro_build (&offset_expr, likely ? "bgtzl" : "bgtz", "s,p", sreg); return; } if (sreg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bltzl" : "bltz", - "s,p", treg); + macro_build (&offset_expr, likely ? "bltzl" : "bltz", "s,p", treg); return; } - macro_build (NULL, &icnt, NULL, "slt", "d,v,t", AT, treg, sreg); - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", - "s,t,p", AT, 0); + macro_build (NULL, "slt", "d,v,t", AT, treg, sreg); + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0); break; case M_BGTUL: @@ -4352,15 +4429,14 @@ macro (struct mips_cl_insn *ip) case M_BGTU: if (treg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", sreg, 0); return; } if (sreg == 0) goto do_false; - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", AT, treg, sreg); - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", - "s,t,p", AT, 0); + macro_build (NULL, "sltu", "d,v,t", AT, treg, sreg); + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0); break; case M_BLEL: @@ -4368,19 +4444,16 @@ macro (struct mips_cl_insn *ip) case M_BLE: if (treg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "blezl" : "blez", - "s,p", sreg); + macro_build (&offset_expr, likely ? "blezl" : "blez", "s,p", sreg); return; } if (sreg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bgezl" : "bgez", - "s,p", treg); + macro_build (&offset_expr, likely ? "bgezl" : "bgez", "s,p", treg); return; } - macro_build (NULL, &icnt, NULL, "slt", "d,v,t", AT, treg, sreg); - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", - "s,t,p", AT, 0); + macro_build (NULL, "slt", "d,v,t", AT, treg, sreg); + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0); break; case M_BLEL_I: @@ -4408,19 +4481,16 @@ macro (struct mips_cl_insn *ip) likely = 1; if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bltzl" : "bltz", - "s,p", sreg); + macro_build (&offset_expr, likely ? "bltzl" : "bltz", "s,p", sreg); return; } if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1) { - macro_build (NULL, &icnt, &offset_expr, likely ? "blezl" : "blez", - "s,p", sreg); + macro_build (&offset_expr, likely ? "blezl" : "blez", "s,p", sreg); return; } - set_at (&icnt, sreg, 0); - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", - "s,t,p", AT, 0); + set_at (sreg, 0); + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0); break; case M_BLEUL: @@ -4428,15 +4498,14 @@ macro (struct mips_cl_insn *ip) case M_BLEU: if (treg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", sreg, 0); return; } if (sreg == 0) goto do_true; - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", AT, treg, sreg); - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", - "s,t,p", AT, 0); + macro_build (NULL, "sltu", "d,v,t", AT, treg, sreg); + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", AT, 0); break; case M_BLEUL_I: @@ -4459,13 +4528,12 @@ macro (struct mips_cl_insn *ip) goto do_false; if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1) { - macro_build (NULL, &icnt, &offset_expr, likely ? "beql" : "beq", + macro_build (&offset_expr, likely ? "beql" : "beq", "s,t,p", sreg, 0); return; } - set_at (&icnt, sreg, 1); - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", - "s,t,p", AT, 0); + set_at (sreg, 1); + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0); break; case M_BLTL: @@ -4473,19 +4541,16 @@ macro (struct mips_cl_insn *ip) case M_BLT: if (treg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bltzl" : "bltz", - "s,p", sreg); + macro_build (&offset_expr, likely ? "bltzl" : "bltz", "s,p", sreg); return; } if (sreg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bgtzl" : "bgtz", - "s,p", treg); + macro_build (&offset_expr, likely ? "bgtzl" : "bgtz", "s,p", treg); return; } - macro_build (NULL, &icnt, NULL, "slt", "d,v,t", AT, sreg, treg); - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", - "s,t,p", AT, 0); + macro_build (NULL, "slt", "d,v,t", AT, sreg, treg); + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0); break; case M_BLTUL: @@ -4495,13 +4560,12 @@ macro (struct mips_cl_insn *ip) goto do_false; if (sreg == 0) { - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", 0, treg); return; } - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", AT, sreg, treg); - macro_build (NULL, &icnt, &offset_expr, likely ? "bnel" : "bne", - "s,t,p", AT, 0); + macro_build (NULL, "sltu", "d,v,t", AT, sreg, treg); + macro_build (&offset_expr, likely ? "bnel" : "bne", "s,t,p", AT, 0); break; case M_DEXT: @@ -4548,8 +4612,7 @@ macro (struct mips_cl_insn *ip) s = "dextm"; fmt = "t,r,+A,+G"; } - macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, - fmt, treg, sreg, pos, size - 1); + macro_build ((expressionS *) NULL, s, fmt, treg, sreg, pos, size - 1); } return; @@ -4597,8 +4660,8 @@ macro (struct mips_cl_insn *ip) s = "dinsm"; fmt = "t,r,+A,+F"; } - macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, - fmt, treg, sreg, pos, pos + size - 1); + macro_build ((expressionS *) NULL, s, fmt, treg, sreg, pos, + pos + size - 1); } return; @@ -4616,9 +4679,9 @@ macro (struct mips_cl_insn *ip) { as_warn (_("Divide by zero.")); if (mips_trap) - macro_build (NULL, &icnt, NULL, "teq", "s,t,q", 0, 0, 7); + macro_build (NULL, "teq", "s,t,q", 0, 0, 7); else - macro_build (NULL, &icnt, NULL, "break", "c", 7); + macro_build (NULL, "break", "c", 7); return; } @@ -4627,39 +4690,34 @@ macro (struct mips_cl_insn *ip) mips_any_noreorder = 1; if (mips_trap) { - macro_build (NULL, &icnt, NULL, "teq", "s,t,q", treg, 0, 7); - macro_build (NULL, &icnt, NULL, dbl ? "ddiv" : "div", "z,s,t", - sreg, treg); + macro_build (NULL, "teq", "s,t,q", treg, 0, 7); + macro_build (NULL, dbl ? "ddiv" : "div", "z,s,t", sreg, treg); } else { expr1.X_add_number = 8; - macro_build (NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0); - macro_build (NULL, &icnt, NULL, dbl ? "ddiv" : "div", "z,s,t", - sreg, treg); - macro_build (NULL, &icnt, NULL, "break", "c", 7); + macro_build (&expr1, "bne", "s,t,p", treg, 0); + macro_build (NULL, dbl ? "ddiv" : "div", "z,s,t", sreg, treg); + macro_build (NULL, "break", "c", 7); } expr1.X_add_number = -1; - macro_build (NULL, &icnt, &expr1, dbl ? "daddiu" : "addiu", "t,r,j", - AT, 0, BFD_RELOC_LO16); + load_register (AT, &expr1, dbl); expr1.X_add_number = mips_trap ? (dbl ? 12 : 8) : (dbl ? 20 : 16); - macro_build (NULL, &icnt, &expr1, "bne", "s,t,p", treg, AT); + macro_build (&expr1, "bne", "s,t,p", treg, AT); if (dbl) { expr1.X_add_number = 1; - macro_build (NULL, &icnt, &expr1, "daddiu", "t,r,j", AT, 0, - BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, "dsll32", "d,w,<", AT, AT, 31); + load_register (AT, &expr1, dbl); + macro_build (NULL, "dsll32", "d,w,<", AT, AT, 31); } else { expr1.X_add_number = 0x80000000; - macro_build (NULL, &icnt, &expr1, "lui", "t,u", AT, - BFD_RELOC_HI16); + macro_build (&expr1, "lui", "t,u", AT, BFD_RELOC_HI16); } if (mips_trap) { - macro_build (NULL, &icnt, NULL, "teq", "s,t,q", sreg, AT, 6); + macro_build (NULL, "teq", "s,t,q", sreg, AT, 6); /* We want to close the noreorder block as soon as possible, so that later insns are available for delay slot filling. */ --mips_opts.noreorder; @@ -4667,16 +4725,16 @@ macro (struct mips_cl_insn *ip) else { expr1.X_add_number = 8; - macro_build (NULL, &icnt, &expr1, "bne", "s,t,p", sreg, AT); - macro_build (NULL, &icnt, NULL, "nop", "", 0); + macro_build (&expr1, "bne", "s,t,p", sreg, AT); + macro_build (NULL, "nop", "", 0); /* We want to close the noreorder block as soon as possible, so that later insns are available for delay slot filling. */ --mips_opts.noreorder; - macro_build (NULL, &icnt, NULL, "break", "c", 6); + macro_build (NULL, "break", "c", 6); } - macro_build (NULL, &icnt, NULL, s, "d", dreg); + macro_build (NULL, s, "d", dreg); break; case M_DIV_3I: @@ -4719,17 +4777,17 @@ macro (struct mips_cl_insn *ip) { as_warn (_("Divide by zero.")); if (mips_trap) - macro_build (NULL, &icnt, NULL, "teq", "s,t,q", 0, 0, 7); + macro_build (NULL, "teq", "s,t,q", 0, 0, 7); else - macro_build (NULL, &icnt, NULL, "break", "c", 7); + macro_build (NULL, "break", "c", 7); return; } if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1) { if (strcmp (s2, "mflo") == 0) - move_register (&icnt, dreg, sreg); + move_register (dreg, sreg); else - move_register (&icnt, dreg, 0); + move_register (dreg, 0); return; } if (imm_expr.X_op == O_constant @@ -4738,17 +4796,16 @@ macro (struct mips_cl_insn *ip) { if (strcmp (s2, "mflo") == 0) { - macro_build (NULL, &icnt, NULL, dbl ? "dneg" : "neg", "d,w", - dreg, sreg); + macro_build (NULL, dbl ? "dneg" : "neg", "d,w", dreg, sreg); } else - move_register (&icnt, dreg, 0); + move_register (dreg, 0); return; } - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, s, "z,s,t", sreg, AT); - macro_build (NULL, &icnt, NULL, s2, "d", dreg); + load_register (AT, &imm_expr, dbl); + macro_build (NULL, s, "z,s,t", sreg, AT); + macro_build (NULL, s2, "d", dreg); break; case M_DIVU_3: @@ -4772,8 +4829,8 @@ macro (struct mips_cl_insn *ip) mips_any_noreorder = 1; if (mips_trap) { - macro_build (NULL, &icnt, NULL, "teq", "s,t,q", treg, 0, 7); - macro_build (NULL, &icnt, NULL, s, "z,s,t", sreg, treg); + macro_build (NULL, "teq", "s,t,q", treg, 0, 7); + macro_build (NULL, s, "z,s,t", sreg, treg); /* We want to close the noreorder block as soon as possible, so that later insns are available for delay slot filling. */ --mips_opts.noreorder; @@ -4781,15 +4838,15 @@ macro (struct mips_cl_insn *ip) else { expr1.X_add_number = 8; - macro_build (NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0); - macro_build (NULL, &icnt, NULL, s, "z,s,t", sreg, treg); + macro_build (&expr1, "bne", "s,t,p", treg, 0); + macro_build (NULL, s, "z,s,t", sreg, treg); /* We want to close the noreorder block as soon as possible, so that later insns are available for delay slot filling. */ --mips_opts.noreorder; - macro_build (NULL, &icnt, NULL, "break", "c", 7); + macro_build (NULL, "break", "c", 7); } - macro_build (NULL, &icnt, NULL, s2, "d", dreg); + macro_build (NULL, s2, "d", dreg); return; case M_DLCA_AB: @@ -4814,7 +4871,7 @@ macro (struct mips_cl_insn *ip) && offset_expr.X_add_number >= -0x8000 && offset_expr.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &offset_expr, + macro_build (&offset_expr, (dbl || HAVE_64BIT_ADDRESSES) ? "daddiu" : "addiu", "t,r,j", treg, sreg, BFD_RELOC_LO16); return; @@ -4856,18 +4913,18 @@ macro (struct mips_cl_insn *ip) { tempreg = treg; used_at = 0; - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, - BFD_RELOC_PCREL_HI16_S); + macro_build (&offset_expr, "lui", "t,u", + tempreg, BFD_RELOC_PCREL_HI16_S); } else { - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, - BFD_RELOC_PCREL_HI16_S); - macro_build (NULL, &icnt, NULL, + macro_build (&offset_expr, "lui", "t,u", + tempreg, BFD_RELOC_PCREL_HI16_S); + macro_build (NULL, (dbl || HAVE_64BIT_ADDRESSES) ? "daddu" : "addu", "d,v,t", tempreg, tempreg, breg); } - macro_build (NULL, &icnt, &offset_expr, + macro_build (&offset_expr, (dbl || HAVE_64BIT_ADDRESSES) ? "daddiu" : "addiu", "t,r,j", treg, tempreg, BFD_RELOC_PCREL_LO16); if (! used_at) @@ -4883,7 +4940,7 @@ macro (struct mips_cl_insn *ip) } if (offset_expr.X_op == O_constant) - load_register (&icnt, tempreg, &offset_expr, + load_register (tempreg, &offset_expr, ((mips_pic == EMBEDDED_PIC || mips_pic == NO_PIC) ? (dbl || HAVE_64BIT_ADDRESSES) : HAVE_64BIT_ADDRESSES)); @@ -4914,41 +4971,37 @@ macro (struct mips_cl_insn *ip) dsll $tempreg,16 daddiu $tempreg,<sym> (BFD_RELOC_LO16) */ - char *p = NULL; if (HAVE_64BIT_ADDRESSES) { - /* We don't do GP optimization for now because RELAX_ENCODE can't - hold the data for such large chunks. */ + /* ??? We don't provide a GP-relative alternative for + these macros. It used not to be possible with the + original relaxation code, but it could be done now. */ if (used_at == 0 && ! mips_opts.noat) { - macro_build (p, &icnt, &offset_expr, "lui", "t,u", + macro_build (&offset_expr, "lui", "t,u", tempreg, BFD_RELOC_MIPS_HIGHEST); - macro_build (p, &icnt, &offset_expr, "lui", "t,u", + macro_build (&offset_expr, "lui", "t,u", AT, BFD_RELOC_HI16_S); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, tempreg, BFD_RELOC_MIPS_HIGHER); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", + macro_build (&offset_expr, "daddiu", "t,r,j", AT, AT, BFD_RELOC_LO16); - macro_build (p, &icnt, NULL, "dsll32", "d,w,<", - tempreg, tempreg, 0); - macro_build (p, &icnt, NULL, "daddu", "d,v,t", - tempreg, tempreg, AT); + macro_build (NULL, "dsll32", "d,w,<", tempreg, tempreg, 0); + macro_build (NULL, "daddu", "d,v,t", tempreg, tempreg, AT); used_at = 1; } else { - macro_build (p, &icnt, &offset_expr, "lui", "t,u", + macro_build (&offset_expr, "lui", "t,u", tempreg, BFD_RELOC_MIPS_HIGHEST); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, tempreg, BFD_RELOC_MIPS_HIGHER); - macro_build (p, &icnt, NULL, "dsll", "d,w,<", - tempreg, tempreg, 16); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", + macro_build (NULL, "dsll", "d,w,<", tempreg, tempreg, 16); + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, tempreg, BFD_RELOC_HI16_S); - macro_build (p, &icnt, NULL, "dsll", "d,w,<", - tempreg, tempreg, 16); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", + macro_build (NULL, "dsll", "d,w,<", tempreg, tempreg, 16); + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); } } @@ -4957,20 +5010,16 @@ macro (struct mips_cl_insn *ip) if ((valueT) offset_expr.X_add_number <= MAX_GPREL_OFFSET && ! nopic_need_relax (offset_expr.X_add_symbol, 1)) { - frag_grow (20); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, mips_gp_register, - BFD_RELOC_GPREL16); - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (4, 8, 0, 4, 0, - mips_opts.warn_about_macros), - offset_expr.X_add_symbol, 0, NULL); + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", + tempreg, mips_gp_register, BFD_RELOC_GPREL16); + relax_switch (); } - macro_build_lui (p, &icnt, &offset_expr, tempreg); - if (p != NULL) - p += 4; - macro_build (p, &icnt, &offset_expr, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); + macro_build_lui (&offset_expr, tempreg); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", + tempreg, tempreg, BFD_RELOC_LO16); + if (mips_relax.sequence) + relax_end (); } } else if (mips_pic == SVR4_PIC && ! mips_big_got && ! HAVE_NEWABI) @@ -5007,60 +5056,46 @@ macro (struct mips_cl_insn *ip) addiu instruction. */ - expr1.X_add_number = offset_expr.X_add_number; - offset_expr.X_add_number = 0; - frag_grow (32); - if (expr1.X_add_number == 0 && breg == 0 - && (call || tempreg == PIC_CALL_REG)) - lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, lw_reloc_type, mips_gp_register); - if (expr1.X_add_number == 0) + if (offset_expr.X_add_number == 0) { - int off; - char *p; + if (breg == 0 && (call || tempreg == PIC_CALL_REG)) + lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; - if (breg == 0) - off = 0; - else + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + lw_reloc_type, mips_gp_register); + if (breg != 0) { /* We're going to put in an addu instruction using tempreg, so we may as well insert the nop right now. */ - macro_build (NULL, &icnt, NULL, "nop", ""); - off = 4; + macro_build (NULL, "nop", ""); } - p = frag_var (rs_machine_dependent, 8 - off, 0, - RELAX_ENCODE (0, 8 - off, -4 - off, 4 - off, 0, - (breg == 0 - ? mips_opts.warn_about_macros - : 0)), - offset_expr.X_add_symbol, 0, NULL); - if (breg == 0) - { - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - } - macro_build (p, &icnt, &expr1, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); + relax_switch (); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + tempreg, BFD_RELOC_MIPS_GOT16, mips_gp_register); + macro_build (NULL, "nop", ""); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", + tempreg, tempreg, BFD_RELOC_LO16); + relax_end (); /* FIXME: If breg == 0, and the next instruction uses $tempreg, then if this variant case is used an extra nop will be generated. */ } - else if (expr1.X_add_number >= -0x8000 - && expr1.X_add_number < 0x8000) + else if (offset_expr.X_add_number >= -0x8000 + && offset_expr.X_add_number < 0x8000) { - macro_build (NULL, &icnt, NULL, "nop", ""); - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); - frag_var (rs_machine_dependent, 0, 0, - RELAX_ENCODE (0, 0, -12, -4, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + load_got_offset (tempreg, &offset_expr); + macro_build (NULL, "nop", ""); + add_got_offset (tempreg, &offset_expr); } else { - int off1; - + expr1.X_add_number = offset_expr.X_add_number; + offset_expr.X_add_number = + ((offset_expr.X_add_number + 0x8000) & 0xffff) - 0x8000; + load_got_offset (tempreg, &offset_expr); + offset_expr.X_add_number = expr1.X_add_number; /* If we are going to add in a base register, and the target register and the base register are the same, then we are using AT as a temporary register. Since @@ -5068,40 +5103,21 @@ macro (struct mips_cl_insn *ip) current AT (from the global offset table) and the register into the register now, and pretend we were not using a base register. */ - if (breg != treg) - off1 = 0; - else + if (breg == treg) { - macro_build (NULL, &icnt, NULL, "nop", ""); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, "nop", ""); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, AT, breg); breg = 0; tempreg = treg; - off1 = -8; } - - /* Set mips_optimize around the lui instruction to avoid - inserting an unnecessary nop after the lw. */ - hold_mips_optimize = mips_optimize; - mips_optimize = 2; - macro_build_lui (NULL, &icnt, &expr1, AT); - mips_optimize = hold_mips_optimize; - - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, "t,r,j", - AT, AT, BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - tempreg, tempreg, AT); - frag_var (rs_machine_dependent, 0, 0, - RELAX_ENCODE (0, 0, -16 + off1, -8, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + add_got_offset_hilo (tempreg, &offset_expr, AT); used_at = 1; } } else if (mips_pic == SVR4_PIC && ! mips_big_got && HAVE_NEWABI) { - char *p = NULL; - int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_DISP; - int adj = 0; + int add_breg_early = 0; /* If this is a reference to an external, and there is no constant, or local symbol (*), with or without a @@ -5126,28 +5142,20 @@ macro (struct mips_cl_insn *ip) local symbols, even though it introduces an additional instruction. */ - frag_grow (28); - if (offset_expr.X_add_number == 0 && breg == 0 - && (call || tempreg == PIC_CALL_REG)) - lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; if (offset_expr.X_add_number) { - frag_now->tc_frag_data.tc_fr_offset = - expr1.X_add_number = offset_expr.X_add_number; + expr1.X_add_number = offset_expr.X_add_number; offset_expr.X_add_number = 0; - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", tempreg, lw_reloc_type, - mips_gp_register); + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); if (expr1.X_add_number >= -0x8000 && expr1.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); - p = frag_var (rs_machine_dependent, 4, 0, - RELAX_ENCODE (8, 4, 0, 0, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + macro_build (&expr1, ADDRESS_ADDI_INSN, "t,r,j", + tempreg, tempreg, BFD_RELOC_LO16); } else if (IS_SEXT_32BIT_NUM (expr1.X_add_number + 0x8000)) { @@ -5165,64 +5173,54 @@ macro (struct mips_cl_insn *ip) else { assert (tempreg == AT); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, - "d,v,t", treg, AT, breg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", + treg, AT, breg); dreg = treg; - adj = 4; + add_breg_early = 1; } - macro_build_lui (NULL, &icnt, &expr1, AT); - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, - "t,r,j", AT, AT, BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + load_register (AT, &expr1, HAVE_64BIT_ADDRESSES); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", dreg, dreg, AT); - p = frag_var (rs_machine_dependent, 4 + adj, 0, - RELAX_ENCODE (16 + adj, 4 + adj, - 0, 0, 0, 0), - offset_expr.X_add_symbol, 0, NULL); - used_at = 1; } else as_bad (_("PIC code offset overflow (max 32 signed bits)")); + relax_switch (); offset_expr.X_add_number = expr1.X_add_number; - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", tempreg, BFD_RELOC_MIPS_GOT_DISP, - mips_gp_register); - if (adj) + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); + if (add_breg_early) { - macro_build (p + 4, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, tempreg, breg); breg = 0; tempreg = treg; } + relax_end (); } - else + else if (breg == 0 && (call || tempreg == PIC_CALL_REG)) { - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", tempreg, lw_reloc_type, - mips_gp_register); - if (lw_reloc_type != BFD_RELOC_MIPS_GOT_DISP) - p = frag_var (rs_machine_dependent, 0, 0, - RELAX_ENCODE (0, 0, -4, 0, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_CALL16, mips_gp_register); + relax_switch (); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); + relax_end (); } - - if (! p) + else { - /* To avoid confusion in tc_gen_reloc, we must ensure - that this does not become a variant frag. */ - frag_wane (frag_now); - frag_new (0); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); } } else if (mips_pic == SVR4_PIC && ! HAVE_NEWABI) { - int gpdel; - char *p; + int gpdelay; int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16; int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16; int local_reloc_type = (int) BFD_RELOC_MIPS_GOT16; @@ -5270,63 +5268,39 @@ macro (struct mips_cl_insn *ip) expr1.X_add_number = offset_expr.X_add_number; offset_expr.X_add_number = 0; - frag_grow (52); - if (reg_needs_delay (mips_gp_register)) - gpdel = 4; - else - gpdel = 0; + relax_start (offset_expr.X_add_symbol); + gpdelay = reg_needs_delay (mips_gp_register); if (expr1.X_add_number == 0 && breg == 0 && (call || tempreg == PIC_CALL_REG)) { lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16; lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16; } - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", - tempreg, lui_reloc_type); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (&offset_expr, "lui", "t,u", tempreg, lui_reloc_type); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, lw_reloc_type, tempreg); if (expr1.X_add_number == 0) { - int off; - - if (breg == 0) - off = 0; - else + if (breg != 0) { /* We're going to put in an addu instruction using tempreg, so we may as well insert the nop right now. */ - macro_build (NULL, &icnt, NULL, "nop", ""); - off = 4; + macro_build (NULL, "nop", ""); } - - p = frag_var (rs_machine_dependent, 12 + gpdel, 0, - RELAX_ENCODE (12 + off, 12 + gpdel, gpdel, - 8 + gpdel, 0, - (breg == 0 - ? mips_opts.warn_about_macros - : 0)), - offset_expr.X_add_symbol, 0, NULL); } else if (expr1.X_add_number >= -0x8000 && expr1.X_add_number < 0x8000) { - macro_build (NULL, &icnt, NULL, "nop", ""); - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, "t,r,j", + macro_build (NULL, "nop", ""); + macro_build (&expr1, ADDRESS_ADDI_INSN, "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); - - p = frag_var (rs_machine_dependent, 12 + gpdel, 0, - RELAX_ENCODE (20, 12 + gpdel, gpdel, 8 + gpdel, 0, - (breg == 0 - ? mips_opts.warn_about_macros - : 0)), - offset_expr.X_add_symbol, 0, NULL); } else { - int adj, dreg; + int dreg; /* If we are going to add in a base register, and the target register and the base register are the same, @@ -5336,61 +5310,40 @@ macro (struct mips_cl_insn *ip) register into the register now, and pretend we were not using a base register. */ if (breg != treg) - { - adj = 0; - dreg = tempreg; - } + dreg = tempreg; else { assert (tempreg == AT); - macro_build (NULL, &icnt, NULL, "nop", ""); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, "nop", ""); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, AT, breg); dreg = treg; - adj = 8; } - /* Set mips_optimize around the lui instruction to avoid - inserting an unnecessary nop after the lw. */ - hold_mips_optimize = mips_optimize; - mips_optimize = 2; - macro_build_lui (NULL, &icnt, &expr1, AT); - mips_optimize = hold_mips_optimize; - - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, "t,r,j", - AT, AT, BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - dreg, dreg, AT); - - p = frag_var (rs_machine_dependent, 16 + gpdel + adj, 0, - RELAX_ENCODE (24 + adj, 16 + gpdel + adj, gpdel, - 8 + gpdel, 0, - (breg == 0 - ? mips_opts.warn_about_macros - : 0)), - offset_expr.X_add_symbol, 0, NULL); + load_register (AT, &expr1, HAVE_64BIT_ADDRESSES); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", dreg, dreg, AT); used_at = 1; } + offset_expr.X_add_number = + ((expr1.X_add_number + 0x8000) & 0xffff) - 0x8000; + relax_switch (); - if (gpdel > 0) + if (gpdelay) { /* This is needed because this instruction uses $gp, but the first instruction on the main stream does not. */ - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; + macro_build (NULL, "nop", ""); } - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, local_reloc_type, mips_gp_register); - p += 4; + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + local_reloc_type, mips_gp_register); if (expr1.X_add_number >= -0x8000 && expr1.X_add_number < 0x8000) { - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - macro_build (p, &icnt, &expr1, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); + macro_build (NULL, "nop", ""); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", + tempreg, tempreg, BFD_RELOC_LO16); /* FIXME: If add_number is 0, and there was no base register, the external symbol case ended with a load, so if the symbol turns out to not be external, and @@ -5404,33 +5357,28 @@ macro (struct mips_cl_insn *ip) /* We must add in the base register now, as in the external symbol case. */ assert (tempreg == AT); - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - macro_build (p, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, "nop", ""); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, AT, breg); - p += 4; tempreg = treg; /* We set breg to 0 because we have arranged to add it in in both cases. */ breg = 0; } - macro_build_lui (p, &icnt, &expr1, AT); - p += 4; - macro_build (p, &icnt, &expr1, ADDRESS_ADDI_INSN, "t,r,j", + macro_build_lui (&expr1, AT); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", AT, AT, BFD_RELOC_LO16); - p += 4; - macro_build (p, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, AT); - p += 4; } + relax_end (); } else if (mips_pic == SVR4_PIC && HAVE_NEWABI) { - char *p = NULL; int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16; int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16; - int adj = 0; + int add_breg_early = 0; /* This is the large GOT case. If this is a reference to an external symbol, and there is no constant, we want @@ -5463,10 +5411,9 @@ macro (struct mips_cl_insn *ip) addiu $reg,$reg,<sym> (BFD_RELOC_MIPS_GOT_OFST) otherwise we have to resort to GOT_HI16/GOT_LO16. */ - frag_grow (40); + relax_start (offset_expr.X_add_symbol); - frag_now->tc_frag_data.tc_fr_offset = - expr1.X_add_number = offset_expr.X_add_number; + expr1.X_add_number = offset_expr.X_add_number; offset_expr.X_add_number = 0; if (expr1.X_add_number == 0 && breg == 0 @@ -5475,29 +5422,19 @@ macro (struct mips_cl_insn *ip) lui_reloc_type = (int) BFD_RELOC_MIPS_CALL_HI16; lw_reloc_type = (int) BFD_RELOC_MIPS_CALL_LO16; } - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", - tempreg, lui_reloc_type); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (&offset_expr, "lui", "t,u", tempreg, lui_reloc_type); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", tempreg, lw_reloc_type, tempreg); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + tempreg, lw_reloc_type, tempreg); if (expr1.X_add_number == 0) - { - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (12, 8, 0, 4, 0, - mips_opts.warn_about_macros), - offset_expr.X_add_symbol, 0, NULL); - } + ; else if (expr1.X_add_number >= -0x8000 && expr1.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, "t,r,j", + macro_build (&expr1, ADDRESS_ADDI_INSN, "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (16, 8, 0, 4, 0, - mips_opts.warn_about_macros), - offset_expr.X_add_symbol, 0, NULL); } else if (IS_SEXT_32BIT_NUM (expr1.X_add_number + 0x8000)) { @@ -5515,53 +5452,42 @@ macro (struct mips_cl_insn *ip) else { assert (tempreg == AT); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, AT, breg); dreg = treg; - adj = 4; + add_breg_early = 1; } - /* Set mips_optimize around the lui instruction to avoid - inserting an unnecessary nop after the lw. */ - macro_build_lui (NULL, &icnt, &expr1, AT); - macro_build (NULL, &icnt, &expr1, ADDRESS_ADDI_INSN, - "t,r,j", AT, AT, BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - dreg, dreg, AT); - - p = frag_var (rs_machine_dependent, 8 + adj, 0, - RELAX_ENCODE (24 + adj, 8 + adj, - 0, 4, 0, - (breg == 0 - ? mips_opts.warn_about_macros - : 0)), - offset_expr.X_add_symbol, 0, NULL); + load_register (AT, &expr1, HAVE_64BIT_ADDRESSES); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", dreg, dreg, AT); used_at = 1; } else as_bad (_("PIC code offset overflow (max 32 signed bits)")); + relax_switch (); offset_expr.X_add_number = expr1.X_add_number; - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); - macro_build (p + 4, &icnt, &offset_expr, ADDRESS_ADDI_INSN, "t,r,j", - tempreg, tempreg, BFD_RELOC_MIPS_GOT_OFST); - if (adj) + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", tempreg, + tempreg, BFD_RELOC_MIPS_GOT_OFST); + if (add_breg_early) { - macro_build (p + 8, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, tempreg, breg); breg = 0; tempreg = treg; } + relax_end (); } else if (mips_pic == EMBEDDED_PIC) { /* We use addiu $tempreg,$gp,<sym> (BFD_RELOC_GPREL16) */ - macro_build (NULL, &icnt, &offset_expr, ADDRESS_ADDI_INSN, "t,r,j", - tempreg, mips_gp_register, BFD_RELOC_GPREL16); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", tempreg, + mips_gp_register, BFD_RELOC_GPREL16); } else abort (); @@ -5575,7 +5501,7 @@ macro (struct mips_cl_insn *ip) else s = ADDRESS_ADD_INSN; - macro_build (NULL, &icnt, NULL, s, "d,v,t", treg, tempreg, breg); + macro_build (NULL, s, "d,v,t", treg, tempreg, breg); } if (! used_at) @@ -5588,9 +5514,9 @@ macro (struct mips_cl_insn *ip) requires an absolute address. We convert it to a b instruction. */ if (mips_pic == NO_PIC) - macro_build (NULL, &icnt, &offset_expr, "j", "a"); + macro_build (&offset_expr, "j", "a"); else - macro_build (NULL, &icnt, &offset_expr, "b", "p"); + macro_build (&offset_expr, "b", "p"); return; /* The jal instructions must be handled as macros because when @@ -5602,13 +5528,13 @@ macro (struct mips_cl_insn *ip) case M_JAL_2: if (mips_pic == NO_PIC || mips_pic == EMBEDDED_PIC) - macro_build (NULL, &icnt, NULL, "jalr", "d,s", dreg, sreg); + macro_build (NULL, "jalr", "d,s", dreg, sreg); else if (mips_pic == SVR4_PIC) { if (sreg != PIC_CALL_REG) as_warn (_("MIPS PIC call to register other than $25")); - macro_build (NULL, &icnt, NULL, "jalr", "d,s", dreg, sreg); + macro_build (NULL, "jalr", "d,s", dreg, sreg); if (! HAVE_NEWABI) { if (mips_cprestore_offset < 0) @@ -5628,8 +5554,7 @@ macro (struct mips_cl_insn *ip) mips_cprestore_valid = 1; } expr1.X_add_number = mips_cprestore_offset; - macro_build_ldst_constoffset (NULL, &icnt, &expr1, - ADDRESS_LOAD_INSN, + macro_build_ldst_constoffset (&expr1, ADDRESS_LOAD_INSN, mips_gp_register, mips_frame_reg, HAVE_64BIT_ADDRESSES); @@ -5643,11 +5568,9 @@ macro (struct mips_cl_insn *ip) case M_JAL_A: if (mips_pic == NO_PIC) - macro_build (NULL, &icnt, &offset_expr, "jal", "a"); + macro_build (&offset_expr, "jal", "a"); else if (mips_pic == SVR4_PIC) { - char *p; - /* If this is a reference to an external symbol, and we are using a small GOT, we want lw $25,<sym>($gp) (BFD_RELOC_MIPS_CALL16) @@ -5680,86 +5603,74 @@ macro (struct mips_cl_insn *ip) { if (! mips_big_got) { - frag_grow (4); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", PIC_CALL_REG, BFD_RELOC_MIPS_CALL16, + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_CALL16, + mips_gp_register); + relax_switch (); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); - frag_var (rs_machine_dependent, 0, 0, - RELAX_ENCODE (0, 0, -4, 0, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + relax_end (); } else { - frag_grow (20); - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", - PIC_CALL_REG, BFD_RELOC_MIPS_CALL_HI16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - PIC_CALL_REG, PIC_CALL_REG, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", PIC_CALL_REG, - BFD_RELOC_MIPS_CALL_LO16, PIC_CALL_REG); - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (12, 8, 0, 4, 0, 0), - offset_expr.X_add_symbol, 0, NULL); - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", PIC_CALL_REG, - BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); - macro_build (p + 4, &icnt, &offset_expr, ADDRESS_ADDI_INSN, - "t,r,j", PIC_CALL_REG, PIC_CALL_REG, + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, "lui", "t,u", PIC_CALL_REG, + BFD_RELOC_MIPS_CALL_HI16); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", PIC_CALL_REG, + PIC_CALL_REG, mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_CALL_LO16, + PIC_CALL_REG); + relax_switch (); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_GOT_PAGE, + mips_gp_register); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", + PIC_CALL_REG, PIC_CALL_REG, BFD_RELOC_MIPS_GOT_OFST); + relax_end (); } - macro_build_jalr (icnt, &offset_expr); + macro_build_jalr (&offset_expr); } else { - frag_grow (40); + relax_start (offset_expr.X_add_symbol); if (! mips_big_got) { - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", PIC_CALL_REG, BFD_RELOC_MIPS_CALL16, + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_CALL16, mips_gp_register); - macro_build (NULL, &icnt, NULL, "nop", ""); - p = frag_var (rs_machine_dependent, 4, 0, - RELAX_ENCODE (0, 4, -8, 0, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + macro_build (NULL, "nop", ""); + relax_switch (); } else { - int gpdel; - - if (reg_needs_delay (mips_gp_register)) - gpdel = 4; - else - gpdel = 0; - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", - PIC_CALL_REG, BFD_RELOC_MIPS_CALL_HI16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - PIC_CALL_REG, PIC_CALL_REG, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", PIC_CALL_REG, - BFD_RELOC_MIPS_CALL_LO16, PIC_CALL_REG); - macro_build (NULL, &icnt, NULL, "nop", ""); - p = frag_var (rs_machine_dependent, 12 + gpdel, 0, - RELAX_ENCODE (16, 12 + gpdel, gpdel, - 8 + gpdel, 0, 0), - offset_expr.X_add_symbol, 0, NULL); - if (gpdel > 0) - { - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - } - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", PIC_CALL_REG, BFD_RELOC_MIPS_GOT16, - mips_gp_register); - p += 4; - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; + int gpdelay; + + gpdelay = reg_needs_delay (mips_gp_register); + macro_build (&offset_expr, "lui", "t,u", PIC_CALL_REG, + BFD_RELOC_MIPS_CALL_HI16); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", PIC_CALL_REG, + PIC_CALL_REG, mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_CALL_LO16, + PIC_CALL_REG); + macro_build (NULL, "nop", ""); + relax_switch (); + if (gpdelay) + macro_build (NULL, "nop", ""); } - macro_build (p, &icnt, &offset_expr, ADDRESS_ADDI_INSN, - "t,r,j", PIC_CALL_REG, PIC_CALL_REG, - BFD_RELOC_LO16); - macro_build_jalr (icnt, &offset_expr); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + PIC_CALL_REG, BFD_RELOC_MIPS_GOT16, + mips_gp_register); + macro_build (NULL, "nop", ""); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", + PIC_CALL_REG, PIC_CALL_REG, BFD_RELOC_LO16); + relax_end (); + macro_build_jalr (&offset_expr); if (mips_cprestore_offset < 0) as_warn (_("No .cprestore pseudo-op used in PIC code")); @@ -5778,10 +5689,9 @@ macro (struct mips_cl_insn *ip) mips_cprestore_valid = 1; } if (mips_opts.noreorder) - macro_build (NULL, &icnt, NULL, "nop", ""); + macro_build (NULL, "nop", ""); expr1.X_add_number = mips_cprestore_offset; - macro_build_ldst_constoffset (NULL, &icnt, &expr1, - ADDRESS_LOAD_INSN, + macro_build_ldst_constoffset (&expr1, ADDRESS_LOAD_INSN, mips_gp_register, mips_frame_reg, HAVE_64BIT_ADDRESSES); @@ -5790,7 +5700,7 @@ macro (struct mips_cl_insn *ip) } else if (mips_pic == EMBEDDED_PIC) { - macro_build (NULL, &icnt, &offset_expr, "bal", "p"); + macro_build (&offset_expr, "bal", "p"); /* The linker may expand the call to a longer sequence which uses $at, so we must break rather than return. */ break; @@ -6016,15 +5926,15 @@ macro (struct mips_cl_insn *ip) nice to emit: <op> $treg,<sym>($breg) (BFD_RELOC_PCREL_LO16) instead, but that seems quite difficult. */ - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, + macro_build (&offset_expr, "lui", "t,u", tempreg, BFD_RELOC_PCREL_HI16_S); - macro_build (NULL, &icnt, NULL, - ((bfd_arch_bits_per_address (stdoutput) == 32 - || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) - ? "addu" : "daddu"), - "d,v,t", tempreg, tempreg, breg); - macro_build (NULL, &icnt, &offset_expr, s, fmt, treg, - BFD_RELOC_PCREL_LO16, tempreg); + macro_build (NULL, + ((bfd_arch_bits_per_address (stdoutput) == 32 + || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) + ? "addu" : "daddu"), + "d,v,t", tempreg, tempreg, breg); + macro_build (&offset_expr, s, fmt, treg, + BFD_RELOC_PCREL_LO16, tempreg); if (! used_at) return; break; @@ -6042,8 +5952,6 @@ macro (struct mips_cl_insn *ip) if (mips_pic == NO_PIC || offset_expr.X_op == O_constant) { - char *p; - /* If this is a reference to a GP relative symbol, and there is no base register, we want <op> $treg,<sym>($gp) (BFD_RELOC_GPREL16) @@ -6129,46 +6037,40 @@ macro (struct mips_cl_insn *ip) && offset_expr.X_op == O_constant && ! IS_SEXT_32BIT_NUM (offset_expr.X_add_number + 0x8000))) { - p = NULL; - - /* We don't do GP optimization for now because RELAX_ENCODE can't - hold the data for such large chunks. */ + /* ??? We don't provide a GP-relative alternative for + these macros. It used not to be possible with the + original relaxation code, but it could be done now. */ if (used_at == 0 && ! mips_opts.noat) { - macro_build (p, &icnt, &offset_expr, "lui", "t,u", - tempreg, BFD_RELOC_MIPS_HIGHEST); - macro_build (p, &icnt, &offset_expr, "lui", "t,u", - AT, BFD_RELOC_HI16_S); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", - tempreg, tempreg, BFD_RELOC_MIPS_HIGHER); + macro_build (&offset_expr, "lui", "t,u", tempreg, + BFD_RELOC_MIPS_HIGHEST); + macro_build (&offset_expr, "lui", "t,u", AT, + BFD_RELOC_HI16_S); + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, + tempreg, BFD_RELOC_MIPS_HIGHER); if (breg != 0) - macro_build (p, &icnt, NULL, "daddu", "d,v,t", - AT, AT, breg); - macro_build (p, &icnt, NULL, "dsll32", "d,w,<", - tempreg, tempreg, 0); - macro_build (p, &icnt, NULL, "daddu", "d,v,t", - tempreg, tempreg, AT); - macro_build (p, &icnt, &offset_expr, s, fmt, treg, - BFD_RELOC_LO16, tempreg); + macro_build (NULL, "daddu", "d,v,t", AT, AT, breg); + macro_build (NULL, "dsll32", "d,w,<", tempreg, tempreg, 0); + macro_build (NULL, "daddu", "d,v,t", tempreg, tempreg, AT); + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_LO16, + tempreg); used_at = 1; } else { - macro_build (p, &icnt, &offset_expr, "lui", "t,u", - tempreg, BFD_RELOC_MIPS_HIGHEST); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", - tempreg, tempreg, BFD_RELOC_MIPS_HIGHER); - macro_build (p, &icnt, NULL, "dsll", "d,w,<", - tempreg, tempreg, 16); - macro_build (p, &icnt, &offset_expr, "daddiu", "t,r,j", - tempreg, tempreg, BFD_RELOC_HI16_S); - macro_build (p, &icnt, NULL, "dsll", "d,w,<", - tempreg, tempreg, 16); + macro_build (&offset_expr, "lui", "t,u", tempreg, + BFD_RELOC_MIPS_HIGHEST); + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, + tempreg, BFD_RELOC_MIPS_HIGHER); + macro_build (NULL, "dsll", "d,w,<", tempreg, tempreg, 16); + macro_build (&offset_expr, "daddiu", "t,r,j", tempreg, + tempreg, BFD_RELOC_HI16_S); + macro_build (NULL, "dsll", "d,w,<", tempreg, tempreg, 16); if (breg != 0) - macro_build (p, &icnt, NULL, "daddu", "d,v,t", + macro_build (NULL, "daddu", "d,v,t", tempreg, tempreg, breg); - macro_build (p, &icnt, &offset_expr, s, fmt, treg, + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_LO16, tempreg); } @@ -6181,58 +6083,44 @@ macro (struct mips_cl_insn *ip) if (breg == 0) { - if ((valueT) offset_expr.X_add_number > MAX_GPREL_OFFSET - || nopic_need_relax (offset_expr.X_add_symbol, 1)) - p = NULL; - else + if ((valueT) offset_expr.X_add_number <= MAX_GPREL_OFFSET + && ! nopic_need_relax (offset_expr.X_add_symbol, 1)) { - frag_grow (20); - macro_build (NULL, &icnt, &offset_expr, s, fmt, treg, - BFD_RELOC_GPREL16, mips_gp_register); - p = frag_var (rs_machine_dependent, 8, 0, - RELAX_ENCODE (4, 8, 0, 4, 0, - (mips_opts.warn_about_macros - || (used_at - && mips_opts.noat))), - offset_expr.X_add_symbol, 0, NULL); + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_GPREL16, + mips_gp_register); + relax_switch (); used_at = 0; } - macro_build_lui (p, &icnt, &offset_expr, tempreg); - if (p != NULL) - p += 4; - macro_build (p, &icnt, &offset_expr, s, fmt, treg, + macro_build_lui (&offset_expr, tempreg); + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_LO16, tempreg); + if (mips_relax.sequence) + relax_end (); } else { - if ((valueT) offset_expr.X_add_number > MAX_GPREL_OFFSET - || nopic_need_relax (offset_expr.X_add_symbol, 1)) - p = NULL; - else + if ((valueT) offset_expr.X_add_number <= MAX_GPREL_OFFSET + && ! nopic_need_relax (offset_expr.X_add_symbol, 1)) { - frag_grow (28); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + relax_start (offset_expr.X_add_symbol); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, breg, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, s, fmt, treg, + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_GPREL16, tempreg); - p = frag_var (rs_machine_dependent, 12, 0, - RELAX_ENCODE (8, 12, 0, 8, 0, 0), - offset_expr.X_add_symbol, 0, NULL); + relax_switch (); } - macro_build_lui (p, &icnt, &offset_expr, tempreg); - if (p != NULL) - p += 4; - macro_build (p, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build_lui (&offset_expr, tempreg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, breg); - if (p != NULL) - p += 4; - macro_build (p, &icnt, &offset_expr, s, fmt, treg, + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_LO16, tempreg); + if (mips_relax.sequence) + relax_end (); } } else if (mips_pic == SVR4_PIC && ! mips_big_got) { - char *p; int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16; /* If this is a reference to an external symbol, we want @@ -6258,13 +6146,12 @@ macro (struct mips_cl_insn *ip) assert (offset_expr.X_op == O_symbol); if (HAVE_NEWABI) { - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", tempreg, BFD_RELOC_MIPS_GOT_PAGE, - mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, breg); - macro_build (NULL, &icnt, &offset_expr, s, fmt, treg, + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_MIPS_GOT_OFST, tempreg); if (! used_at) @@ -6277,25 +6164,22 @@ macro (struct mips_cl_insn *ip) if (expr1.X_add_number < -0x8000 || expr1.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); - frag_grow (20); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, lw_reloc_type, mips_gp_register); - macro_build (NULL, &icnt, NULL, "nop", ""); - p = frag_var (rs_machine_dependent, 4, 0, - RELAX_ENCODE (0, 4, -8, 0, 0, 0), - offset_expr.X_add_symbol, 0, NULL); - macro_build (p, &icnt, &offset_expr, ADDRESS_ADDI_INSN, - "t,r,j", tempreg, tempreg, BFD_RELOC_LO16); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + lw_reloc_type, mips_gp_register); + macro_build (NULL, "nop", ""); + relax_start (offset_expr.X_add_symbol); + relax_switch (); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", tempreg, + tempreg, BFD_RELOC_LO16); + relax_end (); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, breg); - macro_build (NULL, &icnt, &expr1, s, fmt, treg, BFD_RELOC_LO16, - tempreg); + macro_build (&expr1, s, fmt, treg, BFD_RELOC_LO16, tempreg); } else if (mips_pic == SVR4_PIC && ! HAVE_NEWABI) { - int gpdel; - char *p; + int gpdelay; /* If this is a reference to an external symbol, we want lui $tempreg,<sym> (BFD_RELOC_MIPS_GOT_HI16) @@ -6319,43 +6203,31 @@ macro (struct mips_cl_insn *ip) if (expr1.X_add_number < -0x8000 || expr1.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); - if (reg_needs_delay (mips_gp_register)) - gpdel = 4; - else - gpdel = 0; - frag_grow (36); - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, + gpdelay = reg_needs_delay (mips_gp_register); + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, "lui", "t,u", tempreg, BFD_RELOC_MIPS_GOT_HI16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - tempreg, tempreg, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, BFD_RELOC_MIPS_GOT_LO16, tempreg); - p = frag_var (rs_machine_dependent, 12 + gpdel, 0, - RELAX_ENCODE (12, 12 + gpdel, gpdel, 8 + gpdel, 0, 0), - offset_expr.X_add_symbol, 0, NULL); - if (gpdel > 0) - { - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - } - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, BFD_RELOC_MIPS_GOT16, mips_gp_register); - p += 4; - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - macro_build (p, &icnt, &offset_expr, ADDRESS_ADDI_INSN, "t,r,j", - tempreg, tempreg, BFD_RELOC_LO16); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, + mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_LO16, tempreg); + relax_switch (); + if (gpdelay) + macro_build (NULL, "nop", ""); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT16, mips_gp_register); + macro_build (NULL, "nop", ""); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", tempreg, + tempreg, BFD_RELOC_LO16); + relax_end (); + if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, breg); - macro_build (NULL, &icnt, &expr1, s, fmt, treg, BFD_RELOC_LO16, - tempreg); + macro_build (&expr1, s, fmt, treg, BFD_RELOC_LO16, tempreg); } else if (mips_pic == SVR4_PIC && HAVE_NEWABI) { - char *p; - int bregsz = breg != 0 ? 4 : 0; - /* If this is a reference to an external symbol, we want lui $tempreg,<sym> (BFD_RELOC_MIPS_GOT_HI16) add $tempreg,$tempreg,$gp @@ -6365,37 +6237,33 @@ macro (struct mips_cl_insn *ip) lw $tempreg,<sym>($gp) (BFD_RELOC_MIPS_GOT_PAGE) <op> $treg,<sym>($tempreg) (BFD_RELOC_MIPS_GOT_OFST) */ assert (offset_expr.X_op == O_symbol); - frag_grow (36); - frag_now->tc_frag_data.tc_fr_offset = - expr1.X_add_number = offset_expr.X_add_number; + expr1.X_add_number = offset_expr.X_add_number; offset_expr.X_add_number = 0; if (expr1.X_add_number < -0x8000 || expr1.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, "lui", "t,u", tempreg, BFD_RELOC_MIPS_GOT_HI16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - tempreg, tempreg, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, BFD_RELOC_MIPS_GOT_LO16, tempreg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, + mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_LO16, tempreg); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, breg); - macro_build (NULL, &icnt, &expr1, s, fmt, treg, BFD_RELOC_LO16, - tempreg); + macro_build (&expr1, s, fmt, treg, BFD_RELOC_LO16, tempreg); + relax_switch (); offset_expr.X_add_number = expr1.X_add_number; - p = frag_var (rs_machine_dependent, 12 + bregsz, 0, - RELAX_ENCODE (16 + bregsz, 8 + bregsz, - 0, 4 + bregsz, 0, 0), - offset_expr.X_add_symbol, 0, NULL); - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - tempreg, BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", tempreg, + BFD_RELOC_MIPS_GOT_PAGE, mips_gp_register); if (breg != 0) - macro_build (p + 4, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, tempreg, breg); - macro_build (p + 4 + bregsz, &icnt, &offset_expr, s, fmt, treg, + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_MIPS_GOT_OFST, tempreg); + relax_end (); } else if (mips_pic == EMBEDDED_PIC) { @@ -6408,15 +6276,15 @@ macro (struct mips_cl_insn *ip) assert (offset_expr.X_op == O_symbol); if (breg == 0) { - macro_build (NULL, &icnt, &offset_expr, s, fmt, treg, - BFD_RELOC_GPREL16, mips_gp_register); + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_GPREL16, + mips_gp_register); used_at = 0; } else { - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", tempreg, breg, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, s, fmt, treg, + macro_build (&offset_expr, s, fmt, treg, BFD_RELOC_GPREL16, tempreg); } } @@ -6430,18 +6298,18 @@ macro (struct mips_cl_insn *ip) case M_LI: case M_LI_S: - load_register (&icnt, treg, &imm_expr, 0); + load_register (treg, &imm_expr, 0); return; case M_DLI: - load_register (&icnt, treg, &imm_expr, 1); + load_register (treg, &imm_expr, 1); return; case M_LI_SS: if (imm_expr.X_op == O_constant) { - load_register (&icnt, AT, &imm_expr, 0); - macro_build (NULL, &icnt, NULL, "mtc1", "t,G", AT, treg); + load_register (AT, &imm_expr, 0); + macro_build (NULL, "mtc1", "t,G", AT, treg); break; } else @@ -6451,7 +6319,7 @@ macro (struct mips_cl_insn *ip) (offset_expr.X_add_symbol)), ".lit4") == 0 && offset_expr.X_add_number == 0); - macro_build (NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", treg, + macro_build (&offset_expr, "lwc1", "T,o(b)", treg, BFD_RELOC_MIPS_LITERAL, mips_gp_register); return; } @@ -6464,7 +6332,7 @@ macro (struct mips_cl_insn *ip) if (imm_expr.X_op == O_constant || imm_expr.X_op == O_big) { if (HAVE_64BIT_GPRS) - load_register (&icnt, treg, &imm_expr, 1); + load_register (treg, &imm_expr, 1); else { int hreg, lreg; @@ -6481,15 +6349,15 @@ macro (struct mips_cl_insn *ip) } if (hreg <= 31) - load_register (&icnt, hreg, &imm_expr, 0); + load_register (hreg, &imm_expr, 0); if (lreg <= 31) { if (offset_expr.X_op == O_absent) - move_register (&icnt, lreg, 0); + move_register (lreg, 0); else { assert (offset_expr.X_op == O_constant); - load_register (&icnt, lreg, &offset_expr, 0); + load_register (lreg, &offset_expr, 0); } } } @@ -6500,19 +6368,19 @@ macro (struct mips_cl_insn *ip) upper 16 bits of the address. */ if (mips_pic == NO_PIC) { - macro_build_lui (NULL, &icnt, &offset_expr, AT); + macro_build_lui (&offset_expr, AT); } else if (mips_pic == SVR4_PIC) { - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - AT, BFD_RELOC_MIPS_GOT16, mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", AT, + BFD_RELOC_MIPS_GOT16, mips_gp_register); } else if (mips_pic == EMBEDDED_PIC) { /* For embedded PIC we pick up the entire address off $gp in a single instruction. */ - macro_build (NULL, &icnt, &offset_expr, ADDRESS_ADDI_INSN, "t,r,j", - AT, mips_gp_register, BFD_RELOC_GPREL16); + macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", AT, + mips_gp_register, BFD_RELOC_GPREL16); offset_expr.X_op = O_constant; offset_expr.X_add_number = 0; } @@ -6521,27 +6389,19 @@ macro (struct mips_cl_insn *ip) /* Now we load the register(s). */ if (HAVE_64BIT_GPRS) - macro_build (NULL, &icnt, &offset_expr, "ld", "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&offset_expr, "ld", "t,o(b)", treg, BFD_RELOC_LO16, AT); else { - macro_build (NULL, &icnt, &offset_expr, "lw", "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&offset_expr, "lw", "t,o(b)", treg, BFD_RELOC_LO16, AT); if (treg != RA) { /* FIXME: How in the world do we deal with the possible overflow here? */ offset_expr.X_add_number += 4; - macro_build (NULL, &icnt, &offset_expr, "lw", "t,o(b)", + macro_build (&offset_expr, "lw", "t,o(b)", treg + 1, BFD_RELOC_LO16, AT); } } - - /* To avoid confusion in tc_gen_reloc, we must ensure that this - does not become a variant frag. */ - frag_wane (frag_now); - frag_new (0); - break; case M_LI_DD: @@ -6552,22 +6412,22 @@ macro (struct mips_cl_insn *ip) OFFSET_EXPR. */ if (imm_expr.X_op == O_constant || imm_expr.X_op == O_big) { - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_FPRS); + load_register (AT, &imm_expr, HAVE_64BIT_FPRS); if (HAVE_64BIT_FPRS) { assert (HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, "dmtc1", "t,S", AT, treg); + macro_build (NULL, "dmtc1", "t,S", AT, treg); } else { - macro_build (NULL, &icnt, NULL, "mtc1", "t,G", AT, treg + 1); + macro_build (NULL, "mtc1", "t,G", AT, treg + 1); if (offset_expr.X_op == O_absent) - macro_build (NULL, &icnt, NULL, "mtc1", "t,G", 0, treg); + macro_build (NULL, "mtc1", "t,G", 0, treg); else { assert (offset_expr.X_op == O_constant); - load_register (&icnt, AT, &offset_expr, 0); - macro_build (NULL, &icnt, NULL, "mtc1", "t,G", AT, treg); + load_register (AT, &offset_expr, 0); + macro_build (NULL, "mtc1", "t,G", AT, treg); } } break; @@ -6580,7 +6440,7 @@ macro (struct mips_cl_insn *ip) { if (mips_opts.isa != ISA_MIPS1) { - macro_build (NULL, &icnt, &offset_expr, "ldc1", "T,o(b)", treg, + macro_build (&offset_expr, "ldc1", "T,o(b)", treg, BFD_RELOC_MIPS_LITERAL, mips_gp_register); return; } @@ -6592,25 +6452,18 @@ macro (struct mips_cl_insn *ip) { assert (strcmp (s, RDATA_SECTION_NAME) == 0); if (mips_pic == SVR4_PIC) - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, - "t,o(b)", AT, BFD_RELOC_MIPS_GOT16, - mips_gp_register); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", AT, + BFD_RELOC_MIPS_GOT16, mips_gp_register); else { /* FIXME: This won't work for a 64 bit address. */ - macro_build_lui (NULL, &icnt, &offset_expr, AT); + macro_build_lui (&offset_expr, AT); } if (mips_opts.isa != ISA_MIPS1) { - macro_build (NULL, &icnt, &offset_expr, "ldc1", "T,o(b)", treg, - BFD_RELOC_LO16, AT); - - /* To avoid confusion in tc_gen_reloc, we must ensure - that this does not become a variant frag. */ - frag_wane (frag_now); - frag_new (0); - + macro_build (&offset_expr, "ldc1", "T,o(b)", + treg, BFD_RELOC_LO16, AT); break; } breg = AT; @@ -6629,19 +6482,14 @@ macro (struct mips_cl_insn *ip) r = BFD_RELOC_LO16; dob: assert (mips_opts.isa == ISA_MIPS1); - macro_build (NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", + macro_build (&offset_expr, "lwc1", "T,o(b)", target_big_endian ? treg + 1 : treg, r, breg); /* FIXME: A possible overflow which I don't know how to deal with. */ offset_expr.X_add_number += 4; - macro_build (NULL, &icnt, &offset_expr, "lwc1", "T,o(b)", + macro_build (&offset_expr, "lwc1", "T,o(b)", target_big_endian ? treg : treg + 1, r, breg); - /* To avoid confusion in tc_gen_reloc, we must ensure that this - does not become a variant frag. */ - frag_wane (frag_now); - frag_new (0); - if (breg != AT) return; break; @@ -6738,8 +6586,6 @@ macro (struct mips_cl_insn *ip) if (mips_pic == NO_PIC || offset_expr.X_op == O_constant) { - char *p; - /* If this is a reference to a GP relative symbol, we want <op> $treg,<sym>($gp) (BFD_RELOC_GPREL16) <op> $treg+1,<sym>+4($gp) (BFD_RELOC_GPREL16) @@ -6756,34 +6602,25 @@ macro (struct mips_cl_insn *ip) the last case. */ if ((valueT) offset_expr.X_add_number > MAX_GPREL_OFFSET || nopic_need_relax (offset_expr.X_add_symbol, 1)) - { - p = NULL; - used_at = 1; - } + used_at = 1; else { - int off; - + relax_start (offset_expr.X_add_symbol); if (breg == 0) { - frag_grow (28); tempreg = mips_gp_register; - off = 0; used_at = 0; } else { - frag_grow (36); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, breg, mips_gp_register); tempreg = AT; - off = 4; used_at = 1; } /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &offset_expr, s, fmt, - coproc ? treg + 1 : treg, + macro_build (&offset_expr, s, fmt, coproc ? treg + 1 : treg, BFD_RELOC_GPREL16, tempreg); offset_expr.X_add_number += 4; @@ -6792,15 +6629,11 @@ macro (struct mips_cl_insn *ip) hold_mips_optimize = mips_optimize; mips_optimize = 2; /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &offset_expr, s, fmt, - coproc ? treg : treg + 1, + macro_build (&offset_expr, s, fmt, coproc ? treg : treg + 1, BFD_RELOC_GPREL16, tempreg); mips_optimize = hold_mips_optimize; - p = frag_var (rs_machine_dependent, 12 + off, 0, - RELAX_ENCODE (8 + off, 12 + off, 0, 4 + off, 1, - used_at && mips_opts.noat), - offset_expr.X_add_symbol, 0, NULL); + relax_switch (); /* We just generated two relocs. When tc_gen_reloc handles this case, it will skip the first reloc and @@ -6823,33 +6656,22 @@ macro (struct mips_cl_insn *ip) offset_expr.X_op = O_constant; } } - macro_build_lui (p, &icnt, &offset_expr, AT); - if (p != NULL) - p += 4; + macro_build_lui (&offset_expr, AT); if (breg != 0) - { - macro_build (p, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, breg, AT); - if (p != NULL) - p += 4; - } + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, breg, AT); /* Itbl support may require additional care here. */ - macro_build (p, &icnt, &offset_expr, s, fmt, - coproc ? treg + 1 : treg, + macro_build (&offset_expr, s, fmt, coproc ? treg + 1 : treg, BFD_RELOC_LO16, AT); - if (p != NULL) - p += 4; /* FIXME: How do we handle overflow here? */ offset_expr.X_add_number += 4; /* Itbl support may require additional care here. */ - macro_build (p, &icnt, &offset_expr, s, fmt, - coproc ? treg : treg + 1, + macro_build (&offset_expr, s, fmt, coproc ? treg : treg + 1, BFD_RELOC_LO16, AT); + if (mips_relax.sequence) + relax_end (); } else if (mips_pic == SVR4_PIC && ! mips_big_got) { - int off; - /* If this is a reference to an external symbol, we want lw $at,<sym>($gp) (BFD_RELOC_MIPS_GOT16) nop @@ -6865,43 +6687,39 @@ macro (struct mips_cl_insn *ip) in the lwc1 instructions. */ used_at = 1; expr1.X_add_number = offset_expr.X_add_number; - offset_expr.X_add_number = 0; if (expr1.X_add_number < -0x8000 || expr1.X_add_number >= 0x8000 - 4) as_bad (_("PIC code offset overflow (max 16 signed bits)")); - if (breg == 0) - off = 0; - else - off = 4; - frag_grow (24 + off); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - AT, BFD_RELOC_MIPS_GOT16, mips_gp_register); - macro_build (NULL, &icnt, NULL, "nop", ""); + load_got_offset (AT, &offset_expr); + macro_build (NULL, "nop", ""); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, breg, AT); - /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &expr1, s, fmt, coproc ? treg + 1 : treg, - BFD_RELOC_LO16, AT); - expr1.X_add_number += 4; + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, breg, AT); /* Set mips_optimize to 2 to avoid inserting an undesired nop. */ hold_mips_optimize = mips_optimize; mips_optimize = 2; + /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &expr1, s, fmt, coproc ? treg : treg + 1, + relax_start (offset_expr.X_add_symbol); + macro_build (&expr1, s, fmt, coproc ? treg + 1 : treg, BFD_RELOC_LO16, AT); - mips_optimize = hold_mips_optimize; + expr1.X_add_number += 4; + macro_build (&expr1, s, fmt, coproc ? treg : treg + 1, + BFD_RELOC_LO16, AT); + relax_switch (); + macro_build (&offset_expr, s, fmt, coproc ? treg + 1 : treg, + BFD_RELOC_LO16, AT); + offset_expr.X_add_number += 4; + macro_build (&offset_expr, s, fmt, coproc ? treg : treg + 1, + BFD_RELOC_LO16, AT); + relax_end (); - (void) frag_var (rs_machine_dependent, 0, 0, - RELAX_ENCODE (0, 0, -16 - off, -8, 1, 0), - offset_expr.X_add_symbol, 0, NULL); + mips_optimize = hold_mips_optimize; } else if (mips_pic == SVR4_PIC) { - int gpdel, off; - char *p; + int gpdelay; /* If this is a reference to an external symbol, we want lui $at,<sym> (BFD_RELOC_MIPS_GOT_HI16) @@ -6924,27 +6742,19 @@ macro (struct mips_cl_insn *ip) if (expr1.X_add_number < -0x8000 || expr1.X_add_number >= 0x8000 - 4) as_bad (_("PIC code offset overflow (max 16 signed bits)")); - if (reg_needs_delay (mips_gp_register)) - gpdel = 4; - else - gpdel = 0; - if (breg == 0) - off = 0; - else - off = 4; - frag_grow (56); - macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", AT, - BFD_RELOC_MIPS_GOT_HI16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + gpdelay = reg_needs_delay (mips_gp_register); + relax_start (offset_expr.X_add_symbol); + macro_build (&offset_expr, "lui", "t,u", + AT, BFD_RELOC_MIPS_GOT_HI16); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, mips_gp_register); - macro_build (NULL, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", AT, BFD_RELOC_MIPS_GOT_LO16, AT); - macro_build (NULL, &icnt, NULL, "nop", ""); + macro_build (NULL, "nop", ""); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, breg, AT); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, breg, AT); /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &expr1, s, fmt, coproc ? treg + 1 : treg, + macro_build (&expr1, s, fmt, coproc ? treg + 1 : treg, BFD_RELOC_LO16, AT); expr1.X_add_number += 4; @@ -6953,45 +6763,34 @@ macro (struct mips_cl_insn *ip) hold_mips_optimize = mips_optimize; mips_optimize = 2; /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &expr1, s, fmt, coproc ? treg : treg + 1, + macro_build (&expr1, s, fmt, coproc ? treg : treg + 1, BFD_RELOC_LO16, AT); mips_optimize = hold_mips_optimize; expr1.X_add_number -= 4; - p = frag_var (rs_machine_dependent, 16 + gpdel + off, 0, - RELAX_ENCODE (24 + off, 16 + gpdel + off, gpdel, - 8 + gpdel + off, 1, 0), - offset_expr.X_add_symbol, 0, NULL); - if (gpdel > 0) - { - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; - } - macro_build (p, &icnt, &offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", - AT, BFD_RELOC_MIPS_GOT16, mips_gp_register); - p += 4; - macro_build (p, &icnt, NULL, "nop", ""); - p += 4; + relax_switch (); + offset_expr.X_add_number = expr1.X_add_number; + if (gpdelay) + macro_build (NULL, "nop", ""); + macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", AT, + BFD_RELOC_MIPS_GOT16, mips_gp_register); + macro_build (NULL, "nop", ""); if (breg != 0) - { - macro_build (p, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, breg, AT); - p += 4; - } + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, breg, AT); /* Itbl support may require additional care here. */ - macro_build (p, &icnt, &expr1, s, fmt, coproc ? treg + 1 : treg, + macro_build (&offset_expr, s, fmt, coproc ? treg + 1 : treg, BFD_RELOC_LO16, AT); - p += 4; - expr1.X_add_number += 4; + offset_expr.X_add_number += 4; /* Set mips_optimize to 2 to avoid inserting an undesired nop. */ hold_mips_optimize = mips_optimize; mips_optimize = 2; /* Itbl support may require additional care here. */ - macro_build (p, &icnt, &expr1, s, fmt, coproc ? treg : treg + 1, + macro_build (&offset_expr, s, fmt, coproc ? treg : treg + 1, BFD_RELOC_LO16, AT); mips_optimize = hold_mips_optimize; + relax_end (); } else if (mips_pic == EMBEDDED_PIC) { @@ -7010,20 +6809,18 @@ macro (struct mips_cl_insn *ip) } else { - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, breg, mips_gp_register); tempreg = AT; used_at = 1; } /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &offset_expr, s, fmt, - coproc ? treg + 1 : treg, + macro_build (&offset_expr, s, fmt, coproc ? treg + 1 : treg, BFD_RELOC_GPREL16, tempreg); offset_expr.X_add_number += 4; /* Itbl support may require additional care here. */ - macro_build (NULL, &icnt, &offset_expr, s, fmt, - coproc ? treg : treg + 1, + macro_build (&offset_expr, s, fmt, coproc ? treg : treg + 1, BFD_RELOC_GPREL16, tempreg); } else @@ -7041,11 +6838,9 @@ macro (struct mips_cl_insn *ip) s = "sw"; sd_ob: assert (HAVE_32BIT_ADDRESSES); - macro_build (NULL, &icnt, &offset_expr, s, "t,o(b)", treg, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s, "t,o(b)", treg, BFD_RELOC_LO16, breg); offset_expr.X_add_number += 4; - macro_build (NULL, &icnt, &offset_expr, s, "t,o(b)", treg + 1, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s, "t,o(b)", treg + 1, BFD_RELOC_LO16, breg); return; /* New code added to support COPZ instructions. @@ -7079,11 +6874,11 @@ macro (struct mips_cl_insn *ip) copz: /* For now we just do C (same as Cz). The parameter will be stored in insn_opcode by mips_ip. */ - macro_build (NULL, &icnt, NULL, s, "C", ip->insn_opcode); + macro_build (NULL, s, "C", ip->insn_opcode); return; case M_MOVE: - move_register (&icnt, dreg, sreg); + move_register (dreg, sreg); return; #ifdef LOSING_COMPILER @@ -7102,7 +6897,7 @@ macro (struct mips_cl_insn *ip) s = ip->insn_mo->name; s2 = "cop3"; coproc = ITBL_DECODE_PNUM (immed_expr);; - macro_build (NULL, &icnt, &immed_expr, s, "C"); + macro_build (&immed_expr, s, "C"); return; } macro2 (ip); @@ -7118,7 +6913,6 @@ macro2 (struct mips_cl_insn *ip) register int treg, sreg, dreg, breg; int tempreg; int mask; - int icnt = 0; int used_at; expressionS expr1; const char *s; @@ -7132,7 +6926,6 @@ macro2 (struct mips_cl_insn *ip) int off; offsetT maxnum; bfd_reloc_code_real_type r; - char *p; treg = (ip->insn_opcode >> 16) & 0x1f; dreg = (ip->insn_opcode >> 11) & 0x1f; @@ -7151,9 +6944,8 @@ macro2 (struct mips_cl_insn *ip) case M_DMUL: dbl = 1; case M_MUL: - macro_build (NULL, &icnt, NULL, dbl ? "dmultu" : "multu", "s,t", - sreg, treg); - macro_build (NULL, &icnt, NULL, "mflo", "d", dreg); + macro_build (NULL, dbl ? "dmultu" : "multu", "s,t", sreg, treg); + macro_build (NULL, "mflo", "d", dreg); return; case M_DMUL_I: @@ -7162,10 +6954,9 @@ macro2 (struct mips_cl_insn *ip) /* The MIPS assembler some times generates shifts and adds. I'm not trying to be that fancy. GCC should do this for us anyway. */ - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, dbl ? "dmult" : "mult", "s,t", - sreg, AT); - macro_build (NULL, &icnt, NULL, "mflo", "d", dreg); + load_register (AT, &imm_expr, dbl); + macro_build (NULL, dbl ? "dmult" : "mult", "s,t", sreg, AT); + macro_build (NULL, "mflo", "d", dreg); break; case M_DMULO_I: @@ -7182,24 +6973,22 @@ macro2 (struct mips_cl_insn *ip) ++mips_opts.noreorder; mips_any_noreorder = 1; if (imm) - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, dbl ? "dmult" : "mult", "s,t", - sreg, imm ? AT : treg); - macro_build (NULL, &icnt, NULL, "mflo", "d", dreg); - macro_build (NULL, &icnt, NULL, dbl ? "dsra32" : "sra", "d,w,<", - dreg, dreg, RA); - macro_build (NULL, &icnt, NULL, "mfhi", "d", AT); + load_register (AT, &imm_expr, dbl); + macro_build (NULL, dbl ? "dmult" : "mult", "s,t", sreg, imm ? AT : treg); + macro_build (NULL, "mflo", "d", dreg); + macro_build (NULL, dbl ? "dsra32" : "sra", "d,w,<", dreg, dreg, RA); + macro_build (NULL, "mfhi", "d", AT); if (mips_trap) - macro_build (NULL, &icnt, NULL, "tne", "s,t,q", dreg, AT, 6); + macro_build (NULL, "tne", "s,t,q", dreg, AT, 6); else { expr1.X_add_number = 8; - macro_build (NULL, &icnt, &expr1, "beq", "s,t,p", dreg, AT); - macro_build (NULL, &icnt, NULL, "nop", "", 0); - macro_build (NULL, &icnt, NULL, "break", "c", 6); + macro_build (&expr1, "beq", "s,t,p", dreg, AT); + macro_build (NULL, "nop", "", 0); + macro_build (NULL, "break", "c", 6); } --mips_opts.noreorder; - macro_build (NULL, &icnt, NULL, "mflo", "d", dreg); + macro_build (NULL, "mflo", "d", dreg); break; case M_DMULOU_I: @@ -7216,19 +7005,19 @@ macro2 (struct mips_cl_insn *ip) ++mips_opts.noreorder; mips_any_noreorder = 1; if (imm) - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, dbl ? "dmultu" : "multu", "s,t", + load_register (AT, &imm_expr, dbl); + macro_build (NULL, dbl ? "dmultu" : "multu", "s,t", sreg, imm ? AT : treg); - macro_build (NULL, &icnt, NULL, "mfhi", "d", AT); - macro_build (NULL, &icnt, NULL, "mflo", "d", dreg); + macro_build (NULL, "mfhi", "d", AT); + macro_build (NULL, "mflo", "d", dreg); if (mips_trap) - macro_build (NULL, &icnt, NULL, "tne", "s,t,q", AT, 0, 6); + macro_build (NULL, "tne", "s,t,q", AT, 0, 6); else { expr1.X_add_number = 8; - macro_build (NULL, &icnt, &expr1, "beq", "s,t,p", AT, 0); - macro_build (NULL, &icnt, NULL, "nop", "", 0); - macro_build (NULL, &icnt, NULL, "break", "c", 6); + macro_build (&expr1, "beq", "s,t,p", AT, 0); + macro_build (NULL, "nop", "", 0); + macro_build (NULL, "break", "c", 6); } --mips_opts.noreorder; break; @@ -7246,17 +7035,16 @@ macro2 (struct mips_cl_insn *ip) tempreg = dreg; used_at = 0; } - macro_build (NULL, &icnt, NULL, "dnegu", "d,w", tempreg, treg); - macro_build (NULL, &icnt, NULL, "drorv", "d,t,s", dreg, sreg, - tempreg); + macro_build (NULL, "dnegu", "d,w", tempreg, treg); + macro_build (NULL, "drorv", "d,t,s", dreg, sreg, tempreg); if (used_at) break; return; } - macro_build (NULL, &icnt, NULL, "dsubu", "d,v,t", AT, 0, treg); - macro_build (NULL, &icnt, NULL, "dsrlv", "d,t,s", AT, sreg, AT); - macro_build (NULL, &icnt, NULL, "dsllv", "d,t,s", dreg, sreg, treg); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, "dsubu", "d,v,t", AT, 0, treg); + macro_build (NULL, "dsrlv", "d,t,s", AT, sreg, AT); + macro_build (NULL, "dsllv", "d,t,s", dreg, sreg, treg); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); break; case M_ROL: @@ -7272,17 +7060,16 @@ macro2 (struct mips_cl_insn *ip) tempreg = dreg; used_at = 0; } - macro_build (NULL, &icnt, NULL, "negu", "d,w", tempreg, treg); - macro_build (NULL, &icnt, NULL, "rorv", "d,t,s", dreg, sreg, - tempreg); + macro_build (NULL, "negu", "d,w", tempreg, treg); + macro_build (NULL, "rorv", "d,t,s", dreg, sreg, tempreg); if (used_at) break; return; } - macro_build (NULL, &icnt, NULL, "subu", "d,v,t", AT, 0, treg); - macro_build (NULL, &icnt, NULL, "srlv", "d,t,s", AT, sreg, AT); - macro_build (NULL, &icnt, NULL, "sllv", "d,t,s", dreg, sreg, treg); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, "subu", "d,v,t", AT, 0, treg); + macro_build (NULL, "srlv", "d,t,s", AT, sreg, AT); + macro_build (NULL, "sllv", "d,t,s", dreg, sreg, treg); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); break; case M_DROL_I: @@ -7297,25 +7084,22 @@ macro2 (struct mips_cl_insn *ip) { rot = (64 - rot) & 0x3f; if (rot >= 32) - macro_build (NULL, &icnt, NULL, "dror32", "d,w,<", - dreg, sreg, rot - 32); + macro_build (NULL, "dror32", "d,w,<", dreg, sreg, rot - 32); else - macro_build (NULL, &icnt, NULL, "dror", "d,w,<", - dreg, sreg, rot); + macro_build (NULL, "dror", "d,w,<", dreg, sreg, rot); return; } if (rot == 0) { - macro_build (NULL, &icnt, NULL, "dsrl", "d,w,<", dreg, sreg, 0); + macro_build (NULL, "dsrl", "d,w,<", dreg, sreg, 0); return; } l = (rot < 0x20) ? "dsll" : "dsll32"; r = ((0x40 - rot) < 0x20) ? "dsrl" : "dsrl32"; rot &= 0x1f; - macro_build (NULL, &icnt, NULL, l, "d,w,<", AT, sreg, rot); - macro_build (NULL, &icnt, NULL, r, "d,w,<", dreg, sreg, - (0x20 - rot) & 0x1f); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, l, "d,w,<", AT, sreg, rot); + macro_build (NULL, r, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); } break; @@ -7328,44 +7112,42 @@ macro2 (struct mips_cl_insn *ip) rot = imm_expr.X_add_number & 0x1f; if (ISA_HAS_ROR (mips_opts.isa) || CPU_HAS_ROR (mips_opts.arch)) { - macro_build (NULL, &icnt, NULL, "ror", "d,w,<", dreg, sreg, - (32 - rot) & 0x1f); + macro_build (NULL, "ror", "d,w,<", dreg, sreg, (32 - rot) & 0x1f); return; } if (rot == 0) { - macro_build (NULL, &icnt, NULL, "srl", "d,w,<", dreg, sreg, 0); + macro_build (NULL, "srl", "d,w,<", dreg, sreg, 0); return; } - macro_build (NULL, &icnt, NULL, "sll", "d,w,<", AT, sreg, rot); - macro_build (NULL, &icnt, NULL, "srl", "d,w,<", dreg, sreg, - (0x20 - rot) & 0x1f); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, "sll", "d,w,<", AT, sreg, rot); + macro_build (NULL, "srl", "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); } break; case M_DROR: if (ISA_HAS_DROR (mips_opts.isa) || CPU_HAS_DROR (mips_opts.arch)) { - macro_build (NULL, &icnt, NULL, "drorv", "d,t,s", dreg, sreg, treg); + macro_build (NULL, "drorv", "d,t,s", dreg, sreg, treg); return; } - macro_build (NULL, &icnt, NULL, "dsubu", "d,v,t", AT, 0, treg); - macro_build (NULL, &icnt, NULL, "dsllv", "d,t,s", AT, sreg, AT); - macro_build (NULL, &icnt, NULL, "dsrlv", "d,t,s", dreg, sreg, treg); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, "dsubu", "d,v,t", AT, 0, treg); + macro_build (NULL, "dsllv", "d,t,s", AT, sreg, AT); + macro_build (NULL, "dsrlv", "d,t,s", dreg, sreg, treg); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); break; case M_ROR: if (ISA_HAS_ROR (mips_opts.isa) || CPU_HAS_ROR (mips_opts.arch)) { - macro_build (NULL, &icnt, NULL, "rorv", "d,t,s", dreg, sreg, treg); + macro_build (NULL, "rorv", "d,t,s", dreg, sreg, treg); return; } - macro_build (NULL, &icnt, NULL, "subu", "d,v,t", AT, 0, treg); - macro_build (NULL, &icnt, NULL, "sllv", "d,t,s", AT, sreg, AT); - macro_build (NULL, &icnt, NULL, "srlv", "d,t,s", dreg, sreg, treg); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, "subu", "d,v,t", AT, 0, treg); + macro_build (NULL, "sllv", "d,t,s", AT, sreg, AT); + macro_build (NULL, "srlv", "d,t,s", dreg, sreg, treg); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); break; case M_DROR_I: @@ -7379,25 +7161,22 @@ macro2 (struct mips_cl_insn *ip) if (ISA_HAS_DROR (mips_opts.isa) || CPU_HAS_DROR (mips_opts.arch)) { if (rot >= 32) - macro_build (NULL, &icnt, NULL, "dror32", "d,w,<", - dreg, sreg, rot - 32); + macro_build (NULL, "dror32", "d,w,<", dreg, sreg, rot - 32); else - macro_build (NULL, &icnt, NULL, "dror", "d,w,<", - dreg, sreg, rot); + macro_build (NULL, "dror", "d,w,<", dreg, sreg, rot); return; } if (rot == 0) { - macro_build (NULL, &icnt, NULL, "dsrl", "d,w,<", dreg, sreg, 0); + macro_build (NULL, "dsrl", "d,w,<", dreg, sreg, 0); return; } r = (rot < 0x20) ? "dsrl" : "dsrl32"; l = ((0x40 - rot) < 0x20) ? "dsll" : "dsll32"; rot &= 0x1f; - macro_build (NULL, &icnt, NULL, r, "d,w,<", AT, sreg, rot); - macro_build (NULL, &icnt, NULL, l, "d,w,<", dreg, sreg, - (0x20 - rot) & 0x1f); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, r, "d,w,<", AT, sreg, rot); + macro_build (NULL, l, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); } break; @@ -7410,18 +7189,17 @@ macro2 (struct mips_cl_insn *ip) rot = imm_expr.X_add_number & 0x1f; if (ISA_HAS_ROR (mips_opts.isa) || CPU_HAS_ROR (mips_opts.arch)) { - macro_build (NULL, &icnt, NULL, "ror", "d,w,<", dreg, sreg, rot); + macro_build (NULL, "ror", "d,w,<", dreg, sreg, rot); return; } if (rot == 0) { - macro_build (NULL, &icnt, NULL, "srl", "d,w,<", dreg, sreg, 0); + macro_build (NULL, "srl", "d,w,<", dreg, sreg, 0); return; } - macro_build (NULL, &icnt, NULL, "srl", "d,w,<", AT, sreg, rot); - macro_build (NULL, &icnt, NULL, "sll", "d,w,<", dreg, sreg, - (0x20 - rot) & 0x1f); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", dreg, dreg, AT); + macro_build (NULL, "srl", "d,w,<", AT, sreg, rot); + macro_build (NULL, "sll", "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f); + macro_build (NULL, "or", "d,v,t", dreg, dreg, AT); } break; @@ -7434,50 +7212,43 @@ macro2 (struct mips_cl_insn *ip) assert (mips_opts.isa == ISA_MIPS1); /* Even on a big endian machine $fn comes before $fn+1. We have to adjust when storing to memory. */ - macro_build (NULL, &icnt, &offset_expr, "swc1", "T,o(b)", - target_big_endian ? treg + 1 : treg, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, "swc1", "T,o(b)", + target_big_endian ? treg + 1 : treg, BFD_RELOC_LO16, breg); offset_expr.X_add_number += 4; - macro_build (NULL, &icnt, &offset_expr, "swc1", "T,o(b)", - target_big_endian ? treg : treg + 1, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, "swc1", "T,o(b)", + target_big_endian ? treg : treg + 1, BFD_RELOC_LO16, breg); return; case M_SEQ: if (sreg == 0) - macro_build (NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, treg, - BFD_RELOC_LO16); + macro_build (&expr1, "sltiu", "t,r,j", dreg, treg, BFD_RELOC_LO16); else if (treg == 0) - macro_build (NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, sreg, - BFD_RELOC_LO16); + macro_build (&expr1, "sltiu", "t,r,j", dreg, sreg, BFD_RELOC_LO16); else { - macro_build (NULL, &icnt, NULL, "xor", "d,v,t", dreg, sreg, treg); - macro_build (NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, dreg, - BFD_RELOC_LO16); + macro_build (NULL, "xor", "d,v,t", dreg, sreg, treg); + macro_build (&expr1, "sltiu", "t,r,j", dreg, dreg, BFD_RELOC_LO16); } return; case M_SEQ_I: if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0) { - macro_build (NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, sreg, - BFD_RELOC_LO16); + macro_build (&expr1, "sltiu", "t,r,j", dreg, sreg, BFD_RELOC_LO16); return; } if (sreg == 0) { as_warn (_("Instruction %s: result is always false"), ip->insn_mo->name); - move_register (&icnt, dreg, 0); + move_register (dreg, 0); return; } if (imm_expr.X_op == O_constant && imm_expr.X_add_number >= 0 && imm_expr.X_add_number < 0x10000) { - macro_build (NULL, &icnt, &imm_expr, "xori", "t,r,i", dreg, sreg, - BFD_RELOC_LO16); + macro_build (&imm_expr, "xori", "t,r,i", dreg, sreg, BFD_RELOC_LO16); used_at = 0; } else if (imm_expr.X_op == O_constant @@ -7485,19 +7256,17 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number < 0) { imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, - HAVE_32BIT_GPRS ? "addiu" : "daddiu", + macro_build (&imm_expr, HAVE_32BIT_GPRS ? "addiu" : "daddiu", "t,r,j", dreg, sreg, BFD_RELOC_LO16); used_at = 0; } else { - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, "xor", "d,v,t", dreg, sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, "xor", "d,v,t", dreg, sreg, AT); used_at = 1; } - macro_build (NULL, &icnt, &expr1, "sltiu", "t,r,j", dreg, dreg, - BFD_RELOC_LO16); + macro_build (&expr1, "sltiu", "t,r,j", dreg, dreg, BFD_RELOC_LO16); if (used_at) break; return; @@ -7508,9 +7277,8 @@ macro2 (struct mips_cl_insn *ip) case M_SGEU: s = "sltu"; sge: - macro_build (NULL, &icnt, NULL, s, "d,v,t", dreg, sreg, treg); - macro_build (NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, - BFD_RELOC_LO16); + macro_build (NULL, s, "d,v,t", dreg, sreg, treg); + macro_build (&expr1, "xori", "t,r,i", dreg, dreg, BFD_RELOC_LO16); return; case M_SGE_I: /* sreg >= I <==> not (sreg < I) */ @@ -7519,20 +7287,18 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number >= -0x8000 && imm_expr.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &imm_expr, - mask == M_SGE_I ? "slti" : "sltiu", - "t,r,j", dreg, sreg, BFD_RELOC_LO16); + macro_build (&imm_expr, mask == M_SGE_I ? "slti" : "sltiu", "t,r,j", + dreg, sreg, BFD_RELOC_LO16); used_at = 0; } else { - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, mask == M_SGE_I ? "slt" : "sltu", - "d,v,t", dreg, sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, mask == M_SGE_I ? "slt" : "sltu", "d,v,t", + dreg, sreg, AT); used_at = 1; } - macro_build (NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, - BFD_RELOC_LO16); + macro_build (&expr1, "xori", "t,r,i", dreg, dreg, BFD_RELOC_LO16); if (used_at) break; return; @@ -7543,7 +7309,7 @@ macro2 (struct mips_cl_insn *ip) case M_SGTU: s = "sltu"; sgt: - macro_build (NULL, &icnt, NULL, s, "d,v,t", dreg, treg, sreg); + macro_build (NULL, s, "d,v,t", dreg, treg, sreg); return; case M_SGT_I: /* sreg > I <==> I < sreg */ @@ -7552,8 +7318,8 @@ macro2 (struct mips_cl_insn *ip) case M_SGTU_I: s = "sltu"; sgti: - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, s, "d,v,t", dreg, AT, sreg); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, s, "d,v,t", dreg, AT, sreg); break; case M_SLE: /* sreg <= treg <==> treg >= sreg <==> not (treg < sreg) */ @@ -7562,9 +7328,8 @@ macro2 (struct mips_cl_insn *ip) case M_SLEU: s = "sltu"; sle: - macro_build (NULL, &icnt, NULL, s, "d,v,t", dreg, treg, sreg); - macro_build (NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, - BFD_RELOC_LO16); + macro_build (NULL, s, "d,v,t", dreg, treg, sreg); + macro_build (&expr1, "xori", "t,r,i", dreg, dreg, BFD_RELOC_LO16); return; case M_SLE_I: /* sreg <= I <==> I >= sreg <==> not (I < sreg) */ @@ -7573,10 +7338,9 @@ macro2 (struct mips_cl_insn *ip) case M_SLEU_I: s = "sltu"; slei: - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, s, "d,v,t", dreg, AT, sreg); - macro_build (NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, - BFD_RELOC_LO16); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, s, "d,v,t", dreg, AT, sreg); + macro_build (&expr1, "xori", "t,r,i", dreg, dreg, BFD_RELOC_LO16); break; case M_SLT_I: @@ -7584,12 +7348,11 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number >= -0x8000 && imm_expr.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &imm_expr, "slti", "t,r,j", dreg, sreg, - BFD_RELOC_LO16); + macro_build (&imm_expr, "slti", "t,r,j", dreg, sreg, BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, "slt", "d,v,t", dreg, sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, "slt", "d,v,t", dreg, sreg, AT); break; case M_SLTU_I: @@ -7597,47 +7360,45 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number >= -0x8000 && imm_expr.X_add_number < 0x8000) { - macro_build (NULL, &icnt, &imm_expr, "sltiu", "t,r,j", dreg, sreg, + macro_build (&imm_expr, "sltiu", "t,r,j", dreg, sreg, BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", dreg, sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, "sltu", "d,v,t", dreg, sreg, AT); break; case M_SNE: if (sreg == 0) - macro_build (NULL, &icnt, NULL, "sltu","d,v,t", dreg, 0, treg); + macro_build (NULL, "sltu", "d,v,t", dreg, 0, treg); else if (treg == 0) - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, sreg); + macro_build (NULL, "sltu", "d,v,t", dreg, 0, sreg); else { - macro_build (NULL, &icnt, NULL, "xor", "d,v,t", dreg, sreg, treg); - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, dreg); + macro_build (NULL, "xor", "d,v,t", dreg, sreg, treg); + macro_build (NULL, "sltu", "d,v,t", dreg, 0, dreg); } return; case M_SNE_I: if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0) { - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, sreg); + macro_build (NULL, "sltu", "d,v,t", dreg, 0, sreg); return; } if (sreg == 0) { as_warn (_("Instruction %s: result is always true"), ip->insn_mo->name); - macro_build (NULL, &icnt, &expr1, - HAVE_32BIT_GPRS ? "addiu" : "daddiu", - "t,r,j", dreg, 0, BFD_RELOC_LO16); + macro_build (&expr1, HAVE_32BIT_GPRS ? "addiu" : "daddiu", "t,r,j", + dreg, 0, BFD_RELOC_LO16); return; } if (imm_expr.X_op == O_constant && imm_expr.X_add_number >= 0 && imm_expr.X_add_number < 0x10000) { - macro_build (NULL, &icnt, &imm_expr, "xori", "t,r,i", dreg, sreg, - BFD_RELOC_LO16); + macro_build (&imm_expr, "xori", "t,r,i", dreg, sreg, BFD_RELOC_LO16); used_at = 0; } else if (imm_expr.X_op == O_constant @@ -7645,18 +7406,17 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number < 0) { imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, - HAVE_32BIT_GPRS ? "addiu" : "daddiu", + macro_build (&imm_expr, HAVE_32BIT_GPRS ? "addiu" : "daddiu", "t,r,j", dreg, sreg, BFD_RELOC_LO16); used_at = 0; } else { - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, "xor", "d,v,t", dreg, sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, "xor", "d,v,t", dreg, sreg, AT); used_at = 1; } - macro_build (NULL, &icnt, NULL, "sltu", "d,v,t", dreg, 0, dreg); + macro_build (NULL, "sltu", "d,v,t", dreg, 0, dreg); if (used_at) break; return; @@ -7669,13 +7429,12 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number <= 0x8000) { imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, dbl ? "daddi" : "addi", - "t,r,j", dreg, sreg, BFD_RELOC_LO16); + macro_build (&imm_expr, dbl ? "daddi" : "addi", "t,r,j", + dreg, sreg, BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, dbl ? "dsub" : "sub", "d,v,t", - dreg, sreg, AT); + load_register (AT, &imm_expr, dbl); + macro_build (NULL, dbl ? "dsub" : "sub", "d,v,t", dreg, sreg, AT); break; case M_DSUBU_I: @@ -7686,13 +7445,12 @@ macro2 (struct mips_cl_insn *ip) && imm_expr.X_add_number <= 0x8000) { imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, dbl ? "daddiu" : "addiu", - "t,r,j", dreg, sreg, BFD_RELOC_LO16); + macro_build (&imm_expr, dbl ? "daddiu" : "addiu", "t,r,j", + dreg, sreg, BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, dbl); - macro_build (NULL, &icnt, NULL, dbl ? "dsubu" : "subu", "d,v,t", - dreg, sreg, AT); + load_register (AT, &imm_expr, dbl); + macro_build (NULL, dbl ? "dsubu" : "subu", "d,v,t", dreg, sreg, AT); break; case M_TEQ_I: @@ -7713,8 +7471,8 @@ macro2 (struct mips_cl_insn *ip) case M_TNE_I: s = "tne"; trap: - load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); - macro_build (NULL, &icnt, NULL, s, "s,t", sreg, AT); + load_register (AT, &imm_expr, HAVE_64BIT_GPRS); + macro_build (NULL, s, "s,t", sreg, AT); break; case M_TRUNCWS: @@ -7730,22 +7488,19 @@ macro2 (struct mips_cl_insn *ip) mips_emit_delays (TRUE); ++mips_opts.noreorder; mips_any_noreorder = 1; - macro_build (NULL, &icnt, NULL, "cfc1", "t,G", treg, RA); - macro_build (NULL, &icnt, NULL, "cfc1", "t,G", treg, RA); - macro_build (NULL, &icnt, NULL, "nop", ""); + macro_build (NULL, "cfc1", "t,G", treg, RA); + macro_build (NULL, "cfc1", "t,G", treg, RA); + macro_build (NULL, "nop", ""); expr1.X_add_number = 3; - macro_build (NULL, &icnt, &expr1, "ori", "t,r,i", AT, treg, - BFD_RELOC_LO16); + macro_build (&expr1, "ori", "t,r,i", AT, treg, BFD_RELOC_LO16); expr1.X_add_number = 2; - macro_build (NULL, &icnt, &expr1, "xori", "t,r,i", AT, AT, - BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, "ctc1", "t,G", AT, RA); - macro_build (NULL, &icnt, NULL, "nop", ""); - macro_build (NULL, &icnt, NULL, - mask == M_TRUNCWD ? "cvt.w.d" : "cvt.w.s", - "D,S", dreg, sreg); - macro_build (NULL, &icnt, NULL, "ctc1", "t,G", treg, RA); - macro_build (NULL, &icnt, NULL, "nop", ""); + macro_build (&expr1, "xori", "t,r,i", AT, AT, BFD_RELOC_LO16); + macro_build (NULL, "ctc1", "t,G", AT, RA); + macro_build (NULL, "nop", ""); + macro_build (NULL, mask == M_TRUNCWD ? "cvt.w.d" : "cvt.w.s", "D,S", + dreg, sreg); + macro_build (NULL, "ctc1", "t,G", treg, RA); + macro_build (NULL, "nop", ""); --mips_opts.noreorder; break; @@ -7759,16 +7514,14 @@ macro2 (struct mips_cl_insn *ip) as_bad (_("operand overflow")); if (! target_big_endian) ++offset_expr.X_add_number; - macro_build (NULL, &icnt, &offset_expr, s, "t,o(b)", AT, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s, "t,o(b)", AT, BFD_RELOC_LO16, breg); if (! target_big_endian) --offset_expr.X_add_number; else ++offset_expr.X_add_number; - macro_build (NULL, &icnt, &offset_expr, "lbu", "t,o(b)", treg, - BFD_RELOC_LO16, breg); - macro_build (NULL, &icnt, NULL, "sll", "d,w,<", AT, AT, 8); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", treg, treg, AT); + macro_build (&offset_expr, "lbu", "t,o(b)", treg, BFD_RELOC_LO16, breg); + macro_build (NULL, "sll", "d,w,<", AT, AT, 8); + macro_build (NULL, "or", "d,v,t", treg, treg, AT); break; case M_ULD: @@ -7789,22 +7542,20 @@ macro2 (struct mips_cl_insn *ip) tempreg = AT; if (! target_big_endian) offset_expr.X_add_number += off; - macro_build (NULL, &icnt, &offset_expr, s, "t,o(b)", tempreg, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s, "t,o(b)", tempreg, BFD_RELOC_LO16, breg); if (! target_big_endian) offset_expr.X_add_number -= off; else offset_expr.X_add_number += off; - macro_build (NULL, &icnt, &offset_expr, s2, "t,o(b)", tempreg, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s2, "t,o(b)", tempreg, BFD_RELOC_LO16, breg); /* If necessary, move the result in tempreg the final destination. */ if (treg == tempreg) return; /* Protect second load's delay slot. */ if (!gpr_interlocks) - macro_build (NULL, &icnt, NULL, "nop", ""); - move_register (&icnt, treg, tempreg); + macro_build (NULL, "nop", ""); + move_register (treg, tempreg); break; case M_ULD_A: @@ -7818,44 +7569,38 @@ macro2 (struct mips_cl_insn *ip) off = 3; ulwa: used_at = 1; - load_address (&icnt, AT, &offset_expr, &used_at); + load_address (AT, &offset_expr, &used_at); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, AT, breg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, breg); if (! target_big_endian) expr1.X_add_number = off; else expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, s, "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&expr1, s, "t,o(b)", treg, BFD_RELOC_LO16, AT); if (! target_big_endian) expr1.X_add_number = 0; else expr1.X_add_number = off; - macro_build (NULL, &icnt, &expr1, s2, "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&expr1, s2, "t,o(b)", treg, BFD_RELOC_LO16, AT); break; case M_ULH_A: case M_ULHU_A: used_at = 1; - load_address (&icnt, AT, &offset_expr, &used_at); + load_address (AT, &offset_expr, &used_at); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, AT, breg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, breg); if (target_big_endian) expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, - mask == M_ULH_A ? "lb" : "lbu", "t,o(b)", + macro_build (&expr1, mask == M_ULH_A ? "lb" : "lbu", "t,o(b)", treg, BFD_RELOC_LO16, AT); if (target_big_endian) expr1.X_add_number = 1; else expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, "lbu", "t,o(b)", - AT, BFD_RELOC_LO16, AT); - macro_build (NULL, &icnt, NULL, "sll", "d,w,<", treg, treg, 8); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", treg, treg, AT); + macro_build (&expr1, "lbu", "t,o(b)", AT, BFD_RELOC_LO16, AT); + macro_build (NULL, "sll", "d,w,<", treg, treg, 8); + macro_build (NULL, "or", "d,v,t", treg, treg, AT); break; case M_USH: @@ -7863,15 +7608,13 @@ macro2 (struct mips_cl_insn *ip) as_bad (_("operand overflow")); if (target_big_endian) ++offset_expr.X_add_number; - macro_build (NULL, &icnt, &offset_expr, "sb", "t,o(b)", treg, - BFD_RELOC_LO16, breg); - macro_build (NULL, &icnt, NULL, "srl", "d,w,<", AT, treg, 8); + macro_build (&offset_expr, "sb", "t,o(b)", treg, BFD_RELOC_LO16, breg); + macro_build (NULL, "srl", "d,w,<", AT, treg, 8); if (target_big_endian) --offset_expr.X_add_number; else ++offset_expr.X_add_number; - macro_build (NULL, &icnt, &offset_expr, "sb", "t,o(b)", AT, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, "sb", "t,o(b)", AT, BFD_RELOC_LO16, breg); break; case M_USD: @@ -7888,14 +7631,12 @@ macro2 (struct mips_cl_insn *ip) as_bad (_("operand overflow")); if (! target_big_endian) offset_expr.X_add_number += off; - macro_build (NULL, &icnt, &offset_expr, s, "t,o(b)", treg, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s, "t,o(b)", treg, BFD_RELOC_LO16, breg); if (! target_big_endian) offset_expr.X_add_number -= off; else offset_expr.X_add_number += off; - macro_build (NULL, &icnt, &offset_expr, s2, "t,o(b)", treg, - BFD_RELOC_LO16, breg); + macro_build (&offset_expr, s2, "t,o(b)", treg, BFD_RELOC_LO16, breg); return; case M_USD_A: @@ -7909,49 +7650,42 @@ macro2 (struct mips_cl_insn *ip) off = 3; uswa: used_at = 1; - load_address (&icnt, AT, &offset_expr, &used_at); + load_address (AT, &offset_expr, &used_at); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, AT, breg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, breg); if (! target_big_endian) expr1.X_add_number = off; else expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, s, "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&expr1, s, "t,o(b)", treg, BFD_RELOC_LO16, AT); if (! target_big_endian) expr1.X_add_number = 0; else expr1.X_add_number = off; - macro_build (NULL, &icnt, &expr1, s2, "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&expr1, s2, "t,o(b)", treg, BFD_RELOC_LO16, AT); break; case M_USH_A: used_at = 1; - load_address (&icnt, AT, &offset_expr, &used_at); + load_address (AT, &offset_expr, &used_at); if (breg != 0) - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - AT, AT, breg); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", AT, AT, breg); if (! target_big_endian) expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, "sb", "t,o(b)", treg, - BFD_RELOC_LO16, AT); - macro_build (NULL, &icnt, NULL, "srl", "d,w,<", treg, treg, 8); + macro_build (&expr1, "sb", "t,o(b)", treg, BFD_RELOC_LO16, AT); + macro_build (NULL, "srl", "d,w,<", treg, treg, 8); if (! target_big_endian) expr1.X_add_number = 1; else expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, "sb", "t,o(b)", treg, - BFD_RELOC_LO16, AT); + macro_build (&expr1, "sb", "t,o(b)", treg, BFD_RELOC_LO16, AT); if (! target_big_endian) expr1.X_add_number = 0; else expr1.X_add_number = 1; - macro_build (NULL, &icnt, &expr1, "lbu", "t,o(b)", AT, - BFD_RELOC_LO16, AT); - macro_build (NULL, &icnt, NULL, "sll", "d,w,<", treg, treg, 8); - macro_build (NULL, &icnt, NULL, "or", "d,v,t", treg, treg, AT); + macro_build (&expr1, "lbu", "t,o(b)", AT, BFD_RELOC_LO16, AT); + macro_build (NULL, "sll", "d,w,<", treg, treg, 8); + macro_build (NULL, "or", "d,v,t", treg, treg, AT); break; default: @@ -7971,7 +7705,6 @@ mips16_macro (struct mips_cl_insn *ip) { int mask; int xreg, yreg, zreg, tmp; - int icnt; expressionS expr1; int dbl; const char *s, *s2, *s3; @@ -7982,8 +7715,6 @@ mips16_macro (struct mips_cl_insn *ip) yreg = (ip->insn_opcode >> MIPS16OP_SH_RY) & MIPS16OP_MASK_RY; zreg = (ip->insn_opcode >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ; - icnt = 0; - expr1.X_op = O_constant; expr1.X_op_symbol = NULL; expr1.X_add_symbol = NULL; @@ -8009,18 +7740,17 @@ mips16_macro (struct mips_cl_insn *ip) mips_emit_delays (TRUE); ++mips_opts.noreorder; mips_any_noreorder = 1; - macro_build (NULL, &icnt, NULL, dbl ? "ddiv" : "div", "0,x,y", - xreg, yreg); + macro_build (NULL, dbl ? "ddiv" : "div", "0,x,y", xreg, yreg); expr1.X_add_number = 2; - macro_build (NULL, &icnt, &expr1, "bnez", "x,p", yreg); - macro_build (NULL, &icnt, NULL, "break", "6", 7); + macro_build (&expr1, "bnez", "x,p", yreg); + macro_build (NULL, "break", "6", 7); /* FIXME: The normal code checks for of -1 / -0x80000000 here, since that causes an overflow. We should do that as well, but I don't see how to do the comparisons without a temporary register. */ --mips_opts.noreorder; - macro_build (NULL, &icnt, NULL, s, "x", zreg); + macro_build (NULL, s, "x", zreg); break; case M_DIVU_3: @@ -8042,20 +7772,19 @@ mips16_macro (struct mips_cl_insn *ip) mips_emit_delays (TRUE); ++mips_opts.noreorder; mips_any_noreorder = 1; - macro_build (NULL, &icnt, NULL, s, "0,x,y", xreg, yreg); + macro_build (NULL, s, "0,x,y", xreg, yreg); expr1.X_add_number = 2; - macro_build (NULL, &icnt, &expr1, "bnez", "x,p", yreg); - macro_build (NULL, &icnt, NULL, "break", "6", 7); + macro_build (&expr1, "bnez", "x,p", yreg); + macro_build (NULL, "break", "6", 7); --mips_opts.noreorder; - macro_build (NULL, &icnt, NULL, s2, "x", zreg); + macro_build (NULL, s2, "x", zreg); break; case M_DMUL: dbl = 1; case M_MUL: - macro_build (NULL, &icnt, NULL, dbl ? "dmultu" : "multu", "x,y", - xreg, yreg); - macro_build (NULL, &icnt, NULL, "mflo", "x", zreg); + macro_build (NULL, dbl ? "dmultu" : "multu", "x,y", xreg, yreg); + macro_build (NULL, "mflo", "x", zreg); return; case M_DSUBU_I: @@ -8066,22 +7795,21 @@ mips16_macro (struct mips_cl_insn *ip) if (imm_expr.X_op != O_constant) as_bad (_("Unsupported large constant")); imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, dbl ? "daddiu" : "addiu", "y,x,4", - yreg, xreg); + macro_build (&imm_expr, dbl ? "daddiu" : "addiu", "y,x,4", yreg, xreg); break; case M_SUBU_I_2: if (imm_expr.X_op != O_constant) as_bad (_("Unsupported large constant")); imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, "addiu", "x,k", xreg); + macro_build (&imm_expr, "addiu", "x,k", xreg); break; case M_DSUBU_I_2: if (imm_expr.X_op != O_constant) as_bad (_("Unsupported large constant")); imm_expr.X_add_number = -imm_expr.X_add_number; - macro_build (NULL, &icnt, &imm_expr, "daddiu", "y,j", yreg); + macro_build (&imm_expr, "daddiu", "y,j", yreg); break; case M_BEQ: @@ -8130,8 +7858,8 @@ mips16_macro (struct mips_cl_insn *ip) yreg = tmp; do_branch: - macro_build (NULL, &icnt, NULL, s, "x,y", xreg, yreg); - macro_build (NULL, &icnt, &offset_expr, s2, "p"); + macro_build (NULL, s, "x,y", xreg, yreg); + macro_build (&offset_expr, s2, "p"); break; case M_BEQ_I: @@ -8190,18 +7918,18 @@ mips16_macro (struct mips_cl_insn *ip) ++imm_expr.X_add_number; do_branch_i: - macro_build (NULL, &icnt, &imm_expr, s, s3, xreg); - macro_build (NULL, &icnt, &offset_expr, s2, "p"); + macro_build (&imm_expr, s, s3, xreg); + macro_build (&offset_expr, s2, "p"); break; case M_ABS: expr1.X_add_number = 0; - macro_build (NULL, &icnt, &expr1, "slti", "x,8", yreg); + macro_build (&expr1, "slti", "x,8", yreg); if (xreg != yreg) - move_register (&icnt, xreg, yreg); + move_register (xreg, yreg); expr1.X_add_number = 2; - macro_build (NULL, &icnt, &expr1, "bteqz", "p"); - macro_build (NULL, &icnt, NULL, "neg", "x,w", xreg, xreg); + macro_build (&expr1, "bteqz", "p"); + macro_build (NULL, "neg", "x,w", xreg, xreg); } } @@ -12318,7 +12046,6 @@ static void s_cpload (int ignore ATTRIBUTE_UNUSED) { expressionS ex; - int icnt = 0; /* If we are not generating SVR4 PIC code, or if this is NewABI code, .cpload is ignored. */ @@ -12340,12 +12067,13 @@ s_cpload (int ignore ATTRIBUTE_UNUSED) /* In ELF, this symbol is implicitly an STT_OBJECT symbol. */ symbol_get_bfdsym (ex.X_add_symbol)->flags |= BSF_OBJECT; - macro_build_lui (NULL, &icnt, &ex, mips_gp_register); - macro_build (NULL, &icnt, &ex, "addiu", "t,r,j", mips_gp_register, + macro_start (); + macro_build_lui (&ex, mips_gp_register); + macro_build (&ex, "addiu", "t,r,j", mips_gp_register, mips_gp_register, BFD_RELOC_LO16); - - macro_build (NULL, &icnt, NULL, "addu", "d,v,t", mips_gp_register, + macro_build (NULL, "addu", "d,v,t", mips_gp_register, mips_gp_register, tc_get_register (0)); + macro_end (); demand_empty_rest_of_line (); } @@ -12371,7 +12099,6 @@ s_cpsetup (int ignore ATTRIBUTE_UNUSED) expressionS ex_off; expressionS ex_sym; int reg1; - int icnt = 0; char *f; /* If we are not generating SVR4 PIC code, .cpsetup is ignored. @@ -12413,6 +12140,7 @@ s_cpsetup (int ignore ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); expression (&ex_sym); + macro_start (); if (mips_cpreturn_register == -1) { ex_off.X_op = O_constant; @@ -12420,34 +12148,34 @@ s_cpsetup (int ignore ATTRIBUTE_UNUSED) ex_off.X_op_symbol = NULL; ex_off.X_add_number = mips_cpreturn_offset; - macro_build (NULL, &icnt, &ex_off, "sd", "t,o(b)", mips_gp_register, + macro_build (&ex_off, "sd", "t,o(b)", mips_gp_register, BFD_RELOC_LO16, SP); } else - macro_build (NULL, &icnt, NULL, "daddu", "d,v,t", mips_cpreturn_register, + macro_build (NULL, "daddu", "d,v,t", mips_cpreturn_register, mips_gp_register, 0); /* Ensure there's room for the next two instructions, so that `f' doesn't end up with an address in the wrong frag. */ frag_grow (8); f = frag_more (0); - macro_build (NULL, &icnt, &ex_sym, "lui", "t,u", mips_gp_register, - BFD_RELOC_GPREL16); + macro_build (&ex_sym, "lui", "t,u", mips_gp_register, BFD_RELOC_GPREL16); fix_new (frag_now, f - frag_now->fr_literal, 8, NULL, 0, 0, BFD_RELOC_MIPS_SUB); fix_new (frag_now, f - frag_now->fr_literal, 4, NULL, 0, 0, BFD_RELOC_HI16_S); f = frag_more (0); - macro_build (NULL, &icnt, &ex_sym, "addiu", "t,r,j", mips_gp_register, + macro_build (&ex_sym, "addiu", "t,r,j", mips_gp_register, mips_gp_register, BFD_RELOC_GPREL16); fix_new (frag_now, f - frag_now->fr_literal, 8, NULL, 0, 0, BFD_RELOC_MIPS_SUB); fix_new (frag_now, f - frag_now->fr_literal, 4, NULL, 0, 0, BFD_RELOC_LO16); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", mips_gp_register, + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", mips_gp_register, mips_gp_register, reg1); + macro_end (); demand_empty_rest_of_line (); } @@ -12475,7 +12203,6 @@ static void s_cprestore (int ignore ATTRIBUTE_UNUSED) { expressionS ex; - int icnt = 0; /* If we are not generating SVR4 PIC code, or if this is NewABI code, .cprestore is ignored. */ @@ -12493,8 +12220,10 @@ s_cprestore (int ignore ATTRIBUTE_UNUSED) ex.X_op_symbol = NULL; ex.X_add_number = mips_cprestore_offset; - macro_build_ldst_constoffset (NULL, &icnt, &ex, ADDRESS_STORE_INSN, - mips_gp_register, SP, HAVE_64BIT_ADDRESSES); + macro_start (); + macro_build_ldst_constoffset (&ex, ADDRESS_STORE_INSN, mips_gp_register, + SP, HAVE_64BIT_ADDRESSES); + macro_end (); demand_empty_rest_of_line (); } @@ -12510,7 +12239,6 @@ static void s_cpreturn (int ignore ATTRIBUTE_UNUSED) { expressionS ex; - int icnt = 0; /* If we are not generating SVR4 PIC code, .cpreturn is ignored. We also need NewABI support. */ @@ -12520,6 +12248,7 @@ s_cpreturn (int ignore ATTRIBUTE_UNUSED) return; } + macro_start (); if (mips_cpreturn_register == -1) { ex.X_op = O_constant; @@ -12527,12 +12256,12 @@ s_cpreturn (int ignore ATTRIBUTE_UNUSED) ex.X_op_symbol = NULL; ex.X_add_number = mips_cpreturn_offset; - macro_build (NULL, &icnt, &ex, "ld", "t,o(b)", mips_gp_register, - BFD_RELOC_LO16, SP); + macro_build (&ex, "ld", "t,o(b)", mips_gp_register, BFD_RELOC_LO16, SP); } else - macro_build (NULL, &icnt, NULL, "daddu", "d,v,t", mips_gp_register, + macro_build (NULL, "daddu", "d,v,t", mips_gp_register, mips_cpreturn_register, 0); + macro_end (); demand_empty_rest_of_line (); } @@ -12644,7 +12373,6 @@ s_gpdword (int ignore ATTRIBUTE_UNUSED) static void s_cpadd (int ignore ATTRIBUTE_UNUSED) { - int icnt = 0; int reg; /* This is ignored when not generating SVR4 PIC code. */ @@ -12655,9 +12383,10 @@ s_cpadd (int ignore ATTRIBUTE_UNUSED) } /* Add $gp to the register named as an argument. */ + macro_start (); reg = tc_get_register (0); - macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", - reg, reg, mips_gp_register); + macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", reg, reg, mips_gp_register); + macro_end (); demand_empty_rest_of_line (); } @@ -13264,22 +12993,11 @@ md_estimate_size_before_relax (fragS *fragp, asection *segtype) if (change) { - /* Record the offset to the first reloc in the fr_opcode field. - This lets md_convert_frag and tc_gen_reloc know that the code - must be expanded. */ - fragp->fr_opcode = (fragp->fr_literal - + fragp->fr_fix - - RELAX_OLD (fragp->fr_subtype) - + RELAX_RELOC1 (fragp->fr_subtype)); - /* FIXME: This really needs as_warn_where. */ - if (RELAX_WARN (fragp->fr_subtype)) - as_warn (_("AT used after \".set noat\" or macro used after " - "\".set nomacro\"")); - - return RELAX_NEW (fragp->fr_subtype) - RELAX_OLD (fragp->fr_subtype); + fragp->fr_subtype |= RELAX_USE_SECOND; + return -RELAX_FIRST (fragp->fr_subtype); } - - return 0; + else + return -RELAX_SECOND (fragp->fr_subtype); } /* This is called to see whether a reloc against a defined symbol @@ -13383,112 +13101,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) else reloc->addend = fixp->fx_addnumber; - /* If this is a variant frag, we may need to adjust the existing - reloc and generate a new one. */ - if (fixp->fx_frag->fr_opcode != NULL - && ((fixp->fx_r_type == BFD_RELOC_GPREL16 - && ! HAVE_NEWABI) - || (fixp->fx_r_type == BFD_RELOC_MIPS_GOT_DISP - && HAVE_NEWABI) - || fixp->fx_r_type == BFD_RELOC_MIPS_GOT16 - || fixp->fx_r_type == BFD_RELOC_MIPS_CALL16 - || fixp->fx_r_type == BFD_RELOC_MIPS_GOT_HI16 - || fixp->fx_r_type == BFD_RELOC_MIPS_GOT_LO16 - || fixp->fx_r_type == BFD_RELOC_MIPS_CALL_HI16 - || fixp->fx_r_type == BFD_RELOC_MIPS_CALL_LO16) - ) - { - arelent *reloc2; - - assert (! RELAX_MIPS16_P (fixp->fx_frag->fr_subtype)); - - /* If this is not the last reloc in this frag, then we have two - GPREL relocs, or a GOT_HI16/GOT_LO16 pair, or a - CALL_HI16/CALL_LO16, both of which are being replaced. Let - the second one handle all of them. */ - if (fixp->fx_next != NULL - && fixp->fx_frag == fixp->fx_next->fx_frag) - { - assert ((fixp->fx_r_type == BFD_RELOC_GPREL16 - && fixp->fx_next->fx_r_type == BFD_RELOC_GPREL16) - || (fixp->fx_r_type == BFD_RELOC_MIPS_GOT_HI16 - && (fixp->fx_next->fx_r_type - == BFD_RELOC_MIPS_GOT_LO16)) - || (fixp->fx_r_type == BFD_RELOC_MIPS_CALL_HI16 - && (fixp->fx_next->fx_r_type - == BFD_RELOC_MIPS_CALL_LO16))); - retval[0] = NULL; - return retval; - } - - fixp->fx_where = fixp->fx_frag->fr_opcode - fixp->fx_frag->fr_literal; - reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; - reloc->addend += fixp->fx_frag->tc_frag_data.tc_fr_offset; - reloc2 = retval[1] = (arelent *) xmalloc (sizeof (arelent)); - reloc2->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); - *reloc2->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); - reloc2->address = (reloc->address - + (RELAX_RELOC2 (fixp->fx_frag->fr_subtype) - - RELAX_RELOC1 (fixp->fx_frag->fr_subtype))); - reloc2->addend = reloc->addend; - reloc2->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO16); - assert (reloc2->howto != NULL); - - if (RELAX_RELOC3 (fixp->fx_frag->fr_subtype)) - { - arelent *reloc3; - - reloc3 = retval[2] = (arelent *) xmalloc (sizeof (arelent)); - *reloc3 = *reloc2; - reloc3->address += 4; - } - - if (mips_pic == NO_PIC) - { - assert (fixp->fx_r_type == BFD_RELOC_GPREL16); - fixp->fx_r_type = BFD_RELOC_HI16_S; - } - else if (mips_pic == SVR4_PIC) - { - switch (fixp->fx_r_type) - { - default: - abort (); - case BFD_RELOC_MIPS_GOT16: - break; - case BFD_RELOC_MIPS_GOT_LO16: - case BFD_RELOC_MIPS_CALL_LO16: - if (HAVE_NEWABI) - { - fixp->fx_r_type = BFD_RELOC_MIPS_GOT_PAGE; - reloc2->howto = bfd_reloc_type_lookup - (stdoutput, BFD_RELOC_MIPS_GOT_OFST); - } - else - fixp->fx_r_type = BFD_RELOC_MIPS_GOT16; - break; - case BFD_RELOC_MIPS_CALL16: - case BFD_RELOC_MIPS_GOT_OFST: - case BFD_RELOC_MIPS_GOT_DISP: - if (HAVE_NEWABI) - { - /* It may seem nonsensical to relax GOT_DISP to - GOT_DISP, but we're actually turning a GOT_DISP - without offset into a GOT_DISP with an offset, - getting rid of the separate addition, which we can - do when the symbol is found to be local. */ - fixp->fx_r_type = BFD_RELOC_MIPS_GOT_DISP; - retval[1] = NULL; - } - else - fixp->fx_r_type = BFD_RELOC_MIPS_GOT16; - break; - } - } - else - abort (); - } - /* Since the old MIPS ELF ABI uses Rel instead of Rela, encode the vtable entry to be used in the relocation's section offset. */ if (! HAVE_NEWABI && fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) @@ -13596,9 +13208,6 @@ mips_relax_frag (asection *sec, fragS *fragp, long stretch) void md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) { - int old, new; - char *fixptr; - if (RELAX_BRANCH_P (fragp->fr_subtype)) { bfd_byte *buf; @@ -13898,17 +13507,57 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) } else { - if (fragp->fr_opcode == NULL) - return; + int first, second; + fixS *fixp; - old = RELAX_OLD (fragp->fr_subtype); - new = RELAX_NEW (fragp->fr_subtype); - fixptr = fragp->fr_literal + fragp->fr_fix; + first = RELAX_FIRST (fragp->fr_subtype); + second = RELAX_SECOND (fragp->fr_subtype); + fixp = (fixS *) fragp->fr_opcode; - if (new > 0) - memmove (fixptr - old, fixptr, new); + /* Possibly emit a warning if we've chosen the longer option. */ + if (((fragp->fr_subtype & RELAX_USE_SECOND) != 0) + == ((fragp->fr_subtype & RELAX_SECOND_LONGER) != 0)) + { + const char *msg = macro_warning (fragp->fr_subtype); + if (msg != 0) + as_warn_where (fragp->fr_file, fragp->fr_line, msg); + } - fragp->fr_fix += new - old; + /* Go through all the fixups for the first sequence. Disable them + (by marking them as done) if we're going to use the second + sequence instead. */ + while (fixp + && fixp->fx_frag == fragp + && fixp->fx_where < fragp->fr_fix - second) + { + if (fragp->fr_subtype & RELAX_USE_SECOND) + fixp->fx_done = 1; + fixp = fixp->fx_next; + } + + /* Go through the fixups for the second sequence. Disable them if + we're going to use the first sequence, otherwise adjust their + addresses to account for the relaxation. */ + while (fixp && fixp->fx_frag == fragp) + { + if (fragp->fr_subtype & RELAX_USE_SECOND) + fixp->fx_where -= first; + else + fixp->fx_done = 1; + fixp = fixp->fx_next; + } + + /* Now modify the frag contents. */ + if (fragp->fr_subtype & RELAX_USE_SECOND) + { + char *start; + + start = fragp->fr_literal + fragp->fr_fix - first - second; + memmove (start, start + first, second); + fragp->fr_fix -= first; + } + else + fragp->fr_fix -= second; } } diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h index fc96ef3..110dc09 100644 --- a/gas/config/tc-mips.h +++ b/gas/config/tc-mips.h @@ -186,9 +186,4 @@ extern enum dwarf2_format mips_dwarf2_format (void); #define DWARF2_ADDR_SIZE(bfd) \ (DWARF2_FORMAT () == dwarf2_format_32bit ? 4 : 8) -typedef struct { - offsetT tc_fr_offset; -} tc_frag_data_type; -#define TC_FRAG_TYPE tc_frag_data_type - #endif /* TC_MIPS */ diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 3d94f43..6719bbf 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -704,9 +704,10 @@ processing. After this point, it is safe to operate on one chain per section. The assembler always has a current frag, named @code{frag_now}. More space is allocated for the current frag using the @code{frag_more} function; this -returns a pointer to the amount of requested space. Relaxing is done using -variant frags allocated by @code{frag_var} or @code{frag_variant} -(@pxref{Relaxation}). +returns a pointer to the amount of requested space. The function +@code{frag_room} says by how much the current frag can be extended. +Relaxing is done using variant frags allocated by @code{frag_var} +or @code{frag_variant} (@pxref{Relaxation}). @node GAS processing @section What GAS does when it runs @@ -1032,6 +1033,11 @@ arguments, the character before the @kbd{=} character, and the value of If you define this macro, it should return nonzero if the current input line pointer should be treated as the end of a line. +@item TC_CASE_SENSITIVE +@cindex TC_CASE_SENSITIVE +Define this macro if instruction mnemonics and pseudos are case sensitive. +The default is to have it undefined giving case insensitive names. + @item md_parse_name @cindex md_parse_name If this macro is defined, GAS will call it for any symbol found in an diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 9601150..3336453 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1,5 +1,5 @@ /* dwarf2dbg.c - DWARF2 debug support - Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of GAS, the GNU Assembler. @@ -49,7 +49,7 @@ #endif #ifndef DWARF2_ADDR_SIZE -# define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8); +# define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8) #endif #ifdef BFD_ASSEMBLER @@ -372,7 +372,7 @@ get_filenum (const char *filename, unsigned int num) { --dir_len; for (dir = 1; dir < dirs_in_use; ++dir) - if (memcmp (filename, dirs[dir], dir_len) == 0 + if (strncmp (filename, dirs[dir], dir_len) == 0 && dirs[dir][dir_len] == '\0') break; diff --git a/gas/frags.c b/gas/frags.c index 1521d4b..83625d7 100644 --- a/gas/frags.c +++ b/gas/frags.c @@ -262,6 +262,14 @@ frag_wane (register fragS *fragP) fragP->fr_var = 0; } +/* Return the number of bytes by which the current frag can be grown. */ + +int +frag_room (void) +{ + return obstack_room (&frchain_now->frch_obstack); +} + /* Make an alignment frag. The size of this frag will be adjusted to force the next frag to have the appropriate alignment. ALIGNMENT is the power of two to which to align. FILL_CHARACTER is the diff --git a/gas/frags.h b/gas/frags.h index 73b7182..52a6cfe 100644 --- a/gas/frags.h +++ b/gas/frags.h @@ -141,6 +141,7 @@ void frag_align_pattern (int alignment, const char *fill_pattern, void frag_align_code (int alignment, int max); void frag_new (int old_frags_var_max_size); void frag_wane (fragS * fragP); +int frag_room (void); char *frag_variant (relax_stateT type, int max_chars, @@ -155,7 +155,7 @@ char is_end_of_line[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */ }; -#ifdef IGNORE_OPCODE_CASE +#ifndef TC_CASE_SENSITIVE char original_case_string[128]; #endif @@ -720,7 +720,7 @@ read_a_source_file (char *name) /* Expect pseudo-op or machine instruction. */ pop = NULL; -#ifdef IGNORE_OPCODE_CASE +#ifndef TC_CASE_SENSITIVE { char *s2 = s; @@ -754,6 +754,8 @@ read_a_source_file (char *name) if (pop == NULL) pop = (pseudo_typeS *) hash_find (po_hash, s + 1); + if (pop && !pop->poc_handler) + pop = NULL; /* In MRI mode, we may need to insert an automatic alignment directive. What a hack @@ -30,10 +30,7 @@ extern char *input_line_pointer; /* -> char we are parsing now. */ #ifdef PERMIT_WHITESPACE #define SKIP_WHITESPACE() \ - { \ - if (* input_line_pointer == ' ') \ - ++ input_line_pointer; \ - } + ((*input_line_pointer == ' ') ? ++input_line_pointer : 0) #else #define SKIP_WHITESPACE() know(*input_line_pointer != ' ' ) #endif @@ -93,8 +90,7 @@ enum linkonce_type { LINKONCE_SAME_CONTENTS }; -#define IGNORE_OPCODE_CASE -#ifdef IGNORE_OPCODE_CASE +#ifndef TC_CASE_SENSITIVE extern char original_case_string[]; #endif diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index d1b3885..89535f0 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,53 @@ +2004-02-09 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * gas/sh/basic.exp: Don't do sh4a tests for sh5. + +2004-02-06 Nathan Sidwell <nathan@codesourcery.com> + + * gas/macros/test2.s: Lowercase it. + +2004-02-02 Maciej W. Rozycki <macro@ds2.pg.gda.pl> + + * gas/mips/div.d: Update to accomodate changes in macro + expansions. + gas/mips/elf-rel-got-n32.d: Likewise. + gas/mips/elf-rel-got-n64.d: Likewise. + gas/mips/elf-rel-xgot-n32.d: Likewise. + gas/mips/elf-rel-xgot-n64.d: Likewise. + gas/mips/la-svr4pic.d: Likewise. + gas/mips/la-xgot.d: Likewise. + gas/mips/lca-svr4pic.d: Likewise. + gas/mips/lca-xgot.d: Likewise. + +2004-02-01 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * gas/sh/sh4a-fp.d: Fix opcode name fssra to fsrra. + * gas/sh/sh4a-fp.s: Likewise. + * gas/sh/err-sh4a-fp.s: Likewise. + +2004-01-24 Chris Demetriou <cgd@broadcom.com> + + * gas/mips/relax-swap1.s: Add extra space at end, so the + disassembly will consistently have "..." at its end. + * gas/mips/relax-swap2.s: Likewise. + * gas/mips/relax-swap1-mips2.d: Expect "..." at end of disassembly. + +2004-01-23 Daniel Jacobowitz <drow@mvista.com> + + * gas/arm/arm.exp: Add "undefined" test. + * gas/arm/undefined.s, gas/arm/undefined.l: New files. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * gas/mips/macro-warn-[1234].[sdl]: New tests. + * gas/mips/macro-warn-[12]-n32.[dl]: New tests. + * gas/mips/mips.exp: Run them. + +2004-01-23 Richard Sandiford <rsandifo@redhat.com> + + * gas/mips/elf-rel19.[sd]: New test. + * gas/mips/mips.exp: Run it. + 2004-01-11 Tom Rix <tcrix@worldnet.att.net> * gas/m68hc11/movb.s: Add m68hc12 movb and movw dump test. diff --git a/gas/testsuite/gas/arm/arm.exp b/gas/testsuite/gas/arm/arm.exp index 9816497..e5ec8be 100644 --- a/gas/testsuite/gas/arm/arm.exp +++ b/gas/testsuite/gas/arm/arm.exp @@ -86,6 +86,8 @@ if {[istarget *arm*-*-*] || [istarget "xscale-*-*"]} then { } gas_test "offset.s" "" $stdoptlist "OFFSET_IMM regression" + + run_errors_test "undefined" "" "Undefined local label error" } # Not all arm targets are bi-endian, so only run this test on ones diff --git a/gas/testsuite/gas/arm/undefined.l b/gas/testsuite/gas/arm/undefined.l new file mode 100644 index 0000000..89cfa04 --- /dev/null +++ b/gas/testsuite/gas/arm/undefined.l @@ -0,0 +1,2 @@ +[^:]*: Assembler messages: +[^:]*:1: Error: undefined local label `\.Lval' diff --git a/gas/testsuite/gas/arm/undefined.s b/gas/testsuite/gas/arm/undefined.s new file mode 100644 index 0000000..f7b76d7 --- /dev/null +++ b/gas/testsuite/gas/arm/undefined.s @@ -0,0 +1 @@ + ldr a1, .Lval diff --git a/gas/testsuite/gas/macros/test2.s b/gas/testsuite/gas/macros/test2.s index a21b011..0cfca29 100644 --- a/gas/testsuite/gas/macros/test2.s +++ b/gas/testsuite/gas/macros/test2.s @@ -1,7 +1,7 @@ .macro m arg1 arg2 arg3 .long \arg1 .ifc ,\arg2\arg3 - .ELSE + .else m \arg2,\arg3 .endif .endm diff --git a/gas/testsuite/gas/mips/div.d b/gas/testsuite/gas/mips/div.d index 6d60da5..869c0fd 100644 --- a/gas/testsuite/gas/mips/div.d +++ b/gas/testsuite/gas/mips/div.d @@ -102,9 +102,9 @@ Disassembly of section .text: 0+0174 <[^>]*> bnez a2,0+0180 <foo\+0x180> 0+0178 <[^>]*> ddiv zero,a1,a2 0+017c <[^>]*> break (0x0,0x7|0x7) -0+0180 <[^>]*> daddiu at,zero,-1 +0+0180 <[^>]*> (daddiu at,zero,-1|li at,-1) 0+0184 <[^>]*> bne a2,at,0+019c <foo\+0x19c> -0+0188 <[^>]*> daddiu at,zero,1 +0+0188 <[^>]*> (daddiu at,zero,1|li at,1) 0+018c <[^>]*> dsll32 at,at,0x1f 0+0190 <[^>]*> bne a1,at,0+019c <foo\+0x19c> 0+0194 <[^>]*> nop diff --git a/gas/testsuite/gas/mips/elf-rel-got-n32.d b/gas/testsuite/gas/mips/elf-rel-got-n32.d index 4ce7673..41c2c3e 100644 --- a/gas/testsuite/gas/mips/elf-rel-got-n32.d +++ b/gas/testsuite/gas/mips/elf-rel-got-n32.d @@ -12,8 +12,8 @@ Disassembly of section \.text: 00000008 <fn\+0x8> 24a5000c addiu a1,a1,12 0000000c <fn\+0xc> 8f850000 lw a1,0\(gp\) c: R_MIPS_GOT_DISP dg1 -00000010 <fn\+0x10> 3c010002 lui at,0x2 -00000014 <fn\+0x14> 2421e240 addiu at,at,-7616 +00000010 <fn\+0x10> 3c010001 lui at,0x1 +00000014 <fn\+0x14> 3421e240 ori at,at,0xe240 00000018 <fn\+0x18> 00a12821 addu a1,a1,at 0000001c <fn\+0x1c> 8f850000 lw a1,0\(gp\) 1c: R_MIPS_GOT_DISP dg1 @@ -24,8 +24,8 @@ Disassembly of section \.text: 0000002c <fn\+0x2c> 00b12821 addu a1,a1,s1 00000030 <fn\+0x30> 8f850000 lw a1,0\(gp\) 30: R_MIPS_GOT_DISP dg1 -00000034 <fn\+0x34> 3c010002 lui at,0x2 -00000038 <fn\+0x38> 2421e240 addiu at,at,-7616 +00000034 <fn\+0x34> 3c010001 lui at,0x1 +00000038 <fn\+0x38> 3421e240 ori at,at,0xe240 0000003c <fn\+0x3c> 00a12821 addu a1,a1,at 00000040 <fn\+0x40> 00b12821 addu a1,a1,s1 00000044 <fn\+0x44> 8f850000 lw a1,0\(gp\) @@ -184,8 +184,8 @@ Disassembly of section \.text: 000001d8 <fn\+0x1d8> 24a5000c addiu a1,a1,12 000001dc <fn\+0x1dc> 8f850000 lw a1,0\(gp\) 1dc: R_MIPS_GOT_DISP dg2 -000001e0 <fn\+0x1e0> 3c010002 lui at,0x2 -000001e4 <fn\+0x1e4> 2421e240 addiu at,at,-7616 +000001e0 <fn\+0x1e0> 3c010001 lui at,0x1 +000001e4 <fn\+0x1e4> 3421e240 ori at,at,0xe240 000001e8 <fn\+0x1e8> 00a12821 addu a1,a1,at 000001ec <fn\+0x1ec> 8f850000 lw a1,0\(gp\) 1ec: R_MIPS_GOT_DISP dg2 @@ -196,8 +196,8 @@ Disassembly of section \.text: 000001fc <fn\+0x1fc> 00b12821 addu a1,a1,s1 00000200 <fn\+0x200> 8f850000 lw a1,0\(gp\) 200: R_MIPS_GOT_DISP dg2 -00000204 <fn\+0x204> 3c010002 lui at,0x2 -00000208 <fn\+0x208> 2421e240 addiu at,at,-7616 +00000204 <fn\+0x204> 3c010001 lui at,0x1 +00000208 <fn\+0x208> 3421e240 ori at,at,0xe240 0000020c <fn\+0x20c> 00a12821 addu a1,a1,at 00000210 <fn\+0x210> 00b12821 addu a1,a1,s1 00000214 <fn\+0x214> 8f850000 lw a1,0\(gp\) diff --git a/gas/testsuite/gas/mips/elf-rel-got-n64.d b/gas/testsuite/gas/mips/elf-rel-got-n64.d index 9fe98b5..9b971c0 100644 --- a/gas/testsuite/gas/mips/elf-rel-got-n64.d +++ b/gas/testsuite/gas/mips/elf-rel-got-n64.d @@ -18,8 +18,8 @@ Disassembly of section \.text: c: R_MIPS_GOT_DISP dg1 c: R_MIPS_NONE \*ABS\* c: R_MIPS_NONE \*ABS\* -0000000000000010 <fn\+0x10> 3c010002 lui at,0x2 -0000000000000014 <fn\+0x14> 6421e240 daddiu at,at,-7616 +0000000000000010 <fn\+0x10> 3c010001 lui at,0x1 +0000000000000014 <fn\+0x14> 3421e240 ori at,at,0xe240 0000000000000018 <fn\+0x18> 00a1282d daddu a1,a1,at 000000000000001c <fn\+0x1c> df850000 ld a1,0\(gp\) 1c: R_MIPS_GOT_DISP dg1 @@ -36,8 +36,8 @@ Disassembly of section \.text: 30: R_MIPS_GOT_DISP dg1 30: R_MIPS_NONE \*ABS\* 30: R_MIPS_NONE \*ABS\* -0000000000000034 <fn\+0x34> 3c010002 lui at,0x2 -0000000000000038 <fn\+0x38> 6421e240 daddiu at,at,-7616 +0000000000000034 <fn\+0x34> 3c010001 lui at,0x1 +0000000000000038 <fn\+0x38> 3421e240 ori at,at,0xe240 000000000000003c <fn\+0x3c> 00a1282d daddu a1,a1,at 0000000000000040 <fn\+0x40> 00b1282d daddu a1,a1,s1 0000000000000044 <fn\+0x44> df850000 ld a1,0\(gp\) @@ -302,8 +302,8 @@ Disassembly of section \.text: 1dc: R_MIPS_GOT_DISP dg2 1dc: R_MIPS_NONE \*ABS\* 1dc: R_MIPS_NONE \*ABS\* -00000000000001e0 <fn\+0x1e0> 3c010002 lui at,0x2 -00000000000001e4 <fn\+0x1e4> 6421e240 daddiu at,at,-7616 +00000000000001e0 <fn\+0x1e0> 3c010001 lui at,0x1 +00000000000001e4 <fn\+0x1e4> 3421e240 ori at,at,0xe240 00000000000001e8 <fn\+0x1e8> 00a1282d daddu a1,a1,at 00000000000001ec <fn\+0x1ec> df850000 ld a1,0\(gp\) 1ec: R_MIPS_GOT_DISP dg2 @@ -320,8 +320,8 @@ Disassembly of section \.text: 200: R_MIPS_GOT_DISP dg2 200: R_MIPS_NONE \*ABS\* 200: R_MIPS_NONE \*ABS\* -0000000000000204 <fn\+0x204> 3c010002 lui at,0x2 -0000000000000208 <fn\+0x208> 6421e240 daddiu at,at,-7616 +0000000000000204 <fn\+0x204> 3c010001 lui at,0x1 +0000000000000208 <fn\+0x208> 3421e240 ori at,at,0xe240 000000000000020c <fn\+0x20c> 00a1282d daddu a1,a1,at 0000000000000210 <fn\+0x210> 00b1282d daddu a1,a1,s1 0000000000000214 <fn\+0x214> df850000 ld a1,0\(gp\) diff --git a/gas/testsuite/gas/mips/elf-rel-xgot-n32.d b/gas/testsuite/gas/mips/elf-rel-xgot-n32.d index a3f5d0c..a7039df 100644 --- a/gas/testsuite/gas/mips/elf-rel-xgot-n32.d +++ b/gas/testsuite/gas/mips/elf-rel-xgot-n32.d @@ -22,8 +22,8 @@ Disassembly of section \.text: 00000020 <fn\+0x20> 00bc2821 addu a1,a1,gp 00000024 <fn\+0x24> 8ca50000 lw a1,0\(a1\) 24: R_MIPS_GOT_LO16 dg1 -00000028 <fn\+0x28> 3c010002 lui at,0x2 -0000002c <fn\+0x2c> 2421e240 addiu at,at,-7616 +00000028 <fn\+0x28> 3c010001 lui at,0x1 +0000002c <fn\+0x2c> 3421e240 ori at,at,0xe240 00000030 <fn\+0x30> 00a12821 addu a1,a1,at 00000034 <fn\+0x34> 3c050000 lui a1,0x0 34: R_MIPS_GOT_HI16 dg1 @@ -43,8 +43,8 @@ Disassembly of section \.text: 0000005c <fn\+0x5c> 00bc2821 addu a1,a1,gp 00000060 <fn\+0x60> 8ca50000 lw a1,0\(a1\) 60: R_MIPS_GOT_LO16 dg1 -00000064 <fn\+0x64> 3c010002 lui at,0x2 -00000068 <fn\+0x68> 2421e240 addiu at,at,-7616 +00000064 <fn\+0x64> 3c010001 lui at,0x1 +00000068 <fn\+0x68> 3421e240 ori at,at,0xe240 0000006c <fn\+0x6c> 00a12821 addu a1,a1,at 00000070 <fn\+0x70> 00b12821 addu a1,a1,s1 00000074 <fn\+0x74> 3c050000 lui a1,0x0 @@ -281,8 +281,8 @@ Disassembly of section \.text: 000002d4 <fn\+0x2d4> 00bc2821 addu a1,a1,gp 000002d8 <fn\+0x2d8> 8ca50000 lw a1,0\(a1\) 2d8: R_MIPS_GOT_LO16 dg2 -000002dc <fn\+0x2dc> 3c010002 lui at,0x2 -000002e0 <fn\+0x2e0> 2421e240 addiu at,at,-7616 +000002dc <fn\+0x2dc> 3c010001 lui at,0x1 +000002e0 <fn\+0x2e0> 3421e240 ori at,at,0xe240 000002e4 <fn\+0x2e4> 00a12821 addu a1,a1,at 000002e8 <fn\+0x2e8> 3c050000 lui a1,0x0 2e8: R_MIPS_GOT_HI16 dg2 @@ -302,8 +302,8 @@ Disassembly of section \.text: 00000310 <fn\+0x310> 00bc2821 addu a1,a1,gp 00000314 <fn\+0x314> 8ca50000 lw a1,0\(a1\) 314: R_MIPS_GOT_LO16 dg2 -00000318 <fn\+0x318> 3c010002 lui at,0x2 -0000031c <fn\+0x31c> 2421e240 addiu at,at,-7616 +00000318 <fn\+0x318> 3c010001 lui at,0x1 +0000031c <fn\+0x31c> 3421e240 ori at,at,0xe240 00000320 <fn\+0x320> 00a12821 addu a1,a1,at 00000324 <fn\+0x324> 00b12821 addu a1,a1,s1 00000328 <fn\+0x328> 3c050000 lui a1,0x0 diff --git a/gas/testsuite/gas/mips/elf-rel-xgot-n64.d b/gas/testsuite/gas/mips/elf-rel-xgot-n64.d index 3d4c13d..717f8ac 100644 --- a/gas/testsuite/gas/mips/elf-rel-xgot-n64.d +++ b/gas/testsuite/gas/mips/elf-rel-xgot-n64.d @@ -34,8 +34,8 @@ Disassembly of section \.text: 24: R_MIPS_GOT_LO16 dg1 24: R_MIPS_NONE \*ABS\* 24: R_MIPS_NONE \*ABS\* -0000000000000028 <fn\+0x28> 3c010002 lui at,0x2 -000000000000002c <fn\+0x2c> 6421e240 daddiu at,at,-7616 +0000000000000028 <fn\+0x28> 3c010001 lui at,0x1 +000000000000002c <fn\+0x2c> 3421e240 ori at,at,0xe240 0000000000000030 <fn\+0x30> 00a1282d daddu a1,a1,at 0000000000000034 <fn\+0x34> 3c050000 lui a1,0x0 34: R_MIPS_GOT_HI16 dg1 @@ -67,8 +67,8 @@ Disassembly of section \.text: 60: R_MIPS_GOT_LO16 dg1 60: R_MIPS_NONE \*ABS\* 60: R_MIPS_NONE \*ABS\* -0000000000000064 <fn\+0x64> 3c010002 lui at,0x2 -0000000000000068 <fn\+0x68> 6421e240 daddiu at,at,-7616 +0000000000000064 <fn\+0x64> 3c010001 lui at,0x1 +0000000000000068 <fn\+0x68> 3421e240 ori at,at,0xe240 000000000000006c <fn\+0x6c> 00a1282d daddu a1,a1,at 0000000000000070 <fn\+0x70> 00b1282d daddu a1,a1,s1 0000000000000074 <fn\+0x74> 3c050000 lui a1,0x0 @@ -465,8 +465,8 @@ Disassembly of section \.text: 2d8: R_MIPS_GOT_LO16 dg2 2d8: R_MIPS_NONE \*ABS\* 2d8: R_MIPS_NONE \*ABS\* -00000000000002dc <fn\+0x2dc> 3c010002 lui at,0x2 -00000000000002e0 <fn\+0x2e0> 6421e240 daddiu at,at,-7616 +00000000000002dc <fn\+0x2dc> 3c010001 lui at,0x1 +00000000000002e0 <fn\+0x2e0> 3421e240 ori at,at,0xe240 00000000000002e4 <fn\+0x2e4> 00a1282d daddu a1,a1,at 00000000000002e8 <fn\+0x2e8> 3c050000 lui a1,0x0 2e8: R_MIPS_GOT_HI16 dg2 @@ -498,8 +498,8 @@ Disassembly of section \.text: 314: R_MIPS_GOT_LO16 dg2 314: R_MIPS_NONE \*ABS\* 314: R_MIPS_NONE \*ABS\* -0000000000000318 <fn\+0x318> 3c010002 lui at,0x2 -000000000000031c <fn\+0x31c> 6421e240 daddiu at,at,-7616 +0000000000000318 <fn\+0x318> 3c010001 lui at,0x1 +000000000000031c <fn\+0x31c> 3421e240 ori at,at,0xe240 0000000000000320 <fn\+0x320> 00a1282d daddu a1,a1,at 0000000000000324 <fn\+0x324> 00b1282d daddu a1,a1,s1 0000000000000328 <fn\+0x328> 3c050000 lui a1,0x0 diff --git a/gas/testsuite/gas/mips/elf-rel19.d b/gas/testsuite/gas/mips/elf-rel19.d new file mode 100644 index 0000000..e80aa61 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel19.d @@ -0,0 +1,34 @@ +#objdump: -dr +#as: -mabi=32 -KPIC + +.*: file format .* + +Disassembly of section \.text: + +00000000 <.*>: +# +# Relocation agsinst .rodata.str1.1 +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 \.rodata\.str1\.1 +.*: 00000000 nop +.*: 24840004 addiu a0,a0,4 + .*: R_MIPS_LO16 \.rodata\.str1\.1 +# +# Relocation agsinst L2 + 2 +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 L2 +.*: 00000000 nop +.*: 24840002 addiu a0,a0,2 + .*: R_MIPS_LO16 L2 +# +# Relocation agsinst L2 - 0x4000 with 0x10000 added separately. +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 L2 +.*: 3c010001 lui at,0x1 +.*: 2421c000 addiu at,at,-16384 + .*: R_MIPS_LO16 L2 +.*: 00812021 addu a0,a0,at + \.\.\. diff --git a/gas/testsuite/gas/mips/elf-rel19.s b/gas/testsuite/gas/mips/elf-rel19.s new file mode 100644 index 0000000..9a3c6d5 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel19.s @@ -0,0 +1,8 @@ + .abicalls + la $4,L2 + la $4,L2 + 2 + la $4,L2 + 0xc000 + .space 16 + .section .rodata.str1.1,"aMS",@progbits,1 +L1: .string "foo" +L2: .string "a" diff --git a/gas/testsuite/gas/mips/la-svr4pic.d b/gas/testsuite/gas/mips/la-svr4pic.d index 698b57c..d53580f 100644 --- a/gas/testsuite/gas/mips/la-svr4pic.d +++ b/gas/testsuite/gas/mips/la-svr4pic.d @@ -87,23 +87,19 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -157,22 +153,18 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -194,23 +186,23 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -305,26 +297,22 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -389,25 +377,21 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -433,26 +417,26 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) diff --git a/gas/testsuite/gas/mips/la-xgot.d b/gas/testsuite/gas/mips/la-xgot.d index 5a72452..50cc37c83 100644 --- a/gas/testsuite/gas/mips/la-xgot.d +++ b/gas/testsuite/gas/mips/la-xgot.d @@ -114,32 +114,28 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -208,7 +204,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label @@ -216,7 +211,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common @@ -224,7 +218,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common @@ -232,7 +225,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -257,32 +249,32 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -404,8 +396,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -413,8 +404,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -422,8 +412,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -431,8 +420,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -512,7 +500,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -521,7 +508,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -530,7 +516,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -539,7 +524,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -568,8 +552,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -577,8 +561,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -586,8 +570,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -595,8 +579,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) diff --git a/gas/testsuite/gas/mips/lca-svr4pic.d b/gas/testsuite/gas/mips/lca-svr4pic.d index 730ecdd..29e6a44 100644 --- a/gas/testsuite/gas/mips/lca-svr4pic.d +++ b/gas/testsuite/gas/mips/lca-svr4pic.d @@ -87,23 +87,19 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -157,22 +153,18 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -194,23 +186,23 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -305,26 +297,22 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -389,25 +377,21 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -433,26 +417,26 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) diff --git a/gas/testsuite/gas/mips/lca-xgot.d b/gas/testsuite/gas/mips/lca-xgot.d index e40ec55..404f4e0 100644 --- a/gas/testsuite/gas/mips/lca-xgot.d +++ b/gas/testsuite/gas/mips/lca-xgot.d @@ -114,32 +114,28 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -208,7 +204,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label @@ -216,7 +211,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common @@ -224,7 +218,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common @@ -232,7 +225,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -257,32 +249,32 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_data_label [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 big_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lui a0,0x0 [ ]*[0-9a-f]+: R_MIPS_GOT_HI16 small_external_common [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> lw a0,0\(gp\) [ ]*[0-9a-f]+: R_MIPS_GOT16 .bss @@ -404,8 +396,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -413,8 +404,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -422,8 +412,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -431,8 +420,7 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,-32768 +[0-9a-f]+ <[^>]*> li at,0x8000 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -512,7 +500,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -521,7 +508,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -530,7 +516,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -539,7 +524,6 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common [0-9a-f]+ <[^>]*> lui at,0x1 -[0-9a-f]+ <[^>]*> addiu at,at,0 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) @@ -568,8 +552,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -577,8 +561,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_data_label -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -586,8 +570,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 big_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lui a0,0x0 @@ -595,8 +579,8 @@ Disassembly of section .text: [0-9a-f]+ <[^>]*> addu a0,a0,gp [0-9a-f]+ <[^>]*> lw a0,0\(a0\) [ ]*[0-9a-f]+: R_MIPS_GOT_LO16 small_external_common -[0-9a-f]+ <[^>]*> lui at,0x2 -[0-9a-f]+ <[^>]*> addiu at,at,-23131 +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 [0-9a-f]+ <[^>]*> addu a0,a0,at [0-9a-f]+ <[^>]*> addu a0,a0,a1 [0-9a-f]+ <[^>]*> lw a0,0\(gp\) diff --git a/gas/testsuite/gas/mips/macro-warn-1-n32.d b/gas/testsuite/gas/mips/macro-warn-1-n32.d new file mode 100644 index 0000000..08ea8d8 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-1-n32.d @@ -0,0 +1,5 @@ +#as: -n32 -KPIC +#source: macro-warn-1.s +#stderr: macro-warn-1-n32.l +#objdump: -p +#pass diff --git a/gas/testsuite/gas/mips/macro-warn-1-n32.l b/gas/testsuite/gas/mips/macro-warn-1-n32.l new file mode 100644 index 0000000..eaa35eb --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-1-n32.l @@ -0,0 +1,6 @@ +.*: Assembler messages: +.*:6: Warning: Macro instruction expanded into multiple instructions +.*:10: Warning: Macro instruction expanded into multiple instructions +.*:12: Warning: Macro instruction expanded into multiple instructions +.*:16: Warning: Macro instruction expanded into multiple instructions.*slot +.*:20: Warning: Macro instruction expanded into multiple instructions.*slot diff --git a/gas/testsuite/gas/mips/macro-warn-1.d b/gas/testsuite/gas/mips/macro-warn-1.d new file mode 100644 index 0000000..d4d709d --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-1.d @@ -0,0 +1,5 @@ +#as: -32 -KPIC +#source: macro-warn-1.s +#stderr: macro-warn-1.l +#objdump: -p +#pass diff --git a/gas/testsuite/gas/mips/macro-warn-1.l b/gas/testsuite/gas/mips/macro-warn-1.l new file mode 100644 index 0000000..3cf69a0 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-1.l @@ -0,0 +1,8 @@ +.*: Assembler messages: +.*:5: Warning: Macro instruction expanded into multiple instructions +.*:10: Warning: Macro instruction expanded into multiple instructions +.*:11: Warning: Macro instruction expanded into multiple instructions +.*:12: Warning: Macro instruction expanded into multiple instructions +.*:16: Warning: Macro instruction expanded into multiple instructions.*slot +.*:18: Warning: Macro instruction expanded into multiple instructions.*slot +.*:20: Warning: Macro instruction expanded into multiple instructions.*slot diff --git a/gas/testsuite/gas/mips/macro-warn-1.s b/gas/testsuite/gas/mips/macro-warn-1.s new file mode 100644 index 0000000..b07e5ba --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-1.s @@ -0,0 +1,21 @@ + .set noreorder + .set nomacro + .globl early_global +local: + .cpload $25 + .cpsetup $25,16,local + .cprestore 16 + .cpreturn + la $4,early_global + la $4,early_global+10 + la $4,local+10 + la $4,late_global+10 + jr $5 + la $4,early_global + jr $5 + la $4,early_global+10 + jr $5 + la $4,local+10 + jr $5 + la $4,late_global+10 + .globl late_global diff --git a/gas/testsuite/gas/mips/macro-warn-2-n32.d b/gas/testsuite/gas/mips/macro-warn-2-n32.d new file mode 100644 index 0000000..7a8c206 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-2-n32.d @@ -0,0 +1,4 @@ +#as: -n32 -KPIC +#source: macro-warn-2.s +#objdump: -p +#pass diff --git a/gas/testsuite/gas/mips/macro-warn-2.d b/gas/testsuite/gas/mips/macro-warn-2.d new file mode 100644 index 0000000..5f7a9e5 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-2.d @@ -0,0 +1,5 @@ +#as: -32 -KPIC +#source: macro-warn-2.s +#stderr: macro-warn-2.l +#objdump: -p +#pass diff --git a/gas/testsuite/gas/mips/macro-warn-2.l b/gas/testsuite/gas/mips/macro-warn-2.l new file mode 100644 index 0000000..906de22 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-2.l @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:5: Warning: Macro instruction expanded into multiple instructions +.*:9: Warning: Macro instruction expanded into multiple instructions.*slot diff --git a/gas/testsuite/gas/mips/macro-warn-2.s b/gas/testsuite/gas/mips/macro-warn-2.s new file mode 100644 index 0000000..00f51f3 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-2.s @@ -0,0 +1,10 @@ + .set noreorder + .set nomacro +local: + la $4,late_global + la $4,local + jr $5 + la $4,late_global + jr $5 + la $4,local + .globl local_global diff --git a/gas/testsuite/gas/mips/macro-warn-3.d b/gas/testsuite/gas/mips/macro-warn-3.d new file mode 100644 index 0000000..10935f9 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-3.d @@ -0,0 +1,5 @@ +#as: -32 +#source: macro-warn-3.s +#stderr: macro-warn-3.l +#objdump: -p +#pass diff --git a/gas/testsuite/gas/mips/macro-warn-3.l b/gas/testsuite/gas/mips/macro-warn-3.l new file mode 100644 index 0000000..33ecc74 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-3.l @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:4: Warning: Macro instruction expanded into multiple instructions +.*:7: Warning: Macro instruction expanded into multiple instructions.*slot diff --git a/gas/testsuite/gas/mips/macro-warn-3.s b/gas/testsuite/gas/mips/macro-warn-3.s new file mode 100644 index 0000000..0c6b2d7 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-3.s @@ -0,0 +1,10 @@ + .set noreorder + .set nomacro +early_big: + la $4,early_big + la $4,sdata + jr $5 + la $4,early_big + jr $5 + la $4,sdata + .comm sdata,4 diff --git a/gas/testsuite/gas/mips/macro-warn-4.d b/gas/testsuite/gas/mips/macro-warn-4.d new file mode 100644 index 0000000..a52e09c --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-4.d @@ -0,0 +1,5 @@ +#as: -32 +#source: macro-warn-4.s +#stderr: macro-warn-4.l +#objdump: -p +#pass diff --git a/gas/testsuite/gas/mips/macro-warn-4.l b/gas/testsuite/gas/mips/macro-warn-4.l new file mode 100644 index 0000000..abd23b0 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-4.l @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:3: Warning: Macro instruction expanded into multiple instructions +.*:5: Warning: Macro instruction expanded into multiple instructions.*slot diff --git a/gas/testsuite/gas/mips/macro-warn-4.s b/gas/testsuite/gas/mips/macro-warn-4.s new file mode 100644 index 0000000..d3be7f3 --- /dev/null +++ b/gas/testsuite/gas/mips/macro-warn-4.s @@ -0,0 +1,7 @@ + .set noreorder + .set nomacro + la $4,late_big + jr $5 + la $4,late_big + .comm sdata,4 +late_big: diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index af057e9..a641c9b 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -678,6 +678,7 @@ if { [istarget mips*-*-*] } then { if $has_newabi { run_dump_test "elf-rel18" } + run_dump_test "elf-rel19" run_dump_test "${tmips}${el}empic" run_dump_test "empic2" @@ -734,4 +735,13 @@ if { [istarget mips*-*-*] } then { run_dump_test "ldstla-n64" run_dump_test "ldstla-n64-shared" } + + run_dump_test "macro-warn-1" + run_dump_test "macro-warn-2" + run_dump_test "macro-warn-3" + run_dump_test "macro-warn-4" + if $has_newabi { + run_dump_test "macro-warn-1-n32" + run_dump_test "macro-warn-2-n32" + } } diff --git a/gas/testsuite/gas/mips/relax-swap1-mips2.d b/gas/testsuite/gas/mips/relax-swap1-mips2.d index 95badca..7297dd0 100644 --- a/gas/testsuite/gas/mips/relax-swap1-mips2.d +++ b/gas/testsuite/gas/mips/relax-swap1-mips2.d @@ -277,4 +277,4 @@ Disassembly of section \.text: 0+0364 <[^>]*> jalr v0,v1 0+0368 <[^>]*> nop \.\.\. -0+2036c <[^>]*> nop + \.\.\. diff --git a/gas/testsuite/gas/mips/relax-swap1.s b/gas/testsuite/gas/mips/relax-swap1.s index 05264c7..74c2a42 100644 --- a/gas/testsuite/gas/mips/relax-swap1.s +++ b/gas/testsuite/gas/mips/relax-swap1.s @@ -147,3 +147,5 @@ foo: .space 0x20000 # to make a 128kb loop body bar: +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8 diff --git a/gas/testsuite/gas/mips/relax-swap2.s b/gas/testsuite/gas/mips/relax-swap2.s index bae6d59..2e7ea2e 100644 --- a/gas/testsuite/gas/mips/relax-swap2.s +++ b/gas/testsuite/gas/mips/relax-swap2.s @@ -46,3 +46,5 @@ foo: .space 0x20000 # to make a 128kb loop body bar: +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8 diff --git a/gas/testsuite/gas/sh/basic.exp b/gas/testsuite/gas/sh/basic.exp index 1fab0cc..9d16e0e 100644 --- a/gas/testsuite/gas/sh/basic.exp +++ b/gas/testsuite/gas/sh/basic.exp @@ -1,4 +1,5 @@ -# Copyright (C) 1995, 1996, 1997, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1995, 1996, 1997, 2002, 2003, 2004 +# 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 @@ -140,11 +141,13 @@ if [istarget sh*-*-*] then { } if {[istarget sh*-*elf] || [istarget sh*-linux*]} then { - run_dump_test "sh4a" - run_dump_test "sh4a-fp" + if {![istarget "sh64*-*-*"] && ![istarget "sh5*-*-*"]} then { + run_dump_test "sh4a" + run_dump_test "sh4a-fp" - run_dump_test "sh4a-dsp" - run_dump_test "sh4al-dsp" + run_dump_test "sh4a-dsp" + run_dump_test "sh4al-dsp" + } run_dump_test "pic" diff --git a/gas/testsuite/gas/sh/err-sh4a-fp.s b/gas/testsuite/gas/sh/err-sh4a-fp.s index 252a61b..d15736c 100644 --- a/gas/testsuite/gas/sh/err-sh4a-fp.s +++ b/gas/testsuite/gas/sh/err-sh4a-fp.s @@ -5,10 +5,10 @@ fpchg fpul ! { dg-error "excess operands" } - fssra fr1, fr2 ! { dg-error "excess operands" } - fssra ! { dg-error "invalid operands|missing operand" } - fssra fpul ! { dg-error "invalid operands" } - fssra dr0, dr2 ! { dg-error "invalid operands" } + fsrra fr1, fr2 ! { dg-error "excess operands" } + fsrra ! { dg-error "invalid operands|missing operand" } + fsrra fpul ! { dg-error "invalid operands" } + fsrra dr0, dr2 ! { dg-error "invalid operands" } fsca dr0, fpul ! { dg-error "invalid operands" } fsca fpul, fr0 ! { dg-error "invalid operands" } diff --git a/gas/testsuite/gas/sh/sh4a-fp.d b/gas/testsuite/gas/sh/sh4a-fp.d index 386cb2e..0605553 100644 --- a/gas/testsuite/gas/sh/sh4a-fp.d +++ b/gas/testsuite/gas/sh/sh4a-fp.d @@ -8,8 +8,8 @@ start address 0x00000000 Disassembly of section \.text: 0x00000000 f7 fd fpchg -0x00000002 f1 7d fssra fr1 -0x00000004 f9 7d fssra fr9 -0x00000006 f6 7d fssra fr6 +0x00000002 f1 7d fsrra fr1 +0x00000004 f9 7d fsrra fr9 +0x00000006 f6 7d fsrra fr6 0x00000008 f2 fd fsca fpul,dr2 0x0000000a fc fd fsca fpul,dr12 diff --git a/gas/testsuite/gas/sh/sh4a-fp.s b/gas/testsuite/gas/sh/sh4a-fp.s index d101c62..f2c9682 100644 --- a/gas/testsuite/gas/sh/sh4a-fp.s +++ b/gas/testsuite/gas/sh/sh4a-fp.s @@ -3,9 +3,9 @@ fpchg - fssra fr1 - fssra fr9 - fssra fr6 + fsrra fr1 + fsrra fr9 + fsrra fr6 fsca fpul, dr2 fsca fpul, dr12 diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 03cb1b0..8a49238 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,1281 @@ +2004-02-12 Fred Fish <fnf@redhat.com> + + * m68hc11-tdep.c (m68hc11_gdbarch_init): Remove duplicate call to + set_gdbarch_store_return_value. + +2004-02-12 Andrew Cagney <cagney@redhat.com> + + * remote-rdi.c (arm_rdi_start_remote): Delete unused function. + (arm_rdi_interrupt, arm_rdi_interrupt_twice): Ditto. + (interrupt_query): Ditto. + (ofunc): Delete unused variable. + * cris-tdep.c (cris_abi): Delete unused function. + (reg_pop_op, move_reg_to_mem_index_inc_op): Ditto. + (cris_get_wide_opcode, cris_get_short_size): Ditto. + (cris_get_asr_quick_shift_steps): Ditto. + (cris_skip_prologue_frameless_p): Ditto. + * arm-tdep.c (arm_push_return_address): Delete unused function. + (arm_push_dummy_frame, arm_fix_call_dummy): Ditto. + * rs6000-tdep.c (rs6000_pc_in_call_dummy): Delete unused function. + * s390-tdep.c (s390_function_start): Delete unused function. + +2004-02-12 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (PROLOGUE_FRAMELESS_P): Delete. + gdbarch.h, gdbarch.c: Re-generate. + * cris-tdep.c (cris_gdbarch_init): Do not set prologue_frameless_p + to generic_prologue_frameless_p. + * arch-utils.h (generic_prologue_frameless_p): Delete declaration. + * arch-utils.c (generic_prologue_frameless_p): Delete function. + +2004-02-11 Daniel Jacobowitz <drow@mvista.com> + + * mips-linux-tdep.c: Include "frame.h". + (mips_linux_in_dynsym_stub, mips_linux_in_dynsym_resolve_code) + (mips_linux_skip_resolver): New functions. + (mips_linux_init_abi): Call set_gdbarch_skip_solib_resolver + and set_gdbarch_in_solib_call_trampoline. + * mips-tdep.c (mips_gdbarch_init): Move gdbarch_init_osabi call + to after set_gdbarch_in_solib_return_trampoline. Only set the + solib hooks to mips16 functions if the OS ABI is unknown. + * config/mips/tm-linux.h (IN_SOLIB_CALL_TRAMPOLINE): Undefine after + including "config/tm-linux.h". + (IN_SOLIB_DYNSYM_RESOLVE_CODE): Define. + * Makefile.in (mips-linux-tdep.o): Update. + +2004-02-11 David Carlton <carlton@kealia.com> + + * linespec.c (decode_compound): Only look for a class symbol when + considering all but the rightmost component. + +2004-02-11 Andrew Cagney <cagney@redhat.com> + + * hppa-tdep.c (hppa_gdbarch_init): Re-order so that the frame and + abi code are are separatly grouped. + +2004-02-11 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (FRAME_ARGS_SKIP): Default to 0. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sh64-tdep.c (sh64_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * m32r-tdep.c (m32r_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. + * d10v-tdep.c (d10v_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2004-02-11 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_sh3_dsp_register_name): Fix formatting. Add missing + comma. + (sh_sh4al_dsp_register_name): Ditto. + +2004-02-10 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_gdbarch_init): Delete deprecated frame code. + (mips_init_frame_pc_first): Delete function. + (mips_frame_saved_pc): Delete function. + (mips_frame_chain): Delete function. + (mips_init_extra_frame_info): Delete function. + (mips_xfer_register): Delete unused variable "reg". + (mips_n32n64_push_dummy_call): Delete unused variable "valbuf". + (mips_n32n64_return_value): Delete unused variable "reg". + (mips_n32n64_return_value): Delete unused variable "pos". + (mips_o32_push_dummy_call): Delete unused variable "valbuf". + (mips_o32_return_value): Delete unused variable "pos". + (mips_o64_push_dummy_call): Delete unused variable "valbuf". + (mips_print_fp_register): Delete unused variable "namelen" + (mips_print_fp_register): Delete unused variable "flt2" + (get_frame_pointer): Delete function. + (cached_proc_desc): Delete static variable. + (mips_pop_frame): Delete function. + (mips_find_saved_regs): Delete function. + (mips_get_saved_register): Delete function. + (mips_saved_pc_after_call): Delete function. + (SIGFRAME_BASE): Delete macro. + (SIGFRAME_FPREGSAVE_OFF): Delete macro. + (SIGFRAME_PC_OFF): Delete macro. + (SIGFRAME_REGSAVE_OFF): Delete macro. + (mips_dump_tdep): Do not print deleted macro definitions. + +2004-02-10 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (SFILES): Remove explictly listed tui files. + (SUBDIR_GDBTK_SRCS): Fix path to gdbtk-interp.c. + +2004-02-10 Jeff Johnston <jjohnstn@redhat.com> + + * ia64-tdep.c (ia64_frame_this_id): Fix tracing print statement + to use paddr functions to format ia64 addresses and long values. + (ia64_frame_prev_register, ia64_sigtramp_frame_this_id): Ditto. + (ia64_sigtramp_frame_prev_register, ia64_access_reg): Ditto. + (get_kernel_table, ia64_find_proc_info_x): Ditto. + (ia64_get_dyn_info_list, ia64_libunwind_this_frame_id): Ditto. + (ia64_libunwind_frame_prev_register, ia64_unwind_dummy_id): Ditto. + +2004-02-10 Andrew Cagney <cagney@redhat.com> + + * defs.h: Do not include "tui.h". + * gdb_curses.h: New file. + * tui/tui-hooks.h: New file. + * tui/tui.h (tui_update_all_exec_infos): Delete declaration. + (tui_install_hooks, tui_remove_hooks): Delete declarations. + (tui_initialize_io): Delete declaration. + (tui_initialize_readline: Delete redundant declaration. + (struct tui_point): Delete definition. + * tui/tui-data.h (struct tui_point): Define. + * cli/cli-decode.c [TUI]: Include "tui/tui.h". + * utils.c: Include "tui/tui.h". + * tui/tui-data.h: Include "tui/tui.h" and "gdb_curses.h". + * printcmd.c [TUI]: Include "tui/tui.h". + * cli/cli-cmds.c [TUI]: Include "tui/tui.h". + * tui/tui-command.c: Include "gdb_curses.h". + * tui/tui.c, tui/tui-winsource.c, tui/tui-wingeneral.c: Ditto. + * tui/tui-windata.c, tui/tui-win.c, tui/tui-stack.c: Ditto. + * tui/tui-source.c, tui/tui-regs.c, tui/tui-layout.c: Ditto. + * tui/tui-io.c, tui/tui-disasm.c, tui/tui-data.c: : Ditto. + * tui/tui-hooks.c: Include "tui-hooks.h" and "gdb_curses.h". + * Makefile.in: Update all dependencies. + (tui_hooks_h, gdb_curses_h): Define. + (SUBDIR_TUI_CFLAGS): Remove -I${srcdir}/tui. + +2004-02-10 Elena Zannoni <ezannoni@redhat.com> + + * objfiles.h (struct objfile): Remove unused fields auxf1 and + auxf2. Add comments about some other rarely used fields. + +2004-02-10 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (init.c): Fix script removing duplicates. Problem + reported by Peter Schauer. + +2004-02-09 Elena Zannoni <ezannoni@redhat.com> + + * bcache.c (bcache_xmalloc): Use obstack_init instead of + obstack_specify_allocation. + * objfiles.c (allocate_objfile): Ditto. + * solib-sunos.c (solib_add_common_symbols) + (allocate_rt_common_objfile): Ditto. + * symfile.c (reread_symbols): Ditto. + * gdb_obstack.h: Add comment. + +2004-02-09 Elena Zannoni <ezannoni@redhat.com> + + * linespec.c (decode_line_1, locate_first_half) + (decode_compound, lookup_prefix_sym): Update comments. Delete old + commented out code. + +2004-02-09 Daniel Jacobowitz <drow@mvista.com> + + * cp-namespace.c (check_one_possible_namespace_symbol): Don't use + obstack_free. + +2004-02-09 Andrew Cagney <cagney@redhat.com> + + * blockframe.c (find_pc_partial_function): If find_pc_overlay + fails, try find_pc_section. Fix PR c++/1267. + * minsyms.c (lookup_minimal_symbol_by_pc): Use find_pc_section + instead of find_pc_mapped_section. + (lookup_minimal_symbol_by_pc_section): If the SECTION is NULL, do + not default to the section containing PC. Fix PR symtab/1519. + +2004-02-09 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (mips-tdep.o): Update dependencies. + * mips-tdep.c: Include "frame-unwind.h", "frame-base.h" and + "trad-frame.h". + (mips_unwind_pc): Return the pseudo PC register. + (mips_unwind_dummy_id): New function. + (mips16_fetch_instruction): New function. + (mips32_fetch_instruction): New function. + (struct mips_frame_cache): Define. + (mips_mdebug_frame_cache): New function. + (mips_mdebug_frame_this_id): New function. + (mips_mdebug_frame_prev_register): New function. + (mips_mdebug_frame_unwind): Define. + (mips_mdebug_frame_sniffer): New function. + (mips_mdebug_frame_base_address): New function. + (mips_mdebug_frame_base): Define. + (mips_mdebug_frame_base_sniffer): New function. + (mips_gdbarch_init): Append unwind and base sniffers. Set + unwind_dummy_id. + +2004-02-08 Andrew Cagney <cagney@redhat.com> + + * frame.c: Print both the register number and name. + + * Makefile.in (init.c): Eliminate duplicates. Combine two greps + and a sed into a single sed. Make .c and .o patterns more robust. + (OBS): Delete. + (INIT_FILES): Replace OBS with COMMON_OBS. + (COMMON_OBS): Move DEPFILES and YYOBJ to start of definition. + +2004-02-08 Mark Kettenis <kettenis@gnu.org> + + * sparc-nat.c (sparc_xfer_wcookie): Try to fetch the cookie using + the PT_WCOOKIE request. + +2004-02-08 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_unwind_pc): New function. + (mips_gdbarch_init): Set mips_unwind_pc. + + * frame.c (legacy_saved_regs_this_id): Return a null frame ID. + (get_frame_id): Allow the UNKNOWN_FRAME. + (frame_register_unwind, get_frame_type): Ditto. + + * frame.c (legacy_frame_p): Check for DEPRECATED_TARGET_READ_FP_P + and DEPRECATED_FP_REGNUM. Don't assume that the lack of + unwind_dummy_id indicates a legacy frame. + + * configure.in (CONFIG_LIB_OBS): Replace with CONFIG_OBS. + * configure: Re-generate. + + * mips-tdep.c (mips_gdbarch_init): Group deprecated frame unwind + methods. + +2004-02-08 Andrew Cagney <cagney@redhat.com> + + * configure.in (CONFIG_ALL): Set to Makefile target, and not + makefile macro. + * configure: Re-generate. + (CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Ditto. + * Makefile.in (SUBDIR_CLI_CLEAN): Delete. + (SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): Delete. + (SUBDIR_CLI_ALL, SUBDIR_GDBTK_ALL): Delete. + (SUBDIR_GDBTK_CLEAN, SUBDIR_GDBTK_INSTALL): Delete. + (SUBDIR_GDBTK_UNINSTALL, SUBDIR_MI_ALL): Delete. + (SUBDIR_MI_CLEAN, SUBDIR_MI_INSTALL): Delete. + (SUBDIR_MI_UNINSTALL, SUBDIR_TUI_ALL): Delete. + (SUBDIR_TUI_CLEAN, SUBDIR_TUI_INSTALL): Delete. + (SUBDIR_TUI_UNINSTALL, SUBDIR_CLI_CLEAN): Delete. + +2004-02-07 Andrew Cagney <cagney@redhat.com> + + * Makefile.in: Update all dependencies. + + * configure.in (CONFIG_INITS, CONFIG_LIB_OBS): Delete. + * configure: Re-generate. + * Makefile.in (INIT_FILES): Replace CONFIG_INITS with CONFIG_SRCS. + (CONFIG_LIB_OBS, CONFIG_INITS): Delete. + (COMMON_OBS): Add "main.o" and "annotate.o". + (ANNOTATE_OBS): Delete. + (OBS): Remove ANNOTATE_OBS. + (DEPFILES): Replace CONFIG_LIB_OBS with CONFIG_LIB_OBS, remove + CONFIG_INITS. + (gdb$(EXEEXT), insight$(EXEEXT)): Do not depend on, or link + against CONFIG_OBS and "main.o". + (SUBDIR_CLI_INITS, SUBDIR_MI_INITS): Delete. + (SUBDIR_TUI_INITS, SUBDIR_GDBTK_INITS): Delete. + + * tui/tui-command.c: Include "gdb_string.h", delete register + attribute, use ISO-C function signatures. + * tui/tui-disasm.c, tui/tui-file.c, tui/tui-io.c: Ditto. + * tui/tui-layout.c, tui/tui-regs.c, tui/tui-source.c: Ditto. + * tui/tui-stack.c, tui/tui-win.c, tui/tui-winsource.c: Ditto. + * tui/tui.c: Ditto. + + * tui/tui-command.c: Change variable and function names to lower + case. + * tui/tui-data.c, tui/tui-disasm.c: Ditto. + * tui/tui-hooks.c, tui/tui-io.c, tui/tui-layout.c: Ditto. + * tui/tui-regs.c, tui/tui-source.c, tui/tui-stack.c: Ditto. + * tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto. + * tui/tui-winsource.c, tui/tui.c: Ditto. + +2004-02-07 Elena Zannoni <ezannoni@redhat.com> + + * buildsym.c (free_pending_blocks, finish_block) + (record_pending_block, make_blockvector, end_symtab): Replace + symbol_obstack with objfile_obstack. + * coffread.c (process_coff_symbol, coff_read_struct_type) + (coff_read_enum_type): Ditto. + * cp-namespace.c (initialize_namespace_symtab) + (check_one_possible_namespace_symbol): Ditto. + * dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file) + (dwarf2_symbol_mark_computed): Ditto. + * dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto. + * elfread.c (elf_symtab_read): Ditto. + * hpread.c (hpread_symfile_init, hpread_symfile_init) + (hpread_read_enum_type, hpread_read_function_type) + (hpread_read_doc_function_type, hpread_process_one_debug_symbol): + Ditto. + * jv-lang.c (get_java_class_symtab, add_class_symbol) + (java_link_class_type): Ditto. + * mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab) + (new_symbol): Ditto. + * minsyms.c (install_minimal_symbols): Ditto. + * objfiles.c (allocate_objfile): Remove init of symbol_obstack. + (terminate_minimal_symbol_table): Replace symbol_obstack with + objfile_obstack. + (free_objfile): Remove freeing of symbol_obstack. + * objfiles.h: Remove symbol_obstack field. + * pa64solib.c (add_to_solist): Replace symbol_obstack with + objfile_obstack. + * solib-sunos.c (allocate_rt_common_objfile): Remove init of + symbol_obstack. + (solib_add_common_symbols): Replace symbol_obstack with + objfile_obstack. + * somsolib.c (som_solib_add): Ditto. + * stabsread.c (patch_block_stabs, define_symbol, read_enum_type) + (common_block_start, common_block_end): Ditto. + * symfile.c (reread_symbols): Remove freeing and init of + symbol_obstack. + (allocate_symtab): Rename symbol_obstack to objfile_obstack. + * symfile.h: Update comment. + * symmisc.c (print_objfile_statistics): Remove symbol_obstack + stats printing. + * symtab.c (symbol_set_names): Replace symbol_obstack with + objfile_obstack. + * symtab.h (struct general_symbol_info, struct minimal_symbol): + Update comments. + * xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC) + (init_stringtab, xcoff_initial_scan): Replace symbol_obstack with + objfile_obstack. + +2004-02-07 Andrew Cagney <cagney@redhat.com> + + * tui/tui.h: Do not include <stdarg.h>, <string.h>, and + "ansidecl.h". Do not undef "reg" and "chtype". Fix case of + fields and variables. + * tui/tui-wingeneral.h (m_beVisible): Delete macro. + (m_beInvisible): Delete macro. + * tui/tui-data.h: Fix case case fields and variables. + (m_genWinPtrIsNull): Delete macro. + (tui_win_list): Rename winList. + (TUI_SRC_WIN): Rename srcWin. + (TUI_DISASM_WIN): Rename disassemWin. + (TUI_DATA_WIN): Rename dataWin. + (TUI_CMD_WIN): Rename cmdWin. + (m_genWinPtrNotNull): Delete macro. + (m_winPtrIsNull): Delete macro. + (m_winPtrNotNull): Delete macro. + (tui_win_is_source_type): Replace m_winIsSourceType + (tui_win_is_auxillary): Replace m_winIsAuzillary. + (tui_win_has_locator): Replace m_hasLocator. + (tui_set_win_highlight): Replace m_setWinHighlightOn and + m_setWinHighlightOff. + * tui/tui-data.c: Update references. + (tui_win_is_source_type, tui_set_win_highlight): New functions. + (tui_win_has_locator, tui_win_is_auxillary): New functions. + * tui/tui-command.c, tui/tui-disasm.c: Update references. + * tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto. + * tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto. + * tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto. + * tui/tui-winsource.c, tui/tui.c: Ditto. + +2004-02-07 Mark Kettenis <kettenis@gnu.org> + + * sparc-tdep.h (sparc_fetch_wcookie): New prototype. + * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Handle + StackGhost. + + * sparc-tdep.c (sparc32_frame_prev_register): Rename local + variable `i6' to `i7'. + (sparc_supply_rwindow, sparc_collect_rwindow): Likewise. + +2004-02-07 Andrew Cagney <cagney@redhat.com> + + * tui/tui.h (Opaque, OpaquePtr OpaqueList): Delete definition. + (TuiPoint, TuiPointPtr): Ditto. + (TuiStatus, TuiStatusPtr): Ditto. + (TuiWinType, TuiWinTypePtr): Ditto. + (struct tui_point): Rename _TuiPoint. + (tui_get_low_disassembly_address): Rename + tuiGetLowDisassemblyAddress. + (tui_update_all_exec_infos): Rename tuiUpdateAllExecInfos. + (tuiFree): Delete declaration. + (OpaqueFuncPtr, TuiOpaqueFuncPtr): Delete definitions. + (TuiVoidFuncPtr, TuiIntFuncPtr): Delete definitions. + * tui/tui.c (tuiFree): Delete function. + * cli/cli-cmds.c (disassemble_command): Update references. + * tui/tui-data.c, tui/tui-data.h, tui/tui-disasm.c: Ditto. + * tui/tui-layout.c, tui/tui-regs.c, tui/tui-source.c: Ditto. + * tui/tui-stack.c, tui/tui-win.c, tui/tui-wingeneral.c: Ditto. + * tui/tui-winsource.c: Ditto. + +2004-02-07 Elena Zannoni <ezannoni@redhat.com> + + * dbxread.c (dbx_symfile_init, start_psymtab, end_psymtab, + coffstab_build_psymtabs, elfstab_build_psymtabs) + (stabsect_build_psymtabs): Replace psymbol_obstack with + objfile_obstack. + * dwarf2-frame.c (decode_frame_entry_1): Ditto. + * dwarf2read.c (dwarf2_build_psymtabs_hard, dwarf2_read_section): + Ditto. + * dwarfread.c (scan_compilation_units): Ditto. + * elfread.c (elfstab_offset_sections): Ditto. + * hppa-tdep.c (read_unwind_info): Ditto. + * hpread.c (hpread_build_psymtabs, hpread_start_psymtab) + (hpread_end_psymtab): Ditto. + * mdebugread.c (mdebug_build_psymtabs, add_pending) + (parse_partial_symbols, new_psymtab, elfmdebug_build_psymtabs): + Ditto. + * mips-tdep.c (non_heuristic_proc_desc): Ditto. + * objfiles.c (add_to_objfile_sections) + (build_objfile_section_table): Ditto. + (allocate_objfile): Remove init of psymbol_obstack. + (free_objfile): Remove freeing of psymbol_obstack. + * objfiles.h (struct objfile): Remove field + psymbol_obstack. Update comments. + * pa64solib.c (pa64_solib_add_solib_objfile): Replace + psymbol_obstack with objfile_obstack. + * solib-sunos.c (allocate_rt_common_objfile): Remove init of + psymbol_obstack. + * somread.c (som_symfile_offsets, init_import_symbols) + (init_export_symbols): Replace psymbol_obstack with + objfile_obstack. + * somsolib.c (som_solib_add_solib_objfile): Ditto. + * symfile.c (default_symfile_offsets, syms_from_objfile) + (reread_symbols): Remove freeing and init of psymbol_obstack. + (cashier_psymtab): Update comment. + * symmisc.c (print_objfile_statistics): Don't report stats for + psymbol obstack. + * symtab.h (struct general_symbol_info, struct partial_symtab): + Update comments. + * xcoffread.c (xcoff_start_psymtab, xcoff_end_psymtab, swap_sym) + (xcoff_symfile_offsets): Replace psymbol_obstack with + objfile_obstack. + +2004-02-07 Elena Zannoni <ezannoni@redhat.com> + + * objfiles.h (struct objfile): Add objfile_obstack field. + Remove type_obstack field. + + * dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn, + read_structure_scope read_enumeration, new_symbol): Replace + type_obstack with objfile_obstack. + * dwarfread.c (struct_type, enum_type): Ditto. + * gdbtypes.c (alloc_type, alloc_type_instance, init_type) + (lookup_fundamental_type): Ditto. + * gdbtypes.h (TYPE_ALLOC): Ditto. + * hpread.c (hpread_read_enum_type, hpread_read_function_type) + (hpread_read_doc_function_type, hpread_read_struct_type) + (fix_static_member_physnames, hpread_read_array_type) + (hpread_read_subrange_type, hpread_type_lookup): Ditto. + * jv-lang.c (java_lookup_class, type_from_class, type_from_class) + (java_link_class_type): Ditto. + * mdebugread.c (parse_type): Ditto. + * objfiles.c (allocate_objfile, free_objfile): Ditto. + * solib-sunos.c (solib_add_common_symbols): Ditto. + * stabsread.c (define_symbol, read_type, read_member_functions, + read_cpp_abbrev, read_one_struct_field): Ditto. + * symfile.c (reread_symbols): Ditto. + * symmisc.c (print_objfile_statistics): Ditto. + +2004-02-07 Andrew Cagney <cagney@redhat.com> + + * tui/tui-data.h (tui_win_element): Rename TuiWinElement. + (tui_exec_info_content): Rename TuiExecInfoContent. + (TuiGenWinInfo, TuiGenWinInfoPtr): Delete definitions. + (TuiWinInfo, TuiWinInfoPtr): Ditto. + (TuiScrollDirection, TuiScrollDirectionPtr): Ditto. + (TuiList, TuiListPtr): Ditto. + (TuiLayoutType, TuiLayoutTypePtr): Ditto. + (TuiDataType, TuiDataTypePtr): Ditto. + (TuiRegisterDisplayType, TuiRegisterDisplayTypePtr): Ditto. + (TuiLineOrAddress, TuiLineOrAddressPtr): Ditto. + (TuiLayoutDef, TuiLayoutDefPtr): Ditto. + (TuiSourceElement, TuiSourceElementPtr): Ditto. + (TuiDataElement, TuiDataElementPtr): Ditto. + (TuiWinElement, TuiWinElementPtr): Ditto. + (TuiDataInfo, TuiDataInfoPtr): Ditto. + (TuiCommandElement, TuiCommandElementPtr): Ditto. + (TuiLocatorElement, TuiLocatorElementPtr): Ditto. + (TuiWhichElement, TuiWhichElementPtr): Ditto. + (TuiSourceInfo, TuiSourceInfoPtr): Ditto. + (TuiCommandInfo, TuiCommandInfoPtr): Ditto. + * tui/tui-command.c, tui/tui-data.c: Update references. + * tui/tui-data.h, tui/tui-disasm.c, tui/tui-layout.c: Ditto. + * tui/tui-regs.c, tui/tui-source.c, tui/tui-stack.c: Ditto. + * tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto. + * tui/tui-winsource.c, tui/tui.c: Ditto. + +2004-02-07 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.h: Update copyright. + (enum dwarf2_frame_reg_rule): New. + (struct dwarf2_frame_state_reg): New. + (dwarf2_frame_sniffer, dwarf2_frame_base_sniffer): Make extern. + * dwarf2-frame.c: Update copyright. + (enum dwarf2_reg_rule): Remove. + (struct dwarf2_frame_state): Remove defenition of `struct + dwarf2_frame_state_reg'. + (read_reg): Call get_frame_arch to get the architecture instead of + using CURRENT_GDBARCH. + (execute_cfa_program): Prefix old `enum dwarf2_reg_rule' tags with + DWARF2_FRAME_. + (dwarf2_frame_init_reg): New function. + (dwarf2_frame_cache): Call get_frame_arch to get the architecture + instead of using CURRENT_GDBARCH. Call dwarf2_frame_init_reg to + initialize the register state. Prefix old `enum dwarf2_reg_rule' + tags with DWARF2_FRAME_. + (dwarf2_frame_prev_register): Call get_frame_arch to get the + architecture instead of using CURRENT_GDBARCH. Prefix old `enum + dwarf2_reg_rule' tags with DWARF2_FRAME_. + +2004-02-06 Andrew Cagney <cagney@redhat.com> + + * tui/tui-data.h (struct tui_list): Rename _TuiList. + (enum tui_data_type): Rename _TuiDataType. + (struct tui_layout_def): Rename _TuiLayoutDef. + (struct tui_source_element): Rename _TuiSourceElement. + (struct tui_data_element): Rename _TuiDataElement. + (struct tui_command_element): Rename _TuiCommandElement. + (struct tui_locator_element): Rename _TuiLocatorElement. + (union tui_which_element): Define. + (struct tui_win_element): Rename _TuiWinElement. + (struct tui_data_info): Rename _TuiDataInfo. + (struct tui_source_info): Rename _TuiSourceInfo. + (struct tui_command_info): Rename _TuiCommandInfo. + (tui_initialize_static_data): Rename initializeStaticData. + (tui_alloc_generic_win_info): Rename allocGenericWinInfo. + (tui_alloc_win_info): Rename allocWinInfo. + (tui_init_generic_part): Rename initGenericPart. + (tui_init_win_info): Rename initWinInfo. + (tui_alloc_content): Rename allocContent. + (tui_add_content_elements): Rename addContentElements. + (tui_init_content_element): Rename initContentElement. + (tui_free_window): Rename freeWindow. + (tui_free_win_content): Rename freeWinContent. + (tui_free_data_content): Rename freeDataContent. + (tui_free_all_source_wins_content): Rename + freeAllSourceWinsContent. + (tui_del_window): Rename tuiDelWindow. + (tui_del_data_windows): Rename tuiDelDataWindows. + (tui_partial_win_by_name): Rename partialWinByName. + (tui_win_name): Rename winName. + (tui_current_layout): Rename currentLayout. + (tui_set_current_layout_to): Rename setCurrentLayoutTo. + (tui_term_height): Rename termHeight. + (tui_set_term_height_to): Rename setTermHeightTo. + (tui_term_width): Rename termWidth. + (tui_set_term_width_to): Rename setTermWidthTo. + (tui_set_gen_win_origin): Rename setGenWinOrigin. + (tui_locator_win_info_ptr): Rename locatorWinInfoPtr. + (tui_source_exec_info_win_ptr): Rename tui_gen_win_info. + (tui_disassem_exec_info_win_ptr): Rename disassemExecInfoWinPtr. + (tui_source_windows): Rename sourceWindows. + (tui_clear_source_windows): Rename clearSourceWindows. + (tui_clear_source_windows_detail): Rename + clearSourceWindowsDetail. + (tui_clear_win_detail): Rename clearWinDetail. + (tui_add_to_source_windows): Rename tuiAddToSourceWindows. + (tui_default_tab_len): Rename tuiDefaultTabLen. + (tui_set_default_tab_len): Rename tuiSetDefaultTabLen. + (tui_win_with_focus): Rename tuiWinWithFocus. + (tui_set_win_with_focus): Rename tuiSetWinWithFocus. + (tui_layout_def): Rename tuiLayoutDef. + (tui_win_resized): Rename tuiWinResized. + (tui_set_win_resized_to): Rename tuiSetWinResizedTo. + (tui_next_win): Rename tuiNextWin. + (tui_prev_win): Rename tuiPrevWin. + (tui_add_to_source_windows): Rename addToSourceWindows. + * tui/tui-winsource.c, tui/tui-win.c: Update references. + * tui/tui-layout.c, tui/tui-source.c: Ditto. + * tui/tui-stack.c, tui/tui-io.c: Ditto. + * tui/tui.c, tui/tui-data.c: Ditto. + * tui/tui-interp.c, tui/tui-data.c: Ditto. + * tui/tui-disasm.c, tui/tui-command.c: Ditto. + + * tui/tui-source.h: Update copyright. Include "tui-data.h". + (struct symtab): Declare. + (tui_set_source_content): Rename tuiSetSourceContent. + (tui_show_symtab_source): Rename tuiShowSource. + (tui_source_is_displayed): Rename tuiSourceIsDisplayed. + (tui_vertical_source_scroll): Rename tuiVerticalSourceScroll. + * tui/tui-source.c: Update copyright. Update references. + * tui/tui-win.c, tui/tui-winsource.c: Update references. + * tui/tui-stack.c: Update references. + + * tui/tui-win.h: Update copyright. Include "tui-data.h". + (struct tui_win_info): Declare. + (tui_scroll_forward): Rename tuiScrollForward. + (tui_scroll_backward): Rename tuiScrollBackward. + (tui_scroll_left): Rename tuiScrollLeft. + (tui_scroll_right): Rename tuiScrollRight. + (tui_set_win_focus_to): Rename tuiSetWinFocusTo. + (tui_resize_all): Rename tuiResizeAll. + (tui_refresh_all_win): Rename tuiRefreshAll. + (tui_sigwinch_handler): Rename tuiSigwinchHandler. + * tui/tui-layout.c, * tui/tui-io.c: Update references. + * tui/tui-wingeneral.h, * tui/tui.c: Update references. + * tui/tui-disasm.c, * tui/tui-command.c: Update references. + + * tui/tui-windata.h: Update copyright. Include "tui-data.h". + (tui_erase_data_content): Rename tuiEraseDataContent. + (tui_display_all_data): Rename tuiDisplayAllData. + (tui_check_data_values): Rename tuiCheckDataValues. + (tui_display_data_from_line): Rename tuiDisplayDataFromLine. + (tui_first_data_item_displayed): Rename tuiFirstDataItemDisplayed. + (tui_first_data_element_no_in_line): Rename + tuiFirstDataElementNoInLine. + (tui_delete_data_content_windows): Rename + tuiDeleteDataContentWindows. + (tui_refresh_data_win): Rename tuiRefreshDataWin. + (tui_display_data_from): Rename tuiDisplayDataFrom. + (tui_vertical_data_scroll): Rename tuiVerticalDataScroll. + * tui/tui-windata.c, tui/tui-hooks.c: Update references. + * tui/tui-win.c, tui/tui-regs.c: Update references. + * tui/tui-layout.c, tui/tui.c: Update references. + + * tui/tui-wingeneral.h: Update copyright. + (m_allBeVisible): Delete macro. + (m_allBeInvisible): Delete macro. + (struct tui_gen_win_info): Declare. + (struct tui_win_info): Declare. + (tui_unhighlight_win): Rename unhighlightWin. + (tui_make_visible, tui_make_invisible): Replace makeVisible. + (tui_make_all_visible, tui_make_all_invisible): Replace makeAllVisible. + (tui_make_window): Rename makeWindow. + (tui_copy_win): Rename copyWin. + (tui_box_win): Rename boxWin. + (tui_highlight_win): Rename highlightWin. + (tui_check_and_display_highlight_if_needed): Rename + checkAndDisplayHighlightIfNeeded. + (tui_refresh_all): Rename refreshAll. + (tui_delete_win): Rename tuiDelwin. + (tui_refresh_win): Rename tuiRefreshWin. + * tui/tui-wingeneral.c (make_visible): Rename makeVisible. + (tui_make_visible, tui_make_invisible): New functions. + (tui_make_all_visible, tui_make_all_invisible): New functions. + (make_all_visible): Rename makeAllVisible. + * tui/tui-winsource.c, tui/tui-windata.c: Update references. + * tui/tui-data.c, tui/tui-winsource.c: Update references. + * tui/tui-windata.c, tui/tui-win.c: Update references. + * tui/tui-regs.c, tui/tui-layout.c: Update references. + * tui/tui-data.h (struct tui_gen_win_info): Rename _TuiGenWinInfo. + +2004-02-06 Mark Kettenis <kettenis@gnu.org> + + * proc-api.c (write_with_trace): Initialize local variable to + silence compiler warning. + +2004-02-06 Andrew Cagney <cagney@redhat.com> + + * tui/tui-source.h: Do not include "defs.h". + (struct tui_win_info): Declare. + (tui_set_source_content_nil): Declare. + * tui/tui-data.h (struct tui_win_info): Rename _TuiWinInfo. + (union tui_line_or_address): Rename _TuiLineOrAddress. + * tui/tui-winsource.h: Update copyright. Include "tui-data.h". + (tui_update_source_window): Rename tuiUpdateSourceWindow. + (tui_update_source_window_as_is): Rename + tuiUpdateSourceWindowAsIs. + (tui_update_source_windows_with_addr): Rename + tuiUpdateSourceWindowsWithAddr. + (tui_update_source_windows_with_line): Rename + tuiUpdateSourceWindowsWithLine. + (tui_clear_source_content): Rename tuiClearSourceContent. + (tui_erase_source_content): Rename tuiEraseSourceContent. + (tui_set_source_content_nil): Rename tuiSetSourceContentNil. + (tui_show_source_content): Rename tuiShowSourceContent. + (tui_horizontal_source_scroll): Rename tuiHorizontalSourceScroll. + (tui_set_exec_info_content): Rename tuiSetExecInfoContent. + (tui_show_exec_info_content): Rename tuiShowExecInfoContent. + (tui_erase_exec_info_content): Rename tuiEraseExecInfoContent. + (tui_clear_exec_info_content): Rename tuiClearExecInfoContent. + (tui_update_exec_info): Rename tuiUpdateExecInfo. + (tui_set_is_exec_point_at): Rename tuiSetIsExecPointAt. + (tui_alloc_source_buffer): Rename tuiAllocSourceBuffer. + (tui_line_is_displayed): Rename tuiLineIsDisplayed. + (tui_addr_is_displayed): Rename tuiAddrIsDisplayed. + (struct tui_win_info): Declare. + * tui/tui-stack.c: Update references. + * tui/tui-layout.c, tui/tui-winsource.c: Ditto. + * tui/tui-win.c, tui/tui-source.c: Ditto. + * tui/tui.c, tui/tui-disasm.c: Ditto. + +2004-02-06 Mark Kettenis <kettenis@gnu.org> + + * i386-linux-tdep.c (i386_linux_sigcontext_addr): Fix calculation + of UCONTEXT_ADDR. Fixes PR backtrace/1545. + +2004-02-05 Mark Kettenis <kettenis@gnu.org> + + * infrun.c (handle_inferior_event): Allow for breakpoint + instructions to generate a SIGSEGV in addition to SIGTRAP, SIGILL + and SIGEMT. Update comments. + * NEWS (Revised SPARC target): Mention support for non-executable + stack. + +2004-02-04 Mark Kettenis <kettenis@gnu.org> + + * target.h (target_object): Add TARGET_OBJECT_WCOOKIE. + * inftarg.c: Update copyright year. + (child_xfer_partial): Add support for TARGET_OBJECT_WCOOKIE. + * sparc-nat.c: Include "target.h" and "gdb_assert.h". + (sparc_xfer_wcookie): New function. + * sparc-tdep.c (sparc_fetch_wcookie): New function. + * Makefile.in (sparc-nat.o): Update dependencies. + * config/sparc/nm-nbsd.h: Include "target.h". + (NATIVE_XFER_WCOOKIE): New define. + (sparc_xfer_wcookie): New prototype. + +2004-02-04 Andrew Cagney <cagney@redhat.com> + + * m68k-tdep.c (m68k_saved_pc_after_call): Delete #ifdef + SYSCALL_TRAP function. + (m68k_gdbarch_init): Delete #ifdef SYSCALL_TRAP code. + +2004-02-04 Andrew Cagney <cagney@redhat.com> + Daniel Jacobowitz <drow@mvista.com> + + * objfiles.h: Delete comments refering to inside_entry_func and + DEPRECATED_FRAME_CHAIN_VALID. + * defs.h (inside_entry_func): Update prototype.. + * blockframe.c (inside_entry_func): Rename to + legacy_inside_entry_func. Add new inside_entry_func taking a frame. + * frame.c (get_prev_frame): Pass the frame to inside_entry_func. + +2004-02-03 Jeff Johnston <jjohnstn@redhat.com> + + * breakpoint.c (struct captured_parse_breakpoint_args): Move + outside of #ifdef SOLIB_ADD region. + (do_restore_lang_radix_cleanup): Ditto. + (resolve_pending_breakpoint): Ditto. + +2004-02-03 Andrew Cagney <cagney@redhat.com> + + * ia64-tdep.c (read_sigcontext_register): Delete unused function. + (process_note_abi_tag_sections): Delete unused function. + (ia64_read_fp): Delete unused function. + (gdbarch_extract_struct_value_address): Delete declaration. + +2004-02-02 Andrew Cagney <cagney@redhat.com> + + * vax-tdep.c (vax_frame_chain): Delete call to + deprecated_inside_entry_file. + * ns32k-tdep.c (ns32k_frame_chain): Ditto. + +2004-02-02 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.c (dwarf2_frame_cache): Deal with a return address + column that's "empty" or "same value" when eliminating REG_RA + rules. + +2004-02-02 Jeff Johnston <jjohnstn@redhat.com> + + * NEWS: Add information about new pending breakpoint support. + +2004-02-02 Jeff Johnston <jjohnstn@redhat.com> + + * breakpoint.h (struct breakpoint): Add new flag, from_tty, + and pending fields for pending breakpoint support. + * breakpoint.c (breakpoint_enabled): Add check for not pending. + (condition_command): Only parse condition if not a pending + breakpoint. + (print_one_breakpoint): Add support for pending breakpoints. + (describe_other_breakpoints): Add checks to verify we are not + dealing with pending breakpoints. + (check_duplicates): Don't check pending breakpoints. + (set_raw_breakpoint): Initialize pending flag. + (do_restore_lang_radix_cleanup): New cleanup routine. + (resolve_pending_breakpoint): New function. + (re_enable_breakpoints_in_shlibs): Try and resolve any + pending breakpoints via resolve_pending_breakpoint. + (mention): Add pending breakpoint support. + (parse_breakpoint_sals): Add new parameter to pass to + decode_line_1 to indicate silent errors when files or functions + are not found. Change all callers. + (do_captured_parse_breakpoint): New function. + (break_command_1): Change prototype to return an rc value and to + take an optional pending breakpoint pointer. Support creating + a pending breakpoint if a "not found" form of error occurs when + parsing the breakpoint. Also support resolving an existing pending + breakpoint and be silent if the resolution fails. + (create_breakpoints): Change prototype to take pending breakpoint + pointer. When resolving a pending breakpoint, use the new pointer + to provide a conditional or commands added by the end-user. + (delete_breakpoint): Add appropriate check for pending. + (breakpoint_re_set_one): Ditto. + (do_enable_breakpoint): Ditto. + +2004-02-02 David Carlton <carlton@kealia.com> + + * valops.c (enum oload_classification): New. + (find_overload_match): Break implementation into separate + functions; delete #if 0'd code; look for symbols within + namespaces. + (find_oload_champ_namespace,find_oload_champ_namespace_loop) + (find_oload_champ,oload_method_static,classify_oload_match): New. + * cp-support.h: Add declaration for cp_func_name; update + declaration for make_symbol_overload_list. + * cp-support.c (cp_func_name): New. + (overload_list_add_symbol): Fix comment, use + SYMBOL_LINKAGE_NAME and SYMBOL_NATURAL_NAME. + (make_symbol_overload_list): Take a function name and a namespace + instead of a symbol; change implementation. + (make_symbol_overload_list_using): New. + (make_symbol_overload_list_qualified, read_in_psymtabs): New. + +2004-02-02 Fred Fish <fnf@redhat.com> + + * main.c (gdb_stdtarg): Move definition to group with other + gdb_stdtarg definitions and update copyright years. + * remote-sim.c (gdb_os_write_stderr): Write output to + gdb_stdtargerr stream instead of gdb_stdtarg stream. + (gdb_os_flush_stderr): Flush gdb_stdtargerr steam instead of + gdb_stderr stream and update copyright years. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * Makefile.in (mips-linux-nat.o): Update dependencies. + * mips-linux-nat.c: Include mips-tdep.h. + +2004-02-01 Roland McGrath <roland@redhat.com> + + * sol-thread.c (sol_thread_xfer_partial): New function. + (init_sol_thread_ops): Use that for to_xfer_partial hook. + (init_sol_core_ops): Likewise. + + * procfs.c (procfs_xfer_partial): New function. + (init_procfs_ops): Use that for procfs_ops.to_xfer_partial. + * Makefile.in (procfs.o): Add $(auxv_h) dep. + + * config/nm-linux.h (NATIVE_XFER_AUXV): New macro, uses auxv.c's + procfs_xfer_auxv function. + + * procfs.c (procfs_make_note_section): If we can read + TARGET_OBJECT_AUXV data, add an NT_AUXV note containing it. + * linux-proc.c (linux_make_note_section): Likewise. + + * auxv.h: New file. + * auxv.c: New file. + * Makefile.in (auxv_h): New variable. + (COMMON_OBS): Add auxv.o here. + (auxv.o): New target. + + * corelow.c (core_xfer_partial): New function. + (init_core_ops): Use it for core_ops.to_xfer_partial. + + * target.h (enum target_object): Add TARGET_OBJECT_AUXV. + * inftarg.c (child_xfer_partial): Support it using NATIVE_XFER_AUXV + macro if that is defined. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (bpstat_stop_status): Take a ptid_t argument, + and check the specified thread for each breakpoint. + * breakpoint.h (bpstat_stop_status): Update prototype. + * infrun.c (handle_inferior_event): Update calls to + bpstat_stop_status. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * Makefile.in (cli-cmds.o): Add $(readline_h). + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * cli/cli-cmds.c: Include readline.h. + (complete_command): Pass the start of the last word to + complete_line. + +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (bpstat_stop_status): Remove not_a_sw_breakpoint + argument, and change first argument to a CORE_ADDR. + * breakpoint.h (bpstat_stop_status): Update prototype. + * infrun.c (adjust_pc_after_break): Add a new comment. + (handle_inferior_event): Update calls to bpstat_stop_status. + +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.h: Update copyright years. + +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (software_breakpoint_inserted_here_p): New function. + (bpstat_stop_status): Don't decrement PC. + * breakpoint.h (software_breakpoint_inserted_here_p): Add + prototype. + * infrun.c (adjust_pc_after_break): New function. + (handle_inferior_event): Call it, early. Remove later references + to DECR_PC_AFTER_BREAK. + (normal_stop): Add commentary. + +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (breakpoint_re_set_one): Add missing chunk of + 2004-01-27 double-free fix. + +2004-01-31 Mark Kettenis <kettenis@gnu.org> + + * sparc-tdep.c (sparc_fetch_wcookie): New function. + (sparc32_frame_prev_register): Handle StackGhost. + (sparc_supply_rwindow, sparc_collect_rwindow): Likewise. + +2004-01-29 Roland McGrath <roland@redhat.com> + + * configure.in (NEW_PROC_API): Also match solaris2.9 for this test. + * configure: Regenerated. + + * procfs.c: Include gdb_string.h for str* decls, otherwise warnings. + * Makefile.in (procfs.o): Add dep. + +2004-01-28 Andrew Cagney <cagney@redhat.com> + + * tui/tui-stack.h: Update copyright. + (struct frame_info): Add opaque declaration. + (tui_update_locator_filename): Rename tuiUpdateLocatorFilename. + (tui_show_locator_content): Rename tuiShowLocatorContent. + (tui_show_frame_info): Rename tuiShowFrameInfo. + * tui/tui-stack.c: Update copyright. Update references. + * tui/tui-winsource.c: Update references. + * tui/tui-win.c: Update references. + * tui/tui-layout.c: Update references. + * tui/tui-hooks.c: Update copyright, update references. + * tui/tui.c: Update copyright, update references. + * tui/tui-disasm.c: Update references. + +2004-01-28 David Carlton <carlton@kealia.com> + + * dwarf2read.c (add_partial_structure): Use demangled name if + namespace equals "". + +2004-01-27 Jim Blandy <jimb@redhat.com> + + Clean up misapplied patch: + * dwarf2read.c (determine_prefix): Change one of the two forward + declarations for 'determine_prefix_aux' to a declaration for this. + (read_func_scope): Use cu->language, not cu_language. Pass 'cu' + argument to 'die_specification'. + + * dwarf2read.c (read_func_scope): Re-indent comment. + +2004-01-27 Paul N. Hilfinger <hilfinger@gnat.com> + + * breakpoint.c (breakpoint_re_set_one): Set b->cond, b->val, and + b->exp to NULL after freeing so that error during re-parsing or + evaluation of expressions associated with breakpoint don't + eventually lead to re-freeing of storage. + Committed by Andrew Cagney. + +2004-01-27 Andrew Cagney <cagney@redhat.com> + + * source.c (ambiguous_line_spec): Delete undefined declaration. + * m32r-rom.c (m32r_set_board_address): Delete unused function. + (m32r_set_server_address, m32r_set_download_path): Ditto. + * remote-fileio.c (remote_fileio_to_fio_int): Ditto. + +2004-01-27 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2read.c: Update calls to changed and renamed functions, and + references to moved variables. + + (struct dwarf2_cu): Add first_fn, last_fn, cached_fn, + language, language_defn, list_in_scope, and ftypes members. + (cu_first_fn, cu_last_fn, cu_cached_fn, cu_language) + (cu_language_defn, list_in_scope, ftypes, cu_header_offset) + (baseaddr): Remove globals. + + (dwarf_attr): Renamed to dwarf2_attr. Add CU argument. + (set_cu_language, die_is_declaration, die_specification) + (determine_prefix, determin_prefix_aux, class_name, namespace_name) + (dwarf2_linkage_name, dwarf2_name, dwarf2_extension) + (dwarf2_get_ref_die_offset, dwarf2_fundamental_type) + (initialize_cu_func_list, add_to_cu_func_list): Add CU argument. + + (dwarf2_build_psymtabs_hard): Add local baseaddr. Initialize + cu.list_in_scope. Don't initialize cu_header_offset. + (add_partial_symbol): Add local baseaddr. + (psymtab_to_symtab_1): Add local baseaddr. Use + objfile->section_offsets for consistency. Don't initialize + cu_header_offset; do initialize cu.header.offset and + cu.list_in_scope. + (read_file_scope, read_func_scope, read_lexical_block_scope) + (dwarf_decode_lines, new_symbol): Add local baseaddr. + +2004-01-27 Michael Chastain <mec.gnu@mindspring.com> + + * PROBLEMS: Add gdb/1516. + +2003-12-29 Robert Millan <robertmh@gnu.org> + + Patch committed by Andrw Cagney. + * configure.host: Match knetbsd*-gnu and kfreebsd*-gnu. + * configure.tgt: Match knetbsd*-gnu. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * breakpoint.c (catch_command_1): Delete #ifdef code. + (catch_fork_command_1): Delete #ifdef wrapper. + (catch_exec_command_1): Ditto. + (catch_load_command_1): Ditto. + (catch_unload_command_1): Ditto. + + * breakpoint.c (watchpoint_check): Delete #if0ed variable. + (catch_breakpoint): Delete #if0ed function. + (disable_catch_breakpoint): Ditto. + (delete_catch_breakpoint, enable_catch_breakpoint): Ditto. + (disable_catch, enable_catch, delete_catch): Ditto. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * remote.c (echo_check, quit_flag): Delete variables. + (cisco_kernel_mode): Delete variable. + (minitelnet_return, tty_input, escape_count): Delete variables. + (remote_cisco_mode): Delete variable. + (remote_cisco_open, remote_cisco_close): Delete function. + (remote_cisco_mourn, remote_cisco_wait): Delete function. + (init_remote_cisco_ops): Delete function. + (_initialize_remote): Do not install "remote cisco" code. + (read_frame): Delete cisco specific code. + (remote_info_process): Delete function. + (remote_wait): Delete cisco specific code. + (remote_cisco_section_offsets): Delete function. + (remote_cisco_objfile_relocate): Delete function. + (remote_async_wait): Delete cisco specific code. + (minitelnet, readtty, readsocket): Delete function. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (EXTRACT_STRUCT_VALUE_ADDRESS): Deprecate. Add + comments mentioning extract_returned_value_address. + * infcmd.c (print_return_value): Update. Add comments on + extract_returned_value_address. + * stack.c (return_command): Add comments on + extract_returned_value_address. + * values.c: Update comment. + * m32r-tdep.c: Update comment. + * sparc-tdep.c: Update comment. + * ia64-tdep.c (ia64_use_struct_convention): Update comment. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * sh64-tdep.c (sh64_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * m68klinux-tdep.c (m68k_linux_init_abi): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * m32r-tdep.c (m32r_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * dwarf2loc.c (dwarf_expr_frame_base): Use SYMBOL_OPS instead of + SYMBOL_LOCATION_FUNCS + (dwarf2_loclist_funcs, dwarf2_locexpr_funcs): Change type to + "struct symbol_ops". + * dwarf2loc.h (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Change + type to "struct symbol_ops". + * symtab.h (struct symbol_ops): Rename "struct location_funcs". + (struct symbol): Replace ".aux_value.loc.funcs" and + ".aux_value.loc.baton" with ".ops" and ".aux_value.ptr". + (SYMBOL_OBJFILE): Delete macro. + (SYMBOL_LOCATION_FUNCS): Delete macro. + (SYMBOL_LOCATION_BATON): Update. + * dwarf2read.c (dwarf2_symbol_mark_computed): Set SYMBOL_OPS + intead of SYMBOL_LOCATION_FUNCS. + * ax-gdb.c (gen_var_ref): Ditto. + * printcmd.c (address_info): Ditto. + * findvar.c (read_var_value): Ditto. + (symbol_read_needs_frame): Ditto. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * dwarf2read.c (read_func_scope): Document frame-base hack. + +2004-01-25 Mark Kettenis <kettenis@gnu.org> + + * infcmd.c (print_return_value): Plug memory leak; delete + ui_stream object. Rename argument `structure_return' to + `struct_return'. + +2004-01-25 Mark Kettenis <kettenis@gnu.org> + + * infcmd.c (print_return_value): Wrap long lines. + (finish_command_continuation, finish_command): Remove unused + variable `funcaddr'. Fix some coding-standards problems. + + * sparc-tdep.c (sparc_regset_from_core_section): Check whether + SECT_SIZE is large enough, not wheter it's exactly the right size. + (sparc32_gdbarch_init): Initialize TDEP->sizeof_gregset and + TDEP->fpregset to zero. + + * sparcnbsd-tdep.c (sparc32nbsd_supply_gregset): Also supply the + floating-point registers for traditional NetBSD core files. + (sparc32nbsd_init_abi): Initialize TDEP->sizeof_gregset and + TDEP->sizeof_fpregset here. + +2004-01-25 Mark Kettenis <kettenis@gnu.org> + + * sparc-tdep.h (sparc32nbsd_sigcontext_saved_regs): New prototype. + * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): New + function with code split out from + sparc32nbsd_sigcontext_frame_cache. + (sparc32nbsd_sigcontext_frame_cache): Use + sparc32nbsd_sigcontext_saved_regs. + (_initialize_sparc32nbsd_tdep): Don't register OS ABI handler for + OpenBSD. + * sparcobsd-tdep.c: New file. + * Makefile.in (ALLDEPFILES): Add sparcobsd-tdep.c. + (sparcobsd-tdep.o): New dependency. + * configure.tgt (sparc-*-openbsd*): Set gdb_target to obsd. + * config/sparc/obsd.mt: New file. + + * sparc-tdep.c (sparc32_gdbarch_init): Don't require + TDEP->fpregset to be initialized to enable core file register + sets. + +2004-01-24 Mark Kettenis <kettenis@gnu.org> + + * sparc64-tdep.h (struct frame_info, struct trad_frame_saved_reg): + Add opaque declarations. + (sparc64nbsd_sigcontext_saved_regs): New prototype. + * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): New + function with code split out from + sparc64nbsd_sigcontext_frame_cache. + (sparc64nbsd_sigcontext_frame_cache): Use + sparc64nbsd_sigcontext_saved_regs. + (_initialize_sparc64nbsd_tdep): Don't register OS ABI handler for + OpenBSD. + * sparc64obsd-tdep.c: New file. + * Makefile.in (ALLDEPFILES): Add sparc64obsd-tdep.c. + (sparc64obsd-tdep.o): New dependency. + * configure.tgt (sparc64-*-openbsd*): Set gdb_target to obsd64 and + gdb_osabi to GDB_OSABI_OPENBSD_ELF. + * config/sparc/obsd64.mt: New file. + + * sparc-tdep.c (sparc_fetch_instruction): Return zero if we can't + read the instruction at PC. + + * sparcnbsd-tdep.c (GDB_OSABI_NETBSD_CORE): Define, based on the + value of GDB_OSABI_DEFAULT. + (sparcnbsd_core_osabi_sniffer): Return GDB_OSABI_NETBSD_CORE + instead of GDB_OSABI_NETBSD_AOUT. + +2004-01-24 Nick Roberts <nick@nick.uklinux.net> + + * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-cmds.h: Update + copyright. + +2004-01-23 Andrew Cagney <cagney@redhat.com> + + * printcmd.c (display_command): Replace tui_set_display call with + tui_set_layout_for_display_command. + * tui/tui.h (enum tui_win_type): Define. + (tui_set_layout): Delete declaration. + (tui_set_layout_for_display_command): Rename set_tui_layout. + * tui/tui-data.h (enum tui_layout_type): Define. + * tui/tui-layout.h: Update copyright. Include "tui-data.h" and + "tui.h". + (tui_add_win_to_layout): Rename tuiAddWinToLayout. + (tui_default_win_height): Rename tuiDefaultWinHeight. + (tui_default_win_viewport_height): Rename + tuiDefaultWinViewportHeight. + (tui_set_layout): RenametuiSetLayout. + * tui/tui-layout.c: Update references. + * tui/tui.c: Update references. + * tui/tui-disasm.c: Update references. + +2004-01-23 David Carlton <carlton@kealia.com> + + Partial workaround for PR c++/1511: + * cp-namespace.c: Include frame.h. + (cp_lookup_transparent_type): New + (cp_lookup_transparent_type_loop): New. + * cp-support.h: Declare cp_lookup_transparent_type. + * symtab.c (basic_lookup_transparent_type): Renamed from + lookup_transparent_type. + (lookup_transparent_type): Replace old body by a call to + current_language->la_lookup_transparent_type. + * symtab.h: Update copyright. Declare + basic_lookup_transparent_type. + * language.h: Update copyright. + (struct language_defn): Add la_lookup_transparent_type. + * language.c: Update copyright. + (unknown_language_defn): Add basic_lookup_transparent_type. + (auto_language_defn): Add basic_lookup_transparent_type. + (local_language_defn): Add basic_lookup_transparent_type. + * ada-lang.c: Update copyright. + (ada_language_defn): Add basic_lookup_transparent_type. + * c-lang.c: Update copyright. + (c_language_defn): Add basic_lookup_transparent_type. + (cplus_language_defn): Add basic_lookup_transparent_type. + (asm_language_defn): Add basic_lookup_transparent_type. + (minimal_language_defn): Add basic_lookup_transparent_type. + * f-lang.c: Update copyright. + (f_language_defn): Add basic_lookup_transparent_type. + * jv-lang.c: Update copyright. + (java_language_defn): Add basic_lookup_transparent_type. + * m2-lang.c: Update copyright. + (m2_language_defn): Add basic_lookup_transparent_type. + * objc-lang.c: Update copyright. + (objc_language_defn): Add basic_lookup_transparent_type. + * p-lang.c: Update copyright. + (p_language_defn): Add basic_lookup_transparent_type. + * scm-lang.c: Update copyright. + (scm_language_defn): Add basic_lookup_transparent_type. + * Makefile.in (cp-namespace.o): Depend on frame.h. + +2004-01-23 David Carlton <carlton@kealia.com> + + Patch for PR c++/1520: + * dwarf2read.c (read_func_scope): Set processing_current_prefix + properly if we have a specification die. + (determine_prefix_aux): Rename from determine_prefix. + (determine_prefix): Like the old determine_prefix, but never + returns NULL. + +2004-01-23 Theodore A. Roth <troth@openavr.org> + + * avr-tdep.c: Update copyright. + (avr_iaddr_p): Delete unused function. + (avr_saddr_p): Delete unused function. + +2004-01-23 David Carlton <carlton@kealia.com> + + * symfile.c (reread_symbols): Clear objfile->cp_namespace_symtab. + Fix for PR symtab/1534. + +2004-01-23 Mark Kettenis <kettenis@gnu.org> + + * NEWS (New native configurations): Mention OpenBSD/sparc and + OpenBSD/sparc64. + * configure.tgt: Add sparc-*-openbsd* and sparc64-*-openbsd*. + * configure.host: Likewise. + * sparcnbsd-tdep.c (_initialize_sparnbsd_tdep): Register OS ABI + handler for OpenBSD. + * sparc64nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Likewise. + +2004-01-22 Mark Kettenis <kettenis@gnu.org> + + * sparcnbsd-tdep.c (sparcnbsd_core_osabi_sniffer): New function. + (_initialize_sparnbsd_tdep): Register sparcnbsd_core_osabi_sniffer. + + * ser-pipe.c (pipe_open): Use proper null pointer in execl call. + * cli/cli-cmds.c (shell_escape): Likewise. + + * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Recognize + OpenBSD .note.openbsd.ident sections. + +2004-01-22 David Carlton <carlton@kealia.com> + + * dwarf2read.c (psymtab_to_symtab_1): Calculate lowpc, highpc via + get_scope_pc_bounds. + (read_file_scope): Ditto. + (get_scope_pc_bounds): New function, produced by extracting code + from the above two functions, consolidating it, and adding support + for DW_TAG_namespace. + 2004-01-22 Mark Kettenis <kettenis@gnu.org> * osabi.c (MAX_NOTESZ): New define. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a4e4c47..2e3c315 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -8,12 +8,12 @@ # 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. @@ -78,7 +78,7 @@ VPATH = @srcdir@ YACC=@YACC@ -# This is used to rebuild ada-lex.c from ada-lex.l. If the program is +# This is used to rebuild ada-lex.c from ada-lex.l. If the program is # not defined, but ada-lex.c is present, compilation will continue, # possibly with a warning. FLEX = flex @@ -152,14 +152,8 @@ SUBDIR_CLI_SRCS = \ cli/cli-interp.c \ cli/cli-utils.c SUBDIR_CLI_DEPS = -SUBDIR_CLI_INITS = \ - $(SUBDIR_CLI_SRCS) SUBDIR_CLI_LDFLAGS= SUBDIR_CLI_CFLAGS= -SUBDIR_CLI_ALL= -SUBDIR_CLI_CLEAN= -SUBDIR_CLI_INSTALL= -SUBDIR_CLI_UNINSTALL= # # MI sub directory definitons @@ -178,15 +172,9 @@ SUBDIR_MI_SRCS = \ mi/mi-interp.c \ mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c SUBDIR_MI_DEPS = -SUBDIR_MI_INITS = \ - $(SUBDIR_MI_SRCS) SUBDIR_MI_LDFLAGS= SUBDIR_MI_CFLAGS= \ -DMI_OUT=1 -SUBDIR_MI_ALL= -SUBDIR_MI_CLEAN= -SUBDIR_MI_INSTALL= -SUBDIR_MI_UNINSTALL= # # TUI sub directory definitions @@ -227,16 +215,9 @@ SUBDIR_TUI_SRCS = \ tui/tui-winsource.c \ tui/tui.c SUBDIR_TUI_DEPS = -SUBDIR_TUI_INITS = \ - $(SUBDIR_TUI_SRCS) SUBDIR_TUI_LDFLAGS= SUBDIR_TUI_CFLAGS= \ - -DTUI=1 -I${srcdir}/tui -SUBDIR_TUI_ALL= -SUBDIR_TUI_CLEAN= -SUBDIR_TUI_INSTALL= -SUBDIR_TUI_UNINSTALL= - + -DTUI=1 # Opcodes currently live in one of two places. Either they are in the @@ -304,25 +285,19 @@ SUBDIR_GDBTK_OBS = \ gdbtk-register.o gdbtk-stack.o gdbtk-varobj.o gdbtk-wrapper.o SUBDIR_GDBTK_SRCS = \ gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-bp.c \ - gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk-interp.c \ + gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c \ + gdbtk/generic/gdbtk-interp.c \ gdbtk/generic/gdbtk-register.c gdbtk/generic/gdbtk-stack.c \ gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c \ gdbtk/generic/gdbtk-main.c SUBDIR_GDBTK_DEPS = \ $(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TK_DEPS) $(TCL_DEPS) -SUBDIR_GDBTK_INITS = gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-interp.c SUBDIR_GDBTK_LDFLAGS= SUBDIR_GDBTK_CFLAGS= -DGDBTK -SUBDIR_GDBTK_ALL= all-gdbtk -SUBDIR_GDBTK_CLEAN= clean-gdbtk -SUBDIR_GDBTK_INSTALL= install-gdbtk -SUBDIR_GDBTK_UNINSTALL= uninstall-gdbtk CONFIG_OBS= @CONFIG_OBS@ -CONFIG_LIB_OBS= @CONFIG_LIB_OBS@ CONFIG_SRCS= @CONFIG_SRCS@ CONFIG_DEPS= @CONFIG_DEPS@ -CONFIG_INITS= @CONFIG_INITS@ CONFIG_LDFLAGS = @CONFIG_LDFLAGS@ ENABLE_CFLAGS= @ENABLE_CFLAGS@ CONFIG_ALL= @CONFIG_ALL@ @@ -424,15 +399,13 @@ REMOTE_OBS = remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o # This is remote-sim.o if a simulator is to be linked in. SIM_OBS = -ANNOTATE_OBS = annotate.o - # Host and target-dependent makefile fragments come in here. @host_makefile_frag@ @target_makefile_frag@ # End of host and target-dependent makefile fragments -# Possibly ignore the simulator. If the simulator is being ignored, -# these expand into SIM= and SIM_OBJ=, overriding the entries from +# Possibly ignore the simulator. If the simulator is being ignored, +# these expand into SIM= and SIM_OBJ=, overriding the entries from # target_makefile_frag # @IGNORE_SIM@ @@ -565,14 +538,6 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.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 \ - tui/tuiGeneralWin.h tui/tuiIO.c tui/tuiIO.h tui/tuiLayout.c \ - tui/tuiLayout.h tui/tuiRegs.c tui/tuiRegs.h tui/tuiSource.c \ - tui/tuiSource.h tui/tuiSourceWin.c tui/tuiSourceWin.h \ - tui/tuiStack.c tui/tuiStack.h tui/tuiWin.c tui/tuiWin.h \ - tui/tui-file.h tui/tui-file.c tui/tui-out.c tui/tui-hooks.c \ ui-out.c utils.c ui-file.h ui-file.c \ user-regs.c \ valarith.c valops.c valprint.c values.c varobj.c \ @@ -582,7 +547,7 @@ LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c # "system" headers. Using these in dependencies is a rather personal # choice. (-rich, summer 1993) -# (Why would we not want to depend on them? If one of these changes in a +# (Why would we not want to depend on them? If one of these changes in a # non-binary-compatible way, it is a real pain to remake the right stuff # without these dependencies -kingdon, 13 Mar 1994) aout_aout64_h = $(INCLUDE_DIR)/aout/aout64.h @@ -652,6 +617,7 @@ amd64_nat_h = amd64-nat.h annotate_h = annotate.h $(symtab_h) $(gdbtypes_h) arch_utils_h = arch-utils.h arm_tdep_h = arm-tdep.h +auxv_h = auxv.h ax_gdb_h = ax-gdb.h ax_h = ax.h $(doublest_h) bcache_h = bcache.h @@ -672,8 +638,8 @@ cp_abi_h = cp-abi.h cp_support_h = cp-support.h $(symtab_h) dcache_h = dcache.h defs_h = defs.h $(config_h) $(ansidecl_h) $(gdb_locale_h) $(gdb_signals_h) \ - $(libiberty_h) $(progress_h) $(bfd_h) $(tui_h) $(ui_file_h) $(xm_h) \ - $(nm_h) $(tm_h) $(fopen_same_h) $(gdbarch_h) + $(libiberty_h) $(progress_h) $(bfd_h) $(ui_file_h) $(xm_h) $(nm_h) \ + $(tm_h) $(fopen_same_h) $(gdbarch_h) dictionary_h = dictionary.h disasm_h = disasm.h doublest_h = doublest.h $(floatformat_h) @@ -694,6 +660,7 @@ gdbarch_h = gdbarch.h gdb_assert_h = gdb_assert.h gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h) gdbcore_h = gdbcore.h $(bfd_h) +gdb_curses_h = gdb_curses.h gdb_dirent_h = gdb_dirent.h gdb_events_h = gdb-events.h gdb_h = gdb.h @@ -829,19 +796,20 @@ mi_parse_h = $(srcdir)/mi/mi-parse.h # tui_command_h = $(srcdir)/tui/tui-command.h -tui_data_h = $(srcdir)/tui/tui-data.h -tui_disasm_h = $(srcdir)/tui/tui-disasm.h +tui_data_h = $(srcdir)/tui/tui-data.h $(tui_h) $(gdb_curses_h) +tui_disasm_h = $(srcdir)/tui/tui-disasm.h $(tui_h) $(tui_data_h) tui_file_h = $(srcdir)/tui/tui-file.h -tui_h = $(srcdir)/tui/tui.h $(ansidecl_h) +tui_h = $(srcdir)/tui/tui.h +tui_hooks_h = $(srcdir)/tui/tui-hooks.h tui_io_h = $(srcdir)/tui/tui-io.h -tui_layout_h = $(srcdir)/tui/tui-layout.h -tui_regs_h = $(srcdir)/tui/tui-regs.h -tui_source_h = $(srcdir)/tui/tui-source.h $(defs_h) +tui_layout_h = $(srcdir)/tui/tui-layout.h $(tui_h) $(tui_data_h) +tui_regs_h = $(srcdir)/tui/tui-regs.h $(tui_data_h) +tui_source_h = $(srcdir)/tui/tui-source.h $(tui_data_h) tui_stack_h = $(srcdir)/tui/tui-stack.h -tui_windata_h = $(srcdir)/tui/tui-windata.h +tui_windata_h = $(srcdir)/tui/tui-windata.h $(tui_data_h) tui_wingeneral_h = $(srcdir)/tui/tui-wingeneral.h -tui_win_h = $(srcdir)/tui/tui-win.h -tui_winsource_h = $(srcdir)/tui/tui-winsource.h +tui_win_h = $(srcdir)/tui/tui-win.h $(tui_data_h) +tui_winsource_h = $(srcdir)/tui/tui-winsource.h $(tui_data_h) # Header files that need to have srcdir added. Note that in the cases # where we use a macro like $(gdbcmd_h), things are carefully arranged @@ -881,7 +849,7 @@ REMOTE_EXAMPLES = m68k-stub.c i386-stub.c sparc-stub.c rem-multi.shar # Makefile.in DEPFILES = $(TDEPFILES) $(SER_HARDWIRE) $(NATDEPFILES) \ - $(REMOTE_OBS) $(SIM_OBS) $(CONFIG_LIB_OBS) + $(REMOTE_OBS) $(SIM_OBS) $(CONFIG_OBS) SOURCES = $(SFILES) $(ALLDEPFILES) $(YYFILES) $(CONFIG_SRCS) # Don't include YYFILES (*.tab.c) because we already include *.y in SFILES, @@ -890,7 +858,10 @@ TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \ $(SUBDIR_CLI_SRCS) TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR) -COMMON_OBS = version.o \ +COMMON_OBS = $(DEPFILES) $(YYOBJ) \ + version.o \ + annotate.o \ + auxv.o \ bfd-target.o \ blockframe.o breakpoint.o findvar.o regcache.o \ charset.o disasm.o dummy-frame.o \ @@ -900,10 +871,11 @@ COMMON_OBS = version.o \ infcmd.o infrun.o \ expprint.o environ.o stack.o thread.o \ interps.o \ + main.o \ macrotab.o macrocmd.o macroexp.o macroscope.o \ event-loop.o event-top.o inf-loop.o completer.o \ - gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o $(DEPFILES) \ - memattr.o mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \ + gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o \ + memattr.o mem-break.o target.o parse.o language.o buildsym.o \ std-regs.o \ signals.o \ kod.o kod-cisco.o \ @@ -932,8 +904,6 @@ COMMON_OBS = version.o \ reggroups.o \ trad-frame.o -OBS = $(COMMON_OBS) $(ANNOTATE_OBS) - TSOBS = inflow.o SUBDIRS = @subdirs@ @@ -977,12 +947,12 @@ info dvi install-info clean-info html install-html: force @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do gdb.z:gdb.1 - nroff -man $(srcdir)/gdb.1 | col -b > gdb.t + nroff -man $(srcdir)/gdb.1 | col -b > gdb.t pack gdb.t ; rm -f gdb.t mv gdb.t.z gdb.z # Traditionally "install" depends on "all". But it may be useful -# not to; for example, if the user has made some trivial change to a +# not to; for example, if the user has made some trivial change to a # source file and doesn't care about rebuilding or just wants to save the # time it takes for make to check that all is up to date. # install-only is intended to address that need. @@ -1002,7 +972,7 @@ install-only: $(CONFIG_INSTALL) $(DESTDIR)$(man1dir) ; \ $(INSTALL_DATA) $(srcdir)/gdb.1 \ $(DESTDIR)$(man1dir)/$$transformed_name.1 - @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do + @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do uninstall: force $(CONFIG_UNINSTALL) transformed_name=`t='$(program_transform_name)'; \ @@ -1014,7 +984,7 @@ uninstall: force $(CONFIG_UNINSTALL) fi ; \ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ $(DESTDIR)$(man1dir)/$$transformed_name.1 - @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do + @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do # We do this by grepping through sources. If that turns out to be too slow, # maybe we could just require every .o file to have an initialization routine @@ -1026,21 +996,21 @@ uninstall: force $(CONFIG_UNINSTALL) # Note that the set of files with init functions might change, or the names # of the functions might change, so this files needs to depend on all the # object files that will be linked into gdb. -# -# FIXME: There are 2 problems with this approach. First, if the INIT_FILES -# list includes a file twice (because of some mistake somewhere else) -# the _initialize_* function will be included twice in init.c. Second, -# init.c may force unnecessary files to be linked in. + +# FIXME: There is a problem with this approach - init.c may force +# unnecessary files to be linked in. # FIXME: cagney/2002-06-09: gdb/564: gdb/563: Force the order so that -# the first call is to _initialize_gdbtypes. This is a hack to ensure -# that all the architecture dependant global builtin_type_* variables -# are initialized before anything else (per-architecture code is -# called in the same order that it is registered). The ``correct -# fix'' is to have all the builtin types made part of the architecture -# and initialize them on-demand (using gdbarch_data) just like -# everything else. The catch is that other modules still take the -# address of these builtin types forcing them to be variables, sigh! +# the first call is to _initialize_gdbtypes (implemented by explicitly +# putting that function's name first in the init.l-tmp file). This is +# a hack to ensure that all the architecture dependant global +# builtin_type_* variables are initialized before anything else +# (per-architecture code is called in the same order that it is +# registered). The ``correct fix'' is to have all the builtin types +# made part of the architecture and initialize them on-demand (using +# gdbarch_data) just like everything else. The catch is that other +# modules still take the address of these builtin types forcing them +# to be variables, sigh! # NOTE: cagney/2003-03-18: The sed pattern ``s|^\([^ /]...'' is # anchored on the first column and excludes the ``/'' character so @@ -1049,38 +1019,51 @@ uninstall: force $(CONFIG_UNINSTALL) # automatically adds the $(srcdir) prefixes when it encounters files # in sub-directories such as cli/ and mi/. -INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS) +# NOTE: cagney/2004-02-08: The ``case "$$fs" in'' eliminates +# duplicates. Files in the gdb/ directory can end up appearing in +# COMMON_OBS (as a .o file) and CONFIG_SRCS (as a .c file). + +INIT_FILES = $(COMMON_OBS) $(TSOBS) $(CONFIG_SRCS) init.c: $(INIT_FILES) @echo Making init.c @rm -f init.c-tmp init.l-tmp + @touch init.c-tmp + @echo gdbtypes > init.l-tmp @-echo $(INIT_FILES) | \ tr ' ' '\012' | \ sed \ - -e '/^init.o/d' \ - -e '/xdr_ld.o/d' \ - -e '/xdr_ptrace.o/d' \ - -e '/xdr_rdb.o/d' \ - -e '/udr.o/d' \ - -e '/udip2soc.o/d' \ - -e '/udi2go32.o/d' \ - -e '/version.o/d' \ - -e '/^[a-z0-9A-Z_]*_[SU].o/d' \ - -e '/[a-z0-9A-Z_]*-exp.tab.o/d' \ - -e 's/\.o/.c/' \ + -e '/^gdbtypes.[co]$$/d' \ + -e '/^init.[co]$$/d' \ + -e '/xdr_ld.[co]$$/d' \ + -e '/xdr_ptrace.[co]$$/d' \ + -e '/xdr_rdb.[co]$$/d' \ + -e '/udr.[co]$$/d' \ + -e '/udip2soc.[co]$$/d' \ + -e '/udi2go32.[co]$$/d' \ + -e '/version.[co]$$/d' \ + -e '/^[a-z0-9A-Z_]*_[SU].[co]$$/d' \ + -e '/[a-z0-9A-Z_]*-exp.tab.[co]$$/d' \ + -e 's/\.[co]$$/.c/' \ -e 's,signals\.c,signals/signals\.c,' \ -e 's|^\([^ /][^ ]*\)|$(srcdir)/\1|g' | \ - while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \ - sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \ - ( echo _initialize_gdbtypes ; grep -v '^_initialize_gdbtypes$$' ) > init.l-tmp + while read f; do \ + sed -n -e 's/^_initialize_\([a-z_0-9A-Z]*\).*/\1/p' $$f 2>/dev/null; \ + done | \ + while read f; do \ + case " $$fs " in \ + *" $$f "* ) ;; \ + * ) echo $$f ; fs="$$fs $$f";; \ + esac; \ + done >> init.l-tmp @echo '/* Do not modify this file. */' >>init.c-tmp @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp - @echo '#include "defs.h"' >>init.c-tmp - @echo '#include "call-cmds.h"' >>init.c-tmp - @sed -e 's/\(.*\)/extern initialize_file_ftype \1;/' <init.l-tmp >>init.c-tmp + @echo '#include "defs.h" /* For initialize_file_ftype. */' >>init.c-tmp + @echo '#include "call-cmds.h" /* For initialize_all_files. */' >>init.c-tmp + @sed -e 's/\(.*\)/extern initialize_file_ftype _initialize_\1;/' <init.l-tmp >>init.c-tmp @echo 'void' >>init.c-tmp @echo 'initialize_all_files (void)' >>init.c-tmp @echo '{' >>init.c-tmp - @sed -e 's/\(.*\)/ \1 ();/' <init.l-tmp >>init.c-tmp + @sed -e 's/\(.*\)/ _initialize_\1 ();/' <init.l-tmp >>init.c-tmp @echo '}' >>init.c-tmp @rm init.l-tmp @mv init.c-tmp init.c @@ -1090,10 +1073,10 @@ init.c: $(INIT_FILES) init.o: init.c $(defs_h) $(call_cmds_h) # Removing the old gdb first works better if it is running, at least on SunOS. -gdb$(EXEEXT): gdb.o main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) +gdb$(EXEEXT): gdb.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) rm -f gdb$(EXEEXT) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ - -o gdb$(EXEEXT) gdb.o main.o $(CONFIG_OBS) libgdb.a \ + -o gdb$(EXEEXT) gdb.o libgdb.a \ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) nlm: force @@ -1103,7 +1086,7 @@ nlm: force # against that. # # init.o is very important. It pulls in the rest of GDB. -LIBGDB_OBS= $(OBS) $(TSOBS) $(ADD_FILES) init.o +LIBGDB_OBS= $(COMMON_OBS) $(TSOBS) $(ADD_FILES) init.o libgdb.a: $(LIBGDB_OBS) -rm -f libgdb.a $(AR) q libgdb.a $(LIBGDB_OBS) @@ -1155,7 +1138,7 @@ TAGS: $(TAGFILES_NO_SRCDIR) $(TAGFILES_WITH_SRCDIR) tags: TAGS clean mostlyclean: $(CONFIG_CLEAN) - @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(SUBDIRS)" subdir_do + @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(SUBDIRS)" subdir_do rm -f *.o *.a $(ADD_FILES) *~ init.c-tmp init.l-tmp version.c-tmp rm -f init.c version.c rm -f gdb$(EXEEXT) core make.log @@ -1168,7 +1151,7 @@ clean mostlyclean: $(CONFIG_CLEAN) # NB: While GDBSERVER might be configured on native systems, it isn't # always included in SUBDIRS. Remove the gdbserver files explictly. distclean: clean - @$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(SUBDIRS)" subdir_do + @$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(SUBDIRS)" subdir_do rm -f gdbserver/config.status gdbserver/config.log rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h rm -f gdbserver/Makefile gdbserver/config.cache @@ -1327,8 +1310,8 @@ ALLDEPFILES = \ sparc-tdep.c sparc-sol2-nat.c sparc-sol2-tdep.c sparc64-linux-nat.c \ sparc64-linux-tdep.c sparc64-nat.c sparc64-sol2-tdep.c \ sparc64-tdep.c sparc64fbsd-nat.c sparc64fbsd-tdep.c \ - sparc64nbsd-nat.c sparc64nbsd-tdep.c sparcnbsd-nat.c \ - sparcnbsd-tdep.c \ + sparc64nbsd-nat.c sparc64nbsd-tdep.c sparc64obsd-tdep.c \ + sparcnbsd-nat.c sparcnbsd-tdep.c sparcobsd-tdep.c \ sun3-nat.c \ symm-tdep.c symm-nat.c \ vax-tdep.c \ @@ -1410,7 +1393,7 @@ ada-exp.tab.o: ada-exp.tab.c $(defs_h) $(expression_h) $(value_h) \ $(objfiles_h) $(frame_h) $(block_h) $(ada_lex_c) ada-exp.tab.c: ada-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/ada-exp.y y.tab.c ada-exp.tmp -- $(YFLAGS) + $(srcdir)/ada-exp.y y.tab.c ada-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1439,7 +1422,7 @@ c-exp.tab.o: c-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(symfile_h) $(objfiles_h) $(charset_h) $(block_h) $(cp_support_h) c-exp.tab.c: c-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/c-exp.y y.tab.c c-exp.tmp -- $(YFLAGS) + $(srcdir)/c-exp.y y.tab.c c-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1456,7 +1439,7 @@ f-exp.tab.o: f-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(symfile_h) $(objfiles_h) $(block_h) f-exp.tab.c: f-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/f-exp.y y.tab.c f-exp.tmp -- $(YFLAGS) + $(srcdir)/f-exp.y y.tab.c f-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1473,7 +1456,7 @@ jv-exp.tab.o: jv-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(symfile_h) $(objfiles_h) $(block_h) jv-exp.tab.c: jv-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/jv-exp.y y.tab.c jv-exp.tmp -- $(YFLAGS) + $(srcdir)/jv-exp.y y.tab.c jv-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1490,7 +1473,7 @@ m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(symfile_h) $(objfiles_h) $(block_h) m2-exp.tab.c: m2-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/m2-exp.y y.tab.c m2-exp.tmp -- $(YFLAGS) + $(srcdir)/m2-exp.y y.tab.c m2-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1508,7 +1491,7 @@ objc-exp.tab.o: objc-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(block_h) objc-exp.tab.c: objc-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/objc-exp.y y.tab.c objc-exp.tmp -- $(YFLAGS) + $(srcdir)/objc-exp.y y.tab.c objc-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1525,7 +1508,7 @@ p-exp.tab.o: p-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \ $(symfile_h) $(objfiles_h) $(block_h) p-exp.tab.c: p-exp.y $(SHELL) $(YLWRAP) "$(YACC)" \ - $(srcdir)/p-exp.y y.tab.c p-exp.tmp -- $(YFLAGS) + $(srcdir)/p-exp.y y.tab.c p-exp.tmp -- $(YFLAGS) -sed -e '/extern.*malloc/d' \ -e '/extern.*realloc/d' \ -e '/extern.*free/d' \ @@ -1621,6 +1604,9 @@ arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \ $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(arm_tdep_h) \ $(gdb_sim_arm_h) $(elf_bfd_h) $(coff_internal_h) $(elf_arm_h) \ $(gdb_assert_h) $(bfd_in2_h) $(libcoff_h) +auxv.o: auxv.c $(defs_h) $(target_h) $(gdbtypes_h) $(command_h) \ + $(inferior_h) $(valprint_h) $(gdb_assert_h) $(auxv_h) \ + $(elf_common_h) avr-tdep.o: avr-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(frame_base_h) $(trad_frame_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(symfile_h) $(arch_utils_h) $(regcache_h) \ @@ -1691,7 +1677,7 @@ cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \ $(ui_out_h) $(gdb_string_h) cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \ $(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h) $(objfiles_h) \ - $(gdbtypes_h) $(dictionary_h) $(command_h) + $(gdbtypes_h) $(dictionary_h) $(command_h) $(frame_h) cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \ $(demangle_h) $(gdb_assert_h) $(gdbcmd_h) $(dictionary_h) \ $(objfiles_h) $(frame_h) $(symtab_h) $(block_h) $(complaints_h) \ @@ -2075,10 +2061,10 @@ mem-break.o: mem-break.c $(defs_h) $(symtab_h) $(breakpoint_h) $(inferior_h) \ minsyms.o: minsyms.c $(defs_h) $(gdb_string_h) $(symtab_h) $(bfd_h) \ $(symfile_h) $(objfiles_h) $(demangle_h) $(value_h) $(cp_abi_h) mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h) -mips-linux-nat.o: mips-linux-nat.c $(defs_h) +mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h) mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \ $(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \ - $(gdb_assert_h) + $(gdb_assert_h) $(frame_h) mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(mipsnbsd_tdep_h) @@ -2094,7 +2080,8 @@ mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \ $(language_h) $(gdbcore_h) $(symfile_h) $(objfiles_h) $(gdbtypes_h) \ $(target_h) $(arch_utils_h) $(regcache_h) $(osabi_h) $(mips_tdep_h) \ $(block_h) $(reggroups_h) $(opcode_mips_h) $(elf_mips_h) \ - $(elf_bfd_h) $(symcat_h) $(sim_regno_h) $(dis_asm_h) + $(elf_bfd_h) $(symcat_h) $(sim_regno_h) $(dis_asm_h) \ + $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ $(regcache_h) $(gregset_h) mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ @@ -2172,15 +2159,15 @@ printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \ $(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \ $(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \ $(annotate_h) $(symfile_h) $(objfiles_h) $(completer_h) $(ui_out_h) \ - $(gdb_assert_h) $(block_h) $(disasm_h) + $(gdb_assert_h) $(block_h) $(disasm_h) $(tui_h) proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(gdb_wait_h) \ $(proc_utils_h) proc-events.o: proc-events.c $(defs_h) proc-flags.o: proc-flags.c $(defs_h) procfs.o: procfs.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) $(gdb_wait_h) \ - $(gdb_assert_h) $(inflow_h) $(gdb_dirent_h) $(X_OK) $(gdb_stat_h) \ - $(proc_utils_h) $(gregset_h) + $(gdb_string_h) $(gdb_assert_h) $(inflow_h) $(auxv_h) \ + $(gdb_dirent_h) $(X_OK) $(gdb_stat_h) $(proc_utils_h) $(gregset_h) proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \ $(symtab_h) $(target_h) $(gregset_h) proc-why.o: proc-why.c $(defs_h) $(proc_utils_h) @@ -2363,6 +2350,9 @@ sparc64nbsd-tdep.o: sparc64nbsd-tdep.c $(defs_h) $(frame_h) \ $(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \ $(symtab_h) $(solib_svr4_h) $(trad_frame_h) $(gdb_assert_h) \ $(gdb_string_h) $(sparc64_tdep_h) $(nbsd_tdep_h) +sparc64obsd-tdep.o: sparc64obsd-tdep.c $(defs_h) $(frame_h) \ + $(frame_unwind_h) $(osabi_h) $(regset_h) $(symtab_h) $(solib_svr4_h) \ + $(trad_frame_h) $(gdb_assert_h) $(sparc64_tdep_h) $(nbsd_tdep_h) sparc64-sol2-tdep.o: sparc64-sol2-tdep.c $(defs_h) $(frame_h) \ $(frame_unwind_h) $(gdbarch_h) $(symtab_h) $(objfiles_h) $(osabi_h) \ $(trad_frame_h) $(gdb_assert_h) $(sparc64_tdep_h) @@ -2375,13 +2365,17 @@ sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \ $(frame_unwind_h) $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) \ $(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(gdb_assert_h) \ $(gdb_string_h) $(sparc_tdep_h) -sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ - $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) $(sparc_nat_h) +sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \ + $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) \ + $(sparc_nat_h) sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(sparc_tdep_h) $(sparc_nat_h) sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \ $(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \ $(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(gdb_assert_h) \ $(gdb_string_h) $(sparc_tdep_h) $(nbsd_tdep_h) +sparcobsd-tdep.o: sparcobsd-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \ + $(frame_unwind_h) $(osabi_h) $(solib_svr4_h) $(symtab_h) \ + $(trad_frame_h) $(gdb_assert_h) $(sparc_tdep_h) $(nbsd_tdep_h) sparc-sol2-nat.o: sparc-sol2-nat.c $(defs_h) $(regcache_h) $(gregset_h) \ $(sparc_tdep_h) $(sparc64_tdep_h) sparc-sol2-tdep.o: sparc-sol2-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ @@ -2460,7 +2454,7 @@ ui-out.o: ui-out.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \ user-regs.o: user-regs.c $(defs_h) $(user_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(gdb_assert_h) $(frame_h) utils.o: utils.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(event_top_h) \ - $(gdbcmd_h) $(serial_h) $(bfd_h) $(target_h) $(demangle_h) \ + $(tui_h) $(gdbcmd_h) $(serial_h) $(bfd_h) $(target_h) $(demangle_h) \ $(expression_h) $(language_h) $(charset_h) $(annotate_h) \ $(filenames_h) $(inferior_h) uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \ @@ -2536,11 +2530,11 @@ cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(defs_h) $(completer_h) $(target_h) \ $(linespec_h) $(expression_h) $(frame_h) $(value_h) $(language_h) \ $(filenames_h) $(objfiles_h) $(source_h) $(disasm_h) $(ui_out_h) \ $(top_h) $(cli_decode_h) $(cli_script_h) $(cli_setshow_h) \ - $(cli_cmds_h) + $(cli_cmds_h) $(tui_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ $(gdb_regex_h) $(gdb_string_h) $(ui_out_h) $(cli_cmds_h) \ - $(cli_decode_h) $(gdb_assert_h) + $(cli_decode_h) $(tui_h) $(gdb_assert_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-decode.c cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) \ $(cli_decode_h) $(cli_cmds_h) $(value_h) $(completer_h) \ @@ -2616,11 +2610,11 @@ clean-gdbtk: rm -f insight$(EXEEXT) # Removing the old gdb first works better if it is running, at least on SunOS. -insight$(EXEEXT): gdbtk-main.o main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) \ +insight$(EXEEXT): gdbtk-main.o libgdb.a $(ADD_DEPS) \ $(CDEPS) $(TDEPLIBS) rm -f insight$(EXEEXT) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ - -o insight$(EXEEXT) gdbtk-main.o main.o $(CONFIG_OBS) libgdb.a \ + -o insight$(EXEEXT) gdbtk-main.o libgdb.a \ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico @@ -2630,7 +2624,7 @@ gdbtk.o: $(srcdir)/gdbtk/generic/gdbtk.c \ $(srcdir)/gdbtk/generic/gdbtk.h $(defs_h) \ $(symtab_h) $(inferior_h) $(command_h) \ $(bfd_h) $(symfile_h) $(objfiles_h) $(target_h) $(gdb_string_h) \ - $(tracepoint_h) $(top_h) + $(tracepoint_h) $(top_h) $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \ $(ITK_CFLAGS) \ $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\ @@ -2739,7 +2733,7 @@ mi-cmds.o: $(srcdir)/mi/mi-cmds.c $(defs_h) $(top_h) $(mi_cmds_h) \ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmds.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) \ - $(stack_h) $(dictionary_h) + $(stack_h) $(dictionary_h) $(gdb_string_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) @@ -2801,37 +2795,33 @@ signals.o: $(srcdir)/signals/signals.c $(server_h) $(defs_h) $(target_h) \ # Need to explicitly specify the compile rule as make will do nothing # or try to compile the object file into the sub-directory. -tuiSourceWin.o: $(srcdir)/tui/tuiSourceWin.c $(defs_h) $(symtab_h) \ - $(frame_h) $(breakpoint_h) $(value_h) $(source_h) $(tui_h) \ - $(tuiData_h) $(tuiStack_h) $(tuiWin_h) $(tuiGeneralWin_h) \ - $(tuiSourceWin_h) $(tuiSource_h) $(tuiDisassem_h) - $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tuiSourceWin.c -tui.o: $(srcdir)/tui/tui.c $(defs_h) $(gdbcmd_h) $(tui_h) $(tui_data_h) \ - $(tui_layout_h) $(tui_io_h) $(tui_regs_h) $(tui_stack_h) \ - $(tui_win_h) $(tui_winsource_h) $(tui_windata_h) $(readline_h) \ - $(target_h) $(frame_h) $(breakpoint_h) $(inferior_h) $(symtab_h) \ - $(source_h) +tui.o: $(srcdir)/tui/tui.c $(defs_h) $(gdbcmd_h) $(tui_h) $(tui_hooks_h) \ + $(tui_data_h) $(tui_layout_h) $(tui_io_h) $(tui_regs_h) \ + $(tui_stack_h) $(tui_win_h) $(tui_winsource_h) $(tui_windata_h) \ + $(readline_h) $(target_h) $(frame_h) $(breakpoint_h) $(inferior_h) \ + $(symtab_h) $(source_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui.c tui-command.o: $(srcdir)/tui/tui-command.c $(defs_h) $(tui_h) $(tui_data_h) \ - $(tui_win_h) $(tui_io_h) + $(tui_win_h) $(tui_io_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-command.c tui-data.o: $(srcdir)/tui/tui-data.c $(defs_h) $(symtab_h) $(tui_h) \ - $(tui_data_h) $(tui_wingeneral_h) + $(tui_data_h) $(tui_wingeneral_h) $(gdb_string_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-data.c tui-disasm.o: $(srcdir)/tui/tui-disasm.c $(defs_h) $(symtab_h) \ $(breakpoint_h) $(frame_h) $(value_h) $(source_h) $(disasm_h) \ - $(tui_h) $(tui_data_h) $(tui_win_h) $(tui_layout_h) \ - $(tui_winsource_h) $(tui_stack_h) $(tui_file_h) + $(gdb_string_h) $(tui_h) $(tui_data_h) $(tui_win_h) $(tui_layout_h) \ + $(tui_winsource_h) $(tui_stack_h) $(tui_file_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-disasm.c tui-file.o: $(srcdir)/tui/tui-file.c $(defs_h) $(ui_file_h) $(tui_file_h) \ - $(tui_io_h) $(tui_h) + $(tui_io_h) $(tui_h) $(gdb_string_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-file.c tui-hooks.o: $(srcdir)/tui/tui-hooks.c $(defs_h) $(symtab_h) $(inferior_h) \ $(command_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(target_h) \ $(gdbcore_h) $(event_loop_h) $(event_top_h) $(frame_h) \ $(breakpoint_h) $(gdb_events_h) $(ui_out_h) $(top_h) $(tui_h) \ - $(tui_data_h) $(tui_layout_h) $(tui_io_h) $(tui_regs_h) $(tui_win_h) \ - $(tui_stack_h) $(tui_windata_h) $(tui_winsource_h) + $(tui_hooks_h) $(tui_data_h) $(tui_layout_h) $(tui_io_h) \ + $(tui_regs_h) $(tui_win_h) $(tui_stack_h) $(tui_windata_h) \ + $(tui_winsource_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-hooks.c tui-interp.o: $(srcdir)/tui/tui-interp.c $(defs_h) $(interps_h) $(top_h) \ $(event_top_h) $(event_loop_h) $(ui_out_h) $(cli_out_h) \ @@ -2840,46 +2830,49 @@ tui-interp.o: $(srcdir)/tui/tui-interp.c $(defs_h) $(interps_h) $(top_h) \ tui-io.o: $(srcdir)/tui/tui-io.c $(defs_h) $(terminal_h) $(target_h) \ $(event_loop_h) $(event_top_h) $(command_h) $(top_h) $(readline_h) \ $(tui_h) $(tui_data_h) $(tui_io_h) $(tui_command_h) $(tui_win_h) \ - $(tui_wingeneral_h) $(tui_file_h) $(ui_out_h) $(cli_out_h) + $(tui_wingeneral_h) $(tui_file_h) $(ui_out_h) $(cli_out_h) \ + $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-io.c tui-layout.o: $(srcdir)/tui/tui-layout.c $(defs_h) $(command_h) $(symtab_h) \ $(frame_h) $(source_h) $(tui_h) $(tui_data_h) $(tui_windata_h) \ $(tui_wingeneral_h) $(tui_stack_h) $(tui_regs_h) $(tui_win_h) \ - $(tui_winsource_h) $(tui_disasm_h) + $(tui_winsource_h) $(tui_disasm_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-layout.c tui-out.o: $(srcdir)/tui/tui-out.c $(defs_h) $(ui_out_h) $(tui_h) \ $(gdb_string_h) $(gdb_assert_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-out.c tui-regs.o: $(srcdir)/tui/tui-regs.c $(defs_h) $(tui_h) $(tui_data_h) \ $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(frame_h) $(regcache_h) \ - $(inferior_h) $(target_h) $(tui_layout_h) $(tui_win_h) \ - $(tui_windata_h) $(tui_wingeneral_h) $(tui_file_h) + $(inferior_h) $(target_h) $(gdb_string_h) $(tui_layout_h) \ + $(tui_win_h) $(tui_windata_h) $(tui_wingeneral_h) $(tui_file_h) \ + $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-regs.c tui-source.o: $(srcdir)/tui/tui-source.c $(defs_h) $(symtab_h) $(frame_h) \ $(breakpoint_h) $(source_h) $(symtab_h) $(tui_h) $(tui_data_h) \ - $(tui_stack_h) $(tui_winsource_h) $(tui_source_h) + $(tui_stack_h) $(tui_winsource_h) $(tui_source_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-source.c tui-stack.o: $(srcdir)/tui/tui-stack.c $(defs_h) $(symtab_h) $(breakpoint_h) \ - $(frame_h) $(command_h) $(inferior_h) $(target_h) $(top_h) $(tui_h) \ - $(tui_data_h) $(tui_stack_h) $(tui_wingeneral_h) $(tui_source_h) \ - $(tui_winsource_h) $(tui_file_h) + $(frame_h) $(command_h) $(inferior_h) $(target_h) $(top_h) \ + $(gdb_string_h) $(tui_h) $(tui_data_h) $(tui_stack_h) \ + $(tui_wingeneral_h) $(tui_source_h) $(tui_winsource_h) $(tui_file_h) \ + $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-stack.c tui-win.o: $(srcdir)/tui/tui-win.c $(defs_h) $(command_h) $(symtab_h) \ $(breakpoint_h) $(frame_h) $(cli_cmds_h) $(top_h) $(source_h) \ $(tui_h) $(tui_data_h) $(tui_wingeneral_h) $(tui_stack_h) \ $(tui_regs_h) $(tui_disasm_h) $(tui_source_h) $(tui_winsource_h) \ - $(tui_windata_h) + $(tui_windata_h) $(gdb_curses_h) $(gdb_string_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-win.c tui-windata.o: $(srcdir)/tui/tui-windata.c $(defs_h) $(tui_h) $(tui_data_h) \ - $(tui_wingeneral_h) $(tui_regs_h) + $(tui_wingeneral_h) $(tui_regs_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-windata.c tui-wingeneral.o: $(srcdir)/tui/tui-wingeneral.c $(defs_h) $(tui_h) \ - $(tui_data_h) $(tui_wingeneral_h) $(tui_win_h) + $(tui_data_h) $(tui_wingeneral_h) $(tui_win_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-wingeneral.c tui-winsource.o: $(srcdir)/tui/tui-winsource.c $(defs_h) $(symtab_h) \ $(frame_h) $(breakpoint_h) $(value_h) $(source_h) $(tui_h) \ $(tui_data_h) $(tui_stack_h) $(tui_win_h) $(tui_wingeneral_h) \ - $(tui_winsource_h) $(tui_source_h) $(tui_disasm_h) + $(tui_winsource_h) $(tui_source_h) $(tui_disasm_h) $(gdb_curses_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-winsource.c # @@ -19,7 +19,9 @@ you should upgrade gdbserver on the remote side. The SPARC target has been completely revised, incorporating the FreeBSD/sparc64 support that was added for GDB 6.0. As a result -support for LynxOS and SunOS 4 has been dropped. +support for LynxOS and SunOS 4 has been dropped. Calling functions +from within GDB on operating systems with a non-executable stack +(Solaris, OpenBSD) now works. * New C++ demangler @@ -37,6 +39,8 @@ encountered these. * New native configurations NetBSD/amd64 x86_64-*-netbsd* +OpenBSD/sparc sparc-*-openbsd* +OpenBSD/sparc64 sparc64-*-openbsd* * New debugging protocols diff --git a/gdb/PROBLEMS b/gdb/PROBLEMS index cf60d53..7fd0eb5 100644 --- a/gdb/PROBLEMS +++ b/gdb/PROBLEMS @@ -23,6 +23,18 @@ Fortunately the ARM target, in the GDB's mainline sources, has been updated so people encountering problems should consider downloading a more current GDB (http://www.gnu.org/software/gdb/current). +gdb/1516: [regression] local classes, gcc 2.95.3, dwarf-2 + +With gcc 2.95.3 and the dwarf-2 debugging format, classes which are +defined locally to a function include the demangled name of the function +as part of their name. For example, if a function "foobar" contains a +local class definition "Local", gdb will say that the name of the class +type is "foobar__Fi.0:Local". + +This applies only to classes where the class type is defined inside a +function, not to variables defined with types that are defined somewhere +outside any function (which most types are). + gdb/1091: Constructor breakpoints ignored gdb/1193: g++ 3.3 creates multiple constructors: gdb 5.3 can't set breakpoints diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index f05585f..b97321b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1,5 +1,5 @@ /* Ada language support routines for GDB, the GNU debugger. Copyright - 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003 + 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -8019,6 +8019,7 @@ const struct language_defn ada_language_defn = { NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ #if 0 diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index a166ba5..ce66f30 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1537,8 +1537,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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, - alpha_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, alpha_extract_struct_value_address); /* Settings for calling functions in the inferior. */ set_gdbarch_push_dummy_call (gdbarch, alpha_push_dummy_call); @@ -1555,8 +1554,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_breakpoint_from_pc (gdbarch, alpha_breakpoint_from_pc); set_gdbarch_decr_pc_after_break (gdbarch, 4); - set_gdbarch_frame_args_skip (gdbarch, 0); - /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a5d8a1c..e8c070d 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -143,12 +143,6 @@ generic_remote_translate_xfer_address (struct gdbarch *gdbarch, *rem_len = gdb_len; } -int -generic_prologue_frameless_p (CORE_ADDR ip) -{ - return ip == SKIP_PROLOGUE (ip); -} - /* Helper functions for INNER_THAN */ int diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index f8bd5bb..b15f691 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -61,11 +61,6 @@ extern int legacy_sizeof_call_dummy_words; /* Typical remote_translate_xfer_address */ extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer_address; -/* Generic implementation of prologue_frameless_p. Just calls - SKIP_PROLOG and checks the return value to see if it actually - changed. */ -extern gdbarch_prologue_frameless_p_ftype generic_prologue_frameless_p; - /* The only possible cases for inner_than. */ extern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs); extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index f51b82e..52b57f7 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1188,51 +1188,6 @@ arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame) return frame_unwind_register_unsigned (this_frame, ARM_SP_REGNUM); } -/* Set the return address for a generic dummy frame. ARM uses the - entry point. */ - -static CORE_ADDR -arm_push_return_address (CORE_ADDR pc, CORE_ADDR sp) -{ - write_register (ARM_LR_REGNUM, entry_point_address ()); - return sp; -} - -/* Push an empty stack frame, to record the current PC, etc. */ - -static void -arm_push_dummy_frame (void) -{ - CORE_ADDR old_sp = read_register (ARM_SP_REGNUM); - CORE_ADDR sp = old_sp; - CORE_ADDR fp, prologue_start; - int regnum; - - /* Push the two dummy prologue instructions in reverse order, - so that they'll be in the correct low-to-high order in memory. */ - /* sub fp, ip, #4 */ - sp = push_word (sp, 0xe24cb004); - /* stmdb sp!, {r0-r10, fp, ip, lr, pc} */ - prologue_start = sp = push_word (sp, 0xe92ddfff); - - /* Push a pointer to the dummy prologue + 12, because when stm - instruction stores the PC, it stores the address of the stm - instruction itself plus 12. */ - fp = sp = push_word (sp, prologue_start + 12); - - /* Push the processor status. */ - sp = push_word (sp, read_register (ARM_PS_REGNUM)); - - /* Push all 16 registers starting with r15. */ - for (regnum = ARM_PC_REGNUM; regnum >= 0; regnum--) - sp = push_word (sp, read_register (regnum)); - - /* Update fp (for both Thumb and ARM) and sp. */ - write_register (ARM_FP_REGNUM, fp); - write_register (THUMB_FP_REGNUM, fp); - write_register (ARM_SP_REGNUM, sp); -} - /* DEPRECATED_CALL_DUMMY_WORDS: This sequence of words is the instructions @@ -1266,70 +1221,6 @@ arm_set_call_dummy_breakpoint_offset (void) set_gdbarch_deprecated_call_dummy_breakpoint_offset (current_gdbarch, 8); } -/* Fix up the call dummy, based on whether the processor is currently - in Thumb or ARM mode, and whether the target function is Thumb or - ARM. There are three different situations requiring three - different dummies: - - * ARM calling ARM: uses the call dummy in tm-arm.h, which has already - been copied into the dummy parameter to this function. - * ARM calling Thumb: uses the call dummy in tm-arm.h, but with the - "mov pc,r4" instruction patched to be a "bx r4" instead. - * Thumb calling anything: uses the Thumb dummy defined below, which - works for calling both ARM and Thumb functions. - - All three call dummies expect to receive the target function - address in R4, with the low bit set if it's a Thumb function. */ - -static void -arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, - struct value **args, struct type *type, int gcc_p) -{ - static short thumb_dummy[4] = - { - 0xf000, 0xf801, /* bl label */ - 0xdf18, /* swi 24 */ - 0x4720, /* label: bx r4 */ - }; - static unsigned long arm_bx_r4 = 0xe12fff14; /* bx r4 instruction */ - - /* Set flag indicating whether the current PC is in a Thumb function. */ - caller_is_thumb = arm_pc_is_thumb (read_pc ()); - arm_set_call_dummy_breakpoint_offset (); - - /* If the target function is Thumb, set the low bit of the function - address. And if the CPU is currently in ARM mode, patch the - second instruction of call dummy to use a BX instruction to - switch to Thumb mode. */ - target_is_thumb = arm_pc_is_thumb (fun); - if (target_is_thumb) - { - fun |= 1; - if (!caller_is_thumb) - store_unsigned_integer (dummy + 4, sizeof (arm_bx_r4), arm_bx_r4); - } - - /* If the CPU is currently in Thumb mode, use the Thumb call dummy - instead of the ARM one that's already been copied. This will - work for both Thumb and ARM target functions. */ - if (caller_is_thumb) - { - int i; - char *p = dummy; - int len = sizeof (thumb_dummy) / sizeof (thumb_dummy[0]); - - for (i = 0; i < len; i++) - { - store_unsigned_integer (p, sizeof (thumb_dummy[0]), thumb_dummy[i]); - p += sizeof (thumb_dummy[0]); - } - } - - /* Put the target address in r4; the call dummy will copy this to - the PC. */ - write_register (4, fun); -} - /* When arguments must be pushed onto the stack, they go on in reverse order. The code below implements a FILO (stack) to do this. */ @@ -2875,7 +2766,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, arm_frameless_function_invocation); - set_gdbarch_frame_args_skip (gdbarch, 0); frame_base_set_default (gdbarch, &arm_normal_base); @@ -2923,8 +2813,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value); set_gdbarch_store_return_value (gdbarch, arm_store_return_value); set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention); - set_gdbarch_extract_struct_value_address (gdbarch, - arm_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, arm_extract_struct_value_address); /* Single stepping. */ /* XXX For an RDI target we should ask the target if it can single-step. */ diff --git a/gdb/auxv.c b/gdb/auxv.c new file mode 100644 index 0000000..c28014c --- /dev/null +++ b/gdb/auxv.c @@ -0,0 +1,301 @@ +/* Auxiliary vector support for GDB, the GNU debugger. + + Copyright 2004 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "target.h" +#include "gdbtypes.h" +#include "command.h" +#include "inferior.h" +#include "valprint.h" +#include "gdb_assert.h" + +#include "auxv.h" +#include "elf/common.h" + +#include <unistd.h> +#include <fcntl.h> + + +/* This function is called like a to_xfer_partial hook, + but must be called with TARGET_OBJECT_AUXV. + It handles access via /proc/PID/auxv, which is the common method. + This function is appropriate for doing: + #define NATIVE_XFER_AUXV procfs_xfer_auxv + for a native target that uses inftarg.c's child_xfer_partial hook. */ + +LONGEST +procfs_xfer_auxv (struct target_ops *ops, + int /* enum target_object */ object, + const char *annex, + void *readbuf, + const void *writebuf, + ULONGEST offset, + LONGEST len) +{ + char *pathname; + int fd; + LONGEST n; + + gdb_assert (object == TARGET_OBJECT_AUXV); + gdb_assert (readbuf || writebuf); + + pathname = xstrprintf ("/proc/%d/auxv", PIDGET (inferior_ptid)); + fd = open (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY); + xfree (pathname); + if (fd < 0) + return -1; + + if (offset != (ULONGEST) 0 + && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) + n = -1; + else if (readbuf != NULL) + n = read (fd, readbuf, len); + else + n = write (fd, writebuf, len); + + (void) close (fd); + + return n; +} + +/* Read all the auxv data into a contiguous xmalloc'd buffer, + stored in *DATA. Return the size in bytes of this data. + If zero, there is no data and *DATA is null. + if < 0, there was an error and *DATA is null. */ +LONGEST +target_auxv_read (struct target_ops *ops, char **data) +{ + size_t auxv_alloc = 512, auxv_pos = 0; + char *auxv = xmalloc (auxv_alloc); + int n; + + while (1) + { + n = target_read_partial (ops, TARGET_OBJECT_AUXV, + NULL, &auxv[auxv_pos], 0, + auxv_alloc - auxv_pos); + if (n <= 0) + break; + auxv_pos += n; + if (auxv_pos < auxv_alloc) /* Read all there was. */ + break; + gdb_assert (auxv_pos == auxv_alloc); + auxv_alloc *= 2; + auxv = xrealloc (auxv, auxv_alloc); + } + + if (auxv_pos == 0) + { + xfree (auxv); + *data = NULL; + return n; + } + + *data = auxv; + return auxv_pos; +} + +/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. + Return 0 if *READPTR is already at the end of the buffer. + Return -1 if there is insufficient buffer for a whole entry. + Return 1 if an entry was read into *TYPEP and *VALP. */ +int +target_auxv_parse (struct target_ops *ops, char **readptr, char *endptr, + CORE_ADDR *typep, CORE_ADDR *valp) +{ + const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr); + char *ptr = *readptr; + + if (endptr == ptr) + return 0; + + if (endptr - ptr < sizeof_auxv_field * 2) + return -1; + + *typep = extract_unsigned_integer (ptr, sizeof_auxv_field); + ptr += sizeof_auxv_field; + *valp = extract_unsigned_integer (ptr, sizeof_auxv_field); + ptr += sizeof_auxv_field; + + *readptr = ptr; + return 1; +} + +/* Extract the auxiliary vector entry with a_type matching MATCH. + Return zero if no such entry was found, or -1 if there was + an error getting the information. On success, return 1 after + storing the entry's value field in *VALP. */ +int +target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp) +{ + CORE_ADDR type, val; + char *data; + int n = target_auxv_read (ops, &data); + char *ptr = data; + int ents = 0; + + if (n <= 0) + return n; + + while (1) + switch (target_auxv_parse (ops, &ptr, data + n, &type, &val)) + { + case 1: /* Here's an entry, check it. */ + if (type == match) + { + xfree (data); + *valp = val; + return 1; + } + break; + case 0: /* End of the vector. */ + xfree (data); + return 0; + default: /* Bogosity. */ + xfree (data); + return -1; + } + + /*NOTREACHED*/ +} + + +/* Print the contents of the target's AUXV on the specified file. */ +int +fprint_target_auxv (struct ui_file *file, struct target_ops *ops) +{ + CORE_ADDR type, val; + char *data; + int len = target_auxv_read (ops, &data); + char *ptr = data; + int ents = 0; + + if (len <= 0) + return len; + + while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0) + { + extern int addressprint; + const char *name = "???"; + const char *description = ""; + enum { dec, hex, str } flavor = hex; + + switch (type) + { +#define TAG(tag, text, kind) \ + case tag: name = #tag; description = text; flavor = kind; break + TAG (AT_NULL, "End of vector", hex); + TAG (AT_IGNORE, "Entry should be ignored", hex); + TAG (AT_EXECFD, "File descriptor of program", dec); + TAG (AT_PHDR, "Program headers for program", hex); + TAG (AT_PHENT, "Size of program header entry", dec); + TAG (AT_PHNUM, "Number of program headers", dec); + TAG (AT_PAGESZ, "System page size", dec); + TAG (AT_BASE, "Base address of interpreter", hex); + TAG (AT_FLAGS, "Flags", hex); + TAG (AT_ENTRY, "Entry point of program", hex); + TAG (AT_NOTELF, "Program is not ELF", dec); + TAG (AT_UID, "Real user ID", dec); + TAG (AT_EUID, "Effective user ID", dec); + TAG (AT_GID, "Real group ID", dec); + TAG (AT_EGID, "Effective group ID", dec); + TAG (AT_CLKTCK, "Frequency of times()", dec); + TAG (AT_PLATFORM, "String identifying platform", str); + TAG (AT_HWCAP, "Machine-dependent CPU capability hints", hex); + TAG (AT_FPUCW, "Used FPU control word", dec); + TAG (AT_DCACHEBSIZE, "Data cache block size", dec); + TAG (AT_ICACHEBSIZE, "Instruction cache block size", dec); + TAG (AT_UCACHEBSIZE, "Unified cache block size", dec); + TAG (AT_IGNOREPPC, "Entry should be ignored", dec); + TAG (AT_SYSINFO, "Special system info/entry points", hex); + TAG (AT_SYSINFO_EHDR, "System-supplied DSO's ELF header", hex); + TAG (AT_SECURE, "Boolean, was exec setuid-like?", dec); + TAG (AT_SUN_UID, "Effective user ID", dec); + TAG (AT_SUN_RUID, "Real user ID", dec); + TAG (AT_SUN_GID, "Effective group ID", dec); + TAG (AT_SUN_RGID, "Real group ID", dec); + TAG (AT_SUN_LDELF, "Dynamic linker's ELF header", hex); + TAG (AT_SUN_LDSHDR, "Dynamic linker's section headers", hex); + TAG (AT_SUN_LDNAME, "String giving name of dynamic linker", str); + TAG (AT_SUN_LPAGESZ, "Large pagesize", dec); + TAG (AT_SUN_PLATFORM, "Platform name string", str); + TAG (AT_SUN_HWCAP, "Machine-dependent CPU capability hints", hex); + TAG (AT_SUN_IFLUSH, "Should flush icache?", dec); + TAG (AT_SUN_CPU, "CPU name string", str); + TAG (AT_SUN_EMUL_ENTRY, "COFF entry point address", hex); + TAG (AT_SUN_EMUL_EXECFD, "COFF executable file descriptor", dec); + TAG (AT_SUN_EXECNAME, + "Canonicalized file name given to execve", str); + TAG (AT_SUN_MMU, "String for name of MMU module", str); + TAG (AT_SUN_LDDATA, "Dynamic linker's data segment address", hex); + } + + fprintf_filtered (file, "%-4s %-20s %-30s ", + paddr_d (type), name, description); + switch (flavor) + { + case dec: + fprintf_filtered (file, "%s\n", paddr_d (val)); + break; + case hex: + fprintf_filtered (file, "0x%s\n", paddr_nz (val)); + break; + case str: + if (addressprint) + fprintf_filtered (file, "0x%s", paddr_nz (val)); + val_print_string (val, -1, 1, file); + fprintf_filtered (file, "\n"); + break; + } + ++ents; + } + + xfree (data); + + return ents; +} + +static void +info_auxv_command (char *cmd, int from_tty) +{ + + if (! target_has_stack) + error ("The program has no auxiliary information now."); + else + { + int ents = fprint_target_auxv (gdb_stdout, ¤t_target); + if (ents < 0) + error ("No auxilary vector found, or failed reading it."); + else if (ents == 0) + error ("Auxilary vector is empty."); + } +} + + +extern initialize_file_ftype _initialize_auxv; /* -Wmissing-prototypes; */ + +void +_initialize_auxv (void) +{ + add_info ("auxv", info_auxv_command, + "Display the inferior's auxiliary vector.\n\ +This is information provided by the operating system at program startup."); +} diff --git a/gdb/auxv.h b/gdb/auxv.h new file mode 100644 index 0000000..4ce0569 --- /dev/null +++ b/gdb/auxv.h @@ -0,0 +1,75 @@ +/* Auxiliary vector support for GDB, the GNU debugger. + + Copyright 2004 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 AUXV_H +#define AUXV_H + +/* See "include/elf/common.h" for the definition of valid AT_* values. */ + + +/* Avoid miscellaneous includes in this file, so that it can be + included by nm-*.h for the procfs_xfer_auxv decl if that is + used in NATIVE_XFER_AUXV. */ +struct target_ops; /* Forward declaration. */ + + +/* Read all the auxv data into a contiguous xmalloc'd buffer, + stored in *DATA. Return the size in bytes of this data. + If zero, there is no data and *DATA is null. + if < 0, there was an error and *DATA is null. */ +extern LONGEST target_auxv_read (struct target_ops *ops, char **data); + +/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. + Return 0 if *READPTR is already at the end of the buffer. + Return -1 if there is insufficient buffer for a whole entry. + Return 1 if an entry was read into *TYPEP and *VALP. */ +extern int target_auxv_parse (struct target_ops *ops, + char **readptr, char *endptr, + CORE_ADDR *typep, CORE_ADDR *valp); + +/* Extract the auxiliary vector entry with a_type matching MATCH. + Return zero if no such entry was found, or -1 if there was + an error getting the information. On success, return 1 after + storing the entry's value field in *VALP. */ +extern int target_auxv_search (struct target_ops *ops, + CORE_ADDR match, CORE_ADDR *valp); + +/* Print the contents of the target's AUXV on the specified file. */ +extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops); + + +/* This function is called like a to_xfer_partial hook, + but must be called with TARGET_OBJECT_AUXV. + It handles access via /proc/PID/auxv, which is the common method. + This function is appropriate for doing: + #define NATIVE_XFER_AUXV procfs_xfer_auxv + for a native target that uses inftarg.c's child_xfer_partial hook. */ + +extern LONGEST procfs_xfer_auxv (struct target_ops *ops, + int /* enum target_object */ object, + const char *annex, + void *readbuf, + const void *writebuf, + ULONGEST offset, + LONGEST len); + + +#endif diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index b381adf..108732b 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for Atmel AVR, for GDB. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -226,12 +226,6 @@ avr_make_iaddr (CORE_ADDR x) return ((x) | AVR_IMEM_START); } -static int -avr_iaddr_p (CORE_ADDR x) -{ - return (((x) & AVR_MEM_MASK) == AVR_IMEM_START); -} - /* FIXME: TRoth: Really need to use a larger mask for instructions. Some devices are already up to 128KBytes of flash space. @@ -251,12 +245,6 @@ avr_make_saddr (CORE_ADDR x) return ((x) | AVR_SMEM_START); } -static int -avr_saddr_p (CORE_ADDR x) -{ - return (((x) & AVR_MEM_MASK) == AVR_SMEM_START); -} - static CORE_ADDR avr_convert_saddr_to_raw (CORE_ADDR x) { @@ -1321,7 +1309,6 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index cacf308..dadad8e 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -620,7 +620,12 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) case LOC_COMPUTED: case LOC_COMPUTED_ARG: - (*SYMBOL_LOCATION_FUNCS (var)->tracepoint_var_ref) (var, ax, value); + /* FIXME: cagney/2004-01-26: It should be possible to + unconditionally call the SYMBOL_OPS method when available. + Unfortunately DWARF 2 stores the frame-base (instead of the + function) location in a function's symbol. Oops! For the + moment enable this when/where applicable. */ + SYMBOL_OPS (var)->tracepoint_var_ref (var, ax, value); break; case LOC_OPTIMIZED_OUT: diff --git a/gdb/bcache.c b/gdb/bcache.c index b1d9de8..cadadb5 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -266,7 +266,10 @@ bcache_xmalloc (void) { /* Allocate the bcache pre-zeroed. */ struct bcache *b = XCALLOC (1, struct bcache); - obstack_specify_allocation (&b->cache, 0, 0, xmalloc, xfree); + /* We could use obstack_specify_allocation here instead, but + gdb_obstack.h specifies the allocation/deallocation + functions. */ + obstack_init (&b->cache); return b; } diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 4a7a380..701d986 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -156,11 +156,18 @@ inside_main_func (CORE_ADDR pc) && symfile_objfile->ei.main_func_highpc > pc); } -/* Test whether PC is inside the range of addresses that corresponds - to the process entry point function. */ +/* Test whether THIS_FRAME is inside the process entry point function. */ int -inside_entry_func (CORE_ADDR pc) +inside_entry_func (struct frame_info *this_frame) +{ + return (get_frame_func (this_frame) == entry_point_address ()); +} + +/* Similar to inside_entry_func, but accomodating legacy frame code. */ + +static int +legacy_inside_entry_func (CORE_ADDR pc) { if (symfile_objfile == 0) return 0; @@ -192,9 +199,16 @@ frameless_look_for_prologue (struct frame_info *frame) if (func_start) { func_start += FUNCTION_START_OFFSET; - /* This is faster, since only care whether there *is* a - prologue, not how long it is. */ - return PROLOGUE_FRAMELESS_P (func_start); + /* NOTE: cagney/2004-02-09: Eliminated per-architecture + PROLOGUE_FRAMELESS_P call as architectures with custom + implementations had all been deleted. Eventually even this + function can go - GDB no longer tries to differentiate + between framed, frameless and stackless functions. They are + all now considered equally evil :-^. */ + /* If skipping the prologue ends up skips nothing, there must be + no prologue and hence no code creating a frame. There for + the function is "frameless" :-/. */ + return func_start == SKIP_PROLOGUE (func_start); } else if (get_frame_pc (frame) == 0) /* A frame with a zero PC is usually created by dereferencing a @@ -500,10 +514,24 @@ int find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, CORE_ADDR *endaddr) { - asection *section; - - section = find_pc_overlay (pc); - return find_pc_sect_partial_function (pc, section, name, address, endaddr); + struct bfd_section *bfd_section; + + /* To ensure that the symbol returned belongs to the correct setion + (and that the last [random] symbol from the previous section + isn't returned) try to find the section containing PC. First try + the overlay code (which by default returns NULL); and second try + the normal section code (which almost always succeeds). */ + bfd_section = find_pc_overlay (pc); + if (bfd_section == NULL) + { + struct obj_section *obj_section = find_pc_section (pc); + if (obj_section == NULL) + bfd_section = NULL; + else + bfd_section = obj_section->the_bfd_section; + } + return find_pc_sect_partial_function (pc, bfd_section, name, address, + endaddr); } /* Return the innermost stack frame executing inside of BLOCK, @@ -604,7 +632,7 @@ legacy_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) /* If we're already inside the entry function for the main objfile, then it isn't valid. */ - if (inside_entry_func (get_frame_pc (fi))) + if (legacy_inside_entry_func (get_frame_pc (fi))) return 0; /* If we're inside the entry file, it isn't valid. */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 19e8454..a4cfa46 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -89,7 +89,7 @@ extern void break_at_finish_at_depth_command (char *, int); extern void tbreak_at_finish_command (char *, int); -static void break_command_1 (char *, int, int); +static int break_command_1 (char *, int, int, struct breakpoint *); static void mention (struct breakpoint *); @@ -119,6 +119,8 @@ static void condition_command (char *, int); static int get_number_trailer (char **, int); +static int do_captured_parse_breakpoint (struct ui_out *, void *); + void set_breakpoint_count (int); typedef enum @@ -193,10 +195,6 @@ static char *ep_parse_optional_if_clause (char **arg); static char *ep_parse_optional_filename (char **arg); -#if defined(CHILD_INSERT_EXEC_CATCHPOINT) -static void catch_exec_command_1 (char *arg, int tempflag, int from_tty); -#endif - static void create_exception_catchpoint (int tempflag, char *cond_string, enum exception_event_kind ex_event, struct symtab_and_line *sal); @@ -326,7 +324,7 @@ int exception_support_initialized = 0; static int breakpoint_enabled (struct breakpoint *b) { - return b->enable_state == bp_enabled; + return (b->enable_state == bp_enabled && !b->pending); } /* Set breakpoint count to NUM. */ @@ -560,9 +558,12 @@ condition_command (char *arg, int from_tty) /* I don't know if it matters whether this is the string the user typed in or the decompiled expression. */ b->cond_string = savestring (arg, strlen (arg)); - b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); - if (*arg) - error ("Junk at end of expression"); + if (!b->pending) + { + b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); + if (*arg) + error ("Junk at end of expression"); + } } breakpoints_changed (); breakpoint_modify_event (b->number); @@ -1721,6 +1722,37 @@ breakpoint_inserted_here_p (CORE_ADDR pc) return 0; } +/* This function returns non-zero iff there is a software breakpoint + inserted at PC. */ + +int +software_breakpoint_inserted_here_p (CORE_ADDR pc) +{ + struct bp_location *bpt; + int any_breakpoint_here = 0; + + ALL_BP_LOCATIONS (bpt) + { + if (bpt->loc_type != bp_loc_software_breakpoint) + continue; + + if ((breakpoint_enabled (bpt->owner) + || bpt->owner->enable_state == bp_permanent) + && bpt->inserted + && bpt->address == pc) /* bp is enabled and matches pc */ + { + if (overlay_debugging + && section_is_overlay (bpt->section) + && !section_is_mapped (bpt->section)) + continue; /* unmapped overlay -- can't be a match */ + else + return 1; + } + } + + return 0; +} + /* Return nonzero if FRAME is a dummy frame. We can't use DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would take too much time, at least using frame_register() on the 68k. @@ -2455,9 +2487,6 @@ watchpoint_check (void *p) struct breakpoint *b; struct frame_info *fr; int within_current_scope; -#if 0 - struct frame_id current_frame_id; -#endif b = bs->breakpoint_at; @@ -2546,11 +2575,8 @@ which its expression is valid.\n"); } } -/* Get a bpstat associated with having just stopped at address *PC - and frame address CORE_ADDRESS. Update *PC to point at the - breakpoint (if we hit a breakpoint). NOT_A_SW_BREAKPOINT is nonzero - if this is known to not be a real breakpoint (it could still be a - watchpoint, though). */ +/* Get a bpstat associated with having just stopped at address + BP_ADDR. */ /* Determine whether we stopped at a breakpoint, etc, or whether we don't understand this stop. Result is a chain of bpstat's such that: @@ -2567,24 +2593,16 @@ which its expression is valid.\n"); commands, FIXME??? fields. */ bpstat -bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) +bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) { struct breakpoint *b, *temp; - CORE_ADDR bp_addr; /* True if we've hit a breakpoint (as opposed to a watchpoint). */ int real_breakpoint = 0; /* Root of the chain of bpstat's */ struct bpstats root_bs[1]; /* Pointer to the last thing in the chain currently. */ bpstat bs = root_bs; - - /* Get the address where the breakpoint would have been. The - "not_a_sw_breakpoint" argument is meant to distinguish between a - breakpoint trap event and a trace/singlestep trap event. For a - trace/singlestep trap event, we would not want to subtract - DECR_PC_AFTER_BREAK from the PC. */ - - bp_addr = *pc - (not_a_sw_breakpoint ? 0 : DECR_PC_AFTER_BREAK); + int thread_id = pid_to_thread_id (ptid); ALL_BREAKPOINTS_SAFE (b, temp) { @@ -2612,7 +2630,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) if (b->type == bp_hardware_breakpoint) { - if (b->loc->address != *pc) + if (b->loc->address != bp_addr) continue; if (overlay_debugging /* unmapped overlay section */ && section_is_overlay (b->loc->section) @@ -2838,6 +2856,12 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) /* Don't consider this a hit. */ --(b->hit_count); } + else if (b->thread != -1 && b->thread != thread_id) + { + bs->stop = 0; + /* Don't consider this a hit. */ + --(b->hit_count); + } else if (b->ignore_count > 0) { b->ignore_count--; @@ -2870,18 +2894,6 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) bs->next = NULL; /* Terminate the chain */ bs = root_bs->next; /* Re-grab the head of the chain */ - if (real_breakpoint && bs) - { - if (bs->breakpoint_at->type != bp_hardware_breakpoint) - { - if (DECR_PC_AFTER_BREAK != 0) - { - *pc = bp_addr; - write_pc (bp_addr); - } - } - } - /* The value of a hardware watchpoint hasn't changed, but the intermediate memory locations we are watching may have. */ if (bs && !bs->stop && @@ -3458,7 +3470,16 @@ print_one_breakpoint (struct breakpoint *b, if (addressprint) { annotate_field (4); - ui_out_field_core_addr (uiout, "addr", b->loc->address); + if (b->pending) + { + ui_out_field_string (uiout, "addr", "<PENDING>"); + if (TARGET_ADDR_BIT <= 32) + ui_out_spaces (uiout, 2); + else + ui_out_spaces (uiout, 8); + } + else + ui_out_field_core_addr (uiout, "addr", b->loc->address); } annotate_field (5); *last_addr = b->loc->address; @@ -3477,6 +3498,10 @@ print_one_breakpoint (struct breakpoint *b, ui_out_text (uiout, ":"); ui_out_field_int (uiout, "line", b->line_number); } + else if (b->pending) + { + ui_out_field_string (uiout, "pending", b->addr_string); + } else { print_address_symbolic (b->loc->address, stb->stream, demangle, ""); @@ -3513,7 +3538,15 @@ print_one_breakpoint (struct breakpoint *b, ui_out_field_stream (uiout, "cond", stb); ui_out_text (uiout, "\n"); } - + + if (b->pending && b->cond_string) + { + annotate_field (7); + ui_out_text (uiout, "\tstop only if "); + ui_out_field_string (uiout, "cond", b->cond_string); + ui_out_text (uiout, "\n"); + } + if (b->thread != -1) { /* FIXME should make an annotation for this */ @@ -3744,14 +3777,14 @@ describe_other_breakpoints (CORE_ADDR pc, asection *section) ALL_BREAKPOINTS (b) if (b->loc->address == pc) /* address match / overlay match */ - if (!overlay_debugging || b->loc->section == section) + if (!b->pending && (!overlay_debugging || b->loc->section == section)) others++; if (others > 0) { printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : ""); ALL_BREAKPOINTS (b) if (b->loc->address == pc) /* address match / overlay match */ - if (!overlay_debugging || b->loc->section == section) + if (!b->pending && (!overlay_debugging || b->loc->section == section)) { others--; printf_filtered ("%d%s%s ", @@ -3840,6 +3873,7 @@ check_duplicates (struct breakpoint *bpt) ALL_BP_LOCATIONS (b) if (b->owner->enable_state != bp_disabled && b->owner->enable_state != bp_shlib_disabled + && !b->owner->pending && b->owner->enable_state != bp_call_disabled && b->address == address /* address / overlay match */ && (!overlay_debugging || b->section == section) @@ -3874,6 +3908,7 @@ check_duplicates (struct breakpoint *bpt) { if (b->owner->enable_state != bp_disabled && b->owner->enable_state != bp_shlib_disabled + && !b->owner->pending && b->owner->enable_state != bp_call_disabled && b->address == address /* address / overlay match */ && (!overlay_debugging || b->section == section) @@ -4050,6 +4085,7 @@ set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) b->forked_inferior_pid = 0; b->exec_pathname = NULL; b->ops = NULL; + b->pending = 0; /* Add this breakpoint to the end of the chain so that a list of breakpoints will come out in order @@ -4233,6 +4269,66 @@ remove_thread_event_breakpoints (void) delete_breakpoint (b); } +struct captured_parse_breakpoint_args + { + char **arg_p; + struct symtabs_and_lines *sals_p; + char ***addr_string_p; + int *not_found_ptr; + }; + +struct lang_and_radix + { + enum language lang; + int radix; + }; + +/* Cleanup helper routine to restore the current language and + input radix. */ +static void +do_restore_lang_radix_cleanup (void *old) +{ + struct lang_and_radix *p = old; + set_language (p->lang); + input_radix = p->radix; +} + +/* Try and resolve a pending breakpoint. */ +static int +resolve_pending_breakpoint (struct breakpoint *b) +{ + /* Try and reparse the breakpoint in case the shared library + is now loaded. */ + struct symtabs_and_lines sals; + struct symtab_and_line pending_sal; + char **cond_string = (char **) NULL; + char *copy_arg = b->addr_string; + char **addr_string; + char *errmsg; + int rc; + int not_found = 0; + struct ui_file *old_gdb_stderr; + struct lang_and_radix old_lr; + struct cleanup *old_chain; + + /* Set language, input-radix, then reissue breakpoint command. + Ensure the language and input-radix are restored afterwards. */ + old_lr.lang = current_language->la_language; + old_lr.radix = input_radix; + old_chain = make_cleanup (do_restore_lang_radix_cleanup, &old_lr); + + set_language (b->language); + input_radix = b->input_radix; + rc = break_command_1 (b->addr_string, b->flag, b->from_tty, b); + + if (rc == GDB_RC_OK) + /* Pending breakpoint has been resolved. */ + printf_filtered ("Pending breakpoint \"%s\" resolved\n", b->addr_string); + + do_cleanups (old_chain); + return rc; +} + #ifdef SOLIB_ADD void remove_solib_event_breakpoints (void) @@ -4292,19 +4388,26 @@ disable_breakpoints_in_shlibs (int silent) void re_enable_breakpoints_in_shlibs (void) { - struct breakpoint *b; + struct breakpoint *b, *tmp; - ALL_BREAKPOINTS (b) + ALL_BREAKPOINTS_SAFE (b, tmp) + { if (b->enable_state == bp_shlib_disabled) - { - char buf[1], *lib; - - /* Do not reenable the breakpoint if the shared library - is still not mapped in. */ - lib = PC_SOLIB (b->loc->address); - if (lib != NULL && target_read_memory (b->loc->address, buf, 1) == 0) - b->enable_state = bp_enabled; - } + { + char buf[1], *lib; + + /* Do not reenable the breakpoint if the shared library + is still not mapped in. */ + lib = PC_SOLIB (b->loc->address); + if (lib != NULL && target_read_memory (b->loc->address, buf, 1) == 0) + b->enable_state = bp_enabled; + } + else if (b->pending && (b->enable_state == bp_enabled)) + { + if (resolve_pending_breakpoint (b) == GDB_RC_OK) + delete_breakpoint (b); + } + } } #endif @@ -4716,14 +4819,21 @@ mention (struct breakpoint *b) if (say_where) { - if (addressprint || b->source_file == NULL) + if (b->pending) { - printf_filtered (" at "); - print_address_numeric (b->loc->address, 1, gdb_stdout); + printf_filtered (" (%s) pending.", b->addr_string); + } + else + { + if (addressprint || b->source_file == NULL) + { + printf_filtered (" at "); + print_address_numeric (b->loc->address, 1, gdb_stdout); + } + if (b->source_file) + printf_filtered (": file %s, line %d.", + b->source_file, b->line_number); } - if (b->source_file) - printf_filtered (": file %s, line %d.", - b->source_file, b->line_number); } do_cleanups (old_chain); if (ui_out_is_mi_like_p (uiout)) @@ -4736,6 +4846,11 @@ mention (struct breakpoint *b) SALS.sal[i] breakpoint, include the corresponding ADDR_STRING[i], COND[i] and COND_STRING[i] values. + The parameter PENDING_BP points to a pending breakpoint that is + the basis of the breakpoints currently being created. The pending + breakpoint may contain a separate condition string or commands + that were added after the initial pending breakpoint was created. + NOTE: If the function succeeds, the caller is expected to cleanup the arrays ADDR_STRING, COND_STRING, COND and SALS (but not the array contents). If the function fails (error() is called), the @@ -4746,7 +4861,8 @@ static void create_breakpoints (struct symtabs_and_lines sals, char **addr_string, struct expression **cond, char **cond_string, enum bptype type, enum bpdisp disposition, - int thread, int ignore_count, int from_tty) + int thread, int ignore_count, int from_tty, + struct breakpoint *pending_bp) { if (type == bp_hardware_breakpoint) { @@ -4786,6 +4902,26 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, b->ignore_count = ignore_count; b->enable_state = bp_enabled; b->disposition = disposition; + /* If resolving a pending breakpoint, a check must be made to see if + the user has specified a new condition or commands for the + breakpoint. A new condition will override any condition that was + initially specified with the initial breakpoint command. */ + if (pending_bp) + { + char *arg; + if (pending_bp->cond_string) + { + arg = pending_bp->cond_string; + b->cond_string = savestring (arg, strlen (arg)); + b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); + if (*arg) + error ("Junk at end of pending breakpoint condition expression"); + } + /* If there are commands associated with the breakpoint, they should + be copied too. */ + if (pending_bp->commands) + b->commands = copy_command_lines (pending_bp->commands); + } mention (b); } } @@ -4799,7 +4935,8 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, static void parse_breakpoint_sals (char **address, struct symtabs_and_lines *sals, - char ***addr_string) + char ***addr_string, + int *not_found_ptr) { char *addr_start = *address; *addr_string = NULL; @@ -4840,9 +4977,11 @@ parse_breakpoint_sals (char **address, || ((strchr ("+-", (*address)[0]) != NULL) && ((*address)[1] != '[')))) *sals = decode_line_1 (address, 1, default_breakpoint_symtab, - default_breakpoint_line, addr_string, NULL); + default_breakpoint_line, addr_string, + not_found_ptr); else - *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, addr_string, NULL); + *sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0, + addr_string, not_found_ptr); } /* For any SAL that didn't have a canonical string, fill one in. */ if (sals->nelts > 0 && *addr_string == NULL) @@ -4896,26 +5035,44 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals, } } +static int +do_captured_parse_breakpoint (struct ui_out *ui, void *data) +{ + struct captured_parse_breakpoint_args *args = data; + + parse_breakpoint_sals (args->arg_p, args->sals_p, args->addr_string_p, + args->not_found_ptr); + + return GDB_RC_OK; +} + /* Set a breakpoint according to ARG (function, linenum or *address) flag: first bit : 0 non-temporary, 1 temporary. - second bit : 0 normal breakpoint, 1 hardware breakpoint. */ + second bit : 0 normal breakpoint, 1 hardware breakpoint. -static void -break_command_1 (char *arg, int flag, int from_tty) + PENDING_BP is non-NULL when this function is being called to resolve + a pending breakpoint. */ + +static int +break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_bp) { int tempflag, hardwareflag; struct symtabs_and_lines sals; struct expression **cond = 0; - /* Pointers in arg to the start, and one past the end, of the - condition. */ + struct symtab_and_line pending_sal; char **cond_string = (char **) NULL; + char *copy_arg; + char *err_msg; char *addr_start = arg; char **addr_string; struct cleanup *old_chain; struct cleanup *breakpoint_chain = NULL; - int i; + struct captured_parse_breakpoint_args parse_args; + int i, rc; + int pending = 0; int thread = -1; int ignore_count = 0; + int not_found = 0; hardwareflag = flag & BP_HARDWAREFLAG; tempflag = flag & BP_TEMPFLAG; @@ -4923,19 +5080,55 @@ break_command_1 (char *arg, int flag, int from_tty) sals.sals = NULL; sals.nelts = 0; addr_string = NULL; - parse_breakpoint_sals (&arg, &sals, &addr_string); - if (!sals.nelts) - return; + parse_args.arg_p = &arg; + parse_args.sals_p = &sals; + parse_args.addr_string_p = &addr_string; + parse_args.not_found_ptr = ¬_found; + + rc = catch_exceptions_with_msg (uiout, do_captured_parse_breakpoint, + &parse_args, NULL, &err_msg, + RETURN_MASK_ALL); + + /* If caller is interested in rc value from parse, set value. */ + + if (rc != GDB_RC_OK) + { + /* Check for file or function not found. */ + if (not_found) + { + /* If called to resolve pending breakpoint, just return error code. */ + if (pending_bp) + return rc; + + error_output_message (NULL, err_msg); + xfree (err_msg); + if (!query ("Make breakpoint pending on future shared library load? ")) + return rc; + copy_arg = xstrdup (addr_start); + addr_string = ©_arg; + sals.nelts = 1; + sals.sals = &pending_sal; + pending_sal.pc = 0; + pending = 1; + } + else + return rc; + } + else if (!sals.nelts) + return GDB_RC_FAIL; /* Create a chain of things that always need to be cleaned up. */ old_chain = make_cleanup (null_cleanup, 0); - /* Make sure that all storage allocated to SALS gets freed. */ - make_cleanup (xfree, sals.sals); - - /* Cleanup the addr_string array but not its contents. */ - make_cleanup (xfree, addr_string); + if (!pending) + { + /* Make sure that all storage allocated to SALS gets freed. */ + make_cleanup (xfree, sals.sals); + + /* Cleanup the addr_string array but not its contents. */ + make_cleanup (xfree, addr_string); + } /* Allocate space for all the cond expressions. */ cond = xcalloc (sals.nelts, sizeof (struct expression *)); @@ -4962,62 +5155,94 @@ break_command_1 (char *arg, int flag, int from_tty) /* Resolve all line numbers to PC's and verify that the addresses are ok for the target. */ - breakpoint_sals_to_pc (&sals, addr_start); + if (!pending) + breakpoint_sals_to_pc (&sals, addr_start); /* Verify that condition can be parsed, before setting any breakpoints. Allocate a separate condition expression for each breakpoint. */ thread = -1; /* No specific thread yet */ - for (i = 0; i < sals.nelts; i++) + if (!pending) { - char *tok = arg; - while (tok && *tok) + for (i = 0; i < sals.nelts; i++) { - char *end_tok; - int toklen; - char *cond_start = NULL; - char *cond_end = NULL; - while (*tok == ' ' || *tok == '\t') - tok++; - - end_tok = tok; - - while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000') - end_tok++; - - toklen = end_tok - tok; - - if (toklen >= 1 && strncmp (tok, "if", toklen) == 0) - { - tok = cond_start = end_tok + 1; - cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0); - make_cleanup (xfree, cond[i]); - cond_end = tok; - cond_string[i] = savestring (cond_start, cond_end - cond_start); - make_cleanup (xfree, cond_string[i]); - } - else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0) + char *tok = arg; + while (tok && *tok) { - char *tmptok; - - tok = end_tok + 1; - tmptok = tok; - thread = strtol (tok, &tok, 0); - if (tok == tmptok) - error ("Junk after thread keyword."); - if (!valid_thread_id (thread)) - error ("Unknown thread %d\n", thread); + char *end_tok; + int toklen; + char *cond_start = NULL; + char *cond_end = NULL; + while (*tok == ' ' || *tok == '\t') + tok++; + + end_tok = tok; + + while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000') + end_tok++; + + toklen = end_tok - tok; + + if (toklen >= 1 && strncmp (tok, "if", toklen) == 0) + { + tok = cond_start = end_tok + 1; + cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), + 0); + make_cleanup (xfree, cond[i]); + cond_end = tok; + cond_string[i] = savestring (cond_start, + cond_end - cond_start); + make_cleanup (xfree, cond_string[i]); + } + else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0) + { + char *tmptok; + + tok = end_tok + 1; + tmptok = tok; + thread = strtol (tok, &tok, 0); + if (tok == tmptok) + error ("Junk after thread keyword."); + if (!valid_thread_id (thread)) + error ("Unknown thread %d\n", thread); + } + else + error ("Junk at end of arguments."); } - else - error ("Junk at end of arguments."); } + create_breakpoints (sals, addr_string, cond, cond_string, + hardwareflag ? bp_hardware_breakpoint + : bp_breakpoint, + tempflag ? disp_del : disp_donttouch, + thread, ignore_count, from_tty, + pending_bp); } - - create_breakpoints (sals, addr_string, cond, cond_string, - hardwareflag ? bp_hardware_breakpoint : bp_breakpoint, - tempflag ? disp_del : disp_donttouch, - thread, ignore_count, from_tty); - + else + { + struct symtab_and_line sal; + struct breakpoint *b; + + sal.symtab = NULL; + sal.pc = 0; + + make_cleanup (xfree, copy_arg); + + b = set_raw_breakpoint (sal, hardwareflag ? bp_hardware_breakpoint + : bp_breakpoint); + set_breakpoint_count (breakpoint_count + 1); + b->number = breakpoint_count; + b->cond = *cond; + b->thread = thread; + b->addr_string = *addr_string; + b->cond_string = *cond_string; + b->ignore_count = ignore_count; + b->pending = 1; + b->disposition = tempflag ? disp_del : disp_donttouch; + b->from_tty = from_tty; + b->flag = flag; + mention (b); + } + if (sals.nelts > 1) { warning ("Multiple breakpoints were set."); @@ -5028,6 +5253,8 @@ break_command_1 (char *arg, int flag, int from_tty) discard_cleanups (breakpoint_chain); /* But cleanup everything else. */ do_cleanups (old_chain); + + return GDB_RC_OK; } /* Set a breakpoint of TYPE/DISPOSITION according to ARG (function, @@ -5064,7 +5291,7 @@ do_captured_breakpoint (void *data) sals.nelts = 0; address_end = args->address; addr_string = NULL; - parse_breakpoint_sals (&address_end, &sals, &addr_string); + parse_breakpoint_sals (&address_end, &sals, &addr_string, 0); if (!sals.nelts) return GDB_RC_NONE; @@ -5128,7 +5355,8 @@ do_captured_breakpoint (void *data) create_breakpoints (sals, addr_string, cond, cond_string, args->hardwareflag ? bp_hardware_breakpoint : bp_breakpoint, args->tempflag ? disp_del : disp_donttouch, - args->thread, args->ignore_count, 0/*from-tty*/); + args->thread, args->ignore_count, 0/*from-tty*/, + NULL/*pending_bp*/); /* That's it. Discard the cleanups for data inserted into the breakpoint. */ @@ -5220,7 +5448,7 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty) addr_string = xstrprintf ("*0x%s %s", paddr_nz (high), extra_args); else addr_string = xstrprintf ("*0x%s", paddr_nz (high)); - break_command_1 (addr_string, flag, from_tty); + break_command_1 (addr_string, flag, from_tty, NULL); xfree (addr_string); } else @@ -5303,7 +5531,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) extra_args); else break_string = xstrprintf ("*0x%s", paddr_nz (high)); - break_command_1 (break_string, flag, from_tty); + break_command_1 (break_string, flag, from_tty, NULL); xfree (break_string); } else @@ -5370,7 +5598,7 @@ resolve_sal_pc (struct symtab_and_line *sal) void break_command (char *arg, int from_tty) { - break_command_1 (arg, 0, from_tty); + break_command_1 (arg, 0, from_tty, NULL); } void @@ -5388,7 +5616,7 @@ break_at_finish_at_depth_command (char *arg, int from_tty) void tbreak_command (char *arg, int from_tty) { - break_command_1 (arg, BP_TEMPFLAG, from_tty); + break_command_1 (arg, BP_TEMPFLAG, from_tty, NULL); } void @@ -5400,13 +5628,13 @@ tbreak_at_finish_command (char *arg, int from_tty) static void hbreak_command (char *arg, int from_tty) { - break_command_1 (arg, BP_HARDWAREFLAG, from_tty); + break_command_1 (arg, BP_HARDWAREFLAG, from_tty, NULL); } static void thbreak_command (char *arg, int from_tty) { - break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty); + break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty, NULL); } static void @@ -5447,7 +5675,7 @@ stopin_command (char *arg, int from_tty) if (badInput) printf_filtered ("Usage: stop in <function | address>\n"); else - break_command_1 (arg, 0, from_tty); + break_command_1 (arg, 0, from_tty, NULL); } static void @@ -5479,7 +5707,7 @@ stopat_command (char *arg, int from_tty) if (badInput) printf_filtered ("Usage: stop at <line>\n"); else - break_command_1 (arg, 0, from_tty); + break_command_1 (arg, 0, from_tty, NULL); } /* accessflag: hw_write: watch write, @@ -5879,30 +6107,6 @@ until_break_command (char *arg, int from_tty, int anywhere) do_cleanups (old_chain); } -#if 0 -/* These aren't used; I don't konw what they were for. */ -/* Set a breakpoint at the catch clause for NAME. */ -static int -catch_breakpoint (char *name) -{ -} - -static int -disable_catch_breakpoint (void) -{ -} - -static int -delete_catch_breakpoint (void) -{ -} - -static int -enable_catch_breakpoint (void) -{ -} -#endif /* 0 */ - static void ep_skip_leading_whitespace (char **s) { @@ -6017,10 +6221,6 @@ typedef enum } catch_fork_kind; -#if defined(CHILD_INSERT_FORK_CATCHPOINT) || defined(CHILD_INSERT_VFORK_CATCHPOINT) -static void catch_fork_command_1 (catch_fork_kind fork_kind, - char *arg, int tempflag, int from_tty); - static void catch_fork_command_1 (catch_fork_kind fork_kind, char *arg, int tempflag, int from_tty) @@ -6054,9 +6254,7 @@ catch_fork_command_1 (catch_fork_kind fork_kind, char *arg, int tempflag, break; } } -#endif -#if defined(CHILD_INSERT_EXEC_CATCHPOINT) static void catch_exec_command_1 (char *arg, int tempflag, int from_tty) { @@ -6078,9 +6276,7 @@ catch_exec_command_1 (char *arg, int tempflag, int from_tty) and enable reporting of such events. */ create_exec_event_catchpoint (tempflag, cond_string); } -#endif -#if defined(SOLIB_ADD) static void catch_load_command_1 (char *arg, int tempflag, int from_tty) { @@ -6164,7 +6360,6 @@ catch_unload_command_1 (char *arg, int tempflag, int from_tty) SOLIB_CREATE_CATCH_UNLOAD_HOOK (PIDGET (inferior_ptid), tempflag, dll_pathname, cond_string); } -#endif /* SOLIB_ADD */ /* Commands to deal with catching exceptions. */ @@ -6413,43 +6608,23 @@ catch_command_1 (char *arg, int tempflag, int from_tty) } else if (strncmp (arg1_start, "fork", arg1_length) == 0) { -#if defined(CHILD_INSERT_FORK_CATCHPOINT) catch_fork_command_1 (catch_fork, arg1_end + 1, tempflag, from_tty); -#else - error ("Catch of fork not yet implemented"); -#endif } else if (strncmp (arg1_start, "vfork", arg1_length) == 0) { -#if defined(CHILD_INSERT_VFORK_CATCHPOINT) catch_fork_command_1 (catch_vfork, arg1_end + 1, tempflag, from_tty); -#else - error ("Catch of vfork not yet implemented"); -#endif } else if (strncmp (arg1_start, "exec", arg1_length) == 0) { -#if defined(CHILD_INSERT_EXEC_CATCHPOINT) catch_exec_command_1 (arg1_end + 1, tempflag, from_tty); -#else - error ("Catch of exec not yet implemented"); -#endif } else if (strncmp (arg1_start, "load", arg1_length) == 0) { -#if defined(SOLIB_ADD) catch_load_command_1 (arg1_end + 1, tempflag, from_tty); -#else - error ("Catch of load not implemented"); -#endif } else if (strncmp (arg1_start, "unload", arg1_length) == 0) { -#if defined(SOLIB_ADD) catch_unload_command_1 (arg1_end + 1, tempflag, from_tty); -#else - error ("Catch of load not implemented"); -#endif } else if (strncmp (arg1_start, "stop", arg1_length) == 0) { @@ -6483,30 +6658,6 @@ set_breakpoint_sal (struct symtab_and_line sal) return b; } -#if 0 -/* These aren't used; I don't know what they were for. */ -/* Disable breakpoints on all catch clauses described in ARGS. */ -static void -disable_catch (char *args) -{ - /* Map the disable command to catch clauses described in ARGS. */ -} - -/* Enable breakpoints on all catch clauses described in ARGS. */ -static void -enable_catch (char *args) -{ - /* Map the disable command to catch clauses described in ARGS. */ -} - -/* Delete breakpoints on all catch clauses in the active scope. */ -static void -delete_catch (char *args) -{ - /* Map the delete command to catch clauses described in ARGS. */ -} -#endif /* 0 */ - static void catch_command (char *arg, int from_tty) { @@ -6763,6 +6914,7 @@ delete_breakpoint (struct breakpoint *bpt) && !b->loc->duplicate && b->enable_state != bp_disabled && b->enable_state != bp_shlib_disabled + && !b->pending && b->enable_state != bp_call_disabled) { int val; @@ -6968,6 +7120,10 @@ breakpoint_re_set_one (void *bint) shlib_disabled breakpoint though. There's a fair chance we can't re-set it if the shared library it's in hasn't been loaded yet. */ + + if (b->pending) + break; + save_enable = b->enable_state; if (b->enable_state != bp_shlib_disabled) b->enable_state = bp_disabled; @@ -6986,7 +7142,12 @@ breakpoint_re_set_one (void *bint) { s = b->cond_string; if (b->cond) - xfree (b->cond); + { + xfree (b->cond); + /* Avoid re-freeing b->exp if an error during the call + to parse_exp_1. */ + b->cond = NULL; + } b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0); } @@ -7054,12 +7215,22 @@ breakpoint_re_set_one (void *bint) /* So for now, just use a global context. */ if (b->exp) - xfree (b->exp); + { + xfree (b->exp); + /* Avoid re-freeing b->exp if an error during the call to + parse_expression. */ + b->exp = NULL; + } b->exp = parse_expression (b->exp_string); b->exp_valid_block = innermost_block; mark = value_mark (); if (b->val) - value_free (b->val); + { + value_free (b->val); + /* Avoid re-freeing b->val if an error during the call to + evaluate_expression. */ + b->val = NULL; + } b->val = evaluate_expression (b->exp); release_value (b->val); if (VALUE_LAZY (b->val) && breakpoint_enabled (b)) @@ -7069,7 +7240,12 @@ breakpoint_re_set_one (void *bint) { s = b->cond_string; if (b->cond) - xfree (b->cond); + { + xfree (b->cond); + /* Avoid re-freeing b->exp if an error during the call + to parse_exp_1. */ + b->cond = NULL; + } b->cond = parse_exp_1 (&s, (struct block *) 0, 0); } if (breakpoint_enabled (b)) @@ -7363,70 +7539,91 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition) error ("Hardware breakpoints used exceeds limit."); } - if (bpt->enable_state != bp_permanent) - bpt->enable_state = bp_enabled; - bpt->disposition = disposition; - check_duplicates (bpt); - breakpoints_changed (); - - if (bpt->type == bp_watchpoint || - bpt->type == bp_hardware_watchpoint || - bpt->type == bp_read_watchpoint || - bpt->type == bp_access_watchpoint) + if (bpt->pending) { - if (bpt->exp_valid_block != NULL) + if (bpt->enable_state != bp_enabled) { - struct frame_info *fr = - fr = frame_find_by_id (bpt->watchpoint_frame); - if (fr == NULL) + /* When enabling a pending breakpoint, we need to check if the breakpoint + is resolvable since shared libraries could have been loaded + after the breakpoint was disabled. */ + breakpoints_changed (); + if (resolve_pending_breakpoint (bpt) == GDB_RC_OK) { - printf_filtered ("\ -Cannot enable watchpoint %d because the block in which its expression\n\ -is valid is not currently in scope.\n", bpt->number); - bpt->enable_state = bp_disabled; + delete_breakpoint (bpt); return; } - - save_selected_frame = deprecated_selected_frame; - save_selected_frame_level = frame_relative_level (deprecated_selected_frame); - select_frame (fr); + bpt->enable_state = bp_enabled; + bpt->disposition = disposition; } - - value_free (bpt->val); - mark = value_mark (); - bpt->val = evaluate_expression (bpt->exp); - release_value (bpt->val); - if (VALUE_LAZY (bpt->val)) - value_fetch_lazy (bpt->val); - - if (bpt->type == bp_hardware_watchpoint || - bpt->type == bp_read_watchpoint || + } + else /* Not a pending breakpoint. */ + { + if (bpt->enable_state != bp_permanent) + bpt->enable_state = bp_enabled; + bpt->disposition = disposition; + check_duplicates (bpt); + breakpoints_changed (); + + if (bpt->type == bp_watchpoint || + bpt->type == bp_hardware_watchpoint || + bpt->type == bp_read_watchpoint || bpt->type == bp_access_watchpoint) { - int i = hw_watchpoint_used_count (bpt->type, &other_type_used); - int mem_cnt = can_use_hardware_watchpoint (bpt->val); - - /* Hack around 'unused var' error for some targets here */ - (void) mem_cnt, i; - target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT ( - bpt->type, i + mem_cnt, other_type_used); - /* we can consider of type is bp_hardware_watchpoint, convert to - bp_watchpoint in the following condition */ - if (target_resources_ok < 0) + if (bpt->exp_valid_block != NULL) { - printf_filtered ("\ + struct frame_info *fr = + fr = frame_find_by_id (bpt->watchpoint_frame); + if (fr == NULL) + { + printf_filtered ("\ +Cannot enable watchpoint %d because the block in which its expression\n\ +is valid is not currently in scope.\n", bpt->number); + bpt->enable_state = bp_disabled; + return; + } + + save_selected_frame = deprecated_selected_frame; + save_selected_frame_level = frame_relative_level (deprecated_selected_frame); + select_frame (fr); + } + + value_free (bpt->val); + mark = value_mark (); + bpt->val = evaluate_expression (bpt->exp); + release_value (bpt->val); + if (VALUE_LAZY (bpt->val)) + value_fetch_lazy (bpt->val); + + if (bpt->type == bp_hardware_watchpoint || + bpt->type == bp_read_watchpoint || + bpt->type == bp_access_watchpoint) + { + int i = hw_watchpoint_used_count (bpt->type, &other_type_used); + int mem_cnt = can_use_hardware_watchpoint (bpt->val); + + /* Hack around 'unused var' error for some targets here */ + (void) mem_cnt, i; + target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT ( + bpt->type, i + mem_cnt, other_type_used); + /* we can consider of type is bp_hardware_watchpoint, convert to + bp_watchpoint in the following condition */ + if (target_resources_ok < 0) + { + printf_filtered ("\ Cannot enable watchpoint %d because target watch resources\n\ have been allocated for other watchpoints.\n", bpt->number); - bpt->enable_state = bp_disabled; - value_free_to_mark (mark); - return; + bpt->enable_state = bp_disabled; + value_free_to_mark (mark); + return; + } } + + if (save_selected_frame_level >= 0) + select_frame (save_selected_frame); + value_free_to_mark (mark); } - - if (save_selected_frame_level >= 0) - select_frame (save_selected_frame); - value_free_to_mark (mark); } + if (modify_breakpoint_hook) modify_breakpoint_hook (bpt); breakpoint_modify_event (bpt->number); diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 85cc8b9..41bcb0c 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1,5 +1,6 @@ /* Data structures associated with breakpoints in GDB. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -385,6 +386,17 @@ struct breakpoint /* Methods associated with this breakpoint. */ struct breakpoint_ops *ops; + + /* Was breakpoint issued from a tty? Saved for the use of pending breakpoints. */ + int from_tty; + + /* Flag value for pending breakpoint. + first bit : 0 non-temporary, 1 temporary. + second bit : 0 normal breakpoint, 1 hardware breakpoint. */ + int flag; + + /* Is breakpoint pending on shlib loads? */ + int pending; }; /* The following stuff is an abstract data type "bpstat" ("breakpoint @@ -402,7 +414,7 @@ extern void bpstat_clear (bpstat *); is part of the bpstat is copied as well. */ extern bpstat bpstat_copy (bpstat); -extern bpstat bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint); +extern bpstat bpstat_stop_status (CORE_ADDR pc, ptid_t ptid); /* This bpstat_what stuff tells wait_for_inferior what to do with a breakpoint (a challenging task). */ @@ -605,6 +617,8 @@ extern enum breakpoint_here breakpoint_here_p (CORE_ADDR); extern int breakpoint_inserted_here_p (CORE_ADDR); +extern int software_breakpoint_inserted_here_p (CORE_ADDR); + /* FIXME: cagney/2002-11-10: The current [generic] dummy-frame code implements a functional superset of this function. The only reason it hasn't been removed is because some architectures still don't diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 93090ed..4b362e0 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1,6 +1,6 @@ /* Support routines for building symbol tables in GDB's internal format. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -202,7 +202,7 @@ void free_pending_blocks (void) { #if 0 /* Now we make the links in the - symbol_obstack, so don't free + objfile_obstack, so don't free them. */ struct pending_block *bnext, *bnext1; @@ -230,16 +230,16 @@ finish_block (struct symbol *symbol, struct pending **listhead, struct pending_block *pblock; struct pending_block *opblock; - block = allocate_block (&objfile->symbol_obstack); + block = allocate_block (&objfile->objfile_obstack); if (symbol) { - BLOCK_DICT (block) = dict_create_linear (&objfile->symbol_obstack, + BLOCK_DICT (block) = dict_create_linear (&objfile->objfile_obstack, *listhead); } else { - BLOCK_DICT (block) = dict_create_hashed (&objfile->symbol_obstack, + BLOCK_DICT (block) = dict_create_hashed (&objfile->objfile_obstack, *listhead); } @@ -347,7 +347,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, /* If we're in the C++ case, set the block's scope. */ if (SYMBOL_LANGUAGE (symbol) == language_cplus) { - cp_set_block_scope (symbol, block, &objfile->symbol_obstack); + cp_set_block_scope (symbol, block, &objfile->objfile_obstack); } } else @@ -439,7 +439,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, OPBLOCK, or at the beginning if opblock is NULL. This puts the block in the list after all its subblocks. - Allocate the pending block struct in the symbol_obstack to save + Allocate the pending block struct in the objfile_obstack to save time. This wastes a little space. FIXME: Is it worth it? */ void @@ -449,7 +449,7 @@ record_pending_block (struct objfile *objfile, struct block *block, struct pending_block *pblock; pblock = (struct pending_block *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct pending_block)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct pending_block)); pblock->block = block; if (opblock) { @@ -477,7 +477,7 @@ make_blockvector (struct objfile *objfile) } blockvector = (struct blockvector *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, (sizeof (struct blockvector) + (i - 1) * sizeof (struct block *))); @@ -909,7 +909,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) objfile); blockvector = make_blockvector (objfile); cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } #ifndef PROCESS_LINENUMBER_HOOK @@ -961,7 +961,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { /* Reallocate the line table on the symbol obstack */ symtab->linetable = (struct linetable *) - obstack_alloc (&objfile->symbol_obstack, linetablesize); + obstack_alloc (&objfile->objfile_obstack, linetablesize); memcpy (symtab->linetable, subfile->line_vector, linetablesize); } else @@ -973,7 +973,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { /* Reallocate the dirname on the symbol obstack */ symtab->dirname = (char *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, strlen (subfile->dirname) + 1); strcpy (symtab->dirname, subfile->dirname); } @@ -997,7 +997,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { symtab->debugformat = obsavestring (subfile->debugformat, strlen (subfile->debugformat), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } /* All symtabs for the main file and the subfiles share a diff --git a/gdb/c-lang.c b/gdb/c-lang.c index a296d81..ba34540 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -1,5 +1,5 @@ /* C language support routines for GDB, the GNU debugger. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -556,6 +556,7 @@ const struct language_defn c_language_defn = NULL, /* Language specific skip_trampoline */ NULL, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ @@ -613,6 +614,7 @@ const struct language_defn cplus_language_defn = NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + cp_lookup_transparent_type, /* lookup_transparent_type */ cplus_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ @@ -647,6 +649,7 @@ const struct language_defn asm_language_defn = NULL, /* Language specific skip_trampoline */ NULL, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ @@ -686,6 +689,7 @@ const struct language_defn minimal_language_defn = NULL, /* Language specific skip_trampoline */ NULL, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 00aef54..7cd6047 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1,6 +1,6 @@ /* GDB CLI commands. - Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include <readline/readline.h> #include <readline/tilde.h> #include "completer.h" #include "target.h" /* For baud_rate, remote_debug and remote_timeout */ @@ -45,6 +46,10 @@ #include "cli/cli-setshow.h" #include "cli/cli-cmds.h" +#ifdef TUI +#include "tui/tui.h" /* For tui_active et.al. */ +#endif + #ifndef GDBINIT_FILENAME #define GDBINIT_FILENAME ".gdbinit" #endif @@ -222,7 +227,7 @@ complete_command (char *arg, int from_tty) { int i; int argpoint; - char **completions; + char **completions, *point, *arg_prefix; dont_repeat (); @@ -230,7 +235,23 @@ complete_command (char *arg, int from_tty) arg = ""; argpoint = strlen (arg); - completions = complete_line (arg, arg, argpoint); + /* complete_line assumes that its first argument is somewhere within, + and except for filenames at the beginning of, the word to be completed. + The following crude imitation of readline's word-breaking tries to + accomodate this. */ + point = arg + argpoint; + while (point > arg) + { + if (strchr (rl_completer_word_break_characters, point[-1]) != 0) + break; + point--; + } + + arg_prefix = alloca (point - arg + 1); + memcpy (arg_prefix, arg, point - arg); + arg_prefix[point - arg] = 0; + + completions = complete_line (point, arg, argpoint); if (completions) { @@ -246,7 +267,7 @@ complete_command (char *arg, int from_tty) while (item < size) { int next_item; - printf_unfiltered ("%s\n", completions[item]); + printf_unfiltered ("%s%s\n", arg_prefix, completions[item]); next_item = item + 1; while (next_item < size && ! strcmp (completions[item], completions[next_item])) @@ -504,9 +525,9 @@ shell_escape (char *arg, int from_tty) p++; /* Get past '/' */ if (!arg) - execl (user_shell, p, 0); + execl (user_shell, p, (char *) 0); else - execl (user_shell, p, "-c", arg, 0); + execl (user_shell, p, "-c", arg, (char *) 0); fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell, safe_strerror (errno)); @@ -833,8 +854,9 @@ disassemble_command (char *arg, int from_tty) #if defined(TUI) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ - else if (tui_active) - low = tuiGetLowDisassemblyAddress (low, pc); + if (tui_active) + /* FIXME: cagney/2004-02-07: This should be an observer. */ + low = tui_get_low_disassembly_address (low, pc); #endif low += FUNCTION_START_OFFSET; } @@ -847,8 +869,9 @@ disassemble_command (char *arg, int from_tty) #if defined(TUI) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ - else if (tui_active) - low = tuiGetLowDisassemblyAddress (low, pc); + if (tui_active) + /* FIXME: cagney/2004-02-07: This should be an observer. */ + low = tui_get_low_disassembly_address (low, pc); #endif low += FUNCTION_START_OFFSET; } diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 24965688e..43f2f25 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -29,6 +29,10 @@ #include "cli/cli-cmds.h" #include "cli/cli-decode.h" +#ifdef TUI +#include "tui/tui.h" /* For tui_active et.al. */ +#endif + #include "gdb_assert.h" /* Prototypes for local functions */ diff --git a/gdb/coffread.c b/gdb/coffread.c index 215be80..c2a931c 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1,6 +1,6 @@ /* Read coff symbol tables and convert to internal format, for GDB. Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu). @@ -1468,7 +1468,7 @@ process_coff_symbol (struct coff_symbol *cs, struct objfile *objfile) { struct symbol *sym - = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); char *name; @@ -1963,7 +1963,7 @@ coff_read_struct_type (int index, int length, int lastsym) list->field.name = obsavestring (name, strlen (name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_BITPOS (list->field) = 8 * ms->c_value; FIELD_BITSIZE (list->field) = 0; @@ -1982,7 +1982,7 @@ coff_read_struct_type (int index, int length, int lastsym) list->field.name = obsavestring (name, strlen (name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_BITPOS (list->field) = ms->c_value; FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size; @@ -2049,13 +2049,13 @@ coff_read_enum_type (int index, int length, int lastsym) { case C_MOE: sym = (struct symbol *) obstack_alloc - (¤t_objfile->symbol_obstack, + (¤t_objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = ms->c_value; diff --git a/gdb/config/mips/tm-linux.h b/gdb/config/mips/tm-linux.h index c049c29..fc32707 100644 --- a/gdb/config/mips/tm-linux.h +++ b/gdb/config/mips/tm-linux.h @@ -1,6 +1,6 @@ /* Target-dependent definitions for GNU/Linux MIPS. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -26,7 +26,6 @@ /* We don't want to inherit tm-mips.h's shared library trampoline code. */ -#undef IN_SOLIB_CALL_TRAMPOLINE #undef IN_SOLIB_RETURN_TRAMPOLINE #undef SKIP_TRAMPOLINE_CODE #undef IGNORE_HELPER_CALL @@ -50,4 +49,14 @@ #undef IN_SIGTRAMP #define IN_SIGTRAMP(pc, name) (0) +#undef IN_SOLIB_DYNSYM_RESOLVE_CODE +#define IN_SOLIB_DYNSYM_RESOLVE_CODE(PC) mips_linux_in_dynsym_resolve_code (PC) +int mips_linux_in_dynsym_resolve_code (CORE_ADDR pc); + +/* We don't want all of tm-sysv4.h's shared library trampoline code either. + Note that by undefining IN_SOLIB_CALL_TRAMPOLINE here we will use the + gdbarch vector's version instead. */ + +#undef IN_SOLIB_CALL_TRAMPOLINE + #endif /* TM_MIPSLINUX_H */ diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h index 5d4175c..950e5af 100644 --- a/gdb/config/nm-linux.h +++ b/gdb/config/nm-linux.h @@ -77,3 +77,6 @@ extern void lin_thread_get_thread_signals (sigset_t *mask); #define CHILD_POST_ATTACH #define CHILD_FOLLOW_FORK #define KILL_INFERIOR + +#define NATIVE_XFER_AUXV procfs_xfer_auxv +#include "auxv.h" /* Declares it. */ diff --git a/gdb/config/sparc/nm-nbsd.h b/gdb/config/sparc/nm-nbsd.h index 089a5ac..5e05234 100644 --- a/gdb/config/sparc/nm-nbsd.h +++ b/gdb/config/sparc/nm-nbsd.h @@ -25,5 +25,17 @@ /* Get generic NetBSD native definitions. */ #include "config/nm-nbsd.h" + + +/* Support for StackGhost cookies. */ + +#include "target.h" + +#define NATIVE_XFER_WCOOKIE sparc_xfer_wcookie +extern LONGEST sparc_xfer_wcookie (struct target_ops *ops, + enum target_object object, + const char *annex, + void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len); #endif /* nm-nbsd.h */ diff --git a/gdb/config/sparc/obsd.mt b/gdb/config/sparc/obsd.mt new file mode 100644 index 0000000..800cb04 --- /dev/null +++ b/gdb/config/sparc/obsd.mt @@ -0,0 +1,4 @@ +# Target: OpenBSD/sparc +TDEPFILES= sparc-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o nbsd-tdep.o \ + corelow.o solib.o solib-svr4.o +TM_FILE= tm-nbsd.h diff --git a/gdb/config/sparc/obsd64.mt b/gdb/config/sparc/obsd64.mt new file mode 100644 index 0000000..a692817 --- /dev/null +++ b/gdb/config/sparc/obsd64.mt @@ -0,0 +1,5 @@ +# Target: OpenBSD/sparc64 +TDEPFILES= sparc64-tdep.o sparc64nbsd-tdep.o sparc64obsd-tdep.o \ + sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o \ + corelow.o solib.o solib-svr4.o +TM_FILE= tm-nbsd.h diff --git a/gdb/configure b/gdb/configure index a2fc0ea..a1b2795 100755 --- a/gdb/configure +++ b/gdb/configure @@ -2925,10 +2925,8 @@ EOF CONFIG_OBS= -CONFIG_LIB_OBS= CONFIG_DEPS= CONFIG_SRCS= -CONFIG_INITS= ENABLE_CFLAGS= CONFIG_ALL= CONFIG_CLEAN= @@ -3006,12 +3004,7 @@ if test x"$enable_gdbcli" = xyes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)" - CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_CLI_INITS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)" - CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_CLI_ALL)" - CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_CLI_CLEAN)" - CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_CLI_INSTALL)" - CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_CLI_UNINSTALL)" fi fi @@ -3034,12 +3027,7 @@ if test x"$enable_gdbmi" = xyes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)" - CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_MI_INITS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)" - CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_MI_ALL)" - CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_MI_CLEAN)" - CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_MI_INSTALL)" - CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_MI_UNINSTALL)" fi fi @@ -3060,12 +3048,7 @@ if test x"$enable_tui" = xyes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)" - CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)" - CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_TUI_ALL)" - CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_TUI_CLEAN)" - CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_TUI_INSTALL)" - CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_TUI_UNINSTALL)" need_curses=yes fi fi @@ -3110,17 +3093,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3114: checking for $ac_hdr" >&5 +echo "configure:3097: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3119 "configure" +#line 3102 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3107: \"$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* @@ -3150,17 +3133,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3154: checking for $ac_hdr" >&5 +echo "configure:3137: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3159 "configure" +#line 3142 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3147: \"$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* @@ -3198,17 +3181,17 @@ if test x"$enable_libunwind" = xyes; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3202: checking for $ac_hdr" >&5 +echo "configure:3185: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3207 "configure" +#line 3190 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3195: \"$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* @@ -3238,17 +3221,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3242: checking for $ac_hdr" >&5 +echo "configure:3225: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3247 "configure" +#line 3230 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3235: \"$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* @@ -3301,12 +3284,12 @@ fi for ac_func in monstartup _mcleanup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3305: checking for $ac_func" >&5 +echo "configure:3288: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3310 "configure" +#line 3293 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3329,7 +3312,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3316: \"$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 @@ -3354,12 +3337,12 @@ fi done echo $ac_n "checking for _etext""... $ac_c" 1>&6 -echo "configure:3358: checking for _etext" >&5 +echo "configure:3341: checking for _etext" >&5 if eval "test \"`echo '$''{'ac_cv_var__etext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3363 "configure" +#line 3346 "configure" #include "confdefs.h" #include <stdlib.h> extern char _etext; @@ -3368,7 +3351,7 @@ int main() { free (&_etext); ; return 0; } EOF -if { (eval echo configure:3372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var__etext=yes else @@ -3396,19 +3379,19 @@ if test "$enable_profiling" = yes ; then CFLAGS="$CFLAGS $PROFILE_CFLAGS" echo $ac_n "checking whether $CC supports -pg""... $ac_c" 1>&6 -echo "configure:3400: checking whether $CC supports -pg" >&5 +echo "configure:3383: checking whether $CC supports -pg" >&5 if eval "test \"`echo '$''{'ac_cv_cc_supports_pg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3405 "configure" +#line 3388 "configure" #include "confdefs.h" int main() { int x; ; return 0; } EOF -if { (eval echo configure:3412: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cc_supports_pg=yes else @@ -3438,7 +3421,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3442: checking for $ac_word" >&5 +echo "configure:3425: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3479,7 +3462,7 @@ done # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:3483: checking for a BSD compatible install" >&5 +echo "configure:3466: 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 @@ -3532,7 +3515,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:3536: checking whether ln -s works" >&5 +echo "configure:3519: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3555,7 +3538,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3559: checking for $ac_word" >&5 +echo "configure:3542: 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 @@ -3587,7 +3570,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3591: checking for $ac_word" >&5 +echo "configure:3574: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3621,7 +3604,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3625: checking for $ac_word" >&5 +echo "configure:3608: 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 @@ -3653,7 +3636,7 @@ fi # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3657: checking for $ac_word" >&5 +echo "configure:3640: 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 @@ -3685,7 +3668,7 @@ fi # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3689: checking for $ac_word" >&5 +echo "configure:3672: 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 @@ -3719,7 +3702,7 @@ fi # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3723: checking for $ac_word" >&5 +echo "configure:3706: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3755,7 +3738,7 @@ fi # We might need to link with -lm; most simulators need it. echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:3759: checking for main in -lm" >&5 +echo "configure:3742: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3763,14 +3746,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 3767 "configure" +#line 3750 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:3774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3757: \"$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 @@ -3803,12 +3786,12 @@ fi # libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1 # is known to have this problem). Therefore we avoid libw if we can. echo $ac_n "checking for wctype""... $ac_c" 1>&6 -echo "configure:3807: checking for wctype" >&5 +echo "configure:3790: checking for wctype" >&5 if eval "test \"`echo '$''{'ac_cv_func_wctype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3812 "configure" +#line 3795 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char wctype(); below. */ @@ -3831,7 +3814,7 @@ wctype(); ; return 0; } EOF -if { (eval echo configure:3835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_wctype=yes" else @@ -3849,7 +3832,7 @@ if eval "test \"`echo '$ac_cv_func_'wctype`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6 -echo "configure:3853: checking for wctype in -lw" >&5 +echo "configure:3836: checking for wctype in -lw" >&5 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3857,7 +3840,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <<EOF -#line 3861 "configure" +#line 3844 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3868,7 +3851,7 @@ int main() { wctype() ; return 0; } EOF -if { (eval echo configure:3872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3855: \"$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 @@ -3901,14 +3884,14 @@ fi # Some systems (e.g. Solaris) have `gethostbyname' in libnsl. echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6 -echo "configure:3905: checking for library containing gethostbyname" >&5 +echo "configure:3888: checking for library containing gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_gethostbyname="no" cat > conftest.$ac_ext <<EOF -#line 3912 "configure" +#line 3895 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3919,7 +3902,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="none required" else @@ -3930,7 +3913,7 @@ rm -f conftest* test "$ac_cv_search_gethostbyname" = "no" && for i in nsl; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 3934 "configure" +#line 3917 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3941,7 +3924,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="-l$i" break @@ -3965,14 +3948,14 @@ fi # Some systems (e.g. Solaris) have `socketpair' in libsocket. echo $ac_n "checking for library containing socketpair""... $ac_c" 1>&6 -echo "configure:3969: checking for library containing socketpair" >&5 +echo "configure:3952: checking for library containing socketpair" >&5 if eval "test \"`echo '$''{'ac_cv_search_socketpair'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socketpair="no" cat > conftest.$ac_ext <<EOF -#line 3976 "configure" +#line 3959 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3983,7 +3966,7 @@ int main() { socketpair() ; return 0; } EOF -if { (eval echo configure:3987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socketpair="none required" else @@ -3994,7 +3977,7 @@ rm -f conftest* test "$ac_cv_search_socketpair" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 3998 "configure" +#line 3981 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4005,7 +3988,7 @@ int main() { socketpair() ; return 0; } EOF -if { (eval echo configure:4009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socketpair="-l$i" break @@ -4041,14 +4024,14 @@ fi if test "$need_curses" = yes; then echo $ac_n "checking for library containing initscr""... $ac_c" 1>&6 -echo "configure:4045: checking for library containing initscr" >&5 +echo "configure:4028: checking for library containing initscr" >&5 if eval "test \"`echo '$''{'ac_cv_search_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_initscr="no" cat > conftest.$ac_ext <<EOF -#line 4052 "configure" +#line 4035 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4059,7 +4042,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_initscr="none required" else @@ -4070,7 +4053,7 @@ rm -f conftest* test "$ac_cv_search_initscr" = "no" && for i in ncurses Hcurses curses; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4074 "configure" +#line 4057 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4081,7 +4064,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:4085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_initscr="-l$i" break @@ -4117,14 +4100,14 @@ case $host_os in # ??? Why? echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6 -echo "configure:4121: checking for library containing tgetent" >&5 +echo "configure:4104: checking for library containing tgetent" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_tgetent="no" cat > conftest.$ac_ext <<EOF -#line 4128 "configure" +#line 4111 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4135,7 +4118,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="none required" else @@ -4146,7 +4129,7 @@ rm -f conftest* test "$ac_cv_search_tgetent" = "no" && for i in tinfo ncurses curses termcap; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4150 "configure" +#line 4133 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4157,7 +4140,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="-l$i" break @@ -4184,14 +4167,14 @@ esac # Readline doesn't, so I think we're safe with leaving them out. echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6 -echo "configure:4188: checking for library containing tgetent" >&5 +echo "configure:4171: checking for library containing tgetent" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_tgetent="no" cat > conftest.$ac_ext <<EOF -#line 4195 "configure" +#line 4178 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4202,7 +4185,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="none required" else @@ -4213,7 +4196,7 @@ rm -f conftest* test "$ac_cv_search_tgetent" = "no" && for i in termcap tinfo ncurses Hcurses curses; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4217 "configure" +#line 4200 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4224,7 +4207,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="-l$i" break @@ -4258,12 +4241,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4262: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4245: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4267 "configure" +#line 4250 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4271,7 +4254,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4296,7 +4279,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4300: checking for opendir in -ldir" >&5 +echo "configure:4283: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4304,7 +4287,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4308 "configure" +#line 4291 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4315,7 +4298,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4302: \"$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 @@ -4337,7 +4320,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4341: checking for opendir in -lx" >&5 +echo "configure:4324: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4345,7 +4328,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4349 "configure" +#line 4332 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4356,7 +4339,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4343: \"$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 @@ -4379,12 +4362,12 @@ fi fi echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:4383: checking whether stat file-mode macros are broken" >&5 +echo "configure:4366: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4388 "configure" +#line 4371 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -4435,12 +4418,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4439: checking for ANSI C header files" >&5 +echo "configure:4422: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4444 "configure" +#line 4427 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -4448,7 +4431,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4435: \"$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* @@ -4465,7 +4448,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4469 "configure" +#line 4452 "configure" #include "confdefs.h" #include <string.h> EOF @@ -4483,7 +4466,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4487 "configure" +#line 4470 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -4504,7 +4487,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 4508 "configure" +#line 4491 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4515,7 +4498,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -4542,17 +4525,17 @@ for ac_hdr in link.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4546: checking for $ac_hdr" >&5 +echo "configure:4529: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4551 "configure" +#line 4534 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4539: \"$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* @@ -4582,17 +4565,17 @@ for ac_hdr in machine/reg.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4586: checking for $ac_hdr" >&5 +echo "configure:4569: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4591 "configure" +#line 4574 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4596: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4579: \"$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* @@ -4622,17 +4605,17 @@ for ac_hdr in nlist.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4626: checking for $ac_hdr" >&5 +echo "configure:4609: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4631 "configure" +#line 4614 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4619: \"$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* @@ -4662,17 +4645,17 @@ for ac_hdr in poll.h sys/poll.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4666: checking for $ac_hdr" >&5 +echo "configure:4649: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4671 "configure" +#line 4654 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4659: \"$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* @@ -4702,17 +4685,17 @@ for ac_hdr in proc_service.h thread_db.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4706: checking for $ac_hdr" >&5 +echo "configure:4689: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4711 "configure" +#line 4694 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4699: \"$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* @@ -4742,17 +4725,17 @@ for ac_hdr in stddef.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4746: checking for $ac_hdr" >&5 +echo "configure:4729: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4751 "configure" +#line 4734 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4739: \"$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* @@ -4782,17 +4765,17 @@ for ac_hdr in stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4786: checking for $ac_hdr" >&5 +echo "configure:4769: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4791 "configure" +#line 4774 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4779: \"$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* @@ -4822,17 +4805,17 @@ for ac_hdr in stdint.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4826: checking for $ac_hdr" >&5 +echo "configure:4809: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4831 "configure" +#line 4814 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4819: \"$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* @@ -4862,17 +4845,17 @@ for ac_hdr in string.h memory.h strings.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4866: checking for $ac_hdr" >&5 +echo "configure:4849: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4871 "configure" +#line 4854 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4859: \"$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* @@ -4902,17 +4885,17 @@ for ac_hdr in sys/fault.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4906: checking for $ac_hdr" >&5 +echo "configure:4889: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4911 "configure" +#line 4894 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4899: \"$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* @@ -4942,17 +4925,17 @@ for ac_hdr in sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4946: checking for $ac_hdr" >&5 +echo "configure:4929: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4951 "configure" +#line 4934 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4939: \"$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* @@ -4982,17 +4965,17 @@ for ac_hdr in sys/filio.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4986: checking for $ac_hdr" >&5 +echo "configure:4969: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4991 "configure" +#line 4974 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4979: \"$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* @@ -5022,17 +5005,17 @@ for ac_hdr in sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5026: checking for $ac_hdr" >&5 +echo "configure:5009: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5031 "configure" +#line 5014 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5036: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5019: \"$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* @@ -5062,17 +5045,17 @@ for ac_hdr in sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5066: checking for $ac_hdr" >&5 +echo "configure:5049: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5071 "configure" +#line 5054 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5059: \"$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* @@ -5102,17 +5085,17 @@ for ac_hdr in sys/proc.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5106: checking for $ac_hdr" >&5 +echo "configure:5089: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5111 "configure" +#line 5094 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5116: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5099: \"$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* @@ -5142,17 +5125,17 @@ for ac_hdr in sys/procfs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5146: checking for $ac_hdr" >&5 +echo "configure:5129: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5151 "configure" +#line 5134 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5139: \"$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* @@ -5182,17 +5165,17 @@ for ac_hdr in sys/ptrace.h ptrace.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5186: checking for $ac_hdr" >&5 +echo "configure:5169: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5191 "configure" +#line 5174 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5179: \"$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* @@ -5222,17 +5205,17 @@ for ac_hdr in sys/reg.h sys/debugreg.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5226: checking for $ac_hdr" >&5 +echo "configure:5209: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5231 "configure" +#line 5214 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5219: \"$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* @@ -5262,17 +5245,17 @@ for ac_hdr in sys/select.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5266: checking for $ac_hdr" >&5 +echo "configure:5249: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5271 "configure" +#line 5254 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5259: \"$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* @@ -5302,17 +5285,17 @@ for ac_hdr in sys/syscall.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5306: checking for $ac_hdr" >&5 +echo "configure:5289: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5311 "configure" +#line 5294 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5316: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5299: \"$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* @@ -5342,17 +5325,17 @@ for ac_hdr in sys/user.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5346: checking for $ac_hdr" >&5 +echo "configure:5329: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5351 "configure" +#line 5334 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5356: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5339: \"$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* @@ -5382,17 +5365,17 @@ for ac_hdr in sys/wait.h wait.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5386: checking for $ac_hdr" >&5 +echo "configure:5369: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5391 "configure" +#line 5374 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5396: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5379: \"$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* @@ -5422,17 +5405,17 @@ for ac_hdr in termios.h termio.h sgtty.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5426: checking for $ac_hdr" >&5 +echo "configure:5409: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5431 "configure" +#line 5414 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5419: \"$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* @@ -5462,17 +5445,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:5466: checking for $ac_hdr" >&5 +echo "configure:5449: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5471 "configure" +#line 5454 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5459: \"$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* @@ -5515,17 +5498,17 @@ for ac_hdr in curses.h ncurses.h term.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5519: checking for $ac_hdr" >&5 +echo "configure:5502: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5524 "configure" +#line 5507 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5529: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5512: \"$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* @@ -5558,17 +5541,17 @@ for ac_hdr in ctype.h time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5562: checking for $ac_hdr" >&5 +echo "configure:5545: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5567 "configure" +#line 5550 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5555: \"$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* @@ -5596,12 +5579,12 @@ done echo $ac_n "checking for member st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:5600: checking for member st_blocks in struct stat" >&5 +echo "configure:5583: checking for member st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_stat_with_st_blocks_member'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5605 "configure" +#line 5588 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -5609,7 +5592,7 @@ int main() { struct stat st; (void) st.st_blocks; ; return 0; } EOF -if { (eval echo configure:5613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_stat_with_st_blocks_member=yes else @@ -5636,12 +5619,12 @@ 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:5640: checking whether $ac_func is declared" >&5 +echo "configure:5623: 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 <<EOF -#line 5645 "configure" +#line 5628 "configure" #include "confdefs.h" #undef $ac_tr_decl #define $ac_tr_decl 1 @@ -5653,7 +5636,7 @@ char *(*pfn) = (char *(*)) $ac_func ; #endif ; return 0; } EOF -if { (eval echo configure:5657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5640: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "gcc_cv_have_decl_$ac_func=yes" else @@ -5690,12 +5673,12 @@ fi # ------------------ # echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5694: checking return type of signal handlers" >&5 +echo "configure:5677: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5699 "configure" +#line 5682 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -5712,7 +5695,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5736,12 +5719,12 @@ EOF # ------------------------------------- # echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5740: checking for working const" >&5 +echo "configure:5723: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5745 "configure" +#line 5728 "configure" #include "confdefs.h" int main() { @@ -5790,7 +5773,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:5794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5811,21 +5794,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:5815: checking for inline" >&5 +echo "configure:5798: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 5822 "configure" +#line 5805 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:5829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -5858,19 +5841,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:5862: checking for working alloca.h" >&5 +echo "configure:5845: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5867 "configure" +#line 5850 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:5874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5857: \"$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 @@ -5891,12 +5874,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5895: checking for alloca" >&5 +echo "configure:5878: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5900 "configure" +#line 5883 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -5924,7 +5907,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:5928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5911: \"$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 @@ -5956,12 +5939,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5960: checking whether alloca needs Cray hooks" >&5 +echo "configure:5943: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5965 "configure" +#line 5948 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -5986,12 +5969,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5990: checking for $ac_func" >&5 +echo "configure:5973: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5995 "configure" +#line 5978 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6014,7 +5997,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6001: \"$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 @@ -6041,7 +6024,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:6045: checking stack direction for C alloca" >&5 +echo "configure:6028: 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 @@ -6049,7 +6032,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 6053 "configure" +#line 6036 "configure" #include "confdefs.h" find_stack_direction () { @@ -6068,7 +6051,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:6072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6055: \"$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 @@ -6093,17 +6076,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:6097: checking for $ac_hdr" >&5 +echo "configure:6080: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6102 "configure" +#line 6085 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6090: \"$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* @@ -6132,12 +6115,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6136: checking for $ac_func" >&5 +echo "configure:6119: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6141 "configure" +#line 6124 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6160,7 +6143,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6147: \"$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 @@ -6185,7 +6168,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6189: checking for working mmap" >&5 +echo "configure:6172: 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 @@ -6193,7 +6176,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6197 "configure" +#line 6180 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6333,7 +6316,7 @@ main() } EOF -if { (eval echo configure:6337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6320: \"$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 @@ -6356,12 +6339,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6360: checking for pid_t" >&5 +echo "configure:6343: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6365 "configure" +#line 6348 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6390,17 +6373,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:6394: checking for vfork.h" >&5 +echo "configure:6377: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6399 "configure" +#line 6382 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6425,18 +6408,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:6429: checking for working vfork" >&5 +echo "configure:6412: 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:6435: checking for vfork" >&5 +echo "configure:6418: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6440 "configure" +#line 6423 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -6459,7 +6442,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:6463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6446: \"$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 @@ -6481,7 +6464,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 6485 "configure" +#line 6468 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -6576,7 +6559,7 @@ main() { } } EOF -if { (eval echo configure:6580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6563: \"$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 @@ -6601,12 +6584,12 @@ fi for ac_func in canonicalize_file_name realpath do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6605: checking for $ac_func" >&5 +echo "configure:6588: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6610 "configure" +#line 6593 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6629,7 +6612,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6616: \"$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 @@ -6656,12 +6639,12 @@ done for ac_func in poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6660: checking for $ac_func" >&5 +echo "configure:6643: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6665 "configure" +#line 6648 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6684,7 +6667,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6671: \"$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 @@ -6711,12 +6694,12 @@ done for ac_func in pread64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6715: checking for $ac_func" >&5 +echo "configure:6698: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6720 "configure" +#line 6703 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6739,7 +6722,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6726: \"$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 @@ -6766,12 +6749,12 @@ done for ac_func in sbrk do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6770: checking for $ac_func" >&5 +echo "configure:6753: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6775 "configure" +#line 6758 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6794,7 +6777,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6781: \"$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 @@ -6821,12 +6804,12 @@ done for ac_func in setpgid setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6825: checking for $ac_func" >&5 +echo "configure:6808: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6830 "configure" +#line 6813 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6849,7 +6832,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6836: \"$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 @@ -6876,12 +6859,12 @@ done for ac_func in sigaction sigprocmask sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6880: checking for $ac_func" >&5 +echo "configure:6863: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6885 "configure" +#line 6868 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6904,7 +6887,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6891: \"$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 @@ -6931,12 +6914,12 @@ done for ac_func in socketpair do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6935: checking for $ac_func" >&5 +echo "configure:6918: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6940 "configure" +#line 6923 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6959,7 +6942,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6946: \"$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 @@ -6986,12 +6969,12 @@ done for ac_func in syscall do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6990: checking for $ac_func" >&5 +echo "configure:6973: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6995 "configure" +#line 6978 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7014,7 +6997,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7001: \"$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 @@ -7041,7 +7024,7 @@ done if test "$cross_compiling" = no; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:7045: checking whether setpgrp takes no argument" >&5 +echo "configure:7028: 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 @@ -7049,7 +7032,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 7053 "configure" +#line 7036 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -7069,7 +7052,7 @@ main() } EOF -if { (eval echo configure:7073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7056: \"$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 @@ -7094,12 +7077,12 @@ fi else echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:7098: checking whether setpgrp takes no argument" >&5 +echo "configure:7081: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7103 "configure" +#line 7086 "configure" #include "confdefs.h" #include <unistd.h> @@ -7113,7 +7096,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:7117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_func_setpgrp_void=no else @@ -7137,12 +7120,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:7141: checking for sigsetjmp" >&5 +echo "configure:7124: checking for sigsetjmp" >&5 if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7146 "configure" +#line 7129 "configure" #include "confdefs.h" #include <setjmp.h> @@ -7151,7 +7134,7 @@ int main() { sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); ; return 0; } EOF -if { (eval echo configure:7155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7138: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_func_sigsetjmp=yes else @@ -7177,12 +7160,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:7181: checking for GNU regex" >&5 +echo "configure:7164: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7186 "configure" +#line 7169 "configure" #include "confdefs.h" #include <gnu-versions.h> int main() { @@ -7192,7 +7175,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:7196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -7226,12 +7209,12 @@ fi # See if <machine/reg.h> degines `struct reg'. echo $ac_n "checking for struct reg in machine/reg.h""... $ac_c" 1>&6 -echo "configure:7230: checking for struct reg in machine/reg.h" >&5 +echo "configure:7213: checking for struct reg in machine/reg.h" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7235 "configure" +#line 7218 "configure" #include "confdefs.h" #include <sys/types.h> #include <machine/reg.h> @@ -7239,7 +7222,7 @@ int main() { struct reg r; ; return 0; } EOF -if { (eval echo configure:7243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg=yes else @@ -7262,19 +7245,19 @@ fi # See if <machine/reg.h> supports the %fs and %gs i386 segment registers. # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6 -echo "configure:7266: checking for r_fs in struct reg" >&5 +echo "configure:7249: checking for r_fs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7271 "configure" +#line 7254 "configure" #include "confdefs.h" #include <machine/reg.h> int main() { struct reg r; r.r_fs; ; return 0; } EOF -if { (eval echo configure:7278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7261: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_fs=yes else @@ -7294,19 +7277,19 @@ EOF fi echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6 -echo "configure:7298: checking for r_gs in struct reg" >&5 +echo "configure:7281: checking for r_gs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7303 "configure" +#line 7286 "configure" #include "confdefs.h" #include <machine/reg.h> int main() { struct reg r; r.r_gs; ; return 0; } EOF -if { (eval echo configure:7310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_gs=yes else @@ -7328,19 +7311,19 @@ fi # See if <sys/ptrace.h> provides the PTRACE_GETREGS request. echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:7332: checking for PTRACE_GETREGS" >&5 +echo "configure:7315: checking for PTRACE_GETREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7337 "configure" +#line 7320 "configure" #include "confdefs.h" #include <sys/ptrace.h> int main() { PTRACE_GETREGS; ; return 0; } EOF -if { (eval echo configure:7344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getregs=yes else @@ -7362,19 +7345,19 @@ fi # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request. echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:7366: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:7349: checking for PTRACE_GETFPXREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7371 "configure" +#line 7354 "configure" #include "confdefs.h" #include <sys/ptrace.h> int main() { PTRACE_GETFPXREGS; ; return 0; } EOF -if { (eval echo configure:7378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getfpxregs=yes else @@ -7396,12 +7379,12 @@ fi # See if <sys/ptrace.h> provides the PT_GETDBREGS request. echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6 -echo "configure:7400: checking for PT_GETDBREGS" >&5 +echo "configure:7383: checking for PT_GETDBREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7405 "configure" +#line 7388 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ptrace.h> @@ -7409,7 +7392,7 @@ int main() { PT_GETDBREGS; ; return 0; } EOF -if { (eval echo configure:7413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getdbregs=yes else @@ -7431,12 +7414,12 @@ fi # See if <sys/ptrace.h> provides the PT_GETXMMREGS request. echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6 -echo "configure:7435: checking for PT_GETXMMREGS" >&5 +echo "configure:7418: checking for PT_GETXMMREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7440 "configure" +#line 7423 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ptrace.h> @@ -7444,7 +7427,7 @@ int main() { PT_GETXMMREGS; ; return 0; } EOF -if { (eval echo configure:7448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getxmmregs=yes else @@ -7467,19 +7450,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:7471: checking for uintptr_t in stdint.h" >&5 +echo "configure:7454: 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 <<EOF -#line 7476 "configure" +#line 7459 "configure" #include "confdefs.h" #include <stdint.h> int main() { uintptr_t foo = 0; ; return 0; } EOF -if { (eval echo configure:7483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_uintptr_t=yes else @@ -7500,12 +7483,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:7504: checking whether malloc must be declared" >&5 +echo "configure:7487: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7509 "configure" +#line 7492 "configure" #include "confdefs.h" #include <stdio.h> @@ -7526,7 +7509,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:7530: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -7547,12 +7530,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:7551: checking whether realloc must be declared" >&5 +echo "configure:7534: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7556 "configure" +#line 7539 "configure" #include "confdefs.h" #include <stdio.h> @@ -7573,7 +7556,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:7577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -7594,12 +7577,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:7598: checking whether free must be declared" >&5 +echo "configure:7581: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7603 "configure" +#line 7586 "configure" #include "confdefs.h" #include <stdio.h> @@ -7620,7 +7603,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:7624: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -7641,12 +7624,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:7645: checking whether strerror must be declared" >&5 +echo "configure:7628: checking whether strerror must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7650 "configure" +#line 7633 "configure" #include "confdefs.h" #include <stdio.h> @@ -7667,7 +7650,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:7671: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -7688,12 +7671,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:7692: checking whether strdup must be declared" >&5 +echo "configure:7675: checking whether strdup must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7697 "configure" +#line 7680 "configure" #include "confdefs.h" #include <stdio.h> @@ -7714,7 +7697,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:7718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -7735,12 +7718,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:7739: checking whether strstr must be declared" >&5 +echo "configure:7722: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7744 "configure" +#line 7727 "configure" #include "confdefs.h" #include <stdio.h> @@ -7761,7 +7744,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:7765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -7782,12 +7765,12 @@ EOF fi echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:7786: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:7769: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7791 "configure" +#line 7774 "configure" #include "confdefs.h" #include <stdio.h> @@ -7808,7 +7791,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:7812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_canonicalize_file_name=no else @@ -7834,9 +7817,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:7838: checking for HPUX save_state structure" >&5 +echo "configure:7821: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext <<EOF -#line 7840 "configure" +#line 7823 "configure" #include "confdefs.h" #include <machine/save_state.h> EOF @@ -7851,7 +7834,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 7855 "configure" +#line 7838 "configure" #include "confdefs.h" #include <machine/save_state.h> EOF @@ -7910,7 +7893,7 @@ EOF EOF ;; - *-*-solaris2.[678]) + *-*-solaris2.[6789]) cat >> confdefs.h <<\EOF #define NEW_PROC_API 1 EOF @@ -7921,12 +7904,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:7925: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:7908: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7930 "configure" +#line 7913 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7935,7 +7918,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:7939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -7957,12 +7940,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:7961: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:7944: checking for prrun_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7966 "configure" +#line 7949 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7971,7 +7954,7 @@ int main() { prrun_t avar ; return 0; } EOF -if { (eval echo configure:7975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -7993,12 +7976,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:7997: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:7980: checking for gregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8002 "configure" +#line 7985 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8007,7 +7990,7 @@ int main() { gregset_t avar ; return 0; } EOF -if { (eval echo configure:8011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -8029,12 +8012,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:8033: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:8016: checking for fpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8038 "configure" +#line 8021 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8043,7 +8026,7 @@ int main() { fpregset_t avar ; return 0; } EOF -if { (eval echo configure:8047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -8065,12 +8048,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:8069: checking for prgregset_t in sys/procfs.h" >&5 +echo "configure:8052: checking for prgregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8074 "configure" +#line 8057 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8079,7 +8062,7 @@ int main() { prgregset_t avar ; return 0; } EOF -if { (eval echo configure:8083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset_t=yes else @@ -8101,12 +8084,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:8105: checking for prfpregset_t in sys/procfs.h" >&5 +echo "configure:8088: checking for prfpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8110 "configure" +#line 8093 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8115,7 +8098,7 @@ int main() { prfpregset_t avar ; return 0; } EOF -if { (eval echo configure:8119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset_t=yes else @@ -8137,12 +8120,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:8141: checking for prgregset32_t in sys/procfs.h" >&5 +echo "configure:8124: checking for prgregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8146 "configure" +#line 8129 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8151,7 +8134,7 @@ int main() { prgregset32_t avar ; return 0; } EOF -if { (eval echo configure:8155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8138: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset32_t=yes else @@ -8173,12 +8156,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:8177: checking for prfpregset32_t in sys/procfs.h" >&5 +echo "configure:8160: checking for prfpregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8182 "configure" +#line 8165 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8187,7 +8170,7 @@ int main() { prfpregset32_t avar ; return 0; } EOF -if { (eval echo configure:8191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset32_t=yes else @@ -8209,12 +8192,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:8213: checking for lwpid_t in sys/procfs.h" >&5 +echo "configure:8196: checking for lwpid_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8218 "configure" +#line 8201 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8223,7 +8206,7 @@ int main() { lwpid_t avar ; return 0; } EOF -if { (eval echo configure:8227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8210: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpid_t=yes else @@ -8245,12 +8228,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:8249: checking for psaddr_t in sys/procfs.h" >&5 +echo "configure:8232: checking for psaddr_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8254 "configure" +#line 8237 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8259,7 +8242,7 @@ int main() { psaddr_t avar ; return 0; } EOF -if { (eval echo configure:8263: \"$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* bfd_cv_have_sys_procfs_type_psaddr_t=yes else @@ -8281,12 +8264,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:8285: checking for prsysent_t in sys/procfs.h" >&5 +echo "configure:8268: checking for prsysent_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8290 "configure" +#line 8273 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8295,7 +8278,7 @@ int main() { prsysent_t avar ; return 0; } EOF -if { (eval echo configure:8299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prsysent_t=yes else @@ -8317,12 +8300,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:8321: checking for pr_sigset_t in sys/procfs.h" >&5 +echo "configure:8304: checking for pr_sigset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8326 "configure" +#line 8309 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8331,7 +8314,7 @@ int main() { pr_sigset_t avar ; return 0; } EOF -if { (eval echo configure:8335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigset_t=yes else @@ -8353,12 +8336,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:8357: checking for pr_sigaction64_t in sys/procfs.h" >&5 +echo "configure:8340: checking for pr_sigaction64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8362 "configure" +#line 8345 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8367,7 +8350,7 @@ int main() { pr_sigaction64_t avar ; return 0; } EOF -if { (eval echo configure:8371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes else @@ -8389,12 +8372,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:8393: checking for pr_siginfo64_t in sys/procfs.h" >&5 +echo "configure:8376: checking for pr_siginfo64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8398 "configure" +#line 8381 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8403,7 +8386,7 @@ int main() { pr_siginfo64_t avar ; return 0; } EOF -if { (eval echo configure:8407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes else @@ -8430,7 +8413,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:8434: checking whether prfpregset_t type is broken" >&5 +echo "configure:8417: 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 @@ -8438,7 +8421,7 @@ else gdb_cv_prfpregset_t_broken=yes else cat > conftest.$ac_ext <<EOF -#line 8442 "configure" +#line 8425 "configure" #include "confdefs.h" #include <sys/procfs.h> int main () @@ -8448,7 +8431,7 @@ else return 0; } EOF -if { (eval echo configure:8452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8435: \"$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 @@ -8473,12 +8456,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8477: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:8460: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8482 "configure" +#line 8465 "configure" #include "confdefs.h" #include <unistd.h> #include <sys/types.h> @@ -8491,7 +8474,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8495: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -8515,19 +8498,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:8519: checking for member l_addr in struct link_map" >&5 +echo "configure:8502: checking for member l_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8524 "configure" +#line 8507 "configure" #include "confdefs.h" #include <link.h> int main() { struct link_map lm; (void) lm.l_addr; ; return 0; } EOF -if { (eval echo configure:8531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_l_members=yes else @@ -8549,12 +8532,12 @@ EOF echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:8553: checking for member lm_addr in struct link_map" >&5 +echo "configure:8536: checking for member lm_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8558 "configure" +#line 8541 "configure" #include "confdefs.h" #include <sys/types.h> #include <link.h> @@ -8562,7 +8545,7 @@ int main() { struct link_map lm; (void) lm.lm_addr; ; return 0; } EOF -if { (eval echo configure:8566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_lm_members=yes else @@ -8584,12 +8567,12 @@ EOF echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6 -echo "configure:8588: checking for member som_addr in struct so_map" >&5 +echo "configure:8571: checking for member som_addr in struct so_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8593 "configure" +#line 8576 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_NLIST_H @@ -8600,7 +8583,7 @@ int main() { struct so_map lm; (void) lm.som_addr; ; return 0; } EOF -if { (eval echo configure:8604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_so_map_with_som_members=yes else @@ -8622,12 +8605,12 @@ EOF echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6 -echo "configure:8626: checking for struct link_map32 in sys/link.h" >&5 +echo "configure:8609: checking for struct link_map32 in sys/link.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8631 "configure" +#line 8614 "configure" #include "confdefs.h" #define _SYSCALL32 #include <sys/link.h> @@ -8635,7 +8618,7 @@ int main() { struct link_map32 l; ; return 0; } EOF -if { (eval echo configure:8639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map32=yes else @@ -8662,12 +8645,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:8666: checking for long long support in compiler" >&5 +echo "configure:8649: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8671 "configure" +#line 8654 "configure" #include "confdefs.h" int main() { @@ -8677,7 +8660,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8664: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -8699,7 +8682,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:8703: checking for long long support in printf" >&5 +echo "configure:8686: 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 @@ -8707,7 +8690,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <<EOF -#line 8711 "configure" +#line 8694 "configure" #include "confdefs.h" int main () { @@ -8721,7 +8704,7 @@ int main () { return (strcmp ("0x0123456789abcdef", buf)); } EOF -if { (eval echo configure:8725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8708: \"$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 @@ -8745,19 +8728,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:8749: checking for long double support in compiler" >&5 +echo "configure:8732: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8754 "configure" +#line 8737 "configure" #include "confdefs.h" int main() { long double foo; ; return 0; } EOF -if { (eval echo configure:8761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -8779,7 +8762,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:8783: checking for long double support in printf" >&5 +echo "configure:8766: 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 @@ -8787,7 +8770,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <<EOF -#line 8791 "configure" +#line 8774 "configure" #include "confdefs.h" int main () { @@ -8797,7 +8780,7 @@ int main () { return (strncmp ("3.14159", buf, 7)); } EOF -if { (eval echo configure:8801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8784: \"$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 @@ -8821,7 +8804,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:8825: checking for long double support in scanf" >&5 +echo "configure:8808: 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 @@ -8829,7 +8812,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext <<EOF -#line 8833 "configure" +#line 8816 "configure" #include "confdefs.h" int main () { @@ -8839,7 +8822,7 @@ int main () { return !(f > 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:8843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8826: \"$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 @@ -8864,7 +8847,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:8868: checking for -bbigtoc option" >&5 +echo "configure:8851: checking for -bbigtoc option" >&5 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8878,14 +8861,14 @@ else LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc cat > conftest.$ac_ext <<EOF -#line 8882 "configure" +#line 8865 "configure" #include "confdefs.h" int main() { int i; ; return 0; } EOF -if { (eval echo configure:8889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -8908,7 +8891,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:8912: checking for HPUX/OSF thread support" >&5 +echo "configure:8895: 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 @@ -8916,7 +8899,7 @@ echo "configure:8912: checking for HPUX/OSF thread support" >&5 #define HAVE_HPUX_THREAD_SUPPORT 1 EOF - CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o" + CONFIG_OBS="${CONFIG_OBS} hpux-thread.o" CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c" else echo "$ac_t""no (suppressed because you are not using GCC)" 1>&6 @@ -8931,17 +8914,17 @@ 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:8935: checking for Solaris thread debugging library" >&5 +echo "configure:8918: 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 #define HAVE_THREAD_DB_LIB 1 EOF - CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o" + CONFIG_OBS="${CONFIG_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:8945: checking for dlopen in -ldl" >&5 +echo "configure:8928: 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 @@ -8949,7 +8932,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 8953 "configure" +#line 8936 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8960,7 +8943,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:8964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8947: \"$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 @@ -8992,17 +8975,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:8996: checking for the ld -export-dynamic flag" >&5 +echo "configure:8979: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <<EOF -#line 8999 "configure" +#line 8982 "configure" #include "confdefs.h" int main() { int i; ; return 0; } EOF -if { (eval echo configure:9006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -9021,13 +9004,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in <proc_service.h> # at one point. echo $ac_n "checking if <proc_service.h> is old""... $ac_c" 1>&6 -echo "configure:9025: checking if <proc_service.h> is old" >&5 +echo "configure:9008: checking if <proc_service.h> is old" >&5 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9031 "configure" +#line 9014 "configure" #include "confdefs.h" #include <proc_service.h> @@ -9038,7 +9021,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:9042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -9064,12 +9047,12 @@ EOF ;; aix*) echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6 -echo "configure:9068: checking for AiX thread debugging library" >&5 +echo "configure:9051: 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 <<EOF -#line 9073 "configure" +#line 9056 "configure" #include "confdefs.h" #include <sys/pthdebug.h> int main() { @@ -9078,7 +9061,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:9082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_aix_thread_debug=yes else @@ -9093,7 +9076,7 @@ fi echo "$ac_t""$gdb_cv_have_aix_thread_debug" 1>&6 if test $gdb_cv_have_aix_thread_debug = yes; then CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" - CONFIG_LIB_OBS="${CONFIG_LIB_OBS} aix-thread.o" + CONFIG_OBS="${CONFIG_OBS} aix-thread.o" CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug" fi ;; @@ -9103,19 +9086,19 @@ fi if test "x$ac_cv_header_thread_db_h" = "xyes"; then echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6 -echo "configure:9107: checking whether <thread_db.h> has TD_NOTALLOC" >&5 +echo "configure:9090: checking whether <thread_db.h> 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 <<EOF -#line 9112 "configure" +#line 9095 "configure" #include "confdefs.h" #include <thread_db.h> int main() { int i = TD_NOTALLOC; ; return 0; } EOF -if { (eval echo configure:9119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_thread_db_h_has_td_notalloc=yes else @@ -9140,19 +9123,19 @@ fi if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then echo $ac_n "checking whether <sys/syscall.h> has __NR_tkill""... $ac_c" 1>&6 -echo "configure:9144: checking whether <sys/syscall.h> has __NR_tkill" >&5 +echo "configure:9127: checking whether <sys/syscall.h> 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 <<EOF -#line 9149 "configure" +#line 9132 "configure" #include "confdefs.h" #include <sys/syscall.h> int main() { int i = __NR_tkill; ; return 0; } EOF -if { (eval echo configure:9156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_sys_syscall_h_has_tkill=yes else @@ -9264,7 +9247,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:9268: checking compiler warning flags" >&5 +echo "configure:9251: 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 @@ -9274,14 +9257,14 @@ echo "configure:9268: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <<EOF -#line 9278 "configure" +#line 9261 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:9285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -9299,12 +9282,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:9303: checking for cygwin" >&5 +echo "configure:9286: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9308 "configure" +#line 9291 "configure" #include "confdefs.h" #if defined (__CYGWIN__) || defined (__CYGWIN32__) @@ -9382,7 +9365,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:9386: checking for Tcl configuration" >&5 +echo "configure:9369: 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 @@ -9491,7 +9474,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:9495: checking for Tk configuration" >&5 +echo "configure:9478: 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 @@ -9600,7 +9583,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:9604: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:9587: 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" @@ -9666,17 +9649,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:9670: checking for tclInt.h" >&5 +echo "configure:9653: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9675 "configure" +#line 9658 "configure" #include "confdefs.h" #include <tclInt.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9663: \"$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* @@ -9736,7 +9719,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:9740: checking for Tk private headers" >&5 +echo "configure:9723: 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" @@ -9802,17 +9785,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:9806: checking for tk.h" >&5 +echo "configure:9789: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9811 "configure" +#line 9794 "configure" #include "confdefs.h" #include <tk.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9799: \"$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* @@ -9858,7 +9841,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9862: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:9845: 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 @@ -9881,7 +9864,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9885: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:9868: 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 @@ -9936,7 +9919,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:9940: checking for Itcl configuration" >&5 +echo "configure:9923: 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 @@ -10039,7 +10022,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:10043: checking for Itk configuration" >&5 +echo "configure:10026: 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 @@ -10147,11 +10130,10 @@ fi CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)" CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)" CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)" - CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_GDBTK_INITS)" - CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)" - CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)" - CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)" - CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)" + CONFIG_ALL="${CONFIG_ALL} all-gdbtk" + CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk" + CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk" + CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk" if test x$gdb_cv_os_cygwin = xyes; then WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32" @@ -10182,7 +10164,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:10186: checking for X" >&5 +echo "configure:10168: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -10244,12 +10226,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 10248 "configure" +#line 10230 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10235: \"$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* @@ -10318,14 +10300,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 10322 "configure" +#line 10304 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:10329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10311: \"$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. @@ -10464,8 +10446,6 @@ fi - - # target_subdir is used by the testsuite to find the target libraries. target_subdir= if test "${host}" != "${target}"; then @@ -10539,7 +10519,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:10543: checking whether gdbserver is supported on this host" >&5 +echo "configure:10523: 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 @@ -10603,12 +10583,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:10607: checking for Cygwin environment" >&5 +echo "configure:10587: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10612 "configure" +#line 10592 "configure" #include "confdefs.h" int main() { @@ -10619,7 +10599,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:10623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -10636,19 +10616,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:10640: checking for mingw32 environment" >&5 +echo "configure:10620: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10645 "configure" +#line 10625 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:10652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -10667,7 +10647,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:10671: checking for executable suffix" >&5 +echo "configure:10651: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10677,7 +10657,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:10681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:10661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -10719,7 +10699,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:10723: checking for iconv" >&5 +echo "configure:10703: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10727,7 +10707,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 10731 "configure" +#line 10711 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -10737,7 +10717,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -10749,7 +10729,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext <<EOF -#line 10753 "configure" +#line 10733 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -10759,7 +10739,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10743: \"$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 @@ -10780,13 +10760,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:10784: checking for iconv declaration" >&5 +echo "configure:10764: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10790 "configure" +#line 10770 "configure" #include "confdefs.h" #include <stdlib.h> @@ -10805,7 +10785,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else @@ -11086,10 +11066,8 @@ s%@IGNORE_SIM_OBS@%$IGNORE_SIM_OBS%g s%@ENABLE_CFLAGS@%$ENABLE_CFLAGS%g s%@PROFILE_CFLAGS@%$PROFILE_CFLAGS%g s%@CONFIG_OBS@%$CONFIG_OBS%g -s%@CONFIG_LIB_OBS@%$CONFIG_LIB_OBS%g s%@CONFIG_DEPS@%$CONFIG_DEPS%g s%@CONFIG_SRCS@%$CONFIG_SRCS%g -s%@CONFIG_INITS@%$CONFIG_INITS%g s%@CONFIG_ALL@%$CONFIG_ALL%g s%@CONFIG_CLEAN@%$CONFIG_CLEAN%g s%@CONFIG_INSTALL@%$CONFIG_INSTALL%g diff --git a/gdb/configure.host b/gdb/configure.host index 6f28482..668008b 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -51,9 +51,11 @@ hppa*-*-hpux*) gdb_host=hppahpux ;; i[34567]86-ncr-*) gdb_host=ncr3000 ;; i[34567]86-*-bsd*) gdb_host=i386bsd ;; i[34567]86-*-dgux*) gdb_host=i386v4 ;; +i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) + gdb_host=fbsd ;; +i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu) + gdb_host=nbsdelf ;; 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 ;; @@ -132,6 +134,8 @@ sparc-*-netbsdelf*) gdb_host=nbsdelf ;; sparc-*-netbsdaout*) gdb_host=nbsdaout ;; sparc-*-netbsd*) gdb_host=nbsdaout ;; sparc64-*-netbsd*) gdb_host=nbsd64 ;; +sparc-*-openbsd*) gdb_host=nbsdelf ;; +sparc64-*-openbsd*) gdb_host=nbsd64 ;; sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*) gdb_host=sol2 ;; diff --git a/gdb/configure.in b/gdb/configure.in index 84ecaa6..245b720 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -60,10 +60,8 @@ AC_DEFINE_DIR(DEBUGDIR, debugdir, dnl List of object files added by configure. CONFIG_OBS= -CONFIG_LIB_OBS= CONFIG_DEPS= CONFIG_SRCS= -CONFIG_INITS= ENABLE_CFLAGS= CONFIG_ALL= CONFIG_CLEAN= @@ -114,12 +112,7 @@ if test x"$enable_gdbcli" = xyes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)" - CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_CLI_INITS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)" - CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_CLI_ALL)" - CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_CLI_CLEAN)" - CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_CLI_INSTALL)" - CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_CLI_UNINSTALL)" fi fi @@ -138,12 +131,7 @@ if test x"$enable_gdbmi" = xyes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)" - CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_MI_INITS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)" - CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_MI_ALL)" - CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_MI_CLEAN)" - CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_MI_INSTALL)" - CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_MI_UNINSTALL)" fi fi @@ -161,12 +149,7 @@ if test x"$enable_tui" = xyes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)" - CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)" - CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_TUI_ALL)" - CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_TUI_CLEAN)" - CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_TUI_INSTALL)" - CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_TUI_UNINSTALL)" need_curses=yes fi fi @@ -623,7 +606,7 @@ if test "${target}" = "${host}"; then *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* ) AC_DEFINE(NEW_PROC_API) ;; - *-*-solaris2.[[678]]) + *-*-solaris2.[[6789]]) AC_DEFINE(NEW_PROC_API) ;; esac @@ -876,7 +859,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then if test "$GCC" = "yes" ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT) - CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o" + CONFIG_OBS="${CONFIG_OBS} hpux-thread.o" CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c" else AC_MSG_RESULT(no (suppressed because you are not using GCC)) @@ -894,7 +877,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then if test -f /usr/lib/libthread_db.so.1 ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_THREAD_DB_LIB) - CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o" + CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" AC_CHECK_LIB(dl, dlopen) if test "$GCC" = "yes" ; then @@ -941,7 +924,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then AC_MSG_RESULT($gdb_cv_have_aix_thread_debug) if test $gdb_cv_have_aix_thread_debug = yes; then CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" - CONFIG_LIB_OBS="${CONFIG_LIB_OBS} aix-thread.o" + CONFIG_OBS="${CONFIG_OBS} aix-thread.o" CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug" fi ;; @@ -1214,11 +1197,10 @@ if test "${enable_gdbtk}" = "yes"; then CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)" CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)" CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)" - CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_GDBTK_INITS)" - CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)" - CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)" - CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)" - CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)" + CONFIG_ALL="${CONFIG_ALL} all-gdbtk" + CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk" + CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk" + CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk" if test x$gdb_cv_os_cygwin = xyes; then WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32" @@ -1284,10 +1266,8 @@ AC_SUBST(ENABLE_CFLAGS) AC_SUBST(PROFILE_CFLAGS) AC_SUBST(CONFIG_OBS) -AC_SUBST(CONFIG_LIB_OBS) AC_SUBST(CONFIG_DEPS) AC_SUBST(CONFIG_SRCS) -AC_SUBST(CONFIG_INITS) AC_SUBST(CONFIG_ALL) AC_SUBST(CONFIG_CLEAN) AC_SUBST(CONFIG_INSTALL) diff --git a/gdb/configure.tgt b/gdb/configure.tgt index f974631..0d159d4 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -38,8 +38,7 @@ esac case "${target}" in x86_64-*-freebsd*) gdb_target=fbsd64 ;; -*-*-freebsd*) gdb_target=fbsd - ;; +*-*-freebsd*) gdb_target=fbsd ;; alpha*-*-osf*) gdb_target=alpha-osf1 ;; alpha*-*-linux*) gdb_target=alpha-linux ;; @@ -78,7 +77,8 @@ hppa*-*-*) gdb_target=hppa ;; i[34567]86-ncr-*) gdb_target=ncr3000 ;; i[34567]86-*-bsd*) gdb_target=i386bsd ;; -i[34567]86-*-netbsd*) gdb_target=nbsd ;; +i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu) + gdb_target=nbsd ;; i[34567]86-*-openbsd*) gdb_target=obsd ;; i[34567]86-*-go32*) gdb_target=i386aout ;; i[34567]86-*-msdosdjgpp*) gdb_target=go32 ;; @@ -190,6 +190,10 @@ sparc-*-linux*) gdb_target=linux ;; sparc64-*-linux*) gdb_target=linux64 ;; sparc-*-netbsd*) gdb_target=nbsd ;; sparc64-*-netbsd*) gdb_target=nbsd64 ;; +sparc-*-openbsd*) gdb_target=obsd ;; +sparc64-*-openbsd*) gdb_target=obsd64 + gdb_osabi=GDB_OSABI_OPENBSD_ELF + ;; sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) gdb_target=sol2 ;; diff --git a/gdb/corelow.c b/gdb/corelow.c index 8fc3e66..d14b3a3 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -477,7 +477,7 @@ get_core_register_section (char *name, } gdb_assert (core_vec); - core_vec->core_read_registers (contents, size, which, + core_vec->core_read_registers (contents, size, which, ((CORE_ADDR) bfd_section_vma (core_bfd, section))); } @@ -515,6 +515,63 @@ core_files_info (struct target_ops *t) print_section_info (t, core_bfd); } +static LONGEST +core_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, + const void *writebuf, ULONGEST offset, LONGEST len) +{ + switch (object) + { + case TARGET_OBJECT_MEMORY: + if (readbuf) + return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/, + NULL, ops); + if (writebuf) + return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/, + NULL, ops); + return -1; + + case TARGET_OBJECT_AUXV: + if (readbuf) + { + /* When the aux vector is stored in core file, BFD + represents this with a fake section called ".auxv". */ + + sec_ptr section; + bfd_size_type size; + char *contents; + + section = bfd_get_section_by_name (core_bfd, ".auxv"); + if (section == NULL) + return -1; + + size = bfd_section_size (core_bfd, section); + if (offset >= size) + return 0; + size -= offset; + if (size > len) + size = len; + if (size > 0 && + ! bfd_get_section_contents (core_bfd, section, readbuf, + (file_ptr) offset, size)) + { + warning ("Couldn't read NT_AUXV note in core file."); + return -1; + } + + return size; + } + return -1; + + default: + if (ops->beneath != NULL) + return ops->beneath->to_xfer_partial (ops->beneath, object, annex, + readbuf, writebuf, offset, len); + return -1; + } +} + + /* If mourn is being called in all the right places, this could be say `gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */ @@ -551,6 +608,7 @@ init_core_ops (void) core_ops.to_attach = find_default_attach; core_ops.to_detach = core_detach; core_ops.to_fetch_registers = get_core_registers; + core_ops.to_xfer_partial = core_xfer_partial; core_ops.to_xfer_memory = xfer_memory; core_ops.to_files_info = core_files_info; core_ops.to_insert_breakpoint = ignore; diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index fed440e..a731352 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -31,6 +31,7 @@ #include "gdbtypes.h" #include "dictionary.h" #include "command.h" +#include "frame.h" /* When set, the file that we're processing is known to have debugging info for C++ namespaces. */ @@ -85,6 +86,10 @@ static struct symbol *lookup_symbol_file (const char *name, struct symtab **symtab, int anonymous_namespace); +static struct type *cp_lookup_transparent_type_loop (const char *name, + const char *scope, + int scope_len); + static void initialize_namespace_symtab (struct objfile *objfile); static struct block *get_possible_namespace_block (struct objfile *objfile); @@ -551,6 +556,74 @@ cp_lookup_nested_type (struct type *parent_type, } } +/* The C++-version of lookup_transparent_type. */ + +/* FIXME: carlton/2004-01-16: The problem that this is trying to + address is that, unfortunately, sometimes NAME is wrong: it may not + include the name of namespaces enclosing the type in question. + lookup_transparent_type gets called when the the type in question + is a declaration, and we're trying to find its definition; but, for + declarations, our type name deduction mechanism doesn't work. + There's nothing we can do to fix this in general, I think, in the + absence of debug information about namespaces (I've filed PR + gdb/1511 about this); until such debug information becomes more + prevalent, one heuristic which sometimes looks is to search for the + definition in namespaces containing the current namespace. + + We should delete this functions once the appropriate debug + information becomes more widespread. (GCC 3.4 will be the first + released version of GCC with such information.) */ + +struct type * +cp_lookup_transparent_type (const char *name) +{ + /* First, try the honest way of looking up the definition. */ + struct type *t = basic_lookup_transparent_type (name); + const char *scope; + + if (t != NULL) + return t; + + /* If that doesn't work and we're within a namespace, look there + instead. */ + scope = block_scope (get_selected_block (0)); + + if (scope[0] == '\0') + return NULL; + + return cp_lookup_transparent_type_loop (name, scope, 0); +} + +/* Lookup the the type definition associated to NAME in + namespaces/classes containing SCOPE whose name is strictly longer + than LENGTH. LENGTH must be the index of the start of a + component of SCOPE. */ + +static struct type * +cp_lookup_transparent_type_loop (const char *name, const char *scope, + int length) +{ + int scope_length = cp_find_first_component (scope + length); + char *full_name; + + /* If the current scope is followed by "::", look in the next + component. */ + if (scope[scope_length] == ':') + { + struct type *retval + = cp_lookup_transparent_type_loop (name, scope, scope_length + 2); + if (retval != NULL) + return retval; + } + + full_name = alloca (scope_length + 2 + strlen (name) + 1); + strncpy (full_name, scope, scope_length); + strncpy (full_name + scope_length, "::", 2); + strcpy (full_name + scope_length + 2, name); + + return basic_lookup_transparent_type (full_name); +} + /* Now come functions for dealing with symbols associated to namespaces. (They're used to store the namespaces themselves, not objects that live in the namespaces.) These symbols come in two @@ -582,7 +655,7 @@ initialize_namespace_symtab (struct objfile *objfile) namespace_symtab->free_code = free_nothing; namespace_symtab->dirname = NULL; - bv = obstack_alloc (&objfile->symbol_obstack, + bv = obstack_alloc (&objfile->objfile_obstack, sizeof (struct blockvector) + FIRST_LOCAL_BLOCK * sizeof (struct block *)); BLOCKVECTOR_NBLOCKS (bv) = FIRST_LOCAL_BLOCK + 1; @@ -590,12 +663,12 @@ initialize_namespace_symtab (struct objfile *objfile) /* Allocate empty GLOBAL_BLOCK and STATIC_BLOCK. */ - bl = allocate_block (&objfile->symbol_obstack); - BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + bl = allocate_block (&objfile->objfile_obstack); + BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack, NULL); BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl; - bl = allocate_block (&objfile->symbol_obstack); - BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + bl = allocate_block (&objfile->objfile_obstack); + BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack, NULL); BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl; @@ -613,7 +686,7 @@ initialize_namespace_symtab (struct objfile *objfile) having a symtab/block for this purpose seems like the best solution for now. */ - bl = allocate_block (&objfile->symbol_obstack); + bl = allocate_block (&objfile->objfile_obstack); BLOCK_DICT (bl) = dict_create_hashed_expandable (); BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK) = bl; @@ -710,17 +783,23 @@ check_one_possible_namespace_symbol (const char *name, int len, struct objfile *objfile) { struct block *block = get_possible_namespace_block (objfile); - char *name_copy = obsavestring (name, len, &objfile->symbol_obstack); - struct symbol *sym = lookup_block_symbol (block, name_copy, NULL, - VAR_DOMAIN); + char *name_copy = alloca (len + 1); + struct symbol *sym; + + memcpy (name_copy, name, len); + name_copy[len] = '\0'; + sym = lookup_block_symbol (block, name_copy, NULL, VAR_DOMAIN); if (sym == NULL) { - struct type *type = init_type (TYPE_CODE_NAMESPACE, 0, 0, - name_copy, objfile); + struct type *type; + name_copy = obsavestring (name, len, &objfile->objfile_obstack); + + type = init_type (TYPE_CODE_NAMESPACE, 0, 0, name_copy, objfile); + TYPE_TAG_NAME (type) = TYPE_NAME (type); - sym = obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_LANGUAGE (sym) = language_cplus; SYMBOL_SET_NAMES (sym, name_copy, len, objfile); @@ -733,11 +812,7 @@ check_one_possible_namespace_symbol (const char *name, int len, return 0; } else - { - obstack_free (&objfile->symbol_obstack, name_copy); - - return 1; - } + return 1; } /* Look for a symbol named NAME in all the possible namespace blocks. diff --git a/gdb/cp-support.c b/gdb/cp-support.c index bd76fae..4344545 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -52,7 +52,15 @@ 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); +static void overload_list_add_symbol (struct symbol *sym, + const char *oload_name); + +static void make_symbol_overload_list_using (const char *func_name, + const char *namespace); + +static void make_symbol_overload_list_qualified (const char *func_name); + +static void read_in_psymtabs (const char *oload_name); /* The list of "maint cplus" commands. */ @@ -386,6 +394,34 @@ cp_entire_prefix_len (const char *name) return previous_len; } +/* If FULL_NAME is the demangled name of a C++ function (including an + arg list, possibly including namespace/class qualifications), + return a new string containing only the function name (without the + arg list/class qualifications). Otherwise, return NULL. The + caller is responsible for freeing the memory in question. */ + +char * +cp_func_name (const char *full_name) +{ + const char *previous_component = full_name; + const char *next_component; + + if (!full_name) + return NULL; + + for (next_component = (previous_component + + cp_find_first_component (previous_component)); + *next_component == ':'; + next_component = (previous_component + + cp_find_first_component (previous_component))) + { + /* Skip '::'. */ + previous_component = next_component + 2; + } + + return remove_params (previous_component); +} + /* Overload resolution functions. */ static char * @@ -430,12 +466,12 @@ remove_params (const char *demangled_name) 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. */ +/* Test to see if SYM is a symbol that we haven't seen corresponding + to a function named OLOAD_NAME. If so, add it to the current + completion list. */ static void -overload_list_add_symbol (struct symbol *sym, char *oload_name) +overload_list_add_symbol (struct symbol *sym, const char *oload_name) { int newsize; int i; @@ -447,11 +483,12 @@ overload_list_add_symbol (struct symbol *sym, char *oload_name) /* 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]))) + if (strcmp (SYMBOL_LINKAGE_NAME (sym), + SYMBOL_LINKAGE_NAME (sym_return_val[i])) == 0) return; /* Get the demangled name without parameters */ - sym_name = remove_params (SYMBOL_DEMANGLED_NAME (sym)); + sym_name = remove_params (SYMBOL_NATURAL_NAME (sym)); if (!sym_name) return; @@ -476,82 +513,108 @@ overload_list_add_symbol (struct symbol *sym, char *oload_name) } /* 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. */ - + are named FUNC_NAME and are visible within NAMESPACE. */ struct symbol ** -make_symbol_overload_list (struct symbol *fsym) +make_symbol_overload_list (const char *func_name, + const char *namespace) { - struct symbol *sym; - struct symtab *s; - struct partial_symtab *ps; - struct objfile *objfile; - 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; + struct cleanup *old_cleanups; - /* Look for the symbol we are supposed to complete on. */ + sym_return_val_size = 100; + sym_return_val_index = 0; + sym_return_val = xmalloc ((sym_return_val_size + 1) * + sizeof (struct symbol *)); + sym_return_val[0] = NULL; - 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; + old_cleanups = make_cleanup (xfree, sym_return_val); + + make_symbol_overload_list_using (func_name, namespace); + + discard_cleanups (old_cleanups); + + return sym_return_val; +} + +/* This applies the using directives to add namespaces to search in, + and then searches for overloads in all of those namespaces. It + adds the symbols found to sym_return_val. Arguments are as in + make_symbol_overload_list. */ + +static void +make_symbol_overload_list_using (const char *func_name, + const char *namespace) +{ + const struct using_direct *current; + + /* First, go through the using directives. If any of them apply, + look in the appropriate namespaces for new functions to match + on. */ - return sym_return_val; + for (current = block_using (get_selected_block (0)); + current != NULL; + current = current->next) + { + if (strcmp (namespace, current->outer) == 0) + { + make_symbol_overload_list_using (func_name, + current->inner); + } } - 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; + /* Now, add names for this namespace. */ + + if (namespace[0] == '\0') + { + make_symbol_overload_list_qualified (func_name); + } + else + { + char *concatenated_name + = alloca (strlen (namespace) + 2 + strlen (func_name) + 1); + strcpy (concatenated_name, namespace); + strcat (concatenated_name, "::"); + strcat (concatenated_name, func_name); + make_symbol_overload_list_qualified (concatenated_name); + } +} - /* Read in all partial symtabs containing a partial symbol named - OLOAD_NAME. */ +/* This does the bulk of the work of finding overloaded symbols. + FUNC_NAME is the name of the overloaded function we're looking for + (possibly including namespace info). */ - ALL_PSYMTABS (objfile, ps) - { - struct partial_symbol **psym; +static void +make_symbol_overload_list_qualified (const char *func_name) +{ + struct symbol *sym; + struct symtab *s; + struct objfile *objfile; + const struct block *b, *surrounding_static_block = 0; + struct dict_iterator iter; + const struct dictionary *dict; - /* If the psymtab's been read in we'll get it when we search - through the blockvector. */ - if (ps->readin) - continue; + /* Look through the partial symtabs for all symbols which begin + by matching FUNC_NAME. Make sure we read that symbol table in. */ - 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); - } + read_in_psymtabs (func_name); /* 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 */ - } + dict = BLOCK_DICT (b); - /* 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) + for (sym = dict_iter_name_first (dict, func_name, &iter); + sym; + sym = dict_iter_name_next (func_name, &iter)) { - overload_list_add_symbol (sym, oload_name); + overload_list_add_symbol (sym, func_name); } } + surrounding_static_block = block_static_block (get_selected_block (0)); + /* Go through the symtabs and check the externs and statics for symbols which match. */ @@ -559,10 +622,14 @@ make_symbol_overload_list (struct symbol *fsym) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); - ALL_BLOCK_SYMBOLS (b, iter, sym) - { - overload_list_add_symbol (sym, oload_name); - } + dict = BLOCK_DICT (b); + + for (sym = dict_iter_name_first (dict, func_name, &iter); + sym; + sym = dict_iter_name_next (func_name, &iter)) + { + overload_list_add_symbol (sym, func_name); + } } ALL_SYMTABS (objfile, s) @@ -572,15 +639,37 @@ make_symbol_overload_list (struct symbol *fsym) /* 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); - } + dict = BLOCK_DICT (b); + + for (sym = dict_iter_name_first (dict, func_name, &iter); + sym; + sym = dict_iter_name_next (func_name, &iter)) + { + overload_list_add_symbol (sym, func_name); + } } +} + +/* Look through the partial symtabs for all symbols which begin + by matching FUNC_NAME. Make sure we read that symbol table in. */ + +static void +read_in_psymtabs (const char *func_name) +{ + struct partial_symtab *ps; + struct objfile *objfile; - xfree (oload_name); + ALL_PSYMTABS (objfile, ps) + { + if (ps->readin) + continue; - return (sym_return_val); + if ((lookup_partial_symbol (ps, func_name, NULL, 1, VAR_DOMAIN) + != NULL) + || (lookup_partial_symbol (ps, func_name, NULL, 0, VAR_DOMAIN) + != NULL)) + psymtab_to_symtab (ps); + } } /* Lookup the rtti type for a class name. */ diff --git a/gdb/cp-support.h b/gdb/cp-support.h index d4785c3..bbf911a 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -60,7 +60,10 @@ 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 *); +extern char *cp_func_name (const char *full_name); + +extern struct symbol **make_symbol_overload_list (const char *, + const char *); extern struct type *cp_lookup_rtti_type (const char *name, struct block *block); @@ -108,6 +111,8 @@ extern struct type *cp_lookup_nested_type (struct type *parent_type, extern void cp_check_possible_namespace_symbols (const char *name, struct objfile *objfile); +struct type *cp_lookup_transparent_type (const char *name); + /* The list of "maint cplus" commands. */ extern struct cmd_list_element *maint_cplus_cmd_list; diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 6ef3b05..2e55c9b 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -172,12 +172,6 @@ cris_mode (void) return (gdbarch_tdep (current_gdbarch)->cris_mode); } -static const char * -cris_abi (void) -{ - return (gdbarch_tdep (current_gdbarch)->cris_abi); -} - struct frame_extra_info { CORE_ADDR return_pc; @@ -293,18 +287,6 @@ cris_get_operand1 (unsigned short insn) /* Additional functions in order to handle opcodes. */ static int -cris_get_wide_opcode (unsigned short insn) -{ - return ((insn & 0x03E0) >> 5); -} - -static int -cris_get_short_size (unsigned short insn) -{ - return ((insn & 0x0010) >> 4); -} - -static int cris_get_quick_value (unsigned short insn) { return (insn & 0x003F); @@ -329,12 +311,6 @@ cris_get_asr_shift_steps (unsigned long value) } static int -cris_get_asr_quick_shift_steps (unsigned short insn) -{ - return (insn & 0x1F); -} - -static int cris_get_clear_size (unsigned short insn) { return ((insn) & 0xC000); @@ -717,16 +693,6 @@ cris_skip_prologue (CORE_ADDR pc) return cris_skip_prologue_main (pc, 0); } -/* As cris_skip_prologue, but stops as soon as it knows that the function - has a frame. Its result is equal to its input pc if the function is - frameless, unequal otherwise. */ - -static CORE_ADDR -cris_skip_prologue_frameless_p (CORE_ADDR pc) -{ - return cris_skip_prologue_main (pc, 1); -} - /* Given a PC value corresponding to the start of a function, return the PC of the first instruction after the function prologue. */ @@ -2776,63 +2742,6 @@ move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env) inst_env->disable_interrupt = 0; } -/* Handles the pop instruction to a general register. - POP is a assembler macro for MOVE.D [SP+], Rd. */ - -static void -reg_pop_op (unsigned short inst, inst_env_type *inst_env) -{ - /* POP can't have a prefix. */ - if (inst_env->prefix_found) - { - inst_env->invalid = 1; - return; - } - if (cris_get_operand2 (inst) == REG_PC) - { - /* It's invalid to change the PC in a delay slot. */ - if (inst_env->slot_needed) - { - inst_env->invalid = 1; - return; - } - inst_env->reg[REG_PC] = - read_memory_unsigned_integer (inst_env->reg[REG_SP], 4); - } - inst_env->slot_needed = 0; - inst_env->prefix_found = 0; - inst_env->xflag_found = 0; - inst_env->disable_interrupt = 0; -} - -/* Handles moves from register to memory. */ - -static void -move_reg_to_mem_index_inc_op (unsigned short inst, inst_env_type *inst_env) -{ - /* Check if we have a prefix. */ - if (inst_env->prefix_found) - { - /* The only thing that can change the PC is an assign. */ - check_assign (inst, inst_env); - } - else if ((cris_get_operand1 (inst) == REG_PC) - && (cris_get_mode (inst) == AUTOINC_MODE)) - { - /* It's invalid to change the PC in a delay slot. */ - if (inst_env->slot_needed) - { - inst_env->invalid = 1; - return; - } - process_autoincrement (cris_get_size (inst), inst, inst_env); - } - inst_env->slot_needed = 0; - inst_env->prefix_found = 0; - inst_env->xflag_found = 0; - inst_env->disable_interrupt = 0; -} - /* Handles the intructions that's not yet implemented, by setting inst_env->invalid to true. */ @@ -4259,16 +4168,12 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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); set_gdbarch_skip_prologue (gdbarch, cris_skip_prologue); - set_gdbarch_prologue_frameless_p (gdbarch, generic_prologue_frameless_p); /* The stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, cris_breakpoint_from_pc); - /* The number of bytes at the start of arglist that are not really args, - 0 in the CRIS ABI. */ - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, cris_frameless_function_invocation); set_gdbarch_deprecated_frame_chain (gdbarch, cris_frame_chain); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index b4eb2bb..90936f6 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1515,7 +1515,6 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_remote_translate_xfer_address (gdbarch, remote_d10v_translate_xfer_address); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 62a583f..c1f7f8c 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -651,14 +651,13 @@ dbx_symfile_init (struct objfile *objfile) DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd); DBX_SYMTAB_OFFSET (objfile) = SYMBOL_TABLE_OFFSET; - /* Read the string table and stash it away in the psymbol_obstack. It is - only needed as long as we need to expand psymbols into full symbols, - so when we blow away the psymbol the string table goes away as well. + /* Read the string table and stash it away in the objfile_obstack. + When we blow away the objfile the string table goes away as well. Note that gdb used to use the results of attempting to malloc the string table, based on the size it read, as a form of sanity check for botched byte swapping, on the theory that a byte swapped string table size would be so totally bogus that the malloc would fail. Now - that we put in on the psymbol_obstack, we can't do this since gdb gets + that we put in on the objfile_obstack, we can't do this since gdb gets a fatal error (out of virtual memory) if the size is bogus. We can however at least check to see if the size is less than the size of the size field itself, or larger than the size of the entire file. @@ -710,7 +709,7 @@ dbx_symfile_init (struct objfile *objfile) DBX_STRINGTAB_SIZE (objfile)); DBX_STRINGTAB (objfile) = - (char *) obstack_alloc (&objfile->psymbol_obstack, + (char *) obstack_alloc (&objfile->objfile_obstack, DBX_STRINGTAB_SIZE (objfile)); OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile)); @@ -2147,7 +2146,7 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow, filename, textlow, global_syms, static_syms); result->read_symtab_private = (char *) - obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc)); LDSYMOFF (result) = ldsymoff; result->read_symtab = dbx_psymtab_to_symtab; SYMBOL_SIZE (result) = symbol_size; @@ -2269,7 +2268,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, if (number_dependencies) { pst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, number_dependencies * sizeof (struct partial_symtab *)); memcpy (pst->dependencies, dependency_list, number_dependencies * sizeof (struct partial_symtab *)); @@ -2285,7 +2284,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, /* Copy the sesction_offsets array from the main psymtab. */ subpst->section_offsets = pst->section_offsets; subpst->read_symtab_private = - (char *) obstack_alloc (&objfile->psymbol_obstack, + (char *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc)); LDSYMOFF (subpst) = LDSYMLEN (subpst) = @@ -2295,7 +2294,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ subpst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct partial_symtab *)); subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; @@ -3344,7 +3343,7 @@ coffstab_build_psymtabs (struct objfile *objfile, int mainline, if (stabstrsize > bfd_get_size (sym_bfd)) error ("ridiculous string table size: %d bytes", stabstrsize); DBX_STRINGTAB (objfile) = (char *) - obstack_alloc (&objfile->psymbol_obstack, stabstrsize + 1); + obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1); OBJSTAT (objfile, sz_strtab += stabstrsize + 1); /* Now read in the string table in one big gulp. */ @@ -3442,7 +3441,7 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline, if (stabstrsize > bfd_get_size (sym_bfd)) error ("ridiculous string table size: %d bytes", stabstrsize); DBX_STRINGTAB (objfile) = (char *) - obstack_alloc (&objfile->psymbol_obstack, stabstrsize + 1); + obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1); OBJSTAT (objfile, sz_strtab += stabstrsize + 1); /* Now read in the string table in one big gulp. */ @@ -3536,7 +3535,7 @@ stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name, if (DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd)) error ("ridiculous string table size: %d bytes", DBX_STRINGTAB_SIZE (objfile)); DBX_STRINGTAB (objfile) = (char *) - obstack_alloc (&objfile->psymbol_obstack, DBX_STRINGTAB_SIZE (objfile) + 1); + obstack_alloc (&objfile->objfile_obstack, DBX_STRINGTAB_SIZE (objfile) + 1); OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1); /* Now read in the string table in one big gulp. */ @@ -324,10 +324,11 @@ struct cleanup struct symtab; struct breakpoint; +struct frame_info; /* From blockframe.c */ -extern int inside_entry_func (CORE_ADDR); +extern int inside_entry_func (struct frame_info *this_frame); extern int deprecated_inside_entry_file (CORE_ADDR addr); @@ -444,22 +445,18 @@ 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 - filtering. For momement, always call this stream using + filtering. For moment, always call this stream using *_unfiltered. In the very near future that restriction shall be removed - either call shall be unfiltered. (cagney 1999-06-13). */ extern struct ui_file *gdb_stdlog; /* Target output that should bypass normal stdout/stderr filtering. - For momement, always call this stream using *_unfiltered. In the + For moment, always call this stream using *_unfiltered. In the 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" -#endif - #include "ui-file.h" /* More generic printf like operations. Filtered versions may return @@ -656,8 +653,6 @@ enum lval_type lval_reg_frame_relative }; -struct frame_info; - /* Control types for commands */ enum misc_command_type diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index ef9dc92..6e9c232 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,44 @@ +2004-02-12 Elena Zannoni <ezannoni@redhat.com> + + * gdb.texinfo: Properly quote the name "C++". + * gdbint.texinfo: Ditto. + * stabs.texinfo: Ditto. + +2004-02-11 Elena Zannoni <ezannoni@redhat.com> + + * gdbint.texinfo (Support Libraries): Add doco about obstacks and + minimal information about libiberty. + +2004-02-06 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.texinfo (Auxiliary Vector): Fix thinko with @value{GDBN}. + +2004-02-04 Roland McGrath <roland@redhat.com> + + * gdb.texinfo (Auxiliary Vector): New node (section). + (Data): Add it to the menu. + +2004-02-02 Jeff Johnston <jjohnstn@redhat.com> + + * gdb.texinfo (Breakpoints): Add information about pending + breakpoint support. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * gdb.texinfo (Overview): Delete references to the cisco protocol + including the "N" response. + +2004-01-26 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Rename + EXTRACT_STRUCT_VALUE_ADDRESS to + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS. + +2004-01-24 Eli Zaretskii <eliz@gnu.org> + + * gdb.texinfo (KOD): Document "show os". Add index entries for + "set/show os" and "info cisco" commands. + 2004-01-21 Eli Zaretskii <eliz@gnu.org> * Makefile.in (install-info): Prepend $(DESTDIR) to $(infodir). @@ -92,7 +133,7 @@ * gdb.texinfo (M32R/D): Mention m32rsdi target. -2003-10-15 Kevin Buettner <kevinb@redhat.com> +2003-10-15 Kevin Buettner <kevinb@redhat.com> From Anthony Green <green@redhat.com>: * gdb.texinfo (Breakpoints related warnings): Insert into menu. @@ -101,7 +142,7 @@ * gdb.texinfo (Breakpoint related warnings): New node. * gdbint.texinfo (ADJUST_BREAKPOINT_ADDRESS): Document. - + 2003-10-13 Daniel Jacobowitz <drow@mvista.com> * gdb.texinfo (Remote Protocol): Document v and vCont. @@ -133,7 +174,7 @@ 2003-09-30 Andrew Cagney <cagney@redhat.com> REGISTER_VIRTUAL_SIZE to DEPRECATED_REGISTER_VIRTUAL_SIZE. - (Target Architecture Definition): + (Target Architecture Definition): * gdbint.texinfo (Target Architecture Definition): Rename REGISTER_VIRTUAL_TYPE to DEPRECATED_REGISTER_VIRTUAL_TYPE. @@ -146,7 +187,7 @@ * gdbint.texinfo (Target Architecture Definition): Rename NPC_REGNUM to DEPRECATED_NPC_REGNUM. Add cross reference to TARGET_WRITE_PC. - + 2003-09-22 Michael Chastain <mec@shout.net> * gdbint.texinfo (Testsuite Organization): Change gdb.c++ to gdb.cp. @@ -420,7 +461,7 @@ 2003-04-02 Bob Rossi <bob_rossi@cox.net> - * gdb.texinfo (GDB/MI Program Control): Add + * gdb.texinfo (GDB/MI Program Control): Add '-file-list-exec-source-file' 2003-03-31 Andrew Cagney <cagney@redhat.com> @@ -432,7 +473,7 @@ * gdbint.texinfo (Target Architecture Definition): Remove reference to TARGET_WRITE_SP. - + 2003-03-27 Andrew Cagney <cagney@redhat.com> * gdbint.texinfo (Target Architecture Definition): Remove @@ -493,7 +534,7 @@ * gdbint.texinfo (Target Architecture Definition): Rename FRAME_SAVED_PC to DEPRECATED_FRAME_SAVED_PC. - + 2003-03-10 Corinna Vinschen <vinschen@redhat.com> * gdb.texinfo: Add File-I/O documentation. @@ -915,7 +956,7 @@ 2002-08-08 Grace Sainsbury <graces@redhat.com> - From Mark Salter: + From Mark Salter: * gdb.texinfo (Protocol): Document T packet extension to allow watchpoint address reporting. @@ -1073,7 +1114,7 @@ From Eli Zaretskii <eliz@is.elta.co.il> * gdb.texinfo (show max-user-call-depth): Correct formatting. - Provide a better explaination of this feature. + Provide a better explaination of this feature. 2002-04-14 Andrew Cagney <ac131313@redhat.com> @@ -1114,7 +1155,7 @@ * gdb.texinfo: Change all examples to @smallexample. * gdbint.texinfo: Ditto. - + 2002-03-18 Andrew Cagney <ac131313@redhat.com> * gdbint.texinfo (Releasing GDB): Add section ``Versions and @@ -1356,7 +1397,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com> * gdb.texinfo (maint info sections): Document. - * gdb.texinfo (info proc): Comment out documentation for + * gdb.texinfo (info proc): Comment out documentation for 'info proc' sub-options that are currently not implemented. 2001-12-20 Jim Blandy <jimb@redhat.com> @@ -1418,7 +1459,7 @@ Tue Jan 22 11:57:38 2002 Andrew Cagney <cagney@redhat.com> 2001-11-05 Michael Snyder <msnyder@redhat.com> - * gdb.texinfo (info functions): Document use of backslash to + * gdb.texinfo (info functions): Document use of backslash to quote regexp chars in function names such as "operator*()". 2001-11-01 Fred Fish <fnf@redhat.com> @@ -1484,7 +1525,7 @@ Wed Aug 15 10:47:28 2001 Christopher Faylor <cgf@cygnus.com> * gdbint.texinfo: Add a cautionary note about macro use. 2001-08-02 Corinna Vinschen <vinschen@redhat.com> - + * gdb.texinfo: Explain omitting the hostname in the `target remote' command. @@ -1873,10 +1914,10 @@ Tue Mar 28 18:28:45 2000 Andrew Cagney <cagney@b1.cygnus.com> * gdb.texinfo (Protocol): Replace ``qfThreadExtraInfo'' with qThreadExtraInfo. -2000-03-28 J.T. Conklin <jtc@redback.com> +2000-03-28 J.T. Conklin <jtc@redback.com> - * gdb.texinfo: Clarify which remote debug protocol commands are - required and which are optional. + * gdb.texinfo: Clarify which remote debug protocol commands are + required and which are optional. Tue Mar 28 16:06:22 2000 Andrew Cagney <cagney@b1.cygnus.com> @@ -1910,9 +1951,9 @@ Fri Mar 24 18:06:34 2000 Andrew Cagney <cagney@b1.cygnus.com> * gdb.texinfo: Check for @ifinfo instead of @ifnottex. (rluser.texinfo, inc-hist.texinfo, annotate.texi): Add local @chapter and @node entries. - + * gdb.texinfo: Link all top-level nodes. - + Fri Mar 24 17:56:48 2000 Andrew Cagney <cagney@b1.cygnus.com> * Makefile.in (install-info): Create $(infodir) before installing @@ -1933,7 +1974,7 @@ Fri Mar 24 17:56:48 2000 Andrew Cagney <cagney@b1.cygnus.com> 2000-03-20 Michael Snyder <msnyder@cleaver.cygnus.com> - * gdb.texinfo: Add white space to prevent overprinting in + * gdb.texinfo: Add white space to prevent overprinting in two places. 2000-03-17 Stan Shebs <shebs@apple.com> @@ -2103,8 +2144,8 @@ Wed Aug 11 13:18:14 1999 Andrew Cagney <cagney@amy.cygnus.com> 1999-08-10 Elena Zannoni <ezannoni@kwikemart.cygnus.com> - * Makefile.in: Rename inc-hist.texi to inc-hist.texinfo. - * gdb.texinfo: Ditto. + * Makefile.in: Rename inc-hist.texi to inc-hist.texinfo. + * gdb.texinfo: Ditto. 1999-08-06 Tom Tromey <tromey@cygnus.com> @@ -2209,7 +2250,7 @@ Tue Apr 20 11:59:38 1999 Andrew Cagney <cagney@b1.cygnus.com> LITTLE_BREAKPOINT, LITTLE_REMOTE_BREAKPOINT, BIG_REMOTE_BREAKPOINT): Deprecate in favor of REGISTER_NAME and BREAKPOINT_FROM_PC. - + Mon Apr 12 16:00:44 1999 Andrew Cagney <cagney@b1.cygnus.com> * gdbint.texinfo (CALL_DUMMY_STACK_ADJUST_P, @@ -2265,14 +2306,14 @@ Thu Jan 14 17:10:12 1999 Stan Shebs <shebs@andros.cygnus.com> Wed Jan 13 10:38:40 1999 Edith Epstein <eepstein@sophia.cygnus.com> - * gdb.texinfo: Changes made as part of a project to merge in - changes made by HP. Documentation makes extensive use of + * gdb.texinfo: Changes made as part of a project to merge in + changes made by HP. Documentation makes extensive use of @ifclear HPPA and @ifset HPPA. The HP manual omits doumentation on remote debugging. There are differences in documentation (HP vs. non-HP) on C++ support (aCC vs. gnu gcc++). Also, the HP manual discusses catchpoints, hardware watchpoints, and some HPUX specific limitations for shared library support. - + There are also a number of @node changes. 1999-01-12 Jason Molenda (jsm@bugshack.cygnus.com) @@ -2285,7 +2326,7 @@ Wed Jan 6 11:55:34 1999 David Taylor <taylor@texas.cygnus.com> The following changes were made by Edith Epstein <eepstein@cygnus.com> as part of a project to merge in changes made by HP. - + * HPPA-cfg.texi: new file. * all-cfg.texi: set HPPA for HP PA-RISC targets. @@ -2334,7 +2375,7 @@ Tue Dec 1 17:45:43 1998 Stan Shebs <shebs@andros.cygnus.com> Mon Nov 30 11:32:21 1998 Andrew Cagney <cagney@chook> - * gdbint.texinfo (FRAME_CHAIN_VALID_ALTERNATE): + * gdbint.texinfo (FRAME_CHAIN_VALID_ALTERNATE): Sat Nov 28 13:45:53 1998 Andrew Cagney <cagney@b1.cygnus.com> @@ -2381,7 +2422,7 @@ Thu Apr 2 16:10:36 1998 Stan Shebs <shebs@andros.cygnus.com> * gdb.texinfo: Add some credits, mention bug monitor. * remote.texi: Mention mips monitor targets. * gdbint.texinfo: Describe SP_REGNUM, STEP_SKIPS_DELAY. - + Mon Feb 2 17:13:03 1998 Stan Shebs <shebs@andros.cygnus.com> * gdbint.texinfo: Remove obsolete mentions of pinsn.c and opcode.h @@ -2457,14 +2498,14 @@ Fri Jul 5 15:38:54 1996 Fred Fish <fnf@cygnus.com> Also document that some systems can use mmalloc but must define this if their C runtime allocates memory that is later freed. (MMCHECK_FORCE): Document new macro. - + Fri Jun 28 22:17:10 1996 Dawn Perchik <dawn@cygnus.com> * remote.texi: Add documentation for target Sparclet. Mon Jun 24 18:12:22 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - * Makefile.in (srcdir, VPATH, prefix, infodir, INSTALL, + * Makefile.in (srcdir, VPATH, prefix, infodir, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Use autoconf set values. * configure.in: Rewritten for autoconf. * configure: New. @@ -2482,7 +2523,7 @@ Mon Jun 17 10:43:41 1996 Fred Fish <fnf@cygnus.com> (maintainer-clean): Remove clean-info and clean-dvi dependencies and put their actions in the rules. (gdb.ps): New target - (gdb.dvi, gdbgui.dvi, gdbint.dvi, stabs.dvi): Remove + (gdb.dvi, gdbgui.dvi, gdbint.dvi, stabs.dvi): Remove intermediate TeX files, whether they have 2 or 3 character extensions. (gdbint.ps): Add target and rules. @@ -2853,7 +2894,7 @@ Sun Nov 28 18:06:25 1993 Roland H. Pesch (pesch@fowanton.cygnus.com) entries; (Server): explain use of gdbserver w/real-time systems, add example of conflicting TCP port; (MIPS Remote) break up running text into table, highlighting commands, and add example. - + Wed Nov 24 14:15:56 1993 Roland H. Pesch (pesch@fowanton.cygnus.com) * refcard.tex: avoid bad linebreaks even when REFEDITS=psrc.sed @@ -3169,7 +3210,7 @@ Fri Jul 9 09:47:02 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) Tue Jul 6 12:41:28 1993 John Gilmore (gnu@cygnus.com) * gdbint.texinfo (Target Conditionals): Remove NO_TYPEDEFS, - removed from the code by Kingdon. + removed from the code by Kingdon. Tue Jul 6 12:24:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com) @@ -3598,7 +3639,7 @@ Mon Aug 24 01:17:55 1992 John Gilmore (gnu@cygnus.com) Tue Aug 18 15:59:13 1992 Roland H. Pesch (pesch@fowanton.cygnus.com) * gdbinv-s.m4.in: refrain from using @cartouche for just a few - examples (not consistent w others). + examples (not consistent w others). gdb.texinfo: issue disclaimer paragraph on cmdline options only for generic vn of doc @@ -3665,7 +3706,7 @@ Fri Apr 10 17:50:43 1992 John Gilmore (gnu at rtl.cygnus.com) * gdb.texinfo: Update for GDB-4.5. Move `Formatting Documentation' ahead of `Installing GDB' to match README. Update shared library doc, -readnow and -mapped, and directory - structure (add glob and mmalloc). Update configure doc. + structure (add glob and mmalloc). Update configure doc. Tue Mar 24 23:28:38 1992 K. Richard Pixley (rich@cygnus.com) @@ -3694,7 +3735,7 @@ Fri Dec 6 23:57:34 1991 K. Richard Pixley (rich at rtl.cygnus.com) * Makefile.in: remove spaces following hyphens, bsd make can't cope. install using INSTALL_DATA. added clean-info. added - standards.text support. + standards.text support. Thu Dec 5 22:46:12 1991 K. Richard Pixley (rich at rtl.cygnus.com) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 4e04afe..717a374 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -192,7 +192,7 @@ Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another. @end itemize -You can use @value{GDBN} to debug programs written in C and C++. +You can use @value{GDBN} to debug programs written in C and C@t{++}. For more information, see @ref{Support,,Supported languages}. For more information, see @ref{C,,C and C++}. @@ -861,7 +861,7 @@ equivalent to the @samp{-c}/@samp{-p} option followed by that argument.) If the second argument begins with a decimal digit, @value{GDBN} will first attempt to attach to it as a process, and if that fails, attempt to open it as a corefile. If you have a corefile whose name begins with -a digit, you can prevent @value{GDBN} from treating it as a pid by +a digit, you can prevent @value{GDBN} from treating it as a pid by prefixing it with @file{./}, eg. @file{./12345}. If @value{GDBN} has not been configured to included core file support, @@ -901,7 +901,7 @@ file. @itemx -c @var{file} @cindex @code{--core} @cindex @code{-c} -Use file @var{file} as a core dump to examine. +Use file @var{file} as a core dump to examine. @item -c @var{number} @item -pid @var{number} @@ -1112,7 +1112,7 @@ Run using @var{device} for your program's standard input and output. @c resolve the situation of these eventually @item -tui @cindex @code{--tui} -Activate the Terminal User Interface when starting. +Activate the Terminal User Interface when starting. The Terminal User Interface manages several text windows on the terminal, showing source, assembly, registers and @value{GDBN} command outputs (@pxref{TUI, ,@value{GDBN} Text User Interface}). @@ -2599,16 +2599,23 @@ Whether the breakpoint is marked to be disabled or deleted when hit. Enabled breakpoints are marked with @samp{y}. @samp{n} marks breakpoints that are not enabled. @item Address -Where the breakpoint is in your program, as a memory address. +Where the breakpoint is in your program, as a memory address. If the +breakpoint is pending (see below for details) on a future load of a shared library, the address +will be listed as @samp{<PENDING>}. @item What Where the breakpoint is in the source for your program, as a file and -line number. +line number. For a pending breakpoint, the original string passed to +the breakpoint command will be listed as it cannot be resolved until +the appropriate shared library is loaded in the future. @end table @noindent If a breakpoint is conditional, @code{info break} shows the condition on the line following the affected breakpoint; breakpoint commands, if any, -are listed after that. +are listed after that. A pending breakpoint is allowed to have a condition +specified for it. The condition is not parsed for validity until a shared +library is loaded that allows the pending breakpoint to resolve to a +valid location. @noindent @code{info break} with a breakpoint @@ -2631,6 +2638,31 @@ your program. There is nothing silly or meaningless about this. When the breakpoints are conditional, this is even useful (@pxref{Conditions, ,Break conditions}). +@cindex pending breakpoints +If a specified breakpoint location cannot be found, @value{GDBN} will +prompt you +as to whether to make the breakpoint pending on a future shared +library load. This is useful for setting breakpoints at the start of your +@value{GDBN} session for locations that you know will be dynamically loaded +later by the program being debugged. When shared libraries are loaded, +a check is made to see if the load resoloves any pending breakpoint locations. +If a pending breakpoint location has been resolved, +a real breakpoint is created and the original pending breakpoint is removed. + +@cindex operations allowed on pending breakpoints +Normal breakpoint operations apply to pending breakpoints as well. You may +specify a condition for a pending breakpoint and/or commands to run when the +breakpoint is reached. You can also enable or disable +the pending breakpoint. When you specify a condition for a pending breakpoint, +the parsing of the condition will be deferred until the point where the +pending breakpoint location is resolved. Disabling a pending breakpoint +tells @value{GDBN} to not attempt to resolve the breakpoint on any subsequent +shared library load. When a pending breakpoint is re-enabled, +@value{GDBN} checks to see if the location is already resolved. +This is done because any number of shared library loads could have +occurred since the time the breakpoint was disabled and one or more +of these loads could resolve the location. + @cindex negative breakpoint numbers @cindex internal @value{GDBN} breakpoints @value{GDBN} itself sometimes sets breakpoints in your program for @@ -3215,7 +3247,7 @@ end @cindex overloading @cindex symbol overloading -Some programming languages (notably C@t{++} and Objective-C) permit a +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, @@ -3346,7 +3378,7 @@ Such warnings are printed both for user settable and @value{GDBN}'s internal breakpoints. If you see one of these warnings, you should verify that a breakpoint set at the adjusted address will have the desired affect. If not, the breakpoint in question may be removed and -other breakpoints may be set which will have the desired behavior. +other breakpoints may be set which will have the desired behavior. E.g., it may be sufficient to place the breakpoint at a later instruction. A conditional breakpoint may also be useful in some cases to prevent the breakpoint from triggering too often. @@ -4684,6 +4716,7 @@ Table}. * Registers:: Registers * Floating Point Hardware:: Floating point hardware * Vector Unit:: Vector Unit +* Auxiliary Vector:: Auxiliary data provided by operating system * Memory Region Attributes:: Memory region attributes * Dump/Restore Files:: Copy between memory and a file * Character Sets:: Debugging programs that use a different @@ -5864,12 +5897,38 @@ Display information about the vector unit. The exact contents and layout vary depending on the hardware. @end table +@node Auxiliary Vector +@section Operating system auxiliary vector +@cindex auxiliary vector +@cindex vector, auxiliary + +Some operating systems supply an @dfn{auxiliary vector} to programs at +startup. This is akin to the arguments and environment that you +specify for a program, but contains a system-dependent variety of +binary values that tell system libraries important details about the +hardware, operating system, and process. Each value's purpose is +identified by an integer tag; the meanings are well-known but system-specific. +Depending on the configuration and operating system facilities, +@value{GDBN} may be able to show you this information. + +@table @code +@kindex info auxv +@item info auxv +Display the auxiliary vector of the inferior, which can be either a +live process or a core dump file. @value{GDBN} prints each tag value +numerically, and also shows names and text descriptions for recognized +tags. Some values in the vector are numbers, some bit masks, and some +pointers to strings or other data. @value{GDBN} displays each value in the +most appropriate form for a recognized tag, and in hexadecimal for +an unrecognized tag. +@end table + @node Memory Region Attributes -@section Memory region attributes +@section Memory region attributes @cindex memory region attributes -@dfn{Memory region attributes} allow you to describe special handling -required by regions of your target's memory. @value{GDBN} uses attributes +@dfn{Memory region attributes} allow you to describe special handling +required by regions of your target's memory. @value{GDBN} uses attributes to determine whether to allow certain types of memory accesses; whether to use specific width accesses; and whether to cache target memory. @@ -5879,7 +5938,7 @@ accessing memory in that region. Similarly, if no memory regions have been defined, @value{GDBN} uses the default attributes when accessing all memory. -When a memory region is defined, it is given a number to identify it; +When a memory region is defined, it is given a number to identify it; to enable, disable, or remove a memory region, you specify that number. @table @code @@ -5897,7 +5956,7 @@ Remove memory regions @var{nums}@dots{}. @kindex disable mem @item disable mem @var{nums}@dots{} Disable memory regions @var{nums}@dots{}. -A disabled memory region is not forgotten. +A disabled memory region is not forgotten. It may be enabled again later. @kindex enable mem @@ -5912,7 +5971,7 @@ for each region. @table @emph @item Memory Region Number @item Enabled or Disabled. -Enabled memory regions are marked with @samp{y}. +Enabled memory regions are marked with @samp{y}. Disabled memory regions are marked with @samp{n}. @item Lo Address @@ -5929,7 +5988,7 @@ The list of attributes set for this memory region. @subsection Attributes -@subsubsection Memory Access Mode +@subsubsection Memory Access Mode The access mode attributes set whether @value{GDBN} may make read or write accesses to a memory region. @@ -5970,7 +6029,7 @@ Use 64 bit memory accesses. @c @c @table @code @c @item hwbreak -@c Always use hardware breakpoints +@c Always use hardware breakpoints @c @item swbreak (default) @c @end table @@ -5983,13 +6042,13 @@ registers. @table @code @item cache -Enable @value{GDBN} to cache target memory. +Enable @value{GDBN} to cache target memory. @item nocache Disable @value{GDBN} from caching target memory. This is the default. @end table @c @subsubsection Memory Write Verification -@c The memory write verification attributes set whether @value{GDBN} +@c The memory write verification attributes set whether @value{GDBN} @c will re-reads data after each write to verify the write was successful. @c @c @table @code @@ -6051,7 +6110,7 @@ Restore the contents of file @var{filename} into memory. The file format, except for raw binary. To restore a raw binary file you must specify the optional keyword @code{binary} after the filename. -If @var{bias} is non-zero, its value will be added to the addresses +If @var{bias} is non-zero, its value will be added to the addresses contained in the file. Binary files always start at address zero, so they will be restored at address @var{bias}. Other bfd files have a built-in location; they will be restored at offset @var{bias} @@ -6059,7 +6118,7 @@ from that location. If @var{start} and/or @var{end} are non-zero, then only data between file offset @var{start} and file offset @var{end} will be restored. -These offsets are relative to the addresses in the file, before +These offsets are relative to the addresses in the file, before the @var{bias} argument is applied. @end table @@ -6130,15 +6189,15 @@ for both host and target. @item show charset @kindex show charset -Show the names of the current host and target charsets. +Show the names of the current host and target charsets. @itemx show host-charset @kindex show host-charset -Show the name of the current host charset. +Show the name of the current host charset. @itemx show target-charset @kindex show target-charset -Show the name of the current target charset. +Show the name of the current target charset. @end table @@ -6205,7 +6264,7 @@ $ gdb -nw charset-test GNU gdb 2001-12-19-cvs Copyright 2001 Free Software Foundation, Inc. @dots{} -(gdb) +(gdb) @end smallexample We can use the @code{show charset} command to see what character sets @@ -6215,7 +6274,7 @@ strings: @smallexample (gdb) show charset The current host and target character set is `ISO-8859-1'. -(gdb) +(gdb) @end smallexample For the sake of printing this manual, let's use @sc{ascii} as our @@ -6224,7 +6283,7 @@ initial character set: (gdb) set charset ASCII (gdb) show charset The current host and target character set is `ASCII'. -(gdb) +(gdb) @end smallexample Let's assume that @sc{ascii} is indeed the correct character set for our @@ -6238,7 +6297,7 @@ them properly. Since our current target character set is also $1 = 0x401698 "Hello, world!\n" (gdb) print ascii_hello[0] $2 = 72 'H' -(gdb) +(gdb) @end smallexample @value{GDBN} uses the target character set for character and string @@ -6247,7 +6306,7 @@ literals you use in expressions: @smallexample (gdb) print '+' $3 = 43 '+' -(gdb) +(gdb) @end smallexample The @sc{ascii} character set uses the number 43 to encode the @samp{+} @@ -6262,7 +6321,7 @@ character set is still @sc{ascii}, we get jibberish: $4 = 0x4016a8 "\310\205\223\223\226k@@\246\226\231\223\204Z%" (gdb) print ibm1047_hello[0] $5 = 200 '\310' -(gdb) +(gdb) @end smallexample If we invoke the @code{set target-charset} followed by @key{TAB}@key{TAB}, @@ -6270,8 +6329,8 @@ If we invoke the @code{set target-charset} followed by @key{TAB}@key{TAB}, @smallexample (gdb) set target-charset -ASCII EBCDIC-US IBM1047 ISO-8859-1 -(gdb) set target-charset +ASCII EBCDIC-US IBM1047 ISO-8859-1 +(gdb) set target-charset @end smallexample We can select @sc{ibm1047} as our target character set, and examine the @@ -6302,7 +6361,7 @@ string literals you use in expressions: @smallexample (gdb) print '+' $10 = 78 '+' -(gdb) +(gdb) @end smallexample The @sc{ibm1047} character set uses the number 78 to encode the @samp{+} @@ -6312,7 +6371,7 @@ character. @node Macros @chapter C Preprocessor Macros -Some languages, such as C and C++, provide a way to define and invoke +Some languages, such as C and C@t{++}, provide a way to define and invoke ``preprocessor macros'' which expand into strings of tokens. @value{GDBN} can evaluate expressions containing macro invocations, show the result of macro expansion, and show a macro's definition, including @@ -6473,7 +6532,7 @@ Defined at /home/jimb/gdb/macros/play/sample.h:1 expands to: (42 + 1) (gdb) macro expand-once ADD(1) expands to: once (M + 1) -(gdb) +(gdb) @end smallexample In the example above, note that @command{macro expand-once} expands only @@ -6488,11 +6547,11 @@ the source line of the current stack frame: (gdb) break main Breakpoint 1 at 0x8048370: file sample.c, line 10. (gdb) run -Starting program: /home/jimb/gdb/macros/play/sample +Starting program: /home/jimb/gdb/macros/play/sample Breakpoint 1, main () at sample.c:10 10 printf ("Hello, world!\n"); -(gdb) +(gdb) @end smallexample At line 10, the definition of the macro @code{N} at line 9 is in force: @@ -6505,7 +6564,7 @@ Defined at /home/jimb/gdb/macros/play/sample.c:9 expands to: 28 < 42 (gdb) print N Q M $1 = 1 -(gdb) +(gdb) @end smallexample As we step over directives that remove @code{N}'s definition, and then @@ -6529,7 +6588,7 @@ Defined at /home/jimb/gdb/macros/play/sample.c:13 expands to: 1729 < 42 (gdb) print N Q M $2 = 0 -(gdb) +(gdb) @end smallexample @@ -6568,9 +6627,9 @@ tracepoints as of this writing. This chapter describes the tracepoint commands and features. @menu -* Set Tracepoints:: -* Analyze Collected Data:: -* Tracepoint Variables:: +* Set Tracepoints:: +* Analyze Collected Data:: +* Tracepoint Variables:: @end menu @node Set Tracepoints @@ -6595,12 +6654,12 @@ This section describes commands to set tracepoints and associated conditions and actions. @menu -* Create and Delete Tracepoints:: -* Enable and Disable Tracepoints:: -* Tracepoint Passcounts:: -* Tracepoint Actions:: -* Listing Tracepoints:: -* Starting and Stopping Trace Experiment:: +* Create and Delete Tracepoints:: +* Enable and Disable Tracepoints:: +* Tracepoint Passcounts:: +* Tracepoint Actions:: +* Listing Tracepoints:: +* Starting and Stopping Trace Experiment:: @end menu @node Create and Delete Tracepoints @@ -6699,7 +6758,7 @@ user. Examples: @smallexample -(@value{GDBP}) @b{passcount 5 2} // Stop on the 5th execution of +(@value{GDBP}) @b{passcount 5 2} // Stop on the 5th execution of @exdent @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @code{// tracepoint 2} (@value{GDBP}) @b{passcount 12} // Stop on the 12th execution of the @@ -7411,7 +7470,7 @@ name normally: @smallexample (gdb) overlay list -Section .ov.foo.text, loaded at 0x100000 - 0x100034, +Section .ov.foo.text, loaded at 0x100000 - 0x100034, mapped at 0x1016 - 0x104a (gdb) print foo $6 = @{int (int)@} 0x1016 <foo> @@ -7494,7 +7553,7 @@ will silently set a breakpoint there. If the overlay manager then calls this function whenever it has changed the overlay table, this will enable @value{GDBN} to accurately keep track of which overlays are in program memory, and update any breakpoints that may be set -in overlays. This will allow breakpoints to work even if the +in overlays. This will allow breakpoints to work even if the overlays are kept in ROM or other non-writable memory while they are not being executed. @@ -7926,7 +7985,7 @@ language reference or tutorial. @menu * C:: C and C@t{++} -* Objective-C:: Objective-C +* Objective-C:: Objective-C * Modula-2:: Modula-2 @end menu @@ -8452,8 +8511,8 @@ 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:: +* 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 @@ -9185,8 +9244,8 @@ Print the names and data types of all defined functions whose names contain a match for regular expression @var{regexp}. Thus, @samp{info fun step} finds all functions whose names include @code{step}; @samp{info fun ^step} finds those whose names -start with @code{step}. If a function name contains characters -that conflict with the regular expression language (eg. +start with @code{step}. If a function name contains characters +that conflict with the regular expression language (eg. @samp{operator*()}), they may be quoted with a backslash. @kindex info variables @@ -9317,7 +9376,7 @@ structure in more detail. For example: (@value{GDBP}) maint info psymtabs dwarf2read @{ objfile /home/gnu/build/gdb/gdb ((struct objfile *) 0x82e69d0) - @{ psymtab /home/gnu/src/gdb/dwarf2read.c + @{ psymtab /home/gnu/src/gdb/dwarf2read.c ((struct partial_symtab *) 0x8474b10) readin no fullname (null) @@ -9342,9 +9401,9 @@ read the symtab for the compilation unit containing that function: Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c, line 1574. (@value{GDBP}) maint info symtabs -@{ objfile /home/gnu/build/gdb/gdb +@{ objfile /home/gnu/build/gdb/gdb ((struct objfile *) 0x82e69d0) - @{ symtab /home/gnu/src/gdb/dwarf2read.c + @{ symtab /home/gnu/src/gdb/dwarf2read.c ((struct symtab *) 0x86c1f38) dirname (null) fullname (null) @@ -9352,7 +9411,7 @@ line 1574. debugformat DWARF 2 @} @} -(@value{GDBP}) +(@value{GDBP}) @end smallexample @end table @@ -9866,7 +9925,7 @@ Some embedded operating systems, like Sun Chorus and VxWorks, can load relocatable files into an already running program; such systems typically make the requirements above easy to meet. However, it's important to recognize that many native systems use complex link -procedures (@code{.linkonce} section factoring and C++ constructor table +procedures (@code{.linkonce} section factoring and C@t{++} constructor table assembly, for example) that make the requirements difficult to meet. In general, one cannot assume that using @code{add-symbol-file} to read a relocatable object file's symbolic information will have the same effect @@ -10632,9 +10691,7 @@ configuration of @value{GDBN}; use @code{help target} to list them. @node KOD @section Kernel Object Display - @cindex kernel object display -@cindex kernel object @cindex KOD Some targets support kernel object display. Using this facility, @@ -10643,6 +10700,7 @@ and can display information about operating system-level objects such as mutexes and other synchronization objects. Exactly which objects can be displayed is determined on a per-OS basis. +@kindex set os Use the @code{set os} command to set the operating system. This tells @value{GDBN} which kernel object display module to initialize: @@ -10650,11 +10708,17 @@ Use the @code{set os} command to set the operating system. This tells (@value{GDBP}) set os cisco @end smallexample +@kindex show os +The associated command @code{show os} displays the operating system +set with the @code{set os} command; if no operating system has been +set, @code{show os} will display an empty string @samp{""}. + If @code{set os} succeeds, @value{GDBN} will display some information about the operating system, and will create a new @code{info} command which can be used to query the target. The @code{info} command is named after the operating system: +@kindex info cisco @smallexample (@value{GDBP}) info cisco List of Cisco Kernel Objects @@ -10665,8 +10729,10 @@ any Any and all objects Further subcommands can be used to query about particular objects known by the kernel. -There is currently no way to determine whether a given operating system -is supported other than to try it. +There is currently no way to determine whether a given operating +system is supported other than to try setting it with @kbd{set os +@var{name}}, where @var{name} is the name of the operating system you +want to try. @node Remote Debugging @@ -11447,10 +11513,10 @@ accepts addresses which may belong to @emph{any} segment. For example, here's how to display the Page Table entry for the page where the variable @code{i} is stored: -@smallexample +@smallexample @exdent @code{(@value{GDBP}) info dos address-pte __djgpp_base_address + (char *)&i} @exdent @code{Page Table entry for address 0x11a00d30:} -@exdent @code{Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30} +@exdent @code{Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30} @end smallexample @noindent @@ -11519,9 +11585,9 @@ This is a Cygwin specific alias of info shared. This command loads symbols from a dll similarly to add-sym command but without the need to specify a base address. -@kindex set new-console +@kindex set new-console @item set new-console @var{mode} -If @var{mode} is @code{on} the debuggee will +If @var{mode} is @code{on} the debuggee will be started in a new console on next start. If @var{mode} is @code{off}i, the debuggee will be started in the same console as the debugger. @@ -11548,17 +11614,17 @@ This boolean value adds debug output concerning events seen by the debugger. @kindex set debugexec @item set debugexec -This boolean value adds debug output concerning execute events +This boolean value adds debug output concerning execute events seen by the debugger. @kindex set debugexceptions @item set debugexceptions -This boolean value adds debug ouptut concerning exception events +This boolean value adds debug ouptut concerning exception events seen by the debugger. @kindex set debugmemory @item set debugmemory -This boolean value adds debug ouptut concerning memory events +This boolean value adds debug ouptut concerning memory events seen by the debugger. @kindex set shell @@ -13131,7 +13197,7 @@ current ABI. @kindex show osabi One @value{GDBN} configuration can debug binaries for multiple operating -system targets, either via remote debugging or native emulation. +system targets, either via remote debugging or native emulation. @value{GDBN} will autodetect the @dfn{OS ABI} (Operating System ABI) in use, but you can override its conclusion using the @code{set osabi} command. One example where this is useful is in debugging of binaries which use @@ -13525,7 +13591,7 @@ end @end smallexample As a further example, to hook at the begining and end of the @code{echo} -command, and to add extra text to the beginning and end of the message, +command, and to add extra text to the beginning and end of the message, you could define: @smallexample @@ -14036,7 +14102,7 @@ key bindings such as @key{C-p}, @key{C-n}, @key{C-b} and @key{C-f}. The TUI provides a @emph{SingleKey} mode in which it installs a particular key binding in the readline keymaps to connect single keys to -some gdb commands. +some gdb commands. @table @kbd @kindex c @r{(SingleKey TUI key)} @@ -14342,7 +14408,7 @@ the files with these buffers if you wish; but keep in mind that @value{GDBN} communicates with Emacs in terms of line numbers. If you add or delete lines from the text, the line numbers that @value{GDBN} knows cease to correspond properly with the code. - + The description given here is for GNU Emacs version 21.3 and a more detailed description of its interaction with @value{GDBN} is given in the Emacs manual (@pxref{Debuggers,,, Emacs, The @sc{gnu} Emacs Manual}). @@ -15982,17 +16048,17 @@ The corresponding @value{GDBN} command is @samp{cd}. Add directories @var{pathdir} to beginning of search path for source files. If the @samp{-r} option is used, the search path is reset to the default -search path. If directories @var{pathdir} are supplied in addition to the +search path. If directories @var{pathdir} are supplied in addition to the @samp{-r} option, the search path is first reset and then addition occurs as normal. -Multiple directories may be specified, separated by blanks. Specifying +Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated -by the system directory-separator character. The directory-seperator +by the system directory-separator character. The directory-seperator character must not be used in any directory name. If no directories are specified, the current search path is displayed. @@ -16031,18 +16097,18 @@ The corresponding @value{GDBN} command is @samp{dir}. Add directories @var{pathdir} to beginning of search path for object files. If the @samp{-r} option is used, the search path is reset to the original -search path that existed at gdb start-up. If directories @var{pathdir} are -supplied in addition to the +search path that existed at gdb start-up. If directories @var{pathdir} are +supplied in addition to the @samp{-r} option, the search path is first reset and then addition occurs as normal. -Multiple directories may be specified, separated by blanks. Specifying +Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated -by the system directory-separator character. The directory-seperator +by the system directory-separator character. The directory-seperator character must not be used in any directory name. If no directories are specified, the current path is displayed. @@ -16056,7 +16122,7 @@ The corresponding @value{GDBN} command is @samp{path}. @smallexample (@value{GDBP}) --environment-path +-environment-path ^done,path="/usr/bin" (@value{GDBP}) -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin @@ -16662,7 +16728,7 @@ N.A. -file-list-exec-source-file @end smallexample -List the line number, the current source file, and the absolute path +List the line number, the current source file, and the absolute path to the current source file for the current executable. @subsubheading @value{GDBN} Command @@ -16875,7 +16941,7 @@ information when you start an interactive session. ~Type "show copying" to see the conditions. ~There is absolutely no warranty for GDB. Type "show warranty" for ~ details. -~This GDB was configured as +~This GDB was configured as "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi". ^done (@value{GDBP}) @@ -18283,7 +18349,7 @@ before the value of a child variable can be evaluated. Assigns the value of @var{expression} to the variable object specified by @var{name}. The object must be @samp{editable}. If the variable's -value is altered by the assign, the variable will show up in any +value is altered by the assign, the variable will show up in any subsequent @code{-var-update} list. @subsubheading Example @@ -18383,12 +18449,12 @@ for details. This GDB was configured as "i386-pc-linux-gnu" ^Z^Zpre-prompt -(gdb) +(gdb) ^Z^Zprompt @kbd{quit} ^Z^Zpost-prompt -$ +$ @end smallexample Here @samp{quit} is input to @value{GDBN}; the rest is output from @@ -18538,13 +18604,13 @@ deleted a breakpoint. @findex starting @findex stopping When the program starts executing due to a @value{GDBN} command such as -@code{step} or @code{continue}, +@code{step} or @code{continue}, @smallexample ^Z^Zstarting @end smallexample -is output. When the program stops, +is output. When the program stops, @smallexample ^Z^Zstopped @@ -19301,7 +19367,7 @@ A problem internal to GDB has been detected. Further debugging may prove unreliable. Quit this debugging session? (y or n) @kbd{n} Create a core file? (y or n) @kbd{n} -(gdb) +(gdb) @end smallexample Takes an optional parameter that is used as the text of the error or @@ -19324,7 +19390,7 @@ The program being debugged stopped while in a function called from GDB. 0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6 top=0x0200bdd4 id=@{stack=0x200bddc,code=0x101405c@} call_lo=0x01014000 call_hi=0x01014001 -(gdb) +(gdb) @end smallexample Takes an optional file parameter. @@ -19356,14 +19422,14 @@ Takes an optional file parameter. @smallexample (gdb) @kbd{maint print reggroups} - Group Type - general user - float user - all user - vector user - system user - save internal - restore internal + Group Type + general user + float user + all user + vector user + system user + save internal + restore internal @end smallexample @kindex maint set profile @@ -19382,7 +19448,7 @@ if you use profiling, @value{GDBN} will overwrite the profiling log file data in a @file{gmon.out} file, be sure to move it to a safe location. Configuring with @samp{--enable-profiling} arranges for @value{GDBN} to be -compiled with the @samp{-pg} compiler option. +compiled with the @samp{-pg} compiler option. @end table @@ -19481,10 +19547,6 @@ where @code{n >=3} (which is where rle starts to win). The printable characters @samp{$}, @samp{#}, @samp{+} and @samp{-} or with a numeric value greater than 126 should not be used. -Some remote systems have used a different run-length encoding mechanism -loosely refered to as the cisco encoding. Following the @samp{*} -character are two hex digits that indicate the size of the packet. - So: @smallexample "@code{0* }" @@ -19500,8 +19562,8 @@ For any @var{command} not supported by the stub, an empty response protocol. A newer @value{GDBN} can tell if a packet is supported based on that response. -A stub is required to support the @samp{g}, @samp{G}, @samp{m}, @samp{M}, -@samp{c}, and @samp{s} @var{command}s. All other @var{command}s are +A stub is required to support the @samp{g}, @samp{G}, @samp{m}, @samp{M}, +@samp{c}, and @samp{s} @var{command}s. All other @var{command}s are optional. @node Packets @@ -19666,7 +19728,7 @@ for an error Reserved for future use. -@item @code{H}@var{c}@var{t@dots{}} --- set thread +@item @code{H}@var{c}@var{t@dots{}} --- set thread @cindex @code{H} packet Set thread for subsequent operations (@samp{m}, @samp{M}, @samp{g}, @@ -19877,7 +19939,7 @@ Like @samp{C} but step not continue. Reply: @xref{Stop Reply Packets}, for the reply specifications. -@item @code{t}@var{addr}@code{:}@var{PP}@code{,}@var{MM} --- search +@item @code{t}@var{addr}@code{:}@var{PP}@code{,}@var{MM} --- search @cindex @code{t} packet Search backwards starting at address @var{addr} for a match with pattern @@ -20154,15 +20216,6 @@ applicable to certain targets. The process terminated with signal @var{AA}. -@item N@var{AA};@var{t@dots{}};@var{d@dots{}};@var{b@dots{}} @strong{(obsolete)} - -@var{AA} = signal number; @var{t@dots{}} = address of symbol -@code{_start}; @var{d@dots{}} = base of data section; @var{b@dots{}} = -base of bss section. @emph{Note: only used by Cisco Systems targets. -The difference between this reply and the @samp{qOffsets} query is that -the @samp{N} packet may arrive spontaneously whereas the @samp{qOffsets} -is a query initiated by the host debugger.} - @item O@var{XX@dots{}} @var{XX@dots{}} is hex encoding of @sc{ascii} data. This can happen at @@ -20499,20 +20552,20 @@ system are not supported by this protocol. The File-I/O protocol uses the @code{F} packet, as request as well as as reply packet. Since a File-I/O system call can only occur when -@value{GDBN} is waiting for the continuing or stepping target, the +@value{GDBN} is waiting for the continuing or stepping target, the File-I/O request is a reply that @value{GDBN} has to expect as a result of a former @samp{C}, @samp{c}, @samp{S} or @samp{s} packet. This @code{F} packet contains all information needed to allow @value{GDBN} to call the appropriate host system call: @itemize @bullet -@item +@item A unique identifier for the requested system call. @item All parameters to the system call. Pointers are given as addresses in the target memory address space. Pointers to strings are given as -pointer/length pair. Numerical values are given as they are. +pointer/length pair. Numerical values are given as they are. Numerical control values are given in a protocol specific representation. @end itemize @@ -20520,7 +20573,7 @@ Numerical control values are given in a protocol specific representation. At that point @value{GDBN} has to perform the following actions. @itemize @bullet -@item +@item If parameter pointer values are given, which point to data needed as input to a system call, @value{GDBN} requests this data from the target with a standard @code{m} packet request. This additional communication has to be @@ -20582,7 +20635,7 @@ This is just the name of the function. @var{parameter@dots{}} are the parameters to the system call. -@end table +@end table Parameters are hexadecimal integer values, either the real values in case of scalar datatypes, as pointers to target buffer space in case of compound @@ -20649,7 +20702,7 @@ reply packet. In this case the target should behave, as if it had gotten a break message. The meaning for the target is ``system call interupted by @code{SIGINT}''. Consequentially, the target should actually stop (as with a break message) and return to @value{GDBN} with a @code{T02} -packet. In this case, it's important for the target to know, in which +packet. In this case, it's important for the target to know, in which state the system call was interrupted. Since this action is by design not an atomic operation, we have to differ between two cases: @@ -20734,7 +20787,7 @@ in case the user pressed @kbd{Ctrl-C}. Otherwise the return value consists entirely of the exit status of the called command. Due to security concerns, the @code{system} call is refused to be called -by @value{GDBN} by default. The user has to allow this call explicitly by +by @value{GDBN} by default. The user has to allow this call explicitly by entering @table @samp @@ -20783,7 +20836,7 @@ The current setting is shown by typing int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode); -@exdent Request: +@exdent Request: Fopen,pathptr/len,flags,mode @end smallexample @@ -20791,30 +20844,30 @@ Fopen,pathptr/len,flags,mode @code{flags} is the bitwise or of the following values: @table @code -@item O_CREAT +@item O_CREAT If the file does not exist it will be created. The host rules apply as far as file ownership and time stamps are concerned. -@item O_EXCL +@item O_EXCL When used with O_CREAT, if the file already exists it is an error and open() fails. -@item O_TRUNC +@item O_TRUNC If the file already exists and the open mode allows writing (O_RDWR or O_WRONLY is given) it will be truncated to length 0. -@item O_APPEND +@item O_APPEND The file is opened in append mode. -@item O_RDONLY +@item O_RDONLY The file is opened for reading only. -@item O_WRONLY +@item O_WRONLY The file is opened for writing only. -@item O_RDWR +@item O_RDWR The file is opened for reading and writing. @noindent @@ -20826,22 +20879,22 @@ Each other bit is silently ignored. @code{mode} is the bitwise or of the following values: @table @code -@item S_IRUSR +@item S_IRUSR User has read permission. -@item S_IWUSR +@item S_IWUSR User has write permission. -@item S_IRGRP +@item S_IRGRP Group has read permission. -@item S_IWGRP +@item S_IWGRP Group has write permission. -@item S_IROTH +@item S_IROTH Others have read permission. -@item S_IWOTH +@item S_IWOTH Others have write permission. @noindent @@ -20858,42 +20911,42 @@ occured. @end smallexample @table @code -@item EEXIST +@item EEXIST pathname already exists and O_CREAT and O_EXCL were used. -@item EISDIR +@item EISDIR pathname refers to a directory. -@item EACCES +@item EACCES The requested access is not allowed. @item ENAMETOOLONG pathname was too long. -@item ENOENT +@item ENOENT A directory component in pathname does not exist. -@item ENODEV +@item ENODEV pathname refers to a device, pipe, named pipe or socket. -@item EROFS +@item EROFS pathname refers to a file on a read-only filesystem and write access was requested. -@item EFAULT +@item EFAULT pathname is an invalid pointer value. -@item ENOSPC +@item ENOSPC No space on device to create the file. -@item EMFILE +@item EMFILE The process already has the maximum number of files open. -@item ENFILE +@item ENFILE The limit on the total number of files open on the system has been reached. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -20902,10 +20955,10 @@ The call was interrupted by the user. @cindex close, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int close(int fd); -@exdent Request: +@exdent Request: Fclose,fd @exdent Return value: @@ -20915,10 +20968,10 @@ close returns zero on success, or -1 if an error occurred. @end smallexample @table @code -@item EBADF +@item EBADF fd isn't a valid open file descriptor. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -20927,29 +20980,29 @@ The call was interrupted by the user. @cindex read, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int read(int fd, void *buf, unsigned int count); -@exdent Request: +@exdent Request: Fread,fd,bufptr,count @exdent Return value: On success, the number of bytes read is returned. Zero indicates end of file. If count is zero, read -returns zero as well. On error, -1 is returned. +returns zero as well. On error, -1 is returned. @exdent Errors: @end smallexample @table @code -@item EBADF +@item EBADF fd is not a valid file descriptor or is not open for reading. -@item EFAULT +@item EFAULT buf is an invalid pointer value. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -20958,10 +21011,10 @@ The call was interrupted by the user. @cindex write, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int write(int fd, const void *buf, unsigned int count); -@exdent Request: +@exdent Request: Fwrite,fd,bufptr,count @exdent Return value: @@ -20973,21 +21026,21 @@ is returned. @end smallexample @table @code -@item EBADF +@item EBADF fd is not a valid file descriptor or is not open for writing. -@item EFAULT +@item EFAULT buf is an invalid pointer value. -@item EFBIG +@item EFBIG An attempt was made to write a file that exceeds the host specific maximum file size allowed. -@item ENOSPC +@item ENOSPC No space on device to write the data. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -20996,24 +21049,24 @@ The call was interrupted by the user. @cindex lseek, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: long lseek (int fd, long offset, int flag); -@exdent Request: +@exdent Request: Flseek,fd,offset,flag @end smallexample @code{flag} is one of: @table @code -@item SEEK_SET +@item SEEK_SET The offset is set to offset bytes. -@item SEEK_CUR +@item SEEK_CUR The offset is set to its current location plus offset bytes. -@item SEEK_END +@item SEEK_END The offset is set to the size of the file plus offset bytes. @end table @@ -21028,16 +21081,16 @@ value of -1 is returned. @end smallexample @table @code -@item EBADF +@item EBADF fd is not a valid open file descriptor. -@item ESPIPE +@item ESPIPE fd is associated with the @value{GDBN} console. -@item EINVAL +@item EINVAL flag is not a proper value. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -21046,10 +21099,10 @@ The call was interrupted by the user. @cindex rename, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int rename(const char *oldpath, const char *newpath); -@exdent Request: +@exdent Request: Frename,oldpathptr/len,newpathptr/len @exdent Return value: @@ -21059,47 +21112,47 @@ On success, zero is returned. On error, -1 is returned. @end smallexample @table @code -@item EISDIR +@item EISDIR newpath is an existing directory, but oldpath is not a directory. -@item EEXIST +@item EEXIST newpath is a non-empty directory. -@item EBUSY +@item EBUSY oldpath or newpath is a directory that is in use by some process. -@item EINVAL +@item EINVAL An attempt was made to make a directory a subdirectory of itself. -@item ENOTDIR +@item ENOTDIR A component used as a directory in oldpath or new path is not a directory. Or oldpath is a directory and newpath exists but is not a directory. -@item EFAULT +@item EFAULT oldpathptr or newpathptr are invalid pointer values. -@item EACCES +@item EACCES No access to the file or the path of the file. @item ENAMETOOLONG - + oldpath or newpath was too long. -@item ENOENT +@item ENOENT A directory component in oldpath or newpath does not exist. -@item EROFS +@item EROFS The file is on a read-only filesystem. -@item ENOSPC +@item ENOSPC The device containing the file has no room for the new directory entry. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -21108,10 +21161,10 @@ The call was interrupted by the user. @cindex unlink, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int unlink(const char *pathname); -@exdent Request: +@exdent Request: Funlink,pathnameptr/len @exdent Return value: @@ -21121,32 +21174,32 @@ On success, zero is returned. On error, -1 is returned. @end smallexample @table @code -@item EACCES +@item EACCES No access to the file or the path of the file. -@item EPERM +@item EPERM The system does not allow unlinking of directories. -@item EBUSY +@item EBUSY The file pathname cannot be unlinked because it's being used by another process. -@item EFAULT +@item EFAULT pathnameptr is an invalid pointer value. @item ENAMETOOLONG pathname was too long. -@item ENOENT +@item ENOENT A directory component in pathname does not exist. -@item ENOTDIR +@item ENOTDIR A component of the path is not a directory. -@item EROFS +@item EROFS The file is on a read-only filesystem. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -21156,11 +21209,11 @@ The call was interrupted by the user. @cindex stat, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int stat(const char *pathname, struct stat *buf); int fstat(int fd, struct stat *buf); -@exdent Request: +@exdent Request: Fstat,pathnameptr/len,bufptr Ffstat,fd,bufptr @@ -21171,26 +21224,26 @@ On success, zero is returned. On error, -1 is returned. @end smallexample @table @code -@item EBADF +@item EBADF fd is not a valid open file. -@item ENOENT +@item ENOENT A directory component in pathname does not exist or the path is an empty string. -@item ENOTDIR +@item ENOTDIR A component of the path is not a directory. -@item EFAULT +@item EFAULT pathnameptr is an invalid pointer value. -@item EACCES +@item EACCES No access to the file or the path of the file. @item ENAMETOOLONG pathname was too long. -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -21199,10 +21252,10 @@ The call was interrupted by the user. @cindex gettimeofday, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int gettimeofday(struct timeval *tv, void *tz); -@exdent Request: +@exdent Request: Fgettimeofday,tvptr,tzptr @exdent Return value: @@ -21212,10 +21265,10 @@ On success, 0 is returned, -1 otherwise. @end smallexample @table @code -@item EINVAL +@item EINVAL tz is a non-NULL pointer. -@item EFAULT +@item EFAULT tvptr and/or tzptr is an invalid pointer value. @end table @@ -21224,10 +21277,10 @@ tvptr and/or tzptr is an invalid pointer value. @cindex isatty, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int isatty(int fd); -@exdent Request: +@exdent Request: Fisatty,fd @exdent Return value: @@ -21237,7 +21290,7 @@ Returns 1 if fd refers to the @value{GDBN} console, 0 otherwise. @end smallexample @table @code -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -21246,10 +21299,10 @@ The call was interrupted by the user. @cindex system, file-i/o system call @smallexample -@exdent Synopsis: +@exdent Synopsis: int system(const char *command); -@exdent Request: +@exdent Request: Fsystem,commandptr/len @exdent Return value: @@ -21263,7 +21316,7 @@ In case /bin/sh could not be executed, 127 is returned. @end smallexample @table @code -@item EINTR +@item EINTR The call was interrupted by the user. @end table @@ -21291,8 +21344,8 @@ int@r{,} unsigned int@r{,} long@r{,} unsigned long@r{,} mode_t @r{and} time_t @code{Int}, @code{unsigned int}, @code{mode_t} and @code{time_t} are implemented as 32 bit values in this protocol. -@code{Long} and @code{unsigned long} are implemented as 64 bit types. - +@code{Long} and @code{unsigned long} are implemented as 64 bit types. + @xref{Limits}, for corresponding MIN and MAX values (similar to those in @file{limits.h}) to allow range checking on host and target. @@ -21400,7 +21453,7 @@ The buffer of type struct timeval used by the target and @value{GDBN} is defined as follows: @smallexample -struct timeval @{ +struct timeval @{ time_t tv_sec; /* second */ long tv_usec; /* microsecond */ @}; diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index ebf9a37..19458fe 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3174,18 +3174,18 @@ into @var{valbuf}. This method has been deprecated in favour of @code{gdbarch_return_value} (@pxref{gdbarch_return_value}). -@item EXTRACT_STRUCT_VALUE_ADDRESS(@var{regbuf}) -@findex EXTRACT_STRUCT_VALUE_ADDRESS -@anchor{EXTRACT_STRUCT_VALUE_ADDRESS} +@item DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(@var{regbuf}) +@findex DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS +@anchor{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS} When defined, extract from the array @var{regbuf} (containing the raw register state) the @code{CORE_ADDR} at which a function should return its structure value. @xref{gdbarch_return_value}. -@item EXTRACT_STRUCT_VALUE_ADDRESS_P() -@findex EXTRACT_STRUCT_VALUE_ADDRESS_P -Predicate for @code{EXTRACT_STRUCT_VALUE_ADDRESS}. +@item DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() +@findex DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P +Predicate for @code{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}. @item DEPRECATED_FP_REGNUM @findex DEPRECATED_FP_REGNUM @@ -3794,7 +3794,7 @@ non-@code{NULL}, also copy the return value from @var{regcache} into @var{readbuf} (@var{regcache} contains a copy of the registers from the just returned function). -@xref{EXTRACT_STRUCT_VALUE_ADDRESS}, for a description of how +@xref{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}, for a description of how return-values that use the struct convention are handled. @emph{Maintainer note: This method replaces separate predicate, extract, @@ -4678,6 +4678,66 @@ library because it's also used in binutils, for @file{objdump}). @section mmalloc @section libiberty +@cindex @code{libiberty} library + +The @code{libiberty} library provides a set of functions and features +that integrate and improve on functionality found in modern operating +systems. Broadly speaking, such features can be divided into three +groups: supplemental functions (functions that may be missing in some +environments and operating systems), replacement functions (providing +a uniform and easier to use interface for commonly used standard +functions), and extensions (which provide additional functionality +beyond standard functions). + +@value{GDBN} uses various features provided by the @code{libiberty} +library, for instance the C@t{++} demangler, the @acronym{IEEE} +floating format support functions, the input options parser +@samp{getopt}, the @samp{obstack} extension, and other functions. + +@subsection @code{obstacks} in @value{GDBN} +@cindex @code{obstacks} + +The obstack mechanism provides a convenient way to allocate and free +chunks of memory. Each obstack is a pool of memory that is managed +like a stack. Objects (of any nature, size and alignment) are +allocated and freed in a @acronym{LIFO} fashion on an obstack (see +@code{libiberty}'s documenatation for a more detailed explanation of +@code{obstacks}). + +The most noticeable use of the @code{obstacks} in @value{GDBN} is in +object files. There is an obstack associated with each internal +representation of an object file. Lots of things get allocated on +these @code{obstacks}: dictionary entries, blocks, blockvectors, +symbols, minimal symbols, types, vectors of fundamental types, class +fields of types, object files section lists, object files section +offets lists, line tables, symbol tables, partial symbol tables, +string tables, symbol table private data, macros tables, debug +information sections and entries, import and export lists (som), +unwind information (hppa), dwarf2 location expressions data. Plus +various strings such as directory names strings, debug format strings, +names of types. + +An essential and convenient property of all data on @code{obstacks} is +that memory for it gets allocated (with @code{obstack_alloc}) at +various times during a debugging sesssion, but it is released all at +once using the @code{obstack_free} function. The @code{obstack_free} +function takes a pointer to where in the stack it must start the +deletion from (much like the cleanup chains have a pointer to where to +start the cleanups). Because of the stack like structure of the +@code{obstacks}, this allows to free only a top portion of the +obstack. There are a few instances in @value{GDBN} where such thing +happens. Calls to @code{obstack_free} are done after some local data +is allocated to the obstack. Only the local data is deleted from the +obstack. Of course this assumes that nothing between the +@code{obstack_alloc} and the @code{obstack_free} allocates anything +else on the same obstack. For this reason it is best and safest to +use temporary @code{obstacks}. + +Releasing the whole obstack is also not safe per se. It is safe only +under the condition that we know the @code{obstacks} memory is no +longer needed. In @value{GDBN} we get rid of the @code{obstacks} only +when we get rid of the whole objfile(s), for instance upon reading a +new symbol file. @section gnu-regex @cindex regular expressions library @@ -6437,7 +6497,7 @@ intelligibility. This is the base testsuite. The tests in it should apply to all configurations of @value{GDBN} (but generic native-only tests may live here). The test programs should be in the subset of C that is valid K&R, -ANSI/ISO, and C++ (@code{#ifdef}s are allowed if necessary, for instance +ANSI/ISO, and C@t{++} (@code{#ifdef}s are allowed if necessary, for instance for prototypes). @item gdb.@var{lang} diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo index 8597384..c20ae41 100644 --- a/gdb/doc/stabs.texinfo +++ b/gdb/doc/stabs.texinfo @@ -252,10 +252,10 @@ There is an AIX extension for type attributes. Following the @samp{=} are any number of type attributes. Each one starts with @samp{@@} and ends with @samp{;}. Debuggers, including AIX's dbx and GDB 4.10, skip any type attributes they do not recognize. GDB 4.9 and other versions -of dbx may not do this. Because of a conflict with C++ +of dbx may not do this. Because of a conflict with C@t{++} (@pxref{Cplusplus}), new attributes should not be defined which begin with a digit, @samp{(}, or @samp{-}; GDB may be unable to distinguish -those from the C++ type descriptor @samp{@@}. The attributes are: +those from the C@t{++} type descriptor @samp{@@}. The attributes are: @table @code @item a@var{boundary} @@ -430,7 +430,7 @@ Some compilers (for example, GCC2 and SunOS4 @file{/bin/cc}) also include the directory in which the source was compiled, in a second @code{N_SO} symbol preceding the one containing the file name. This symbol can be distinguished by the fact that it ends in a slash. Code -from the @code{cfront} C++ compiler can have additional @code{N_SO} symbols for +from the @code{cfront} C@t{++} compiler can have additional @code{N_SO} symbols for nonexistent source files after the @code{N_SO} for the real source file; these are believed to contain no useful information. @@ -1765,7 +1765,7 @@ Another way is with the @samp{x} type descriptor, which is followed by @samp{s} for a structure tag, @samp{u} for a union tag, or @samp{e} for a enumerator tag, followed by the name of the tag, followed by @samp{:}. If the name contains @samp{::} between a @samp{<} and @samp{>} pair (for -C++ templates), such a @samp{::} does not end the name---only a single +C@t{++} templates), such a @samp{::} does not end the name---only a single @samp{:} ends the name; see @ref{Nested Symbols}. For example, the following C declarations: @@ -2062,13 +2062,13 @@ The @code{s_next} field is a pointer to the same kind of structure that the field is an element of. So the definition of structure type 16 contains a type definition for an element which is a pointer to type 16. -If a field is a static member (this is a C++ feature in which a single +If a field is a static member (this is a C@t{++} feature in which a single variable appears to be a field of every structure of a given type) it still starts out with the field name, a colon, and the type, but then instead of a comma, bit position, comma, and bit size, there is a colon followed by the name of the variable which each such field refers to. -If the structure has methods (a C++ feature), they follow the non-method +If the structure has methods (a C@t{++} feature), they follow the non-method fields; see @ref{Cplusplus}. @node Typedefs @@ -2389,7 +2389,7 @@ Symnum n_type n_othr n_desc n_value n_strx String @end example @node Cplusplus -@chapter GNU C++ Stabs +@chapter GNU C@t{++} Stabs @menu * Class Names:: C++ class names are both tags and typedefs. @@ -2409,9 +2409,9 @@ Symnum n_type n_othr n_desc n_value n_strx String @end menu @node Class Names -@section C++ Class Names +@section C@t{++} Class Names -In C++, a class name which is declared with @code{class}, @code{struct}, +In C@t{++}, a class name which is declared with @code{class}, @code{struct}, or @code{union}, is not only a tag, as in C, but also a type name. Thus there should be stabs with both @samp{t} and @samp{T} symbol descriptors (@pxref{Typedefs}). @@ -2420,7 +2420,7 @@ To save space, there is a special abbreviation for this case. If the @samp{T} symbol descriptor is followed by @samp{t}, then the stab defines both a type name and a tag. -For example, the C++ code +For example, the C@t{++} code @example struct foo @{int x;@}; @@ -2442,7 +2442,7 @@ or @node Nested Symbols @section Defining a Symbol Within Another Type -In C++, a symbol (such as a type name) can be defined within another type. +In C@t{++}, a symbol (such as a type name) can be defined within another type. @c FIXME: Needs example. In stabs, this is sometimes represented by making the name of a symbol @@ -2457,12 +2457,12 @@ then @code{foo::bar::baz} is the name of the symbol, @samp{t} is the symbol descriptor, and @samp{5=*6} is the type information. @node Basic Cplusplus Types -@section Basic Types For C++ +@section Basic Types For C@t{++} << the examples that follow are based on a01.C >> -C++ adds two more builtin types to the set defined for C. These are +C@t{++} adds two more builtin types to the set defined for C. These are the unknown type and the vtable record type. The unknown type, type 16, is defined in terms of itself like the void type. @@ -2473,7 +2473,7 @@ pfn, and delta2. pfn is the function pointer. << In boilerplate $vtbl_ptr_type, what are the fields delta, index, and delta2 used for? >> -This basic type is present in all C++ programs even if there are no +This basic type is present in all C@t{++} programs even if there are no virtual methods defined. @display @@ -2503,8 +2503,8 @@ virtual methods defined. @node Simple Classes @section Simple Class Definition -The stabs describing C++ language features are an extension of the -stabs describing C. Stabs representing C++ class types elaborate +The stabs describing C@t{++} language features are an extension of the +stabs describing C. Stabs representing C@t{++} class types elaborate extensively on the stab format used to describe structure types in C. Stabs representing class type variables look just like stabs representing C language variables. @@ -2526,20 +2526,20 @@ stab is not located between an @code{N_FUN} and an @code{N_LBRAC} stab this indi that the class is defined at file scope. If it were, then the @code{N_LSYM} would signify a local variable. -A stab describing a C++ class type is similar in format to a stab +A stab describing a C@t{++} class type is similar in format to a stab describing a C struct, with each class member shown as a field in the structure. The part of the struct format describing fields is -expanded to include extra information relevant to C++ class members. +expanded to include extra information relevant to C@t{++} class members. In addition, if the class has multiple base classes or virtual functions the struct format outside of the field parts is also augmented. -In this simple example the field part of the C++ class stab +In this simple example the field part of the C@t{++} class stab representing member data looks just like the field part of a C struct stab. The section on protections describes how its format is sometimes extended for member data. -The field part of a C++ class stab representing a member function +The field part of a C@t{++} class stab representing a member function differs substantially from the field part of a C struct stab. It still begins with @samp{name:} but then goes on to define a new type number for the member function, describe its return type, its argument types, @@ -2566,7 +2566,7 @@ occur in the @var{operator-name} string. The next part of the method description represents the arguments to the method, preceded by a colon and ending with a semi-colon. The types of the arguments are expressed in the same way argument types are expressed -in C++ name mangling. In this example an @code{int} and a @code{char} +in C@t{++} name mangling. In this example an @code{int} and a @code{char} map to @samp{ic}. This is followed by a number, a letter, and an asterisk or period, @@ -2600,7 +2600,7 @@ information present for virtual methods. @node Class Instance @section Class Instance -As shown above, describing even a simple C++ class definition is +As shown above, describing even a simple C@t{++} class definition is accomplished by massively extending the stab format used in C to describe structure types. However, once the class is defined, C stabs with no modifications can be used to describe class instances. The @@ -2627,7 +2627,7 @@ different from a standard C stab describing a local variable. @node Methods @section Method Definition -The class definition shown above declares Ameth. The C++ source below +The class definition shown above declares Ameth. The C@t{++} source below defines Ameth: @example @@ -2723,7 +2723,7 @@ descriptor for a pointer-to-non-static-member-data type. It is followed by type information for the class (or union), a comma, and type information for the member data. -The following C++ source: +The following C@t{++} source: @smallexample typedef int A::*int_in_a; @@ -2737,7 +2737,7 @@ generates the following stab: Note that there is a conflict between this and type attributes (@pxref{String Field}); both use type descriptor @samp{@@}. -Fortunately, the @samp{@@} type descriptor used in this C++ sense always +Fortunately, the @samp{@@} type descriptor used in this C@t{++} sense always will be followed by a digit, @samp{(}, or @samp{-}, and type attributes never start with those things. @@ -2747,7 +2747,7 @@ never start with those things. In the simple class definition shown above all member data and functions were publicly accessible. The example that follows contrasts public, protected and privately accessible fields and shows -how these protections are encoded in C++ stabs. +how these protections are encoded in C@t{++} stabs. If the character following the @samp{@var{field-name}:} part of the string is @samp{/}, then the next character is the visibility. @samp{0} @@ -2761,7 +2761,7 @@ an optimized out field with a private or protected visibility). Visibility @samp{9} is not supported by GDB 4.11; this should be fixed in the next GDB release. -The following C++ source: +The following C@t{++} source: @example class vis @{ @@ -2791,7 +2791,7 @@ type float (@samp{12}), and offset and size @samp{,64,32;}. Protections for member functions are signified by one digit embedded in the field part of the stab describing the method. The digit is 0 if -private, 1 if protected and 2 if public. Consider the C++ class +private, 1 if protected and 2 if public. Consider the C@t{++} class definition below: @example @@ -2889,7 +2889,7 @@ struct is @samp{Adat}, an integer, starting at structure offset 0 and occupying 32 bits. The second field in the class struct is not explicitly defined by the -C++ class definition but is implied by the fact that the class +C@t{++} class definition but is implied by the fact that the class contains a virtual method. This field is the vtable pointer. The name of the vtable pointer field starts with @samp{$vf} and continues with a type reference to the class it is part of. In this example the type @@ -2901,7 +2901,7 @@ This is in turn defined as a pointer to another new type (22). Type 22 is the vtable itself, which is defined as an array, indexed by a range of integers between 0 and 1, and whose elements are of type -17. Type 17 was the vtable record type defined by the boilerplate C++ +17. Type 17 was the vtable record type defined by the boilerplate C@t{++} type definitions, as shown earlier. The bit offset of the vtable pointer field is 32. The number of bits @@ -2955,7 +2955,7 @@ class. This is preceded by @samp{~%} and followed by a final semi-colon. @node Inheritance @section Inheritance -Stabs describing C++ derived classes include additional sections that +Stabs describing C@t{++} derived classes include additional sections that describe the inheritance hierarchy of the class. A derived class stab also encodes the number of base classes. For each base class it tells if the base class is virtual or not, and if the inheritance is private @@ -3286,13 +3286,13 @@ GNU Modula2 definition module dependency; see @ref{N_DEFD}. Function start/body/end line numbers (Solaris2). @item 0x50 N_EHDECL -GNU C++ exception variable; see @ref{N_EHDECL}. +GNU C@t{++} exception variable; see @ref{N_EHDECL}. @item 0x50 N_MOD2 Modula2 info "for imc" (according to Ultrix V4.0); see @ref{N_MOD2}. @item 0x54 N_CATCH -GNU C++ @code{catch} clause; see @ref{N_CATCH}. +GNU C@t{++} @code{catch} clause; see @ref{N_CATCH}. @item 0x60 N_SSYM Structure of union element; see @ref{N_SSYM}. @@ -3386,7 +3386,7 @@ for more information about their use. Variable on the stack; see @ref{Stack Variables}. @item : -C++ nested symbol; see @xref{Nested Symbols}. +C@t{++} nested symbol; see @xref{Nested Symbols}. @item a Parameter passed by reference in register; see @ref{Reference Parameters}. @@ -3399,7 +3399,7 @@ Constant; see @ref{Constants}. @item C Conformant array bound (Pascal, maybe other languages); @ref{Conformant -Arrays}. Name of a caught exception (GNU C++). These can be +Arrays}. Name of a caught exception (GNU C@t{++}). These can be distinguished because the latter uses @code{N_CATCH} and the former uses another symbol type. @@ -3500,17 +3500,17 @@ Type reference; see @ref{String Field}. Reference to builtin type; see @ref{Negative Type Numbers}. @item # -Method (C++); see @ref{Method Type Descriptor}. +Method (C@t{++}); see @ref{Method Type Descriptor}. @item * Pointer; see @ref{Miscellaneous Types}. @item & -Reference (C++). +Reference (C@t{++}). @item @@ Type Attributes (AIX); see @ref{String Field}. Member (class and variable) -type (GNU C++); see @ref{Member Type Descriptor}. +type (GNU C@t{++}); see @ref{Member Type Descriptor}. @item a Array; see @ref{Arrays}. @@ -3615,7 +3615,7 @@ Wide character; see @ref{Builtin Type Descriptors}. Cross-reference; see @ref{Cross-References}. @item Y -Used by IBM's xlC C++ compiler (for structures, I think). +Used by IBM's xlC C@t{++} compiler (for structures, I think). @item z gstring; see @ref{Strings}. @@ -3757,7 +3757,7 @@ if it is imported with the GNU M2 keyword @code{%INITIALIZE}. Perhaps @deffn @code{.stabs} N_EHDECL @findex N_EHDECL -GNU C++ exception variable <<?>>. +GNU C@t{++} exception variable <<?>>. "@var{string} is variable name" @@ -3779,9 +3779,9 @@ Note: conflicts with @code{N_EHDECL} <<?>> @deffn @code{.stabn} N_CATCH @findex N_CATCH -GNU C++ @code{catch} clause +GNU C@t{++} @code{catch} clause -GNU C++ @code{catch} clause. The value is its address. The desc field +GNU C@t{++} @code{catch} clause. The value is its address. The desc field is nonzero if this entry is immediately followed by a @code{CAUGHT} stab saying what exception was caught. Multiple @code{CAUGHT} stabs means that multiple exceptions can be caught here. If desc is 0, it means all diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 2c655d9..5a55976 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -1,6 +1,6 @@ /* Frame unwinder for frames with DWARF Call Frame Information. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by Mark Kettenis. @@ -97,49 +97,13 @@ static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc); /* Structure describing a frame state. */ -enum dwarf2_reg_rule -{ - /* Make certain that 0 maps onto the correct enum value; the - corresponding structure is being initialized using memset zero. - This indicates that CFI didn't provide any information at all - about a register, leaving how to obtain its value totally - unspecified. */ - REG_UNSPECIFIED = 0, - - /* The term "undefined" comes from the DWARF2 CFI spec which this - code is moddeling; it indicates that the register's value is - "undefined". GCC uses the less formal term "unsaved". Its - definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. - The failure to differentiate the two helps explain a few problems - with the CFI generated by GCC. */ - REG_UNDEFINED, - REG_SAVED_OFFSET, - REG_SAVED_REG, - REG_SAVED_EXP, - REG_SAME_VALUE, - - /* These aren't defined by the DWARF2 CFI specification, but are - used internally by GDB. */ - REG_RA, /* Return Address. */ - REG_CFA /* Call Frame Address. */ -}; - struct dwarf2_frame_state { /* Each register save state can be described in terms of a CFA slot, another register, or a location expression. */ struct dwarf2_frame_state_reg_info { - struct dwarf2_frame_state_reg - { - union { - LONGEST offset; - ULONGEST reg; - unsigned char *exp; - } loc; - ULONGEST exp_len; - enum dwarf2_reg_rule how; - } *reg; + struct dwarf2_frame_state_reg *reg; int num_regs; /* Used to implement DW_CFA_remember_state. */ @@ -242,12 +206,13 @@ static CORE_ADDR read_reg (void *baton, int reg) { struct frame_info *next_frame = (struct frame_info *) baton; + struct gdbarch *gdbarch = get_frame_arch (next_frame); int regnum; char *buf; regnum = DWARF2_REG_TO_REGNUM (reg); - buf = (char *) alloca (register_size (current_gdbarch, regnum)); + buf = (char *) alloca (register_size (gdbarch, regnum)); frame_unwind_register (next_frame, regnum, buf); return extract_typed_address (buf, builtin_type_void_data_ptr); } @@ -321,7 +286,7 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp); offset = utmp * fs->data_align; dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg].how = REG_SAVED_OFFSET; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_OFFSET; fs->regs.reg[reg].loc.offset = offset; } else if ((insn & 0xc0) == DW_CFA_restore) @@ -361,7 +326,7 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp); offset = utmp * fs->data_align; dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg].how = REG_SAVED_OFFSET; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_OFFSET; fs->regs.reg[reg].loc.offset = offset; break; @@ -375,20 +340,20 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, case DW_CFA_undefined: insn_ptr = read_uleb128 (insn_ptr, insn_end, ®); dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg].how = REG_UNDEFINED; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNDEFINED; break; case DW_CFA_same_value: insn_ptr = read_uleb128 (insn_ptr, insn_end, ®); dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg].how = REG_SAME_VALUE; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAME_VALUE; break; case DW_CFA_register: insn_ptr = read_uleb128 (insn_ptr, insn_end, ®); insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp); dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg].how = REG_SAVED_REG; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_REG; fs->regs.reg[reg].loc.reg = utmp; break; @@ -448,7 +413,7 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp); fs->regs.reg[reg].loc.exp = insn_ptr; fs->regs.reg[reg].exp_len = utmp; - fs->regs.reg[reg].how = REG_SAVED_EXP; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_EXP; insn_ptr += utmp; break; @@ -457,7 +422,7 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, insn_ptr = read_sleb128 (insn_ptr, insn_end, &offset); offset += fs->data_align; dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); - fs->regs.reg[reg].how = REG_SAVED_OFFSET; + fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_OFFSET; fs->regs.reg[reg].loc.offset = offset; break; @@ -500,10 +465,47 @@ struct dwarf2_frame_cache struct dwarf2_frame_state_reg *reg; }; +/* Initialize the register state REG. If we have a register that acts + as a program counter, mark it as a destination for the return + address. If we have a register that serves as the stack pointer, + arrange for it to be filled with the call frame address (CFA). The + other registers are marked as unspecified. + + We copy the return address to the program counter, since many parts + in GDB assume that it is possible to get the return address by + unwind the program counter register. However, on ISA's with a + dedicated return address register, the CFI usually only contains + information to unwind that return address register. + + The reason we're treating the stack pointer special here is because + in many cases GCC doesn't emit CFI for the stack pointer and + implicitly assumes that it is equal to the CFA. This makes some + sense since the DWARF specification (version 3, draft 8, p. 102) + says that: + + "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)." + + However, this isn't true for all platforms supported by GCC + (e.g. IBM S/390 and zSeries). For those targets we should override + the defaults given here. */ + +static void +dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, + struct dwarf2_frame_state_reg *reg) +{ + if (regnum == PC_REGNUM) + reg->how = DWARF2_FRAME_REG_RA; + else if (regnum == SP_REGNUM) + reg->how = DWARF2_FRAME_REG_CFA; +} + static struct dwarf2_frame_cache * dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) { struct cleanup *old_chain; + struct gdbarch *gdbarch = get_frame_arch (next_frame); const int num_regs = NUM_REGS + NUM_PSEUDO_REGS; struct dwarf2_frame_cache *cache; struct dwarf2_frame_state *fs; @@ -575,43 +577,12 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) internal_error (__FILE__, __LINE__, "Unknown CFA rule."); } - /* Initialize the register rules. If we have a register that acts - as a program counter, mark it as a destination for the return - address. If we have a register that serves as the stack pointer, - arrange for it to be filled with the call frame address (CFA). - The other registers are marked as unspecified. - - We copy the return address to the program counter, since many - parts in GDB assume that it is possible to get the return address - by unwind the program counter register. However, on ISA's with a - dedicated return address register, the CFI usually only contains - information to unwind that return address register. - - The reason we're treating the stack pointer special here is - because in many cases GCC doesn't emit CFI for the stack pointer - and implicitly assumes that it is equal to the CFA. This makes - some sense since the DWARF specification (version 3, draft 8, - p. 102) says that: - - "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)." - - However, this isn't true for all platforms supported by GCC - (e.g. IBM S/390 and zSeries). For those targets we should - override the defaults given here. */ + /* Initialize the register state. */ { int regnum; for (regnum = 0; regnum < num_regs; regnum++) - { - if (regnum == PC_REGNUM) - cache->reg[regnum].how = REG_RA; - else if (regnum == SP_REGNUM) - cache->reg[regnum].how = REG_CFA; - else - cache->reg[regnum].how = REG_UNSPECIFIED; - } + dwarf2_frame_init_reg (gdbarch, regnum, &cache->reg[regnum]); } /* Go through the DWARF2 CFI generated table and save its register @@ -644,7 +615,7 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) problems when a debug info register falls outside of the table. We need a way of iterating through all the valid DWARF2 register numbers. */ - if (fs->regs.reg[column].how == REG_UNSPECIFIED) + if (fs->regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED) complaint (&symfile_complaints, "Incomplete CFI data; unspecified registers at 0x%s", paddr (fs->pc)); @@ -653,24 +624,32 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) } } - /* Eliminate any REG_RA rules. */ + /* Eliminate any DWARF2_FRAME_REG_RA rules. */ { int regnum; for (regnum = 0; regnum < num_regs; regnum++) { - if (cache->reg[regnum].how == REG_RA) + if (cache->reg[regnum].how == DWARF2_FRAME_REG_RA) { - if (fs->retaddr_column < fs->regs.num_regs) - cache->reg[regnum] = fs->regs.reg[fs->retaddr_column]; + struct dwarf2_frame_state_reg *retaddr_reg = + &fs->regs.reg[fs->retaddr_column]; + + /* It seems rather bizarre to specify an "empty" column as + the return adress column. However, this is exactly + what GCC does on some targets. It turns out that GCC + assumes that the return address can be found in the + register corresponding to the return address column. + Incidentally, that's how should treat a return address + column specifying "same value" too. */ + if (fs->retaddr_column < fs->regs.num_regs + && retaddr_reg->how != DWARF2_FRAME_REG_UNSPECIFIED + && retaddr_reg->how != DWARF2_FRAME_REG_SAME_VALUE) + cache->reg[regnum] = *retaddr_reg; else { - /* It turns out that GCC assumes that if the return - address column is "empty" the return address can be - found in the register corresponding to the return - address column. */ cache->reg[regnum].loc.reg = fs->retaddr_column; - cache->reg[regnum].how = REG_SAVED_REG; + cache->reg[regnum].how = DWARF2_FRAME_REG_SAVED_REG; } } } @@ -698,12 +677,13 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, enum lval_type *lvalp, CORE_ADDR *addrp, int *realnump, void *valuep) { + struct gdbarch *gdbarch = get_frame_arch (next_frame); struct dwarf2_frame_cache *cache = dwarf2_frame_cache (next_frame, this_cache); switch (cache->reg[regnum].how) { - case REG_UNDEFINED: + case DWARF2_FRAME_REG_UNDEFINED: /* If CFI explicitly specified that the value isn't defined, mark it as optimized away; the value isn't available. */ *optimizedp = 1; @@ -719,7 +699,7 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, } break; - case REG_SAVED_OFFSET: + case DWARF2_FRAME_REG_SAVED_OFFSET: *optimizedp = 0; *lvalp = lval_memory; *addrp = cache->cfa + cache->reg[regnum].loc.offset; @@ -727,18 +707,17 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, if (valuep) { /* Read the value in from memory. */ - read_memory (*addrp, valuep, - register_size (current_gdbarch, regnum)); + read_memory (*addrp, valuep, register_size (gdbarch, regnum)); } break; - case REG_SAVED_REG: + case DWARF2_FRAME_REG_SAVED_REG: regnum = DWARF2_REG_TO_REGNUM (cache->reg[regnum].loc.reg); frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp, realnump, valuep); break; - case REG_SAVED_EXP: + case DWARF2_FRAME_REG_SAVED_EXP: *optimizedp = 0; *lvalp = lval_memory; *addrp = execute_stack_op (cache->reg[regnum].loc.exp, @@ -748,12 +727,11 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, if (valuep) { /* Read the value in from memory. */ - read_memory (*addrp, valuep, - register_size (current_gdbarch, regnum)); + read_memory (*addrp, valuep, register_size (gdbarch, regnum)); } break; - case REG_UNSPECIFIED: + case DWARF2_FRAME_REG_UNSPECIFIED: /* GCC, in its infinite wisdom decided to not provide unwind information for registers that are "same value". Since DWARF2 (3 draft 7) doesn't define such behavior, said @@ -765,12 +743,12 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, optimizedp, lvalp, addrp, realnump, valuep); break; - case REG_SAME_VALUE: + case DWARF2_FRAME_REG_SAME_VALUE: frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp, realnump, valuep); break; - case REG_CFA: + case DWARF2_FRAME_REG_CFA: *optimizedp = 0; *lvalp = not_lval; *addrp = 0; @@ -1233,7 +1211,7 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p) return end; cie = (struct dwarf2_cie *) - obstack_alloc (&unit->objfile->psymbol_obstack, + obstack_alloc (&unit->objfile->objfile_obstack, sizeof (struct dwarf2_cie)); cie->initial_instructions = NULL; cie->cie_pointer = cie_pointer; @@ -1349,7 +1327,7 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p) return NULL; fde = (struct dwarf2_fde *) - obstack_alloc (&unit->objfile->psymbol_obstack, + obstack_alloc (&unit->objfile->objfile_obstack, sizeof (struct dwarf2_fde)); fde->cie = find_cie (unit, cie_pointer); if (fde->cie == NULL) diff --git a/gdb/dwarf2-frame.h b/gdb/dwarf2-frame.h index c9c106f..b650a84 100644 --- a/gdb/dwarf2-frame.h +++ b/gdb/dwarf2-frame.h @@ -1,6 +1,6 @@ /* Frame unwinder for frames with DWARF Call Frame Information. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by Mark Kettenis. @@ -27,15 +27,61 @@ struct objfile; struct frame_info; +/* Register rule. */ + +enum dwarf2_frame_reg_rule +{ + /* Make certain that 0 maps onto the correct enum value; the + corresponding structure is being initialized using memset zero. + This indicates that CFI didn't provide any information at all + about a register, leaving how to obtain its value totally + unspecified. */ + DWARF2_FRAME_REG_UNSPECIFIED = 0, + + /* The term "undefined" comes from the DWARF2 CFI spec which this + code is moddeling; it indicates that the register's value is + "undefined". GCC uses the less formal term "unsaved". Its + definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. + The failure to differentiate the two helps explain a few problems + with the CFI generated by GCC. */ + DWARF2_FRAME_REG_UNDEFINED, + DWARF2_FRAME_REG_SAVED_OFFSET, + DWARF2_FRAME_REG_SAVED_REG, + DWARF2_FRAME_REG_SAVED_EXP, + DWARF2_FRAME_REG_SAME_VALUE, + + /* These aren't defined by the DWARF2 CFI specification, but are + used internally by GDB. */ + DWARF2_FRAME_REG_RA, /* Return Address. */ + DWARF2_FRAME_REG_CFA /* Call Frame Address. */ +}; + +/* Register state. */ + +struct dwarf2_frame_state_reg +{ + /* Each register save state can be described in terms of a CFA slot, + another register, or a location expression. */ + union { + LONGEST offset; + ULONGEST reg; + unsigned char *exp; + } loc; + ULONGEST exp_len; + enum dwarf2_frame_reg_rule how; +}; + /* Return the frame unwind methods for the function that contains PC, or NULL if it can't be handled by DWARF CFI frame unwinder. */ -const struct frame_unwind *dwarf2_frame_sniffer (struct frame_info *next_frame); +extern const struct frame_unwind * + dwarf2_frame_sniffer (struct frame_info *next_frame); /* Return the frame base methods for the function that contains PC, or NULL if it can't be handled by the DWARF CFI frame unwinder. */ -const struct frame_base *dwarf2_frame_base_sniffer (struct frame_info *next_frame); +extern const struct frame_base * + dwarf2_frame_base_sniffer (struct frame_info *next_frame); /* Register the DWARF CFI for OBJFILE. */ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index fac5c4a..ef333f7 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -154,7 +154,7 @@ dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length) framefunc = get_frame_function (debaton->frame); - if (SYMBOL_LOCATION_FUNCS (framefunc) == &dwarf2_loclist_funcs) + if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs) { struct dwarf2_loclist_baton *symbaton; symbaton = SYMBOL_LOCATION_BATON (framefunc); @@ -465,7 +465,7 @@ locexpr_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, /* The set of location functions used with the DWARF-2 expression evaluator. */ -struct location_funcs dwarf2_locexpr_funcs = { +const struct symbol_ops dwarf2_locexpr_funcs = { locexpr_read_variable, locexpr_read_needs_frame, locexpr_describe_location, @@ -537,7 +537,7 @@ loclist_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, /* The set of location functions used with the DWARF-2 expression evaluator and location lists. */ -struct location_funcs dwarf2_loclist_funcs = { +const struct symbol_ops dwarf2_loclist_funcs = { loclist_read_variable, loclist_read_needs_frame, loclist_describe_location, diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index 321cb03..ce0a8ef 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -21,6 +21,8 @@ #if !defined (DWARF2LOC_H) #define DWARF2LOC_H +struct symbol_ops; + /* This header is private to the DWARF-2 reader. It is shared between dwarf2read.c and dwarf2loc.c. */ @@ -62,7 +64,7 @@ struct dwarf2_loclist_baton struct objfile *objfile; }; -extern struct location_funcs dwarf2_locexpr_funcs; -extern struct location_funcs dwarf2_loclist_funcs; +extern const struct symbol_ops dwarf2_locexpr_funcs; +extern const struct symbol_ops dwarf2_loclist_funcs; #endif diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index cdfcda2..8de89d3 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -231,6 +231,34 @@ struct dwarf2_cu should be moved to the dwarf2_cu structure; for instance the abbrevs hash table. */ struct comp_unit_head header; + + struct function_range *first_fn, *last_fn, *cached_fn; + + /* The language we are debugging. */ + enum language language; + const struct language_defn *language_defn; + + /* The generic symbol table building routines have separate lists for + file scope symbols and all all other scopes (local scopes). So + we need to select the right one to pass to add_symbol_to_list(). + We do it by keeping a pointer to the correct list in list_in_scope. + + FIXME: The original dwarf code just treated the file scope as the + first local scope, and all other local scopes as nested local + scopes, and worked fine. Check to see if we really need to + distinguish these in buildsym.c. */ + struct pending **list_in_scope; + + /* Maintain an array of referenced fundamental types for the current + compilation unit being read. For DWARF version 1, we have to construct + the fundamental types on the fly, since no information about the + fundamental types is supplied. Each such fundamental type is created by + calling a language dependent routine to create the type, and then a + pointer to that type is then placed in the array at the index specified + by it's FT_<TYPENAME> value. The array has a fixed size set by the + FT_NUM_MEMBERS compile time constant, which is the number of predefined + fundamental types gdb knows how to construct. */ + struct type *ftypes[FT_NUM_MEMBERS]; /* Fundamental types */ }; /* The line number information for a compilation unit (found in the @@ -360,8 +388,6 @@ struct function_range struct function_range *next; }; -static struct function_range *cu_first_fn, *cu_last_fn, *cu_cached_fn; - /* Get at parts of an attribute structure */ #define DW_STRING(attr) ((attr)->u.str) @@ -391,19 +417,11 @@ static struct die_info *die_ref_table[REF_HASH_SIZE]; /* Obstack for allocating temporary storage used during symbol reading. */ static struct obstack dwarf2_tmp_obstack; -/* Offset to the first byte of the current compilation unit header, - for resolving relative reference dies. */ -static unsigned int cu_header_offset; - /* Allocate fields for structs, unions and enums in this size. */ #ifndef DW_FIELD_ALLOC_CHUNK #define DW_FIELD_ALLOC_CHUNK 4 #endif -/* The language we are debugging. */ -static enum language cu_language; -static const struct language_defn *cu_language_defn; - /* Actually data from the sections. */ static char *dwarf_info_buffer; static char *dwarf_abbrev_buffer; @@ -416,17 +434,6 @@ static char *dwarf_loc_buffer; /* A zeroed version of a partial die for initialization purposes. */ static struct partial_die_info zeroed_partial_die; -/* The generic symbol table building routines have separate lists for - file scope symbols and all all other scopes (local scopes). So - we need to select the right one to pass to add_symbol_to_list(). - We do it by keeping a pointer to the correct list in list_in_scope. - - FIXME: The original dwarf code just treated the file scope as the first - local scope, and all other local scopes as nested local scopes, and worked - fine. Check to see if we really need to distinguish these - in buildsym.c. */ -static struct pending **list_in_scope = &file_symbols; - /* FIXME: decode_locdesc sets these variables to describe the location to the caller. These ought to be a structure or something. If none of the flags are set, the object lives at the address returned @@ -436,15 +443,10 @@ static int isreg; /* Object lives in register. decode_locdesc's return value is the register number. */ -/* This value is added to each symbol value. FIXME: Generalize to - the section_offsets structure used by dbxread (once this is done, - pass the appropriate section number to end_symtab). */ -static CORE_ADDR baseaddr; /* Add to each symbol value */ - /* We put a pointer to this structure in the read_symtab_private field of the psymtab. The complete dwarf information for an objfile is kept in the - psymbol_obstack, so that absolute die references can be handled. + objfile_obstack, so that absolute die references can be handled. Most of the information in this structure is related to an entire object file and could be passed via the sym_private field of the objfile. It is however conceivable that dwarf2 might not be the only type @@ -525,17 +527,6 @@ struct dwarf2_pinfo #define DWARF_LOC_BUFFER(p) (PST_PRIVATE(p)->dwarf_loc_buffer) #define DWARF_LOC_SIZE(p) (PST_PRIVATE(p)->dwarf_loc_size) -/* Maintain an array of referenced fundamental types for the current - compilation unit being read. For DWARF version 1, we have to construct - the fundamental types on the fly, since no information about the - fundamental types is supplied. Each such fundamental type is created by - calling a language dependent routine to create the type, and then a - pointer to that type is then placed in the array at the index specified - by it's FT_<TYPENAME> value. The array has a fixed size set by the - FT_NUM_MEMBERS compile time constant, which is the number of predefined - fundamental types gdb knows how to construct. */ -static struct type *ftypes[FT_NUM_MEMBERS]; /* Fundamental types */ - /* FIXME: We might want to set this from BFD via bfd_arch_bits_per_byte, but this would require a corresponding change in unpack_field_as_long and friends. */ @@ -730,13 +721,15 @@ static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *); static long read_signed_leb128 (bfd *, char *, unsigned int *); -static void set_cu_language (unsigned int); +static void set_cu_language (unsigned int, struct dwarf2_cu *); -static struct attribute *dwarf_attr (struct die_info *, unsigned int); +static struct attribute *dwarf2_attr (struct die_info *, unsigned int, + struct dwarf2_cu *); -static int die_is_declaration (struct die_info *); +static int die_is_declaration (struct die_info *, struct dwarf2_cu *cu); -static struct die_info *die_specification (struct die_info *die); +static struct die_info *die_specification (struct die_info *die, + struct dwarf2_cu *); static void free_line_header (struct line_header *lh); @@ -772,11 +765,13 @@ static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *); static void read_type_die (struct die_info *, struct dwarf2_cu *); -static char *determine_prefix (struct die_info *die); +static char *determine_prefix (struct die_info *die, struct dwarf2_cu *); + +static char *determine_prefix_aux (struct die_info *die, struct dwarf2_cu *); static char *typename_concat (const char *prefix, const char *suffix); -static char *class_name (struct die_info *die); +static char *class_name (struct die_info *die, struct dwarf2_cu *); static void read_typedef (struct die_info *, struct dwarf2_cu *); @@ -793,6 +788,10 @@ static void read_lexical_block_scope (struct die_info *, struct dwarf2_cu *); static int dwarf2_get_pc_bounds (struct die_info *, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *); +static void get_scope_pc_bounds (struct die_info *, + CORE_ADDR *, CORE_ADDR *, + struct dwarf2_cu *); + static void dwarf2_add_field (struct field_info *, struct die_info *, struct dwarf2_cu *); @@ -813,7 +812,7 @@ static void read_common_block (struct die_info *, struct dwarf2_cu *); static void read_namespace (struct die_info *die, struct dwarf2_cu *); static const char *namespace_name (struct die_info *die, - int *is_anonymous); + int *is_anonymous, struct dwarf2_cu *); static void read_enumeration (struct die_info *, struct dwarf2_cu *); @@ -856,11 +855,12 @@ static struct cleanup *make_cleanup_free_die_list (struct die_info *); static void process_die (struct die_info *, struct dwarf2_cu *); -static char *dwarf2_linkage_name (struct die_info *); +static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *); -static char *dwarf2_name (struct die_info *die); +static char *dwarf2_name (struct die_info *die, struct dwarf2_cu *); -static struct die_info *dwarf2_extension (struct die_info *die); +static struct die_info *dwarf2_extension (struct die_info *die, + struct dwarf2_cu *); static char *dwarf_tag_name (unsigned int); @@ -890,13 +890,15 @@ static void store_in_ref_table (unsigned int, struct die_info *); static void dwarf2_empty_hash_tables (void); -static unsigned int dwarf2_get_ref_die_offset (struct attribute *); +static unsigned int dwarf2_get_ref_die_offset (struct attribute *, + struct dwarf2_cu *); static int dwarf2_get_attr_constant_value (struct attribute *, int); static struct die_info *follow_die_ref (unsigned int); -static struct type *dwarf2_fundamental_type (struct objfile *, int); +static struct type *dwarf2_fundamental_type (struct objfile *, int, + struct dwarf2_cu *); /* memory allocation interface */ @@ -908,9 +910,10 @@ static struct abbrev_info *dwarf_alloc_abbrev (void); static struct die_info *dwarf_alloc_die (void); -static void initialize_cu_func_list (void); +static void initialize_cu_func_list (struct dwarf2_cu *); -static void add_to_cu_func_list (const char *, CORE_ADDR, CORE_ADDR); +static void add_to_cu_func_list (const char *, CORE_ADDR, CORE_ADDR, + struct dwarf2_cu *); static void dwarf_decode_macros (struct line_header *, unsigned int, char *, bfd *, struct dwarf2_cu *); @@ -1148,7 +1151,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) struct partial_die_info comp_unit_die; struct partial_symtab *pst; struct cleanup *back_to; - CORE_ADDR lowpc, highpc; + CORE_ADDR lowpc, highpc, baseaddr; info_ptr = dwarf_info_buffer; abbrev_ptr = dwarf_abbrev_buffer; @@ -1232,6 +1235,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) cu.header.first_die_ptr = info_ptr; cu.header.cu_head_ptr = beg_of_comp_unit; + cu.list_in_scope = &file_symbols; + /* Read the abbrevs for this compilation unit into a table */ dwarf2_read_abbrevs (abfd, &cu); make_cleanup (dwarf2_empty_abbrev_table, cu.header.dwarf2_abbrevs); @@ -1241,7 +1246,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) &cu); /* Set the language we're debugging */ - set_cu_language (comp_unit_die.language); + set_cu_language (comp_unit_die.language, &cu); /* Allocate a new partial symbol table structure */ pst = start_psymtab_common (objfile, objfile->section_offsets, @@ -1251,8 +1256,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) objfile->static_psymbols.next); pst->read_symtab_private = (char *) - obstack_alloc (&objfile->psymbol_obstack, sizeof (struct dwarf2_pinfo)); - cu_header_offset = beg_of_comp_unit - dwarf_info_buffer; + obstack_alloc (&objfile->objfile_obstack, sizeof (struct dwarf2_pinfo)); DWARF_INFO_BUFFER (pst) = dwarf_info_buffer; DWARF_INFO_OFFSET (pst) = beg_of_comp_unit - dwarf_info_buffer; DWARF_ABBREV_BUFFER (pst) = dwarf_abbrev_buffer; @@ -1442,6 +1446,9 @@ add_partial_symbol (struct partial_die_info *pdi, CORE_ADDR addr = 0; char *actual_name = pdi->name; const struct partial_symbol *psym = NULL; + CORE_ADDR baseaddr; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); /* If we're not in the global namespace and if the namespace name isn't encoded in a mangled actual_name, add it. */ @@ -1465,7 +1472,7 @@ add_partial_symbol (struct partial_die_info *pdi, VAR_DOMAIN, LOC_BLOCK, &objfile->global_psymbols, 0, pdi->lowpc + baseaddr, - cu_language, objfile); + cu->language, objfile); } else { @@ -1475,7 +1482,7 @@ add_partial_symbol (struct partial_die_info *pdi, VAR_DOMAIN, LOC_BLOCK, &objfile->static_psymbols, 0, pdi->lowpc + baseaddr, - cu_language, objfile); + cu->language, objfile); } break; case DW_TAG_variable: @@ -1501,7 +1508,7 @@ add_partial_symbol (struct partial_die_info *pdi, VAR_DOMAIN, LOC_STATIC, &objfile->global_psymbols, 0, addr + baseaddr, - cu_language, objfile); + cu->language, objfile); } else { @@ -1515,7 +1522,7 @@ add_partial_symbol (struct partial_die_info *pdi, VAR_DOMAIN, LOC_STATIC, &objfile->static_psymbols, 0, addr + baseaddr, - cu_language, objfile); + cu->language, objfile); } break; case DW_TAG_typedef: @@ -1524,7 +1531,7 @@ add_partial_symbol (struct partial_die_info *pdi, add_psymbol_to_list (actual_name, strlen (actual_name), VAR_DOMAIN, LOC_TYPEDEF, &objfile->static_psymbols, - 0, (CORE_ADDR) 0, cu_language, objfile); + 0, (CORE_ADDR) 0, cu->language, objfile); break; case DW_TAG_class_type: case DW_TAG_structure_type: @@ -1538,27 +1545,27 @@ add_partial_symbol (struct partial_die_info *pdi, return; add_psymbol_to_list (actual_name, strlen (actual_name), STRUCT_DOMAIN, LOC_TYPEDEF, - cu_language == language_cplus + cu->language == language_cplus ? &objfile->global_psymbols : &objfile->static_psymbols, - 0, (CORE_ADDR) 0, cu_language, objfile); + 0, (CORE_ADDR) 0, cu->language, objfile); - if (cu_language == language_cplus) + if (cu->language == language_cplus) { /* For C++, these implicitly act as typedefs as well. */ add_psymbol_to_list (actual_name, strlen (actual_name), VAR_DOMAIN, LOC_TYPEDEF, &objfile->global_psymbols, - 0, (CORE_ADDR) 0, cu_language, objfile); + 0, (CORE_ADDR) 0, cu->language, objfile); } break; case DW_TAG_enumerator: add_psymbol_to_list (actual_name, strlen (actual_name), VAR_DOMAIN, LOC_CONST, - cu_language == language_cplus + cu->language == language_cplus ? &objfile->static_psymbols : &objfile->global_psymbols, - 0, (CORE_ADDR) 0, cu_language, objfile); + 0, (CORE_ADDR) 0, cu->language, objfile); break; default: break; @@ -1570,7 +1577,7 @@ add_partial_symbol (struct partial_die_info *pdi, (otherwise we'll have psym == NULL), and if we actually had a mangled name to begin with. */ - if (cu_language == language_cplus + if (cu->language == language_cplus && namespace == NULL && psym != NULL && SYMBOL_CPLUS_DEMANGLED_NAME (psym) != NULL) @@ -1633,7 +1640,7 @@ add_partial_namespace (struct partial_die_info *pdi, char *info_ptr, add_psymbol_to_list (full_name, strlen (full_name), VAR_DOMAIN, LOC_TYPEDEF, &objfile->global_psymbols, - 0, 0, cu_language, objfile); + 0, 0, cu->language, objfile); /* Now scan partial symbols in that namespace. */ @@ -1653,13 +1660,13 @@ add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, bfd *abfd = cu->objfile->obfd; char *actual_class_name = NULL; - if (cu_language == language_cplus - && namespace == NULL + if (cu->language == language_cplus + && (namespace == NULL || namespace[0] == '\0') && struct_pdi->name != NULL && struct_pdi->has_children) { - /* We don't have namespace debugging information, so see if we - can figure out if this structure lives in a namespace. Look + /* See if we can figure out if the class lives in a namespace + (or is nested within another class.) We do this by looking for a member function; its demangled name will contain namespace info, if there is any. */ @@ -1669,6 +1676,21 @@ add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, could fix this by only using the demangled name to get the prefix (but see comment in read_structure_scope). */ + /* FIXME: carlton/2004-01-23: If NAMESPACE equals "", we have + the appropriate debug information, so it would be nice to be + able to avoid this hack. But NAMESPACE may not be the + namespace where this class was defined: NAMESPACE reflects + where STRUCT_PDI occurs in the tree of dies, but because of + DW_AT_specification, that may not actually tell us where the + class is defined. (See the comment in read_func_scope for an + example of how this could occur.) + + Unfortunately, our current partial symtab data structures are + completely unable to deal with DW_AT_specification. So, for + now, the best thing to do is to get nesting information from + places other than the tree structure of dies if there's any + chance that a DW_AT_specification is involved. :-( */ + char *next_child = info_ptr; while (1) @@ -1695,7 +1717,7 @@ add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, } add_partial_symbol (struct_pdi, cu, namespace); - xfree(actual_class_name); + xfree (actual_class_name); return locate_pdi_sibling (struct_pdi, info_ptr, abfd, cu); } @@ -1804,6 +1826,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) struct symtab *symtab; struct cleanup *back_to; struct attribute *attr; + CORE_ADDR baseaddr; /* Set local variables from the partial symbol table info. */ offset = DWARF_INFO_OFFSET (pst); @@ -1820,9 +1843,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) dwarf_ranges_size = DWARF_RANGES_SIZE (pst); dwarf_loc_buffer = DWARF_LOC_BUFFER (pst); dwarf_loc_size = DWARF_LOC_SIZE (pst); - baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile)); - cu_header_offset = offset; info_ptr = dwarf_info_buffer + offset; + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); /* We're in the global namespace. */ processing_current_prefix = ""; @@ -1842,6 +1864,10 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) dwarf2_read_abbrevs (abfd, &cu); make_cleanup (dwarf2_empty_abbrev_table, cu.header.dwarf2_abbrevs); + cu.header.offset = offset; + + cu.list_in_scope = &file_symbols; + dies = read_comp_unit (info_ptr, abfd, &cu); make_cleanup_free_die_list (dies); @@ -1855,7 +1881,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) cu.header.base_known = 0; cu.header.base_address = 0; - attr = dwarf_attr (dies, DW_AT_entry_pc); + attr = dwarf2_attr (dies, DW_AT_entry_pc, &cu); if (attr) { cu.header.base_address = DW_ADDR (attr); @@ -1863,7 +1889,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) } else { - attr = dwarf_attr (dies, DW_AT_low_pc); + attr = dwarf2_attr (dies, DW_AT_low_pc, &cu); if (attr) { cu.header.base_address = DW_ADDR (attr); @@ -1874,39 +1900,20 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) /* Do line number decoding in read_file_scope () */ process_die (dies, &cu); - if (!dwarf2_get_pc_bounds (dies, &lowpc, &highpc, &cu)) - { - /* Some compilers don't define a DW_AT_high_pc attribute for - the compilation unit. If the DW_AT_high_pc is missing, - synthesize it, by scanning the DIE's below the compilation unit. */ - highpc = 0; - if (dies->child != NULL) - { - child_die = dies->child; - while (child_die && child_die->tag) - { - if (child_die->tag == DW_TAG_subprogram) - { - CORE_ADDR low, high; + /* Some compilers don't define a DW_AT_high_pc attribute for the + compilation unit. If the DW_AT_high_pc is missing, synthesize + it, by scanning the DIE's below the compilation unit. */ + get_scope_pc_bounds (dies, &lowpc, &highpc, &cu); - if (dwarf2_get_pc_bounds (child_die, &low, &high, &cu)) - { - highpc = max (highpc, high); - } - } - child_die = sibling_die (child_die); - } - } - } symtab = end_symtab (highpc + baseaddr, objfile, SECT_OFF_TEXT (objfile)); /* Set symtab language to language from DW_AT_language. If the compilation is from a C file generated by language preprocessors, do not set the language if it was already deduced by start_subfile. */ if (symtab != NULL - && !(cu_language == language_c && symtab->language != language_c)) + && !(cu.language == language_c && symtab->language != language_c)) { - symtab->language = cu_language; + symtab->language = cu.language; } pst->symtab = symtab; pst->readin = 1; @@ -1968,7 +1975,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) break; case DW_TAG_base_type: read_base_type (die, cu); - if (dwarf_attr (die, DW_AT_name)) + if (dwarf2_attr (die, DW_AT_name, cu)) { /* Add a typedef symbol for the base type definition. */ new_symbol (die, die->type, cu); @@ -1976,7 +1983,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) break; case DW_TAG_subrange_type: read_subrange_type (die, cu); - if (dwarf_attr (die, DW_AT_name)) + if (dwarf2_attr (die, DW_AT_name, cu)) { /* Add a typedef symbol for the base type definition. */ new_symbol (die, die->type, cu); @@ -2009,9 +2016,9 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) } static void -initialize_cu_func_list (void) +initialize_cu_func_list (struct dwarf2_cu *cu) { - cu_first_fn = cu_last_fn = cu_cached_fn = NULL; + cu->first_fn = cu->last_fn = cu->cached_fn = NULL; } static void @@ -2028,28 +2035,11 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) struct die_info *child_die; bfd *abfd = objfile->obfd; struct line_header *line_header = 0; + CORE_ADDR baseaddr; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) - { - if (die->child != NULL) - { - child_die = die->child; - while (child_die && child_die->tag) - { - if (child_die->tag == DW_TAG_subprogram) - { - CORE_ADDR low, high; - - if (dwarf2_get_pc_bounds (child_die, &low, &high, cu)) - { - lowpc = min (lowpc, low); - highpc = max (highpc, high); - } - } - child_die = sibling_die (child_die); - } - } - } + get_scope_pc_bounds (die, &lowpc, &highpc, cu); /* If we didn't find a lowpc, set it to highpc to avoid complaints from finish_block. */ @@ -2058,12 +2048,12 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) lowpc += baseaddr; highpc += baseaddr; - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr) { name = DW_STRING (attr); } - attr = dwarf_attr (die, DW_AT_comp_dir); + attr = dwarf2_attr (die, DW_AT_comp_dir, cu); if (attr) { comp_dir = DW_STRING (attr); @@ -2085,10 +2075,10 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) objfile->ei.deprecated_entry_file_highpc = highpc; } - attr = dwarf_attr (die, DW_AT_language); + attr = dwarf2_attr (die, DW_AT_language, cu); if (attr) { - set_cu_language (DW_UNSND (attr)); + set_cu_language (DW_UNSND (attr), cu); } /* We assume that we're processing GCC output. */ @@ -2103,12 +2093,12 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) /* The compilation unit may be in a different language or objfile, zero out all remembered fundamental types. */ - memset (ftypes, 0, FT_NUM_MEMBERS * sizeof (struct type *)); + memset (cu->ftypes, 0, FT_NUM_MEMBERS * sizeof (struct type *)); start_symtab (name, comp_dir, lowpc); record_debugformat ("DWARF 2"); - initialize_cu_func_list (); + initialize_cu_func_list (cu); /* Process all dies in compilation unit. */ if (die->child != NULL) @@ -2122,7 +2112,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) } /* Decode line number information if present. */ - attr = dwarf_attr (die, DW_AT_stmt_list); + attr = dwarf2_attr (die, DW_AT_stmt_list, cu); if (attr) { unsigned int line_offset = DW_UNSND (attr); @@ -2139,7 +2129,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) refers to information in the line number info statement program header, so we can only read it if we've read the header successfully. */ - attr = dwarf_attr (die, DW_AT_macro_info); + attr = dwarf2_attr (die, DW_AT_macro_info, cu); if (attr && line_header) { unsigned int macro_offset = DW_UNSND (attr); @@ -2150,7 +2140,8 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) } static void -add_to_cu_func_list (const char *name, CORE_ADDR lowpc, CORE_ADDR highpc) +add_to_cu_func_list (const char *name, CORE_ADDR lowpc, CORE_ADDR highpc, + struct dwarf2_cu *cu) { struct function_range *thisfn; @@ -2162,12 +2153,12 @@ add_to_cu_func_list (const char *name, CORE_ADDR lowpc, CORE_ADDR highpc) thisfn->seen_line = 0; thisfn->next = NULL; - if (cu_last_fn == NULL) - cu_first_fn = thisfn; + if (cu->last_fn == NULL) + cu->first_fn = thisfn; else - cu_last_fn->next = thisfn; + cu->last_fn->next = thisfn; - cu_last_fn = thisfn; + cu->last_fn = thisfn; } static void @@ -2180,19 +2171,58 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) struct die_info *child_die; struct attribute *attr; char *name; + const char *previous_prefix = processing_current_prefix; + struct cleanup *back_to = NULL; + CORE_ADDR baseaddr; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - name = dwarf2_linkage_name (die); + name = dwarf2_linkage_name (die, cu); /* Ignore functions with missing or empty names and functions with missing or invalid low and high pc attributes. */ if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) return; + if (cu->language == language_cplus) + { + struct die_info *spec_die = die_specification (die, cu); + + /* NOTE: carlton/2004-01-23: We have to be careful in the + presence of DW_AT_specification. For example, with GCC 3.4, + given the code + + namespace N { + void foo() { + // Definition of N::foo. + } + } + + then we'll have a tree of DIEs like this: + + 1: DW_TAG_compile_unit + 2: DW_TAG_namespace // N + 3: DW_TAG_subprogram // declaration of N::foo + 4: DW_TAG_subprogram // definition of N::foo + DW_AT_specification // refers to die #3 + + Thus, when processing die #4, we have to pretend that we're + in the context of its DW_AT_specification, namely the contex + of die #3. */ + + if (spec_die != NULL) + { + char *specification_prefix = determine_prefix (spec_die, cu); + processing_current_prefix = specification_prefix; + back_to = make_cleanup (xfree, specification_prefix); + } + } + lowpc += baseaddr; highpc += baseaddr; /* Record the function range for dwarf_decode_lines. */ - add_to_cu_func_list (name, lowpc, highpc); + add_to_cu_func_list (name, lowpc, highpc, cu); if (objfile->ei.entry_point >= lowpc && objfile->ei.entry_point < highpc) @@ -2206,11 +2236,20 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) /* If there is a location expression for DW_AT_frame_base, record it. */ - attr = dwarf_attr (die, DW_AT_frame_base); + attr = dwarf2_attr (die, DW_AT_frame_base, cu); if (attr) + /* FIXME: cagney/2004-01-26: The DW_AT_frame_base's location + expression is being recorded directly in the function's symbol + and not in a separate frame-base object. I guess this hack is + to avoid adding some sort of frame-base adjunct/annex to the + function's symbol :-(. The problem with doing this is that it + results in a function symbol with a location expression that + has nothing to do with the location of the function, ouch! The + relationship should be: a function's symbol has-a frame base; a + frame-base has-a location expression. */ dwarf2_symbol_mark_computed (attr, new->name, cu); - list_in_scope = &local_symbols; + cu->list_in_scope = &local_symbols; if (die->child != NULL) { @@ -2237,7 +2276,11 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) /* If we've finished processing a top-level function, subsequent symbols go in the file symbol list. */ if (outermost_context_p ()) - list_in_scope = &file_symbols; + cu->list_in_scope = &file_symbols; + + processing_current_prefix = previous_prefix; + if (back_to != NULL) + do_cleanups (back_to); } /* Process all the DIES contained within a lexical block scope. Start @@ -2250,6 +2293,9 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) struct context_stack *new; CORE_ADDR lowpc, highpc; struct die_info *child_die; + CORE_ADDR baseaddr; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); /* Ignore blocks with missing or invalid low and high pc attributes. */ /* ??? Perhaps consider discontiguous blocks defined by DW_AT_ranges @@ -2296,11 +2342,11 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR high = 0; int ret = 0; - attr = dwarf_attr (die, DW_AT_high_pc); + attr = dwarf2_attr (die, DW_AT_high_pc, cu); if (attr) { high = DW_ADDR (attr); - attr = dwarf_attr (die, DW_AT_low_pc); + attr = dwarf2_attr (die, DW_AT_low_pc, cu); if (attr) low = DW_ADDR (attr); else @@ -2312,7 +2358,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, } else { - attr = dwarf_attr (die, DW_AT_ranges); + attr = dwarf2_attr (die, DW_AT_ranges, cu); if (attr != NULL) { unsigned int addr_size = cu_header->addr_size; @@ -2440,6 +2486,68 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, return ret; } +/* Get the low and high pc's represented by the scope DIE, and store + them in *LOWPC and *HIGHPC. If the correct values can't be + determined, set *LOWPC to -1 and *HIGHPC to 0. */ + +static void +get_scope_pc_bounds (struct die_info *die, + CORE_ADDR *lowpc, CORE_ADDR *highpc, + struct dwarf2_cu *cu) +{ + CORE_ADDR best_low = (CORE_ADDR) -1; + CORE_ADDR best_high = (CORE_ADDR) 0; + CORE_ADDR current_low, current_high; + + if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu)) + { + best_low = current_low; + best_high = current_high; + } + else + { + struct die_info *child = die->child; + + while (child && child->tag) + { + switch (child->tag) { + case DW_TAG_subprogram: + if (dwarf2_get_pc_bounds (child, ¤t_low, ¤t_high, cu)) + { + best_low = min (best_low, current_low); + best_high = max (best_high, current_high); + } + break; + case DW_TAG_namespace: + /* FIXME: carlton/2004-01-16: Should we do this for + DW_TAG_class_type/DW_TAG_structure_type, too? I think + that current GCC's always emit the DIEs corresponding + to definitions of methods of classes as children of a + DW_TAG_compile_unit or DW_TAG_namespace (as opposed to + the DIEs giving the declarations, which could be + anywhere). But I don't see any reason why the + standards says that they have to be there. */ + get_scope_pc_bounds (child, ¤t_low, ¤t_high, cu); + + if (current_low != ((CORE_ADDR) -1)) + { + best_low = min (best_low, current_low); + best_high = max (best_high, current_high); + } + break; + default: + /* Ignore. */ + break; + } + + child = sibling_die (child); + } + } + + *lowpc = best_low; + *highpc = best_high; +} + /* Add an aggregate field to the field list. */ static void @@ -2469,18 +2577,18 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, new_field->accessibility = DW_ACCESS_private; new_field->virtuality = DW_VIRTUALITY_none; - attr = dwarf_attr (die, DW_AT_accessibility); + attr = dwarf2_attr (die, DW_AT_accessibility, cu); if (attr) new_field->accessibility = DW_UNSND (attr); if (new_field->accessibility != DW_ACCESS_public) fip->non_public_fields = 1; - attr = dwarf_attr (die, DW_AT_virtuality); + attr = dwarf2_attr (die, DW_AT_virtuality, cu); if (attr) new_field->virtuality = DW_UNSND (attr); fp = &new_field->field; - if (die->tag == DW_TAG_member && ! die_is_declaration (die)) + if (die->tag == DW_TAG_member && ! die_is_declaration (die, cu)) { /* Data member other than a C++ static data member. */ @@ -2490,7 +2598,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, FIELD_STATIC_KIND (*fp) = 0; /* Get bit size of field (zero if none). */ - attr = dwarf_attr (die, DW_AT_bit_size); + attr = dwarf2_attr (die, DW_AT_bit_size, cu); if (attr) { FIELD_BITSIZE (*fp) = DW_UNSND (attr); @@ -2501,7 +2609,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, } /* Get bit offset of field. */ - attr = dwarf_attr (die, DW_AT_data_member_location); + attr = dwarf2_attr (die, DW_AT_data_member_location, cu); if (attr) { FIELD_BITPOS (*fp) = @@ -2509,7 +2617,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, } else FIELD_BITPOS (*fp) = 0; - attr = dwarf_attr (die, DW_AT_bit_offset); + attr = dwarf2_attr (die, DW_AT_bit_offset, cu); if (attr) { if (BITS_BIG_ENDIAN) @@ -2532,7 +2640,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, int anonymous_size; int bit_offset = DW_UNSND (attr); - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) { /* The size of the anonymous object containing @@ -2554,15 +2662,15 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, } /* Get name of field. */ - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) fieldname = DW_STRING (attr); fp->name = obsavestring (fieldname, strlen (fieldname), - &objfile->type_obstack); + &objfile->objfile_obstack); /* Change accessibility for artificial fields (e.g. virtual table pointer or virtual base class pointer) to private. */ - if (dwarf_attr (die, DW_AT_artificial)) + if (dwarf2_attr (die, DW_AT_artificial, cu)) { new_field->accessibility = DW_ACCESS_private; fip->non_public_fields = 1; @@ -2580,25 +2688,25 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, char *physname; /* Get name of field. */ - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) fieldname = DW_STRING (attr); else return; /* Get physical name. */ - physname = dwarf2_linkage_name (die); + physname = dwarf2_linkage_name (die, cu); SET_FIELD_PHYSNAME (*fp, obsavestring (physname, strlen (physname), - &objfile->type_obstack)); + &objfile->objfile_obstack)); FIELD_TYPE (*fp) = die_type (die, cu); FIELD_NAME (*fp) = obsavestring (fieldname, strlen (fieldname), - &objfile->type_obstack); + &objfile->objfile_obstack); } else if (die->tag == DW_TAG_inheritance) { /* C++ base class field. */ - attr = dwarf_attr (die, DW_AT_data_member_location); + attr = dwarf2_attr (die, DW_AT_data_member_location, cu); if (attr) FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte); @@ -2713,14 +2821,14 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, struct nextfnfield *new_fnfield; /* Get name of member function. */ - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) fieldname = DW_STRING (attr); else return; /* Get the mangled name. */ - physname = dwarf2_linkage_name (die); + physname = dwarf2_linkage_name (die, cu); /* Look up member function name in fieldlist. */ for (i = 0; i < fip->nfnfields; i++) @@ -2762,7 +2870,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, /* Fill in the member function field info. */ fnp = &new_fnfield->fnfield; fnp->physname = obsavestring (physname, strlen (physname), - &objfile->type_obstack); + &objfile->objfile_obstack); fnp->type = alloc_type (objfile); if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC) { @@ -2790,14 +2898,14 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, physname); /* Get fcontext from DW_AT_containing_type if present. */ - if (dwarf_attr (die, DW_AT_containing_type) != NULL) + if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL) fnp->fcontext = die_containing_type (die, cu); /* dwarf2 doesn't have stubbed physical names, so the setting of is_const and is_volatile is irrelevant, as it is needed by gdb_mangle_name only. */ /* Get accessibility. */ - attr = dwarf_attr (die, DW_AT_accessibility); + attr = dwarf2_attr (die, DW_AT_accessibility, cu); if (attr) { switch (DW_UNSND (attr)) @@ -2812,12 +2920,12 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, } /* Check for artificial methods. */ - attr = dwarf_attr (die, DW_AT_artificial); + attr = dwarf2_attr (die, DW_AT_artificial, cu); if (attr && DW_UNSND (attr) != 0) fnp->is_artificial = 1; /* Get index in virtual function table if it is a virtual member function. */ - attr = dwarf_attr (die, DW_AT_vtable_elem_location); + attr = dwarf2_attr (die, DW_AT_vtable_elem_location, cu); if (attr) { /* Support the .debug_loc offsets */ @@ -2904,18 +3012,18 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) type = alloc_type (objfile); INIT_CPLUS_SPECIFIC (type); - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) { name = DW_STRING (attr); - if (cu_language == language_cplus) + if (cu->language == language_cplus) { - struct die_info *spec_die = die_specification (die); + struct die_info *spec_die = die_specification (die, cu); if (spec_die != NULL) { - char *specification_prefix = determine_prefix (spec_die); + char *specification_prefix = determine_prefix (spec_die, cu); processing_current_prefix = specification_prefix; back_to = make_cleanup (xfree, specification_prefix); } @@ -2928,7 +3036,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) TYPE_TAG_NAME to be a const char *, I ran into a cascade of changes which would have forced decode_line_1 to take a const char **. */ - char *new_prefix = obconcat (&objfile->type_obstack, + char *new_prefix = obconcat (&objfile->objfile_obstack, processing_current_prefix, processing_current_prefix[0] == '\0' ? "" : "::", @@ -2939,8 +3047,8 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) else { TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), - &objfile->type_obstack); - need_to_update_name = (cu_language == language_cplus); + &objfile->objfile_obstack); + need_to_update_name = (cu->language == language_cplus); } } @@ -2959,7 +3067,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) TYPE_CODE (type) = TYPE_CODE_CLASS; } - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) { TYPE_LENGTH (type) = DW_UNSND (attr); @@ -2974,7 +3082,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) type within the structure itself. */ die->type = type; - if (die->child != NULL && ! die_is_declaration (die)) + if (die->child != NULL && ! die_is_declaration (die, cu)) { struct field_info fi; struct die_info *child_die; @@ -3024,14 +3132,14 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) name. */ char *actual_class_name = class_name_from_physname (dwarf2_linkage_name - (child_die)); + (child_die, cu)); if (actual_class_name != NULL && strcmp (actual_class_name, name) != 0) { TYPE_TAG_NAME (type) = obsavestring (actual_class_name, strlen (actual_class_name), - &objfile->type_obstack); + &objfile->objfile_obstack); } xfree (actual_class_name); need_to_update_name = 0; @@ -3060,7 +3168,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) class itself) which contains the vtable pointer for the current class from the DW_AT_containing_type attribute. */ - if (dwarf_attr (die, DW_AT_containing_type) != NULL) + if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL) { struct type *t = die_containing_type (die, cu); @@ -3141,14 +3249,14 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu) type = alloc_type (objfile); TYPE_CODE (type) = TYPE_CODE_ENUM; - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) { const char *name = DW_STRING (attr); if (processing_has_namespace_info) { - TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, + TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack, processing_current_prefix, processing_current_prefix[0] == '\0' ? "" : "::", @@ -3157,11 +3265,11 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu) else { TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), - &objfile->type_obstack); + &objfile->objfile_obstack); } } - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) { TYPE_LENGTH (type) = DW_UNSND (attr); @@ -3184,7 +3292,7 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu) } else { - attr = dwarf_attr (child_die, DW_AT_name); + attr = dwarf2_attr (child_die, DW_AT_name, cu); if (attr) { sym = new_symbol (child_die, type, cu); @@ -3256,7 +3364,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) arrays with unspecified length. */ if (die->child == NULL) { - index_type = dwarf2_fundamental_type (objfile, FT_INTEGER); + index_type = dwarf2_fundamental_type (objfile, FT_INTEGER, cu); range_type = create_range_type (NULL, index_type, 0, -1); die->type = create_array_type (NULL, element_type, range_type); return; @@ -3300,7 +3408,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) custom vendor extension. The main difference between a regular array and the vector variant is that vectors are passed by value to functions. */ - attr = dwarf_attr (die, DW_AT_GNU_vector); + attr = dwarf2_attr (die, DW_AT_GNU_vector, cu); if (attr) TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; @@ -3320,7 +3428,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) struct symbol *sym; CORE_ADDR base = (CORE_ADDR) 0; - attr = dwarf_attr (die, DW_AT_location); + attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) { /* Support the .debug_loc offsets */ @@ -3344,7 +3452,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) while (child_die && child_die->tag) { sym = new_symbol (child_die, NULL, cu); - attr = dwarf_attr (child_die, DW_AT_data_member_location); + attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu); if (attr) { SYMBOL_VALUE_ADDRESS (sym) = @@ -3367,7 +3475,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) int is_anonymous; struct die_info *current_die; - name = namespace_name (die, &is_anonymous); + name = namespace_name (die, &is_anonymous, cu); /* Now build the name of the current namespace. */ @@ -3392,7 +3500,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) before. Also, add a using directive if it's an anonymous namespace. */ - if (dwarf2_extension (die) == NULL) + if (dwarf2_extension (die, cu) == NULL) { struct type *type; @@ -3430,7 +3538,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) namespace. */ static const char * -namespace_name (struct die_info *die, int *is_anonymous) +namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu) { struct die_info *current_die; const char *name = NULL; @@ -3439,9 +3547,9 @@ namespace_name (struct die_info *die, int *is_anonymous) for (current_die = die; current_die != NULL; - current_die = dwarf2_extension (die)) + current_die = dwarf2_extension (die, cu)) { - name = dwarf2_name (current_die); + name = dwarf2_name (current_die, cu); if (name != NULL) break; } @@ -3474,13 +3582,13 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) type = lookup_pointer_type (die_type (die, cu)); - attr_byte_size = dwarf_attr (die, DW_AT_byte_size); + attr_byte_size = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr_byte_size) byte_size = DW_UNSND (attr_byte_size); else byte_size = cu_header->addr_size; - attr_address_class = dwarf_attr (die, DW_AT_address_class); + attr_address_class = dwarf2_attr (die, DW_AT_address_class, cu); if (attr_address_class) addr_class = DW_UNSND (attr_address_class); else @@ -3552,7 +3660,7 @@ read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu) } type = lookup_reference_type (die_type (die, cu)); - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) { TYPE_LENGTH (type) = DW_UNSND (attr); @@ -3610,7 +3718,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) return; } - attr = dwarf_attr (die, DW_AT_string_length); + attr = dwarf2_attr (die, DW_AT_string_length, cu); if (attr) { length = DW_UNSND (attr); @@ -3618,7 +3726,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) else { /* check for the DW_AT_byte_size attribute */ - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) { length = DW_UNSND (attr); @@ -3628,9 +3736,9 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) length = 1; } } - index_type = dwarf2_fundamental_type (objfile, FT_INTEGER); + index_type = dwarf2_fundamental_type (objfile, FT_INTEGER, cu); range_type = create_range_type (NULL, index_type, 1, length); - if (cu_language == language_fortran) + if (cu->language == language_fortran) { /* Need to create a unique string type for bounds information */ @@ -3638,7 +3746,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) } else { - char_type = dwarf2_fundamental_type (objfile, FT_CHAR); + char_type = dwarf2_fundamental_type (objfile, FT_CHAR, cu); type = create_string_type (char_type, range_type); } die->type = type; @@ -3671,9 +3779,9 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) ftype = lookup_function_type (type); /* All functions in C++ have prototypes. */ - attr = dwarf_attr (die, DW_AT_prototyped); + attr = dwarf2_attr (die, DW_AT_prototyped, cu); if ((attr && (DW_UNSND (attr) != 0)) - || cu_language == language_cplus) + || cu->language == language_cplus) TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED; if (die->child != NULL) @@ -3710,7 +3818,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) parameter for non-static member functions (which is the this pointer) as artificial. We pass this information to dwarf2_add_member_fn via TYPE_FIELD_ARTIFICIAL. */ - attr = dwarf_attr (child_die, DW_AT_artificial); + attr = dwarf2_attr (child_die, DW_AT_artificial, cu); if (attr) TYPE_FIELD_ARTIFICIAL (ftype, iparams) = DW_UNSND (attr); else @@ -3734,7 +3842,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu) if (!die->type) { - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) { name = DW_STRING (attr); @@ -3761,17 +3869,17 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) return; } - attr = dwarf_attr (die, DW_AT_encoding); + attr = dwarf2_attr (die, DW_AT_encoding, cu); if (attr) { encoding = DW_UNSND (attr); } - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) { size = DW_UNSND (attr); } - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) { enum type_code code = TYPE_CODE_INT; @@ -3808,18 +3916,19 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) } type = init_type (code, size, type_flags, DW_STRING (attr), objfile); if (encoding == DW_ATE_address) - TYPE_TARGET_TYPE (type) = dwarf2_fundamental_type (objfile, FT_VOID); + TYPE_TARGET_TYPE (type) = dwarf2_fundamental_type (objfile, FT_VOID, + cu); else if (encoding == DW_ATE_complex_float) { if (size == 32) TYPE_TARGET_TYPE (type) - = dwarf2_fundamental_type (objfile, FT_EXT_PREC_FLOAT); + = dwarf2_fundamental_type (objfile, FT_EXT_PREC_FLOAT, cu); else if (size == 16) TYPE_TARGET_TYPE (type) - = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT); + = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT, cu); else if (size == 8) TYPE_TARGET_TYPE (type) - = dwarf2_fundamental_type (objfile, FT_FLOAT); + = dwarf2_fundamental_type (objfile, FT_FLOAT, cu); } } else @@ -3855,17 +3964,17 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) if (TYPE_CODE (base_type) == TYPE_CODE_VOID) base_type = alloc_type (NULL); - if (cu_language == language_fortran) + if (cu->language == language_fortran) { /* FORTRAN implies a lower bound of 1, if not given. */ low = 1; } - attr = dwarf_attr (die, DW_AT_lower_bound); + attr = dwarf2_attr (die, DW_AT_lower_bound, cu); if (attr) low = dwarf2_get_attr_constant_value (attr, 0); - attr = dwarf_attr (die, DW_AT_upper_bound); + attr = dwarf2_attr (die, DW_AT_upper_bound, cu); if (attr) { if (attr->form == DW_FORM_block1) @@ -3889,11 +3998,11 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) range_type = create_range_type (NULL, base_type, low, high); - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) TYPE_NAME (range_type) = DW_STRING (attr); - attr = dwarf_attr (die, DW_AT_byte_size); + attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) TYPE_LENGTH (range_type) = DW_UNSND (attr); @@ -4023,7 +4132,7 @@ make_cleanup_free_die_list (struct die_info *dies) /* Read the contents of the section at OFFSET and of size SIZE from the - object file specified by OBJFILE into the psymbol_obstack and return it. */ + object file specified by OBJFILE into the objfile_obstack and return it. */ char * dwarf2_read_section (struct objfile *objfile, asection *sectp) @@ -4035,7 +4144,7 @@ dwarf2_read_section (struct objfile *objfile, asection *sectp) if (size == 0) return NULL; - buf = (char *) obstack_alloc (&objfile->psymbol_obstack, size); + buf = (char *) obstack_alloc (&objfile->objfile_obstack, size); retbuf = (char *) symfile_relocate_debug_section (abfd, sectp, (bfd_byte *) buf); if (retbuf != NULL) @@ -4270,7 +4379,7 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd, complaint (&symfile_complaints, "ignoring absolute DW_AT_sibling"); else part_die->sibling = - dwarf_info_buffer + dwarf2_get_ref_die_offset (&attr); + dwarf_info_buffer + dwarf2_get_ref_die_offset (&attr, cu); break; default: break; @@ -4285,7 +4394,8 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd, struct partial_die_info spec_die; char *spec_ptr; - spec_ptr = dwarf_info_buffer + dwarf2_get_ref_die_offset (&spec_attr); + spec_ptr = dwarf_info_buffer + + dwarf2_get_ref_die_offset (&spec_attr, cu); read_partial_die (&spec_die, abfd, spec_ptr, cu); if (spec_die.name) { @@ -4819,27 +4929,27 @@ read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) } static void -set_cu_language (unsigned int lang) +set_cu_language (unsigned int lang, struct dwarf2_cu *cu) { switch (lang) { case DW_LANG_C89: case DW_LANG_C: - cu_language = language_c; + cu->language = language_c; break; case DW_LANG_C_plus_plus: - cu_language = language_cplus; + cu->language = language_cplus; break; case DW_LANG_Fortran77: case DW_LANG_Fortran90: case DW_LANG_Fortran95: - cu_language = language_fortran; + cu->language = language_fortran; break; case DW_LANG_Mips_Assembler: - cu_language = language_asm; + cu->language = language_asm; break; case DW_LANG_Java: - cu_language = language_java; + cu->language = language_java; break; case DW_LANG_Ada83: case DW_LANG_Ada95: @@ -4848,16 +4958,16 @@ set_cu_language (unsigned int lang) case DW_LANG_Pascal83: case DW_LANG_Modula2: default: - cu_language = language_minimal; + cu->language = language_minimal; break; } - cu_language_defn = language_def (cu_language); + cu->language_defn = language_def (cu->language); } /* Return the named attribute or NULL if not there. */ static struct attribute * -dwarf_attr (struct die_info *die, unsigned int name) +dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu) { unsigned int i; struct attribute *spec = NULL; @@ -4875,34 +4985,34 @@ dwarf_attr (struct die_info *die, unsigned int name) if (spec) { struct die_info *ref_die = - follow_die_ref (dwarf2_get_ref_die_offset (spec)); + follow_die_ref (dwarf2_get_ref_die_offset (spec, cu)); if (ref_die) - return dwarf_attr (ref_die, name); + return dwarf2_attr (ref_die, name, cu); } return NULL; } static int -die_is_declaration (struct die_info *die) +die_is_declaration (struct die_info *die, struct dwarf2_cu *cu) { - return (dwarf_attr (die, DW_AT_declaration) - && ! dwarf_attr (die, DW_AT_specification)); + return (dwarf2_attr (die, DW_AT_declaration, cu) + && ! dwarf2_attr (die, DW_AT_specification, cu)); } /* Return the die giving the specification for DIE, if there is one. */ static struct die_info * -die_specification (struct die_info *die) +die_specification (struct die_info *die, struct dwarf2_cu *cu) { - struct attribute *spec_attr = dwarf_attr (die, DW_AT_specification); + struct attribute *spec_attr = dwarf2_attr (die, DW_AT_specification, cu); if (spec_attr == NULL) return NULL; else - return follow_die_ref (dwarf2_get_ref_die_offset (spec_attr)); + return follow_die_ref (dwarf2_get_ref_die_offset (spec_attr, cu)); } /* Free the line_header structure *LH, and any arrays and strings it @@ -5096,26 +5206,26 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd, addresses passed to record_line. */ static CORE_ADDR -check_cu_functions (CORE_ADDR address) +check_cu_functions (CORE_ADDR address, struct dwarf2_cu *cu) { struct function_range *fn; /* Find the function_range containing address. */ - if (!cu_first_fn) + if (!cu->first_fn) return address; - if (!cu_cached_fn) - cu_cached_fn = cu_first_fn; + if (!cu->cached_fn) + cu->cached_fn = cu->first_fn; - fn = cu_cached_fn; + fn = cu->cached_fn; while (fn) if (fn->lowpc <= address && fn->highpc > address) goto found; else fn = fn->next; - fn = cu_first_fn; - while (fn && fn != cu_cached_fn) + fn = cu->first_fn; + while (fn && fn != cu->cached_fn) if (fn->lowpc <= address && fn->highpc > address) goto found; else @@ -5146,6 +5256,10 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, char *line_end; unsigned int bytes_read; unsigned char op_code, extended_op, adj_opcode; + CORE_ADDR baseaddr; + struct objfile *objfile = cu->objfile; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); line_ptr = lh->statement_program_start; line_end = lh->statement_program_end; @@ -5191,7 +5305,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, line += lh->line_base + (adj_opcode % lh->line_range); /* append row to matrix using current values */ record_line (current_subfile, line, - check_cu_functions (address)); + check_cu_functions (address, cu)); basic_block = 1; } else switch (op_code) @@ -5238,7 +5352,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, break; case DW_LNS_copy: record_line (current_subfile, line, - check_cu_functions (address)); + check_cu_functions (address, cu)); basic_block = 0; break; case DW_LNS_advance_pc: @@ -5419,21 +5533,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) char *name; struct attribute *attr = NULL; struct attribute *attr2 = NULL; + CORE_ADDR baseaddr; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); if (die->tag != DW_TAG_namespace) - name = dwarf2_linkage_name (die); + name = dwarf2_linkage_name (die, cu); else name = TYPE_NAME (type); if (name) { - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); /* Cache this symbol's name and the name's demangled form (if any). */ - SYMBOL_LANGUAGE (sym) = cu_language; + SYMBOL_LANGUAGE (sym) = cu->language; SYMBOL_SET_NAMES (sym, name, strlen (name), objfile); /* Default assumptions. @@ -5444,7 +5561,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) SYMBOL_TYPE (sym) = type; else SYMBOL_TYPE (sym) = die_type (die, cu); - attr = dwarf_attr (die, DW_AT_decl_line); + attr = dwarf2_attr (die, DW_AT_decl_line, cu); if (attr) { SYMBOL_LINE (sym) = DW_UNSND (attr); @@ -5452,7 +5569,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) switch (die->tag) { case DW_TAG_label: - attr = dwarf_attr (die, DW_AT_low_pc); + attr = dwarf2_attr (die, DW_AT_low_pc, cu); if (attr) { SYMBOL_VALUE_ADDRESS (sym) = DW_ADDR (attr) + baseaddr; @@ -5463,14 +5580,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) /* SYMBOL_BLOCK_VALUE (sym) will be filled in later by finish_block. */ SYMBOL_CLASS (sym) = LOC_BLOCK; - attr2 = dwarf_attr (die, DW_AT_external); + attr2 = dwarf2_attr (die, DW_AT_external, cu); if (attr2 && (DW_UNSND (attr2) != 0)) { add_symbol_to_list (sym, &global_symbols); } else { - add_symbol_to_list (sym, list_in_scope); + add_symbol_to_list (sym, cu->list_in_scope); } break; case DW_TAG_variable: @@ -5482,26 +5599,26 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) TARGET_INT_BIT / HOST_CHAR_BIT, 0, "<variable, no debug info>", objfile); - attr = dwarf_attr (die, DW_AT_const_value); + attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) { dwarf2_const_value (attr, sym, cu); - attr2 = dwarf_attr (die, DW_AT_external); + attr2 = dwarf2_attr (die, DW_AT_external, cu); if (attr2 && (DW_UNSND (attr2) != 0)) add_symbol_to_list (sym, &global_symbols); else - add_symbol_to_list (sym, list_in_scope); + add_symbol_to_list (sym, cu->list_in_scope); break; } - attr = dwarf_attr (die, DW_AT_location); + attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) { var_decode_location (attr, sym, cu); - attr2 = dwarf_attr (die, DW_AT_external); + attr2 = dwarf2_attr (die, DW_AT_external, cu); if (attr2 && (DW_UNSND (attr2) != 0)) add_symbol_to_list (sym, &global_symbols); else - add_symbol_to_list (sym, list_in_scope); + add_symbol_to_list (sym, cu->list_in_scope); } else { @@ -5511,9 +5628,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) The address of the variable will then be determined from the minimal symbol table whenever the variable is referenced. */ - attr2 = dwarf_attr (die, DW_AT_external); + attr2 = dwarf2_attr (die, DW_AT_external, cu); if (attr2 && (DW_UNSND (attr2) != 0) - && dwarf_attr (die, DW_AT_type) != NULL) + && dwarf2_attr (die, DW_AT_type, cu) != NULL) { SYMBOL_CLASS (sym) = LOC_UNRESOLVED; add_symbol_to_list (sym, &global_symbols); @@ -5521,7 +5638,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) } break; case DW_TAG_formal_parameter: - attr = dwarf_attr (die, DW_AT_location); + attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) { var_decode_location (attr, sym, cu); @@ -5529,12 +5646,12 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (SYMBOL_CLASS (sym) == LOC_COMPUTED) SYMBOL_CLASS (sym) = LOC_COMPUTED_ARG; } - attr = dwarf_attr (die, DW_AT_const_value); + attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) { dwarf2_const_value (attr, sym, cu); } - add_symbol_to_list (sym, list_in_scope); + add_symbol_to_list (sym, cu->list_in_scope); break; case DW_TAG_unspecified_parameters: /* From varargs functions; gdb doesn't seem to have any @@ -5553,7 +5670,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) read_structure_scope, and the correct name is saved in the type. */ - if (cu_language == language_cplus) + if (cu->language == language_cplus) { struct type *type = SYMBOL_TYPE (sym); @@ -5565,7 +5682,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) SYMBOL_LINKAGE_NAME (sym) = obsavestring (TYPE_TAG_NAME (type), strlen (TYPE_TAG_NAME (type)), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } } @@ -5580,19 +5697,19 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) struct pending **list_to_add; - list_to_add = (list_in_scope == &file_symbols - && cu_language == language_cplus - ? &global_symbols : list_in_scope); + list_to_add = (cu->list_in_scope == &file_symbols + && cu->language == language_cplus + ? &global_symbols : cu->list_in_scope); add_symbol_to_list (sym, list_to_add); /* The semantics of C++ state that "struct foo { ... }" also defines a typedef for "foo". Synthesize a typedef symbol so that "ptype foo" works as expected. */ - if (cu_language == language_cplus) + if (cu->language == language_cplus) { struct symbol *typedef_sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); *typedef_sym = *sym; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; @@ -5600,7 +5717,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) TYPE_NAME (SYMBOL_TYPE (sym)) = obsavestring (SYMBOL_NATURAL_NAME (sym), strlen (SYMBOL_NATURAL_NAME (sym)), - &objfile->type_obstack); + &objfile->objfile_obstack); add_symbol_to_list (typedef_sym, list_to_add); } } @@ -5609,31 +5726,31 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (processing_has_namespace_info && processing_current_prefix[0] != '\0') { - SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->symbol_obstack, + SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->objfile_obstack, processing_current_prefix, "::", name); } SYMBOL_CLASS (sym) = LOC_TYPEDEF; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - add_symbol_to_list (sym, list_in_scope); + add_symbol_to_list (sym, cu->list_in_scope); break; case DW_TAG_base_type: case DW_TAG_subrange_type: SYMBOL_CLASS (sym) = LOC_TYPEDEF; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - add_symbol_to_list (sym, list_in_scope); + add_symbol_to_list (sym, cu->list_in_scope); break; case DW_TAG_enumerator: if (processing_has_namespace_info && processing_current_prefix[0] != '\0') { - SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->symbol_obstack, + SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->objfile_obstack, processing_current_prefix, "::", name); } - attr = dwarf_attr (die, DW_AT_const_value); + attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) { dwarf2_const_value (attr, sym, cu); @@ -5644,9 +5761,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) struct pending **list_to_add; - list_to_add = (list_in_scope == &file_symbols - && cu_language == language_cplus - ? &global_symbols : list_in_scope); + list_to_add = (cu->list_in_scope == &file_symbols + && cu->language == language_cplus + ? &global_symbols : cu->list_in_scope); add_symbol_to_list (sym, list_to_add); } @@ -5687,7 +5804,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, TYPE_LENGTH (SYMBOL_TYPE (sym))); SYMBOL_VALUE_BYTES (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, cu_header->addr_size); + obstack_alloc (&objfile->objfile_obstack, cu_header->addr_size); /* NOTE: cagney/2003-05-09: In-lined store_address call with it's body - store_unsigned_integer. */ store_unsigned_integer (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size, @@ -5705,7 +5822,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, TYPE_LENGTH (SYMBOL_TYPE (sym))); SYMBOL_VALUE_BYTES (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, blk->size); + obstack_alloc (&objfile->objfile_obstack, blk->size); memcpy (SYMBOL_VALUE_BYTES (sym), blk->data, blk->size); SYMBOL_CLASS (sym) = LOC_CONST_BYTES; break; @@ -5781,15 +5898,15 @@ die_type (struct die_info *die, struct dwarf2_cu *cu) struct die_info *type_die; unsigned int ref; - type_attr = dwarf_attr (die, DW_AT_type); + type_attr = dwarf2_attr (die, DW_AT_type, cu); if (!type_attr) { /* A missing DW_AT_type represents a void type. */ - return dwarf2_fundamental_type (cu->objfile, FT_VOID); + return dwarf2_fundamental_type (cu->objfile, FT_VOID, cu); } else { - ref = dwarf2_get_ref_die_offset (type_attr); + ref = dwarf2_get_ref_die_offset (type_attr, cu); type_die = follow_die_ref (ref); if (!type_die) { @@ -5819,10 +5936,10 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu) struct die_info *type_die = NULL; unsigned int ref; - type_attr = dwarf_attr (die, DW_AT_containing_type); + type_attr = dwarf2_attr (die, DW_AT_containing_type, cu); if (type_attr) { - ref = dwarf2_get_ref_die_offset (type_attr); + ref = dwarf2_get_ref_die_offset (type_attr, cu); type_die = follow_die_ref (ref); if (!type_die) { @@ -5883,7 +6000,7 @@ tag_type_to_type (struct die_info *die, struct dwarf2_cu *cu) static void read_type_die (struct die_info *die, struct dwarf2_cu *cu) { - char *prefix = determine_prefix (die); + char *prefix = determine_prefix (die, cu); const char *old_prefix = processing_current_prefix; struct cleanup *back_to = make_cleanup (xfree, prefix); processing_current_prefix = prefix; @@ -5942,16 +6059,31 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) do_cleanups (back_to); } +/* Return the name of the namespace/class that DIE is defined within, + or "" if we can't tell. The caller should xfree the result. */ + +/* NOTE: carlton/2004-01-23: See read_func_scope (and the comment + therein) for an example of how to use this function to deal with + DW_AT_specification. */ + +static char * +determine_prefix (struct die_info *die, struct dwarf2_cu *cu) +{ + char *prefix = determine_prefix_aux (die, cu); + + return prefix ? prefix : xstrdup (""); +} + /* Return the name of the namespace/class that DIE is defined within, or NULL if we can't tell. The caller should xfree the result. */ static char * -determine_prefix (struct die_info *die) +determine_prefix_aux (struct die_info *die, struct dwarf2_cu *cu) { struct die_info *parent; - if (cu_language != language_cplus) + if (cu->language != language_cplus) return NULL; parent = die->parent; @@ -5962,7 +6094,7 @@ determine_prefix (struct die_info *die) } else { - char *parent_prefix = determine_prefix (parent); + char *parent_prefix = determine_prefix_aux (parent, cu); char *retval; switch (parent->tag) { @@ -5971,7 +6103,7 @@ determine_prefix (struct die_info *die) int dummy; retval = typename_concat (parent_prefix, - namespace_name (parent, &dummy)); + namespace_name (parent, &dummy, cu)); } break; case DW_TAG_class_type: @@ -5979,10 +6111,10 @@ determine_prefix (struct die_info *die) { if (parent_prefix != NULL) { - const char *parent_name = dwarf2_name (parent); + const char *parent_name = dwarf2_name (parent, cu); if (parent_name != NULL) - retval = typename_concat (parent_prefix, dwarf2_name (parent)); + retval = typename_concat (parent_prefix, dwarf2_name (parent, cu)); else /* FIXME: carlton/2003-11-10: I'm not sure what the best thing to do here is. */ @@ -5990,7 +6122,7 @@ determine_prefix (struct die_info *die) "<<anonymous class>>"); } else - retval = class_name (parent); + retval = class_name (parent, cu); } break; default: @@ -6029,7 +6161,7 @@ typename_concat (const char *prefix, const char *suffix) by DIE. */ static char * -class_name (struct die_info *die) +class_name (struct die_info *die, struct dwarf2_cu *cu) { struct die_info *child; const char *name; @@ -6037,10 +6169,10 @@ class_name (struct die_info *die) for (child = die->child; child != NULL; child = sibling_die (child)) { if (child->tag == DW_TAG_subprogram) - return class_name_from_physname (dwarf2_linkage_name (child)); + return class_name_from_physname (dwarf2_linkage_name (child, cu)); } - name = dwarf2_name (die); + name = dwarf2_name (die, cu); if (name != NULL) return xstrdup (name); else @@ -6058,69 +6190,69 @@ dwarf_base_type (int encoding, int size, struct dwarf2_cu *cu) switch (encoding) { case DW_ATE_address: - type = dwarf2_fundamental_type (objfile, FT_VOID); + type = dwarf2_fundamental_type (objfile, FT_VOID, cu); return type; case DW_ATE_boolean: - type = dwarf2_fundamental_type (objfile, FT_BOOLEAN); + type = dwarf2_fundamental_type (objfile, FT_BOOLEAN, cu); return type; case DW_ATE_complex_float: if (size == 16) { - type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_COMPLEX); + type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_COMPLEX, cu); } else { - type = dwarf2_fundamental_type (objfile, FT_COMPLEX); + type = dwarf2_fundamental_type (objfile, FT_COMPLEX, cu); } return type; case DW_ATE_float: if (size == 8) { - type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT); + type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT, cu); } else { - type = dwarf2_fundamental_type (objfile, FT_FLOAT); + type = dwarf2_fundamental_type (objfile, FT_FLOAT, cu); } return type; case DW_ATE_signed: switch (size) { case 1: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_CHAR); + type = dwarf2_fundamental_type (objfile, FT_SIGNED_CHAR, cu); break; case 2: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_SHORT); + type = dwarf2_fundamental_type (objfile, FT_SIGNED_SHORT, cu); break; default: case 4: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_INTEGER); + type = dwarf2_fundamental_type (objfile, FT_SIGNED_INTEGER, cu); break; } return type; case DW_ATE_signed_char: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_CHAR); + type = dwarf2_fundamental_type (objfile, FT_SIGNED_CHAR, cu); return type; case DW_ATE_unsigned: switch (size) { case 1: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_CHAR); + type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_CHAR, cu); break; case 2: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_SHORT); + type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_SHORT, cu); break; default: case 4: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_INTEGER); + type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_INTEGER, cu); break; } return type; case DW_ATE_unsigned_char: - type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_CHAR); + type = dwarf2_fundamental_type (objfile, FT_UNSIGNED_CHAR, cu); return type; default: - type = dwarf2_fundamental_type (objfile, FT_SIGNED_INTEGER); + type = dwarf2_fundamental_type (objfile, FT_SIGNED_INTEGER, cu); return type; } } @@ -6169,14 +6301,14 @@ sibling_die (struct die_info *die) /* Get linkage name of a die, return NULL if not found. */ static char * -dwarf2_linkage_name (struct die_info *die) +dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) { struct attribute *attr; - attr = dwarf_attr (die, DW_AT_MIPS_linkage_name); + attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); if (attr && DW_STRING (attr)) return DW_STRING (attr); - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) return DW_STRING (attr); return NULL; @@ -6185,11 +6317,11 @@ dwarf2_linkage_name (struct die_info *die) /* Get name of a die, return NULL if not found. */ static char * -dwarf2_name (struct die_info *die) +dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) { struct attribute *attr; - attr = dwarf_attr (die, DW_AT_name); + attr = dwarf2_attr (die, DW_AT_name, cu); if (attr && DW_STRING (attr)) return DW_STRING (attr); return NULL; @@ -6199,17 +6331,17 @@ dwarf2_name (struct die_info *die) is none. */ static struct die_info * -dwarf2_extension (struct die_info *die) +dwarf2_extension (struct die_info *die, struct dwarf2_cu *cu) { struct attribute *attr; struct die_info *extension_die; unsigned int ref; - attr = dwarf_attr (die, DW_AT_extension); + attr = dwarf2_attr (die, DW_AT_extension, cu); if (attr == NULL) return NULL; - ref = dwarf2_get_ref_die_offset (attr); + ref = dwarf2_get_ref_die_offset (attr, cu); extension_die = follow_die_ref (ref); if (!extension_die) { @@ -7122,7 +7254,7 @@ dwarf2_empty_hash_tables (void) } static unsigned int -dwarf2_get_ref_die_offset (struct attribute *attr) +dwarf2_get_ref_die_offset (struct attribute *attr, struct dwarf2_cu *cu) { unsigned int result = 0; @@ -7136,7 +7268,7 @@ dwarf2_get_ref_die_offset (struct attribute *attr) case DW_FORM_ref4: case DW_FORM_ref8: case DW_FORM_ref_udata: - result = cu_header_offset + DW_UNSND (attr); + result = cu->header.offset + DW_UNSND (attr); break; default: complaint (&symfile_complaints, @@ -7188,7 +7320,8 @@ follow_die_ref (unsigned int offset) } static struct type * -dwarf2_fundamental_type (struct objfile *objfile, int typeid) +dwarf2_fundamental_type (struct objfile *objfile, int typeid, + struct dwarf2_cu *cu) { if (typeid < 0 || typeid >= FT_NUM_MEMBERS) { @@ -7200,12 +7333,12 @@ dwarf2_fundamental_type (struct objfile *objfile, int typeid) one is not found, create and install one appropriate for the current language and the current target machine. */ - if (ftypes[typeid] == NULL) + if (cu->ftypes[typeid] == NULL) { - ftypes[typeid] = cu_language_defn->la_fund_type (objfile, typeid); + cu->ftypes[typeid] = cu->language_defn->la_fund_type (objfile, typeid); } - return (ftypes[typeid]); + return (cu->ftypes[typeid]); } /* Decode simple location descriptions. @@ -7525,7 +7658,7 @@ macro_start_file (int file, int line, /* We don't create a macro table for this compilation unit at all until we actually get a filename. */ if (! pending_macros) - pending_macros = new_macro_table (&objfile->symbol_obstack, + pending_macros = new_macro_table (&objfile->objfile_obstack, objfile->macro_cache); if (! current_file) @@ -7868,7 +8001,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, { struct dwarf2_loclist_baton *baton; - baton = obstack_alloc (&cu->objfile->symbol_obstack, + baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (struct dwarf2_loclist_baton)); baton->objfile = cu->objfile; @@ -7881,14 +8014,14 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, complaint (&symfile_complaints, "Location list used without specifying the CU base address."); - SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_loclist_funcs; + SYMBOL_OPS (sym) = &dwarf2_loclist_funcs; SYMBOL_LOCATION_BATON (sym) = baton; } else { struct dwarf2_locexpr_baton *baton; - baton = obstack_alloc (&cu->objfile->symbol_obstack, + baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (struct dwarf2_locexpr_baton)); baton->objfile = cu->objfile; @@ -7910,7 +8043,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, baton->data = NULL; } - SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs; + SYMBOL_OPS (sym) = &dwarf2_locexpr_funcs; SYMBOL_LOCATION_BATON (sym) = baton; } } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 5d1518d..8048466 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1,7 +1,7 @@ /* DWARF debugging format support for GDB. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. Portions based on dbxread.c, mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port. @@ -968,7 +968,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie, && *dip->at_name != '~' && *dip->at_name != '.') { - TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, + TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack, "", "", dip->at_name); } /* Use whatever size is known. Zero is a valid size. We might however @@ -1011,7 +1011,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie, /* Save the data. */ list->field.name = obsavestring (mbr.at_name, strlen (mbr.at_name), - &objfile->type_obstack); + &objfile->objfile_obstack); FIELD_TYPE (list->field) = decode_die_type (&mbr); FIELD_BITPOS (list->field) = 8 * locval (&mbr); FIELD_STATIC_KIND (list->field) = 0; @@ -1670,7 +1670,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) && *dip->at_name != '~' && *dip->at_name != '.') { - TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, + TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack, "", "", dip->at_name); } if (dip->at_byte_size != 0) @@ -1704,15 +1704,15 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) objfile); scan += TARGET_FT_LONG_SIZE (objfile); list->field.name = obsavestring (scan, strlen (scan), - &objfile->type_obstack); + &objfile->objfile_obstack); scan += strlen (scan) + 1; nfields++; /* Handcraft a new symbol for this enum member. */ - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = create_name (list->field.name, - &objfile->symbol_obstack); + &objfile->objfile_obstack); SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_CLASS (sym) = LOC_CONST; @@ -1733,7 +1733,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; TYPE_NFIELDS (type) = nfields; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct field) * nfields); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nfields); /* Copy the saved-up fields into the field vector. */ for (n = 0; (n < nfields) && (list != NULL); list = list->next) { @@ -2800,7 +2800,7 @@ scan_compilation_units (char *thisdie, char *enddie, file_ptr dbfoff, pst->texthigh = di.at_high_pc; pst->read_symtab_private = (char *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct dwfinfo)); DBFOFF (pst) = dbfoff; DBROFF (pst) = curoff; @@ -2851,7 +2851,7 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile) if (dip->at_name != NULL) { - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); @@ -3011,11 +3011,11 @@ synthesize_typedef (struct dieinfo *dip, struct objfile *objfile, if (dip->at_name != NULL) { sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = create_name (dip->at_name, - &objfile->symbol_obstack); + &objfile->objfile_obstack); SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language); SYMBOL_TYPE (sym) = type; SYMBOL_CLASS (sym) = LOC_TYPEDEF; diff --git a/gdb/elfread.c b/gdb/elfread.c index d3779c0..83a1862 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1,7 +1,7 @@ /* Read ELF (Executable and Linking Format) object files for GDB. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. @@ -159,8 +159,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic) seen any section info for it yet. */ asymbol *filesym = 0; #ifdef SOFUN_ADDRESS_MAYBE_MISSING - /* Name of filesym, as saved on the symbol_obstack. */ - char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack); + /* Name of filesym, as saved on the objfile_obstack. */ + char *filesymname = obsavestring ("", 0, &objfile->objfile_obstack); #endif struct dbx_symfile_info *dbx = objfile->sym_stab_info; int stripped = (bfd_get_symcount (objfile->obfd) == 0); @@ -251,7 +251,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic) #ifdef SOFUN_ADDRESS_MAYBE_MISSING filesymname = obsavestring ((char *) filesym->name, strlen (filesym->name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); #endif } else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK)) @@ -712,7 +712,7 @@ 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, + obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); for (i = 0; i < maybe->num_sections; i++) (pst->section_offsets)->offsets[i] = maybe->sections[i]; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 37ca92c..c34b4a7 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1,5 +1,5 @@ /* Fortran language support routines for GDB, the GNU debugger. - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Motorola. Adapted from the C parser by Farooq Butt (fmbutt@engage.sps.mot.com). @@ -475,6 +475,7 @@ const struct language_defn f_language_defn = NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%o", "0", "o", ""}, /* Octal format info */ diff --git a/gdb/findvar.c b/gdb/findvar.c index 34b4a5b..b5929fa 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -1,7 +1,7 @@ /* Find a variable's value in memory, for GDB, the GNU debugger. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, - 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -263,7 +263,7 @@ value_of_register (int regnum, struct frame_info *frame) char raw_buffer[MAX_REGISTER_SIZE]; enum lval_type lval; - /* User registers lie completly outside of the range of normal + /* User registers lie completely outside of the range of normal registers. Catch them early so that the target never sees them. */ if (regnum >= NUM_REGS + NUM_PSEUDO_REGS) return value_of_user_reg (regnum, frame); @@ -346,11 +346,12 @@ symbol_read_needs_frame (struct symbol *sym) we failed to consider one. */ case LOC_COMPUTED: case LOC_COMPUTED_ARG: - { - struct location_funcs *symfuncs = SYMBOL_LOCATION_FUNCS (sym); - return (symfuncs->read_needs_frame) (sym); - } - break; + /* FIXME: cagney/2004-01-26: It should be possible to + unconditionally call the SYMBOL_OPS method when available. + Unfortunately DWARF 2 stores the frame-base (instead of the + function) location in a function's symbol. Oops! For the + moment enable this when/where applicable. */ + return SYMBOL_OPS (sym)->read_needs_frame (sym); case LOC_REGISTER: case LOC_ARG: @@ -564,15 +565,14 @@ addresses have not been bound by the dynamic loader. Try again when executable i case LOC_COMPUTED: case LOC_COMPUTED_ARG: - { - struct location_funcs *funcs = SYMBOL_LOCATION_FUNCS (var); - - if (frame == 0 && (funcs->read_needs_frame) (var)) - return 0; - return (funcs->read_variable) (var, frame); - - } - break; + /* FIXME: cagney/2004-01-26: It should be possible to + unconditionally call the SYMBOL_OPS method when available. + Unfortunately DWARF 2 stores the frame-base (instead of the + function) location in a function's symbol. Oops! For the + moment enable this when/where applicable. */ + if (frame == 0 && SYMBOL_OPS (var)->read_needs_frame (var)) + return 0; + return SYMBOL_OPS (var)->read_variable (var, frame); case LOC_UNRESOLVED: { diff --git a/gdb/frame.c b/gdb/frame.c index a7da919..e608005 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -234,7 +234,6 @@ get_frame_id (struct frame_info *fi) directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ - gdb_assert (fi->unwind->type != UNKNOWN_FRAME); fi->type = fi->unwind->type; } /* Find THIS frame's ID. */ @@ -510,9 +509,10 @@ frame_register_unwind (struct frame_info *frame, int regnum, if (frame_debug) { - fprintf_unfiltered (gdb_stdlog, - "{ frame_register_unwind (frame=%d,regnum=\"%s\",...) ", - frame->level, frame_map_regnum_to_name (frame, regnum)); + fprintf_unfiltered (gdb_stdlog, "\ +{ frame_register_unwind (frame=%d,regnum=%d(%s),...) ", + frame->level, regnum, + frame_map_regnum_to_name (frame, regnum)); } /* Require all but BUFFERP to be valid. A NULL BUFFERP indicates @@ -538,7 +538,6 @@ frame_register_unwind (struct frame_info *frame, int regnum, directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ - gdb_assert (frame->unwind->type != UNKNOWN_FRAME); frame->type = frame->unwind->type; } @@ -1029,9 +1028,12 @@ legacy_saved_regs_this_id (struct frame_info *next_frame, void **this_prologue_cache, struct frame_id *id) { - /* legacy_get_prev_frame() always sets ->this_id.p, hence this is - never needed. */ - internal_error (__FILE__, __LINE__, "legacy_saved_regs_this_id() called"); + /* A developer is trying to bring up a new architecture, help them + by providing a default unwinder that refuses to unwind anything + (the ID is always NULL). In the case of legacy code, + legacy_get_prev_frame() will have previously set ->this_id.p, so + this code won't be called. */ + (*id) = null_frame_id; } const struct frame_unwind legacy_saved_regs_unwinder = { @@ -1284,7 +1286,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) prev = FRAME_OBSTACK_ZALLOC (struct frame_info); prev->level = this_frame->level + 1; - /* Do not completly wire it in to the frame chain. Some (bad) code + /* Do not completely wire it in to the frame chain. Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along frame->prev to pull some fancy tricks (of course such code is, by definition, recursive). @@ -1838,7 +1840,7 @@ get_prev_frame (struct frame_info *this_frame) && backtrace_beyond_entry_func #endif && this_frame->type != DUMMY_FRAME && this_frame->level >= 0 - && inside_entry_func (get_frame_pc (this_frame))) + && inside_entry_func (this_frame)) { if (frame_debug) { @@ -2133,7 +2135,6 @@ get_frame_type (struct frame_info *frame) directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ - gdb_assert (frame->unwind->type != UNKNOWN_FRAME); frame->type = frame->unwind->type; } if (frame->type == UNKNOWN_FRAME) @@ -2280,11 +2281,28 @@ frame_sp_unwind (struct frame_info *next_frame) int legacy_frame_p (struct gdbarch *current_gdbarch) { - return (DEPRECATED_INIT_FRAME_PC_P () - || DEPRECATED_INIT_FRAME_PC_FIRST_P () - || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () - || DEPRECATED_FRAME_CHAIN_P () - || !gdbarch_unwind_dummy_id_p (current_gdbarch)); + if (DEPRECATED_INIT_FRAME_PC_P () + || DEPRECATED_INIT_FRAME_PC_FIRST_P () + || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () + || DEPRECATED_FRAME_CHAIN_P ()) + /* No question, it's a legacy frame. */ + return 1; + if (gdbarch_unwind_dummy_id_p (current_gdbarch)) + /* No question, it's not a legacy frame (provided none of the + deprecated methods checked above are present that is). */ + return 0; + if (DEPRECATED_TARGET_READ_FP_P () + || DEPRECATED_FP_REGNUM >= 0) + /* Assume it's legacy. If you're trying to convert a legacy frame + target to the new mechanism, get rid of these. legacy + get_prev_frame requires these when unwind_frame_id isn't + available. */ + return 1; + /* Default to assuming that it's brand new code, and hence not + legacy. Force it down the non-legacy path so that the new code + uses the new frame mechanism from day one. Dummy frame's won't + work very well but we can live with that. */ + return 0; } extern initialize_file_ftype _initialize_frame; /* -Wmissing-prototypes */ diff --git a/gdb/frame.h b/gdb/frame.h index 2a97308..d45fc32 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -1,7 +1,7 @@ /* Definitions for dealing with stack frames, for GDB, the GNU debugger. Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -344,7 +344,7 @@ extern CORE_ADDR get_frame_args_address (struct frame_info *); extern int frame_relative_level (struct frame_info *fi); /* Return the frame's type. Some are real, some are signal - trampolines, and some are completly artificial (dummy). */ + trampolines, and some are completely artificial (dummy). */ enum frame_type { diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 67fb641..e647ad8 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1392,7 +1392,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc); set_gdbarch_adjust_breakpoint_address (gdbarch, frv_gdbarch_adjust_breakpoint_address); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation); set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); @@ -1400,7 +1399,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return); set_gdbarch_store_return_value (gdbarch, frv_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); /* Frame stuff. */ set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc); diff --git a/gdb/gdb-events.h b/gdb/gdb-events.h index 4836568..2ce193f 100644 --- a/gdb/gdb-events.h +++ b/gdb/gdb-events.h @@ -1,6 +1,6 @@ /* User Interface Events. - Copyright 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2001, 2002, 2004 Free Software Foundation, Inc. Contributed by Cygnus Solutions. @@ -96,7 +96,7 @@ extern void selected_frame_level_changed_event (int level); extern void selected_thread_changed_event (int thread_num); -/* When GDB_EVENTS are not being used, completly disable them. */ +/* When GDB_EVENTS are not being used, completely disable them. */ #if !WITH_GDB_EVENTS #define breakpoint_create_event(b) 0 diff --git a/gdb/gdb-events.sh b/gdb/gdb-events.sh index 458e4b6..bd07794 100755 --- a/gdb/gdb-events.sh +++ b/gdb/gdb-events.sh @@ -1,7 +1,7 @@ #!/bin/sh # User Interface Events. -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. # # Contributed by Cygnus Solutions. # @@ -239,7 +239,7 @@ done echo "" echo "" cat <<EOF -/* When GDB_EVENTS are not being used, completly disable them. */ +/* When GDB_EVENTS are not being used, completely disable them. */ EOF echo "" echo "#if !WITH_GDB_EVENTS" diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h new file mode 100644 index 0000000..074313e --- /dev/null +++ b/gdb/gdb_curses.h @@ -0,0 +1,31 @@ +/* Portable <curses.h>. + + Copyright 2004 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 GDB_CURSES_H +#define GDB_CURSES_H 1 + +#if defined (HAVE_NCURSES_H) +#include <ncurses.h> +#elif defined (HAVE_CURSES_H) +#include <curses.h> +#endif + +#endif diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h index 237830e..0dcfc4f 100644 --- a/gdb/gdb_obstack.h +++ b/gdb/gdb_obstack.h @@ -26,6 +26,13 @@ /* Unless explicitly specified, GDB obstacks always use xmalloc() and xfree(). */ +/* Note: ezannoni 2004-02-09: One could also specify the allocation + functions using a special init function for each obstack, + obstack_specify_allocation. However we just use obstack_init and + let these defines here do the job. While one could argue the + superiority of one approach over the other, we just chose one + throughout. */ + #define obstack_chunk_alloc xmalloc #define obstack_chunk_free xfree diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index fffbd0d..d46d2d5 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -208,11 +208,10 @@ struct gdbarch gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value; gdbarch_deprecated_store_return_value_ftype *deprecated_store_return_value; gdbarch_use_struct_convention_ftype *use_struct_convention; - gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; + gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address; gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs; gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info; gdbarch_skip_prologue_ftype *skip_prologue; - gdbarch_prologue_frameless_p_ftype *prologue_frameless_p; gdbarch_inner_than_ftype *inner_than; gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address; @@ -379,11 +378,10 @@ struct gdbarch startup_gdbarch = 0, /* deprecated_extract_return_value */ 0, /* deprecated_store_return_value */ 0, /* use_struct_convention */ - 0, /* extract_struct_value_address */ + 0, /* deprecated_extract_struct_value_address */ 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, /* adjust_breakpoint_address */ @@ -519,11 +517,9 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->extract_return_value = legacy_extract_return_value; current_gdbarch->store_return_value = legacy_store_return_value; current_gdbarch->use_struct_convention = generic_use_struct_convention; - current_gdbarch->prologue_frameless_p = generic_prologue_frameless_p; current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address; - current_gdbarch->frame_args_skip = -1; current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not; current_gdbarch->deprecated_frame_args_address = get_frame_base; current_gdbarch->deprecated_frame_locals_address = get_frame_base; @@ -686,13 +682,12 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of extract_return_value, invalid_p == 0 */ /* Skip verify of store_return_value, invalid_p == 0 */ /* Skip verify of use_struct_convention, invalid_p == 0 */ - /* Skip verify of extract_struct_value_address, has predicate */ + /* Skip verify of deprecated_extract_struct_value_address, has predicate */ /* Skip verify of deprecated_frame_init_saved_regs, has predicate */ /* Skip verify of deprecated_init_extra_frame_info, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (current_gdbarch->skip_prologue == 0)) fprintf_unfiltered (log, "\n\tskip_prologue"); - /* Skip verify of prologue_frameless_p, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (current_gdbarch->inner_than == 0)) fprintf_unfiltered (log, "\n\tinner_than"); @@ -705,9 +700,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of decr_pc_after_break, invalid_p == 0 */ /* Skip verify of function_start_offset, invalid_p == 0 */ /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (current_gdbarch->frame_args_skip == -1)) - fprintf_unfiltered (log, "\n\tframe_args_skip"); + /* Skip verify of frame_args_skip, invalid_p == 0 */ /* Skip verify of frameless_function_invocation, invalid_p == 0 */ /* Skip verify of deprecated_frame_chain, has predicate */ /* Skip verify of deprecated_frame_chain_valid, has predicate */ @@ -1087,6 +1080,25 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_extract_return_value /*DEPRECATED_EXTRACT_RETURN_VALUE ()*/); #endif +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P()", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() = %d\n", + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()); +#endif +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache)", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regcache))); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS = <0x%08lx>\n", + (long) current_gdbarch->deprecated_extract_struct_value_address + /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/); +#endif #ifdef DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", @@ -1753,25 +1765,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) (long) current_gdbarch->extract_return_value /*EXTRACT_RETURN_VALUE ()*/); #endif -#ifdef EXTRACT_STRUCT_VALUE_ADDRESS_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "EXTRACT_STRUCT_VALUE_ADDRESS_P()", - XSTRING (EXTRACT_STRUCT_VALUE_ADDRESS_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: EXTRACT_STRUCT_VALUE_ADDRESS_P() = %d\n", - EXTRACT_STRUCT_VALUE_ADDRESS_P ()); -#endif -#ifdef EXTRACT_STRUCT_VALUE_ADDRESS - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "EXTRACT_STRUCT_VALUE_ADDRESS(regcache)", - XSTRING (EXTRACT_STRUCT_VALUE_ADDRESS (regcache))); - fprintf_unfiltered (file, - "gdbarch_dump: EXTRACT_STRUCT_VALUE_ADDRESS = <0x%08lx>\n", - (long) current_gdbarch->extract_struct_value_address - /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/); -#endif #ifdef FETCH_POINTER_ARGUMENT_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2023,16 +2016,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: print_vector_info = 0x%08lx\n", (long) current_gdbarch->print_vector_info); -#ifdef PROLOGUE_FRAMELESS_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "PROLOGUE_FRAMELESS_P(ip)", - XSTRING (PROLOGUE_FRAMELESS_P (ip))); - fprintf_unfiltered (file, - "gdbarch_dump: PROLOGUE_FRAMELESS_P = <0x%08lx>\n", - (long) current_gdbarch->prologue_frameless_p - /*PROLOGUE_FRAMELESS_P ()*/); -#endif #ifdef PS_REGNUM fprintf_unfiltered (file, "gdbarch_dump: PS_REGNUM # %s\n", @@ -4346,27 +4329,27 @@ set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, } int -gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch) +gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->extract_struct_value_address != NULL; + return gdbarch->deprecated_extract_struct_value_address != NULL; } CORE_ADDR -gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache) +gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache) { gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->extract_struct_value_address != NULL); + gdb_assert (gdbarch->deprecated_extract_struct_value_address != NULL); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_struct_value_address called\n"); - return gdbarch->extract_struct_value_address (regcache); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n"); + return gdbarch->deprecated_extract_struct_value_address (regcache); } void -set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, - gdbarch_extract_struct_value_address_ftype extract_struct_value_address) +set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, + gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address) { - gdbarch->extract_struct_value_address = extract_struct_value_address; + gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address; } int @@ -4435,23 +4418,6 @@ set_gdbarch_skip_prologue (struct gdbarch *gdbarch, } int -gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, CORE_ADDR ip) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->prologue_frameless_p != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_prologue_frameless_p called\n"); - return gdbarch->prologue_frameless_p (ip); -} - -void -set_gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, - gdbarch_prologue_frameless_p_ftype prologue_frameless_p) -{ - gdbarch->prologue_frameless_p = prologue_frameless_p; -} - -int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs) { gdb_assert (gdbarch != NULL); @@ -4598,8 +4564,7 @@ CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - /* Check variable changed from pre-default. */ - gdb_assert (gdbarch->frame_args_skip != -1); + /* Skip verify of frame_args_skip, invalid_p == 0 */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_args_skip called\n"); return gdbarch->frame_args_skip; diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 8240ae4..bce32b4 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1447,11 +1447,7 @@ extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_va /* The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded - into RETURN_VALUE. For the moment do not try to fold in - EXTRACT_STRUCT_VALUE_ADDRESS as, dependant on the ABI, the debug - info, and the level of effort, it may well be possible to find the - address of a structure being return on the stack. Someone else can - make that change. */ + into RETURN_VALUE. */ typedef int (gdbarch_return_value_on_stack_ftype) (struct type *type); extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type); @@ -1513,29 +1509,47 @@ extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_ #define USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_use_struct_convention (current_gdbarch, gcc_p, value_type)) #endif -#if defined (EXTRACT_STRUCT_VALUE_ADDRESS) -/* Legacy for systems yet to multi-arch EXTRACT_STRUCT_VALUE_ADDRESS */ -#if !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) -#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (1) +/* As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an + ABI suitable for the implementation of a robust extract + struct-convention return-value address method (the sparc saves the + address in the callers frame). All the other cases so far examined, + the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been + erreneous - the code was incorrectly assuming that the return-value + address, stored in a register, was preserved across the entire + function call. + For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of + the ABIs that are still to be analyzed - perhaps this should simply + be deleted. The commented out extract_returned_value_address method + is provided as a starting point for the 32-bit SPARC. It, or + something like it, along with changes to both infcmd.c and stack.c + will be needed for that case to work. NB: It is passed the callers + frame since it is only after the callee has returned that this + function is used. + M:::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame */ + +#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */ +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (1) #endif #endif -extern int gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) -#error "Non multi-arch definition of EXTRACT_STRUCT_VALUE_ADDRESS" +extern int gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) -#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_extract_struct_value_address_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch)) #endif -typedef CORE_ADDR (gdbarch_extract_struct_value_address_ftype) (struct regcache *regcache); -extern CORE_ADDR gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache); -extern void set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_extract_struct_value_address_ftype *extract_struct_value_address); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_STRUCT_VALUE_ADDRESS) -#error "Non multi-arch definition of EXTRACT_STRUCT_VALUE_ADDRESS" +typedef CORE_ADDR (gdbarch_deprecated_extract_struct_value_address_ftype) (struct regcache *regcache); +extern CORE_ADDR gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache); +extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" #endif -#if !defined (EXTRACT_STRUCT_VALUE_ADDRESS) -#define EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_extract_struct_value_address (current_gdbarch, regcache)) +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regcache)) #endif #if defined (DEPRECATED_FRAME_INIT_SAVED_REGS) @@ -1598,16 +1612,6 @@ extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_pro #define SKIP_PROLOGUE(ip) (gdbarch_skip_prologue (current_gdbarch, ip)) #endif -typedef int (gdbarch_prologue_frameless_p_ftype) (CORE_ADDR ip); -extern int gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, CORE_ADDR ip); -extern void set_gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, gdbarch_prologue_frameless_p_ftype *prologue_frameless_p); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PROLOGUE_FRAMELESS_P) -#error "Non multi-arch definition of PROLOGUE_FRAMELESS_P" -#endif -#if !defined (PROLOGUE_FRAMELESS_P) -#define PROLOGUE_FRAMELESS_P(ip) (gdbarch_prologue_frameless_p (current_gdbarch, ip)) -#endif - typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs); extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs); extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 1801e8f..0c5a440 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -606,11 +606,7 @@ M:::enum return_value_convention:return_value:struct type *valtype, struct regca # The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE, # STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded -# into RETURN_VALUE. For the moment do not try to fold in -# EXTRACT_STRUCT_VALUE_ADDRESS as, dependant on the ABI, the debug -# info, and the level of effort, it may well be possible to find the -# address of a structure being return on the stack. Someone else can -# make that change. +# into RETURN_VALUE. f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0 f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0 @@ -619,13 +615,31 @@ f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct f:2:DEPRECATED_STORE_RETURN_VALUE:void:deprecated_store_return_value:struct type *type, char *valbuf:type, valbuf f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0 -F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache -# +# As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an +# ABI suitable for the implementation of a robust extract +# struct-convention return-value address method (the sparc saves the +# address in the callers frame). All the other cases so far examined, +# the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been +# erreneous - the code was incorrectly assuming that the return-value +# address, stored in a register, was preserved across the entire +# function call. + +# For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of +# the ABIs that are still to be analyzed - perhaps this should simply +# be deleted. The commented out extract_returned_value_address method +# is provided as a starting point for the 32-bit SPARC. It, or +# something like it, along with changes to both infcmd.c and stack.c +# will be needed for that case to work. NB: It is passed the callers +# frame since it is only after the callee has returned that this +# function is used. + +#M:::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame +F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:struct regcache *regcache:regcache + F:2:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame F:2:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame # f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0 -f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0 f:2:INNER_THAN:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0 f::BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::0: M:2:ADJUST_BREAKPOINT_ADDRESS:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr @@ -636,7 +650,7 @@ v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:::0 # m::REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0 # -v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1 +v::FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:::0 f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0 F:2:DEPRECATED_FRAME_CHAIN:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame F:2:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 603c33f..0d908ea 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,19 @@ +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * linux-low.c: Update copyright year. + (check_removed_breakpoint): Clear pending_is_breakpoint. + (linux_set_resume_request, linux_queue_one_thread) + (resume_status_pending_p): New functions. + (linux_continue_one_thread): Use process->resume. + (linux_resume): Only resume threads if there are no pending events. + * linux-low.h (struct process_info): Add resume request + pointer. + +2004-01-30 Daniel Jacobowitz <drow@mvista.com> + + * regcache.c (new_register_cache): Clear the allocated register + buffer. Suggested by Atsushi Nemoto <anemo@mba.ocn.ne.jp>. + 2003-10-13 Daniel Jacobowitz <drow@mvista.com> * linux-low.c (linux_resume): Take a struct thread_resume * diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 68b3f65..501bb58 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1,5 +1,5 @@ /* Low level interface to ptrace, for the remote server for GDB. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -316,6 +316,7 @@ check_removed_breakpoint (struct process_info *event_child) (*the_low_target.set_pc) (stop_pc); /* We consumed the pending SIGTRAP. */ + event_child->pending_is_breakpoint = 0; event_child->status_pending_p = 0; event_child->status_pending = 0; @@ -876,18 +877,18 @@ linux_resume_one_process (struct inferior_list_entry *entry, static struct thread_resume *resume_ptr; /* This function is called once per thread. We look up the thread - in RESUME_PTR, which will tell us whether to resume, step, or leave - the thread stopped; and what signal, if any, it should be sent. - For threads which we aren't explicitly told otherwise, we preserve - the stepping flag; this is used for stepping over gdbserver-placed - breakpoints. If the thread has a status pending, it may not actually - be resumed. */ + in RESUME_PTR, and mark the thread with a pointer to the appropriate + resume request. + + This algorithm is O(threads * resume elements), but resume elements + is small (and will remain small at least until GDB supports thread + suspension). */ static void -linux_continue_one_thread (struct inferior_list_entry *entry) +linux_set_resume_request (struct inferior_list_entry *entry) { struct process_info *process; struct thread_info *thread; - int ndx, step; + int ndx; thread = (struct thread_info *) entry; process = get_thread_process (thread); @@ -896,25 +897,127 @@ linux_continue_one_thread (struct inferior_list_entry *entry) while (resume_ptr[ndx].thread != -1 && resume_ptr[ndx].thread != entry->id) ndx++; - if (resume_ptr[ndx].leave_stopped) + process->resume = &resume_ptr[ndx]; +} + +/* This function is called once per thread. We check the thread's resume + request, which will tell us whether to resume, step, or leave the thread + stopped; and what signal, if any, it should be sent. For threads which + we aren't explicitly told otherwise, we preserve the stepping flag; this + is used for stepping over gdbserver-placed breakpoints. */ + +static void +linux_continue_one_thread (struct inferior_list_entry *entry) +{ + struct process_info *process; + struct thread_info *thread; + int step; + + thread = (struct thread_info *) entry; + process = get_thread_process (thread); + + if (process->resume->leave_stopped) return; - if (resume_ptr[ndx].thread == -1) - step = process->stepping || resume_ptr[ndx].step; + if (process->resume->thread == -1) + step = process->stepping || process->resume->step; else - step = resume_ptr[ndx].step; + step = process->resume->step; + + linux_resume_one_process (&process->head, step, process->resume->sig); - linux_resume_one_process (&process->head, step, resume_ptr[ndx].sig); + process->resume = NULL; +} + +/* This function is called once per thread. We check the thread's resume + request, which will tell us whether to resume, step, or leave the thread + stopped; and what signal, if any, it should be sent. We queue any needed + signals, since we won't actually resume. We already have a pending event + to report, so we don't need to preserve any step requests; they should + be re-issued if necessary. */ + +static void +linux_queue_one_thread (struct inferior_list_entry *entry) +{ + struct process_info *process; + struct thread_info *thread; + + thread = (struct thread_info *) entry; + process = get_thread_process (thread); + + if (process->resume->leave_stopped) + return; + + /* If we have a new signal, enqueue the signal. */ + if (process->resume->sig != 0) + { + struct pending_signals *p_sig; + p_sig = malloc (sizeof (*p_sig)); + p_sig->prev = process->pending_signals; + p_sig->signal = process->resume->sig; + process->pending_signals = p_sig; + } + + process->resume = NULL; +} + +/* Set DUMMY if this process has an interesting status pending. */ +static int +resume_status_pending_p (struct inferior_list_entry *entry, void *flag_p) +{ + struct process_info *process = (struct process_info *) entry; + + /* Processes which will not be resumed are not interesting, because + we might not wait for them next time through linux_wait. */ + if (process->resume->leave_stopped) + return 0; + + /* If this thread has a removed breakpoint, we won't have any + events to report later, so check now. check_removed_breakpoint + may clear status_pending_p. We avoid calling check_removed_breakpoint + for any thread that we are not otherwise going to resume - this + lets us preserve stopped status when two threads hit a breakpoint. + GDB removes the breakpoint to single-step a particular thread + past it, then re-inserts it and resumes all threads. We want + to report the second thread without resuming it in the interim. */ + if (process->status_pending_p) + check_removed_breakpoint (process); + + if (process->status_pending_p) + * (int *) flag_p = 1; + + return 0; } static void linux_resume (struct thread_resume *resume_info) { - /* Yes, this is quadratic. If it ever becomes a problem then it's - fairly easy to fix. Yes, the use of a global here is rather ugly. */ + int pending_flag; + /* Yes, the use of a global here is rather ugly. */ resume_ptr = resume_info; - for_each_inferior (&all_threads, linux_continue_one_thread); + + for_each_inferior (&all_threads, linux_set_resume_request); + + /* If there is a thread which would otherwise be resumed, which + has a pending status, then don't resume any threads - we can just + report the pending status. Make sure to queue any signals + that would otherwise be sent. */ + pending_flag = 0; + find_inferior (&all_processes, resume_status_pending_p, &pending_flag); + + if (debug_threads) + { + if (pending_flag) + fprintf (stderr, "Not resuming, pending status\n"); + else + fprintf (stderr, "Resuming, no pending status\n"); + } + + if (pending_flag) + for_each_inferior (&all_threads, linux_queue_one_thread); + else + for_each_inferior (&all_threads, linux_continue_one_thread); } #ifdef HAVE_LINUX_USRREGS diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index bae76b7..d42c9b5 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -1,5 +1,5 @@ /* Internal interfaces for the GNU/Linux specific target code for gdbserver. - Copyright 2002, Free Software Foundation, Inc. + Copyright 2002, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -106,7 +106,13 @@ struct process_info /* If this is non-zero, it points to a chain of signals which need to be delivered to this process. */ struct pending_signals *pending_signals; + + /* A link used when resuming. It is initialized from the resume request, + and then processed and cleared in linux_resume_one_process. */ + + struct thread_resume *resume; }; + extern struct inferior_list all_processes; void linux_attach_lwp (int pid, int tid); diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index be3b3a7..bc64ebc 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -1,5 +1,5 @@ /* Register support routines for the remote server for GDB. - Copyright 2001, 2002 + Copyright 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -101,7 +101,10 @@ new_register_cache (void) regcache = malloc (sizeof (*regcache)); - regcache->registers = malloc (register_bytes); + /* Make sure to zero-initialize the register cache when it is created, + in case there are registers the target never fetches. This way they'll + read as zero instead of garbage. */ + regcache->registers = calloc (1, register_bytes); if (regcache->registers == NULL) fatal ("Could not allocate register cache."); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index f98cf1c..4c24fa2 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1,6 +1,6 @@ /* Support routines for manipulating internal types for GDB. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. This file is part of GDB. @@ -136,7 +136,7 @@ static void virtual_base_list_aux (struct type *dclass); /* Alloc a new type structure and fill it with some defaults. If OBJFILE is non-NULL, then allocate the space for the type structure - in that objfile's type_obstack. Otherwise allocate the new type structure + in that objfile's objfile_obstack. Otherwise allocate the new type structure by xmalloc () (for permanent types). */ struct type * @@ -154,10 +154,10 @@ alloc_type (struct objfile *objfile) } else { - type = obstack_alloc (&objfile->type_obstack, + type = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type)); memset (type, 0, sizeof (struct type)); - TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->type_obstack, + TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->objfile_obstack, sizeof (struct main_type)); OBJSTAT (objfile, n_types++); } @@ -191,7 +191,7 @@ alloc_type_instance (struct type *oldtype) } else { - type = obstack_alloc (&TYPE_OBJFILE (oldtype)->type_obstack, + type = obstack_alloc (&TYPE_OBJFILE (oldtype)->objfile_obstack, sizeof (struct type)); memset (type, 0, sizeof (struct type)); } @@ -1675,7 +1675,7 @@ allocate_cplus_struct_type (struct type *type) /* Helper function to initialize the standard scalar types. If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy - of the string pointed to by name in the type_obstack for that objfile, + of the string pointed to by name in the objfile_obstack for that objfile, and initialize the type name to that copy. There are places (mipsread.c in particular, where init_type is called with a NULL value for NAME). */ @@ -1692,7 +1692,7 @@ init_type (enum type_code code, int length, int flags, char *name, if ((name != NULL) && (objfile != NULL)) { TYPE_NAME (type) = - obsavestring (name, strlen (name), &objfile->type_obstack); + obsavestring (name, strlen (name), &objfile->objfile_obstack); } else { @@ -1793,7 +1793,7 @@ lookup_fundamental_type (struct objfile *objfile, int typeid) { nbytes = FT_NUM_MEMBERS * sizeof (struct type *); objfile->fundamental_types = (struct type **) - obstack_alloc (&objfile->type_obstack, nbytes); + obstack_alloc (&objfile->objfile_obstack, nbytes); memset ((char *) objfile->fundamental_types, 0, nbytes); OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index acd0ffd..a1141d7 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1,7 +1,7 @@ /* Internal type definitions for GDB. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. @@ -320,7 +320,7 @@ struct main_type char *tag_name; /* Every type is now associated with a particular objfile, and the - type is allocated on the type_obstack for that objfile. One problem + type is allocated on the objfile_obstack for that objfile. One problem however, is that there are times when gdb allocates new types while it is not in the process of reading symbols from a particular objfile. Fortunately, these happen when the type being created is a derived @@ -1069,15 +1069,15 @@ extern struct type *builtin_type_f_void; /* Allocate space for storing data associated with a particular type. We ensure that the space is allocated using the same mechanism that was used to allocate the space for the type structure itself. I.E. - if the type is on an objfile's type_obstack, then the space for data - associated with that type will also be allocated on the type_obstack. + if the type is on an objfile's objfile_obstack, then the space for data + associated with that type will also be allocated on the objfile_obstack. If the type is not associated with any particular objfile (such as builtin types), then the data space will be allocated with xmalloc, the same as for the type structure. */ #define TYPE_ALLOC(t,size) \ (TYPE_OBJFILE (t) != NULL \ - ? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \ + ? obstack_alloc (&TYPE_OBJFILE (t) -> objfile_obstack, size) \ : xmalloc (size)) extern struct type *alloc_type (struct objfile *); diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index c87dfab..3ec6d51 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1324,12 +1324,10 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows up. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* This value is almost never non-zero... */ - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_extract_struct_value_address (gdbarch, - h8300_extract_struct_value_address); + set_gdbarch_deprecated_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); diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2241e7e..9ca22a9 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -510,7 +510,7 @@ read_unwind_info (struct objfile *objfile) obj_private_data_t *obj_private; text_offset = ANOFFSET (objfile->section_offsets, 0); - ui = (struct obj_unwind_info *) obstack_alloc (&objfile->psymbol_obstack, + ui = (struct obj_unwind_info *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct obj_unwind_info)); ui->table = NULL; @@ -560,7 +560,7 @@ read_unwind_info (struct objfile *objfile) /* Allocate memory for the unwind table. */ ui->table = (struct unwind_table_entry *) - obstack_alloc (&objfile->psymbol_obstack, total_size); + obstack_alloc (&objfile->objfile_obstack, total_size); ui->last = total_entries - 1; /* Now read in each unwind section and internalize the standard unwind @@ -623,7 +623,7 @@ read_unwind_info (struct objfile *objfile) if (objfile->obj_private == NULL) { obj_private = (obj_private_data_t *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (obj_private_data_t)); obj_private->unwind_info = NULL; obj_private->so_info = NULL; @@ -5120,34 +5120,12 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, hppa32_register_name); set_gdbarch_deprecated_register_virtual_type (gdbarch, hppa32_register_virtual_type); - set_gdbarch_deprecated_call_dummy_length - (gdbarch, hppa32_call_dummy_length); - set_gdbarch_deprecated_stack_align (gdbarch, hppa32_stack_align); - set_gdbarch_deprecated_reg_struct_has_addr - (gdbarch, hppa_reg_struct_has_addr); - set_gdbarch_deprecated_extract_return_value - (gdbarch, hppa32_extract_return_value); - set_gdbarch_use_struct_convention - (gdbarch, hppa32_use_struct_convention); - set_gdbarch_deprecated_store_return_value - (gdbarch, hppa32_store_return_value); break; case 8: set_gdbarch_num_regs (gdbarch, hppa64_num_regs); set_gdbarch_register_name (gdbarch, hppa64_register_name); set_gdbarch_deprecated_register_virtual_type (gdbarch, hppa64_register_virtual_type); - set_gdbarch_deprecated_call_dummy_breakpoint_offset - (gdbarch, hppa64_call_dummy_breakpoint_offset); - set_gdbarch_deprecated_call_dummy_length - (gdbarch, hppa64_call_dummy_length); - set_gdbarch_deprecated_stack_align (gdbarch, hppa64_stack_align); - set_gdbarch_deprecated_extract_return_value - (gdbarch, hppa64_extract_return_value); - set_gdbarch_use_struct_convention - (gdbarch, hppa64_use_struct_convention); - set_gdbarch_deprecated_store_return_value - (gdbarch, hppa64_store_return_value); break; default: internal_error (__FILE__, __LINE__, "Unsupported address size: %d", @@ -5174,7 +5152,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_in_solib_call_trampoline (gdbarch, hppa_in_solib_call_trampoline); set_gdbarch_in_solib_return_trampoline (gdbarch, hppa_in_solib_return_trampoline); - set_gdbarch_deprecated_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call); set_gdbarch_inner_than (gdbarch, hppa_inner_than); set_gdbarch_deprecated_register_size (gdbarch, tdep->bytes_per_address); set_gdbarch_deprecated_fp_regnum (gdbarch, 3); @@ -5186,19 +5163,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_register_virtual_size (gdbarch, hppa_register_raw_size); set_gdbarch_deprecated_max_register_raw_size (gdbarch, tdep->bytes_per_address); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8); - set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return); set_gdbarch_cannot_store_register (gdbarch, hppa_cannot_store_register); - set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info); - set_gdbarch_deprecated_frame_chain (gdbarch, hppa_frame_chain); - set_gdbarch_deprecated_frame_chain_valid (gdbarch, hppa_frame_chain_valid); - 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_skip (gdbarch, 0); - set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame); - set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame); - /* set_gdbarch_deprecated_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */ - set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments); set_gdbarch_addr_bits_remove (gdbarch, hppa_smash_text_address); set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address); set_gdbarch_believe_pcc_promotion (gdbarch, 1); @@ -5217,6 +5182,47 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) whether any watched location changed. */ set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); + /* Inferior function call methods. */ +#if 0 +#else + switch (tdep->bytes_per_address) + { + case 4: + set_gdbarch_deprecated_call_dummy_length (gdbarch, hppa32_call_dummy_length); + set_gdbarch_deprecated_stack_align (gdbarch, hppa32_stack_align); + set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, hppa_reg_struct_has_addr); + set_gdbarch_deprecated_extract_return_value (gdbarch, hppa32_extract_return_value); + set_gdbarch_use_struct_convention (gdbarch, hppa32_use_struct_convention); + set_gdbarch_deprecated_store_return_value (gdbarch, hppa32_store_return_value); + break; + case 8: + set_gdbarch_deprecated_call_dummy_breakpoint_offset (gdbarch, hppa64_call_dummy_breakpoint_offset); + set_gdbarch_deprecated_call_dummy_length (gdbarch, hppa64_call_dummy_length); + set_gdbarch_deprecated_stack_align (gdbarch, hppa64_stack_align); + set_gdbarch_deprecated_extract_return_value (gdbarch, hppa64_extract_return_value); + set_gdbarch_use_struct_convention (gdbarch, hppa64_use_struct_convention); + set_gdbarch_deprecated_store_return_value (gdbarch, hppa64_store_return_value); + break; + } + set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return); + set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame); + /* set_gdbarch_deprecated_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */ + set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments); +#endif + + /* Frame unwind methods. */ +#if 0 +#else + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call); + set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info); + set_gdbarch_deprecated_frame_chain (gdbarch, hppa_frame_chain); + set_gdbarch_deprecated_frame_chain_valid (gdbarch, hppa_frame_chain_valid); + set_gdbarch_frameless_function_invocation + (gdbarch, hppa_frameless_function_invocation); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc); + set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame); +#endif + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/hpread.c b/gdb/hpread.c index 246f77e..76e9696 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -1680,7 +1680,7 @@ hpread_symfile_init (struct objfile *objfile) return; GNTT (objfile) - = obstack_alloc (&objfile->symbol_obstack, + = obstack_alloc (&objfile->objfile_obstack, bfd_section_size (objfile->obfd, gntt_section)); bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile), @@ -1702,7 +1702,7 @@ hpread_symfile_init (struct objfile *objfile) return; LNTT (objfile) - = obstack_alloc (&objfile->symbol_obstack, + = obstack_alloc (&objfile->objfile_obstack, bfd_section_size (objfile->obfd, lntt_section)); bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile), @@ -1719,7 +1719,7 @@ hpread_symfile_init (struct objfile *objfile) return; SLT (objfile) = - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, bfd_section_size (objfile->obfd, slt_section)); bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile), @@ -1734,7 +1734,7 @@ hpread_symfile_init (struct objfile *objfile) VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section); VT (objfile) = - (char *) obstack_alloc (&objfile->symbol_obstack, + (char *) obstack_alloc (&objfile->objfile_obstack, VT_SIZE (objfile)); bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile), @@ -1973,7 +1973,7 @@ hpread_build_psymtabs (struct objfile *objfile, int mainline) if (!have_name) { pst->filename = (char *) - obstack_alloc (&pst->objfile->psymbol_obstack, + obstack_alloc (&pst->objfile->objfile_obstack, strlen (namestring) + 1); strcpy (pst->filename, namestring); have_name = 1; @@ -2392,7 +2392,7 @@ hpread_start_psymtab (struct objfile *objfile, char *filename, result->textlow += offset; result->read_symtab_private = (char *) - obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc)); LDSYMOFF (result) = ldsymoff; result->read_symtab = hpread_psymtab_to_symtab; @@ -2453,7 +2453,7 @@ hpread_end_psymtab (struct partial_symtab *pst, char **include_list, if (number_dependencies) { pst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, number_dependencies * sizeof (struct partial_symtab *)); memcpy (pst->dependencies, dependency_list, number_dependencies * sizeof (struct partial_symtab *)); @@ -2468,7 +2468,7 @@ hpread_end_psymtab (struct partial_symtab *pst, char **include_list, subpst->section_offsets = pst->section_offsets; subpst->read_symtab_private = - (char *) obstack_alloc (&objfile->psymbol_obstack, + (char *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc)); LDSYMOFF (subpst) = LDSYMLEN (subpst) = @@ -2478,7 +2478,7 @@ hpread_end_psymtab (struct partial_symtab *pst, char **include_list, /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ subpst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct partial_symtab *)); subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; @@ -3127,11 +3127,11 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp, memp = hpread_get_lntt (mem.dnttp.index, objfile); name = VT (objfile) + memp->dmember.name; - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = memp->dmember.value; @@ -3145,7 +3145,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nsyms); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms); /* Find the symbols for the members and put them into the type. The symbols can be found in the symlist that we put them on @@ -3235,11 +3235,11 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Get the name. */ name = VT (objfile) + paramp->dfparam.name; - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); /* Figure out where it lives. */ if (paramp->dfparam.regparam) @@ -3306,7 +3306,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Note how many parameters we found. */ TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms); /* Find the symbols for the parameters and @@ -3415,7 +3415,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Get the name. */ name = VT (objfile) + paramp->dfparam.name; - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = name; @@ -3485,7 +3485,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Note how many parameters we found. */ TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms); /* Find the symbols for the parameters and @@ -3782,7 +3782,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, if (n_templ_args > 0) TYPE_TEMPLATE_ARGS (type) = (struct template_arg *) - obstack_alloc (&objfile->type_obstack, sizeof (struct template_arg) * n_templ_args); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct template_arg) * n_templ_args); for (n = n_templ_args; t_list; t_list = t_list->next) { n -= 1; @@ -4255,7 +4255,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_NINSTANTIATIONS (type) = ninstantiations; if (ninstantiations > 0) TYPE_INSTANTIATIONS (type) = (struct type **) - obstack_alloc (&objfile->type_obstack, sizeof (struct type *) * ninstantiations); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct type *) * ninstantiations); for (n = ninstantiations; i_list; i_list = i_list->next) { n -= 1; @@ -4267,7 +4267,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_NFIELDS (type) = nfields; TYPE_N_BASECLASSES (type) = n_base_classes; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nfields); /* Copy the saved-up fields into the field vector. */ for (n = nfields, tmp_list = list; tmp_list; tmp_list = tmp_list->next) { @@ -4281,7 +4281,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_NFN_FIELDS (type) = n_fn_fields; TYPE_NFN_FIELDS_TOTAL (type) = n_fn_fields_total; TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *) - obstack_alloc (&objfile->type_obstack, sizeof (struct fn_fieldlist) * n_fn_fields); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct fn_fieldlist) * n_fn_fields); for (n = n_fn_fields; fn_list; fn_list = fn_list->next) { n -= 1; @@ -4399,7 +4399,7 @@ fix_static_member_physnames (struct type *type, char *class_name, return; /* physnames are already set */ SET_FIELD_PHYSNAME (TYPE_FIELDS (type)[i], - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, strlen (class_name) + strlen (TYPE_FIELD_NAME (type, i)) + 3)); strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name); strcat (TYPE_FIELD_STATIC_PHYSNAME (type, i), "::"); @@ -4562,7 +4562,7 @@ hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp, */ TYPE_NFIELDS (type) = 1; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, sizeof (struct field)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field)); TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype, objfile); return type; @@ -4585,7 +4585,7 @@ hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8; TYPE_NFIELDS (type) = 2; TYPE_FIELDS (type) - = (struct field *) obstack_alloc (&objfile->type_obstack, + = (struct field *) obstack_alloc (&objfile->objfile_obstack, 2 * sizeof (struct field)); if (dn_bufp->dsubr.dyn_low) @@ -4803,7 +4803,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) /* Build the correct name. */ TYPE_NAME (structtype) - = (char *) obstack_alloc (&objfile->type_obstack, + = (char *) obstack_alloc (&objfile->objfile_obstack, strlen (prefix) + strlen (suffix) + 1); TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix); TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix); @@ -5098,10 +5098,10 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, char *class_scope_name; /* Allocate one GDB debug symbol and fill in some default values. */ - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack); + DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->objfile_obstack); SYMBOL_LANGUAGE (sym) = language_auto; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_LINE (sym) = 0; @@ -5304,7 +5304,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, * some things broke, so I'm leaving it in here, and * working around the issue in stack.c. - RT */ - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); + SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack); if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) && (!SYMBOL_CPLUS_DEMANGLED_NAME (sym))) { @@ -5420,7 +5420,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, * some things broke, so I'm leaving it in here, and * working around the issue in stack.c. - RT */ - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); + SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack); if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) && (!SYMBOL_CPLUS_DEMANGLED_NAME (sym))) @@ -5886,7 +5886,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, { struct symbol *newsym; - newsym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + newsym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (newsym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (newsym) = name; diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 50073b1..768a5b6 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -274,7 +274,7 @@ i386_linux_sigcontext_addr (struct frame_info *next_frame) pointer to the user context is passed as the third argument to the signal handler. */ read_memory (sp + 8, buf, 4); - ucontext_addr = extract_unsigned_integer (buf, 4) + 20; + ucontext_addr = extract_unsigned_integer (buf, 4); return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; } diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c index 4a1eaac..6d2f492 100644 --- a/gdb/i386-nto-tdep.c +++ b/gdb/i386-nto-tdep.c @@ -271,7 +271,7 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) i386_elf_init_abi (info, gdbarch); /* Neutrino rewinds to look more normal. Need to override the i386 - default which is [unfortunatly] to decrement the PC. */ + default which is [unfortunately] to decrement the PC. */ set_gdbarch_decr_pc_after_break (gdbarch, 0); /* NTO has shared libraries. */ diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 6b2dba6..5d641af 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -102,7 +102,6 @@ static gdbarch_register_type_ftype ia64_register_type; static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc; static gdbarch_skip_prologue_ftype ia64_skip_prologue; static gdbarch_extract_return_value_ftype ia64_extract_return_value; -static gdbarch_extract_struct_value_address_ftype ia64_extract_struct_value_address; static gdbarch_use_struct_convention_ftype ia64_use_struct_convention; static struct type *is_float_or_hfa_type (struct type *t); @@ -334,32 +333,6 @@ const struct floatformat floatformat_ia64_ext = }; -/* Read the given register from a sigcontext structure in the - specified frame. */ - -static CORE_ADDR -read_sigcontext_register (struct frame_info *frame, int regnum) -{ - CORE_ADDR regaddr; - - if (frame == NULL) - internal_error (__FILE__, __LINE__, - "read_sigcontext_register: NULL frame"); - if (!(get_frame_type (frame) == SIGTRAMP_FRAME)) - internal_error (__FILE__, __LINE__, - "read_sigcontext_register: frame not a signal trampoline"); - if (SIGCONTEXT_REGISTER_ADDRESS == 0) - internal_error (__FILE__, __LINE__, - "read_sigcontext_register: SIGCONTEXT_REGISTER_ADDRESS is 0"); - - regaddr = SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), regnum); - if (regaddr) - return read_memory_integer (regaddr, register_size (current_gdbarch, regnum)); - else - internal_error (__FILE__, __LINE__, - "read_sigcontext_register: Register %d not in struct sigcontext", regnum); -} - /* Extract ``len'' bits from an instruction bundle starting at bit ``from''. */ @@ -650,18 +623,6 @@ ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) } 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); @@ -1590,8 +1551,10 @@ ia64_frame_this_id (struct frame_info *next_frame, void **this_cache, (*this_id) = frame_id_build_special (cache->base, cache->pc, cache->bsp); if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "regular frame id: code %lx, stack %lx, special %lx, next_frame %p\n", - this_id->code_addr, this_id->stack_addr, cache->bsp, next_frame); + "regular frame id: code 0x%s, stack 0x%s, special 0x%s, next_frame %p\n", + paddr_nz (this_id->code_addr), + paddr_nz (this_id->stack_addr), + paddr_nz (cache->bsp), next_frame); } static void @@ -1886,9 +1849,10 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "regular prev register <%d> <%s> is %lx\n", regnum, + "regular prev register <%d> <%s> is 0x%s\n", regnum, (((unsigned) regnum <= IA64_NAT127_REGNUM) - ? ia64_register_names[regnum] : "r??"), extract_unsigned_integer (valuep, 8)); + ? ia64_register_names[regnum] : "r??"), + paddr_nz (extract_unsigned_integer (valuep, 8))); } static const struct frame_unwind ia64_frame_unwind = @@ -1986,8 +1950,10 @@ ia64_sigtramp_frame_this_id (struct frame_info *next_frame, (*this_id) = frame_id_build_special (cache->base, frame_pc_unwind (next_frame), cache->bsp); if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "sigtramp frame id: code %lx, stack %lx, special %lx, next_frame %p\n", - this_id->code_addr, this_id->stack_addr, cache->bsp, next_frame); + "sigtramp frame id: code 0x%s, stack 0x%s, special 0x%s, next_frame %p\n", + paddr_nz (this_id->code_addr), + paddr_nz (this_id->stack_addr), + paddr_nz (cache->bsp), next_frame); } static void @@ -2063,9 +2029,10 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "sigtramp prev register <%s> is %lx\n", + "sigtramp prev register <%s> is 0x%s\n", (((unsigned) regnum <= IA64_NAT127_REGNUM) - ? ia64_register_names[regnum] : "r??"), extract_unsigned_integer (valuep, 8)); + ? ia64_register_names[regnum] : "r??"), + paddr_nz (extract_unsigned_integer (valuep, 8))); } static const struct frame_unwind ia64_sigtramp_frame_unwind = @@ -2264,9 +2231,10 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, } if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - " access_reg: to cache: %4s=%016lx\n", + " access_reg: to cache: %4s=0x%s\n", (((unsigned) regnum <= IA64_NAT127_REGNUM) - ? ia64_register_names[regnum] : "r??"), *val); + ? ia64_register_names[regnum] : "r??"), + paddr_nz (*val)); } else { @@ -2310,9 +2278,10 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - " access_reg: from cache: %4s=%016lx\n", + " access_reg: from cache: %4s=0x%s\n", (((unsigned) regnum <= IA64_NAT127_REGNUM) - ? ia64_register_names[regnum] : "r??"), *val); + ? ia64_register_names[regnum] : "r??"), + paddr_nz (*val)); } return 0; } @@ -2396,9 +2365,11 @@ get_kernel_table (unw_word_t ip, unw_dyn_info_t *di) if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, "get_kernel_table: found table `%s': " - "segbase=%lx, length=%lu, gp=%lx\n", - (char *) di->u.ti.name_ptr, di->u.ti.segbase, - di->u.ti.table_len, di->gp); + "segbase=0x%s, length=%s, gp=0x%s\n", + (char *) di->u.ti.name_ptr, + paddr_nz (di->u.ti.segbase), + paddr_u (di->u.ti.table_len), + paddr_nz (di->gp)); return 0; } @@ -2480,12 +2451,15 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, return -UNW_ENOINFO; if (gdbarch_debug >= 1) - fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: %lx -> " - "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," - "length=%lu,data=%p)\n", - ip, (char *)di.u.ti.name_ptr, - di.u.ti.segbase, di.start_ip, di.end_ip, - di.gp, di.u.ti.table_len, di.u.ti.table_data); + fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: 0x%s -> " + "(name=`%s',segbase=0x%s,start=0x%s,end=0x%s,gp=0x%s," + "length=%s,data=0x%s)\n", + paddr_nz (ip), (char *)di.u.ti.name_ptr, + paddr_nz (di.u.ti.segbase), + paddr_nz (di.start_ip), paddr_nz (di.end_ip), + paddr_nz (di.gp), + paddr_u (di.u.ti.table_len), + paddr_nz ((CORE_ADDR)di.u.ti.table_data)); } else { @@ -2494,12 +2468,15 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, return ret; if (gdbarch_debug >= 1) - fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: %lx -> " - "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," - "length=%lu,data=%lx)\n", - ip, (char *)di.u.rti.name_ptr, - di.u.rti.segbase, di.start_ip, di.end_ip, - di.gp, di.u.rti.table_len, di.u.rti.table_data); + fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: 0x%s -> " + "(name=`%s',segbase=0x%s,start=0x%s,end=0x%s,gp=0x%s," + "length=%s,data=0x%s)\n", + paddr_nz (ip), (char *)di.u.rti.name_ptr, + paddr_nz (di.u.rti.segbase), + paddr_nz (di.start_ip), paddr_nz (di.end_ip), + paddr_nz (di.gp), + paddr_u (di.u.rti.table_len), + paddr_nz (di.u.rti.table_data)); } ret = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info, @@ -2552,9 +2529,9 @@ ia64_get_dyn_info_list (unw_addr_space_t as, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, "dynamic unwind table in objfile %s " - "at %lx (gp=%lx)\n", + "at 0x%s (gp=0x%s)\n", bfd_get_filename (objfile->obfd), - addr, di.gp); + paddr_nz (addr), paddr_nz (di.gp)); *dilap = addr; return 0; } @@ -2584,8 +2561,9 @@ ia64_libunwind_frame_this_id (struct frame_info *next_frame, void **this_cache, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "libunwind frame id: code %lx, stack %lx, special %lx, next_frame %p\n", - id.code_addr, id.stack_addr, bsp, next_frame); + "libunwind frame id: code 0x%s, stack 0x%s, special 0x%s, next_frame %p\n", + paddr_nz (id.code_addr), paddr_nz (id.stack_addr), + paddr_nz (bsp), next_frame); } static void @@ -2664,9 +2642,10 @@ ia64_libunwind_frame_prev_register (struct frame_info *next_frame, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "libunwind prev register <%s> is %lx\n", + "libunwind prev register <%s> is 0x%s\n", (((unsigned) regnum <= IA64_NAT127_REGNUM) - ? ia64_register_names[regnum] : "r??"), extract_unsigned_integer (valuep, 8)); + ? ia64_register_names[regnum] : "r??"), + paddr_nz (extract_unsigned_integer (valuep, 8))); } static const struct frame_unwind ia64_libunwind_frame_unwind = @@ -2709,9 +2688,9 @@ static struct libunwind_descr ia64_libunwind_descr = #endif /* HAVE_LIBUNWIND_IA64_H */ -/* 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). */ +/* Should we use DEPRECATED_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). */ int ia64_use_struct_convention (int gcc_p, struct type *type) { @@ -3211,8 +3190,9 @@ ia64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "dummy frame id: code %lx, stack %lx, special %lx\n", - frame_pc_unwind (next_frame), sp, bsp); + "dummy frame id: code 0x%s, stack 0x%s, special 0x%s\n", + paddr_nz (frame_pc_unwind (next_frame)), + paddr_nz (sp), paddr_nz (bsp)); return frame_id_build_special (sp, frame_pc_unwind (next_frame), bsp); } @@ -3256,53 +3236,6 @@ ia64_remote_translate_xfer_address (struct gdbarch *gdbarch, *targ_len = nr_bytes; } -static void -process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) -{ - int *os_ident_ptr = obj; - const char *name; - unsigned int sectsize; - - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); - if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) - { - unsigned int name_length, data_length, note_type; - char *note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - data_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 4 && data_length == 16 && note_type == 1 - && strcmp (note + 12, "GNU") == 0) - { - int os_number = bfd_h_get_32 (abfd, note + 16); - - /* The case numbers are from abi-tags in glibc. */ - switch (os_number) - { - case 0 : - *os_ident_ptr = ELFOSABI_LINUX; - break; - case 1 : - *os_ident_ptr = ELFOSABI_HURD; - break; - case 2 : - *os_ident_ptr = ELFOSABI_SOLARIS; - break; - default : - internal_error (__FILE__, __LINE__, - "process_note_abi_sections: unknown OS number %d", os_number); - break; - } - } - } -} - static int ia64_print_insn (bfd_vma memaddr, struct disassemble_info *info) { @@ -3400,7 +3333,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, ia64_extract_return_value); set_gdbarch_store_return_value (gdbarch, ia64_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); set_gdbarch_memory_insert_breakpoint (gdbarch, ia64_memory_insert_breakpoint); set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint); @@ -3425,8 +3358,6 @@ ia64_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_frame_args_skip (gdbarch, 0); - set_gdbarch_remote_translate_xfer_address ( gdbarch, ia64_remote_translate_xfer_address); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 483937c..2de769e 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1047,24 +1047,23 @@ advance_command (char *arg, int from_tty) } -/* Print the result of a function at the end of a 'finish' command. */ +/* Print the result of a function at the end of a 'finish' command. */ + static void -print_return_value (int structure_return, struct type *value_type) +print_return_value (int struct_return, struct type *value_type) { + struct cleanup *old_chain; + struct ui_stream *stb; struct value *value; - static struct ui_stream *stb = NULL; - if (!structure_return) + if (!struct_return) { + /* The return value can be found in the inferior's registers. */ value = register_value_being_returned (value_type, stop_registers); - stb = ui_out_stream_new (uiout); - ui_out_text (uiout, "Value returned is "); - ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); - ui_out_text (uiout, " = "); - value_print (value, stb->stream, 0, Val_no_prettyprint); - ui_out_field_stream (uiout, "return-value", stb); - ui_out_text (uiout, "\n"); } + /* FIXME: cagney/2004-01-17: When both return_value and + extract_returned_value_address are available, should use that to + find the address of and then extract the returned value. */ /* FIXME: 2003-09-27: When returning from a nested inferior function call, it's possible (with no help from the architecture vector) to locate and return/print a "struct return" value. This is just @@ -1077,7 +1076,8 @@ print_return_value (int structure_return, struct type *value_type) initiate the call, as opposed to the call_function_by_hand case. */ { - gdb_assert (gdbarch_return_value (current_gdbarch, value_type, NULL, NULL, NULL) + gdb_assert (gdbarch_return_value (current_gdbarch, value_type, + NULL, NULL, NULL) == RETURN_VALUE_STRUCT_CONVENTION); ui_out_text (uiout, "Value returned has type: "); ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type)); @@ -1087,9 +1087,9 @@ print_return_value (int structure_return, struct type *value_type) } else { - if (EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) { - CORE_ADDR addr = EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers); + CORE_ADDR addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers); if (!addr) error ("Function return value unknown."); value = value_at (value_type, addr, NULL); @@ -1107,25 +1107,31 @@ print_return_value (int structure_return, struct type *value_type) EXTRACT_RETURN_VALUE (value_type, stop_registers, VALUE_CONTENTS_RAW (value)); } - stb = ui_out_stream_new (uiout); - ui_out_text (uiout, "Value returned is "); - ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); - ui_out_text (uiout, " = "); - value_print (value, stb->stream, 0, Val_no_prettyprint); - ui_out_field_stream (uiout, "return-value", stb); - ui_out_text (uiout, "\n"); } + + /* Print it. */ + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup_ui_out_stream_delete (stb); + ui_out_text (uiout, "Value returned is "); + ui_out_field_fmt (uiout, "gdb-result-var", "$%d", + record_latest_value (value)); + ui_out_text (uiout, " = "); + value_print (value, stb->stream, 0, Val_no_prettyprint); + ui_out_field_stream (uiout, "return-value", stb); + ui_out_text (uiout, "\n"); + do_cleanups (old_chain); } /* Stuff that needs to be done by the finish command after the target - has stopped. In asynchronous mode, we wait for the target to stop in - the call to poll or select in the event loop, so it is impossible to - do all the stuff as part of the finish_command function itself. The - only chance we have to complete this command is in - fetch_inferior_event, which is called by the event loop as soon as it - detects that the target has stopped. This function is called via the - cmd_continuation pointer. */ -void + has stopped. In asynchronous mode, we wait for the target to stop + in the call to poll or select in the event loop, so it is + impossible to do all the stuff as part of the finish_command + function itself. The only chance we have to complete this command + is in fetch_inferior_event, which is called by the event loop as + soon as it detects that the target has stopped. This function is + called via the cmd_continuation pointer. */ + +static void finish_command_continuation (struct continuation_arg *arg) { struct symbol *function; @@ -1133,15 +1139,15 @@ finish_command_continuation (struct continuation_arg *arg) struct cleanup *cleanups; breakpoint = (struct breakpoint *) arg->data.pointer; - function = (struct symbol *) arg->next->data.pointer; - cleanups = (struct cleanup *) arg->next->next->data.pointer; + function = (struct symbol *) arg->next->data.pointer; + cleanups = (struct cleanup *) arg->next->next->data.pointer; if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL - && function != 0) + && function != NULL) { struct type *value_type; - CORE_ADDR funcaddr; int struct_return; + int gcc_compiled; value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function)); if (!value_type) @@ -1154,18 +1160,18 @@ finish_command_continuation (struct continuation_arg *arg) return; } - funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function)); - - struct_return = using_struct_return (check_typedef (value_type), - BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function))); + CHECK_TYPEDEF (value_type); + gcc_compiled = BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)); + struct_return = using_struct_return (value_type, gcc_compiled); print_return_value (struct_return, value_type); } + do_exec_cleanups (cleanups); } -/* "finish": Set a temporary breakpoint at the place - the selected frame will return to, then continue. */ +/* "finish": Set a temporary breakpoint at the place the selected + frame will return to, then continue. */ static void finish_command (char *arg, int from_tty) @@ -1179,20 +1185,20 @@ finish_command (char *arg, int from_tty) int async_exec = 0; - /* Find out whether we must run in the background. */ + /* Find out whether we must run in the background. */ if (arg != NULL) async_exec = strip_bg_char (&arg); /* If we must run in the background, but the target can't do it, - error out. */ + error out. */ if (event_loop_p && async_exec && !target_can_async_p ()) error ("Asynchronous execution not supported on this target."); /* If we are not asked to run in the bg, then prepare to run in the - foreground, synchronously. */ + foreground, synchronously. */ if (event_loop_p && !async_exec && target_can_async_p ()) { - /* Simulate synchronous execution */ + /* Simulate synchronous execution. */ async_disable_stdin (); } @@ -1223,8 +1229,8 @@ finish_command (char *arg, int from_tty) function = find_pc_function (get_frame_pc (deprecated_selected_frame)); - /* Print info on the selected frame, including level number - but not source. */ + /* Print info on the selected frame, including level number but not + source. */ if (from_tty) { printf_filtered ("Run till exit from "); @@ -1235,7 +1241,7 @@ finish_command (char *arg, int from_tty) /* If running asynchronously and the target support asynchronous execution, set things up for the rest of the finish command to be completed later on, when gdb has detected that the target has - stopped, in fetch_inferior_event. */ + stopped, in fetch_inferior_event. */ if (event_loop_p && target_can_async_p ()) { arg1 = @@ -1253,44 +1259,43 @@ finish_command (char *arg, int from_tty) add_continuation (finish_command_continuation, arg1); } - proceed_to_finish = 1; /* We want stop_registers, please... */ + proceed_to_finish = 1; /* We want stop_registers, please... */ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); /* Do this only if not running asynchronously or if the target - cannot do async execution. Otherwise, complete this command when - the target actually stops, in fetch_inferior_event. */ + cannot do async execution. Otherwise, complete this command when + the target actually stops, in fetch_inferior_event. */ if (!event_loop_p || !target_can_async_p ()) { - - /* Did we stop at our breakpoint? */ + /* Did we stop at our breakpoint? */ if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL - && function != 0) + && function != NULL) { struct type *value_type; - CORE_ADDR funcaddr; int struct_return; + int gcc_compiled; value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function)); if (!value_type) internal_error (__FILE__, __LINE__, "finish_command: function has no target type"); - /* FIXME: Shouldn't we do the cleanups before returning? */ + /* FIXME: Shouldn't we do the cleanups before returning? */ if (TYPE_CODE (value_type) == TYPE_CODE_VOID) return; - funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function)); - - struct_return = - using_struct_return (check_typedef (value_type), - BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function))); + CHECK_TYPEDEF (value_type); + gcc_compiled = BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)); + struct_return = using_struct_return (value_type, gcc_compiled); print_return_value (struct_return, value_type); } + do_cleanups (old_chain); } } + static void program_info (char *args, int from_tty) { diff --git a/gdb/infrun.c b/gdb/infrun.c index 0724546..ea83f13 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1313,6 +1313,79 @@ handle_step_into_function (struct execution_control_state *ecs) return; } +static void +adjust_pc_after_break (struct execution_control_state *ecs) +{ + CORE_ADDR stop_pc; + + /* If this target does not decrement the PC after breakpoints, then + we have nothing to do. */ + if (DECR_PC_AFTER_BREAK == 0) + return; + + /* If we've hit a breakpoint, we'll normally be stopped with SIGTRAP. If + we aren't, just return. + + We assume that waitkinds other than TARGET_WAITKIND_STOPPED are not + affected by DECR_PC_AFTER_BREAK. Other waitkinds which are implemented + by software breakpoints should be handled through the normal breakpoint + layer. + + NOTE drow/2004-01-31: On some targets, breakpoints may generate + different signals (SIGILL or SIGEMT for instance), but it is less + clear where the PC is pointing afterwards. It may not match + DECR_PC_AFTER_BREAK. I don't know any specific target that generates + these signals at breakpoints (the code has been in GDB since at least + 1992) so I can not guess how to handle them here. + + In earlier versions of GDB, a target with HAVE_NONSTEPPABLE_WATCHPOINTS + would have the PC after hitting a watchpoint affected by + DECR_PC_AFTER_BREAK. I haven't found any target with both of these set + in GDB history, and it seems unlikely to be correct, so + HAVE_NONSTEPPABLE_WATCHPOINTS is not checked here. */ + + if (ecs->ws.kind != TARGET_WAITKIND_STOPPED) + return; + + if (ecs->ws.value.sig != TARGET_SIGNAL_TRAP) + return; + + /* Find the location where (if we've hit a breakpoint) the breakpoint would + be. */ + stop_pc = read_pc_pid (ecs->ptid) - DECR_PC_AFTER_BREAK; + + /* If we're software-single-stepping, then assume this is a breakpoint. + NOTE drow/2004-01-17: This doesn't check that the PC matches, or that + we're even in the right thread. The software-single-step code needs + some modernization. + + If we're not software-single-stepping, then we first check that there + is an enabled software breakpoint at this address. If there is, and + we weren't using hardware-single-step, then we've hit the breakpoint. + + If we were using hardware-single-step, we check prev_pc; if we just + stepped over an inserted software breakpoint, then we should decrement + the PC and eventually report hitting the breakpoint. The prev_pc check + prevents us from decrementing the PC if we just stepped over a jump + instruction and landed on the instruction after a breakpoint. + + The last bit checks that we didn't hit a breakpoint in a signal handler + without an intervening stop in sigtramp, which is detected by a new + stack pointer value below any usual function calling stack adjustments. + + NOTE drow/2004-01-17: I'm not sure that this is necessary. The check + predates checking for software single step at the same time. Also, + if we've moved into a signal handler we should have seen the + signal. */ + + if ((SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p) + || (software_breakpoint_inserted_here_p (stop_pc) + && !(currently_stepping (ecs) + && prev_pc != stop_pc + && !(step_range_end && INNER_THAN (read_sp (), (step_sp - 16)))))) + write_pc_pid (stop_pc, ecs->ptid); +} + /* Given an execution control state that has been freshly filled in by an event from the inferior, figure out what it means and take appropriate action. */ @@ -1332,6 +1405,8 @@ handle_inferior_event (struct execution_control_state *ecs) target_last_wait_ptid = ecs->ptid; target_last_waitstatus = *ecs->wp; + adjust_pc_after_break (ecs); + switch (ecs->infwait_state) { case infwait_thread_hop_state: @@ -1514,13 +1589,7 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = read_pc (); - /* Assume that catchpoints are not really software breakpoints. If - some future target implements them using software breakpoints then - that target is responsible for fudging DECR_PC_AFTER_BREAK. Thus - we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that - bpstat_stop_status will not decrement the PC. */ - - stop_bpstat = bpstat_stop_status (&stop_pc, 1); + stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid); ecs->random_signal = !bpstat_explains_signal (stop_bpstat); @@ -1569,13 +1638,7 @@ handle_inferior_event (struct execution_control_state *ecs) ecs->saved_inferior_ptid = inferior_ptid; inferior_ptid = ecs->ptid; - /* Assume that catchpoints are not really software breakpoints. If - some future target implements them using software breakpoints then - that target is responsible for fudging DECR_PC_AFTER_BREAK. Thus - we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that - bpstat_stop_status will not decrement the PC. */ - - stop_bpstat = bpstat_stop_status (&stop_pc, 1); + stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid); ecs->random_signal = !bpstat_explains_signal (stop_bpstat); inferior_ptid = ecs->saved_inferior_ptid; @@ -1685,19 +1748,15 @@ handle_inferior_event (struct execution_control_state *ecs) /* Check if a regular breakpoint has been hit before checking for a potential single step breakpoint. Otherwise, GDB will not see this breakpoint hit when stepping onto breakpoints. */ - if (breakpoints_inserted - && breakpoint_here_p (stop_pc - DECR_PC_AFTER_BREAK)) + if (breakpoints_inserted && breakpoint_here_p (stop_pc)) { ecs->random_signal = 0; - if (!breakpoint_thread_match (stop_pc - DECR_PC_AFTER_BREAK, - ecs->ptid)) + if (!breakpoint_thread_match (stop_pc, ecs->ptid)) { int remove_status; /* Saw a breakpoint, but it was hit by the wrong thread. Just continue. */ - if (DECR_PC_AFTER_BREAK) - write_pc_pid (stop_pc - DECR_PC_AFTER_BREAK, ecs->ptid); remove_status = remove_breakpoints (); /* Did we fail to remove breakpoints? If so, try @@ -1710,7 +1769,7 @@ handle_inferior_event (struct execution_control_state *ecs) if (remove_status != 0) { /* FIXME! This is obviously non-portable! */ - write_pc_pid (stop_pc - DECR_PC_AFTER_BREAK + 4, ecs->ptid); + write_pc_pid (stop_pc + 4, ecs->ptid); /* We need to restart all the threads now, * unles we're running in scheduler-locked mode. * Use currently_stepping to determine whether to @@ -1744,17 +1803,6 @@ handle_inferior_event (struct execution_control_state *ecs) } else if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p) { - /* Readjust the stop_pc as it is off by DECR_PC_AFTER_BREAK - compared to the value it would have if the system stepping - capability was used. This allows the rest of the code in - this function to use this address without having to worry - whether software single step is in use or not. */ - if (DECR_PC_AFTER_BREAK) - { - stop_pc -= DECR_PC_AFTER_BREAK; - write_pc_pid (stop_pc, ecs->ptid); - } - sw_single_step_trap_p = 1; ecs->random_signal = 0; } @@ -1886,9 +1934,6 @@ handle_inferior_event (struct execution_control_state *ecs) includes evaluating watchpoints, things will come to a stop in the correct manner. */ - if (DECR_PC_AFTER_BREAK) - write_pc (stop_pc - DECR_PC_AFTER_BREAK); - remove_breakpoints (); registers_changed (); target_resume (ecs->ptid, 1, TARGET_SIGNAL_0); /* Single step */ @@ -1930,15 +1975,20 @@ handle_inferior_event (struct execution_control_state *ecs) will be made according to the signal handling tables. */ /* First, distinguish signals caused by the debugger from signals - that have to do with the program's own actions. - Note that breakpoint insns may cause SIGTRAP or SIGILL - or SIGEMT, depending on the operating system version. - Here we detect when a SIGILL or SIGEMT is really a breakpoint - and change it to SIGTRAP. */ + that have to do with the program's own actions. Note that + breakpoint insns may cause SIGTRAP or SIGILL or SIGEMT, depending + on the operating system version. Here we detect when a SIGILL or + SIGEMT is really a breakpoint and change it to SIGTRAP. We do + something similar for SIGSEGV, since a SIGSEGV will be generated + when we're trying to execute a breakpoint instruction on a + non-executable stack. This happens for call dummy breakpoints + for architectures like SPARC that place call dummies on the + stack. */ if (stop_signal == TARGET_SIGNAL_TRAP || (breakpoints_inserted && (stop_signal == TARGET_SIGNAL_ILL + || stop_signal == TARGET_SIGNAL_SEGV || stop_signal == TARGET_SIGNAL_EMT)) || stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_NO_SIGSTOP) @@ -1983,29 +2033,8 @@ handle_inferior_event (struct execution_control_state *ecs) else { /* See if there is a breakpoint at the current PC. */ + stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid); - /* The second argument of bpstat_stop_status is meant to help - distinguish between a breakpoint trap and a singlestep trap. - This is only important on targets where DECR_PC_AFTER_BREAK - is non-zero. The prev_pc test is meant to distinguish between - singlestepping a trap instruction, and singlestepping thru a - jump to the instruction following a trap instruction. - - Therefore, pass TRUE if our reason for stopping is - something other than hitting a breakpoint. We do this by - checking that either: we detected earlier a software single - step trap or, 1) stepping is going on and 2) we didn't hit - a breakpoint in a signal handler without an intervening stop - in sigtramp, which is detected by a new stack pointer value - below any usual function calling stack adjustments. */ - stop_bpstat = - bpstat_stop_status - (&stop_pc, - sw_single_step_trap_p - || (currently_stepping (ecs) - && prev_pc != stop_pc - DECR_PC_AFTER_BREAK - && !(step_range_end - && INNER_THAN (read_sp (), (step_sp - 16))))); /* Following in case break condition called a function. */ stop_print_frame = 1; @@ -2022,10 +2051,14 @@ handle_inferior_event (struct execution_control_state *ecs) If someone ever tries to get get call dummys on a non-executable stack to work (where the target would stop - with something like a SIGSEG), then those tests might need to - be re-instated. Given, however, that the tests were only + with something like a SIGSEGV), then those tests might need + to be re-instated. Given, however, that the tests were only enabled when momentary breakpoints were not being used, I - suspect that it won't be the case. */ + suspect that it won't be the case. + + NOTE: kettenis/2004-02-05: Indeed such checks don't seem to + be necessary for call dummies on a non-executable stack on + SPARC. */ if (stop_signal == TARGET_SIGNAL_TRAP) ecs->random_signal @@ -3121,6 +3154,7 @@ normal_stop (void) previous_inferior_ptid = inferior_ptid; } + /* NOTE drow/2004-01-17: Is this still necessary? */ /* Make sure that the current_frame's pc is correct. This is a correction for setting up the frame info before doing DECR_PC_AFTER_BREAK */ diff --git a/gdb/inftarg.c b/gdb/inftarg.c index a20c39f..a6f40ec 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -1,7 +1,7 @@ /* Target-vector operations for controlling Unix child processes, for GDB. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2002, 2003 Free Software Foundation, Inc. + 2000, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -222,7 +222,7 @@ child_attach (char *args, int from_tty) printf_unfiltered ("Attaching to program: %s, %s\n", exec_file, target_pid_to_str (pid_to_ptid (pid))); else - printf_unfiltered ("Attaching to %s\n", + printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid_to_ptid (pid))); gdb_flush (gdb_stdout); @@ -578,11 +578,19 @@ child_xfer_partial (struct target_ops *ops, enum target_object object, return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf, offset, len); -#if 0 case TARGET_OBJECT_AUXV: - return native_xfer_auxv (PIDGET (inferior_ptid), readbuf, writebuf, +#ifndef NATIVE_XFER_AUXV +#define NATIVE_XFER_AUXV(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) +#endif + return NATIVE_XFER_AUXV (ops, object, annex, readbuf, writebuf, offset, len); + + case TARGET_OBJECT_WCOOKIE: +#ifndef NATIVE_XFER_WCOOKIE +#define NATIVE_XFER_WCOOKIE(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) #endif + return NATIVE_XFER_WCOOKIE (ops, object, annex, readbuf, writebuf, + offset, len); default: return -1; @@ -655,10 +663,10 @@ init_child_ops (void) } /* Take over the 'find_mapped_memory' vector from inftarg.c. */ -extern void -inftarg_set_find_memory_regions (int (*func) (int (*) (CORE_ADDR, - unsigned long, - int, int, int, +extern void +inftarg_set_find_memory_regions (int (*func) (int (*) (CORE_ADDR, + unsigned long, + int, int, int, void *), void *)) { @@ -666,7 +674,7 @@ inftarg_set_find_memory_regions (int (*func) (int (*) (CORE_ADDR, } /* Take over the 'make_corefile_notes' vector from inftarg.c. */ -extern void +extern void inftarg_set_make_corefile_notes (char * (*func) (bfd *, int *)) { child_ops.to_make_corefile_notes = func; diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index d4779fd..6db6e88 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -1,5 +1,5 @@ /* Java language support routines for GDB, the GNU debugger. - Copyright 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -104,19 +104,19 @@ get_java_class_symtab (void) class_symtab = allocate_symtab ("<java-classes>", objfile); class_symtab->language = language_java; bv = (struct blockvector *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct blockvector) + sizeof (struct block *)); BLOCKVECTOR_NBLOCKS (bv) = 1; BLOCKVECTOR (class_symtab) = bv; /* Allocate dummy STATIC_BLOCK. */ - bl = allocate_block (&objfile->symbol_obstack); - BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + bl = allocate_block (&objfile->objfile_obstack); + BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack, NULL); BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl; /* Allocate GLOBAL_BLOCK. */ - bl = allocate_block (&objfile->symbol_obstack); + bl = allocate_block (&objfile->objfile_obstack); BLOCK_DICT (bl) = dict_create_hashed_expandable (); BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl; class_symtab->free_func = free_class_block; @@ -139,7 +139,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr) { struct symbol *sym; sym = (struct symbol *) - obstack_alloc (&dynamics_objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_LANGUAGE (sym) = language_java; DEPRECATED_SYMBOL_NAME (sym) = TYPE_TAG_NAME (type); @@ -186,7 +186,7 @@ java_lookup_class (char *name) type = alloc_type (objfile); TYPE_CODE (type) = TYPE_CODE_STRUCT; INIT_CPLUS_SPECIFIC (type); - TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->type_obstack); + TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->objfile_obstack); TYPE_FLAGS (type) |= TYPE_FLAG_STUB; TYPE ? = addr; return type; @@ -289,7 +289,7 @@ type_from_class (struct value *clas) /* if clasloader non-null, prepend loader address. FIXME */ temp = clas; utf8_name = value_struct_elt (&temp, NULL, "name", NULL, "structure"); - name = get_java_utf8_name (&objfile->type_obstack, utf8_name); + name = get_java_utf8_name (&objfile->objfile_obstack, utf8_name); for (nptr = name; *nptr != 0; nptr++) { if (*nptr == '/') @@ -309,7 +309,7 @@ type_from_class (struct value *clas) char *signature = name; int namelen = java_demangled_signature_length (signature); if (namelen > strlen (name)) - name = obstack_alloc (&objfile->type_obstack, namelen + 1); + name = obstack_alloc (&objfile->objfile_obstack, namelen + 1); java_demangled_signature_copy (name, signature); name[namelen] = '\0'; is_array = 1; @@ -442,7 +442,7 @@ java_link_class_type (struct type *type, struct value *clas) temp = field; temp = value_struct_elt (&temp, NULL, "name", NULL, "structure"); TYPE_FIELD_NAME (type, i) = - get_java_utf8_name (&objfile->type_obstack, temp); + get_java_utf8_name (&objfile->objfile_obstack, temp); temp = field; accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags", NULL, "structure")); @@ -488,7 +488,7 @@ java_link_class_type (struct type *type, struct value *clas) TYPE_NFN_FIELDS_TOTAL (type) = nmethods; j = nmethods * sizeof (struct fn_field); fn_fields = (struct fn_field *) - obstack_alloc (&dynamics_objfile->symbol_obstack, j); + obstack_alloc (&dynamics_objfile->objfile_obstack, j); memset (fn_fields, 0, j); fn_fieldlists = (struct fn_fieldlist *) alloca (nmethods * sizeof (struct fn_fieldlist)); @@ -513,7 +513,7 @@ java_link_class_type (struct type *type, struct value *clas) /* Get method name. */ temp = method; temp = value_struct_elt (&temp, NULL, "name", NULL, "structure"); - mname = get_java_utf8_name (&objfile->type_obstack, temp); + mname = get_java_utf8_name (&objfile->objfile_obstack, temp); if (strcmp (mname, "<init>") == 0) mname = unqualified_name; @@ -538,7 +538,7 @@ java_link_class_type (struct type *type, struct value *clas) { /* Found an existing method with the same name. */ int l; if (mname != unqualified_name) - obstack_free (&objfile->type_obstack, mname); + obstack_free (&objfile->objfile_obstack, mname); mname = fn_fieldlists[j].name; fn_fieldlists[j].length++; k = i - k; /* Index of new slot. */ @@ -559,7 +559,7 @@ java_link_class_type (struct type *type, struct value *clas) j = TYPE_NFN_FIELDS (type) * sizeof (struct fn_fieldlist); TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *) - obstack_alloc (&dynamics_objfile->symbol_obstack, j); + obstack_alloc (&dynamics_objfile->objfile_obstack, j); memcpy (TYPE_FN_FIELDLISTS (type), fn_fieldlists, j); return type; @@ -1046,6 +1046,7 @@ const struct language_defn java_language_defn = NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ java_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ diff --git a/gdb/language.c b/gdb/language.c index 3be9f9e..bc00b47 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1,7 +1,7 @@ /* Multiple source language support for GDB. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by the Department of Computer Science at the State University of New York at Buffalo. @@ -1289,6 +1289,7 @@ const struct language_defn unknown_language_defn = unk_lang_trampoline, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ @@ -1324,6 +1325,7 @@ const struct language_defn auto_language_defn = unk_lang_trampoline, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ @@ -1358,6 +1360,7 @@ const struct language_defn local_language_defn = unk_lang_trampoline, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ diff --git a/gdb/language.h b/gdb/language.h index 7470167..8ed9fb0 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -1,7 +1,7 @@ /* Source-language-related definitions for GDB. - Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2003 Free - Software Foundation, Inc. + Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2003, + 2004 Free Software Foundation, Inc. Contributed by the Department of Computer Science at the State University of New York at Buffalo. @@ -233,6 +233,9 @@ struct language_defn const domain_enum, struct symtab **); + /* Find the definition of the type with the given name. */ + struct type *(*la_lookup_transparent_type) (const char *); + /* Return demangled language symbol, or NULL. */ char *(*la_demangle) (const char *mangled, int options); diff --git a/gdb/linespec.c b/gdb/linespec.c index e16e96e..eedc671 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -694,7 +694,11 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* Check to see if it's a multipart linespec (with colons or periods). */ - /* Locate the end of the first half of the linespec. */ + /* Locate the end of the first half of the linespec. + After the call, for instance, if the argptr string is "foo.c:123" + p will point at "123". If there is only one part, like "foo", p + will point to "". If this is a C++ name, like "A::B::foo", p will + point to "::B::foo". Argptr is not changed by this call. */ p = locate_first_half (argptr, &is_quote_enclosed); @@ -723,8 +727,13 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, if (is_quoted) *argptr = *argptr + 1; - /* Is it a C++ or Java compound data structure? */ - + /* Is it a C++ or Java compound data structure? + The check on p[1] == ':' is capturing the case of "::", + since p[0]==':' was checked above. + Note that the call to decode_compound does everything + for us, including the lookup on the symbol table, so we + can return now. */ + if (p[0] == '.' || p[1] == ':') return decode_compound (argptr, funfirstline, canonical, saved_arg, p); @@ -954,7 +963,9 @@ decode_indirect (char **argptr) /* Locate the first half of the linespec, ending in a colon, period, or whitespace. (More or less.) Also, check to see if *ARGPTR is enclosed in double quotes; if so, set is_quote_enclosed, advance - ARGPTR past that and zero out the trailing double quote. */ + ARGPTR past that and zero out the trailing double quote. + If ARGPTR is just a simple name like "main", p will point to "" + at the end. */ static char * locate_first_half (char **argptr, int *is_quote_enclosed) @@ -1141,7 +1152,9 @@ decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab, } /* This handles C++ and Java compound data structures. P should point - at the first component separator, i.e. double-colon or period. */ + at the first component separator, i.e. double-colon or period. As + an example, on entrance to this function we could have ARGPTR + pointing to "AAA::inA::fun" and P pointing to "::inA::fun". */ static struct symtabs_and_lines decode_compound (char **argptr, int funfirstline, char ***canonical, @@ -1149,9 +1162,6 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, { struct symtabs_and_lines values; char *p2; -#if 0 - char *q, *q1; -#endif char *saved_arg2 = *argptr; char *temp_end; struct symbol *sym; @@ -1162,100 +1172,52 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, struct symbol **sym_arr; struct type *t; - /* First check for "global" namespace specification, - of the form "::foo". If found, skip over the colons - and jump to normal symbol processing. */ + /* First check for "global" namespace specification, of the form + "::foo". If found, skip over the colons and jump to normal + symbol processing. I.e. the whole line specification starts with + "::" (note the condition that *argptr == p). */ if (p[0] == ':' && ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t'))) saved_arg2 += 2; - /* We have what looks like a class or namespace - scope specification (A::B), possibly with many - levels of namespaces or classes (A::B::C::D). - - Some versions of the HP ANSI C++ compiler (as also possibly - other compilers) generate class/function/member names with - embedded double-colons if they are inside namespaces. To - handle this, we loop a few times, considering larger and - larger prefixes of the string as though they were single - symbols. So, if the initially supplied string is - A::B::C::D::foo, we have to look up "A", then "A::B", - then "A::B::C", then "A::B::C::D", and finally - "A::B::C::D::foo" as single, monolithic symbols, because - A, B, C or D may be namespaces. - - Note that namespaces can nest only inside other - namespaces, and not inside classes. So we need only - consider *prefixes* of the string; there is no need to look up - "B::C" separately as a symbol in the previous example. */ + /* Given our example "AAA::inA::fun", we have two cases to consider: - p2 = p; /* Save for restart. */ - while (1) - { - sym_class = lookup_prefix_sym (argptr, p); + 1) AAA::inA is the name of a class. In that case, presumably it + has a method called "fun"; we then look up that method using + find_method. - if (sym_class && - (t = check_typedef (SYMBOL_TYPE (sym_class)), - (TYPE_CODE (t) == TYPE_CODE_STRUCT - || TYPE_CODE (t) == TYPE_CODE_UNION))) - { - /* Arg token is not digits => try it as a function name. - Find the next token (everything up to end or next - blank). */ - if (**argptr - && strchr (get_gdb_completer_quote_characters (), - **argptr) != NULL) - { - p = skip_quoted (*argptr); - *argptr = *argptr + 1; - } - else - { - p = *argptr; - while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':') - p++; - } -/* - q = operator_chars (*argptr, &q1); - if (q1 - q) - { - char *opname; - char *tmp = alloca (q1 - q + 1); - memcpy (tmp, q, q1 - q); - tmp[q1 - q] = '\0'; - opname = cplus_mangle_opname (tmp, DMGL_ANSI); - if (opname == NULL) - { - cplusplus_error (saved_arg, "no mangling for \"%s\"\n", tmp); - } - copy = (char*) alloca (3 + strlen(opname)); - sprintf (copy, "__%s", opname); - p = q1; - } - else - */ - { - copy = (char *) alloca (p - *argptr + 1); - memcpy (copy, *argptr, p - *argptr); - copy[p - *argptr] = '\0'; - if (p != *argptr - && copy[p - *argptr - 1] - && strchr (get_gdb_completer_quote_characters (), - copy[p - *argptr - 1]) != NULL) - copy[p - *argptr - 1] = '\0'; - } + 2) AAA::inA isn't the name of a class. In that case, either the + user made a typo or AAA::inA is the name of a namespace. + Either way, we just look up AAA::inA::fun with lookup_symbol. - /* No line number may be specified. */ - while (*p == ' ' || *p == '\t') - p++; - *argptr = p; + Thus, our first task is to find everything before the last set of + double-colons and figure out if it's the name of a class. So we + first loop through all of the double-colons. */ - return find_method (funfirstline, canonical, saved_arg, - copy, t, sym_class); - } + p2 = p; /* Save for restart. */ + + /* This is very messy. Following the example above we have now the + following pointers: + p -> "::inA::fun" + argptr -> "AAA::inA::fun + saved_arg -> "AAA::inA::fun + saved_arg2 -> "AAA::inA::fun + p2 -> "::inA::fun". */ + + /* In the loop below, with these strings, we'll make 2 passes, each + is marked in comments.*/ + while (1) + { /* Move pointer up to next possible class/namespace token. */ + p = p2 + 1; /* Restart with old value +1. */ + + /* PASS1: at this point p2->"::inA::fun", so p->":inA::fun", + i.e. if there is a double-colon, p will now point to the + second colon. */ + /* PASS2: p2->"::fun", p->":fun" */ + /* Move pointer ahead to next double-colon. */ while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')) { @@ -1266,22 +1228,113 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, error ("malformed template specification in command"); p = temp_end; } + /* Note that, since, at the start of this loop, p would be + pointing to the second colon in a double-colon, we only + satisfy the condition below if there is another + double-colon to the right (after). I.e. there is another + component that can be a class or a namespace. I.e, if at + the beginning of this loop (PASS1), we had + p->":inA::fun", we'll trigger this when p has been + advanced to point to "::fun". */ + /* PASS2: we will not trigger this. */ else if ((p[0] == ':') && (p[1] == ':')) break; /* Found double-colon. */ else + /* PASS2: We'll keep getting here, until p->"", at which point + we exit this loop. */ p++; } if (*p != ':') - break; /* Out of the while (1). */ - - p2 = p; /* Save restart for next time around. */ - *argptr = saved_arg2; /* Restore argptr. */ + break; /* Out of the while (1). This would happen + for instance if we have looked up + unsuccessfully all the components of the + string, and p->""(PASS2) */ + + /* We get here if p points to ' ', '\t', '\'', "::" or ""(i.e + string ended). */ + /* Save restart for next time around. */ + p2 = p; + /* Restore argptr as it was on entry to this function. */ + *argptr = saved_arg2; + /* PASS1: at this point p->"::fun" argptr->"AAA::inA::fun", + p2->"::fun". */ + + /* All ready for next pass through the loop. */ } /* while (1) */ - /* Last chance attempt -- check entire name as a symbol. Use "copy" - in preparation for jumping out of this block, to be consistent - with usage following the jump target. */ + + /* Start of lookup in the symbol tables. */ + + /* Lookup in the symbol table the substring between argptr and + p. Note, this call changes the value of argptr. */ + /* Before the call, argptr->"AAA::inA::fun", + p->"", p2->"::fun". After the call: argptr->"fun", p, p2 + unchanged. */ + sym_class = lookup_prefix_sym (argptr, p2); + + /* If sym_class has been found, and if "AAA::inA" is a class, then + we're in case 1 above. So we look up "fun" as a method of that + class. */ + if (sym_class && + (t = check_typedef (SYMBOL_TYPE (sym_class)), + (TYPE_CODE (t) == TYPE_CODE_STRUCT + || TYPE_CODE (t) == TYPE_CODE_UNION))) + { + /* Arg token is not digits => try it as a function name. + Find the next token (everything up to end or next + blank). */ + if (**argptr + && strchr (get_gdb_completer_quote_characters (), + **argptr) != NULL) + { + p = skip_quoted (*argptr); + *argptr = *argptr + 1; + } + else + { + /* At this point argptr->"fun". */ + p = *argptr; + while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':') + p++; + /* At this point p->"". String ended. */ + } + + /* Allocate our own copy of the substring between argptr and + p. */ + copy = (char *) alloca (p - *argptr + 1); + memcpy (copy, *argptr, p - *argptr); + copy[p - *argptr] = '\0'; + if (p != *argptr + && copy[p - *argptr - 1] + && strchr (get_gdb_completer_quote_characters (), + copy[p - *argptr - 1]) != NULL) + copy[p - *argptr - 1] = '\0'; + + /* At this point copy->"fun", p->"" */ + + /* No line number may be specified. */ + while (*p == ' ' || *p == '\t') + p++; + *argptr = p; + /* At this point arptr->"". */ + + /* Look for copy as a method of sym_class. */ + /* At this point copy->"fun", sym_class is "AAA:inA", + saved_arg->"AAA::inA::fun". This concludes the scanning of + the string for possible components matches. If we find it + here, we return. If not, and we are at the and of the string, + we'll lookup the whole string in the symbol tables. */ + + return find_method (funfirstline, canonical, saved_arg, + copy, t, sym_class); + + } /* End if symbol found */ + + + /* We couldn't find a class, so we're in case 2 above. We check the + entire name as a symbol instead. */ + copy = (char *) alloca (p - saved_arg2 + 1); memcpy (copy, saved_arg2, p - saved_arg2); /* Note: if is_quoted should be true, we snuff out quote here @@ -1289,6 +1342,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, copy[p - saved_arg2] = '\000'; /* Set argptr to skip over the name. */ *argptr = (*p == '\'') ? p + 1 : p; + /* Look up entire name */ sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0, &sym_symtab); if (sym) @@ -1307,7 +1361,9 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, /* Return the symbol corresponding to the substring of *ARGPTR ending at P, allowing whitespace. Also, advance *ARGPTR past the symbol name in question, the compound object separator ("::" or "."), and - whitespace. */ + whitespace. Note that *ARGPTR is changed whether or not the + lookup_symbol call finds anything (i.e we return NULL). As an + example, say ARGPTR is "AAA::inA::fun" and P is "::inA::fun". */ static struct symbol * lookup_prefix_sym (char **argptr, char *p) @@ -1323,12 +1379,15 @@ lookup_prefix_sym (char **argptr, char *p) memcpy (copy, *argptr, p - *argptr); copy[p - *argptr] = 0; - /* Discard the class name from the arg. */ + /* Discard the class name from the argptr. */ p = p1 + (p1[0] == ':' ? 2 : 1); while (*p == ' ' || *p == '\t') p++; *argptr = p; + /* At this point p1->"::inA::fun", p->"inA::fun" copy->"AAA", + argptr->"inA::fun" */ + return lookup_symbol (copy, 0, STRUCT_DOMAIN, 0, (struct symtab **) NULL); } diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index 22dc93d..0a77459 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -208,7 +208,7 @@ struct linux_corefile_thread_data }; /* Function: linux_corefile_thread_callback - * + * * Called by gdbthread.c once per thread. * Records the thread's register state for the corefile note section. */ @@ -221,7 +221,7 @@ linux_corefile_thread_callback (struct lwp_info *ti, void *data) inferior_ptid = ti->ptid; registers_changed (); - target_fetch_registers (-1); /* FIXME should not be necessary; + target_fetch_registers (-1); /* FIXME should not be necessary; fill_gregset should do it automatically. */ args->note_data = linux_do_thread_registers (args->obfd, ti->ptid, @@ -230,13 +230,13 @@ linux_corefile_thread_callback (struct lwp_info *ti, void *data) args->num_notes++; inferior_ptid = saved_ptid; registers_changed (); - target_fetch_registers (-1); /* FIXME should not be necessary; + target_fetch_registers (-1); /* FIXME should not be necessary; fill_gregset should do it automatically. */ return 0; } /* Function: linux_do_registers - * + * * Records the register state for the corefile note section. */ @@ -245,7 +245,7 @@ linux_do_registers (bfd *obfd, ptid_t ptid, char *note_data, int *note_size) { registers_changed (); - target_fetch_registers (-1); /* FIXME should not be necessary; + target_fetch_registers (-1); /* FIXME should not be necessary; fill_gregset should do it automatically. */ return linux_do_thread_registers (obfd, ptid_build (ptid_get_pid (inferior_ptid), @@ -258,8 +258,8 @@ linux_do_registers (bfd *obfd, ptid_t ptid, /* Function: linux_make_note_section * * Fills the "to_make_corefile_note" target vector. - * Builds the note section for a corefile, and returns it - * in a malloc buffer. + * Builds the note section for a corefile, and returns it + * in a malloc buffer. */ static char * @@ -271,6 +271,8 @@ linux_make_note_section (bfd *obfd, int *note_size) char psargs[80] = { '\0' }; char *note_data = NULL; ptid_t current_ptid = inferior_ptid; + char *auxv; + int auxv_len; if (get_exec_file (0)) { @@ -305,6 +307,14 @@ linux_make_note_section (bfd *obfd, int *note_size) note_data = thread_args.note_data; } + auxv_len = target_auxv_read (¤t_target, &auxv); + if (auxv_len > 0) + { + note_data = elfcore_write_note (obfd, note_data, note_size, + "CORE", NT_AUXV, auxv, auxv_len); + xfree (auxv); + } + make_cleanup (xfree, note_data); return note_data; } @@ -564,7 +574,7 @@ linux_info_proc_cmd (char *args, int from_tty) printf_filtered ("End of text: 0x%x\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) printf_filtered ("Start of stack: 0x%x\n", itmp); -#if 0 /* Don't know how architecture-dependent the rest is... +#if 0 /* Don't know how architecture-dependent the rest is... Anyway the signal bitmap info is available from "status". */ if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */ printf_filtered ("Kernel stack pointer: 0x%x\n", itmp); diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 7fe2e34e..e5b6b50 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -1,5 +1,5 @@ /* Modula 2 language support routines for GDB, the GNU debugger. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -428,6 +428,7 @@ const struct language_defn m2_language_defn = NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"%loB", "", "o", "B"}, /* Octal format info */ diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index 970a8e6..ef8c271 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -398,63 +398,6 @@ mon2000_open (char *args, int from_tty) monitor_open (args, &mon2000_cmds, from_tty); } -/* Function: set_board_address - Tell the BootOne monitor what it's ethernet IP address is. */ - -static void -m32r_set_board_address (char *args, int from_tty) -{ - int resp_len; - char buf[1024]; - - if (args && *args) - { - monitor_printf ("ulip %s\n", args); - resp_len = monitor_expect_prompt (buf, sizeof (buf)); - /* now parse the result for success */ - } - else - error ("Requires argument (IP address for M32R-EVA board)"); -} - -/* Function: set_server_address - Tell the BootOne monitor what gdb's ethernet IP address is. */ - -static void -m32r_set_server_address (char *args, int from_tty) -{ - int resp_len; - char buf[1024]; - - if (args && *args) - { - monitor_printf ("uhip %s\n", args); - resp_len = monitor_expect_prompt (buf, sizeof (buf)); - /* now parse the result for success */ - } - else - error ("Requires argument (IP address of GDB's host computer)"); -} - -/* Function: set_download_path - Tell the BootOne monitor the default path for downloadable SREC files. */ - -static void -m32r_set_download_path (char *args, int from_tty) -{ - int resp_len; - char buf[1024]; - - if (args && *args) - { - monitor_printf ("up %s\n", args); - resp_len = monitor_expect_prompt (buf, sizeof (buf)); - /* now parse the result for success */ - } - else - error ("Requires argument (default path for downloadable SREC files)"); -} - static void m32r_upload_command (char *args, int from_tty) { diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 16ec1ff..700bfb2 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -75,9 +75,9 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) return sp & ~3; } -/* 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). +/* Should we use DEPRECATED_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 m32r returns anything less than 8 bytes in size in registers. */ @@ -939,8 +939,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, m32r_extract_return_value); set_gdbarch_push_dummy_call (gdbarch, m32r_push_dummy_call); set_gdbarch_store_return_value (gdbarch, m32r_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m32r_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m32r_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m32r_use_struct_convention); set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue); @@ -951,7 +950,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_memory_remove_breakpoint (gdbarch, m32r_memory_remove_breakpoint); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 6aa2911..278adf7 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1536,7 +1536,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info, /* Set register info. */ set_gdbarch_fp0_regnum (gdbarch, -1); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); @@ -1552,8 +1551,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack); set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value); - set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention); set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7938426..f6284ee 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -1037,26 +1037,6 @@ m68k_get_longjmp_target (CORE_ADDR *pc) return 1; } -#ifdef SYSCALL_TRAP -/* Immediately after a function call, return the saved pc before the frame - is setup. For sun3's, we check for the common case of being inside of a - system call, and if so, we know that Sun pushes the call # on the stack - prior to doing the trap. */ - -static CORE_ADDR -m68k_saved_pc_after_call (struct frame_info *frame) -{ - int op; - - op = read_memory_unsigned_integer (frame->pc - SYSCALL_TRAP_OFFSET, 2); - - if (op == SYSCALL_TRAP) - return read_memory_unsigned_integer (read_register (SP_REGNUM) + 4, 4); - else - return read_memory_unsigned_integer (read_register (SP_REGNUM), 4); -} -#endif /* SYSCALL_TRAP */ - /* Function: m68k_gdbarch_init Initializer function for the m68k gdbarch vector. Called by gdbarch. Sets up the gdbarch vector(s) for this target. */ @@ -1079,9 +1059,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_bit (gdbarch, 96); set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue); -#ifdef SYSCALL_TRAP - set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68k_saved_pc_after_call); -#endif set_gdbarch_breakpoint_from_pc (gdbarch, m68k_local_breakpoint_from_pc); /* Stack grows down. */ @@ -1093,8 +1070,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, m68k_extract_return_value); set_gdbarch_store_return_value (gdbarch, m68k_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m68k_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68k_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m68k_use_struct_convention); set_gdbarch_frameless_function_invocation (gdbarch, diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c index b39eebe..ed7e3ec 100644 --- a/gdb/m68klinux-tdep.c +++ b/gdb/m68klinux-tdep.c @@ -294,8 +294,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_extract_return_value (gdbarch, m68k_linux_extract_return_value); set_gdbarch_store_return_value (gdbarch, m68k_linux_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m68k_linux_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68k_linux_extract_struct_value_address); set_gdbarch_pc_in_sigtramp (gdbarch, m68k_linux_pc_in_sigtramp); @@ -1,7 +1,7 @@ /* Top level stuff for GDB, the GNU debugger. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, - 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -72,10 +72,10 @@ char *gdb_sysroot = 0; struct ui_file *gdb_stdout; struct ui_file *gdb_stderr; struct ui_file *gdb_stdlog; -struct ui_file *gdb_stdtarg; struct ui_file *gdb_stdin; /* target IO streams */ struct ui_file *gdb_stdtargin; +struct ui_file *gdb_stdtarg; struct ui_file *gdb_stdtargerr; /* Whether to enable writing into executable and core files */ diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index 5e08e25..f4ec39f 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -1075,7 +1075,6 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) mcore_extract_return_value); set_gdbarch_deprecated_store_struct_return (gdbarch, mcore_store_struct_return); set_gdbarch_skip_prologue (gdbarch, mcore_skip_prologue); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_deprecated_frame_args_address (gdbarch, mcore_frame_args_address); set_gdbarch_deprecated_frame_locals_address (gdbarch, mcore_frame_locals_address); set_gdbarch_deprecated_pop_frame (gdbarch, mcore_pop_frame); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ae1ea7d..a30959f 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -428,7 +428,7 @@ mdebug_build_psymtabs (struct objfile *objfile, char *fdr_end; FDR *fdr_ptr; - info->fdr = (FDR *) obstack_alloc (&objfile->psymbol_obstack, + info->fdr = (FDR *) obstack_alloc (&objfile->objfile_obstack, (info->symbolic_header.ifdMax * sizeof (FDR))); fdr_src = info->external_fdr; @@ -581,7 +581,7 @@ add_pending (FDR *fh, char *sh, struct type *t) if (!p) { p = ((struct mdebug_pending *) - obstack_alloc (¤t_objfile->psymbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct mdebug_pending))); p->s = sh; p->t = t; @@ -1060,7 +1060,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (sh->iss == 0 || name[0] == '.' || name[0] == '\0') TYPE_TAG_NAME (t) = NULL; else - TYPE_TAG_NAME (t) = obconcat (¤t_objfile->symbol_obstack, + TYPE_TAG_NAME (t) = obconcat (¤t_objfile->objfile_obstack, "", "", name); TYPE_CODE (t) = type_code; @@ -1106,12 +1106,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, FIELD_STATIC_KIND (*f) = 0; enum_sym = ((struct symbol *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct symbol))); memset (enum_sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (enum_sym) = obsavestring (f->name, strlen (f->name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); SYMBOL_CLASS (enum_sym) = LOC_CONST; SYMBOL_TYPE (enum_sym) = t; SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN; @@ -1204,7 +1204,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, SYMBOL_CLASS (s) = LOC_CONST; SYMBOL_TYPE (s) = mdebug_type_void; e = ((struct mips_extra_func_info *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct mips_extra_func_info))); memset (e, 0, sizeof (struct mips_extra_func_info)); SYMBOL_VALUE (s) = (long) e; @@ -1637,7 +1637,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, else if (TYPE_TAG_NAME (tp) == NULL || strcmp (TYPE_TAG_NAME (tp), name) != 0) TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); } } @@ -1673,7 +1673,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, if (TYPE_NAME (tp) == NULL || strcmp (TYPE_NAME (tp), name) != 0) TYPE_NAME (tp) = obsavestring (name, strlen (name), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); } } if (t->bt == btTypedef) @@ -1697,11 +1697,11 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, TYPE_FIELDS (tp) = ((struct field *) TYPE_ALLOC (tp, 2 * sizeof (struct field))); TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax); ax++; TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax); ax++; } @@ -2262,7 +2262,7 @@ parse_partial_symbols (struct objfile *objfile) && (bfd_get_section_flags (cur_bfd, text_sect) & SEC_RELOC)) relocatable = 1; - extern_tab = (EXTR *) obstack_alloc (&objfile->psymbol_obstack, + extern_tab = (EXTR *) obstack_alloc (&objfile->objfile_obstack, sizeof (EXTR) * hdr->iextMax); includes_allocated = 30; @@ -2306,7 +2306,7 @@ parse_partial_symbols (struct objfile *objfile) /* Allocate the global pending list. */ pending_list = ((struct mdebug_pending **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, hdr->ifdMax * sizeof (struct mdebug_pending *))); memset (pending_list, 0, hdr->ifdMax * sizeof (struct mdebug_pending *)); @@ -2558,7 +2558,7 @@ parse_partial_symbols (struct objfile *objfile) objfile->global_psymbols.next, objfile->static_psymbols.next); pst->read_symtab_private = ((char *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc))); memset (pst->read_symtab_private, 0, sizeof (struct symloc)); @@ -3661,7 +3661,7 @@ parse_partial_symbols (struct objfile *objfile) pst->number_of_dependencies = 0; pst->dependencies = ((struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, ((fh->crfd - 1) * sizeof (struct partial_symtab *)))); for (s_idx = 1; s_idx < fh->crfd; s_idx++) @@ -3948,7 +3948,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) procedure specific info */ struct mips_extra_func_info *e = ((struct mips_extra_func_info *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct mips_extra_func_info))); struct symbol *s = new_symbol (MIPS_EFI_SYMBOL_NAME); @@ -4592,7 +4592,7 @@ new_symtab (char *name, int maxlines, struct objfile *objfile) s->free_code = free_linetable; s->debugformat = obsavestring ("ECOFF", 5, - &objfile->symbol_obstack); + &objfile->objfile_obstack); return (s); } @@ -4609,7 +4609,7 @@ new_psymtab (char *name, struct objfile *objfile) /* Keep a backpointer to the file's symbols */ psymtab->read_symtab_private = ((char *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc))); memset (psymtab->read_symtab_private, 0, sizeof (struct symloc)); CUR_BFD (psymtab) = cur_bfd; @@ -4697,7 +4697,7 @@ static struct symbol * new_symbol (char *name) { struct symbol *s = ((struct symbol *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct symbol))); memset (s, 0, sizeof (*s)); @@ -4740,7 +4740,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile, back_to = make_cleanup_discard_minimal_symbols (); info = ((struct ecoff_debug_info *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct ecoff_debug_info))); if (!(*swap->read_debug_info) (abfd, sec, info)) diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 9a2a9ec..7db9ffb 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -1,5 +1,5 @@ /* MI Command Set - stack commands. - Copyright 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 3641187..709ed301 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -1,6 +1,6 @@ /* MI Command Set - varobj commands. - Copyright 2000, 2002 Free Software Foundation, Inc. + Copyright 2000, 2002, 2004 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index c619424..5453059 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -1,6 +1,6 @@ /* MI Command Set for GDB, the GNU debugger. - Copyright 2000, 2003 Free Software Foundation, Inc. + Copyright 2000, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). diff --git a/gdb/minsyms.c b/gdb/minsyms.c index df35956..83aef9d 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1,6 +1,6 @@ /* GDB routines for manipulating the minimal symbol tables. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003 + 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. @@ -355,7 +355,7 @@ lookup_minimal_symbol_solib_trampoline (const char *name, /* Search through the minimal symbol table for each objfile and find the symbol whose address is the largest address that is still less - than or equal to PC, and matches SECTION (if non-null). Returns a + than or equal to PC, and matches SECTION (if non-NULL). Returns a pointer to the minimal symbol if such a symbol is found, or NULL if PC is not in a suitable range. Note that we need to look through ALL the minimal symbol tables before deciding on the symbol that @@ -374,20 +374,23 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, asection *section) struct minimal_symbol *best_symbol = NULL; struct obj_section *pc_section; - /* pc has to be in a known section. This ensures that anything beyond - the end of the last segment doesn't appear to be part of the last - function in the last segment. */ + /* PC has to be in a known section. This ensures that anything + beyond the end of the last segment doesn't appear to be part of + the last function in the last segment. */ pc_section = find_pc_section (pc); if (pc_section == NULL) return NULL; - /* If no section was specified, then just make sure that the PC is in - the same section as the minimal symbol we find. */ - if (section == NULL) - section = pc_section->the_bfd_section; - - /* FIXME drow/2003-07-19: Should we also check that PC is in SECTION - if we were passed a non-NULL SECTION argument? */ + /* NOTE: cagney/2004-01-27: Removed code (added 2003-07-19) that was + trying to force the PC into a valid section as returned by + find_pc_section. It broke IRIX 6.5 mdebug which relies on this + code returning an absolute symbol - the problem was that + find_pc_section wasn't returning an absolute section and hence + the code below would skip over absolute symbols. Since the + original problem was with finding a frame's function, and that + uses [indirectly] lookup_minimal_symbol_by_pc, the original + problem has been fixed by having that function use + find_pc_section. */ for (objfile = object_files; objfile != NULL; @@ -497,7 +500,13 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, asection *section) struct minimal_symbol * lookup_minimal_symbol_by_pc (CORE_ADDR pc) { - return lookup_minimal_symbol_by_pc_section (pc, find_pc_mapped_section (pc)); + /* NOTE: cagney/2004-01-27: This was using find_pc_mapped_section to + force the section but that (well unless you're doing overlay + debugging) always returns NULL making the call somewhat useless. */ + struct obj_section *section = find_pc_section (pc); + if (section == NULL) + return NULL; + return lookup_minimal_symbol_by_pc_section (pc, section->the_bfd_section); } @@ -714,7 +723,7 @@ make_cleanup_discard_minimal_symbols (void) Note that we are not concerned here about recovering the space that is potentially freed up, because the strings themselves are allocated - on the symbol_obstack, and will get automatically freed when the symbol + on the objfile_obstack, and will get automatically freed when the symbol table is freed. The caller can free up the unused minimal symbols at the end of the compacted region if their allocation strategy allows it. @@ -832,10 +841,10 @@ install_minimal_symbols (struct objfile *objfile) we will give back the excess space. */ alloc_count = msym_count + objfile->minimal_symbol_count + 1; - obstack_blank (&objfile->symbol_obstack, + obstack_blank (&objfile->objfile_obstack, alloc_count * sizeof (struct minimal_symbol)); msymbols = (struct minimal_symbol *) - obstack_base (&objfile->symbol_obstack); + obstack_base (&objfile->objfile_obstack); /* Copy in the existing minimal symbols, if there are any. */ @@ -875,10 +884,10 @@ install_minimal_symbols (struct objfile *objfile) mcount = compact_minimal_symbols (msymbols, mcount, objfile); - obstack_blank (&objfile->symbol_obstack, + obstack_blank (&objfile->objfile_obstack, (mcount + 1 - alloc_count) * sizeof (struct minimal_symbol)); msymbols = (struct minimal_symbol *) - obstack_finish (&objfile->symbol_obstack); + obstack_finish (&objfile->objfile_obstack); /* We also terminate the minimal symbol table with a "null symbol", which is *not* included in the size of the table. This makes it @@ -896,7 +905,7 @@ install_minimal_symbols (struct objfile *objfile) SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown); /* Attach the minimal symbol table to the specified objfile. - The strings themselves are also located in the symbol_obstack + The strings themselves are also located in the objfile_obstack of this objfile. */ objfile->minimal_symbol_count = mcount; diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 197f7e9..f5071ad 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "mips-tdep.h" /* Pseudo registers can not be read. ptrace does not provide a way to read (or set) PS_REGNUM, and there's no point in reading or setting diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index a7ee145..fb7601b 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -27,6 +27,7 @@ #include "mips-tdep.h" #include "gdb_string.h" #include "gdb_assert.h" +#include "frame.h" /* Copied from <asm/elf.h>. */ #define ELF_NGREG 45 @@ -676,6 +677,125 @@ init_register_addr_data (struct gdbarch *gdbarch) return 0; } +/* Check the code at PC for a dynamic linker lazy resolution stub. Because + they aren't in the .plt section, we pattern-match on the code generated + by GNU ld. They look like this: + + lw t9,0x8010(gp) + addu t7,ra + jalr t9,ra + addiu t8,zero,INDEX + + (with the appropriate doubleword instructions for N64). Also return the + dynamic symbol index used in the last instruction. */ + +static int +mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name) +{ + unsigned char buf[28], *p; + ULONGEST insn, insn1; + int n64 = (mips_abi (current_gdbarch) == MIPS_ABI_N64); + + read_memory (pc - 12, buf, 28); + + if (n64) + { + /* ld t9,0x8010(gp) */ + insn1 = 0xdf998010; + } + else + { + /* lw t9,0x8010(gp) */ + insn1 = 0x8f998010; + } + + p = buf + 12; + while (p >= buf) + { + insn = extract_unsigned_integer (p, 4); + if (insn == insn1) + break; + p -= 4; + } + if (p < buf) + return 0; + + insn = extract_unsigned_integer (p + 4, 4); + if (n64) + { + /* daddu t7,ra */ + if (insn != 0x03e0782d) + return 0; + } + else + { + /* addu t7,ra */ + if (insn != 0x03e07821) + return 0; + } + + insn = extract_unsigned_integer (p + 8, 4); + /* jalr t9,ra */ + if (insn != 0x0320f809) + return 0; + + insn = extract_unsigned_integer (p + 12, 4); + if (n64) + { + /* daddiu t8,zero,0 */ + if ((insn & 0xffff0000) != 0x64180000) + return 0; + } + else + { + /* addiu t8,zero,0 */ + if ((insn & 0xffff0000) != 0x24180000) + return 0; + } + + return (insn & 0xffff); +} + +/* Return non-zero iff PC belongs to the dynamic linker resolution code + or to a stub. */ + +int +mips_linux_in_dynsym_resolve_code (CORE_ADDR pc) +{ + /* Check whether PC is in the dynamic linker. This also checks whether + it is in the .plt section, which MIPS does not use. */ + if (in_solib_dynsym_resolve_code (pc)) + return 1; + + /* Pattern match for the stub. It would be nice if there were a more + efficient way to avoid this check. */ + if (mips_linux_in_dynsym_stub (pc, NULL)) + return 1; + + return 0; +} + +/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c, + and glibc_skip_solib_resolver in glibc-tdep.c. The normal glibc + implementation of this triggers at "fixup" from the same objfile as + "_dl_runtime_resolve"; MIPS/Linux can trigger at "__dl_runtime_resolve" + directly. An unresolved PLT entry will point to _dl_runtime_resolve, + which will first call __dl_runtime_resolve, and then pass control to + the resolved function. */ + +static CORE_ADDR +mips_linux_skip_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + struct minimal_symbol *resolver; + + resolver = lookup_minimal_symbol ("__dl_runtime_resolve", NULL, NULL); + + if (resolver && SYMBOL_VALUE_ADDRESS (resolver) == pc) + return frame_pc_unwind (get_current_frame ()); + + return 0; +} + static void mips_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { @@ -709,6 +829,12 @@ mips_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) internal_error (__FILE__, __LINE__, "can't handle ABI"); break; } + + set_gdbarch_skip_solib_resolver (gdbarch, mips_linux_skip_resolver); + + /* This overrides the MIPS16 stub support from mips-tdep. But no one uses + MIPS16 on Linux yet, so this isn't much of a loss. */ + set_gdbarch_in_solib_call_trampoline (gdbarch, mips_linux_in_dynsym_stub); } void diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 41bfc7c..fb80964 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -50,6 +50,9 @@ #include "symcat.h" #include "sim-regno.h" #include "dis-asm.h" +#include "frame-unwind.h" +#include "frame-base.h" +#include "trad-frame.h" static void set_reg_offset (CORE_ADDR *saved_regs, int regnum, CORE_ADDR off); static struct type *mips_register_type (struct gdbarch *gdbarch, int regnum); @@ -286,7 +289,6 @@ mips_xfer_register (struct regcache *regcache, int reg_num, int length, enum bfd_endian endian, bfd_byte * in, const bfd_byte * out, int buf_offset) { - bfd_byte reg[MAX_REGISTER_SIZE]; int reg_offset = 0; gdb_assert (reg_num >= NUM_REGS); /* Need to transfer the left or right part of the register, based on @@ -810,6 +812,25 @@ mips_read_pc (ptid_t ptid) return read_signed_register_pid (mips_regnum (current_gdbarch)->pc, ptid); } +static CORE_ADDR +mips_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + return frame_unwind_register_signed (next_frame, + NUM_REGS + mips_regnum (gdbarch)->pc); +} + +/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that + dummy frame. The frame ID's base needs to match the TOS value + saved by save_dummy_frame_tos(), and the PC match the dummy frame's + breakpoint. */ + +static struct frame_id +mips_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + return frame_id_build (frame_unwind_register_signed (next_frame, NUM_REGS + SP_REGNUM), + frame_pc_unwind (next_frame)); +} + static void mips_write_pc (CORE_ADDR pc, ptid_t ptid) { @@ -936,6 +957,34 @@ mips_fetch_instruction (CORE_ADDR addr) return extract_unsigned_integer (buf, instlen); } +static ULONGEST +mips16_fetch_instruction (CORE_ADDR addr) +{ + char buf[MIPS_INSTLEN]; + int instlen; + int status; + + instlen = MIPS16_INSTLEN; + addr = unmake_mips16_addr (addr); + status = read_memory_nobpt (addr, buf, instlen); + if (status) + memory_error (status, addr); + return extract_unsigned_integer (buf, instlen); +} + +static ULONGEST +mips32_fetch_instruction (CORE_ADDR addr) +{ + char buf[MIPS_INSTLEN]; + int instlen; + int status; + instlen = MIPS_INSTLEN; + status = read_memory_nobpt (addr, buf, instlen); + if (status) + memory_error (status, addr); + return extract_unsigned_integer (buf, instlen); +} + /* These the fields of 32 bit mips instructions */ #define mips32_op(x) (x >> 26) @@ -1426,98 +1475,57 @@ mips_next_pc (CORE_ADDR pc) return mips32_next_pc (pc); } -/* Set up the 'saved_regs' array. This is a data structure containing - the addresses on the stack where each register has been saved, for - each stack frame. Registers that have not been saved will have - zero here. The stack pointer register is special: rather than the - address where the stack register has been saved, - saved_regs[SP_REGNUM] will have the actual value of the previous - frame's stack register. */ +struct mips_frame_cache +{ + CORE_ADDR base; + struct trad_frame_saved_reg *saved_regs; +}; -static void -mips_find_saved_regs (struct frame_info *fci) + +static struct mips_frame_cache * +mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache) { - int ireg; + mips_extra_func_info_t proc_desc; + struct mips_frame_cache *cache; + struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* r0 bit means kernel trap */ int kernel_trap; /* What registers have been saved? Bitmasks. */ unsigned long gen_mask, float_mask; - mips_extra_func_info_t proc_desc; - t_inst inst; - CORE_ADDR *saved_regs; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - if (deprecated_get_frame_saved_regs (fci) != NULL) - return; - saved_regs = frame_saved_regs_zalloc (fci); - - /* If it is the frame for sigtramp, the saved registers are located - in a sigcontext structure somewhere on the stack. If the stack - layout for sigtramp changes we might have to change these - constants and the companion fixup_sigtramp in mdebugread.c */ -#ifndef SIGFRAME_BASE - /* To satisfy alignment restrictions, sigcontext is located 4 bytes - above the sigtramp frame. */ -#define SIGFRAME_BASE mips_regsize (current_gdbarch) -/* FIXME! Are these correct?? */ -#define SIGFRAME_PC_OFF (SIGFRAME_BASE + 2 * mips_regsize (current_gdbarch)) -#define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 3 * mips_regsize (current_gdbarch)) -#define SIGFRAME_FPREGSAVE_OFF \ - (SIGFRAME_REGSAVE_OFF + MIPS_NUMREGS * mips_regsize (current_gdbarch) + 3 * mips_regsize (current_gdbarch)) -#endif - if ((get_frame_type (fci) == SIGTRAMP_FRAME)) - { - for (ireg = 0; ireg < MIPS_NUMREGS; ireg++) - { - CORE_ADDR reg_position = - (get_frame_base (fci) + SIGFRAME_REGSAVE_OFF + - ireg * mips_regsize (current_gdbarch)); - set_reg_offset (saved_regs, ireg, reg_position); - } - for (ireg = 0; ireg < MIPS_NUMREGS; ireg++) - { - CORE_ADDR reg_position = (get_frame_base (fci) - + SIGFRAME_FPREGSAVE_OFF - + ireg * mips_regsize (current_gdbarch)); - set_reg_offset (saved_regs, - mips_regnum (current_gdbarch)->fp0 + ireg, - reg_position); - } - set_reg_offset (saved_regs, mips_regnum (current_gdbarch)->pc, - get_frame_base (fci) + SIGFRAME_PC_OFF); - /* SP_REGNUM, contains the value and not the address. */ - set_reg_offset (saved_regs, SP_REGNUM, get_frame_base (fci)); - return; - } + if ((*this_cache) != NULL) + return (*this_cache); + cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache); + (*this_cache) = cache; + cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); - proc_desc = get_frame_extra_info (fci)->proc_desc; + /* Get the mdebug proc descriptor. */ + proc_desc = find_proc_desc (frame_pc_unwind (next_frame), next_frame, 1); if (proc_desc == NULL) /* I'm not sure how/whether this can happen. Normally when we can't find a proc_desc, we "synthesize" one using heuristic_proc_desc and set the saved_regs right away. */ - return; + return cache; + + /* Extract the frame's base. */ + cache->base = (frame_unwind_register_signed (next_frame, NUM_REGS + PROC_FRAME_REG (proc_desc)) + + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc)); kernel_trap = PROC_REG_MASK (proc_desc) & 1; gen_mask = kernel_trap ? 0xFFFFFFFF : PROC_REG_MASK (proc_desc); float_mask = kernel_trap ? 0xFFFFFFFF : PROC_FREG_MASK (proc_desc); - - if ( /* In any frame other than the innermost or a frame interrupted - by a signal, we assume that all registers have been saved. - This assumes that all register saves in a function happen - before the first function call. */ - (get_next_frame (fci) == NULL - || (get_frame_type (get_next_frame (fci)) == SIGTRAMP_FRAME)) - /* In a dummy frame we know exactly where things are saved. */ - && !PROC_DESC_IS_DUMMY (proc_desc) - /* Don't bother unless we are inside a function prologue. - Outside the prologue, we know where everything is. */ - && in_prologue (get_frame_pc (fci), PROC_LOW_ADDR (proc_desc)) - /* Not sure exactly what kernel_trap means, but if it means the - kernel saves the registers without a prologue doing it, we - better not examine the prologue to see whether registers - have been saved yet. */ - && !kernel_trap) + + /* In any frame other than the innermost or a frame interrupted by a + signal, we assume that all registers have been saved. This + assumes that all register saves in a function happen before the + first function call. */ + if (in_prologue (frame_pc_unwind (next_frame), PROC_LOW_ADDR (proc_desc)) + /* Not sure exactly what kernel_trap means, but if it means the + kernel saves the registers without a prologue doing it, we + better not examine the prologue to see whether registers + have been saved yet. */ + && !kernel_trap) { /* We need to figure out whether the registers that the proc_desc claims are saved have been saved yet. */ @@ -1527,22 +1535,28 @@ mips_find_saved_regs (struct frame_info *fci) /* Bitmasks; set if we have found a save for the register. */ unsigned long gen_save_found = 0; unsigned long float_save_found = 0; - int instlen; + int mips16; /* If the address is odd, assume this is MIPS16 code. */ addr = PROC_LOW_ADDR (proc_desc); - instlen = pc_is_mips16 (addr) ? MIPS16_INSTLEN : MIPS_INSTLEN; + mips16 = pc_is_mips16 (addr); /* Scan through this function's instructions preceding the current PC, and look for those that save registers. */ - while (addr < get_frame_pc (fci)) + while (addr < frame_pc_unwind (next_frame)) { - inst = mips_fetch_instruction (addr); - if (pc_is_mips16 (addr)) - mips16_decode_reg_save (inst, &gen_save_found); + if (mips16) + { + mips16_decode_reg_save (mips16_fetch_instruction (addr), + &gen_save_found); + addr += MIPS16_INSTLEN; + } else - mips32_decode_reg_save (inst, &gen_save_found, &float_save_found); - addr += instlen; + { + mips32_decode_reg_save (mips32_fetch_instruction (addr), + &gen_save_found, &float_save_found); + addr += MIPS_INSTLEN; + } } gen_mask = gen_save_found; float_mask = float_save_found; @@ -1551,12 +1565,13 @@ mips_find_saved_regs (struct frame_info *fci) /* Fill in the offsets for the registers which gen_mask says were saved. */ { - CORE_ADDR reg_position = (get_frame_base (fci) + CORE_ADDR reg_position = (cache->base + PROC_REG_OFFSET (proc_desc)); + int ireg; for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1) if (gen_mask & 0x80000000) { - set_reg_offset (saved_regs, ireg, reg_position); + cache->saved_regs[NUM_REGS + ireg].addr = reg_position; reg_position -= mips_saved_regsize (tdep); } } @@ -1567,7 +1582,7 @@ mips_find_saved_regs (struct frame_info *fci) instruction that saves $s0 or $s1, correct their saved addresses. */ if (pc_is_mips16 (PROC_LOW_ADDR (proc_desc))) { - inst = mips_fetch_instruction (PROC_LOW_ADDR (proc_desc)); + ULONGEST inst = mips16_fetch_instruction (PROC_LOW_ADDR (proc_desc)); if ((inst & 0xf81f) == 0xe809 && (inst & 0x700) != 0x700) /* entry */ { @@ -1575,16 +1590,18 @@ mips_find_saved_regs (struct frame_info *fci) int sreg_count = (inst >> 6) & 3; /* Check if the ra register was pushed on the stack. */ - CORE_ADDR reg_position = (get_frame_base (fci) + CORE_ADDR reg_position = (cache->base + PROC_REG_OFFSET (proc_desc)); if (inst & 0x20) reg_position -= mips_saved_regsize (tdep); /* Check if the s0 and s1 registers were pushed on the stack. */ + /* NOTE: cagney/2004-02-08: Huh? This is doing no such + check. */ for (reg = 16; reg < sreg_count + 16; reg++) { - set_reg_offset (saved_regs, reg, reg_position); + cache->saved_regs[NUM_REGS + reg].addr = reg_position; reg_position -= mips_saved_regsize (tdep); } } @@ -1593,9 +1610,9 @@ mips_find_saved_regs (struct frame_info *fci) /* Fill in the offsets for the registers which float_mask says were saved. */ { - CORE_ADDR reg_position = (get_frame_base (fci) + CORE_ADDR reg_position = (cache->base + PROC_FREG_OFFSET (proc_desc)); - + int ireg; /* Fill in the offsets for the float registers which float_mask says were saved. */ for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1) @@ -1627,27 +1644,83 @@ mips_find_saved_regs (struct frame_info *fci) reg_position is decremented each time through the loop). */ if ((ireg & 1)) - set_reg_offset (saved_regs, - mips_regnum (current_gdbarch)->fp0 + ireg, - reg_position - mips_saved_regsize (tdep)); + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg] + .addr = reg_position - mips_saved_regsize (tdep); else - set_reg_offset (saved_regs, - mips_regnum (current_gdbarch)->fp0 + ireg, - reg_position + mips_saved_regsize (tdep)); + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg] + .addr = reg_position + mips_saved_regsize (tdep); } else - set_reg_offset (saved_regs, - mips_regnum (current_gdbarch)->fp0 + ireg, - reg_position); + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg] + .addr = reg_position; reg_position -= mips_saved_regsize (tdep); } - set_reg_offset (saved_regs, mips_regnum (current_gdbarch)->pc, - saved_regs[RA_REGNUM]); + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc] + = cache->saved_regs[NUM_REGS + RA_REGNUM]; } /* SP_REGNUM, contains the value and not the address. */ - set_reg_offset (saved_regs, SP_REGNUM, get_frame_base (fci)); + trad_frame_set_value (cache->saved_regs, NUM_REGS + SP_REGNUM, cache->base); + + return (*this_cache); +} + +static void +mips_mdebug_frame_this_id (struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) +{ + struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame, + this_cache); + (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame)); +} + +static void +mips_mdebug_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame, + this_cache); + trad_frame_prev_register (next_frame, info->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + +static const struct frame_unwind mips_mdebug_frame_unwind = +{ + NORMAL_FRAME, + mips_mdebug_frame_this_id, + mips_mdebug_frame_prev_register +}; + +static const struct frame_unwind * +mips_mdebug_frame_sniffer (struct frame_info *next_frame) +{ + return &mips_mdebug_frame_unwind; +} + +static CORE_ADDR +mips_mdebug_frame_base_address (struct frame_info *next_frame, + void **this_cache) +{ + struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame, + this_cache); + return info->base; +} + +static const struct frame_base mips_mdebug_frame_base = { + &mips_mdebug_frame_unwind, + mips_mdebug_frame_base_address, + mips_mdebug_frame_base_address, + mips_mdebug_frame_base_address +}; + +static const struct frame_base * +mips_mdebug_frame_base_sniffer (struct frame_info *next_frame) +{ + return &mips_mdebug_frame_base; } static CORE_ADDR @@ -1726,52 +1799,6 @@ mips_software_single_step (enum target_signal sig, int insert_breakpoints_p) target_remove_breakpoint (next_pc, break_mem); } -static CORE_ADDR -mips_init_frame_pc_first (int fromleaf, struct frame_info *prev) -{ - CORE_ADDR pc, tmp; - - pc = ((fromleaf) - ? DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev)) - : get_next_frame (prev) - ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)) : read_pc ()); - tmp = SKIP_TRAMPOLINE_CODE (pc); - return tmp ? tmp : pc; -} - - -static CORE_ADDR -mips_frame_saved_pc (struct frame_info *frame) -{ - CORE_ADDR saved_pc; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0)) - { - /* Always unwind the cooked PC register value. */ - saved_pc = frame_unwind_register_signed (frame, NUM_REGS + mips_regnum (current_gdbarch)->pc); - } - else - { - mips_extra_func_info_t proc_desc - = get_frame_extra_info (frame)->proc_desc; - if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc)) - saved_pc = read_memory_integer ((get_frame_base (frame) - - mips_saved_regsize (tdep)), - mips_saved_regsize (tdep)); - else - { - /* We have to get the saved pc from the sigcontext if it is - a signal handler frame. */ - int pcreg = (get_frame_type (frame) == SIGTRAMP_FRAME - ? mips_regnum (current_gdbarch)->pc - : proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM); - saved_pc = read_next_frame_reg (frame, NUM_REGS + pcreg); - } - } - return ADDR_BITS_REMOVE (saved_pc); -} - static struct mips_extra_func_info temp_proc_desc; /* This hack will go away once the get_prev_frame() code has been @@ -2286,7 +2313,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr) This means that we should not bother with this method on 64-bit targets (until that is fixed). */ - priv = obstack_alloc (&sec->objfile->psymbol_obstack, + priv = obstack_alloc (&sec->objfile->objfile_obstack, sizeof (struct mips_objfile_private)); priv->size = 0; sec->objfile->obj_private = priv; @@ -2295,14 +2322,14 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr) { asection *bfdsec; - priv = obstack_alloc (&sec->objfile->psymbol_obstack, + priv = obstack_alloc (&sec->objfile->objfile_obstack, sizeof (struct mips_objfile_private)); bfdsec = bfd_get_section_by_name (sec->objfile->obfd, ".pdr"); if (bfdsec != NULL) { priv->size = bfd_section_size (sec->objfile->obfd, bfdsec); - priv->contents = obstack_alloc (&sec->objfile->psymbol_obstack, + priv->contents = obstack_alloc (&sec->objfile->objfile_obstack, priv->size); bfd_get_section_contents (sec->objfile->obfd, bfdsec, priv->contents, 0, priv->size); @@ -2354,7 +2381,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr) /* Fill in what we need of the proc_desc. */ proc_desc = (mips_extra_func_info_t) - obstack_alloc (&sec->objfile->psymbol_obstack, + obstack_alloc (&sec->objfile->objfile_obstack, sizeof (struct mips_extra_func_info)); PROC_LOW_ADDR (proc_desc) = startaddr; @@ -2471,154 +2498,6 @@ find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int cur_frame) return proc_desc; } -static CORE_ADDR -get_frame_pointer (struct frame_info *frame, mips_extra_func_info_t proc_desc) -{ - return (read_next_frame_reg (frame, NUM_REGS + PROC_FRAME_REG (proc_desc)) - + PROC_FRAME_OFFSET (proc_desc) - PROC_FRAME_ADJUST (proc_desc)); -} - -static mips_extra_func_info_t cached_proc_desc; - -static CORE_ADDR -mips_frame_chain (struct frame_info *frame) -{ - mips_extra_func_info_t proc_desc; - CORE_ADDR tmp; - CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame); - - /* Check if the PC is inside a call stub. If it is, fetch the - PC of the caller of that stub. */ - if ((tmp = SKIP_TRAMPOLINE_CODE (saved_pc)) != 0) - saved_pc = tmp; - - if (DEPRECATED_PC_IN_CALL_DUMMY (saved_pc, 0, 0)) - { - /* A dummy frame, uses SP not FP. Get the old SP value. If all - is well, frame->frame the bottom of the current frame will - contain that value. */ - return get_frame_base (frame); - } - - /* Look up the procedure descriptor for this PC. */ - proc_desc = find_proc_desc (saved_pc, frame, 1); - if (!proc_desc) - return 0; - - cached_proc_desc = proc_desc; - - /* If no frame pointer and frame size is zero, we must be at end - of stack (or otherwise hosed). If we don't check frame size, - we loop forever if we see a zero size frame. */ - if (PROC_FRAME_REG (proc_desc) == SP_REGNUM - && PROC_FRAME_OFFSET (proc_desc) == 0 - /* The previous frame from a sigtramp frame might be frameless - and have frame size zero. */ - && !(get_frame_type (frame) == SIGTRAMP_FRAME) - /* For a generic dummy frame, let get_frame_pointer() unwind a - register value saved as part of the dummy frame call. */ - && !(DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0))) - return 0; - else - return get_frame_pointer (frame, proc_desc); -} - -static void -mips_init_extra_frame_info (int fromleaf, struct frame_info *fci) -{ - int regnum; - mips_extra_func_info_t proc_desc; - - if (get_frame_type (fci) == DUMMY_FRAME) - return; - - /* Use proc_desc calculated in frame_chain. When there is no - next frame, i.e, get_next_frame (fci) == NULL, we call - find_proc_desc () to calculate it, passing an explicit - NULL as the frame parameter. */ - proc_desc = - get_next_frame (fci) - ? cached_proc_desc - : find_proc_desc (get_frame_pc (fci), - NULL /* i.e, get_next_frame (fci) */ , - 1); - - frame_extra_info_zalloc (fci, sizeof (struct frame_extra_info)); - - get_frame_extra_info (fci)->proc_desc = - proc_desc == &temp_proc_desc ? 0 : proc_desc; - if (proc_desc) - { - /* Fixup frame-pointer - only needed for top frame */ - /* This may not be quite right, if proc has a real frame register. - Get the value of the frame relative sp, procedure might have been - interrupted by a signal at it's very start. */ - if (get_frame_pc (fci) == PROC_LOW_ADDR (proc_desc) - && !PROC_DESC_IS_DUMMY (proc_desc)) - deprecated_update_frame_base_hack (fci, - read_next_frame_reg (get_next_frame - (fci), - NUM_REGS + - SP_REGNUM)); - else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fci), 0, 0)) - /* Do not ``fix'' fci->frame. It will have the value of the - generic dummy frame's top-of-stack (since the draft - fci->frame is obtained by returning the unwound stack - pointer) and that is what we want. That way the fci->frame - value will match the top-of-stack value that was saved as - part of the dummy frames data. */ - /* Do nothing. */ ; - else - deprecated_update_frame_base_hack (fci, - get_frame_pointer (get_next_frame - (fci), - proc_desc)); - - if (proc_desc == &temp_proc_desc) - { - char *name; - - /* Do not set the saved registers for a sigtramp frame, - mips_find_saved_registers will do that for us. We can't - use (get_frame_type (fci) == SIGTRAMP_FRAME), it is not - yet set. */ - /* FIXME: cagney/2002-11-18: This problem will go away once - frame.c:get_prev_frame() is modified to set the frame's - type before calling functions like this. */ - find_pc_partial_function (get_frame_pc (fci), &name, - (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); - if (!PC_IN_SIGTRAMP (get_frame_pc (fci), name)) - { - frame_saved_regs_zalloc (fci); - /* Set value of previous frame's stack pointer. - Remember that saved_regs[SP_REGNUM] is special in - that it contains the value of the stack pointer - register. The other saved_regs values are addresses - (in the inferior) at which a given register's value - may be found. */ - set_reg_offset (temp_saved_regs, SP_REGNUM, - get_frame_base (fci)); - set_reg_offset (temp_saved_regs, mips_regnum (current_gdbarch)->pc, - temp_saved_regs[RA_REGNUM]); - memcpy (deprecated_get_frame_saved_regs (fci), temp_saved_regs, - SIZEOF_FRAME_SAVED_REGS); - } - } - - /* hack: if argument regs are saved, guess these contain args */ - /* assume we can't tell how many args for now */ - get_frame_extra_info (fci)->num_args = -1; - for (regnum = MIPS_LAST_ARG_REGNUM; regnum >= A0_REGNUM; regnum--) - { - if (PROC_REG_MASK (proc_desc) & (1 << regnum)) - { - get_frame_extra_info (fci)->num_args = regnum - A0_REGNUM + 1; - break; - } - } - } -} - /* MIPS stack frames are almost impenetrable. When execution stops, we basically have to look at symbol information for the function that we stopped in, which tells us *which* register (if any) is @@ -3215,7 +3094,6 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, for (argnum = 0; argnum < nargs; argnum++) { char *val; - char valbuf[MAX_REGISTER_SIZE]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (VALUE_TYPE (arg)); int len = TYPE_LENGTH (arg_type); @@ -3429,7 +3307,6 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, /* A struct that contains one or two floats. Each value is part in the least significant part of their floating point register.. */ - bfd_byte reg[MAX_REGISTER_SIZE]; int regnum; int field; for (field = 0, regnum = mips_regnum (current_gdbarch)->fp0; @@ -3480,7 +3357,6 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, offset += register_size (current_gdbarch, regnum), regnum++) { int xfer = register_size (current_gdbarch, regnum); - int pos = 0; if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) @@ -3557,7 +3433,6 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, for (argnum = 0; argnum < nargs; argnum++) { char *val; - char valbuf[MAX_REGISTER_SIZE]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (VALUE_TYPE (arg)); int len = TYPE_LENGTH (arg_type); @@ -3932,7 +3807,6 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct type *type, offset += mips_stack_argsize (tdep), regnum++) { int xfer = mips_stack_argsize (tdep); - int pos = 0; if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) @@ -4011,7 +3885,6 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, for (argnum = 0; argnum < nargs; argnum++) { char *val; - char valbuf[MAX_REGISTER_SIZE]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (VALUE_TYPE (arg)); int len = TYPE_LENGTH (arg_type); @@ -4302,87 +4175,6 @@ mips_o64_store_return_value (struct type *valtype, char *valbuf) } } -static void -mips_pop_frame (void) -{ - int regnum; - struct frame_info *frame = get_current_frame (); - CORE_ADDR new_sp = get_frame_base (frame); - mips_extra_func_info_t proc_desc; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0)) - { - generic_pop_dummy_frame (); - flush_cached_frames (); - return; - } - - proc_desc = get_frame_extra_info (frame)->proc_desc; - write_register (mips_regnum (current_gdbarch)->pc, - DEPRECATED_FRAME_SAVED_PC (frame)); - mips_find_saved_regs (frame); - for (regnum = 0; regnum < NUM_REGS; regnum++) - if (regnum != SP_REGNUM && regnum != mips_regnum (current_gdbarch)->pc - && deprecated_get_frame_saved_regs (frame)[regnum]) - { - /* Floating point registers must not be sign extended, in case - mips_saved_regsize() = 4 but sizeof (FP0_REGNUM) == 8. */ - - if (mips_regnum (current_gdbarch)->fp0 <= regnum - && regnum < mips_regnum (current_gdbarch)->fp0 + 32) - write_register (regnum, - read_memory_unsigned_integer - (deprecated_get_frame_saved_regs (frame)[regnum], - mips_saved_regsize (tdep))); - else - write_register (regnum, - read_memory_integer (deprecated_get_frame_saved_regs - (frame)[regnum], - mips_saved_regsize (tdep))); - } - - write_register (SP_REGNUM, new_sp); - flush_cached_frames (); - - if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc)) - { - struct linked_proc_info *pi_ptr, *prev_ptr; - - for (pi_ptr = linked_proc_desc_table, prev_ptr = NULL; - pi_ptr != NULL; prev_ptr = pi_ptr, pi_ptr = pi_ptr->next) - { - if (&pi_ptr->info == proc_desc) - break; - } - - if (pi_ptr == NULL) - error ("Can't locate dummy extra frame info\n"); - - if (prev_ptr != NULL) - prev_ptr->next = pi_ptr->next; - else - linked_proc_desc_table = pi_ptr->next; - - xfree (pi_ptr); - - write_register (mips_regnum (current_gdbarch)->hi, - read_memory_integer ((new_sp - - 2 * mips_saved_regsize (tdep)), - mips_saved_regsize (tdep))); - write_register (mips_regnum (current_gdbarch)->lo, - read_memory_integer ((new_sp - - 3 * mips_saved_regsize (tdep)), - mips_saved_regsize (tdep))); - if (MIPS_FPU_TYPE != MIPS_FPU_NONE) - write_register (mips_regnum (current_gdbarch)->fp_control_status, - read_memory_integer ((new_sp - - - 4 * mips_saved_regsize (tdep)), - mips_saved_regsize (tdep))); - } -} - /* Floating point register management. Background: MIPS1 & 2 fp registers are 32 bits wide. To support @@ -4506,8 +4298,8 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, int regnum) { /* do values for FP (float) regs */ char *raw_buffer; - double doub, flt1, flt2; /* doubles extracted from raw hex data */ - int inv1, inv2, namelen; + double doub, flt1; /* doubles extracted from raw hex data */ + int inv1, inv2; raw_buffer = (char *) alloca (2 * @@ -5498,65 +5290,6 @@ mips_ignore_helper (CORE_ADDR pc) } -/* When debugging a 64 MIPS target running a 32 bit ABI, the size of - the register stored on the stack (32) is different to its real raw - size (64). The below ensures that registers are fetched from the - stack using their ABI size and then stored into the RAW_BUFFER - using their raw size. - - The alternative to adding this function would be to add an ABI - macro - REGISTER_STACK_SIZE(). */ - -static void -mips_get_saved_register (char *raw_buffer, - int *optimizedp, - CORE_ADDR *addrp, - struct frame_info *frame, - int regnum, enum lval_type *lvalp) -{ - CORE_ADDR addrx; - enum lval_type lvalx; - int optimizedx; - int realnumx; - - /* Always a pseudo. */ - gdb_assert (regnum >= NUM_REGS); - - /* Make certain that all needed parameters are present. */ - if (addrp == NULL) - addrp = &addrx; - if (lvalp == NULL) - lvalp = &lvalx; - if (optimizedp == NULL) - optimizedp = &optimizedx; - - if ((regnum % NUM_REGS) == SP_REGNUM) - /* The SP_REGNUM is special, its value is stored in saved_regs. - In fact, it is so special that it can even only be fetched - using a raw register number! Once this code as been converted - to frame-unwind the problem goes away. */ - frame_register_unwind (deprecated_get_next_frame_hack (frame), - regnum % NUM_REGS, optimizedp, lvalp, addrp, - &realnumx, raw_buffer); - else - /* Get it from the next frame. */ - frame_register_unwind (deprecated_get_next_frame_hack (frame), - regnum, optimizedp, lvalp, addrp, - &realnumx, raw_buffer); -} - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -static CORE_ADDR -mips_saved_pc_after_call (struct frame_info *frame) -{ - return read_signed_register (RA_REGNUM); -} - - /* Convert a dbx stab register number (from `r' declaration) to a GDB [1 * NUM_REGS .. 2 * NUM_REGS) REGNUM. */ @@ -6024,17 +5757,17 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, mips_write_pc); - set_gdbarch_deprecated_target_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ set_gdbarch_read_sp (gdbarch, mips_read_sp); /* Add/remove bits from an address. The MIPS needs be careful to ensure that all 32 bit addresses are sign extended to 64 bits. */ set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove); - /* There's a mess in stack frame creation. See comments in - blockframe.c near reference to DEPRECATED_INIT_FRAME_PC_FIRST. */ - set_gdbarch_deprecated_init_frame_pc_first (gdbarch, - mips_init_frame_pc_first); + /* Unwind the frame. */ + set_gdbarch_unwind_pc (gdbarch, mips_unwind_pc); + frame_unwind_append_sniffer (gdbarch, mips_mdebug_frame_sniffer); + set_gdbarch_unwind_dummy_id (gdbarch, mips_unwind_dummy_id); + frame_base_append_sniffer (gdbarch, mips_mdebug_frame_base_sniffer); /* Map debug register numbers onto internal register numbers. */ set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum); @@ -6046,42 +5779,22 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) mips_dwarf_dwarf2_ecoff_reg_to_regnum); set_gdbarch_register_sim_regno (gdbarch, mips_register_sim_regno); - /* Initialize a frame */ - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, - mips_find_saved_regs); - set_gdbarch_deprecated_init_extra_frame_info (gdbarch, - mips_init_extra_frame_info); - /* MIPS version of CALL_DUMMY */ /* NOTE: cagney/2003-08-05: Eventually call dummy location will be replaced by a command, and all targets will default to on stack (regardless of the stack's execute status). */ set_gdbarch_call_dummy_location (gdbarch, AT_SYMBOL); - set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_frame_align (gdbarch, mips_frame_align); - set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, - generic_save_dummy_frame_tos); set_gdbarch_convert_register_p (gdbarch, mips_convert_register_p); set_gdbarch_register_to_value (gdbarch, mips_register_to_value); set_gdbarch_value_to_register (gdbarch, mips_value_to_register); - 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_args_skip (gdbarch, 0); - - set_gdbarch_deprecated_get_saved_register (gdbarch, - mips_get_saved_register); - set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc); set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue); - set_gdbarch_deprecated_saved_pc_after_call (gdbarch, - mips_saved_pc_after_call); set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address); set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer); @@ -6102,13 +5815,22 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) is sitting on? */ set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); - /* Hook in OS ABI-specific overrides, if they have been registered. */ - gdbarch_init_osabi (info, gdbarch); - set_gdbarch_skip_trampoline_code (gdbarch, mips_skip_stub); - set_gdbarch_in_solib_call_trampoline (gdbarch, mips_in_call_stub); - set_gdbarch_in_solib_return_trampoline (gdbarch, mips_in_return_stub); + /* NOTE drow/2004-02-11: We overload the core solib trampoline code + to support MIPS16. This is a bad thing. Make sure not to do it + if we have an OS ABI that actually supports shared libraries, since + shared library support is more important. If we have an OS someday + that supports both shared libraries and MIPS16, we'll have to find + a better place for these. */ + if (info.osabi == GDB_OSABI_UNKNOWN) + { + set_gdbarch_in_solib_call_trampoline (gdbarch, mips_in_call_stub); + set_gdbarch_in_solib_return_trampoline (gdbarch, mips_in_return_stub); + } + + /* Hook in OS ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch); return gdbarch; } @@ -6321,17 +6043,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: SET_PROC_DESC_IS_DUMMY = function?\n"); fprintf_unfiltered (file, - "mips_dump_tdep: SIGFRAME_BASE = %d\n", SIGFRAME_BASE); - fprintf_unfiltered (file, - "mips_dump_tdep: SIGFRAME_FPREGSAVE_OFF = %d\n", - SIGFRAME_FPREGSAVE_OFF); - fprintf_unfiltered (file, - "mips_dump_tdep: SIGFRAME_PC_OFF = %d\n", - SIGFRAME_PC_OFF); - fprintf_unfiltered (file, - "mips_dump_tdep: SIGFRAME_REGSAVE_OFF = %d\n", - SIGFRAME_REGSAVE_OFF); - fprintf_unfiltered (file, "mips_dump_tdep: SKIP_TRAMPOLINE_CODE # %s\n", XSTRING (SKIP_TRAMPOLINE_CODE (PC))); fprintf_unfiltered (file, diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index a6ef1ca..1803eef 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1179,7 +1179,6 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_store_struct_return (gdbarch, mn10300_store_struct_return); set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); - set_gdbarch_frame_args_skip (gdbarch, 0); /* That's right, we're using the stack pointer as our frame pointer. */ set_gdbarch_deprecated_target_read_fp (gdbarch, mn10300_read_fp); diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 6726c8c..dc143bb 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -309,10 +309,6 @@ ns32k_frame_chain (struct frame_info *frame) /* In the case of the NS32000 series, the frame's nominal address is the FP value, and that address is saved at the previous FP value as a 4-byte word. */ - - if (deprecated_inside_entry_file (get_frame_pc (frame))) - return 0; - return (read_memory_integer (get_frame_base (frame), 4)); } diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index c655616..cc933db 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -1,6 +1,6 @@ /* Objective-C language support routines for GDB, the GNU debugger. - Copyright 2002, 2003 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Apple Computer, Inc. Written by Michael Snyder. @@ -672,6 +672,7 @@ const struct language_defn objc_language_defn = { objc_skip_trampoline, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ objc_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ diff --git a/gdb/objfiles.c b/gdb/objfiles.c index fab1c99..03a88eb 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1,7 +1,7 @@ /* GDB routines for manipulating objfiles. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. @@ -93,7 +93,7 @@ add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect, section.ovly_mapped = 0; section.addr = bfd_section_vma (abfd, asect); section.endaddr = section.addr + bfd_section_size (abfd, asect); - obstack_grow (&objfile->psymbol_obstack, (char *) §ion, sizeof (section)); + obstack_grow (&objfile->objfile_obstack, (char *) §ion, sizeof (section)); objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1); } @@ -119,13 +119,13 @@ build_objfile_section_table (struct objfile *objfile) /* objfile->sections can be already set when reading a mapped symbol file. I believe that we do need to rebuild the section table in this case (we rebuild other things derived from the bfd), but we - can't free the old one (it's in the psymbol_obstack). So we just + can't free the old one (it's in the objfile_obstack). So we just waste some memory. */ objfile->sections_end = 0; bfd_map_over_sections (objfile->obfd, add_to_objfile_sections, (char *) objfile); objfile->sections = (struct obj_section *) - obstack_finish (&objfile->psymbol_obstack); + obstack_finish (&objfile->objfile_obstack); objfile->sections_end = objfile->sections + (unsigned long) objfile->sections_end; return (0); } @@ -165,13 +165,9 @@ allocate_objfile (bfd *abfd, int flags) objfile->md = NULL; objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc (); - obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, - xfree); - obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, - xfree); - obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc, - xfree); - + /* We could use obstack_specify_allocation here instead, but + gdb_obstack.h specifies the alloc/dealloc functions. */ + obstack_init (&objfile->objfile_obstack); terminate_minimal_symbol_table (objfile); } @@ -238,14 +234,14 @@ allocate_objfile (bfd *abfd, int flags) /* Create the terminating entry of OBJFILE's minimal symbol table. If OBJFILE->msymbols is zero, allocate a single entry from - OBJFILE->symbol_obstack; otherwise, just initialize + OBJFILE->objfile_obstack; otherwise, just initialize OBJFILE->msymbols[OBJFILE->minimal_symbol_count]. */ void terminate_minimal_symbol_table (struct objfile *objfile) { if (! objfile->msymbols) objfile->msymbols = ((struct minimal_symbol *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (objfile->msymbols[0]))); { @@ -341,8 +337,8 @@ unlink_objfile (struct objfile *objfile) /* Destroy an objfile and all the symtabs and psymtabs under it. Note - that as much as possible is allocated on the symbol_obstack and - psymbol_obstack, so that the memory can be efficiently freed. + that as much as possible is allocated on the objfile_obstack + so that the memory can be efficiently freed. Things which we do NOT free because they are not in malloc'd memory or not in memory specific to the objfile include: @@ -431,9 +427,7 @@ free_objfile (struct objfile *objfile) bcache_xfree (objfile->macro_cache); if (objfile->demangled_names_hash) htab_delete (objfile->demangled_names_hash); - obstack_free (&objfile->psymbol_obstack, 0); - obstack_free (&objfile->symbol_obstack, 0); - obstack_free (&objfile->type_obstack, 0); + obstack_free (&objfile->objfile_obstack, 0); xmfree (objfile->md, objfile); objfile = NULL; } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 732af4d..ce40121 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -1,7 +1,7 @@ /* Definitions for symbol file management in GDB. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -98,18 +98,7 @@ struct objfile_data; use the block at main, or can't find it for some reason, everything still works as before. And if we have no startup code debugging information but we do have usable information for main(), backtraces - from user code don't go wandering off into the startup code. - - To use this method, define your DEPRECATED_FRAME_CHAIN_VALID macro - like: - - #define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) \ - (chain != 0 \ - && !(inside_main_func ((thisframe)->pc)) \ - && !(inside_entry_func ((thisframe)->pc))) - - and add initializations of the four scope controlling variables inside - the object file / debugging information processing modules. */ + from user code don't go wandering off into the startup code. */ struct entry_info { @@ -292,12 +281,10 @@ struct objfile long mtime; - /* Obstacks to hold objects that should be freed when we load a new symbol + /* Obstack to hold objects that should be freed when we load a new symbol table from this object file. */ - struct obstack psymbol_obstack; /* Partial symbols */ - struct obstack symbol_obstack; /* Full symbols */ - struct obstack type_obstack; /* Types */ + struct obstack objfile_obstack; /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */ @@ -313,7 +300,7 @@ struct objfile struct htab *demangled_names_hash; /* Vectors of all partial symbols read in from file. The actual data - is stored in the psymbol_obstack. */ + is stored in the objfile_obstack. */ struct psymbol_allocation_list global_psymbols; struct psymbol_allocation_list static_psymbols; @@ -325,7 +312,7 @@ struct objfile when passed a pointer to somewhere in the middle of it. There is also a count of the number of symbols, which does not include the terminating null symbol. The array itself, as well as all the data that it points - to, should be allocated on the symbol_obstack for this file. */ + to, should be allocated on the objfile_obstack for this file. */ struct minimal_symbol *msymbols; int minimal_symbol_count; @@ -403,7 +390,7 @@ struct objfile unsigned num_data; /* Set of relocation offsets to apply to each section. - Currently on the psymbol_obstack (which makes no sense, but I'm + Currently on the objfile_obstack (which makes no sense, but I'm not sure it's harming anything). These offsets indicate that all symbols (including partial and @@ -431,20 +418,21 @@ struct objfile SECTIONS points to the first entry in the table, and SECTIONS_END points to the first location past the last entry in the table. Currently the table is stored on the - psymbol_obstack (which makes no sense, but I'm not sure it's + objfile_obstack (which makes no sense, but I'm not sure it's harming anything). */ struct obj_section *sections, *sections_end; - /* two auxiliary fields, used to hold the fp of separate symbol files */ - FILE *auxf1, *auxf2; - /* Imported symbols */ + /* FIXME: ezannoni 2004-02-10: This is just SOM (HP) specific (see + somread.c). It should not pollute generic objfiles. */ ImportEntry *import_list; int import_list_size; /* Exported symbols */ + /* FIXME: ezannoni 2004-02-10: This is just SOM (HP) specific (see + somread.c). It should not pollute generic objfiles. */ ExportEntry *export_list; int export_list_size; @@ -520,7 +508,7 @@ extern struct objfile *symfile_objfile; extern struct objfile *rt_common_objfile; -/* When we need to allocate a new type, we need to know which type_obstack +/* When we need to allocate a new type, we need to know which objfile_obstack to allocate the type on, since there is one for each objfile. The places where types are allocated are deeply buried in function call hierarchies which know nothing about objfiles, so rather than trying to pass a diff --git a/gdb/osabi.c b/gdb/osabi.c index 239d508..3acfc70 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -473,6 +473,15 @@ generic_elf_osabi_sniff_abi_tag_sections: unknown OS number %d", return; } + /* .note.openbsd.ident notes, used by OpenBSD. */ + if (strcmp (name, ".note.openbsd.ident") == 0 + && check_note (abfd, sect, note, "OpenBSD", 4, NT_OPENBSD_IDENT)) + { + /* There is no need to check the version yet. */ + *osabi = GDB_OSABI_OPENBSD_ELF; + return; + } + /* .note.netbsdcore.procinfo notes, used by NetBSD. */ if (strcmp (name, ".note.netbsdcore.procinfo") == 0) { diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 3ebb433..a402532 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -1,5 +1,5 @@ /* Pascal language support routines for GDB, the GNU debugger. - Copyright 2000, 2002 Free Software Foundation, Inc. + Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -464,6 +464,7 @@ const struct language_defn pascal_language_defn = NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "%", "b", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index 8a5cae1..4e29455 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -1,6 +1,6 @@ /* Handle HP ELF shared libraries for GDB, the GNU Debugger. - Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, + Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -281,7 +281,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, if (so->objfile->obj_private == NULL) { obj_private = (obj_private_data_t *) - obstack_alloc (&so->objfile->psymbol_obstack, + obstack_alloc (&so->objfile->objfile_obstack, sizeof (obj_private_data_t)); obj_private->unwind_info = NULL; obj_private->so_info = NULL; @@ -1161,7 +1161,7 @@ add_to_solist (int from_tty, char *dll_path, int readsyms, new_so->pa64_solib_desc_addr = load_module_desc_addr; new_so->loaded = 1; new_so->name = obsavestring (dll_path, strlen(dll_path), - &symfile_objfile->symbol_obstack); + &symfile_objfile->objfile_obstack); /* If we are not going to load the library, tell the user if we haven't already and return. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 3c7ad41..1cea480 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -44,6 +44,10 @@ #include "block.h" #include "disasm.h" +#ifdef TUI +#include "tui/tui.h" /* For tui_active et.al. */ +#endif + extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -1141,7 +1145,12 @@ address_info (char *exp, int from_tty) case LOC_COMPUTED: case LOC_COMPUTED_ARG: - (SYMBOL_LOCATION_FUNCS (sym)->describe_location) (sym, gdb_stdout); + /* FIXME: cagney/2004-01-26: It should be possible to + unconditionally call the SYMBOL_OPS method when available. + Unfortunately DWARF 2 stores the frame-base (instead of the + function) location in a function's symbol. Oops! For the + moment enable this when/where applicable. */ + SYMBOL_OPS (sym)->describe_location (sym, gdb_stdout); break; case LOC_REGISTER: @@ -1356,7 +1365,7 @@ display_command (char *exp, int from_tty) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ if (tui_active && *exp == '$') - display_it = (tui_set_layout (exp) == TUI_FAILURE); + display_it = (tui_set_layout_for_display_command (exp) == TUI_FAILURE); #endif if (display_it) diff --git a/gdb/proc-api.c b/gdb/proc-api.c index 1e4a2dc..e6d30ea 100644 --- a/gdb/proc-api.c +++ b/gdb/proc-api.c @@ -459,7 +459,7 @@ static off_t lseek_offset; int write_with_trace (int fd, void *varg, size_t len, char *file, int line) { - int i; + int i = ARRAY_SIZE (rw_table) - 1; int ret; procfs_ctl_t *arg = (procfs_ctl_t *) varg; diff --git a/gdb/procfs.c b/gdb/procfs.c index 090cf73..f73f729 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -19,7 +19,7 @@ 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, +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" @@ -45,10 +45,12 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdb_wait.h" #include <signal.h> #include <ctype.h> +#include "gdb_string.h" #include "gdb_assert.h" #include "inflow.h" +#include "auxv.h" -/* +/* * PROCFS.C * * This module provides the interface between GDB and the @@ -73,7 +75,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ * This module has to support both /proc interfaces. This means * that there are two different ways of doing every basic operation. * - * In order to keep most of the code simple and clean, I have + * In order to keep most of the code simple and clean, I have * defined an interface "layer" which hides all these system calls. * An ifdef (NEW_PROC_API) determines which interface we are using, * and most or all occurrances of this ifdef should be confined to @@ -82,7 +84,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Determine which /proc API we are using: - The ioctl API defines PIOCSTATUS, while + The ioctl API defines PIOCSTATUS, while the read/write (multiple fd) API never does. */ #ifdef NEW_PROC_API @@ -127,16 +129,21 @@ static ptid_t procfs_wait (ptid_t, struct target_waitstatus *); static int procfs_xfer_memory (CORE_ADDR, char *, int, int, struct mem_attrib *attrib, struct target_ops *); +static LONGEST procfs_xfer_partial (struct target_ops *ops, + enum target_object object, + const char *annex, + void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len); static int procfs_thread_alive (ptid_t); void procfs_find_new_threads (void); char *procfs_pid_to_str (ptid_t); -static int proc_find_memory_regions (int (*) (CORE_ADDR, - unsigned long, - int, int, int, - void *), +static int proc_find_memory_regions (int (*) (CORE_ADDR, + unsigned long, + int, int, int, + void *), void *); static char * procfs_make_note_section (bfd *, int *); @@ -150,7 +157,7 @@ init_procfs_ops (void) { procfs_ops.to_shortname = "procfs"; procfs_ops.to_longname = "Unix /proc child process"; - procfs_ops.to_doc = + procfs_ops.to_doc = "Unix /proc child process (started by the \"run\" command)."; procfs_ops.to_open = procfs_open; procfs_ops.to_can_run = procfs_can_run; @@ -164,6 +171,7 @@ init_procfs_ops (void) procfs_ops.to_prepare_to_store = procfs_prepare_to_store; procfs_ops.to_fetch_registers = procfs_fetch_registers; procfs_ops.to_store_registers = procfs_store_registers; + procfs_ops.to_xfer_partial = procfs_xfer_partial; procfs_ops.to_xfer_memory = procfs_xfer_memory; procfs_ops.to_insert_breakpoint = memory_insert_breakpoint; procfs_ops.to_remove_breakpoint = memory_remove_breakpoint; @@ -206,14 +214,14 @@ init_procfs_ops (void) #ifdef NEW_PROC_API /* Solaris 7 && 8 method for watchpoints */ #ifdef WA_READ - enum { READ_WATCHFLAG = WA_READ, + enum { READ_WATCHFLAG = WA_READ, WRITE_WATCHFLAG = WA_WRITE, EXEC_WATCHFLAG = WA_EXEC, AFTER_WATCHFLAG = WA_TRAPAFTER }; #endif #else /* Irix method for watchpoints */ - enum { READ_WATCHFLAG = MA_READ, + enum { READ_WATCHFLAG = MA_READ, WRITE_WATCHFLAG = MA_WRITE, EXEC_WATCHFLAG = MA_EXEC, AFTER_WATCHFLAG = 0 /* trapafter not implemented */ @@ -344,7 +352,7 @@ typedef struct procinfo { int was_stopped; int ignore_next_sigstop; - /* The following four fd fields may be identical, or may contain + /* The following four fd fields may be identical, or may contain several different fd's, depending on the version of /proc (old ioctl or new read/write). */ @@ -352,7 +360,7 @@ typedef struct procinfo { /* * The next three file descriptors are actually only needed in the * read/write, multiple-file-descriptor implemenation (NEW_PROC_API). - * However, to avoid a bunch of #ifdefs in the code, we will use + * However, to avoid a bunch of #ifdefs in the code, we will use * them uniformly by (in the case of the ioctl single-file-descriptor * implementation) filling them with copies of the control fd. */ @@ -377,7 +385,7 @@ typedef struct procinfo { int num_syscalls; /* Total number of syscalls */ char **syscall_names; /* Syscall number to name map */ #endif - + struct procinfo *thread_list; int status_valid : 1; @@ -417,7 +425,7 @@ static procinfo * procinfo_list; * Returns: pointer to procinfo, or NULL if not found. */ -static procinfo * +static procinfo * find_procinfo (int pid, int tid) { procinfo *pi; @@ -458,7 +466,7 @@ find_procinfo_or_die (int pid, int tid) if (pi == NULL) { if (tid) - error ("procfs: couldn't find pid %d (kernel thread %d) in procinfo list.", + error ("procfs: couldn't find pid %d (kernel thread %d) in procinfo list.", pid, tid); else error ("procfs: couldn't find pid %d in procinfo list.", pid); @@ -469,14 +477,14 @@ find_procinfo_or_die (int pid, int tid) /* open_with_retry() is a wrapper for open(). The appropriate open() call is attempted; if unsuccessful, it will be retried as many times as needed for the EAGAIN and EINTR conditions. - + For other conditions, open_with_retry() will retry the open() a limited number of times. In addition, a short sleep is imposed prior to retrying the open(). The reason for this sleep is to give the kernel a chance to catch up and create the file in question in the event that GDB "wins" the race to open a file before the kernel has created it. */ - + static int open_with_retry (const char *pathname, int flags) { @@ -523,19 +531,19 @@ open_procinfo_files (procinfo *pi, int which) #endif int fd; - /* + /* * This function is getting ALMOST long enough to break up into several. * Here is some rationale: * * NEW_PROC_API (Solaris 2.6, Solaris 2.7, Unixware): - * There are several file descriptors that may need to be open + * There are several file descriptors that may need to be open * for any given process or LWP. The ones we're intereted in are: * - control (ctl) write-only change the state * - status (status) read-only query the state * - address space (as) read/write access memory * - map (map) read-only virtual addr map * Most of these are opened lazily as they are needed. - * The pathnames for the 'files' for an LWP look slightly + * The pathnames for the 'files' for an LWP look slightly * different from those of a first-class process: * Pathnames for a process (<proc-id>): * /proc/<proc-id>/ctl @@ -553,12 +561,12 @@ open_procinfo_files (procinfo *pi, int which) * For convenience, we copy the same file descriptor into all * three fields of the procinfo struct (ctl_fd, status_fd, and * as_fd, see NEW_PROC_API above) so that code that uses them - * doesn't need any #ifdef's. + * doesn't need any #ifdef's. * Pathname for all: * /proc/<proc-id> * * Solaris 2.5 LWP's: - * Each LWP has an independent file descriptor, but these + * Each LWP has an independent file descriptor, but these * are not obtained via the 'open' system call like the rest: * instead, they're obtained thru an ioctl call (PIOCOPENLWP) * to the file descriptor of the parent process. @@ -617,11 +625,11 @@ open_procinfo_files (procinfo *pi, int which) * In this case, there is only one file descriptor for each procinfo * (ie. each process or LWP). In fact, only the file descriptor for * the process can actually be opened by an 'open' system call. - * The ones for the LWPs have to be obtained thru an IOCTL call - * on the process's file descriptor. + * The ones for the LWPs have to be obtained thru an IOCTL call + * on the process's file descriptor. * * For convenience, we copy each procinfo's single file descriptor - * into all of the fields occupied by the several file descriptors + * into all of the fields occupied by the several file descriptors * of the NEW_PROC_API implementation. That way, the code that uses * them can be written without ifdefs. */ @@ -751,7 +759,7 @@ destroy_one_procinfo (procinfo **list, procinfo *pi) /* Step one: unlink the procinfo from its list */ if (pi == *list) *list = pi->next; - else + else for (ptr = *list; ptr; ptr = ptr->next) if (ptr->next == pi) { @@ -849,7 +857,7 @@ sysset_t_size (procinfo * pi) } /* Function: sysset_t_alloc - + Allocate and (partially) initialize a sysset_t struct. */ static sysset_t * @@ -868,7 +876,7 @@ sysset_t_alloc (procinfo * pi) #ifdef DYNAMIC_SYSCALLS /* Function: load_syscalls - + Extract syscall numbers and names from /proc/<pid>/sysent. Initialize pi->num_syscalls with the number of syscalls and pi->syscall_names with the names. (Certain numbers may be skipped in which case the @@ -968,13 +976,13 @@ load_syscalls (procinfo *pi) strncpy (pi->syscall_names[callnum], namebuf, size-1); pi->syscall_names[callnum][size-1] = '\0'; } - + close (sysent_fd); xfree (syscalls); } /* Function: free_syscalls - + Free the space allocated for the syscall names from the procinfo structure. */ @@ -998,7 +1006,7 @@ free_syscalls (procinfo *pi) Given a name, look up (and return) the corresponding syscall number. If no match is found, return -1. */ - + static int find_syscall (procinfo *pi, char *name) { @@ -1018,7 +1026,7 @@ find_syscall (procinfo *pi, char *name) /* * This "module" is the interface layer between the /proc system API - * and the gdb target vector functions. This layer consists of + * and the gdb target vector functions. This layer consists of * access functions that encapsulate each of the basic operations * that we need to use from the /proc API. * @@ -1118,16 +1126,16 @@ proc_get_status (procinfo *pi) pi->status_valid = 0; /* fail */ else { - /* Sigh... I have to read a different data structure, + /* Sigh... I have to read a different data structure, depending on whether this is a main process or an LWP. */ if (pi->tid) - pi->status_valid = (read (pi->status_fd, - (char *) &pi->prstatus.pr_lwp, + pi->status_valid = (read (pi->status_fd, + (char *) &pi->prstatus.pr_lwp, sizeof (lwpstatus_t)) == sizeof (lwpstatus_t)); else { - pi->status_valid = (read (pi->status_fd, + pi->status_valid = (read (pi->status_fd, (char *) &pi->prstatus, sizeof (gdb_prstatus_t)) == sizeof (gdb_prstatus_t)); @@ -1136,7 +1144,7 @@ proc_get_status (procinfo *pi) (pi->prstatus.pr_lwp.pr_flags & PR_ISTOP) && pi->prstatus.pr_lwp.pr_why == PR_REQUESTED) /* Unixware peculiarity -- read the damn thing again! */ - pi->status_valid = (read (pi->status_fd, + pi->status_valid = (read (pi->status_fd, (char *) &pi->prstatus, sizeof (gdb_prstatus_t)) == sizeof (gdb_prstatus_t)); @@ -1148,7 +1156,7 @@ proc_get_status (procinfo *pi) if (pi->tid == 0) /* main process */ { /* Just read the danged status. Now isn't that simple? */ - pi->status_valid = + pi->status_valid = (ioctl (pi->status_fd, PIOCSTATUS, &pi->prstatus) >= 0); } else @@ -1165,7 +1173,7 @@ proc_get_status (procinfo *pi) win = (ioctl (pi->status_fd, PIOCTSTATUS, &thread_status) >= 0); if (win) { - memcpy (&pi->prstatus, &thread_status.status, + memcpy (&pi->prstatus, &thread_status.status, sizeof (pi->prstatus)); pi->status_valid = 1; } @@ -1178,16 +1186,16 @@ proc_get_status (procinfo *pi) if (pi->status_valid) { - PROC_PRETTYFPRINT_STATUS (proc_flags (pi), + PROC_PRETTYFPRINT_STATUS (proc_flags (pi), proc_why (pi), - proc_what (pi), + proc_what (pi), proc_get_current_thread (pi)); } /* The status struct includes general regs, so mark them valid too */ pi->gregs_valid = pi->status_valid; #ifdef NEW_PROC_API - /* In the read/write multiple-fd model, + /* In the read/write multiple-fd model, the status struct includes the fp regs too, so mark them valid too */ pi->fpregs_valid = pi->status_valid; #endif @@ -1198,7 +1206,7 @@ proc_get_status (procinfo *pi) * Function: proc_flags * * returns the process flags (pr_flags field). - */ + */ long proc_flags (procinfo *pi) @@ -1274,7 +1282,7 @@ proc_nsysarg (procinfo *pi) if (!pi->status_valid) if (!proc_get_status (pi)) return 0; - + #ifdef NEW_PROC_API return pi->prstatus.pr_lwp.pr_nsysarg; #else @@ -1294,7 +1302,7 @@ proc_sysargs (procinfo *pi) if (!pi->status_valid) if (!proc_get_status (pi)) return NULL; - + #ifdef NEW_PROC_API return (long *) &pi->prstatus.pr_lwp.pr_sysarg; #else @@ -1314,7 +1322,7 @@ proc_syscall (procinfo *pi) if (!pi->status_valid) if (!proc_get_status (pi)) return 0; - + #ifdef NEW_PROC_API return pi->prstatus.pr_lwp.pr_syscall; #else @@ -1344,9 +1352,9 @@ proc_cursig (struct procinfo *pi) } /* - * Function: proc_modify_flag + * Function: proc_modify_flag * - * === I appologize for the messiness of this function. + * === I appologize for the messiness of this function. * === This is an area where the different versions of * === /proc are more inconsistent than usual. MVS * @@ -1368,7 +1376,7 @@ proc_cursig (struct procinfo *pi) * Note: OSF does not define PR_KLC. * Note: OSF is the only one that can ONLY use the oldest method. * - * Arguments: + * Arguments: * pi -- the procinfo * flag -- one of PR_FORK, PR_RLC, or PR_ASYNC * mode -- 1 for set, 0 for reset. @@ -1383,20 +1391,20 @@ proc_modify_flag (procinfo *pi, long flag, long mode) { long win = 0; /* default to fail */ - /* - * These operations affect the process as a whole, and applying - * them to an individual LWP has the same meaning as applying them - * to the main process. Therefore, if we're ever called with a - * pointer to an LWP's procinfo, let's substitute the process's - * procinfo and avoid opening the LWP's file descriptor - * unnecessarily. + /* + * These operations affect the process as a whole, and applying + * them to an individual LWP has the same meaning as applying them + * to the main process. Therefore, if we're ever called with a + * pointer to an LWP's procinfo, let's substitute the process's + * procinfo and avoid opening the LWP's file descriptor + * unnecessarily. */ if (pi->pid != 0) pi = find_procinfo_or_die (pi->pid, 0); #ifdef NEW_PROC_API /* Newest method: UnixWare and newer Solarii */ - /* First normalize the PCUNSET/PCRESET command opcode + /* First normalize the PCUNSET/PCRESET command opcode (which for no obvious reason has a different definition from one operating system to the next...) */ #ifdef PCUNSET @@ -1463,7 +1471,7 @@ proc_modify_flag (procinfo *pi, long flag, long mode) pi->status_valid = 0; if (!win) - warning ("procfs: modify_flag failed to turn %s %s", + warning ("procfs: modify_flag failed to turn %s %s", flag == PR_FORK ? "PR_FORK" : flag == PR_RLC ? "PR_RLC" : #ifdef PR_ASYNC @@ -1531,7 +1539,7 @@ proc_set_kill_on_last_close (procinfo *pi) * Function: proc_unset_kill_on_last_close * * Reset the kill_on_last_close flag. - * Process will NOT be killed when debugger + * Process will NOT be killed when debugger * closes its file handles (or exits or dies). * * Returns non-zero for success, zero for failure. @@ -1581,7 +1589,7 @@ proc_unset_inherit_on_fork (procinfo *pi) * Function: proc_set_async * * Set PR_ASYNC flag. - * If one LWP stops because of a debug event (signal etc.), + * If one LWP stops because of a debug event (signal etc.), * the remaining LWPs will continue to run. * * Returns non-zero for success, zero for failure. @@ -1614,7 +1622,7 @@ proc_unset_async (procinfo *pi) * Function: proc_stop_process * * Request the process/LWP to stop. Does not wait. - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1641,9 +1649,9 @@ proc_stop_process (procinfo *pi) if (win) { pi->status_valid = 1; - PROC_PRETTYFPRINT_STATUS (proc_flags (pi), + PROC_PRETTYFPRINT_STATUS (proc_flags (pi), proc_why (pi), - proc_what (pi), + proc_what (pi), proc_get_current_thread (pi)); } #endif @@ -1656,7 +1664,7 @@ proc_stop_process (procinfo *pi) * Function: proc_wait_for_stop * * Wait for the process or LWP to stop (block until it does). - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1667,10 +1675,10 @@ proc_wait_for_stop (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -1687,9 +1695,9 @@ proc_wait_for_stop (procinfo *pi) if (win) { pi->status_valid = 1; - PROC_PRETTYFPRINT_STATUS (proc_flags (pi), + PROC_PRETTYFPRINT_STATUS (proc_flags (pi), proc_why (pi), - proc_what (pi), + proc_what (pi), proc_get_current_thread (pi)); } #endif @@ -1720,7 +1728,7 @@ proc_wait_for_stop (procinfo *pi) * signo if zero, clear the current signal if any. * if non-zero, set the current signal to this one. * - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1733,7 +1741,7 @@ proc_run_process (procinfo *pi, int step, int signo) * We will probably have to apply this operation to individual threads, * so make sure the control file descriptor is open. */ - + if (pi->ctl_fd == 0 && open_procinfo_files (pi, FD_CTL) == 0) { @@ -1773,7 +1781,7 @@ proc_run_process (procinfo *pi, int step, int signo) * Function: proc_set_traced_signals * * Register to trace signals in the process or LWP. - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1784,10 +1792,10 @@ proc_set_traced_signals (procinfo *pi, gdb_sigset_t *sigset) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -1819,7 +1827,7 @@ proc_set_traced_signals (procinfo *pi, gdb_sigset_t *sigset) * Function: proc_set_traced_faults * * Register to trace hardware faults in the process or LWP. - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1830,10 +1838,10 @@ proc_set_traced_faults (procinfo *pi, fltset_t *fltset) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -1863,7 +1871,7 @@ proc_set_traced_faults (procinfo *pi, fltset_t *fltset) * Function: proc_set_traced_sysentry * * Register to trace entry to system calls in the process or LWP. - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1874,10 +1882,10 @@ proc_set_traced_sysentry (procinfo *pi, sysset_t *sysset) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -1905,7 +1913,7 @@ proc_set_traced_sysentry (procinfo *pi, sysset_t *sysset) #endif /* The above operation renders the procinfo's cached pstatus obsolete. */ pi->status_valid = 0; - + return win; } @@ -1913,7 +1921,7 @@ proc_set_traced_sysentry (procinfo *pi, sysset_t *sysset) * Function: proc_set_traced_sysexit * * Register to trace exit from system calls in the process or LWP. - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1924,10 +1932,10 @@ proc_set_traced_sysexit (procinfo *pi, sysset_t *sysset) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -1963,7 +1971,7 @@ proc_set_traced_sysexit (procinfo *pi, sysset_t *sysset) * Function: proc_set_held_signals * * Specify the set of blocked / held signals in the process or LWP. - * Returns non-zero for success, zero for failure. + * Returns non-zero for success, zero for failure. */ int @@ -1974,10 +1982,10 @@ proc_set_held_signals (procinfo *pi, gdb_sigset_t *sighold) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2017,10 +2025,10 @@ proc_get_pending_signals (procinfo *pi, gdb_sigset_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2054,10 +2062,10 @@ proc_get_signal_actions (procinfo *pi, gdb_sigaction_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2091,10 +2099,10 @@ proc_get_held_signals (procinfo *pi, gdb_sigset_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2137,10 +2145,10 @@ proc_get_traced_signals (procinfo *pi, gdb_sigset_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2179,10 +2187,10 @@ proc_trace_signal (procinfo *pi, int signo) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2213,10 +2221,10 @@ proc_ignore_signal (procinfo *pi, int signo) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2247,10 +2255,10 @@ proc_get_traced_faults (procinfo *pi, fltset_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2289,10 +2297,10 @@ proc_get_traced_sysentry (procinfo *pi, sysset_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2362,10 +2370,10 @@ proc_get_traced_sysexit (procinfo *pi, sysset_t *save) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2435,10 +2443,10 @@ proc_clear_current_fault (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2481,17 +2489,17 @@ proc_set_current_signal (procinfo *pi, int signo) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); #ifdef PROCFS_DONT_PIOCSSIG_CURSIG /* With Alpha OSF/1 procfs, the kernel gets really confused if it * receives a PIOCSSIG with a signal identical to the current signal, - * it messes up the current signal. Work around the kernel bug. + * it messes up the current signal. Work around the kernel bug. */ if (signo > 0 && signo == proc_cursig (pi)) @@ -2531,10 +2539,10 @@ proc_clear_current_signal (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2581,7 +2589,7 @@ proc_get_gregs (procinfo *pi) /* * OK, sorry about the ifdef's. - * There's three cases instead of two, because + * There's three cases instead of two, because * in this instance Unixware and Solaris/RW differ. */ @@ -2831,10 +2839,10 @@ proc_parent_pid (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -2867,7 +2875,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) int proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags) { -#if !defined (TARGET_HAS_HARDWARE_WATCHPOINTS) +#if !defined (TARGET_HAS_HARDWARE_WATCHPOINTS) return 0; #else /* Horrible hack! Detect Solaris 2.5, because this doesn't work on 2.5 */ @@ -2975,11 +2983,11 @@ proc_get_LDT_entry (procinfo *pi, int key) /* This alloc has to persist, 'cause we return a pointer to it. */ if (nldt > nalloc) { - ldt_entry = (struct ssd *) + ldt_entry = (struct ssd *) xrealloc (ldt_entry, (nldt + 1) * sizeof (struct ssd)); nalloc = nldt; } - + /* Read the whole table in one gulp. */ if (ioctl (pi->ctl_fd, PIOCLDT, ldt_entry) < 0) { @@ -3007,16 +3015,16 @@ proc_get_LDT_entry (procinfo *pi, int key) since there is a different way to do threads on every OS. */ /* - * Function: proc_get_nthreads + * Function: proc_get_nthreads * - * Return the number of threads for the process + * Return the number of threads for the process */ #if defined (PIOCNTHR) && defined (PIOCTLIST) /* * OSF version */ -int +int proc_get_nthreads (procinfo *pi) { int nthreads = 0; @@ -3040,10 +3048,10 @@ proc_get_nthreads (procinfo *pi) return 0; /* - * NEW_PROC_API: only works for the process procinfo, + * NEW_PROC_API: only works for the process procinfo, * because the LWP procinfos do not get prstatus filled in. */ -#ifdef NEW_PROC_API +#ifdef NEW_PROC_API if (pi->tid != 0) /* find the parent process procinfo */ pi = find_procinfo_or_die (pi->pid, 0); #endif @@ -3081,10 +3089,10 @@ proc_get_current_thread (procinfo *pi) /* * Note: this should be applied to the root procinfo for the process, * not to the procinfo for an LWP. If applied to the procinfo for - * an LWP, it will simply return that LWP's ID. In that case, + * an LWP, it will simply return that LWP's ID. In that case, * find the parent process procinfo. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -3104,7 +3112,7 @@ proc_get_current_thread (procinfo *pi) /* * OSF version */ -int +int proc_get_current_thread (procinfo *pi) { #if 0 /* FIXME: not ready for prime time? */ @@ -3118,7 +3126,7 @@ proc_get_current_thread (procinfo *pi) /* * Default version */ -int +int proc_get_current_thread (procinfo *pi) { return 0; @@ -3128,7 +3136,7 @@ proc_get_current_thread (procinfo *pi) #endif /* - * Function: proc_update_threads + * Function: proc_update_threads * * Discover the IDs of all the threads within the process, and * create a procinfo for each of them (chained to the parent). @@ -3165,10 +3173,10 @@ proc_update_threads (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -3220,10 +3228,10 @@ proc_update_threads (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -3232,8 +3240,8 @@ proc_update_threads (procinfo *pi) /* * Unixware * - * Note: this brute-force method is the only way I know of - * to accomplish this task on Unixware. This method will + * Note: this brute-force method is the only way I know of + * to accomplish this task on Unixware. This method will * also work on Solaris 2.6 and 2.7. There is a much simpler * and more elegant way to do this on Solaris, but the margins * of this manuscript are too small to write it here... ;-) @@ -3261,7 +3269,7 @@ proc_update_threads (procinfo *pi) /* * OSF version */ -int +int proc_update_threads (procinfo *pi) { int nthreads, i; @@ -3270,10 +3278,10 @@ proc_update_threads (procinfo *pi) /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -3284,7 +3292,7 @@ proc_update_threads (procinfo *pi) return 0; /* nothing to do for 1 or fewer threads */ threads = xmalloc (nthreads * sizeof (tid_t)); - + if (ioctl (pi->ctl_fd, PIOCTLIST, threads) < 0) proc_error (pi, "procfs: update_threads (PIOCTLIST)", __LINE__); @@ -3322,8 +3330,8 @@ proc_update_threads (procinfo *pi) * Note: this function does NOT call update_threads. * If you want to discover new threads first, you must * call that function explicitly. This function just makes - * a quick pass over the currently-known procinfos. - * + * a quick pass over the currently-known procinfos. + * * Arguments: * pi - parent process procinfo * func - per-thread function @@ -3344,10 +3352,10 @@ proc_iterate_over_threads (procinfo *pi, /* * We should never have to apply this operation to any procinfo * except the one for the main process. If that ever changes - * for any reason, then take out the following clause and + * for any reason, then take out the following clause and * replace it with one that makes sure the ctl_fd is open. */ - + if (pi->tid != 0) pi = find_procinfo_or_die (pi->pid, 0); @@ -3504,7 +3512,7 @@ procfs_debug_inferior (procinfo *pi) return 0; } -static void +static void procfs_attach (char *args, int from_tty) { char *exec_file; @@ -3522,7 +3530,7 @@ procfs_attach (char *args, int from_tty) exec_file = get_exec_file (0); if (exec_file) - printf_filtered ("Attaching to program `%s', %s\n", + printf_filtered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid_to_ptid (pid))); else printf_filtered ("Attaching to %s\n", @@ -3534,7 +3542,7 @@ procfs_attach (char *args, int from_tty) push_target (&procfs_ops); } -static void +static void procfs_detach (char *args, int from_tty) { char *exec_file; @@ -3551,7 +3559,7 @@ procfs_detach (char *args, int from_tty) } if (args) signo = atoi (args); - + do_detach (signo); inferior_ptid = null_ptid; unpush_target (&procfs_ops); /* Pop out of handling an inferior */ @@ -3569,7 +3577,7 @@ do_attach (ptid_t ptid) if (!open_procinfo_files (pi, FD_CTL)) { fprintf_filtered (gdb_stderr, "procfs:%d -- ", __LINE__); - sprintf (errmsg, "do_attach: couldn't open /proc file for process %d", + sprintf (errmsg, "do_attach: couldn't open /proc file for process %d", PIDGET (ptid)); dead_procinfo (pi, errmsg, NOKILL); } @@ -3601,7 +3609,7 @@ do_attach (ptid_t ptid) dead_procinfo (pi, "do_attach: couldn't save traced syscall entries.", NOKILL); if (!proc_get_traced_sysexit (pi, pi->saved_exitset)) - dead_procinfo (pi, "do_attach: couldn't save traced syscall exits.", + dead_procinfo (pi, "do_attach: couldn't save traced syscall exits.", NOKILL); if (!proc_get_held_signals (pi, &pi->saved_sighold)) dead_procinfo (pi, "do_attach: couldn't save held signals.", NOKILL); @@ -3685,15 +3693,15 @@ procfs_fetch_registers (int regno) /* First look up procinfo for the main process. */ pi = find_procinfo_or_die (pid, 0); - /* If the event thread is not the same as GDB's requested thread - (ie. inferior_ptid), then look up procinfo for the requested + /* If the event thread is not the same as GDB's requested thread + (ie. inferior_ptid), then look up procinfo for the requested thread. */ - if ((tid != 0) && + if ((tid != 0) && (tid != proc_get_current_thread (pi))) pi = find_procinfo_or_die (pid, tid); if (pi == NULL) - error ("procfs: fetch_registers failed to find procinfo for %s", + error ("procfs: fetch_registers failed to find procinfo for %s", target_pid_to_str (inferior_ptid)); if ((gregs = proc_get_gregs (pi)) == NULL) @@ -3733,7 +3741,7 @@ procfs_prepare_to_store (void) /* * store_registers * - * Since the /proc interface will not read individual registers, + * Since the /proc interface will not read individual registers, * we will cache these requests until the process is resumed, and * only then write them back to the inferior process. * @@ -3759,7 +3767,7 @@ procfs_store_registers (int regno) /* If current lwp for process is not the same as requested thread (ie. inferior_ptid), then find procinfo for the requested thread. */ - if ((tid != 0) && + if ((tid != 0) && (tid != proc_get_current_thread (pi))) pi = find_procinfo_or_die (pid, tid); @@ -3938,7 +3946,7 @@ wait_again: into a waitstatus for GDB. If we actually had to call wait because the /proc file - is gone (child terminated), then we skip this block, + is gone (child terminated), then we skip this block, because we already have a waitstatus. */ flags = proc_flags (pi); @@ -3979,20 +3987,20 @@ wait_again: { /* Handle SYS_exit call only */ /* Stopped at entry to SYS_exit. - Make it runnable, resume it, then use + Make it runnable, resume it, then use the wait system call to get its exit code. - Proc_run_process always clears the current + Proc_run_process always clears the current fault and signal. Then return its exit status. */ pi->status_valid = 0; wstat = 0; - /* FIXME: what we should do is return + /* FIXME: what we should do is return TARGET_WAITKIND_SPURIOUS. */ if (!proc_run_process (pi, 0, 0)) proc_error (pi, "target_wait, run_process", __LINE__); if (attach_flag) { - /* Don't call wait: simulate waiting for exit, + /* Don't call wait: simulate waiting for exit, return a "success" exit code. Bogus: what if it returns something else? */ wstat = 0; @@ -4028,7 +4036,7 @@ wait_again: { printf_filtered ("%ld syscall arguments:\n", nsysargs); for (i = 0; i < nsysargs; i++) - printf_filtered ("#%ld: 0x%08lx\n", + printf_filtered ("#%ld: 0x%08lx\n", i, sysargs[i]); } @@ -4099,7 +4107,7 @@ wait_again: SYS_fork, or SYS_vfork here? The old procfs seemed to use this event to handle threads on older (non-LWP) systems, where I'm assuming - that threads were actually separate processes. + that threads were actually separate processes. Irix, maybe? Anyway, low priority for now. */ } else @@ -4116,7 +4124,7 @@ wait_again: { printf_filtered ("%ld syscall arguments:\n", nsysargs); for (i = 0; i < nsysargs; i++) - printf_filtered ("#%ld: 0x%08lx\n", + printf_filtered ("#%ld: 0x%08lx\n", i, sysargs[i]); } } @@ -4147,7 +4155,7 @@ wait_again: temp_ptid = MERGEPID (pi->pid, temp_tid); if (!in_thread_list (temp_ptid)) { - printf_filtered ("[New %s]\n", + printf_filtered ("[New %s]\n", target_pid_to_str (temp_ptid)); add_thread (temp_ptid); } @@ -4225,9 +4233,9 @@ wait_again: !in_thread_list (retval)) { /* - * We have a new thread. + * We have a new thread. * We need to add it both to GDB's list and to our own. - * If we don't create a procinfo, resume may be unhappy + * If we don't create a procinfo, resume may be unhappy * later. */ printf_filtered ("[New %s]\n", target_pid_to_str (retval)); @@ -4236,16 +4244,16 @@ wait_again: create_procinfo (PIDGET (retval), TIDGET (retval)); /* In addition, it's possible that this is the first - * new thread we've seen, in which case we may not + * new thread we've seen, in which case we may not * have created entries for inferior_ptid yet. */ if (TIDGET (inferior_ptid) != 0) { if (!in_thread_list (inferior_ptid)) add_thread (inferior_ptid); - if (find_procinfo (PIDGET (inferior_ptid), + if (find_procinfo (PIDGET (inferior_ptid), TIDGET (inferior_ptid)) == NULL) - create_procinfo (PIDGET (inferior_ptid), + create_procinfo (PIDGET (inferior_ptid), TIDGET (inferior_ptid)); } } @@ -4267,6 +4275,40 @@ wait_again: return retval; } +/* Perform a partial transfer to/from the specified object. For + memory transfers, fall back to the old memory xfer functions. */ + +static LONGEST +procfs_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, + const void *writebuf, ULONGEST offset, LONGEST len) +{ + switch (object) + { + case TARGET_OBJECT_MEMORY: + if (readbuf) + return (*ops->to_xfer_memory) (offset, readbuf, len, 0/*write*/, + NULL, ops); + if (writebuf) + return (*ops->to_xfer_memory) (offset, readbuf, len, 1/*write*/, + NULL, ops); + return -1; + +#ifdef NEW_PROC_API + case TARGET_OBJECT_AUXV: + return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf, + offset, len); +#endif + + default: + if (ops->beneath != NULL) + return ops->beneath->to_xfer_partial (ops->beneath, object, annex, + readbuf, writebuf, offset, len); + return -1; + } +} + + /* Transfer LEN bytes between GDB address MYADDR and target address MEMADDR. If DOWRITE is non-zero, transfer them to the target, otherwise transfer them from the target. TARGET is unused. @@ -4325,7 +4367,7 @@ procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite, * If there are "dirty" caches that need to be written back * to the child process, do that. * - * File descriptors are also cached. + * File descriptors are also cached. * As they are a limited resource, we cannot hold onto them indefinitely. * However, as they are expensive to open, we don't want to throw them * away indescriminately either. As a compromise, we will keep the @@ -4333,7 +4375,7 @@ procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite, * descriptors we may have accumulated for the threads. * * Return value: - * As this function is called by iterate_over_threads, it always + * As this function is called by iterate_over_threads, it always * returns zero (so that iterate_over_threads will keep iterating). */ @@ -4357,14 +4399,14 @@ invalidate_cache (procinfo *parent, procinfo *pi, void *ptr) if (parent == NULL || proc_get_current_thread (parent) != pi->tid) if (!proc_set_fpregs (pi)) /* flush fpregs cache */ - proc_warn (pi, "target_resume, set_fpregs", + proc_warn (pi, "target_resume, set_fpregs", __LINE__); #endif if (parent != NULL) { /* The presence of a parent indicates that this is an LWP. - Close any file descriptors that it might have open. + Close any file descriptors that it might have open. We don't do this to the master (parent) procinfo. */ close_procinfo_files (pi); @@ -4412,10 +4454,10 @@ make_signal_thread_runnable (procinfo *process, procinfo *pi, void *ptr) * procfs_wait and wait for it to stop again (unles gdb is async). * * Arguments: - * step: if true, then arrange for the child to stop again + * step: if true, then arrange for the child to stop again * after executing a single instruction. * signo: if zero, then cancel any pending signal. - * If non-zero, then arrange for the indicated signal + * If non-zero, then arrange for the indicated signal * to be delivered to the child when it runs. * pid: if -1, then allow any child thread to run. * if non-zero, then allow only the indicated thread to run. @@ -4428,11 +4470,11 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo) procinfo *pi, *thread; int native_signo; - /* 2.1: + /* 2.1: prrun.prflags |= PRSVADDR; - prrun.pr_vaddr = $PC; set resume address + prrun.pr_vaddr = $PC; set resume address prrun.prflags |= PRSTRACE; trace signals in pr_trace (all) - prrun.prflags |= PRSFAULT; trace faults in pr_fault (all but PAGE) + prrun.prflags |= PRSFAULT; trace faults in pr_fault (all but PAGE) prrun.prflags |= PRCFAULT; clear current fault. PRSTRACE and PRSFAULT can be done by other means @@ -4461,7 +4503,7 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo) /* Running the process voids all cached registers and status. */ /* Void the threads' caches first */ - proc_iterate_over_threads (pi, invalidate_cache, NULL); + proc_iterate_over_threads (pi, invalidate_cache, NULL); /* Void the process procinfo's caches. */ invalidate_cache (NULL, pi, NULL); @@ -4481,7 +4523,7 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo) proc_error (pi, "target_resume, set_async", __LINE__); #endif #if 0 - proc_iterate_over_threads (pi, + proc_iterate_over_threads (pi, make_signal_thread_runnable, NULL); #endif @@ -4502,7 +4544,7 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo) /* * Function: register_gdb_signals * - * Traverse the list of signals that GDB knows about + * Traverse the list of signals that GDB knows about * (see "handle" command), and arrange for the target * to be stopped or not, according to these settings. * @@ -4554,7 +4596,7 @@ static void procfs_files_info (struct target_ops *ignore) { printf_filtered ("\tUsing the running image of %s %s via /proc.\n", - attach_flag? "attached": "child", + attach_flag? "attached": "child", target_pid_to_str (inferior_ptid)); } @@ -4573,7 +4615,7 @@ procfs_open (char *args, int from_tty) /* * Function: target_can_run * - * This tells GDB that this target vector can be invoked + * This tells GDB that this target vector can be invoked * for "run" or "attach". */ @@ -4590,7 +4632,7 @@ procfs_can_run (void) may layer their own process structure atop that provided here. sol-thread.c does this because of the Solaris two-level thread model. */ - + /* NOTE: possibly obsolete -- use the thread_stratum approach instead. */ return !procfs_suppress_run; @@ -4615,7 +4657,7 @@ procfs_stop (void) * Function: unconditionally_kill_inferior * * Make it die. Wait for it to die. Clean up after it. - * Note: this should only be applied to the real process, + * Note: this should only be applied to the real process, * not to an LWP, because of the check for parent-process. * If we need this to work for an LWP, it needs some more logic. */ @@ -4662,7 +4704,7 @@ unconditionally_kill_inferior (procinfo *pi) /* If pi is GDB's child, wait for it to die. */ if (parent_pid == getpid ()) - /* FIXME: should we use waitpid to make sure we get the right event? + /* FIXME: should we use waitpid to make sure we get the right event? Should we check the returned event? */ { #if 0 @@ -4682,7 +4724,7 @@ unconditionally_kill_inferior (procinfo *pi) * Then we want GDB to forget all about it. */ -static void +static void procfs_kill_inferior (void) { if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */ @@ -4702,7 +4744,7 @@ procfs_kill_inferior (void) * Forget we ever debugged this thing! */ -static void +static void procfs_mourn_inferior (void) { procinfo *pi; @@ -4721,13 +4763,13 @@ procfs_mourn_inferior (void) /* * Function: init_inferior * - * When GDB forks to create a runnable inferior process, + * When GDB forks to create a runnable inferior process, * this function is called on the parent side of the fork. * It's job is to do whatever is necessary to make the child * ready to be debugged, and then wait for the child to synchronize. */ -static void +static void procfs_init_inferior (int pid) { procinfo *pi; @@ -4912,7 +4954,7 @@ procfs_set_exec_trap (void) if (!proc_unset_run_on_last_close (pi)) proc_warn (pi, "set_exec_trap, unset_RLC", __LINE__); - /* FIXME: No need to destroy the procinfo -- + /* FIXME: No need to destroy the procinfo -- we have our own address space, and we're about to do an exec! */ /*destroy_procinfo (pi);*/ } @@ -4921,10 +4963,10 @@ procfs_set_exec_trap (void) * Function: create_inferior * * This function is called BEFORE gdb forks the inferior process. - * Its only real responsibility is to set things up for the fork, + * Its only real responsibility is to set things up for the fork, * and tell GDB which two functions to call after the fork (one * for the parent, and one for the child). - * + * * This function does a complicated search for a unix shell program, * which it then uses to parse arguments and environment variables * to be sent to the child. I wonder whether this code could not @@ -5005,7 +5047,7 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env) shell_file = tryname; } - fork_inferior (exec_file, allargs, env, procfs_set_exec_trap, + fork_inferior (exec_file, allargs, env, procfs_set_exec_trap, procfs_init_inferior, NULL, shell_file); /* We are at the first instruction we care about. */ @@ -5035,7 +5077,7 @@ procfs_notice_thread (procinfo *pi, procinfo *thread, void *ptr) /* * Function: target_find_new_threads * - * Query all the threads that the target knows about, + * Query all the threads that the target knows about, * and give them back to GDB to add to its list. */ @@ -5050,7 +5092,7 @@ procfs_find_new_threads (void) proc_iterate_over_threads (pi, procfs_notice_thread, NULL); } -/* +/* * Function: target_thread_alive * * Return true if the thread is still 'alive'. @@ -5085,7 +5127,7 @@ procfs_thread_alive (ptid_t ptid) /* * Function: target_pid_to_str * - * Return a string to be used to identify the thread in + * Return a string to be used to identify the thread in * the "info threads" display. */ @@ -5112,16 +5154,16 @@ procfs_pid_to_str (ptid_t ptid) * Insert a watchpoint */ -int +int procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, int after) { #ifndef UNIXWARE #ifndef AIX5 int pflags = 0; - procinfo *pi; + procinfo *pi; - pi = find_procinfo_or_die (PIDGET (ptid) == -1 ? + pi = find_procinfo_or_die (PIDGET (ptid) == -1 ? PIDGET (inferior_ptid) : PIDGET (ptid), 0); /* Translate from GDB's flags to /proc's */ @@ -5166,7 +5208,7 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, is one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_watchpoint. CNT is the number of watchpoints used so far. - + Note: procfs_can_use_hw_breakpoint() is not yet used by all procfs.c targets due to the fact that some of them still define TARGET_CAN_USE_HARDWARE_WATCHPOINT. */ @@ -5206,7 +5248,7 @@ procfs_stopped_by_watchpoint (ptid_t ptid) { procinfo *pi; - pi = find_procinfo_or_die (PIDGET (ptid) == -1 ? + pi = find_procinfo_or_die (PIDGET (ptid) == -1 ? PIDGET (inferior_ptid) : PIDGET (ptid), 0); if (!pi) /* If no process, then not stopped by watchpoint! */ @@ -5215,7 +5257,7 @@ procfs_stopped_by_watchpoint (ptid_t ptid) if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP)) { if (proc_why (pi) == PR_FAULTED) - { + { #ifdef FLTWATCH if (proc_what (pi) == FLTWATCH) return 1; @@ -5231,7 +5273,7 @@ procfs_stopped_by_watchpoint (ptid_t ptid) #ifdef TM_I386SOL2_H /* - * Function: procfs_find_LDT_entry + * Function: procfs_find_LDT_entry * * Input: * ptid_t ptid; // The GDB-style pid-plus-LWP. @@ -5273,7 +5315,7 @@ procfs_find_LDT_entry (ptid_t ptid) * Memory Mappings Functions: */ -/* +/* * Function: iterate_over_mappings * * Call a callback function once for each mapping, passing it the mapping, @@ -5287,14 +5329,14 @@ procfs_find_LDT_entry (ptid_t ptid) * child_func -- optional secondary function pointer to be passed * to the child function. * - * Return: First non-zero return value from the callback function, + * Return: First non-zero return value from the callback function, * or zero. */ static int -iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data, - int (*func) (struct prmap *map, - int (*child_func) (), +iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data, + int (*func) (struct prmap *map, + int (*child_func) (), void *data)) { char pathname[MAX_PROC_NAME_SIZE]; @@ -5307,7 +5349,7 @@ iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data, struct stat sbuf; #endif - /* Get the number of mappings, allocate space, + /* Get the number of mappings, allocate space, and read the mappings into prmaps. */ #ifdef NEW_PROC_API /* Open map fd. */ @@ -5318,7 +5360,7 @@ iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data, /* Make sure it gets closed again. */ make_cleanup_close (map_fd); - /* Use stat to determine the file size, and compute + /* Use stat to determine the file size, and compute the number of prmap_t objects it contains. */ if (fstat (map_fd, &sbuf) != 0) proc_error (pi, "iterate_over_mappings (fstat)", __LINE__); @@ -5348,10 +5390,10 @@ iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data, /* * Function: solib_mappings_callback * - * Calls the supplied callback function once for each mapped address - * space in the process. The callback function receives an open - * file descriptor for the file corresponding to that mapped - * address space (if there is one), and the base address of the + * Calls the supplied callback function once for each mapped address + * space in the process. The callback function receives an open + * file descriptor for the file corresponding to that mapped + * address space (if there is one), and the base address of the * mapped space. Quit when the callback function returns a * nonzero value, or at teh end of the mappings. * @@ -5359,7 +5401,7 @@ iterate_over_mappings (procinfo *pi, int (*child_func) (), void *data, * or zero. */ -int solib_mappings_callback (struct prmap *map, +int solib_mappings_callback (struct prmap *map, int (*func) (int, CORE_ADDR), void *data) { @@ -5382,14 +5424,14 @@ int solib_mappings_callback (struct prmap *map, /* Note: caller's responsibility to close this fd! */ fd = open_with_retry (name, O_RDONLY); /* Note: we don't test the above call for failure; - we just pass the FD on as given. Sometimes there is + we just pass the FD on as given. Sometimes there is no file, so the open may return failure, but that's not a problem. */ } #else fd = ioctl (pi->ctl_fd, PIOCOPENM, &map->pr_vaddr); /* Note: we don't test the above call for failure; - we just pass the FD on as given. Sometimes there is + we just pass the FD on as given. Sometimes there is no file, so the ioctl may return failure, but that's not a problem. */ #endif @@ -5403,7 +5445,7 @@ int solib_mappings_callback (struct prmap *map, * to implement the exported interface to solib-svr4.c. * * Given a pointer to a function, call that function once for every - * mapped address space in the process. The callback function + * mapped address space in the process. The callback function * receives an open file descriptor for the file corresponding to * that mapped address space (if there is one), and the base address * of the mapped space. Quit when the callback function returns a @@ -5428,27 +5470,27 @@ proc_iterate_over_mappings (int (*func) (int, CORE_ADDR)) * Calls an external function for each memory region. * External function will have the signiture: * - * int callback (CORE_ADDR vaddr, - * unsigned long size, - * int read, int write, int execute, + * int callback (CORE_ADDR vaddr, + * unsigned long size, + * int read, int write, int execute, * void *data); * * Returns the integer value returned by the callback. */ static int -find_memory_regions_callback (struct prmap *map, - int (*func) (CORE_ADDR, - unsigned long, - int, int, int, +find_memory_regions_callback (struct prmap *map, + int (*func) (CORE_ADDR, + unsigned long, + int, int, int, void *), void *data) { return (*func) ((CORE_ADDR) map->pr_vaddr, - map->pr_size, + map->pr_size, (map->pr_mflags & MA_READ) != 0, (map->pr_mflags & MA_WRITE) != 0, - (map->pr_mflags & MA_EXEC) != 0, + (map->pr_mflags & MA_EXEC) != 0, data); } @@ -5458,25 +5500,25 @@ find_memory_regions_callback (struct prmap *map, * External interface. Calls a callback function once for each * mapped memory region in the child process, passing as arguments * CORE_ADDR virtual_address, - * unsigned long size, + * unsigned long size, * int read, TRUE if region is readable by the child * int write, TRUE if region is writable by the child * int execute TRUE if region is executable by the child. - * + * * Stops iterating and returns the first non-zero value * returned by the callback. */ static int -proc_find_memory_regions (int (*func) (CORE_ADDR, - unsigned long, - int, int, int, - void *), +proc_find_memory_regions (int (*func) (CORE_ADDR, + unsigned long, + int, int, int, + void *), void *data) { procinfo *pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0); - return iterate_over_mappings (pi, func, data, + return iterate_over_mappings (pi, func, data, find_memory_regions_callback); } @@ -5527,12 +5569,12 @@ info_mappings_callback (struct prmap *map, int (*ignore) (), void *unused) else data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n"; - printf_filtered (data_fmt_string, + printf_filtered (data_fmt_string, (unsigned long) map->pr_vaddr, (unsigned long) map->pr_vaddr + map->pr_size - 1, map->pr_size, #ifdef PCAGENT /* Horrible hack: only defined on Solaris 2.6+ */ - (unsigned int) map->pr_offset, + (unsigned int) map->pr_offset, #else map->pr_off, #endif @@ -5561,7 +5603,7 @@ info_proc_mappings (procinfo *pi, int summary) return; /* No output for summary mode. */ printf_filtered ("Mapped address spaces:\n\n"); - printf_filtered (header_fmt_string, + printf_filtered (header_fmt_string, "Start Addr", " End Addr", " Size", @@ -5631,7 +5673,7 @@ info_proc_cmd (char *args, int from_tty) process = find_procinfo (pid, 0); if (process == NULL) { - /* No. So open a procinfo for it, but + /* No. So open a procinfo for it, but remember to close it again when finished. */ process = create_procinfo (pid, 0); make_cleanup (do_destroy_procinfo_cleanup, process); @@ -5649,7 +5691,7 @@ info_proc_cmd (char *args, int from_tty) if (proc_flags (process) & (PR_STOPPED | PR_ISTOP)) proc_prettyprint_why (proc_why (process), proc_what (process), 1); if (proc_get_nthreads (process) > 1) - printf_filtered ("Process has %d threads.\n", + printf_filtered ("Process has %d threads.\n", proc_get_nthreads (process)); } if (thread) @@ -5711,25 +5753,25 @@ proc_trace_syscalls (char *args, int from_tty, int entry_or_exit, int mode) } } -static void +static void proc_trace_sysentry_cmd (char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSENTRY, FLAG_SET); } -static void +static void proc_trace_sysexit_cmd (char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_SET); } -static void +static void proc_untrace_sysentry_cmd (char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSENTRY, FLAG_RESET); } -static void +static void proc_untrace_sysexit_cmd (char *args, int from_tty) { proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_RESET); @@ -5741,17 +5783,17 @@ _initialize_procfs (void) { init_procfs_ops (); add_target (&procfs_ops); - add_info ("proc", info_proc_cmd, + add_info ("proc", info_proc_cmd, "Show /proc process information about any running process.\n\ Specify process id, or use the program being debugged by default.\n\ Specify keyword 'mappings' for detailed info on memory mappings."); - add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd, + add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd, "Give a trace of entries into the syscall."); - add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd, + add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd, "Give a trace of exits from the syscall."); - add_com ("proc-untrace-entry", no_class, proc_untrace_sysentry_cmd, + add_com ("proc-untrace-entry", no_class, proc_untrace_sysentry_cmd, "Cancel a trace of entries into the syscall."); - add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd, + add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd, "Cancel a trace of exits from the syscall."); } @@ -5780,7 +5822,7 @@ procfs_first_available (void) /* gcore only implemented on solaris and unixware (so far) */ static char * -procfs_do_thread_registers (bfd *obfd, ptid_t ptid, +procfs_do_thread_registers (bfd *obfd, ptid_t ptid, char *note_data, int *note_size) { gdb_gregset_t gregs; @@ -5794,14 +5836,14 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid, note_data = (char *) elfcore_write_lwpstatus (obfd, note_data, note_size, - merged_pid, + merged_pid, stop_signal, &gregs); #else note_data = (char *) elfcore_write_prstatus (obfd, note_data, note_size, - merged_pid, + merged_pid, stop_signal, &gregs); #endif @@ -5829,8 +5871,8 @@ procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data) { ptid_t saved_ptid = inferior_ptid; inferior_ptid = MERGEPID (pi->pid, thread->tid); - args->note_data = procfs_do_thread_registers (args->obfd, inferior_ptid, - args->note_data, + args->note_data = procfs_do_thread_registers (args->obfd, inferior_ptid, + args->note_data, args->note_size); inferior_ptid = saved_ptid; } @@ -5849,34 +5891,36 @@ procfs_make_note_section (bfd *obfd, int *note_size) char *note_data = NULL; char *inf_args; struct procfs_corefile_thread_data thread_args; + char *auxv; + int auxv_len; if (get_exec_file (0)) { strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname)); - strncpy (psargs, get_exec_file (0), + strncpy (psargs, get_exec_file (0), sizeof (psargs)); inf_args = get_inferior_args (); if (inf_args && *inf_args && strlen (inf_args) < ((int) sizeof (psargs) - (int) strlen (psargs))) { - strncat (psargs, " ", + strncat (psargs, " ", sizeof (psargs) - strlen (psargs)); - strncat (psargs, inf_args, + strncat (psargs, inf_args, sizeof (psargs) - strlen (psargs)); } } - note_data = (char *) elfcore_write_prpsinfo (obfd, - note_data, - note_size, - fname, + note_data = (char *) elfcore_write_prpsinfo (obfd, + note_data, + note_size, + fname, psargs); #ifdef UNIXWARE fill_gregset (&gregs, -1); - note_data = elfcore_write_pstatus (obfd, note_data, note_size, - PIDGET (inferior_ptid), + note_data = elfcore_write_pstatus (obfd, note_data, note_size, + PIDGET (inferior_ptid), stop_signal, &gregs); #endif @@ -5889,7 +5933,7 @@ procfs_make_note_section (bfd *obfd, int *note_size) { /* iterate_over_threads didn't come up with any threads; just use inferior_ptid. */ - note_data = procfs_do_thread_registers (obfd, inferior_ptid, + note_data = procfs_do_thread_registers (obfd, inferior_ptid, note_data, note_size); } else @@ -5897,6 +5941,14 @@ procfs_make_note_section (bfd *obfd, int *note_size) note_data = thread_args.note_data; } + auxv_len = target_auxv_read (¤t_target, &auxv); + if (auxv_len > 0) + { + note_data = elfcore_write_note (obfd, note_data, note_size, + "CORE", NT_AUXV, auxv, auxv_len); + xfree (auxv); + } + make_cleanup (xfree, note_data); return note_data; } diff --git a/gdb/regcache.c b/gdb/regcache.c index 504196d..7c40383 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1,7 +1,7 @@ /* Cache and manage the values of registers for GDB, the GNU debugger. Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -459,7 +459,7 @@ regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src) gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); /* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough move of data into the current_regcache(). Doing this would be - silly - it would mean that valid_p would be completly invalid. */ + silly - it would mean that valid_p would be completely invalid. */ gdb_assert (dst != current_regcache); memcpy (dst->registers, src->registers, dst->descr->sizeof_raw_registers); memcpy (dst->register_valid_p, src->register_valid_p, diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index ead40f0..281872e 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -364,12 +364,6 @@ remote_fileio_to_be (LONGEST num, char *buf, int bytes) } 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); diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index aa005a7..268ed32 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -66,8 +66,6 @@ static void arm_rdi_fetch_registers (int regno); static void arm_rdi_resume (ptid_t pid, int step, enum target_signal siggnal); -static int arm_rdi_start_remote (char *dummy); - static void arm_rdi_open (char *name, int from_tty); static void arm_rdi_create_inferior (char *exec_file, char *args, char **env); @@ -82,12 +80,6 @@ static void arm_rdi_kill (void); static void arm_rdi_detach (char *args, int from_tty); -static void arm_rdi_interrupt (int signo); - -static void arm_rdi_interrupt_twice (int signo); - -static void interrupt_query (void); - static int arm_rdi_insert_breakpoint (CORE_ADDR, char *); static int arm_rdi_remove_breakpoint (CORE_ADDR, char *); @@ -130,15 +122,6 @@ static struct local_bp_list_entry } *local_bp_list; - -/* Stub for catch_errors. */ - -static int -arm_rdi_start_remote (char *dummy) -{ - return 1; -} - /* Helper callbacks for the "host interface" structure. RDI functions call these to forward output from the target system and so forth. */ @@ -479,29 +462,6 @@ arm_rdi_resume (ptid_t ptid, int step, enum target_signal siggnal) } } -/* Send ^C to target to halt it. Target will respond, and send us a - packet. */ - -static void -arm_rdi_interrupt (int signo) -{ -} - -static void (*ofunc) (); - -/* The user typed ^C twice. */ -static void -arm_rdi_interrupt_twice (int signo) -{ -} - -/* Ask the user what to do when an interrupt is received. */ - -static void -interrupt_query (void) -{ -} - /* Wait until the remote machine stops, then return, storing status in STATUS just as `wait' would. Returns "pid" (though it's not clear what, if anything, that means in the case of this target). */ diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index b1dc94e..9b0b3fd 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -1,7 +1,7 @@ /* Generic remote debugging interface for simulators. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002 Free Software Foundation, Inc. + 2002, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support. Steve Chamberlain (sac@cygnus.com). @@ -221,7 +221,7 @@ gdb_os_write_stderr (host_callback *p, const char *buf, int len) { b[0] = buf[i]; b[1] = 0; - fputs_unfiltered (b, gdb_stdtarg); + fputs_unfiltered (b, gdb_stdtargerr); } return len; } @@ -231,7 +231,7 @@ gdb_os_write_stderr (host_callback *p, const char *buf, int len) static void gdb_os_flush_stderr (host_callback *p) { - gdb_flush (gdb_stderr); + gdb_flush (gdb_stdtargerr); } /* GDB version of printf_filtered callback. */ diff --git a/gdb/remote.c b/gdb/remote.c index 617e55d..99f51a3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -152,10 +152,6 @@ static void init_remote_ops (void); static void init_extended_remote_ops (void); -static void init_remote_cisco_ops (void); - -static struct target_ops remote_cisco_ops; - static void remote_stop (void); static int ishex (int ch, int *val); @@ -373,10 +369,6 @@ static int remote_break; starts. */ static struct serial *remote_desc = NULL; -/* This is set by the target (thru the 'S' message) - to denote that the target is in kernel mode. */ -static int cisco_kernel_mode = 0; - /* This variable sets the number of bits in an address that are to be sent in a memory ("M" or "m") packet. Normally, after stripping leading zeros, the entire address would be sent. This variable @@ -1994,123 +1986,6 @@ get_offsets (void) objfile_relocate (symfile_objfile, offs); } -/* - * Cisco version of section offsets: - * - * Instead of having GDB query the target for the section offsets, - * Cisco lets the target volunteer the information! It's also in - * a different format, so here are the functions that will decode - * a section offset packet from a Cisco target. - */ - -/* - * Function: remote_cisco_section_offsets - * - * Returns: zero for success, non-zero for failure - */ - -static int -remote_cisco_section_offsets (bfd_vma text_addr, - bfd_vma data_addr, - bfd_vma bss_addr, - bfd_signed_vma *text_offs, - bfd_signed_vma *data_offs, - bfd_signed_vma *bss_offs) -{ - bfd_vma text_base, data_base, bss_base; - struct minimal_symbol *start; - asection *sect; - bfd *abfd; - int len; - - if (symfile_objfile == NULL) - return -1; /* no can do nothin' */ - - start = lookup_minimal_symbol ("_start", NULL, NULL); - if (start == NULL) - return -1; /* Can't find "_start" symbol */ - - data_base = bss_base = 0; - text_base = SYMBOL_VALUE_ADDRESS (start); - - abfd = symfile_objfile->obfd; - for (sect = abfd->sections; - sect != 0; - sect = sect->next) - { - const char *p = bfd_get_section_name (abfd, sect); - len = strlen (p); - if (strcmp (p + len - 4, "data") == 0) /* ends in "data" */ - if (data_base == 0 || - data_base > bfd_get_section_vma (abfd, sect)) - data_base = bfd_get_section_vma (abfd, sect); - if (strcmp (p + len - 3, "bss") == 0) /* ends in "bss" */ - if (bss_base == 0 || - bss_base > bfd_get_section_vma (abfd, sect)) - bss_base = bfd_get_section_vma (abfd, sect); - } - *text_offs = text_addr - text_base; - *data_offs = data_addr - data_base; - *bss_offs = bss_addr - bss_base; - if (remote_debug) - { - char tmp[128]; - - sprintf (tmp, "VMA: text = 0x"); - sprintf_vma (tmp + strlen (tmp), text_addr); - sprintf (tmp + strlen (tmp), " data = 0x"); - sprintf_vma (tmp + strlen (tmp), data_addr); - sprintf (tmp + strlen (tmp), " bss = 0x"); - sprintf_vma (tmp + strlen (tmp), bss_addr); - fputs_filtered (tmp, gdb_stdlog); - fprintf_filtered (gdb_stdlog, - "Reloc offset: text = 0x%s data = 0x%s bss = 0x%s\n", - paddr_nz (*text_offs), - paddr_nz (*data_offs), - paddr_nz (*bss_offs)); - } - - return 0; -} - -/* - * Function: remote_cisco_objfile_relocate - * - * Relocate the symbol file for a remote target. - */ - -void -remote_cisco_objfile_relocate (bfd_signed_vma text_off, bfd_signed_vma data_off, - bfd_signed_vma bss_off) -{ - struct section_offsets *offs; - - if (text_off != 0 || data_off != 0 || bss_off != 0) - { - /* FIXME: This code assumes gdb-stabs.h is being used; it's - broken for xcoff, dwarf, sdb-coff, etc. But there is no - simple canonical representation for this stuff. */ - - 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; - offs->offsets[SECT_OFF_BSS (symfile_objfile)] = bss_off; - - /* First call the standard objfile_relocate. */ - objfile_relocate (symfile_objfile, offs); - - /* Now we need to fix up the section entries already attached to - the exec target. These entries will control memory transfers - from the exec file. */ - - exec_set_section_offsets (text_off, data_off, bss_off); - } -} - /* Stub for catch_errors. */ static int @@ -3097,70 +2972,10 @@ Packet: '%s'\n", if (buf[3] == 'p') { - /* Export Cisco kernel mode as a convenience variable - (so that it can be used in the GDB prompt if desired). */ - - if (cisco_kernel_mode == 1) - set_internalvar (lookup_internalvar ("cisco_kernel_mode"), - value_from_string ("PDEBUG-")); - cisco_kernel_mode = 0; thread_num = strtol ((const char *) &buf[4], NULL, 16); record_currthread (thread_num); } - else if (buf[3] == 'k') - { - /* Export Cisco kernel mode as a convenience variable - (so that it can be used in the GDB prompt if desired). */ - - if (cisco_kernel_mode == 1) - set_internalvar (lookup_internalvar ("cisco_kernel_mode"), - value_from_string ("KDEBUG-")); - cisco_kernel_mode = 1; - } goto got_status; - case 'N': /* Cisco special: status and offsets */ - { - bfd_vma text_addr, data_addr, bss_addr; - bfd_signed_vma text_off, data_off, bss_off; - unsigned char *p1; - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = (enum target_signal) - (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); - - if (symfile_objfile == NULL) - { - warning ("Relocation packet received with no symbol file. \ -Packet Dropped"); - goto got_status; - } - - /* Relocate object file. Buffer format is NAATT;DD;BB - * where AA is the signal number, TT is the new text - * address, DD * is the new data address, and BB is the - * new bss address. */ - - p = &buf[3]; - text_addr = strtoul (p, (char **) &p1, 16); - if (p1 == p || *p1 != ';') - warning ("Malformed relocation packet: Packet '%s'", buf); - p = p1 + 1; - data_addr = strtoul (p, (char **) &p1, 16); - if (p1 == p || *p1 != ';') - warning ("Malformed relocation packet: Packet '%s'", buf); - p = p1 + 1; - bss_addr = strtoul (p, (char **) &p1, 16); - if (p1 == p) - warning ("Malformed relocation packet: Packet '%s'", buf); - - if (remote_cisco_section_offsets (text_addr, data_addr, bss_addr, - &text_off, &data_off, &bss_off) - == 0) - if (text_off != 0 || data_off != 0 || bss_off != 0) - remote_cisco_objfile_relocate (text_off, data_off, bss_off); - - goto got_status; - } case 'W': /* Target exited */ { /* The remote process exited. */ @@ -3346,70 +3161,10 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status) if (buf[3] == 'p') { - /* Export Cisco kernel mode as a convenience variable - (so that it can be used in the GDB prompt if desired). */ - - if (cisco_kernel_mode == 1) - set_internalvar (lookup_internalvar ("cisco_kernel_mode"), - value_from_string ("PDEBUG-")); - cisco_kernel_mode = 0; thread_num = strtol ((const char *) &buf[4], NULL, 16); record_currthread (thread_num); } - else if (buf[3] == 'k') - { - /* Export Cisco kernel mode as a convenience variable - (so that it can be used in the GDB prompt if desired). */ - - if (cisco_kernel_mode == 1) - set_internalvar (lookup_internalvar ("cisco_kernel_mode"), - value_from_string ("KDEBUG-")); - cisco_kernel_mode = 1; - } goto got_status; - case 'N': /* Cisco special: status and offsets */ - { - bfd_vma text_addr, data_addr, bss_addr; - bfd_signed_vma text_off, data_off, bss_off; - unsigned char *p1; - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = (enum target_signal) - (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))); - - if (symfile_objfile == NULL) - { - warning ("Relocation packet recieved with no symbol file. \ -Packet Dropped"); - goto got_status; - } - - /* Relocate object file. Buffer format is NAATT;DD;BB - * where AA is the signal number, TT is the new text - * address, DD * is the new data address, and BB is the - * new bss address. */ - - p = &buf[3]; - text_addr = strtoul (p, (char **) &p1, 16); - if (p1 == p || *p1 != ';') - warning ("Malformed relocation packet: Packet '%s'", buf); - p = p1 + 1; - data_addr = strtoul (p, (char **) &p1, 16); - if (p1 == p || *p1 != ';') - warning ("Malformed relocation packet: Packet '%s'", buf); - p = p1 + 1; - bss_addr = strtoul (p, (char **) &p1, 16); - if (p1 == p) - warning ("Malformed relocation packet: Packet '%s'", buf); - - if (remote_cisco_section_offsets (text_addr, data_addr, bss_addr, - &text_off, &data_off, &bss_off) - == 0) - if (text_off != 0 || data_off != 0 || bss_off != 0) - remote_cisco_objfile_relocate (text_off, data_off, bss_off); - - goto got_status; - } case 'W': /* Target exited */ { /* The remote process exited. */ @@ -4250,8 +4005,6 @@ putpkt_binary (char *buf, int cnt) } } -static int remote_cisco_mode; - /* Come here after finding the start of the frame. Collect the rest into BUF, verifying the checksum, length, and handling run-length compression. No more than sizeof_buf-1 characters are read so that @@ -4333,24 +4086,9 @@ read_frame (char *buf, int repeat; csum += c; - if (remote_cisco_mode == 0) - { - c = readchar (remote_timeout); - csum += c; - repeat = c - ' ' + 3; /* Compute repeat count */ - } - else - { - /* Cisco's run-length encoding variant uses two - hex chars to represent the repeat count. */ - - c = readchar (remote_timeout); - csum += c; - repeat = fromhex (c) << 4; - c = readchar (remote_timeout); - csum += c; - repeat += fromhex (c); - } + c = readchar (remote_timeout); + csum += c; + repeat = c - ' ' + 3; /* Compute repeat count */ /* The character before ``*'' is repeated. */ @@ -5488,409 +5226,6 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", extended_remote_ops.to_mourn_inferior = extended_remote_mourn; } -/* - * Command: info remote-process - * - * This implements Cisco's version of the "info proc" command. - * - * This query allows the target stub to return an arbitrary string - * (or strings) giving arbitrary information about the target process. - * This is optional; the target stub isn't required to implement it. - * - * Syntax: qfProcessInfo request first string - * qsProcessInfo request subsequent string - * reply: 'O'<hex-encoded-string> - * 'l' last reply (empty) - */ - -static void -remote_info_process (char *args, int from_tty) -{ - struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); - - if (remote_desc == 0) - error ("Command can only be used when connected to the remote target."); - - putpkt ("qfProcessInfo"); - getpkt (buf, (rs->remote_packet_size), 0); - if (buf[0] == 0) - return; /* Silently: target does not support this feature. */ - - if (buf[0] == 'E') - error ("info proc: target error."); - - while (buf[0] == 'O') /* Capitol-O packet */ - { - remote_console_output (&buf[1]); - putpkt ("qsProcessInfo"); - getpkt (buf, (rs->remote_packet_size), 0); - } -} - -/* - * Target Cisco - */ - -static void -remote_cisco_open (char *name, int from_tty) -{ - int ex; - if (name == 0) - error ("To open a remote debug connection, you need to specify what \n" - "device is attached to the remote system (e.g. host:port)."); - - /* See FIXME above */ - wait_forever_enabled_p = 1; - - target_preopen (from_tty); - - unpush_target (&remote_cisco_ops); - - remote_desc = remote_serial_open (name); - if (!remote_desc) - perror_with_name (name); - - /* - * If a baud rate was specified on the gdb command line it will - * be greater than the initial value of -1. If it is, use it otherwise - * default to 9600 - */ - - baud_rate = (baud_rate > 0) ? baud_rate : 9600; - if (serial_setbaudrate (remote_desc, baud_rate)) - { - /* The requested speed could not be set. Error out to - top level after closing remote_desc. Take care to - set remote_desc to NULL to avoid closing remote_desc - more than once. */ - serial_close (remote_desc); - remote_desc = NULL; - perror_with_name (name); - } - - serial_raw (remote_desc); - - /* If there is something sitting in the buffer we might take it as a - response to a command, which would be bad. */ - serial_flush_input (remote_desc); - - if (from_tty) - { - puts_filtered ("Remote debugging using "); - puts_filtered (name); - puts_filtered ("\n"); - } - - remote_cisco_mode = 1; - - push_target (&remote_cisco_ops); /* Switch to using cisco target now */ - - init_all_packet_configs (); - - general_thread = -2; - continue_thread = -2; - - /* Probe for ability to use "ThreadInfo" query, as required. */ - use_threadinfo_query = 1; - use_threadextra_query = 1; - - /* Without this, some commands which require an active target (such - as kill) won't work. This variable serves (at least) double duty - as both the pid of the target process (if it has such), and as a - flag indicating that a target is active. These functions should - be split out into seperate variables, especially since GDB will - someday have a notion of debugging several processes. */ - inferior_ptid = pid_to_ptid (MAGIC_NULL_PID); - - /* Start the remote connection; if error, discard this target. See - the comments in remote_open_1() for further details such as the - need to re-throw the exception. */ - ex = catch_exceptions (uiout, - remote_start_remote_dummy, NULL, - "Couldn't establish connection to remote" - " target\n", - RETURN_MASK_ALL); - if (ex < 0) - { - pop_target (); - throw_exception (ex); - } -} - -static void -remote_cisco_close (int quitting) -{ - remote_cisco_mode = 0; - remote_close (quitting); -} - -static void -remote_cisco_mourn (void) -{ - remote_mourn_1 (&remote_cisco_ops); -} - -enum -{ - READ_MORE, - FATAL_ERROR, - ENTER_DEBUG, - DISCONNECT_TELNET -} -minitelnet_return; - -/* Shared between readsocket() and readtty(). The size is arbitrary, - however all targets are known to support a 400 character packet. */ -static char tty_input[400]; - -static int escape_count; -static int echo_check; -extern int quit_flag; - -static int -readsocket (void) -{ - int data; - - /* Loop until the socket doesn't have any more data */ - - while ((data = readchar (0)) >= 0) - { - /* Check for the escape sequence */ - if (data == '|') - { - /* If this is the fourth escape, get out */ - if (++escape_count == 4) - { - return ENTER_DEBUG; - } - else - { /* This is a '|', but not the fourth in a row. - Continue without echoing it. If it isn't actually - one of four in a row, it'll be echoed later. */ - continue; - } - } - else - /* Not a '|' */ - { - /* Ensure any pending '|'s are flushed. */ - - for (; escape_count > 0; escape_count--) - putchar ('|'); - } - - if (data == '\r') /* If this is a return character, */ - continue; /* - just supress it. */ - - if (echo_check != -1) /* Check for echo of user input. */ - { - if (tty_input[echo_check] == data) - { - gdb_assert (echo_check <= sizeof (tty_input)); - echo_check++; /* Character matched user input: */ - continue; /* Continue without echoing it. */ - } - else if ((data == '\n') && (tty_input[echo_check] == '\r')) - { /* End of the line (and of echo checking). */ - echo_check = -1; /* No more echo supression */ - continue; /* Continue without echoing. */ - } - else - { /* Failed check for echo of user input. - We now have some suppressed output to flush! */ - int j; - - for (j = 0; j < echo_check; j++) - putchar (tty_input[j]); - echo_check = -1; - } - } - putchar (data); /* Default case: output the char. */ - } - - if (data == SERIAL_TIMEOUT) /* Timeout returned from readchar. */ - return READ_MORE; /* Try to read some more */ - else - return FATAL_ERROR; /* Trouble, bail out */ -} - -static int -readtty (void) -{ - int tty_bytecount; - - /* First, read a buffer full from the terminal */ - tty_bytecount = read (fileno (stdin), tty_input, sizeof (tty_input) - 1); - if (tty_bytecount == -1) - { - perror ("readtty: read failed"); - return FATAL_ERROR; - } - - /* Remove a quoted newline. */ - if (tty_input[tty_bytecount - 1] == '\n' && - tty_input[tty_bytecount - 2] == '\\') /* line ending in backslash */ - { - tty_input[--tty_bytecount] = 0; /* remove newline */ - tty_input[--tty_bytecount] = 0; /* remove backslash */ - } - - /* Turn trailing newlines into returns */ - if (tty_input[tty_bytecount - 1] == '\n') - tty_input[tty_bytecount - 1] = '\r'; - - /* If the line consists of a ~, enter debugging mode. */ - if ((tty_input[0] == '~') && (tty_bytecount == 2)) - return ENTER_DEBUG; - - /* Make this a zero terminated string and write it out */ - tty_input[tty_bytecount] = 0; - if (serial_write (remote_desc, tty_input, tty_bytecount)) - { - perror_with_name ("readtty: write failed"); - return FATAL_ERROR; - } - - return READ_MORE; -} - -static int -minitelnet (void) -{ - fd_set input; /* file descriptors for select */ - int tablesize; /* max number of FDs for select */ - int status; - int quit_count = 0; - - escape_count = 0; - echo_check = -1; - - tablesize = 8 * sizeof (input); - - for (;;) - { - /* Check for anything from our socket - doesn't block. Note that - this must be done *before* the select as there may be - buffered I/O waiting to be processed. */ - - if ((status = readsocket ()) == FATAL_ERROR) - { - error ("Debugging terminated by communications error"); - } - else if (status != READ_MORE) - { - return (status); - } - - fflush (stdout); /* Flush output before blocking */ - - /* Now block on more socket input or TTY input */ - - FD_ZERO (&input); - FD_SET (fileno (stdin), &input); - FD_SET (deprecated_serial_fd (remote_desc), &input); - - status = select (tablesize, &input, 0, 0, 0); - if ((status == -1) && (errno != EINTR)) - { - error ("Communications error on select %d", errno); - } - - /* Handle Control-C typed */ - - if (quit_flag) - { - if ((++quit_count) == 2) - { - if (query ("Interrupt GDB? ")) - { - printf_filtered ("Interrupted by user.\n"); - throw_exception (RETURN_QUIT); - } - quit_count = 0; - } - quit_flag = 0; - - if (remote_break) - serial_send_break (remote_desc); - else - serial_write (remote_desc, "\003", 1); - - continue; - } - - /* Handle console input */ - - if (FD_ISSET (fileno (stdin), &input)) - { - quit_count = 0; - echo_check = 0; - status = readtty (); - if (status == READ_MORE) - continue; - - return status; /* telnet session ended */ - } - } -} - -static ptid_t -remote_cisco_wait (ptid_t ptid, struct target_waitstatus *status) -{ - if (minitelnet () != ENTER_DEBUG) - { - error ("Debugging session terminated by protocol error"); - } - putpkt ("?"); - return remote_wait (ptid, status); -} - -static void -init_remote_cisco_ops (void) -{ - remote_cisco_ops.to_shortname = "cisco"; - remote_cisco_ops.to_longname = "Remote serial target in cisco-specific protocol"; - remote_cisco_ops.to_doc = - "Use a remote machine via TCP, using a cisco-specific protocol.\n\ -Specify the serial device it is connected to (e.g. host:2020)."; - remote_cisco_ops.to_open = remote_cisco_open; - remote_cisco_ops.to_close = remote_cisco_close; - remote_cisco_ops.to_detach = remote_detach; - remote_cisco_ops.to_disconnect = remote_disconnect; - remote_cisco_ops.to_resume = remote_resume; - remote_cisco_ops.to_wait = remote_cisco_wait; - remote_cisco_ops.to_fetch_registers = remote_fetch_registers; - remote_cisco_ops.to_store_registers = remote_store_registers; - remote_cisco_ops.to_prepare_to_store = remote_prepare_to_store; - remote_cisco_ops.to_xfer_memory = remote_xfer_memory; - remote_cisco_ops.to_files_info = remote_files_info; - remote_cisco_ops.to_insert_breakpoint = remote_insert_breakpoint; - remote_cisco_ops.to_remove_breakpoint = remote_remove_breakpoint; - remote_cisco_ops.to_remove_hw_breakpoint = remote_remove_hw_breakpoint; - remote_cisco_ops.to_insert_hw_breakpoint = remote_insert_hw_breakpoint; - remote_cisco_ops.to_insert_watchpoint = remote_insert_watchpoint; - remote_cisco_ops.to_remove_watchpoint = remote_remove_watchpoint; - remote_cisco_ops.to_stopped_by_watchpoint = remote_stopped_by_watchpoint; - remote_cisco_ops.to_stopped_data_address = remote_stopped_data_address; - remote_cisco_ops.to_can_use_hw_breakpoint = remote_check_watch_resources; - remote_cisco_ops.to_kill = remote_kill; - remote_cisco_ops.to_load = generic_load; - remote_cisco_ops.to_mourn_inferior = remote_cisco_mourn; - remote_cisco_ops.to_thread_alive = remote_thread_alive; - remote_cisco_ops.to_find_new_threads = remote_threads_info; - remote_cisco_ops.to_pid_to_str = remote_pid_to_str; - remote_cisco_ops.to_extra_thread_info = remote_threads_extra_info; - remote_cisco_ops.to_stratum = process_stratum; - remote_cisco_ops.to_has_all_memory = 1; - remote_cisco_ops.to_has_memory = 1; - remote_cisco_ops.to_has_stack = 1; - remote_cisco_ops.to_has_registers = 1; - remote_cisco_ops.to_has_execution = 1; - remote_cisco_ops.to_magic = OPS_MAGIC; -} - static int remote_can_async_p (void) { @@ -6087,9 +5422,6 @@ _initialize_remote (void) init_extended_async_remote_ops (); add_target (&extended_async_remote_ops); - init_remote_cisco_ops (); - add_target (&remote_cisco_ops); - /* Hook into new objfile notification. */ remote_new_objfile_chain = target_new_objfile_hook; target_new_objfile_hook = remote_new_objfile; @@ -6203,9 +5535,6 @@ in a memory packet.\n", &showlist); #endif - add_info ("remote-process", remote_info_process, - "Query the remote system for process info."); - add_packet_config_cmd (&remote_protocol_vcont, "vCont", "verbose-resume", set_remote_protocol_vcont_packet_cmd, diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 57fe902..438b7a4 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2046,17 +2046,6 @@ rs6000_extract_struct_value_address (struct regcache *regcache) return 0; } -/* Return whether PC is in a dummy function call. - - FIXME: This just checks for the end of the stack, which is broken - for things like stepping through gcc nested function stubs. */ - -static int -rs6000_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) -{ - return sp < pc && pc < fp; -} - /* Hook called when a new child process is started. */ void @@ -2892,7 +2881,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call); - set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame); set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 0e52652..d85e640 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1565,22 +1565,6 @@ s390_sniff_pc_function_start (CORE_ADDR pc, struct frame_info *fi) } - -static CORE_ADDR -s390_function_start (struct frame_info *fi) -{ - CORE_ADDR function_start = 0; - - if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised) - function_start = get_frame_extra_info (fi)->function_start; - else if (get_frame_pc (fi)) - function_start = get_frame_func (fi); - return function_start; -} - - - - static int s390_frameless_function_invocation (struct frame_info *fi) { @@ -2584,7 +2568,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_believe_pcc_promotion (gdbarch, 0); set_gdbarch_char_signed (gdbarch, 0); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs); set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return); @@ -2628,7 +2611,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); - set_gdbarch_extract_struct_value_address (gdbarch, s390_cannot_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, s390_cannot_extract_struct_value_address); /* Parameters for inferior function calls. */ set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 7e2ad8f..872dcaf 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -1,6 +1,6 @@ /* Scheme/Guile language support routines for GDB, the GNU debugger. - Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003 Free Software + Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -263,6 +263,7 @@ const struct language_defn scm_language_defn = NULL, /* Language specific skip_trampoline */ value_of_this, /* value_of_this */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"#o%lo", "#o", "o", ""}, /* Octal format info */ diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index 38f8e78..3e04973 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -98,7 +98,7 @@ pipe_open (struct serial *scb, const char *name) for (old = pidlist; old; old = old->next) close (fileno (old->fp)); /* don't allow a flush */ #endif - execl ("/bin/sh", "sh", "-c", name, NULL); + execl ("/bin/sh", "sh", "-c", name, (char *) 0); _exit (127); } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 8c7408b..1db65c6 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -212,8 +212,8 @@ sh_sh3_dsp_register_name (int reg_nr) "y0", "y1", "", "", "", "", "", "mod", "ssr", "spc", "rs", "re", "", "", "", "", "", "", - "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b" - "", "", "", "", "", "", "", "", + "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b", + "", "", "", "", "", "", "", "", }; if (reg_nr < 0) return NULL; @@ -300,8 +300,8 @@ sh_sh4al_dsp_register_name (int reg_nr) "y0", "y1", "", "", "", "", "", "mod", "ssr", "spc", "rs", "re", "", "", "", "", "", "", - "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b" - "", "", "", "", "", "", "", "", + "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b", + "", "", "", "", "", "", "", "", }; if (reg_nr < 0) return NULL; @@ -2239,15 +2239,13 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - sh_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); set_gdbarch_believe_pcc_promotion (gdbarch, 1); diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 56063c1..76ac673 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -2847,7 +2847,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); set_gdbarch_believe_pcc_promotion (gdbarch, 1); @@ -2887,7 +2886,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_push_return_address (gdbarch, sh64_push_return_address); set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return); - set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention); set_gdbarch_deprecated_pop_frame (gdbarch, sh64_pop_frame); set_gdbarch_elf_make_msymbol_special (gdbarch, diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 72313dc..3ac2a34 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -111,7 +111,7 @@ static void sol_core_close (int quitting); static void init_sol_thread_ops (void); static void init_sol_core_ops (void); -/* Default definitions: These must be defined in tm.h +/* Default definitions: These must be defined in tm.h if they are to be shared with a process module such as procfs. */ #define GET_PID(ptid) ptid_get_pid (ptid) @@ -127,56 +127,56 @@ static void init_sol_core_ops (void); /* Pointers to routines from lithread_db resolved by dlopen() */ static void (*p_td_log) (const int on_off); -static td_err_e (*p_td_ta_new) (const struct ps_prochandle * ph_p, +static td_err_e (*p_td_ta_new) (const struct ps_prochandle * ph_p, td_thragent_t ** ta_pp); static td_err_e (*p_td_ta_delete) (td_thragent_t * ta_p); static td_err_e (*p_td_init) (void); -static td_err_e (*p_td_ta_get_ph) (const td_thragent_t * ta_p, +static td_err_e (*p_td_ta_get_ph) (const td_thragent_t * ta_p, struct ps_prochandle ** ph_pp); -static td_err_e (*p_td_ta_get_nthreads) (const td_thragent_t * ta_p, +static td_err_e (*p_td_ta_get_nthreads) (const td_thragent_t * ta_p, int *nthread_p); -static td_err_e (*p_td_ta_tsd_iter) (const td_thragent_t * ta_p, - td_key_iter_f * cb, +static td_err_e (*p_td_ta_tsd_iter) (const td_thragent_t * ta_p, + td_key_iter_f * cb, void *cbdata_p); -static td_err_e (*p_td_ta_thr_iter) (const td_thragent_t * ta_p, - td_thr_iter_f * cb, - void *cbdata_p, +static td_err_e (*p_td_ta_thr_iter) (const td_thragent_t * ta_p, + td_thr_iter_f * cb, + void *cbdata_p, td_thr_state_e state, - int ti_pri, - sigset_t * ti_sigmask_p, + int ti_pri, + sigset_t * ti_sigmask_p, unsigned ti_user_flags); static td_err_e (*p_td_thr_validate) (const td_thrhandle_t * th_p); -static td_err_e (*p_td_thr_tsd) (const td_thrhandle_t * th_p, - const thread_key_t key, +static td_err_e (*p_td_thr_tsd) (const td_thrhandle_t * th_p, + const thread_key_t key, void **data_pp); -static td_err_e (*p_td_thr_get_info) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_get_info) (const td_thrhandle_t * th_p, td_thrinfo_t * ti_p); -static td_err_e (*p_td_thr_getfpregs) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_getfpregs) (const td_thrhandle_t * th_p, prfpregset_t * fpregset); -static td_err_e (*p_td_thr_getxregsize) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_getxregsize) (const td_thrhandle_t * th_p, int *xregsize); -static td_err_e (*p_td_thr_getxregs) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_getxregs) (const td_thrhandle_t * th_p, const caddr_t xregset); -static td_err_e (*p_td_thr_sigsetmask) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_sigsetmask) (const td_thrhandle_t * th_p, const sigset_t ti_sigmask); -static td_err_e (*p_td_thr_setprio) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_setprio) (const td_thrhandle_t * th_p, const int ti_pri); -static td_err_e (*p_td_thr_setsigpending) (const td_thrhandle_t * th_p, - const uchar_t ti_pending_flag, +static td_err_e (*p_td_thr_setsigpending) (const td_thrhandle_t * th_p, + const uchar_t ti_pending_flag, const sigset_t ti_pending); -static td_err_e (*p_td_thr_setfpregs) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_setfpregs) (const td_thrhandle_t * th_p, const prfpregset_t * fpregset); -static td_err_e (*p_td_thr_setxregs) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_setxregs) (const td_thrhandle_t * th_p, const caddr_t xregset); -static td_err_e (*p_td_ta_map_id2thr) (const td_thragent_t * ta_p, - thread_t tid, +static td_err_e (*p_td_ta_map_id2thr) (const td_thragent_t * ta_p, + thread_t tid, td_thrhandle_t * th_p); -static td_err_e (*p_td_ta_map_lwp2thr) (const td_thragent_t * ta_p, - lwpid_t lwpid, +static td_err_e (*p_td_ta_map_lwp2thr) (const td_thragent_t * ta_p, + lwpid_t lwpid, td_thrhandle_t * th_p); -static td_err_e (*p_td_thr_getgregs) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_getgregs) (const td_thrhandle_t * th_p, prgregset_t regset); -static td_err_e (*p_td_thr_setgregs) (const td_thrhandle_t * th_p, +static td_err_e (*p_td_thr_setgregs) (const td_thrhandle_t * th_p, const prgregset_t regset); /* @@ -647,7 +647,7 @@ sol_thread_store_registers (int regno) if (regno != -1) { /* Not writing all the regs */ char old_value[MAX_REGISTER_SIZE]; - + /* Save new register value. */ regcache_collect (regno, old_value); @@ -739,7 +739,7 @@ sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite, /* Note: don't need to call switch_to_thread; we're just reading memory. */ if (target_has_execution) - retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, + retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, attrib, target); else retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len, @@ -750,6 +750,37 @@ sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite, return retval; } +/* Perform partial transfers on OBJECT. See target_read_partial + and target_write_partial for details of each variant. One, and + only one, of readbuf or writebuf must be non-NULL. */ + +static LONGEST +sol_thread_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, + const void *writebuf, ULONGEST offset, LONGEST len) +{ + int retval; + struct cleanup *old_chain; + + old_chain = save_inferior_ptid (); + + if (is_thread (inferior_ptid) || /* A thread */ + !target_thread_alive (inferior_ptid)) /* An lwp, but not alive */ + inferior_ptid = procfs_first_available (); /* Find any live lwp. */ + /* Note: don't need to call switch_to_thread; we're just reading memory. */ + + if (target_has_execution) + retval = procfs_ops.to_xfer_partial (ops, object, annex, + readbuf, writebuf, offset, len); + else + retval = orig_core_ops.to_xfer_partial (ops, object, annex, + readbuf, writebuf, offset, len); + + do_cleanups (old_chain); + + return retval; +} + /* Print status information about what we're accessing. */ static void @@ -798,7 +829,7 @@ sol_thread_create_inferior (char *exec_file, char *allargs, char **env) those variables don't show up until the library gets mapped and the symbol table is read in. */ -/* This new_objfile event is now managed by a chained function pointer. +/* This new_objfile event is now managed by a chained function pointer. * It is the callee's responsability to call the next client on the chain. */ @@ -864,7 +895,7 @@ sol_thread_can_run (void) return procfs_suppress_run; } -/* +/* LOCAL FUNCTION @@ -1028,10 +1059,10 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr, /* FIXME: passing 0 as attrib argument. */ if (target_has_execution) - cc = procfs_ops.to_xfer_memory (addr, buf, size, + cc = procfs_ops.to_xfer_memory (addr, buf, size, dowrite, 0, &procfs_ops); else - cc = orig_core_ops.to_xfer_memory (addr, buf, size, + cc = orig_core_ops.to_xfer_memory (addr, buf, size, dowrite, 0, &core_ops); if (cc < 0) @@ -1048,10 +1079,10 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr, else if (cc == 0) { if (dowrite == 0) - warning ("rw_common (): unable to read at addr 0x%lx", + warning ("rw_common (): unable to read at addr 0x%lx", (long) addr); else - warning ("rw_common (): unable to write at addr 0x%lx", + warning ("rw_common (): unable to write at addr 0x%lx", (long) addr); do_cleanups (old_chain); @@ -1430,7 +1461,7 @@ sol_core_files_info (struct target_ops *t) } /* Worker bee for info sol-thread command. This is a callback function that - gets called once for each Solaris thread (ie. not kernel thread) in the + gets called once for each Solaris thread (ie. not kernel thread) in the inferior. Print anything interesting that we can think of. */ static int @@ -1512,10 +1543,10 @@ info_solthreads (char *args, int from_tty) } static int -sol_find_memory_regions (int (*func) (CORE_ADDR, - unsigned long, - int, int, int, - void *), +sol_find_memory_regions (int (*func) (CORE_ADDR, + unsigned long, + int, int, int, + void *), void *data) { return procfs_ops.to_find_memory_regions (func, data); @@ -1549,6 +1580,7 @@ init_sol_thread_ops (void) sol_thread_ops.to_store_registers = sol_thread_store_registers; sol_thread_ops.to_prepare_to_store = sol_thread_prepare_to_store; sol_thread_ops.to_xfer_memory = sol_thread_xfer_memory; + sol_thread_ops.to_xfer_partial = sol_thread_xfer_partial; sol_thread_ops.to_files_info = sol_thread_files_info; sol_thread_ops.to_insert_breakpoint = memory_insert_breakpoint; sol_thread_ops.to_remove_breakpoint = memory_remove_breakpoint; @@ -1592,6 +1624,7 @@ init_sol_core_ops (void) sol_core_ops.to_detach = sol_core_detach; sol_core_ops.to_fetch_registers = sol_thread_fetch_registers; sol_core_ops.to_xfer_memory = sol_thread_xfer_memory; + sol_core_ops.to_xfer_partial = sol_thread_xfer_partial; sol_core_ops.to_files_info = sol_core_files_info; sol_core_ops.to_insert_breakpoint = ignore; sol_core_ops.to_remove_breakpoint = ignore; diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index b7444c6..a88e7b7 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -1,6 +1,6 @@ /* Handle SunOS shared libraries for GDB, the GNU Debugger. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, - 2001 + 2001, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -145,12 +145,7 @@ allocate_rt_common_objfile (void) objfile->md = NULL; objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc (); - obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, - xfree); - obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, - xfree); - obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc, - xfree); + obstack_init (&objfile->objfile_obstack); objfile->name = mstrsave (objfile->md, "rt_common"); /* Add this file onto the tail of the linked list of other such files. */ @@ -185,9 +180,8 @@ solib_add_common_symbols (CORE_ADDR rtc_symp) if (rt_common_objfile != NULL && rt_common_objfile->minimal_symbol_count) { - obstack_free (&rt_common_objfile->symbol_obstack, 0); - obstack_specify_allocation (&rt_common_objfile->symbol_obstack, 0, 0, - xmalloc, xfree); + obstack_free (&rt_common_objfile->objfile_obstack, 0); + obstack_init (&rt_common_objfile->objfile_obstack); rt_common_objfile->minimal_symbol_count = 0; rt_common_objfile->msymbols = NULL; terminate_minimal_symbol_table (rt_common_objfile); diff --git a/gdb/somread.c b/gdb/somread.c index 971fea2..4ffa4c1 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -1,6 +1,6 @@ /* Read HP PA/Risc object files for GDB. - Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, + 2004 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. This file is part of GDB. @@ -432,7 +432,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); /* FIXME: ezannoni 2000-04-20 The section names in SOM are not @@ -534,7 +534,7 @@ init_import_symbols (struct objfile *objfile) to do with psymbols, just a matter of convenience. We want the import list to be freed when the objfile is deallocated */ objfile->import_list - = (ImportEntry *) obstack_alloc (&objfile->psymbol_obstack, + = (ImportEntry *) obstack_alloc (&objfile->objfile_obstack, import_list_size * sizeof (ImportEntry)); /* Read in the import entries, a bunch at a time */ @@ -550,7 +550,7 @@ init_import_symbols (struct objfile *objfile) if (buffer[i].type != (unsigned char) 0) { objfile->import_list[k] - = (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1); + = (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1); strcpy (objfile->import_list[k], string_buffer + buffer[i].name); /* Some day we might want to record the type and other information too */ } @@ -570,7 +570,7 @@ init_import_symbols (struct objfile *objfile) if (buffer[i].type != (unsigned char) 0) { objfile->import_list[k] - = (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1); + = (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1); strcpy (objfile->import_list[k], string_buffer + buffer[i].name); /* Some day we might want to record the type and other information too */ } @@ -657,7 +657,7 @@ init_export_symbols (struct objfile *objfile) to do with psymbols, just a matter of convenience. We want the export list to be freed when the objfile is deallocated */ objfile->export_list - = (ExportEntry *) obstack_alloc (&objfile->psymbol_obstack, + = (ExportEntry *) obstack_alloc (&objfile->objfile_obstack, export_list_size * sizeof (ExportEntry)); /* Read in the export entries, a bunch at a time */ @@ -673,7 +673,7 @@ init_export_symbols (struct objfile *objfile) if (buffer[i].type != (unsigned char) 0) { objfile->export_list[k].name - = (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1); + = (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1); strcpy (objfile->export_list[k].name, string_buffer + buffer[i].name); objfile->export_list[k].address = buffer[i].value; /* Some day we might want to record the type and other information too */ @@ -697,7 +697,7 @@ init_export_symbols (struct objfile *objfile) if (buffer[i].type != (unsigned char) 0) { objfile->export_list[k].name - = (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1); + = (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1); strcpy (objfile->export_list[k].name, string_buffer + buffer[i].name); /* Some day we might want to record the type and other information too */ objfile->export_list[k].address = buffer[i].value; diff --git a/gdb/somsolib.c b/gdb/somsolib.c index b2a833c..7ecc97e 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -1,7 +1,7 @@ /* Handle HP SOM shared libraries for GDB, the GNU Debugger. Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -310,7 +310,7 @@ som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, if (so->objfile->obj_private == NULL) { obj_private = (obj_private_data_t *) - obstack_alloc (&so->objfile->psymbol_obstack, + obstack_alloc (&so->objfile->objfile_obstack, sizeof (obj_private_data_t)); obj_private->unwind_info = NULL; obj_private->so_info = NULL; @@ -643,7 +643,7 @@ som_solib_add (char *arg_string, int from_tty, struct target_ops *target, int re } name = obsavestring (name, name_len - 1, - &symfile_objfile->symbol_obstack); + &symfile_objfile->objfile_obstack); status = target_read_memory (addr + 8, buf, 4); if (status != 0) diff --git a/gdb/source.c b/gdb/source.c index 6c0e213..ba2dc06 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -80,8 +80,6 @@ static void forward_search_command (char *, int); static void line_info (char *, int); -static void ambiguous_line_spec (struct symtabs_and_lines *); - static void source_info (char *, int); static void show_directories (char *, int); diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index 3ab21f0..955e65e 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -22,7 +22,9 @@ #include "defs.h" #include "inferior.h" #include "regcache.h" +#include "target.h" +#include "gdb_assert.h" #include <signal.h> #include "gdb_string.h" #include <sys/ptrace.h> @@ -246,8 +248,64 @@ store_inferior_registers (int regnum) return; } } + +/* Fetch StackGhost Per-Process XOR cookie. */ +LONGEST +sparc_xfer_wcookie (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len) +{ + unsigned long wcookie = 0; + char *buf = (char *)&wcookie; + + gdb_assert (object == TARGET_OBJECT_WCOOKIE); + gdb_assert (readbuf && writebuf == NULL); + + if (offset >= sizeof (unsigned long)) + return -1; + +#ifdef PT_WCOOKIE + /* If PT_WCOOKIE is defined (by <sys/ptrace.h>), assume we're + running on an OpenBSD release that uses StackGhost (3.1 or + later). As of release 3.4, OpenBSD doesn't use a randomized + cookie yet, but a future release probably will. */ + { + int pid; + + pid = TIDGET (inferior_ptid); + if (pid == 0) + pid = PIDGET (inferior_ptid); + + /* Sanity check. The proper type for a cookie is register_t, but + we can't assume that this type exists on all systems supported + by the code in this file. */ + gdb_assert (sizeof (wcookie) == sizeof (register_t)); + + /* Fetch the cookie. */ + if (ptrace (PT_WCOOKIE, pid, (PTRACE_ARG3_TYPE) &wcookie, 0) == -1) + { + if (errno != EINVAL) + perror_with_name ("Couldn't get StackGhost cookie"); + + /* Although PT_WCOOKIE is defined on OpenBSD 3.1 and later, + the request wasn't implemented until after OpenBSD 3.4. If + the kernel doesn't support the PT_WCOOKIE request, assume + we're running on a kernel that uses non-randomized cookies. */ + wcookie = 0x3; + } + } +#endif /* PT_WCOOKIE */ + + if (len > sizeof (unsigned long) - offset) + len = sizeof (unsigned long) - offset; + + memcpy (readbuf, buf + offset, len); + return len; +} + + /* Provide a prototype to silence -Wmissing-prototypes. */ void _initialize_sparc_nat (void); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index c2f3cfb..66dbac7 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -96,7 +96,9 @@ sparc_fetch_instruction (CORE_ADDR pc) unsigned long insn; int i; - read_memory (pc, buf, sizeof (buf)); + /* If we can't read the instruction at PC, return zero. */ + if (target_read_memory (pc, buf, sizeof (buf))) + return 0; insn = 0; for (i = 0; i < sizeof (buf); i++) @@ -104,6 +106,56 @@ sparc_fetch_instruction (CORE_ADDR pc) return insn; } + +/* OpenBSD/sparc includes StackGhost, which according to the author's + website http://stackghost.cerias.purdue.edu "... transparently and + automatically protects applications' stack frames; more + specifically, it guards the return pointers. The protection + mechanisms require no application source or binary modification and + imposes only a negligible performance penalty." + + The same website provides the following description of how + StackGhost works: + + "StackGhost interfaces with the kernel trap handler that would + normally write out registers to the stack and the handler that + would read them back in. By XORing a cookie into the + return-address saved in the user stack when it is actually written + to the stack, and then XOR it out when the return-address is pulled + from the stack, StackGhost can cause attacker corrupted return + pointers to behave in a manner the attacker cannot predict. + StackGhost can also use several unused bits in the return pointer + to detect a smashed return pointer and abort the process." + + For GDB this means that whenever we're reading %i7 from a stack + frame's window save area, we'll have to XOR the cookie. + + More information on StackGuard can be found on in: + + Mike Frantzen and Mike Shuey. "StackGhost: Hardware Facilitated + Stack Protection." 2001. Published in USENIX Security Symposium + '01. */ + +/* Fetch StackGhost Per-Process XOR cookie. */ + +ULONGEST +sparc_fetch_wcookie (void) +{ + struct target_ops *ops = ¤t_target; + char buf[8]; + int len; + + len = target_read_partial (ops, TARGET_OBJECT_WCOOKIE, NULL, buf, 0, 8); + if (len == -1) + return 0; + + /* We should have either an 32-bit or an 64-bit cookie. */ + gdb_assert (len == 4 || len == 8); + + return extract_unsigned_integer (buf, len); +} + + /* Return the contents if register REGNUM as an address. */ static CORE_ADDR @@ -664,6 +716,29 @@ sparc32_frame_prev_register (struct frame_info *next_frame, void **this_cache, return; } + /* Handle StackGhost. */ + { + ULONGEST wcookie = sparc_fetch_wcookie (); + + if (wcookie != 0 && !cache->frameless_p && regnum == SPARC_I7_REGNUM) + { + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (valuep) + { + CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 4; + ULONGEST i7; + + /* Read the value in from memory. */ + i7 = get_frame_memory_unsigned (next_frame, addr, 4); + store_unsigned_integer (valuep, 4, i7 ^ wcookie); + } + return; + } + } + /* The previous frame's `local' and `in' registers have been saved in the register save area. */ if (!cache->frameless_p @@ -837,8 +912,8 @@ sparc32_return_value (struct gdbarch *gdbarch, struct type *type, #if 0 /* NOTE: cagney/2004-01-17: For the moment disable this method. The architecture and CORE-gdb will need new code (and a replacement for - EXTRACT_STRUCT_VALUE_ADDRESS) before this can be made to work - robustly. Here is a possible function signature: */ + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) before this can be made to + work robustly. Here is a possible function signature: */ /* NOTE: cagney/2004-01-17: So far only the 32-bit SPARC ABI has been identifed as having a way to robustly recover the address of a struct-convention return-value (after the function has returned). @@ -1028,10 +1103,10 @@ sparc_regset_from_core_section (struct gdbarch *gdbarch, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset) + if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset) return tdep->gregset; - if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset) + if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset) return tdep->fpregset; return NULL; @@ -1056,9 +1131,9 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->pc_regnum = SPARC32_PC_REGNUM; tdep->npc_regnum = SPARC32_NPC_REGNUM; tdep->gregset = NULL; - tdep->sizeof_gregset = 20 * 4; + tdep->sizeof_gregset = 0; tdep->fpregset = NULL; - tdep->sizeof_fpregset = 33 * 4; + tdep->sizeof_fpregset = 0; tdep->plt_entry_size = 0; set_gdbarch_long_double_bit (gdbarch, 128); @@ -1111,7 +1186,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_unwind_append_sniffer (gdbarch, sparc32_frame_sniffer); /* If we have register sets, enable the generic core file support. */ - if (tdep->gregset && tdep->fpregset) + if (tdep->gregset) set_gdbarch_regset_from_core_section (gdbarch, sparc_regset_from_core_section); @@ -1161,6 +1236,16 @@ sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum) { target_read_memory (sp + ((i - SPARC_L0_REGNUM) * 4), buf + offset, 4); + + /* Handle StackGhost. */ + if (i == SPARC_I7_REGNUM) + { + ULONGEST wcookie = sparc_fetch_wcookie (); + ULONGEST i7 = extract_unsigned_integer (buf + offset, 4); + + store_unsigned_integer (buf + offset, 4, i7 ^ wcookie); + } + regcache_raw_supply (regcache, i, buf); } } @@ -1204,6 +1289,16 @@ sparc_collect_rwindow (const struct regcache *regcache, if (regnum == -1 || regnum == SPARC_SP_REGNUM || regnum == i) { regcache_raw_collect (regcache, i, buf); + + /* Handle StackGhost. */ + if (i == SPARC_I7_REGNUM) + { + ULONGEST wcookie = sparc_fetch_wcookie (); + ULONGEST i7 = extract_unsigned_integer (buf + offset, 4); + + store_unsigned_integer (buf + offset, 4, i7 ^ wcookie); + } + target_write_memory (sp + ((i - SPARC_L0_REGNUM) * 4), buf + offset, 4); } diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index d8d0582..bbfbb42 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -22,11 +22,11 @@ #ifndef SPARC_TDEP_H #define SPARC_TDEP_H 1 +struct frame_info; struct gdbarch; struct regcache; struct regset; struct trad_frame_saved_reg; -struct frame_info; /* Register offsets for the general-purpose register set. */ @@ -147,6 +147,9 @@ struct sparc_frame_cache /* Fetch the instruction at PC. */ extern unsigned long sparc_fetch_instruction (CORE_ADDR pc); +/* Fetch StackGhost Per-Process XOR cookie. */ +extern ULONGEST sparc_fetch_wcookie (void); + extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, struct sparc_frame_cache *cache); @@ -195,4 +198,7 @@ extern void sparc32_sol2_init_abi (struct gdbarch_info info, /* Register offsets for NetBSD. */ extern const struct sparc_gregset sparc32nbsd_gregset; +extern struct trad_frame_saved_reg * + sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame); + #endif /* sparc-tdep.h */ diff --git a/gdb/sparc64-tdep.h b/gdb/sparc64-tdep.h index f5ab60d..c3073b9 100644 --- a/gdb/sparc64-tdep.h +++ b/gdb/sparc64-tdep.h @@ -22,9 +22,11 @@ #ifndef SPARC64_TDEP_H #define SPARC64_TDEP_H 1 +struct frame_info; struct gdbarch; -struct sparc_gregset; struct regcache; +struct sparc_gregset; +struct trad_frame_saved_reg; #include "sparc-tdep.h" @@ -109,9 +111,13 @@ extern void sparc64_sol2_init_abi (struct gdbarch_info info, /* Register offsets for FreeBSD/sparc64. */ extern const struct sparc_gregset sparc64fbsd_gregset; -/* Variables exported from sparc64nbsd-tdep.c. */ +/* Functions and variables exported from sparc64nbsd-tdep.c. */ /* Register offsets for NetBSD/sparc64. */ extern const struct sparc_gregset sparc64nbsd_gregset; +extern struct trad_frame_saved_reg * + sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr, + struct frame_info *next_frame); + #endif /* sparc64-tdep.h */ diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c index 58b87b3..8e79870 100644 --- a/gdb/sparc64nbsd-tdep.c +++ b/gdb/sparc64nbsd-tdep.c @@ -88,76 +88,86 @@ sparc64nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) return nbsd_pc_in_sigtramp (pc, name); } -static struct sparc_frame_cache * -sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame, - void **this_cache) +struct trad_frame_saved_reg * +sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr, + struct frame_info *next_frame) { - struct sparc_frame_cache *cache; - CORE_ADDR addr, sigcontext_addr, sp; - LONGEST fprs; + struct trad_frame_saved_reg *saved_regs; + CORE_ADDR addr, sp; int regnum, delta; - if (*this_cache) - return *this_cache; - - cache = sparc_frame_cache (next_frame, this_cache); - gdb_assert (cache == *this_cache); + saved_regs = trad_frame_alloc_saved_regs (next_frame); /* The registers are saved in bits and pieces scattered all over the place. The code below records their location on the assumption that the part of the signal trampoline that saves the state has been executed. */ - /* If we couldn't find the frame's function, we're probably dealing - with an on-stack signal trampoline. */ - if (cache->pc == 0) - { - cache->pc = sparc64nbsd_sigtramp_start; - - /* Since we couldn't find the frame's function, the cache was - initialized under the assumption that we're frameless. */ - cache->frameless_p = 0; - addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); - cache->base = addr; - } - - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); - - /* We find the appropriate instance of `struct sigcontext' at a - fixed offset in the signal frame. */ - sigcontext_addr = cache->base + BIAS + 128 + 8; - - cache->saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8; - cache->saved_regs[SPARC64_PC_REGNUM].addr = sigcontext_addr + 16; - cache->saved_regs[SPARC64_NPC_REGNUM].addr = sigcontext_addr + 24; - cache->saved_regs[SPARC64_STATE_REGNUM].addr = sigcontext_addr + 32; - cache->saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 40; - cache->saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 48; + saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8; + saved_regs[SPARC64_PC_REGNUM].addr = sigcontext_addr + 16; + saved_regs[SPARC64_NPC_REGNUM].addr = sigcontext_addr + 24; + saved_regs[SPARC64_STATE_REGNUM].addr = sigcontext_addr + 32; + saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 40; + saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 48; /* The remaining `global' registers and %y are saved in the `local' registers. */ delta = SPARC_L0_REGNUM - SPARC_G0_REGNUM; for (regnum = SPARC_G2_REGNUM; regnum <= SPARC_G7_REGNUM; regnum++) - cache->saved_regs[regnum].realreg = regnum + delta; - cache->saved_regs[SPARC64_Y_REGNUM].realreg = SPARC_L1_REGNUM; + saved_regs[regnum].realreg = regnum + delta; + saved_regs[SPARC64_Y_REGNUM].realreg = SPARC_L1_REGNUM; /* The remaining `out' registers can be found in the current frame's `in' registers. */ delta = SPARC_I0_REGNUM - SPARC_O0_REGNUM; for (regnum = SPARC_O1_REGNUM; regnum <= SPARC_O5_REGNUM; regnum++) - cache->saved_regs[regnum].realreg = regnum + delta; - cache->saved_regs[SPARC_O7_REGNUM].realreg = SPARC_I7_REGNUM; + saved_regs[regnum].realreg = regnum + delta; + saved_regs[SPARC_O7_REGNUM].realreg = SPARC_I7_REGNUM; /* The `local' and `in' registers have been saved in the register save area. */ - addr = cache->saved_regs[SPARC_SP_REGNUM].addr; + addr = saved_regs[SPARC_SP_REGNUM].addr; sp = get_frame_memory_unsigned (next_frame, addr, 8); for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM; regnum++, addr += 8) - cache->saved_regs[regnum].addr = addr; + saved_regs[regnum].addr = addr; /* TODO: Handle the floating-point registers. */ + return saved_regs; +} + +static struct sparc_frame_cache * +sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame, + void **this_cache) +{ + struct sparc_frame_cache *cache; + CORE_ADDR addr; + + if (*this_cache) + return *this_cache; + + cache = sparc_frame_cache (next_frame, this_cache); + gdb_assert (cache == *this_cache); + + /* If we couldn't find the frame's function, we're probably dealing + with an on-stack signal trampoline. */ + if (cache->pc == 0) + { + cache->pc = sparc64nbsd_sigtramp_start; + + /* Since we couldn't find the frame's function, the cache was + initialized under the assumption that we're frameless. */ + cache->frameless_p = 0; + addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + cache->base = addr; + } + + /* We find the appropriate instance of `struct sigcontext' at a + fixed offset in the signal frame. */ + addr = cache->base + BIAS + 128 + 8; + cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame); + return cache; } diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c new file mode 100644 index 0000000..190a46b --- /dev/null +++ b/gdb/sparc64obsd-tdep.c @@ -0,0 +1,210 @@ +/* Target-dependent code for OpenBSD/sparc64. + + Copyright 2004 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 "frame-unwind.h" +#include "osabi.h" +#include "regset.h" +#include "symtab.h" +#include "solib-svr4.h" +#include "trad-frame.h" + +#include "gdb_assert.h" + +#include "sparc64-tdep.h" +#include "nbsd-tdep.h" + +/* OpenBSD uses the traditional NetBSD core file format, even for + ports that use ELF. The core files don't use multiple register + sets. Instead, the general-purpose and floating-point registers + are lumped together in a single section. Unlike on NetBSD, OpenBSD + uses a different layout for its general-purpose registers than the + layout used for ptrace(2). */ + +/* From <machine/reg.h>. */ +const struct sparc_gregset sparc64obsd_core_gregset = +{ + 0 * 8, /* "tstate" */ + 1 * 8, /* %pc */ + 2 * 8, /* %npc */ + 3 * 8, /* %y */ + -1, /* %fprs */ + -1, + 7 * 8, /* %g1 */ + 22 * 8, /* %l0 */ + 4 /* sizeof (%y) */ +}; + +static void +sparc64obsd_supply_gregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *gregs, size_t len) +{ + const char *regs = gregs; + + sparc64_supply_gregset (regset->descr, regcache, regnum, regs); + sparc64_supply_fpregset (regcache, regnum, regs + 288); +} + + +/* Signal trampolines. */ + +/* The OpenBSD kernel maps the signal trampoline at some random + location in user space, which means that the traditional BSD way of + detecting it won't work. + + The signal trampoline will be mapped at an address that is page + aligned. We recognize the signal trampoline by the looking for the + sigreturn system call. */ + +static const int sparc64obsd_page_size = 8192; + +static int +sparc64obsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + CORE_ADDR start_pc = (pc & ~(sparc64obsd_page_size - 1)); + unsigned long insn; + + if (name) + return 0; + + /* Check for "restore %g0, SYS_sigreturn, %g1". */ + insn = sparc_fetch_instruction (start_pc + 0xe8); + if (insn != 0x83e82067) + return 0; + + /* Check for "t ST_SYSCALL". */ + insn = sparc_fetch_instruction (start_pc + 0xf0); + if (insn != 0x91d02000) + return 0; + + return 1; +} + +static struct sparc_frame_cache * +sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache) +{ + struct sparc_frame_cache *cache; + CORE_ADDR addr; + + if (*this_cache) + return *this_cache; + + cache = sparc_frame_cache (next_frame, this_cache); + gdb_assert (cache == *this_cache); + + /* If we couldn't find the frame's function, we're probably dealing + with an on-stack signal trampoline. */ + if (cache->pc == 0) + { + cache->pc = frame_pc_unwind (next_frame); + cache->pc &= ~(sparc64obsd_page_size - 1); + + /* Since we couldn't find the frame's function, the cache was + initialized under the assumption that we're frameless. */ + cache->frameless_p = 0; + addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + cache->base = addr; + } + + /* We find the appropriate instance of `struct sigcontext' at a + fixed offset in the signal frame. */ + addr = cache->base + BIAS + 128 + 16; + cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame); + + return cache; +} + +static void +sparc64obsd_frame_this_id (struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) +{ + struct sparc_frame_cache *cache = + sparc64obsd_frame_cache (next_frame, this_cache); + + (*this_id) = frame_id_build (cache->base, cache->pc); +} + +static void +sparc64obsd_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct sparc_frame_cache *cache = + sparc64obsd_frame_cache (next_frame, this_cache); + + trad_frame_prev_register (next_frame, cache->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + +static const struct frame_unwind sparc64obsd_frame_unwind = +{ + SIGTRAMP_FRAME, + sparc64obsd_frame_this_id, + sparc64obsd_frame_prev_register +}; + +static const struct frame_unwind * +sparc64obsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + char *name; + + find_pc_partial_function (pc, &name, NULL, NULL); + if (sparc64obsd_pc_in_sigtramp (pc, name)) + return &sparc64obsd_frame_unwind; + + return NULL; +} + + +static void +sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + tdep->gregset = XMALLOC (struct regset); + tdep->gregset->descr = &sparc64obsd_core_gregset; + tdep->gregset->supply_regset = sparc64obsd_supply_gregset; + tdep->sizeof_gregset = 832; + + set_gdbarch_pc_in_sigtramp (gdbarch, sparc64obsd_pc_in_sigtramp); + frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer); + + sparc64_init_abi (info, gdbarch); + + set_solib_svr4_fetch_link_map_offsets + (gdbarch, nbsd_lp64_solib_svr4_fetch_link_map_offsets); +} + + +/* Provide a prototype to silence -Wmissing-prototypes. */ +void _initialize_sparc64obsd_tdep (void); + +void +_initialize_sparc64obsd_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, + GDB_OSABI_OPENBSD_ELF, sparc64obsd_init_abi); +} diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c index 4ea3901..b1be7eb 100644 --- a/gdb/sparcnbsd-tdep.c +++ b/gdb/sparcnbsd-tdep.c @@ -50,16 +50,18 @@ const struct sparc_gregset sparc32nbsd_gregset = -1 /* %l0 */ }; -/* Unlike other NetBSD implementations, the SPARC port historically - used .reg and .reg2 (see bfd/netbsd-core.c), and as such, we can - share one routine for a.out and ELF core files. */ - static void sparc32nbsd_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { sparc32_supply_gregset (regset->descr, regcache, regnum, gregs); + + /* Traditional NetBSD core files don't use multiple register sets. + Instead, the general-purpose and floating-point registers are + lumped together in a single section. */ + if (len >= 212) + sparc32_supply_fpregset (regcache, regnum, (const char *) gregs + 80); } static void @@ -90,92 +92,118 @@ sparc32nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) return nbsd_pc_in_sigtramp (pc, name); } -static struct sparc_frame_cache * -sparc32nbsd_sigcontext_frame_cache (struct frame_info *next_frame, - void **this_cache) +struct trad_frame_saved_reg * +sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame) { - struct sparc_frame_cache *cache; + struct trad_frame_saved_reg *saved_regs; CORE_ADDR addr, sigcontext_addr; - LONGEST psr; int regnum, delta; + ULONGEST psr; - if (*this_cache) - return *this_cache; + saved_regs = trad_frame_alloc_saved_regs (next_frame); - cache = sparc_frame_cache (next_frame, this_cache); - gdb_assert (cache == *this_cache); + /* We find the appropriate instance of `struct sigcontext' at a + fixed offset in the signal frame. */ + addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + sigcontext_addr = addr + 64 + 16; /* The registers are saved in bits and pieces scattered all over the place. The code below records their location on the assumption that the part of the signal trampoline that saves the state has been executed. */ - /* If we couldn't find the frame's function, we're probably dealing - with an on-stack signal trampoline. */ - if (cache->pc == 0) - { - cache->pc = sparc32nbsd_sigtramp_start; - - /* Since we couldn't find the frame's function, the cache was - initialized under the assumption that we're frameless. */ - cache->frameless_p = 0; - addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); - cache->base = addr; - } - - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); - - /* We find the appropriate instance of `struct sigcontext' at a - fixed offset in the signal frame. */ - sigcontext_addr = cache->base + 64 + 16; - - cache->saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8; - cache->saved_regs[SPARC32_PC_REGNUM].addr = sigcontext_addr + 12; - cache->saved_regs[SPARC32_NPC_REGNUM].addr = sigcontext_addr + 16; - cache->saved_regs[SPARC32_PSR_REGNUM].addr = sigcontext_addr + 20; - cache->saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 24; - cache->saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 28; + saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8; + saved_regs[SPARC32_PC_REGNUM].addr = sigcontext_addr + 12; + saved_regs[SPARC32_NPC_REGNUM].addr = sigcontext_addr + 16; + saved_regs[SPARC32_PSR_REGNUM].addr = sigcontext_addr + 20; + saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 24; + saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 28; /* The remaining `global' registers and %y are saved in the `local' registers. */ delta = SPARC_L0_REGNUM - SPARC_G0_REGNUM; for (regnum = SPARC_G2_REGNUM; regnum <= SPARC_G7_REGNUM; regnum++) - cache->saved_regs[regnum].realreg = regnum + delta; - cache->saved_regs[SPARC32_Y_REGNUM].realreg = SPARC_L1_REGNUM; + saved_regs[regnum].realreg = regnum + delta; + saved_regs[SPARC32_Y_REGNUM].realreg = SPARC_L1_REGNUM; /* The remaining `out' registers can be found in the current frame's `in' registers. */ delta = SPARC_I0_REGNUM - SPARC_O0_REGNUM; for (regnum = SPARC_O1_REGNUM; regnum <= SPARC_O5_REGNUM; regnum++) - cache->saved_regs[regnum].realreg = regnum + delta; - cache->saved_regs[SPARC_O7_REGNUM].realreg = SPARC_I7_REGNUM; + saved_regs[regnum].realreg = regnum + delta; + saved_regs[SPARC_O7_REGNUM].realreg = SPARC_I7_REGNUM; /* The `local' and `in' registers have been saved in the register save area. */ - addr = cache->saved_regs[SPARC_SP_REGNUM].addr; + addr = saved_regs[SPARC_SP_REGNUM].addr; addr = get_frame_memory_unsigned (next_frame, addr, 4); for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++, addr += 4) - cache->saved_regs[regnum].addr = addr; + saved_regs[regnum].addr = addr; + + /* Handle StackGhost. */ + { + ULONGEST wcookie = sparc_fetch_wcookie (); + + if (wcookie != 0) + { + ULONGEST i7; + + addr = saved_regs[SPARC_I7_REGNUM].addr; + i7 = get_frame_memory_unsigned (next_frame, addr, 4); + trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie); + } + } /* The floating-point registers are only saved if the EF bit in %prs has been set. */ #define PSR_EF 0x00001000 - addr = cache->saved_regs[SPARC32_PSR_REGNUM].addr; + addr = saved_regs[SPARC32_PSR_REGNUM].addr; psr = get_frame_memory_unsigned (next_frame, addr, 4); if (psr & PSR_EF) { CORE_ADDR sp; sp = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); - cache->saved_regs[SPARC32_FSR_REGNUM].addr = sp + 96; + saved_regs[SPARC32_FSR_REGNUM].addr = sp + 96; for (regnum = SPARC_F0_REGNUM, addr = sp + 96 + 8; regnum <= SPARC_F31_REGNUM; regnum++, addr += 4) - cache->saved_regs[regnum].addr = addr; + saved_regs[regnum].addr = addr; + } + + return saved_regs; +} + +static struct sparc_frame_cache * +sparc32nbsd_sigcontext_frame_cache (struct frame_info *next_frame, + void **this_cache) +{ + struct sparc_frame_cache *cache; + CORE_ADDR addr; + + if (*this_cache) + return *this_cache; + + cache = sparc_frame_cache (next_frame, this_cache); + gdb_assert (cache == *this_cache); + + /* If we couldn't find the frame's function, we're probably dealing + with an on-stack signal trampoline. */ + if (cache->pc == 0) + { + cache->pc = sparc32nbsd_sigtramp_start; + + /* Since we couldn't find the frame's function, the cache was + initialized under the assumption that we're frameless. */ + cache->frameless_p = 0; + addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + cache->base = addr; } + cache->saved_regs = sparc32nbsd_sigcontext_saved_regs (next_frame); + return cache; } @@ -249,9 +277,11 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->gregset = XMALLOC (struct regset); tdep->gregset->descr = &sparc32nbsd_gregset; tdep->gregset->supply_regset = sparc32nbsd_supply_gregset; + tdep->sizeof_gregset = 20 * 4; tdep->fpregset = XMALLOC (struct regset); tdep->fpregset->supply_regset = sparc32nbsd_supply_fpregset; + tdep->sizeof_fpregset = 33 * 4; set_gdbarch_pc_in_sigtramp (gdbarch, sparc32nbsd_pc_in_sigtramp); frame_unwind_append_sniffer (gdbarch, sparc32nbsd_sigtramp_frame_sniffer); @@ -284,6 +314,28 @@ sparcnbsd_aout_osabi_sniffer (bfd *abfd) return GDB_OSABI_UNKNOWN; } +/* OpenBSD uses the traditional NetBSD core file format, even for + ports that use ELF. Therefore, if the default OS ABI is OpenBSD + ELF, we return that instead of NetBSD a.out. This is mainly for + the benfit of OpenBSD/sparc64, which inherits the sniffer below + since we include this file for an OpenBSD/sparc64 target. For + OpenBSD/sparc, the NetBSD a.out OS ABI is probably similar enough + to both the OpenBSD a.out and the OpenBSD ELF OS ABI. */ +#if defined (GDB_OSABI_DEFAULT) && (GDB_OSABI_DEFAULT == GDB_OSABI_OPENBSD_ELF) +#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF +#else +#define GDB_OSABI_NETBSD_CORE GDB_OSABI_NETBSD_AOUT +#endif + +static enum gdb_osabi +sparcnbsd_core_osabi_sniffer (bfd *abfd) +{ + if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0) + return GDB_OSABI_NETBSD_CORE; + + return GDB_OSABI_UNKNOWN; +} + /* Provide a prototype to silence -Wmissing-prototypes. */ void _initialize_sparcnbsd_tdep (void); @@ -294,6 +346,11 @@ _initialize_sparnbsd_tdep (void) gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_aout_flavour, sparcnbsd_aout_osabi_sniffer); + /* BFD doesn't set the architecture for NetBSD style a.out core + files. */ + gdbarch_register_osabi_sniffer (bfd_arch_unknown, bfd_target_unknown_flavour, + sparcnbsd_core_osabi_sniffer); + gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_AOUT, sparc32nbsd_aout_init_abi); gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_ELF, diff --git a/gdb/sparcobsd-tdep.c b/gdb/sparcobsd-tdep.c new file mode 100644 index 0000000..108e255 --- /dev/null +++ b/gdb/sparcobsd-tdep.c @@ -0,0 +1,171 @@ +/* Target-dependent code for OpenBSD/sparc. + + Copyright 2004 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 "floatformat.h" +#include "frame.h" +#include "frame-unwind.h" +#include "osabi.h" +#include "solib-svr4.h" +#include "symtab.h" +#include "trad-frame.h" + +#include "gdb_assert.h" + +#include "sparc-tdep.h" +#include "nbsd-tdep.h" + +/* Signal trampolines. */ + +/* The OpenBSD kernel maps the signal trampoline at some random + location in user space, which means that the traditional BSD way of + detecting it won't work. + + The signal trampoline will be mapped at an address that is page + aligned. We recognize the signal trampoline by the looking for the + sigreturn system call. */ + +static const int sparc32obsd_page_size = 4096; + +static int +sparc32obsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + CORE_ADDR start_pc = (pc & ~(sparc32obsd_page_size - 1)); + unsigned long insn; + + if (name) + return 0; + + /* Check for "restore %g0, SYS_sigreturn, %g1". */ + insn = sparc_fetch_instruction (start_pc + 0xec); + if (insn != 0x83e82067) + return 0; + + /* Check for "t ST_SYSCALL". */ + insn = sparc_fetch_instruction (start_pc + 0xf4); + if (insn != 0x91d02000) + return 0; + + return 1; +} + +static struct sparc_frame_cache * +sparc32obsd_frame_cache (struct frame_info *next_frame, void **this_cache) +{ + struct sparc_frame_cache *cache; + CORE_ADDR addr; + + if (*this_cache) + return *this_cache; + + cache = sparc_frame_cache (next_frame, this_cache); + gdb_assert (cache == *this_cache); + + /* If we couldn't find the frame's function, we're probably dealing + with an on-stack signal trampoline. */ + if (cache->pc == 0) + { + cache->pc = frame_pc_unwind (next_frame); + cache->pc &= ~(sparc32obsd_page_size - 1); + + /* Since we couldn't find the frame's function, the cache was + initialized under the assumption that we're frameless. */ + cache->frameless_p = 0; + addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + cache->base = addr; + } + + cache->saved_regs = sparc32nbsd_sigcontext_saved_regs (next_frame); + + return cache; +} + +static void +sparc32obsd_frame_this_id (struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) +{ + struct sparc_frame_cache *cache = + sparc32obsd_frame_cache (next_frame, this_cache); + + (*this_id) = frame_id_build (cache->base, cache->pc); +} + +static void +sparc32obsd_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct sparc_frame_cache *cache = + sparc32obsd_frame_cache (next_frame, this_cache); + + trad_frame_prev_register (next_frame, cache->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + +static const struct frame_unwind sparc32obsd_frame_unwind = +{ + SIGTRAMP_FRAME, + sparc32obsd_frame_this_id, + sparc32obsd_frame_prev_register +}; + +static const struct frame_unwind * +sparc32obsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + char *name; + + find_pc_partial_function (pc, &name, NULL, NULL); + if (sparc32obsd_pc_in_sigtramp (pc, name)) + return &sparc32obsd_frame_unwind; + + return NULL; +} + + +static void +sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* OpenBSD doesn't support the 128-bit `long double' from the psABI. */ + set_gdbarch_long_double_bit (gdbarch, 64); + set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big); + + set_gdbarch_pc_in_sigtramp (gdbarch, sparc32obsd_pc_in_sigtramp); + frame_unwind_append_sniffer (gdbarch, sparc32obsd_sigtramp_frame_sniffer); + + set_solib_svr4_fetch_link_map_offsets + (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); +} + + +/* Provide a prototype to silence -Wmissing-prototypes. */ +void _initialize_sparc32obsd_tdep (void); + +void +_initialize_sparc32obsd_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_OPENBSD_ELF, + sparc32obsd_init_abi); +} diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 2a75803..021c19e 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -379,14 +379,14 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, ld will remove it from the executable. There is then a N_GSYM stab for it, but no regular (C_EXT) symbol. */ sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; DEPRECATED_SYMBOL_NAME (sym) = - obsavestring (name, pp - name, &objfile->symbol_obstack); + obsavestring (name, pp - name, &objfile->objfile_obstack); pp += 2; if (*(pp - 1) == 'F' || *(pp - 1) == 'f') { @@ -612,7 +612,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, nameless = (p == string || ((string[0] == ' ') && (string[1] == ':'))); current_symbol = sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); switch (type & N_TYPE) @@ -646,7 +646,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, { case 't': DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"), - &objfile->symbol_obstack); + &objfile->objfile_obstack); break; case 'v': /* $vtbl_ptr_type */ @@ -655,7 +655,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, case 'e': DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"), - &objfile->symbol_obstack); + &objfile->objfile_obstack); break; case '_': @@ -738,7 +738,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_TYPE (sym) = lookup_fundamental_type (objfile, FT_DBL_PREC_FLOAT); dbl_valu = (char *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, TYPE_LENGTH (SYMBOL_TYPE (sym))); store_typed_floating (dbl_valu, SYMBOL_TYPE (sym), d); SYMBOL_VALUE_BYTES (sym) = dbl_valu; @@ -1251,21 +1251,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_TAG_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->type_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); + = obconcat (&objfile->objfile_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); add_symbol_to_list (sym, &file_symbols); if (synonym) { /* Clone the sym and then modify it. */ struct symbol *typedef_sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); *typedef_sym = *sym; SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF; SYMBOL_VALUE (typedef_sym) = valu; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->type_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); + = obconcat (&objfile->objfile_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); add_symbol_to_list (typedef_sym, &file_symbols); } break; @@ -1527,7 +1527,7 @@ again: return error_type (pp, objfile); } to = type_name = - (char *) obstack_alloc (&objfile->type_obstack, p - *pp + 1); + (char *) obstack_alloc (&objfile->objfile_obstack, p - *pp + 1); /* Copy the name. */ from = *pp + 1; @@ -1554,7 +1554,7 @@ again: && (TYPE_CODE (SYMBOL_TYPE (sym)) == code) && strcmp (DEPRECATED_SYMBOL_NAME (sym), type_name) == 0) { - obstack_free (&objfile->type_obstack, type_name); + obstack_free (&objfile->objfile_obstack, type_name); type = SYMBOL_TYPE (sym); if (typenums[0] != -1) *dbx_lookup_type (typenums) = type; @@ -2511,11 +2511,11 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, make_cleanup (xfree, destr_fnlist); memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist)); destr_fnlist->fn_fieldlist.name - = obconcat (&objfile->type_obstack, "", "~", + = obconcat (&objfile->objfile_obstack, "", "~", new_fnlist->fn_fieldlist.name); destr_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct fn_field) * has_destructor); memset (destr_fnlist->fn_fieldlist.fn_fields, 0, sizeof (struct fn_field) * has_destructor); @@ -2576,11 +2576,11 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, if (ret) new_fnlist->fn_fieldlist.name = obsavestring (dem_opname, strlen (dem_opname), - &objfile->type_obstack); + &objfile->objfile_obstack); } new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct fn_field) * length); memset (new_fnlist->fn_fieldlist.fn_fields, 0, sizeof (struct fn_field) * length); @@ -2649,7 +2649,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, name = ""; } fip->list->field.name = - obconcat (&objfile->type_obstack, vptr_name, name, ""); + obconcat (&objfile->objfile_obstack, vptr_name, name, ""); break; case 'b': /* $vb -- a virtual bsomethingorother */ @@ -2662,13 +2662,13 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, name = "FOO"; } fip->list->field.name = - obconcat (&objfile->type_obstack, vb_name, name, ""); + obconcat (&objfile->objfile_obstack, vb_name, name, ""); break; default: invalid_cpp_abbrev_complaint (*pp); fip->list->field.name = - obconcat (&objfile->type_obstack, + obconcat (&objfile->objfile_obstack, "INVALID_CPLUSPLUS_ABBREV", "", ""); break; } @@ -2714,7 +2714,7 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, struct type *type, struct objfile *objfile) { fip->list->field.name = - obsavestring (*pp, p - *pp, &objfile->type_obstack); + obsavestring (*pp, p - *pp, &objfile->objfile_obstack); *pp = p + 1; /* This means we have a visibility for a field coming. */ @@ -3484,14 +3484,14 @@ read_enum_type (char **pp, struct type *type, p = *pp; while (*p != ':') p++; - name = obsavestring (*pp, p - *pp, &objfile->symbol_obstack); + name = obsavestring (*pp, p - *pp, &objfile->objfile_obstack); *pp = p + 1; n = read_huge_number (pp, ',', &nbits); if (nbits != 0) return error_type (pp, objfile); sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = name; SYMBOL_LANGUAGE (sym) = current_subfile->language; @@ -4039,7 +4039,7 @@ common_block_start (char *name, struct objfile *objfile) common_block = local_symbols; common_block_i = local_symbols ? local_symbols->nsyms : 0; common_block_name = obsavestring (name, strlen (name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } /* Process a N_ECOMM symbol. */ @@ -4065,9 +4065,9 @@ common_block_end (struct objfile *objfile) } sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - /* Note: common_block_name already saved on symbol_obstack */ + /* Note: common_block_name already saved on objfile_obstack */ DEPRECATED_SYMBOL_NAME (sym) = common_block_name; SYMBOL_CLASS (sym) = LOC_BLOCK; diff --git a/gdb/stack.c b/gdb/stack.c index 73a6ec5..0a9052f 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1857,6 +1857,9 @@ return_command (char *retval_exp, int from_tty) is discarded, side effects such as "return i++" still occure. */ return_value = NULL; + /* FIXME: cagney/2004-01-17: If the architecture implements both + return_value and extract_returned_value_address, should allow + "return" to work - don't set return_value to NULL. */ else if (!gdbarch_return_value_p (current_gdbarch) && (TYPE_CODE (return_type) == TYPE_CODE_STRUCT || TYPE_CODE (return_type) == TYPE_CODE_UNION)) @@ -1926,6 +1929,10 @@ If you continue, the return value that you specified will be ignored.\n"; STORE_RETURN_VALUE (return_type, current_regcache, VALUE_CONTENTS (return_value)); } + /* FIXME: cagney/2004-01-17: If extract_returned_value_address + is available and the function is using + RETURN_VALUE_STRUCT_CONVENTION, should use it to find the + address of the returned value so that it can be assigned. */ else { gdb_assert (gdbarch_return_value (current_gdbarch, return_type, diff --git a/gdb/symfile.c b/gdb/symfile.c index 97800c8..7e16d45 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -485,7 +485,7 @@ default_symfile_offsets (struct objfile *objfile, objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); memset (objfile->section_offsets, 0, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); @@ -690,7 +690,7 @@ syms_from_objfile (struct objfile *objfile, objfile->num_sections = num_offsets; objfile->section_offsets = ((struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, size)); + obstack_alloc (&objfile->objfile_obstack, size)); memcpy (objfile->section_offsets, offsets, size); init_objfile_sect_indices (objfile); @@ -1879,7 +1879,7 @@ reread_symbols (void) bfd_errmsg (bfd_get_error ())); /* Save the offsets, we will nuke them with the rest of the - psymbol_obstack. */ + objfile_obstack. */ num_offsets = objfile->num_sections; offsets = ((struct section_offsets *) alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets))); @@ -1911,13 +1911,12 @@ reread_symbols (void) htab_delete (objfile->demangled_names_hash); objfile->demangled_names_hash = NULL; } - obstack_free (&objfile->psymbol_obstack, 0); - obstack_free (&objfile->symbol_obstack, 0); - obstack_free (&objfile->type_obstack, 0); + obstack_free (&objfile->objfile_obstack, 0); objfile->sections = NULL; objfile->symtabs = NULL; objfile->psymtabs = NULL; objfile->free_psymtabs = NULL; + objfile->cp_namespace_symtab = NULL; objfile->msymbols = NULL; objfile->sym_private = NULL; objfile->minimal_symbol_count = 0; @@ -1934,16 +1933,13 @@ reread_symbols (void) /* We never make this a mapped file. */ objfile->md = NULL; - /* obstack_specify_allocation also initializes the obstack so - it is empty. */ objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc (); - obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, - xmalloc, xfree); - obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, - xmalloc, xfree); - obstack_specify_allocation (&objfile->type_obstack, 0, 0, - xmalloc, xfree); + /* obstack_init also initializes the obstack so it is + empty. We could use obstack_specify_allocation but + gdb_obstack.h specifies the alloc/dealloc + functions. */ + obstack_init (&objfile->objfile_obstack); if (build_objfile_section_table (objfile)) { error ("Can't find the file sections in `%s': %s", @@ -1954,7 +1950,7 @@ 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, + obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (num_offsets)); memcpy (objfile->section_offsets, offsets, SIZEOF_N_SECTION_OFFSETS (num_offsets)); @@ -2240,14 +2236,14 @@ allocate_symtab (char *filename, struct objfile *objfile) struct symtab *symtab; symtab = (struct symtab *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symtab)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symtab)); memset (symtab, 0, sizeof (*symtab)); symtab->filename = obsavestring (filename, strlen (filename), - &objfile->symbol_obstack); + &objfile->objfile_obstack); symtab->fullname = NULL; symtab->language = deduce_language_from_filename (filename); symtab->debugformat = obsavestring ("unknown", 7, - &objfile->symbol_obstack); + &objfile->objfile_obstack); /* Hook it to the objfile it comes from */ @@ -2278,12 +2274,12 @@ allocate_psymtab (char *filename, struct objfile *objfile) } else psymtab = (struct partial_symtab *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct partial_symtab)); memset (psymtab, 0, sizeof (struct partial_symtab)); psymtab->filename = obsavestring (filename, strlen (filename), - &objfile->psymbol_obstack); + &objfile->objfile_obstack); psymtab->symtab = NULL; /* Prepend it to the psymtab list for the objfile it belongs to. @@ -2432,7 +2428,7 @@ cashier_psymtab (struct partial_symtab *pst) partial_symbol lists (global_psymbols/static_psymbols) that this psymtab points to. These just take up space until all the psymtabs are reclaimed. Ditto the dependencies list and - filename, which are all in the psymbol_obstack. */ + filename, which are all in the objfile_obstack. */ /* We need to cashier any psymtab that has this one as a dependency... */ again: diff --git a/gdb/symfile.h b/gdb/symfile.h index 40aa8dd..13f6555 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. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -224,7 +224,7 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *, 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. */ + found in the OBSTACKP */ extern char *obconcat (struct obstack *obstackp, const char *, const char *, const char *); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 76b3507..f6d31f9 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -1,7 +1,7 @@ /* Do various things to symbol tables (other than lookup), for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, - 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software + 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -230,16 +230,12 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, sz_strtab) > 0) printf_filtered (" Space used by a.out string tables: %d\n", OBJSTAT (objfile, sz_strtab)); - printf_filtered (" Total memory used for psymbol obstack: %d\n", - obstack_memory_used (&objfile->psymbol_obstack)); + printf_filtered (" Total memory used for objfile obstack: %d\n", + obstack_memory_used (&objfile->objfile_obstack)); printf_filtered (" Total memory used for psymbol cache: %d\n", bcache_memory_used (objfile->psymbol_cache)); printf_filtered (" Total memory used for macro cache: %d\n", bcache_memory_used (objfile->macro_cache)); - printf_filtered (" Total memory used for symbol obstack: %d\n", - obstack_memory_used (&objfile->symbol_obstack)); - printf_filtered (" Total memory used for type obstack: %d\n", - obstack_memory_used (&objfile->type_obstack)); } immediate_quit--; } diff --git a/gdb/symtab.c b/gdb/symtab.c index 1d7b396..622e277 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1,7 +1,7 @@ /* Symbol table lookup for the GNU debugger, GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, - 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -485,7 +485,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, /* Set both the mangled and demangled (if any) names for GSYMBOL based on LINKAGE_NAME and LEN. The hash table corresponding to OBJFILE - is used, and the memory comes from that objfile's symbol_obstack. + is used, and the memory comes from that objfile's objfile_obstack. LINKAGE_NAME is copied, so the pointer can be discarded after calling this function. */ @@ -572,7 +572,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, /* If there is a demangled name, place it right after the mangled name. Otherwise, just place a second zero byte after the end of the mangled name. */ - *slot = obstack_alloc (&objfile->symbol_obstack, + *slot = obstack_alloc (&objfile->objfile_obstack, lookup_len + demangled_len + 2); memcpy (*slot, lookup_name, lookup_len + 1); if (demangled_name != NULL) @@ -1480,15 +1480,23 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, } /* Look up a type named NAME in the struct_domain. The type returned - must not be opaque -- i.e., must have at least one field defined + must not be opaque -- i.e., must have at least one field + defined. */ - This code was modelled on lookup_symbol -- the parts not relevant to looking - up types were just left out. In particular it's assumed here that types - are available in struct_domain and only at file-static or global blocks. */ +struct type * +lookup_transparent_type (const char *name) +{ + return current_language->la_lookup_transparent_type (name); +} +/* The standard implementation of lookup_transparent_type. This code + was modeled on lookup_symbol -- the parts not relevant to looking + up types were just left out. In particular it's assumed here that + types are available in struct_domain and only at file-static or + global blocks. */ struct type * -lookup_transparent_type (const char *name) +basic_lookup_transparent_type (const char *name) { struct symbol *sym; struct symtab *s = NULL; diff --git a/gdb/symtab.h b/gdb/symtab.h index ce1c9fa..b5d9ffd 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1,7 +1,7 @@ /* Symbol table definitions for GDB. Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software + 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -88,10 +88,10 @@ struct agent_expr; struct general_symbol_info { /* Name of the symbol. This is a required field. Storage for the - name is allocated on the psymbol_obstack or symbol_obstack for - the associated objfile. For languages like C++ that make a - distinction between the mangled name and demangled name, this is - the mangled name. */ + name is allocated on the objfile_obstack for the associated + objfile. For languages like C++ that make a distinction between + the mangled name and demangled name, this is the mangled + name. */ char *name; @@ -311,12 +311,13 @@ struct minimal_symbol struct general_symbol_info ginfo; - /* The info field is available for caching machine-specific information - so it doesn't have to rederive the info constantly (over a serial line). - It is initialized to zero and stays that way until target-dependent code - sets it. Storage for any data pointed to by this field should be allo- - cated on the symbol_obstack for the associated objfile. - The type would be "void *" except for reasons of compatibility with older + /* The info field is available for caching machine-specific + information so it doesn't have to rederive the info constantly + (over a serial line). It is initialized to zero and stays that + way until target-dependent code sets it. Storage for any data + pointed to by this field should be allocated on the + objfile_obstack for the associated objfile. The type would be + "void *" except for reasons of compatibility with older compilers. This field is optional. Currently, the AMD 29000 tdep.c uses it to remember things it has decoded @@ -546,21 +547,12 @@ enum address_class LOC_COMPUTED_ARG }; -/* A structure of function pointers describing the location of a - variable, structure member, or structure base class. - - These functions' BATON arguments are generic data pointers, holding - whatever data the functions need --- the code which provides this - structure also provides the actual contents of the baton, and - decides its form. However, there may be other rules about where - the baton data must be allocated; whoever is pointing to this - `struct location_funcs' object will know the rules. For example, - when a symbol S's location is LOC_COMPUTED, then - SYMBOL_LOCATION_FUNCS(S) is pointing to a location_funcs structure, - and SYMBOL_LOCATION_BATON(S) is the baton, which must be allocated - on the same obstack as the symbol itself. */ - -struct location_funcs +/* The methods needed to implement a symbol class. These methods can + use the symbol's .aux_value for additional per-symbol information. + + At present this is only used to implement location expressions. */ + +struct symbol_ops { /* Return the value of the variable SYMBOL, relative to the stack @@ -608,6 +600,12 @@ struct symbol ENUM_BITFIELD(domain_enum_tag) domain : 6; /* Address class */ + /* NOTE: cagney/2003-11-02: The fields "aclass" and "ops" contain + overlapping information. By creating a per-aclass ops vector, or + using the aclass as an index into an ops table, the aclass and + ops fields can be merged. The latter, for instance, would shave + 32-bits from each symbol (relative to a symbol lookup, any table + index overhead would be in the noise). */ ENUM_BITFIELD(address_class) aclass : 6; @@ -617,28 +615,30 @@ struct symbol unsigned short line; - /* Some symbols require an additional value to be recorded on a per- - symbol basis. Stash those values here. */ + /* Method's for symbol's of this class. */ + /* NOTE: cagney/2003-11-02: See comment above attached to "aclass". */ + + const struct symbol_ops *ops; + + /* Some symbols require additional information to be recorded on a + per- symbol basis. Stash those values here. */ union { /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */ short basereg; - - /* For a LOC_COMPUTED or LOC_COMPUTED_ARG symbol, this is the - baton and location_funcs structure to find its location. For a - LOC_BLOCK symbol for a function in a compilation unit compiled - with DWARF 2 information, this is information used internally - by the DWARF 2 code --- specifically, the location expression - for the frame base for this function. */ + /* An arbitrary data pointer. Note that this data must be + allocated using the same obstack as the symbol itself. */ + /* So far it is only used by LOC_COMPUTED and LOC_COMPUTED_ARG to + find the location location information. For a LOC_BLOCK symbol + for a function in a compilation unit compiled with DWARF 2 + information, this is information used internally by the DWARF 2 + code --- specifically, the location expression for the frame + base for this function. */ /* FIXME drow/2003-02-21: For the LOC_BLOCK case, it might be better to add a magic symbol to the block containing this information, or to have a generic debug info annotation slot for symbols. */ - struct - { - void *baton; - struct location_funcs *funcs; - } loc; + void *ptr; } aux_value; @@ -652,8 +652,8 @@ struct symbol #define SYMBOL_LINE(symbol) (symbol)->line #define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg #define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile -#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value.loc.baton -#define SYMBOL_LOCATION_FUNCS(symbol) (symbol)->aux_value.loc.funcs +#define SYMBOL_OPS(symbol) (symbol)->ops +#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value.ptr /* A partial_symbol records the name, domain, and address class of symbols whose types we have not parsed yet. For functions, it also @@ -859,7 +859,7 @@ struct symtab Even after the source file has been read into a symtab, the partial_symtab remains around. They are allocated on an obstack, - psymbol_obstack. FIXME, this is bad for dynamic linking or VxWorks- + objfile_obstack. FIXME, this is bad for dynamic linking or VxWorks- style execution of a bunch of .o's. */ struct partial_symtab @@ -1107,6 +1107,7 @@ extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *); extern void reread_symbols (void); extern struct type *lookup_transparent_type (const char *); +extern struct type *basic_lookup_transparent_type (const char *); /* Macro for name of symbol to indicate a file compiled with gcc. */ diff --git a/gdb/target.h b/gdb/target.h index 8894ac6..2d8ce37 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -35,8 +35,8 @@ struct target_ops; specific to the communications interface between us and the target. - A TARGET is an interface between the debugger and a particular - kind of file or process. Targets can be STACKED in STRATA, + A TARGET is an interface between the debugger and a particular + kind of file or process. Targets can be STACKED in STRATA, so that more than one target can potentially respond to a request. In particular, memory accesses will walk down the stack of targets until they find a target that is interested in handling that particular @@ -155,7 +155,7 @@ enum inferior_event_type INF_QUIT_REQ, /* Process a normal inferior event which will result in target_wait being called. */ - INF_REG_EVENT, + INF_REG_EVENT, /* Deal with an error on the inferior. */ INF_ERROR, /* We are called because a timer went off. */ @@ -186,7 +186,7 @@ enum target_signal target_signal_from_name (char *); Return the number of bytes actually transfered, zero when no further transfer is possible, and -1 when the transfer is not supported. - + NOTE: cagney/2003-10-17: The current interface does not support a "retry" mechanism. Instead it assumes that at least one byte will be transfered on each call. @@ -226,8 +226,12 @@ enum target_object TARGET_OBJECT_MEMORY, /* Kernel Unwind Table. See "ia64-tdep.c". */ TARGET_OBJECT_UNWIND_TABLE, - /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, - TARGET_OBJECT_AUXV, ... */ + /* Transfer auxilliary vector. */ + TARGET_OBJECT_AUXV, + /* StackGhost cookie. See "sparc-tdep.c". */ + TARGET_OBJECT_WCOOKIE + + /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */ }; extern LONGEST target_read_partial (struct target_ops *ops, @@ -324,7 +328,7 @@ struct target_ops something at MEMADDR + N. */ int (*to_xfer_memory) (CORE_ADDR memaddr, char *myaddr, - int len, int write, + int len, int write, struct mem_attrib *attrib, struct target_ops *target); @@ -392,10 +396,10 @@ struct target_ops void (*to_async) (void (*cb) (enum inferior_event_type, void *context), void *context); int to_async_mask_value; - int (*to_find_memory_regions) (int (*) (CORE_ADDR, - unsigned long, - int, int, int, - void *), + int (*to_find_memory_regions) (int (*) (CORE_ADDR, + unsigned long, + int, int, int, + void *), void *); char * (*to_make_corefile_notes) (bfd *, int *); @@ -413,7 +417,7 @@ struct target_ops only one, of readbuf or writebuf must be non-NULL. */ LONGEST (*to_xfer_partial) (struct target_ops *ops, enum target_object object, const char *annex, - void *readbuf, const void *writebuf, + void *readbuf, const void *writebuf, ULONGEST offset, LONGEST len); int to_magic; @@ -451,9 +455,9 @@ void target_close (struct target_ops *targ, int quitting); /* Attaches to a process on the target side. Arguments are as passed to the `attach' command by the user. This routine can be called when the target is not on the target-stack, if the target_can_run - routine returns 1; in that case, it must push itself onto the stack. + routine returns 1; in that case, it must push itself onto the stack. Upon exit, the target should be ready for normal operations, and - should be ready to deliver the status of the process immediately + should be ready to deliver the status of the process immediately (without waiting) to an upcoming target_wait call. */ #define target_attach(args, from_tty) \ @@ -548,10 +552,10 @@ extern int target_read_memory (CORE_ADDR memaddr, char *myaddr, int len); extern int target_write_memory (CORE_ADDR memaddr, char *myaddr, int len); -extern int xfer_memory (CORE_ADDR, char *, int, int, +extern int xfer_memory (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *); -extern int child_xfer_memory (CORE_ADDR, char *, int, int, +extern int child_xfer_memory (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *); /* Make a single attempt at transfering LEN bytes. On a successful @@ -629,8 +633,8 @@ extern void print_section_info (struct target_ops *, bfd *); (*current_target.to_insert_breakpoint) (addr, save) /* Remove a breakpoint at address ADDR in the target machine. - SAVE is a pointer to the same save area - that was previously passed to target_insert_breakpoint. + SAVE is a pointer to the same save area + that was previously passed to target_insert_breakpoint. Result is 0 for success, or an errno value. */ #define target_remove_breakpoint(addr, save) \ @@ -782,7 +786,7 @@ extern void target_load (char *arg, int from_tty); (*current_target.to_has_exited) (pid,wait_status,exit_status) /* The debugger has completed a blocking wait() call. There is now - some process event that must be processed. This function should + some process event that must be processed. This function should be defined by those targets that require the debugger to perform cleanup or internal state changes in response to the process event. */ @@ -826,7 +830,7 @@ extern void target_load (char *arg, int from_tty); /* Get the symbol information for a breakpointable routine called when - an exception event occurs. + an exception event occurs. Intended mainly for C++, and for those platforms/implementations where such a callback mechanism is available, e.g. HP-UX with ANSI C++ (aCC). Some compilers (e.g. g++) support @@ -910,7 +914,7 @@ extern void target_load (char *arg, int from_tty); #define target_async_mask_value \ (current_target.to_async_mask_value) -extern int target_async_mask (int mask); +extern int target_async_mask (int mask); extern void target_link (char *, CORE_ADDR *); @@ -938,7 +942,7 @@ extern char *normal_pid_to_str (ptid_t ptid); * New Objfile Event Hook: * * Sometimes a GDB component wants to get notified whenever a new - * objfile is loaded. Mainly this is used by thread-debugging + * objfile is loaded. Mainly this is used by thread-debugging * implementations that need to know when symbols for the target * thread implemenation are available. * @@ -983,7 +987,7 @@ extern void (*target_new_objfile_hook) (struct objfile *); * Iterator function for target memory regions. * Calls a callback function once for each memory region 'mapped' * in the child process. Defined as a simple macro rather than - * as a function macro so that it can be tested for nullity. + * as a function macro so that it can be tested for nullity. */ #define target_find_memory_regions(FUNC, DATA) \ @@ -1040,7 +1044,7 @@ extern void (*target_new_objfile_hook) (struct objfile *); /* Provide defaults for hardware watchpoint functions. */ -/* If the *_hw_beakpoint functions have not been defined +/* If the *_hw_beakpoint functions have not been defined elsewhere use the definitions in the target vector. */ /* Returns non-zero if we can set a hardware watchpoint of type TYPE. TYPE is diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1501073..2b4faeb 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,232 @@ +2004-02-13 Andrew Cagney <cagney@redhat.com> + + * gdb.mi/mi1-basics.exp, gdb.mi/mi1-break.exp: Delete file. + * gdb.mi/mi1-console.exp, gdb.mi/mi1-disassemble.exp: Delete file. + * gdb.mi/mi1-eval.exp, gdb.mi/mi1-hack-cli.exp: Delete file. + * gdb.mi/mi1-pthreads.exp, gdb.mi/mi1-read-memory.exp: Delete file. + * gdb.mi/mi1-regs.exp, gdb.mi/mi1-return.exp: Delete file. + * gdb.mi/mi1-simplerun.exp, gdb.mi/mi1-stack.exp: Delete file. + * gdb.mi/mi1-stepi.exp, gdb.mi/mi1-symbol.exp: Delete file. + * gdb.mi/mi1-until.exp, gdb.mi/mi1-var-block.exp: Delete file. + * gdb.mi/mi1-var-child.exp, gdb.mi/mi1-var-cmd.exp: Delete file. + * gdb.mi/mi1-var-display.exp, gdb.mi/mi1-watch.exp: Delete file. + +2004-02-11 Jeff Johnston <jjohnstn@redhat.com> + + * gdb.asm/ia64.inc (gdbasm_startup): Make sure first instruction + executed is an alloc instruction. + +2004-02-11 David Carlton <carlton@kealia.com> + + * gdb.cp/breakpoint.exp: New. + * gdb.cp/breakpoint.cc: New. + +2004-02-11 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR gdb/1543. + * gdb.cp/ambiguous.exp, gdb.cp/annota2.exp, gdb.cp/annota3.exp, + gdb.cp/anon-union.exp, gdb.cp/casts.exp, gdb.cp/classes.exp, + gdb.cp/cplusfuncs.exp, gdb.cp/ctti.exp, gdb.exp/demangle.exp, + gdb.cp/derivation.exp, gdb.cp/exception.exp, gdb.cp/hang.exp, + gdb.cp/inherit.exp, gdb.cp/local.exp, gdb.cp/maint.exp, + gdb.cp/member-ptr.exp, gdb.cp/method.exp, gdb.cp/misc.exp, + gdb.cp/namespace.exp, gdb.cp/overload.exp, gdb.cp/ovldbreak.exp, + gdb.cp/psmang.exp, gdb.cp/ref-types.exp, gdb.cp/templates.exp, + gdb.cp/userdef.exp, gdb.cp/virtfunc.exp: Remove reference + to bug-gdb@prep.ai.mit.edu . + * gdb.cp/bs15503.cc, gdb.cp/class2.cc, gdb.cp/cttiadd.cc, + gdb.cp/cttiadd1.cc, gdb.cp/cttiadd2.cc, gdb.cp/cttiadd3.cc, + gdb.cp/exception.cc, gdb.cp/member-ptr.cc, gdb.cp/namespace1.cc: + Likewise. + +2004-02-10 Andrew Cagney <cagney@redhat.com> + + * lib/gdb.exp (gdb_expect_list): Recover from internal-errors + using gdb_internal_error_resync. + +2004-02-09 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/thread-specific.exp: Stop early if no threads are + found. + +2004-02-09 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/pending.exp: Remove extra \n from gdb_test calls. + +2004-02-08 Daniel Jacobowitz <drow@mvista.com> + + * lib/gdb.exp (gdb_breakpoint): Fail on unexpected pending + breakpoints. + +2004-02-07 Daniel Jacobowitz <drow@mvista.com> + + * config/sim.exp (gdb_load): Handle $arg == "". + * lib/gdb.exp (gdb_run_cmd): Honor gdb,do_reload_on_run. + * gdb.objc/basicclass.exp: Use gdb_run_cmd. + +2004-02-07 Elena Zannoni <ezannoni@redhat.com> + + * gdb.base/maint.exp: Update test to reflect + obstack changes. + +2004-02-04 Jeff Johnston <jjohnstn@redhat.com> + + * gdb.base/pendshr.c (pendfunc): New function that calls + pendfunc1. + * gdb.base/pending.c: Call pendfunc instead of pendfunc1. + +2004-02-04 Fred Fish <fnf@redhat.com> + + * gdb.arch/gdb1431.c: Add underbar prefixed version of global + function symbols and update copyright years. + * gdb.arch/gdb1291.c: Ditto. + +2004-02-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/virtfunc.exp: Accept both "ctor()" and "ctor(void)". + +2004-02-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/inherit.exp: Accept both "ctor()" and "ctor(void)". + +2004-02-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/inherit.exp: Accept output with gcc 3.2-7-rh. + +2004-02-02 Fred Fish <fnf@redhat.com> + + * gdb.base/bang.exp: Use gdb_run_cmd so this tests works with + remote targets. Update copyright years. + +2004-02-02 Jeff Johnston <jjohnstn@redhat.com> + + * lib/gdb.exp (gdb_breakpoint): Add pending breakpoint + support. + * gdb.base/langs.exp: Fix test which attempts to create + breakpoint on non-existent function to handle new pending + support. + * gdb.base/shlib-call.exp: Use gdb_breakpoint to set + a breakpoint. + * gdb.base/pending.exp: New test. + * gdb.base/pending.c: New file. + * gdb.base/pendshr.c: Ditto. + +2004-02-02 David Carlton <carlton@kealia.com> + + * gdb.cp/overload.exp: Add overloadNamespace tests. + * gdb.cp/overload.cc (dummyClass, dummyInstance): New. + (overloadNamespace, XXX): New. + (main): Call XXX::marker2. + +2004-02-01 Fred Fish <fnf@redhat.com> + + * gdb.base/dump.exp: Use runto_main instead of "runto main". + * gdb.base/finish.exp: Ditto. + * gdb.base/gcore.exp: Ditto. + * gdb.base/huge.exp: Ditto. + * gdb.base/info-proc.exp: Ditto. + * gdb.base/return2.exp: Ditto. + * gdb.threads/gcore-thread.exp: Ditto. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/thread-specific.exp: Add missing anchor to regexp. + +2004-02-01 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/fileio.c (test_open): Replace O_RDONLY with O_RDWR such + that opening the file succeeds on OpenBSD. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/thread-specific.c: New file. + * gdb.threads/threads-specific.exp: New test script. + * lib/gdb.exp (gdb_test_multiple): Allow user patterns access + to expect_out. + +2004-02-01 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/call-ar-st.exp: Call get_debug_format. Remove xfail on + sparc*-*-solaris* into a kfail PR gdb/1539 on sparc-*-* for stabs + only on the "print_small_structs from print_long_arg_list" test. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * gdb.base/completion.exp: Kill a stray backslash. + + From Jim Ingham <jingham@apple.com>: + * gdb.base/completion.exp: Test that "complete file ./gdb.base/compl" + agrees with the result from sending a tab. + +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * gdb.base/chng-syms.exp: Remove stray newline. + +2004-01-31 Mark Kettenis <kettenis@gnu.org> + + * gdb.asm/asm-source.exp: Set asm-note to "openbsd" for + *-*-openbsd*. + * gdb.asm/openbsd.inc: New file. + +2004-01-30 Mark Kettenis <kettenis@gnu.org> + + * gdb.asm/asm-source.exp: Strip -Wl, from link-flags. Don't + append -static to link-flags for *-*-freebsd*, *-*netbsd* and + *-*solaris2*. Remove commented out default settings for + asm-flags. Replace gdb_compile with target_link. + +2004-01-29 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/inherit.exp: Rewrite. Use gdb_test_multiple and gdb + for all tests. Remove old hp-ux and cygnus xfail cases. + +2004-01-29 Paul N. Hilfinger <Hilfinger@gnat.com> + + * gdb.base/chng-syms.exp: New file. + * gdb.base/chng-syms.c: New file. + +2004-01-24 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/local.exp: Rewrite "ptype Local". Add "ptype l". + Provide arms for current output in all my configurations. + +2004-01-24 Michael Chastain <mec.gnu@mindspring.com> + + * lib/compiler.c: Add hp_cc_compiler and hp_aCC_compiler. + * lib/compiler.cc: Likewise. + * lib/gdb.exp (get_compiler_info): Always call gdb_compile to + get the right preprocessor. Eval the output directly. Remove + special tests for hp_cc_compiler and hp_aCC_compiler. Remove + hp_f77_compiler and hp_f90_compiler completely. + (gdb_preprocess): Delete. + (get_compiler): Delete. + +2004-01-24 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/charset.c, gdb.base/dump.c, gdb.base/huge.c: Include + <string.h>. + +2004-01-24 Nick Roberts <nick@nick.uklinux.net> + + * gdb.mi/mi-stack.exp: Update copyright. + +2004-01-23 David Carlton <carlton@kealia.com> + + * gdb.cp/rtti.exp: Don't include full path in ${srcfile}. Add + test for cp_lookup_transparent_type. + * gdb.cp/rtti1.cc: Update copyright. Add n2::func and refer_to; + call them. + +2004-01-23 Daniel Jacobowitz <drow@mvista.com> + + * gdb.mi/mi-var-child.exp: Update copyright year. Move new test + after -var-update. + +2004-01-23 David Carlton <carlton@kealia.com> + + * gdb.cp/namespace.cc (C::ensureRefs): New. + * gdb.cp/namespace1.cc (C::ensureOtherRefs): New. + 2004-01-20 Nick Roberts <nick@nick.uklinux.net> * gdb.mi/mi-stack.exp (test_stack_locals_listing): Test for diff --git a/gdb/testsuite/config/sim.exp b/gdb/testsuite/config/sim.exp index 5d8a93d..6ecdc52 100644 --- a/gdb/testsuite/config/sim.exp +++ b/gdb/testsuite/config/sim.exp @@ -1,5 +1,5 @@ # Test Framework Driver for GDB driving a builtin simulator -# Copyright 1994, 1997, 1998 Free Software Foundation, Inc. +# Copyright 1994, 1997, 1998, 2004 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 @@ -55,7 +55,9 @@ proc gdb_load { arg } { global GDB global gdb_prompt - if [gdb_file_cmd $arg] then { return -1 } + if { $arg != "" } { + if [gdb_file_cmd $arg] then { return -1 } + } gdb_target_sim diff --git a/gdb/testsuite/gdb.arch/gdb1291.c b/gdb/testsuite/gdb.arch/gdb1291.c index 2178f70..7e70e6e 100755 --- a/gdb/testsuite/gdb.arch/gdb1291.c +++ b/gdb/testsuite/gdb.arch/gdb1291.c @@ -1,4 +1,4 @@ -/* Copyright 2003 Free Software Foundation, Inc.
+/* Copyright 2003, 2004 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
@@ -29,6 +29,7 @@ main() asm(".text\n"
" .align 5\n"
"sub:\n"
+ "_sub:\n"
" mov.l r14,@-r15\n"
" mov.w .STACK2,r3\n"
" sub r3,r15\n"
diff --git a/gdb/testsuite/gdb.arch/gdb1431.c b/gdb/testsuite/gdb.arch/gdb1431.c index 0041042..64f5c60 100755 --- a/gdb/testsuite/gdb.arch/gdb1431.c +++ b/gdb/testsuite/gdb.arch/gdb1431.c @@ -1,4 +1,4 @@ -/* Copyright 2003 Free Software Foundation, Inc.
+/* Copyright 2003, 2004 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
@@ -31,6 +31,7 @@ main() asm(".text\n"
" .align 5\n"
"sub1:\n"
+ "_sub1:\n"
" mov.l r14,@-r15\n"
" add #-128,r15\n"
" add #-128,r15\n"
@@ -48,6 +49,7 @@ asm(".text\n" asm(".text\n"
" .align 5\n"
"sub2:\n"
+ "_sub2:\n"
" mov.l r14,@-r15\n"
" mov.w .STACK2,r3\n"
" sub r3,r15\n"
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 301b778..75e64b4 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -70,7 +70,7 @@ switch -glob -- [istarget] { } "m32r*-*" { set asm-arch m32r - append link-flags " -Wl,--whole-archive -lgloss -Wl,--no-whole-archive" + append link-flags "--whole-archive -lgloss --no-whole-archive" } "m6811-*-*" { set asm-arch m68hc11 @@ -118,26 +118,19 @@ if { "${asm-arch}" == "" } { gdb_suppress_entire_file "Assembly source test -- not implemented for this target." } -# On FreeBSD and NetBSD, the final link will fail because of -# unresolved symbols. It turns out that libc.so references symbols -# that are normally provided by crt1.o, which isn't linked in since we -# specify -nostartfiles. Using -nostdlib doesn't help since -# target_compile automatically adds -lm. Linking statically avoids -# this mess. -# -# On Solaris, linking dynamically results in a binary that dumps core. -# -if {[istarget "*-*-freebsd*"] || [istarget "*-*-netbsd*"] - || [istarget "*-*-solaris2*"]} then { - append link-flags " -static" -} - # On NetBSD/ELF we need a special NetBSD-identifying note section. if { [istarget "*-*-netbsdelf*"] || [istarget "x86_64-*-netbsd*"] } then { set asm-note "netbsd" } +# On OpenBSD/ELF we need a similar note section. We make no attempt +# of handing a.out here since most OpenBSD/a.out systems use a rather +# outdated assembler that doesn't assemble this test's code anyway. +if { [istarget "*-*-openbsd*"] } then { + set asm-note "openbsd" +} + # Watch out, we are invoking the assembler, but the testsuite sets multilib # switches according to compiler syntax. If we pass these options straight # to the assembler, they won't always make sense. If we don't pass them to @@ -164,7 +157,6 @@ remote_exec build "rm -f ${subdir}/note.inc" remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc if { "${asm-flags}" == "" } { - #set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}" set asm-flags "-gstabs -I${srcdir}/${subdir} -I${objdir}/${subdir}" } @@ -175,11 +167,13 @@ if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags}"] ! gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -set opts "debug ldflags=-nostartfiles" -foreach i ${link-flags} { - append opts " ldflags=$i" -} -if { [gdb_compile "asmsrc1.o asmsrc2.o" "${binfile}" executable $opts] != "" } { +# We deliberately don't use gdb_compile here to link together the +# assembled object files. Using gdb_compile, and therefore the C +# compiler, is conceptually wrong, since we're testing raw assembler +# code here that provides its own startup code. Using target_link +# also avoids a lot of problems on many systems, most notably on +# *-*-*bsd* and *-*-solaris2*. +if {[target_link "asmsrc1.o asmsrc2.o" "${binfile}" ${link-flags}] != "" } then { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.asm/ia64.inc b/gdb/testsuite/gdb.asm/ia64.inc index d55cd22..31f37c1 100644 --- a/gdb/testsuite/gdb.asm/ia64.inc +++ b/gdb/testsuite/gdb.asm/ia64.inc @@ -36,6 +36,7 @@ comment "crt0 startup" .macro gdbasm_startup + gdbasm_enter mov r32=r0 nop.i 0 nop.i 0 diff --git a/gdb/testsuite/gdb.asm/openbsd.inc b/gdb/testsuite/gdb.asm/openbsd.inc new file mode 100644 index 0000000..90e3dbd --- /dev/null +++ b/gdb/testsuite/gdb.asm/openbsd.inc @@ -0,0 +1,12 @@ + comment "openbsd .note" + +.section ".note.openbsdbsd.ident", "a" + .p2align 2 + + .long 8 + .long 4 + .long 1 + .ascii "OpenBSD\0\0" + .long 200311 + + .p2align 2 diff --git a/gdb/testsuite/gdb.base/Makefile.in b/gdb/testsuite/gdb.base/Makefile.in index e59f57b..9f382db 100644 --- a/gdb/testsuite/gdb.base/Makefile.in +++ b/gdb/testsuite/gdb.base/Makefile.in @@ -3,7 +3,7 @@ srcdir = @srcdir@ EXECUTABLES = all-types annota1 bitfields break \ call-ar-st call-rt-st call-strs callfuncs callfwmall \ - commands compiler condbreak constvars coremaker \ + chng-syms commands compiler condbreak constvars coremaker \ dbx-test display ending-run execd-prog exprs \ foll-exec foll-fork foll-vfork funcargs int-type interrupt jump \ langs list long_long mips_pro miscexprs nodebug opaque overlays \ diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp index f584074..1e18328 100644 --- a/gdb/testsuite/gdb.base/bang.exp +++ b/gdb/testsuite/gdb.base/bang.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2003, 2004 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 @@ -35,7 +35,13 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Verify that we can run the program and that it terminates normally. -gdb_test "run" \ - ".*Program exited normally\." \ - "run program" +gdb_run_cmd +gdb_expect { + -re ".*Program exited normally\.\r\n$gdb_prompt $" { + pass "run program" + } + timeout { + fail "run program (timeout)" + } +} diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index 1431bc5..9b0e539 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -105,6 +105,8 @@ if ![runto_main] then { continue } +get_debug_format + #go -until 1209 gdb_test "tbreak 1209" \ "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \ @@ -500,11 +502,14 @@ set ws "\[\n\r\t \]+" if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \ ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } { - # On Solaris, some of the args are passed by ref, others by value, - # and GDB gets confused and says "Invalid cast" because it thinks - # it has to cast the structure into a pointer to structure. A real - # GDB bug, probably for all Sparc configs, but obscure. -sts 1999-08-17. - setup_xfail "sparc*-*-solaris*" + + # On 32-bit SPARC, some of the args are passed by ref, others by + # value, and GDB gets confused and says "Invalid cast" because it + # thinks it has to cast the structure into a pointer to structure. + if { [test_debug_format "stabs"] } then { + setup_kfail "gdb/1539" "sparc-*-*" + } + send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n" gdb_expect_list "print print_small_structs from print_long_arg_list" ".*$gdb_prompt $" { "\[\t\r\n \]+alpha" diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c index ece684a..a7b7123 100644 --- a/gdb/testsuite/gdb.base/charset.c +++ b/gdb/testsuite/gdb.base/charset.c @@ -2,6 +2,7 @@ Jim Blandy <jimb@cygnus.com> --- December 2001 */ #include <stdio.h> +#include <string.h> /* X_string is a null-terminated string in the X charset whose diff --git a/gdb/testsuite/gdb.base/chng-syms.c b/gdb/testsuite/gdb.base/chng-syms.c new file mode 100644 index 0000000..3394f5c --- /dev/null +++ b/gdb/testsuite/gdb.base/chng-syms.c @@ -0,0 +1,22 @@ +/* + * Test that GDB cleans up properly after errors that result when a + * breakpoint is reset. + */ + +/* VARIABLE is a macro defined on the compiler command line. */ + +#include <stdlib.h> + +int VARIABLE = 42; + +void stop_here () +{ + VARIABLE *= 2; +} + +int main () +{ + stop_here (); + exit (0); +} + diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp new file mode 100644 index 0000000..18f847f --- /dev/null +++ b/gdb/testsuite/gdb.base/chng-syms.exp @@ -0,0 +1,120 @@ +# Copyright 2004 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 + +# Author: Paul N. Hilfinger (Hilfinger@gnat.com) + +# Test that GDB cleans up properly after errors that result when a +# breakpoint is reset. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +# IDT/SIM apparently doesn't have enough file descriptors to allow the +# problem checked by this test to occur. +if [istarget "mips-idt-*"] { + return 0; +} + +set testfile "chng-syms" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var1}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +set oldtimeout $timeout +set timeout 10 +verbose "Timeout is now 10 seconds" 2 + +proc expect_to_stop_here { ident } { + global gdb_prompt + global decimal + + # the "at foo.c:36" output we get with -g. + # the "in func" output we get without -g. + gdb_expect { + -re "Breakpoint \[0-9\]*, stop_here .*$gdb_prompt $" { + return 1 + } + -re "$gdb_prompt $" { + fail "running to stop_here $ident" + return 0 + } + timeout { + fail "running to stop_here $ident (timeout)" + return 0 + } + } + return 1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "break stop_here if (var1 == 42)" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "setting conditional breakpoint on function" +gdb_run_cmd + +expect_to_stop_here "first time" + +gdb_continue_to_end "breakpoint first time through" + +# Now we recompile the executable, but without a variable named "var1", first +# waiting to insure that even on fast machines, the file modification times +# are distinct. This will force GDB to reload the file on the +# next "run" command, causing an error when GDB tries to tries to reset +# the breakpoint. + +sleep 2 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var2}] != "" } { + +# Complication: Since GDB generally holds an open file descriptor on the +# executable at this point, there are some systems in which the +# re-compilation will fail. In such cases, we'll consider the test +# (vacuously) passed providing that re-running it succeeds as before. + + gdb_run_cmd + expect_to_stop_here "after re-compile fails" + gdb_continue_to_end "after re-compile fails" + +} else { + + gdb_run_cmd + gdb_expect { + -re "Error in re-setting .*No symbol .var1..*Program exited normally.*" { + pass "running with invalidated bpt condition after executable changes" + } + timeout { + fail "(timeout) running with invalidated bpt condition after executable changes" + } + } + +} + +set timeout $oldtimeout +verbose "Timeout is now $timeout seconds" 2 +return 0 diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index ccf00cf..1698a30 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -657,6 +657,15 @@ gdb_test "cd ${fullsrcdir}" \ "Working directory [string_to_regexp ${fullsrcdir}].*" \ "cd to \${srcdir}" +send_gdb "complete file ./gdb.base/compl\n" +sleep 1 +gdb_expect { + -re "file ./gdb.base/completion\\.exp.*$gdb_prompt $" + { pass "complete-command 'file ./gdb.base/compl'"} + -re ".*$gdb_prompt $" { fail "complete-command 'file ./gdb.base/compl'" } + timeout { fail "(timeout) complete-command 'file ./gdb.base/compl'" } +} + send_gdb "file ./gdb.base/complet\t" sleep 1 gdb_expect { @@ -664,7 +673,6 @@ gdb_expect { { send_gdb "\n" gdb_expect { -re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $" -\ { send_gdb "n\n" gdb_expect { -re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\ diff --git a/gdb/testsuite/gdb.base/dump.c b/gdb/testsuite/gdb.base/dump.c index 784edf6..bc68778 100644 --- a/gdb/testsuite/gdb.base/dump.c +++ b/gdb/testsuite/gdb.base/dump.c @@ -1,3 +1,5 @@ +#include <string.h> + #define ARRSIZE 32 int intarray[ARRSIZE], intarray2[ARRSIZE]; diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index 0bc4472..e09a60c 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -1,4 +1,4 @@ -# Copyright 2002 Free Software Foundation, Inc. +# Copyright 2002, 2004 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 @@ -264,7 +264,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Run to main. -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Program failed to run, so remaining tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c index 4fda0fd..c9ef715 100644 --- a/gdb/testsuite/gdb.base/fileio.c +++ b/gdb/testsuite/gdb.base/fileio.c @@ -75,7 +75,7 @@ test_open () /* Test opening */ errno = 0; - ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDONLY, S_IWUSR | S_IRUSR); + ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR); printf ("open 1: ret = %d, errno = %d %s\n", ret, errno, ret >= 0 ? "OK" : ""); if (ret >= 0) diff --git a/gdb/testsuite/gdb.base/finish.exp b/gdb/testsuite/gdb.base/finish.exp index 064f26e..8818233 100644 --- a/gdb/testsuite/gdb.base/finish.exp +++ b/gdb/testsuite/gdb.base/finish.exp @@ -1,4 +1,4 @@ -# Copyright 2000 Free Software Foundation, Inc. +# Copyright 2000, 2004 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 @@ -100,7 +100,7 @@ proc finish_void { } { proc finish_tests { } { global gdb_prompt - if { ! [ runto main ] } then { + if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp index 0576638..33fcba4 100644 --- a/gdb/testsuite/gdb.base/gcore.exp +++ b/gdb/testsuite/gdb.base/gcore.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004 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 @@ -61,7 +61,7 @@ gdb_expect { } } -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/huge.c b/gdb/testsuite/gdb.base/huge.c index 419b92c..446bb18 100644 --- a/gdb/testsuite/gdb.base/huge.c +++ b/gdb/testsuite/gdb.base/huge.c @@ -2,6 +2,8 @@ * Test GDB's ability to read a very large data object from target memory. */ +#include <string.h> + /* A value that will produce a target data object large enough to crash GDB. 0x200000 is big enough on GNU/Linux, other systems may need a larger number. */ diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp index fa50d01..733ddee 100644 --- a/gdb/testsuite/gdb.base/huge.exp +++ b/gdb/testsuite/gdb.base/huge.exp @@ -1,4 +1,4 @@ -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001, 2004 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 @@ -49,7 +49,7 @@ gdb_load ${binfile} set timeout 30 -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp index d0da68f..fc68601 100644 --- a/gdb/testsuite/gdb.base/info-proc.exp +++ b/gdb/testsuite/gdb.base/info-proc.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004 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 @@ -74,7 +74,7 @@ gdb_expect { gdb_test "info proc" "No current process.*" "info proc without a process" -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index 8006bbf..a81df66 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -65,8 +65,15 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \ - "break on nonexistent function in langs.exp" +gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" { + -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or n. $" { + + gdb_test "n" "" "break on nonexistent function in langs.exp" + } + -re "Breakpoint .* (deferred).*$gdb_prompt $" { + pass "break on nonexistent function in langs.exp" + } +} if {$hp_aCC_compiler} { set isfixed 1 diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 3e98c00..53d5825 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -191,6 +191,11 @@ gdb_expect { send_gdb "maint print statistics\n" gdb_expect { -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\ + { + # Old output for gdb 6.0 and earlier + pass "maint print statistics" + } + -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $"\ { pass "maint print statistics" } -re ".*$gdb_prompt $" { fail "maint print statistics" } timeout { fail "(timeout) maint print statistics" } diff --git a/gdb/testsuite/gdb.base/pending.c b/gdb/testsuite/gdb.base/pending.c new file mode 100644 index 0000000..a83a451 --- /dev/null +++ b/gdb/testsuite/gdb.base/pending.c @@ -0,0 +1,35 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004 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 */ + +#include <stdio.h> + +int k = 0; + +extern void pendfunc (int x); + +int main() +{ + pendfunc (3); /* break main here */ + pendfunc (4); + k = 1; + pendfunc (3); + return 0; +} diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp new file mode 100644 index 0000000..2cef30a --- /dev/null +++ b/gdb/testsuite/gdb.base/pending.exp @@ -0,0 +1,266 @@ +# Copyright 2003, 2004 +# 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 created by Jeff Johnston. (jjohnstn@redhat.com) +# The shared library compilation portion was copied from shlib-call.exp which was +# written by Elena Zannoni (ezannoni@redhat.com). + +if $tracelevel then { + strace $tracelevel +} + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +# are we on a target board? +if ![isnative] then { + return 0 +} + +set testfile "pending" +set libfile "pendshr" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# Build the shared libraries this test case needs. +# + +if {$gcc_compiled == 0} { + if [istarget "hppa*-hp-hpux*"] then { + set additional_flags "additional_flags=+z" + } elseif { [istarget "mips-sgi-irix*"] } { + # Disable SGI compiler's implicit -Dsgi + set additional_flags "additional_flags=-Usgi" + } else { + # don't know what the compiler is... + set additional_flags "" + } +} else { + if { ([istarget "powerpc*-*-aix*"] + || [istarget "rs6000*-*-aix*"]) } { + set additional_flags "" + } else { + set additional_flags "additional_flags=-fpic" + } +} + +if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.o" object [list debug $additional_flags]] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [istarget "hppa*-*-hpux*"] { + remote_exec build "ld -b ${objdir}/${subdir}/${libfile}.o -o ${objdir}/${subdir}/${libfile}.sl" +} else { + set additional_flags "additional_flags=-shared" + if {[gdb_compile "${objdir}/${subdir}/${libfile}.o" "${objdir}/${subdir}/${libfile}.sl" executable [list debug $additional_flags]] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + } +} + +if { ($gcc_compiled + && ([istarget "powerpc*-*-aix*"] + || [istarget "rs6000*-*-aix*"] )) } { + set additional_flags "additional_flags=-L${objdir}/${subdir}" +} elseif { [istarget "mips-sgi-irix*"] } { + set additional_flags "additional_flags=-rpath ${objdir}/${subdir}" +} else { + set additional_flags "" +} +if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { + 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 [target_info exists gdb_stub] { + gdb_step_for_stub; +} +# +# Test setting, querying, and modifying pending breakpoints +# + +gdb_test_multiple "break pendfunc1" "set pending breakpoint" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint" + } +} + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \ +"single pending breakpoint info" + +# +# Test breaking at existing function +# + +set mainline [gdb_get_line_number "break main here"] + +gdb_test "break main" \ + "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \ + "breakpoint function" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending plus real breakpoint info" + + +# +# Test not setting a pending breakpoint +# +gdb_test_multiple "break pendfunc2" "Don't set pending breakpoint" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "n" "" "Don't set pending breakpoint" + } +} + +# +# Add condition to pending breakpoint +# + +gdb_test "condition 1 k == 1" "" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending plus condition" + +# +# Disable pending breakpoint +# + +gdb_test "disable 1" "" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending disabled" + +# +# Add commands to pending breakpoint +# +gdb_test "commands 1\nprint k\nend" "" \ + "Set commands for pending breakpoint" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[\t \]+print k.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending disabled plus commands" + +# +# Try a pending break for a line in a source file with a condition +# + +gdb_test_multiple "break pendshr.c:26 if x > 3" "Set pending breakpoint 2" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "y" "Breakpoint.*pendshr.c:26.*pending." \ + "Set pending breakpoint 2" + } +} + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[\t \]+print k.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:26 if x > 3.*" \ +"multiple pending breakpoints" + +# +# Run to main which should resolve a pending breakpoint +# + +gdb_test "run" \ +"Breakpoint.*at.* +Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.* +Breakpoint.*, main.*$mainline.*" \ +"running to main" + +# +# Re-enable the first pending breakpoint which should resolve +# + +gdb_test "enable 1" \ +"Breakpoint.*at.* +Pending breakpoint \"pendfunc1.* resolved.*" \ +"re-enabling pending breakpoint that can resolve instantly" + +# +# Continue to verify conditionals and commands for breakpoints are honored +# + +gdb_test "continue" \ +".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*4;" \ +"continue to resolved breakpoint 2" + +gdb_test "continue" \ +".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.* +\[$\]1 = 1." \ +"continue to resolved breakpoint 1" + +delete_breakpoints + +gdb_breakpoint "main" + +# +# Set non-existent pending breakpoint +# +gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "y" "Breakpoint.*imaginary.*pending." \ + "set imaginary pending breakpoint" + } +} + +# +# rerun program and make sure that any pending breakpoint remains and no +# error messages are issued for the missing function +# + +rerun_to_main +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \ +"verify pending breakpoint after restart" diff --git a/gdb/testsuite/gdb.base/pendshr.c b/gdb/testsuite/gdb.base/pendshr.c new file mode 100644 index 0000000..672fe8a --- /dev/null +++ b/gdb/testsuite/gdb.base/pendshr.c @@ -0,0 +1,33 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004 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 */ + +#include <stdio.h> + +void pendfunc1 (int x) +{ + int y = x + 4; + printf ("in pendfunc1, x is %d\n", x); +} + +void pendfunc (int x) +{ + pendfunc1 (x); +} diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp index c87d9e4..050ccf9 100644 --- a/gdb/testsuite/gdb.base/return2.exp +++ b/gdb/testsuite/gdb.base/return2.exp @@ -1,4 +1,4 @@ -# Copyright 2000, 2001 Free Software Foundation, Inc. +# Copyright 2000, 2001, 2004 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 @@ -100,7 +100,7 @@ proc return_void { } { proc return2_tests { } { global gdb_prompt - if { ! [ runto main ] } then { + if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 8fe8b22..4205253 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2000, 2004 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 @@ -291,7 +291,7 @@ send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" # PR's 16495, 18213 # test that we can re-set breakpoints in shared libraries -gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library" +gdb_breakpoint "shr1" # FIXME: should not send "run" explicitly. Non-portable. diff --git a/gdb/testsuite/gdb.cp/ambiguous.exp b/gdb/testsuite/gdb.cp/ambiguous.exp index 6385dcb..f54e964 100644 --- a/gdb/testsuite/gdb.cp/ambiguous.exp +++ b/gdb/testsuite/gdb.cp/ambiguous.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2003, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # tests relating to ambiguous class members diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp index f4f2433..7710cc4 100644 --- a/gdb/testsuite/gdb.cp/annota2.exp +++ b/gdb/testsuite/gdb.cp/annota2.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 +# Copyright 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Elena Zannoni (ezannoni@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp index c75a289..37be48d 100644 --- a/gdb/testsuite/gdb.cp/annota3.exp +++ b/gdb/testsuite/gdb.cp/annota3.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2003, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Elena Zannoni (ezannoni@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/anon-union.exp b/gdb/testsuite/gdb.cp/anon-union.exp index 0d5c777..4c34dcf 100644 --- a/gdb/testsuite/gdb.cp/anon-union.exp +++ b/gdb/testsuite/gdb.cp/anon-union.exp @@ -1,5 +1,5 @@ # Tests for anonymous union support. -# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2003, 2004 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 @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 # This file is part of the gdb testsuite diff --git a/gdb/testsuite/gdb.cp/breakpoint.cc b/gdb/testsuite/gdb.cp/breakpoint.cc new file mode 100644 index 0000000..266007c --- /dev/null +++ b/gdb/testsuite/gdb.cp/breakpoint.cc @@ -0,0 +1,41 @@ +/* Code to go along with tests in breakpoint.exp. + + Copyright 2004 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. */ + +class C1 { +public: + class Nested { + public: + int + foo () + { + return 1; + } + }; +}; + +int main () +{ + C1::Nested c1; + + c1.foo(); + + return 0; +} diff --git a/gdb/testsuite/gdb.mi/mi1-symbol.exp b/gdb/testsuite/gdb.cp/breakpoint.exp index f0da197..c85f805 100644 --- a/gdb/testsuite/gdb.mi/mi1-symbol.exp +++ b/gdb/testsuite/gdb.cp/breakpoint.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2004 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 @@ -14,48 +14,52 @@ # 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. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# +# This contains tests for breakpoints in C++. -load_lib mi-support.exp -set MIFLAGS "-i=mi1" +if $tracelevel then { + strace $tracelevel + } -gdb_exit -if [mi_gdb_start] { - continue -} +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 -set testfile "basics" -set srcfile ${testfile}.c +set testfile "breakpoint" +set srcfile ${testfile}.cc set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { + +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." } -mi_run_to_main - -proc test_list_lines {} { - global mi_gdb_prompt - global hex - global decimal - global srcfile - - # Test list-lines. - # Tests: - # -symbol-list-lines ${srcfile} +if [get_compiler_info ${binfile} "c++"] { + return -1 +} - mi_gdb_test "-symbol-list-lines ${srcfile}" \ - "\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \ - "symbol-list-lines for source file ${srcfile}" +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +proc test_breakpoint {name} { + # Restart the program every time, so that a single failure doesn't + # lead to a cascade. + if ![runto_main] then { + perror "couldn't run to main when testing ${name}" + continue + } else { + gdb_breakpoint "${name}" + gdb_test "continue" "Continuing.\r\n\r\nBreakpoint \[0-9\]*, ${name}.*" "continue to ${name}" + } } -test_list_lines +test_breakpoint "C1::Nested::foo" -mi_gdb_exit +gdb_exit return 0 diff --git a/gdb/testsuite/gdb.cp/bs15503.cc b/gdb/testsuite/gdb.cp/bs15503.cc index aec5a0b..5581ec5 100644 --- a/gdb/testsuite/gdb.cp/bs15503.cc +++ b/gdb/testsuite/gdb.cp/bs15503.cc @@ -15,9 +15,7 @@ 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 */ + */ #include <string> #include <iostream> diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp index 5b6cabe..3aaf37c 100644 --- a/gdb/testsuite/gdb.cp/casts.exp +++ b/gdb/testsuite/gdb.cp/casts.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # Test casting, especially between class types or pointer-to-class diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc index 16cf988..34263c8 100644 --- a/gdb/testsuite/gdb.cp/class2.cc +++ b/gdb/testsuite/gdb.cp/class2.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 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 @@ -15,9 +15,7 @@ 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 */ + */ struct A { diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index 16a4c3b..12428be 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp index 0a5e1b3..a509afb 100644 --- a/gdb/testsuite/gdb.cp/cplusfuncs.exp +++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp @@ -1,4 +1,5 @@ -# Copyright 1992, 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright 1992, 1997, 1999, 2001, 2002, 2003, 2004 +# 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 @@ -14,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# 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) diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp index a5e75d8..7c23b49 100644 --- a/gdb/testsuite/gdb.cp/ctti.exp +++ b/gdb/testsuite/gdb.cp/ctti.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # file written by Elena Zannoni (ezannoni@cygnus.com) # rewritten by Michael Chastain (mec.gnu@mindspring.com) diff --git a/gdb/testsuite/gdb.cp/cttiadd.cc b/gdb/testsuite/gdb.cp/cttiadd.cc index 1958605..ffba405 100644 --- a/gdb/testsuite/gdb.cp/cttiadd.cc +++ b/gdb/testsuite/gdb.cp/cttiadd.cc @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add(T v1, T v2) { diff --git a/gdb/testsuite/gdb.cp/cttiadd1.cc b/gdb/testsuite/gdb.cp/cttiadd1.cc index 3ef318a..9b149b3 100644 --- a/gdb/testsuite/gdb.cp/cttiadd1.cc +++ b/gdb/testsuite/gdb.cp/cttiadd1.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 2004 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 @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add(T v1, T v2); diff --git a/gdb/testsuite/gdb.cp/cttiadd2.cc b/gdb/testsuite/gdb.cp/cttiadd2.cc index a2f04b5..3538661 100644 --- a/gdb/testsuite/gdb.cp/cttiadd2.cc +++ b/gdb/testsuite/gdb.cp/cttiadd2.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 2004 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 @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add2(T v1, T v2) { diff --git a/gdb/testsuite/gdb.cp/cttiadd3.cc b/gdb/testsuite/gdb.cp/cttiadd3.cc index 60fb61a..2bea7bb 100644 --- a/gdb/testsuite/gdb.cp/cttiadd3.cc +++ b/gdb/testsuite/gdb.cp/cttiadd3.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 2004 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 @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add3(T v1, T v2) { diff --git a/gdb/testsuite/gdb.cp/demangle.exp b/gdb/testsuite/gdb.cp/demangle.exp index 7bd9fc5..848f66f 100644 --- a/gdb/testsuite/gdb.cp/demangle.exp +++ b/gdb/testsuite/gdb.cp/demangle.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1997, 1999, 2003 Free Software Foundation, Inc. +# Copyright (C) 1992, 1997, 1999, 2003, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp index 6ef6dbe..d82ab1f 100644 --- a/gdb/testsuite/gdb.cp/derivation.exp +++ b/gdb/testsuite/gdb.cp/derivation.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Elena Zannoni (ezannoni@cygnus.com) # And rewritten by Michael Chastain <mec.gnu@mindspring.com> diff --git a/gdb/testsuite/gdb.cp/exception.cc b/gdb/testsuite/gdb.cp/exception.cc index 4134fbc..cd124e5 100644 --- a/gdb/testsuite/gdb.cp/exception.cc +++ b/gdb/testsuite/gdb.cp/exception.cc @@ -15,9 +15,9 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + - Please email any bugs, comments, and/or additions to this file to: - bug-gdb@prep.ai.mit.edu */ // Test file for exception handling support. diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp index d921ead..3193091 100644 --- a/gdb/testsuite/gdb.cp/exception.exp +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite. # tests for exception-handling support # Written by Satish Pai <pai@apollo.hp.com> 1997-07-23 diff --git a/gdb/testsuite/gdb.cp/hang.exp b/gdb/testsuite/gdb.cp/hang.exp index 4c117a1..2308874 100644 --- a/gdb/testsuite/gdb.cp/hang.exp +++ b/gdb/testsuite/gdb.cp/hang.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright 2002, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - if $tracelevel then { strace $tracelevel } diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index 993bfb1..72de1ac 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -1,5 +1,5 @@ -# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, +# 2004 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 @@ -15,951 +15,1008 @@ # 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) +# And rewritten by Michael Chastain. (mec.gnu@mindspring.com) -set ws "\[\r\n\t \]+" -set nl "\[\r\n\]+" - -# The format of a g++ virtual base pointer. -set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?" +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" +set vhn "\\$\[0-9\]+" if $tracelevel then { - strace $tracelevel + 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 {} { +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)" + set re_class "class A \{${ws}public:" + set re_fields "int a;${ws}int x;" + set re_synth_gcc_23 "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" + + set name "ptype A (FIXME)" + gdb_test_multiple "ptype A" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { - setup_xfail "*-*-*" - fail "ptype A (FIXME)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -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)" + set name "ptype class A (FIXME)" + gdb_test_multiple "ptype class A" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -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 "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -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)" + set name "ptype g_A (FIXME)" + gdb_test_multiple "ptype g_A" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -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 "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -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" + set re_class "class B : public A \{${ws}public:" + set re_fields "int b;${ws}int x;" + set re_synth_gcc_23 "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" + + set name "ptype B" + gdb_test_multiple "ptype B" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # 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" + set name "ptype class B" + gdb_test_multiple "ptype class B" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # 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" + set name "ptype g_B" + gdb_test_multiple "ptype g_B" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # 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" + set re_class "class C : public A \{${ws}public:" + set re_fields "int c;${ws}int x;" + set re_synth_gcc_23 "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);" + + set name "ptype C" + gdb_test_multiple "ptype C" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # 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" + set name "ptype class C" + gdb_test_multiple "ptype class C" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # 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" + set name "ptype g_C" + gdb_test_multiple "ptype g_C" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" { - pass "ptype tagless struct" + } + + # Print a structure with no tag. + + set re_tag "tagless_struct" + set XX_tag "\\._1" + set re_class "(class $re_tag \{${ws}public:|class \{${ws}public:|struct $re_tag \{|struct \{)" + set XX_class "(class $XX_tag \{${ws}public:|struct $XX_tag \{)" + set re_fields "int one;${ws}int two;" + set re_synth_gcc_23 "$re_tag & operator=\\($re_tag const ?&\\);${ws}$re_tag\\($re_tag const ?&\\);${ws}$re_tag\\((void|)\\);" + set XX_synth_gcc_23 "($re_tag|$XX_tag) & operator=\\($XX_tag const ?&\\);${ws}$XX_tag\\($XX_tag const ?&\\);${ws}$XX_tag\\((void|)\\);" + + set name "ptype tagless struct" + gdb_test_multiple "ptype tagless_struct" $name { + -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" { - pass "ptype tagless struct (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass "$name (obsolete gcc or gdb)" } - -re ".*$gdb_prompt $" { - fail "ptype tagless struct" + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - timeout { - fail "ptype tagless struct (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } } - 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" + set name "ptype variable of type tagless struct" + gdb_test_multiple "ptype v_tagless" $name { + -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - -re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" { - pass "ptype tagless struct" + -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass "$name (obsolete gcc or gdb)" } - -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" { - pass "ptype variable of type tagless struct (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - -re ".*$gdb_prompt $" { - fail "ptype variable of type tagless struct" - } - timeout { - fail "ptype variable of type tagless struct (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } } } -# -# 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. -# +# Multiple inheritance, print type definitions. -proc test_print_anon_union {} { +proc test_ptype_mi { } { 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" + set re_class "class D : public B, public C \{${ws}public:" + set re_fields "int d;${ws}int x;" + set re_synth_gcc_23 "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" + + # ptype D: type, class, object. + + set name "ptype D" + gdb_test_multiple "ptype D" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } + + set name "ptype class D" + gdb_test_multiple "ptype class D" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" { - pass "print variable of type anonymous union (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$nl$gdb_prompt $" { - fail "print variable of type anonymous union" + } + + set name "ptype g_D" + gdb_test_multiple "ptype g_D" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - timeout { - fail "print variableof type anonymous union (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } } - 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" + + set re_class "class E : public D \{${ws}public:" + set re_fields "int e;${ws}int x;" + set re_synth_gcc_23 "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" + + # ptype E: type, class, object. + + set name "ptype E" + gdb_test_multiple "ptype E" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -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 = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -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" + } + + set name "ptype class E" + gdb_test_multiple "ptype class E" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -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 "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$nl$gdb_prompt $" { - fail "print type of anonymous union" + } + + set name "ptype g_E" + gdb_test_multiple "ptype g_E" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - timeout { - fail "print type of anonymous union (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } } } -# -# Multiple inheritance, print individual members. -# +# Single virtual inheritance, print type definitions. -proc test_print_mi_members {} { +proc test_ptype_vi { } { global gdb_prompt + global ws 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. + # ptype vA: type, class, object. - gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a" + set re_class "class vA \{${ws}public:" + set re_fields "int va;${ws}int vx;" + set re_synth_gcc_23 "vA & operator=\\(vA const ?&\\);${ws}vA\\(vA const ?&\\);${ws}vA\\((void|)\\);" - gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x" + set name "ptype vA" + gdb_test_multiple "ptype vA" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } - gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b" + set name "ptype class vA" + gdb_test_multiple "ptype class vA" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } - gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x" + set name "ptype g_vA" + gdb_test_multiple "ptype g_vA" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } - # Print all members of g_C. + # ptype vB: type, class, object. - gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a" + set re_class "class vB : public virtual vA \{(${ws}private:|)" + set re_vbptr "vA \\*(_vb.2vA|_vb.vA);${ws}" + set re_access "public:" + set re_fields "int vb;${ws}int vx;" + set re_synth_gcc_2 "vB & operator=\\(vB const ?&\\);${ws}vB\\(int, vB const ?&\\);${ws}vB\\(int\\);" + set re_synth_gcc_3 "vB & operator=\\(vB const ?&\\);${ws}vB\\(vB const ?&\\);${ws}vB\\((void|)\\);" - gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x" + set name "ptype vB" + gdb_test_multiple "ptype vB" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } - gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c" + set name "ptype class vB" + gdb_test_multiple "ptype class vB" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } - gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x" + set name "ptype g_vB" + gdb_test_multiple "ptype g_vB" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } - # Print all members of g_D. + # ptype vC: type, class, object. - # 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. + set re_class "class vC : public virtual vA \{(${ws}private:|)" + set re_vbptr "vA \\*(_vb.2vA|_vb.vA);${ws}" + set re_access "public:" + set re_fields "int vc;${ws}int vx;" + set re_synth_gcc_2 "vC & operator=\\(vC const ?&\\);${ws}vC\\(int, vC const ?&\\);${ws}vC\\(int\\);" + set re_synth_gcc_3 "vC & operator=\\(vC const ?&\\);${ws}vC\\(vC const ?&\\);${ws}vC\\((void|)\\);" - 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" + set name "ptype vC" + gdb_test_multiple "ptype vC" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -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 "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = 15$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::a" + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" } - -re ".* = 11$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::a" + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" } - -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" + set name "ptype class vC" + gdb_test_multiple "ptype class vC" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -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 "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = 16$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" } - -re ".* = 12$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" } - -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" + set name "ptype g_vC" + gdb_test_multiple "ptype g_vC" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } +} - gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d" +# Multiple virtual inheritance, print type definitions. - gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x" +proc test_ptype_mvi { } { + global gdb_prompt + global ws + global nl - # Print all members of g_E. + # ptype vD: type, class, object. - # 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. + set re_class "class vD : public virtual vB, public virtual vC \{(${ws}private:|)" + set re_vbptr "vC \\*(_vb.2vC|_vb.vC);${ws}vB \\*(_vb.2vB|_vb.vB);" + set re_access "public:" + set re_fields "int vd;${ws}int vx;" + set re_synth_gcc_2 "vD & operator=\\(vD const ?&\\);${ws}vD\\(int, vD const ?&\\);${ws}vD\\(int\\);" + set re_synth_gcc_3 "vD & operator=\\(vD const ?&\\);${ws}vD\\(vD const ?&\\);${ws}vD\\((void|)\\);" - send_gdb "print g_E.A::a\n" - gdb_expect { - -re ".* = 21$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::a" + set name "ptype vD" + gdb_test_multiple "ptype vD" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -re ".* = 25$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::a" + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } - -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" + set name "ptype class vD" + gdb_test_multiple "ptype class vD" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -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 "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = 26$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" } - -re ".* = 22$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } - -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" + set name "ptype g_vD" + gdb_test_multiple "ptype g_vD" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } - gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x" + # ptype vE: type, class, object. - gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d" + set re_class "class vE : public virtual vD \{(${ws}private:|)" + set re_vbptr "vD \\*(_vb.2vD|_vb.vD);" + set re_access "public:" + set re_fields "int ve;${ws}int vx;" + set re_synth_gcc_2 "vE & operator=\\(vE const ?&\\);${ws}vE\\(int, vE const ?&\\);${ws}vE\\(int\\);" + set re_synth_gcc_3 "vE & operator=\\(vE const ?&\\);${ws}vE\\(vE const ?&\\);${ws}vE\\((void|)\\);" - gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x" + set name "ptype vE" + gdb_test_multiple "ptype vE" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } - gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e" + set name "ptype class vE" + gdb_test_multiple "ptype class vE" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } - gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x" + set name "ptype g_vE" + gdb_test_multiple "ptype g_vE" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } } -# -# Multiple inheritance, print type definitions. -# +# Single inheritance, print individual members. -proc test_ptype_mi {} { - global nl +proc test_print_si_members { } { + global vhn - gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D" + # Print all members of g_A using fully qualified form. + gdb_test "print g_A.A::a" "$vhn = 1" + gdb_test "print g_A.A::x" "$vhn = 2" - gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D" + # Print members of g_A using nonambiguous compact form. + gdb_test "print g_A.a" "$vhn = 1" + gdb_test "print g_A.x" "$vhn = 2" - gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D" + # Print all members of g_B using fully qualified form. + gdb_test "print g_B.A::a" "$vhn = 3" + gdb_test "print g_B.A::x" "$vhn = 4" + gdb_test "print g_B.B::b" "$vhn = 5" + gdb_test "print g_B.B::x" "$vhn = 6" - gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E" + # Print members of g_B using nonambiguous compact form. + gdb_test "print g_B.a" "$vhn = 3" + gdb_test "print g_B.b" "$vhn = 5" + gdb_test "print g_B.x" "$vhn = 6" - gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E" + # Print all members of g_C using fully qualified form. + gdb_test "print g_C.A::a" "$vhn = 7" + gdb_test "print g_C.A::x" "$vhn = 8" + gdb_test "print g_C.C::c" "$vhn = 9" + gdb_test "print g_C.C::x" "$vhn = 10" - gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E" + # Print members of g_C using nonambiguous compact form. + gdb_test "print g_C.a" "$vhn = 7" + gdb_test "print g_C.c" "$vhn = 9" + gdb_test "print g_C.x" "$vhn = 10" } -# -# 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" +# Single inheritance, print complete classes. - # Print all members of g_E. +proc test_print_si_classes { } { + global vhn - 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" + # Print all members of g_A, g_B, g_C. + gdb_test "print g_A" "$vhn = \{a = 1, x = 2\}" + gdb_test "print g_B" "$vhn = \{<(class A|A)> = \{a = 3, x = 4\}, b = 5, x = 6\}" + gdb_test "print g_C" "$vhn = \{<(class A|A)> = \{a = 7, x = 8\}, c = 9, x = 10\}" } -# -# Single virtual inheritance, print individual members. -# +# Multiple inheritance, print individual members. -proc test_print_svi_members {} { +proc test_print_mi_members {} { global gdb_prompt - global decimal global nl + global vhn - # 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" + # Print all members of g_A. + gdb_test "print g_A.A::a" "$vhn = 1" + gdb_test "print g_A.A::x" "$vhn = 2" - gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx" + # Print all members of g_B. + gdb_test "print g_B.A::a" "$vhn = 3" + gdb_test "print g_B.A::x" "$vhn = 4" + gdb_test "print g_B.B::b" "$vhn = 5" + gdb_test "print g_B.B::x" "$vhn = 6" - # Print all members of g_vB. + # Print all members of g_C. + gdb_test "print g_C.A::a" "$vhn = 7" + gdb_test "print g_C.A::x" "$vhn = 8" + gdb_test "print g_C.C::c" "$vhn = 9" + gdb_test "print g_C.C::x" "$vhn = 10" - 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 + # Print all members of g_D. + # + # g_D.A::a and g_D.A::x are ambiguous member accesses, and gdb + # should detect these. There are no ways to PASS these tests + # because I don't know what the gdb message will be. -- chastain + # 2004-01-27. + + set name "print g_D.A::a" + gdb_test_multiple "print g_D.A::a" $name { + -re "$vhn = (15|11)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::a" } - -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" + set name "print g_D.A::x" + gdb_test_multiple "print g_D.A::x" $name { + -re "$vhn = (16|12)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::x" + } + } - # Print all members of g_vC. + gdb_test "print g_D.B::b" "$vhn = 13" + gdb_test "print g_D.B::x" "$vhn = 14" + gdb_test "print g_D.C::c" "$vhn = 17" + gdb_test "print g_D.C::x" "$vhn = 18" + gdb_test "print g_D.D::d" "$vhn = 19" + gdb_test "print g_D.D::x" "$vhn = 20" - gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va" + # Print all members of g_E. + # g_E.A::a and g_E.A::x are ambiguous. - gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx" + set name "print g_E.A::a" + gdb_test_multiple "print g_E.A::a" $name { + -re "$vhn = (21|25)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::a" + } + } - gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc" + set name "print g_E.A::x" + gdb_test_multiple "print g_E.A::x" $name { + -re "$vhn = (26|22)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::x" + } + } - gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx" + gdb_test "print g_E.B::b" "$vhn = 23" + gdb_test "print g_E.B::x" "$vhn = 24" + gdb_test "print g_E.C::c" "$vhn = 27" + gdb_test "print g_E.C::x" "$vhn = 28" + gdb_test "print g_E.D::d" "$vhn = 29" + gdb_test "print g_E.D::x" "$vhn = 30" + gdb_test "print g_E.E::e" "$vhn = 31" + gdb_test "print g_E.E::x" "$vhn = 32" +} - # Print members of g_vC using compact form. +# Multiple inheritance, print complete classes. - gdb_test "print g_vC.va" ".* = 7" "print g_vC.va" +proc test_print_mi_classes { } { + global vhn - gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc" + # Print all members of g_D. + gdb_test "print g_D" "$vhn = \{\<(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\}" - gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx" + # Print all members of g_E. + gdb_test "print g_E" "$vhn = \{\<(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\}" } +# 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. # -# Single virtual inheritance, print type definitions. -# +# GDB HEAD 2004-01-27 with hp aCC A.03.45 crashes on the first test. +# -- chastain 2004-01-27 -proc test_ptype_vi {} { +proc test_print_anon_union {} { global gdb_prompt global ws global nl - global vbptr + global vhn - # 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 } - } + gdb_test "print g_anon_union.a" "$vhn = 2" "print anonymous union member" - # 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" + set name "print variable of type anonymous union" + gdb_test_multiple "print g_anon_union" $name { + -re "$vhn = \{one = 1, \{a = 2, b = 2\}\}$nl$gdb_prompt $" { + pass $name } - -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 } - } + set re_class "class class_with_anon_union \{${ws}public:" + set re_fields "int one;${ws}" + set re_anon_union "union \{${ws}int a;${ws}long int b;${ws}\};" + set re_synth_gcc_23 "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|)\\);" - 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" + set name "print type of anonymous union" + gdb_test_multiple "ptype g_anon_union" $name { + -re "type = $re_class${ws}$re_fields${ws}$re_anon_union$nl\}$nl$gdb_prompt $" { + pass $name } - -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 "type = $re_class${ws}$re_fields${ws}$re_anon_union${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -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)" } - } +# Single virtual inheritance, print individual members. - 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)" } - } +proc test_print_svi_members { } { + global vhn - 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)" } - } + # Print all members of g_vA. + gdb_test "print g_vA.vA::va" "$vhn = 1" + gdb_test "print g_vA.vA::vx" "$vhn = 2" - 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)" } - } + # Print members of g_vA using compact form. + gdb_test "print g_vA.va" "$vhn = 1" + gdb_test "print g_vA.vx" "$vhn = 2" + + # Print all members of g_vB. + gdb_test "print g_vB.vA::va" "$vhn = 3" + gdb_test "print g_vB.vA::vx" "$vhn = 4" + gdb_test "print g_vB.vB::vb" "$vhn = 5" + gdb_test "print g_vB.vB::vx" "$vhn = 6" + + # Print members of g_vB using compact form. + gdb_test "print g_vB.va" "$vhn = 3" + gdb_test "print g_vB.vb" "$vhn = 5" + gdb_test "print g_vB.vx" "$vhn = 6" + + # Print all members of g_vC. + gdb_test "print g_vC.vA::va" "$vhn = 7" + gdb_test "print g_vC.vA::vx" "$vhn = 8" + gdb_test "print g_vC.vC::vc" "$vhn = 9" + gdb_test "print g_vC.vC::vx" "$vhn = 10" + + # Print members of g_vC using compact form. + gdb_test "print g_vC.va" "$vhn = 7" "print g_vC.va" + gdb_test "print g_vC.vc" "$vhn = 9" "print g_vC.vc" + gdb_test "print g_vC.vx" "$vhn = 10" "print g_vC.vx" } -# # Single virtual inheritance, print complete classes. -# -proc test_print_svi_classes {} { +proc test_print_svi_classes { } { global gdb_prompt global hex - global decimal global nl - global vbptr + global vhn # Print all members of g_vA. - - gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA" + gdb_test "print g_vA" "$vhn = \{va = 1, vx = 2\}" # Print all members of g_vB. - - send_gdb "print g_vB\n" - gdb_expect { - -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" { - pass "print g_vB (aCC)" - } - -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vB (aCC)" - } - -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, ${vbptr}vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { - pass "print g_vB" + set re_vbptr_2 "(_vb.2vA|_vb.vA)" + set re_vbptr_3 "_vptr.vB" + + set name "print g_vB" + gdb_test_multiple "print g_vB" $name { + -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_2 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" + } + -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + pass $name } - -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { - pass "print g_vB (FIXME v3 vtbl ptr)" - } - -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" { - # Happens with gcc 3.3 -gstabs+ - # Does not happen with gcc 3.2.3 -gstabs+. - # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+. - # -- chastain 2003-06-29 - pass "print g_vB" - } - - -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 ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" { - pass "print g_vC (aCC)" - } - -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vC (aCC)" + set re_vbptr_2 "(_vb.2vA|_vb.vA)" + set re_vbptr_3 "_vptr.vC" + + set name "print g_vC" + gdb_test_multiple "print g_vC" $name { + -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_2 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" + } + -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + pass $name } - -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, ${vbptr}vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { - pass "print g_vC" - } - -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { - pass "print g_vC (FIXME v3 vtbl ptr)" - } - -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" { - # Happens with gcc 3.3 -gstabs+ - # Does not happen with gcc 3.2.3 -gstabs+. - # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+. - # -- chastain 2003-06-29 - pass "print g_vC" - } - -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 +proc test_print_mvi_members { } { + global vhn # 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" + gdb_test "print g_vD.vA::va" "$vhn = 19" + gdb_test "print g_vD.vA::vx" "$vhn = 20" + gdb_test "print g_vD.vB::vb" "$vhn = 21" + gdb_test "print g_vD.vB::vx" "$vhn = 22" + gdb_test "print g_vD.vC::vc" "$vhn = 23" + gdb_test "print g_vD.vC::vx" "$vhn = 24" + gdb_test "print g_vD.vD::vd" "$vhn = 25" + gdb_test "print g_vD.vD::vx" "$vhn = 26" # 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" + gdb_test "print g_vE.vA::va" "$vhn = 0" + gdb_test "print g_vE.vA::vx" "$vhn = 0" + gdb_test "print g_vE.vB::vb" "$vhn = 0" + gdb_test "print g_vE.vB::vx" "$vhn = 0" + gdb_test "print g_vE.vC::vc" "$vhn = 0" + gdb_test "print g_vE.vC::vx" "$vhn = 0" + gdb_test "print g_vE.vD::vd" "$vhn = 0" + gdb_test "print g_vE.vD::vx" "$vhn = 0" + gdb_test "print g_vE.vE::ve" "$vhn = 27" + gdb_test "print g_vE.vE::vx" "$vhn = 28" } -# -# Multiple virtual inheritance, print type definitions. -# +# Multiple virtual inheritance, print complete classes. -proc test_ptype_mvi {} { +proc test_print_mvi_classes { } { global gdb_prompt + global hex 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" } - } + global vhn - 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" } - } + # Virtual base pointers for everybody. - 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 + set re_vbptr_2_vA "(_vb.2vA|_vb.vA)" + set re_vbptr_2_vB "(_vb.2vB|_vb.vB)" + set re_vbptr_2_vC "(_vb.2vC|_vb.vC)" + set re_vbptr_2_vD "(_vb.2vD|_vb.vD)" + set re_vbptr_3_vA "_vptr.vA" + set re_vbptr_3_vB "_vptr.vB" + set re_vbptr_3_vC "_vptr.vC" + set re_vbptr_3_vD "_vptr.vD" + set re_vbptr_3_vE "_vptr.vE" # Print all members of g_vD. - send_gdb "print g_vD\n" - gdb_expect { - -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{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 ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \<class vC\> = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vD (aCC)" + set name "print g_vD" + gdb_test_multiple "print g_vD" $name { + -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_2_vA = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 23, vx = 24\}, $re_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, ${vbptr}vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{${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 "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" } - -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_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 "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + pass "$name" } - -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vptr.vC = $hex <VTT for vD>, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { - # Happens with gcc 3.3 -gstabs+ - # Does not happen with gcc 3.2.3 -gstabs+. - # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+. - # -- chastain 2003-06-29 - pass "print g_vD" - } - -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 ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{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 ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \<class vC\> = \{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)" + set name "print g_vE" + gdb_test_multiple "print g_vE" $name { + -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_2_vA = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 0, vx = 0\}, $re_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 0, vx = 0\}, $re_vbptr_2_vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{${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 "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" } - -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vptr.vB = $hex *(\<VTT for vD\>)?, vb = 0, vx = 0\}, \<vC\> = \{_vptr.vC = $hex *(\<VTT for vD\>)?, 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 "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc 3.2.7-rh -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" } - -re ".*$gdb_prompt $" { fail "print g_vE" } - timeout { fail "print g_vE (timeout)" } } } -proc do_tests {} { +proc do_tests { } { global prms_id global bug_id global subdir @@ -980,10 +1037,9 @@ proc do_tests {} { 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; + if { ![runto_main] } then { + perror "couldn't run to main" + return } test_ptype_si @@ -991,10 +1047,9 @@ proc do_tests {} { test_ptype_vi test_ptype_mvi - gdb_stop_suppressing_tests; - - if { ![ runto 'inheritance2' ] } { - gdb_suppress_tests; + if { ![runto 'inheritance2'] } then { + perror "couldn't run to inheritance2" + return } test_print_si_members @@ -1003,10 +1058,9 @@ proc do_tests {} { test_print_mi_classes test_print_anon_union - gdb_stop_suppressing_tests; - - if { ![ runto 'inheritance4' ] } { - gdb_suppress_tests; + if { ![runto 'inheritance4'] } { + perror "couldn't run to inheritance4" + return } test_print_svi_members diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp index f4e8d22..5cd2ee9 100644 --- a/gdb/testsuite/gdb.cp/local.exp +++ b/gdb/testsuite/gdb.cp/local.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # tests for local variables # Written by Satish Pai <pai@apollo.hp.com> 1997-07-08 # Cleaned by Michael Chastain <mec@shout.net> 2002-04-08 @@ -73,53 +70,104 @@ if ![runto 'marker1'] then { 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 ".". +set sep "(\[.\]|___)\[0-9\]" -# --- -# Pattern 1: -# PASS -# dwarf-2 -# gcc 2.95.3 +# ptype on a local variable. # -# 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 +# This test has six arms. The first three arms accept normal output: +# no synthetic methods; synthetic methods before user methods; +# synthetic methods after user methods. # -# Pattern 3: -# PASS -# stabs+ -# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# The next two arms accept "foobar__Fi.0::Local" instead of "Local". +# This is a bug. It happens in various places with various versions of +# gcc and gdb and various debugging types. # -# Pattern 4: -# This an old pattern from the hppa aCC version of this file. -# I left it alone. +# The last arm accepts the user methods in duplicate. This bug happens +# with gcc 3.3.2 -gdwarf-2, and has been fixed in gcc HEAD 2004-01-22. # -# chastain 2002-04-08 +# -- chastain 2004-01-24 -# pattern #5 -# PASS -# stabs+ -# gcc HEAD abi-2 -# -# chastain 2004-01-02 +set re_class "((struct|class) Local \{${ws}public:|struct Local \{)" +set re_fields "int loc1;" +set re_methods "char loc_foo\\(char\\);" +set re_synth_gcc_23 "Local & operator=\\(Local const ?&\\);${ws}Local\\(Local const ?&\\);${ws}Local\\((void|)\\);" -set sep "(\[.\]|___)\[0-9\]" +set XX_class "((struct|class) foobar__Fi.0::Local \{${ws}public:|struct foobar__Fi.0:Local \{)" +set XX_synth_gcc_2 "Local & operator=\\(foobar__Fi.0::Local const ?&\\);${ws}Local\\(foobar__Fi.0::Local const ?&\\);${ws}Local\\((void|)\\);" +set YY_methods "$re_methods${ws}$re_methods" -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 "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\(char\\);\[\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 \]*\}.*$gdb_prompt $" { pass "ptype Local" } - -re ".*$gdb_prompt $" { fail "ptype Local" } - timeout { fail "(timeout) ptype Local" } +set name "ptype l" +gdb_test_multiple "ptype l" $name { + -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, dwarf-2 + # gdb 6.0, gcc HEAD 2004-01-22, dwarf-2 + # gdb HEAD 2004-01-23, gcc HEAD 2004-01,22, dwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, stabs+ + # gdb HEAD 2004-01-23, gcc 3.3.2, stabs+ + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23${ws}$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc HEAD 2004-01-22, stabs+ + # gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, stabs+ + pass "$name" + } + -re "type = $XX_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb HEAD 2004-01-23, gcc 2.95.3, dwarf-2 + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}($re_synth_gcc_23|$XX_synth_gcc_2)${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, stabs+ + # gdb HEAD 2004-01-23, gcc 2.95.3, stabs+ + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}$YY_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, dwarf-2 + # gdb HEAD 2004-01-23, gcc 3.2.2, dwarf-2 + kfail "gdb/483" "$name" + } +} + +# This is the same test with "ptype Local" (the type name) +# instead of "ptype l" (the variable name). + +set name "ptype Local" +gdb_test_multiple "ptype Local" $name { + -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, dwarf-2 + # gdb 6.0, gcc HEAD 2004-01-22, dwarf-2 + # gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, dwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, stabs+ + # gdb HEAD 2004-01-23, gcc 3.3.2, stabs+ + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23${ws}$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc HEAD 2004-01-22, stabs+ + # gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, stabs+ + pass "$name" + } + -re "type = $XX_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}($re_synth_gcc_23|$XX_synth_gcc_2)${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, stabs+ + # gdb HEAD 2004-01-23, gcc 2.95.3, stabs+ + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}$YY_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, dwarf-2 + # gdb HEAD 2004-01-23, gcc 3.2.2, dwarf-2 + kfail "gdb/483" "$name" + } + -re "No symbol \"Local\" in current context.$nl$gdb_prompt $" { + # gdb HEAD 2004-01-23, gcc 2.95.3, dwarf-2 + fail "$name" + } } gdb_test "break marker2" diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp index 710e14a..fd93333 100644 --- a/gdb/testsuite/gdb.cp/maint.exp +++ b/gdb/testsuite/gdb.cp/maint.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation Inc. +# Copyright 2003, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file tests C++-specific maintenance commands and help on those. diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc index 8851a85..e668c46 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.cc +++ b/gdb/testsuite/gdb.cp/member-ptr.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 2004 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 @@ -15,9 +15,9 @@ 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 */ extern "C" { #include <stdio.h> diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp index 83a70a0..f6a9d40 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.exp +++ b/gdb/testsuite/gdb.cp/member-ptr.exp @@ -16,9 +16,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Tests for pointer-to-member support # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 # Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-11 diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp index 0e8e485..87666d8 100644 --- a/gdb/testsuite/gdb.cp/method.exp +++ b/gdb/testsuite/gdb.cp/method.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # tests for misc. C++ method stuff # Written by Satish Pai <pai@apollo.hp.com> 1997-07-08 diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp index a2d122f..2758cd0 100644 --- a/gdb/testsuite/gdb.cp/misc.exp +++ b/gdb/testsuite/gdb.cp/misc.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/namespace.cc b/gdb/testsuite/gdb.cp/namespace.cc index 6a68373..ee55168 100644 --- a/gdb/testsuite/gdb.cp/namespace.cc +++ b/gdb/testsuite/gdb.cp/namespace.cc @@ -97,6 +97,13 @@ namespace C }; }; + void ensureRefs () { + // NOTE (2004-04-23, carlton): This function is here only to make + // sure that GCC 3.4 outputs debug info for these classes. + static CClass *c = new CClass(); + static CClass::NestedClass *n = new CClass::NestedClass(); + } + namespace { int cX = 6; diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index eb03a3e..4b3f1e2 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # tests for namespaces # Originally written by Satish Pai <pai@apollo.hp.com> 1997-07-23 diff --git a/gdb/testsuite/gdb.cp/namespace1.cc b/gdb/testsuite/gdb.cp/namespace1.cc index 5d66810..c3ad692 100644 --- a/gdb/testsuite/gdb.cp/namespace1.cc +++ b/gdb/testsuite/gdb.cp/namespace1.cc @@ -13,9 +13,9 @@ 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 { @@ -24,6 +24,12 @@ namespace C int z; }; + void ensureOtherRefs () { + // NOTE (2004-04-23, carlton): This function is here only to make + // sure that GCC 3.4 outputs debug info for this class. + static OtherFileClass *c = new OtherFileClass(); + } + namespace { int cXOtherFile = 29; }; diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc index 56afc96..a41e14d 100644 --- a/gdb/testsuite/gdb.cp/overload.cc +++ b/gdb/testsuite/gdb.cp/overload.cc @@ -53,6 +53,31 @@ int intToChar (char c) void marker1() {} +// Now test how overloading and namespaces interact. + +class dummyClass {}; + +dummyClass dummyInstance; + +int overloadNamespace(int i) +{ + return 1; +} + +int overloadNamespace(dummyClass d) +{ + return 2; +} + +namespace XXX { + int overloadNamespace (char c) + { + return 3; + } + + void marker2() {} +} + int main () { char arg2 = 2; @@ -81,7 +106,8 @@ int main () intToChar(1); marker1(); // marker1-returns-here - return 0; // marker1-returns-here + XXX::marker2(); // marker1-returns-here + return 0; } foo::foo (int i) { ifoo = i; ccpfoo = NULL; } diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index 2925b50..b09c58e 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) # Rewritten by Michael Chastain <mec.gnu@mindspring.com> @@ -296,6 +293,21 @@ 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" +# Now some tests to see how overloading and namespaces interact. + +gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 1" +gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 1" +gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2" + +if ![runto 'XXX::marker2'] then { + perror "couldn't run to XXX::marker2" + continue +} + +gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 3" "print overloadNamespace(1) in XXX" +gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 3" "print overloadNamespace('a') in XXX" +gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2" "print overloadNamespace(dummyInstance) in XXX" + # One last mysterious test. # I wonder what this is for? diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index 043243d..b6dfa5c 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2001, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) # modified by Michael Chastain (chastain@redhat.com) diff --git a/gdb/testsuite/gdb.cp/psmang.exp b/gdb/testsuite/gdb.cp/psmang.exp index 31dd346..b137379 100644 --- a/gdb/testsuite/gdb.cp/psmang.exp +++ b/gdb/testsuite/gdb.cp/psmang.exp @@ -1,4 +1,4 @@ -# Copyright 2002 Free Software Foundation, Inc. +# Copyright 2002, 2004 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 @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# 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. diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp index 98dc2d6..764ba8b 100644 --- a/gdb/testsuite/gdb.cp/ref-types.exp +++ b/gdb/testsuite/gdb.cp/ref-types.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp index 1241665..0a8a2d7 100644 --- a/gdb/testsuite/gdb.cp/rtti.exp +++ b/gdb/testsuite/gdb.cp/rtti.exp @@ -46,8 +46,9 @@ 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}" +# gdb_get_line_number needs this to be called srcfile. Except that it +# gets confused if the directories are included. :-( +set srcfile "${testfile}1.cc" if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." @@ -78,8 +79,8 @@ if ![runto_main] then { # 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_breakpoint [gdb_get_line_number "main-constructs-done"] +gdb_continue_to_breakpoint "end of constructors in main" gdb_test_multiple "print *e1" "print *e1" { -re "warning: RTTI symbol not found for class 'n1::D1'.*$gdb_prompt $" { @@ -131,5 +132,13 @@ gdb_test_multiple "print *e2" "print *e2" { } } +# Now we test the hack that's been implemented to get around some +# instances of PR gdb/1511. + +gdb_breakpoint [gdb_get_line_number "func-constructs-done"] +gdb_continue_to_breakpoint "end of constructors in func" + +gdb_test "print *obj" "\\$\[0-9\]* = {<n2::Base2> = .*}" + gdb_exit return 0 diff --git a/gdb/testsuite/gdb.cp/rtti1.cc b/gdb/testsuite/gdb.cp/rtti1.cc index 6e9d862..de8e12f 100644 --- a/gdb/testsuite/gdb.cp/rtti1.cc +++ b/gdb/testsuite/gdb.cp/rtti1.cc @@ -1,6 +1,6 @@ /* Code to go along with tests in rtti.exp. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by David Carlton <carlton@bactrian.org> and by Kealia, Inc. @@ -55,6 +55,26 @@ namespace n1 { } // n1 +// NOTE: carlton/2004-01-23: This call exists only to convince GCC to +// keep around a reference to 'obj' in n2::func - GCC 3.4 had been +// optimizing it away. +void refer_to (n2::C2 *obj) +{ + // Do nothing. +} + +namespace n2 +{ + void func () + { + C2 *obj = create2 (); + + refer_to (obj); // func-constructs-done + + return; + } +} + int main() { using namespace n1; @@ -63,5 +83,7 @@ int main() C1 *e1 = create1(); C2 *e2 = create2(); - return 0; // constructs-done + n2::func(); // main-constructs-done + + return 0; } diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index 0f7a573..8763a93 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) set ws "\[\r\n\t \]+" diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 4575249..5c9c933 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -1,5 +1,5 @@ # Tests of overloaded operators resolution. -# Copyright 1998, 1999, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2002, 2004 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 @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) # # source file "userdef.cc" diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index 958900a..bd931a6 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. @@ -176,7 +173,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ "" # class B @@ -187,7 +184,7 @@ proc test_ptype_of_classes {} { "" "int b;" \ "public:" "virtual int f\\((void|)\\);" \ "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ - "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" \ "" # class C @@ -198,7 +195,7 @@ proc test_ptype_of_classes {} { "public:" "int c;" \ "" "" \ "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" \ - "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" \ + "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);" \ "" # class AD @@ -220,7 +217,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ "" # class E @@ -232,7 +229,7 @@ proc test_ptype_of_classes {} { "public:" "int e;" \ "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ - "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" \ "" # An instance of D @@ -243,7 +240,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ "" # An instance of D * @@ -254,7 +251,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ " ?\\*" # An instance of AD * @@ -277,7 +274,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ "" # An instance of B @@ -288,7 +285,7 @@ proc test_ptype_of_classes {} { "" "int b;" \ "public:" "virtual int f\\((void|)\\);" \ "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ - "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" \ "" # An instance of C @@ -299,7 +296,7 @@ proc test_ptype_of_classes {} { "public:" "int c;" \ "" "" \ "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" \ - "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" \ + "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);" \ "" # An instance of D @@ -310,7 +307,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ "" # An instance of E @@ -321,7 +318,7 @@ proc test_ptype_of_classes {} { "public:" "int e;" \ "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ - "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" \ "" # An instance of V @@ -354,7 +351,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ " ?\\*" # An instance of A * @@ -365,7 +362,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ " ?\\*" # An instance of B * @@ -376,7 +373,7 @@ proc test_ptype_of_classes {} { "" "int b;" \ "public:" "virtual int f\\((void|)\\);" \ "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ - "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" \ " ?\\*" # An instance of D * @@ -387,7 +384,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ " ?\\*" # An instance of D * @@ -398,7 +395,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ " ?\\*" # An instance of V * @@ -464,7 +461,7 @@ proc test_ptype_of_classes {} { "public:" "int e;" \ "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ - "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" \ " ?\\*" # An instance of VB * diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index b805234a..966a86d 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -1,4 +1,4 @@ -# Copyright 2000, 2002 Free Software Foundation, Inc. +# Copyright 2000, 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 3ba24b1..74a5894 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation +# Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -827,16 +827,15 @@ mi_gdb_test "-var-update *" \ set line 208 mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" -mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \ - "listing of names and values of children" - # Test: c_variable-5.8 # Desc: check that long_array[3-9] changed mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ "update all vars struct_declarations.long_array.3-9 changed" +mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ + "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \ + "listing of names and values of children" # Step over "weird->func_ptr = nothing;" set line 211 diff --git a/gdb/testsuite/gdb.mi/mi1-basics.exp b/gdb/testsuite/gdb.mi/mi1-basics.exp deleted file mode 100644 index 42d022d..0000000 --- a/gdb/testsuite/gdb.mi/mi1-basics.exp +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -# In this file we want to test if the operations needed by the following -# procedures work, so it makes no sense using them here. - -# mi_delete_breakpoints -# mi_gdb_reinitialize_dir $srcdir/$subdir -# mi_gdb_load ${binfile} - -# Test if the MI interpreter has been configured - -proc test_mi_interpreter_selection {} { - global mi_gdb_prompt - global gdb_prompt - - # All this test expects is to get the prompt back - # with no syntax error message - send_gdb "-gdb-version\n" - gdb_expect { - -re "GNU gdb .*\r\n$mi_gdb_prompt$" \ - { pass "acceptance of MI operations" - return 1} - -re ".*\r\n$mi_gdb_prompt$" \ - { fail "acceptance of MI operations" - note "Skipping all other MI tests." } - -re "Undefined command.*$gdb_prompt $" \ - { fail "acceptance of MI operations" - note "Skipping all other MI tests." } - -re ".*$gdb_prompt $" \ - { fail "acceptance of MI operations" - note "Skipping all other MI tests." } - timeout { fail "acceptance of MI operations (timeout)" - note "Skipping all other MI tests." } - } - return 0 -} - -proc test_exec_and_symbol_mi_operatons {} { - global mi_gdb_prompt - global binfile - - # Load symbols and specify executable on a single operation - # Tests: - # -file-exec-and-symbols - - # Can't use mi_gdb_test as if this doesn't work, - # we must give up on the whole test file - send_gdb "-file-exec-and-symbols ${binfile}\n" - gdb_expect { - -re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" \ - { pass "file-exec-and-symbols operation" } - timeout { fail "file-exec-and-symbols operation (timeout)" - note "Skipping all other MI tests." - return 0} - } - - # The following is not used by mi-support.exp, but we test here so - # we get done with loading a program basics. - - # Do it again, but now load symbols and specify executable with - # two separate operations - # Tests: - # -file-clear - # -file-exec-file - # -file-symbol-file - - # FIXME: file-clear is not implemented yet. -# mi_gdb_test "-file-clear" \ -# "\\\^done" \ -# "file-clear operation" - - mi_gdb_test "-file-exec-file ${binfile}" \ - "\\\^done" \ - "file-exec-file operation" - - mi_gdb_test "-file-symbol-file ${binfile}" \ - "\\\^done" \ - "file-symbol-file operation" - - # FIXME: if we cannot load we have to skip all other tests. -} - -proc test_breakpoints_deletion {} { - global mi_gdb_prompt - global srcfile - - # Clear all breakpoints and list to confirm - # Tests: - # -break-delete (all) - # -break-list - - # The all parameter is actually no parameter. - mi_gdb_test "200-break-delete" \ - "\\\^done" \ - "break-delete (all) operation" - - mi_gdb_test "201-break-list" \ - ".*\\\^done,BreakpointTable=\\\{.*,body=\\\[\\\]\\\}" \ - "all breakpoints removed" -} - -proc test_dir_specification {} { - global mi_gdb_prompt - global srcdir - global subdir - - # Clear the search directories, then specify one to be searched - # Tests: - # -environment-directory - # -environment-directory arg - -#exp_internal 1 - mi_gdb_test "202-environment-directory" \ - "\\\^done" \ - "environment-directory operation" - - mi_gdb_test "203-environment-directory ${srcdir}/${subdir}" \ - "\\\^done" \ - "environment-directory arg operation" -#exp_internal 0 -} - -if [test_mi_interpreter_selection] { - test_exec_and_symbol_mi_operatons - test_breakpoints_deletion - test_dir_specification -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-break.exp b/gdb/testsuite/gdb.mi/mi1-break.exp deleted file mode 100644 index 34a6ef7..0000000 --- a/gdb/testsuite/gdb.mi/mi1-break.exp +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 1999 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_tbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -t main - # -break-insert -t basics.c:callee2 - # -break-insert -t basics.c:15 - # -break-insert -t srcfile:6 - # -break-list - - mi_gdb_test "222-break-insert -t main" \ - "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert -t operation" - - mi_gdb_test "333-break-insert -t basics.c:callee2" \ - "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \ - "insert temp breakpoint at basics.c:callee2" - - mi_gdb_test "444-break-insert -t basics.c:15" \ - "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \ - "insert temp breakpoint at basics.c:15 (callee3)" - - # Getting the quoting right is tricky. That is "\"<file>\":6" - mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":6\"" \ - "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \ - "insert temp breakpoint at \"<fullfilename>\":6 (callee4)" - - mi_gdb_test "666-break-list" \ - "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}.*\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "777-break-delete" \ - "777\\^done" \ - "delete temp breakpoints" -} - -proc test_rbreak_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert -r main - # -break-insert -r callee2 - # -break-insert -r callee - # -break-insert -r .*llee - # -break-list - - setup_xfail "*-*-*" - mi_gdb_test "122-break-insert -r main" \ - "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \ - "break-insert -r operation" - - setup_xfail "*-*-*" - mi_gdb_test "133-break-insert -r callee2" \ - "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\}" \ - "insert breakpoint with regexp callee2" - - setup_xfail "*-*-*" - mi_gdb_test "144-break-insert -r callee" \ - "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"27\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"17\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"8\"\}" \ - "insert breakpoint with regexp callee" - - setup_xfail "*-*-*" - mi_gdb_test "155-break-insert -r \.\*llee" \ - "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"27\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"17\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"8\"\}" \ - "insert breakpoint with regexp .*llee" - - setup_xfail "*-*-*" - mi_gdb_test "166-break-list" \ - "1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete" \ - "177\\^done" \ - "delete temp breakpoints" -} - -test_tbreak_creation_and_listing -test_rbreak_creation_and_listing - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-console.exp b/gdb/testsuite/gdb.mi/mi1-console.exp deleted file mode 100644 index ab7f5ac..0000000 --- a/gdb/testsuite/gdb.mi/mi1-console.exp +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -# This test only works when talking to a target that routes its output -# through GDB. Check that we're either talking to a simulator or a -# remote target. - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "mi-console" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_run_to_main - -# Next over the hello() call which will produce lots of output -send_gdb "47-exec-next\n" -gdb_expect { - -re "47\\^running\r\n$mi_gdb_prompt" { - pass "Started step over hello" - } - timeout { - fail "Started step over hello (timeout)" - } -} - -gdb_expect { - -re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" { - pass "Hello message" - } - -re "Hello" { - - # Probably a native system where GDB doesn't have direct - # control over the inferior console. - # For this to work, GDB would need to run the inferior process - # under a PTY and then use the even-loops ability to wait on - # multiple event sources to channel the output back through the - # MI. - - kfail "gdb/623" "Hello message" - } - timeout { - fail "Hello message (timeout)" - } -} - -gdb_expect { - -re "47\\*stopped.*$mi_gdb_prompt$" { - pass "Finished step over hello" - } - timeout { - fail "Finished step over hello (timeout)" - } -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-disassemble.exp b/gdb/testsuite/gdb.mi/mi1-disassemble.exp deleted file mode 100644 index 7292a35..0000000 --- a/gdb/testsuite/gdb.mi/mi1-disassemble.exp +++ /dev/null @@ -1,178 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test Machine interface (MI) operations for disassembly. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_disassembly_only {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassemble -s $pc -e "$pc+8" -- 0 - # -data-disassembly -f basics.c -l 32 -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \ - "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \ - "data-disassemble from pc to pc+12 assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file & line, assembly only" -} - -proc test_disassembly_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l 32 -n 20 -- 0 - # -data-disassembly -f basics.c -l 32 -n 0 -- 0 - # -data-disassembly -f basics.c -l 32 -n 50 -- 0 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file, line, number assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 0" \ - "222\\^done,asm_insns=\\\[\\\]" \ - "data-disassemble file, line, number (zero lines) assembly only" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 0" \ - "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \ - "data-disassemble file, line, number (more than main lines) assembly only" -} - - -proc test_disassembly_mixed {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l 21 -- 1 - # -data-disassembly -s $pc -e "$pc+8" -- 1 - - mi_gdb_test "002-data-disassemble -f basics.c -l 21 -- 1" \ - "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"21\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble file, line assembly mixed" - - # - # In mixed mode, the lowest level of granularity is the source line. - # So we are going to get the disassembly for the source line at - # which we are now, even if we have specified that the range is only 2 insns. - # - mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 1" \ - "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \ - "data-disassemble range assembly mixed" -} - -proc test_disassembly_mixed_lines_limit {} { - global mi_gdb_prompt - global hex - global decimal - - # Test disassembly more only for the current function. - # Tests: - # -data-disassembly -f basics.c -l 32 -n 20 -- 1 - # -data-disassembly -f basics.c -l 32 -n 0 -- 1 - # -data-disassembly -f basics.c -l 32 -n 50 -- 1 - - mi_gdb_test "print/x \$pc" "" "" - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \ - "data-disassemble file, line, number assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"31\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \ - "data-disassemble file, line, number (zero lines) assembly mixed" - - mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 1" \ - "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \ - "data-disassemble file, line, number (more than main lines) assembly mixed" -} - -proc test_disassembly_bogus_args {} { - global mi_gdb_prompt - global hex - - # Test that bogus input to disassembly command is rejected. - # Tests: - # -data-disassembly -f foo -l abc -n 0 -- 0 - # -data-disassembly -s foo -e bar -- 0 - # -data-disassembly -s $pc -f basics.c -- 0 - # -data-disassembly -f basics.c -l 32 -- 9 - - mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \ - ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \ - "data-disassemble bogus filename" - - mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \ - "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \ - "data-disassemble bogus address" - - mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \ - "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \ - "data-disassemble mix different args" - - mi_gdb_test "789-data-disassemble -f basics.c -l 32 -- 9" \ - "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \ - "data-disassemble wrong mode arg" - -} - -mi_run_to_main -test_disassembly_only -test_disassembly_mixed -test_disassembly_bogus_args -test_disassembly_lines_limit -test_disassembly_mixed_lines_limit - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-eval.exp b/gdb/testsuite/gdb.mi/mi1-eval.exp deleted file mode 100644 index 330e00d..0000000 --- a/gdb/testsuite/gdb.mi/mi1-eval.exp +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify -data-evaluate-expression. There are really minimal tests. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_runto callee4 -mi_next_to "callee4" "" "basics.c" "9" "next at callee4" - -mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" - -mi_gdb_test "311-data-evaluate-expression &A" "311\\^done,value=\"$hex\"" "eval &A" - -mi_gdb_test "411-data-evaluate-expression A+3" "411\\^done,value=\"4\"" "eval A+3" - -mi_gdb_test "511-data-evaluate-expression \"A + 3\"" "511\\^done,value=\"4\"" "eval A + 3" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-hack-cli.exp b/gdb/testsuite/gdb.mi/mi1-hack-cli.exp deleted file mode 100644 index 951981a..0000000 --- a/gdb/testsuite/gdb.mi/mi1-hack-cli.exp +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 1999 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - - -# Some basic checks for the CLI. - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -mi_gdb_test "show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n\\^done" \ - "show architecture" - -mi_gdb_test "47show architecture" \ - "&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n47\\^done" \ - "47show architecture" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-pthreads.exp b/gdb/testsuite/gdb.mi/mi1-pthreads.exp deleted file mode 100644 index df841b2..0000000 --- a/gdb/testsuite/gdb.mi/mi1-pthreads.exp +++ /dev/null @@ -1,221 +0,0 @@ -# Copyright 2002, 2003, 2004 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 MI thread commands. -# Specifically, we are testing the MI command set and the console (in MI) -# command set ("interpreter-exec") and that the commands that are executed -# via these command pathways are properly executed. Console commands -# executed via MI should use MI output wrappers, MI event handlers, etc. - -# This only works with native configurations -if {![isnative]} { - return -} - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if {[mi_gdb_start]} { - continue -} - -# The procs below dealing with parsing cli/mi output for the threadlist -# is duplicated in gdb669.exp. Any changes here will probably need to -# be made there as well. - -proc get_mi_thread_list {name} { - global expect_out - - # MI will return a list of thread ids: - # - # -thread-list-ids - # ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N" - # (gdb) - mi_gdb_test "-thread-list-ids" \ - {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \ - "-thread_list_ids ($name)" - - set output {} - if {[info exists expect_out(buffer)]} { - set output $expect_out(buffer) - } - - set thread_list {} - if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} { - fail "finding threads in MI output ($name)" - } else { - pass "finding threads in MI output ($name)" - - # Make list of console threads - set start [expr {[string first \{ $threads] + 1}] - set end [expr {[string first \} $threads] - 1}] - set threads [string range $threads $start $end] - foreach thread [split $threads ,] { - if {[scan $thread {thread-id="%d"} num]} { - lappend thread_list $num - } - } - } - - return $thread_list -} - -# Check that MI and the console know of the same threads. -# Appends NAME to all test names. -proc check_mi_and_console_threads {name} { - global expect_out - - mi_gdb_test "-thread-list-ids" \ - {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \ - "-thread-list-ids ($name)" - set mi_output {} - if {[info exists expect_out(buffer)]} { - set mi_output $expect_out(buffer) - } - - # GDB will return a list of thread ids and some more info: - # - # (gdb) - # -interpreter-exec console "info threads" - # ~" 4 Thread 2051 (LWP 7734) 0x401166b1 in __libc_nanosleep () at __libc_nanosleep:-1" - # ~" 3 Thread 1026 (LWP 7733) () at __libc_nanosleep:-1" - # ~" 2 Thread 2049 (LWP 7732) 0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63" - # ~"* 1 Thread 1024 (LWP 7731) main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160" - # FIXME: kseitz/2002-09-05: Don't use the hack-cli method. - mi_gdb_test "info threads" \ - {.*(~".*"[\r\n]*)+.*} \ - "info threads ($name)" - set console_output {} - if {[info exists $expect_out(buffer)]} { - set console_output $expect_out(buffer) - } - - # Make a list of all known threads to console (gdb's thread IDs) - set console_thread_list {} - foreach line [split $console_output \n] { - if {[string index $line 0] == "~"} { - # This is a line from the console; trim off "~", " ", "*", and "\"" - set line [string trim $line ~\ \"\*] - if {[scan $line "%d" id] == 1} { - lappend console_thread_list $id - } - } - } - - # Now find the result string from MI - set mi_result "" - foreach line [split $mi_output \n] { - if {[string range $line 0 4] == "^done"} { - set mi_result $line - } - } - if {$mi_result == ""} { - fail "finding MI result string ($name)" - } else { - pass "finding MI result string ($name)" - } - - # Finally, extract the thread ids and compare them to the console - set num_mi_threads_str "" - if {![regexp {number-of-threads="[0-9]+"} $mi_result num_mi_threads_str]} { - fail "finding number of threads in MI output ($name)" - } else { - pass "finding number of threads in MI output ($name)" - - # Extract the number of threads from the MI result - if {![scan $num_mi_threads_str {number-of-threads="%d"} num_mi_threads]} { - fail "got number of threads from MI ($name)" - } else { - pass "got number of threads from MI ($name)" - - # Check if MI and console have same number of threads - if {$num_mi_threads != [llength $console_thread_list]} { - fail "console and MI have same number of threads ($name)" - } else { - pass "console and MI have same number of threads ($name)" - - # Get MI thread list - set mi_thread_list [get_mi_thread_list $name] - - # Check if MI and console have the same threads - set fails 0 - foreach ct [lsort $console_thread_list] mt [lsort $mi_thread_list] { - if {$ct != $mt} { - incr fails - } - } - if {$fails > 0} { - fail "MI and console have same threads ($name)" - - # Send a list of failures to the log - send_log "Console has thread ids: $console_thread_list\n" - send_log "MI has thread ids: $mi_thread_list\n" - } else { - pass "MI and console have same threads ($name)" - } - } - } - } -} - -# This procedure tests the various thread commands in MI. -proc check_mi_thread_command_set {} { - - mi_runto done_making_threads - - set thread_list [get_mi_thread_list "in check_mi_thread_command_set"] - - mi_gdb_test "-thread-select" \ - {\^error,msg="mi_cmd_thread_select: USAGE: threadnum."} \ - "check_mi_thread_command_set: -thread-select" - - mi_gdb_test "-thread-select 123456789" \ - {\^error,msg="Thread ID 123456789 not known\."} \ - "check_mi_thread_command_set: -thread-select 123456789" - - foreach thread $thread_list { - # line and file are optional. - # many of the threads are blocked in libc calls, - # and many people have libc's with no symbols. - mi_gdb_test "-thread-select $thread" \ - "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \ - "check_mi_thread_command_set: -thread-select $thread" - } -} - -# -# Start here -# -set testfile "pthreads" -set srcfile "$testfile.c" -set binfile "$objdir/$subdir/mi1-$testfile" - -set options [list debug incdir=$objdir] -if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { - return -1 -} - -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load $binfile - -check_mi_thread_command_set - -mi_gdb_exit - diff --git a/gdb/testsuite/gdb.mi/mi1-read-memory.exp b/gdb/testsuite/gdb.mi/mi1-read-memory.exp deleted file mode 100644 index 9a0acf4..0000000 --- a/gdb/testsuite/gdb.mi/mi1-read-memory.exp +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# test basic Machine interface (MI) operations -# -# Verify that, using the MI, we can load a program and do -# other basic things that are used by all test files through mi_gdb_exit, -# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and -# mi_gdb_load, so we can safely use those. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but the command syntax and correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "mi-read-memory" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - - -mi_run_to_main - -#mi_next "do initialization" - -mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" - -mi_gdb_test "1-data-read-memory" \ - "1\\^error,msg=\".*\"" \ - "no arguments" - - -mi_gdb_test "2-data-read-memory bytes x 1 3 2" \ - "2\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \ - "3x2, one byte" - - -mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \ - "9\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x00\",\"0x01\"\\\]},{addr=\"$hex\",data=\\\[\"0x02\",\"0x03\"\\\]},{addr=\"$hex\",data=\\\[\"0x04\",\"0x05\"\\\]}\\\]" \ - "3x2, one byte offset by -6" - - -mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \ - "3\\^done,addr=\"$hex\",nr-bytes=\"4\",total-bytes=\"4\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x0100\",\"0x0102\"\\\]}\\\]" \ - "expression in quotes" - - -mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \ - "4\\^done,addr=\"$hex\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0x10\",\"0x11\",\"0x12\",\"0x13\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x14\",\"0x15\",\"0x16\",\"0x17\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x18\",\"0x19\",\"0x1a\",\"0x1b\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x1c\",\"0x1d\",\"0x1e\",\"0x1f\"\\\],ascii=\"xxxx\"},{addr=\"$hex\",data=\\\[\"0x20\",\"0x21\",\"0x22\",\"0x23\"\\\],ascii=\" !\\\\\"#\"},{addr=\"$hex\",data=\\\[\"0x24\",\"0x25\",\"0x26\",\"0x27\"\\\],ascii=\"\\$%&'\"},{addr=\"$hex\",data=\\\[\"0x28\",\"0x29\",\"0x2a\",\"0x2b\"\\\],ascii=\"().+\"},{addr=\"$hex\",data=\\\[\"0x2c\",\"0x2d\",\"0x2e\",\"0x2f\"\\\],ascii=\",-\./\"}\\\]" \ - "ascii and data" - - -mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \ - "5\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"128\"\\\]}\\\]" \ - "decimal" - -mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \ - "6\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory=\\\[{addr=\"$hex\",data=\\\[\"0200\"\\\]}\\\]" \ - "octal" - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-regs.exp b/gdb/testsuite/gdb.mi/mi1-regs.exp deleted file mode 100644 index bf59907..0000000 --- a/gdb/testsuite/gdb.mi/mi1-regs.exp +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and look at registers. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc sparc_register_tests_no_exec { } { - # Test the generic IDT chip. - mi_gdb_test "111-data-list-register-values" \ - ".*111\\^error,msg=\"mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> \\\[<regnum1>...<regnumN>\\\]\"" \ - "wrong arguments" - - mi_gdb_test "111-data-list-register-values x" \ - ".*111\\^error,msg=\"mi_cmd_data_list_register_values: No registers\.\"" \ - "no executable" -} - -# These tests exercise IDT-specific MIPS registers for several -# different processor models. - -# This should detect the actual processor in use and change -# the expected results appropriately. FIXME - -proc sparc_register_tests { } { - global hex - global decimal - set octal "\[0-7\]+" - set binary "\[0-1\]+" - set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))" - set float2 "\\-?\[0-9\]+" - - mi_gdb_test "111-data-list-register-names" \ - "111\\^done,register-names=\\\[\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fpsr\",\"cpsr\"\\\]" \ - "list register names" - - mi_gdb_test "222-data-list-register-values x" \ - "222\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\\\]" \ - "register values x" - - mi_gdb_test "333-data-list-register-values f" \ - "333\\^done,register-values=\\\[\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"71\",value=\"$float\"\}\\\]" \ - "register values f" - - mi_gdb_test "444-data-list-register-values d" \ - "444\\^done,register-values=\\\[\{number=\"0\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\\\]" \ - "register values d" - - mi_gdb_test "555-data-list-register-values o" \ - "555\\^done,register-values=\\\[\{number=\"0\",value=\"$octal\"\}.*\{number=\"71\",value=\"$octal\"\}\\\]" \ - "register values o" - - mi_gdb_test "666-data-list-register-values t" \ - "666\\^done,register-values=\\\[\{number=\"0\",value=\"$binary\"\}.*\{number=\"71\",value=\"$binary\"\}\\\]" \ - "register values t" - - # On the sparc, registers 0-31 are int, 32-63 float, 64-71 int - - mi_gdb_test "777-data-list-register-values N" \ - "777\\^done,register-values=\\\[\{number=\"0\",value=\"$decimal\"\}.*\{number=\"31\",value=\"$decimal\"\},\{number=\"32\",value=\"$float\"\}.*\{number=\"63\",value=\"$float\"\},\{number=\"64\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\\\]" \ - "register values N" - - mi_gdb_test "888-data-list-register-values r" \ - "888\\^done,register-values=\\\[\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\\\]" \ - "register values r" - - mi_gdb_test "999-data-list-register-names 68 69 70 71" \ - "999\\^done,register-names=\\\[\"pc\",\"npc\",\"fpsr\",\"cpsr\"\\\]" \ - "list names of some regs" - - mi_gdb_test "001-data-list-register-values x 68 69 70 71" \ - "001\\^done,register-values=\\\[\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\\\]" \ - "list values of some regs" - - mi_gdb_test "002-data-list-changed-registers" \ - "002\\^done,changed-registers=\\\[(\"${decimal}\"(,\"${decimal}\")*)?\\\]" \ - "list changed registers" -} - -if [istarget "sparc-*-*"] then { - sparc_register_tests_no_exec - mi_run_to_main - sparc_register_tests -} else { - verbose "mi-regs.exp tests ignored for this target" -} - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-return.exp b/gdb/testsuite/gdb.mi/mi1-return.exp deleted file mode 100644 index 539a61c..0000000 --- a/gdb/testsuite/gdb.mi/mi1-return.exp +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-return. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -proc test_return_simple {} { - global mi_gdb_prompt - global hex - - send_gdb "111-exec-return\n" - gdb_expect { - -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"} - -re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" } - timeout { fail "return from callee4 now (timeout)" - } - } -} - -mi_runto callee4 - -mi_gdb_test "205-break-delete" \ - "205\\^done.*" \ - "delete all breakpoints" - -test_return_simple - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-simplerun.exp b/gdb/testsuite/gdb.mi/mi1-simplerun.exp deleted file mode 100644 index 839903a..0000000 --- a/gdb/testsuite/gdb.mi/mi1-simplerun.exp +++ /dev/null @@ -1,199 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "201-break-insert basics.c:callee2" \ - "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \ - "insert breakpoint at basics.c:callee2" - - mi_gdb_test "202-break-insert basics.c:15" \ - "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \ - "insert breakpoint at basics.c:15 (callee3)" - - mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \ - "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \ - "insert breakpoint at \"<fullfilename>\":6 (callee4)" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \ - "list of breakpoints" - - mi_gdb_test "205-break-disable 2 3 4" \ - "205\\^done.*" \ - "disabling of breakpoints" - - mi_gdb_test "206-break-info 2" \ - "206\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"2\",.*,enabled=\"n\",.*\}\\\]\}" \ - "list of breakpoints, 16 disabled" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - # -gdb-set - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } -} - -proc test_controlled_execution {} { - global mi_gdb_prompt - global hex - - # Continue execution until a breakpoint is reached, step into calls, verifying - # if the arguments are correctly shown, continue to the end of a called - # function, step over a call (next). - # Tests: - # -exec-continue - # -exec-next - # -exec-step - # -exec-finish - - mi_next_to "main" "" "basics.c" "33" "next at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``\\\\\"'' is for \". - mi_step_to "callee1" \ - "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \ - "basics.c" "27" "step at main" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \ - "basics.c" "8" "" "step to callee4" - - # FIXME: A string argument is not printed right; should be fixed and - # we should look for the right thing here. - # NOTE: The ``.'' is part of ``gdb-result-var="$1"'' - mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish" -} - -proc test_controlling_breakpoints {} { - global mi_gdb_prompt - - # Enable, delete, set ignore counts in breakpoints - # (disable was already tested above) - # Tests: - # -break-delete - # -break-enable - # -break-after - # -break-condition - -} - -proc test_program_termination {} { - global mi_gdb_prompt - - # Run to completion: normal and forced - # Tests: - # -exec-abort - # (normal termination of inferior) - - # FIXME: "stopped" doesn't seem appropriate. - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - send_gdb "999-exec-continue\n" - gdb_expect { - -re "999\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "999\\*stopped,reason=\"exited-normally\"\r\n$mi_gdb_prompt$" { - pass "continue to end" - } - -re ".*$mi_gdb_prompt$" {fail "continue to end (2)"} - timeout {fail "continue to end (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "continue to end (1)"} - timeout {fail "continue to end (timeout 1)"} - } -} - -test_breakpoints_creation_and_listing -test_running_the_program -test_controlled_execution -test_controlling_breakpoints -test_program_termination - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-stack.exp b/gdb/testsuite/gdb.mi/mi1-stack.exp deleted file mode 100644 index b8c7cab..0000000 --- a/gdb/testsuite/gdb.mi/mi1-stack.exp +++ /dev/null @@ -1,203 +0,0 @@ -# Copyright 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that stack commands work. - -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_stack_frame_listing {} { - global mi_gdb_prompt - global hex - - # Obtain a stack trace - # Tests: - # -stack-list-frames - # -stack-list-frames 1 1 - # -stack-list-frames 1 3 - - mi_gdb_test "231-stack-list-frames" \ - "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \ - "stack frame listing" - mi_gdb_test "232-stack-list-frames 1 1" \ - "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \ - "stack frame listing 1 1" - mi_gdb_test "233-stack-list-frames 1 3" \ - "233\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \ - "stack frame listing 1 3" - - mi_gdb_test "234-stack-list-frames 1" \ - "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack frame listing wrong" -} - -proc test_stack_args_listing {} { - global mi_gdb_prompt - global hex - - # Obtain lists for args for the stack frames - # Tests: - # -stack-list-arguments 0 - # -stack-list-arguments 0 1 1 - # -stack-list-arguments 0 1 3 - # -stack-list-arguments 1 - # -stack-list-arguments 1 1 1 - # -stack-list-arguments 1 1 3 - # -stack-list-arguments - - mi_gdb_test "231-stack-list-arguments 0" \ - "231\\^done,stack-args=\\\[frame=\{level=\"0\",args=\\\[\\\]\},frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\},frame=\{level=\"2\",args=\\\[name=\"intarg\",name=\"strarg\"\\\]\},frame=\{level=\"3\",args=\\\[name=\"intarg\",name=\"strarg\",name=\"fltarg\"\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 0" - - mi_gdb_test "232-stack-list-arguments 0 1 1" \ - "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\}\\\]" \ - "stack args listing 0 1 1" - - mi_gdb_test "233-stack-list-arguments 0 1 3" \ - "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[name=\"strarg\"\\\]\},frame=\{level=\"2\",args=\\\[name=\"intarg\",name=\"strarg\"\\\]\},frame=\{level=\"3\",args=\\\[name=\"intarg\",name=\"strarg\",name=\"fltarg\"\\\]\}\\\]" \ - "stack args listing 0 1 3" - - mi_gdb_test "231-stack-list-arguments 1" \ - "231\\^done,stack-args=\\\[frame=\{level=\"0\",args=\\\[\\\]\},frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\},frame=\{level=\"4\",args=\\\[\\\]\}\\\]" \ - "stack args listing 1" - - mi_gdb_test "232-stack-list-arguments 1 1 1" \ - "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\}\\\]" \ - "stack args listing 1 1 1" - - mi_gdb_test "233-stack-list-arguments 1 1 3" \ - "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\}\\\]" \ - "stack args listing 1 1 3" - - mi_gdb_test "234-stack-list-arguments" \ - "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \ - "stack args listing wrong" -} - -proc test_stack_info_depth {} { - global mi_gdb_prompt - global hex - - # Obtain depth of stack - # Tests: - # -stack-info-depth - # -stack-info-depth 3 - # -stack-info-depth 99 - - mi_gdb_test "231-stack-info-depth" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth" - - mi_gdb_test "231-stack-info-depth 3" \ - "231\\^done,depth=\"3\"" \ - "stack info-depth 3" - - mi_gdb_test "231-stack-info-depth 99" \ - "231\\^done,depth=\"5\"" \ - "stack info-depth 99" - - mi_gdb_test "231-stack-info-depth 99 99" \ - "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \ - "stack info-depth wrong usage" -} - -proc test_stack_locals_listing {} { - global mi_gdb_prompt - global hex - - # Obtain lists for locals for the stack frames - # Tests: - # -stack-list-locals 0 - # -stack-list-locals 1 - # -stack-list-arguments - - mi_gdb_test "232-stack-list-locals 0" \ - "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \ - "stack locals listing 0" - -# step until A, B, C, have some reasonable values. -send_gdb "-exec-next 3\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "next's in callee4" - } - timeout { fail "next in callee4 (timeout)" } -} - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\\\]" \ - "stack locals listing 1" - - mi_gdb_test "234-stack-list-locals" \ - "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \ - "stack locals listing wrong" - - mi_gdb_test "232-stack-select-frame 1" \ - "232\\^done" \ - "stack select frame 1" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\\\]" \ - "stack locals listing for new frame" - -# this should be a no-op - - mi_gdb_test "232-stack-select-frame" \ - "232\\^done" \ - "stack select same frame" - - mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\\\]" \ - "stack locals for same frame (level 1)" - -} - -mi_runto callee4 -test_stack_frame_listing -test_stack_args_listing -test_stack_locals_listing -test_stack_info_depth - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-stepi.exp b/gdb/testsuite/gdb.mi/mi1-stepi.exp deleted file mode 100644 index a706637..0000000 --- a/gdb/testsuite/gdb.mi/mi1-stepi.exp +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-step-instruction and exec-next-instruction. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_stepi_nexti {} { - global mi_gdb_prompt - global hex - - send_gdb "111-exec-step-instruction\n" - gdb_expect { - -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" { - pass "step-instruction at main" - } - timeout { - fail "step-instruction at main (timeout)" - } - } - send_gdb "222-exec-next-instruction\n" - gdb_expect { - -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" { - pass "next-instruction at main" - } - timeout { - fail "next-instruction at main (timeout)" - } - } - send_gdb "333-exec-next-instruction\n" - gdb_expect { - -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" { - pass "next-instruction at main" - } - timeout { - fail "next-instruction at main (timeout)" - } - } -} - -mi_run_to_main -test_stepi_nexti - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-until.exp b/gdb/testsuite/gdb.mi/mi1-until.exp deleted file mode 100644 index a036b93..0000000 --- a/gdb/testsuite/gdb.mi/mi1-until.exp +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test Machine interface (MI) operations -# Verify that, using the MI, we can run a simple program and perform -# exec-until. - -# The goal is not to -# test gdb functionality, which is done by other tests, but to verify -# the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "until" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_running_to_foo {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert 10" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*until.c\",line=\"10\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"10\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } - - mi_gdb_test "100-break-delete 1" "100\\^done" "break-delete 1" - -} - -proc test_until {} { - global mi_gdb_prompt - global hex - - send_gdb "111-exec-until\n" - gdb_expect { - -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"12\"\}\r\n$mi_gdb_prompt$" { - pass "until after while loop" - } - timeout { - fail "until after while loop (timeout)" - } - } - - send_gdb "222-exec-until 15\n" - gdb_expect { - -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"15\"\}\r\n$mi_gdb_prompt$" { - pass "until line number" - } - timeout { - fail "until line number (timeout)" - } - } - - send_gdb "333-exec-until until.c:17\n" - gdb_expect { - -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"17\"\}\r\n$mi_gdb_prompt$" { - pass "until line number:file" - } - timeout { - fail "until line number:file (timeout)" - } - } - - # This is supposed to NOT stop at line 25. It stops right after foo is over. - - send_gdb "444-exec-until until.c:25\n" - gdb_expect { - -re "444\\^running\r\n${mi_gdb_prompt}444\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*until.c\",line=\"24\"\}\r\n$mi_gdb_prompt$" { - pass "until after current function" - } - timeout { - fail "until after current function (timeout)" - } - } - -} - -test_running_to_foo -test_until - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-var-block.exp b/gdb/testsuite/gdb.mi/mi1-var-block.exp deleted file mode 100644 index 0ff9356..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-block.exp +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_runto do_block_tests - -# Test: c_variable-3.2 -# Desc: create cb and foo -mi_gdb_test "-var-create cb * cb" \ - "\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \ - "create local variable cb" - -mi_gdb_test "-var-create foo * foo" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create local variable foo" - -# step to "foo = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test" - - -# Be paranoid and assume 3.2 created foo -mi_gdb_test "-var-delete foo" \ - "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \ - "delete var foo" - - -# Test: c_variable-3.3 -# Desc: create foo -mi_gdb_test "-var-create foo * foo" \ - "\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \ - "create local variable foo" - -# step to "foo2 = 123;" -mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test" - -# Test: c_variable-3.4 -# Desc: check foo, cb changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",name=\"cb\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: cb foo changed" - -# step to "foo = 321;" -mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test" - -# Test: c_variable-3.5 -# Desc: create inner block foo -mi_gdb_test "-var-create inner_foo * foo" \ - "\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \ - "create local variable inner_foo" - -# step to "foo2 = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test" - -# Test: c_variable-3.6 -# Desc: create foo2 -mi_gdb_test "-var-create foo2 * foo2" \ - "\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \ - "create local variable foo2" - -# Test: c_variable-3.7 -# Desc: check that outer foo in scope and inner foo out of scope -# Note: also a known gdb problem -setup_xfail *-*-* -mi_gdb_test "-var-update inner_foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -setup_xfail *-*-* -mi_gdb_test "-var-evaluate-expression inner_foo" \ - "\\^done,value=\{FIXME\}" \ - "evaluate inner_foo: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\{\}" \ - "update foo: did not change" - -mi_gdb_test "-var-delete inner_foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var inner_foo" - -# step to "foo = 0;" -mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test" - -# Test: c_variable-3.8 -# Desc: check that foo2 out of scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo2: should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* - -# step to "cb = 21;" -mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test" - -# Test: c_variable-3.9 -# Desc: check that only cb is in scope (known gdb problem) -setup_xfail *-*-* -mi_gdb_test "-var-update foo2" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo2 should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -setup_xfail *-*-* -mi_gdb_test "-var-update foo" \ - "\\^done,changelist=\{FIXME\}" \ - "update foo should be out of scope: KNOWN PROBLEM" -clear_xfail *-*-* -mi_gdb_test "-var-update cb" \ - "\\^done,changelist=\{\}" \ - "update cb" - -# Test: c_variable-3.10 -# Desc: names of editable variables -#gdbtk_test c_variable-3.10 {names of editable variables} { -# editable_variables -#} {{foo cb foo2} {}} - -# Done with block tests -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -mi_gdb_test "-var-delete foo2" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo2" - -mi_gdb_test "-var-delete cb" \ - "\\^done,ndeleted=\"1\"" \ - "delete var cb" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-var-child.exp b/gdb/testsuite/gdb.mi/mi1-var-child.exp deleted file mode 100644 index 92ae381..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-child.exp +++ /dev/null @@ -1,1203 +0,0 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation - -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_runto do_children_tests - -##### ##### -# # -# children tests # -# # -##### ##### - - -# Test: c_variable-4.2 -# Desc: create variable "struct_declarations" -mi_gdb_test "-var-create struct_declarations * struct_declarations" \ - "\\^done,name=\"struct_declarations\",numchild=\"11\",type=\"struct _struct_decl\"" \ - "create local variable struct_declarations" - -# Test: c_variable-4.3 -# Desc: children of struct_declarations -# STABS doesn't give us argument types for the func ptr structs, but -# Dwarf 2 does. -mi_gdb_test "-var-list-children struct_declarations" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of struct_declarations" - -#gdbtk_test c_variable-4.3 {children of struct_declarations} { -# get_children struct_declarations -#} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2} - -# Test: c_variable-4.4 -# Desc: number of children of struct_declarations -mi_gdb_test "-var-info-num-children struct_declarations" \ - "\\^done,numchild=\"11\"" \ - "get number of children of struct_declarations" - -# Test: c_variable-4.5 -# Desc: children of struct_declarations.integer -mi_gdb_test "-var-list-children struct_declarations.integer" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.integer" - -# Test: c_variable-4.6 -# Desc: number of children of struct_declarations.integer -mi_gdb_test "-var-info-num-children struct_declarations.integer" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.integer" - -# Test: c_variable-4.7 -# Desc: children of struct_declarations.character -mi_gdb_test "-var-list-children struct_declarations.character" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.character" - -# Test: c_variable-4.8 -# Desc: number of children of struct_declarations.character -mi_gdb_test "-var-info-num-children struct_declarations.character" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.character" - -# Test: c_variable-4.9 -# Desc: children of struct_declarations.char_ptr -mi_gdb_test "-var-list-children struct_declarations.char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.char_ptr.\\*char_ptr\",exp=\"\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.char_ptr" - -# Test: c_variable-4.10 -# Desc: number of children of struct_declarations.char_ptr -mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.char_ptr" - -# Test: c_variable-4.11 -# Desc: children of struct_declarations.long_int -mi_gdb_test "-var-list-children struct_declarations.long_int" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_int" - -# Test: c_variable-4.12 -# Desc: number of children of struct_declarations.long_int -mi_gdb_test "-var-info-num-children struct_declarations.long_int" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_int" - -# Test: c_variable-4.13 -# Desc: children of int_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",exp=\"\\*int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of struct_declarations.int_ptr_ptr" - -#gdbtk_test c_variable-4.13 {children of int_ptr_ptr} { -# get_children struct_declarations.int_ptr_ptr -#} {*int_ptr_ptr} - -# Test: c_variable-4.14 -# Desc: number of children of int_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.int_ptr_ptr" - - -# Test: c_variable-4.15 -# Desc: children of struct_declarations.long_array -mi_gdb_test "-var-list-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of struct_declarations.long_array" - -# Test: c_variable-4.16 -# Desc: number of children of struct_declarations.long_array -mi_gdb_test "-var-info-num-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.long_array" - -# Test: c_variable-4.17 -# Desc: children of struct_declarations.func_ptr -mi_gdb_test "-var-list-children struct_declarations.func_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr" - - -# Test: c_variable-4.18 -# Desc: number of children of struct_declarations.func_ptr -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr" - - -# Test: c_variable-4.19 -# Desc: children of struct_declarations.func_ptr_struct -mi_gdb_test "-var-list-children struct_declarations.func_ptr_struct" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr_struct" - -# Test: c_variable-4.20 -# Desc: number of children of struct_declarations.func_ptr_struct -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_struct" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr_struct" - - -# Test: c_variable-4.21 -# Desc: children of struct_declarations.func_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.func_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr_ptr" - -# Test: c_variable-4.22 -# Desc: number of children of struct_declarations.func_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr_ptr" - - -# Test: c_variable-4.23 -# Desc: children of struct_declarations.u1 -mi_gdb_test "-var-list-children struct_declarations.u1" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.u1.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.u1.b\",exp=\"b\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.u1.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.u1.d\",exp=\"d\",numchild=\"0\",type=\"enum foo\"\}\}" \ - "get children of struct_declarations.u1" - -# Test: c_variable-4.24 -# Desc: number of children of struct_declarations.u1 -mi_gdb_test "-var-info-num-children struct_declarations.u1" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.u1" - -# Test: c_variable-4.25 -# Desc: children of struct_declarations.s2 -mi_gdb_test "-var-list-children struct_declarations.s2" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.s2.u2\",exp=\"u2\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2.g\",exp=\"g\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.s2.h\",exp=\"h\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.i\",exp=\"i\",numchild=\"10\",type=\"long int \\\[10\\\]\"\}\}" \ - "get children of struct_declarations.s2" -#gdbtk_test c_variable-4.25 {children of struct_declarations.s2} { -# get_children struct_declarations.s2 -#} {u2 g h i} - -# Test: c_variable-4.26 -# Desc: number of children of struct_declarations.s2 -mi_gdb_test "-var-info-num-children struct_declarations.s2" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.s2" - - -# Test: c_variable-4.27 -# Desc: children of struct_declarations.long_array.1 -mi_gdb_test "-var-list-children struct_declarations.long_array.1" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.1" - -# Test: c_variable-4.28 -# Desc: number of children of struct_declarations.long_array.1 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.1" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.1" - -# Test: c_variable-4.29 -# Desc: children of struct_declarations.long_array.2 -mi_gdb_test "-var-list-children struct_declarations.long_array.2" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.2" - -# Test: c_variable-4.30 -# Desc: number of children of struct_declarations.long_array.2 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.2" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.2" - -# Test: c_variable-4.31 -# Desc: children of struct_declarations.long_array.3 -mi_gdb_test "-var-list-children struct_declarations.long_array.3" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.3" - -# Test: c_variable-4.32 -# Desc: number of children of struct_declarations.long_array.3 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.3" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.3" - -# Test: c_variable-4.33 -# Desc: children of struct_declarations.long_array.4 -mi_gdb_test "-var-list-children struct_declarations.long_array.4" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.4" - -# Test: c_variable-4.34 -# Desc: number of children of struct_declarations.long_array.4 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.4" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.4" - -# Test: c_variable-4.35 -# Desc: children of struct_declarations.long_array.5 -mi_gdb_test "-var-list-children struct_declarations.long_array.5" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.5" - -# Test: c_variable-4.36 -# Desc: number of children of struct_declarations.long_array.5 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.5" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.5" - -# Test: c_variable-4.37 -# Desc: children of struct_declarations.long_array.6 -mi_gdb_test "-var-list-children struct_declarations.long_array.6" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.6" - -# Test: c_variable-4.38 -# Desc: number of children of struct_declarations.long_array.6 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.6" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.6" - -# Test: c_variable-4.39 -# Desc: children of struct_declarations.long_array.7 -mi_gdb_test "-var-list-children struct_declarations.long_array.7" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.7" - -# Test: c_variable-4.40 -# Desc: number of children of struct_declarations.long_array.7 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.7" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.7" - -# Test: c_variable-4.41 -# Desc: children of struct_declarations.long_array.8 -mi_gdb_test "-var-list-children struct_declarations.long_array.8" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.8" - -# Test: c_variable-4.42 -# Desc: number of children of struct_declarations.long_array.8 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.8" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.8" - - -# Test: c_variable-4.43 -# Desc: children of struct_declarations.long_array.9 -mi_gdb_test "-var-list-children struct_declarations.long_array.9" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.9" - -# Test: c_variable-4.44 -# Desc: number of children of struct_declarations.long_array.9 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.9" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.9" - -# Test: c_variable-4.45 -# Desc: children of struct_declarations.u1.a -mi_gdb_test "-var-list-children struct_declarations.u1.a" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.a" - -# Test: c_variable-4.46 -# Desc: number of children of struct_declarations.u1.a -mi_gdb_test "-var-info-num-children struct_declarations.u1.a" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.a" - -# Test: c_variable-4.47 -# Desc: children of struct_declarations.u1.b -mi_gdb_test "-var-list-children struct_declarations.u1.b" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.u1.b.\\*b\",exp=\"\\*b\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.u1.b" - -# Test: c_variable-4.48 -# Desc: number of children of struct_declarations.u1.b -mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.u1.b" - -# Test: c_variable-4.49 -# Desc: children of struct_declarations.u1.c -mi_gdb_test "-var-list-children struct_declarations.u1.c" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.c" - -# Test: c_variable-4.50 -# Desc: number of children of struct_declarations.u1.c -mi_gdb_test "-var-info-num-children struct_declarations.u1.c" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.c" - -# Test: c_variable-4.51 -# Desc: children of struct_declarations.u1.d -mi_gdb_test "-var-list-children struct_declarations.u1.d" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.d" - - -# Test: c_variable-4.52 -# Desc: number of children of struct_declarations.u1.d -mi_gdb_test "-var-info-num-children struct_declarations.u1.d" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.d" - - -# Test: c_variable-4.53 -# Desc: children of struct_declarations.s2.u2 -mi_gdb_test "-var-list-children struct_declarations.s2.u2" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1\",exp=\"u1s1\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2.u2.f\",exp=\"f\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.u2.u1s2\",exp=\"u1s2\",numchild=\"2\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of struct_declarations.s2.u2" - -# Test: c_variable-4.54 -# Desc: number of children of struct_declarations.s2.u2 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2" \ - "\\^done,numchild=\"3\"" \ - "get number of children of struct_declarations.s2.u2" - -# Test: c_variable-4.55 -# Desc: children of struct_declarations.s2.g -mi_gdb_test "-var-list-children struct_declarations.s2.g" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.g" - -# Test: c_variable-4.56 -# Desc: number of children of struct_declarations.s2.g -mi_gdb_test "-var-info-num-children struct_declarations.s2.g" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.g" - - -# Test: c_variable-4.57 -# Desc: children of struct_declarations.s2.h -mi_gdb_test "-var-list-children struct_declarations.s2.h" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.h" - -# Test: c_variable-4.58 -# Desc: number of children of struct_declarations.s2.h -mi_gdb_test "-var-info-num-children struct_declarations.s2.h" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.h" - - -# Test: c_variable-4.59 -# Desc: children of struct_declarations.s2.i -mi_gdb_test "-var-list-children struct_declarations.s2.i" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.s2.i.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of struct_declarations.s2.i" - -# Test: c_variable-4.60 -# Desc: number of children of struct_declarations.s2.i -mi_gdb_test "-var-info-num-children struct_declarations.s2.i" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.s2.i" - -# Test: c_variable-4.61 -# Desc: children of struct_declarations.s2.u2.u1s1 -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1.d\",exp=\"d\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e\",exp=\"e\",numchild=\"10\",type=\"char \\\[10\\\]\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.func\",exp=\"func\",numchild=\"0\",type=\"int \\*\\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.foo\",exp=\"foo\",numchild=\"0\",type=\"efoo\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s1" - -# Test: c_variable-4.62 -# Desc: number of children of struct_declarations.s2.u2.u1s1 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.s2.u2.u1s1" - -# Test: c_variable-4.63 -# Desc: children of struct_declarations.s2.u2.f -mi_gdb_test "-var-list-children struct_declarations.s2.u2.f" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.f" - -# Test: c_variable-4.64 -# Desc: number of children of struct_declarations.s2.u2.f -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.f" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.f" - -# Test: c_variable-4.65 -# Desc: children of struct_declarations.s2.u2.u1s2 -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s2.array_ptr\",exp=\"array_ptr\",numchild=\"2\",type=\"char \\\[2\\\]\"\},child=\{name=\"struct_declarations.s2.u2.u1s2.func\",exp=\"func\",numchild=\"0\",type=\"int \\(\\*\\)\\((int, char \\*)?\\)\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s2" - -# Test: c_variable-4.66 -# Desc: number of children of struct_declarations.s2.u2.u1s2 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2" \ - "\\^done,numchild=\"2\"" \ - "get number of children of struct_declarations.s2.u2.u1s2" - -# Test: c_variable-4.67 -# Desc: children of struct_declarations.s2.u2.u1s1.d -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.d" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.d" - -# Test: c_variable-4.68 -# Desc: number of children of struct_declarations.s2.u2.u1s1.d -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.d" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.d" - -# Test: c_variable-4.69 -# Desc: children of struct_declarations.s2.u2.u1s1.e -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.e" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1.e.0\",exp=\"0\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.1\",exp=\"1\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.2\",exp=\"2\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.s2.u2.u1s1.e.3\",exp=\"3\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.4\",exp=\"4\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.5\",exp=\"5\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.6\",exp=\"6\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.7\",exp=\"7\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.8\",exp=\"8\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.9\",exp=\"9\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s1.e" - -# Test: c_variable-4.70 -# Desc: number of children of struct_declarations.s2.u2.u1s1.e -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.e" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.e" - - -# Test: c_variable-4.71 -# Desc: children of struct_declarations.s2.u2.u1s1.func -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.func" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.func" - -# Test: c_variable-4.72 -# Desc: number of children of struct_declarations.s2.u2.u1s1.func -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.func" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.func" - - -# Test: c_variable-4.73 -# Desc: children of struct_declarations.s2.u2.u1s1.foo -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.foo" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.foo" - -# Test: c_variable-4.74 -# Desc: number of children of struct_declarations.s2.u2.u1s1.foo -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.foo" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.foo" - - -# Test: c_variable-4.75 -# Desc: children of struct_declarations.s2.u2.u1s2.array_ptr -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2.array_ptr" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s2.array_ptr.0\",exp=\"0\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.s2.u2.u1s2.array_ptr.1\",exp=\"1\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s2.array_ptr" - -# Test: c_variable-4.76 -# Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.array_ptr" \ - "\\^done,numchild=\"2\"" \ - "get number of children of struct_declarations.s2.u2.u1s2.array_ptr" - -# Test: c_variable-4.77 -# Desc: children of struct_declarations.s2.u2.u1s2.func -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2.func" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s2.func" - -# Test: c_variable-4.78 -# Desc: number of children of struct_declarations.s2.u2.u1s2.func -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.func" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s2.func" - -# Test: c_variable-4.79 -# Desc: children of struct_declarations.int_ptr_ptr.*int_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",exp=\"\\*\\*int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of struct_declarations.int_ptr_ptr.*int_ptr_ptr" -#} {**int_ptr_ptr} - -# Test: c_variable-4.80 -# Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr" - - -# Step to "struct_declarations.integer = 123;" -set line 192 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step to line $line" - -# Test: c_variable-4.81 -# Desc: create local variable "weird" -mi_gdb_test "-var-create weird * weird" \ - "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \ - "create local variable weird" - -# Test: c_variable-4.82 -# Desc: children of weird -mi_gdb_test "-var-list-children weird" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of weird" - -# Test: c_variable-4.83 -# Desc: number of children of weird -mi_gdb_test "-var-info-num-children weird" \ - "\\^done,numchild=\"11\"" \ - "get number of children of weird" - - -# Test: c_variable-4.84 -# Desc: children of weird->long_array -mi_gdb_test "-var-list-children weird.long_array" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of weird.long_array" -#gdbtk_test c_variable-4.84 {children of weird->long_array} { -# get_children weird.long_array -#} {0 1 2 3 4 5 6 7 8 9} - -# Test: c_variable-4.85 -# Desc: number of children of weird.long_array -mi_gdb_test "-var-info-num-children weird.long_array" \ - "\\^done,numchild=\"10\"" \ - "get number of children of weird.long_array" - -# Test: c_variable-4.86 -# Desc: children of weird.int_ptr_ptr -mi_gdb_test "-var-list-children weird.int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird.int_ptr_ptr.\\*int_ptr_ptr\",exp=\"\\*int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of weird.int_ptr_ptr" -#gdbtk_test c_variable-4.86 {children of weird->int_ptr_ptr} { -# get_children weird.int_ptr_ptr -#} {*int_ptr_ptr} - -# Test: c_variable-4.87 -# Desc: number of children of weird.int_ptr_ptr -mi_gdb_test "-var-info-num-children weird.int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird.int_ptr_ptr" - -# Test: c_variable-4.88 -# Desc: children of *weird->int_ptr_ptr -mi_gdb_test "-var-list-children weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",exp=\"\\*\\*int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of weird.int_ptr_ptr.*int_ptr_ptr" -#gdbtk_test c_variable-4.88 {children of *weird->int_ptr_ptr} { -# get_children weird.int_ptr_ptr.*int_ptr_ptr -#} {**int_ptr_ptr} - -# Test: c_variable-4.89 -# Desc: number of children *weird->int_ptr_ptr -mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird.int_ptr_ptr.*int_ptr_ptr" - -# Test: c_variable-4.90 -# Desc: create weird->int_ptr_ptr -mi_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \ - "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"" \ - "create local variable weird->int_ptr_ptr" - -# Test: c_variable-4.91 -# Desc: children of weird->int_ptr_ptr -mi_gdb_test "-var-list-children weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",exp=\"\\*weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of weird->int_ptr_ptr" - - -# Test: c_variable-4.92 -# Desc: number of children of (weird->int_ptr_ptr) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird->int_ptr_ptr" - -# Test: c_variable-4.93 -# Desc: children of *(weird->int_ptr_ptr) -mi_gdb_test "-var-list-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",exp=\"\\*\\*weird->int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr" - -# Test: c_variable-4.94 -# Desc: number of children of *(weird->int_ptr_ptr) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr" - -# Test: c_variable-4.95 -# Desc: children of *(*(weird->int_ptr_ptr)) -mi_gdb_test "-var-list-children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" - -# Test: c_variable-4.96 -# Desc: number of children of *(*(weird->int_ptr_ptr)) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" - -# Test: c_variable-4.97 -# Desc: is weird editable -mi_gdb_test "-var-show-attributes weird" \ - "\\^done,attr=\"editable\"" \ - "is weird editable" - -# Test: c_variable-4.98 -# Desc: is weird->int_ptr_ptr editable -mi_gdb_test "-var-show-attributes weird->int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird->int_ptr_ptr editable" - -# Test: c_variable-4.99 -# Desc: is *(weird->int_ptr_ptr) editable -mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird.int_ptr_ptr.*int_ptr_ptr editable" - -# Test: c_variable-4.100 -# Desc: is *(*(weird->int_ptr_ptr)) editable -mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable" - -# Test: c_variable-4.101 -# Desc: is weird->u1 editable -mi_gdb_test "-var-show-attributes weird.u1" \ - "\\^done,attr=\"noneditable\"" \ - "is weird.u1 editable" - -# Test: c_variable-4.102 -# Desc: is weird->s2 editable -mi_gdb_test "-var-show-attributes weird.s2" \ - "\\^done,attr=\"noneditable\"" \ - "is weird.s2 editable" - -# Test: c_variable-4.103 -# Desc: is struct_declarations.u1.a editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.a" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.a editable" - -# Test: c_variable-4.104 -# Desc: is struct_declarations.u1.b editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.b" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.b editable" - -# Test: c_variable-4.105 -# Desc: is struct_declarations.u1.c editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.c" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.c editable" - -# Test: c_variable-4.106 -# Desc: is struct_declarations.long_array editable -mi_gdb_test "-var-show-attributes struct_declarations.long_array" \ - "\\^done,attr=\"noneditable\"" \ - "is struct_declarations.long_array editable" - -# Test: c_variable-4.107 -# Desc: is struct_declarations.long_array[0] editable -mi_gdb_test "-var-show-attributes struct_declarations.long_array.0" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.long_array.0 editable" - -# Test: c_variable-4.108 -# Desc: is struct_declarations editable -mi_gdb_test "-var-show-attributes struct_declarations" \ - "\\^done,attr=\"noneditable\"" \ - "is struct_declarations editable" - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"24\"" \ - "delete var weird" - -##### ##### -# # -# children and update tests # -# # -##### ##### - -# Test: c_variable-5.1 -# Desc: check that nothing changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars. None changed" - -# Step over "struct_declarations.integer = 123;" -set line 193 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.2 -# Desc: check that integer changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.integer\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.integer" - -# Step over: -# weird->char_ptr = "hello"; -# bar = 2121; -# foo = &bar; -set line 196 -mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" - -# Test: c_variable-5.3 -# Desc: check that char_ptr changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.char_ptr" - -# Step over "struct_declarations.int_ptr_ptr = &foo;" -set line 197 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.4 -# Desc: check that int_ptr_ptr and children changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars int_ptr_ptr and children changed" - -# Step over "weird->long_array[0] = 1234;" -set line 198 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.5 -# Desc: check that long_array[0] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.0\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.0 changed" - -# Step over "struct_declarations.long_array[1] = 2345;" -set line 199 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.6 -# Desc: check that long_array[1] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.1\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.1 changed" - -# Step over "weird->long_array[2] = 3456;" -set line 200 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.7 -# Desc: check that long_array[2] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.2\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.2 changed" - -# Step over: -# struct_declarations.long_array[3] = 4567; -# weird->long_array[4] = 5678; -# struct_declarations.long_array[5] = 6789; -# weird->long_array[6] = 7890; -# struct_declarations.long_array[7] = 8901; -# weird->long_array[8] = 9012; -# struct_declarations.long_array[9] = 1234; -set line 208 -mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" - -# Test: c_variable-5.8 -# Desc: check that long_array[3-9] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.3-9 changed" - - -# Step over "weird->func_ptr = nothing;" -set line 211 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.9 -# Desc: check that func_ptr changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.func_ptr changed" - -# Delete all variables -mi_gdb_test "-var-delete struct_declarations" \ - "\\^done,ndeleted=\"65\"" \ - "delete var struct_declarations" - -mi_gdb_test "-var-delete weird->int_ptr_ptr" \ - "\\^done,ndeleted=\"3\"" \ - "delete var weird->int_ptr_ptr" - -# Step over all lines: -# ... -# psnp = &snp0; -set line 254 -mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" - -# Test: c_variable-5.10 -# Desc: create psnp->char_ptr -mi_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \ - "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"" \ - "create local variable psnp->char_ptr" - -# Test: c_variable-5.11 -# Desc: children of psnp->char_ptr -mi_gdb_test "-var-list-children psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr\",exp=\"\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\"\}\}" \ - "get children of psnp->char_ptr" - -# Test: c_variable-5.12 -# Desc: number of children of psnp->char_ptr -mi_gdb_test "-var-info-num-children psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr" - -# Test: c_variable-5.13 -# Desc: children of *(psnp->char_ptr) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",exp=\"\\*\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr" - -# Test: c_variable-5.14 -# Desc: number of children of *(psnp->char_ptr) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr" - -# Test: c_variable-5.15 -# Desc: children of *(*(psnp->char_ptr)) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.15B -# Desc: children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*\\*psnp->char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.16 -# Desc: number of children of *(*(psnp->char_ptr)) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.17 -# Desc: children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*\\*psnp->char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" - -# Test: c_variable-5.18 -# Desc: number of children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" - -# Test: c_variable-5.17B -# Desc: children of *(*(*(*(psnp->char_ptr)))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" - -# Test: c_variable-5.18B -# Desc: number of children of *(*(*(*(psnp->char_ptr)))) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" - - -# Test: c_variable-5.19 -# Desc: create psnp->long_ptr -mi_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \ - "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"" \ - "create local variable psnp->long_ptr" - -# Test: c_variable-5.20 -# Desc: children of psnp->long_ptr -mi_gdb_test "-var-list-children psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr\",exp=\"\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\"\}\}" \ - "get children of psnp->long_ptr" - -# Test: c_variable-5.21 -# Desc: number of children of psnp->long_ptr -mi_gdb_test "-var-info-num-children psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr" - -# Test: c_variable-5.22 -# Desc: children of *(psnp->long_ptr) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",exp=\"\\*\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr" - - -# Test: c_variable-5.23 -# Desc: number of children of *(psnp->long_ptr) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr" - -# Test: c_variable-5.24 -# Desc: children of *(*(psnp->long_ptr)) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",exp=\"\\*\\*\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" - -# Test: c_variable-5.25 -# Desc: number of children of *(*(psnp->long_ptr)) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" - -# Test: c_variable-5.26 -# Desc: children of *(*(*(psnp->long_ptr))) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",exp=\"\\*\\*\\*\\*psnp->long_ptr\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" - -# Test: c_variable-5.27 -# Desc: number of children of *(*(*(psnp->long_ptr))) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" - -# Test: c_variable-5.28 -# Desc: children of *(*(*(*(psnp->long_ptr)))) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" - -# Test: c_variable-5.29 -# Desc: number of children of *(*(*(*(psnp->long_ptr)))) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" - -# Test: c_variable-5.30 -# Desc: create psnp->ptrs -mi_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \ - "\\^done,name=\"psnp->ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \ - "create local variable psnp->ptrs" - -# Test: c_variable-5.31 -# Desc: children of psnp->ptrs -mi_gdb_test "-var-list-children psnp->ptrs" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"psnp->ptrs.0\",exp=\"0\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.1\",exp=\"1\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.2\",exp=\"2\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs" - -# Test: c_variable-5.32 -# Desc: number of children of psnp->ptrs -mi_gdb_test "-var-info-num-children psnp->ptrs" \ - "\\^done,numchild=\"3\"" \ - "get number of children of psnp->ptrs" - -# Test: c_variable-5.33 -# Desc: children of psnp->ptrs[0] -mi_gdb_test "-var-list-children psnp->ptrs.0" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0" - -# Test: c_variable-5.34 -# Desc: number of children of psnp->ptrs[0] -mi_gdb_test "-var-info-num-children psnp->ptrs.0" \ - "\\^done,numchild=\"4\"" \ - "get number of children of psnp->ptrs.0" - -# Test: c_variable-5.35 -# Desc: children of psnp->ptrs[0]->next -mi_gdb_test "-var-list-children psnp->ptrs.0.next" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next" - -#} {char_ptr long_ptr ptrs next} - -# Test: c_variable-5.36 -# Desc: number of children of psnp->ptrs[0]->next -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \ - "\\^done,numchild=\"4\"" \ - "get number of children of psnp->ptrs.0.next" - - -# Test: c_variable-5.37 -# Desc: children of psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",exp=\"\\*char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr" - -#gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} { -# get_children psnp->ptrs.0.next.char_ptr -#} {*char_ptr} - -# Test: c_variable-5.38 -# Desc: number of children of psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr" - -# Test: c_variable-5.39 -# Desc: children of *psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",exp=\"\\*\\*char_ptr\",numchild=\"1\",type=\"char \\*\\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr" - -# Test: c_variable-5.40 -# Desc: number of children of *psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr" - -# Test: c_variable-5.41 -# Desc: children of **psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.41B -# Desc: children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.42 -# Desc: number of children of **psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.43 -# Desc: children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.44 -# Desc: number of children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.43B -# Desc: children of ****psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.44B -# Desc: number of children of ****psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.45 -# Desc: children of psnp->ptrs[0]->next->next -mi_gdb_test "-var-list-children psnp->ptrs.0.next.next" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.next.next.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.next.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next.next.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.next" - -# Test: c_variable-5.46 -# Desc: children of psnp->ptrs[0]->next->next->ptrs -mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"psnp->ptrs.0.next.next.ptrs.0\",exp=\"0\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs.1\",exp=\"1\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs.2\",exp=\"2\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.next.ptrs" - -# Step over "snp0.char_ptr = &b3;" -set line 255 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.47 -# Desc: check that psnp->char_ptr (and [0].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->char_ptr (and 0.char_ptr) changed" - -# Step over "snp1.char_ptr = &c3;" -set line 256 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.48 -# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->char_ptr (and 1.char_ptr) changed" - - -# Step over "snp2.char_ptr = &a3;" -set line 257 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.49 -# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.next.char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed" - - -# Step over "snp0.long_ptr = &y3;" -set line 258 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.50 -# Desc: check that psnp->long_ptr (and [0].long_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->long_ptr (and 0.long_ptr) changed" - - -# Step over "snp1.long_ptr = &x3;" -set line 259 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.51 -# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed -# Why does this have a FIXME? -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "FIXME\\^done,changelist=\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->long_ptr (and 1.long_ptr) changed" -clear_xfail *-*-* - -# This command produces this error message: -# &"warning: varobj_list: assertion failed - mycount <> 0\n" -# - -# Step over "snp2.long_ptr = &z3;" -set line 260 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.52 -# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed" - - - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp b/gdb/testsuite/gdb.mi/mi1-var-cmd.exp deleted file mode 100644 index c6a88b6..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp +++ /dev/null @@ -1,560 +0,0 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - - -##### ##### -# # -# Variable Creation tests # -# # -##### ##### - -# Test: c_variable-1.1 -# Desc: Create global variable - -mi_gdb_test "111-var-create global_simple * global_simple" \ - "111\\^done,name=\"global_simple\",numchild=\"6\",type=\"simpleton\"" \ - "create global variable" - -# Test: c_variable-1.2 -# Desc: Create non-existent variable - -mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create non-existent variable" - -# Test: c_variable-1.3 -# Desc: Create out of scope variable - -mi_gdb_test "113-var-create argc * argc" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create out of scope variable" - -mi_runto do_locals_tests - -# Test: c_variable-1.4 -# Desc: create local variables - -mi_gdb_test "-var-create linteger * linteger" \ - "\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \ - "create local variable linteger" - -mi_gdb_test "-var-create lpinteger * lpinteger" \ - "\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \ - "create local variable lpinteger" - -mi_gdb_test "-var-create lcharacter * lcharacter" \ - "\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \ - "create local variablelcharacter " - -mi_gdb_test "-var-create lpcharacter * lpcharacter" \ - "\\^done,name=\"lpcharacter\",numchild=\"1\",type=\"char \\*\"" \ - "create local variable lpcharacter" - -mi_gdb_test "-var-create llong * llong" \ - "\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \ - "create local variable llong" - -mi_gdb_test "-var-create lplong * lplong" \ - "\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \ - "create local variable lplong" - -mi_gdb_test "-var-create lfloat * lfloat" \ - "\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \ - "create local variable lfloat" - -mi_gdb_test "-var-create lpfloat * lpfloat" \ - "\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \ - "create local variable lpfloat" - -mi_gdb_test "-var-create ldouble * ldouble" \ - "\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \ - "create local variable ldouble" - -mi_gdb_test "-var-create lpdouble * lpdouble" \ - "\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \ - "create local variable lpdouble" - -mi_gdb_test "-var-create lsimple * lsimple" \ - "\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \ - "create local variable lsimple" - -mi_gdb_test "-var-create lpsimple * lpsimple" \ - "\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \ - "create local variable lpsimple" - -mi_gdb_test "-var-create func * func" \ - "\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"" \ - "create local variable func" - -# Test: c_variable-1.5 -# Desc: create lsimple.character -mi_gdb_test "-var-create lsimple.character * lsimple.character" \ - "\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \ - "create lsimple.character" - -# Test: c_variable-1.6 -# Desc: create lpsimple->integer -mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \ - "\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \ - "create lsimple->integer" - -# Test: c_variable-1.7 -# Desc: ceate lsimple.integer -mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \ - "\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \ - "create lsimple->integer" - - -# Test: c_variable-1.9 -# Desc: create type name -# Type names (like int, long, etc..) are all proper expressions to gdb. -# make sure variable code does not allow users to create variables, though. -mi_gdb_test "-var-create int * int" \ - "&\"Attempt to use a type name as an expression.mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create int" - - -##### ##### -# # -# Value changed tests # -# # -##### ##### - -# Test: c_variable-2.1 -# Desc: check whether values changed at do_block_tests -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars" - -# Step over "linteger = 1234;" -mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test" - -# Test: c_variable-2.2 -# Desc: check whether only linteger changed values -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: linteger changed" - -# Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)" - -# Test: c_variable-2.3 -# Desc: check whether only lpinteger changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lpinteger changed" - -# Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)" - -# Test: c_variable-2.4 -# Desc: check whether only lcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lcharacter changed" - -# Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)" - -# Test: c_variable-2.5 -# Desc: check whether only lpcharacter changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lpcharacter changed" - - -# Step over: -# llong = 2121L; -# lplong = &llong; -# lfloat = 2.1; -# lpfloat = &lfloat; -# ldouble = 2.718281828459045; -# lpdouble = &ldouble; -# lsimple.integer = 1234; -# lsimple.unsigned_integer = 255; -# lsimple.character = 'a'; - -mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "119" "" "step at do_locals_tests (5)" - -# Test: c_variable-2.6 -# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, -# lsimple.unsigned_character lsimple.integer lsimple.character changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\",name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\",name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",name=\"lplong\",in_scope=\"true\",type_changed=\"false\",name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: many changed" - -# Step over: -# lsimple.signed_character = 21; -# lsimple.char_ptr = &lcharacter; -# lpsimple = &lsimple; -# func = nothing; - -mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "125" "" "step at do_locals_tests (6)" - -# Test: c_variable-2.7 -# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"func\",in_scope=\"true\",type_changed=\"false\",name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: func and lpsimple changed" - -# Step over -# linteger = 4321; -# lcharacter = 'b'; -# llong = 1212L; -# lfloat = 1.2; -# ldouble = 5.498548281828172; -# lsimple.integer = 255; -# lsimple.unsigned_integer = 4321; -# lsimple.character = 'b'; - -mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" "133" "" "step at do_locals_tests (7)" - -# Test: c_variable-2.8 -# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, -# lpsimple.integer lsimple.character changed -# Note: this test also checks that lpsimple->integer and lsimple.integer have -# changed (they are the same) -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",name=\"llong\",in_scope=\"true\",type_changed=\"false\",name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: func and lpsimple changed" - - -### -# -# Test assignment to variables. More tests on assignment are in other files. -# -### -mi_gdb_test "-var-assign global_simple 0" \ - "&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \ - "assign to global_simple" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: linteger changed after assign" - -mi_gdb_test "-var-assign linteger 3333" \ - "\\^done,value=\"3333\"" \ - "assign to linteger again, same value" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars: linteger not changed after same assign" - -mi_gdb_test "-var-evaluate-expression linteger" \ - "\\^done,value=\"3333\"" \ - "eval linteger" - -mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: lpinteger changed after assign" - -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars: no changes for second update" - -mi_gdb_test "-var-evaluate-expression lpinteger" \ - "\\^done,value=\"$hex\"" \ - "eval lpinteger" - -# reset the values to the original ones so that the rest of the file doesn't suffer. - -mi_gdb_test "-var-assign linteger 4321" \ - "\\^done,value=\"4321\"" \ - "assign to linteger" - -mi_gdb_test "-var-assign lpinteger &linteger" \ - "\\^done,value=\"$hex\"" \ - "assign to lpinteger" - -mi_gdb_test "-var-assign lcharacter 'z'" \ - "\\^done,value=\"122 'z'\"" \ - "assign to lcharacter" - -mi_gdb_test "-var-evaluate-expression lcharacter" \ - "\\^done,value=\"122 'z'\"" \ - "eval lcharacter" - -mi_gdb_test "-var-assign llong 1313L" \ - "\\^done,value=\"1313\"" \ - "assign to llong" -mi_gdb_test "-var-evaluate-expression llong" \ - "\\^done,value=\"1313\"" \ - "eval llong" -mi_gdb_test "-var-assign llong 1212L" \ - "\\^done,value=\"1212\"" \ - "assign to llong" - -mi_gdb_test "-var-assign lplong &llong+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" -mi_gdb_test "-var-evaluate-expression lplong" \ - "\\^done,value=\"$hex\"" \ - "eval lplong" -mi_gdb_test "-var-assign lplong &llong" \ - "\\^done,value=\"$hex\"" \ - "assign to lplong" - -mi_gdb_test "-var-assign lfloat 3.4567" \ - "\\^done,value=\"3.45.*\"" \ - "assign to lfloat" -mi_gdb_test "-var-evaluate-expression lfloat" \ - "\\^done,value=\"3.45.*\"" \ - "eval lfloat" -mi_gdb_test "-var-assign lfloat 1.2345" \ - "\\^done,value=\"1.23.*\"" \ - "assign to lfloat" - -mi_gdb_test "-var-assign lpfloat &lfloat+4" \ - "\\^done,value=\"$hex\"" \ - "assign to lpfloat" - -mi_gdb_test "-var-assign ldouble 5.333318284590435" \ - "\\^done,value=\"5.333318284590435\"" \ - "assign to ldouble" - -mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex <do_block_tests>\"" \ - "assign to func" - -mi_gdb_test "-var-assign lsimple.character 'd'" \ - "\\^done,value=\"100 'd'\"" \ - "assign to lsimple.character" - -mi_gdb_test "-var-assign lsimple->integer 222" \ - "\\^done,value=\"222\"" \ - "assign to lsimple->integer" - -mi_gdb_test "-var-assign lsimple.integer 333" \ - "\\^done,value=\"333\"" \ - "assign to lsimple.integer" - -###### -# End of assign tests -##### - -mi_gdb_test "-break-insert subroutine1" \ - "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \ - "break-insert subroutine1" -mi_continue_to "2" "subroutine1" \ - "\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \ - "var-cmd.c" "146" "continue to subroutine1" - -# Test: c_variable-2.10 -# Desc: create variable for locals i,l in subroutine1 -mi_gdb_test "-var-create i * i" \ - "\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \ - "create i" - -mi_gdb_test "-var-create l * l" \ - "\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \ - "create l" - -# Test: c_variable-2.11 -# Desc: create do_locals_tests local in subroutine1 -mi_gdb_test "-var-create linteger * linteger" \ - "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ - "create linteger" - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "147" "step at subroutine1" - -# Test: c_variable-2.12 -# Desc: change global_simple.integer -# Note: This also tests whether we are reporting changes in structs properly. -# gdb normally would say that global_simple has changed, but we -# special case that, since it is not what a human expects to -# see. - -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \ - "update all vars: changed FIXME" -clear_xfail *-*-* - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "148" "step at subroutine1 (2)" - -# Test: c_variable-2.13 -# Desc: change subroutine1 local i -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: i changed" - -mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" "149" "step at subroutine1 (3)" - -# Test: c_variable-2.14 -# Desc: change do_locals_tests local llong -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars: llong changed" - -mi_next_to "do_locals_tests" "" "var-cmd.c" "136" "next out of subroutine1" - -# Test: c_variable-2.15 -# Desc: check for out of scope subroutine1 locals -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"l\",in_scope=\"false\",name=\"i\",in_scope=\"false\"\}" \ - "update all vars: all now out of scope" - -# Done with locals/globals tests. Erase all variables -#delete_all_variables -mi_gdb_test "-var-delete global_simple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var" - -mi_gdb_test "-var-delete linteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var linteger" - -mi_gdb_test "-var-delete lpinteger" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpinteger" - -mi_gdb_test "-var-delete lcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lcharacter" - -mi_gdb_test "-var-delete lpcharacter" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpcharacter" - -mi_gdb_test "-var-delete llong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var llong" - -mi_gdb_test "-var-delete lplong" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lplong" - -mi_gdb_test "-var-delete lfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lfloat" - -mi_gdb_test "-var-delete lpfloat" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpfloat" - -mi_gdb_test "-var-delete ldouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var ldouble" - -mi_gdb_test "-var-delete lpdouble" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpdouble" - -mi_gdb_test "-var-delete lsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple" - -mi_gdb_test "-var-delete lpsimple" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lpsimple" - -mi_gdb_test "-var-delete func" \ - "\\^done,ndeleted=\"1\"" \ - "delete var func" - -mi_gdb_test "-var-delete lsimple.character" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.character" - -mi_gdb_test "-var-delete lsimple->integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple->integer" - -mi_gdb_test "-var-delete lsimple.integer" \ - "\\^done,ndeleted=\"1\"" \ - "delete var lsimple.integer" - -mi_gdb_test "-var-delete i" \ - "\\^done,ndeleted=\"1\"" \ - "delete var i" - -mi_gdb_test "-var-delete l" \ - "\\^done,ndeleted=\"1\"" \ - "delete var l" - -# Test whether we can follow the name of a variable through multiple -# stack frames. -mi_gdb_test "-break-insert do_special_tests" \ - {\^done,bkpt=.*} \ - "set breakpoint at do_special_tests" - -mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests} - -mi_gdb_test "-var-create selected_a @ a" \ - {\^done,name="selected_a",numchild="0",type="int"} \ - "create selected_a" - -mi_gdb_test "-break-insert incr_a" \ - {\^done,bkpt=.*} \ - "set breakpoint at incr_a" - -mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a} - -mi_gdb_test "-var-update selected_a" \ - {\^done,changelist=\{name="selected_a",in_scope="true",new_type="char",new_num_children="0"\}} \ - "update selected_a in incr_a" - -mi_next "step a line in incr_a" -mi_next "return from incr_a to do_special_tests" - -mi_gdb_test "-var-update selected_a" \ - {\^done,changelist=\{name="selected_a",in_scope="true",new_type="int",new_num_children="0"\}} \ - "update selected_a in do_special_tests" - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-var-display.exp b/gdb/testsuite/gdb.mi/mi1-var-display.exp deleted file mode 100644 index 593a1c0..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-display.exp +++ /dev/null @@ -1,627 +0,0 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. -# -# This Program Is Free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can create, update, delete variables. -# - - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "var-cmd" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -mi_gdb_test "200-break-insert 260" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"260\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_children_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"} - timeout {fail "run to do_children_tests (timeout 2)"} -} - -##### ##### -# # -# Display tests # -# # -##### ##### - -# Test: c_variable-6.1 -# Desc: create variable bar -mi_gdb_test "-var-create bar * bar" \ - "\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \ - "create local variable bar" - -# Test: c_variable-6.2 -# Desc: type of variable bar -mi_gdb_test "-var-info-type bar" \ - "\\^done,type=\"int\"" \ - "info type variable bar" - -# Test: c_variable-6.3 -# Desc: format of variable bar -mi_gdb_test "-var-show-format bar" \ - "\\^done,format=\"natural\"" \ - "show format variable bar" - -# Test: c_variable-6.4 -# Desc: value of variable bar -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"2121\"" \ - "eval variable bar" - -# Test: c_variable-6.5 -# Desc: change format of bar to hex -mi_gdb_test "-var-set-format bar hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable bar" - -# Test: c_variable-6.6 -# Desc: value of bar with new format -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"0x849\"" \ - "eval variable bar with new format" - -# Test: c_variable-6.7 -# Desc: change value of bar -mi_gdb_test "-var-assign bar 3" \ - "\\^done,value=\"0x3\"" \ - "assing to variable bar" - -mi_gdb_test "-var-set-format bar decimal" \ - "\\^done,format=\"decimal\"" \ - "set format variable bar" - -mi_gdb_test "-var-evaluate-expression bar" \ - "\\^done,value=\"3\"" \ - "eval variable bar with new value" - -mi_gdb_test "-var-delete bar" \ - "\\^done,ndeleted=\"1\"" \ - "delete var bar" - -# Test: c_variable-6.11 -# Desc: create variable foo -mi_gdb_test "-var-create foo * foo" \ - "\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \ - "create local variable foo" - -# Test: c_variable-6.12 -# Desc: type of variable foo -mi_gdb_test "-var-info-type foo" \ - "\\^done,type=\"int \\*\"" \ - "info type variable foo" - -# Test: c_variable-6.13 -# Desc: format of variable foo -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"natural\"" \ - "show format variable foo" - -# Test: c_variable-6.14 -# Desc: value of variable foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"$hex\"" \ - "eval variable foo" - -# Test: c_variable-6.15 -# Desc: change format of var to octal -mi_gdb_test "-var-set-format foo octal" \ - "\\^done,format=\"octal\"" \ - "set format variable foo" - -mi_gdb_test "-var-show-format foo" \ - "\\^done,format=\"octal\"" \ - "show format variable foo" - -# Test: c_variable-6.16 -# Desc: value of foo with new format -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"\[0-7\]+\"" \ - "eval variable foo" - -# Test: c_variable-6.17 -# Desc: change value of foo -mi_gdb_test "-var-assign foo 3" \ - "\\^done,value=\"03\"" \ - "assing to variable foo" - -mi_gdb_test "-var-set-format foo decimal" \ - "\\^done,format=\"decimal\"" \ - "set format variable foo" - -# Test: c_variable-6.18 -# Desc: check new value of foo -mi_gdb_test "-var-evaluate-expression foo" \ - "\\^done,value=\"3\"" \ - "eval variable foo" - -mi_gdb_test "-var-delete foo" \ - "\\^done,ndeleted=\"1\"" \ - "delete var foo" - -# Test: c_variable-6.21 -# Desc: create variable weird and children -mi_gdb_test "-var-create weird * weird" \ - "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \ - "create local variable weird" - -mi_gdb_test "-var-list-children weird" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children local variable weird" - - -# Test: c_variable-6.23 -# Desc: change format of weird.func_ptr and weird.func_ptr_ptr -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-show-format weird.func_ptr_ptr" \ - "\\^done,format=\"hexadecimal\"" \ - "show format variable weird.func_ptr_ptr" - -# Test: c_variable-6.24 -# Desc: format of weird and children -mi_gdb_test "-var-set-format weird natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird" - -mi_gdb_test "-var-set-format weird.integer natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.integer" - -mi_gdb_test "-var-set-format weird.character natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.character" - -mi_gdb_test "-var-set-format weird.char_ptr natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.char_ptr" - -mi_gdb_test "-var-set-format weird.long_int natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.long_int" - -mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.int_ptr_ptr" - -mi_gdb_test "-var-set-format weird.long_array natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.long_array" - -mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr" - -mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ - "\\^done,format=\"hexadecimal\"" \ - "set format variable weird.func_ptr_struct" - -mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.func_ptr_ptr" - -mi_gdb_test "-var-set-format weird.u1 natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.u1" - -mi_gdb_test "-var-set-format weird.s2 natural" \ - "\\^done,format=\"natural\"" \ - "set format variable weird.s2" - -# Test: c_variable-6.25 -# Desc: value of weird and children -#gdbtk_test c_variable-6.25 {value of weird and children} { -# set values {} -# foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { -# lappend values [value $v $f] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.26 -# Desc: change format of weird and children to octal -#gdbtk_test c_variable-6.26 {change format of weird and children to octal} { -# set formats {} -# foreach v [lsort [array names var]] { -# $var($v) format octal -# lappend formats [$var($v) format] -# } - -# set formats -#} {octal octal octal octal octal octal octal octal octal octal octal octal} - -# Test: c_variable-6.27 -# Desc: value of weird and children with new format -#gdbtk_test c_variable-6.27 {value of foo with new format} { -# set values {} -# foreach v [lsort [array names var]] { -# lappend values [value $v o] -# } - -# set values -#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} - -# Test: c_variable-6.30 -# Desc: create more children of weird -#gdbtk_test c_variable-6.30 {create more children of weird} { -# foreach v [array names var] { -# get_children $v -# } - -# # Do it twice to get more children -# foreach v [array names var] { -# get_children $v -# } - -# lsort [array names var] -#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d} - -# Test: c_variable-6.31 -# Desc: check that all children of weird change -# Ok, obviously things like weird.s2 and weird.u1 will not change! -#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} { -# $var(weird) value 0x2121 -# check_update -#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}} - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"12\"" \ - "delete var weird" - - -##### ##### -# # -# Special Display Tests # -# # -##### ##### - -# Stop in "do_special_tests" -mi_gdb_test "200-break-insert do_special_tests" \ - "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"282\",times=\"0\"\}" \ - "break-insert operation" - -send_gdb "-exec-continue\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" { - pass "continue to do_special_tests" - } - timeout { - fail "continue to do_special_tests (timeout)" - } -} - -# Test: c_variable-7.10 -# Desc: create union u -mi_gdb_test "-var-create u * u" \ - "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \ - "create local variable u" - -# Test: c_variable-7.11 -# Desc: value of u -mi_gdb_test "-var-evaluate-expression u" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable u" - -# Test: c_variable-7.12 -# Desc: type of u -mi_gdb_test "-var-info-type u" \ - "\\^done,type=\"union named_union\"" \ - "info type variable u" - -# Test: c_variable-7.13 -# Desc: is u editable -mi_gdb_test "-var-show-attributes u" \ - "\\^done,attr=\"noneditable\"" \ - "is u editable" - -# Test: c_variable-7.14 -# Desc: number of children of u -mi_gdb_test "-var-info-num-children u" \ - "\\^done,numchild=\"2\"" \ - "get number of children of u" - -# Test: c_variable-7.15 -# Desc: children of u -mi_gdb_test "-var-list-children u" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"u.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"u.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of u" - -# Test: c_variable-7.20 -# Desc: create anonu -mi_gdb_test "-var-create anonu * anonu" \ - "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \ - "create local variable anonu" - -# Test: c_variable-7.21 -# Desc: value of anonu -mi_gdb_test "-var-evaluate-expression anonu" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anonu" - -# Test: c_variable-7.22 -# Desc: type of anonu -mi_gdb_test "-var-info-type anonu" \ - "\\^done,type=\"union \{\\.\\.\\.\}\"" \ - "info type variable anonu" - -# Test: c_variable-7.23 -# Desc: is anonu editable -mi_gdb_test "-var-show-attributes anonu" \ - "\\^done,attr=\"noneditable\"" \ - "is anonu editable" - -# Test: c_variable-7.24 -# Desc: number of children of anonu -mi_gdb_test "-var-info-num-children anonu" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anonu" - -# Test: c_variable-7.25 -# Desc: children of anonu -mi_gdb_test "-var-list-children anonu" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"anonu.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anonu.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anonu.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of anonu" - -# Test: c_variable-7.30 -# Desc: create struct s -mi_gdb_test "-var-create s * s" \ - "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \ - "create local variable s" - - -# Test: c_variable-7.31 -# Desc: value of s -mi_gdb_test "-var-evaluate-expression s" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable s" - -# Test: c_variable-7.32 -# Desc: type of s -mi_gdb_test "-var-info-type s" \ - "\\^done,type=\"struct _simple_struct\"" \ - "info type variable s" - -# Test: c_variable-7.33 -# Desc: is s editable -mi_gdb_test "-var-show-attributes s" \ - "\\^done,attr=\"noneditable\"" \ - "is s editable" - -# Test: c_variable-7.34 -# Desc: number of children of s -mi_gdb_test "-var-info-num-children s" \ - "\\^done,numchild=\"6\"" \ - "get number of children of s" - -# Test: c_variable-7.35 -# Desc: children of s -mi_gdb_test "-var-list-children s" \ - "\\^done,numchild=\"6\",children=\{child=\{name=\"s.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"s.unsigned_integer\",exp=\"unsigned_integer\",numchild=\"0\",type=\"unsigned int\"\},child=\{name=\"s.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"s.signed_character\",exp=\"signed_character\",numchild=\"0\",type=\"signed char\"\},child=\{name=\"s.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"s.array_of_10\",exp=\"array_of_10\",numchild=\"10\",type=\"int \\\[10\\\]\"\}\}" \ - "get children of s" -#} {integer unsigned_integer character signed_character char_ptr array_of_10} - -# Test: c_variable-7.40 -# Desc: create anons -mi_gdb_test "-var-create anons * anons" \ - "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \ - "create local variable anons" - -# Test: c_variable-7.41 -# Desc: value of anons -mi_gdb_test "-var-evaluate-expression anons" \ - "\\^done,value=\"\{\\.\\.\\.\}\"" \ - "eval variable anons" - -# Test: c_variable-7.42 -# Desc: type of anons -mi_gdb_test "-var-info-type anons" \ - "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ - "info type variable anons" - -# Test: c_variable-7.43 -# Desc: is anons editable -mi_gdb_test "-var-show-attributes anons" \ - "\\^done,attr=\"noneditable\"" \ - "is anons editable" - -# Test: c_variable-7.44 -# Desc: number of children of anons -mi_gdb_test "-var-info-num-children anons" \ - "\\^done,numchild=\"3\"" \ - "get number of children of anons" - -# Test: c_variable-7.45 -# Desc: children of anons -mi_gdb_test "-var-list-children anons" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"anons.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anons.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anons.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of anons" - - -# Test: c_variable-7.50 -# Desc: create enum e -mi_gdb_test "-var-create e * e" \ - "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \ - "create local variable e" - -setup_xfail "*-*-*" -# Test: c_variable-7.51 -# Desc: value of e -mi_gdb_test "-var-evaluate-expression e" \ - "\\^done,value=\"FIXME\"" \ - "eval variable e" -clear_xfail "*-*-*" - -# Test: c_variable-7.52 -# Desc: type of e -mi_gdb_test "-var-info-type e" \ - "\\^done,type=\"enum foo\"" \ - "info type variable e" - -# Test: c_variable-7.53 -# Desc: is e editable -mi_gdb_test "-var-show-attributes e" \ - "\\^done,attr=\"editable\"" \ - "is e editable" - -# Test: c_variable-7.54 -# Desc: number of children of e -mi_gdb_test "-var-info-num-children e" \ - "\\^done,numchild=\"0\"" \ - "get number of children of e" - -# Test: c_variable-7.55 -# Desc: children of e -mi_gdb_test "-var-list-children e" \ - "\\^done,numchild=\"0\"" \ - "get children of e" - -# Test: c_variable-7.60 -# Desc: create anone -mi_gdb_test "-var-create anone * anone" \ - "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \ - "create local variable anone" - -setup_xfail "*-*-*" -# Test: c_variable-7.61 -# Desc: value of anone -mi_gdb_test "-var-evaluate-expression anone" \ - "\\^done,value=\"A\"" \ - "eval variable anone" -clear_xfail "*-*-*" - - -# Test: c_variable-7.70 -# Desc: create anone -mi_gdb_test "-var-create anone * anone" \ - "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \ - "create duplicate local variable anone" - - -# Test: c_variable-7.72 -# Desc: type of anone -mi_gdb_test "-var-info-type anone" \ - "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ - "info type variable anone" - - -# Test: c_variable-7.73 -# Desc: is anone editable -mi_gdb_test "-var-show-attributes anone" \ - "\\^done,attr=\"editable\"" \ - "is anone editable" - -# Test: c_variable-7.74 -# Desc: number of children of anone -mi_gdb_test "-var-info-num-children anone" \ - "\\^done,numchild=\"0\"" \ - "get number of children of anone" - -# Test: c_variable-7.75 -# Desc: children of anone -mi_gdb_test "-var-list-children anone" \ - "\\^done,numchild=\"0\"" \ - "get children of anone" - - -# Record fp - -send_gdb "p/x \$fp\n" -gdb_expect { - -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { - pass "print FP register" - set fp $expect_out(1,string) - } -# -re ".*" { fail "print FP register"} - timeout { fail "print FP register (timeout)"} -} - -mi_gdb_test "200-break-insert incr_a" \ - "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"85\",times=\"0\"\}" \ - "break-insert operation" -send_gdb "-exec-continue\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" { - pass "continue to incr_a" - } - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" { - fail "continue to incr_a (compiler debug info incorrect)" - } - -re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" { - fail "continue to incr_a (unknown output)" - } - timeout { - fail "continue to incr_a (timeout)" - } -} - -# Test: c_variable-7.81 -# Desc: Create variables in different scopes -mi_gdb_test "-var-create a1 * a" \ - "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \ - "create local variable a1" - -mi_gdb_test "-var-create a2 $fp a" \ - "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \ - "create variable a2 in different scope" - -#gdbtk_test c_variable-7.81 {create variables in different scopes} { -# set a1 [gdb_variable create -expr a] -# set a2 [gdb_variable create -expr a -frame $fp] - -# set vals {} -# lappend vals [$a1 value] -# lappend vals [$a2 value] -# set vals -#} {2 1} - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-watch.exp b/gdb/testsuite/gdb.mi/mi1-watch.exp deleted file mode 100644 index dfb97ae..0000000 --- a/gdb/testsuite/gdb.mi/mi1-watch.exp +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# -# Test essential Machine interface (MI) operations -# -# Verify that, using the MI, we can run a simple program and perform basic -# debugging activities like: insert breakpoints, run the program, -# step, next, continue until it ends and, last but not least, quit. -# -# The goal is not to test gdb functionality, which is done by other tests, -# but to verify the correct output response to MI operations. -# - -load_lib mi-support.exp -set MIFLAGS "-i=mi1" - -gdb_exit -if [mi_gdb_start] { - continue -} - -set testfile "basics" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - -proc test_watchpoint_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert a watchpoint and list - # Tests: - # -break-watch C - # -break-list - - mi_gdb_test "111-break-watch C" \ - "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \ - "break-watch operation" - - mi_gdb_test "222-break-list" \ - "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \ - "list of watchpoints" - -} - -# UNUSED at the time -proc test_awatch_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert an access watchpoint and list it - # Tests: - # -break-watch -a A - # -break-list - - mi_gdb_test "333-break-watch -a A" \ - "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \ - "break-watch -a operation" - - mi_gdb_test "444-break-list" \ - "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \ - "list of watchpoints awatch" - - mi_gdb_test "777-break-delete 3" \ - "777\\^done" \ - "delete access watchpoint" -} - -# UNUSED at the time -proc test_rwatch_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert a read watchpoint and list it. - # Tests: - # -break-insert -r B - # -break-list - - mi_gdb_test "200-break-watch -r C" \ - "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert -r operation" - - mi_gdb_test "300-break-list" \ - "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\}\}" \ - "list of breakpoints" - - mi_gdb_test "177-break-delete 4" \ - "177\\^done" \ - "delete read watchpoint" -} - -proc test_watchpoint_triggering {} { - global mi_gdb_prompt - global hex - - # Continue execution until the watchpoint is reached, continue again, - # to see the watchpoint go out of scope. - # Does: - # -exec-continue (Here wp triggers) - # -exec-continue (Here wp goes out of scope) - - send_gdb "222-exec-continue\n" - gdb_expect { - -re "222\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "watchpoint trigger" - } - -re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"} - timeout {fail "watchpoint trigger (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (1)"} - timeout {fail "watchpoint trigger (timeout 1)"} - } - - send_gdb "223-exec-continue\n" - gdb_expect { - -re "223\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" { - pass "wp out of scope" - } - -re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"} - timeout {fail "wp out of scope (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "wp out of scope (1)"} - timeout {fail "wp out of scope (timeout 1)"} - } -} - -mi_runto callee4 -test_watchpoint_creation_and_listing -#test_rwatch_creation_and_listing -#test_awatch_creation_and_listing -test_watchpoint_triggering - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.objc/basicclass.exp b/gdb/testsuite/gdb.objc/basicclass.exp index 39cf296..41ab284 100644 --- a/gdb/testsuite/gdb.objc/basicclass.exp +++ b/gdb/testsuite/gdb.objc/basicclass.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2003, 2004 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 @@ -125,13 +125,9 @@ gdb_test continue \ # # Test resetting breakpoints when re-running program # -send_gdb "run\n" +gdb_run_cmd 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 $"\ + -re "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" } diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 43d253e..d7f8971 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -78,7 +78,7 @@ gdb_expect { } } -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.threads/thread-specific.c b/gdb/testsuite/gdb.threads/thread-specific.c new file mode 100644 index 0000000..88a462d --- /dev/null +++ b/gdb/testsuite/gdb.threads/thread-specific.c @@ -0,0 +1,66 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2004 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. */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <pthread.h> + +void *thread_function(void *arg); + +unsigned int args[1]; + +int main() { + int res; + pthread_t threads[2]; + void *thread_result; + long i = 1; + + args[0] = 1; + res = pthread_create(&threads[0], + NULL, + thread_function, + (void *) 0); + + /* thread-specific.exp: last thread start. */ + args[1] = 1; + + /* Don't run forever. Run just short of it :) */ + while (i > 0) + { + /* thread-specific.exp: main loop. */ + (i) ++; + } + + exit(EXIT_SUCCESS); +} + +void *thread_function(void *arg) { + int my_number = (long) arg; + int *myp = &args[my_number]; + + /* Don't run forever. Run just short of it :) */ + while (*myp > 0) + { + /* thread-specific.exp: thread loop. */ + (*myp) ++; + } + + pthread_exit(NULL); +} diff --git a/gdb/testsuite/gdb.threads/thread-specific.exp b/gdb/testsuite/gdb.threads/thread-specific.exp new file mode 100644 index 0000000..66f0bd2 --- /dev/null +++ b/gdb/testsuite/gdb.threads/thread-specific.exp @@ -0,0 +1,115 @@ +# Copyright 2004 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 Daniel Jacobowitz <drow@mvista.com>. +# It tests that the correct breakpoint is reported when we hit a +# thread-specific breakpoint inserted for several threads. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "thread-specific" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { + return -1 +} + +# Return a list of the valid thread IDs, with the initial thread first. +proc get_thread_list { } { + global gdb_prompt + global expect_out + + set thr_list "" + + gdb_test_multiple "info threads" "get threads list" { + -re "info threads\r\n" { + exp_continue + } + -re "^\\* *(\[0-9\]*) Thread \[^\n\]*main\[^\n\]*\n" { + set thr_list "$expect_out(1,string) $thr_list" + exp_continue + } + -re "^ *(\[0-9\]*) Thread \[^\n\]*\n" { + lappend thr_list $expect_out(1,string) + exp_continue + } + -re ".*$gdb_prompt $" { + if { [llength $thr_list] != 0 } { + pass "get threads list" + } else { + fail "get threads list (no threads)" + } + } + } + + return $thr_list +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_load ${binfile} + +gdb_test "set print sevenbit-strings" "" +gdb_test "set width 0" "" + +runto_main + +gdb_breakpoint [gdb_get_line_number "thread-specific.exp: last thread start"] +gdb_continue_to_breakpoint "all threads started" + +set line [gdb_get_line_number "thread-specific.exp: thread loop"] +set threads [get_thread_list] + +if {[llength $threads] == 0} { + # We have already issued a FAIL above. + return 1 +} + +gdb_test_multiple "break $line thread [lindex $threads 0]" \ + "breakpoint $line main thread" { + -re "Breakpoint (\[0-9\]*) at.* file .*$srcfile, line.*$gdb_prompt $" { + set main_breakpoint $expect_out(1,string) + pass "breakpoint $line main thread" + } +} + +foreach thread [lrange $threads 1 end] { + gdb_breakpoint "$line thread $thread" +} + +gdb_test_multiple "continue" "continue to thread-specific breakpoint" { + -re "Breakpoint $main_breakpoint, .* at .*\r\n$gdb_prompt $" { + fail "continue to thread-specific breakpoint (wrong breakpoint)" + } + -re "Breakpoint .* at .*\r\n$gdb_prompt $" { + pass "continue to thread-specific breakpoint" + } +} + +return 0 diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c index b0f557c..b1f1f5d 100644 --- a/gdb/testsuite/lib/compiler.c +++ b/gdb/testsuite/lib/compiler.c @@ -1,6 +1,6 @@ /* This test file is part of GDB, the GNU debugger. - Copyright 1995, 1997, 1999, 2003 Free Software Foundation, Inc. + Copyright 1995, 1997, 1999, 2003, 2004 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 @@ -19,36 +19,47 @@ Please email any bugs, comments, and/or additions to this file to: bug-gdb@prep.ai.mit.edu */ -/* Often the behavior of any particular test depends upon what compiler was - used to compile the test. As each test is compiled, this file is - preprocessed by the same compiler used to compile that specific test - (different tests might be compiled by different compilers, particularly - if compiled at different times), and used to generate a *.ci (compiler - info) file for that test. +/* Sometimes the behavior of a test depends upon the compiler used to + compile the test program. A test script can call get_compiler_info + to figure out the compiler version and test_compiler_info to test it. - I.E., when callfuncs is compiled, a callfuncs.ci file will be generated, - which can then be sourced by callfuncs.exp to give callfuncs.exp access - to information about the compilation environment. + get_compiler_info runs the preprocessor on this file and then eval's + the result. This sets various symbols for use by test_compiler_info. - TODO: It might be a good idea to add expect code that tests each - definition made with 'set" to see if one already exists, and if so - warn about conflicts if it is being set to something else. */ + TODO: make compiler_info a local variable for get_compiler_info and + test_compiler_info. -/* This needs to be kept in sync with whatis.c and gdb.exp(get_compiler_info). - If this ends up being hairy, we could use a common header file. */ + TODO: all clients should use test_compiler_info and should not + use gcc_compiled, hp_cc_compiler, or hp_aCC_compiler. -#if defined (__STDC__) || defined (_AIX) -set signed_keyword_not_used 0 -#else -set signed_keyword_not_used 1 -#endif + TODO: purge signed_keyword_not_used. */ + +set compiler_info "" #if defined (__GNUC__) -set gcc_compiled __GNUC__ set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -] +set gcc_compiled __GNUC__ #else set gcc_compiled 0 -set compiler_info "" #endif -return 0 +#if defined (__HP_cc) +set compiler_info [join {hpcc __HP_cc} -] +set hp_cc_compiler __HP_cc +#else +set hp_cc_compiler 0 +#endif + +#if defined (__HP_aCC) +set compiler_info [join {hpacc __HP_aCC} -] +set hp_aCC_compiler __HP_aCC +#else +set hp_aCC_compiler 0 +#endif + +/* gdb.base/whatis.exp still uses this */ +#if defined (__STDC__) || defined (_AIX) +set signed_keyword_not_used 0 +#else +set signed_keyword_not_used 1 +#endif diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc index bbefeaa..0c5eb66 100644 --- a/gdb/testsuite/lib/compiler.cc +++ b/gdb/testsuite/lib/compiler.cc @@ -19,27 +19,35 @@ Please email any bugs, comments, and/or additions to this file to: bug-gdb@prep.ai.mit.edu */ -/* Often the behavior of any particular test depends upon what compiler was - used to compile the test. As each test is compiled, this file is - preprocessed by the same compiler used to compile that specific test - (different tests might be compiled by different compilers, particularly - if compiled at different times), and used to generate a *.ci (compiler - info) file for that test. +/* This file is exactly like compiler.c. I could just use compiler.c if + I could be sure that every C++ compiler accepted extensions of ".c". */ - I.E., when callfuncs is compiled, a callfuncs.ci file will be generated, - which can then be sourced by callfuncs.exp to give callfuncs.exp access - to information about the compilation environment. - - TODO: It might be a good idea to add expect code that tests each - definition made with 'set" to see if one already exists, and if so - warn about conflicts if it is being set to something else. */ +set compiler_info "" #if defined (__GNUC__) -set gcc_compiled __GNUC__ set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -] +set gcc_compiled __GNUC__ #else set gcc_compiled 0 -set compiler_info "" #endif -return 0 +#if defined (__HP_cc) +set compiler_info [join {hpcc __HP_cc} -] +set hp_cc_compiler __HP_cc +#else +set hp_cc_compiler 0 +#endif + +#if defined (__HP_aCC) +set compiler_info [join {hpacc __HP_aCC} -] +set hp_aCC_compiler __HP_aCC +#else +set hp_aCC_compiler 0 +#endif + +/* gdb.base/whatis.exp still uses this */ +#if defined (__STDC__) || defined (_AIX) +set signed_keyword_not_used 0 +#else +set signed_keyword_not_used 1 +#endif diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3f2938e..5cd54ab 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1,5 +1,5 @@ # Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -# 2002, 2003 +# 2002, 2003, 2004 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -248,6 +248,12 @@ proc gdb_run_cmd {args} { } return } + + if [target_info exists gdb,do_reload_on_run] { + if { [gdb_load ""] < 0 } { + return; + } + } send_gdb "run $args\n" # This doesn't work quite right yet. gdb_expect 60 { @@ -269,6 +275,10 @@ proc gdb_breakpoint { function } { -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {} + -re "Make breakpoint pending.*y or n. $" { + send_gdb "n\n" + exp_continue + } -re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 } timeout { fail "setting breakpoint at $function (timeout)" ; return 0 } } @@ -449,6 +459,7 @@ proc gdb_test_multiple { command message user_code } { global gdb_prompt global GDB upvar timeout timeout + upvar expect_out expect_out if { $message == "" } { set message $command @@ -1094,86 +1105,114 @@ proc skip_hp_tests {} { return $skip_hp } -global compiler_info -set compiler_info unknown +set compiler_info "unknown" +set gcc_compiled 0 +set hp_cc_compiler 0 +set hp_aCC_compiler 0 +set signed_keyword_not_used 0 + +# Figure out what compiler I am using. +# +# BINFILE is a "compiler information" output file. This implementation +# does not use BINFILE. +# +# ARGS can be empty or "C++". If empty, "C" is assumed. +# +# There are several ways to do this, with various problems. +# +# [ gdb_compile -E $ifile -o $binfile.ci ] +# source $binfile.ci +# +# Single Unix Spec v3 says that "-E -o ..." together are not +# specified. And in fact, the native compiler on hp-ux 11 (among +# others) does not work with "-E -o ...". Most targets used to do +# this, and it mostly worked, because it works with gcc. +# +# [ catch "exec $compiler -E $ifile > $binfile.ci" exec_output ] +# source $binfile.ci +# +# This avoids the problem with -E and -o together. This almost works +# if the build machine is the same as the host machine, which is +# usually true of the targets which are not gcc. But this code does +# not figure which compiler to call, and it always ends up using the C +# compiler. Not good for setting hp_aCC_compiler. Targets +# hppa*-*-hpux* and mips*-*-irix* used to do this. +# +# [ gdb_compile -E $ifile > $binfile.ci ] +# source $binfile.ci +# +# dejagnu target_compile says that it supports output redirection, +# but the code is completely different from the normal path and I +# don't want to sweep the mines from that path. So I didn't even try +# this. +# +# set cppout [ gdb_compile $ifile "" preprocess $args quiet ] +# eval $cppout +# +# I actually do this for all targets now. gdb_compile runs the right +# compiler, and TCL captures the output, and I eval the output. +# +# Unfortunately, expect logs the output of the command as it goes by, +# and dejagnu helpfully prints a second copy of it right afterwards. +# So I turn off expect logging for a moment. +# +# [ gdb_compile $ifile $ciexe_file executable $args ] +# [ remote_exec $ciexe_file ] +# [ source $ci_file.out ] +# +# I could give up on -E and just do this. +# I didn't get desperate enough to try this. +# +# -- chastain 2004-01-06 proc get_compiler_info {binfile args} { - # Create and source the file that provides information about the compiler - # used to compile the test case. - # Compiler_type can be null or c++. If null we assume c. + # For compiler.c and compiler.cc global srcdir - global subdir - # These two come from compiler.c. - global signed_keyword_not_used - global gcc_compiled + + # I am going to play with the log to keep noise out. + global outdir + global tool + + # These come from compiler.c or compiler.cc global compiler_info + global gcc_compiled + global hp_cc_compiler + global hp_aCC_compiler + global signed_keyword_not_used - if {![istarget "hppa*-*-hpux*"] && ![istarget "mips*-*-irix*"]} { - if { [llength $args] > 0 } { - if {$args == "c++"} { - if { [gdb_compile "${srcdir}/lib/compiler.cc" "${binfile}.ci" preprocess {}] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } - } else { - if { [gdb_compile "${srcdir}/lib/compiler.c" "${binfile}.ci" preprocess {}] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } - } else { - if { [llength $args] > 0 } { - if {$args == "c++"} { - if { [eval gdb_preprocess \ - [list "${srcdir}/lib/compiler.cc" "${binfile}.ci"] \ - $args] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } - } elseif { $args != "f77" } { - if { [eval gdb_preprocess \ - [list "${srcdir}/lib/compiler.c" "${binfile}.ci"] \ - $args] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } + # Choose which file to preprocess. + set ifile "${srcdir}/lib/compiler.c" + if { [llength $args] > 0 && [lindex $args 0] == "c++" } { + set ifile "${srcdir}/lib/compiler.cc" } - - uplevel \#0 { set gcc_compiled 0 } - if { [llength $args] == 0 || $args != "f77" } { - source ${binfile}.ci + # Run $ifile through the right preprocessor. + # Toggle gdb.log to keep the compiler output out of the log. + log_file + set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ] + log_file -a "$outdir/$tool.log" + + # Source the output. + foreach cppline [ split "$cppout" "\n" ] { + if { ! [ regexp "^#" "$cppline" ] } { + if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } { + verbose "get_compiler_info: $cppline" 2 + eval "$cppline" + } + } } + verbose -log "get_compiler_info: $compiler_info" # Most compilers will evaluate comparisons and other boolean # operations to 0 or 1. uplevel \#0 { set true 1 } uplevel \#0 { set false 0 } - uplevel \#0 { set hp_cc_compiler 0 } - uplevel \#0 { set hp_aCC_compiler 0 } - uplevel \#0 { set hp_f77_compiler 0 } - uplevel \#0 { set hp_f90_compiler 0 } - if { !$gcc_compiled && [istarget "hppa*-*-hpux*"] } { - # Check for the HP compilers - set compiler [lindex [split [get_compiler $args] " "] 0] - catch "exec what $compiler" output - if [regexp ".*HP aC\\+\\+.*" $output] { - uplevel \#0 { set hp_aCC_compiler 1 } - # Use of aCC results in boolean results being displayed as - # "true" or "false" - uplevel \#0 { set true true } - uplevel \#0 { set false false } - } elseif [regexp ".*HP C Compiler.*" $output] { - uplevel \#0 { set hp_cc_compiler 1 } - } elseif [regexp ".*HP-UX f77.*" $output] { - uplevel \#0 { set hp_f77_compiler 1 } - } elseif [regexp ".*HP-UX f90.*" $output] { - uplevel \#0 { set hp_f90_compiler 1 } - } + # Use of aCC results in boolean results being displayed as + # "true" or "false" + if { $hp_aCC_compiler } { + uplevel \#0 { set true true } + uplevel \#0 { set false false } } return 0; @@ -1184,85 +1223,6 @@ proc test_compiler_info { compiler } { return [string match $compiler $compiler_info] } -proc get_compiler {args} { - global CC CC_FOR_TARGET CXX CXX_FOR_TARGET F77_FOR_TARGET - - if { [llength $args] == 0 - || ([llength $args] == 1 && [lindex $args 0] == "") } { - set which_compiler "c" - } else { - if { $args =="c++" } { - set which_compiler "c++" - } elseif { $args =="f77" } { - set which_compiler "f77" - } else { - perror "Unknown compiler type supplied to gdb_preprocess" - return "" - } - } - - if [info exists CC_FOR_TARGET] { - if {$which_compiler == "c"} { - set compiler $CC_FOR_TARGET - } - } - - if [info exists CXX_FOR_TARGET] { - if {$which_compiler == "c++"} { - set compiler $CXX_FOR_TARGET - } - } - - if [info exists F77_FOR_TARGET] { - if {$which_compiler == "f77"} { - set compiler $F77_FOR_TARGET - } - } - - if { ![info exists compiler] } { - if { $which_compiler == "c" } { - if {[info exists CC]} { - set compiler $CC - } - } - if { $which_compiler == "c++" } { - if {[info exists CXX]} { - set compiler $CXX - } - } - if {![info exists compiler]} { - set compiler [board_info [target_info name] compiler]; - if { $compiler == "" } { - perror "get_compiler: No compiler found" - return "" - } - } - } - - return $compiler -} - -proc gdb_preprocess {source dest args} { - set compiler [get_compiler "$args"] - if { $compiler == "" } { - return 1 - } - - set cmdline "$compiler -E $source > $dest" - - verbose "Invoking $compiler -E $source > $dest" - verbose -log "Executing on local host: $cmdline" 2 - set status [catch "exec ${cmdline}" exec_output] - - set result [prune_warnings $exec_output] - regsub "\[\r\n\]*$" "$result" "" result; - regsub "^\[\r\n\]*" "$result" "" result; - if { $result != "" } { - clone_output "gdb compile failed, $result" - } - return $result; -} - set gdb_wrapper_initialized 0 proc gdb_wrapper_init { args } { @@ -1510,6 +1470,11 @@ proc gdb_expect_list {test sentinel list} { fail "${test} (pattern ${index} + sentinel)" set ok 0 } + -re ".*A problem internal to GDB has been detected" { + fail "${test} (GDB internal error)" + set ok 0 + gdb_internal_error_resync + } timeout { fail "${test} (pattern ${index} + sentinel) (timeout)" set ok 0 @@ -1528,6 +1493,11 @@ proc gdb_expect_list {test sentinel list} { fail "${test} (pattern ${index})" set ok 0 } + -re ".*A problem internal to GDB has been detected" { + fail "${test} (GDB internal error)" + set ok 0 + gdb_internal_error_resync + } timeout { fail "${test} (pattern ${index}) (timeout)" set ok 0 diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index 4b1c0fd..bdb96e2 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -29,13 +29,7 @@ #include "tui/tui-win.h" #include "tui/tui-io.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /***************************************** @@ -52,20 +46,20 @@ unsigned int tui_dispatch_ctrl_char (unsigned int ch) { - TuiWinInfoPtr winInfo = tuiWinWithFocus (); - WINDOW *w = cmdWin->generic.handle; + struct tui_win_info *win_info = tui_win_with_focus (); + WINDOW *w = TUI_CMD_WIN->generic.handle; /* ** If the command window has the logical focus, or no-one does ** assume it is the command window; in this case, pass the ** character on through and do nothing here. */ - if (winInfo == (TuiWinInfoPtr) NULL || winInfo == cmdWin) + if (win_info == NULL || win_info == TUI_CMD_WIN) return ch; else { - unsigned int c = 0, chCopy = ch; - register int i; + unsigned int c = 0, ch_copy = ch; + int i; char *term; /* If this is an xterm, page next/prev keys aren't returned @@ -77,57 +71,58 @@ tui_dispatch_ctrl_char (unsigned int ch) term[i] = toupper (term[i]); if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch)) { - unsigned int pageCh = 0, tmpChar; + unsigned int page_ch = 0; + unsigned int tmp_char; - tmpChar = 0; - while (!key_is_end_sequence (tmpChar)) + tmp_char = 0; + while (!key_is_end_sequence (tmp_char)) { - tmpChar = (int) wgetch (w); - if (tmpChar == ERR) + tmp_char = (int) wgetch (w); + if (tmp_char == ERR) { return ch; } - if (!tmpChar) + if (!tmp_char) break; - if (tmpChar == 53) - pageCh = KEY_PPAGE; - else if (tmpChar == 54) - pageCh = KEY_NPAGE; + if (tmp_char == 53) + page_ch = KEY_PPAGE; + else if (tmp_char == 54) + page_ch = KEY_NPAGE; else { return 0; } } - chCopy = pageCh; + ch_copy = page_ch; } - switch (chCopy) + switch (ch_copy) { case KEY_NPAGE: - tuiScrollForward (winInfo, 0); + tui_scroll_forward (win_info, 0); break; case KEY_PPAGE: - tuiScrollBackward (winInfo, 0); + tui_scroll_backward (win_info, 0); break; case KEY_DOWN: case KEY_SF: - tuiScrollForward (winInfo, 1); + tui_scroll_forward (win_info, 1); break; case KEY_UP: case KEY_SR: - tuiScrollBackward (winInfo, 1); + tui_scroll_backward (win_info, 1); break; case KEY_RIGHT: - tuiScrollLeft (winInfo, 1); + tui_scroll_left (win_info, 1); break; case KEY_LEFT: - tuiScrollRight (winInfo, 1); + tui_scroll_right (win_info, 1); break; case '\f': - tuiRefreshAll (); + tui_refresh_all_win (); break; default: - c = chCopy; + c = ch_copy; break; } return c; diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index c6f4fb5..2b6faa3 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -1,7 +1,7 @@ /* TUI data manipulation routines. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -28,44 +28,38 @@ #include "tui/tui-data.h" #include "tui/tui-wingeneral.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_string.h" +#include "gdb_curses.h" /**************************** ** GLOBAL DECLARATIONS ****************************/ -TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS]; +struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]); /*************************** ** Private data ****************************/ -static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT; -static int _termHeight, _termWidth; -static TuiGenWinInfo _locator; -static TuiGenWinInfo _execInfo[2]; -static TuiWinInfoPtr _srcWinList[2]; -static TuiList _sourceWindows = -{(OpaqueList) _srcWinList, 0}; -static int _defaultTabLen = DEFAULT_TAB_LEN; -static TuiWinInfoPtr _winWithFocus = (TuiWinInfoPtr) NULL; -static TuiLayoutDef _layoutDef = -{SRC_WIN, /* displayMode */ - FALSE, /* split */ - TUI_UNDEFINED_REGS, /* regsDisplayType */ - TUI_SFLOAT_REGS}; /* floatRegsDisplayType */ -static int _winResized = FALSE; +static enum tui_layout_type current_layout = UNDEFINED_LAYOUT; +static int term_height, term_width; +static struct tui_gen_win_info _locator; +static struct tui_gen_win_info exec_info[2]; +static struct tui_win_info * src_win_list[2]; +static struct tui_list source_windows = {(void **) src_win_list, 0}; +static int default_tab_len = DEFAULT_TAB_LEN; +static struct tui_win_info * win_with_focus = (struct tui_win_info *) NULL; +static struct tui_layout_def layout_def = +{SRC_WIN, /* DISPLAY_MODE */ + FALSE, /* SPLIT */ + TUI_UNDEFINED_REGS, /* REGS_DISPLAY_TYPE */ + TUI_SFLOAT_REGS}; /* FLOAT_REGS_DISPLAY_TYPE */ +static int win_resized = FALSE; /********************************* ** Static function forward decls **********************************/ -static void freeContent (TuiWinContent, int, TuiWinType); -static void freeContentElements (TuiWinContent, int, TuiWinType); +static void free_content (tui_win_content, int, enum tui_win_type); +static void free_content_elements (tui_win_content, int, enum tui_win_type); @@ -73,314 +67,252 @@ static void freeContentElements (TuiWinContent, int, TuiWinType); ** PUBLIC FUNCTIONS **********************************/ +int +tui_win_is_source_type (enum tui_win_type win_type) +{ + return (win_type == SRC_WIN || win_type == DISASSEM_WIN); +} + +int +tui_win_is_auxillary (enum tui_win_type win_type) +{ + return (win_type > MAX_MAJOR_WINDOWS); +} + +int +tui_win_has_locator (struct tui_win_info *win_info) +{ + return (win_info != NULL \ + && win_info->detail.source_info.has_locator); +} + +void +tui_set_win_highlight (struct tui_win_info *win_info, int highlight) +{ + if (win_info != NULL) + win_info->is_highlighted = highlight; +} + /****************************************** ** ACCESSORS & MUTATORS FOR PRIVATE DATA ******************************************/ -/* - ** tuiWinResized(). - ** Answer a whether the terminal window has been resized or not - */ +/* Answer a whether the terminal window has been resized or not. */ int -tuiWinResized (void) +tui_win_resized (void) { - return _winResized; -} /* tuiWinResized */ + return win_resized; +} -/* - ** tuiSetWinResized(). - ** Set a whether the terminal window has been resized or not - */ +/* Set a whether the terminal window has been resized or not. */ void -tuiSetWinResizedTo (int resized) +tui_set_win_resized_to (int resized) { - _winResized = resized; - - return; -} /* tuiSetWinResizedTo */ + win_resized = resized; +} -/* - ** tuiLayoutDef(). - ** Answer a pointer to the current layout definition - */ -TuiLayoutDefPtr -tuiLayoutDef (void) +/* Answer a pointer to the current layout definition. */ +struct tui_layout_def * +tui_layout_def (void) { - return &_layoutDef; -} /* tuiLayoutDef */ + return &layout_def; +} -/* - ** tuiWinWithFocus(). - ** Answer the window with the logical focus - */ -TuiWinInfoPtr -tuiWinWithFocus (void) +/* Answer the window with the logical focus. */ +struct tui_win_info * +tui_win_with_focus (void) { - return _winWithFocus; -} /* tuiWinWithFocus */ + return win_with_focus; +} -/* - ** tuiSetWinWithFocus(). - ** Set the window that has the logical focus - */ +/* Set the window that has the logical focus. */ void -tuiSetWinWithFocus (TuiWinInfoPtr winInfo) +tui_set_win_with_focus (struct tui_win_info * win_info) { - _winWithFocus = winInfo; - - return; -} /* tuiSetWinWithFocus */ + win_with_focus = win_info; +} -/* - ** tuiDefaultTabLen(). - ** Answer the length in chars, of tabs - */ +/* Answer the length in chars, of tabs. */ int -tuiDefaultTabLen (void) +tui_default_tab_len (void) { - return _defaultTabLen; -} /* tuiDefaultTabLen */ + return default_tab_len; +} -/* - ** tuiSetDefaultTabLen(). - ** Set the length in chars, of tabs - */ +/* Set the length in chars, of tabs. */ void -tuiSetDefaultTabLen (int len) +tui_set_default_tab_len (int len) { - _defaultTabLen = len; - - return; -} /* tuiSetDefaultTabLen */ + default_tab_len = len; +} -/* - ** currentSourceWin() - ** Accessor for the current source window. Usually there is only - ** one source window (either source or disassembly), but both can - ** be displayed at the same time. - */ -TuiListPtr -sourceWindows (void) +/* Accessor for the current source window. Usually there is only one + source window (either source or disassembly), but both can be + displayed at the same time. */ +struct tui_list * +tui_source_windows (void) { - return &_sourceWindows; -} /* currentSourceWindows */ + return &source_windows; +} -/* - ** clearSourceWindows() - ** Clear the list of source windows. Usually there is only one - ** source window (either source or disassembly), but both can be - ** displayed at the same time. - */ +/* Clear the list of source windows. Usually there is only one source + window (either source or disassembly), but both can be displayed at + the same time. */ void -clearSourceWindows (void) +tui_clear_source_windows (void) { - _sourceWindows.list[0] = (Opaque) NULL; - _sourceWindows.list[1] = (Opaque) NULL; - _sourceWindows.count = 0; - - return; -} /* currentSourceWindows */ + source_windows.list[0] = NULL; + source_windows.list[1] = NULL; + source_windows.count = 0; +} -/* - ** clearSourceWindowsDetail() - ** Clear the pertinant detail in the source windows. - */ +/* Clear the pertinant detail in the source windows. */ void -clearSourceWindowsDetail (void) +tui_clear_source_windows_detail (void) { int i; - for (i = 0; i < (sourceWindows ())->count; i++) - clearWinDetail ((TuiWinInfoPtr) (sourceWindows ())->list[i]); - - return; -} /* currentSourceWindows */ + for (i = 0; i < (tui_source_windows ())->count; i++) + tui_clear_win_detail ((struct tui_win_info *) (tui_source_windows ())->list[i]); +} -/* - ** addSourceWindowToList(). - ** Add a window to the list of source windows. Usually there is - ** only one source window (either source or disassembly), but - ** both can be displayed at the same time. - */ +/* Add a window to the list of source windows. Usually there is only + one source window (either source or disassembly), but both can be + displayed at the same time. */ void -addToSourceWindows (TuiWinInfoPtr winInfo) +tui_add_to_source_windows (struct tui_win_info * win_info) { - if (_sourceWindows.count < 2) - _sourceWindows.list[_sourceWindows.count++] = (Opaque) winInfo; - - return; -} /* addToSourceWindows */ + if (source_windows.count < 2) + source_windows.list[source_windows.count++] = (void *) win_info; +} -/* - ** clearWinDetail() - ** Clear the pertinant detail in the windows. - */ +/* Clear the pertinant detail in the windows. */ void -clearWinDetail (TuiWinInfoPtr winInfo) +tui_clear_win_detail (struct tui_win_info * win_info) { - if (m_winPtrNotNull (winInfo)) + if (win_info != NULL) { - switch (winInfo->generic.type) + switch (win_info->generic.type) { case SRC_WIN: case DISASSEM_WIN: - winInfo->detail.sourceInfo.startLineOrAddr.addr = 0; - winInfo->detail.sourceInfo.horizontalOffset = 0; + win_info->detail.source_info.start_line_or_addr.addr = 0; + win_info->detail.source_info.horizontal_offset = 0; break; case CMD_WIN: - winInfo->detail.commandInfo.curLine = - winInfo->detail.commandInfo.curch = 0; + win_info->detail.command_info.cur_line = + win_info->detail.command_info.curch = 0; break; case DATA_WIN: - winInfo->detail.dataDisplayInfo.dataContent = - (TuiWinContent) NULL; - winInfo->detail.dataDisplayInfo.dataContentCount = 0; - winInfo->detail.dataDisplayInfo.regsContent = - (TuiWinContent) NULL; - winInfo->detail.dataDisplayInfo.regsContentCount = 0; - winInfo->detail.dataDisplayInfo.regsDisplayType = + win_info->detail.data_display_info.data_content = + (tui_win_content) NULL; + win_info->detail.data_display_info.data_content_count = 0; + win_info->detail.data_display_info.regs_content = + (tui_win_content) NULL; + win_info->detail.data_display_info.regs_content_count = 0; + win_info->detail.data_display_info.regs_display_type = TUI_UNDEFINED_REGS; - winInfo->detail.dataDisplayInfo.regsColumnCount = 1; - winInfo->detail.dataDisplayInfo.displayRegs = FALSE; + win_info->detail.data_display_info.regs_column_count = 1; + win_info->detail.data_display_info.display_regs = FALSE; break; default: break; } } - - return; -} /* clearWinDetail */ +} -/* - ** sourceExecInfoPtr(). - ** Accessor for the source execution info ptr. - */ -TuiGenWinInfoPtr -sourceExecInfoWinPtr (void) +/* Accessor for the source execution info ptr. */ +struct tui_gen_win_info * +tui_source_exec_info_win_ptr (void) { - return &_execInfo[0]; -} /* sourceExecInfoWinPtr */ + return &exec_info[0]; +} -/* - ** disassemExecInfoPtr(). - ** Accessor for the disassem execution info ptr. - */ -TuiGenWinInfoPtr -disassemExecInfoWinPtr (void) +/* Accessor for the disassem execution info ptr. */ +struct tui_gen_win_info * +tui_disassem_exec_info_win_ptr (void) { - return &_execInfo[1]; -} /* disassemExecInfoWinPtr */ + return &exec_info[1]; +} -/* - ** locatorWinInfoPtr(). - ** Accessor for the locator win info. Answers a pointer to the - ** static locator win info struct. - */ -TuiGenWinInfoPtr -locatorWinInfoPtr (void) +/* Accessor for the locator win info. Answers a pointer to the static + locator win info struct. */ +struct tui_gen_win_info * +tui_locator_win_info_ptr (void) { return &_locator; -} /* locatorWinInfoPtr */ +} -/* - ** termHeight(). - ** Accessor for the termHeight - */ +/* Accessor for the term_height. */ int -termHeight (void) +tui_term_height (void) { - return _termHeight; -} /* termHeight */ + return term_height; +} -/* - ** setTermHeightTo(). - ** Mutator for the term height - */ +/* Mutator for the term height. */ void -setTermHeightTo (int h) +tui_set_term_height_to (int h) { - _termHeight = h; - - return; -} /* setTermHeightTo */ + term_height = h; +} -/* - ** termWidth(). - ** Accessor for the termWidth - */ +/* Accessor for the term_width. */ int -termWidth (void) +tui_term_width (void) { - return _termWidth; -} /* termWidth */ + return term_width; +} -/* - ** setTermWidth(). - ** Mutator for the termWidth - */ +/* Mutator for the term_width. */ void -setTermWidthTo (int w) +tui_set_term_width_to (int w) { - _termWidth = w; - - return; -} /* setTermWidthTo */ + term_width = w; +} -/* - ** currentLayout(). - ** Accessor for the current layout - */ -TuiLayoutType -currentLayout (void) +/* Accessor for the current layout. */ +enum tui_layout_type +tui_current_layout (void) { - return _currentLayout; -} /* currentLayout */ + return current_layout; +} -/* - ** setCurrentLayoutTo(). - ** Mutator for the current layout - */ +/* Mutator for the current layout. */ void -setCurrentLayoutTo (TuiLayoutType newLayout) +tui_set_current_layout_to (enum tui_layout_type new_layout) { - _currentLayout = newLayout; - - return; -} /* setCurrentLayoutTo */ + current_layout = new_layout; +} -/* - ** setGenWinOrigin(). - ** Set the origin of the window - */ +/* Set the origin of the window. */ void -setGenWinOrigin (TuiGenWinInfoPtr winInfo, int x, int y) +set_gen_win_origin (struct tui_gen_win_info * win_info, int x, int y) { - winInfo->origin.x = x; - winInfo->origin.y = y; - - return; -} /* setGenWinOrigin */ + win_info->origin.x = x; + win_info->origin.y = y; +} /***************************** @@ -388,25 +320,22 @@ setGenWinOrigin (TuiGenWinInfoPtr winInfo, int x, int y) *****************************/ -/* - ** tuiNextWin(). - ** Answer the next window in the list, cycling back to the top - ** if necessary - */ -TuiWinInfoPtr -tuiNextWin (TuiWinInfoPtr curWin) +/* Answer the next window in the list, cycling back to the top if + necessary. */ +struct tui_win_info * +tui_next_win (struct tui_win_info * cur_win) { - TuiWinType type = curWin->generic.type; - TuiWinInfoPtr nextWin = (TuiWinInfoPtr) NULL; + enum tui_win_type type = cur_win->generic.type; + struct tui_win_info * next_win = (struct tui_win_info *) NULL; - if (curWin->generic.type == CMD_WIN) + if (cur_win->generic.type == CMD_WIN) type = SRC_WIN; else - type = curWin->generic.type + 1; - while (type != curWin->generic.type && m_winPtrIsNull (nextWin)) + type = cur_win->generic.type + 1; + while (type != cur_win->generic.type && (next_win == NULL)) { - if (winList[type] && winList[type]->generic.isVisible) - nextWin = winList[type]; + if (tui_win_list[type] && tui_win_list[type]->generic.is_visible) + next_win = tui_win_list[type]; else { if (type == CMD_WIN) @@ -416,29 +345,26 @@ tuiNextWin (TuiWinInfoPtr curWin) } } - return nextWin; -} /* tuiNextWin */ + return next_win; +} -/* - ** tuiPrevWin(). - ** Answer the prev window in the list, cycling back to the bottom - ** if necessary - */ -TuiWinInfoPtr -tuiPrevWin (TuiWinInfoPtr curWin) +/* Answer the prev window in the list, cycling back to the bottom if + necessary. */ +struct tui_win_info * +tui_prev_win (struct tui_win_info * cur_win) { - TuiWinType type = curWin->generic.type; - TuiWinInfoPtr prev = (TuiWinInfoPtr) NULL; + enum tui_win_type type = cur_win->generic.type; + struct tui_win_info * prev = (struct tui_win_info *) NULL; - if (curWin->generic.type == SRC_WIN) + if (cur_win->generic.type == SRC_WIN) type = CMD_WIN; else - type = curWin->generic.type - 1; - while (type != curWin->generic.type && m_winPtrIsNull (prev)) + type = cur_win->generic.type - 1; + while (type != cur_win->generic.type && (prev == NULL)) { - if (winList[type]->generic.isVisible) - prev = winList[type]; + if (tui_win_list[type]->generic.is_visible) + prev = tui_win_list[type]; else { if (type == SRC_WIN) @@ -452,46 +378,40 @@ tuiPrevWin (TuiWinInfoPtr curWin) } -/* - ** partialWinByName(). - ** Answer the window represented by name - */ -TuiWinInfoPtr -partialWinByName (char *name) +/* Answer the window represented by name. */ +struct tui_win_info * +tui_partial_win_by_name (char *name) { - TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL; + struct tui_win_info * win_info = (struct tui_win_info *) NULL; if (name != (char *) NULL) { int i = 0; - while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo)) + while (i < MAX_MAJOR_WINDOWS && win_info == NULL) { - if (winList[i] != 0) + if (tui_win_list[i] != 0) { - char *curName = winName (&winList[i]->generic); - if (strlen (name) <= strlen (curName) && - strncmp (name, curName, strlen (name)) == 0) - winInfo = winList[i]; + char *cur_name = tui_win_name (&tui_win_list[i]->generic); + if (strlen (name) <= strlen (cur_name) && + strncmp (name, cur_name, strlen (name)) == 0) + win_info = tui_win_list[i]; } i++; } } - return winInfo; -} /* partialWinByName */ + return win_info; +} -/* - ** winName(). - ** Answer the name of the window - */ +/* Answer the name of the window. */ char * -winName (TuiGenWinInfoPtr winInfo) +tui_win_name (struct tui_gen_win_info * win_info) { char *name = (char *) NULL; - switch (winInfo->type) + switch (win_info->type) { case SRC_WIN: name = SRC_NAME; @@ -511,184 +431,161 @@ winName (TuiGenWinInfoPtr winInfo) } return name; -} /* winName */ +} -/* - ** initializeStaticData - */ void -initializeStaticData (void) +tui_initialize_static_data (void) { - initGenericPart (sourceExecInfoWinPtr ()); - initGenericPart (disassemExecInfoWinPtr ()); - initGenericPart (locatorWinInfoPtr ()); - - return; -} /* initializeStaticData */ + tui_init_generic_part (tui_source_exec_info_win_ptr ()); + tui_init_generic_part (tui_disassem_exec_info_win_ptr ()); + tui_init_generic_part (tui_locator_win_info_ptr ()); +} -/* - ** allocGenericWinInfo(). - */ -TuiGenWinInfoPtr -allocGenericWinInfo (void) +struct tui_gen_win_info * +tui_alloc_generic_win_info (void) { - TuiGenWinInfoPtr win; + struct tui_gen_win_info * win; - if ((win = (TuiGenWinInfoPtr) xmalloc ( - sizeof (TuiGenWinInfoPtr))) != (TuiGenWinInfoPtr) NULL) - initGenericPart (win); + if ((win = (struct tui_gen_win_info *) xmalloc ( + sizeof (struct tui_gen_win_info *))) != (struct tui_gen_win_info *) NULL) + tui_init_generic_part (win); return win; -} /* allocGenericWinInfo */ +} -/* - ** initGenericPart(). - */ void -initGenericPart (TuiGenWinInfoPtr win) +tui_init_generic_part (struct tui_gen_win_info * win) { win->width = win->height = win->origin.x = win->origin.y = - win->viewportHeight = - win->contentSize = - win->lastVisibleLine = 0; + win->viewport_height = + win->content_size = + win->last_visible_line = 0; win->handle = (WINDOW *) NULL; - win->content = (OpaquePtr) NULL; - win->contentInUse = - win->isVisible = FALSE; + win->content = NULL; + win->content_in_use = + win->is_visible = FALSE; win->title = 0; } /* - ** initContentElement(). + ** init_content_element(). */ void -initContentElement (TuiWinElementPtr element, TuiWinType type) +init_content_element (struct tui_win_element * element, enum tui_win_type type) { element->highlight = FALSE; switch (type) { case SRC_WIN: case DISASSEM_WIN: - element->whichElement.source.line = (char *) NULL; - element->whichElement.source.lineOrAddr.lineNo = 0; - element->whichElement.source.isExecPoint = FALSE; - element->whichElement.source.hasBreak = FALSE; + element->which_element.source.line = (char *) NULL; + element->which_element.source.line_or_addr.line_no = 0; + element->which_element.source.is_exec_point = FALSE; + element->which_element.source.has_break = FALSE; break; case DATA_WIN: - initGenericPart (&element->whichElement.dataWindow); - element->whichElement.dataWindow.type = DATA_ITEM_WIN; - ((TuiGenWinInfoPtr) & element->whichElement.dataWindow)->content = - (OpaquePtr) allocContent (1, DATA_ITEM_WIN); - ((TuiGenWinInfoPtr) - & element->whichElement.dataWindow)->contentSize = 1; + tui_init_generic_part (&element->which_element.data_window); + element->which_element.data_window.type = DATA_ITEM_WIN; + ((struct tui_gen_win_info *) & element->which_element.data_window)->content = + (void **) tui_alloc_content (1, DATA_ITEM_WIN); + ((struct tui_gen_win_info *) + & element->which_element.data_window)->content_size = 1; break; case CMD_WIN: - element->whichElement.command.line = (char *) NULL; + element->which_element.command.line = (char *) NULL; break; case DATA_ITEM_WIN: - element->whichElement.data.name = (char *) NULL; - element->whichElement.data.type = TUI_REGISTER; - element->whichElement.data.itemNo = UNDEFINED_ITEM; - element->whichElement.data.value = (Opaque) NULL; - element->whichElement.data.highlight = FALSE; + element->which_element.data.name = (char *) NULL; + element->which_element.data.type = TUI_REGISTER; + element->which_element.data.item_no = UNDEFINED_ITEM; + element->which_element.data.value = NULL; + element->which_element.data.highlight = FALSE; break; case LOCATOR_WIN: - element->whichElement.locator.fileName[0] = - element->whichElement.locator.procName[0] = (char) 0; - element->whichElement.locator.lineNo = 0; - element->whichElement.locator.addr = 0; + element->which_element.locator.file_name[0] = + element->which_element.locator.proc_name[0] = (char) 0; + element->which_element.locator.line_no = 0; + element->which_element.locator.addr = 0; break; case EXEC_INFO_WIN: - memset(element->whichElement.simpleString, ' ', - sizeof(element->whichElement.simpleString)); + memset(element->which_element.simple_string, ' ', + sizeof(element->which_element.simple_string)); break; default: break; } - return; -} /* initContentElement */ +} -/* - ** initWinInfo(). - */ void -initWinInfo (TuiWinInfoPtr winInfo) +init_win_info (struct tui_win_info * win_info) { - initGenericPart (&winInfo->generic); - winInfo->canHighlight = - winInfo->isHighlighted = FALSE; - switch (winInfo->generic.type) + tui_init_generic_part (&win_info->generic); + win_info->can_highlight = + win_info->is_highlighted = FALSE; + switch (win_info->generic.type) { case SRC_WIN: case DISASSEM_WIN: - winInfo->detail.sourceInfo.executionInfo = (TuiGenWinInfoPtr) NULL; - winInfo->detail.sourceInfo.hasLocator = FALSE; - winInfo->detail.sourceInfo.horizontalOffset = 0; - winInfo->detail.sourceInfo.startLineOrAddr.addr = 0; - winInfo->detail.sourceInfo.filename = 0; + win_info->detail.source_info.execution_info = (struct tui_gen_win_info *) NULL; + win_info->detail.source_info.has_locator = FALSE; + win_info->detail.source_info.horizontal_offset = 0; + win_info->detail.source_info.start_line_or_addr.addr = 0; + win_info->detail.source_info.filename = 0; break; case DATA_WIN: - winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL; - winInfo->detail.dataDisplayInfo.dataContentCount = 0; - winInfo->detail.dataDisplayInfo.regsContent = (TuiWinContent) NULL; - winInfo->detail.dataDisplayInfo.regsContentCount = 0; - winInfo->detail.dataDisplayInfo.regsDisplayType = + win_info->detail.data_display_info.data_content = (tui_win_content) NULL; + win_info->detail.data_display_info.data_content_count = 0; + win_info->detail.data_display_info.regs_content = (tui_win_content) NULL; + win_info->detail.data_display_info.regs_content_count = 0; + win_info->detail.data_display_info.regs_display_type = TUI_UNDEFINED_REGS; - winInfo->detail.dataDisplayInfo.regsColumnCount = 1; - winInfo->detail.dataDisplayInfo.displayRegs = FALSE; + win_info->detail.data_display_info.regs_column_count = 1; + win_info->detail.data_display_info.display_regs = FALSE; break; case CMD_WIN: - winInfo->detail.commandInfo.curLine = 0; - winInfo->detail.commandInfo.curch = 0; + win_info->detail.command_info.cur_line = 0; + win_info->detail.command_info.curch = 0; break; default: - winInfo->detail.opaque = (Opaque) NULL; + win_info->detail.opaque = NULL; break; } - - return; -} /* initWinInfo */ +} -/* - ** allocWinInfo(). - */ -TuiWinInfoPtr -allocWinInfo (TuiWinType type) +struct tui_win_info * +tui_alloc_win_info (enum tui_win_type type) { - TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL; + struct tui_win_info * win_info = (struct tui_win_info *) NULL; - winInfo = (TuiWinInfoPtr) xmalloc (sizeof (TuiWinInfo)); - if (m_winPtrNotNull (winInfo)) + win_info = (struct tui_win_info *) xmalloc (sizeof (struct tui_win_info)); + if ((win_info != NULL)) { - winInfo->generic.type = type; - initWinInfo (winInfo); + win_info->generic.type = type; + init_win_info (win_info); } - return winInfo; -} /* allocWinInfo */ + return win_info; +} -/* - ** allocContent(). - ** Allocates the content and elements in a block. - */ -TuiWinContent -allocContent (int numElements, TuiWinType type) +/* Allocates the content and elements in a block. */ +tui_win_content +tui_alloc_content (int num_elements, enum tui_win_type type) { - TuiWinContent content = (TuiWinContent) NULL; - char *elementBlockPtr = (char *) NULL; + tui_win_content content = (tui_win_content) NULL; + char *element_block_ptr = (char *) NULL; int i; - if ((content = (TuiWinContent) - xmalloc (sizeof (TuiWinElementPtr) * numElements)) != (TuiWinContent) NULL) + if ((content = (tui_win_content) + xmalloc (sizeof (struct tui_win_element *) * num_elements)) != (tui_win_content) NULL) { /* ** All windows, except the data window, can allocate the elements ** in a chunk. The data window cannot because items can be @@ -696,284 +593,262 @@ allocContent (int numElements, TuiWinType type) */ if (type != DATA_WIN) { - if ((elementBlockPtr = (char *) - xmalloc (sizeof (TuiWinElement) * numElements)) != (char *) NULL) + if ((element_block_ptr = (char *) + xmalloc (sizeof (struct tui_win_element) * num_elements)) != (char *) NULL) { - for (i = 0; i < numElements; i++) + for (i = 0; i < num_elements; i++) { - content[i] = (TuiWinElementPtr) elementBlockPtr; - initContentElement (content[i], type); - elementBlockPtr += sizeof (TuiWinElement); + content[i] = (struct tui_win_element *) element_block_ptr; + init_content_element (content[i], type); + element_block_ptr += sizeof (struct tui_win_element); } } else { - tuiFree ((char *) content); - content = (TuiWinContent) NULL; + xfree (content); + content = (tui_win_content) NULL; } } } return content; -} /* allocContent */ +} -/* - ** addContentElements(). - ** Adds the input number of elements to the windows's content. If - ** no content has been allocated yet, allocContent() is called to - ** do this. The index of the first element added is returned, - ** unless there is a memory allocation error, in which case, (-1) - ** is returned. - */ +/* Adds the input number of elements to the windows's content. If no + content has been allocated yet, alloc_content() is called to do + this. The index of the first element added is returned, unless + there is a memory allocation error, in which case, (-1) is + returned. */ int -addContentElements (TuiGenWinInfoPtr winInfo, int numElements) +tui_add_content_elements (struct tui_gen_win_info * win_info, int num_elements) { - TuiWinElementPtr elementPtr; - int i, indexStart; + struct tui_win_element * element_ptr; + int i, index_start; - if (winInfo->content == (OpaquePtr) NULL) + if (win_info->content == NULL) { - winInfo->content = (OpaquePtr) allocContent (numElements, winInfo->type); - indexStart = 0; + win_info->content = (void **) tui_alloc_content (num_elements, win_info->type); + index_start = 0; } else - indexStart = winInfo->contentSize; - if (winInfo->content != (OpaquePtr) NULL) + index_start = win_info->content_size; + if (win_info->content != NULL) { - for (i = indexStart; (i < numElements + indexStart); i++) + for (i = index_start; (i < num_elements + index_start); i++) { - if ((elementPtr = (TuiWinElementPtr) - xmalloc (sizeof (TuiWinElement))) != (TuiWinElementPtr) NULL) + if ((element_ptr = (struct tui_win_element *) + xmalloc (sizeof (struct tui_win_element))) != (struct tui_win_element *) NULL) { - winInfo->content[i] = (Opaque) elementPtr; - initContentElement (elementPtr, winInfo->type); - winInfo->contentSize++; + win_info->content[i] = (void *) element_ptr; + init_content_element (element_ptr, win_info->type); + win_info->content_size++; } else /* things must be really hosed now! We ran out of memory!? */ return (-1); } } - return indexStart; -} /* addContentElements */ + return index_start; +} -/* Delete all curses windows associated with winInfo, leaving everything +/* Delete all curses windows associated with win_info, leaving everything else intact. */ void -tuiDelWindow (TuiWinInfoPtr winInfo) +tui_del_window (struct tui_win_info * win_info) { - TuiGenWinInfoPtr genericWin; + struct tui_gen_win_info * generic_win; - switch (winInfo->generic.type) + switch (win_info->generic.type) { case SRC_WIN: case DISASSEM_WIN: - genericWin = locatorWinInfoPtr (); - if (genericWin != (TuiGenWinInfoPtr) NULL) + generic_win = tui_locator_win_info_ptr (); + if (generic_win != (struct tui_gen_win_info *) NULL) { - tuiDelwin (genericWin->handle); - genericWin->handle = (WINDOW *) NULL; - genericWin->isVisible = FALSE; + tui_delete_win (generic_win->handle); + generic_win->handle = (WINDOW *) NULL; + generic_win->is_visible = FALSE; } - if (winInfo->detail.sourceInfo.filename) + if (win_info->detail.source_info.filename) { - xfree (winInfo->detail.sourceInfo.filename); - winInfo->detail.sourceInfo.filename = 0; + xfree (win_info->detail.source_info.filename); + win_info->detail.source_info.filename = 0; } - genericWin = winInfo->detail.sourceInfo.executionInfo; - if (genericWin != (TuiGenWinInfoPtr) NULL) + generic_win = win_info->detail.source_info.execution_info; + if (generic_win != (struct tui_gen_win_info *) NULL) { - tuiDelwin (genericWin->handle); - genericWin->handle = (WINDOW *) NULL; - genericWin->isVisible = FALSE; + tui_delete_win (generic_win->handle); + generic_win->handle = (WINDOW *) NULL; + generic_win->is_visible = FALSE; } break; case DATA_WIN: - if (winInfo->generic.content != (OpaquePtr) NULL) + if (win_info->generic.content != NULL) { - tuiDelDataWindows (winInfo->detail.dataDisplayInfo.regsContent, - winInfo->detail.dataDisplayInfo.regsContentCount); - tuiDelDataWindows (winInfo->detail.dataDisplayInfo.dataContent, - winInfo->detail.dataDisplayInfo.dataContentCount); + tui_del_data_windows (win_info->detail.data_display_info.regs_content, + win_info->detail.data_display_info.regs_content_count); + tui_del_data_windows (win_info->detail.data_display_info.data_content, + win_info->detail.data_display_info.data_content_count); } break; default: break; } - if (winInfo->generic.handle != (WINDOW *) NULL) + if (win_info->generic.handle != (WINDOW *) NULL) { - tuiDelwin (winInfo->generic.handle); - winInfo->generic.handle = (WINDOW *) NULL; - winInfo->generic.isVisible = FALSE; + tui_delete_win (win_info->generic.handle); + win_info->generic.handle = (WINDOW *) NULL; + win_info->generic.is_visible = FALSE; } } -/* - ** freeWindow(). - */ void -freeWindow (TuiWinInfoPtr winInfo) +tui_free_window (struct tui_win_info * win_info) { - TuiGenWinInfoPtr genericWin; + struct tui_gen_win_info * generic_win; - switch (winInfo->generic.type) + switch (win_info->generic.type) { case SRC_WIN: case DISASSEM_WIN: - genericWin = locatorWinInfoPtr (); - if (genericWin != (TuiGenWinInfoPtr) NULL) + generic_win = tui_locator_win_info_ptr (); + if (generic_win != (struct tui_gen_win_info *) NULL) { - tuiDelwin (genericWin->handle); - genericWin->handle = (WINDOW *) NULL; + tui_delete_win (generic_win->handle); + generic_win->handle = (WINDOW *) NULL; } - freeWinContent (genericWin); - if (winInfo->detail.sourceInfo.filename) + tui_free_win_content (generic_win); + if (win_info->detail.source_info.filename) { - xfree (winInfo->detail.sourceInfo.filename); - winInfo->detail.sourceInfo.filename = 0; + xfree (win_info->detail.source_info.filename); + win_info->detail.source_info.filename = 0; } - genericWin = winInfo->detail.sourceInfo.executionInfo; - if (genericWin != (TuiGenWinInfoPtr) NULL) + generic_win = win_info->detail.source_info.execution_info; + if (generic_win != (struct tui_gen_win_info *) NULL) { - tuiDelwin (genericWin->handle); - genericWin->handle = (WINDOW *) NULL; - freeWinContent (genericWin); + tui_delete_win (generic_win->handle); + generic_win->handle = (WINDOW *) NULL; + tui_free_win_content (generic_win); } break; case DATA_WIN: - if (winInfo->generic.content != (OpaquePtr) NULL) + if (win_info->generic.content != NULL) { - freeDataContent ( - winInfo->detail.dataDisplayInfo.regsContent, - winInfo->detail.dataDisplayInfo.regsContentCount); - winInfo->detail.dataDisplayInfo.regsContent = - (TuiWinContent) NULL; - winInfo->detail.dataDisplayInfo.regsContentCount = 0; - freeDataContent ( - winInfo->detail.dataDisplayInfo.dataContent, - winInfo->detail.dataDisplayInfo.dataContentCount); - winInfo->detail.dataDisplayInfo.dataContent = - (TuiWinContent) NULL; - winInfo->detail.dataDisplayInfo.dataContentCount = 0; - winInfo->detail.dataDisplayInfo.regsDisplayType = + tui_free_data_content (win_info->detail.data_display_info.regs_content, + win_info->detail.data_display_info.regs_content_count); + win_info->detail.data_display_info.regs_content = + (tui_win_content) NULL; + win_info->detail.data_display_info.regs_content_count = 0; + tui_free_data_content (win_info->detail.data_display_info.data_content, + win_info->detail.data_display_info.data_content_count); + win_info->detail.data_display_info.data_content = + (tui_win_content) NULL; + win_info->detail.data_display_info.data_content_count = 0; + win_info->detail.data_display_info.regs_display_type = TUI_UNDEFINED_REGS; - winInfo->detail.dataDisplayInfo.regsColumnCount = 1; - winInfo->detail.dataDisplayInfo.displayRegs = FALSE; - winInfo->generic.content = (OpaquePtr) NULL; - winInfo->generic.contentSize = 0; + win_info->detail.data_display_info.regs_column_count = 1; + win_info->detail.data_display_info.display_regs = FALSE; + win_info->generic.content = NULL; + win_info->generic.content_size = 0; } break; default: break; } - if (winInfo->generic.handle != (WINDOW *) NULL) + if (win_info->generic.handle != (WINDOW *) NULL) { - tuiDelwin (winInfo->generic.handle); - winInfo->generic.handle = (WINDOW *) NULL; - freeWinContent (&winInfo->generic); + tui_delete_win (win_info->generic.handle); + win_info->generic.handle = (WINDOW *) NULL; + tui_free_win_content (&win_info->generic); } - if (winInfo->generic.title) - xfree (winInfo->generic.title); - xfree (winInfo); + if (win_info->generic.title) + xfree (win_info->generic.title); + xfree (win_info); } -/* - ** freeAllSourceWinsContent(). - */ void -freeAllSourceWinsContent (void) +tui_free_all_source_wins_content (void) { int i; - for (i = 0; i < (sourceWindows ())->count; i++) + for (i = 0; i < (tui_source_windows ())->count; i++) { - TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; + struct tui_win_info * win_info = (struct tui_win_info *) (tui_source_windows ())->list[i]; - if (m_winPtrNotNull (winInfo)) + if (win_info != NULL) { - freeWinContent (&(winInfo->generic)); - freeWinContent (winInfo->detail.sourceInfo.executionInfo); + tui_free_win_content (&(win_info->generic)); + tui_free_win_content (win_info->detail.source_info.execution_info); } } - - return; -} /* freeAllSourceWinsContent */ +} -/* - ** freeWinContent(). - */ void -freeWinContent (TuiGenWinInfoPtr winInfo) +tui_free_win_content (struct tui_gen_win_info * win_info) { - if (winInfo->content != (OpaquePtr) NULL) + if (win_info->content != NULL) { - freeContent ((TuiWinContent) winInfo->content, - winInfo->contentSize, - winInfo->type); - winInfo->content = (OpaquePtr) NULL; + free_content ((tui_win_content) win_info->content, + win_info->content_size, + win_info->type); + win_info->content = NULL; } - winInfo->contentSize = 0; - - return; -} /* freeWinContent */ + win_info->content_size = 0; +} void -tuiDelDataWindows (TuiWinContent content, int contentSize) +tui_del_data_windows (tui_win_content content, int content_size) { int i; /* - ** Remember that data window content elements are of type TuiGenWinInfoPtr, + ** Remember that data window content elements are of type struct tui_gen_win_info *, ** each of which whose single element is a data element. */ - for (i = 0; i < contentSize; i++) + for (i = 0; i < content_size; i++) { - TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow; + struct tui_gen_win_info * generic_win = &content[i]->which_element.data_window; - if (genericWin != (TuiGenWinInfoPtr) NULL) + if (generic_win != (struct tui_gen_win_info *) NULL) { - tuiDelwin (genericWin->handle); - genericWin->handle = (WINDOW *) NULL; - genericWin->isVisible = FALSE; + tui_delete_win (generic_win->handle); + generic_win->handle = (WINDOW *) NULL; + generic_win->is_visible = FALSE; } } - - return; -} /* tuiDelDataWindows */ +} void -freeDataContent (TuiWinContent content, int contentSize) +tui_free_data_content (tui_win_content content, int content_size) { int i; /* - ** Remember that data window content elements are of type TuiGenWinInfoPtr, + ** Remember that data window content elements are of type struct tui_gen_win_info *, ** each of which whose single element is a data element. */ - for (i = 0; i < contentSize; i++) + for (i = 0; i < content_size; i++) { - TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow; + struct tui_gen_win_info * generic_win = &content[i]->which_element.data_window; - if (genericWin != (TuiGenWinInfoPtr) NULL) + if (generic_win != (struct tui_gen_win_info *) NULL) { - tuiDelwin (genericWin->handle); - genericWin->handle = (WINDOW *) NULL; - freeWinContent (genericWin); + tui_delete_win (generic_win->handle); + generic_win->handle = (WINDOW *) NULL; + tui_free_win_content (generic_win); } } - freeContent (content, - contentSize, + free_content (content, + content_size, DATA_WIN); - - return; -} /* freeDataContent */ +} /********************************** @@ -981,65 +856,58 @@ freeDataContent (TuiWinContent content, int contentSize) **********************************/ -/* - ** freeContent(). - */ static void -freeContent (TuiWinContent content, int contentSize, TuiWinType winType) +free_content (tui_win_content content, int content_size, enum tui_win_type win_type) { - if (content != (TuiWinContent) NULL) + if (content != (tui_win_content) NULL) { - freeContentElements (content, contentSize, winType); - tuiFree ((char *) content); + free_content_elements (content, content_size, win_type); + xfree (content); } - - return; -} /* freeContent */ +} /* - ** freeContentElements(). + ** free_content_elements(). */ static void -freeContentElements (TuiWinContent content, int contentSize, TuiWinType type) +free_content_elements (tui_win_content content, int content_size, enum tui_win_type type) { - if (content != (TuiWinContent) NULL) + if (content != (tui_win_content) NULL) { int i; if (type == SRC_WIN || type == DISASSEM_WIN) { /* free whole source block */ - if (content[0]->whichElement.source.line != (char *) NULL) - tuiFree (content[0]->whichElement.source.line); + xfree (content[0]->which_element.source.line); } else { - for (i = 0; i < contentSize; i++) + for (i = 0; i < content_size; i++) { - TuiWinElementPtr element; + struct tui_win_element * element; element = content[i]; - if (element != (TuiWinElementPtr) NULL) + if (element != (struct tui_win_element *) NULL) { switch (type) { case DATA_WIN: - tuiFree ((char *) element); + xfree (element); break; case DATA_ITEM_WIN: /* ** Note that data elements are not allocated ** in a single block, but individually, as needed. */ - if (element->whichElement.data.type != TUI_REGISTER) - tuiFree ((char *) - element->whichElement.data.name); - tuiFree ((char *) element->whichElement.data.value); - tuiFree ((char *) element); + if (element->which_element.data.type != TUI_REGISTER) + xfree ((void *)element->which_element.data.name); + xfree (element->which_element.data.value); + xfree (element); break; case CMD_WIN: - tuiFree ((char *) element->whichElement.command.line); + xfree (element->which_element.command.line); break; default: break; @@ -1048,8 +916,6 @@ freeContentElements (TuiWinContent content, int contentSize, TuiWinType type) } } if (type != DATA_WIN && type != DATA_ITEM_WIN) - tuiFree ((char *) content[0]); /* free the element block */ + xfree (content[0]); /* free the element block */ } - - return; -} /* freeContentElements */ +} diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index ea7c786..dd8c230 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -25,29 +25,31 @@ #ifndef TUI_DATA_H #define TUI_DATA_H -#if defined (HAVE_NCURSES_H) -#include <ncurses.h> -#elif defined (HAVE_CURSES_H) -#include <curses.h> -#endif +#include "tui/tui.h" /* For enum tui_win_type. */ +#include "gdb_curses.h" /* For WINDOW. */ + +/* This is a point definition. */ +struct tui_point +{ + int x, y; +}; /* Generic window information */ - typedef struct _TuiGenWinInfo - { - WINDOW *handle; /* window handle */ - TuiWinType type; /* type of window */ - int width; /* window width */ - int height; /* window height */ - TuiPoint origin; /* origin of window */ - OpaquePtr content; /* content of window */ - int contentSize; /* Size of content (# of elements) */ - int contentInUse; /* Can it be used, or is it already used? */ - int viewportHeight; /* viewport height */ - int lastVisibleLine; /* index of last visible line */ - int isVisible; /* whether the window is visible or not */ - char* title; /* Window title to display. */ - } -TuiGenWinInfo, *TuiGenWinInfoPtr; +struct tui_gen_win_info +{ + WINDOW *handle; /* window handle */ + enum tui_win_type type; /* type of window */ + int width; /* window width */ + int height; /* window height */ + struct tui_point origin; /* origin of window */ + void **content; /* content of window */ + int content_size; /* Size of content (# of elements) */ + int content_in_use; /* Can it be used, or is it already used? */ + int viewport_height; /* viewport height */ + int last_visible_line; /* index of last visible line */ + int is_visible; /* whether the window is visible or not */ + char *title; /* Window title to display. */ +}; /* Constant definitions */ #define DEFAULT_TAB_LEN 8 @@ -95,120 +97,109 @@ TuiGenWinInfo, *TuiGenWinInfoPtr; #define TUI_GENERAL_SPECIAL_REGS_NAME "$REGS" #define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER "$regs" -/* Scroll direction enum */ -typedef enum tui_scroll_direction - { - FORWARD_SCROLL, - BACKWARD_SCROLL, - LEFT_SCROLL, - RIGHT_SCROLL - } -TuiScrollDirection, *TuiScrollDirectionPtr; +/* Scroll direction enum. */ +enum tui_scroll_direction +{ + FORWARD_SCROLL, + BACKWARD_SCROLL, + LEFT_SCROLL, + RIGHT_SCROLL +}; -/* General list struct */ -typedef struct _TuiList - { - OpaqueList list; - int count; - } -TuiList, *TuiListPtr; +/* General list struct. */ +struct tui_list +{ + void **list; + int count; +}; /* The kinds of layouts available */ -typedef enum - { - SRC_COMMAND, - DISASSEM_COMMAND, - SRC_DISASSEM_COMMAND, - SRC_DATA_COMMAND, - DISASSEM_DATA_COMMAND, - UNDEFINED_LAYOUT - } -TuiLayoutType, *TuiLayoutTypePtr; +enum tui_layout_type +{ + SRC_COMMAND, + DISASSEM_COMMAND, + SRC_DISASSEM_COMMAND, + SRC_DATA_COMMAND, + DISASSEM_DATA_COMMAND, + UNDEFINED_LAYOUT +}; /* Basic data types that can be displayed in the data window. */ -typedef enum _TuiDataType - { - TUI_REGISTER, - TUI_SCALAR, - TUI_COMPLEX, - TUI_STRUCT - } -TuiDataType, TuiDataTypePtr; +enum tui_data_type +{ + TUI_REGISTER, + TUI_SCALAR, + TUI_COMPLEX, + TUI_STRUCT +}; /* Types of register displays */ -typedef enum tui_register_display_type - { - TUI_UNDEFINED_REGS, - TUI_GENERAL_REGS, - TUI_SFLOAT_REGS, - TUI_DFLOAT_REGS, - TUI_SPECIAL_REGS, - TUI_GENERAL_AND_SPECIAL_REGS - } -TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr; +enum tui_register_display_type +{ + TUI_UNDEFINED_REGS, + TUI_GENERAL_REGS, + TUI_SFLOAT_REGS, + TUI_DFLOAT_REGS, + TUI_SPECIAL_REGS, + TUI_GENERAL_AND_SPECIAL_REGS +}; /* Structure describing source line or line address */ -typedef union _TuiLineOrAddress - { - int lineNo; - CORE_ADDR addr; - } -TuiLineOrAddress, *TuiLineOrAddressPtr; +union tui_line_or_address +{ + int line_no; + CORE_ADDR addr; +}; /* Current Layout definition */ -typedef struct _TuiLayoutDef - { - TuiWinType displayMode; - int split; - TuiRegisterDisplayType regsDisplayType; - TuiRegisterDisplayType floatRegsDisplayType; - } -TuiLayoutDef, *TuiLayoutDefPtr; +struct tui_layout_def +{ + enum tui_win_type display_mode; + int split; + enum tui_register_display_type regs_display_type; + enum tui_register_display_type float_regs_display_type; +}; /* Elements in the Source/Disassembly Window */ -typedef struct _TuiSourceElement - { - char *line; - TuiLineOrAddress lineOrAddr; - int isExecPoint; - int hasBreak; - } -TuiSourceElement, *TuiSourceElementPtr; +struct tui_source_element +{ + char *line; + union tui_line_or_address line_or_addr; + int is_exec_point; + int has_break; +}; /* Elements in the data display window content */ -typedef struct _TuiDataElement - { - const char *name; - int itemNo; /* the register number, or data display number */ - TuiDataType type; - Opaque value; - int highlight; - } -TuiDataElement, *TuiDataElementPtr; +struct tui_data_element +{ + const char *name; + int item_no; /* the register number, or data display number */ + enum tui_data_type type; + void *value; + int highlight; +}; /* Elements in the command window content */ -typedef struct _TuiCommandElement - { - char *line; - } -TuiCommandElement, *TuiCommandElementPtr; +struct tui_command_element +{ + char *line; +}; #define MAX_LOCATOR_ELEMENT_LEN 100 /* Elements in the locator window content */ -typedef struct _TuiLocatorElement - { - char fileName[MAX_LOCATOR_ELEMENT_LEN]; - char procName[MAX_LOCATOR_ELEMENT_LEN]; - int lineNo; - CORE_ADDR addr; - } -TuiLocatorElement, *TuiLocatorElementPtr; +struct tui_locator_element +{ + char file_name[MAX_LOCATOR_ELEMENT_LEN]; + char proc_name[MAX_LOCATOR_ELEMENT_LEN]; + int line_no; + CORE_ADDR addr; +}; /* Flags to tell what kind of breakpoint is at current line. */ #define TUI_BP_ENABLED 0x01 @@ -223,164 +214,136 @@ TuiLocatorElement, *TuiLocatorElementPtr; #define TUI_EXEC_POS 2 #define TUI_EXECINFO_SIZE 4 -typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE]; +typedef char tui_exec_info_content[TUI_EXECINFO_SIZE]; /* An content element in a window */ -typedef union - { - TuiSourceElement source; /* the source elements */ - TuiGenWinInfo dataWindow; /* data display elements */ - TuiDataElement data; /* elements of dataWindow */ - TuiCommandElement command; /* command elements */ - TuiLocatorElement locator; /* locator elements */ - TuiExecInfoContent simpleString; /* simple char based elements */ - } -TuiWhichElement, *TuiWhichElementPtr; - -typedef struct _TuiWinElement - { - int highlight; - TuiWhichElement whichElement; - } -TuiWinElement, *TuiWinElementPtr; +union tui_which_element +{ + struct tui_source_element source; /* the source elements */ + struct tui_gen_win_info data_window; /* data display elements */ + struct tui_data_element data; /* elements of data_window */ + struct tui_command_element command; /* command elements */ + struct tui_locator_element locator; /* locator elements */ + tui_exec_info_content simple_string; /* simple char based elements */ +}; + +struct tui_win_element +{ + int highlight; + union tui_which_element which_element; +}; /* This describes the content of the window. */ -typedef TuiWinElementPtr *TuiWinContent; +typedef struct tui_win_element **tui_win_content; /* This struct defines the specific information about a data display window */ -typedef struct _TuiDataInfo - { - TuiWinContent dataContent; /* start of data display content */ - int dataContentCount; - TuiWinContent regsContent; /* start of regs display content */ - int regsContentCount; - TuiRegisterDisplayType regsDisplayType; - int regsColumnCount; - int displayRegs; /* Should regs be displayed at all? */ - } -TuiDataInfo, *TuiDataInfoPtr; - - -typedef struct _TuiSourceInfo - { - int hasLocator; /* Does locator belongs to this window? */ - TuiGenWinInfoPtr executionInfo; /* execution information window */ - int horizontalOffset; /* used for horizontal scroll */ - TuiLineOrAddress startLineOrAddr; - char* filename; - } -TuiSourceInfo, *TuiSourceInfoPtr; - - -typedef struct _TuiCommandInfo - { - int curLine; /* The current line position */ - int curch; /* The current cursor position */ - int start_line; - } -TuiCommandInfo, *TuiCommandInfoPtr; +struct tui_data_info +{ + tui_win_content data_content; /* start of data display content */ + int data_content_count; + tui_win_content regs_content; /* start of regs display content */ + int regs_content_count; + enum tui_register_display_type regs_display_type; + int regs_column_count; + int display_regs; /* Should regs be displayed at all? */ +}; + + +struct tui_source_info +{ + int has_locator; /* Does locator belongs to this window? */ + /* Execution information window. */ + struct tui_gen_win_info *execution_info; + int horizontal_offset; /* used for horizontal scroll */ + union tui_line_or_address start_line_or_addr; + char* filename; +}; + + +struct tui_command_info +{ + int cur_line; /* The current line position */ + int curch; /* The current cursor position */ + int start_line; +}; /* This defines information about each logical window */ -typedef struct _TuiWinInfo +struct tui_win_info +{ + struct tui_gen_win_info generic; /* general window information */ + union { - TuiGenWinInfo generic; /* general window information */ - union - { - TuiSourceInfo sourceInfo; - TuiDataInfo dataDisplayInfo; - TuiCommandInfo commandInfo; - Opaque opaque; - } - detail; - int canHighlight; /* Can this window ever be highlighted? */ - int isHighlighted; /* Is this window highlighted? */ + struct tui_source_info source_info; + struct tui_data_info data_display_info; + struct tui_command_info command_info; + void *opaque; } -TuiWinInfo, *TuiWinInfoPtr; - -/* MACROS (prefixed with m_) */ - -/* Testing macros */ -#define m_genWinPtrIsNull(winInfo) \ - ((winInfo) == (TuiGenWinInfoPtr)NULL) -#define m_genWinPtrNotNull(winInfo) \ - ((winInfo) != (TuiGenWinInfoPtr)NULL) -#define m_winPtrIsNull(winInfo) \ - ((winInfo) == (TuiWinInfoPtr)NULL) -#define m_winPtrNotNull(winInfo) \ - ((winInfo) != (TuiWinInfoPtr)NULL) - -#define m_winIsSourceType(type) \ - (type == SRC_WIN || type == DISASSEM_WIN) -#define m_winIsAuxillary(winType) \ - (winType > MAX_MAJOR_WINDOWS) -#define m_hasLocator(winInfo) \ - ( ((winInfo) != (TuiWinInfoPtr)NULL) ? \ - (winInfo->detail.sourceInfo.hasLocator) : \ - FALSE ) - -#define m_setWinHighlightOn(winInfo) \ - if ((winInfo) != (TuiWinInfoPtr)NULL) \ - (winInfo)->isHighlighted = TRUE -#define m_setWinHighlightOff(winInfo) \ - if ((winInfo) != (TuiWinInfoPtr)NULL) \ - (winInfo)->isHighlighted = FALSE + detail; + int can_highlight; /* Can this window ever be highlighted? */ + int is_highlighted; /* Is this window highlighted? */ +}; + +extern int tui_win_is_source_type (enum tui_win_type win_type); +extern int tui_win_is_auxillary (enum tui_win_type win_type); +extern int tui_win_has_locator (struct tui_win_info *win_info); +extern void tui_set_win_highlight (struct tui_win_info *win_info, + int highlight); /* Global Data */ -extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS]; +extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]); -/* Macros */ -#define srcWin winList[SRC_WIN] -#define disassemWin winList[DISASSEM_WIN] -#define dataWin winList[DATA_WIN] -#define cmdWin winList[CMD_WIN] +#define TUI_SRC_WIN tui_win_list[SRC_WIN] +#define TUI_DISASM_WIN tui_win_list[DISASSEM_WIN] +#define TUI_DATA_WIN tui_win_list[DATA_WIN] +#define TUI_CMD_WIN tui_win_list[CMD_WIN] /* Data Manipulation Functions */ -extern void initializeStaticData (void); -extern TuiGenWinInfoPtr allocGenericWinInfo (void); -extern TuiWinInfoPtr allocWinInfo (TuiWinType); -extern void initGenericPart (TuiGenWinInfoPtr); -extern void initWinInfo (TuiWinInfoPtr); -extern TuiWinContent allocContent (int, TuiWinType); -extern int addContentElements (TuiGenWinInfoPtr, int); -extern void initContentElement (TuiWinElementPtr, TuiWinType); -extern void freeWindow (TuiWinInfoPtr); -extern void freeWinContent (TuiGenWinInfoPtr); -extern void freeDataContent (TuiWinContent, int); -extern void freeAllSourceWinsContent (void); -extern void tuiDelWindow (TuiWinInfoPtr); -extern void tuiDelDataWindows (TuiWinContent, int); -extern TuiWinInfoPtr partialWinByName (char *); -extern char *winName (TuiGenWinInfoPtr); -extern TuiLayoutType currentLayout (void); -extern void setCurrentLayoutTo (TuiLayoutType); -extern int termHeight (void); -extern void setTermHeightTo (int); -extern int termWidth (void); -extern void setTermWidthTo (int); -extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int); -extern TuiGenWinInfoPtr locatorWinInfoPtr (void); -extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void); -extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void); -extern TuiListPtr sourceWindows (void); -extern void clearSourceWindows (void); -extern void clearSourceWindowsDetail (void); -extern void clearWinDetail (TuiWinInfoPtr winInfo); -extern void tuiAddToSourceWindows (TuiWinInfoPtr); -extern int tuiDefaultTabLen (void); -extern void tuiSetDefaultTabLen (int); -extern TuiWinInfoPtr tuiWinWithFocus (void); -extern void tuiSetWinWithFocus (TuiWinInfoPtr); -extern TuiLayoutDefPtr tuiLayoutDef (void); -extern int tuiWinResized (void); -extern void tuiSetWinResizedTo (int); - -extern TuiWinInfoPtr tuiNextWin (TuiWinInfoPtr); -extern TuiWinInfoPtr tuiPrevWin (TuiWinInfoPtr); - -extern void addToSourceWindows (TuiWinInfoPtr winInfo); +extern void tui_initialize_static_data (void); +extern struct tui_gen_win_info *tui_alloc_generic_win_info (void); +extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type); +extern void tui_init_generic_part (struct tui_gen_win_info *); +extern void tui_init_win_info (struct tui_win_info *); +extern tui_win_content tui_alloc_content (int, enum tui_win_type); +extern int tui_add_content_elements (struct tui_gen_win_info *, int); +extern void tui_init_content_element (struct tui_win_element *, enum tui_win_type); +extern void tui_free_window (struct tui_win_info *); +extern void tui_free_win_content (struct tui_gen_win_info *); +extern void tui_free_data_content (tui_win_content, int); +extern void tui_free_all_source_wins_content (void); +extern void tui_del_window (struct tui_win_info *); +extern void tui_del_data_windows (tui_win_content, int); +extern struct tui_win_info *tui_partial_win_by_name (char *); +extern char *tui_win_name (struct tui_gen_win_info *); +extern enum tui_layout_type tui_current_layout (void); +extern void tui_set_current_layout_to (enum tui_layout_type); +extern int tui_term_height (void); +extern void tui_set_term_height_to (int); +extern int tui_term_width (void); +extern void tui_set_term_width_to (int); +extern void tui_set_gen_win_origin (struct tui_gen_win_info *, int, int); +extern struct tui_gen_win_info *tui_locator_win_info_ptr (void); +extern struct tui_gen_win_info *tui_source_exec_info_win_ptr (void); +extern struct tui_gen_win_info *tui_disassem_exec_info_win_ptr (void); +extern struct tui_list * tui_source_windows (void); +extern void tui_clear_source_windows (void); +extern void tui_clear_source_windows_detail (void); +extern void tui_clear_win_detail (struct tui_win_info * win_info); +extern void tui_add_to_source_windows (struct tui_win_info *); +extern int tui_default_tab_len (void); +extern void tui_set_default_tab_len (int); +extern struct tui_win_info *tui_win_with_focus (void); +extern void tui_set_win_with_focus (struct tui_win_info *); +extern struct tui_layout_def * tui_layout_def (void); +extern int tui_win_resized (void); +extern void tui_set_win_resized_to (int); + +extern struct tui_win_info *tui_next_win (struct tui_win_info *); +extern struct tui_win_info *tui_prev_win (struct tui_win_info *); + +extern void tui_add_to_source_windows (struct tui_win_info * win_info); #endif /* TUI_DATA_H */ diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 99143a4..19226b3 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -29,7 +29,7 @@ #include "value.h" #include "source.h" #include "disasm.h" - +#include "gdb_string.h" #include "tui/tui.h" #include "tui/tui-data.h" #include "tui/tui-win.h" @@ -38,13 +38,7 @@ #include "tui/tui-stack.h" #include "tui/tui-file.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" struct tui_asm_line { @@ -95,24 +89,24 @@ tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count) static CORE_ADDR tui_find_disassembly_address (CORE_ADDR pc, int from) { - register CORE_ADDR newLow; - int maxLines; + CORE_ADDR new_low; + int max_lines; int i; struct tui_asm_line* lines; - maxLines = (from > 0) ? from : - from; - if (maxLines <= 1) + max_lines = (from > 0) ? from : - from; + if (max_lines <= 1) return pc; lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line) - * maxLines); - memset (lines, 0, sizeof (struct tui_asm_line) * maxLines); + * max_lines); + memset (lines, 0, sizeof (struct tui_asm_line) * max_lines); - newLow = pc; + new_low = pc; if (from > 0) { - tui_disassemble (lines, pc, maxLines); - newLow = lines[maxLines - 1].addr; + tui_disassemble (lines, pc, max_lines); + new_low = lines[max_lines - 1].addr; } else { @@ -123,17 +117,17 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) /* Find backward an address which is a symbol and for which disassembling from that address will fill completely the window. */ - pos = maxLines - 1; + pos = max_lines - 1; do { - newLow -= 1 * maxLines; - msymbol = lookup_minimal_symbol_by_pc_section (newLow, 0); + new_low -= 1 * max_lines; + msymbol = lookup_minimal_symbol_by_pc_section (new_low, 0); if (msymbol) - newLow = SYMBOL_VALUE_ADDRESS (msymbol); + new_low = SYMBOL_VALUE_ADDRESS (msymbol); else - newLow += 1 * maxLines; + new_low += 1 * max_lines; - tui_disassemble (lines, newLow, maxLines); + tui_disassemble (lines, new_low, max_lines); last_addr = lines[pos].addr; } while (last_addr > pc && msymbol); @@ -148,7 +142,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) CORE_ADDR next_addr; pos++; - if (pos >= maxLines) + if (pos >= max_lines) pos = 0; next_addr = tui_disassemble (&lines[pos], last_addr, 1); @@ -159,29 +153,29 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) last_addr = next_addr; } while (last_addr <= pc); pos++; - if (pos >= maxLines) + if (pos >= max_lines) pos = 0; - newLow = lines[pos].addr; + new_low = lines[pos].addr; } - for (i = 0; i < maxLines; i++) + for (i = 0; i < max_lines; i++) { xfree (lines[i].addr_string); xfree (lines[i].insn); } - return newLow; + return new_low; } /* Function to set the disassembly window's content. */ enum tui_status tui_set_disassem_content (CORE_ADDR pc) { - TuiStatus ret = TUI_FAILURE; - register int i; - register int offset = disassemWin->detail.sourceInfo.horizontalOffset; - register int lineWidth, maxLines; + enum tui_status ret = TUI_FAILURE; + int i; + int offset = TUI_DISASM_WIN->detail.source_info.horizontal_offset; + int line_width, max_lines; CORE_ADDR cur_pc; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - int tab_len = tuiDefaultTabLen (); + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + int tab_len = tui_default_tab_len (); struct tui_asm_line* lines; int insn_pos; int addr_size, max_size; @@ -190,29 +184,29 @@ tui_set_disassem_content (CORE_ADDR pc) if (pc == 0) return TUI_FAILURE; - ret = tuiAllocSourceBuffer (disassemWin); + ret = tui_alloc_source_buffer (TUI_DISASM_WIN); if (ret != TUI_SUCCESS) return ret; - disassemWin->detail.sourceInfo.startLineOrAddr.addr = pc; + TUI_DISASM_WIN->detail.source_info.start_line_or_addr.addr = pc; cur_pc = (CORE_ADDR) - (((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr); + (((struct tui_win_element *) locator->content[0])->which_element.locator.addr); - maxLines = disassemWin->generic.height - 2; /* account for hilite */ + max_lines = TUI_DISASM_WIN->generic.height - 2; /* account for hilite */ /* Get temporary table that will hold all strings (addr & insn). */ lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line) - * maxLines); - memset (lines, 0, sizeof (struct tui_asm_line) * maxLines); + * max_lines); + memset (lines, 0, sizeof (struct tui_asm_line) * max_lines); - lineWidth = disassemWin->generic.width - 1; + line_width = TUI_DISASM_WIN->generic.width - 1; - tui_disassemble (lines, pc, maxLines); + tui_disassemble (lines, pc, max_lines); /* See what is the maximum length of an address and of a line. */ addr_size = 0; max_size = 0; - for (i = 0; i < maxLines; i++) + for (i = 0; i < max_lines; i++) { size_t len = strlen (lines[i].addr_string); if (len > addr_size) @@ -229,22 +223,22 @@ tui_set_disassem_content (CORE_ADDR pc) insn_pos = (1 + (addr_size / tab_len)) * tab_len; /* Now construct each line */ - for (i = 0; i < maxLines; i++) + for (i = 0; i < max_lines; i++) { - TuiWinElementPtr element; - TuiSourceElement* src; - int curLen; + struct tui_win_element * element; + struct tui_source_element* src; + int cur_len; - element = (TuiWinElementPtr) disassemWin->generic.content[i]; - src = &element->whichElement.source; + element = (struct tui_win_element *) TUI_DISASM_WIN->generic.content[i]; + src = &element->which_element.source; strcpy (line, lines[i].addr_string); - curLen = strlen (line); + cur_len = strlen (line); /* Add spaces to make the instructions start on the same column */ - while (curLen < insn_pos) + while (cur_len < insn_pos) { strcat (line, " "); - curLen++; + cur_len++; } strcat (line, lines[i].insn); @@ -255,38 +249,38 @@ tui_set_disassem_content (CORE_ADDR pc) else src->line[0] = '\0'; - src->lineOrAddr.addr = lines[i].addr; - src->isExecPoint = lines[i].addr == cur_pc; + src->line_or_addr.addr = lines[i].addr; + src->is_exec_point = lines[i].addr == cur_pc; /* See whether there is a breakpoint installed. */ - src->hasBreak = (!src->isExecPoint + src->has_break = (!src->is_exec_point && breakpoint_here_p (pc) != no_breakpoint_here); xfree (lines[i].addr_string); xfree (lines[i].insn); } - disassemWin->generic.contentSize = i; + TUI_DISASM_WIN->generic.content_size = i; return TUI_SUCCESS; } /* Function to display the disassembly window with disassembled code. */ void -tui_show_disassem (CORE_ADDR startAddr) +tui_show_disassem (CORE_ADDR start_addr) { - struct symtab *s = find_pc_symtab (startAddr); - TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); - TuiLineOrAddress val; + struct symtab *s = find_pc_symtab (start_addr); + struct tui_win_info * win_with_focus = tui_win_with_focus (); + union tui_line_or_address val; - val.addr = startAddr; - tuiAddWinToLayout (DISASSEM_WIN); - tuiUpdateSourceWindow (disassemWin, s, val, FALSE); + val.addr = start_addr; + tui_add_win_to_layout (DISASSEM_WIN); + tui_update_source_window (TUI_DISASM_WIN, s, val, FALSE); /* ** if the focus was in the src win, put it in the asm win, if the ** source view isn't split */ - if (currentLayout () != SRC_DISASSEM_COMMAND && winWithFocus == srcWin) - tuiSetWinFocusTo (disassemWin); + if (tui_current_layout () != SRC_DISASSEM_COMMAND && win_with_focus == TUI_SRC_WIN) + tui_set_win_focus_to (TUI_DISASM_WIN); return; } @@ -294,29 +288,29 @@ tui_show_disassem (CORE_ADDR startAddr) /* Function to display the disassembly window. */ void -tui_show_disassem_and_update_source (CORE_ADDR startAddr) +tui_show_disassem_and_update_source (CORE_ADDR start_addr) { struct symtab_and_line sal; - tui_show_disassem (startAddr); - if (currentLayout () == SRC_DISASSEM_COMMAND) + tui_show_disassem (start_addr); + if (tui_current_layout () == SRC_DISASSEM_COMMAND) { - TuiLineOrAddress val; + union tui_line_or_address val; /* ** Update what is in the source window if it is displayed too, ** note that it follows what is in the disassembly window and visa-versa */ - sal = find_pc_line (startAddr, 0); - val.lineNo = sal.line; - tuiUpdateSourceWindow (srcWin, sal.symtab, val, TRUE); + sal = find_pc_line (start_addr, 0); + val.line_no = sal.line; + tui_update_source_window (TUI_SRC_WIN, sal.symtab, val, TRUE); if (sal.symtab) { set_current_source_symtab_and_line (&sal); - tuiUpdateLocatorFilename (sal.symtab->filename); + tui_update_locator_filename (sal.symtab->filename); } else - tuiUpdateLocatorFilename ("?"); + tui_update_locator_filename ("?"); } return; @@ -325,12 +319,12 @@ tui_show_disassem_and_update_source (CORE_ADDR startAddr) CORE_ADDR tui_get_begin_asm_address (void) { - TuiGenWinInfoPtr locator; - TuiLocatorElementPtr element; + struct tui_gen_win_info * locator; + struct tui_locator_element * element; CORE_ADDR addr; - locator = locatorWinInfoPtr (); - element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator; + locator = tui_locator_win_info_ptr (); + element = &((struct tui_win_element *) locator->content[0])->which_element.locator; if (element->addr == 0) { @@ -358,13 +352,13 @@ tui_get_begin_asm_address (void) disassembly window. This may or may not be the same as the low address input. */ CORE_ADDR -tuiGetLowDisassemblyAddress (CORE_ADDR low, CORE_ADDR pc) +tui_get_low_disassembly_address (CORE_ADDR low, CORE_ADDR pc) { int pos; /* Determine where to start the disassembly so that the pc is about in the middle of the viewport. */ - pos = tuiDefaultWinViewportHeight (DISASSEM_WIN, DISASSEM_COMMAND) / 2; + pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2; pc = tui_find_disassembly_address (pc, -pos); if (pc < low) @@ -374,30 +368,30 @@ tuiGetLowDisassemblyAddress (CORE_ADDR low, CORE_ADDR pc) /* Scroll the disassembly forward or backward vertically. */ void -tui_vertical_disassem_scroll (enum tui_scroll_direction scrollDirection, - int numToScroll) +tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction, + int num_to_scroll) { - if (disassemWin->generic.content != (OpaquePtr) NULL) + if (TUI_DISASM_WIN->generic.content != NULL) { CORE_ADDR pc; - TuiWinContent content; + tui_win_content content; struct symtab *s; - TuiLineOrAddress val; - int maxLines, dir; + union tui_line_or_address val; + int max_lines, dir; struct symtab_and_line cursal = get_current_source_symtab_and_line (); - content = (TuiWinContent) disassemWin->generic.content; + content = (tui_win_content) TUI_DISASM_WIN->generic.content; if (cursal.symtab == (struct symtab *) NULL) s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); else s = cursal.symtab; /* account for hilite */ - maxLines = disassemWin->generic.height - 2; - pc = content[0]->whichElement.source.lineOrAddr.addr; - dir = (scrollDirection == FORWARD_SCROLL) ? maxLines : - maxLines; + max_lines = TUI_DISASM_WIN->generic.height - 2; + pc = content[0]->which_element.source.line_or_addr.addr; + dir = (scroll_direction == FORWARD_SCROLL) ? max_lines : - max_lines; val.addr = tui_find_disassembly_address (pc, dir); - tuiUpdateSourceWindowAsIs (disassemWin, s, val, FALSE); + tui_update_source_window_as_is (TUI_DISASM_WIN, s, val, FALSE); } } diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c index 36fc097..5d2740e 100644 --- a/gdb/tui/tui-file.c +++ b/gdb/tui/tui-file.c @@ -25,7 +25,7 @@ #include "tui.h" -#include <string.h> +#include "gdb_string.h" /* A ``struct ui_file'' that is compatible with all the legacy code. */ diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index f0f2060..fbdf5bf 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -1,6 +1,6 @@ /* GDB hooks for TUI. - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -40,6 +40,7 @@ #include <fcntl.h> #include "tui/tui.h" +#include "tui/tui-hooks.h" #include "tui/tui-data.h" #include "tui/tui-layout.h" #include "tui/tui-io.h" @@ -49,13 +50,7 @@ #include "tui/tui-windata.h" #include "tui/tui-winsource.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" int tui_target_has_run = 0; @@ -141,7 +136,7 @@ tui_registers_changed_hook (void) { tui_refreshing_registers = 1; #if 0 - tuiCheckDataValues (fi); + tui_check_data_values (fi); #endif tui_refreshing_registers = 0; } @@ -156,7 +151,7 @@ tui_register_changed_hook (int regno) if (fi && tui_refreshing_registers == 0) { tui_refreshing_registers = 1; - tuiCheckDataValues (fi); + tui_check_data_values (fi); tui_refreshing_registers = 0; } } @@ -250,13 +245,13 @@ tui_selected_frame_level_changed_hook (int level) select_source_symtab (s); /* Display the frame position (even if there is no symbols). */ - tuiShowFrameInfo (fi); + tui_show_frame_info (fi); /* Refresh the register window if it's visible. */ if (tui_is_window_visible (DATA_WIN)) { tui_refreshing_registers = 1; - tuiCheckDataValues (fi); + tui_check_data_values (fi); tui_refreshing_registers = 0; } } @@ -268,7 +263,7 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line, int stopline, int noerror) { select_source_symtab (s); - tuiShowFrameInfo (deprecated_selected_frame); + tui_show_frame_info (deprecated_selected_frame); } /* Called when the target process died or is detached. @@ -276,7 +271,7 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line, static void tui_detach_hook (void) { - tuiShowFrameInfo (0); + tui_show_frame_info (0); tui_display_main (); } diff --git a/gdb/tui/tui-hooks.h b/gdb/tui/tui-hooks.h new file mode 100644 index 0000000..fa1137d --- /dev/null +++ b/gdb/tui/tui-hooks.h @@ -0,0 +1,28 @@ +/* External/Public TUI hools header file, for GDB the GNU debugger. + + Copyright 2004 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 TUI_HOOKS_H +#define TUI_HOOKS_H + +extern void tui_install_hooks (void); +extern void tui_remove_hooks (void); + +#endif diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index 82b4dcd..1e1d643 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -53,7 +53,7 @@ tui_init (void) /* Install exit handler to leave the screen in a good shape. */ atexit (tui_exit); - initializeStaticData (); + tui_initialize_static_data (); tui_initialize_io (); tui_initialize_readline (); diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 61b1f93..addb3b0 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -43,13 +43,7 @@ #include <signal.h> #include <stdio.h> -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" int key_is_start_sequence (int ch) @@ -147,7 +141,7 @@ static int tui_readline_pipe[2]; This may be the main gdb prompt or a secondary prompt. */ static char *tui_rl_saved_prompt; -static unsigned int _tuiHandleResizeDuringIO (unsigned int); +static unsigned int tui_handle_resize_during_io (unsigned int); static void tui_putc (char c) @@ -167,7 +161,7 @@ tui_puts (const char *string) char c; WINDOW *w; - w = cmdWin->generic.handle; + w = TUI_CMD_WIN->generic.handle; while ((c = *string++) != 0) { /* Catch annotation and discard them. We need two \032 and @@ -184,9 +178,9 @@ tui_puts (const char *string) else if (c == '\n') tui_skip_line = -1; } - getyx (w, cmdWin->detail.commandInfo.curLine, - cmdWin->detail.commandInfo.curch); - cmdWin->detail.commandInfo.start_line = cmdWin->detail.commandInfo.curLine; + getyx (w, TUI_CMD_WIN->detail.command_info.cur_line, + TUI_CMD_WIN->detail.command_info.curch); + TUI_CMD_WIN->detail.command_info.start_line = TUI_CMD_WIN->detail.command_info.cur_line; /* We could defer the following. */ wrefresh (w); @@ -211,18 +205,18 @@ tui_redisplay_readline (void) /* Detect when we temporarily left SingleKey and now the readline edit buffer is empty, automatically restore the SingleKey mode. */ - if (tui_current_key_mode == tui_one_command_mode && rl_end == 0) - tui_set_key_mode (tui_single_key_mode); + if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0) + tui_set_key_mode (TUI_SINGLE_KEY_MODE); - if (tui_current_key_mode == tui_single_key_mode) + if (tui_current_key_mode == TUI_SINGLE_KEY_MODE) prompt = ""; else prompt = tui_rl_saved_prompt; c_pos = -1; c_line = -1; - w = cmdWin->generic.handle; - start_line = cmdWin->detail.commandInfo.start_line; + w = TUI_CMD_WIN->generic.handle; + start_line = TUI_CMD_WIN->detail.command_info.start_line; wmove (w, start_line, 0); prev_col = 0; height = 1; @@ -255,8 +249,8 @@ tui_redisplay_readline (void) } if (c == '\n') { - getyx (w, cmdWin->detail.commandInfo.start_line, - cmdWin->detail.commandInfo.curch); + getyx (w, TUI_CMD_WIN->detail.command_info.start_line, + TUI_CMD_WIN->detail.command_info.curch); } getyx (w, line, col); if (col < prev_col) @@ -264,15 +258,15 @@ tui_redisplay_readline (void) prev_col = col; } wclrtobot (w); - getyx (w, cmdWin->detail.commandInfo.start_line, - cmdWin->detail.commandInfo.curch); + getyx (w, TUI_CMD_WIN->detail.command_info.start_line, + TUI_CMD_WIN->detail.command_info.curch); if (c_line >= 0) { wmove (w, c_line, c_pos); - cmdWin->detail.commandInfo.curLine = c_line; - cmdWin->detail.commandInfo.curch = c_pos; + TUI_CMD_WIN->detail.command_info.cur_line = c_line; + TUI_CMD_WIN->detail.command_info.curch = c_pos; } - cmdWin->detail.commandInfo.start_line -= height - 1; + TUI_CMD_WIN->detail.command_info.start_line -= height - 1; wrefresh (w); fflush(stdout); @@ -322,8 +316,7 @@ tui_readline_output (int code, gdb_client_data data) Comes from readline/complete.c */ static char * -printable_part (pathname) - char *pathname; +printable_part (char *pathname) { char *temp; @@ -360,8 +353,7 @@ printable_part (pathname) } while (0) static int -print_filename (to_print, full_pathname) - char *to_print, *full_pathname; +print_filename (char *to_print, char *full_pathname) { int printed_len = 0; char *s; @@ -376,7 +368,7 @@ print_filename (to_print, full_pathname) /* The user must press "y" or "n". Non-zero return means "y" pressed. Comes from readline/complete.c */ static int -get_y_or_n () +get_y_or_n (void) { extern int _rl_abort_internal (); int c; @@ -402,9 +394,7 @@ get_y_or_n () Comes from readline/complete.c and modified to write in the TUI command window using tui_putc/tui_puts. */ static void -tui_rl_display_match_list (matches, len, max) - char **matches; - int len, max; +tui_rl_display_match_list (char **matches, int len, int max) { typedef int QSFUNC (const void *, const void *); extern int _rl_qsort_string_compare (const void*, const void*); @@ -415,7 +405,7 @@ tui_rl_display_match_list (matches, len, max) char *temp; /* Screen dimension correspond to the TUI command window. */ - int screenwidth = cmdWin->generic.width; + int screenwidth = TUI_CMD_WIN->generic.width; /* If there are many items, then ask the user if she really wants to see them all. */ @@ -584,13 +574,13 @@ tui_cont_sig (int sig) resetty (); /* Force a refresh of the screen. */ - tuiRefreshAll (); + tui_refresh_all_win (); /* Update cursor position on the screen. */ - wmove (cmdWin->generic.handle, - cmdWin->detail.commandInfo.start_line, - cmdWin->detail.commandInfo.curch); - wrefresh (cmdWin->generic.handle); + wmove (TUI_CMD_WIN->generic.handle, + TUI_CMD_WIN->detail.command_info.start_line, + TUI_CMD_WIN->detail.command_info.curch); + wrefresh (TUI_CMD_WIN->generic.handle); } signal (sig, tui_cont_sig); } @@ -598,7 +588,7 @@ tui_cont_sig (int sig) /* Initialize the IO for gdb in curses mode. */ void -tui_initialize_io () +tui_initialize_io (void) { #ifdef SIGCONT signal (SIGCONT, tui_cont_sig); @@ -651,7 +641,7 @@ tui_getc (FILE *fp) int ch; WINDOW *w; - w = cmdWin->generic.handle; + w = TUI_CMD_WIN->generic.handle; #ifdef TUI_USE_PIPE_FOR_READLINE /* Flush readline output. */ @@ -659,7 +649,7 @@ tui_getc (FILE *fp) #endif ch = wgetch (w); - ch = _tuiHandleResizeDuringIO (ch); + ch = tui_handle_resize_during_io (ch); /* The \n must be echoed because it will not be printed by readline. */ if (ch == '\n') @@ -671,7 +661,7 @@ tui_getc (FILE *fp) user we recognized the command. */ if (rl_end == 0) { - wmove (w, cmdWin->detail.commandInfo.curLine, 0); + wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, 0); /* Clear the line. This will blink the gdb prompt since it will be redrawn at the same line. */ @@ -681,8 +671,8 @@ tui_getc (FILE *fp) } else { - wmove (w, cmdWin->detail.commandInfo.curLine, - cmdWin->detail.commandInfo.curch); + wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, + TUI_CMD_WIN->detail.command_info.curch); waddch (w, ch); } } @@ -693,11 +683,7 @@ tui_getc (FILE *fp) } if (ch == '\n' || ch == '\r' || ch == '\f') - cmdWin->detail.commandInfo.curch = 0; -#if 0 - else - tuiIncrCommandCharCountBy (1); -#endif + TUI_CMD_WIN->detail.command_info.curch = 0; if (ch == KEY_BACKSPACE) return '\b'; @@ -708,15 +694,15 @@ tui_getc (FILE *fp) /* Cleanup when a resize has occured. Returns the character that must be processed. */ static unsigned int -_tuiHandleResizeDuringIO (unsigned int originalCh) +tui_handle_resize_during_io (unsigned int original_ch) { - if (tuiWinResized ()) + if (tui_win_resized ()) { - tuiRefreshAll (); + tui_refresh_all_win (); dont_repeat (); - tuiSetWinResizedTo (FALSE); + tui_set_win_resized_to (FALSE); return '\n'; } else - return originalCh; + return original_ch; } diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index e4093c1..4e3de8f 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -39,37 +39,31 @@ #include "tui/tui-winsource.h" #include "tui/tui-disasm.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /******************************* ** Static Local Decls ********************************/ -static void showLayout (TuiLayoutType); -static void _initGenWinInfo (TuiGenWinInfoPtr, TuiWinType, int, int, int, int); -static void _initAndMakeWin (Opaque *, TuiWinType, int, int, int, int, int); -static void _showSourceOrDisassemAndCommand (TuiLayoutType); -static void _makeSourceOrDisassemWindow (TuiWinInfoPtr *, TuiWinType, int, int); -static void _makeCommandWindow (TuiWinInfoPtr *, int, int); -static void _makeSourceWindow (TuiWinInfoPtr *, int, int); -static void _makeDisassemWindow (TuiWinInfoPtr *, int, int); -static void _makeDataWindow (TuiWinInfoPtr *, int, int); -static void _showSourceCommand (void); -static void _showDisassemCommand (void); -static void _showSourceDisassemCommand (void); -static void _showData (TuiLayoutType); -static TuiLayoutType _nextLayout (void); -static TuiLayoutType _prevLayout (void); -static void _tuiLayout_command (char *, int); -static void _tuiToggleLayout_command (char *, int); -static void _tuiToggleSplitLayout_command (char *, int); -static CORE_ADDR _extractDisplayStartAddr (void); -static void _tuiHandleXDBLayout (TuiLayoutDefPtr); +static void show_layout (enum tui_layout_type); +static void init_gen_win_info (struct tui_gen_win_info *, enum tui_win_type, int, int, int, int); +static void init_and_make_win (void **, enum tui_win_type, int, int, int, int, int); +static void show_source_or_disasm_and_command (enum tui_layout_type); +static void make_source_or_disasm_window (struct tui_win_info * *, enum tui_win_type, int, int); +static void make_command_window (struct tui_win_info * *, int, int); +static void make_source_window (struct tui_win_info * *, int, int); +static void make_disasm_window (struct tui_win_info * *, int, int); +static void make_data_window (struct tui_win_info * *, int, int); +static void show_source_command (void); +static void show_disasm_command (void); +static void show_source_disasm_command (void); +static void show_data (enum tui_layout_type); +static enum tui_layout_type next_layout (void); +static enum tui_layout_type prev_layout (void); +static void tui_layout_command (char *, int); +static void tui_toggle_layout_command (char *, int); +static void tui_toggle_split_layout_command (char *, int); +static CORE_ADDR extract_display_start_addr (void); +static void tui_handle_xdb_layout (struct tui_layout_def *); /*************************************** @@ -80,45 +74,45 @@ static void _tuiHandleXDBLayout (TuiLayoutDefPtr); /* Show the screen layout defined. */ static void -showLayout (TuiLayoutType layout) +show_layout (enum tui_layout_type layout) { - TuiLayoutType curLayout = currentLayout (); + enum tui_layout_type cur_layout = tui_current_layout (); - if (layout != curLayout) + if (layout != cur_layout) { /* ** Since the new layout may cause changes in window size, we ** should free the content and reallocate on next display of ** source/asm */ - freeAllSourceWinsContent (); - clearSourceWindows (); + tui_free_all_source_wins_content (); + tui_clear_source_windows (); if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND) { - _showData (layout); - refreshAll (winList); + show_data (layout); + tui_refresh_all (tui_win_list); } else { /* First make the current layout be invisible */ - m_allBeInvisible (); - m_beInvisible (locatorWinInfoPtr ()); + tui_make_all_invisible (); + tui_make_invisible (tui_locator_win_info_ptr ()); switch (layout) { /* Now show the new layout */ case SRC_COMMAND: - _showSourceCommand (); - addToSourceWindows (srcWin); + show_source_command (); + tui_add_to_source_windows (TUI_SRC_WIN); break; case DISASSEM_COMMAND: - _showDisassemCommand (); - addToSourceWindows (disassemWin); + show_disasm_command (); + tui_add_to_source_windows (TUI_DISASM_WIN); break; case SRC_DISASSEM_COMMAND: - _showSourceDisassemCommand (); - addToSourceWindows (srcWin); - addToSourceWindows (disassemWin); + show_source_disasm_command (); + tui_add_to_source_windows (TUI_SRC_WIN); + tui_add_to_source_windows (TUI_DISASM_WIN); break; default: break; @@ -128,62 +122,60 @@ showLayout (TuiLayoutType layout) } -/* - ** tuiSetLayout() - ** Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND, - ** SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. - ** If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or - ** UNDEFINED_LAYOUT, then the data window is populated according - ** to regsDisplayType. - */ -TuiStatus -tuiSetLayout (TuiLayoutType layoutType, - TuiRegisterDisplayType regsDisplayType) +/* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND, + SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. + If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or + UNDEFINED_LAYOUT, then the data window is populated according to + regs_display_type. */ +enum tui_status +tui_set_layout (enum tui_layout_type layout_type, + enum tui_register_display_type regs_display_type) { - TuiStatus status = TUI_SUCCESS; + enum tui_status status = TUI_SUCCESS; - if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS) + if (layout_type != UNDEFINED_LAYOUT || regs_display_type != TUI_UNDEFINED_REGS) { - TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT; - int regsPopulate = FALSE; - CORE_ADDR addr = _extractDisplayStartAddr (); - TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus (); - TuiLayoutDefPtr layoutDef = tuiLayoutDef (); + enum tui_layout_type cur_layout = tui_current_layout (), new_layout = UNDEFINED_LAYOUT; + int regs_populate = FALSE; + CORE_ADDR addr = extract_display_start_addr (); + struct tui_win_info * new_win_with_focus = (struct tui_win_info *) NULL; + struct tui_win_info * win_with_focus = tui_win_with_focus (); + struct tui_layout_def * layout_def = tui_layout_def (); - if (layoutType == UNDEFINED_LAYOUT && - regsDisplayType != TUI_UNDEFINED_REGS) + if (layout_type == UNDEFINED_LAYOUT && + regs_display_type != TUI_UNDEFINED_REGS) { - if (curLayout == SRC_DISASSEM_COMMAND) - newLayout = DISASSEM_DATA_COMMAND; - else if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND) - newLayout = SRC_DATA_COMMAND; - else if (curLayout == DISASSEM_COMMAND || - curLayout == DISASSEM_DATA_COMMAND) - newLayout = DISASSEM_DATA_COMMAND; + if (cur_layout == SRC_DISASSEM_COMMAND) + new_layout = DISASSEM_DATA_COMMAND; + else if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND) + new_layout = SRC_DATA_COMMAND; + else if (cur_layout == DISASSEM_COMMAND || + cur_layout == DISASSEM_DATA_COMMAND) + new_layout = DISASSEM_DATA_COMMAND; } else - newLayout = layoutType; + new_layout = layout_type; - regsPopulate = (newLayout == SRC_DATA_COMMAND || - newLayout == DISASSEM_DATA_COMMAND || - regsDisplayType != TUI_UNDEFINED_REGS); - if (newLayout != curLayout || regsDisplayType != TUI_UNDEFINED_REGS) + regs_populate = (new_layout == SRC_DATA_COMMAND || + new_layout == DISASSEM_DATA_COMMAND || + regs_display_type != TUI_UNDEFINED_REGS); + if (new_layout != cur_layout || regs_display_type != TUI_UNDEFINED_REGS) { - if (newLayout != curLayout) + if (new_layout != cur_layout) { - showLayout (newLayout); + show_layout (new_layout); /* ** Now determine where focus should be */ - if (winWithFocus != cmdWin) + if (win_with_focus != TUI_CMD_WIN) { - switch (newLayout) + switch (new_layout) { case SRC_COMMAND: - tuiSetWinFocusTo (srcWin); - layoutDef->displayMode = SRC_WIN; - layoutDef->split = FALSE; + tui_set_win_focus_to (TUI_SRC_WIN); + layout_def->display_mode = SRC_WIN; + layout_def->split = FALSE; break; case DISASSEM_COMMAND: /* the previous layout was not showing @@ -194,9 +186,9 @@ tuiSetLayout (TuiLayoutType layoutType, ** We still want to show the assembly though! */ addr = tui_get_begin_asm_address (); - tuiSetWinFocusTo (disassemWin); - layoutDef->displayMode = DISASSEM_WIN; - layoutDef->split = FALSE; + tui_set_win_focus_to (TUI_DISASM_WIN); + layout_def->display_mode = DISASSEM_WIN; + layout_def->split = FALSE; break; case SRC_DISASSEM_COMMAND: /* the previous layout was not showing @@ -207,19 +199,19 @@ tuiSetLayout (TuiLayoutType layoutType, ** We still want to show the assembly though! */ addr = tui_get_begin_asm_address (); - if (winWithFocus == srcWin) - tuiSetWinFocusTo (srcWin); + if (win_with_focus == TUI_SRC_WIN) + tui_set_win_focus_to (TUI_SRC_WIN); else - tuiSetWinFocusTo (disassemWin); - layoutDef->split = TRUE; + tui_set_win_focus_to (TUI_DISASM_WIN); + layout_def->split = TRUE; break; case SRC_DATA_COMMAND: - if (winWithFocus != dataWin) - tuiSetWinFocusTo (srcWin); + if (win_with_focus != TUI_DATA_WIN) + tui_set_win_focus_to (TUI_SRC_WIN); else - tuiSetWinFocusTo (dataWin); - layoutDef->displayMode = SRC_WIN; - layoutDef->split = FALSE; + tui_set_win_focus_to (TUI_DATA_WIN); + layout_def->display_mode = SRC_WIN; + layout_def->split = FALSE; break; case DISASSEM_DATA_COMMAND: /* the previous layout was not showing @@ -230,35 +222,35 @@ tuiSetLayout (TuiLayoutType layoutType, ** We still want to show the assembly though! */ addr = tui_get_begin_asm_address (); - if (winWithFocus != dataWin) - tuiSetWinFocusTo (disassemWin); + if (win_with_focus != TUI_DATA_WIN) + tui_set_win_focus_to (TUI_DISASM_WIN); else - tuiSetWinFocusTo (dataWin); - layoutDef->displayMode = DISASSEM_WIN; - layoutDef->split = FALSE; + tui_set_win_focus_to (TUI_DATA_WIN); + layout_def->display_mode = DISASSEM_WIN; + layout_def->split = FALSE; break; default: break; } } - if (newWinWithFocus != (TuiWinInfoPtr) NULL) - tuiSetWinFocusTo (newWinWithFocus); + if (new_win_with_focus != (struct tui_win_info *) NULL) + tui_set_win_focus_to (new_win_with_focus); /* ** Now update the window content */ - if (!regsPopulate && - (newLayout == SRC_DATA_COMMAND || - newLayout == DISASSEM_DATA_COMMAND)) - tuiDisplayAllData (); + if (!regs_populate && + (new_layout == SRC_DATA_COMMAND || + new_layout == DISASSEM_DATA_COMMAND)) + tui_display_all_data (); - tuiUpdateSourceWindowsWithAddr (addr); + tui_update_source_windows_with_addr (addr); } - if (regsPopulate) + if (regs_populate) { - layoutDef->regsDisplayType = - (regsDisplayType == TUI_UNDEFINED_REGS ? - TUI_GENERAL_REGS : regsDisplayType); - tui_show_registers (layoutDef->regsDisplayType); + layout_def->regs_display_type = + (regs_display_type == TUI_UNDEFINED_REGS ? + TUI_GENERAL_REGS : regs_display_type); + tui_show_registers (layout_def->regs_display_type); } } } @@ -268,92 +260,84 @@ tuiSetLayout (TuiLayoutType layoutType, return status; } -/* - ** tuiAddWinToLayout(). - ** Add the specified window to the layout in a logical way. - ** This means setting up the most logical layout given the - ** window to be added. - */ +/* Add the specified window to the layout in a logical way. This + means setting up the most logical layout given the window to be + added. */ void -tuiAddWinToLayout (TuiWinType type) +tui_add_win_to_layout (enum tui_win_type type) { - TuiLayoutType curLayout = currentLayout (); + enum tui_layout_type cur_layout = tui_current_layout (); switch (type) { case SRC_WIN: - if (curLayout != SRC_COMMAND && - curLayout != SRC_DISASSEM_COMMAND && - curLayout != SRC_DATA_COMMAND) + if (cur_layout != SRC_COMMAND && + cur_layout != SRC_DISASSEM_COMMAND && + cur_layout != SRC_DATA_COMMAND) { - clearSourceWindowsDetail (); - if (curLayout == DISASSEM_DATA_COMMAND) - showLayout (SRC_DATA_COMMAND); + tui_clear_source_windows_detail (); + if (cur_layout == DISASSEM_DATA_COMMAND) + show_layout (SRC_DATA_COMMAND); else - showLayout (SRC_COMMAND); + show_layout (SRC_COMMAND); } break; case DISASSEM_WIN: - if (curLayout != DISASSEM_COMMAND && - curLayout != SRC_DISASSEM_COMMAND && - curLayout != DISASSEM_DATA_COMMAND) + if (cur_layout != DISASSEM_COMMAND && + cur_layout != SRC_DISASSEM_COMMAND && + cur_layout != DISASSEM_DATA_COMMAND) { - clearSourceWindowsDetail (); - if (curLayout == SRC_DATA_COMMAND) - showLayout (DISASSEM_DATA_COMMAND); + tui_clear_source_windows_detail (); + if (cur_layout == SRC_DATA_COMMAND) + show_layout (DISASSEM_DATA_COMMAND); else - showLayout (DISASSEM_COMMAND); + show_layout (DISASSEM_COMMAND); } break; case DATA_WIN: - if (curLayout != SRC_DATA_COMMAND && - curLayout != DISASSEM_DATA_COMMAND) + if (cur_layout != SRC_DATA_COMMAND && + cur_layout != DISASSEM_DATA_COMMAND) { - if (curLayout == DISASSEM_COMMAND) - showLayout (DISASSEM_DATA_COMMAND); + if (cur_layout == DISASSEM_COMMAND) + show_layout (DISASSEM_DATA_COMMAND); else - showLayout (SRC_DATA_COMMAND); + show_layout (SRC_DATA_COMMAND); } break; default: break; } - - return; -} /* tuiAddWinToLayout */ +} -/* - ** tuiDefaultWinHeight(). - ** Answer the height of a window. If it hasn't been created yet, - ** answer what the height of a window would be based upon its - ** type and the layout. - */ +/* Answer the height of a window. If it hasn't been created yet, + answer what the height of a window would be based upon its type and + the layout. */ int -tuiDefaultWinHeight (TuiWinType type, TuiLayoutType layout) +tui_default_win_height (enum tui_win_type type, enum tui_layout_type layout) { int h; - if (winList[type] != (TuiWinInfoPtr) NULL) - h = winList[type]->generic.height; + if (tui_win_list[type] != (struct tui_win_info *) NULL) + h = tui_win_list[type]->generic.height; else { switch (layout) { case SRC_COMMAND: case DISASSEM_COMMAND: - if (m_winPtrIsNull (cmdWin)) - h = termHeight () / 2; + if (TUI_CMD_WIN == NULL) + h = tui_term_height () / 2; else - h = termHeight () - cmdWin->generic.height; + h = tui_term_height () - TUI_CMD_WIN->generic.height; break; case SRC_DISASSEM_COMMAND: case SRC_DATA_COMMAND: case DISASSEM_DATA_COMMAND: - if (m_winPtrIsNull (cmdWin)) - h = termHeight () / 3; + if (TUI_CMD_WIN == NULL) + h = tui_term_height () / 3; else - h = (termHeight () - cmdWin->generic.height) / 2; + h = (tui_term_height () - TUI_CMD_WIN->generic.height) / 2; break; default: h = 0; @@ -362,40 +346,35 @@ tuiDefaultWinHeight (TuiWinType type, TuiLayoutType layout) } return h; -} /* tuiDefaultWinHeight */ +} -/* - ** tuiDefaultWinViewportHeight(). - ** Answer the height of a window. If it hasn't been created yet, - ** answer what the height of a window would be based upon its - ** type and the layout. - */ +/* Answer the height of a window. If it hasn't been created yet, + answer what the height of a window would be based upon its type and + the layout. */ int -tuiDefaultWinViewportHeight (TuiWinType type, TuiLayoutType layout) +tui_default_win_viewport_height (enum tui_win_type type, + enum tui_layout_type layout) { int h; - h = tuiDefaultWinHeight (type, layout); + h = tui_default_win_height (type, layout); - if (winList[type] == cmdWin) + if (tui_win_list[type] == TUI_CMD_WIN) h -= 1; else h -= 2; return h; -} /* tuiDefaultWinViewportHeight */ +} -/* - ** _initialize_tuiLayout(). - ** Function to initialize gdb commands, for tui window layout - ** manipulation. - */ +/* Function to initialize gdb commands, for tui window layout + manipulation. */ void -_initialize_tuiLayout (void) +_initialize_tui_layout (void) { - add_com ("layout", class_tui, _tuiLayout_command, + add_com ("layout", class_tui, tui_layout_command, "Change the layout of windows.\n\ Usage: layout prev | next | <layout_name> \n\ Layout names are:\n\ @@ -410,9 +389,9 @@ Layout names are:\n\ the window that has current logical focus.\n"); if (xdb_commands) { - add_com ("td", class_tui, _tuiToggleLayout_command, + add_com ("td", class_tui, tui_toggle_layout_command, "Toggle between Source/Command and Disassembly/Command layouts.\n"); - add_com ("ts", class_tui, _tuiToggleSplitLayout_command, + add_com ("ts", class_tui, tui_toggle_split_layout_command, "Toggle between Source/Command or Disassembly/Command and \n\ Source/Disassembly/Command layouts.\n"); } @@ -424,84 +403,81 @@ Source/Disassembly/Command layouts.\n"); **************************/ -/* - ** _tuiSetLayoutTo() - ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS, - ** $REGS, $GREGS, $FREGS, $SREGS. - */ -TuiStatus -tui_set_layout (const char *layoutName) +/* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, + REGS, $REGS, $GREGS, $FREGS, $SREGS. */ +enum tui_status +tui_set_layout_for_display_command (const char *layout_name) { - TuiStatus status = TUI_SUCCESS; + enum tui_status status = TUI_SUCCESS; - if (layoutName != (char *) NULL) + if (layout_name != (char *) NULL) { - register int i; - register char *bufPtr; - TuiLayoutType newLayout = UNDEFINED_LAYOUT; - TuiRegisterDisplayType dpyType = TUI_UNDEFINED_REGS; - TuiLayoutType curLayout = currentLayout (); + int i; + char *buf_ptr; + enum tui_layout_type new_layout = UNDEFINED_LAYOUT; + enum tui_register_display_type dpy_type = TUI_UNDEFINED_REGS; + enum tui_layout_type cur_layout = tui_current_layout (); - bufPtr = (char *) xstrdup (layoutName); - for (i = 0; (i < strlen (layoutName)); i++) - bufPtr[i] = toupper (bufPtr[i]); + buf_ptr = (char *) xstrdup (layout_name); + for (i = 0; (i < strlen (layout_name)); i++) + buf_ptr[i] = toupper (buf_ptr[i]); /* First check for ambiguous input */ - if (strlen (bufPtr) <= 1 && (*bufPtr == 'S' || *bufPtr == '$')) + if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$')) { warning ("Ambiguous command input.\n"); status = TUI_FAILURE; } else { - if (subset_compare (bufPtr, "SRC")) - newLayout = SRC_COMMAND; - else if (subset_compare (bufPtr, "ASM")) - newLayout = DISASSEM_COMMAND; - else if (subset_compare (bufPtr, "SPLIT")) - newLayout = SRC_DISASSEM_COMMAND; - else if (subset_compare (bufPtr, "REGS") || - subset_compare (bufPtr, TUI_GENERAL_SPECIAL_REGS_NAME) || - subset_compare (bufPtr, TUI_GENERAL_REGS_NAME) || - subset_compare (bufPtr, TUI_FLOAT_REGS_NAME) || - subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME)) + if (subset_compare (buf_ptr, "SRC")) + new_layout = SRC_COMMAND; + else if (subset_compare (buf_ptr, "ASM")) + new_layout = DISASSEM_COMMAND; + else if (subset_compare (buf_ptr, "SPLIT")) + new_layout = SRC_DISASSEM_COMMAND; + else if (subset_compare (buf_ptr, "REGS") || + subset_compare (buf_ptr, TUI_GENERAL_SPECIAL_REGS_NAME) || + subset_compare (buf_ptr, TUI_GENERAL_REGS_NAME) || + subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME) || + subset_compare (buf_ptr, TUI_SPECIAL_REGS_NAME)) { - if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND) - newLayout = SRC_DATA_COMMAND; + if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND) + new_layout = SRC_DATA_COMMAND; else - newLayout = DISASSEM_DATA_COMMAND; + new_layout = DISASSEM_DATA_COMMAND; /* could ifdef out the following code. when compile with -z, there are null pointer references that cause a core dump if 'layout regs' is the first layout command issued by the user. HP has asked us to hook up this code - edie epstein */ - if (subset_compare (bufPtr, TUI_FLOAT_REGS_NAME)) + if (subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME)) { - if (dataWin->detail.dataDisplayInfo.regsDisplayType != + if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_SFLOAT_REGS && - dataWin->detail.dataDisplayInfo.regsDisplayType != + TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_DFLOAT_REGS) - dpyType = TUI_SFLOAT_REGS; + dpy_type = TUI_SFLOAT_REGS; else - dpyType = - dataWin->detail.dataDisplayInfo.regsDisplayType; + dpy_type = + TUI_DATA_WIN->detail.data_display_info.regs_display_type; } - else if (subset_compare (bufPtr, + else if (subset_compare (buf_ptr, TUI_GENERAL_SPECIAL_REGS_NAME)) - dpyType = TUI_GENERAL_AND_SPECIAL_REGS; - else if (subset_compare (bufPtr, TUI_GENERAL_REGS_NAME)) - dpyType = TUI_GENERAL_REGS; - else if (subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME)) - dpyType = TUI_SPECIAL_REGS; - else if (dataWin) + dpy_type = TUI_GENERAL_AND_SPECIAL_REGS; + else if (subset_compare (buf_ptr, TUI_GENERAL_REGS_NAME)) + dpy_type = TUI_GENERAL_REGS; + else if (subset_compare (buf_ptr, TUI_SPECIAL_REGS_NAME)) + dpy_type = TUI_SPECIAL_REGS; + else if (TUI_DATA_WIN) { - if (dataWin->detail.dataDisplayInfo.regsDisplayType != + if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_UNDEFINED_REGS) - dpyType = - dataWin->detail.dataDisplayInfo.regsDisplayType; + dpy_type = + TUI_DATA_WIN->detail.data_display_info.regs_display_type; else - dpyType = TUI_GENERAL_REGS; + dpy_type = TUI_GENERAL_REGS; } /* end of potential ifdef @@ -511,18 +487,18 @@ tui_set_layout (const char *layoutName) general purpose registers */ -/* dpyType = TUI_GENERAL_REGS; +/* dpy_type = TUI_GENERAL_REGS; */ } - else if (subset_compare (bufPtr, "NEXT")) - newLayout = _nextLayout (); - else if (subset_compare (bufPtr, "PREV")) - newLayout = _prevLayout (); + else if (subset_compare (buf_ptr, "NEXT")) + new_layout = next_layout (); + else if (subset_compare (buf_ptr, "PREV")) + new_layout = prev_layout (); else status = TUI_FAILURE; - xfree (bufPtr); + xfree (buf_ptr); - tuiSetLayout (newLayout, dpyType); + tui_set_layout (new_layout, dpy_type); } } else @@ -533,26 +509,26 @@ tui_set_layout (const char *layoutName) static CORE_ADDR -_extractDisplayStartAddr (void) +extract_display_start_addr (void) { - TuiLayoutType curLayout = currentLayout (); + enum tui_layout_type cur_layout = tui_current_layout (); CORE_ADDR addr; CORE_ADDR pc; struct symtab_and_line cursal = get_current_source_symtab_and_line (); - switch (curLayout) + switch (cur_layout) { case SRC_COMMAND: case SRC_DATA_COMMAND: find_line_pc (cursal.symtab, - srcWin->detail.sourceInfo.startLineOrAddr.lineNo, + TUI_SRC_WIN->detail.source_info.start_line_or_addr.line_no, &pc); addr = pc; break; case DISASSEM_COMMAND: case SRC_DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: - addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr; + addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.addr; break; default: addr = 0; @@ -560,589 +536,539 @@ _extractDisplayStartAddr (void) } return addr; -} /* _extractDisplayStartAddr */ +} static void -_tuiHandleXDBLayout (TuiLayoutDefPtr layoutDef) +tui_handle_xdb_layout (struct tui_layout_def * layout_def) { - if (layoutDef->split) + if (layout_def->split) { - tuiSetLayout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS); - tuiSetWinFocusTo (winList[layoutDef->displayMode]); + tui_set_layout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS); + tui_set_win_focus_to (tui_win_list[layout_def->display_mode]); } else { - if (layoutDef->displayMode == SRC_WIN) - tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS); + if (layout_def->display_mode == SRC_WIN) + tui_set_layout (SRC_COMMAND, TUI_UNDEFINED_REGS); else - tuiSetLayout (DISASSEM_DATA_COMMAND, layoutDef->regsDisplayType); + tui_set_layout (DISASSEM_DATA_COMMAND, layout_def->regs_display_type); } - - - return; -} /* _tuiHandleXDBLayout */ +} static void -_tuiToggleLayout_command (char *arg, int fromTTY) +tui_toggle_layout_command (char *arg, int from_tty) { - TuiLayoutDefPtr layoutDef = tuiLayoutDef (); + struct tui_layout_def * layout_def = tui_layout_def (); /* Make sure the curses mode is enabled. */ tui_enable (); - if (layoutDef->displayMode == SRC_WIN) - layoutDef->displayMode = DISASSEM_WIN; + if (layout_def->display_mode == SRC_WIN) + layout_def->display_mode = DISASSEM_WIN; else - layoutDef->displayMode = SRC_WIN; - - if (!layoutDef->split) - _tuiHandleXDBLayout (layoutDef); + layout_def->display_mode = SRC_WIN; + if (!layout_def->split) + tui_handle_xdb_layout (layout_def); } static void -_tuiToggleSplitLayout_command (char *arg, int fromTTY) +tui_toggle_split_layout_command (char *arg, int from_tty) { - TuiLayoutDefPtr layoutDef = tuiLayoutDef (); + struct tui_layout_def * layout_def = tui_layout_def (); /* Make sure the curses mode is enabled. */ tui_enable (); - layoutDef->split = (!layoutDef->split); - _tuiHandleXDBLayout (layoutDef); - + layout_def->split = (!layout_def->split); + tui_handle_xdb_layout (layout_def); } static void -_tuiLayout_command (char *arg, int fromTTY) +tui_layout_command (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); /* Switch to the selected layout. */ - if (tui_set_layout (arg) != TUI_SUCCESS) + if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS) warning ("Invalid layout specified.\n%s", LAYOUT_USAGE); } -/* - ** _nextLayout(). - ** Answer the previous layout to cycle to. - */ -static TuiLayoutType -_nextLayout (void) +/* Answer the previous layout to cycle to. */ +static enum tui_layout_type +next_layout (void) { - TuiLayoutType newLayout; + enum tui_layout_type new_layout; - newLayout = currentLayout (); - if (newLayout == UNDEFINED_LAYOUT) - newLayout = SRC_COMMAND; + new_layout = tui_current_layout (); + if (new_layout == UNDEFINED_LAYOUT) + new_layout = SRC_COMMAND; else { - newLayout++; - if (newLayout == UNDEFINED_LAYOUT) - newLayout = SRC_COMMAND; + new_layout++; + if (new_layout == UNDEFINED_LAYOUT) + new_layout = SRC_COMMAND; } - return newLayout; -} /* _nextLayout */ + return new_layout; +} -/* - ** _prevLayout(). - ** Answer the next layout to cycle to. - */ -static TuiLayoutType -_prevLayout (void) +/* Answer the next layout to cycle to. */ +static enum tui_layout_type +prev_layout (void) { - TuiLayoutType newLayout; + enum tui_layout_type new_layout; - newLayout = currentLayout (); - if (newLayout == SRC_COMMAND) - newLayout = DISASSEM_DATA_COMMAND; + new_layout = tui_current_layout (); + if (new_layout == SRC_COMMAND) + new_layout = DISASSEM_DATA_COMMAND; else { - newLayout--; - if (newLayout == UNDEFINED_LAYOUT) - newLayout = DISASSEM_DATA_COMMAND; + new_layout--; + if (new_layout == UNDEFINED_LAYOUT) + new_layout = DISASSEM_DATA_COMMAND; } - return newLayout; -} /* _prevLayout */ + return new_layout; +} -/* - ** _makeCommandWindow(). - */ static void -_makeCommandWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY) +make_command_window (struct tui_win_info * * win_info_ptr, int height, int origin_y) { - _initAndMakeWin ((Opaque *) winInfoPtr, + init_and_make_win ((void **) win_info_ptr, CMD_WIN, height, - termWidth (), + tui_term_width (), 0, - originY, + origin_y, DONT_BOX_WINDOW); - (*winInfoPtr)->canHighlight = FALSE; - - return; -} /* _makeCommandWindow */ + (*win_info_ptr)->can_highlight = FALSE; +} /* - ** _makeSourceWindow(). + ** make_source_window(). */ static void -_makeSourceWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY) +make_source_window (struct tui_win_info * * win_info_ptr, int height, int origin_y) { - _makeSourceOrDisassemWindow (winInfoPtr, SRC_WIN, height, originY); + make_source_or_disasm_window (win_info_ptr, SRC_WIN, height, origin_y); return; -} /* _makeSourceWindow */ +} /* make_source_window */ /* - ** _makeDisassemWindow(). + ** make_disasm_window(). */ static void -_makeDisassemWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY) +make_disasm_window (struct tui_win_info * * win_info_ptr, int height, int origin_y) { - _makeSourceOrDisassemWindow (winInfoPtr, DISASSEM_WIN, height, originY); + make_source_or_disasm_window (win_info_ptr, DISASSEM_WIN, height, origin_y); return; -} /* _makeDisassemWindow */ +} /* make_disasm_window */ -/* - ** _makeDataWindow(). - */ static void -_makeDataWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY) +make_data_window (struct tui_win_info * * win_info_ptr, int height, int origin_y) { - _initAndMakeWin ((Opaque *) winInfoPtr, + init_and_make_win ((void **) win_info_ptr, DATA_WIN, height, - termWidth (), + tui_term_width (), 0, - originY, + origin_y, BOX_WINDOW); - - return; -} /* _makeDataWindow */ +} -/* - ** _showSourceCommand(). - ** Show the Source/Command layout - */ +/* Show the Source/Command layout. */ static void -_showSourceCommand (void) +show_source_command (void) { - _showSourceOrDisassemAndCommand (SRC_COMMAND); - - return; -} /* _showSourceCommand */ + show_source_or_disasm_and_command (SRC_COMMAND); +} -/* - ** _showDisassemCommand(). - ** Show the Dissassem/Command layout - */ +/* Show the Dissassem/Command layout. */ static void -_showDisassemCommand (void) +show_disasm_command (void) { - _showSourceOrDisassemAndCommand (DISASSEM_COMMAND); - - return; -} /* _showDisassemCommand */ + show_source_or_disasm_and_command (DISASSEM_COMMAND); +} -/* - ** _showSourceDisassemCommand(). - ** Show the Source/Disassem/Command layout - */ +/* Show the Source/Disassem/Command layout. */ static void -_showSourceDisassemCommand (void) +show_source_disasm_command (void) { - if (currentLayout () != SRC_DISASSEM_COMMAND) + if (tui_current_layout () != SRC_DISASSEM_COMMAND) { - int cmdHeight, srcHeight, asmHeight; + int cmd_height, src_height, asm_height; - if (m_winPtrNotNull (cmdWin)) - cmdHeight = cmdWin->generic.height; + if (TUI_CMD_WIN != NULL) + cmd_height = TUI_CMD_WIN->generic.height; else - cmdHeight = termHeight () / 3; + cmd_height = tui_term_height () / 3; - srcHeight = (termHeight () - cmdHeight) / 2; - asmHeight = termHeight () - (srcHeight + cmdHeight); + src_height = (tui_term_height () - cmd_height) / 2; + asm_height = tui_term_height () - (src_height + cmd_height); - if (m_winPtrIsNull (srcWin)) - _makeSourceWindow (&srcWin, srcHeight, 0); + if (TUI_SRC_WIN == NULL) + make_source_window (&TUI_SRC_WIN, src_height, 0); else { - _initGenWinInfo (&srcWin->generic, - srcWin->generic.type, - srcHeight, - srcWin->generic.width, - srcWin->detail.sourceInfo.executionInfo->width, + init_gen_win_info (&TUI_SRC_WIN->generic, + TUI_SRC_WIN->generic.type, + src_height, + TUI_SRC_WIN->generic.width, + TUI_SRC_WIN->detail.source_info.execution_info->width, 0); - srcWin->canHighlight = TRUE; - _initGenWinInfo (srcWin->detail.sourceInfo.executionInfo, + TUI_SRC_WIN->can_highlight = TRUE; + init_gen_win_info (TUI_SRC_WIN->detail.source_info.execution_info, EXEC_INFO_WIN, - srcHeight, + src_height, 3, 0, 0); - m_beVisible (srcWin); - m_beVisible (srcWin->detail.sourceInfo.executionInfo); - srcWin->detail.sourceInfo.hasLocator = FALSE;; + tui_make_visible (&TUI_SRC_WIN->generic); + tui_make_visible (TUI_SRC_WIN->detail.source_info.execution_info); + TUI_SRC_WIN->detail.source_info.has_locator = FALSE;; } - if (m_winPtrNotNull (srcWin)) + if (TUI_SRC_WIN != NULL) { - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); - tuiShowSourceContent (srcWin); - if (m_winPtrIsNull (disassemWin)) + tui_show_source_content (TUI_SRC_WIN); + if (TUI_DISASM_WIN == NULL) { - _makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1); - _initAndMakeWin ((Opaque *) & locator, + make_disasm_window (&TUI_DISASM_WIN, asm_height, src_height - 1); + init_and_make_win ((void **) & locator, LOCATOR_WIN, 2 /* 1 */ , - termWidth (), + tui_term_width (), 0, - (srcHeight + asmHeight) - 1, + (src_height + asm_height) - 1, DONT_BOX_WINDOW); } else { - _initGenWinInfo (locator, + init_gen_win_info (locator, LOCATOR_WIN, 2 /* 1 */ , - termWidth (), + tui_term_width (), 0, - (srcHeight + asmHeight) - 1); - disassemWin->detail.sourceInfo.hasLocator = TRUE; - _initGenWinInfo ( - &disassemWin->generic, - disassemWin->generic.type, - asmHeight, - disassemWin->generic.width, - disassemWin->detail.sourceInfo.executionInfo->width, - srcHeight - 1); - _initGenWinInfo (disassemWin->detail.sourceInfo.executionInfo, + (src_height + asm_height) - 1); + TUI_DISASM_WIN->detail.source_info.has_locator = TRUE; + init_gen_win_info ( + &TUI_DISASM_WIN->generic, + TUI_DISASM_WIN->generic.type, + asm_height, + TUI_DISASM_WIN->generic.width, + TUI_DISASM_WIN->detail.source_info.execution_info->width, + src_height - 1); + init_gen_win_info (TUI_DISASM_WIN->detail.source_info.execution_info, EXEC_INFO_WIN, - asmHeight, + asm_height, 3, 0, - srcHeight - 1); - disassemWin->canHighlight = TRUE; - m_beVisible (disassemWin); - m_beVisible (disassemWin->detail.sourceInfo.executionInfo); + src_height - 1); + TUI_DISASM_WIN->can_highlight = TRUE; + tui_make_visible (&TUI_DISASM_WIN->generic); + tui_make_visible (TUI_DISASM_WIN->detail.source_info.execution_info); } - if (m_winPtrNotNull (disassemWin)) + if (TUI_DISASM_WIN != NULL) { - srcWin->detail.sourceInfo.hasLocator = FALSE; - disassemWin->detail.sourceInfo.hasLocator = TRUE; - m_beVisible (locator); - tuiShowLocatorContent (); - tuiShowSourceContent (disassemWin); - - if (m_winPtrIsNull (cmdWin)) - _makeCommandWindow (&cmdWin, - cmdHeight, - termHeight () - cmdHeight); + TUI_SRC_WIN->detail.source_info.has_locator = FALSE; + TUI_DISASM_WIN->detail.source_info.has_locator = TRUE; + tui_make_visible (locator); + tui_show_locator_content (); + tui_show_source_content (TUI_DISASM_WIN); + + if (TUI_CMD_WIN == NULL) + make_command_window (&TUI_CMD_WIN, + cmd_height, + tui_term_height () - cmd_height); else { - _initGenWinInfo (&cmdWin->generic, - cmdWin->generic.type, - cmdWin->generic.height, - cmdWin->generic.width, + init_gen_win_info (&TUI_CMD_WIN->generic, + TUI_CMD_WIN->generic.type, + TUI_CMD_WIN->generic.height, + TUI_CMD_WIN->generic.width, 0, - cmdWin->generic.origin.y); - cmdWin->canHighlight = FALSE; - m_beVisible (cmdWin); + TUI_CMD_WIN->generic.origin.y); + TUI_CMD_WIN->can_highlight = FALSE; + tui_make_visible (&TUI_CMD_WIN->generic); } - if (m_winPtrNotNull (cmdWin)) - tuiRefreshWin (&cmdWin->generic); + if (TUI_CMD_WIN != NULL) + tui_refresh_win (&TUI_CMD_WIN->generic); } } - setCurrentLayoutTo (SRC_DISASSEM_COMMAND); + tui_set_current_layout_to (SRC_DISASSEM_COMMAND); } - - return; -} /* _showSourceDisassemCommand */ +} -/* - ** _showData(). - ** Show the Source/Data/Command or the Dissassembly/Data/Command layout - */ +/* Show the Source/Data/Command or the Dissassembly/Data/Command + layout. */ static void -_showData (TuiLayoutType newLayout) +show_data (enum tui_layout_type new_layout) { - int totalHeight = (termHeight () - cmdWin->generic.height); - int srcHeight, dataHeight; - TuiWinType winType; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - - - dataHeight = totalHeight / 2; - srcHeight = totalHeight - dataHeight; - m_allBeInvisible (); - m_beInvisible (locator); - _makeDataWindow (&dataWin, dataHeight, 0); - dataWin->canHighlight = TRUE; - if (newLayout == SRC_DATA_COMMAND) - winType = SRC_WIN; + int total_height = (tui_term_height () - TUI_CMD_WIN->generic.height); + int src_height, data_height; + enum tui_win_type win_type; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + + + data_height = total_height / 2; + src_height = total_height - data_height; + tui_make_all_invisible (); + tui_make_invisible (locator); + make_data_window (&TUI_DATA_WIN, data_height, 0); + TUI_DATA_WIN->can_highlight = TRUE; + if (new_layout == SRC_DATA_COMMAND) + win_type = SRC_WIN; else - winType = DISASSEM_WIN; - if (m_winPtrIsNull (winList[winType])) + win_type = DISASSEM_WIN; + if (tui_win_list[win_type] == NULL) { - if (winType == SRC_WIN) - _makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1); + if (win_type == SRC_WIN) + make_source_window (&tui_win_list[win_type], src_height, data_height - 1); else - _makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1); - _initAndMakeWin ((Opaque *) & locator, + make_disasm_window (&tui_win_list[win_type], src_height, data_height - 1); + init_and_make_win ((void **) & locator, LOCATOR_WIN, 2 /* 1 */ , - termWidth (), + tui_term_width (), 0, - totalHeight - 1, + total_height - 1, DONT_BOX_WINDOW); } else { - _initGenWinInfo (&winList[winType]->generic, - winList[winType]->generic.type, - srcHeight, - winList[winType]->generic.width, - winList[winType]->detail.sourceInfo.executionInfo->width, - dataHeight - 1); - _initGenWinInfo (winList[winType]->detail.sourceInfo.executionInfo, + init_gen_win_info (&tui_win_list[win_type]->generic, + tui_win_list[win_type]->generic.type, + src_height, + tui_win_list[win_type]->generic.width, + tui_win_list[win_type]->detail.source_info.execution_info->width, + data_height - 1); + init_gen_win_info (tui_win_list[win_type]->detail.source_info.execution_info, EXEC_INFO_WIN, - srcHeight, + src_height, 3, 0, - dataHeight - 1); - m_beVisible (winList[winType]); - m_beVisible (winList[winType]->detail.sourceInfo.executionInfo); - _initGenWinInfo (locator, + data_height - 1); + tui_make_visible (&tui_win_list[win_type]->generic); + tui_make_visible (tui_win_list[win_type]->detail.source_info.execution_info); + init_gen_win_info (locator, LOCATOR_WIN, 2 /* 1 */ , - termWidth (), + tui_term_width (), 0, - totalHeight - 1); + total_height - 1); } - winList[winType]->detail.sourceInfo.hasLocator = TRUE; - m_beVisible (locator); - tuiShowLocatorContent (); - addToSourceWindows (winList[winType]); - setCurrentLayoutTo (newLayout); - - return; -} /* _showData */ + tui_win_list[win_type]->detail.source_info.has_locator = TRUE; + tui_make_visible (locator); + tui_show_locator_content (); + tui_add_to_source_windows (tui_win_list[win_type]); + tui_set_current_layout_to (new_layout); +} /* - ** _initGenWinInfo(). + ** init_gen_win_info(). */ static void -_initGenWinInfo (TuiGenWinInfoPtr winInfo, TuiWinType type, - int height, int width, int originX, int originY) +init_gen_win_info (struct tui_gen_win_info * win_info, enum tui_win_type type, + int height, int width, int origin_x, int origin_y) { int h = height; - winInfo->type = type; - winInfo->width = width; - winInfo->height = h; + win_info->type = type; + win_info->width = width; + win_info->height = h; if (h > 1) { - winInfo->viewportHeight = h - 1; - if (winInfo->type != CMD_WIN) - winInfo->viewportHeight--; + win_info->viewport_height = h - 1; + if (win_info->type != CMD_WIN) + win_info->viewport_height--; } else - winInfo->viewportHeight = 1; - winInfo->origin.x = originX; - winInfo->origin.y = originY; + win_info->viewport_height = 1; + win_info->origin.x = origin_x; + win_info->origin.y = origin_y; return; -} /* _initGenWinInfo */ +} /* init_gen_win_info */ /* - ** _initAndMakeWin(). + ** init_and_make_win(). */ static void -_initAndMakeWin (Opaque * winInfoPtr, TuiWinType winType, - int height, int width, int originX, int originY, int boxIt) +init_and_make_win (void ** win_info_ptr, enum tui_win_type win_type, + int height, int width, int origin_x, int origin_y, int box_it) { - Opaque opaqueWinInfo = *winInfoPtr; - TuiGenWinInfoPtr generic; + void *opaque_win_info = *win_info_ptr; + struct tui_gen_win_info * generic; - if (opaqueWinInfo == (Opaque) NULL) + if (opaque_win_info == NULL) { - if (m_winIsAuxillary (winType)) - opaqueWinInfo = (Opaque) allocGenericWinInfo (); + if (tui_win_is_auxillary (win_type)) + opaque_win_info = (void *) tui_alloc_generic_win_info (); else - opaqueWinInfo = (Opaque) allocWinInfo (winType); + opaque_win_info = (void *) tui_alloc_win_info (win_type); } - if (m_winIsAuxillary (winType)) - generic = (TuiGenWinInfoPtr) opaqueWinInfo; + if (tui_win_is_auxillary (win_type)) + generic = (struct tui_gen_win_info *) opaque_win_info; else - generic = &((TuiWinInfoPtr) opaqueWinInfo)->generic; + generic = &((struct tui_win_info *) opaque_win_info)->generic; - if (opaqueWinInfo != (Opaque) NULL) + if (opaque_win_info != NULL) { - _initGenWinInfo (generic, winType, height, width, originX, originY); - if (!m_winIsAuxillary (winType)) + init_gen_win_info (generic, win_type, height, width, origin_x, origin_y); + if (!tui_win_is_auxillary (win_type)) { if (generic->type == CMD_WIN) - ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = FALSE; + ((struct tui_win_info *) opaque_win_info)->can_highlight = FALSE; else - ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = TRUE; + ((struct tui_win_info *) opaque_win_info)->can_highlight = TRUE; } - makeWindow (generic, boxIt); + tui_make_window (generic, box_it); } - *winInfoPtr = opaqueWinInfo; + *win_info_ptr = opaque_win_info; } -/* - ** _makeSourceOrDisassemWindow(). - */ static void -_makeSourceOrDisassemWindow (TuiWinInfoPtr * winInfoPtr, TuiWinType type, - int height, int originY) +make_source_or_disasm_window (struct tui_win_info * * win_info_ptr, enum tui_win_type type, + int height, int origin_y) { - TuiGenWinInfoPtr executionInfo = (TuiGenWinInfoPtr) NULL; + struct tui_gen_win_info * execution_info = (struct tui_gen_win_info *) NULL; /* ** Create the exeuction info window. */ if (type == SRC_WIN) - executionInfo = sourceExecInfoWinPtr (); + execution_info = tui_source_exec_info_win_ptr (); else - executionInfo = disassemExecInfoWinPtr (); - _initAndMakeWin ((Opaque *) & executionInfo, + execution_info = tui_disassem_exec_info_win_ptr (); + init_and_make_win ((void **) & execution_info, EXEC_INFO_WIN, height, 3, 0, - originY, + origin_y, DONT_BOX_WINDOW); /* ** Now create the source window. */ - _initAndMakeWin ((Opaque *) winInfoPtr, + init_and_make_win ((void **) win_info_ptr, type, height, - termWidth () - executionInfo->width, - executionInfo->width, - originY, + tui_term_width () - execution_info->width, + execution_info->width, + origin_y, BOX_WINDOW); - (*winInfoPtr)->detail.sourceInfo.executionInfo = executionInfo; - - return; -} /* _makeSourceOrDisassemWindow */ + (*win_info_ptr)->detail.source_info.execution_info = execution_info; +} -/* - ** _showSourceOrDisassemAndCommand(). - ** Show the Source/Command or the Disassem layout - */ +/* Show the Source/Command or the Disassem layout. */ static void -_showSourceOrDisassemAndCommand (TuiLayoutType layoutType) +show_source_or_disasm_and_command (enum tui_layout_type layout_type) { - if (currentLayout () != layoutType) + if (tui_current_layout () != layout_type) { - TuiWinInfoPtr *winInfoPtr; - int srcHeight, cmdHeight; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); + struct tui_win_info * *win_info_ptr; + int src_height, cmd_height; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); - if (m_winPtrNotNull (cmdWin)) - cmdHeight = cmdWin->generic.height; + if (TUI_CMD_WIN != NULL) + cmd_height = TUI_CMD_WIN->generic.height; else - cmdHeight = termHeight () / 3; - srcHeight = termHeight () - cmdHeight; + cmd_height = tui_term_height () / 3; + src_height = tui_term_height () - cmd_height; - if (layoutType == SRC_COMMAND) - winInfoPtr = &srcWin; + if (layout_type == SRC_COMMAND) + win_info_ptr = &TUI_SRC_WIN; else - winInfoPtr = &disassemWin; + win_info_ptr = &TUI_DISASM_WIN; - if (m_winPtrIsNull (*winInfoPtr)) + if ((*win_info_ptr) == NULL) { - if (layoutType == SRC_COMMAND) - _makeSourceWindow (winInfoPtr, srcHeight - 1, 0); + if (layout_type == SRC_COMMAND) + make_source_window (win_info_ptr, src_height - 1, 0); else - _makeDisassemWindow (winInfoPtr, srcHeight - 1, 0); - _initAndMakeWin ((Opaque *) & locator, + make_disasm_window (win_info_ptr, src_height - 1, 0); + init_and_make_win ((void **) & locator, LOCATOR_WIN, 2 /* 1 */ , - termWidth (), + tui_term_width (), 0, - srcHeight - 1, + src_height - 1, DONT_BOX_WINDOW); } else { - _initGenWinInfo (locator, + init_gen_win_info (locator, LOCATOR_WIN, 2 /* 1 */ , - termWidth (), + tui_term_width (), 0, - srcHeight - 1); - (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE; - _initGenWinInfo ( - &(*winInfoPtr)->generic, - (*winInfoPtr)->generic.type, - srcHeight - 1, - (*winInfoPtr)->generic.width, - (*winInfoPtr)->detail.sourceInfo.executionInfo->width, + src_height - 1); + (*win_info_ptr)->detail.source_info.has_locator = TRUE; + init_gen_win_info ( + &(*win_info_ptr)->generic, + (*win_info_ptr)->generic.type, + src_height - 1, + (*win_info_ptr)->generic.width, + (*win_info_ptr)->detail.source_info.execution_info->width, 0); - _initGenWinInfo ((*winInfoPtr)->detail.sourceInfo.executionInfo, + init_gen_win_info ((*win_info_ptr)->detail.source_info.execution_info, EXEC_INFO_WIN, - srcHeight - 1, + src_height - 1, 3, 0, 0); - (*winInfoPtr)->canHighlight = TRUE; - m_beVisible (*winInfoPtr); - m_beVisible ((*winInfoPtr)->detail.sourceInfo.executionInfo); + (*win_info_ptr)->can_highlight = TRUE; + tui_make_visible (&(*win_info_ptr)->generic); + tui_make_visible ((*win_info_ptr)->detail.source_info.execution_info); } - if (m_winPtrNotNull (*winInfoPtr)) + if ((*win_info_ptr) != NULL) { - (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE; - m_beVisible (locator); - tuiShowLocatorContent (); - tuiShowSourceContent (*winInfoPtr); + (*win_info_ptr)->detail.source_info.has_locator = TRUE; + tui_make_visible (locator); + tui_show_locator_content (); + tui_show_source_content (*win_info_ptr); - if (m_winPtrIsNull (cmdWin)) + if (TUI_CMD_WIN == NULL) { - _makeCommandWindow (&cmdWin, cmdHeight, srcHeight); - tuiRefreshWin (&cmdWin->generic); + make_command_window (&TUI_CMD_WIN, cmd_height, src_height); + tui_refresh_win (&TUI_CMD_WIN->generic); } else { - _initGenWinInfo (&cmdWin->generic, - cmdWin->generic.type, - cmdWin->generic.height, - cmdWin->generic.width, - cmdWin->generic.origin.x, - cmdWin->generic.origin.y); - cmdWin->canHighlight = FALSE; - m_beVisible (cmdWin); + init_gen_win_info (&TUI_CMD_WIN->generic, + TUI_CMD_WIN->generic.type, + TUI_CMD_WIN->generic.height, + TUI_CMD_WIN->generic.width, + TUI_CMD_WIN->generic.origin.x, + TUI_CMD_WIN->generic.origin.y); + TUI_CMD_WIN->can_highlight = FALSE; + tui_make_visible (&TUI_CMD_WIN->generic); } } - setCurrentLayoutTo (layoutType); + tui_set_current_layout_to (layout_type); } - - return; -} /* _showSourceOrDisassemAndCommand */ +} diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h index f6b0ed7..5df1f0b 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -1,5 +1,8 @@ /* TUI layout window management. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -22,9 +25,14 @@ #ifndef TUI_LAYOUT_H #define TUI_LAYOUT_H -extern void tuiAddWinToLayout (TuiWinType); -extern int tuiDefaultWinHeight (TuiWinType, TuiLayoutType); -extern int tuiDefaultWinViewportHeight (TuiWinType, TuiLayoutType); -extern TuiStatus tuiSetLayout (TuiLayoutType, TuiRegisterDisplayType); +#include "tui/tui.h" +#include "tui/tui-data.h" + +extern void tui_add_win_to_layout (enum tui_win_type); +extern int tui_default_win_height (enum tui_win_type, enum tui_layout_type); +extern int tui_default_win_viewport_height (enum tui_win_type, + enum tui_layout_type); +extern enum tui_status tui_set_layout (enum tui_layout_type, + enum tui_register_display_type); #endif /*TUI_LAYOUT_H */ diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 68520b9..7ce92c2 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -32,19 +32,14 @@ #include "regcache.h" #include "inferior.h" #include "target.h" +#include "gdb_string.h" #include "tui/tui-layout.h" #include "tui/tui-win.h" #include "tui/tui-windata.h" #include "tui/tui-wingeneral.h" #include "tui/tui-file.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /***************************************** ** LOCAL DEFINITIONS ** @@ -76,28 +71,28 @@ /***************************************** ** STATIC LOCAL FUNCTIONS FORWARD DECLS ** ******************************************/ -static TuiStatus _tuiSetRegsContent - (int, int, struct frame_info *, TuiRegisterDisplayType, int); -static const char *_tuiRegisterName (int); -static TuiStatus _tuiGetRegisterRawValue (int, char *, struct frame_info *); -static void _tuiSetRegisterElement - (int, struct frame_info *, TuiDataElementPtr, int); -static void _tuiDisplayRegister (int, TuiGenWinInfoPtr, enum precision_type); -static void _tuiRegisterFormat - (char *, int, int, TuiDataElementPtr, enum precision_type); -static TuiStatus _tuiSetGeneralRegsContent (int); -static TuiStatus _tuiSetSpecialRegsContent (int); -static TuiStatus _tuiSetGeneralAndSpecialRegsContent (int); -static TuiStatus _tuiSetFloatRegsContent (TuiRegisterDisplayType, int); -static int _tuiRegValueHasChanged - (TuiDataElementPtr, struct frame_info *, char *); -static void _tuiShowFloat_command (char *, int); -static void _tuiShowGeneral_command (char *, int); -static void _tuiShowSpecial_command (char *, int); -static void _tui_vShowRegisters_commandSupport (TuiRegisterDisplayType); -static void _tuiToggleFloatRegs_command (char *, int); -static void _tuiScrollRegsForward_command (char *, int); -static void _tuiScrollRegsBackward_command (char *, int); +static enum tui_status tui_set_regs_content + (int, int, struct frame_info *, enum tui_register_display_type, int); +static const char *tui_register_name (int); +static enum tui_status tui_get_register_raw_value (int, char *, struct frame_info *); +static void tui_set_register_element + (int, struct frame_info *, struct tui_data_element *, int); +static void tui_display_register (int, struct tui_gen_win_info *, enum precision_type); +static void tui_register_format + (char *, int, int, struct tui_data_element *, enum precision_type); +static enum tui_status tui_set_general_regs_content (int); +static enum tui_status tui_set_special_regs_content (int); +static enum tui_status tui_set_general_and_special_regs_content (int); +static enum tui_status tui_set_float_regs_content (enum tui_register_display_type, int); +static int tui_reg_value_has_changed + (struct tui_data_element *, struct frame_info *, char *); +static void tui_show_float_command (char *, int); +static void tui_show_general_command (char *, int); +static void tui_show_special_command (char *, int); +static void tui_v_show_registers_command_support (enum tui_register_display_type); +static void _tui_toggle_float_regs_command (char *, int); +static void tui_scroll_regs_forward_command (char *, int); +static void tui_scroll_regs_backward_command (char *, int); @@ -110,35 +105,35 @@ static void _tuiScrollRegsBackward_command (char *, int); int tui_last_regs_line_no (void) { - register int numLines = (-1); + int num_lines = (-1); - if (dataWin->detail.dataDisplayInfo.regsContentCount > 0) + if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0) { - numLines = (dataWin->detail.dataDisplayInfo.regsContentCount / - dataWin->detail.dataDisplayInfo.regsColumnCount); - if (dataWin->detail.dataDisplayInfo.regsContentCount % - dataWin->detail.dataDisplayInfo.regsColumnCount) - numLines++; + num_lines = (TUI_DATA_WIN->detail.data_display_info.regs_content_count / + TUI_DATA_WIN->detail.data_display_info.regs_column_count); + if (TUI_DATA_WIN->detail.data_display_info.regs_content_count % + TUI_DATA_WIN->detail.data_display_info.regs_column_count) + num_lines++; } - return numLines; + return num_lines; } -/* Answer the line number that the register element at elementNo is - on. If elementNo is greater than the number of register elements +/* Answer the line number that the register element at element_no is + on. If element_no is greater than the number of register elements there are, -1 is returned. */ int -tui_line_from_reg_element_no (int elementNo) +tui_line_from_reg_element_no (int element_no) { - if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount) + if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count) { int i, line = (-1); i = 1; while (line == (-1)) { - if (elementNo < - (dataWin->detail.dataDisplayInfo.regsColumnCount * i)) + if (element_no < + (TUI_DATA_WIN->detail.data_display_info.regs_column_count * i)) line = i - 1; else i++; @@ -151,93 +146,90 @@ tui_line_from_reg_element_no (int elementNo) } -/* Answer the index of the first element in lineNo. If lineNo is past +/* Answer the index of the first element in line_no. If line_no is past the register area (-1) is returned. */ int -tui_first_reg_element_no_inline (int lineNo) +tui_first_reg_element_no_inline (int line_no) { - if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount) - <= dataWin->detail.dataDisplayInfo.regsContentCount) - return ((lineNo + 1) * - dataWin->detail.dataDisplayInfo.regsColumnCount) - - dataWin->detail.dataDisplayInfo.regsColumnCount; + if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count) + <= TUI_DATA_WIN->detail.data_display_info.regs_content_count) + return ((line_no + 1) * + TUI_DATA_WIN->detail.data_display_info.regs_column_count) - + TUI_DATA_WIN->detail.data_display_info.regs_column_count; else return (-1); } -/* - ** tuiLastRegElementNoInLine() - ** Answer the index of the last element in lineNo. If lineNo is past - ** the register area (-1) is returned. - */ +/* Answer the index of the last element in line_no. If line_no is + past the register area (-1) is returned. */ int -tuiLastRegElementNoInLine (int lineNo) +tui_last_reg_element_no_in_line (int line_no) { - if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount) <= - dataWin->detail.dataDisplayInfo.regsContentCount) - return ((lineNo + 1) * - dataWin->detail.dataDisplayInfo.regsColumnCount) - 1; + if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count) <= + TUI_DATA_WIN->detail.data_display_info.regs_content_count) + return ((line_no + 1) * + TUI_DATA_WIN->detail.data_display_info.regs_column_count) - 1; else return (-1); -} /* tuiLastRegElementNoInLine */ +} /* Calculate the number of columns that should be used to display the registers. */ int -tui_calculate_regs_column_count (TuiRegisterDisplayType dpyType) +tui_calculate_regs_column_count (enum tui_register_display_type dpy_type) { - int colCount, colWidth; + int col_count, col_width; - if (IS_64BIT || dpyType == TUI_DFLOAT_REGS) - colWidth = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH; + if (IS_64BIT || dpy_type == TUI_DFLOAT_REGS) + col_width = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH; else { - if (dpyType == TUI_SFLOAT_REGS) - colWidth = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH; + if (dpy_type == TUI_SFLOAT_REGS) + col_width = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH; else - colWidth = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH; + col_width = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH; } - colCount = (dataWin->generic.width - 2) / colWidth; + col_count = (TUI_DATA_WIN->generic.width - 2) / col_width; - return colCount; -} /* tuiCalulateRegsColumnCount */ + return col_count; +} -/* Show the registers int the data window as indicated by dpyType. If +/* Show the registers int the data window as indicated by dpy_type. If there is any other registers being displayed, then they are - cleared. What registers are displayed is dependent upon dpyType. */ + cleared. What registers are displayed is dependent upon dpy_type. */ void -tui_show_registers (TuiRegisterDisplayType dpyType) +tui_show_registers (enum tui_register_display_type dpy_type) { - TuiStatus ret = TUI_FAILURE; - int refreshValuesOnly = FALSE; + enum tui_status ret = TUI_FAILURE; + int refresh_values_only = FALSE; /* Say that registers should be displayed, even if there is a problem */ - dataWin->detail.dataDisplayInfo.displayRegs = TRUE; + TUI_DATA_WIN->detail.data_display_info.display_regs = TRUE; if (target_has_registers) { - refreshValuesOnly = - (dpyType == dataWin->detail.dataDisplayInfo.regsDisplayType); - switch (dpyType) + refresh_values_only = + (dpy_type == TUI_DATA_WIN->detail.data_display_info.regs_display_type); + switch (dpy_type) { case TUI_GENERAL_REGS: - ret = _tuiSetGeneralRegsContent (refreshValuesOnly); + ret = tui_set_general_regs_content (refresh_values_only); break; case TUI_SFLOAT_REGS: case TUI_DFLOAT_REGS: - ret = _tuiSetFloatRegsContent (dpyType, refreshValuesOnly); + ret = tui_set_float_regs_content (dpy_type, refresh_values_only); break; /* could ifdef out */ case TUI_SPECIAL_REGS: - ret = _tuiSetSpecialRegsContent (refreshValuesOnly); + ret = tui_set_special_regs_content (refresh_values_only); break; case TUI_GENERAL_AND_SPECIAL_REGS: - ret = _tuiSetGeneralAndSpecialRegsContent (refreshValuesOnly); + ret = tui_set_general_and_special_regs_content (refresh_values_only); break; /* end of potential if def */ @@ -248,110 +240,110 @@ tui_show_registers (TuiRegisterDisplayType dpyType) } if (ret == TUI_FAILURE) { - dataWin->detail.dataDisplayInfo.regsDisplayType = TUI_UNDEFINED_REGS; - tuiEraseDataContent (NO_REGS_STRING); + TUI_DATA_WIN->detail.data_display_info.regs_display_type = TUI_UNDEFINED_REGS; + tui_erase_data_content (NO_REGS_STRING); } else { int i; /* Clear all notation of changed values */ - for (i = 0; (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++) + for (i = 0; (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); i++) { - TuiGenWinInfoPtr dataItemWin; + struct tui_gen_win_info * data_item_win; - dataItemWin = &dataWin->detail.dataDisplayInfo. - regsContent[i]->whichElement.dataWindow; - (&((TuiWinElementPtr) - dataItemWin->content[0])->whichElement.data)->highlight = FALSE; + data_item_win = &TUI_DATA_WIN->detail.data_display_info. + regs_content[i]->which_element.data_window; + (&((struct tui_win_element *) + data_item_win->content[0])->which_element.data)->highlight = FALSE; } - dataWin->detail.dataDisplayInfo.regsDisplayType = dpyType; - tuiDisplayAllData (); + TUI_DATA_WIN->detail.data_display_info.regs_display_type = dpy_type; + tui_display_all_data (); } - (tuiLayoutDef ())->regsDisplayType = dpyType; + (tui_layout_def ())->regs_display_type = dpy_type; return; } /* Function to display the registers in the content from - 'startElementNo' until the end of the register content or the end + 'start_element_no' until the end of the register content or the end of the display height. No checking for displaying past the end of the registers is done here. */ void -tui_display_registers_from (int startElementNo) +tui_display_registers_from (int start_element_no) { - if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL && - dataWin->detail.dataDisplayInfo.regsContentCount > 0) + if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL && + TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0) { - register int i = startElementNo; - int j, valueCharsWide, itemWinWidth, curY, labelWidth; + int i = start_element_no; + int j, value_chars_wide, item_win_width, cur_y, label_width; enum precision_type precision; - precision = (dataWin->detail.dataDisplayInfo.regsDisplayType + precision = (TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS) ? double_precision : unspecified_precision; if (IS_64BIT || - dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS) + TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS) { - valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH; - labelWidth = DOUBLE_FLOAT_LABEL_WIDTH; + value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH; + label_width = DOUBLE_FLOAT_LABEL_WIDTH; } else { - if (dataWin->detail.dataDisplayInfo.regsDisplayType == + if (TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_SFLOAT_REGS) { - valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH; - labelWidth = SINGLE_FLOAT_LABEL_WIDTH; + value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH; + label_width = SINGLE_FLOAT_LABEL_WIDTH; } else { - valueCharsWide = SINGLE_VALUE_WIDTH; - labelWidth = SINGLE_LABEL_WIDTH; + value_chars_wide = SINGLE_VALUE_WIDTH; + label_width = SINGLE_LABEL_WIDTH; } } - itemWinWidth = valueCharsWide + labelWidth; + item_win_width = value_chars_wide + label_width; /* ** Now create each data "sub" window, and write the display into it. */ - curY = 1; - while (i < dataWin->detail.dataDisplayInfo.regsContentCount && - curY <= dataWin->generic.viewportHeight) + cur_y = 1; + while (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count && + cur_y <= TUI_DATA_WIN->generic.viewport_height) { for (j = 0; - (j < dataWin->detail.dataDisplayInfo.regsColumnCount && - i < dataWin->detail.dataDisplayInfo.regsContentCount); j++) + (j < TUI_DATA_WIN->detail.data_display_info.regs_column_count && + i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); j++) { - TuiGenWinInfoPtr dataItemWin; - TuiDataElementPtr dataElementPtr; + struct tui_gen_win_info * data_item_win; + struct tui_data_element * data_element_ptr; /* create the window if necessary */ - dataItemWin = &dataWin->detail.dataDisplayInfo. - regsContent[i]->whichElement.dataWindow; - dataElementPtr = &((TuiWinElementPtr) - dataItemWin->content[0])->whichElement.data; - if (dataItemWin->handle == (WINDOW *) NULL) + data_item_win = &TUI_DATA_WIN->detail.data_display_info. + regs_content[i]->which_element.data_window; + data_element_ptr = &((struct tui_win_element *) + data_item_win->content[0])->which_element.data; + if (data_item_win->handle == (WINDOW *) NULL) { - dataItemWin->height = 1; - dataItemWin->width = (precision == double_precision) ? - itemWinWidth + 2 : itemWinWidth + 1; - dataItemWin->origin.x = (itemWinWidth * j) + 1; - dataItemWin->origin.y = curY; - makeWindow (dataItemWin, DONT_BOX_WINDOW); - scrollok (dataItemWin->handle, FALSE); + data_item_win->height = 1; + data_item_win->width = (precision == double_precision) ? + item_win_width + 2 : item_win_width + 1; + data_item_win->origin.x = (item_win_width * j) + 1; + data_item_win->origin.y = cur_y; + tui_make_window (data_item_win, DONT_BOX_WINDOW); + scrollok (data_item_win->handle, FALSE); } - touchwin (dataItemWin->handle); + touchwin (data_item_win->handle); /* ** Get the printable representation of the register ** and display it */ - _tuiDisplayRegister ( - dataElementPtr->itemNo, dataItemWin, precision); + tui_display_register ( + data_element_ptr->item_no, data_item_win, precision); i++; /* next register */ } - curY++; /* next row; */ + cur_y++; /* next row; */ } } @@ -359,79 +351,73 @@ tui_display_registers_from (int startElementNo) } -/* - ** tuiDisplayRegElementAtLine(). - ** Function to display the registers in the content from - ** 'startElementNo' on 'startLineNo' until the end of the - ** register content or the end of the display height. - ** This function checks that we won't display off the end - ** of the register display. - */ +/* Function to display the registers in the content from + 'start_element_no' on 'start_line_no' until the end of the register + content or the end of the display height. This function checks + that we won't display off the end of the register display. */ void -tuiDisplayRegElementAtLine (int startElementNo, int startLineNo) +tui_display_reg_element_at_line (int start_element_no, int start_line_no) { - if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL && - dataWin->detail.dataDisplayInfo.regsContentCount > 0) + if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL && + TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0) { - register int elementNo = startElementNo; + int element_no = start_element_no; - if (startElementNo != 0 && startLineNo != 0) + if (start_element_no != 0 && start_line_no != 0) { - register int lastLineNo, firstLineOnLastPage; + int last_line_no, first_line_on_last_page; - lastLineNo = tui_last_regs_line_no (); - firstLineOnLastPage = lastLineNo - (dataWin->generic.height - 2); - if (firstLineOnLastPage < 0) - firstLineOnLastPage = 0; + last_line_no = tui_last_regs_line_no (); + first_line_on_last_page = last_line_no - (TUI_DATA_WIN->generic.height - 2); + if (first_line_on_last_page < 0) + first_line_on_last_page = 0; /* ** If there is no other data displayed except registers, - ** and the elementNo causes us to scroll past the end of the + ** and the element_no causes us to scroll past the end of the ** registers, adjust what element to really start the display at. */ - if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0 && - startLineNo > firstLineOnLastPage) - elementNo = tui_first_reg_element_no_inline (firstLineOnLastPage); + if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 && + start_line_no > first_line_on_last_page) + element_no = tui_first_reg_element_no_inline (first_line_on_last_page); } - tui_display_registers_from (elementNo); + tui_display_registers_from (element_no); } - - return; -} /* tuiDisplayRegElementAtLine */ +} -/* Function to display the registers starting at line lineNo in the +/* Function to display the registers starting at line line_no in the data window. Answers the line number that the display actually started from. If nothing is displayed (-1) is returned. */ int -tui_display_registers_from_line (int lineNo, int forceDisplay) +tui_display_registers_from_line (int line_no, int force_display) { - if (dataWin->detail.dataDisplayInfo.regsContentCount > 0) + if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0) { - int line, elementNo; + int line, element_no; - if (lineNo < 0) + if (line_no < 0) line = 0; - else if (forceDisplay) + else if (force_display) { /* - ** If we must display regs (forceDisplay is true), then make + ** If we must display regs (force_display is true), then make ** sure that we don't display off the end of the registers. */ - if (lineNo >= tui_last_regs_line_no ()) + if (line_no >= tui_last_regs_line_no ()) { if ((line = tui_line_from_reg_element_no ( - dataWin->detail.dataDisplayInfo.regsContentCount - 1)) < 0) + TUI_DATA_WIN->detail.data_display_info.regs_content_count - 1)) < 0) line = 0; } else - line = lineNo; + line = line_no; } else - line = lineNo; + line = line_no; - elementNo = tui_first_reg_element_no_inline (line); - if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount) - tuiDisplayRegElementAtLine (elementNo, line); + element_no = tui_first_reg_element_no_inline (line); + if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count) + tui_display_reg_element_at_line (element_no, line); else line = (-1); @@ -448,51 +434,51 @@ tui_display_registers_from_line (int lineNo, int forceDisplay) void tui_check_register_values (struct frame_info *frame) { - if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible) + if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible) { - if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0 && - dataWin->detail.dataDisplayInfo.displayRegs) - tui_show_registers ((tuiLayoutDef ())->regsDisplayType); + if (TUI_DATA_WIN->detail.data_display_info.regs_content_count <= 0 && + TUI_DATA_WIN->detail.data_display_info.display_regs) + tui_show_registers ((tui_layout_def ())->regs_display_type); else { int i, j; - char rawBuf[MAX_REGISTER_SIZE]; + char raw_buf[MAX_REGISTER_SIZE]; for (i = 0; - (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++) + (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); i++) { - TuiDataElementPtr dataElementPtr; - TuiGenWinInfoPtr dataItemWinPtr; - int wasHilighted; - - dataItemWinPtr = &dataWin->detail.dataDisplayInfo. - regsContent[i]->whichElement.dataWindow; - dataElementPtr = &((TuiWinElementPtr) - dataItemWinPtr->content[0])->whichElement.data; - wasHilighted = dataElementPtr->highlight; - dataElementPtr->highlight = - _tuiRegValueHasChanged (dataElementPtr, frame, &rawBuf[0]); - if (dataElementPtr->highlight) + struct tui_data_element * data_element_ptr; + struct tui_gen_win_info * data_item_win_ptr; + int was_hilighted; + + data_item_win_ptr = &TUI_DATA_WIN->detail.data_display_info. + regs_content[i]->which_element.data_window; + data_element_ptr = &((struct tui_win_element *) + data_item_win_ptr->content[0])->which_element.data; + was_hilighted = data_element_ptr->highlight; + data_element_ptr->highlight = + tui_reg_value_has_changed (data_element_ptr, frame, &raw_buf[0]); + if (data_element_ptr->highlight) { int size; - size = DEPRECATED_REGISTER_RAW_SIZE (dataElementPtr->itemNo); + size = DEPRECATED_REGISTER_RAW_SIZE (data_element_ptr->item_no); for (j = 0; j < size; j++) - ((char *) dataElementPtr->value)[j] = rawBuf[j]; - _tuiDisplayRegister ( - dataElementPtr->itemNo, - dataItemWinPtr, - ((dataWin->detail.dataDisplayInfo.regsDisplayType == + ((char *) data_element_ptr->value)[j] = raw_buf[j]; + tui_display_register ( + data_element_ptr->item_no, + data_item_win_ptr, + ((TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS) ? double_precision : unspecified_precision)); } - else if (wasHilighted) + else if (was_hilighted) { - dataElementPtr->highlight = FALSE; - _tuiDisplayRegister ( - dataElementPtr->itemNo, - dataItemWinPtr, - ((dataWin->detail.dataDisplayInfo.regsDisplayType == + data_element_ptr->highlight = FALSE; + tui_display_register ( + data_element_ptr->item_no, + data_item_win_ptr, + ((TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS) ? double_precision : unspecified_precision)); } @@ -504,47 +490,47 @@ tui_check_register_values (struct frame_info *frame) /* - ** tuiToggleFloatRegs(). + ** tui_toggle_float_regs(). */ void -tuiToggleFloatRegs (void) +tui_toggle_float_regs (void) { - TuiLayoutDefPtr layoutDef = tuiLayoutDef (); + struct tui_layout_def * layout_def = tui_layout_def (); - if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS) - layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS; + if (layout_def->float_regs_display_type == TUI_SFLOAT_REGS) + layout_def->float_regs_display_type = TUI_DFLOAT_REGS; else - layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS; + layout_def->float_regs_display_type = TUI_SFLOAT_REGS; - if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible && - (dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_SFLOAT_REGS || - dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)) - tui_show_registers (layoutDef->floatRegsDisplayType); + if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible && + (TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_SFLOAT_REGS || + TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)) + tui_show_registers (layout_def->float_regs_display_type); return; -} /* tuiToggleFloatRegs */ +} /* tui_toggle_float_regs */ void -_initialize_tuiRegs (void) +_initialize_tui_regs (void) { if (xdb_commands) { - add_com ("fr", class_tui, _tuiShowFloat_command, + add_com ("fr", class_tui, tui_show_float_command, "Display only floating point registers\n"); - add_com ("gr", class_tui, _tuiShowGeneral_command, + add_com ("gr", class_tui, tui_show_general_command, "Display only general registers\n"); - add_com ("sr", class_tui, _tuiShowSpecial_command, + add_com ("sr", class_tui, tui_show_special_command, "Display only special registers\n"); - add_com ("+r", class_tui, _tuiScrollRegsForward_command, + add_com ("+r", class_tui, tui_scroll_regs_forward_command, "Scroll the registers window forward\n"); - add_com ("-r", class_tui, _tuiScrollRegsBackward_command, + add_com ("-r", class_tui, tui_scroll_regs_backward_command, "Scroll the register window backward\n"); - add_com ("tf", class_tui, _tuiToggleFloatRegs_command, + add_com ("tf", class_tui, _tui_toggle_float_regs_command, "Toggle between single and double precision floating point registers.\n"); add_cmd (TUI_FLOAT_REGS_NAME_LOWER, class_tui, - _tuiToggleFloatRegs_command, + _tui_toggle_float_regs_command, "Toggle between single and double precision floating point \ registers.\n", &togglelist); @@ -558,13 +544,13 @@ registers.\n", /* - ** _tuiRegisterName(). + ** tui_register_name(). ** Return the register name. */ static const char * -_tuiRegisterName (int regNum) +tui_register_name (int reg_num) { - return REGISTER_NAME (regNum); + return REGISTER_NAME (reg_num); } extern int pagination_enabled; @@ -577,13 +563,13 @@ tui_restore_gdbout (void *ui) } /* - ** _tuiRegisterFormat + ** tui_register_format ** Function to format the register name and value into a buffer, ** suitable for printing or display */ static void -_tuiRegisterFormat (char *buf, int bufLen, int regNum, - TuiDataElementPtr dataElement, +tui_register_format (char *buf, int buf_len, int reg_num, + struct tui_data_element * data_element, enum precision_type precision) { struct ui_file *stream; @@ -593,7 +579,7 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum, char *p; int pos; - name = REGISTER_NAME (regNum); + name = REGISTER_NAME (reg_num); if (name == 0) { strcpy (buf, ""); @@ -602,30 +588,30 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum, pagination_enabled = 0; old_stdout = gdb_stdout; - stream = tui_sfileopen (bufLen); + stream = tui_sfileopen (buf_len); gdb_stdout = stream; cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout); gdbarch_print_registers_info (current_gdbarch, stream, deprecated_selected_frame, - regNum, 1); + reg_num, 1); /* Save formatted output in the buffer. */ p = tui_file_get_strbuf (stream); pos = 0; - while (*p && *p == *name++ && bufLen) + while (*p && *p == *name++ && buf_len) { *buf++ = *p++; - bufLen--; + buf_len--; pos++; } while (*p == ' ') p++; - while (pos < 8 && bufLen) + while (pos < 8 && buf_len) { *buf++ = ' '; - bufLen--; + buf_len--; pos++; } - strncpy (buf, p, bufLen); + strncpy (buf, p, buf_len); /* Remove the possible \n. */ p = strchr (buf, '\n'); @@ -637,20 +623,18 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum, #define NUM_GENERAL_REGS 32 -/* - ** _tuiSetGeneralRegsContent(). - ** Set the content of the data window to consist of the general registers. - */ -static TuiStatus -_tuiSetGeneralRegsContent (int refreshValuesOnly) +/* Set the content of the data window to consist of the general + registers. */ +static enum tui_status +tui_set_general_regs_content (int refresh_values_only) { - return (_tuiSetRegsContent (0, + return (tui_set_regs_content (0, NUM_GENERAL_REGS - 1, deprecated_selected_frame, TUI_GENERAL_REGS, - refreshValuesOnly)); + refresh_values_only)); -} /* _tuiSetGeneralRegsContent */ +} #ifndef PCOQ_HEAD_REGNUM @@ -659,365 +643,336 @@ _tuiSetGeneralRegsContent (int refreshValuesOnly) #define START_SPECIAL_REGS PCOQ_HEAD_REGNUM #endif -/* - ** _tuiSetSpecialRegsContent(). - ** Set the content of the data window to consist of the special registers. - */ -static TuiStatus -_tuiSetSpecialRegsContent (int refreshValuesOnly) +/* Set the content of the data window to consist of the special + registers. */ +static enum tui_status +tui_set_special_regs_content (int refresh_values_only) { - TuiStatus ret = TUI_FAILURE; - int endRegNum; + enum tui_status ret = TUI_FAILURE; + int end_reg_num; - endRegNum = FP0_REGNUM - 1; - ret = _tuiSetRegsContent (START_SPECIAL_REGS, - endRegNum, + end_reg_num = FP0_REGNUM - 1; + ret = tui_set_regs_content (START_SPECIAL_REGS, + end_reg_num, deprecated_selected_frame, TUI_SPECIAL_REGS, - refreshValuesOnly); + refresh_values_only); return ret; -} /* _tuiSetSpecialRegsContent */ +} -/* - ** _tuiSetGeneralAndSpecialRegsContent(). - ** Set the content of the data window to consist of the special registers. - */ -static TuiStatus -_tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly) +/* Set the content of the data window to consist of the special + registers. */ +static enum tui_status +tui_set_general_and_special_regs_content (int refresh_values_only) { - TuiStatus ret = TUI_FAILURE; - int endRegNum = (-1); + enum tui_status ret = TUI_FAILURE; + int end_reg_num = (-1); - endRegNum = FP0_REGNUM - 1; - ret = _tuiSetRegsContent ( - 0, endRegNum, deprecated_selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly); + end_reg_num = FP0_REGNUM - 1; + ret = tui_set_regs_content ( + 0, end_reg_num, deprecated_selected_frame, TUI_SPECIAL_REGS, refresh_values_only); return ret; -} /* _tuiSetGeneralAndSpecialRegsContent */ +} -/* - ** _tuiSetFloatRegsContent(). - ** Set the content of the data window to consist of the float registers. - */ -static TuiStatus -_tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType, int refreshValuesOnly) +/* Set the content of the data window to consist of the float + registers. */ +static enum tui_status +tui_set_float_regs_content (enum tui_register_display_type dpy_type, + int refresh_values_only) { - TuiStatus ret = TUI_FAILURE; - int startRegNum; + enum tui_status ret = TUI_FAILURE; + int start_reg_num; - startRegNum = FP0_REGNUM; - ret = _tuiSetRegsContent (startRegNum, + start_reg_num = FP0_REGNUM; + ret = tui_set_regs_content (start_reg_num, NUM_REGS - 1, deprecated_selected_frame, - dpyType, - refreshValuesOnly); + dpy_type, + refresh_values_only); return ret; -} /* _tuiSetFloatRegsContent */ +} -/* - ** _tuiRegValueHasChanged(). - ** Answer TRUE if the register's value has changed, FALSE otherwise. - ** If TRUE, newValue is filled in with the new value. - */ +/* Answer TRUE if the register's value has changed, FALSE otherwise. + If TRUE, new_value is filled in with the new value. */ static int -_tuiRegValueHasChanged (TuiDataElementPtr dataElement, - struct frame_info *frame, - char *newValue) +tui_reg_value_has_changed (struct tui_data_element * data_element, + struct frame_info *frame, char *new_value) { - int hasChanged = FALSE; + int has_changed = FALSE; - if (dataElement->itemNo != UNDEFINED_ITEM && - _tuiRegisterName (dataElement->itemNo) != (char *) NULL) + if (data_element->item_no != UNDEFINED_ITEM && + tui_register_name (data_element->item_no) != (char *) NULL) { - char rawBuf[MAX_REGISTER_SIZE]; + char raw_buf[MAX_REGISTER_SIZE]; int i; - if (_tuiGetRegisterRawValue ( - dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS) + if (tui_get_register_raw_value (data_element->item_no, raw_buf, frame) == TUI_SUCCESS) { - int size = DEPRECATED_REGISTER_RAW_SIZE (dataElement->itemNo); + int size = DEPRECATED_REGISTER_RAW_SIZE (data_element->item_no); - for (i = 0; (i < size && !hasChanged); i++) - hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]); - if (hasChanged && newValue != (char *) NULL) + for (i = 0; (i < size && !has_changed); i++) + has_changed = (((char *) data_element->value)[i] != raw_buf[i]); + if (has_changed && new_value != (char *) NULL) { for (i = 0; i < size; i++) - newValue[i] = rawBuf[i]; + new_value[i] = raw_buf[i]; } } } - return hasChanged; -} /* _tuiRegValueHasChanged */ + return has_changed; +} -/* - ** _tuiGetRegisterRawValue(). - ** Get the register raw value. The raw value is returned in regValue. - */ -static TuiStatus -_tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame) +/* Get the register raw value. The raw value is returned in reg_value. */ +static enum tui_status +tui_get_register_raw_value (int reg_num, char *reg_value, struct frame_info *frame) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; if (target_has_registers) { - get_frame_register (frame, regNum, regValue); + get_frame_register (frame, reg_num, reg_value); /* NOTE: cagney/2003-03-13: This is bogus. It is refering to the register cache and not the frame which could have pulled the register value off the stack. */ - if (register_cached (regNum) >= 0) + if (register_cached (reg_num) >= 0) ret = TUI_SUCCESS; } return ret; -} /* _tuiGetRegisterRawValue */ +} -/* - ** _tuiSetRegisterElement(). - ** Function to initialize a data element with the input and - ** the register value. - */ +/* Function to initialize a data element with the input and the + register value. */ static void -_tuiSetRegisterElement (int regNum, struct frame_info *frame, - TuiDataElementPtr dataElement, - int refreshValueOnly) +tui_set_register_element (int reg_num, struct frame_info *frame, + struct tui_data_element * data_element, + int refresh_value_only) { - if (dataElement != (TuiDataElementPtr) NULL) + if (data_element != (struct tui_data_element *) NULL) { - if (!refreshValueOnly) + if (!refresh_value_only) { - dataElement->itemNo = regNum; - dataElement->name = _tuiRegisterName (regNum); - dataElement->highlight = FALSE; + data_element->item_no = reg_num; + data_element->name = tui_register_name (reg_num); + data_element->highlight = FALSE; } - if (dataElement->value == (Opaque) NULL) - dataElement->value = (Opaque) xmalloc (MAX_REGISTER_SIZE); - if (dataElement->value != (Opaque) NULL) - _tuiGetRegisterRawValue (regNum, dataElement->value, frame); + if (data_element->value == NULL) + data_element->value = xmalloc (MAX_REGISTER_SIZE); + if (data_element->value != NULL) + tui_get_register_raw_value (reg_num, data_element->value, frame); } - - return; -} /* _tuiSetRegisterElement */ +} -/* - ** _tuiSetRegsContent(). - ** Set the content of the data window to consist of the registers - ** numbered from startRegNum to endRegNum. Note that if - ** refreshValuesOnly is TRUE, startRegNum and endRegNum are ignored. - */ -static TuiStatus -_tuiSetRegsContent (int startRegNum, int endRegNum, +/* Set the content of the data window to consist of the registers + numbered from start_reg_num to end_reg_num. Note that if + refresh_values_only is TRUE, start_reg_num and end_reg_num are + ignored. */ +static enum tui_status +tui_set_regs_content (int start_reg_num, int end_reg_num, struct frame_info *frame, - TuiRegisterDisplayType dpyType, - int refreshValuesOnly) + enum tui_register_display_type dpy_type, + int refresh_values_only) { - TuiStatus ret = TUI_FAILURE; - int numRegs = endRegNum - startRegNum + 1; - int allocatedHere = FALSE; + enum tui_status ret = TUI_FAILURE; + int num_regs = end_reg_num - start_reg_num + 1; + int allocated_here = FALSE; - if (dataWin->detail.dataDisplayInfo.regsContentCount > 0 && - !refreshValuesOnly) + if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0 && + !refresh_values_only) { - freeDataContent (dataWin->detail.dataDisplayInfo.regsContent, - dataWin->detail.dataDisplayInfo.regsContentCount); - dataWin->detail.dataDisplayInfo.regsContentCount = 0; + tui_free_data_content (TUI_DATA_WIN->detail.data_display_info.regs_content, + TUI_DATA_WIN->detail.data_display_info.regs_content_count); + TUI_DATA_WIN->detail.data_display_info.regs_content_count = 0; } - if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0) + if (TUI_DATA_WIN->detail.data_display_info.regs_content_count <= 0) { - dataWin->detail.dataDisplayInfo.regsContent = - allocContent (numRegs, DATA_WIN); - allocatedHere = TRUE; + TUI_DATA_WIN->detail.data_display_info.regs_content = + tui_alloc_content (num_regs, DATA_WIN); + allocated_here = TRUE; } - if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL) + if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL) { int i; - if (!refreshValuesOnly || allocatedHere) + if (!refresh_values_only || allocated_here) { - dataWin->generic.content = (OpaquePtr) NULL; - dataWin->generic.contentSize = 0; - addContentElements (&dataWin->generic, numRegs); - dataWin->detail.dataDisplayInfo.regsContent = - (TuiWinContent) dataWin->generic.content; - dataWin->detail.dataDisplayInfo.regsContentCount = numRegs; + TUI_DATA_WIN->generic.content = NULL; + TUI_DATA_WIN->generic.content_size = 0; + tui_add_content_elements (&TUI_DATA_WIN->generic, num_regs); + TUI_DATA_WIN->detail.data_display_info.regs_content = + (tui_win_content) TUI_DATA_WIN->generic.content; + TUI_DATA_WIN->detail.data_display_info.regs_content_count = num_regs; } /* ** Now set the register names and values */ - for (i = startRegNum; (i <= endRegNum); i++) + for (i = start_reg_num; (i <= end_reg_num); i++) { - TuiGenWinInfoPtr dataItemWin; + struct tui_gen_win_info * data_item_win; - dataItemWin = &dataWin->detail.dataDisplayInfo. - regsContent[i - startRegNum]->whichElement.dataWindow; - _tuiSetRegisterElement ( + data_item_win = &TUI_DATA_WIN->detail.data_display_info. + regs_content[i - start_reg_num]->which_element.data_window; + tui_set_register_element ( i, frame, - &((TuiWinElementPtr) dataItemWin->content[0])->whichElement.data, - !allocatedHere && refreshValuesOnly); + &((struct tui_win_element *) data_item_win->content[0])->which_element.data, + !allocated_here && refresh_values_only); } - dataWin->detail.dataDisplayInfo.regsColumnCount = - tui_calculate_regs_column_count (dpyType); + TUI_DATA_WIN->detail.data_display_info.regs_column_count = + tui_calculate_regs_column_count (dpy_type); #ifdef LATER - if (dataWin->detail.dataDisplayInfo.dataContentCount > 0) + if (TUI_DATA_WIN->detail.data_display_info.data_content_count > 0) { /* delete all the windows? */ - /* realloc content equal to dataContentCount + regsContentCount */ - /* append dataWin->detail.dataDisplayInfo.dataContent to content */ + /* realloc content equal to data_content_count + regs_content_count */ + /* append TUI_DATA_WIN->detail.data_display_info.data_content to content */ } #endif - dataWin->generic.contentSize = - dataWin->detail.dataDisplayInfo.regsContentCount + - dataWin->detail.dataDisplayInfo.dataContentCount; + TUI_DATA_WIN->generic.content_size = + TUI_DATA_WIN->detail.data_display_info.regs_content_count + + TUI_DATA_WIN->detail.data_display_info.data_content_count; ret = TUI_SUCCESS; } return ret; -} /* _tuiSetRegsContent */ +} -/* - ** _tuiDisplayRegister(). - ** Function to display a register in a window. If hilite is TRUE, - ** than the value will be displayed in reverse video - */ +/* Function to display a register in a window. If hilite is TRUE, + than the value will be displayed in reverse video. */ static void -_tuiDisplayRegister (int regNum, - TuiGenWinInfoPtr winInfo, /* the data item window */ +tui_display_register (int reg_num, + struct tui_gen_win_info * win_info, /* the data item window */ enum precision_type precision) { - if (winInfo->handle != (WINDOW *) NULL) + if (win_info->handle != (WINDOW *) NULL) { int i; char buf[40]; - int valueCharsWide, labelWidth; - TuiDataElementPtr dataElementPtr = &((TuiWinContent) - winInfo->content)[0]->whichElement.data; + int value_chars_wide, label_width; + struct tui_data_element * data_element_ptr = &((tui_win_content) + win_info->content)[0]->which_element.data; if (IS_64BIT || - dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS) + TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS) { - valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH; - labelWidth = DOUBLE_FLOAT_LABEL_WIDTH; + value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH; + label_width = DOUBLE_FLOAT_LABEL_WIDTH; } else { - if (dataWin->detail.dataDisplayInfo.regsDisplayType == + if (TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_SFLOAT_REGS) { - valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH; - labelWidth = SINGLE_FLOAT_LABEL_WIDTH; + value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH; + label_width = SINGLE_FLOAT_LABEL_WIDTH; } else { - valueCharsWide = SINGLE_VALUE_WIDTH; - labelWidth = SINGLE_LABEL_WIDTH; + value_chars_wide = SINGLE_VALUE_WIDTH; + label_width = SINGLE_LABEL_WIDTH; } } buf[0] = (char) 0; - _tuiRegisterFormat (buf, - valueCharsWide + labelWidth, - regNum, - dataElementPtr, + tui_register_format (buf, + value_chars_wide + label_width, + reg_num, + data_element_ptr, precision); - if (dataElementPtr->highlight) - wstandout (winInfo->handle); + if (data_element_ptr->highlight) + wstandout (win_info->handle); - wmove (winInfo->handle, 0, 0); - for (i = 1; i < winInfo->width; i++) - waddch (winInfo->handle, ' '); - wmove (winInfo->handle, 0, 0); - waddstr (winInfo->handle, buf); + wmove (win_info->handle, 0, 0); + for (i = 1; i < win_info->width; i++) + waddch (win_info->handle, ' '); + wmove (win_info->handle, 0, 0); + waddstr (win_info->handle, buf); - if (dataElementPtr->highlight) - wstandend (winInfo->handle); - tuiRefreshWin (winInfo); + if (data_element_ptr->highlight) + wstandend (win_info->handle); + tui_refresh_win (win_info); } - return; -} /* _tuiDisplayRegister */ +} static void -_tui_vShowRegisters_commandSupport (TuiRegisterDisplayType dpyType) +tui_v_show_registers_command_support (enum tui_register_display_type dpy_type) { - if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible) + if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible) { /* Data window already displayed, show the registers */ - if (dataWin->detail.dataDisplayInfo.regsDisplayType != dpyType) - tui_show_registers (dpyType); + if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != dpy_type) + tui_show_registers (dpy_type); } else - (tuiLayoutDef ())->regsDisplayType = dpyType; + (tui_layout_def ())->regs_display_type = dpy_type; return; -} /* _tui_vShowRegisters_commandSupport */ +} static void -_tuiShowFloat_command (char *arg, int fromTTY) +tui_show_float_command (char *arg, int from_tty) { - if (m_winPtrIsNull (dataWin) || !dataWin->generic.isVisible || - (dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_SFLOAT_REGS && - dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_DFLOAT_REGS)) - _tui_vShowRegisters_commandSupport ((tuiLayoutDef ())->floatRegsDisplayType); - - return; -} /* _tuiShowFloat_command */ + if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible || + (TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_SFLOAT_REGS && + TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_DFLOAT_REGS)) + tui_v_show_registers_command_support ((tui_layout_def ())->float_regs_display_type); +} static void -_tuiShowGeneral_command (char *arg, int fromTTY) +tui_show_general_command (char *arg, int from_tty) { - _tui_vShowRegisters_commandSupport (TUI_GENERAL_REGS); + tui_v_show_registers_command_support (TUI_GENERAL_REGS); } static void -_tuiShowSpecial_command (char *arg, int fromTTY) +tui_show_special_command (char *arg, int from_tty) { - _tui_vShowRegisters_commandSupport (TUI_SPECIAL_REGS); + tui_v_show_registers_command_support (TUI_SPECIAL_REGS); } static void -_tuiToggleFloatRegs_command (char *arg, int fromTTY) +_tui_toggle_float_regs_command (char *arg, int from_tty) { - if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible) - tuiToggleFloatRegs (); + if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible) + tui_toggle_float_regs (); else { - TuiLayoutDefPtr layoutDef = tuiLayoutDef (); + struct tui_layout_def * layout_def = tui_layout_def (); - if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS) - layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS; + if (layout_def->float_regs_display_type == TUI_SFLOAT_REGS) + layout_def->float_regs_display_type = TUI_DFLOAT_REGS; else - layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS; + layout_def->float_regs_display_type = TUI_SFLOAT_REGS; } - - - return; -} /* _tuiToggleFloatRegs_command */ +} static void -_tuiScrollRegsForward_command (char *arg, int fromTTY) +tui_scroll_regs_forward_command (char *arg, int from_tty) { - tui_scroll (FORWARD_SCROLL, dataWin, 1); + tui_scroll (FORWARD_SCROLL, TUI_DATA_WIN, 1); } static void -_tuiScrollRegsBackward_command (char *arg, int fromTTY) +tui_scroll_regs_backward_command (char *arg, int from_tty) { - tui_scroll (BACKWARD_SCROLL, dataWin, 1); + tui_scroll (BACKWARD_SCROLL, TUI_DATA_WIN, 1); } diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index 19703a2..c4de123 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -25,7 +25,7 @@ #ifndef TUI_REGS_H #define TUI_REGS_H -#include "tui/tui-data.h" /* For TuiRegisterDisplayType. */ +#include "tui/tui-data.h" /* For struct tui_register_display_type. */ extern void tui_check_register_values (struct frame_info *); extern void tui_show_registers (enum tui_register_display_type); diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index f2d3762..5a148a6 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -1,7 +1,7 @@ /* TUI display source window. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -36,39 +36,33 @@ #include "tui/tui-winsource.h" #include "tui/tui-source.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /* Function to display source in the source window. */ -TuiStatus -tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) +enum tui_status +tui_set_source_content (struct symtab *s, int line_no, int noerror) { - TuiStatus ret = TUI_FAILURE; + enum tui_status ret = TUI_FAILURE; if (s != (struct symtab *) NULL && s->filename != (char *) NULL) { - register FILE *stream; - register int i, desc, c, lineWidth, nlines; - register char *srcLine = 0; + FILE *stream; + int i, desc, c, line_width, nlines; + char *src_line = 0; - if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS) + if ((ret = tui_alloc_source_buffer (TUI_SRC_WIN)) == TUI_SUCCESS) { - lineWidth = srcWin->generic.width - 1; + line_width = TUI_SRC_WIN->generic.width - 1; /* Take hilite (window border) into account, when calculating the number of lines */ - nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo; + nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no; desc = open_source_file (s); if (desc < 0) { if (!noerror) { char *name = alloca (strlen (s->filename) + 100); - sprintf (name, "%s:%d", s->filename, lineNo); + sprintf (name, "%s:%d", s->filename, line_no); print_sys_errmsg (name, errno); } ret = TUI_FAILURE; @@ -78,27 +72,27 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) if (s->line_charpos == 0) find_source_lines (s, desc); - if (lineNo < 1 || lineNo > s->nlines) + if (line_no < 1 || line_no > s->nlines) { close (desc); printf_unfiltered ( "Line number %d out of range; %s has %d lines.\n", - lineNo, s->filename, s->nlines); + line_no, s->filename, s->nlines); } - else if (lseek (desc, s->line_charpos[lineNo - 1], 0) < 0) + else if (lseek (desc, s->line_charpos[line_no - 1], 0) < 0) { close (desc); perror_with_name (s->filename); } else { - register int offset, curLineNo, curLine, curLen, threshold; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - TuiSourceInfoPtr src = &srcWin->detail.sourceInfo; + int offset, cur_line_no, cur_line, cur_len, threshold; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + struct tui_source_info * src = &TUI_SRC_WIN->detail.source_info; - if (srcWin->generic.title) - xfree (srcWin->generic.title); - srcWin->generic.title = xstrdup (s->filename); + if (TUI_SRC_WIN->generic.title) + xfree (TUI_SRC_WIN->generic.title); + TUI_SRC_WIN->generic.title = xstrdup (s->filename); if (src->filename) xfree (src->filename); @@ -106,53 +100,53 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) /* Determine the threshold for the length of the line and the offset to start the display. */ - offset = src->horizontalOffset; - threshold = (lineWidth - 1) + offset; + offset = src->horizontal_offset; + threshold = (line_width - 1) + offset; stream = fdopen (desc, FOPEN_RT); clearerr (stream); - curLine = 0; - curLineNo = src->startLineOrAddr.lineNo = lineNo; + cur_line = 0; + cur_line_no = src->start_line_or_addr.line_no = line_no; if (offset > 0) - srcLine = (char *) xmalloc ( + src_line = (char *) xmalloc ( (threshold + 1) * sizeof (char)); - while (curLine < nlines) + while (cur_line < nlines) { - TuiWinElementPtr element = (TuiWinElementPtr) - srcWin->generic.content[curLine]; + struct tui_win_element * element = (struct tui_win_element *) + TUI_SRC_WIN->generic.content[cur_line]; /* get the first character in the line */ c = fgetc (stream); if (offset == 0) - srcLine = ((TuiWinElementPtr) - srcWin->generic.content[ - curLine])->whichElement.source.line; + src_line = ((struct tui_win_element *) + TUI_SRC_WIN->generic.content[ + cur_line])->which_element.source.line; /* Init the line with the line number */ - sprintf (srcLine, "%-6d", curLineNo); - curLen = strlen (srcLine); - i = curLen - - ((curLen / tuiDefaultTabLen ()) * tuiDefaultTabLen ()); - while (i < tuiDefaultTabLen ()) + sprintf (src_line, "%-6d", cur_line_no); + cur_len = strlen (src_line); + i = cur_len - + ((cur_len / tui_default_tab_len ()) * tui_default_tab_len ()); + while (i < tui_default_tab_len ()) { - srcLine[curLen] = ' '; + src_line[cur_len] = ' '; i++; - curLen++; + cur_len++; } - srcLine[curLen] = (char) 0; + src_line[cur_len] = (char) 0; /* Set whether element is the execution point and whether there is a break point on it. */ - element->whichElement.source.lineOrAddr.lineNo = - curLineNo; - element->whichElement.source.isExecPoint = - (strcmp (((TuiWinElementPtr) - locator->content[0])->whichElement.locator.fileName, + element->which_element.source.line_or_addr.line_no = + cur_line_no; + element->which_element.source.is_exec_point = + (strcmp (((struct tui_win_element *) + locator->content[0])->which_element.locator.file_name, s->filename) == 0 - && curLineNo == ((TuiWinElementPtr) - locator->content[0])->whichElement.locator.lineNo); + && cur_line_no == ((struct tui_win_element *) + locator->content[0])->which_element.locator.line_no); if (c != EOF) { - i = strlen (srcLine) - 1; + i = strlen (src_line) - 1; do { if ((c != '\n') && @@ -160,13 +154,13 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) { if (c < 040 && c != '\t') { - srcLine[i++] = '^'; - srcLine[i] = c + 0100; + src_line[i++] = '^'; + src_line[i] = c + 0100; } else if (c == 0177) { - srcLine[i++] = '^'; - srcLine[i] = '?'; + src_line[i++] = '^'; + src_line[i] = '?'; } else { /* Store the charcter in the line @@ -176,20 +170,20 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) buffer. */ if (c == '\t') { - int j, maxTabLen = tuiDefaultTabLen (); + int j, max_tab_len = tui_default_tab_len (); for (j = i - ( - (i / maxTabLen) * maxTabLen); - ((j < maxTabLen) && + (i / max_tab_len) * max_tab_len); + ((j < max_tab_len) && i < threshold); i++, j++) - srcLine[i] = ' '; + src_line[i] = ' '; i--; } else - srcLine[i] = c; + src_line[i] = c; } - srcLine[i + 1] = 0; + src_line[i + 1] = 0; } else { /* If we have not reached EOL, then eat @@ -202,21 +196,21 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) i < threshold && (c = fgetc (stream))); } /* Now copy the line taking the offset into account */ - if (strlen (srcLine) > offset) - strcpy (((TuiWinElementPtr) srcWin->generic.content[ - curLine])->whichElement.source.line, - &srcLine[offset]); + if (strlen (src_line) > offset) + strcpy (((struct tui_win_element *) TUI_SRC_WIN->generic.content[ + cur_line])->which_element.source.line, + &src_line[offset]); else - ((TuiWinElementPtr) - srcWin->generic.content[ - curLine])->whichElement.source.line[0] = (char) 0; - curLine++; - curLineNo++; + ((struct tui_win_element *) + TUI_SRC_WIN->generic.content[ + cur_line])->which_element.source.line[0] = (char) 0; + cur_line++; + cur_line_no++; } if (offset > 0) - tuiFree (srcLine); + xfree (src_line); fclose (stream); - srcWin->generic.contentSize = nlines; + TUI_SRC_WIN->generic.content_size = nlines; ret = TUI_SUCCESS; } } @@ -229,65 +223,65 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror) /* elz: this function sets the contents of the source window to empty except for a line in the middle with a warning message about the source not being available. This function is called by - tuiEraseSourceContents, which in turn is invoked when the source files - cannot be accessed */ + tui_erase_source_contents(), which in turn is invoked when the + source files cannot be accessed. */ void -tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string) +tui_set_source_content_nil (struct tui_win_info * win_info, char *warning_string) { - int lineWidth; - int nLines; + int line_width; + int n_lines; int curr_line = 0; - lineWidth = winInfo->generic.width - 1; - nLines = winInfo->generic.height - 2; + line_width = win_info->generic.width - 1; + n_lines = win_info->generic.height - 2; /* set to empty each line in the window, except for the one which contains the message */ - while (curr_line < winInfo->generic.contentSize) + while (curr_line < win_info->generic.content_size) { /* set the information related to each displayed line to null: i.e. the line number is 0, there is no bp, it is not where the program is stopped */ - TuiWinElementPtr element = - (TuiWinElementPtr) winInfo->generic.content[curr_line]; - element->whichElement.source.lineOrAddr.lineNo = 0; - element->whichElement.source.isExecPoint = FALSE; - element->whichElement.source.hasBreak = FALSE; + struct tui_win_element * element = + (struct tui_win_element *) win_info->generic.content[curr_line]; + element->which_element.source.line_or_addr.line_no = 0; + element->which_element.source.is_exec_point = FALSE; + element->which_element.source.has_break = FALSE; /* set the contents of the line to blank */ - element->whichElement.source.line[0] = (char) 0; + element->which_element.source.line[0] = (char) 0; - /* if the current line is in the middle of the screen, then we want to - display the 'no source available' message in it. - Note: the 'weird' arithmetic with the line width and height comes from - the function tuiEraseSourceContent. We need to keep the screen and the - window's actual contents in synch */ + /* if the current line is in the middle of the screen, then we + want to display the 'no source available' message in it. + Note: the 'weird' arithmetic with the line width and height + comes from the function tui_erase_source_content(). We need + to keep the screen and the window's actual contents in synch. */ - if (curr_line == (nLines / 2 + 1)) + if (curr_line == (n_lines / 2 + 1)) { int i; int xpos; int warning_length = strlen (warning_string); - char *srcLine; + char *src_line; - srcLine = element->whichElement.source.line; + src_line = element->which_element.source.line; - if (warning_length >= ((lineWidth - 1) / 2)) + if (warning_length >= ((line_width - 1) / 2)) xpos = 1; else - xpos = (lineWidth - 1) / 2 - warning_length; + xpos = (line_width - 1) / 2 - warning_length; for (i = 0; i < xpos; i++) - srcLine[i] = ' '; + src_line[i] = ' '; - sprintf (srcLine + i, "%s", warning_string); + sprintf (src_line + i, "%s", warning_string); - for (i = xpos + warning_length; i < lineWidth; i++) - srcLine[i] = ' '; + for (i = xpos + warning_length; i < line_width; i++) + src_line[i] = ' '; - srcLine[i] = '\n'; + src_line[i] = '\n'; } /* end if */ @@ -300,33 +294,34 @@ tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string) /* Function to display source in the source window. This function initializes the horizontal scroll to 0. */ void -tuiShowSource (struct symtab *s, TuiLineOrAddress line, int noerror) +tui_show_symtab_source (struct symtab *s, union tui_line_or_address line, int noerror) { - srcWin->detail.sourceInfo.horizontalOffset = 0; - tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror); + TUI_SRC_WIN->detail.source_info.horizontal_offset = 0; + tui_update_source_window_as_is (TUI_SRC_WIN, s, line, noerror); } -/* Answer whether the source is currently displayed in the source window. */ +/* Answer whether the source is currently displayed in the source + window. */ int -tuiSourceIsDisplayed (char *fname) +tui_source_is_displayed (char *fname) { - return (srcWin->generic.contentInUse && - (strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())-> - content[0])->whichElement.locator.fileName, fname) == 0)); + return (TUI_SRC_WIN->generic.content_in_use && + (strcmp (((struct tui_win_element *) (tui_locator_win_info_ptr ())-> + content[0])->which_element.locator.file_name, fname) == 0)); } /* Scroll the source forward or backward vertically. */ void -tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, - int numToScroll) +tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction, + int num_to_scroll) { - if (srcWin->generic.content != (OpaquePtr) NULL) + if (TUI_SRC_WIN->generic.content != NULL) { - TuiLineOrAddress l; + union tui_line_or_address l; struct symtab *s; - TuiWinContent content = (TuiWinContent) srcWin->generic.content; + tui_win_content content = (tui_win_content) TUI_SRC_WIN->generic.content; struct symtab_and_line cursal = get_current_source_symtab_and_line (); if (cursal.symtab == (struct symtab *) NULL) @@ -334,23 +329,23 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, else s = cursal.symtab; - if (scrollDirection == FORWARD_SCROLL) + if (scroll_direction == FORWARD_SCROLL) { - l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo + - numToScroll; - if (l.lineNo > s->nlines) - /*line = s->nlines - winInfo->generic.contentSize + 1; */ + l.line_no = content[0]->which_element.source.line_or_addr.line_no + + num_to_scroll; + if (l.line_no > s->nlines) + /*line = s->nlines - win_info->generic.content_size + 1; */ /*elz: fix for dts 23398 */ - l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo; + l.line_no = content[0]->which_element.source.line_or_addr.line_no; } else { - l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo - - numToScroll; - if (l.lineNo <= 0) - l.lineNo = 1; + l.line_no = content[0]->which_element.source.line_or_addr.line_no - + num_to_scroll; + if (l.line_no <= 0) + l.line_no = 1; } - print_source_lines (s, l.lineNo, l.lineNo + 1, 0); + print_source_lines (s, l.line_no, l.line_no + 1, 0); } } diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h index 96cf865..3b61ca4 100644 --- a/gdb/tui/tui-source.h +++ b/gdb/tui/tui-source.h @@ -1,5 +1,8 @@ /* TUI display source window. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,15 +22,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _TUI_SOURCE_H -#define _TUI_SOURCE_H +#ifndef TUI_SOURCE_H +#define TUI_SOURCE_H + +#include "tui/tui-data.h" + +struct symtab; +struct tui_win_info; -#include "defs.h" +extern void tui_set_source_content_nil (struct tui_win_info *, char *); -extern TuiStatus tuiSetSourceContent (struct symtab *, int, int); -extern void tuiShowSource (struct symtab *, TuiLineOrAddress, int); -extern int tuiSourceIsDisplayed (char *); -extern void tuiVerticalSourceScroll (TuiScrollDirection, int); +extern enum tui_status tui_set_source_content (struct symtab *, int, int); +extern void tui_show_symtab_source (struct symtab *, union tui_line_or_address, int); +extern int tui_source_is_displayed (char *); +extern void tui_vertical_source_scroll (enum tui_scroll_direction, int); #endif -/*_TUI_SOURCE_H*/ diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 6bf64bb..0ee5389 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -1,7 +1,7 @@ /* TUI display locator. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -30,7 +30,7 @@ #include "inferior.h" #include "target.h" #include "top.h" - +#include "gdb_string.h" #include "tui/tui.h" #include "tui/tui-data.h" #include "tui/tui-stack.h" @@ -39,13 +39,7 @@ #include "tui/tui-winsource.h" #include "tui/tui-file.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /* Get a printable name for the function at the address. The symbol name is demangled if demangling is turned on. @@ -66,7 +60,7 @@ static void tui_update_command (char *, int); can on this single line: target name, process number, current function, current line, current PC, SingleKey mode. */ static char* -tui_make_status_line (TuiLocatorElement* loc) +tui_make_status_line (struct tui_locator_element* loc) { char* string; char line_buf[50], *pname; @@ -94,13 +88,13 @@ tui_make_status_line (TuiLocatorElement* loc) if (pid_width > MAX_PID_WIDTH) pid_width = MAX_PID_WIDTH; - status_size = termWidth (); + status_size = tui_term_width (); string = (char *) xmalloc (status_size + 1); buf = (char*) alloca (status_size + 1); /* Translate line number and obtain its size. */ - if (loc->lineNo > 0) - sprintf (line_buf, "%d", loc->lineNo); + if (loc->line_no > 0) + sprintf (line_buf, "%d", loc->line_no); else strcpy (line_buf, "??"); line_width = strlen (line_buf); @@ -122,7 +116,7 @@ tui_make_status_line (TuiLocatorElement* loc) - (sizeof (PROC_PREFIX) - 1 + 1) - (sizeof (LINE_PREFIX) - 1 + line_width + 1) - (sizeof (PC_PREFIX) - 1 + pc_width + 1) - - (tui_current_key_mode == tui_single_key_mode + - (tui_current_key_mode == TUI_SINGLE_KEY_MODE ? (sizeof (SINGLE_KEY) - 1 + 1) : 0)); @@ -152,7 +146,7 @@ tui_make_status_line (TuiLocatorElement* loc) } /* Now convert elements to string form */ - pname = loc->procName; + pname = loc->proc_name; /* Now create the locator line from the string version of the elements. We could use sprintf() here but @@ -174,7 +168,7 @@ tui_make_status_line (TuiLocatorElement* loc) } /* Show whether we are in SingleKey mode. */ - if (tui_current_key_mode == tui_single_key_mode) + if (tui_current_key_mode == TUI_SINGLE_KEY_MODE) { strcat_to_buf (string, status_size, SINGLE_KEY); strcat_to_buf (string, status_size, " "); @@ -244,33 +238,30 @@ tui_get_function_from_frame (struct frame_info *fi) return name; } -/* - ** tuiShowLocatorContent() - */ void -tuiShowLocatorContent (void) +tui_show_locator_content (void) { char *string; - TuiGenWinInfoPtr locator; + struct tui_gen_win_info * locator; - locator = locatorWinInfoPtr (); + locator = tui_locator_win_info_ptr (); - if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL) + if (locator != NULL && locator->handle != (WINDOW *) NULL) { - TuiWinElementPtr element; + struct tui_win_element * element; - element = (TuiWinElementPtr) locator->content[0]; + element = (struct tui_win_element *) locator->content[0]; - string = tui_make_status_line (&element->whichElement.locator); + string = tui_make_status_line (&element->which_element.locator); wmove (locator->handle, 0, 0); wstandout (locator->handle); waddstr (locator->handle, string); wclrtoeol (locator->handle); wstandend (locator->handle); - tuiRefreshWin (locator); + tui_refresh_win (locator); wmove (locator->handle, 0, 0); xfree (string); - locator->contentInUse = TRUE; + locator->content_in_use = TRUE; } } @@ -279,18 +270,18 @@ tuiShowLocatorContent (void) static void tui_set_locator_filename (const char *filename) { - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - TuiLocatorElementPtr element; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + struct tui_locator_element * element; - if (locator->content[0] == (Opaque) NULL) + if (locator->content[0] == NULL) { tui_set_locator_info (filename, NULL, 0, 0); return; } - element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator; - element->fileName[0] = 0; - strcat_to_buf (element->fileName, MAX_LOCATOR_ELEMENT_LEN, filename); + element = &((struct tui_win_element *) locator->content[0])->which_element.locator; + element->file_name[0] = 0; + strcat_to_buf (element->file_name, MAX_LOCATOR_ELEMENT_LEN, filename); } /* Update the locator, with the provided arguments. */ @@ -298,69 +289,69 @@ static void tui_set_locator_info (const char *filename, const char *procname, int lineno, CORE_ADDR addr) { - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - TuiLocatorElementPtr element; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + struct tui_locator_element * element; /* Allocate the locator content if necessary. */ - if (locator->contentSize <= 0) + if (locator->content_size <= 0) { - locator->content = (OpaquePtr) allocContent (1, locator->type); - locator->contentSize = 1; + locator->content = (void **) tui_alloc_content (1, locator->type); + locator->content_size = 1; } - element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator; - element->procName[0] = (char) 0; - strcat_to_buf (element->procName, MAX_LOCATOR_ELEMENT_LEN, procname); - element->lineNo = lineno; + element = &((struct tui_win_element *) locator->content[0])->which_element.locator; + element->proc_name[0] = (char) 0; + strcat_to_buf (element->proc_name, MAX_LOCATOR_ELEMENT_LEN, procname); + element->line_no = lineno; element->addr = addr; tui_set_locator_filename (filename); } /* Update only the filename portion of the locator. */ void -tuiUpdateLocatorFilename (const char *filename) +tui_update_locator_filename (const char *filename) { tui_set_locator_filename (filename); - tuiShowLocatorContent (); + tui_show_locator_content (); } /* Function to print the frame information for the TUI. */ void -tuiShowFrameInfo (struct frame_info *fi) +tui_show_frame_info (struct frame_info *fi) { - TuiWinInfoPtr winInfo; - register int i; + struct tui_win_info * win_info; + int i; if (fi) { - register int startLine, i; + int start_line, i; CORE_ADDR low; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - int sourceAlreadyDisplayed; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + int source_already_displayed; struct symtab_and_line sal; find_frame_sal (fi, &sal); - sourceAlreadyDisplayed = sal.symtab != 0 - && tuiSourceIsDisplayed (sal.symtab->filename); + source_already_displayed = sal.symtab != 0 + && tui_source_is_displayed (sal.symtab->filename); tui_set_locator_info (sal.symtab == 0 ? "??" : sal.symtab->filename, tui_get_function_from_frame (fi), sal.line, get_frame_pc (fi)); - tuiShowLocatorContent (); - startLine = 0; - for (i = 0; i < (sourceWindows ())->count; i++) + tui_show_locator_content (); + start_line = 0; + for (i = 0; i < (tui_source_windows ())->count; i++) { - TuiWhichElement *item; - winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; + union tui_which_element *item; + win_info = (struct tui_win_info *) (tui_source_windows ())->list[i]; - item = &((TuiWinElementPtr) locator->content[0])->whichElement; - if (winInfo == srcWin) + item = &((struct tui_win_element *) locator->content[0])->which_element; + if (win_info == TUI_SRC_WIN) { - startLine = (item->locator.lineNo - - (winInfo->generic.viewportHeight / 2)) + 1; - if (startLine <= 0) - startLine = 1; + start_line = (item->locator.line_no - + (win_info->generic.viewport_height / 2)) + 1; + if (start_line <= 0) + start_line = 1; } else { @@ -368,56 +359,57 @@ tuiShowFrameInfo (struct frame_info *fi) &low, (CORE_ADDR) NULL) == 0) error ("No function contains program counter for selected frame.\n"); else - low = tuiGetLowDisassemblyAddress (low, get_frame_pc (fi)); + low = tui_get_low_disassembly_address (low, get_frame_pc (fi)); } - if (winInfo == srcWin) + if (win_info == TUI_SRC_WIN) { - TuiLineOrAddress l; - l.lineNo = startLine; - if (!(sourceAlreadyDisplayed - && tuiLineIsDisplayed (item->locator.lineNo, winInfo, TRUE))) - tuiUpdateSourceWindow (winInfo, sal.symtab, l, TRUE); + union tui_line_or_address l; + l.line_no = start_line; + if (!(source_already_displayed + && tui_line_is_displayed (item->locator.line_no, win_info, TRUE))) + tui_update_source_window (win_info, sal.symtab, l, TRUE); else { - l.lineNo = item->locator.lineNo; - tuiSetIsExecPointAt (l, winInfo); + l.line_no = item->locator.line_no; + tui_set_is_exec_point_at (l, win_info); } } else { - if (winInfo == disassemWin) + if (win_info == TUI_DISASM_WIN) { - TuiLineOrAddress a; + union tui_line_or_address a; a.addr = low; - if (!tuiAddrIsDisplayed (item->locator.addr, winInfo, TRUE)) - tuiUpdateSourceWindow (winInfo, sal.symtab, a, TRUE); + if (!tui_addr_is_displayed (item->locator.addr, win_info, TRUE)) + tui_update_source_window (win_info, sal.symtab, a, TRUE); else { a.addr = item->locator.addr; - tuiSetIsExecPointAt (a, winInfo); + tui_set_is_exec_point_at (a, win_info); } } } - tuiUpdateExecInfo (winInfo); + tui_update_exec_info (win_info); } } else { tui_set_locator_info (NULL, NULL, 0, (CORE_ADDR) 0); - tuiShowLocatorContent (); - for (i = 0; i < (sourceWindows ())->count; i++) + tui_show_locator_content (); + for (i = 0; i < (tui_source_windows ())->count; i++) { - winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; - tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT); - tuiUpdateExecInfo (winInfo); + win_info = (struct tui_win_info *) (tui_source_windows ())->list[i]; + tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT); + tui_update_exec_info (win_info); } } } -/* Function to initialize gdb commands, for tui window stack manipulation. */ +/* Function to initialize gdb commands, for tui window stack + manipulation. */ void -_initialize_tuiStack (void) +_initialize_tui_stack (void) { add_com ("update", class_tui, tui_update_command, "Update the source window and locator to display the current " diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h index 14be497..65725b3 100644 --- a/gdb/tui/tui-stack.h +++ b/gdb/tui/tui-stack.h @@ -1,5 +1,8 @@ /* TUI display locator. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,15 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _TUI_STACK_H -#define _TUI_STACK_H -/* - ** This header file supports - */ +#ifndef TUI_STACK_H +#define TUI_STACK_H + +struct frame_info; -extern void tuiUpdateLocatorFilename (const char *); -extern void tuiShowLocatorContent (void); -extern void tuiShowFrameInfo (struct frame_info *); +extern void tui_update_locator_filename (const char *); +extern void tui_show_locator_content (void); +extern void tui_show_frame_info (struct frame_info *); #endif -/*_TUI_STACK_H*/ diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index a7d35ce..afd4b10 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -46,36 +46,30 @@ #include "tui/tui-winsource.h" #include "tui/tui-windata.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" -#include <string.h> +#include "gdb_string.h" #include <ctype.h> #include <readline/readline.h> /******************************* ** Static Local Decls ********************************/ -static void _makeVisibleWithNewHeight (TuiWinInfoPtr); -static void _makeInvisibleAndSetNewHeight (TuiWinInfoPtr, int); -static TuiStatus _tuiAdjustWinHeights (TuiWinInfoPtr, int); -static int _newHeightOk (TuiWinInfoPtr, int); -static void _tuiSetTabWidth_command (char *, int); -static void _tuiRefreshAll_command (char *, int); -static void _tuiSetWinHeight_command (char *, int); -static void _tuiXDBsetWinHeight_command (char *, int); -static void _tuiAllWindowsInfo (char *, int); -static void _tuiSetFocus_command (char *, int); -static void _tuiScrollForward_command (char *, int); -static void _tuiScrollBackward_command (char *, int); -static void _tuiScrollLeft_command (char *, int); -static void _tuiScrollRight_command (char *, int); -static void _parseScrollingArgs (char *, TuiWinInfoPtr *, int *); +static void make_visible_with_new_height (struct tui_win_info *); +static void make_invisible_and_set_new_height (struct tui_win_info *, int); +static enum tui_status tui_adjust_win_heights (struct tui_win_info *, int); +static int new_height_ok (struct tui_win_info *, int); +static void tui_set_tab_width_command (char *, int); +static void tui_refresh_all_command (char *, int); +static void tui_set_win_height_command (char *, int); +static void tui_xdb_set_win_height_command (char *, int); +static void tui_all_windows_info (char *, int); +static void tui_set_focus_command (char *, int); +static void tui_scroll_forward_command (char *, int); +static void tui_scroll_backward_command (char *, int); +static void tui_scroll_left_command (char *, int); +static void tui_scroll_right_command (char *, int); +static void parse_scrolling_args (char *, struct tui_win_info * *, int *); /*************************************** @@ -241,7 +235,7 @@ translate (const char *name, struct tui_translate *table) Returns 1 if the configuration has changed and the screen should be redrawn. */ int -tui_update_variables () +tui_update_variables (void) { int need_redraw = 0; struct tui_translate *entry; @@ -296,12 +290,9 @@ show_tui_cmd (char *args, int from_tty) { } -/* - ** _initialize_tuiWin(). - ** Function to initialize gdb commands, for tui window manipulation. - */ +/* Function to initialize gdb commands, for tui window manipulation. */ void -_initialize_tuiWin (void) +_initialize_tui_win (void) { struct cmd_list_element *c; static struct cmd_list_element *tui_setlist; @@ -322,14 +313,14 @@ _initialize_tuiWin (void) &tui_showlist, "show tui ", 0/*allow-unknown*/, &showlist); - add_com ("refresh", class_tui, _tuiRefreshAll_command, + add_com ("refresh", class_tui, tui_refresh_all_command, "Refresh the terminal display.\n"); if (xdb_commands) add_com_alias ("U", "refresh", class_tui, 0); - add_com ("tabset", class_tui, _tuiSetTabWidth_command, + add_com ("tabset", class_tui, tui_set_tab_width_command, "Set the width (in characters) of tab stops.\n\ Usage: tabset <n>\n"); - add_com ("winheight", class_tui, _tuiSetWinHeight_command, + add_com ("winheight", class_tui, tui_set_win_height_command, "Set the height of a specified window.\n\ Usage: winheight <win_name> [+ | -] <#lines>\n\ Window names are:\n\ @@ -338,9 +329,9 @@ cmd : the command window\n\ asm : the disassembly window\n\ regs : the register display\n"); add_com_alias ("wh", "winheight", class_tui, 0); - add_info ("win", _tuiAllWindowsInfo, + add_info ("win", tui_all_windows_info, "List of all displayed windows.\n"); - add_com ("focus", class_tui, _tuiSetFocus_command, + add_com ("focus", class_tui, tui_set_focus_command, "Set focus to named window or next/prev window.\n\ Usage: focus {<win> | next | prev}\n\ Valid Window names are:\n\ @@ -349,16 +340,16 @@ asm : the disassembly window\n\ regs : the register display\n\ cmd : the command window\n"); add_com_alias ("fs", "focus", class_tui, 0); - add_com ("+", class_tui, _tuiScrollForward_command, + add_com ("+", class_tui, tui_scroll_forward_command, "Scroll window forward.\nUsage: + [win] [n]\n"); - add_com ("-", class_tui, _tuiScrollBackward_command, + add_com ("-", class_tui, tui_scroll_backward_command, "Scroll window backward.\nUsage: - [win] [n]\n"); - add_com ("<", class_tui, _tuiScrollLeft_command, + add_com ("<", class_tui, tui_scroll_left_command, "Scroll window forward.\nUsage: < [win] [n]\n"); - add_com (">", class_tui, _tuiScrollRight_command, + add_com (">", class_tui, tui_scroll_right_command, "Scroll window backward.\nUsage: > [win] [n]\n"); if (xdb_commands) - add_com ("w", class_xdb, _tuiXDBsetWinHeight_command, + add_com ("w", class_xdb, tui_xdb_set_win_height_command, "XDB compatibility command for setting the height of a command window.\n\ Usage: w <#lines>\n"); @@ -407,7 +398,7 @@ Usage: w <#lines>\n"); /* Update gdb's knowledge of the terminal size. */ void -tui_update_gdb_sizes () +tui_update_gdb_sizes (void) { char cmd[50]; int screenheight, screenwidth; @@ -415,168 +406,142 @@ tui_update_gdb_sizes () rl_get_screen_size (&screenheight, &screenwidth); /* Set to TUI command window dimension or use readline values. */ sprintf (cmd, "set width %d", - tui_active ? cmdWin->generic.width : screenwidth); + tui_active ? TUI_CMD_WIN->generic.width : screenwidth); execute_command (cmd, 0); sprintf (cmd, "set height %d", - tui_active ? cmdWin->generic.height : screenheight); + tui_active ? TUI_CMD_WIN->generic.height : screenheight); execute_command (cmd, 0); } -/* - ** tuiSetWinFocusTo - ** Set the logical focus to winInfo - */ +/* Set the logical focus to win_info. */ void -tuiSetWinFocusTo (TuiWinInfoPtr winInfo) +tui_set_win_focus_to (struct tui_win_info * win_info) { - if (m_winPtrNotNull (winInfo)) + if (win_info != NULL) { - TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); - - if (m_winPtrNotNull (winWithFocus) && - winWithFocus->generic.type != CMD_WIN) - unhighlightWin (winWithFocus); - tuiSetWinWithFocus (winInfo); - if (winInfo->generic.type != CMD_WIN) - highlightWin (winInfo); + struct tui_win_info * win_with_focus = tui_win_with_focus (); + + if (win_with_focus != NULL + && win_with_focus->generic.type != CMD_WIN) + tui_unhighlight_win (win_with_focus); + tui_set_win_with_focus (win_info); + if (win_info->generic.type != CMD_WIN) + tui_highlight_win (win_info); } - - return; -} /* tuiSetWinFocusTo */ +} -/* - ** tuiScrollForward(). - */ void -tuiScrollForward (TuiWinInfoPtr winToScroll, int numToScroll) +tui_scroll_forward (struct tui_win_info * win_to_scroll, int num_to_scroll) { - if (winToScroll != cmdWin) + if (win_to_scroll != TUI_CMD_WIN) { - int _numToScroll = numToScroll; + int _num_to_scroll = num_to_scroll; - if (numToScroll == 0) - _numToScroll = winToScroll->generic.height - 3; + if (num_to_scroll == 0) + _num_to_scroll = win_to_scroll->generic.height - 3; /* ** If we are scrolling the source or disassembly window, do a ** "psuedo" scroll since not all of the source is in memory, - ** only what is in the viewport. If winToScroll is the + ** only what is in the viewport. If win_to_scroll is the ** command window do nothing since the term should handle it. */ - if (winToScroll == srcWin) - tuiVerticalSourceScroll (FORWARD_SCROLL, _numToScroll); - else if (winToScroll == disassemWin) - tui_vertical_disassem_scroll (FORWARD_SCROLL, _numToScroll); - else if (winToScroll == dataWin) - tuiVerticalDataScroll (FORWARD_SCROLL, _numToScroll); + if (win_to_scroll == TUI_SRC_WIN) + tui_vertical_source_scroll (FORWARD_SCROLL, _num_to_scroll); + else if (win_to_scroll == TUI_DISASM_WIN) + tui_vertical_disassem_scroll (FORWARD_SCROLL, _num_to_scroll); + else if (win_to_scroll == TUI_DATA_WIN) + tui_vertical_data_scroll (FORWARD_SCROLL, _num_to_scroll); } +} - return; -} /* tuiScrollForward */ - - -/* - ** tuiScrollBackward(). - */ void -tuiScrollBackward (TuiWinInfoPtr winToScroll, int numToScroll) +tui_scroll_backward (struct tui_win_info * win_to_scroll, int num_to_scroll) { - if (winToScroll != cmdWin) + if (win_to_scroll != TUI_CMD_WIN) { - int _numToScroll = numToScroll; + int _num_to_scroll = num_to_scroll; - if (numToScroll == 0) - _numToScroll = winToScroll->generic.height - 3; + if (num_to_scroll == 0) + _num_to_scroll = win_to_scroll->generic.height - 3; /* ** If we are scrolling the source or disassembly window, do a ** "psuedo" scroll since not all of the source is in memory, - ** only what is in the viewport. If winToScroll is the + ** only what is in the viewport. If win_to_scroll is the ** command window do nothing since the term should handle it. */ - if (winToScroll == srcWin) - tuiVerticalSourceScroll (BACKWARD_SCROLL, _numToScroll); - else if (winToScroll == disassemWin) - tui_vertical_disassem_scroll (BACKWARD_SCROLL, _numToScroll); - else if (winToScroll == dataWin) - tuiVerticalDataScroll (BACKWARD_SCROLL, _numToScroll); + if (win_to_scroll == TUI_SRC_WIN) + tui_vertical_source_scroll (BACKWARD_SCROLL, _num_to_scroll); + else if (win_to_scroll == TUI_DISASM_WIN) + tui_vertical_disassem_scroll (BACKWARD_SCROLL, _num_to_scroll); + else if (win_to_scroll == TUI_DATA_WIN) + tui_vertical_data_scroll (BACKWARD_SCROLL, _num_to_scroll); } - return; -} /* tuiScrollBackward */ +} -/* - ** tuiScrollLeft(). - */ void -tuiScrollLeft (TuiWinInfoPtr winToScroll, int numToScroll) +tui_scroll_left (struct tui_win_info * win_to_scroll, int num_to_scroll) { - if (winToScroll != cmdWin) + if (win_to_scroll != TUI_CMD_WIN) { - int _numToScroll = numToScroll; + int _num_to_scroll = num_to_scroll; - if (_numToScroll == 0) - _numToScroll = 1; + if (_num_to_scroll == 0) + _num_to_scroll = 1; /* ** If we are scrolling the source or disassembly window, do a ** "psuedo" scroll since not all of the source is in memory, - ** only what is in the viewport. If winToScroll is the + ** only what is in the viewport. If win_to_scroll is the ** command window do nothing since the term should handle it. */ - if (winToScroll == srcWin || winToScroll == disassemWin) - tuiHorizontalSourceScroll (winToScroll, LEFT_SCROLL, _numToScroll); + if (win_to_scroll == TUI_SRC_WIN || win_to_scroll == TUI_DISASM_WIN) + tui_horizontal_source_scroll (win_to_scroll, LEFT_SCROLL, _num_to_scroll); } - return; -} /* tuiScrollLeft */ +} -/* - ** tuiScrollRight(). - */ void -tuiScrollRight (TuiWinInfoPtr winToScroll, int numToScroll) +tui_scroll_right (struct tui_win_info * win_to_scroll, int num_to_scroll) { - if (winToScroll != cmdWin) + if (win_to_scroll != TUI_CMD_WIN) { - int _numToScroll = numToScroll; + int _num_to_scroll = num_to_scroll; - if (_numToScroll == 0) - _numToScroll = 1; + if (_num_to_scroll == 0) + _num_to_scroll = 1; /* ** If we are scrolling the source or disassembly window, do a ** "psuedo" scroll since not all of the source is in memory, - ** only what is in the viewport. If winToScroll is the + ** only what is in the viewport. If win_to_scroll is the ** command window do nothing since the term should handle it. */ - if (winToScroll == srcWin || winToScroll == disassemWin) - tuiHorizontalSourceScroll (winToScroll, RIGHT_SCROLL, _numToScroll); + if (win_to_scroll == TUI_SRC_WIN || win_to_scroll == TUI_DISASM_WIN) + tui_horizontal_source_scroll (win_to_scroll, RIGHT_SCROLL, _num_to_scroll); } - return; -} /* tuiScrollRight */ +} -/* - ** tui_scroll(). - ** Scroll a window. Arguments are passed through a va_list. - */ +/* Scroll a window. Arguments are passed through a va_list. */ void -tui_scroll (TuiScrollDirection direction, - TuiWinInfoPtr winToScroll, - int numToScroll) +tui_scroll (enum tui_scroll_direction direction, + struct tui_win_info * win_to_scroll, + int num_to_scroll) { switch (direction) { case FORWARD_SCROLL: - tuiScrollForward (winToScroll, numToScroll); + tui_scroll_forward (win_to_scroll, num_to_scroll); break; case BACKWARD_SCROLL: - tuiScrollBackward (winToScroll, numToScroll); + tui_scroll_backward (win_to_scroll, num_to_scroll); break; case LEFT_SCROLL: - tuiScrollLeft (winToScroll, numToScroll); + tui_scroll_left (win_to_scroll, num_to_scroll); break; case RIGHT_SCROLL: - tuiScrollRight (winToScroll, numToScroll); + tui_scroll_right (win_to_scroll, num_to_scroll); break; default: break; @@ -584,221 +549,210 @@ tui_scroll (TuiScrollDirection direction, } -/* - ** tuiRefreshAll(). - */ void -tuiRefreshAll (void) +tui_refresh_all_win (void) { - TuiWinType type; + enum tui_win_type type; clearok (curscr, TRUE); - refreshAll (winList); + tui_refresh_all (tui_win_list); for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++) { - if (winList[type] && winList[type]->generic.isVisible) + if (tui_win_list[type] && tui_win_list[type]->generic.is_visible) { switch (type) { case SRC_WIN: case DISASSEM_WIN: - tuiShowSourceContent (winList[type]); - checkAndDisplayHighlightIfNeeded (winList[type]); - tuiEraseExecInfoContent (winList[type]); - tuiUpdateExecInfo (winList[type]); + tui_show_source_content (tui_win_list[type]); + tui_check_and_display_highlight_if_needed (tui_win_list[type]); + tui_erase_exec_info_content (tui_win_list[type]); + tui_update_exec_info (tui_win_list[type]); break; case DATA_WIN: - tuiRefreshDataWin (); + tui_refresh_data_win (); break; default: break; } } } - tuiShowLocatorContent (); + tui_show_locator_content (); } -/* - ** tuiResizeAll(). - ** Resize all the windows based on the the terminal size. This - ** function gets called from within the readline sinwinch handler. - */ +/* Resize all the windows based on the the terminal size. This + function gets called from within the readline sinwinch handler. */ void -tuiResizeAll (void) +tui_resize_all (void) { - int heightDiff, widthDiff; + int height_diff, width_diff; int screenheight, screenwidth; rl_get_screen_size (&screenheight, &screenwidth); - widthDiff = screenwidth - termWidth (); - heightDiff = screenheight - termHeight (); - if (heightDiff || widthDiff) + width_diff = screenwidth - tui_term_width (); + height_diff = screenheight - tui_term_height (); + if (height_diff || width_diff) { - TuiLayoutType curLayout = currentLayout (); - TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); - TuiWinInfoPtr firstWin, secondWin; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - TuiWinType winType; - int newHeight, splitDiff, cmdSplitDiff, numWinsDisplayed = 2; + enum tui_layout_type cur_layout = tui_current_layout (); + struct tui_win_info * win_with_focus = tui_win_with_focus (); + struct tui_win_info *first_win; + struct tui_win_info *second_win; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + enum tui_win_type win_type; + int new_height, split_diff, cmd_split_diff, num_wins_displayed = 2; /* turn keypad off while we resize */ - if (winWithFocus != cmdWin) - keypad (cmdWin->generic.handle, FALSE); + if (win_with_focus != TUI_CMD_WIN) + keypad (TUI_CMD_WIN->generic.handle, FALSE); tui_update_gdb_sizes (); - setTermHeightTo (screenheight); - setTermWidthTo (screenwidth); - if (curLayout == SRC_DISASSEM_COMMAND || - curLayout == SRC_DATA_COMMAND || curLayout == DISASSEM_DATA_COMMAND) - numWinsDisplayed++; - splitDiff = heightDiff / numWinsDisplayed; - cmdSplitDiff = splitDiff; - if (heightDiff % numWinsDisplayed) + tui_set_term_height_to (screenheight); + tui_set_term_width_to (screenwidth); + if (cur_layout == SRC_DISASSEM_COMMAND || + cur_layout == SRC_DATA_COMMAND || cur_layout == DISASSEM_DATA_COMMAND) + num_wins_displayed++; + split_diff = height_diff / num_wins_displayed; + cmd_split_diff = split_diff; + if (height_diff % num_wins_displayed) { - if (heightDiff < 0) - cmdSplitDiff--; + if (height_diff < 0) + cmd_split_diff--; else - cmdSplitDiff++; + cmd_split_diff++; } /* now adjust each window */ clear (); refresh (); - switch (curLayout) + switch (cur_layout) { case SRC_COMMAND: case DISASSEM_COMMAND: - firstWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; - firstWin->generic.width += widthDiff; - locator->width += widthDiff; + first_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; + first_win->generic.width += width_diff; + locator->width += width_diff; /* check for invalid heights */ - if (heightDiff == 0) - newHeight = firstWin->generic.height; - else if ((firstWin->generic.height + splitDiff) >= + if (height_diff == 0) + new_height = first_win->generic.height; + else if ((first_win->generic.height + split_diff) >= (screenheight - MIN_CMD_WIN_HEIGHT - 1)) - newHeight = screenheight - MIN_CMD_WIN_HEIGHT - 1; - else if ((firstWin->generic.height + splitDiff) <= 0) - newHeight = MIN_WIN_HEIGHT; + new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1; + else if ((first_win->generic.height + split_diff) <= 0) + new_height = MIN_WIN_HEIGHT; else - newHeight = firstWin->generic.height + splitDiff; - - _makeInvisibleAndSetNewHeight (firstWin, newHeight); - cmdWin->generic.origin.y = locator->origin.y + 1; - cmdWin->generic.width += widthDiff; - newHeight = screenheight - cmdWin->generic.origin.y; - _makeInvisibleAndSetNewHeight (cmdWin, newHeight); - _makeVisibleWithNewHeight (firstWin); - _makeVisibleWithNewHeight (cmdWin); - if (firstWin->generic.contentSize <= 0) - tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT); + new_height = first_win->generic.height + split_diff; + + make_invisible_and_set_new_height (first_win, new_height); + TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1; + TUI_CMD_WIN->generic.width += width_diff; + new_height = screenheight - TUI_CMD_WIN->generic.origin.y; + make_invisible_and_set_new_height (TUI_CMD_WIN, new_height); + make_visible_with_new_height (first_win); + make_visible_with_new_height (TUI_CMD_WIN); + if (first_win->generic.content_size <= 0) + tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT); break; default: - if (curLayout == SRC_DISASSEM_COMMAND) + if (cur_layout == SRC_DISASSEM_COMMAND) { - firstWin = srcWin; - firstWin->generic.width += widthDiff; - secondWin = disassemWin; - secondWin->generic.width += widthDiff; + first_win = TUI_SRC_WIN; + first_win->generic.width += width_diff; + second_win = TUI_DISASM_WIN; + second_win->generic.width += width_diff; } else { - firstWin = dataWin; - firstWin->generic.width += widthDiff; - secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; - secondWin->generic.width += widthDiff; + first_win = TUI_DATA_WIN; + first_win->generic.width += width_diff; + second_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; + second_win->generic.width += width_diff; } /* Change the first window's height/width */ /* check for invalid heights */ - if (heightDiff == 0) - newHeight = firstWin->generic.height; - else if ((firstWin->generic.height + - secondWin->generic.height + (splitDiff * 2)) >= + if (height_diff == 0) + new_height = first_win->generic.height; + else if ((first_win->generic.height + + second_win->generic.height + (split_diff * 2)) >= (screenheight - MIN_CMD_WIN_HEIGHT - 1)) - newHeight = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2; - else if ((firstWin->generic.height + splitDiff) <= 0) - newHeight = MIN_WIN_HEIGHT; + new_height = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2; + else if ((first_win->generic.height + split_diff) <= 0) + new_height = MIN_WIN_HEIGHT; else - newHeight = firstWin->generic.height + splitDiff; - _makeInvisibleAndSetNewHeight (firstWin, newHeight); + new_height = first_win->generic.height + split_diff; + make_invisible_and_set_new_height (first_win, new_height); - if (firstWin == dataWin && widthDiff != 0) - firstWin->detail.dataDisplayInfo.regsColumnCount = + if (first_win == TUI_DATA_WIN && width_diff != 0) + first_win->detail.data_display_info.regs_column_count = tui_calculate_regs_column_count ( - firstWin->detail.dataDisplayInfo.regsDisplayType); - locator->width += widthDiff; + first_win->detail.data_display_info.regs_display_type); + locator->width += width_diff; /* Change the second window's height/width */ /* check for invalid heights */ - if (heightDiff == 0) - newHeight = secondWin->generic.height; - else if ((firstWin->generic.height + - secondWin->generic.height + (splitDiff * 2)) >= + if (height_diff == 0) + new_height = second_win->generic.height; + else if ((first_win->generic.height + + second_win->generic.height + (split_diff * 2)) >= (screenheight - MIN_CMD_WIN_HEIGHT - 1)) { - newHeight = screenheight - MIN_CMD_WIN_HEIGHT - 1; - if (newHeight % 2) - newHeight = (newHeight / 2) + 1; + new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1; + if (new_height % 2) + new_height = (new_height / 2) + 1; else - newHeight /= 2; + new_height /= 2; } - else if ((secondWin->generic.height + splitDiff) <= 0) - newHeight = MIN_WIN_HEIGHT; + else if ((second_win->generic.height + split_diff) <= 0) + new_height = MIN_WIN_HEIGHT; else - newHeight = secondWin->generic.height + splitDiff; - secondWin->generic.origin.y = firstWin->generic.height - 1; - _makeInvisibleAndSetNewHeight (secondWin, newHeight); + new_height = second_win->generic.height + split_diff; + second_win->generic.origin.y = first_win->generic.height - 1; + make_invisible_and_set_new_height (second_win, new_height); /* Change the command window's height/width */ - cmdWin->generic.origin.y = locator->origin.y + 1; - _makeInvisibleAndSetNewHeight ( - cmdWin, cmdWin->generic.height + cmdSplitDiff); - _makeVisibleWithNewHeight (firstWin); - _makeVisibleWithNewHeight (secondWin); - _makeVisibleWithNewHeight (cmdWin); - if (firstWin->generic.contentSize <= 0) - tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT); - if (secondWin->generic.contentSize <= 0) - tuiEraseSourceContent (secondWin, EMPTY_SOURCE_PROMPT); + TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1; + make_invisible_and_set_new_height ( + TUI_CMD_WIN, TUI_CMD_WIN->generic.height + cmd_split_diff); + make_visible_with_new_height (first_win); + make_visible_with_new_height (second_win); + make_visible_with_new_height (TUI_CMD_WIN); + if (first_win->generic.content_size <= 0) + tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT); + if (second_win->generic.content_size <= 0) + tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT); break; } /* ** Now remove all invisible windows, and their content so that they get ** created again when called for with the new size */ - for (winType = SRC_WIN; (winType < MAX_MAJOR_WINDOWS); winType++) + for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++) { - if (winType != CMD_WIN && m_winPtrNotNull (winList[winType]) && - !winList[winType]->generic.isVisible) + if (win_type != CMD_WIN && (tui_win_list[win_type] != NULL) + && !tui_win_list[win_type]->generic.is_visible) { - freeWindow (winList[winType]); - winList[winType] = (TuiWinInfoPtr) NULL; + tui_free_window (tui_win_list[win_type]); + tui_win_list[win_type] = (struct tui_win_info *) NULL; } } - tuiSetWinResizedTo (TRUE); + tui_set_win_resized_to (TRUE); /* turn keypad back on, unless focus is in the command window */ - if (winWithFocus != cmdWin) - keypad (cmdWin->generic.handle, TRUE); + if (win_with_focus != TUI_CMD_WIN) + keypad (TUI_CMD_WIN->generic.handle, TRUE); } - return; -} /* tuiResizeAll */ +} -/* - ** tuiSigwinchHandler() - ** SIGWINCH signal handler for the tui. This signal handler is - ** always called, even when the readline package clears signals - ** because it is set as the old_sigwinch() (TUI only) - */ +/* SIGWINCH signal handler for the tui. This signal handler is always + called, even when the readline package clears signals because it is + set as the old_sigwinch() (TUI only). */ void -tuiSigwinchHandler (int signal) +tui_sigwinch_handler (int signal) { /* ** Say that a resize was done so that the readline can do it ** later when appropriate. */ - tuiSetWinResizedTo (TRUE); - - return; -} /* tuiSigwinchHandler */ + tui_set_win_resized_to (TRUE); +} @@ -807,177 +761,146 @@ tuiSigwinchHandler (int signal) **************************/ -/* - ** _tuiScrollForward_command(). - */ static void -_tuiScrollForward_command (char *arg, int fromTTY) +tui_scroll_forward_command (char *arg, int from_tty) { - int numToScroll = 1; - TuiWinInfoPtr winToScroll; + int num_to_scroll = 1; + struct tui_win_info * win_to_scroll; /* Make sure the curses mode is enabled. */ tui_enable (); if (arg == (char *) NULL) - _parseScrollingArgs (arg, &winToScroll, (int *) NULL); + parse_scrolling_args (arg, &win_to_scroll, (int *) NULL); else - _parseScrollingArgs (arg, &winToScroll, &numToScroll); - tui_scroll (FORWARD_SCROLL, winToScroll, numToScroll); + parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll); + tui_scroll (FORWARD_SCROLL, win_to_scroll, num_to_scroll); } -/* - ** _tuiScrollBackward_command(). - */ static void -_tuiScrollBackward_command (char *arg, int fromTTY) +tui_scroll_backward_command (char *arg, int from_tty) { - int numToScroll = 1; - TuiWinInfoPtr winToScroll; + int num_to_scroll = 1; + struct tui_win_info * win_to_scroll; /* Make sure the curses mode is enabled. */ tui_enable (); if (arg == (char *) NULL) - _parseScrollingArgs (arg, &winToScroll, (int *) NULL); + parse_scrolling_args (arg, &win_to_scroll, (int *) NULL); else - _parseScrollingArgs (arg, &winToScroll, &numToScroll); - tui_scroll (BACKWARD_SCROLL, winToScroll, numToScroll); + parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll); + tui_scroll (BACKWARD_SCROLL, win_to_scroll, num_to_scroll); } -/* - ** _tuiScrollLeft_command(). - */ static void -_tuiScrollLeft_command (char *arg, int fromTTY) +tui_scroll_left_command (char *arg, int from_tty) { - int numToScroll; - TuiWinInfoPtr winToScroll; + int num_to_scroll; + struct tui_win_info * win_to_scroll; /* Make sure the curses mode is enabled. */ tui_enable (); - _parseScrollingArgs (arg, &winToScroll, &numToScroll); - tui_scroll (LEFT_SCROLL, winToScroll, numToScroll); + parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll); + tui_scroll (LEFT_SCROLL, win_to_scroll, num_to_scroll); } -/* - ** _tuiScrollRight_command(). - */ static void -_tuiScrollRight_command (char *arg, int fromTTY) +tui_scroll_right_command (char *arg, int from_tty) { - int numToScroll; - TuiWinInfoPtr winToScroll; + int num_to_scroll; + struct tui_win_info * win_to_scroll; /* Make sure the curses mode is enabled. */ tui_enable (); - _parseScrollingArgs (arg, &winToScroll, &numToScroll); - tui_scroll (RIGHT_SCROLL, winToScroll, numToScroll); + parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll); + tui_scroll (RIGHT_SCROLL, win_to_scroll, num_to_scroll); } -/* - ** _tuiSetFocus(). - ** Set focus to the window named by 'arg' - */ +/* Set focus to the window named by 'arg'. */ static void -_tuiSetFocus (char *arg, int fromTTY) +tui_set_focus (char *arg, int from_tty) { if (arg != (char *) NULL) { - char *bufPtr = (char *) xstrdup (arg); + char *buf_ptr = (char *) xstrdup (arg); int i; - TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL; + struct tui_win_info * win_info = (struct tui_win_info *) NULL; - for (i = 0; (i < strlen (bufPtr)); i++) - bufPtr[i] = toupper (arg[i]); + for (i = 0; (i < strlen (buf_ptr)); i++) + buf_ptr[i] = toupper (arg[i]); - if (subset_compare (bufPtr, "NEXT")) - winInfo = tuiNextWin (tuiWinWithFocus ()); - else if (subset_compare (bufPtr, "PREV")) - winInfo = tuiPrevWin (tuiWinWithFocus ()); + if (subset_compare (buf_ptr, "NEXT")) + win_info = tui_next_win (tui_win_with_focus ()); + else if (subset_compare (buf_ptr, "PREV")) + win_info = tui_prev_win (tui_win_with_focus ()); else - winInfo = partialWinByName (bufPtr); + win_info = tui_partial_win_by_name (buf_ptr); - if (winInfo == (TuiWinInfoPtr) NULL || !winInfo->generic.isVisible) + if (win_info == (struct tui_win_info *) NULL || !win_info->generic.is_visible) warning ("Invalid window specified. \n\ The window name specified must be valid and visible.\n"); else { - tuiSetWinFocusTo (winInfo); - keypad (cmdWin->generic.handle, (winInfo != cmdWin)); + tui_set_win_focus_to (win_info); + keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN)); } - if (dataWin && dataWin->generic.isVisible) - tuiRefreshDataWin (); - tuiFree (bufPtr); + if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible) + tui_refresh_data_win (); + xfree (buf_ptr); printf_filtered ("Focus set to %s window.\n", - winName ((TuiGenWinInfoPtr) tuiWinWithFocus ())); + tui_win_name ((struct tui_gen_win_info *) tui_win_with_focus ())); } else warning ("Incorrect Number of Arguments.\n%s", FOCUS_USAGE); +} - return; -} /* _tuiSetFocus */ - -/* - ** _tuiSetFocus_command() - */ static void -_tuiSetFocus_command (char *arg, int fromTTY) +tui_set_focus_command (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); - _tuiSetFocus (arg, fromTTY); + tui_set_focus (arg, from_tty); } -/* - ** _tuiAllWindowsInfo(). - */ static void -_tuiAllWindowsInfo (char *arg, int fromTTY) +tui_all_windows_info (char *arg, int from_tty) { - TuiWinType type; - TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); + enum tui_win_type type; + struct tui_win_info * win_with_focus = tui_win_with_focus (); for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) - if (winList[type] && winList[type]->generic.isVisible) + if (tui_win_list[type] && tui_win_list[type]->generic.is_visible) { - if (winWithFocus == winList[type]) + if (win_with_focus == tui_win_list[type]) printf_filtered (" %s\t(%d lines) <has focus>\n", - winName (&winList[type]->generic), - winList[type]->generic.height); + tui_win_name (&tui_win_list[type]->generic), + tui_win_list[type]->generic.height); else printf_filtered (" %s\t(%d lines)\n", - winName (&winList[type]->generic), - winList[type]->generic.height); + tui_win_name (&tui_win_list[type]->generic), + tui_win_list[type]->generic.height); } - - return; -} /* _tuiAllWindowsInfo */ +} -/* - ** _tuiRefreshAll_command(). - */ static void -_tuiRefreshAll_command (char *arg, int fromTTY) +tui_refresh_all_command (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); - tuiRefreshAll (); + tui_refresh_all_win (); } -/* - ** _tuiSetWinTabWidth_command(). - ** Set the height of the specified window. - */ +/* Set the height of the specified window. */ static void -_tuiSetTabWidth_command (char *arg, int fromTTY) +tui_set_tab_width_command (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); @@ -987,82 +910,77 @@ _tuiSetTabWidth_command (char *arg, int fromTTY) ts = atoi (arg); if (ts > 0) - tuiSetDefaultTabLen (ts); + tui_set_default_tab_len (ts); else warning ("Tab widths greater than 0 must be specified.\n"); } - - return; -} /* _tuiSetTabWidth_command */ +} -/* - ** _tuiSetWinHeight(). - ** Set the height of the specified window. - */ +/* Set the height of the specified window. */ static void -_tuiSetWinHeight (char *arg, int fromTTY) +tui_set_win_height (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); if (arg != (char *) NULL) { char *buf = xstrdup (arg); - char *bufPtr = buf; + char *buf_ptr = buf; char *wname = (char *) NULL; - int newHeight, i; - TuiWinInfoPtr winInfo; + int new_height, i; + struct tui_win_info * win_info; - wname = bufPtr; - bufPtr = strchr (bufPtr, ' '); - if (bufPtr != (char *) NULL) + wname = buf_ptr; + buf_ptr = strchr (buf_ptr, ' '); + if (buf_ptr != (char *) NULL) { - *bufPtr = (char) 0; + *buf_ptr = (char) 0; /* ** Validate the window name */ for (i = 0; i < strlen (wname); i++) wname[i] = toupper (wname[i]); - winInfo = partialWinByName (wname); + win_info = tui_partial_win_by_name (wname); - if (winInfo == (TuiWinInfoPtr) NULL || !winInfo->generic.isVisible) + if (win_info == (struct tui_win_info *) NULL || !win_info->generic.is_visible) warning ("Invalid window specified. \n\ The window name specified must be valid and visible.\n"); else { /* Process the size */ - while (*(++bufPtr) == ' ') + while (*(++buf_ptr) == ' ') ; - if (*bufPtr != (char) 0) + if (*buf_ptr != (char) 0) { int negate = FALSE; - int fixedSize = TRUE; - int inputNo;; + int fixed_size = TRUE; + int input_no;; - if (*bufPtr == '+' || *bufPtr == '-') + if (*buf_ptr == '+' || *buf_ptr == '-') { - if (*bufPtr == '-') + if (*buf_ptr == '-') negate = TRUE; - fixedSize = FALSE; - bufPtr++; + fixed_size = FALSE; + buf_ptr++; } - inputNo = atoi (bufPtr); - if (inputNo > 0) + input_no = atoi (buf_ptr); + if (input_no > 0) { if (negate) - inputNo *= (-1); - if (fixedSize) - newHeight = inputNo; + input_no *= (-1); + if (fixed_size) + new_height = input_no; else - newHeight = winInfo->generic.height + inputNo; + new_height = win_info->generic.height + input_no; /* ** Now change the window's height, and adjust all ** other windows around it */ - if (_tuiAdjustWinHeights (winInfo, - newHeight) == TUI_FAILURE) + if (tui_adjust_win_heights (win_info, + new_height) == TUI_FAILURE) warning ("Invalid window height specified.\n%s", WIN_HEIGHT_USAGE); else @@ -1078,48 +996,40 @@ The window name specified must be valid and visible.\n"); printf_filtered (WIN_HEIGHT_USAGE); if (buf != (char *) NULL) - tuiFree (buf); + xfree (buf); } else printf_filtered (WIN_HEIGHT_USAGE); +} - return; -} /* _tuiSetWinHeight */ - -/* - ** _tuiSetWinHeight_command(). - ** Set the height of the specified window, with va_list. - */ +/* Set the height of the specified window, with va_list. */ static void -_tuiSetWinHeight_command (char *arg, int fromTTY) +tui_set_win_height_command (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); - _tuiSetWinHeight (arg, fromTTY); + tui_set_win_height (arg, from_tty); } -/* - ** _tuiXDBsetWinHeight(). - ** XDB Compatibility command for setting the window height. This will - ** increase or decrease the command window by the specified amount. - */ +/* XDB Compatibility command for setting the window height. This will + increase or decrease the command window by the specified amount. */ static void -_tuiXDBsetWinHeight (char *arg, int fromTTY) +tui_xdb_set_win_height (char *arg, int from_tty) { /* Make sure the curses mode is enabled. */ tui_enable (); if (arg != (char *) NULL) { - int inputNo = atoi (arg); + int input_no = atoi (arg); - if (inputNo > 0) + if (input_no > 0) { /* Add 1 for the locator */ - int newHeight = termHeight () - (inputNo + 1); + int new_height = tui_term_height () - (input_no + 1); - if (!_newHeightOk (winList[CMD_WIN], newHeight) || - _tuiAdjustWinHeights (winList[CMD_WIN], - newHeight) == TUI_FAILURE) + if (!new_height_ok (tui_win_list[CMD_WIN], new_height) || + tui_adjust_win_heights (tui_win_list[CMD_WIN], + new_height) == TUI_FAILURE) warning ("Invalid window height specified.\n%s", XDBWIN_HEIGHT_USAGE); } @@ -1129,226 +1039,215 @@ _tuiXDBsetWinHeight (char *arg, int fromTTY) } else warning ("Invalid window height specified.\n%s", XDBWIN_HEIGHT_USAGE); +} - return; -} /* _tuiXDBsetWinHeight */ - -/* - ** _tuiSetWinHeight_command(). - ** Set the height of the specified window, with va_list. - */ +/* Set the height of the specified window, with va_list. */ static void -_tuiXDBsetWinHeight_command (char *arg, int fromTTY) +tui_xdb_set_win_height_command (char *arg, int from_tty) { - _tuiXDBsetWinHeight (arg, fromTTY); + tui_xdb_set_win_height (arg, from_tty); } -/* - ** _tuiAdjustWinHeights(). - ** Function to adjust all window heights around the primary - */ -static TuiStatus -_tuiAdjustWinHeights (TuiWinInfoPtr primaryWinInfo, int newHeight) +/* Function to adjust all window heights around the primary. */ +static enum tui_status +tui_adjust_win_heights (struct tui_win_info * primary_win_info, int new_height) { - TuiStatus status = TUI_FAILURE; + enum tui_status status = TUI_FAILURE; - if (_newHeightOk (primaryWinInfo, newHeight)) + if (new_height_ok (primary_win_info, new_height)) { status = TUI_SUCCESS; - if (newHeight != primaryWinInfo->generic.height) + if (new_height != primary_win_info->generic.height) { int diff; - TuiWinInfoPtr winInfo; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); - TuiLayoutType curLayout = currentLayout (); + struct tui_win_info * win_info; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); + enum tui_layout_type cur_layout = tui_current_layout (); - diff = (newHeight - primaryWinInfo->generic.height) * (-1); - if (curLayout == SRC_COMMAND || curLayout == DISASSEM_COMMAND) + diff = (new_height - primary_win_info->generic.height) * (-1); + if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND) { - TuiWinInfoPtr srcWinInfo; + struct tui_win_info * src_win_info; - _makeInvisibleAndSetNewHeight (primaryWinInfo, newHeight); - if (primaryWinInfo->generic.type == CMD_WIN) + make_invisible_and_set_new_height (primary_win_info, new_height); + if (primary_win_info->generic.type == CMD_WIN) { - winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[0]; - srcWinInfo = winInfo; + win_info = (struct tui_win_info *) (tui_source_windows ())->list[0]; + src_win_info = win_info; } else { - winInfo = winList[CMD_WIN]; - srcWinInfo = primaryWinInfo; + win_info = tui_win_list[CMD_WIN]; + src_win_info = primary_win_info; } - _makeInvisibleAndSetNewHeight (winInfo, - winInfo->generic.height + diff); - cmdWin->generic.origin.y = locator->origin.y + 1; - _makeVisibleWithNewHeight (winInfo); - _makeVisibleWithNewHeight (primaryWinInfo); - if (srcWinInfo->generic.contentSize <= 0) - tuiEraseSourceContent (srcWinInfo, EMPTY_SOURCE_PROMPT); + make_invisible_and_set_new_height (win_info, + win_info->generic.height + diff); + TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1; + make_visible_with_new_height (win_info); + make_visible_with_new_height (primary_win_info); + if (src_win_info->generic.content_size <= 0) + tui_erase_source_content (src_win_info, EMPTY_SOURCE_PROMPT); } else { - TuiWinInfoPtr firstWin, secondWin; + struct tui_win_info *first_win; + struct tui_win_info *second_win; - if (curLayout == SRC_DISASSEM_COMMAND) + if (cur_layout == SRC_DISASSEM_COMMAND) { - firstWin = srcWin; - secondWin = disassemWin; + first_win = TUI_SRC_WIN; + second_win = TUI_DISASM_WIN; } else { - firstWin = dataWin; - secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; + first_win = TUI_DATA_WIN; + second_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; } - if (primaryWinInfo == cmdWin) + if (primary_win_info == TUI_CMD_WIN) { /* ** Split the change in height accross the 1st & 2nd windows ** adjusting them as well. */ - int firstSplitDiff = diff / 2; /* subtract the locator */ - int secondSplitDiff = firstSplitDiff; + int first_split_diff = diff / 2; /* subtract the locator */ + int second_split_diff = first_split_diff; if (diff % 2) { - if (firstWin->generic.height > - secondWin->generic.height) + if (first_win->generic.height > + second_win->generic.height) if (diff < 0) - firstSplitDiff--; + first_split_diff--; else - firstSplitDiff++; + first_split_diff++; else { if (diff < 0) - secondSplitDiff--; + second_split_diff--; else - secondSplitDiff++; + second_split_diff++; } } /* make sure that the minimum hieghts are honored */ - while ((firstWin->generic.height + firstSplitDiff) < 3) + while ((first_win->generic.height + first_split_diff) < 3) { - firstSplitDiff++; - secondSplitDiff--; + first_split_diff++; + second_split_diff--; } - while ((secondWin->generic.height + secondSplitDiff) < 3) + while ((second_win->generic.height + second_split_diff) < 3) { - secondSplitDiff++; - firstSplitDiff--; + second_split_diff++; + first_split_diff--; } - _makeInvisibleAndSetNewHeight ( - firstWin, - firstWin->generic.height + firstSplitDiff); - secondWin->generic.origin.y = firstWin->generic.height - 1; - _makeInvisibleAndSetNewHeight ( - secondWin, secondWin->generic.height + secondSplitDiff); - cmdWin->generic.origin.y = locator->origin.y + 1; - _makeInvisibleAndSetNewHeight (cmdWin, newHeight); + make_invisible_and_set_new_height ( + first_win, + first_win->generic.height + first_split_diff); + second_win->generic.origin.y = first_win->generic.height - 1; + make_invisible_and_set_new_height ( + second_win, second_win->generic.height + second_split_diff); + TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1; + make_invisible_and_set_new_height (TUI_CMD_WIN, new_height); } else { - if ((cmdWin->generic.height + diff) < 1) + if ((TUI_CMD_WIN->generic.height + diff) < 1) { /* ** If there is no way to increase the command window ** take real estate from the 1st or 2nd window. */ - if ((cmdWin->generic.height + diff) < 1) + if ((TUI_CMD_WIN->generic.height + diff) < 1) { int i; - for (i = cmdWin->generic.height + diff; + for (i = TUI_CMD_WIN->generic.height + diff; (i < 1); i++) - if (primaryWinInfo == firstWin) - secondWin->generic.height--; + if (primary_win_info == first_win) + second_win->generic.height--; else - firstWin->generic.height--; + first_win->generic.height--; } } - if (primaryWinInfo == firstWin) - _makeInvisibleAndSetNewHeight (firstWin, newHeight); + if (primary_win_info == first_win) + make_invisible_and_set_new_height (first_win, new_height); else - _makeInvisibleAndSetNewHeight ( - firstWin, - firstWin->generic.height); - secondWin->generic.origin.y = firstWin->generic.height - 1; - if (primaryWinInfo == secondWin) - _makeInvisibleAndSetNewHeight (secondWin, newHeight); + make_invisible_and_set_new_height ( + first_win, + first_win->generic.height); + second_win->generic.origin.y = first_win->generic.height - 1; + if (primary_win_info == second_win) + make_invisible_and_set_new_height (second_win, new_height); else - _makeInvisibleAndSetNewHeight ( - secondWin, secondWin->generic.height); - cmdWin->generic.origin.y = locator->origin.y + 1; - if ((cmdWin->generic.height + diff) < 1) - _makeInvisibleAndSetNewHeight (cmdWin, 1); + make_invisible_and_set_new_height ( + second_win, second_win->generic.height); + TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1; + if ((TUI_CMD_WIN->generic.height + diff) < 1) + make_invisible_and_set_new_height (TUI_CMD_WIN, 1); else - _makeInvisibleAndSetNewHeight ( - cmdWin, cmdWin->generic.height + diff); + make_invisible_and_set_new_height ( + TUI_CMD_WIN, TUI_CMD_WIN->generic.height + diff); } - _makeVisibleWithNewHeight (cmdWin); - _makeVisibleWithNewHeight (secondWin); - _makeVisibleWithNewHeight (firstWin); - if (firstWin->generic.contentSize <= 0) - tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT); - if (secondWin->generic.contentSize <= 0) - tuiEraseSourceContent (secondWin, EMPTY_SOURCE_PROMPT); + make_visible_with_new_height (TUI_CMD_WIN); + make_visible_with_new_height (second_win); + make_visible_with_new_height (first_win); + if (first_win->generic.content_size <= 0) + tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT); + if (second_win->generic.content_size <= 0) + tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT); } } } return status; -} /* _tuiAdjustWinHeights */ +} -/* - ** _makeInvisibleAndSetNewHeight(). - ** Function make the target window (and auxillary windows associated - ** with the targer) invisible, and set the new height and location. - */ +/* Function make the target window (and auxillary windows associated + with the targer) invisible, and set the new height and location. */ static void -_makeInvisibleAndSetNewHeight (TuiWinInfoPtr winInfo, int height) +make_invisible_and_set_new_height (struct tui_win_info * win_info, int height) { int i; - TuiGenWinInfoPtr genWinInfo; - + struct tui_gen_win_info * gen_win_info; - m_beInvisible (&winInfo->generic); - winInfo->generic.height = height; + tui_make_invisible (&win_info->generic); + win_info->generic.height = height; if (height > 1) - winInfo->generic.viewportHeight = height - 1; + win_info->generic.viewport_height = height - 1; else - winInfo->generic.viewportHeight = height; - if (winInfo != cmdWin) - winInfo->generic.viewportHeight--; + win_info->generic.viewport_height = height; + if (win_info != TUI_CMD_WIN) + win_info->generic.viewport_height--; - /* Now deal with the auxillary windows associated with winInfo */ - switch (winInfo->generic.type) + /* Now deal with the auxillary windows associated with win_info */ + switch (win_info->generic.type) { case SRC_WIN: case DISASSEM_WIN: - genWinInfo = winInfo->detail.sourceInfo.executionInfo; - m_beInvisible (genWinInfo); - genWinInfo->height = height; - genWinInfo->origin.y = winInfo->generic.origin.y; + gen_win_info = win_info->detail.source_info.execution_info; + tui_make_invisible (gen_win_info); + gen_win_info->height = height; + gen_win_info->origin.y = win_info->generic.origin.y; if (height > 1) - genWinInfo->viewportHeight = height - 1; + gen_win_info->viewport_height = height - 1; else - genWinInfo->viewportHeight = height; - if (winInfo != cmdWin) - genWinInfo->viewportHeight--; + gen_win_info->viewport_height = height; + if (win_info != TUI_CMD_WIN) + gen_win_info->viewport_height--; - if (m_hasLocator (winInfo)) + if (tui_win_has_locator (win_info)) { - genWinInfo = locatorWinInfoPtr (); - m_beInvisible (genWinInfo); - genWinInfo->origin.y = winInfo->generic.origin.y + height; + gen_win_info = tui_locator_win_info_ptr (); + tui_make_invisible (gen_win_info); + gen_win_info->origin.y = win_info->generic.origin.y + height; } break; case DATA_WIN: /* delete all data item windows */ - for (i = 0; i < winInfo->generic.contentSize; i++) + for (i = 0; i < win_info->generic.content_size; i++) { - genWinInfo = (TuiGenWinInfoPtr) & ((TuiWinElementPtr) - winInfo->generic.content[i])->whichElement.dataWindow; - tuiDelwin (genWinInfo->handle); - genWinInfo->handle = (WINDOW *) NULL; + gen_win_info = (struct tui_gen_win_info *) & ((struct tui_win_element *) + win_info->generic.content[i])->which_element.data_window; + tui_delete_win (gen_win_info->handle); + gen_win_info->handle = (WINDOW *) NULL; } break; default: @@ -1357,125 +1256,120 @@ _makeInvisibleAndSetNewHeight (TuiWinInfoPtr winInfo, int height) } -/* - ** _makeVisibleWithNewHeight(). - ** Function to make the windows with new heights visible. - ** This means re-creating the windows' content since the window - ** had to be destroyed to be made invisible. - */ +/* Function to make the windows with new heights visible. This means + re-creating the windows' content since the window had to be + destroyed to be made invisible. */ static void -_makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) +make_visible_with_new_height (struct tui_win_info * win_info) { struct symtab *s; - m_beVisible (&winInfo->generic); - checkAndDisplayHighlightIfNeeded (winInfo); - switch (winInfo->generic.type) + tui_make_visible (&win_info->generic); + tui_check_and_display_highlight_if_needed (win_info); + switch (win_info->generic.type) { case SRC_WIN: case DISASSEM_WIN: - freeWinContent (winInfo->detail.sourceInfo.executionInfo); - m_beVisible (winInfo->detail.sourceInfo.executionInfo); - if (winInfo->generic.content != (OpaquePtr) NULL) + tui_free_win_content (win_info->detail.source_info.execution_info); + tui_make_visible (win_info->detail.source_info.execution_info); + if (win_info->generic.content != NULL) { - TuiLineOrAddress lineOrAddr; + union tui_line_or_address line_or_addr; struct symtab_and_line cursal = get_current_source_symtab_and_line (); - if (winInfo->generic.type == SRC_WIN) - lineOrAddr.lineNo = - winInfo->detail.sourceInfo.startLineOrAddr.lineNo; + if (win_info->generic.type == SRC_WIN) + line_or_addr.line_no = + win_info->detail.source_info.start_line_or_addr.line_no; else - lineOrAddr.addr = - winInfo->detail.sourceInfo.startLineOrAddr.addr; - freeWinContent (&winInfo->generic); - tuiUpdateSourceWindow (winInfo, - cursal.symtab, lineOrAddr, TRUE); + line_or_addr.addr = + win_info->detail.source_info.start_line_or_addr.addr; + tui_free_win_content (&win_info->generic); + tui_update_source_window (win_info, cursal.symtab, line_or_addr, TRUE); } else if (deprecated_selected_frame != (struct frame_info *) NULL) { - TuiLineOrAddress line; + union tui_line_or_address line; struct symtab_and_line cursal = get_current_source_symtab_and_line (); s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); - if (winInfo->generic.type == SRC_WIN) - line.lineNo = cursal.line; + if (win_info->generic.type == SRC_WIN) + line.line_no = cursal.line; else { find_line_pc (s, cursal.line, &line.addr); } - tuiUpdateSourceWindow (winInfo, s, line, TRUE); + tui_update_source_window (win_info, s, line, TRUE); } - if (m_hasLocator (winInfo)) + if (tui_win_has_locator (win_info)) { - m_beVisible (locatorWinInfoPtr ()); - tuiShowLocatorContent (); + tui_make_visible (tui_locator_win_info_ptr ()); + tui_show_locator_content (); } break; case DATA_WIN: - tuiDisplayAllData (); + tui_display_all_data (); break; case CMD_WIN: - winInfo->detail.commandInfo.curLine = 0; - winInfo->detail.commandInfo.curch = 0; - wmove (winInfo->generic.handle, - winInfo->detail.commandInfo.curLine, - winInfo->detail.commandInfo.curch); + win_info->detail.command_info.cur_line = 0; + win_info->detail.command_info.curch = 0; + wmove (win_info->generic.handle, + win_info->detail.command_info.cur_line, + win_info->detail.command_info.curch); break; default: break; } - - return; -} /* _makeVisibleWithNewHeight */ +} static int -_newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight) +new_height_ok (struct tui_win_info * primary_win_info, int new_height) { - int ok = (newHeight < termHeight ()); + int ok = (new_height < tui_term_height ()); if (ok) { int diff; - TuiLayoutType curLayout = currentLayout (); + enum tui_layout_type cur_layout = tui_current_layout (); - diff = (newHeight - primaryWinInfo->generic.height) * (-1); - if (curLayout == SRC_COMMAND || curLayout == DISASSEM_COMMAND) + diff = (new_height - primary_win_info->generic.height) * (-1); + if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND) { - ok = ((primaryWinInfo->generic.type == CMD_WIN && - newHeight <= (termHeight () - 4) && - newHeight >= MIN_CMD_WIN_HEIGHT) || - (primaryWinInfo->generic.type != CMD_WIN && - newHeight <= (termHeight () - 2) && - newHeight >= MIN_WIN_HEIGHT)); + ok = ((primary_win_info->generic.type == CMD_WIN && + new_height <= (tui_term_height () - 4) && + new_height >= MIN_CMD_WIN_HEIGHT) || + (primary_win_info->generic.type != CMD_WIN && + new_height <= (tui_term_height () - 2) && + new_height >= MIN_WIN_HEIGHT)); if (ok) { /* check the total height */ - TuiWinInfoPtr winInfo; + struct tui_win_info * win_info; - if (primaryWinInfo == cmdWin) - winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[0]; + if (primary_win_info == TUI_CMD_WIN) + win_info = (struct tui_win_info *) (tui_source_windows ())->list[0]; else - winInfo = cmdWin; - ok = ((newHeight + - (winInfo->generic.height + diff)) <= termHeight ()); + win_info = TUI_CMD_WIN; + ok = ((new_height + + (win_info->generic.height + diff)) <= tui_term_height ()); } } else { - int curTotalHeight, totalHeight, minHeight = 0; - TuiWinInfoPtr firstWin, secondWin; + int cur_total_height, total_height, min_height = 0; + struct tui_win_info *first_win; + struct tui_win_info *second_win; - if (curLayout == SRC_DISASSEM_COMMAND) + if (cur_layout == SRC_DISASSEM_COMMAND) { - firstWin = srcWin; - secondWin = disassemWin; + first_win = TUI_SRC_WIN; + second_win = TUI_DISASM_WIN; } else { - firstWin = dataWin; - secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; + first_win = TUI_DATA_WIN; + second_win = (struct tui_win_info *) (tui_source_windows ())->list[0]; } /* ** We could simply add all the heights to obtain the same result @@ -1483,52 +1377,52 @@ _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight) ** line that the first and second windows share, and add one ** for the locator. */ - totalHeight = curTotalHeight = - (firstWin->generic.height + secondWin->generic.height - 1) - + cmdWin->generic.height + 1 /*locator */ ; - if (primaryWinInfo == cmdWin) + total_height = cur_total_height = + (first_win->generic.height + second_win->generic.height - 1) + + TUI_CMD_WIN->generic.height + 1 /*locator */ ; + if (primary_win_info == TUI_CMD_WIN) { /* locator included since first & second win share a line */ - ok = ((firstWin->generic.height + - secondWin->generic.height + diff) >= + ok = ((first_win->generic.height + + second_win->generic.height + diff) >= (MIN_WIN_HEIGHT * 2) && - newHeight >= MIN_CMD_WIN_HEIGHT); + new_height >= MIN_CMD_WIN_HEIGHT); if (ok) { - totalHeight = newHeight + (firstWin->generic.height + - secondWin->generic.height + diff); - minHeight = MIN_CMD_WIN_HEIGHT; + total_height = new_height + (first_win->generic.height + + second_win->generic.height + diff); + min_height = MIN_CMD_WIN_HEIGHT; } } else { - minHeight = MIN_WIN_HEIGHT; + min_height = MIN_WIN_HEIGHT; /* ** First see if we can increase/decrease the command ** window. And make sure that the command window is ** at least 1 line */ - ok = ((cmdWin->generic.height + diff) > 0); + ok = ((TUI_CMD_WIN->generic.height + diff) > 0); if (!ok) { /* ** Looks like we have to increase/decrease one of ** the other windows */ - if (primaryWinInfo == firstWin) - ok = (secondWin->generic.height + diff) >= minHeight; + if (primary_win_info == first_win) + ok = (second_win->generic.height + diff) >= min_height; else - ok = (firstWin->generic.height + diff) >= minHeight; + ok = (first_win->generic.height + diff) >= min_height; } if (ok) { - if (primaryWinInfo == firstWin) - totalHeight = newHeight + - secondWin->generic.height + - cmdWin->generic.height + diff; + if (primary_win_info == first_win) + total_height = new_height + + second_win->generic.height + + TUI_CMD_WIN->generic.height + diff; else - totalHeight = newHeight + - firstWin->generic.height + - cmdWin->generic.height + diff; + total_height = new_height + + first_win->generic.height + + TUI_CMD_WIN->generic.height + diff; } } /* @@ -1536,23 +1430,21 @@ _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight) ** the old total height. */ if (ok) - ok = (newHeight >= minHeight && totalHeight <= curTotalHeight); + ok = (new_height >= min_height && total_height <= cur_total_height); } } return ok; -} /* _newHeightOk */ +} -/* - ** _parseScrollingArgs(). - */ static void -_parseScrollingArgs (char *arg, TuiWinInfoPtr * winToScroll, int *numToScroll) +parse_scrolling_args (char *arg, struct tui_win_info * * win_to_scroll, + int *num_to_scroll) { - if (numToScroll) - *numToScroll = 0; - *winToScroll = tuiWinWithFocus (); + if (num_to_scroll) + *num_to_scroll = 0; + *win_to_scroll = tui_win_with_focus (); /* ** First set up the default window to scroll, in case there is no @@ -1560,56 +1452,54 @@ _parseScrollingArgs (char *arg, TuiWinInfoPtr * winToScroll, int *numToScroll) */ if (arg != (char *) NULL) { - char *buf, *bufPtr; + char *buf, *buf_ptr; /* process the number of lines to scroll */ - buf = bufPtr = xstrdup (arg); - if (isdigit (*bufPtr)) + buf = buf_ptr = xstrdup (arg); + if (isdigit (*buf_ptr)) { - char *numStr; + char *num_str; - numStr = bufPtr; - bufPtr = strchr (bufPtr, ' '); - if (bufPtr != (char *) NULL) + num_str = buf_ptr; + buf_ptr = strchr (buf_ptr, ' '); + if (buf_ptr != (char *) NULL) { - *bufPtr = (char) 0; - if (numToScroll) - *numToScroll = atoi (numStr); - bufPtr++; + *buf_ptr = (char) 0; + if (num_to_scroll) + *num_to_scroll = atoi (num_str); + buf_ptr++; } - else if (numToScroll) - *numToScroll = atoi (numStr); + else if (num_to_scroll) + *num_to_scroll = atoi (num_str); } /* process the window name if one is specified */ - if (bufPtr != (char *) NULL) + if (buf_ptr != (char *) NULL) { char *wname; int i; - if (*bufPtr == ' ') - while (*(++bufPtr) == ' ') + if (*buf_ptr == ' ') + while (*(++buf_ptr) == ' ') ; - if (*bufPtr != (char) 0) - wname = bufPtr; + if (*buf_ptr != (char) 0) + wname = buf_ptr; else wname = "?"; /* Validate the window name */ for (i = 0; i < strlen (wname); i++) wname[i] = toupper (wname[i]); - *winToScroll = partialWinByName (wname); + *win_to_scroll = tui_partial_win_by_name (wname); - if (*winToScroll == (TuiWinInfoPtr) NULL || - !(*winToScroll)->generic.isVisible) + if (*win_to_scroll == (struct tui_win_info *) NULL || + !(*win_to_scroll)->generic.is_visible) warning ("Invalid window specified. \n\ The window name specified must be valid and visible.\n"); - else if (*winToScroll == cmdWin) - *winToScroll = (TuiWinInfoPtr) (sourceWindows ())->list[0]; + else if (*win_to_scroll == TUI_CMD_WIN) + *win_to_scroll = (struct tui_win_info *) (tui_source_windows ())->list[0]; } - tuiFree (buf); + xfree (buf); } - - return; -} /* _parseScrollingArgs */ +} diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h index bc26080..b76998c 100644 --- a/gdb/tui/tui-win.h +++ b/gdb/tui/tui-win.h @@ -1,5 +1,8 @@ /* TUI window generic functions. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,27 +22,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _TUI_WIN_H -#define _TUI_WIN_H - -/***************************************** -** TYPE DEFINITIONS ** -******************************************/ +#ifndef TUI_WIN_H +#define TUI_WIN_H +#include "tui/tui-data.h" +struct tui_win_info; -/***************************************** -** PUBLIC FUNCTION EXTERNAL DECLS ** -******************************************/ -extern void tuiScrollForward (TuiWinInfoPtr, int); -extern void tuiScrollBackward (TuiWinInfoPtr, int); -extern void tuiScrollLeft (TuiWinInfoPtr, int); -extern void tuiScrollRight (TuiWinInfoPtr, int); -extern void tui_scroll (TuiScrollDirection, TuiWinInfoPtr, int); -extern void tuiSetWinFocusTo (TuiWinInfoPtr); -extern void tuiResizeAll (void); -extern void tuiRefreshAll (void); -extern void tuiSigwinchHandler (int); +extern void tui_scroll_forward (struct tui_win_info *, int); +extern void tui_scroll_backward (struct tui_win_info *, int); +extern void tui_scroll_left (struct tui_win_info *, int); +extern void tui_scroll_right (struct tui_win_info *, int); +extern void tui_scroll (enum tui_scroll_direction, struct tui_win_info *, int); +extern void tui_set_win_focus_to (struct tui_win_info *); +extern void tui_resize_all (void); +extern void tui_refresh_all_win (void); +extern void tui_sigwinch_handler (int); extern chtype tui_border_ulcorner; extern chtype tui_border_urcorner; @@ -50,10 +48,9 @@ extern chtype tui_border_hline; extern int tui_border_attrs; extern int tui_active_border_attrs; -extern int tui_update_variables (); +extern int tui_update_variables (void); /* Update gdb's knowledge of the terminal size. */ extern void tui_update_gdb_sizes (void); #endif -/*_TUI_WIN_H*/ diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c index f504f7f..a69fb03 100644 --- a/gdb/tui/tui-windata.c +++ b/gdb/tui/tui-windata.c @@ -28,13 +28,7 @@ #include "tui/tui-wingeneral.h" #include "tui/tui-regs.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /***************************************** @@ -48,300 +42,260 @@ ******************************************/ -/* - ** tuiFirstDataItemDisplayed() - ** Answer the index first element displayed. - ** If none are displayed, then return (-1). - */ +/* Answer the index first element displayed. If none are displayed, + then return (-1). */ int -tuiFirstDataItemDisplayed (void) +tui_first_data_item_displayed (void) { - int elementNo = (-1); + int element_no = (-1); int i; - for (i = 0; (i < dataWin->generic.contentSize && elementNo < 0); i++) + for (i = 0; (i < TUI_DATA_WIN->generic.content_size && element_no < 0); i++) { - TuiGenWinInfoPtr dataItemWin; + struct tui_gen_win_info * data_item_win; - dataItemWin = &((TuiWinContent) - dataWin->generic.content)[i]->whichElement.dataWindow; - if (dataItemWin->handle != (WINDOW *) NULL && dataItemWin->isVisible) - elementNo = i; + data_item_win = &((tui_win_content) + TUI_DATA_WIN->generic.content)[i]->which_element.data_window; + if (data_item_win->handle != (WINDOW *) NULL && data_item_win->is_visible) + element_no = i; } - return elementNo; -} /* tuiFirstDataItemDisplayed */ + return element_no; +} -/* - ** tuiFirstDataElementNoInLine() - ** Answer the index of the first element in lineNo. If lineNo is - ** past the data area (-1) is returned. - */ +/* Answer the index of the first element in line_no. If line_no is + past the data area (-1) is returned. */ int -tuiFirstDataElementNoInLine (int lineNo) +tui_first_data_element_no_in_line (int line_no) { - int firstElementNo = (-1); + int first_element_no = (-1); /* - ** First see if there is a register on lineNo, and if so, set the + ** First see if there is a register on line_no, and if so, set the ** first element number */ - if ((firstElementNo = tui_first_reg_element_no_inline (lineNo)) == -1) + if ((first_element_no = tui_first_reg_element_no_inline (line_no)) == -1) { /* - ** Looking at the general data, the 1st element on lineNo + ** Looking at the general data, the 1st element on line_no */ } - return firstElementNo; -} /* tuiFirstDataElementNoInLine */ + return first_element_no; +} -/* - ** tuiDeleteDataContentWindows() - ** Function to delete all the item windows in the data window. - ** This is usually done when the data window is scrolled. - */ +/* Function to delete all the item windows in the data window. This + is usually done when the data window is scrolled. */ void -tuiDeleteDataContentWindows (void) +tui_delete_data_content_windows (void) { int i; - TuiGenWinInfoPtr dataItemWinPtr; + struct tui_gen_win_info * data_item_win_ptr; - for (i = 0; (i < dataWin->generic.contentSize); i++) + for (i = 0; (i < TUI_DATA_WIN->generic.content_size); i++) { - dataItemWinPtr = &((TuiWinContent) - dataWin->generic.content)[i]->whichElement.dataWindow; - tuiDelwin (dataItemWinPtr->handle); - dataItemWinPtr->handle = (WINDOW *) NULL; - dataItemWinPtr->isVisible = FALSE; + data_item_win_ptr = &((tui_win_content) + TUI_DATA_WIN->generic.content)[i]->which_element.data_window; + tui_delete_win (data_item_win_ptr->handle); + data_item_win_ptr->handle = (WINDOW *) NULL; + data_item_win_ptr->is_visible = FALSE; } - - return; -} /* tuiDeleteDataContentWindows */ +} void -tuiEraseDataContent (char *prompt) +tui_erase_data_content (char *prompt) { - werase (dataWin->generic.handle); - checkAndDisplayHighlightIfNeeded (dataWin); + werase (TUI_DATA_WIN->generic.handle); + tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); if (prompt != (char *) NULL) { - int halfWidth = (dataWin->generic.width - 2) / 2; - int xPos; + int half_width = (TUI_DATA_WIN->generic.width - 2) / 2; + int x_pos; - if (strlen (prompt) >= halfWidth) - xPos = 1; + if (strlen (prompt) >= half_width) + x_pos = 1; else - xPos = halfWidth - strlen (prompt); - mvwaddstr (dataWin->generic.handle, - (dataWin->generic.height / 2), - xPos, + x_pos = half_width - strlen (prompt); + mvwaddstr (TUI_DATA_WIN->generic.handle, + (TUI_DATA_WIN->generic.height / 2), + x_pos, prompt); } - wrefresh (dataWin->generic.handle); - - return; -} /* tuiEraseDataContent */ + wrefresh (TUI_DATA_WIN->generic.handle); +} -/* - ** tuiDisplayAllData(). - ** This function displays the data that is in the data window's - ** content. It does not set the content. - */ +/* This function displays the data that is in the data window's + content. It does not set the content. */ void -tuiDisplayAllData (void) +tui_display_all_data (void) { - if (dataWin->generic.contentSize <= 0) - tuiEraseDataContent (NO_DATA_STRING); + if (TUI_DATA_WIN->generic.content_size <= 0) + tui_erase_data_content (NO_DATA_STRING); else { - tuiEraseDataContent ((char *) NULL); - tuiDeleteDataContentWindows (); - checkAndDisplayHighlightIfNeeded (dataWin); + tui_erase_data_content ((char *) NULL); + tui_delete_data_content_windows (); + tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); tui_display_registers_from (0); /* ** Then display the other data */ - if (dataWin->detail.dataDisplayInfo.dataContent != - (TuiWinContent) NULL && - dataWin->detail.dataDisplayInfo.dataContentCount > 0) + if (TUI_DATA_WIN->detail.data_display_info.data_content != + (tui_win_content) NULL && + TUI_DATA_WIN->detail.data_display_info.data_content_count > 0) { } } - return; -} /* tuiDisplayAllData */ +} -/* - ** tuiDisplayDataFromLine() - ** Function to display the data starting at line, lineNo, in the - ** data window. - */ +/* Function to display the data starting at line, line_no, in the data + window. */ void -tuiDisplayDataFromLine (int lineNo) +tui_display_data_from_line (int line_no) { - int _lineNo = lineNo; + int _line_no = line_no; - if (lineNo < 0) - _lineNo = 0; + if (line_no < 0) + _line_no = 0; - checkAndDisplayHighlightIfNeeded (dataWin); + tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); /* there is no general data, force regs to display (if there are any) */ - if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0) - tui_display_registers_from_line (_lineNo, TRUE); + if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0) + tui_display_registers_from_line (_line_no, TRUE); else { - int elementNo, startLineNo; - int regsLastLine = tui_last_regs_line_no (); + int element_no, start_line_no; + int regs_last_line = tui_last_regs_line_no (); /* display regs if we can */ - if (tui_display_registers_from_line (_lineNo, FALSE) < 0) + if (tui_display_registers_from_line (_line_no, FALSE) < 0) { /* - ** _lineNo is past the regs display, so calc where the + ** _line_no is past the regs display, so calc where the ** start data element is */ - if (regsLastLine < _lineNo) + if (regs_last_line < _line_no) { /* figure out how many lines each element is to obtain - the start elementNo */ + the start element_no */ } } else { /* ** calculate the starting element of the data display, given - ** regsLastLine and how many lines each element is, up to - ** _lineNo + ** regs_last_line and how many lines each element is, up to + ** _line_no */ } - /* Now display the data , starting at elementNo */ + /* Now display the data , starting at element_no */ } +} - return; -} /* tuiDisplayDataFromLine */ - -/* - ** tuiDisplayDataFrom() - ** Display data starting at element elementNo - */ +/* Display data starting at element element_no. */ void -tuiDisplayDataFrom (int elementNo, int reuseWindows) +tui_display_data_from (int element_no, int reuse_windows) { - int firstLine = (-1); + int first_line = (-1); - if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount) - firstLine = tui_line_from_reg_element_no (elementNo); + if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count) + first_line = tui_line_from_reg_element_no (element_no); else - { /* calculate the firstLine from the element number */ + { /* calculate the first_line from the element number */ } - if (firstLine >= 0) + if (first_line >= 0) { - tuiEraseDataContent ((char *) NULL); - if (!reuseWindows) - tuiDeleteDataContentWindows (); - tuiDisplayDataFromLine (firstLine); + tui_erase_data_content ((char *) NULL); + if (!reuse_windows) + tui_delete_data_content_windows (); + tui_display_data_from_line (first_line); } - - return; -} /* tuiDisplayDataFrom */ +} -/* - ** tuiRefreshDataWin() - ** Function to redisplay the contents of the data window. - */ +/* Function to redisplay the contents of the data window. */ void -tuiRefreshDataWin (void) +tui_refresh_data_win (void) { - tuiEraseDataContent ((char *) NULL); - if (dataWin->generic.contentSize > 0) + tui_erase_data_content ((char *) NULL); + if (TUI_DATA_WIN->generic.content_size > 0) { - int firstElement = tuiFirstDataItemDisplayed (); + int first_element = tui_first_data_item_displayed (); - if (firstElement >= 0) /* re-use existing windows */ - tuiDisplayDataFrom (firstElement, TRUE); + if (first_element >= 0) /* re-use existing windows */ + tui_display_data_from (first_element, TRUE); } +} - return; -} /* tuiRefreshDataWin */ - -/* - ** tuiCheckDataValues(). - ** Function to check the data values and hilite any that have changed - */ +/* Function to check the data values and hilite any that have changed. */ void -tuiCheckDataValues (struct frame_info *frame) +tui_check_data_values (struct frame_info *frame) { tui_check_register_values (frame); /* Now check any other data values that there are */ - if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible) + if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible) { int i; - for (i = 0; dataWin->detail.dataDisplayInfo.dataContentCount; i++) + for (i = 0; TUI_DATA_WIN->detail.data_display_info.data_content_count; i++) { #ifdef LATER - TuiDataElementPtr dataElementPtr; - TuiGenWinInfoPtr dataItemWinPtr; - Opaque newValue; - - dataItemPtr = &dataWin->detail.dataDisplayInfo. - dataContent[i]->whichElement.dataWindow; - dataElementPtr = &((TuiWinContent) - dataItemWinPtr->content)[0]->whichElement.data; + tui_data_element_ptr data_element_ptr; + struct tui_gen_win_info * data_item_win_ptr; + Opaque new_value; + + data_item_ptr = &TUI_DATA_WIN->detail.data_display_info. + data_content[i]->which_element.data_window; + data_element_ptr = &((tui_win_content) + data_item_win_ptr->content)[0]->which_element.data; if value - has changed (dataElementPtr, frame, &newValue) + has changed (data_element_ptr, frame, &new_value) { - dataElementPtr->value = newValue; + data_element_ptr->value = new_value; update the display with the new value, hiliting it. } #endif } } -} /* tuiCheckDataValues */ +} -/* - ** tuiVerticalDataScroll() - ** Scroll the data window vertically forward or backward. - */ +/* Scroll the data window vertically forward or backward. */ void -tuiVerticalDataScroll (TuiScrollDirection scrollDirection, int numToScroll) +tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction, int num_to_scroll) { - int firstElementNo; - int firstLine = (-1); + int first_element_no; + int first_line = (-1); - firstElementNo = tuiFirstDataItemDisplayed (); - if (firstElementNo < dataWin->detail.dataDisplayInfo.regsContentCount) - firstLine = tui_line_from_reg_element_no (firstElementNo); + first_element_no = tui_first_data_item_displayed (); + if (first_element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count) + first_line = tui_line_from_reg_element_no (first_element_no); else { /* calculate the first line from the element number which is in ** the general data content */ } - if (firstLine >= 0) + if (first_line >= 0) { - int lastElementNo, lastLine; + int last_element_no, last_line; - if (scrollDirection == FORWARD_SCROLL) - firstLine += numToScroll; + if (scroll_direction == FORWARD_SCROLL) + first_line += num_to_scroll; else - firstLine -= numToScroll; - tuiEraseDataContent ((char *) NULL); - tuiDeleteDataContentWindows (); - tuiDisplayDataFromLine (firstLine); + first_line -= num_to_scroll; + tui_erase_data_content ((char *) NULL); + tui_delete_data_content_windows (); + tui_display_data_from_line (first_line); } - - return; -} /* tuiVerticalDataScroll */ +} /***************************************** diff --git a/gdb/tui/tui-windata.h b/gdb/tui/tui-windata.h index 0b1e700..10123a3 100644 --- a/gdb/tui/tui-windata.h +++ b/gdb/tui/tui-windata.h @@ -1,5 +1,8 @@ /* Data/register window display. - Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2004 Free Software Foundation, + Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,29 +22,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _TUI_DATAWIN_H -#define _TUI_DATAWIN_H - - -/***************************************** -** TYPE DEFINITIONS ** -******************************************/ - +#ifndef TUI_WINDATA_H +#define TUI_WINDATA_H +#include "tui/tui-data.h" -/***************************************** -** PUBLIC FUNCTION EXTERNAL DECLS ** -******************************************/ -extern void tuiEraseDataContent (char *); -extern void tuiDisplayAllData (void); -extern void tuiCheckDataValues (struct frame_info *); -extern void tuiDisplayDataFromLine (int); -extern int tuiFirstDataItemDisplayed (void); -extern int tuiFirstDataElementNoInLine (int); -extern void tuiDeleteDataContentWindows (void); -extern void tuiRefreshDataWin (void); -extern void tuiDisplayDataFrom (int, int); -extern void tuiVerticalDataScroll (TuiScrollDirection, int); +extern void tui_erase_data_content (char *); +extern void tui_display_all_data (void); +extern void tui_check_data_values (struct frame_info *); +extern void tui_display_data_from_line (int); +extern int tui_first_data_item_displayed (void); +extern int tui_first_data_element_no_in_line (int); +extern void tui_delete_data_content_windows (void); +extern void tui_refresh_data_win (void); +extern void tui_display_data_from (int, int); +extern void tui_vertical_data_scroll (enum tui_scroll_direction, int); #endif -/*_TUI_DATAWIN_H*/ diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index 2f32f64..3dc62d5 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -28,78 +28,67 @@ #include "tui/tui-wingeneral.h" #include "tui/tui-win.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /*********************** ** PUBLIC FUNCTIONS ***********************/ -/* - ** tuiRefreshWin() - ** Refresh the window - */ + +/* Refresh the window. */ void -tuiRefreshWin (TuiGenWinInfoPtr winInfo) +tui_refresh_win (struct tui_gen_win_info * win_info) { - if (winInfo->type == DATA_WIN && winInfo->contentSize > 0) + if (win_info->type == DATA_WIN && win_info->content_size > 0) { int i; - for (i = 0; (i < winInfo->contentSize); i++) + for (i = 0; (i < win_info->content_size); i++) { - TuiGenWinInfoPtr dataItemWinPtr; + struct tui_gen_win_info * data_item_win_ptr; - dataItemWinPtr = &((TuiWinContent) - winInfo->content)[i]->whichElement.dataWindow; - if (m_genWinPtrNotNull (dataItemWinPtr) && - dataItemWinPtr->handle != (WINDOW *) NULL) - wrefresh (dataItemWinPtr->handle); + data_item_win_ptr = &((tui_win_content) + win_info->content)[i]->which_element.data_window; + if (data_item_win_ptr != NULL + && data_item_win_ptr->handle != (WINDOW *) NULL) + wrefresh (data_item_win_ptr->handle); } } - else if (winInfo->type == CMD_WIN) + else if (win_info->type == CMD_WIN) { /* Do nothing */ } else { - if (winInfo->handle != (WINDOW *) NULL) - wrefresh (winInfo->handle); + if (win_info->handle != (WINDOW *) NULL) + wrefresh (win_info->handle); } return; -} /* tuiRefreshWin */ +} -/* - ** tuiDelwin() - ** Function to delete the curses window, checking for null - */ +/* Function to delete the curses window, checking for NULL. */ void -tuiDelwin (WINDOW * window) +tui_delete_win (WINDOW * window) { if (window != (WINDOW *) NULL) delwin (window); return; -} /* tuiDelwin */ +} /* Draw a border arround the window. */ void -boxWin (TuiGenWinInfoPtr winInfo, int highlightFlag) +box_win (struct tui_gen_win_info * win_info, int highlight_flag) { - if (winInfo && winInfo->handle) + if (win_info && win_info->handle) { WINDOW *win; int attrs; - win = winInfo->handle; - if (highlightFlag == HILITE) + win = win_info->handle; + if (highlight_flag == HILITE) attrs = tui_active_border_attrs; else attrs = tui_border_attrs; @@ -109,175 +98,177 @@ boxWin (TuiGenWinInfoPtr winInfo, int highlightFlag) tui_border_hline, tui_border_hline, tui_border_ulcorner, tui_border_urcorner, tui_border_llcorner, tui_border_lrcorner); - if (winInfo->title) - mvwaddstr (win, 0, 3, winInfo->title); + if (win_info->title) + mvwaddstr (win, 0, 3, win_info->title); wattroff (win, attrs); } } -/* - ** unhighlightWin(). - */ void -unhighlightWin (TuiWinInfoPtr winInfo) +tui_unhighlight_win (struct tui_win_info * win_info) { - if (m_winPtrNotNull (winInfo) && winInfo->generic.handle != (WINDOW *) NULL) + if (win_info != NULL && win_info->generic.handle != (WINDOW *) NULL) { - boxWin ((TuiGenWinInfoPtr) winInfo, NO_HILITE); - wrefresh (winInfo->generic.handle); - m_setWinHighlightOff (winInfo); + box_win ((struct tui_gen_win_info *) win_info, NO_HILITE); + wrefresh (win_info->generic.handle); + tui_set_win_highlight (win_info, 0); } -} /* unhighlightWin */ +} -/* - ** highlightWin(). - */ void -highlightWin (TuiWinInfoPtr winInfo) +tui_highlight_win (struct tui_win_info * win_info) { - if (m_winPtrNotNull (winInfo) && - winInfo->canHighlight && winInfo->generic.handle != (WINDOW *) NULL) + if (win_info != NULL + && win_info->can_highlight + && win_info->generic.handle != (WINDOW *) NULL) { - boxWin ((TuiGenWinInfoPtr) winInfo, HILITE); - wrefresh (winInfo->generic.handle); - m_setWinHighlightOn (winInfo); + box_win ((struct tui_gen_win_info *) win_info, HILITE); + wrefresh (win_info->generic.handle); + tui_set_win_highlight (win_info, 1); } -} /* highlightWin */ - +} -/* - ** checkAndDisplayHighlightIfNecessay - */ void -checkAndDisplayHighlightIfNeeded (TuiWinInfoPtr winInfo) +tui_check_and_display_highlight_if_needed (struct tui_win_info * win_info) { - if (m_winPtrNotNull (winInfo) && winInfo->generic.type != CMD_WIN) + if (win_info != NULL && win_info->generic.type != CMD_WIN) { - if (winInfo->isHighlighted) - highlightWin (winInfo); + if (win_info->is_highlighted) + tui_highlight_win (win_info); else - unhighlightWin (winInfo); + tui_unhighlight_win (win_info); } return; -} /* checkAndDisplayHighlightIfNeeded */ +} -/* - ** makeWindow(). - */ void -makeWindow (TuiGenWinInfoPtr winInfo, int boxIt) +tui_make_window (struct tui_gen_win_info * win_info, int box_it) { WINDOW *handle; - handle = newwin (winInfo->height, - winInfo->width, - winInfo->origin.y, - winInfo->origin.x); - winInfo->handle = handle; + handle = newwin (win_info->height, + win_info->width, + win_info->origin.y, + win_info->origin.x); + win_info->handle = handle; if (handle != (WINDOW *) NULL) { - if (boxIt == BOX_WINDOW) - boxWin (winInfo, NO_HILITE); - winInfo->isVisible = TRUE; + if (box_it == BOX_WINDOW) + box_win (win_info, NO_HILITE); + win_info->is_visible = TRUE; scrollok (handle, TRUE); } } -/* - ** makeVisible(). - ** We can't really make windows visible, or invisible. So we - ** have to delete the entire window when making it visible, - ** and create it again when making it visible. - */ -void -makeVisible (TuiGenWinInfoPtr winInfo, int visible) +/* We can't really make windows visible, or invisible. So we have to + delete the entire window when making it visible, and create it + again when making it visible. */ +static void +make_visible (struct tui_gen_win_info *win_info, int visible) { /* Don't tear down/recreate command window */ - if (winInfo->type == CMD_WIN) + if (win_info->type == CMD_WIN) return; if (visible) { - if (!winInfo->isVisible) + if (!win_info->is_visible) { - makeWindow ( - winInfo, - (winInfo->type != CMD_WIN && !m_winIsAuxillary (winInfo->type))); - winInfo->isVisible = TRUE; + tui_make_window (win_info, + (win_info->type != CMD_WIN + && !tui_win_is_auxillary (win_info->type))); + win_info->is_visible = TRUE; } } else if (!visible && - winInfo->isVisible && winInfo->handle != (WINDOW *) NULL) + win_info->is_visible && win_info->handle != (WINDOW *) NULL) { - winInfo->isVisible = FALSE; - tuiDelwin (winInfo->handle); - winInfo->handle = (WINDOW *) NULL; + win_info->is_visible = FALSE; + tui_delete_win (win_info->handle); + win_info->handle = (WINDOW *) NULL; } return; -} /* makeVisible */ +} +void +tui_make_visible (struct tui_gen_win_info *win_info) +{ + make_visible (win_info, 1); +} -/* - ** makeAllVisible(). - ** Makes all windows invisible (except the command and locator windows) - */ void -makeAllVisible (int visible) +tui_make_invisible (struct tui_gen_win_info *win_info) +{ + make_visible (win_info, 0); +} + + +/* Makes all windows invisible (except the command and locator windows). */ +static void +make_all_visible (int visible) { int i; for (i = 0; i < MAX_MAJOR_WINDOWS; i++) { - if (m_winPtrNotNull (winList[i]) && - ((winList[i])->generic.type) != CMD_WIN) + if (tui_win_list[i] != NULL + && ((tui_win_list[i])->generic.type) != CMD_WIN) { - if (m_winIsSourceType ((winList[i])->generic.type)) - makeVisible ((winList[i])->detail.sourceInfo.executionInfo, - visible); - makeVisible ((TuiGenWinInfoPtr) winList[i], visible); + if (tui_win_is_source_type ((tui_win_list[i])->generic.type)) + make_visible ((tui_win_list[i])->detail.source_info.execution_info, + visible); + make_visible ((struct tui_gen_win_info *) tui_win_list[i], visible); } } return; -} /* makeAllVisible */ +} + +void +tui_make_all_visible (void) +{ + make_all_visible (1); +} + +void +tui_make_all_invisible (void) +{ + make_all_visible (0); +} + +/* Function to refresh all the windows currently displayed. */ -/* - ** refreshAll(). - ** Function to refresh all the windows currently displayed - */ void -refreshAll (TuiWinInfoPtr * list) +tui_refresh_all (struct tui_win_info * * list) { - TuiWinType type; - TuiGenWinInfoPtr locator = locatorWinInfoPtr (); + enum tui_win_type type; + struct tui_gen_win_info * locator = tui_locator_win_info_ptr (); for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) { - if (list[type] && list[type]->generic.isVisible) + if (list[type] && list[type]->generic.is_visible) { if (type == SRC_WIN || type == DISASSEM_WIN) { - touchwin (list[type]->detail.sourceInfo.executionInfo->handle); - tuiRefreshWin (list[type]->detail.sourceInfo.executionInfo); + touchwin (list[type]->detail.source_info.execution_info->handle); + tui_refresh_win (list[type]->detail.source_info.execution_info); } touchwin (list[type]->generic.handle); - tuiRefreshWin (&list[type]->generic); + tui_refresh_win (&list[type]->generic); } } - if (locator->isVisible) + if (locator->is_visible) { touchwin (locator->handle); - tuiRefreshWin (locator); + tui_refresh_win (locator); } - - return; -} /* refreshAll */ +} /********************************* diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h index 42d1ce4..306d794 100644 --- a/gdb/tui/tui-wingeneral.h +++ b/gdb/tui/tui-wingeneral.h @@ -1,5 +1,8 @@ /* General window behavior. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,31 +22,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef TUI_GENERAL_WIN_H -#define TUI_GENERAL_WIN_H - -/* - ** Functions - */ -extern void unhighlightWin (TuiWinInfoPtr); -extern void makeVisible (TuiGenWinInfoPtr, int); -extern void makeAllVisible (int); -extern void makeWindow (TuiGenWinInfoPtr, int); -extern TuiWinInfoPtr copyWin (TuiWinInfoPtr); -extern void boxWin (TuiGenWinInfoPtr, int); -extern void highlightWin (TuiWinInfoPtr); -extern void checkAndDisplayHighlightIfNeeded (TuiWinInfoPtr); -extern void refreshAll (TuiWinInfoPtr *); -extern void tuiDelwin (WINDOW * window); -extern void tuiRefreshWin (TuiGenWinInfoPtr); - -/* - ** Macros - */ -#define m_beVisible(winInfo) makeVisible((TuiGenWinInfoPtr)(winInfo), TRUE) -#define m_beInvisible(winInfo) \ - makeVisible((TuiGenWinInfoPtr)(winInfo), FALSE) -#define m_allBeVisible() makeAllVisible(TRUE) -#define m_allBeInvisible() makeAllVisible(FALSE) - -#endif /*TUI_GENERAL_WIN_H */ +#ifndef TUI_WINGENERAL_H +#define TUI_WINGENERAL_H + +struct tui_win_info; +struct tui_gen_win_info; + +extern void tui_unhighlight_win (struct tui_win_info *); +extern void tui_make_visible (struct tui_gen_win_info *); +extern void tui_make_invisible (struct tui_gen_win_info *); +extern void tui_make_all_visible (void); +extern void tui_make_all_invisible (void); +extern void tui_make_window (struct tui_gen_win_info *, int); +extern struct tui_win_info *tui_copy_win (struct tui_win_info *); +extern void tui_box_win (struct tui_gen_win_info *, int); +extern void tui_highlight_win (struct tui_win_info *); +extern void tui_check_and_display_highlight_if_needed (struct tui_win_info *); +extern void tui_refresh_all (struct tui_win_info **); +extern void tui_delete_win (WINDOW * window); +extern void tui_refresh_win (struct tui_gen_win_info *); + +#endif diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 87609b4..6a2b9cf 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -39,19 +39,13 @@ #include "tui/tui-source.h" #include "tui/tui-disasm.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /* Function to display the "main" routine. */ void tui_display_main (void) { - if ((sourceWindows ())->count > 0) + if ((tui_source_windows ())->count > 0) { CORE_ADDR addr; @@ -60,97 +54,88 @@ tui_display_main (void) { struct symtab_and_line sal; - tuiUpdateSourceWindowsWithAddr (addr); + tui_update_source_windows_with_addr (addr); sal = find_pc_line (addr, 0); if (sal.symtab) - tuiUpdateLocatorFilename (sal.symtab->filename); + tui_update_locator_filename (sal.symtab->filename); else - tuiUpdateLocatorFilename ("??"); + tui_update_locator_filename ("??"); } } } -/* - ** tuiUpdateSourceWindow(). - ** Function to display source in the source window. This function - ** initializes the horizontal scroll to 0. - */ +/* Function to display source in the source window. This function + initializes the horizontal scroll to 0. */ void -tuiUpdateSourceWindow (TuiWinInfoPtr winInfo, struct symtab *s, - TuiLineOrAddress lineOrAddr, int noerror) +tui_update_source_window (struct tui_win_info * win_info, struct symtab *s, + union tui_line_or_address line_or_addr, int noerror) { - winInfo->detail.sourceInfo.horizontalOffset = 0; - tuiUpdateSourceWindowAsIs (winInfo, s, lineOrAddr, noerror); + win_info->detail.source_info.horizontal_offset = 0; + tui_update_source_window_as_is (win_info, s, line_or_addr, noerror); return; -} /* tuiUpdateSourceWindow */ +} -/* - ** tuiUpdateSourceWindowAsIs(). - ** Function to display source in the source/asm window. This - ** function shows the source as specified by the horizontal offset. - */ +/* Function to display source in the source/asm window. This function + shows the source as specified by the horizontal offset. */ void -tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s, - TuiLineOrAddress lineOrAddr, int noerror) +tui_update_source_window_as_is (struct tui_win_info * win_info, struct symtab *s, + union tui_line_or_address line_or_addr, int noerror) { - TuiStatus ret; + enum tui_status ret; - if (winInfo->generic.type == SRC_WIN) - ret = tuiSetSourceContent (s, lineOrAddr.lineNo, noerror); + if (win_info->generic.type == SRC_WIN) + ret = tui_set_source_content (s, line_or_addr.line_no, noerror); else - ret = tui_set_disassem_content (lineOrAddr.addr); + ret = tui_set_disassem_content (line_or_addr.addr); if (ret == TUI_FAILURE) { - tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT); - tuiClearExecInfoContent (winInfo); + tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT); + tui_clear_exec_info_content (win_info); } else { - tui_update_breakpoint_info (winInfo, 0); - tuiShowSourceContent (winInfo); - tuiUpdateExecInfo (winInfo); - if (winInfo->generic.type == SRC_WIN) + tui_update_breakpoint_info (win_info, 0); + tui_show_source_content (win_info); + tui_update_exec_info (win_info); + if (win_info->generic.type == SRC_WIN) { struct symtab_and_line sal; - sal.line = lineOrAddr.lineNo + - (winInfo->generic.contentSize - 2); + sal.line = line_or_addr.line_no + + (win_info->generic.content_size - 2); sal.symtab = s; set_current_source_symtab_and_line (&sal); /* ** If the focus was in the asm win, put it in the src ** win if we don't have a split layout */ - if (tuiWinWithFocus () == disassemWin && - currentLayout () != SRC_DISASSEM_COMMAND) - tuiSetWinFocusTo (srcWin); + if (tui_win_with_focus () == TUI_DISASM_WIN && + tui_current_layout () != SRC_DISASSEM_COMMAND) + tui_set_win_focus_to (TUI_SRC_WIN); } } return; -} /* tuiUpdateSourceWindowAsIs */ +} -/* - ** tuiUpdateSourceWindowsWithAddr(). - ** Function to ensure that the source and/or disassemly windows - ** reflect the input address. - */ +/* Function to ensure that the source and/or disassemly windows + reflect the input address. */ void -tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr) +tui_update_source_windows_with_addr (CORE_ADDR addr) { if (addr != 0) { struct symtab_and_line sal; - TuiLineOrAddress l; + union tui_line_or_address l; - switch (currentLayout ()) + switch (tui_current_layout ()) { case DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: @@ -161,8 +146,8 @@ tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr) break; default: sal = find_pc_line (addr, 0); - l.lineNo = sal.line; - tuiShowSource (sal.symtab, l, FALSE); + l.line_no = sal.line; + tui_show_symtab_source (sal.symtab, l, FALSE); break; } } @@ -170,40 +155,35 @@ tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr) { int i; - for (i = 0; i < (sourceWindows ())->count; i++) + for (i = 0; i < (tui_source_windows ())->count; i++) { - TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i]; + struct tui_win_info * win_info = (struct tui_win_info *) (tui_source_windows ())->list[i]; - tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT); - tuiClearExecInfoContent (winInfo); + tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT); + tui_clear_exec_info_content (win_info); } } +} - return; -} /* tuiUpdateSourceWindowsWithAddr */ - -/* - ** tuiUpdateSourceWindowsWithLine(). - ** Function to ensure that the source and/or disassemly windows - ** reflect the input address. - */ +/* Function to ensure that the source and/or disassemly windows + reflect the input address. */ void -tuiUpdateSourceWindowsWithLine (struct symtab *s, int line) +tui_update_source_windows_with_line (struct symtab *s, int line) { CORE_ADDR pc; - TuiLineOrAddress l; + union tui_line_or_address l; - switch (currentLayout ()) + switch (tui_current_layout ()) { case DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: find_line_pc (s, line, &pc); - tuiUpdateSourceWindowsWithAddr (pc); + tui_update_source_windows_with_addr (pc); break; default: - l.lineNo = line; - tuiShowSource (s, l, FALSE); - if (currentLayout () == SRC_DISASSEM_COMMAND) + l.line_no = line; + tui_show_symtab_source (s, l, FALSE); + if (tui_current_layout () == SRC_DISASSEM_COMMAND) { find_line_pc (s, line, &pc); tui_show_disassem (pc); @@ -212,133 +192,118 @@ tuiUpdateSourceWindowsWithLine (struct symtab *s, int line) } return; -} /* tuiUpdateSourceWindowsWithLine */ +} -/* - ** tuiClearSourceContent(). - */ void -tuiClearSourceContent (TuiWinInfoPtr winInfo, int displayPrompt) +tui_clear_source_content (struct tui_win_info * win_info, int display_prompt) { - if (m_winPtrNotNull (winInfo)) + if (win_info != NULL) { - register int i; + int i; - winInfo->generic.contentInUse = FALSE; - tuiEraseSourceContent (winInfo, displayPrompt); - for (i = 0; i < winInfo->generic.contentSize; i++) + win_info->generic.content_in_use = FALSE; + tui_erase_source_content (win_info, display_prompt); + for (i = 0; i < win_info->generic.content_size; i++) { - TuiWinElementPtr element = - (TuiWinElementPtr) winInfo->generic.content[i]; - element->whichElement.source.hasBreak = FALSE; - element->whichElement.source.isExecPoint = FALSE; + struct tui_win_element * element = + (struct tui_win_element *) win_info->generic.content[i]; + element->which_element.source.has_break = FALSE; + element->which_element.source.is_exec_point = FALSE; } } - - return; -} /* tuiClearSourceContent */ +} -/* - ** tuiEraseSourceContent(). - */ void -tuiEraseSourceContent (TuiWinInfoPtr winInfo, int displayPrompt) +tui_erase_source_content (struct tui_win_info * win_info, int display_prompt) { - int xPos; - int halfWidth = (winInfo->generic.width - 2) / 2; + int x_pos; + int half_width = (win_info->generic.width - 2) / 2; - if (winInfo->generic.handle != (WINDOW *) NULL) + if (win_info->generic.handle != (WINDOW *) NULL) { - werase (winInfo->generic.handle); - checkAndDisplayHighlightIfNeeded (winInfo); - if (displayPrompt == EMPTY_SOURCE_PROMPT) + werase (win_info->generic.handle); + tui_check_and_display_highlight_if_needed (win_info); + if (display_prompt == EMPTY_SOURCE_PROMPT) { - char *noSrcStr; + char *no_src_str; - if (winInfo->generic.type == SRC_WIN) - noSrcStr = NO_SRC_STRING; + if (win_info->generic.type == SRC_WIN) + no_src_str = NO_SRC_STRING; else - noSrcStr = NO_DISASSEM_STRING; - if (strlen (noSrcStr) >= halfWidth) - xPos = 1; + no_src_str = NO_DISASSEM_STRING; + if (strlen (no_src_str) >= half_width) + x_pos = 1; else - xPos = halfWidth - strlen (noSrcStr); - mvwaddstr (winInfo->generic.handle, - (winInfo->generic.height / 2), - xPos, - noSrcStr); + x_pos = half_width - strlen (no_src_str); + mvwaddstr (win_info->generic.handle, + (win_info->generic.height / 2), + x_pos, + no_src_str); /* elz: added this function call to set the real contents of the window to what is on the screen, so that later calls to refresh, do display the correct stuff, and not the old image */ - tuiSetSourceContentNil (winInfo, noSrcStr); + tui_set_source_content_nil (win_info, no_src_str); } - tuiRefreshWin (&winInfo->generic); + tui_refresh_win (&win_info->generic); } - return; -} /* tuiEraseSourceContent */ +} /* Redraw the complete line of a source or disassembly window. */ static void -tui_show_source_line (TuiWinInfoPtr winInfo, int lineno) +tui_show_source_line (struct tui_win_info * win_info, int lineno) { - TuiWinElementPtr line; + struct tui_win_element * line; int x, y; - line = (TuiWinElementPtr) winInfo->generic.content[lineno - 1]; - if (line->whichElement.source.isExecPoint) - wattron (winInfo->generic.handle, A_STANDOUT); + line = (struct tui_win_element *) win_info->generic.content[lineno - 1]; + if (line->which_element.source.is_exec_point) + wattron (win_info->generic.handle, A_STANDOUT); - mvwaddstr (winInfo->generic.handle, lineno, 1, - line->whichElement.source.line); - if (line->whichElement.source.isExecPoint) - wattroff (winInfo->generic.handle, A_STANDOUT); + mvwaddstr (win_info->generic.handle, lineno, 1, + line->which_element.source.line); + if (line->which_element.source.is_exec_point) + wattroff (win_info->generic.handle, A_STANDOUT); /* Clear to end of line but stop before the border. */ - getyx (winInfo->generic.handle, y, x); - while (x + 1 < winInfo->generic.width) + getyx (win_info->generic.handle, y, x); + while (x + 1 < win_info->generic.width) { - waddch (winInfo->generic.handle, ' '); - getyx (winInfo->generic.handle, y, x); + waddch (win_info->generic.handle, ' '); + getyx (win_info->generic.handle, y, x); } } -/* - ** tuiShowSourceContent(). - */ void -tuiShowSourceContent (TuiWinInfoPtr winInfo) +tui_show_source_content (struct tui_win_info * win_info) { - if (winInfo->generic.contentSize > 0) + if (win_info->generic.content_size > 0) { int lineno; - for (lineno = 1; lineno <= winInfo->generic.contentSize; lineno++) - tui_show_source_line (winInfo, lineno); + for (lineno = 1; lineno <= win_info->generic.content_size; lineno++) + tui_show_source_line (win_info, lineno); } else - tuiEraseSourceContent (winInfo, TRUE); + tui_erase_source_content (win_info, TRUE); - checkAndDisplayHighlightIfNeeded (winInfo); - tuiRefreshWin (&winInfo->generic); - winInfo->generic.contentInUse = TRUE; + tui_check_and_display_highlight_if_needed (win_info); + tui_refresh_win (&win_info->generic); + win_info->generic.content_in_use = TRUE; } -/* - ** tuiHorizontalSourceScroll(). - ** Scroll the source forward or backward horizontally - */ +/* Scroll the source forward or backward horizontally. */ void -tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, - TuiScrollDirection direction, - int numToScroll) +tui_horizontal_source_scroll (struct tui_win_info * win_info, + enum tui_scroll_direction direction, + int num_to_scroll) { - if (winInfo->generic.content != (OpaquePtr) NULL) + if (win_info->generic.content != NULL) { int offset; struct symtab *s; @@ -350,96 +315,94 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, s = cursal.symtab; if (direction == LEFT_SCROLL) - offset = winInfo->detail.sourceInfo.horizontalOffset + numToScroll; + offset = win_info->detail.source_info.horizontal_offset + num_to_scroll; else { if ((offset = - winInfo->detail.sourceInfo.horizontalOffset - numToScroll) < 0) + win_info->detail.source_info.horizontal_offset - num_to_scroll) < 0) offset = 0; } - winInfo->detail.sourceInfo.horizontalOffset = offset; - tuiUpdateSourceWindowAsIs ( - winInfo, - s, - ((TuiWinElementPtr) - winInfo->generic.content[0])->whichElement.source.lineOrAddr, - FALSE); + win_info->detail.source_info.horizontal_offset = offset; + tui_update_source_window_as_is (win_info, s, + ((struct tui_win_element *) + win_info->generic.content[0])->which_element.source.line_or_addr, + FALSE); } return; -} /* tuiHorizontalSourceScroll */ +} -/* Set or clear the hasBreak flag in the line whose line is lineNo. */ +/* Set or clear the has_break flag in the line whose line is line_no. */ void -tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo) +tui_set_is_exec_point_at (union tui_line_or_address l, struct tui_win_info * win_info) { int changed = 0; int i; - TuiWinContent content = (TuiWinContent) winInfo->generic.content; + tui_win_content content = (tui_win_content) win_info->generic.content; i = 0; - while (i < winInfo->generic.contentSize) + while (i < win_info->generic.content_size) { - int newState; + int new_state; - if (content[i]->whichElement.source.lineOrAddr.addr == l.addr) - newState = TRUE; + if (content[i]->which_element.source.line_or_addr.addr == l.addr) + new_state = TRUE; else - newState = FALSE; - if (newState != content[i]->whichElement.source.isExecPoint) + new_state = FALSE; + if (new_state != content[i]->which_element.source.is_exec_point) { changed++; - content[i]->whichElement.source.isExecPoint = newState; - tui_show_source_line (winInfo, i + 1); + content[i]->which_element.source.is_exec_point = new_state; + tui_show_source_line (win_info, i + 1); } i++; } if (changed) - tuiRefreshWin (&winInfo->generic); + tui_refresh_win (&win_info->generic); } /* Update the execution windows to show the active breakpoints. This is called whenever a breakpoint is inserted, removed or has its state changed. */ void -tui_update_all_breakpoint_info () +tui_update_all_breakpoint_info (void) { - TuiList* list = sourceWindows (); + struct tui_list *list = tui_source_windows (); int i; for (i = 0; i < list->count; i++) { - TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i]; + struct tui_win_info * win = (struct tui_win_info *) list->list[i]; if (tui_update_breakpoint_info (win, FALSE)) { - tuiUpdateExecInfo (win); + tui_update_exec_info (win); } } } /* Scan the source window and the breakpoints to update the - hasBreak information for each line. + has_break information for each line. Returns 1 if something changed and the execution window must be refreshed. */ int -tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only) +tui_update_breakpoint_info (struct tui_win_info * win, int current_only) { int i; int need_refresh = 0; - TuiSourceInfoPtr src = &win->detail.sourceInfo; + struct tui_source_info * src = &win->detail.source_info; - for (i = 0; i < win->generic.contentSize; i++) + for (i = 0; i < win->generic.content_size; i++) { struct breakpoint *bp; extern struct breakpoint *breakpoint_chain; int mode; - TuiSourceElement* line; + struct tui_source_element* line; - line = &((TuiWinElementPtr) win->generic.content[i])->whichElement.source; - if (current_only && !line->isExecPoint) + line = &((struct tui_win_element *) win->generic.content[i])->which_element.source; + if (current_only && !line->is_exec_point) continue; /* Scan each breakpoint to see if the current line has something to @@ -450,12 +413,12 @@ tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only) bp != (struct breakpoint *) NULL; bp = bp->next) { - if ((win == srcWin + if ((win == TUI_SRC_WIN && bp->source_file && (strcmp (src->filename, bp->source_file) == 0) - && bp->line_number == line->lineOrAddr.lineNo) - || (win == disassemWin - && bp->loc->address == line->lineOrAddr.addr)) + && bp->line_number == line->line_or_addr.line_no) + || (win == TUI_DISASM_WIN + && bp->loc->address == line->line_or_addr.addr)) { if (bp->enable_state == bp_disabled) mode |= TUI_BP_DISABLED; @@ -469,9 +432,9 @@ tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only) mode |= TUI_BP_HARDWARE; } } - if (line->hasBreak != mode) + if (line->has_break != mode) { - line->hasBreak = mode; + line->has_break = mode; need_refresh = 1; } } @@ -479,62 +442,59 @@ tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only) } -/* - ** tuiSetExecInfoContent(). - ** Function to initialize the content of the execution info window, - ** based upon the input window which is either the source or - ** disassembly window. - */ -TuiStatus -tuiSetExecInfoContent (TuiWinInfoPtr winInfo) +/* Function to initialize the content of the execution info window, + based upon the input window which is either the source or + disassembly window. */ +enum tui_status +tui_set_exec_info_content (struct tui_win_info * win_info) { - TuiStatus ret = TUI_SUCCESS; + enum tui_status ret = TUI_SUCCESS; - if (winInfo->detail.sourceInfo.executionInfo != (TuiGenWinInfoPtr) NULL) + if (win_info->detail.source_info.execution_info != (struct tui_gen_win_info *) NULL) { - TuiGenWinInfoPtr execInfoPtr = winInfo->detail.sourceInfo.executionInfo; + struct tui_gen_win_info * exec_info_ptr = win_info->detail.source_info.execution_info; - if (execInfoPtr->content == (OpaquePtr) NULL) - execInfoPtr->content = - (OpaquePtr) allocContent (winInfo->generic.height, - execInfoPtr->type); - if (execInfoPtr->content != (OpaquePtr) NULL) + if (exec_info_ptr->content == NULL) + exec_info_ptr->content = + (void **) tui_alloc_content (win_info->generic.height, + exec_info_ptr->type); + if (exec_info_ptr->content != NULL) { int i; - tui_update_breakpoint_info (winInfo, 1); - for (i = 0; i < winInfo->generic.contentSize; i++) + tui_update_breakpoint_info (win_info, 1); + for (i = 0; i < win_info->generic.content_size; i++) { - TuiWinElementPtr element; - TuiWinElementPtr srcElement; + struct tui_win_element * element; + struct tui_win_element * src_element; int mode; - element = (TuiWinElementPtr) execInfoPtr->content[i]; - srcElement = (TuiWinElementPtr) winInfo->generic.content[i]; + element = (struct tui_win_element *) exec_info_ptr->content[i]; + src_element = (struct tui_win_element *) win_info->generic.content[i]; - memset(element->whichElement.simpleString, ' ', - sizeof(element->whichElement.simpleString)); - element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0; + memset(element->which_element.simple_string, ' ', + sizeof(element->which_element.simple_string)); + element->which_element.simple_string[TUI_EXECINFO_SIZE - 1] = 0; /* Now update the exec info content based upon the state of each line as indicated by the source content. */ - mode = srcElement->whichElement.source.hasBreak; + mode = src_element->which_element.source.has_break; if (mode & TUI_BP_HIT) - element->whichElement.simpleString[TUI_BP_HIT_POS] = + element->which_element.simple_string[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B'; else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED)) - element->whichElement.simpleString[TUI_BP_HIT_POS] = + element->which_element.simple_string[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'h' : 'b'; if (mode & TUI_BP_ENABLED) - element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+'; + element->which_element.simple_string[TUI_BP_BREAK_POS] = '+'; else if (mode & TUI_BP_DISABLED) - element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-'; + element->which_element.simple_string[TUI_BP_BREAK_POS] = '-'; - if (srcElement->whichElement.source.isExecPoint) - element->whichElement.simpleString[TUI_EXEC_POS] = '>'; + if (src_element->which_element.source.is_exec_point) + element->which_element.simple_string[TUI_EXEC_POS] = '>'; } - execInfoPtr->contentSize = winInfo->generic.contentSize; + exec_info_ptr->content_size = win_info->generic.content_size; } else ret = TUI_FAILURE; @@ -544,169 +504,147 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo) } -/* - ** tuiShowExecInfoContent(). - */ void -tuiShowExecInfoContent (TuiWinInfoPtr winInfo) +tui_show_exec_info_content (struct tui_win_info * win_info) { - TuiGenWinInfoPtr execInfo = winInfo->detail.sourceInfo.executionInfo; - int curLine; - - werase (execInfo->handle); - tuiRefreshWin (execInfo); - for (curLine = 1; (curLine <= execInfo->contentSize); curLine++) - mvwaddstr (execInfo->handle, - curLine, + struct tui_gen_win_info * exec_info = win_info->detail.source_info.execution_info; + int cur_line; + + werase (exec_info->handle); + tui_refresh_win (exec_info); + for (cur_line = 1; (cur_line <= exec_info->content_size); cur_line++) + mvwaddstr (exec_info->handle, + cur_line, 0, - ((TuiWinElementPtr) - execInfo->content[curLine - 1])->whichElement.simpleString); - tuiRefreshWin (execInfo); - execInfo->contentInUse = TRUE; - - return; -} /* tuiShowExecInfoContent */ + ((struct tui_win_element *) + exec_info->content[cur_line - 1])->which_element.simple_string); + tui_refresh_win (exec_info); + exec_info->content_in_use = TRUE; +} -/* - ** tuiEraseExecInfoContent(). - */ void -tuiEraseExecInfoContent (TuiWinInfoPtr winInfo) +tui_erase_exec_info_content (struct tui_win_info * win_info) { - TuiGenWinInfoPtr execInfo = winInfo->detail.sourceInfo.executionInfo; - - werase (execInfo->handle); - tuiRefreshWin (execInfo); + struct tui_gen_win_info * exec_info = win_info->detail.source_info.execution_info; - return; -} /* tuiEraseExecInfoContent */ + werase (exec_info->handle); + tui_refresh_win (exec_info); +} -/* - ** tuiClearExecInfoContent(). - */ void -tuiClearExecInfoContent (TuiWinInfoPtr winInfo) +tui_clear_exec_info_content (struct tui_win_info * win_info) { - winInfo->detail.sourceInfo.executionInfo->contentInUse = FALSE; - tuiEraseExecInfoContent (winInfo); + win_info->detail.source_info.execution_info->content_in_use = FALSE; + tui_erase_exec_info_content (win_info); return; -} /* tuiClearExecInfoContent */ +} -/* - ** tuiUpdateExecInfo(). - ** Function to update the execution info window - */ +/* Function to update the execution info window. */ void -tuiUpdateExecInfo (TuiWinInfoPtr winInfo) +tui_update_exec_info (struct tui_win_info * win_info) { - tuiSetExecInfoContent (winInfo); - tuiShowExecInfoContent (winInfo); -} /* tuiUpdateExecInfo */ + tui_set_exec_info_content (win_info); + tui_show_exec_info_content (win_info); +} -TuiStatus -tuiAllocSourceBuffer (TuiWinInfoPtr winInfo) +enum tui_status +tui_alloc_source_buffer (struct tui_win_info *win_info) { - register char *srcLineBuf; - register int i, lineWidth, maxLines; - TuiStatus ret = TUI_FAILURE; + char *src_line_buf; + int i, line_width, max_lines; + enum tui_status ret = TUI_FAILURE; - maxLines = winInfo->generic.height; /* less the highlight box */ - lineWidth = winInfo->generic.width - 1; + max_lines = win_info->generic.height; /* less the highlight box */ + line_width = win_info->generic.width - 1; /* ** Allocate the buffer for the source lines. Do this only once since they ** will be re-used for all source displays. The only other time this will ** be done is when a window's size changes. */ - if (winInfo->generic.content == (OpaquePtr) NULL) + if (win_info->generic.content == NULL) { - srcLineBuf = (char *) xmalloc ((maxLines * lineWidth) * sizeof (char)); - if (srcLineBuf == (char *) NULL) + src_line_buf = (char *) xmalloc ((max_lines * line_width) * sizeof (char)); + if (src_line_buf == (char *) NULL) fputs_unfiltered ( "Unable to Allocate Memory for Source or Disassembly Display.\n", gdb_stderr); else { /* allocate the content list */ - if ((winInfo->generic.content = - (OpaquePtr) allocContent (maxLines, SRC_WIN)) == (OpaquePtr) NULL) + if ((win_info->generic.content = + (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL) { - tuiFree (srcLineBuf); - srcLineBuf = (char *) NULL; + xfree (src_line_buf); + src_line_buf = (char *) NULL; fputs_unfiltered ( "Unable to Allocate Memory for Source or Disassembly Display.\n", gdb_stderr); } } - for (i = 0; i < maxLines; i++) - ((TuiWinElementPtr) - winInfo->generic.content[i])->whichElement.source.line = - srcLineBuf + (lineWidth * i); + for (i = 0; i < max_lines; i++) + ((struct tui_win_element *) + win_info->generic.content[i])->which_element.source.line = + src_line_buf + (line_width * i); ret = TUI_SUCCESS; } else ret = TUI_SUCCESS; return ret; -} /* tuiAllocSourceBuffer */ +} -/* - ** tuiLineIsDisplayed(). - ** Answer whether the a particular line number or address is displayed - ** in the current source window. - */ +/* Answer whether the a particular line number or address is displayed + in the current source window. */ int -tuiLineIsDisplayed (int line, TuiWinInfoPtr winInfo, - int checkThreshold) +tui_line_is_displayed (int line, struct tui_win_info * win_info, + int check_threshold) { - int isDisplayed = FALSE; + int is_displayed = FALSE; int i, threshold; - if (checkThreshold) + if (check_threshold) threshold = SCROLL_THRESHOLD; else threshold = 0; i = 0; - while (i < winInfo->generic.contentSize - threshold && !isDisplayed) + while (i < win_info->generic.content_size - threshold && !is_displayed) { - isDisplayed = (((TuiWinElementPtr) - winInfo->generic.content[i])->whichElement.source.lineOrAddr.lineNo + is_displayed = (((struct tui_win_element *) + win_info->generic.content[i])->which_element.source.line_or_addr.line_no == (int) line); i++; } - return isDisplayed; -} /* tuiLineIsDisplayed */ + return is_displayed; +} -/* - ** tuiLineIsDisplayed(). - ** Answer whether the a particular line number or address is displayed - ** in the current source window. - */ +/* Answer whether the a particular line number or address is displayed + in the current source window. */ int -tuiAddrIsDisplayed (CORE_ADDR addr, TuiWinInfoPtr winInfo, - int checkThreshold) +tui_addr_is_displayed (CORE_ADDR addr, struct tui_win_info * win_info, + int check_threshold) { - int isDisplayed = FALSE; + int is_displayed = FALSE; int i, threshold; - if (checkThreshold) + if (check_threshold) threshold = SCROLL_THRESHOLD; else threshold = 0; i = 0; - while (i < winInfo->generic.contentSize - threshold && !isDisplayed) + while (i < win_info->generic.content_size - threshold && !is_displayed) { - isDisplayed = (((TuiWinElementPtr) - winInfo->generic.content[i])->whichElement.source.lineOrAddr.addr + is_displayed = (((struct tui_win_element *) + win_info->generic.content[i])->which_element.source.line_or_addr.addr == addr); i++; } - return isDisplayed; + return is_displayed; } diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index cb00449..e64589b 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -1,5 +1,8 @@ /* TUI display source/assembly window. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,50 +22,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _TUI_SOURCEWIN_H -#define _TUI_SOURCEWIN_H +#ifndef TUI_SOURCEWIN_H +#define TUI_SOURCEWIN_H + +#include "tui/tui-data.h" + +struct tui_win_info; -/* Update the execution windows to show the active breakpoints. - This is called whenever a breakpoint is inserted, removed or - has its state changed. */ +/* Update the execution windows to show the active breakpoints. This + is called whenever a breakpoint is inserted, removed or has its + state changed. */ extern void tui_update_all_breakpoint_info (void); -/* Scan the source window and the breakpoints to update the - hasBreak information for each line. - Returns 1 if something changed and the execution window - must be refreshed. */ -extern int tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only); +/* Scan the source window and the breakpoints to update the hasBreak + information for each line. Returns 1 if something changed and the + execution window must be refreshed. */ +extern int tui_update_breakpoint_info (struct tui_win_info * win, + int current_only); /* Function to display the "main" routine. */ extern void tui_display_main (void); -extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress, - int); -extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress, - int); -extern void tuiUpdateSourceWindowsWithAddr (CORE_ADDR); -extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int); -extern void tuiClearSourceContent (TuiWinInfoPtr, int); -extern void tuiEraseSourceContent (TuiWinInfoPtr, int); -extern void tuiSetSourceContentNil (TuiWinInfoPtr, char *); -extern void tuiShowSourceContent (TuiWinInfoPtr); -extern void tuiHorizontalSourceScroll (TuiWinInfoPtr, TuiScrollDirection, - int); -extern TuiStatus tuiSetExecInfoContent (TuiWinInfoPtr); -extern void tuiShowExecInfoContent (TuiWinInfoPtr); -extern void tuiEraseExecInfoContent (TuiWinInfoPtr); -extern void tuiClearExecInfoContent (TuiWinInfoPtr); -extern void tuiUpdateExecInfo (TuiWinInfoPtr); - -extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr); -extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr); -extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int); -extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int); - - -/* - ** Constant definitions - */ +extern void tui_update_source_window (struct tui_win_info *, struct symtab *, + union tui_line_or_address, int); +extern void tui_update_source_window_as_is (struct tui_win_info *, + struct symtab *, + union tui_line_or_address, int); +extern void tui_update_source_windows_with_addr (CORE_ADDR); +extern void tui_update_source_windows_with_line (struct symtab *, int); +extern void tui_clear_source_content (struct tui_win_info *, int); +extern void tui_erase_source_content (struct tui_win_info *, int); +extern void tui_show_source_content (struct tui_win_info *); +extern void tui_horizontal_source_scroll (struct tui_win_info *, + enum tui_scroll_direction, int); +extern enum tui_status tui_set_exec_info_content (struct tui_win_info *); +extern void tui_show_exec_info_content (struct tui_win_info *); +extern void tui_erase_exec_info_content (struct tui_win_info *); +extern void tui_clear_exec_info_content (struct tui_win_info *); +extern void tui_update_exec_info (struct tui_win_info *); + +extern void tui_set_is_exec_point_at (union tui_line_or_address, + struct tui_win_info *); +extern enum tui_status tui_alloc_source_buffer (struct tui_win_info *); +extern int tui_line_is_displayed (int, struct tui_win_info *, int); +extern int tui_addr_is_displayed (CORE_ADDR, struct tui_win_info *, int); + + +/* Constant definitions. */ #define SCROLL_THRESHOLD 2 /* threshold for lazy scroll */ #endif -/*_TUI_SOURCEWIN_H */ diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 5b9cff0..2da728f 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -1,7 +1,7 @@ /* General functions for the WDB TUI. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -38,6 +38,7 @@ #include "defs.h" #include "gdbcmd.h" #include "tui/tui.h" +#include "tui/tui-hooks.h" #include "tui/tui-data.h" #include "tui/tui-layout.h" #include "tui/tui-io.h" @@ -54,19 +55,13 @@ #include "symtab.h" #include "source.h" -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#ifdef HAVE_CURSES_H -#include <curses.h> -#endif -#endif +#include "gdb_curses.h" /* Tells whether the TUI is active or not. */ int tui_active = 0; static int tui_finish_init = 1; -enum tui_key_mode tui_current_key_mode = tui_command_mode; +enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE; struct tui_char_command { @@ -137,10 +132,10 @@ tui_rl_change_windows (int notused1, int notused2) if (tui_active) { - TuiLayoutType new_layout; - TuiRegisterDisplayType regs_type = TUI_UNDEFINED_REGS; + enum tui_layout_type new_layout; + enum tui_register_display_type regs_type = TUI_UNDEFINED_REGS; - new_layout = currentLayout (); + new_layout = tui_current_layout (); /* Select a new layout to have a rolling layout behavior with always two windows (except when undefined). */ @@ -170,7 +165,7 @@ tui_rl_change_windows (int notused1, int notused2) new_layout = SRC_COMMAND; break; } - tuiSetLayout (new_layout, regs_type); + tui_set_layout (new_layout, regs_type); } return 0; } @@ -185,10 +180,10 @@ tui_rl_delete_other_windows (int notused1, int notused2) if (tui_active) { - TuiLayoutType new_layout; - TuiRegisterDisplayType regs_type = TUI_UNDEFINED_REGS; + enum tui_layout_type new_layout; + enum tui_register_display_type regs_type = TUI_UNDEFINED_REGS; - new_layout = currentLayout (); + new_layout = tui_current_layout (); /* Kill one window. */ switch (new_layout) @@ -205,7 +200,7 @@ tui_rl_delete_other_windows (int notused1, int notused2) new_layout = DISASSEM_COMMAND; break; } - tuiSetLayout (new_layout, regs_type); + tui_set_layout (new_layout, regs_type); } return 0; } @@ -215,18 +210,18 @@ tui_rl_delete_other_windows (int notused1, int notused2) static int tui_rl_other_window (int count, int key) { - TuiWinInfoPtr winInfo; + struct tui_win_info * win_info; if (!tui_active) tui_rl_switch_mode (0/*notused*/, 0/*notused*/); - winInfo = tuiNextWin (tuiWinWithFocus ()); - if (winInfo) + win_info = tui_next_win (tui_win_with_focus ()); + if (win_info) { - tuiSetWinFocusTo (winInfo); - if (dataWin && dataWin->generic.isVisible) - tuiRefreshDataWin (); - keypad (cmdWin->generic.handle, (winInfo != cmdWin)); + tui_set_win_focus_to (win_info); + if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible) + tui_refresh_data_win (); + keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN)); } return 0; } @@ -261,7 +256,7 @@ tui_rl_command_key (int count, int key) static int tui_rl_command_mode (int count, int key) { - tui_set_key_mode (tui_one_command_mode); + tui_set_key_mode (TUI_ONE_COMMAND_MODE); return rl_insert (count, key); } @@ -273,8 +268,8 @@ tui_rl_next_keymap (int notused1, int notused2) if (!tui_active) tui_rl_switch_mode (0/*notused*/, 0/*notused*/); - tui_set_key_mode (tui_current_key_mode == tui_command_mode - ? tui_single_key_mode : tui_command_mode); + tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE + ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE); return 0; } @@ -283,11 +278,11 @@ tui_rl_next_keymap (int notused1, int notused2) the command window is cleaner. It will be displayed if we temporarily leave the SingleKey mode. */ static int -tui_rl_startup_hook () +tui_rl_startup_hook (void) { rl_already_prompted = 1; - if (tui_current_key_mode != tui_command_mode) - tui_set_key_mode (tui_single_key_mode); + if (tui_current_key_mode != TUI_COMMAND_MODE) + tui_set_key_mode (TUI_SINGLE_KEY_MODE); tui_redisplay_readline (); return 0; } @@ -297,15 +292,15 @@ void tui_set_key_mode (enum tui_key_mode mode) { tui_current_key_mode = mode; - rl_set_keymap (mode == tui_single_key_mode + rl_set_keymap (mode == TUI_SINGLE_KEY_MODE ? tui_keymap : tui_readline_standard_keymap); - tuiShowLocatorContent (); + tui_show_locator_content (); } /* Initialize readline and configure the keymap for the switching key shortcut. */ void -tui_initialize_readline () +tui_initialize_readline (void) { int i; Keymap tui_ctlx_keymap; @@ -384,15 +379,15 @@ tui_enable (void) nl(); keypad (w, TRUE); rl_initialize (); - setTermHeightTo (LINES); - setTermWidthTo (COLS); + tui_set_term_height_to (LINES); + tui_set_term_width_to (COLS); def_prog_mode (); - tuiShowFrameInfo (0); - tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS); - tuiSetWinFocusTo (srcWin); - keypad (cmdWin->generic.handle, TRUE); - wrefresh (cmdWin->generic.handle); + tui_show_frame_info (0); + tui_set_layout (SRC_COMMAND, TUI_UNDEFINED_REGS); + tui_set_win_focus_to (TUI_SRC_WIN); + keypad (TUI_CMD_WIN->generic.handle, TRUE); + wrefresh (TUI_CMD_WIN->generic.handle); tui_finish_init = 0; } else @@ -413,11 +408,11 @@ tui_enable (void) tui_active = 1; if (deprecated_selected_frame) - tuiShowFrameInfo (deprecated_selected_frame); + tui_show_frame_info (deprecated_selected_frame); /* Restore TUI keymap. */ tui_set_key_mode (tui_current_key_mode); - tuiRefreshAll (); + tui_refresh_all_win (); /* Update gdb's knowledge of its terminal. */ target_terminal_save_ours (); @@ -456,26 +451,15 @@ tui_disable (void) tui_update_gdb_sizes (); } -/* Wrapper on top of free() to ensure that input address - is greater than 0x0. */ void -tuiFree (char *ptr) +strcat_to_buf (char *buf, int buflen, const char *item_to_add) { - if (ptr != (char *) NULL) + if (item_to_add != (char *) NULL && buf != (char *) NULL) { - xfree (ptr); - } -} - -void -strcat_to_buf (char *buf, int buflen, const char *itemToAdd) -{ - if (itemToAdd != (char *) NULL && buf != (char *) NULL) - { - if ((strlen (buf) + strlen (itemToAdd)) <= buflen) - strcat (buf, itemToAdd); + if ((strlen (buf) + strlen (item_to_add)) <= buflen) + strcat (buf, item_to_add); else - strncat (buf, itemToAdd, (buflen - strlen (buf))); + strncat (buf, item_to_add, (buflen - strlen (buf))); } } @@ -489,7 +473,7 @@ strcat_to_buf (char *buf, int buflen, const char *itemToAdd) #define CHK(val, dft) (val<=0 ? dft : val) static void -_tuiReset (void) +tui_reset (void) { struct termio mode; @@ -555,7 +539,7 @@ _tuiReset (void) #endif /* USG */ return; -} /* _tuiReset */ +} #endif void @@ -563,40 +547,40 @@ tui_show_source (const char *file, int line) { struct symtab_and_line cursal = get_current_source_symtab_and_line (); /* make sure that the source window is displayed */ - tuiAddWinToLayout (SRC_WIN); + tui_add_win_to_layout (SRC_WIN); - tuiUpdateSourceWindowsWithLine (cursal.symtab, line); - tuiUpdateLocatorFilename (file); + tui_update_source_windows_with_line (cursal.symtab, line); + tui_update_locator_filename (file); } void tui_show_assembly (CORE_ADDR addr) { - tuiAddWinToLayout (DISASSEM_WIN); - tuiUpdateSourceWindowsWithAddr (addr); + tui_add_win_to_layout (DISASSEM_WIN); + tui_update_source_windows_with_addr (addr); } int -tui_is_window_visible (TuiWinType type) +tui_is_window_visible (enum tui_win_type type) { if (tui_active == 0) return 0; - if (winList[type] == 0) + if (tui_win_list[type] == 0) return 0; - return winList[type]->generic.isVisible; + return tui_win_list[type]->generic.is_visible; } int tui_get_command_dimension (int *width, int *height) { - if (!tui_active || !m_winPtrNotNull (cmdWin)) + if (!tui_active || (TUI_CMD_WIN == NULL)) { return 0; } - *width = cmdWin->generic.width; - *height = cmdWin->generic.height; + *width = TUI_CMD_WIN->generic.width; + *height = TUI_CMD_WIN->generic.height; return 1; } diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 03d036d..d7b741c 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -25,76 +25,40 @@ #ifndef TUI_H #define TUI_H -#include <stdarg.h> -#include <string.h> -#include "ansidecl.h" - -#if defined(reg) -#undef reg -#endif -#if defined(chtype) -#undef chtype -#endif - struct ui_file; -/* Opaque data type */ -typedef char *Opaque; -typedef -Opaque (*OpaqueFuncPtr) (va_list); - typedef char **OpaqueList; - typedef OpaqueList OpaquePtr; - -/* Generic function pointer */ - typedef void (*TuiVoidFuncPtr) (va_list); - typedef int (*TuiIntFuncPtr) (va_list); -/* - typedef Opaque (*TuiOpaqueFuncPtr) (va_list); - */ - typedef OpaqueFuncPtr TuiOpaqueFuncPtr; - extern void strcat_to_buf (char *, int, const char *); -/* Types of error returns */ - typedef enum tui_status - { - TUI_SUCCESS, - TUI_FAILURE - } -TuiStatus, *TuiStatusPtr; +/* Types of error returns. */ +enum tui_status +{ + TUI_SUCCESS, + TUI_FAILURE +}; /* Types of windows */ - typedef enum - { - SRC_WIN = 0, - DISASSEM_WIN, - DATA_WIN, - CMD_WIN, - /* This must ALWAYS be AFTER the major windows last */ - MAX_MAJOR_WINDOWS, - /* auxillary windows */ - LOCATOR_WIN, - EXEC_INFO_WIN, - DATA_ITEM_WIN, - /* This must ALWAYS be next to last */ - MAX_WINDOWS, - UNDEFINED_WIN /* LAST */ - } -TuiWinType, *TuiWinTypePtr; - -/* This is a point definition */ - typedef struct _TuiPoint - { - int x, y; - } -TuiPoint, *TuiPointPtr; +enum tui_win_type +{ + SRC_WIN = 0, + DISASSEM_WIN, + DATA_WIN, + CMD_WIN, + /* This must ALWAYS be AFTER the major windows last. */ + MAX_MAJOR_WINDOWS, + /* Auxillary windows. */ + LOCATOR_WIN, + EXEC_INFO_WIN, + DATA_ITEM_WIN, + /* This must ALWAYS be next to last. */ + MAX_WINDOWS, + UNDEFINED_WIN /* LAST */ +}; /* GENERAL TUI FUNCTIONS */ /* tui.c */ -extern void tuiFree (char *); -extern CORE_ADDR tuiGetLowDisassemblyAddress (CORE_ADDR, CORE_ADDR); +extern CORE_ADDR tui_get_low_disassembly_address (CORE_ADDR, CORE_ADDR); extern void tui_show_assembly (CORE_ADDR addr); -extern int tui_is_window_visible (TuiWinType type); +extern int tui_is_window_visible (enum tui_win_type type); extern int tui_get_command_dimension (int *width, int *height); /* Initialize readline and configure the keymap for the switching @@ -110,13 +74,13 @@ extern void tui_disable (void); enum tui_key_mode { /* Plain command mode to enter gdb commands. */ - tui_command_mode, + TUI_COMMAND_MODE, /* SingleKey mode with some keys bound to gdb commands. */ - tui_single_key_mode, + TUI_SINGLE_KEY_MODE, /* Read/edit one command and return to SingleKey after it's processed. */ - tui_one_command_mode + TUI_ONE_COMMAND_MODE }; extern enum tui_key_mode tui_current_key_mode; @@ -124,23 +88,13 @@ extern enum tui_key_mode tui_current_key_mode; /* Change the TUI key mode by installing the appropriate readline keymap. */ extern void tui_set_key_mode (enum tui_key_mode mode); -extern void tui_initialize_io (void); - -extern void tui_initialize_readline (void); - extern int tui_active; -extern void tui_install_hooks (void); -extern void tui_remove_hooks (void); - extern void tui_show_source (const char *file, int line); extern struct ui_out *tui_out_new (struct ui_file *stream); -/* tuiLayout.c */ -extern TuiStatus tui_set_layout (const char *); - -/* tuiSourceWin.c */ -extern void tuiUpdateAllExecInfos (void); +/* tui-layout.c */ +extern enum tui_status tui_set_layout_for_display_command (const char *name); -#endif /* TUI_H */ +#endif diff --git a/gdb/utils.c b/gdb/utils.c index 556486b..e99164c 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -27,6 +27,10 @@ #include "gdb_string.h" #include "event-top.h" +#ifdef TUI +#include "tui/tui.h" /* For tui_get_command_dimension. */ +#endif + #ifdef __GO32__ #include <pc.h> #endif diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 321e97a..692a0dd 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1243,8 +1243,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) */ /* Stack grows up. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - /* This value is almost never non-zero... */ - set_gdbarch_frame_args_skip (gdbarch, 0); /* * Call Dummies diff --git a/gdb/valops.c b/gdb/valops.c index 14fefd9..6042277 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -62,6 +62,38 @@ static struct value *search_struct_method (char *, struct value **, struct value **, int, int *, struct type *); +static int find_oload_champ_namespace (struct type **arg_types, int nargs, + const char *func_name, + const char *qualified_name, + struct symbol ***oload_syms, + struct badness_vector **oload_champ_bv); + +static +int find_oload_champ_namespace_loop (struct type **arg_types, int nargs, + const char *func_name, + const char *qualified_name, + int namespace_len, + struct symbol ***oload_syms, + struct badness_vector **oload_champ_bv, + int *oload_champ); + +static int find_oload_champ (struct type **arg_types, int nargs, int method, + int num_fns, + struct fn_field *fns_ptr, + struct symbol **oload_syms, + struct badness_vector **oload_champ_bv); + +static int oload_method_static (int method, struct fn_field *fns_ptr, + int index); + +enum oload_classification { STANDARD, NON_STANDARD, INCOMPATIBLE }; + +static enum +oload_classification classify_oload_match (struct badness_vector + * oload_champ_bv, + int nargs, + int static_offset); + static int check_field_in (struct type *, const char *); static struct value *value_struct_elt_for_reference (struct type *domain, @@ -1893,19 +1925,10 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, int lax, struct value **objp, struct symbol *fsym, struct value **valp, struct symbol **symp, int *staticp) { - int nparms; - struct type **parm_types; - int champ_nparms = 0; struct value *obj = (objp ? *objp : NULL); - short oload_champ = -1; /* Index of best overloaded function */ - short oload_ambiguous = 0; /* Current ambiguity state for overload resolution */ - /* 0 => no ambiguity, 1 => two good funcs, 2 => incomparable funcs */ - short oload_ambig_champ = -1; /* 2nd contender for best match */ - short oload_non_standard = 0; /* did we have to use non-standard conversions? */ - short oload_incompatible = 0; /* are args supplied incompatible with any function? */ + int oload_champ; /* Index of best overloaded function */ - struct badness_vector *bv; /* A measure of how good an overloaded instance is */ struct badness_vector *oload_champ_bv = NULL; /* The measure for the current best match */ struct value *temp = obj; @@ -1914,13 +1937,13 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, int num_fns = 0; /* Number of overloaded instances being considered */ struct type *basetype = NULL; int boffset; - int jj; int ix; int static_offset; - struct cleanup *cleanups = NULL; + struct cleanup *old_cleanups = NULL; - char *obj_type_name = NULL; + const char *obj_type_name = NULL; char *func_name = NULL; + enum oload_classification match_quality; /* Get the list of overloaded methods or functions */ if (method) @@ -1944,38 +1967,269 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, been resolved by find_method_list via value_find_oload_method_list above. */ gdb_assert (TYPE_DOMAIN_TYPE (fns_ptr[0].type) != NULL); + oload_champ = find_oload_champ (arg_types, nargs, method, num_fns, + fns_ptr, oload_syms, &oload_champ_bv); } else { - int i = -1; - func_name = cplus_demangle (DEPRECATED_SYMBOL_NAME (fsym), DMGL_NO_OPTS); + const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym); + func_name = cp_func_name (qualified_name); /* If the name is NULL this must be a C-style function. Just return the same symbol. */ - if (!func_name) + if (func_name == NULL) { *symp = fsym; return 0; } - oload_syms = make_symbol_overload_list (fsym); - cleanups = make_cleanup (xfree, oload_syms); - while (oload_syms[++i]) - num_fns++; - if (!num_fns) - error ("Couldn't find function %s", func_name); + old_cleanups = make_cleanup (xfree, func_name); + make_cleanup (xfree, oload_syms); + make_cleanup (xfree, oload_champ_bv); + + oload_champ = find_oload_champ_namespace (arg_types, nargs, + func_name, + qualified_name, + &oload_syms, + &oload_champ_bv); + } + + /* Check how bad the best match is. */ + + match_quality + = classify_oload_match (oload_champ_bv, nargs, + oload_method_static (method, fns_ptr, + oload_champ)); + + if (match_quality == INCOMPATIBLE) + { + if (method) + error ("Cannot resolve method %s%s%s to any overloaded instance", + obj_type_name, + (obj_type_name && *obj_type_name) ? "::" : "", + name); + else + error ("Cannot resolve function %s to any overloaded instance", + func_name); + } + else if (match_quality == NON_STANDARD) + { + if (method) + warning ("Using non-standard conversion to match method %s%s%s to supplied arguments", + obj_type_name, + (obj_type_name && *obj_type_name) ? "::" : "", + name); + else + warning ("Using non-standard conversion to match function %s to supplied arguments", + func_name); + } + + if (method) + { + if (staticp != NULL) + *staticp = oload_method_static (method, fns_ptr, oload_champ); + if (TYPE_FN_FIELD_VIRTUAL_P (fns_ptr, oload_champ)) + *valp = value_virtual_fn_field (&temp, fns_ptr, oload_champ, basetype, boffset); + else + *valp = value_fn_field (&temp, fns_ptr, oload_champ, basetype, boffset); + } + else + { + *symp = oload_syms[oload_champ]; + } + + if (objp) + { + if (TYPE_CODE (VALUE_TYPE (temp)) != TYPE_CODE_PTR + && TYPE_CODE (VALUE_TYPE (*objp)) == TYPE_CODE_PTR) + { + temp = value_addr (temp); + } + *objp = temp; + } + if (old_cleanups != NULL) + do_cleanups (old_cleanups); + + switch (match_quality) + { + case INCOMPATIBLE: + return 100; + case NON_STANDARD: + return 10; + default: /* STANDARD */ + return 0; + } +} + +/* Find the best overload match, searching for FUNC_NAME in namespaces + contained in QUALIFIED_NAME until it either finds a good match or + runs out of namespaces. It stores the overloaded functions in + *OLOAD_SYMS, and the badness vector in *OLOAD_CHAMP_BV. The + calling function is responsible for freeing *OLOAD_SYMS and + *OLOAD_CHAMP_BV. */ + +static int +find_oload_champ_namespace (struct type **arg_types, int nargs, + const char *func_name, + const char *qualified_name, + struct symbol ***oload_syms, + struct badness_vector **oload_champ_bv) +{ + int oload_champ; + + find_oload_champ_namespace_loop (arg_types, nargs, + func_name, + qualified_name, 0, + oload_syms, oload_champ_bv, + &oload_champ); + + return oload_champ; +} + +/* Helper function for find_oload_champ_namespace; NAMESPACE_LEN is + how deep we've looked for namespaces, and the champ is stored in + OLOAD_CHAMP. The return value is 1 if the champ is a good one, 0 + if it isn't. + + It is the caller's responsibility to free *OLOAD_SYMS and + *OLOAD_CHAMP_BV. */ + +static int +find_oload_champ_namespace_loop (struct type **arg_types, int nargs, + const char *func_name, + const char *qualified_name, + int namespace_len, + struct symbol ***oload_syms, + struct badness_vector **oload_champ_bv, + int *oload_champ) +{ + int next_namespace_len = namespace_len; + int searched_deeper = 0; + int num_fns = 0; + struct cleanup *old_cleanups; + int new_oload_champ; + struct symbol **new_oload_syms; + struct badness_vector *new_oload_champ_bv; + char *new_namespace; + + if (next_namespace_len != 0) + { + gdb_assert (qualified_name[next_namespace_len] == ':'); + next_namespace_len += 2; + } + next_namespace_len + += cp_find_first_component (qualified_name + next_namespace_len); + + /* Initialize these to values that can safely be xfree'd. */ + *oload_syms = NULL; + *oload_champ_bv = NULL; + + /* First, see if we have a deeper namespace we can search in. If we + get a good match there, use it. */ + + if (qualified_name[next_namespace_len] == ':') + { + searched_deeper = 1; + + if (find_oload_champ_namespace_loop (arg_types, nargs, + func_name, qualified_name, + next_namespace_len, + oload_syms, oload_champ_bv, + oload_champ)) + { + return 1; + } + }; + + /* If we reach here, either we're in the deepest namespace or we + didn't find a good match in a deeper namespace. But, in the + latter case, we still have a bad match in a deeper namespace; + note that we might not find any match at all in the current + namespace. (There's always a match in the deepest namespace, + because this overload mechanism only gets called if there's a + function symbol to start off with.) */ + + old_cleanups = make_cleanup (xfree, *oload_syms); + old_cleanups = make_cleanup (xfree, *oload_champ_bv); + new_namespace = alloca (namespace_len + 1); + strncpy (new_namespace, qualified_name, namespace_len); + new_namespace[namespace_len] = '\0'; + new_oload_syms = make_symbol_overload_list (func_name, + new_namespace); + while (new_oload_syms[num_fns]) + ++num_fns; + + new_oload_champ = find_oload_champ (arg_types, nargs, 0, num_fns, + NULL, new_oload_syms, + &new_oload_champ_bv); + + /* Case 1: We found a good match. Free earlier matches (if any), + and return it. Case 2: We didn't find a good match, but we're + not the deepest function. Then go with the bad match that the + deeper function found. Case 3: We found a bad match, and we're + the deepest function. Then return what we found, even though + it's a bad match. */ + + if (new_oload_champ != -1 + && classify_oload_match (new_oload_champ_bv, nargs, 0) == STANDARD) + { + *oload_syms = new_oload_syms; + *oload_champ = new_oload_champ; + *oload_champ_bv = new_oload_champ_bv; + do_cleanups (old_cleanups); + return 1; + } + else if (searched_deeper) + { + xfree (new_oload_syms); + xfree (new_oload_champ_bv); + discard_cleanups (old_cleanups); + return 0; + } + else + { + gdb_assert (new_oload_champ != -1); + *oload_syms = new_oload_syms; + *oload_champ = new_oload_champ; + *oload_champ_bv = new_oload_champ_bv; + discard_cleanups (old_cleanups); + return 0; } +} + +/* Look for a function to take NARGS args of types ARG_TYPES. Find + the best match from among the overloaded methods or functions + (depending on METHOD) given by FNS_PTR or OLOAD_SYMS, respectively. + The number of methods/functions in the list is given by NUM_FNS. + Return the index of the best match; store an indication of the + quality of the match in OLOAD_CHAMP_BV. + + It is the caller's responsibility to free *OLOAD_CHAMP_BV. */ + +static int +find_oload_champ (struct type **arg_types, int nargs, int method, + int num_fns, struct fn_field *fns_ptr, + struct symbol **oload_syms, + struct badness_vector **oload_champ_bv) +{ + int ix; + struct badness_vector *bv; /* A measure of how good an overloaded instance is */ + int oload_champ = -1; /* Index of best overloaded function */ + int oload_ambiguous = 0; /* Current ambiguity state for overload resolution */ + /* 0 => no ambiguity, 1 => two good funcs, 2 => incomparable funcs */ - oload_champ_bv = NULL; + *oload_champ_bv = NULL; /* Consider each candidate in turn */ for (ix = 0; ix < num_fns; ix++) { - static_offset = 0; + int jj; + int static_offset = oload_method_static (method, fns_ptr, ix); + int nparms; + struct type **parm_types; + if (method) { - if (TYPE_FN_FIELD_STATIC_P (fns_ptr, ix)) - static_offset = 1; nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (fns_ptr, ix)); } else @@ -1996,30 +2250,25 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, bv = rank_function (parm_types, nparms, arg_types + static_offset, nargs - static_offset); - if (!oload_champ_bv) + if (!*oload_champ_bv) { - oload_champ_bv = bv; + *oload_champ_bv = bv; oload_champ = 0; - champ_nparms = nparms; } else /* See whether current candidate is better or worse than previous best */ - switch (compare_badness (bv, oload_champ_bv)) + switch (compare_badness (bv, *oload_champ_bv)) { case 0: oload_ambiguous = 1; /* top two contenders are equally good */ - oload_ambig_champ = ix; break; case 1: oload_ambiguous = 2; /* incomparable top contenders */ - oload_ambig_champ = ix; break; case 2: - oload_champ_bv = bv; /* new champion, record details */ + *oload_champ_bv = bv; /* new champion, record details */ oload_ambiguous = 0; oload_champ = ix; - oload_ambig_champ = -1; - champ_nparms = nparms; break; case 3: default: @@ -2036,90 +2285,41 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, fprintf_filtered (gdb_stderr,"...Badness @ %d : %d\n", jj, bv->rank[jj]); fprintf_filtered (gdb_stderr,"Overload resolution champion is %d, ambiguous? %d\n", oload_champ, oload_ambiguous); } - } /* end loop over all candidates */ - /* NOTE: dan/2000-03-10: Seems to be a better idea to just pick one - if they have the exact same goodness. This is because there is no - way to differentiate based on return type, which we need to in - cases like overloads of .begin() <It's both const and non-const> */ -#if 0 - if (oload_ambiguous) - { - if (method) - error ("Cannot resolve overloaded method %s%s%s to unique instance; disambiguate by specifying function signature", - obj_type_name, - (obj_type_name && *obj_type_name) ? "::" : "", - name); - else - error ("Cannot resolve overloaded function %s to unique instance; disambiguate by specifying function signature", - func_name); } -#endif - /* Check how bad the best match is. */ - static_offset = 0; - if (method && TYPE_FN_FIELD_STATIC_P (fns_ptr, oload_champ)) - static_offset = 1; - for (ix = 1; ix <= nargs - static_offset; ix++) - { - if (oload_champ_bv->rank[ix] >= 100) - oload_incompatible = 1; /* truly mismatched types */ + return oload_champ; +} - else if (oload_champ_bv->rank[ix] >= 10) - oload_non_standard = 1; /* non-standard type conversions needed */ - } - if (oload_incompatible) - { - if (method) - error ("Cannot resolve method %s%s%s to any overloaded instance", - obj_type_name, - (obj_type_name && *obj_type_name) ? "::" : "", - name); - else - error ("Cannot resolve function %s to any overloaded instance", - func_name); - } - else if (oload_non_standard) - { - if (method) - warning ("Using non-standard conversion to match method %s%s%s to supplied arguments", - obj_type_name, - (obj_type_name && *obj_type_name) ? "::" : "", - name); - else - warning ("Using non-standard conversion to match function %s to supplied arguments", - func_name); - } +/* Return 1 if we're looking at a static method, 0 if we're looking at + a non-static method or a function that isn't a method. */ - if (method) - { - if (staticp && TYPE_FN_FIELD_STATIC_P (fns_ptr, oload_champ)) - *staticp = 1; - else if (staticp) - *staticp = 0; - if (TYPE_FN_FIELD_VIRTUAL_P (fns_ptr, oload_champ)) - *valp = value_virtual_fn_field (&temp, fns_ptr, oload_champ, basetype, boffset); - else - *valp = value_fn_field (&temp, fns_ptr, oload_champ, basetype, boffset); - } +static int +oload_method_static (int method, struct fn_field *fns_ptr, int index) +{ + if (method && TYPE_FN_FIELD_STATIC_P (fns_ptr, index)) + return 1; else - { - *symp = oload_syms[oload_champ]; - xfree (func_name); - } + return 0; +} - if (objp) +/* Check how good an overload match OLOAD_CHAMP_BV represents. */ + +static enum oload_classification +classify_oload_match (struct badness_vector *oload_champ_bv, + int nargs, + int static_offset) +{ + int ix; + + for (ix = 1; ix <= nargs - static_offset; ix++) { - if (TYPE_CODE (VALUE_TYPE (temp)) != TYPE_CODE_PTR - && TYPE_CODE (VALUE_TYPE (*objp)) == TYPE_CODE_PTR) - { - temp = value_addr (temp); - } - *objp = temp; + if (oload_champ_bv->rank[ix] >= 100) + return INCOMPATIBLE; /* truly mismatched types */ + else if (oload_champ_bv->rank[ix] >= 10) + return NON_STANDARD; /* non-standard type conversions needed */ } - if (cleanups != NULL) - do_cleanups (cleanups); - return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0); + return STANDARD; /* Only standard conversions needed. */ } /* C++: return 1 is NAME is a legitimate name for the destructor diff --git a/gdb/values.c b/gdb/values.c index 386e3bf..87baf21 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1247,9 +1247,9 @@ register_value_being_returned (struct type *valtype, struct regcache *retbuf) return val; } -/* 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). +/* Should we use DEPRECATED_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). On most machines, the struct convention is used unless we are using gcc and the type is of a special size. */ diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 939c327..169b532 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -187,9 +187,6 @@ vax_frame_chain (struct frame_info *frame) { /* In the case of the VAX, the frame's nominal address is the FP value, and 12 bytes later comes the saved previous FP value as a 4-byte word. */ - if (deprecated_inside_entry_file (get_frame_pc (frame))) - return (0); - return (read_memory_integer (get_frame_base (frame) + 12, 4)); } diff --git a/gdb/version.in b/gdb/version.in index ac22164..03fc5a7 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2004-01-22-cvs +2004-02-14-cvs diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 4375d18..0f67a8d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1,6 +1,6 @@ /* Read AIX xcoff symbol tables and convert to internal format, for GDB. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Derived from coffread.c, dbxread.c, and a lot of hacking. Contributed by IBM Corporation. @@ -988,7 +988,7 @@ read_xcoff_symtab (struct partial_symtab *pst) if (cs->c_name[E_SYMNMLEN - 1] != '\0') { char *p; - p = obstack_alloc (&objfile->symbol_obstack, E_SYMNMLEN + 1); + p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1); strncpy (p, cs->c_name, E_SYMNMLEN); p[E_SYMNMLEN] = '\0'; cs->c_name = p; @@ -1422,12 +1422,12 @@ read_xcoff_symtab (struct partial_symtab *pst) #define SYMBOL_DUP(SYMBOL1, SYMBOL2) \ (SYMBOL2) = (struct symbol *) \ - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); \ + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); \ *(SYMBOL2) = *(SYMBOL1); #define SYMNAME_ALLOC(NAME, ALLOCED) \ - (ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->symbol_obstack); + (ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->objfile_obstack); static struct type *func_symbol_type; @@ -1894,10 +1894,10 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) if (val != sizeof lengthbuf || length < sizeof lengthbuf) return; - /* Allocate string table from symbol_obstack. We will need this table + /* Allocate string table from objfile_obstack. We will need this table as long as we have its symbol table around. */ - strtbl = (char *) obstack_alloc (&objfile->symbol_obstack, length); + strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length); ((struct coff_symfile_info *) objfile->sym_private)->strtbl = strtbl; /* Copy length buffer, the first byte is usually zero and is @@ -1946,7 +1946,7 @@ xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum, global_syms, static_syms); result->read_symtab_private = (char *) - obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc)); ((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum; result->read_symtab = xcoff_psymtab_to_symtab; @@ -1993,7 +1993,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list, if (number_dependencies) { pst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, number_dependencies * sizeof (struct partial_symtab *)); memcpy (pst->dependencies, dependency_list, number_dependencies * sizeof (struct partial_symtab *)); @@ -2008,7 +2008,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list, subpst->section_offsets = pst->section_offsets; subpst->read_symtab_private = - (char *) obstack_alloc (&objfile->psymbol_obstack, + (char *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc)); ((struct symloc *) subpst->read_symtab_private)->first_symnum = 0; ((struct symloc *) subpst->read_symtab_private)->numsyms = 0; @@ -2018,7 +2018,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list, /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ subpst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct partial_symtab *)); subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; @@ -2081,7 +2081,7 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux, /* FIXME: wastes memory for symbols which we don't end up putting into the minimal symbols. */ char *p; - p = obstack_alloc (&objfile->psymbol_obstack, E_SYMNMLEN + 1); + p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1); strncpy (p, symbol->n_name, E_SYMNMLEN); p[E_SYMNMLEN] = '\0'; *name = p; @@ -2890,7 +2890,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline) if (length) { debugsec = - (char *) obstack_alloc (&objfile->symbol_obstack, length); + (char *) obstack_alloc (&objfile->objfile_obstack, length); if (!bfd_get_section_contents (abfd, secp, debugsec, (file_ptr) 0, length)) @@ -2913,7 +2913,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline) name, bfd_errmsg (bfd_get_error ())); size = coff_data (abfd)->local_symesz * num_symbols; ((struct coff_symfile_info *) objfile->sym_private)->symtbl = - obstack_alloc (&objfile->symbol_obstack, size); + obstack_alloc (&objfile->objfile_obstack, size); ((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms = num_symbols; @@ -2959,7 +2959,7 @@ xcoff_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) - obstack_alloc (&objfile->psymbol_obstack, + obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); /* Initialize the section indexes for future use. */ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index da875d3..6a64ede 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1063,8 +1063,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) */ /* Stack grows up. */ set_gdbarch_inner_than (gdbarch, core_addr_greaterthan); - /* This value is almost never non-zero... */ - set_gdbarch_frame_args_skip (gdbarch, 0); /* * Call Dummies @@ -1076,7 +1074,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, xstormy16_use_struct_convention); set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 4a4501e..ea008d6 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,15 @@ +2004-01-28 Roland McGrath <roland@redhat.com> + + * common.h (AT_SECURE): New macro. + +2004-01-21 Roland McGrath <roland@redhat.com> + + * common.h (AT_SUN_UID, AT_SUN_RUID, AT_SUN_GID): New macros. + (AT_SUN_RGID, AT_SUN_LDELF, AT_SUN_LDSHDR, AT_SUN_LDNAME, + AT_SUN_LPAGESZ, AT_SUN_PLATFORM, AT_SUN_HWCAP, AT_SUN_IFLUSH, + AT_SUN_CPU, AT_SUN_EMUL_ENTRY, AT_SUN_EMUL_EXECFD, + AT_SUN_EXECNAME) AT_SUN_MMU, AT_SUN_LDDATA): Likewise. + 2004-01-17 Mark Kettenis <kettenis@gnu.org> * common.h (NT_OPENBSD_IDENT): Define. diff --git a/include/elf/common.h b/include/elf/common.h index 15aa5d9..bf233f6 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -721,9 +721,30 @@ #define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ #define AT_UCACHEBSIZE 21 /* Unified cache block size. */ #define AT_IGNOREPPC 22 /* Entry should be ignored */ +#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ /* Pointer to the global system page used for system calls and other nice things. */ #define AT_SYSINFO 32 -#define AT_SYSINFO_EHDR 33 +#define AT_SYSINFO_EHDR 33 /* Pointer to ELF header of system-supplied DSO. */ + +#define AT_SUN_UID 2000 /* Effective user ID. */ +#define AT_SUN_RUID 2001 /* Real user ID. */ +#define AT_SUN_GID 2002 /* Effective group ID. */ +#define AT_SUN_RGID 2003 /* Real group ID. */ +#define AT_SUN_LDELF 2004 /* Dynamic linker's ELF header. */ +#define AT_SUN_LDSHDR 2005 /* Dynamic linker's section headers. */ +#define AT_SUN_LDNAME 2006 /* String giving name of dynamic linker. */ +#define AT_SUN_LPAGESZ 2007 /* Large pagesize. */ +#define AT_SUN_PLATFORM 2008 /* Platform name string. */ +#define AT_SUN_HWCAP 2009 /* Machine dependent hints about + processor capabilities. */ +#define AT_SUN_IFLUSH 2010 /* Should flush icache? */ +#define AT_SUN_CPU 2011 /* CPU name string. */ +#define AT_SUN_EMUL_ENTRY 2012 /* COFF entry point address. */ +#define AT_SUN_EMUL_EXECFD 2013 /* COFF executable file descriptor. */ +#define AT_SUN_EXECNAME 2014 /* Canonicalized file name given to execve. */ +#define AT_SUN_MMU 2015 /* String for name of MMU module. */ +#define AT_SUN_LDDATA 2016 /* Dynamic linker's data segment address. */ + #endif /* _ELF_COMMON_H */ diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 8f0d6d7..438c6d8 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,7 @@ +2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com> + + * h8300.h (32bit ldc/stc): Add relaxing support. + 2004-01-12 Anil Paranjpe <anilp1@KPITCummins.com> * h8300.h (BITOP): Pass MEMRELAX flag. diff --git a/include/opcode/h8300.h b/include/opcode/h8300.h index 76d42e5..29374df 100644 --- a/include/opcode/h8300.h +++ b/include/opcode/h8300.h @@ -1434,8 +1434,9 @@ struct h8_opcode h8_opcodes[] = {O (O_LDC, SW), AV_H8S, 2, "ldc", {{DISP32SRC, EXR | DST, E}}, {{PREFIXLDC, 0x7, 0x8, B30 | DISPREG, 0x0, 0x6, 0xB, 0x2, IGNORE, SRC | DISP32LIST, E}}}, {O (O_LDC, SW), AV_H8H, 2, "ldc", {{ABS16SRC, CCR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x0, IGNORE, SRC | ABS16LIST, E}}}, {O (O_LDC, SW), AV_H8S, 2, "ldc", {{ABS16SRC, EXR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x0, IGNORE, SRC | ABS16LIST, E}}}, - {O (O_LDC, SW), AV_H8H, 2, "ldc", {{ABS32SRC, CCR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | ABS32LIST, E}}}, - {O (O_LDC, SW), AV_H8S, 2, "ldc", {{ABS32SRC, EXR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | ABS32LIST, E}}}, + {O (O_LDC, SW), AV_H8H, 2, "ldc", {{ABS32SRC, CCR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | MEMRELAX | ABS32LIST, E}}}, + {O (O_LDC, SW), AV_H8S, 2, "ldc", {{ABS32SRC, EXR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | MEMRELAX | ABS32LIST, E}}}, + {O (O_LDC, SL), AV_H8SX, 0, "ldc", {{RS32, B30 | VBR_SBR | DST, E}}, {{0x0, 0x3, B30 | VBR_SBR | DST, RS32, E}}}, @@ -1809,8 +1810,8 @@ struct h8_opcode h8_opcodes[] = {O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, DISP32DST, E}}, {{PREFIXSTC, 0x7, 0x8, B30 | DSTDISPREG, 0, 0x6, 0xB, 0xA, IGNORE, DSTDISP32LIST, E}}}, {O (O_STC, SW), AV_H8H, 2, "stc", {{CCR | SRC, ABS16DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0x8, IGNORE, DST | ABS16LIST, E}}}, {O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, ABS16DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0x8, IGNORE, DST | ABS16LIST, E}}}, - {O (O_STC, SW), AV_H8H, 2, "stc", {{CCR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | ABS32LIST, E}}}, - {O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | ABS32LIST, E}}}, + {O (O_STC, SW), AV_H8H, 2, "stc", {{CCR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | MEMRELAX | ABS32LIST, E}}}, + {O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | MEMRELAX | ABS32LIST, E}}}, {O (O_STC, SL), AV_H8SX, 0, "stc", {{B30 | VBR_SBR | SRC, RD32, E}}, {{0x0, 0x2, B30 | VBR_SBR | SRC, RD32, E}}}, diff --git a/ld/ChangeLog b/ld/ChangeLog index 9d4edc9..373d7ac0e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,36 @@ +2004-02-09 Daniel Jacobowitz <drow@mvista.com> + + * emulparams/armelf.sh, emulparams/armelf_linux.sh: Move + .note.gnu.arm.ident to after allocated sections. Mark its + address as 0. + +2004-02-09 Daniel Jacobowitz <drow@mvista.com> + + * emulparams/armelf_linux.sh (COMMONPAGESIZE): Set to 4KB. + * emulparams/elf32bmip.sh (COMMONPAGESIZE): Likewise. + * emulparams/elf32bmipn32.sh (COMMONPAGESIZE): Likewise. + * emulparams/elf32btsmipn32.sh (COMMONPAGESIZE): Likewise. + * emulparams/shlelf_linux.sh (COMMONPAGESIZE): Likewise. + +2004-02-05 Nick Clifton <nickc@redhat.com> + + * emultempl/pe.em (_after_open): Fix typo in previous delta. + +2004-02-04 Danny Smith <dannysmith@users.sourceforge.net> + + * emultempl/pe.em (_after_open): Fix thinko in 2003-12-18 patch. + +2004-01-28 Alan Modra <amodra@bigpond.net.au> + + * genscripts.sh: Fix typo. + + * genscripts.sh: Apply $LIBPATH_SUFFIX to $tool_lib and $libdir too. + +2004-01-24 Jakub Jelinek <jakub@redhat.com> + + * emulparams/elf64_ia64.sh: Put .rela.opd into + OTHER_GOT_RELOC_SECTIONS instead of OTHER_PLT_RELOC_SECTIONS. + 2004-01-20 Danny Smith <dannysmith@users.sourceforge.net> * pe-dll.c (pe_create_import_fixup): Clear WP_TEXT flag. @@ -14,13 +47,13 @@ * ldlang.c (lang_get_regions): Add extra parameter 'have_vma' which if true will prevent the LMA region being used as a replacement for a default VMA region. - (lang_leave_output_section_statement): Pass extra parameter. - (lang_leave_overlay): Likewise. - * ld.texinfo (Output Section LMA): Document that the LMA + (lang_leave_output_section_statement): Pass extra parameter. + (lang_leave_overlay): Likewise. + * ld.texinfo (Output Section LMA): Document that the LMA region can be set to the VMA region if no VMA has been set. * ldlang.h (struct lang_output_section_phdr_list): Create a typedef for this type. Minor formatting fixes. - + 2004-01-13 Nick Clifton <nickc@redhat.com> * ldlang.c (lang_size_sections_1): If dot is advanced, then diff --git a/ld/emulparams/armelf.sh b/ld/emulparams/armelf.sh index 71e3059..35a6d23 100644 --- a/ld/emulparams/armelf.sh +++ b/ld/emulparams/armelf.sh @@ -7,9 +7,9 @@ TEXT_START_ADDR=0x8000 TEMPLATE_NAME=elf32 EXTRA_EM_FILE=armelf OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)' -OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }' OTHER_BSS_SYMBOLS='__bss_start__ = .;' OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;' +OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }' DATA_START_SYMBOLS='__data_start = . ;'; diff --git a/ld/emulparams/armelf_linux.sh b/ld/emulparams/armelf_linux.sh index 248b708..88a2d19 100644 --- a/ld/emulparams/armelf_linux.sh +++ b/ld/emulparams/armelf_linux.sh @@ -4,15 +4,16 @@ OUTPUT_FORMAT="elf32-littlearm" BIG_OUTPUT_FORMAT="elf32-bigarm" LITTLE_OUTPUT_FORMAT="elf32-littlearm" MAXPAGESIZE=0x8000 +COMMONPAGESIZE=0x1000 TEMPLATE_NAME=elf32 EXTRA_EM_FILE=armelf GENERATE_SHLIB_SCRIPT=yes DATA_START_SYMBOLS='__data_start = . ;'; OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)' -OTHER_READONLY_SECTIONS='.note.gnu.arm.ident : { KEEP (*(.note.gnu.arm.ident)) }' OTHER_BSS_SYMBOLS='__bss_start__ = .;' OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;' +OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }' TEXT_START_ADDR=0x00008000 diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh index fa7d671..94e1c9c 100644 --- a/ld/emulparams/elf32bmip.sh +++ b/ld/emulparams/elf32bmip.sh @@ -8,6 +8,7 @@ LITTLE_OUTPUT_FORMAT="elf32-littlemips" TEXT_START_ADDR=0x0400000 test -n "${EMBEDDED}" || DATA_ADDR=0x10000000 MAXPAGESIZE=0x40000 +COMMONPAGESIZE=0x1000 NONPAGED_TEXT_START_ADDR=0x0400000 SHLIB_TEXT_START_ADDR=0x5ffe0000 test -n "${EMBEDDED}" || TEXT_DYNAMIC= diff --git a/ld/emulparams/elf32bmipn32.sh b/ld/emulparams/elf32bmipn32.sh index 7533837..3de791c 100755 --- a/ld/emulparams/elf32bmipn32.sh +++ b/ld/emulparams/elf32bmipn32.sh @@ -3,6 +3,7 @@ OUTPUT_FORMAT="elf32-nbigmips" BIG_OUTPUT_FORMAT="elf32-nbigmips" LITTLE_OUTPUT_FORMAT="elf32-nlittlemips" SHLIB_TEXT_START_ADDR=0x5ffe0000 +COMMONPAGESIZE=0x1000 # IRIX6 defines these symbols. 0x34 is the size of the ELF header. EXECUTABLE_SYMBOLS=" diff --git a/ld/emulparams/elf32btsmipn32.sh b/ld/emulparams/elf32btsmipn32.sh index 6cfa48a..5ca6797 100644 --- a/ld/emulparams/elf32btsmipn32.sh +++ b/ld/emulparams/elf32btsmipn32.sh @@ -5,6 +5,7 @@ OUTPUT_FORMAT="elf32-ntradbigmips" BIG_OUTPUT_FORMAT="elf32-ntradbigmips" LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips" +COMMONPAGESIZE=0x1000 # Magic sections. OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' diff --git a/ld/emulparams/elf64_ia64.sh b/ld/emulparams/elf64_ia64.sh index 100aca1..60c8c4c 100644 --- a/ld/emulparams/elf64_ia64.sh +++ b/ld/emulparams/elf64_ia64.sh @@ -28,7 +28,7 @@ test -z "$CREATE_PIE" && OTHER_READONLY_SECTIONS=" .opd ${RELOCATING-0} : { *(.opd) }" test -n "$CREATE_PIE" && OTHER_READWRITE_SECTIONS=" .opd ${RELOCATING-0} : { *(.opd) }" -test -n "$CREATE_PIE" && OTHER_PLT_RELOC_SECTIONS="${OTHER_PLT_RELOC_SECTIONS} +test -n "$CREATE_PIE" && OTHER_GOT_RELOC_SECTIONS=" .rela.opd ${RELOCATING-0} : { *(.rela.opd) }" OTHER_READONLY_SECTIONS="${OTHER_READONLY_SECTIONS} .IA_64.unwind_info ${RELOCATING-0} : { *(.IA_64.unwind_info${RELOCATING+* .gnu.linkonce.ia64unwi.*}) } diff --git a/ld/emulparams/shlelf_linux.sh b/ld/emulparams/shlelf_linux.sh index 7d90ab3..528b725 100644 --- a/ld/emulparams/shlelf_linux.sh +++ b/ld/emulparams/shlelf_linux.sh @@ -5,6 +5,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sh-linux" TEXT_START_ADDR=0x400000 MAXPAGESIZE=0x10000 +COMMONPAGESIZE=0x1000 ARCH=sh MACHINE= TEMPLATE_NAME=elf32 diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 4f12d7f..7d6c2e8 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1139,8 +1139,8 @@ gld_${EMULATION_NAME}_after_open (void) extension, and use that for the remainder of the comparisons. */ pnt = strrchr (is3->the_bfd->filename, '.'); - if (pnt != NULL && strcmp (pnt, ".dll") != 0) - continue; + if (pnt != NULL && strcmp (pnt, ".dll") == 0) + break; } if (is3 == NULL) diff --git a/ld/genscripts.sh b/ld/genscripts.sh index 4c7226a..0168203 100755 --- a/ld/genscripts.sh +++ b/ld/genscripts.sh @@ -128,10 +128,20 @@ fi if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then LIB_PATH2= - if [ x"$use_sysroot" != xyes ] ; then - LIB_PATH2=${libdir} + + libs=${NATIVE_LIB_DIRS} + if [ "x${use_sysroot}" != "xyes" ] ; then + case " ${libs} " in + *" ${libdir} "*) ;; + *) libs="${libdir} ${libs}" ;; + esac + case " ${libs} " in + *" ${tool_lib} "*) ;; + *) libs="${tool_lib} ${libs}" ;; + esac fi - for lib in ${NATIVE_LIB_DIRS}; do + + for lib in ${libs}; do # The "=" is harmless if we aren't using a sysroot, but also needless. if [ "x${use_sysroot}" = "xyes" ] ; then lib="=${lib}" @@ -161,13 +171,13 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then esac fi done + case :${LIB_PATH}:${LIB_PATH2}: in *:: | ::*) LIB_PATH=${LIB_PATH}${LIB_PATH2} ;; *) LIB_PATH=${LIB_PATH}:${LIB_PATH2} ;; esac fi - # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for # sysrooted configurations and when LIBPATH=":". if [ "x${use_sysroot}" != "xyes" ] ; then diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 80c5d1e..f67c5ec 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2004-02-09 Anil Paranjpe <anilp1@KPITCummins.com> + + * ld-h8300/relax-5.s: New file: Source for relax-5 test. + * ld-h8300/relax-5.d: New file: Expected output and commands for + assembling and linking the relax-5 test. + * ld-h8300/relax-5-coff.d: New file: Variant for the COFF based + toolchain. + * ld-h8300/h8300-exp: Run the relax-5 test. + +2004-01-23 Daniel Jacobowitz <drow@mvista.com> + + * ld-arm/arm-app-abs32.s, ld-arm/arm-app-abs32.r, + ld-arm/arm-app-abs32.d: New files. + * ld-arm/arm-elf.exp: Add arm-app-abs32 testcase. + 2004-01-19 Alan Modra <amodra@bigpond.net.au> * ld-i386/tlsbin.dd: Adjust for changed sib printing. diff --git a/ld/testsuite/ld-arm/arm-app-abs32.d b/ld/testsuite/ld-arm/arm-app-abs32.d new file mode 100644 index 0000000..4ebff1e --- /dev/null +++ b/ld/testsuite/ld-arm/arm-app-abs32.d @@ -0,0 +1,29 @@ + +tmpdir/arm-app-abs32: file format elf32-littlearm +architecture: arm, flags 0x00000112: +EXEC_P, HAS_SYMS, D_PAGED +start address .* + +Disassembly of section .plt: + +.* <.plt>: + .*: e52de004 str lr, \[sp, #-4\]! + .*: e59fe004 ldr lr, \[pc, #4\] ; .* <.plt\+0x10> + .*: e08fe00e add lr, pc, lr + .*: e5bef008 ldr pc, \[lr, #8\]! + .*: .* .* + .*: e28fc6.* add ip, pc, #.* ; .* + .*: e28cca.* add ip, ip, #.* ; .* + .*: e5bcf.* ldr pc, \[ip, #.*\]! +Disassembly of section .text: + +.* <_start>: + .*: e1a0c00d mov ip, sp + .*: e92dd800 stmdb sp!, {fp, ip, lr, pc} + .*: e59f0004 ldr r0, \[pc, #4\] ; .* <.text\+0x14> + .*: e89d6800 ldmia sp, {fp, sp, lr} + .*: e12fff1e bx lr + .*: .* .* + +.* <app_func2>: + .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/arm-app-abs32.r b/ld/testsuite/ld-arm/arm-app-abs32.r new file mode 100644 index 0000000..b9e9966 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-app-abs32.r @@ -0,0 +1,8 @@ + +tmpdir/arm-app-abs32: file format elf32-littlearm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_ARM_JUMP_SLOT lib_func1 + + diff --git a/ld/testsuite/ld-arm/arm-app-abs32.s b/ld/testsuite/ld-arm/arm-app-abs32.s new file mode 100644 index 0000000..a1cf526 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-app-abs32.s @@ -0,0 +1,16 @@ + .text + .globl _start +_start: + mov ip, sp + stmdb sp!, {r11, ip, lr, pc} + ldr a1, .Lval + ldmia sp, {r11, sp, lr} + bx lr + +.Lval: + .long lib_func1 + + .globl app_func2 +app_func2: + bx lr + diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 581ebb6..2f32a11 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -44,6 +44,9 @@ set armelftests { {"Simple static application" "" "" {arm-static-app.s} {{objdump -fdw arm-static-app.d} {objdump -rw arm-static-app.r}} "arm-static-app"} + {"Non-pcrel function reference" "tmpdir/arm-lib.so" "" {arm-app-abs32.s} + {{objdump -fdw arm-app-abs32.d} {objdump -Rw arm-app-abs32.r}} + "arm-app-abs32"} } run_ld_link_tests $armelftests diff --git a/ld/testsuite/ld-h8300/h8300.exp b/ld/testsuite/ld-h8300/h8300.exp index a8e8dda..a063f4e 100644 --- a/ld/testsuite/ld-h8300/h8300.exp +++ b/ld/testsuite/ld-h8300/h8300.exp @@ -30,7 +30,9 @@ if {[istarget *-elf]} { run_dump_test relax-2 run_dump_test relax-3 run_dump_test relax-4 + run_dump_test relax-5 } else { run_dump_test relax-3-coff run_dump_test relax-4-coff + run_dump_test relax-5-coff } diff --git a/ld/testsuite/ld-h8300/relax-5-coff.d b/ld/testsuite/ld-h8300/relax-5-coff.d new file mode 100644 index 0000000..dae5d23 --- /dev/null +++ b/ld/testsuite/ld-h8300/relax-5-coff.d @@ -0,0 +1,50 @@ +# name: H8300 Relaxation Test 5 +# source: relax-5.s +# ld: --relax -m h8300s +# objdump: -d --no-show-raw-insn + +.*: file format .*-h8300 + +Disassembly of section .text: + +00000100 <_start>: + 100: 01 40 6b 00 00 00 ldc @0x0:16,ccr + 106: 01 40 6b 00 7f ff ldc @0x7fff:16,ccr + 10c: 01 40 6b 20 00 00 80 00 ldc @0x8000:32,ccr + 114: 01 40 6b 20 00 00 ff 00 ldc @0xff00:32,ccr + 11c: 01 40 6b 20 00 ff ff 00 ldc @0xffff00:32,ccr + 124: 01 40 6b 20 ff ff 7f ff ldc @0xffff7fff:32,ccr + 12c: 01 40 6b 00 80 00 ldc @0x8000:16,ccr + 132: 01 40 6b 00 fe ff ldc @0xfeff:16,ccr + 138: 01 40 6b 00 ff 00 ldc @0xff00:16,ccr + 13e: 01 40 6b 00 ff ff ldc @0xffff:16,ccr + 144: 01 40 6b 80 00 00 stc ccr,@0x0:16 + 14a: 01 40 6b 80 7f ff stc ccr,@0x7fff:16 + 150: 01 40 6b a0 00 00 80 00 stc ccr,@0x8000:32 + 158: 01 40 6b a0 00 00 ff 00 stc ccr,@0xff00:32 + 160: 01 40 6b a0 00 ff ff 00 stc ccr,@0xffff00:32 + 168: 01 40 6b a0 ff ff 7f ff stc ccr,@0xffff7fff:32 + 170: 01 40 6b 80 80 00 stc ccr,@0x8000:16 + 176: 01 40 6b 80 fe ff stc ccr,@0xfeff:16 + 17c: 01 40 6b 80 ff 00 stc ccr,@0xff00:16 + 182: 01 40 6b 80 ff ff stc ccr,@0xffff:16 + 188: 01 41 6b 00 00 00 ldc @0x0:16,exr + 18e: 01 41 6b 00 7f ff ldc @0x7fff:16,exr + 194: 01 41 6b 20 00 00 80 00 ldc @0x8000:32,exr + 19c: 01 41 6b 20 00 00 ff 00 ldc @0xff00:32,exr + 1a4: 01 41 6b 20 00 ff ff 00 ldc @0xffff00:32,exr + 1ac: 01 41 6b 20 ff ff 7f ff ldc @0xffff7fff:32,exr + 1b4: 01 41 6b 00 80 00 ldc @0x8000:16,exr + 1ba: 01 41 6b 00 fe ff ldc @0xfeff:16,exr + 1c0: 01 41 6b 00 ff 00 ldc @0xff00:16,exr + 1c6: 01 41 6b 00 ff ff ldc @0xffff:16,exr + 1cc: 01 41 6b 80 00 00 stc exr,@0x0:16 + 1d2: 01 41 6b 80 7f ff stc exr,@0x7fff:16 + 1d8: 01 41 6b a0 00 00 80 00 stc exr,@0x8000:32 + 1e0: 01 41 6b a0 00 00 ff 00 stc exr,@0xff00:32 + 1e8: 01 41 6b a0 00 ff ff 00 stc exr,@0xffff00:32 + 1f0: 01 41 6b a0 ff ff 7f ff stc exr,@0xffff7fff:32 + 1f8: 01 41 6b 80 80 00 stc exr,@0x8000:16 + 1fe: 01 41 6b 80 fe ff stc exr,@0xfeff:16 + 204: 01 41 6b 80 ff 00 stc exr,@0xff00:16 + 20a: 01 41 6b 80 ff ff stc exr,@0xffff:16 diff --git a/ld/testsuite/ld-h8300/relax-5.d b/ld/testsuite/ld-h8300/relax-5.d new file mode 100644 index 0000000..d33eb0f --- /dev/null +++ b/ld/testsuite/ld-h8300/relax-5.d @@ -0,0 +1,50 @@ +# name: H8300 Relaxation Test 5 +# source: relax-5.s +# ld: --relax -m h8300self +# objdump: -d --no-show-raw-insn + +.*: file format .*-h8300 + +Disassembly of section .text: + +00000100 <_start>: + 100: 01 40 6b 00 00 00 ldc @0x0:16,ccr + 106: 01 40 6b 00 7f ff ldc @0x7fff:16,ccr + 10c: 01 40 6b 20 00 00 80 00 ldc @0x8000:32,ccr + 114: 01 40 6b 20 00 00 ff 00 ldc @0xff00:32,ccr + 11c: 01 40 6b 20 00 ff ff 00 ldc @0xffff00:32,ccr + 124: 01 40 6b 20 ff ff 7f ff ldc @0xffff7fff:32,ccr + 12c: 01 40 6b 00 80 00 ldc @0x8000:16,ccr + 132: 01 40 6b 00 fe ff ldc @0xfeff:16,ccr + 138: 01 40 6b 00 ff 00 ldc @0xff00:16,ccr + 13e: 01 40 6b 00 ff ff ldc @0xffff:16,ccr + 144: 01 40 6b 80 00 00 stc ccr,@0x0:16 + 14a: 01 40 6b 80 7f ff stc ccr,@0x7fff:16 + 150: 01 40 6b a0 00 00 80 00 stc ccr,@0x8000:32 + 158: 01 40 6b a0 00 00 ff 00 stc ccr,@0xff00:32 + 160: 01 40 6b a0 00 ff ff 00 stc ccr,@0xffff00:32 + 168: 01 40 6b a0 ff ff 7f ff stc ccr,@0xffff7fff:32 + 170: 01 40 6b 80 80 00 stc ccr,@0x8000:16 + 176: 01 40 6b 80 fe ff stc ccr,@0xfeff:16 + 17c: 01 40 6b 80 ff 00 stc ccr,@0xff00:16 + 182: 01 40 6b 80 ff ff stc ccr,@0xffff:16 + 188: 01 41 6b 00 00 00 ldc @0x0:16,exr + 18e: 01 41 6b 00 7f ff ldc @0x7fff:16,exr + 194: 01 41 6b 20 00 00 80 00 ldc @0x8000:32,exr + 19c: 01 41 6b 20 00 00 ff 00 ldc @0xff00:32,exr + 1a4: 01 41 6b 20 00 ff ff 00 ldc @0xffff00:32,exr + 1ac: 01 41 6b 20 ff ff 7f ff ldc @0xffff7fff:32,exr + 1b4: 01 41 6b 00 80 00 ldc @0x8000:16,exr + 1ba: 01 41 6b 00 fe ff ldc @0xfeff:16,exr + 1c0: 01 41 6b 00 ff 00 ldc @0xff00:16,exr + 1c6: 01 41 6b 00 ff ff ldc @0xffff:16,exr + 1cc: 01 41 6b 80 00 00 stc exr,@0x0:16 + 1d2: 01 41 6b 80 7f ff stc exr,@0x7fff:16 + 1d8: 01 41 6b a0 00 00 80 00 stc exr,@0x8000:32 + 1e0: 01 41 6b a0 00 00 ff 00 stc exr,@0xff00:32 + 1e8: 01 41 6b a0 00 ff ff 00 stc exr,@0xffff00:32 + 1f0: 01 41 6b a0 ff ff 7f ff stc exr,@0xffff7fff:32 + 1f8: 01 41 6b 80 80 00 stc exr,@0x8000:16 + 1fe: 01 41 6b 80 fe ff stc exr,@0xfeff:16 + 204: 01 41 6b 80 ff 00 stc exr,@0xff00:16 + 20a: 01 41 6b 80 ff ff stc exr,@0xffff:16 diff --git a/ld/testsuite/ld-h8300/relax-5.s b/ld/testsuite/ld-h8300/relax-5.s new file mode 100644 index 0000000..b5afedb --- /dev/null +++ b/ld/testsuite/ld-h8300/relax-5.s @@ -0,0 +1,66 @@ +; Relaxation is possible from @aa:32 to @aa:16 for following instructions +; ldc.w @@aa:32,ccr +; stc.w ccr,@@aa:32 +; ldc.w @aa:32,exr +; stc.w exr,@aa:32 + .h8300s + .globl _start +; +; Relaxation of aa:32 +; + _start: + ldc @s1:32,ccr + ldc @s2:32,ccr + ldc @s3:32,ccr + ldc @s4:32,ccr + ldc @s5:32,ccr + ldc @s6:32,ccr + ldc @s7:32,ccr + ldc @s8:32,ccr + ldc @s9:32,ccr + ldc @s10:32,ccr + + stc ccr,@s1:32 + stc ccr,@s2:32 + stc ccr,@s3:32 + stc ccr,@s4:32 + stc ccr,@s5:32 + stc ccr,@s6:32 + stc ccr,@s7:32 + stc ccr,@s8:32 + stc ccr,@s9:32 + stc ccr,@s10:32 + + ldc @s1:32,exr + ldc @s2:32,exr + ldc @s3:32,exr + ldc @s4:32,exr + ldc @s5:32,exr + ldc @s6:32,exr + ldc @s7:32,exr + ldc @s8:32,exr + ldc @s9:32,exr + ldc @s10:32,exr + + stc exr,@s1:32 + stc exr,@s2:32 + stc exr,@s3:32 + stc exr,@s4:32 + stc exr,@s5:32 + stc exr,@s6:32 + stc exr,@s7:32 + stc exr,@s8:32 + stc exr,@s9:32 + stc exr,@s10:32 + + .equ s1,0 + .equ s2,0x7fff + .equ s3,0x8000 + .equ s4,0xff00 + .equ s5,0xffff00 + .equ s6,0xffff7fff + .equ s7,0xffff8000 + .equ s8,0xfffffeff + .equ s9,0xffffff00 + .equ s10,0xffffffff + .end diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 30295c2..10c7f46 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,17 @@ +2004-01-25 Ian Lance Taylor <ian@wasabisystems.com> + + * configure.ac: Add m4_pattern_allow(LIBOBJS). + * configure: Regenerate. + +2004-01-22 DJ Delorie <dj@redhat.com> + + * Makefile.in: Convert to ./ throughout. Rebuild dependencies + with explicit build rules. + (VPATH): Remove. + (.c.o): Poison. + * configure.ac (pexecute, LIBOBJS): Add ./ . + * maint-tool: Build dependencies with explicit rules. + 2004-01-15 Kazu Hirata <kazu@cs.umass.edu> * strdup.c (strdup): Constify the argument. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index fc86feb..bbb5c2a 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -28,7 +28,6 @@ libiberty_topdir = @libiberty_topdir@ srcdir = @srcdir@ -VPATH = @srcdir@ prefix = @prefix@ @@ -70,8 +69,8 @@ PICFLAG = MAKEOVERRIDES = -TARGETLIB = libiberty.a -TESTLIB = testlib.a +TARGETLIB = ./libiberty.a +TESTLIB = ./testlib.a LIBOBJS = @LIBOBJS@ @@ -118,19 +117,19 @@ installcheck: installcheck-subdir INCDIR=$(srcdir)/$(MULTISRCTOP)../include COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ + +# Just to make sure we don't use a built-in rule with VPATH .c.o: - if [ x"$(PICFLAG)" != x ]; then \ - $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \ - else true; fi - $(COMPILE.c) $< $(OUTPUT_OPTION) + false # NOTE: If you add new files to the library, add them to this list # (alphabetical), and add them to REQUIRED_OFILES, or -# CONFIGURED_OFILES and funcs in configure.ac. +# CONFIGURED_OFILES and funcs in configure.ac. Also run "make maint-deps" +# to build the new rules. CFILES = alloca.c argv.c asprintf.c atexit.c \ basename.c bcmp.c bcopy.c bsearch.c bzero.c \ calloc.c choose-temp.c clock.c concat.c cp-demangle.c \ - cp-demint.c cplus-dem.c \ + cp-demint.c cplus-dem.c \ dyn-string.c \ fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \ getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ @@ -158,45 +157,45 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \ # These are always included in the library. The first four are listed # first and by compile time to optimize parallel builds. -REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o cp-demint.o md5.o \ - alloca.o argv.o \ - choose-temp.o concat.o \ - dyn-string.o \ - fdmatch.o fibheap.o floatformat.o fnmatch.o \ - getopt.o getopt1.o getpwd.o getruntime.o \ - hashtab.o hex.o \ - lbasename.o \ - lrealpath.o \ - make-relative-prefix.o \ - make-temp-file.o \ - objalloc.o obstack.o \ - partition.o physmem.o @pexecute@ \ - safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \ - strsignal.o \ - ternary.o \ - xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o +REQUIRED_OFILES = ./regex.o ./cplus-dem.o ./cp-demangle.o ./cp-demint.o ./md5.o \ + ./alloca.o ./argv.o \ + ./choose-temp.o ./concat.o \ + ./dyn-string.o \ + ./fdmatch.o ./fibheap.o ./floatformat.o ./fnmatch.o \ + ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o \ + ./hashtab.o ./hex.o \ + ./lbasename.o \ + ./lrealpath.o \ + ./make-relative-prefix.o \ + ./make-temp-file.o \ + ./objalloc.o ./obstack.o \ + ./partition.o ./physmem.o @pexecute@ \ + ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o \ + ./strsignal.o \ + ./ternary.o \ + ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o # These are all the objects that configure may add to the library via # $funcs or EXTRA_OFILES. This list exists here only for "make # maint-missing" and "make check". -CONFIGURED_OFILES = asprintf.o atexit.o \ - basename.o bcmp.o bcopy.o bsearch.o bzero.o \ - calloc.o clock.o copysign.o \ - _doprnt.o \ - ffs.o \ - getcwd.o getpagesize.o \ - index.o insque.o \ - memchr.o memcmp.o memcpy.o memmove.o mempcpy.o memset.o mkstemps.o \ - pex-djgpp.o pex-mpw.o pex-msdos.o pex-os2.o \ - pex-unix.o pex-win32.o \ - putenv.o \ - random.o rename.o rindex.o \ - setenv.o sigsetmask.o snprintf.o stpcpy.o stpncpy.o strcasecmp.o \ - strchr.o strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o \ - strtod.o strtol.o strtoul.o \ - tmpnam.o \ - vasprintf.o vfork.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o \ - waitpid.o +CONFIGURED_OFILES = ./asprintf.o ./atexit.o \ + ./basename.o ./bcmp.o ./bcopy.o ./bsearch.o ./bzero.o \ + ./calloc.o ./clock.o ./copysign.o \ + ./_doprnt.o \ + ./ffs.o \ + ./getcwd.o ./getpagesize.o \ + ./index.o ./insque.o \ + ./memchr.o ./memcmp.o ./memcpy.o ./memmove.o ./mempcpy.o ./memset.o ./mkstemps.o \ + ./pex-djgpp.o ./pex-mpw.o ./pex-msdos.o ./pex-os2.o \ + ./pex-unix.o ./pex-win32.o \ + ./putenv.o \ + ./random.o ./rename.o ./rindex.o \ + ./setenv.o ./sigsetmask.o ./snprintf.o ./stpcpy.o ./stpncpy.o ./strcasecmp.o \ + ./strchr.o ./strdup.o ./strncasecmp.o ./strncmp.o ./strrchr.o ./strstr.o \ + ./strtod.o ./strtol.o ./strtoul.o \ + ./tmpnam.o \ + ./vasprintf.o ./vfork.o ./vfprintf.o ./vprintf.o ./vsnprintf.o ./vsprintf.o \ + ./waitpid.o # These files are installed if the library has been configured to do so. INSTALLED_HEADERS = \ @@ -390,8 +389,8 @@ Makefile: $(srcdir)/Makefile.in config.status # Depending on Makefile makes sure that config.status has been re-run # if needed. This prevents problems with parallel builds. config.h: stamp-h ; @true -stamp-h: config.in config.status Makefile - CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status +stamp-h: $(srcdir)/config.in config.status Makefile + CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status config.status: $(srcdir)/configure $(srcdir)/config.table $(SHELL) ./config.status --recheck @@ -415,113 +414,643 @@ $(CONFIGURED_OFILES): stamp-picdir # The dependencies in the remainder of this file are automatically # generated by "make maint-deps". Manual edits will be lost. -_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -atexit.o: config.h -basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ +./_doprnt.o: $(srcdir)/_doprnt.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/safe-ctype.h -bsearch.o: config.h $(INCDIR)/ansidecl.h -calloc.o: $(INCDIR)/ansidecl.h -choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -clock.o: config.h -concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -copysign.o: $(INCDIR)/ansidecl.h -cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(srcdir)/cp-demangle.h \ - $(INCDIR)/demangle.h $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/_doprnt.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION) + +./alloca.o: $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -cp-demint.o: config.h $(INCDIR)/ansidecl.h $(srcdir)/cp-demangle.h \ - $(INCDIR)/demangle.h $(INCDIR)/libiberty.h -cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ - $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h -dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/alloca.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION) + +./argv.o: $(srcdir)/argv.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/argv.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/argv.c $(OUTPUT_OPTION) + +./asprintf.o: $(srcdir)/asprintf.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/asprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/asprintf.c $(OUTPUT_OPTION) + +./atexit.o: $(srcdir)/atexit.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/atexit.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/atexit.c $(OUTPUT_OPTION) + +./basename.o: $(srcdir)/basename.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/basename.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/basename.c $(OUTPUT_OPTION) + +./bcmp.o: $(srcdir)/bcmp.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bcmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bcmp.c $(OUTPUT_OPTION) + +./bcopy.o: $(srcdir)/bcopy.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bcopy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bcopy.c $(OUTPUT_OPTION) + +./bsearch.o: $(srcdir)/bsearch.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bsearch.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bsearch.c $(OUTPUT_OPTION) + +./bzero.o: $(srcdir)/bzero.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bzero.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bzero.c $(OUTPUT_OPTION) + +./calloc.o: $(srcdir)/calloc.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/calloc.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/calloc.c $(OUTPUT_OPTION) + +./choose-temp.o: $(srcdir)/choose-temp.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/choose-temp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/choose-temp.c $(OUTPUT_OPTION) + +./clock.o: $(srcdir)/clock.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/clock.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/clock.c $(OUTPUT_OPTION) + +./concat.o: $(srcdir)/concat.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/concat.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/concat.c $(OUTPUT_OPTION) + +./copysign.o: $(srcdir)/copysign.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/copysign.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/copysign.c $(OUTPUT_OPTION) + +./cp-demangle.o: $(srcdir)/cp-demangle.c config.h $(INCDIR)/ansidecl.h \ + $(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \ + $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demangle.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/cp-demangle.c $(OUTPUT_OPTION) + +./cp-demint.o: $(srcdir)/cp-demint.c config.h $(INCDIR)/ansidecl.h \ + $(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \ $(INCDIR)/libiberty.h -floatformat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demint.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/cp-demint.c $(OUTPUT_OPTION) + +./cplus-dem.o: $(srcdir)/cplus-dem.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/cplus-dem.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/cplus-dem.c $(OUTPUT_OPTION) + +./dyn-string.o: $(srcdir)/dyn-string.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dyn-string.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/dyn-string.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/dyn-string.c $(OUTPUT_OPTION) + +./fdmatch.o: $(srcdir)/fdmatch.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fdmatch.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fdmatch.c $(OUTPUT_OPTION) + +./ffs.o: $(srcdir)/ffs.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/ffs.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/ffs.c $(OUTPUT_OPTION) + +./fibheap.o: $(srcdir)/fibheap.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/fibheap.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fibheap.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION) + +./floatformat.o: $(srcdir)/floatformat.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/floatformat.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/floatformat.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/floatformat.c $(OUTPUT_OPTION) + +./fnmatch.o: $(srcdir)/fnmatch.c config.h $(INCDIR)/fnmatch.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fnmatch.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fnmatch.c $(OUTPUT_OPTION) + +./getcwd.o: $(srcdir)/getcwd.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getcwd.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getcwd.c $(OUTPUT_OPTION) + +./getopt.o: $(srcdir)/getopt.c config.h $(INCDIR)/getopt.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getopt.c $(OUTPUT_OPTION) + +./getopt1.o: $(srcdir)/getopt1.c config.h $(INCDIR)/getopt.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt1.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getopt1.c $(OUTPUT_OPTION) + +./getpagesize.o: $(srcdir)/getpagesize.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getpagesize.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getpagesize.c $(OUTPUT_OPTION) + +./getpwd.o: $(srcdir)/getpwd.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h -getcwd.o: config.h -getopt.o: config.h $(INCDIR)/getopt.h -getopt1.o: config.h $(INCDIR)/getopt.h -getpagesize.o: config.h -getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getpwd.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getpwd.c $(OUTPUT_OPTION) + +./getruntime.o: $(srcdir)/getruntime.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getruntime.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION) + +./hashtab.o: $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/hashtab.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/hashtab.c $(OUTPUT_OPTION) + +./hex.o: $(srcdir)/hex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h -lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/filenames.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/hex.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/hex.c $(OUTPUT_OPTION) + +./index.o: $(srcdir)/index.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/index.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/index.c $(OUTPUT_OPTION) + +./insque.o: $(srcdir)/insque.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/insque.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/insque.c $(OUTPUT_OPTION) + +./lbasename.o: $(srcdir)/lbasename.c $(INCDIR)/ansidecl.h $(INCDIR)/filenames.h \ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h -lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/lbasename.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/lbasename.c $(OUTPUT_OPTION) + +./lrealpath.o: $(srcdir)/lrealpath.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/lrealpath.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/lrealpath.c $(OUTPUT_OPTION) + +./make-relative-prefix.o: $(srcdir)/make-relative-prefix.c config.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/make-relative-prefix.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/make-relative-prefix.c $(OUTPUT_OPTION) + +./make-temp-file.o: $(srcdir)/make-temp-file.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h -memchr.o: $(INCDIR)/ansidecl.h -memcmp.o: $(INCDIR)/ansidecl.h -memcpy.o: $(INCDIR)/ansidecl.h -memmove.o: $(INCDIR)/ansidecl.h -mempcpy.o: $(INCDIR)/ansidecl.h -memset.o: $(INCDIR)/ansidecl.h -mkstemps.o: config.h $(INCDIR)/ansidecl.h -objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h -obstack.o: config.h $(INCDIR)/obstack.h -partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/partition.h -pex-djgpp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-mpw.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-msdos.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h $(INCDIR)/safe-ctype.h -pex-os2.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-unix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-win32.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -physmem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -putenv.o: config.h $(INCDIR)/ansidecl.h -random.o: $(INCDIR)/ansidecl.h -regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h -rename.o: config.h $(INCDIR)/ansidecl.h -safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -setenv.o: config.h $(INCDIR)/ansidecl.h -sigsetmask.o: $(INCDIR)/ansidecl.h -snprintf.o: $(INCDIR)/ansidecl.h -sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/make-temp-file.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/make-temp-file.c $(OUTPUT_OPTION) + +./md5.o: $(srcdir)/md5.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/md5.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/md5.c $(OUTPUT_OPTION) + +./memchr.o: $(srcdir)/memchr.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memchr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memchr.c $(OUTPUT_OPTION) + +./memcmp.o: $(srcdir)/memcmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memcmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memcmp.c $(OUTPUT_OPTION) + +./memcpy.o: $(srcdir)/memcpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memcpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memcpy.c $(OUTPUT_OPTION) + +./memmove.o: $(srcdir)/memmove.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memmove.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memmove.c $(OUTPUT_OPTION) + +./mempcpy.o: $(srcdir)/mempcpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/mempcpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/mempcpy.c $(OUTPUT_OPTION) + +./memset.o: $(srcdir)/memset.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memset.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memset.c $(OUTPUT_OPTION) + +./mkstemps.o: $(srcdir)/mkstemps.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/mkstemps.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/mkstemps.c $(OUTPUT_OPTION) + +./mpw.o: $(srcdir)/mpw.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/mpw.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/mpw.c $(OUTPUT_OPTION) + +./msdos.o: $(srcdir)/msdos.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/msdos.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/msdos.c $(OUTPUT_OPTION) + +./objalloc.o: $(srcdir)/objalloc.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/objalloc.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/objalloc.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/objalloc.c $(OUTPUT_OPTION) + +./obstack.o: $(srcdir)/obstack.c config.h $(INCDIR)/obstack.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/obstack.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/obstack.c $(OUTPUT_OPTION) + +./partition.o: $(srcdir)/partition.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/partition.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/partition.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/partition.c $(OUTPUT_OPTION) + +./pex-djgpp.o: $(srcdir)/pex-djgpp.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-djgpp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION) + +./pex-mpw.o: $(srcdir)/pex-mpw.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-mpw.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-mpw.c $(OUTPUT_OPTION) + +./pex-msdos.o: $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-msdos.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-msdos.c $(OUTPUT_OPTION) + +./pex-os2.o: $(srcdir)/pex-os2.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-os2.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-os2.c $(OUTPUT_OPTION) + +./pex-unix.o: $(srcdir)/pex-unix.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-unix.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-unix.c $(OUTPUT_OPTION) + +./pex-win32.o: $(srcdir)/pex-win32.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-win32.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION) + +./physmem.o: $(srcdir)/physmem.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/physmem.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/physmem.c $(OUTPUT_OPTION) + +./putenv.o: $(srcdir)/putenv.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/putenv.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/putenv.c $(OUTPUT_OPTION) + +./random.o: $(srcdir)/random.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/random.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/random.c $(OUTPUT_OPTION) + +./regex.o: $(srcdir)/regex.c config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/regex.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/regex.c $(OUTPUT_OPTION) + +./rename.o: $(srcdir)/rename.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/rename.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/rename.c $(OUTPUT_OPTION) + +./rindex.o: $(srcdir)/rindex.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/rindex.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/rindex.c $(OUTPUT_OPTION) + +./safe-ctype.o: $(srcdir)/safe-ctype.c $(INCDIR)/ansidecl.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/safe-ctype.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/safe-ctype.c $(OUTPUT_OPTION) + +./setenv.o: $(srcdir)/setenv.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/setenv.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/setenv.c $(OUTPUT_OPTION) + +./sigsetmask.o: $(srcdir)/sigsetmask.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/sigsetmask.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/sigsetmask.c $(OUTPUT_OPTION) + +./snprintf.o: $(srcdir)/snprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/snprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/snprintf.c $(OUTPUT_OPTION) + +./sort.o: $(srcdir)/sort.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/sort.h -spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/splay-tree.h -stpcpy.o: $(INCDIR)/ansidecl.h -stpncpy.o: $(INCDIR)/ansidecl.h -strcasecmp.o: $(INCDIR)/ansidecl.h -strchr.o: $(INCDIR)/ansidecl.h -strdup.o: $(INCDIR)/ansidecl.h -strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -strncasecmp.o: $(INCDIR)/ansidecl.h -strncmp.o: $(INCDIR)/ansidecl.h -strrchr.o: $(INCDIR)/ansidecl.h -strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -strtol.o: config.h $(INCDIR)/safe-ctype.h -strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/ternary.h -vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -vfork.o: $(INCDIR)/ansidecl.h -vfprintf.o: $(INCDIR)/ansidecl.h -vprintf.o: $(INCDIR)/ansidecl.h -vsnprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -vsprintf.o: $(INCDIR)/ansidecl.h -waitpid.o: config.h -xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/sort.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/sort.c $(OUTPUT_OPTION) + +./spaces.o: $(srcdir)/spaces.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/spaces.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/spaces.c $(OUTPUT_OPTION) + +./splay-tree.o: $(srcdir)/splay-tree.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/splay-tree.c $(OUTPUT_OPTION) + +./stpcpy.o: $(srcdir)/stpcpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/stpcpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/stpcpy.c $(OUTPUT_OPTION) + +./stpncpy.o: $(srcdir)/stpncpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/stpncpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/stpncpy.c $(OUTPUT_OPTION) + +./strcasecmp.o: $(srcdir)/strcasecmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strcasecmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strcasecmp.c $(OUTPUT_OPTION) + +./strchr.o: $(srcdir)/strchr.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strchr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strchr.c $(OUTPUT_OPTION) + +./strdup.o: $(srcdir)/strdup.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strdup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strdup.c $(OUTPUT_OPTION) + +./strerror.o: $(srcdir)/strerror.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strerror.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strerror.c $(OUTPUT_OPTION) + +./strncasecmp.o: $(srcdir)/strncasecmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strncasecmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strncasecmp.c $(OUTPUT_OPTION) + +./strncmp.o: $(srcdir)/strncmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strncmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strncmp.c $(OUTPUT_OPTION) + +./strrchr.o: $(srcdir)/strrchr.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strrchr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strrchr.c $(OUTPUT_OPTION) + +./strsignal.o: $(srcdir)/strsignal.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strsignal.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strsignal.c $(OUTPUT_OPTION) + +./strstr.o: $(srcdir)/strstr.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strstr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strstr.c $(OUTPUT_OPTION) + +./strtod.o: $(srcdir)/strtod.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strtod.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strtod.c $(OUTPUT_OPTION) + +./strtol.o: $(srcdir)/strtol.c config.h $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strtol.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strtol.c $(OUTPUT_OPTION) + +./strtoul.o: $(srcdir)/strtoul.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strtoul.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strtoul.c $(OUTPUT_OPTION) + +./ternary.o: $(srcdir)/ternary.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/ternary.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/ternary.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/ternary.c $(OUTPUT_OPTION) + +./tmpnam.o: $(srcdir)/tmpnam.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/tmpnam.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION) + +./vasprintf.o: $(srcdir)/vasprintf.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vasprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vasprintf.c $(OUTPUT_OPTION) + +./vfork.o: $(srcdir)/vfork.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vfork.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vfork.c $(OUTPUT_OPTION) + +./vfprintf.o: $(srcdir)/vfprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vfprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vfprintf.c $(OUTPUT_OPTION) + +./vprintf.o: $(srcdir)/vprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vprintf.c $(OUTPUT_OPTION) + +./vsnprintf.o: $(srcdir)/vsnprintf.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vsnprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vsnprintf.c $(OUTPUT_OPTION) + +./vsprintf.o: $(srcdir)/vsprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vsprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vsprintf.c $(OUTPUT_OPTION) + +./waitpid.o: $(srcdir)/waitpid.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/waitpid.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/waitpid.c $(OUTPUT_OPTION) + +./xatexit.o: $(srcdir)/xatexit.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xatexit.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xatexit.c $(OUTPUT_OPTION) + +./xexit.o: $(srcdir)/xexit.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xexit.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xexit.c $(OUTPUT_OPTION) + +./xmalloc.o: $(srcdir)/xmalloc.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xmalloc.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xmalloc.c $(OUTPUT_OPTION) + +./xmemdup.o: $(srcdir)/xmemdup.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xmemdup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xmemdup.c $(OUTPUT_OPTION) + +./xstrdup.o: $(srcdir)/xstrdup.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrdup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xstrdup.c $(OUTPUT_OPTION) + +./xstrerror.o: $(srcdir)/xstrerror.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrerror.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION) + diff --git a/libiberty/configure b/libiberty/configure index 71f14e8..2f65976 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -5679,11 +5679,11 @@ fi # Figure out which version of pexecute to use. case "${host}" in - *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;; - *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;; - *-*-msdos*) pexecute=pex-msdos.o ;; - *-*-os2-emx*) pexecute=pex-os2.o ;; - *) pexecute=pex-unix.o ;; + *-*-mingw* | *-*-winnt*) pexecute=./pex-win32.o ;; + *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;; + *-*-msdos*) pexecute=./pex-msdos.o ;; + *-*-os2-emx*) pexecute=./pex-os2.o ;; + *) pexecute=./pex-unix.o ;; esac @@ -6134,6 +6134,16 @@ else fi + +L="" +for l in x $LIBOBJS; do + case $l in + x) ;; + *) L="$L ./$l" ;; + esac +done +LIBOBJS="$L" + # We need multilib support, but only if configuring for the target. ac_config_files="$ac_config_files Makefile testsuite/Makefile" ac_config_commands="$ac_config_commands default" diff --git a/libiberty/configure.ac b/libiberty/configure.ac index eb8a99d..e8907e7 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -477,11 +477,11 @@ fi # Figure out which version of pexecute to use. case "${host}" in - *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;; - *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;; - *-*-msdos*) pexecute=pex-msdos.o ;; - *-*-os2-emx*) pexecute=pex-os2.o ;; - *) pexecute=pex-unix.o ;; + *-*-mingw* | *-*-winnt*) pexecute=./pex-win32.o ;; + *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;; + *-*-msdos*) pexecute=./pex-msdos.o ;; + *-*-os2-emx*) pexecute=./pex-os2.o ;; + *) pexecute=./pex-unix.o ;; esac AC_SUBST(pexecute) @@ -496,6 +496,16 @@ else fi AC_SUBST(INSTALL_DEST) +m4_pattern_allow(LIBOBJS) +L="" +for l in x $LIBOBJS; do + case $l in + x) ;; + *) L="$L ./$l" ;; + esac +done +LIBOBJS="$L" + # We need multilib support, but only if configuring for the target. AC_OUTPUT(Makefile testsuite/Makefile, [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h diff --git a/libiberty/getpwd.c b/libiberty/getpwd.c index f508b1e..31c7d20 100644 --- a/libiberty/getpwd.c +++ b/libiberty/getpwd.c @@ -35,6 +35,9 @@ extern int errno; #if HAVE_SYS_STAT_H #include <sys/stat.h> #endif +#if HAVE_LIMITS_H +#include <limits.h> +#endif /* Prototype these in case the system headers don't provide them. */ extern char *getpwd (); diff --git a/libiberty/maint-tool b/libiberty/maint-tool index 6b9bf7f..bfc5304 100644 --- a/libiberty/maint-tool +++ b/libiberty/maint-tool @@ -213,6 +213,12 @@ sub locals_first { sub deps { + $crule = "\tif [ x\"\$(PICFLAG)\" != x ]; then \\\n"; + $crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$< -o pic/\$@; \\\n"; + $crule .= "\telse true; fi\n"; + $crule .= "\t\$(COMPILE.c) \$< \$(OUTPUT_OPTION)\n"; + $crule .= "\n"; + $incdir = shift @ARGV; opendir(INC, $incdir); @@ -260,10 +266,10 @@ sub deps { @deps = sort { &locals_first($a,$b) } keys %scanned; $obj = $f; $obj =~ s/\.c$/.o/; - $obj = "$obj:"; + $obj = "./$obj:"; if ($#deps >= 0) { - print OUT $obj; - $len = length($obj); + print OUT "$obj \$(srcdir)/$f"; + $len = length("$obj $f"); for $dt (@deps) { $d = $mine{$dt}; if ($len + length($d) > 70) { @@ -275,7 +281,12 @@ sub deps { } } print OUT "\n"; + } else { + print OUT "$obj \$(srcdir)/$f\n"; } + $c = $crule; + $c =~ s@\$\<@\$\(srcdir\)\/$f@g; + print OUT $c; } } closedir(S); diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index b1937de..683e786 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,16 @@ +2004-02-13 Ben Elliston <bje@wasabisystems.com> + + * m32r-dis.c: Regenerate. + +2004-01-27 Michael Snyder <msnyder@redhat.com> + + * sh-opc.h (sh_table): "fsrra", not "fssra". + +2004-01-23 Andrew Over <andrew.over@cs.anu.edu.au> + + * sparc-opc.c (fdtox, fstox, fqtox, fxtod, fxtos, fxtoq): Tighten + contraints. + 2004-01-19 Andrew Over <andrew.over@cs.anu.edu.au> * sparc-opc.c (sparc_opcodes) <f[dsq]tox, fxto[dsq]>: Fix args. diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c index 6e5ea70..4622462 100644 --- a/opcodes/m32r-dis.c +++ b/opcodes/m32r-dis.c @@ -105,7 +105,8 @@ my_print_insn (cd, pc, info) /* Read the base part of the insn. */ - status = (*info->read_memory_func) (pc, buf, buflen, info); + status = (*info->read_memory_func) (pc - ((!big_p && (pc & 3) != 0) ? 2 : 0), + buf, buflen, info); if (status != 0) { (*info->memory_error_func) (status, pc, info); @@ -118,13 +119,13 @@ my_print_insn (cd, pc, info) return print_insn (cd, pc, info, buf, buflen); /* Print the first insn. */ - buf += (big_p ? 0 : 2); if ((pc & 3) == 0) { + buf += (big_p ? 0 : 2); if (print_insn (cd, pc, info, buf, 2) == 0) (*info->fprintf_func) (info->stream, UNKNOWN_INSN_MSG); + buf += (big_p ? 2 : -2); } - buf += (big_p ? 2 : -2); x = (big_p ? &buf[0] : &buf[1]); if (*x & 0x80) diff --git a/opcodes/sh-opc.h b/opcodes/sh-opc.h index b9e103c..4b0b0a8 100644 --- a/opcodes/sh-opc.h +++ b/opcodes/sh-opc.h @@ -935,7 +935,7 @@ const sh_opcode_info sh_table[] = /* 1111nnnn01101101 fsqrt <F_REG_N> */{"fsqrt",{F_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh3e_up}, /* 1111nnnn01101101 fsqrt <D_REG_N> */{"fsqrt",{D_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh4_up}, -/* 1111nnnn01111101 fssra <F_REG_N> */{"fssra",{F_REG_N},{HEX_F,REG_N,HEX_7,HEX_D}, arch_sh4a_up}, +/* 1111nnnn01111101 fsrra <F_REG_N> */{"fsrra",{F_REG_N},{HEX_F,REG_N,HEX_7,HEX_D}, arch_sh4a_up}, /* 1111nnnn00001101 fsts FPUL,<F_REG_N>*/{"fsts",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_0,HEX_D}, arch_sh2e_up}, diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb index 830822a..5e90d29 100644 --- a/readline/ChangeLog.gdb +++ b/readline/ChangeLog.gdb @@ -1,3 +1,31 @@ +2004-01-27 Elena Zannoni <ezannoni@redhat.com> + + Merge in official patches to readline-4.3 from + ftp://ftp.cwru.edu/pub/bash/readline-4.3-patches: + NOTE: Patch-ID readline-43-004 was already applied (see below). + + * bind.c (rl_generic_bind): Pressing certain key sequences + causes an infinite loop in _rl_dispatch_subseq with the `key' argument + set to 256. This eventually causes bash to exceed the stack size + limit and crash with a segmentation violation. + Patch-ID: readline43-001. + + * readline.c (_rl_dispatch_subseq): Repeating an edit in + vi-mode with `.' does not work. + Patch-ID: readline43-002. + + * mbutil.c (_rl_get_char_len, _rl_compare_chars, + _rl_adjust_point): When in a locale with multibyte characters, the + readline display updater will occasionally cause a + segmentation fault when attempting to compute the length of the first + multibyte character on the line. + Patch-ID: readline43-003. + + * vi_mode.c (_rl_vi_change_mbchar_case): Using the vi editing + mode's case-changing commands in a locale with multibyte characters + will cause garbage characters to be inserted into the editing buffer. + Patch-ID: readline43-005. + 2003-12-28 Eli Zaretskii <eliz@elta.co.il> * readline.c (rl_save_state, rl_restore_state): Support systems @@ -57,7 +85,14 @@ 2003-01-09 Michael Chastain <mec@shout.net> From Chet Ramey, <chet@po.cwru.edu>, the readline maintainer: + ftp://ftp.cwru.edu/pub/bash/readline-4.3-patches/readline43-004 + * display.c: Fix perverse screen refresh with UTF-8. + When running in a locale with multibyte characters, the + readline display updater will use carriage returns when + drawing the line, overwriting any partial output already on + the screen and not terminated by a newline. + Patch-ID: readline43-004 2003-01-08 Chris Demetriou <cgd@broadcom.com> diff --git a/readline/bind.c b/readline/bind.c index 65ef401..7103888 100644 --- a/readline/bind.c +++ b/readline/bind.c @@ -311,7 +311,7 @@ rl_generic_bind (type, keyseq, data, map) mapped to something, `abc' to be mapped to something else, and the function bound to `a' to be executed when the user types `abx', leaving `bx' in the input queue. */ - if (k.function /* && k.type == ISFUNC */) + if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR)) { map[ANYOTHERKEY] = k; k.function = 0; diff --git a/readline/mbutil.c b/readline/mbutil.c index 50302f0..8794d02 100644 --- a/readline/mbutil.c +++ b/readline/mbutil.c @@ -205,14 +205,16 @@ _rl_get_char_len (src, ps) if (tmp == (size_t)(-2)) { /* shorted to compose multibyte char */ - memset (ps, 0, sizeof(mbstate_t)); + if (ps) + memset (ps, 0, sizeof(mbstate_t)); return -2; } else if (tmp == (size_t)(-1)) { /* invalid to compose multibyte char */ /* initialize the conversion state */ - memset (ps, 0, sizeof(mbstate_t)); + if (ps) + memset (ps, 0, sizeof(mbstate_t)); return -1; } else if (tmp == (size_t)0) @@ -225,9 +227,12 @@ _rl_get_char_len (src, ps) return 1. Otherwise return 0. */ int _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2) - char *buf1, *buf2; - mbstate_t *ps1, *ps2; - int pos1, pos2; + char *buf1; + int pos1; + mbstate_t *ps1; + char *buf2; + int pos2; + mbstate_t *ps2; { int i, w1, w2; @@ -276,8 +281,11 @@ _rl_adjust_point(string, point, ps) pos++; /* clear the state of the byte sequence, because in this case effect of mbstate is undefined */ - memset (ps, 0, sizeof (mbstate_t)); + if (ps) + memset (ps, 0, sizeof (mbstate_t)); } + else if (tmp == 0) + pos++; else pos += tmp; } diff --git a/readline/readline.c b/readline/readline.c index efa0bf8..aed0235 100644 --- a/readline/readline.c +++ b/readline/readline.c @@ -684,6 +684,7 @@ _rl_dispatch_subseq (key, map, got_subseq) } #if defined (VI_MODE) if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && + key != ANYOTHERKEY && _rl_vi_textmod_command (key)) _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); #endif diff --git a/readline/vi_mode.c b/readline/vi_mode.c index 5d146b3f..8930364 100644 --- a/readline/vi_mode.c +++ b/readline/vi_mode.c @@ -680,7 +680,8 @@ _rl_vi_change_mbchar_case (count) int count; { wchar_t wc; - char mb[MB_LEN_MAX]; + char mb[MB_LEN_MAX+1]; + int mblen; mbstate_t ps; memset (&ps, 0, sizeof (mbstate_t)); @@ -703,7 +704,9 @@ _rl_vi_change_mbchar_case (count) /* Vi is kind of strange here. */ if (wc) { - wctomb (mb, wc); + mblen = wctomb (mb, wc); + if (mblen >= 0) + mb[mblen] = '\0'; rl_begin_undo_group (); rl_delete (1, 0); rl_insert_text (mb); diff --git a/sim/ChangeLog b/sim/ChangeLog index 97fecf2..dec01da 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,8 @@ +2004-01-26 Chris Demetriou <cgd@broadcom.com> + + * configure.in (mips*-*-*): Configure in testsuite. + * configure: Regenerate. + 2003-10-08 Dave Brolley <brolley@redhat.com> * configure.in: Move frv handling to alphabetically correct placement. diff --git a/sim/configure b/sim/configure index b342d39..d09adab 100755 --- a/sim/configure +++ b/sim/configure @@ -1426,11 +1426,11 @@ case "${target}" in # OBSOLETE extra_subdirs="${extra_subdirs} igen" # OBSOLETE ;; # OBSOLETE fr30-*-*) sim_target=fr30 ;; - h8300*-*-*) - sim_target=h8300 + frv-*-*) sim_target=frv extra_subdirs="${extra_subdirs} testsuite" ;; - frv-*-*) sim_target=frv + h8300*-*-*) + sim_target=h8300 extra_subdirs="${extra_subdirs} testsuite" ;; h8500-*-*) sim_target=h8500 ;; @@ -1442,7 +1442,7 @@ case "${target}" in # The MIPS simulator can only be compiled by gcc. sim_target=mips only_if_gcc=yes - extra_subdirs="${extra_subdirs} igen" + extra_subdirs="${extra_subdirs} igen testsuite" ;; mn10300*-*-*) # The mn10300 simulator can only be compiled by gcc. diff --git a/sim/configure.in b/sim/configure.in index d992470..c66a413 100644 --- a/sim/configure.in +++ b/sim/configure.in @@ -81,7 +81,7 @@ case "${target}" in # The MIPS simulator can only be compiled by gcc. sim_target=mips only_if_gcc=yes - extra_subdirs="${extra_subdirs} igen" + extra_subdirs="${extra_subdirs} igen testsuite" ;; mn10300*-*-*) # The mn10300 simulator can only be compiled by gcc. diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index 92cbd04..7c2294c 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,10 @@ +2004-02-04 Andrew Cagney <cagney@redhat.com> + + Committed by Andrew Cagney. + * mloopx.in: Update copyright. + (xextract-pbb): Fixed trap for system calls operation in parallel. + * mloop2.in (xextract-pbb): Ditto. + 2003-12-19 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> * configure.in: Changed for dummy simulator of m32r-linux. diff --git a/sim/m32r/mloop2.in b/sim/m32r/mloop2.in index bb9b0b2..69c6ec7 100644 --- a/sim/m32r/mloop2.in +++ b/sim/m32r/mloop2.in @@ -1,5 +1,6 @@ # Simulator main loop for m32r2. -*- C -*- -# Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. +# +# Copyright 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc. # # This file is part of GDB, the GNU debugger. # @@ -289,15 +290,33 @@ cat <<EOF { if ((insn & 0x8000) != 0) /* parallel? */ { - /* Yep. Here's the "interesting" [sic] part. */ - idesc = emit_parallel (current_cpu, pc, insn, sc, 1); - sc += 3; - max_insns -= 3; + int up_count; + + if (((insn >> 16) & 0xfff0) == 0x10f0) + { + /* FIXME: No need to handle this sequentially if system + calls will be able to execute after second insn in + parallel. ( trap #num || insn ) */ + /* insn */ + idesc = emit_16 (current_cpu, pc + 2, insn & 0x7fff, + sc, 1, 0); + /* trap */ + emit_16 (current_cpu, pc, insn >> 16, sc + 1, 1, 0); + up_count = 2; + } + else + { + /* Yep. Here's the "interesting" [sic] part. */ + idesc = emit_parallel (current_cpu, pc, insn, sc, 1); + up_count = 3; + } + sc += up_count; + max_insns -= up_count; icount += 2; pc += 4; if (IDESC_CTI_P (idesc)) { - SET_CTI_VPC (sc - 3); + SET_CTI_VPC (sc - up_count); break; } } @@ -375,18 +394,51 @@ cat <<EOF Only emit before/after handlers if necessary. */ if (trace_p || profile_p) { - idesc = emit_full_parallel (current_cpu, pc, insn, sc, - trace_p, profile_p); + if (((insn >> 16) & 0xfff0) == 0x10f0) + { + /* FIXME: No need to handle this sequentially if + system calls will be able to execute after second + insn in parallel. ( trap #num || insn ) */ + /* insn */ + idesc = emit_full16 (current_cpu, pc + 2, + insn & 0x7fff, sc, 0, 0); + /* trap */ + emit_full16 (current_cpu, pc, insn >> 16, sc + 3, + 0, 0); + } + else + { + idesc = emit_full_parallel (current_cpu, pc, insn, + sc, trace_p, profile_p); + } cti_sc = sc + 1; sc += 6; max_insns -= 6; } else { - idesc = emit_parallel (current_cpu, pc, insn, sc, 0); + int up_count; + + if (((insn >> 16) & 0xfff0) == 0x10f0) + { + /* FIXME: No need to handle this sequentially if + system calls will be able to execute after second + insn in parallel. ( trap #num || insn ) */ + /* insn */ + idesc = emit_16 (current_cpu, pc + 2, insn & 0x7fff, + sc, 0, 0); + /* trap */ + emit_16 (current_cpu, pc, insn >> 16, sc + 1, 0, 0); + up_count = 2; + } + else + { + idesc = emit_parallel (current_cpu, pc, insn, sc, 0); + up_count = 3; + } cti_sc = sc; - sc += 3; - max_insns -= 3; + sc += up_count; + max_insns -= up_count; } icount += 2; pc += 4; diff --git a/sim/m32r/mloopx.in b/sim/m32r/mloopx.in index e1663f7..5ca20a1 100644 --- a/sim/m32r/mloopx.in +++ b/sim/m32r/mloopx.in @@ -1,5 +1,6 @@ # Simulator main loop for m32rx. -*- C -*- -# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +# +# Copyright 1996, 1997, 1998, 2004 Free Software Foundation, Inc. # # This file is part of the GNU Simulators. # @@ -289,15 +290,33 @@ cat <<EOF { if ((insn & 0x8000) != 0) /* parallel? */ { - /* Yep. Here's the "interesting" [sic] part. */ - idesc = emit_parallel (current_cpu, pc, insn, sc, 1); - sc += 3; - max_insns -= 3; + int up_count; + + if (((insn >> 16) & 0xfff0) == 0x10f0) + { + /* FIXME: No need to handle this sequentially if system + calls will be able to execute after second insn in + parallel. ( trap #num || insn ) */ + /* insn */ + idesc = emit_16 (current_cpu, pc + 2, insn & 0x7fff, + sc, 1, 0); + /* trap */ + emit_16 (current_cpu, pc, insn >> 16, sc + 1, 1, 0); + up_count = 2; + } + else + { + /* Yep. Here's the "interesting" [sic] part. */ + idesc = emit_parallel (current_cpu, pc, insn, sc, 1); + up_count = 3; + } + sc += up_count; + max_insns -= up_count; icount += 2; pc += 4; if (IDESC_CTI_P (idesc)) { - SET_CTI_VPC (sc - 3); + SET_CTI_VPC (sc - up_count); break; } } @@ -375,18 +394,51 @@ cat <<EOF Only emit before/after handlers if necessary. */ if (trace_p || profile_p) { - idesc = emit_full_parallel (current_cpu, pc, insn, sc, - trace_p, profile_p); + if (((insn >> 16) & 0xfff0) == 0x10f0) + { + /* FIXME: No need to handle this sequentially if + system calls will be able to execute after second + insn in parallel. ( trap #num || insn ) */ + /* insn */ + idesc = emit_full16 (current_cpu, pc + 2, + insn & 0x7fff, sc, 0, 0); + /* trap */ + emit_full16 (current_cpu, pc, insn >> 16, sc + 3, + 0, 0); + } + else + { + idesc = emit_full_parallel (current_cpu, pc, insn, + sc, trace_p, profile_p); + } cti_sc = sc + 1; sc += 6; max_insns -= 6; } else { - idesc = emit_parallel (current_cpu, pc, insn, sc, 0); + int up_count; + + if (((insn >> 16) & 0xfff0) == 0x10f0) + { + /* FIXME: No need to handle this sequentially if + system calls will be able to execute after second + insn in parallel. ( trap #num || insn ) */ + /* insn */ + idesc = emit_16 (current_cpu, pc + 2, insn & 0x7fff, + sc, 0, 0); + /* trap */ + emit_16 (current_cpu, pc, insn >> 16, sc + 1, 0, 0); + up_count = 2; + } + else + { + idesc = emit_parallel (current_cpu, pc, insn, sc, 0); + up_count = 3; + } cti_sc = sc; - sc += 3; - max_insns -= 3; + sc += up_count; + max_insns -= up_count; } icount += 2; pc += 4; diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index dac646a..d4f94c3 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,8 @@ +2004-01-27 Andrew Cagney <cagney@redhat.com> + + * ppc-instructions: Update copyright. + (convert_to_integer): Add trailing ";" to label. + 2003-10-16 Michael Snyder <msnyder@redhat.com> * emul_netbsd.c: Only a comment may follow an #endif. diff --git a/sim/ppc/ppc-instructions b/sim/ppc/ppc-instructions index a930dc8..1991c49 100644 --- a/sim/ppc/ppc-instructions +++ b/sim/ppc/ppc-instructions @@ -1,7 +1,7 @@ # # This file is part of the program psim. # -# Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney +# Copyright 1994, 1995, 1996, 1997, 2003, 2004 Andrew Cagney # # -- # @@ -1281,7 +1281,7 @@ void::function::convert_to_integer:cpu *processor, unsigned_word cia, unsigned64 /* FPSCR[fprf] = undefined */ } /**/ - LABEL(Done): + LABEL(Done):; # extract out raw fields of a FP number diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index 9659f95..549e499 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,23 @@ +2004-02-02 Michael Snyder <msnyder@redhat.com> + + * gencode.c (movua.l): Set thislock to 0, not n. + +2004-02-12 Michael Snyder <msnyder@redhat.com> + + * gencode.c (table): Change from char to short. + (dumptable): Change generated table from char to short. + * interp.c (sh_jump_table, sh_dsp_table, ppi_table): char to short. + (init_dsp): Compute size of sh_dsp_table. + (sim_resume): Change jump_table from char to short. + +2004-01-27 Michael Snyder <msnyder@redhat.com> + + * gencode.c: (op tab): Some refs and defs fixes. + "fsrra" -> "fsrra <FREG_N>". + "sleep": replace array ref with array addr. + "trapa": ditto. + Comment and whitespace clean-ups. + 2004-01-07 Michael Snyder <msnyder@redhat.com> * gencode.c: Whitespace cleanup. diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c index 52e611f..3347591 100644 --- a/sim/sh/gencode.c +++ b/sim/sh/gencode.c @@ -4,7 +4,7 @@ Written by Steve Chamberlain of Cygnus Support. sac@cygnus.com - This file is part of SH sim + This file is part of SH sim. THIS SOFTWARE IS NOT COPYRIGHTED @@ -20,7 +20,7 @@ */ /* This program generates the opcode table for the assembler and - the simulator code + the simulator code. -t prints a pretty table for the assembler manual -s generates the simulator code jump table @@ -72,7 +72,7 @@ op tab[] = "R[n] = ult;", }, - { "0", "", "and #<imm>,R0", "11001001i8*1....", + { "0", "0", "and #<imm>,R0", "11001001i8*1....", "R0 &= i;", }, { "n", "nm", "and <REG_M>,<REG_N>", "0010nnnnmmmm1001", @@ -201,8 +201,8 @@ op tab[] = "SET_SR_T (0);", }, - { "", "nm", "div1 <REG_M>,<REG_N>", "0011nnnnmmmm0100", - "div1 (R, m, n/*, T*/);", + { "n", "nm", "div1 <REG_M>,<REG_N>", "0011nnnnmmmm0100", + "div1 (&R0, m, n/*, T*/);", }, { "", "nm", "dmuls.l <REG_M>,<REG_N>", "0011nnnnmmmm1101", @@ -287,7 +287,7 @@ op tab[] = /* sh2e */ { "", "", "fdiv <FREG_M>,<FREG_N>", "1111nnnnmmmm0011", "FP_OP (n, /, m);", - "/* FIXME: check for DP and (n & 1) == 0? */", + "/* FIXME: check for DP and (n & 1) == 0? */", }, /* sh4 */ @@ -309,13 +309,13 @@ op tab[] = /* sh2e */ { "", "", "fldi0 <FREG_N>", "1111nnnn10001101", "SET_FR (n, (float) 0.0);", - "/* FIXME: check for DP and (n & 1) == 0? */", + "/* FIXME: check for DP and (n & 1) == 0? */", }, /* sh2e */ { "", "", "fldi1 <FREG_N>", "1111nnnn10011101", "SET_FR (n, (float) 1.0);", - "/* FIXME: check for DP and (n & 1) == 0? */", + "/* FIXME: check for DP and (n & 1) == 0? */", }, /* sh2e */ @@ -443,7 +443,8 @@ op tab[] = "}", }, - /* sh4: See fmov instructions above for move to/from extended fp registers */ + /* sh4: + See fmov instructions above for move to/from extended fp registers. */ /* sh2e */ { "", "", "fmul <FREG_M>,<FREG_N>", "1111nnnnmmmm0010", @@ -490,7 +491,7 @@ op tab[] = }, /* sh4 */ - { "", "", "fsrra", "1111nnnn01111101", + { "", "", "fsrra <FREG_N>", "1111nnnn01111101", "if (FPSCR_PR)", " RAISE_EXCEPTION (SIGILL);", "else", @@ -662,11 +663,11 @@ op tab[] = }, { "nm", "nm", "mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111", - "macl (&R0,memory,n,m);", + "macl (&R0, memory, n, m);", }, { "nm", "nm", "mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111", - "macw (&R0,memory,n,m,endianw);", + "macw (&R0, memory, n, m, endianw);", }, { "n", "", "mov #<imm>,<REG_N>", "1110nnnni8*1....", @@ -840,7 +841,7 @@ op tab[] = "WLAT (R[n], R[0]);", }, - { "n", "0", "movco.l R0, @<REG_N>", "0000nnnn01110011", + { "", "n0", "movco.l R0, @<REG_N>", "0000nnnn01110011", "/* LDST -> T */", "SET_SR_T (LDST);", "/* if (T) R0 -> (Rn) */", @@ -868,7 +869,7 @@ op tab[] = "MA (1);", "R[0] = (RBAT (regn) << 24) + (RBAT (regn + 1) << 16) + ", " (RBAT (regn + 2) << 8) + RBAT (regn + 3);", - "L (n);", + "L (0);", }, { "0n", "n", "movua.l @<REG_N>+,R0", "0100nnnn11101001", "int regn = R[n];", @@ -876,7 +877,7 @@ op tab[] = "R[0] = (RBAT (regn) << 24) + (RBAT (regn + 1) << 16) + ", " (RBAT (regn + 2) << 8) + RBAT (regn + 3);", "R[n] += 4;", - "L (n);", + "L (0);", }, { "", "mn", "mul.l <REG_M>,<REG_N>", "0000nnnnmmmm0111", "MACL = ((int) R[n]) * ((int) R[m]);", @@ -1101,7 +1102,7 @@ op tab[] = }, { "", "", "sleep", "0000000000011011", - "nip += trap (0xc3, R0, PC, memory, maskl, maskw, endianw);", + "nip += trap (0xc3, &R0, PC, memory, maskl, maskw, endianw);", }, { "n", "", "stc <CREG_M>,<REG_N>", "0000nnnnmmmm0010", @@ -1192,7 +1193,7 @@ op tab[] = { "0", "", "trapa #<imm>", "11000011i8*1....", "long imm = 0xff & i;", "if (i < 20 || i == 33 || i == 34 || i == 0xc3)", - " nip += trap (i, R, PC, memory, maskl, maskw,endianw);", + " nip += trap (i, &R0, PC, memory, maskl, maskw, endianw);", #if 0 "else {", /* SH-[12] */ @@ -1242,10 +1243,10 @@ op tab[] = #if 0 { "divs.l <REG_M>,<REG_N>", "0100nnnnmmmm1110", - "divl (0,R[n],R[m]);", + "divl (0, R[n], R[m]);", }, { "divu.l <REG_M>,<REG_N>", "0100nnnnmmmm1101", - "divl (0,R[n],R[m]);", + "divl (0, R[n], R[m]);", }, #endif @@ -2262,11 +2263,9 @@ gengastab () { printf ("%s %-30s\n", p->code, p->name); } - - } -static unsigned char table[1 << 16]; +static unsigned short table[1 << 16]; /* Take an opcode, expand all varying fields in it out and fill all the right entries in 'table' with the opcode index. */ @@ -2395,7 +2394,7 @@ expand_opcode (val, i, s) } /* Print the jump table used to index an opcode into a switch - statement entry. */ + statement entry. */ static void dumptable (name, size, start) @@ -2408,7 +2407,7 @@ dumptable (name, size, start) int i = start; - printf ("unsigned char %s[%d]={\n", name, size); + printf ("unsigned short %s[%d]={\n", name, size); while (i < start + size) { int j = 0; @@ -2643,7 +2642,7 @@ gensim_caselist (p) printf (" TL (n);\n"); { - /* Do the refs */ + /* Do the refs. */ char *r; for (r = p->refs; *r; r++) { @@ -2666,7 +2665,7 @@ gensim_caselist (p) printf (" }\n"); { - /* Do the defs */ + /* Do the defs. */ char *r; for (r = p->defs; *r; r++) { @@ -2975,12 +2974,12 @@ main (ac, av) int ac; char **av; { - /* verify the table before anything else */ + /* Verify the table before anything else. */ { op *p; for (p = tab; p->name; p++) { - /* check that the code field contains 16 bits */ + /* Check that the code field contains 16 bits. */ if (strlen (p->code) != 16) { fprintf (stderr, "Code `%s' length wrong (%d) for `%s'\n", @@ -2990,7 +2989,7 @@ main (ac, av) } } - /* now generate the requested data */ + /* Now generate the requested data. */ if (ac > 1) { if (strcmp (av[1], "-t") == 0) diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 9810678..b7c7779 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -53,7 +53,7 @@ #define SIGTRAP 5 #endif -extern unsigned char sh_jump_table[], sh_dsp_table[0x1000], ppi_table[]; +extern unsigned short sh_jump_table[], sh_dsp_table[0x1000], ppi_table[]; int sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size); @@ -1646,7 +1646,7 @@ init_dsp (abfd) { int i, tmp; - for (i = sizeof sh_dsp_table - 1; i >= 0; i--) + for (i = (sizeof sh_dsp_table / sizeof sh_dsp_table[0]) - 1; i >= 0; i--) { tmp = sh_jump_table[0xf000 + i]; sh_jump_table[0xf000 + i] = sh_dsp_table[i]; @@ -1752,7 +1752,7 @@ sim_resume (sd, step, siggnal) void (*prev) (); void (*prev_fpe) (); - register unsigned char *jump_table = sh_jump_table; + register unsigned short *jump_table = sh_jump_table; register int *R = &(saved_state.asregs.regs[0]); /*register int T;*/ diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog index cbd36e3..4e7b230 100644 --- a/sim/testsuite/ChangeLog +++ b/sim/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2004-01-26 Chris Demetriou <cgd@broadcom.com> + + * sim/mips: New directory. Tests for the MIPS simulator. + +2004-01-23 Ben Elliston <bje@wasabisystems.com> + + * lib/sim-defs.exp (run_sim_test): Delete the .o and .x files if a + test passes. + 2003-10-10 Dave Brolley <brolley@redhat.com> * sim/frv/testutils.inc (or_gr_immed): New macro. diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 017fcef..e755717 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -289,6 +289,7 @@ proc run_sim_test { name requested_machs } { if { "$opts(xerror)" == "no" } { if [string match $opts(output) $output] { pass "$mach $testname" + file delete ${name}.o ${name}.x } else { verbose -log "output: $output" 3 verbose -log "pattern: $opts(output)" 3 @@ -304,6 +305,7 @@ proc run_sim_test { name requested_machs } { } else { if [string match $opts(output) $output] { pass "$mach $testname" + file delete ${name}.o ${name}.x } else { verbose -log "output: $output" 3 verbose -log "pattern: $opts(output)" 3 diff --git a/sim/testsuite/sim/mips/ChangeLog b/sim/testsuite/sim/mips/ChangeLog new file mode 100644 index 0000000..67e7bfa --- /dev/null +++ b/sim/testsuite/sim/mips/ChangeLog @@ -0,0 +1,5 @@ +2004-01-26 Chris Demetriou <cgd@broadcom.com> + + * basic.exp: New file. + * testutils.inc: New file. + * sanity.s: New file. diff --git a/sim/testsuite/sim/mips/basic.exp b/sim/testsuite/sim/mips/basic.exp new file mode 100644 index 0000000..63dc086 --- /dev/null +++ b/sim/testsuite/sim/mips/basic.exp @@ -0,0 +1,26 @@ +# MIPS simulator instruction tests + +# As gross as it is, we unset the linker script specifid by the target +# board. The MIPS libgloss linker scripts include libgcc (and possibly +# other libraries), which the linker (used to link these tests rather +# than the compiler) can't necessarily find. +unset_currtarget_info ldscript + +# Only test mips*-elf (e.g., no mips-linux), and only test if the target +# board really is a simulator (sim tests don't work on real HW). +if {[istarget mips*-elf] && [board_info target exists is_simulator]} { + + if {[istarget mipsisa64*-elf]} { + set models "mips1 mips2 mips3 mips4 mips32 mips64" + } elseif {[istarget mipsisa32*-elf]} { + set models "mips1 mips2 mips32" + } elseif {[istarget mips64*-elf]} { + set models "mips1 mips2 mips3" + } else { + # fall back to just testing mips1 code. + set models "mips1" + } + set cpu_option -march + + run_sim_test sanity.s $models +} diff --git a/sim/testsuite/sim/mips/sanity.s b/sim/testsuite/sim/mips/sanity.s new file mode 100644 index 0000000..74551ed --- /dev/null +++ b/sim/testsuite/sim/mips/sanity.s @@ -0,0 +1,20 @@ +# mips test sanity, expected to pass. +# mach: all +# as: -mabi=eabi +# ld: -N -Ttext=0x80010000 +# output: *\\npass\\n + + .include "testutils.inc" + + setup + + .set noreorder + + .ent DIAG +DIAG: + + writemsg "Sanity is good!" + + pass + + .end DIAG diff --git a/sim/testsuite/sim/mips/testutils.inc b/sim/testsuite/sim/mips/testutils.inc new file mode 100644 index 0000000..f111f79 --- /dev/null +++ b/sim/testsuite/sim/mips/testutils.inc @@ -0,0 +1,149 @@ +# MIPS simulator testsuite utility functions. +# Copyright (C) 2004 Free Software Foundation, Inc. +# Contributed by Chris Demetriou of Broadcom Corporation. +# +# This file is part of the GNU simulators. +# +# 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, 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. */ + + +# $1, $4, $5, %6, are used as temps by the macros defined here. + + .macro writemsg msg + .data +901: .ascii "\msg\n" +902: + .previous + la $5, 901b + li $6, 902b - 901b + .set push + .set noreorder + jal _dowrite + li $4, 0 + .set pop + .endm + + + # The MIPS simulator uses "break 0x3ff" as the code to exit, + # with the return value in $4 (a0). + .macro exit rc + li $4, \rc + break 0x3ff + .endm + + + .macro setup + + .global _start + .ent _start +_start: + .set push + .set noreorder + j DIAG + nop + .set pop + .end _start + + .global _fail + .ent _fail +_fail: + writemsg "fail" + exit 1 + .end _fail + + .global _pass + .ent _pass +_pass: + writemsg "pass" + exit 0 + .end _pass + + # The MIPS simulator can use multiple different monitor types, + # so we hard-code the simulator "write" reserved instruction opcode, + # rather than jumping to a vector that invokes it. The operation + # expects RA to point to the location at which to continue + # after writing. + .global _dowrite + .ent _dowrite +_dowrite: + # Write opcode (reserved instruction). See sim_monitor and its + # callers in sim/mips/interp.c. + .word 0x00000005 | ((8 << 1) << 6) + .end _dowrite + + .endm # setup + + + .macro pass + .set push + .set noreorder + j _pass + nop + .set pop + .endm + + + .macro fail + .set push + .set noreorder + j _fail + nop + .set pop + .endm + + + .macro load32 reg, val + li \reg, \val + .endm + + + .macro load64 reg, val + dli \reg, \val + .endm + + + .macro loadaddr reg, addr + la \reg, \addr + .endm + + + .macro checkreg reg, expreg + .set push + .set noat + .set noreorder + beq \expreg, \reg, 901f + nop + fail +901: + .set pop + .endm + + + .macro check32 reg, val + .set push + .set noat + load32 $1, \val + checkreg \reg, $1 + .set pop + .endm + + + .macro check64 reg, val + .set push + .set noat + load64 $1, \val + checkreg \reg, $1 + .set pop + .endm diff --git a/sim/testsuite/sim/sh/ChangeLog b/sim/testsuite/sim/sh/ChangeLog index ed3f5ba..e3fecbd 100644 --- a/sim/testsuite/sim/sh/ChangeLog +++ b/sim/testsuite/sim/sh/ChangeLog @@ -1,3 +1,9 @@ +2004-02-12 Michael Snyder <msnyder@redhat.com> + + * and.s, movi.s, sett.s: New files. + * allinsn.exp: Add new tests. + * testutils.inc (set_sr_bit): Fix macro labels. + 2004-01-07 Michael Snyder <msnyder@redhat.com> * dmxy.s, fipr.s, fpchg.s, ldrc.s, loop.s, movli.s, movua.s, diff --git a/sim/testsuite/sim/sh/allinsn.exp b/sim/testsuite/sim/sh/allinsn.exp index 23a53db..0ec39f5 100644 --- a/sim/testsuite/sim/sh/allinsn.exp +++ b/sim/testsuite/sim/sh/allinsn.exp @@ -4,6 +4,7 @@ set all "sh shdsp" if [istarget sh-*elf] { run_sim_test add.s $all + run_sim_test and.s $all run_sim_test dmxy.s shdsp run_sim_test fabs.s sh run_sim_test fadd.s sh @@ -31,6 +32,7 @@ if [istarget sh-*elf] { run_sim_test loop.s shdsp run_sim_test macl.s sh run_sim_test macw.s sh + run_sim_test movi.s $all run_sim_test movli.s $all run_sim_test movua.s $all run_sim_test movxy.s shdsp @@ -50,6 +52,7 @@ if [istarget sh-*elf] { run_sim_test pshlr.s shdsp run_sim_test psub.s shdsp run_sim_test pswap.s shdsp + run_sim_test sett.s $all run_sim_test shll.s $all run_sim_test shll2.s $all run_sim_test shll8.s $all diff --git a/sim/testsuite/sim/sh/and.s b/sim/testsuite/sim/sh/and.s new file mode 100644 index 0000000..0093447 --- /dev/null +++ b/sim/testsuite/sim/sh/and.s @@ -0,0 +1,89 @@ +# sh testcase for and +# mach: all +# as(sh): -defsym sim_cpu=0 +# as(shdsp): -defsym sim_cpu=1 -dsp + + .include "testutils.inc" + + .align 2 +_x: .long 0xa5a5a5a5 +_y: .long 0x55555555 + + start + +and_reg_reg_direct: + set_grs_a5a5 + mov.l i, r1 + mov.l j, r2 + and r1, r2 + test_gr0_a5a5 + assertreg 0xa5a5a5a5 r1 + assertreg 0xa0a0a0a0 r2 + test_gr_a5a5 r3 + test_gr_a5a5 r4 + test_gr_a5a5 r5 + test_gr_a5a5 r6 + test_gr_a5a5 r7 + test_gr_a5a5 r8 + test_gr_a5a5 r9 + test_gr_a5a5 r10 + test_gr_a5a5 r11 + test_gr_a5a5 r12 + test_gr_a5a5 r13 + test_gr_a5a5 r14 + bra and_imm_reg + nop + + .align 2 +i: .long 0xa5a5a5a5 +j: .long 0xaaaaaaaa + +and_imm_reg: + set_grs_a5a5 + and #0xff, r0 + assertreg 0xa5, r0 + test_gr_a5a5 r1 + test_gr_a5a5 r2 + test_gr_a5a5 r3 + test_gr_a5a5 r4 + test_gr_a5a5 r5 + test_gr_a5a5 r6 + test_gr_a5a5 r7 + test_gr_a5a5 r8 + test_gr_a5a5 r9 + test_gr_a5a5 r10 + test_gr_a5a5 r11 + test_gr_a5a5 r12 + test_gr_a5a5 r13 + test_gr_a5a5 r14 + +and_b_imm_ind: + set_grs_a5a5 + mov.l x, r0 + and.b #0x55, @(r0, GBR) + mov.l @r0, r0 + + assertreg 0xa5a5a505, r0 + test_gr_a5a5 r1 + test_gr_a5a5 r2 + test_gr_a5a5 r3 + test_gr_a5a5 r4 + test_gr_a5a5 r5 + test_gr_a5a5 r6 + test_gr_a5a5 r7 + test_gr_a5a5 r8 + test_gr_a5a5 r9 + test_gr_a5a5 r10 + test_gr_a5a5 r11 + test_gr_a5a5 r12 + test_gr_a5a5 r13 + test_gr_a5a5 r14 + + pass + + exit 0 + + .align 2 +x: .long _x +y: .long _y + diff --git a/sim/testsuite/sim/sh/movi.s b/sim/testsuite/sim/sh/movi.s new file mode 100644 index 0000000..b79f8d2 --- /dev/null +++ b/sim/testsuite/sim/sh/movi.s @@ -0,0 +1,35 @@ +# sh testcase for mov <#imm> +# mach: all +# as(sh): -defsym sim_cpu=0 +# as(shdsp): -defsym sim_cpu=1 -dsp + + .include "testutils.inc" + + start + +mov_i_reg: # Test <imm8> + set_grs_a5a5 + mov #-0x55, r1 + + assertreg 0xffffffab, r1 + + test_gr_a5a5 r0 + test_gr_a5a5 r2 + test_gr_a5a5 r3 + test_gr_a5a5 r4 + test_gr_a5a5 r5 + test_gr_a5a5 r6 + test_gr_a5a5 r7 + test_gr_a5a5 r8 + test_gr_a5a5 r9 + test_gr_a5a5 r10 + test_gr_a5a5 r11 + test_gr_a5a5 r12 + test_gr_a5a5 r13 + test_gr_a5a5 r14 + + pass + + exit 0 + + diff --git a/sim/testsuite/sim/sh/sett.s b/sim/testsuite/sim/sh/sett.s new file mode 100644 index 0000000..fff2d2d --- /dev/null +++ b/sim/testsuite/sim/sh/sett.s @@ -0,0 +1,65 @@ +# sh testcase for sett, clrt, movt +# mach: all +# as(sh): -defsym sim_cpu=0 +# as(shdsp): -defsym sim_cpu=1 -dsp + + .include "testutils.inc" + + start +sett_1: set_grs_a5a5 + sett + bt .Lsett + nop + fail +.Lsett: + test_grs_a5a5 + +clrt_1: set_grs_a5a5 + clrt + bf .Lclrt + nop + fail +.Lclrt: + test_grs_a5a5 + +movt_1: set_grs_a5a5 + sett + movt r1 + test_gr_a5a5 r0 + assertreg 1, r1 + test_gr_a5a5 r2 + test_gr_a5a5 r3 + test_gr_a5a5 r4 + test_gr_a5a5 r5 + test_gr_a5a5 r6 + test_gr_a5a5 r7 + test_gr_a5a5 r8 + test_gr_a5a5 r9 + test_gr_a5a5 r10 + test_gr_a5a5 r11 + test_gr_a5a5 r12 + test_gr_a5a5 r13 + test_gr_a5a5 r14 + +movt_2: set_grs_a5a5 + clrt + movt r1 + test_gr_a5a5 r0 + assertreg 0, r1 + test_gr_a5a5 r2 + test_gr_a5a5 r3 + test_gr_a5a5 r4 + test_gr_a5a5 r5 + test_gr_a5a5 r6 + test_gr_a5a5 r7 + test_gr_a5a5 r8 + test_gr_a5a5 r9 + test_gr_a5a5 r10 + test_gr_a5a5 r11 + test_gr_a5a5 r12 + test_gr_a5a5 r13 + test_gr_a5a5 r14 + + pass + + exit 0 diff --git a/sim/testsuite/sim/sh/testutils.inc b/sim/testsuite/sim/sh/testutils.inc index 736934c..8d3895e 100644 --- a/sim/testsuite/sim/sh/testutils.inc +++ b/sim/testsuite/sim/sh/testutils.inc @@ -485,9 +485,9 @@ set_greg\@: bra .Lsrbit\@ nop .align 2 -.Lsrbitval: +.Lsrbitval\@: .long \val -.Lsrbit: +.Lsrbit\@: .endm .macro test_sr_bit_set val @@ -559,7 +559,7 @@ set_greg\@: .macro set_creg val reg - # + # [gbr, vbr, ssr, spc, sgr, dbr... ] push r0 mov.l .Lscrval\@, r0 ldc r0, \reg |